1993-06-17 04:15:11 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# autoconf -- create `configure' using m4 macros
|
1994-03-25 02:37:32 +08:00
|
|
|
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
|
1993-06-17 04:15:11 +08:00
|
|
|
|
|
|
|
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
# If given no args, create `configure' from template file `configure.in'.
|
|
|
|
# With one arg, create a configure script on standard output from
|
|
|
|
# the given template file.
|
|
|
|
|
1994-05-05 01:34:32 +08:00
|
|
|
usage="\
|
1994-08-01 21:44:22 +08:00
|
|
|
Usage: autoconf [-hv] [--help] [-m dir] [--macrodir=dir]
|
|
|
|
[--version] [template-file]"
|
1993-06-17 04:15:11 +08:00
|
|
|
|
1993-06-25 03:57:01 +08:00
|
|
|
# NLS nuisances.
|
1994-05-04 22:44:23 +08:00
|
|
|
# Only set `LANG' and `LC_ALL' to "C" if already set.
|
1993-06-25 03:57:01 +08:00
|
|
|
# These must not be set unconditionally because not all systems understand
|
|
|
|
# e.g. LANG=C (notably SCO).
|
1994-05-05 23:49:35 +08:00
|
|
|
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
|
|
|
|
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
|
1993-06-25 03:57:01 +08:00
|
|
|
|
1993-06-17 04:15:11 +08:00
|
|
|
test -z "${AC_MACRODIR}" && AC_MACRODIR=@datadir@
|
|
|
|
test -z "${M4}" && M4=@M4@
|
1994-05-03 07:47:38 +08:00
|
|
|
case "${M4}" in
|
|
|
|
/*) # Handle the case that m4 has moved since we were configured.
|
|
|
|
# It may have been found originally in a build directory.
|
|
|
|
test -f "${M4}" || M4=m4 ;;
|
|
|
|
esac
|
1993-06-17 04:15:11 +08:00
|
|
|
|
1993-10-11 02:00:46 +08:00
|
|
|
tmpout=/tmp/acout.$$
|
1993-06-17 04:15:11 +08:00
|
|
|
print_version=
|
1994-08-01 21:44:22 +08:00
|
|
|
|
1993-06-17 04:15:11 +08:00
|
|
|
while test $# -gt 0 ; do
|
1994-07-19 22:44:16 +08:00
|
|
|
case "${1}" in
|
|
|
|
-h | --help | --h* )
|
1994-03-18 10:55:23 +08:00
|
|
|
echo "${usage}" 1>&2; exit 0 ;;
|
1994-07-19 22:44:16 +08:00
|
|
|
--macrodir=* | --m*=* )
|
1993-06-17 04:15:11 +08:00
|
|
|
AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`"
|
|
|
|
shift ;;
|
1994-07-19 22:44:16 +08:00
|
|
|
-m | --macrodir | --m* )
|
1993-06-17 04:15:11 +08:00
|
|
|
shift
|
|
|
|
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
|
|
|
AC_MACRODIR="${1}"
|
|
|
|
shift ;;
|
1994-07-19 22:44:16 +08:00
|
|
|
-v | --version | --v* )
|
1993-06-17 04:15:11 +08:00
|
|
|
print_version="-DAC_PRINT_VERSION"
|
1994-07-19 22:44:16 +08:00
|
|
|
infile=/dev/null
|
1993-06-17 04:15:11 +08:00
|
|
|
shift ;;
|
1994-07-19 22:44:16 +08:00
|
|
|
-- ) # Stop option processing
|
1993-06-17 04:15:11 +08:00
|
|
|
shift; break ;;
|
1994-07-19 22:44:16 +08:00
|
|
|
- ) # Use stdin as input.
|
1993-06-17 04:15:11 +08:00
|
|
|
break ;;
|
1994-07-19 22:44:16 +08:00
|
|
|
-* )
|
1993-06-17 04:15:11 +08:00
|
|
|
echo "${usage}" 1>&2; exit 1 ;;
|
|
|
|
* )
|
|
|
|
break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
1993-10-11 02:00:46 +08:00
|
|
|
if test -z "$print_version"; then
|
|
|
|
case $# in
|
|
|
|
0) infile=configure.in ;;
|
|
|
|
1) infile="$1" ;;
|
|
|
|
*) echo "$usage" >&2; exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
1994-03-25 02:37:32 +08:00
|
|
|
trap 'rm -f $tmpin $tmpout; exit 1' 1 2 15
|
|
|
|
|
1993-10-11 02:00:46 +08:00
|
|
|
if test z$infile = z-; then
|
1994-03-25 02:37:32 +08:00
|
|
|
tmpin=/tmp/acin.$$
|
|
|
|
infile=$tmpin
|
1993-10-11 02:00:46 +08:00
|
|
|
cat > $infile
|
1994-07-19 22:44:16 +08:00
|
|
|
elif test ! -r "${infile}"; then
|
1993-10-11 02:00:46 +08:00
|
|
|
echo "autoconf: ${infile}: No such file or directory" >&2
|
|
|
|
exit 1
|
1993-06-17 04:15:11 +08:00
|
|
|
fi
|
1993-10-11 02:00:46 +08:00
|
|
|
fi
|
1993-06-17 04:15:11 +08:00
|
|
|
|
1994-08-31 02:42:54 +08:00
|
|
|
# Use the frozen version of Autoconf if available.
|
|
|
|
r= f=
|
|
|
|
# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
|
|
|
|
case `$M4 --help < /dev/null 2>&1` in
|
|
|
|
*reload-state*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;;
|
|
|
|
*traditional*) ;;
|
|
|
|
*) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
$M4 -I$AC_MACRODIR $print_version $r autoconf.m4$f $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
|
1993-06-17 04:15:11 +08:00
|
|
|
|
1994-07-19 22:44:16 +08:00
|
|
|
if test -n "$print_version"; then
|
|
|
|
cat $tmpout
|
|
|
|
rm -f $tmpout
|
|
|
|
exit 0
|
|
|
|
fi
|
1993-10-11 02:00:46 +08:00
|
|
|
|
1993-06-17 04:15:11 +08:00
|
|
|
# You could add your own prefixes to pattern if you wanted to check for
|
|
|
|
# them too, e.g. pattern="AC_\|ILT_", except that UNIX sed doesn't do
|
1994-03-25 02:37:32 +08:00
|
|
|
# alternation.
|
1993-06-17 04:15:11 +08:00
|
|
|
pattern="AC_"
|
|
|
|
|
|
|
|
status=0
|
|
|
|
if grep "${pattern}" $tmpout > /dev/null 2>&1; then
|
|
|
|
echo "autoconf: Undefined macros:" >&2
|
|
|
|
grep "${pattern}" $tmpout | sed "s/.*\(${pattern}[_A-Z0-9]*\).*/\1/" |
|
|
|
|
while read name; do
|
|
|
|
grep -n $name $infile /dev/null
|
|
|
|
done | sort -u >&2
|
|
|
|
status=1
|
|
|
|
fi
|
|
|
|
|
1994-08-25 11:45:07 +08:00
|
|
|
if test $# -eq 0; then
|
|
|
|
exec > configure; chmod +x configure
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Put the real line numbers into configure to make config.log more helpful.
|
|
|
|
awk '
|
1994-08-27 15:01:13 +08:00
|
|
|
/__oline__/ { printf "%d:", NR + 1 }
|
1994-08-25 11:45:07 +08:00
|
|
|
{ print }
|
|
|
|
' $tmpout | sed '
|
1994-08-27 15:01:13 +08:00
|
|
|
/__oline__/s/^\([0-9][0-9]*\):\(.*\)__oline__\(.*\)$/\2\1\3/
|
1994-08-25 11:45:07 +08:00
|
|
|
'
|
1993-06-17 04:15:11 +08:00
|
|
|
|
|
|
|
rm -f $tmpout
|
|
|
|
exit $status
|