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
329
330
331
332
333
334
|
#! @SHELL@
# -*- shell-script -*-
# autoreconf - remake all Autoconf configure scripts in a directory tree
# Copyright 2010,2023 Thomas E. Dickey
# Copyright 1994, 1999, 2000 Free Software Foundation, Inc.
# 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; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
me=`echo "$0" | sed -e 's,.*[\\/],,'`
usage="\
Usage: $0 [OPTION] ... [TEMPLATE-FILE]
Run \`autoconf' and \`autoheader' where appropriate) repeatedly to
remake the Autoconf \`configure' scripts and configuration header
templates in the directory tree rooted at the current directory.
By default, it only remakes those files that are older than their
predecessors. If you install a new version of Autoconf, running
\`autoreconf' remakes all of the files by giving it the \`--force'
option.
Operation modes:
-h, --help print this help, then exit
-V, --version print version number, then exit
-v, --verbose verbosely report processing
-d, --debug don't remove temporary files
-f, --force consider every files are obsolete
-i, --install copy missing auxiliary files
-s, --symlink instead of copying, install symbolic links
The option \`--install' is similar to the option \`--add-missing' in
other tools.
Library directories:
-A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed)
-l, --localdir=DIR location of \`aclocal.m4' and \`acconfig.h'
-M, --m4dir=M4DIR this package's Autoconf extensions
Unless specified, heuristics try to compute \`M4DIR' from the \`Makefile.am',
or defaults to \`m4' if it exists.
The environment variables AUTOCONF and AUTOHEADER are honored.
Report bugs to <@PACKAGE_BUGREPORT@>."
version="\
autoreconf (@PACKAGE_NAME@) @VERSION@
Written by David J. MacKenzie.
Copyright 1994, 1999, 2000 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="\
Try \`$me --help' for more information."
exit_missing_arg="\
echo \"$me: option \\\`\$1' requires an argument\" >&2
echo \"\$help\" >&2
exit 1"
# NLS nuisances.
# Only set these to C if already set. These must not be set unconditionally
# because not all systems understand e.g. LANG=C (notably SCO).
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
# Non-C LC_CTYPE values break the ctype check.
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
# Variables.
: ${autoconf_dir=${AC_MACRODIR=@datadir@}}
debug=false
dir=`echo "$0" | sed -e 's,[^\\/]*$,,'`
force=false
# --install -- as --add-missing in other tools.
install=false
localdir=.
# m4dir -- local Autoconf extensions. Typically `m4'.
m4dir=
status=0
# symlink -- when --install, use symlinks instead.
symlink=false
verbose=:
# Looking for autoconf.
# We test "$dir/autoconf" in case we are in the build tree, in which case
# the names are not transformed yet.
for autoconf in "$AUTOCONF" \
"$dir/@autoconf-name@" \
"$dir/autoconf" \
"@bindir@/@autoconf-name@"; do
test -f "$autoconf" && break
done
# Looking for autoheader.
for autoheader in "$AUTOHEADER" \
"$dir/@autoheader-name@" \
"$dir/autoheader" \
"@bindir@/@autoheader-name@"; do
test -f "$autoheader" && break
done
# Parse command line.
while test $# -gt 0; do
optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
"x$1" : 'x-.\(.*\)'`
case "$1" in
--version | -V )
echo "$version" ; exit 0 ;;
--help | -h )
echo "$usage"; exit 0 ;;
--verbose | -v )
verbose=echo
shift;;
--debug | -d )
debug=:; shift ;;
--localdir=* | -l?* )
localdir=$optarg
shift ;;
--localdir | -l )
test $# = 1 && eval "$exit_missing_arg"
shift
localdir=$1
shift ;;
--autoconf-dir=* | -A?* )
autoconf_dir=$optarg
shift ;;
--autoconf-dir | -A )
test $# = 1 && eval "$exit_missing_arg"
shift
autoconf_dir=$1
shift ;;
--macrodir=* | -m?* )
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
autoconf_dir=$optarg
shift ;;
--macrodir | -m )
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
test $# = 1 && eval "$exit_missing_arg"
shift
autoconf_dir=$1
shift ;;
--m4dir=* | -M?* )
m4dir=$optarg
shift ;;
--m4dir | -M )
test $# = 1 && eval "$exit_missing_arg"
shift
m4dir=$1
shift ;;
--force | -f )
force=:; shift ;;
--install | -i )
install=:; shift ;;
--symlink | -s )
symlink=:; shift ;;
-- ) # Stop option processing.
shift; break ;;
-* )
exec >&2
echo "$me: invalid option $1"
echo "$help"
exit 1 ;;
* )
break ;;
esac
done
# Find the input file.
if test $# -ne 0; then
exec >&2
echo "$me: invalid number of arguments"
echo "$help"
exit 1
fi
# If verbose, say what you are going to use.
if test $verbose = echo; then
$autoconf --version |
sed "s,.*)\(.*\)$,$me: using autoconf\1: $autoconf,;1q" >&2
$autoheader --version |
sed "s,.*)\(.*\)$,$me: using autoheader\1: $autoheader,;1q" >&2
fi
# Dispatch autoreconf's option to the tools.
# --localdir
autoconf="$autoconf -l $localdir"
autoheader="$autoheader -l $localdir"
# --verbose
autoconf="$autoconf `$verbose --verbose`"
autoheader="$autoheader `$verbose --verbose`"
# --debug
$debug &&
{
autoconf="$autoconf --debug"
autoheader="$autoheader --debug"
}
# --macrodir
export autoconf_dir
# Trap on 0 to stop playing with `rm'.
$debug ||
{
trap 'status=$?; rm -rf $tmp && exit $status' 0
trap '(exit 1); exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
: ${TMPDIR=/tmp}
{
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/arXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=$TMPDIR/ar$$
(umask 077 && mkdir $tmp)
} ||
{
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
(exit 1); exit 1
}
# When debugging, it is convenient that all the related temporary
# files be at the same place.
TMPDIR=$tmp
export TMPDIR
# update.sh --
# Exit 0 if the first argument is not the most recent of all or is missing.
cat >$tmp/update.sh <<\EOF
test -f "$1" || { :; exit; }
test x`ls -1dt "$@" 2>/dev/null | sed 1q` != x"$1"
EOF
update="@SHELL@ $tmp/update.sh"
# ----------------------- #
# Real work starts here. #
# ----------------------- #
# Make a list of directories to process.
# The xargs grep filters out Cygnus configure.in files.
find . '(' -name configure.ac -o -name configure.in ')' -print |
xargs grep -l AC_INIT |
sed 's,/configure\.ac$,,;s,/configure\.in$,,;s,^./,,' |
while read dir; do
(
cd $dir || continue
# ------------------ #
# Running autoconf. #
# ------------------ #
if $force ||
$update configure configure.ac $localdir/aclocal.m4 ||
$update configure configure.in $localdir/aclocal.m4; then
$verbose $me: running $autoconf in $dir >&2
$autoconf
fi
# -------------------- #
# Running autoheader. #
# -------------------- #
# templates -- arguments of AC_CONFIG_HEADERS.
$verbose $me: running $autoconf -t 'AC_CONFIG_HEADERS:$1' >&2
templates=`$autoconf -t 'AC_CONFIG_HEADERS:$1'`
if test -n "$templates"; then
tcount=`set -- $templates; echo $#`
template=`set -- $templates; echo $1 | sed '
s/.*://
t colon
s/$/.in/
: colon
s/:.*//
'`
template_dir=`echo $template | sed -e 's,[\\/]*[^\\/]*$,,;s,^$,.,'`
stamp_num=`test "$tcount" -gt 1 && echo "$tcount"`
stamp=$template_dir/stamp-h$stamp_num.in
# If config.hin exists, don't override it unless it was really
# created by autoheader (users are allowed to write them by hand!).
uses_autoheader=false
grep autoheader "$template" >/dev/null 2>&1 &&
uses_autoheader=:
test -f "$template" ||
uses_autoheader=:
if $uses_autoheader &&
{ $force ||
$update $template \
configure.ac $localdir/aclocal.m4 $localdir/acconfig.h ||
$update $template \
configure.in $localdir/aclocal.m4 $localdir/acconfig.h ||
$update $stamp \
configure.ac $localdir/aclocal.m4 $localdir/acconfig.h ||
$update $stamp \
configure.in $localdir/aclocal.m4 $localdir/acconfig.h; } then
$verbose $me: running $autoheader in $dir >&2
$autoheader &&
$verbose "touching $stamp" >&2 &&
touch $stamp
fi
fi
)
done
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# End:
|