2 # autoreconf - remake all Autoconf configure scripts in a directory tree
3 # Copyright (C) 1994 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 Usage: autoreconf [-f] [-h] [--help] [-m dir] [--macrodir=dir]
21 [-l dir] [--localdir=dir] [--force] [--verbose] [--version]"
28 test -z "$AC_MACRODIR" && AC_MACRODIR
=@datadir@
30 while test $# -gt 0; do
33 echo "$usage"; exit 0 ;;
34 --localdir=* |
--l*=* )
35 localdir
="`echo \"${1}\" | sed -e 's/^[^=]*=//'`"
37 -l |
--localdir |
--l*)
39 test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
42 --macrodir=* |
--m*=* )
43 AC_MACRODIR
="`echo \"$1\" | sed -e 's/^[^=]*=//'`"
45 -m |
--macrodir |
--m*)
47 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
55 show_version
=yes; shift ;;
56 --) # Stop option processing.
58 -*) echo "$usage" 1>&2; exit 1 ;;
63 if test $show_version = yes; then
64 version
=`sed -n 's/define.AC_ACVERSION.[ ]*\([0-9.]*\).*/\1/p' \
65 $AC_MACRODIR/acgeneral.m4`
66 echo "Autoconf version $version"
70 if test $# -ne 0; then
71 echo "$usage" 1>&2; exit 1
74 top_autoconf
=`echo $0|sed s%autoreconf%autoconf%`
75 top_autoheader
=`echo $0|sed s%autoreconf%autoheader%`
77 # The xargs grep filters out Cygnus configure.in files.
78 find .
-name configure.
in -print |
79 xargs grep -l AC_OUTPUT |
80 sed 's%/configure\.in$%%; s%^./%%' |
87 *) # A "../" for each directory in /$dir.
88 dots
=`echo /$dir|sed 's%/[^/]*%../%g'` ;;
92 /*) autoconf
=$top_autoconf; autoheader
=$top_autoheader ;;
93 */*) autoconf
=$dots$top_autoconf; autoheader
=$dots$top_autoheader ;;
94 *) autoconf
=$top_autoconf; autoheader
=$top_autoheader ;;
97 case "$AC_MACRODIR" in
98 /*) macrodir_opt
="--macrodir=$AC_MACRODIR" ;;
99 *) macrodir_opt
="--macrodir=$dots$AC_MACRODIR" ;;
104 aclocal
=aclocal.
m4 ;;
105 /*) localdir_opt
="--localdir=$localdir"
106 aclocal
=$localdir/aclocal.
m4 ;;
107 *) localdir_opt
="--localdir=$dots$localdir"
108 aclocal
=$dots$localdir/aclocal.
m4 ;;
111 test ! -f $aclocal && aclocal
=
113 if test $force = no
&& test -f configure
&&
114 ls -lt configure configure.
in $aclocal |
sed 1q |
115 grep 'configure$' > /dev
/null
119 test $verbose = yes && echo running autoconf
in $dir
120 $autoconf $macrodir_opt $localdir_opt
123 if grep AC_CONFIG_HEADER configure.
in >/dev
/null
; then
124 template
=`sed -n '/AC_CONFIG_HEADER/{
125 s%[^#]*AC_CONFIG_HEADER(\([^)]*\).*%\1%
135 if test ! -f $template ||
grep autoheader
$template >/dev
/null
; then
136 if test $force = no
&& test -f $template &&
137 ls -lt $template configure.
in $aclocal |
sed 1q |
138 grep "$template$" > /dev
/null
142 test $verbose = yes && echo running autoheader
in $dir
143 $autoheader $macrodir_opt $localdir_opt