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