+2000-02-08 Akim Demaille <akim@epita.fr>
+
+ Clean up autoconf.
+
+ * autoconf.sh: Minor reorganizations to clearly separate the
+ prologue, which is almost common to all the shell scripts of
+ Autoconf, and the body.
+
2000-02-08 Akim Demaille <akim@epita.fr>
Improve support of name spaces in libm4. Put the m4 builtins
# would break.
ac_LF_and_DOT=`echo; echo .`
-: ${AC_MACRODIR=@datadir@}
-: ${AC_ACLOCALDIR=`aclocal --print-ac-dir 2>/dev/null`}
+# Find GNU m4.
+# Handle the case that m4 has moved since we were configured.
+# It may have been found originally in a build directory.
: ${M4=@M4@}
-: ${AWK=@AWK@}
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 ;;
+/*) test -f "$M4" || M4=m4 ;;
+esac
+# 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*);;
+*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
esac
+# Variables.
+: ${AC_MACRODIR=@datadir@}
+: ${AC_ACLOCALDIR=`aclocal --print-ac-dir 2>/dev/null`}
+: ${AWK=@AWK@}
localdir=
outfile=
# Tasks:
tmpout=$TMPDIR/acout.$$
verbose=:
+# Parse command line
while test $# -gt 0 ; do
case "$1" in
+ --version | --v* )
+ echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
--localdir=* | --l*=* )
task=trace
traces="$traces -t `echo \"$1\" | sed -e 's/^[^=]*=//'`"
shift ;;
- -t* )
- task=trace
- traces="$traces -t `echo \"$1\" | sed -e 's/^-t//'`"
- shift ;;
--output | -o )
shift
outfile="$1"
--output=* )
outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
shift ;;
- -o* )
- outfile=`echo "$1" | sed -e 's/^-o//'`
- shift ;;
- --version | --v* )
- echo "$version" ; exit 0 ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
esac
done
+# Running m4.
+if test -n "$localdir"; then
+ use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
+fi
+run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
+
+
case $# in
0) infile=configure.in
test $task = script && test "x$outfile" = x && outfile=configure;;
infile=$tmpin
cat >$infile
elif test ! -r "$infile"; then
- echo "autoconf: $infile: No such file or directory" >&2
+ echo "$me: $infile: No such file or directory" >&2
exit 1
fi
-if test -n "$localdir"; then
- use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
-else
- use_localdir=
-fi
-
-# 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*);;
-*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
-esac
-run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
-
# Output is produced into FD 4. Prepare it.
case "x$outfile" in
x- | x ) # Output to stdout
exec 4>$outfile;;
esac
-# Initializations are performed. Perform the task.
+# Initializations are performed. Proceed to the main task.
case $task in
-
- ## ------------------- ##
- ## Generate the script ##
- ## ------------------- ##
+ ## --------------------- ##
+ ## Generate the script. ##
+ ## --------------------- ##
script)
$run_m4 $infile > $tmpout || exit 2
# would break.
ac_LF_and_DOT=`echo; echo .`
-: ${AC_MACRODIR=@datadir@}
-: ${AC_ACLOCALDIR=`aclocal --print-ac-dir 2>/dev/null`}
+# Find GNU m4.
+# Handle the case that m4 has moved since we were configured.
+# It may have been found originally in a build directory.
: ${M4=@M4@}
-: ${AWK=@AWK@}
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 ;;
+/*) test -f "$M4" || M4=m4 ;;
+esac
+# 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*);;
+*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
esac
+# Variables.
+: ${AC_MACRODIR=@datadir@}
+: ${AC_ACLOCALDIR=`aclocal --print-ac-dir 2>/dev/null`}
+: ${AWK=@AWK@}
localdir=
outfile=
# Tasks:
tmpout=$TMPDIR/acout.$$
verbose=:
+# Parse command line
while test $# -gt 0 ; do
case "$1" in
+ --version | --v* )
+ echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
--localdir=* | --l*=* )
task=trace
traces="$traces -t `echo \"$1\" | sed -e 's/^[^=]*=//'`"
shift ;;
- -t* )
- task=trace
- traces="$traces -t `echo \"$1\" | sed -e 's/^-t//'`"
- shift ;;
--output | -o )
shift
outfile="$1"
--output=* )
outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
shift ;;
- -o* )
- outfile=`echo "$1" | sed -e 's/^-o//'`
- shift ;;
- --version | --v* )
- echo "$version" ; exit 0 ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
esac
done
+# Running m4.
+if test -n "$localdir"; then
+ use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
+fi
+run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
+
+
case $# in
0) infile=configure.in
test $task = script && test "x$outfile" = x && outfile=configure;;
infile=$tmpin
cat >$infile
elif test ! -r "$infile"; then
- echo "autoconf: $infile: No such file or directory" >&2
+ echo "$me: $infile: No such file or directory" >&2
exit 1
fi
-if test -n "$localdir"; then
- use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
-else
- use_localdir=
-fi
-
-# 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*);;
-*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
-esac
-run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
-
# Output is produced into FD 4. Prepare it.
case "x$outfile" in
x- | x ) # Output to stdout
exec 4>$outfile;;
esac
-# Initializations are performed. Perform the task.
+# Initializations are performed. Proceed to the main task.
case $task in
-
- ## ------------------- ##
- ## Generate the script ##
- ## ------------------- ##
+ ## --------------------- ##
+ ## Generate the script. ##
+ ## --------------------- ##
script)
$run_m4 $infile > $tmpout || exit 2
# would break.
ac_LF_and_DOT=`echo; echo .`
-: ${AC_MACRODIR=@datadir@}
-: ${AC_ACLOCALDIR=`aclocal --print-ac-dir 2>/dev/null`}
+# Find GNU m4.
+# Handle the case that m4 has moved since we were configured.
+# It may have been found originally in a build directory.
: ${M4=@M4@}
-: ${AWK=@AWK@}
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 ;;
+/*) test -f "$M4" || M4=m4 ;;
+esac
+# 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*);;
+*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
esac
+# Variables.
+: ${AC_MACRODIR=@datadir@}
+: ${AC_ACLOCALDIR=`aclocal --print-ac-dir 2>/dev/null`}
+: ${AWK=@AWK@}
localdir=
outfile=
# Tasks:
tmpout=$TMPDIR/acout.$$
verbose=:
+# Parse command line
while test $# -gt 0 ; do
case "$1" in
+ --version | --v* )
+ echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
--localdir=* | --l*=* )
task=trace
traces="$traces -t `echo \"$1\" | sed -e 's/^[^=]*=//'`"
shift ;;
- -t* )
- task=trace
- traces="$traces -t `echo \"$1\" | sed -e 's/^-t//'`"
- shift ;;
--output | -o )
shift
outfile="$1"
--output=* )
outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
shift ;;
- -o* )
- outfile=`echo "$1" | sed -e 's/^-o//'`
- shift ;;
- --version | --v* )
- echo "$version" ; exit 0 ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
esac
done
+# Running m4.
+if test -n "$localdir"; then
+ use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
+fi
+run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
+
+
case $# in
0) infile=configure.in
test $task = script && test "x$outfile" = x && outfile=configure;;
infile=$tmpin
cat >$infile
elif test ! -r "$infile"; then
- echo "autoconf: $infile: No such file or directory" >&2
+ echo "$me: $infile: No such file or directory" >&2
exit 1
fi
-if test -n "$localdir"; then
- use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
-else
- use_localdir=
-fi
-
-# 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*);;
-*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
-esac
-run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
-
# Output is produced into FD 4. Prepare it.
case "x$outfile" in
x- | x ) # Output to stdout
exec 4>$outfile;;
esac
-# Initializations are performed. Perform the task.
+# Initializations are performed. Proceed to the main task.
case $task in
-
- ## ------------------- ##
- ## Generate the script ##
- ## ------------------- ##
+ ## --------------------- ##
+ ## Generate the script. ##
+ ## --------------------- ##
script)
$run_m4 $infile > $tmpout || exit 2