1# Configure script for bash debugger (bashdb) 2dnl Process this file with autoconf to produce a configure script. 3 4# Copyright (C) 2002-2012, 5# 2014-2019 Rocky Bernstein <rocky@gnu.org> 6 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2, or (at your option) 10# any later version. 11 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16 17# You should have received a copy of the GNU General Public License 18# along with this program; see the file COPYING. If not, write to the 19# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 20# MA 02110-1301 USA. 21 22define(DEBUGGER, bashdb) 23define(POSIXSHELL, bash) 24define(OK_BASH_VERS, 5.0) 25define(relstatus, 1.1.2) 26 27AC_INIT([bashdb], 28 [OK_BASH_VERS-relstatus], 29 [https://sourceforge.net/p/bashdb/bugs/new/]) 30 31dnl make sure we are using a recent autoconf version. 32dnl In particular we assume prefix will be set to "NONE" if --prefix 33dnl isn't given. Earlier autoconf' used "no" instead of "NONE". 34AC_PREREQ(2.69) 35 36################################################################## 37# See if --prefix was set. If not, set it to a reasonable default 38# based on where bash thinks bashdb is supposed to be installed. 39################################################################## 40AM_INIT_AUTOMAKE([foreign]) 41AM_MAINTAINER_MODE 42 43 44# List of output variables produced by this configure script 45# 46AC_SUBST(BASHVERS) 47AC_SUBST(RELSTATUS) 48 49AC_ARG_WITH(bashdb-main, AC_HELP_STRING([--with-bashdb-main], 50 [location of bashdb-main.inc]), 51 BASHDB_MAIN=$withval, 52 ${ac_default_prefix/prefix}/bashdb/bashdb-main.inc) 53AC_SUBST(BASHDB_MAIN) 54 55AC_SUBST(DIFF) 56AC_SUBST(DIFF_OPTS) 57AC_PATH_PROG(PERL, perl, false) 58AC_PROG_GREP 59AC_PROG_SED 60 61CMDLINE_INVOKED='$0 == ${BASH_SOURCE}' 62AC_SUBST(CMDLINE_INVOKED) 63 64AM_CONFIG_HEADER(config.h) 65AC_DEFINE([PACKAGE], [bashdb], [Bash Debugger]) 66AC_DEFINE([VERSION], [OK_BASH_VERS-relstatus], [version string]) 67 68AC_ARG_PROGRAM 69 70AC_BASHDB_PACKAGE([bashdb]) 71 72# Brought over from bash/configure.in to substitute OK_BASH_VERS 73# and RELSTATUS in bashdb.in and version.texi 74BASHVERS=OK_BASH_VERS 75RELSTATUS=relstatus 76 77 78AC_CONFIG_SRCDIR(DEBUGGER.in) 79if test x$ac_srcdir = x ; then 80 ac_srcdir=. 81fi 82 83AM_MISSING_PROG(GIT2CL, git2cl, $missing_dir) 84AC_PROG_LN_S 85AC_PATH_PROG(RM, rm, true) 86AC_PROG_MAKE_SET 87 88## --with-bash can be used to tell the bashdb script and the regression 89## test which bash to run. It can be omitted too in which case we'll 90## look for a bash binary. 91AC_ARG_WITH(POSIXSHELL, AC_HELP_STRING([--with-POSIXSHELL], 92 [location of POSIXSHELL program]), SH_PROG=$withval) 93 94if test "$SH_PROG" = "yes" || test "$SH_PROG" = "no" || test -z "$SH_PROG" 95then 96 bash_shell_dir=$(dirname $SHELL) 97 AC_PATH_PROG(SH_PROG, POSIXSHELL, no, PATH="$bash_shell_dir:$PATH") 98fi 99 100if test "$SH_PROG" = no; then 101 AC_MSG_ERROR([I didn't find the DEBUGGER executable.\ 102 You might want to use the --with-POSIXSHELL option.]) 103fi 104 105bash_version=`$SH_PROG --version` 106[bash_major=`$SH_PROG -c 'echo ${BASH_VERSINFO[0]}'`] 107[bash_minor=`$SH_PROG -c 'echo ${BASH_VERSINFO[1]}'`] 108bash_5_or_greater=no 109case "${bash_major}.${bash_minor}" in 110 'OK_BASH_VERS' | '5.0') 111 bash_5_or_greater=yes 112 ;; 113 *) 114 AC_MSG_WARN([You have Bash $bash_version installed.]) 115 AC_MSG_ERROR([This package is only known to work with Bash 5.0]) 116 ;; 117esac 118 119AC_ARG_WITH(dbg-main, AC_HELP_STRING([--with-dbg-main], 120 [location of dbg-main.sh]), 121 DBGR_MAIN=$withval) 122AC_SUBST(DBGR_MAIN) 123 124mydir=$(dirname $0) 125if test "$prefix" == NONE ; then 126 prefix=$($SH_PROG $mydir/compute-prefix.sh $SH_PROG) 127fi 128 129if test -z "$DBGR_MAIN" ; then 130 DBGR_MAIN=`strings $SH_PROG$EXEEXT | grep bashdb-main.inc` 131 if test -z "$DBGR_MAIN" ; then 132 AC_MSG_ERROR([I didn't find bashdb-main.inc in your bash. If you have the 133right version of bash, set it with the --with-dbg-main option]) 134 fi 135fi 136 137# Create a suitable transform ( without the $ -> $$ escaping added 138# because of $program_transform_name being used in a Makefile 139# This transform is needed because bashdb must be executed by the 140# bashdb-bash regardless if a program transform has taken place 141ac_transform=`echo "$program_transform_name" | sed 's/\\$\\$/\\$/g'` 142 143# Fully expanded name of bash executable to be substituted into 144# bashdb.This allow us to move this package into any suitable location 145# by using --prefix as an option to configure. 146AC_SUBST_DIR(INTERPRETER_NAME,"${bindir}/"`echo bash | sed "$ac_transform"`) 147 148# WARNING: The configure-correct name for architecture-independent 149# directory (the place for the bash source for the debugger) is 150# datadir. The automake file seem to want to use pkgdatadir instead. 151 152# I'm not sure how to get these to agree. 153 154# Also, I'd like to set the default to the name that's been coded 155# inside of the bash program rather than some autoconf standard; I 156# don't know how to change the autoconf default that which is 157# determined dynamically below. 158 159# Get the fully expanded name of pkgdatadir. This is used in bashdb.in 160# and dbg-main.sh.in and for installing debugger files. 161 162pkgdatadir=$datadir/DEBUGGER 163AC_SUBST_DIR(PKGDATADIR, $pkgdatadir) 164 165dnl We use a diff in regression testing 166AC_PATH_PROG(DIFF, diff, no) 167# FIXME: check that option -b (ignore-whitspace) works 168DIFF_OPTS=-b 169 170if test "$DIFF" = no ; then 171 AC_PATH_PROG(DIFF, cmp, no) 172else 173 dnl Try for GNU diff options. 174 # MSDOG output uses \r\n rather than \n in tests 175 for diff_opt in -w --unified -b ; do 176 if $DIFF $diff_opt $0 $0 > /dev/null 2>&1; then 177 AC_MSG_RESULT([adding $diff_opt to diff in regression tests]) 178 DIFF_OPTS="$DIFF_OPTS $diff_opt" 179 fi 180 done 181fi 182 183################################################################## 184# See if --prefix was set. If not, set it to a reasonable default 185# based on where bash thinks bashdb is supposed to be installed. 186################################################################## 187mydir=$(dirname $0) 188if [[ "$prefix" = NONE ]]; then 189 prefix=$($SH_PROG $mydir/compute-prefix.sh $SH_PROG) 190 ac_default_prefix=$prefix 191fi 192 193#Makefiles 194AC_CONFIG_FILES([ \ 195 Makefile \ 196 command/Makefile \ 197 command/info_sub/Makefile \ 198 command/set_sub/Makefile \ 199 command/show_sub/Makefile \ 200 data/Makefile \ 201 doc/Makefile \ 202 init/Makefile \ 203 lib/Makefile \ 204 test/Makefile \ 205 test/data/Makefile \ 206 test/example/Makefile \ 207 test/integration/Makefile \ 208 test/unit/Makefile \ 209 test/unit/require_me.sh \ 210 ]) 211 212# Additional files needing substitution of values (not Makefiles). 213AC_CONFIG_FILES([bashdb], [chmod +x DEBUGGER]) 214AC_CONFIG_FILES([test/example/bugIFS.sh], 215 [chmod +x test/example/bugIFS.sh]) 216AC_CONFIG_FILES([test/example/hanoi.sh], 217 [chmod +x test/example/hanoi.sh]) 218AC_CONFIG_FILES([test/example/interrupt.sh], 219 [chmod +x test/example/interrupt.sh]) 220AC_CONFIG_FILES([test/example/bug-args.sh], 221 [chmod +x test/example/bug-args.sh]) 222AC_CONFIG_FILES([test/unit/test-action.sh], 223 [chmod +x test/unit/test-action.sh]) 224AC_CONFIG_FILES([test/unit/test-alias.sh], 225 [chmod +x test/unit/test-alias.sh]) 226AC_CONFIG_FILES([test/unit/test-bashdb-trace.sh], 227 [chmod +x test/unit/test-bashdb-trace.sh]) 228AC_CONFIG_FILES([test/unit/test-break.sh], 229 [chmod +x test/unit/test-break.sh]) 230AC_CONFIG_FILES([test/unit/test-cmd-complete.sh], 231 [chmod +x test/unit/test-cmd-complete.sh]) 232AC_CONFIG_FILES([test/unit/test-cmd-info-variables.sh], 233 [chmod +x test/unit/test-cmd-info-variables.sh]) 234AC_CONFIG_FILES([test/unit/test-cmd-eval.sh], 235 [chmod +x test/unit/test-cmd-eval.sh]) 236AC_CONFIG_FILES([test/unit/test-columns.sh], 237 [chmod +x test/unit/test-columns.sh]) 238AC_CONFIG_FILES([test/unit/test-eval.sh], 239 [chmod +x test/unit/test-eval.sh]) 240AC_CONFIG_FILES([test/unit/test-file.sh], 241 [chmod +x test/unit/test-file.sh]) 242AC_CONFIG_FILES([test/unit/test-filecache.sh], 243 [chmod +x test/unit/test-filecache.sh]) 244AC_CONFIG_FILES([test/unit/test-get-sourceline.sh], 245 [chmod +x test/unit/test-get-sourceline.sh]) 246AC_CONFIG_FILES([test/unit/test-fns.sh], [chmod +x test/unit/test-fns.sh]) 247AC_CONFIG_FILES([test/unit/test-frame.sh], [chmod +x test/unit/test-frame.sh]) 248AC_CONFIG_FILES([test/unit/test-lib-eval.sh], 249 [chmod +x test/unit/test-lib-eval.sh]) 250AC_CONFIG_FILES([test/unit/test-lib-list.sh], 251 [chmod +x test/unit/test-lib-list.sh]) 252AC_CONFIG_FILES([test/unit/test-msg.sh], [chmod +x test/unit/test-msg.sh]) 253AC_CONFIG_FILES([test/unit/test-io.sh], [chmod +x test/unit/test-io.sh]) 254AC_CONFIG_FILES([test/unit/test-pre.sh], [chmod +x test/unit/test-pre.sh]) 255AC_CONFIG_FILES([test/unit/test-require.sh], 256 [chmod +x test/unit/test-require.sh]) 257AC_CONFIG_FILES([test/unit/test-run.sh], [chmod +x test/unit/test-run.sh]) 258AC_CONFIG_FILES([test/unit/test-save-restore.sh], 259 [chmod +x test/unit/test-save-restore.sh]) 260AC_CONFIG_FILES([test/unit/test-sort.sh], 261 [chmod +x test/unit/test-sort.sh]) 262AC_CONFIG_FILES([test/unit/test-validate.sh], 263 [chmod +x test/unit/test-validate.sh]) 264 265AC_CONFIG_FILES([test/integration/test-bash-rematch], 266 [chmod +x test/integration/test-bash-rematch]) 267AC_CONFIG_FILES([test/integration/test-bug-break], 268 [chmod +x test/integration/test-bug-break]) 269AC_CONFIG_FILES([test/integration/test-bug-step-subshell], 270 [chmod +x test/integration/test-bug-step-subshell]) 271AC_CONFIG_FILES([test/integration/test-complete], 272 [chmod +x test/integration/test-complete]) 273AC_CONFIG_FILES([test/integration/test-debug], 274 [chmod +x test/integration/test-debug]) 275AC_CONFIG_FILES([test/integration/test-delete], 276 [chmod +x test/integration/test-delete]) 277AC_CONFIG_FILES([test/integration/test-export], 278 [chmod +x test/integration/test-export]) 279AC_CONFIG_FILES([test/integration/test-file-with-spaces], 280 [chmod +x test/integration/test-file-with-spaces]) 281AC_CONFIG_FILES([test/integration/test-interrupt], 282 [chmod +x test/integration/test-interrupt]) 283AC_CONFIG_FILES([test/integration/test-misc], 284 [chmod +x test/integration/test-misc]) 285AC_CONFIG_FILES([test/integration/test-setshow], 286 [chmod +x test/integration/test-setshow]) 287AC_CONFIG_FILES([test/integration/test-info-args], 288 [chmod +x test/integration/test-info-args]) 289AC_CONFIG_FILES([test/integration/test-settrace], 290 [chmod +x test/integration/test-settrace]) 291AC_CONFIG_FILES([test/integration/test-sig], 292 [chmod +x test/integration/test-sig]) 293 294AC_CONFIG_FILES([ \ 295 bashdb-main.inc \ 296 bashdb-trace \ 297 doc/macros.texi \ 298 test/integration/check-common.sh \ 299 ]) 300 301AC_CONFIG_COMMANDS([default],[[ 302# Keep old dates on these files to prevent rebuilding. 303touch -cr $ac_srcdir/configure.ac doc/bashdb.1 304touch -cr $ac_srcdir/configure.ac doc/bashdb-man.html 305if test -e $ac_srcdir/doc/version-bashdb.texi ; then 306 echo timestamp > $ac_srcdir/doc/stamp-vti 307 touch -cr $ac_srcdir/configure.ac $ac_srcdir/doc/version-bashdb.texi \ 308 $ac_srcdir/doc/stamp-vti \ 309 $ac_srcdir/doc/bashdb.info* 310fi 311]],[[]]) 312 313AC_OUTPUT 314echo 315echo "=========================================================" 316echo "Bash version: $bash_version" 317echo "Location : $SH_PROG" 318echo "Prefix : $prefix" 319if $($SH_PROG $mydir/check-prefix.sh $SH_PROG $prefix); then 320 echo "prefix checks out" 321else 322 echo "Warning: prefix doesn't match what is in bash for 'bash --debugger ...' to work" 323fi 324 325if test x"$build_set0" != x; then 326 echo "We will try to build the set0 builtin to set variable \$0" 327 echo "using source located at ${BASH_SRC}." 328elif test "$bash_4_or_greater" = no ; then 329 echo 'We will not try to build the set $0 builtin.' 330fi 331