From: David MacKenzie Date: Wed, 24 Aug 1994 06:41:01 +0000 (+0000) Subject: rewrite AC_DEFINE X-Git-Tag: fsf-origin~539 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7371685eb28d84e348c6f6147408d2f358f029f;p=thirdparty%2Fautoconf.git rewrite AC_DEFINE --- diff --git a/Makefile.in b/Makefile.in index 76b5b9a95..fbbb39b0f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -57,8 +57,7 @@ DISTFILES = COPYING ChangeLog ChangeLog.1 ChangeLog.0 INSTALL \ acconfig.h acfunctions acgeneral.m4 acheaders acidentifiers \ acmakevars acoldnames.m4 acprograms acspecific.m4 autoconf.info* \ autoconf.m4 autoconf.sh autoconf.texi install.texi \ - autoheader.sh autoreconf.sh autoscan.pl autoupdate.sh \ - shindent.sh ifnames.sh \ + autoheader.sh autoreconf.sh autoscan.pl autoupdate.sh ifnames.sh \ config.guess config.sub configure configure.in \ install.sh mkinstalldirs texinfo.tex \ testsuite/Makefile.in testsuite/config/*.exp \ @@ -86,10 +85,6 @@ autoupdate: autoupdate.sh rm -f $@ $@.tmp $(editsh) $(srcdir)/autoupdate.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@ -shindent: shindent.sh - rm -f $@ $@.tmp - $(editsh) $(srcdir)/shindent.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@ - ifnames: ifnames.sh rm -f $@ $@.tmp $(editsh) $(srcdir)/ifnames.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@ @@ -141,9 +136,6 @@ install: all acgeneral.m4 acoldnames.m4 acspecific.m4 acconfig.h \ $(INSTALL_DATA) $(srcdir)/acconfig.h $(acdatadir)/acconfig.h -if test -f autoscan; then \ $(INSTALL_PROGRAM) autoscan $(bindir)/autoscan; \ - else :; fi - -if test -f shindent; then \ - $(INSTALL_PROGRAM) shindent $(bindir)/shindent; \ $(INSTALL_DATA) $(srcdir)/acfunctions $(acdatadir)/acfunctions; \ $(INSTALL_DATA) $(srcdir)/acheaders $(acdatadir)/acheaders; \ $(INSTALL_DATA) $(srcdir)/acidentifiers $(acdatadir)/acidentifiers; \ @@ -163,8 +155,7 @@ install-info: info installdirs uninstall: rm -f $(bindir)/autoconf $(bindir)/autoheader $(bindir)/autoscan - rm -f $(bindir)/autoreconf $(bindir)/autoupdate - rm -f $(bindir)/shindent $(bindir)/ifnames + rm -f $(bindir)/autoreconf $(bindir)/autoupdate $(bindir)/ifnames rm -fr $(acdatadir) cd $(infodir); rm -f autoconf.info* if test -f standards.info || test -f $(srcdir)/standards.info; \ @@ -188,8 +179,7 @@ clean mostlyclean distclean realclean:: done clean mostlyclean distclean realclean:: - rm -f autoconf autoheader autoscan autoreconf autoupdate - rm -f shindent ifnames *.tmp + rm -f autoconf autoheader autoscan autoreconf autoupdate ifnames *.tmp rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.ma *.mas diff --git a/NEWS b/NEWS index e33d812cc..0e7108810 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,7 @@ Major changes in release 2.0: * AC_OUTPUT and AC_CONFIG_HEADER allow you to override the input-file names. * AC_PROG_INSTALL looks for install.sh in the directory specified by AC_CONFIG_AUXDIR, or srcdir or srcdir/.. or srcdir/../.. by default. +* AC_DEFINE and AC_DEFINE_UNQUOTED are more robust and smaller. * AC_DEFINE no longer prints anything, because of the new result reporting mechanism (AC_MSG_CHECKING and AC_MSG_RESULT). * AC_VERBOSE pays attention to --quiet/--silent, not --verbose. @@ -51,8 +52,6 @@ Major changes in release 2.0: * autoreconf to recursively remake configure and configuration header files in a source tree. * autoupdate to update a configure.in to use the new macro names. -* shindent to produce consistent indentation in shell scripts, such as - configure. * ifnames to list the symbols used in #if and #ifdef directives in a source tree. diff --git a/README b/README index 7a4456fab..fab94f110 100644 --- a/README +++ b/README @@ -14,8 +14,8 @@ Autoconf, so that Autoconf's configure script can find it. The configuration scripts produced by Autoconf are self-contained, so their users do not need to have Autoconf (or GNU m4). -Also, some optional utilities that come with Autoconf use Perl, Bash, -TCL, and the TCL packages Expect and DejaGNU. However, none of those +Also, some optional utilities that come with Autoconf use Perl, TCL, +and the TCL packages Expect and DejaGNU. However, none of those are required in order to use the main Autoconf program. If they are not present, the affected Autoconf utilities will not be installed. diff --git a/TODO b/TODO index 63a9b5f5d..a4d1b2ec2 100644 --- a/TODO +++ b/TODO @@ -10,7 +10,7 @@ Required for 2.0: ------------------------------------------------------------------------------ -* Fix up quoting for AC_DEFINE; understand and integrate Jim Avera's patches. +* Split up AC_SUBST substitutions using a loop to accomodate old seds. ------------------------------------------------------------------------------ @@ -21,6 +21,7 @@ Required for 2.0: * Fix AC_ARG_{ENABLE,WITH}, and AC_REQUIRE interrupting messages. ------------------------------------------------------------------------------ + Other things: @@ -38,10 +39,6 @@ functions (POSIX, NIS) that do everything necessary, instead. ------------------------------------------------------------------------------ -* Add a --indent option to autoconf to call shindent. - ------------------------------------------------------------------------------- - * Doc: Add indexes of concepts, env vars. ------------------------------------------------------------------------------ diff --git a/acgeneral.m4 b/acgeneral.m4 index 0866d98fc..8f8ca6099 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -35,7 +35,7 @@ Install it before installing Autoconf or set the M4 environment variable to its path name. )m4exit(2)])dnl dnl -define(AC_ACVERSION, 1.100)dnl +define(AC_ACVERSION, 1.101)dnl dnl This is defined by the --version option of the autoconf script. ifdef([AC_PRINT_VERSION], [Autoconf version AC_ACVERSION m4exit(0)])dnl @@ -53,12 +53,12 @@ divert(AC_DIVERSION_NORMAL)dnl dnl dnl Define a macro which automatically provides itself. dnl Use instead of define for macros to be used as functions. -dnl dnl AC_DEFUN(NAME, EXPANSION) define([AC_DEFUN], [define($1, [define([AC_PROVIDE_$1], )][$2])])dnl dnl +dnl AC_INIT_NOTICE() AC_DEFUN(AC_INIT_NOTICE, [# Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version] AC_ACVERSION [ @@ -79,6 +79,7 @@ AC_DEFUN(AC_INIT_NOTICE, # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ])dnl dnl +dnl AC_INIT_PARSE_ARGS() AC_DEFUN(AC_INIT_PARSE_ARGS, [AC_BEFORE([$0], [AC_ARG_ENABLE])dnl AC_BEFORE([$0], [AC_ARG_WITH])dnl @@ -361,12 +362,13 @@ if test -n "$ac_prev"; then fi ])dnl dnl -dnl Try to have only one #! line, just so it doesn't look funny. -dnl +dnl Try to have only one #! line, so the script doesn't look funny. +dnl AC_BINSH() AC_DEFUN(AC_BINSH, [#!/bin/sh ])dnl dnl +dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR) AC_DEFUN(AC_INIT, [AC_REQUIRE([AC_BINSH])dnl AC_INIT_NOTICE @@ -472,6 +474,11 @@ AC_CACHE_LOAD AC_LANG_C undivert(AC_DIVERSION_ARG)dnl +dnl Substitute for predefined variables. +AC_SUBST(LIBS)dnl +AC_SUBST(prefix)dnl +AC_SUBST(exec_prefix)dnl +AC_SUBST(DEFS)dnl ])dnl dnl dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE]) @@ -537,30 +544,33 @@ AC_DEFUN(AC_REVISION, dnl dnl Subroutines of AC_PREREQ. dnl -dnl Change the dots in version number $1 into commas. +dnl Change the dots in NUMBER into commas. +dnl AC_PREREQ_SPLIT(NUMBER) AC_DEFUN(AC_PREREQ_SPLIT, [translit($1, ., [, ])])dnl dnl dnl Default the ternary version number to 0 (e.g., 1, 7 -> 1, 7, 0). +dnl AC_PREREQ_CANON(MAJOR, MINOR [,TERNARY]) AC_DEFUN(AC_PREREQ_CANON, [$1, $2, ifelse([$3], , 0, [$3])])dnl dnl -dnl Complain and exit if the version number in $1 through $3 is less than -dnl the version number in $4 through $6. -dnl $7 is the printable version of the second version number. +dnl Complain and exit if version number 1 is less than version number 2. +dnl PRINTABLE2 is the printable version of version number 2. +dnl AC_PREREQ_COMPARE(MAJOR1, MINOR1, TERNARY1, MAJOR2, MINOR2, TERNARY2, +dnl PRINTABLE2) AC_DEFUN(AC_PREREQ_COMPARE, [ifelse(builtin([eval], [$3 + $2 * 100 + $1 * 10000 < $6 + $5 * 100 + $4 * 10000]), 1, [errprint(Autoconf version $7 or higher is required )m4exit(3)])])dnl dnl -dnl Complain and exit if the Autoconf version is less than $1. +dnl Complain and exit if the Autoconf version is less than VERSION. dnl AC_PREREQ(VERSION) AC_DEFUN(AC_PREREQ, [AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1])])dnl dnl -dnl Run configure in subdirectories $1. +dnl Run configure in subdirectories DIR... dnl Not actually done until AC_OUTPUT_SUBDIRS. dnl AC_CONFIG_SUBDIRS(DIR ...) AC_DEFUN(AC_CONFIG_SUBDIRS, @@ -586,7 +596,7 @@ changequote(<<, >>)dnl changequote([, ])dnl fi fi -undefine(AC_VAR_NAME)dnl +undefine([AC_VAR_NAME])dnl ])dnl AC_DEFUN(AC_PREFIX, [AC_OBSOLETE([$0], [; instead use AC_PREFIX_PROGRAM before AC_INIT])dnl @@ -597,8 +607,8 @@ dnl ### Canonicalizing the system type dnl dnl dnl Find install.sh, config.sub, config.guess, and Cygnus configure -dnl in directory $1. These are auxiliary files used in configuration. -dnl $1 can be either absolute or relative to ${srcdir}. +dnl in directory DIR. These are auxiliary files used in configuration. +dnl DIR can be either absolute or relative to ${srcdir}. dnl AC_CONFIG_AUX_DIR(DIR) AC_DEFUN(AC_CONFIG_AUX_DIR, [AC_CONFIG_AUX_DIRS($1 ${srcdir}/$1)])dnl @@ -738,8 +748,8 @@ AC_SUBST(build_vendor)dnl AC_SUBST(build_os)dnl ])dnl dnl -dnl Link each of the existing files in $2 to the corresponding -dnl link name in $1. +dnl Link each of the existing files FILE... to the corresponding +dnl link name in LINK... dnl Not actually done until AC_OUTPUT_LINKS. dnl AC_LINK_FILES(LINK ..., FILE ...) AC_DEFUN(AC_LINK_FILES, @@ -750,6 +760,7 @@ dnl ### Caching test results dnl dnl dnl Look for site or system specific initialization scripts. +dnl AC_SITE_LOAD() AC_DEFUN(AC_SITE_LOAD, [# Prefer explicitly selected file to automatically selected ones. if test ! -r "$CONFIG_SITE"; then @@ -771,6 +782,7 @@ for ac_site_file in $CONFIG_SITE; do done ])dnl dnl +dnl AC_CACHE_LOAD() AC_DEFUN(AC_CACHE_LOAD, [if test -r "$cache_file"; then echo "loading cache $cache_file" @@ -781,10 +793,11 @@ else fi ])dnl dnl +dnl AC_CACHE_SAVE() AC_DEFUN(AC_CACHE_SAVE, [if test -w $cache_file; then echo "updating cache $cache_file" -cat > $cache_file <<\CEOF +cat > $cache_file <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. @@ -798,7 +811,7 @@ cat > $cache_file <<\CEOF # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. -CEOF +EOF changequote(, )dnl dnl Allow a site initialization script to override cache values. # Ultrix sh set writes to stderr and can't be redirected directly. @@ -809,8 +822,8 @@ echo "not updating unwritable cache $cache_file" fi ])dnl dnl -dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved. +dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) AC_DEFUN(AC_CACHE_VAL, [AC_REQUIRE([AC_PROG_ECHO_N])dnl dnl We used to use the below line, but it fails if the 1st arg is a @@ -827,95 +840,22 @@ dnl dnl ### Setting variables dnl dnl -dnl Several simple subroutines to do various flavors of quoting. -dnl -dnl Quote $1 against shell "s. -AC_DEFUN(AC_QUOTE_DQUOTE, -[dnl We use \1 instead of \& to avoid an m4 1.0.3 bug. -patsubst($1, changequote(, )\([$"`\\]\)changequote([, ]), \\\1)])dnl -dnl -dnl Quote $1 against shell 's. -AC_DEFUN(AC_QUOTE_SQUOTE, -[patsubst($1, ', '\\'')])dnl -dnl -dnl Quote $1 against shell here documents (<> confdefs.h -dnl Define DEFS even if AC_LIST_HEADERS for use in user case statements. -DEFS="$DEFS -D$1=AC_QUOTE_SQUOTE(AC_VAL)" -ifdef([AC_LIST_HEADERS], -ac_sed_defs="dnl -${ac_sed_defs}\${ac_dA}$1\${ac_dB}$1\${ac_dC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_dD} -\${ac_uA}$1\${ac_uB}$1\${ac_uC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_uD} -\${ac_eA}$1\${ac_eB}$1\${ac_eC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_eD} -" -)dnl -} +[cat >> confdefs.h <<\EOF +[#define] $1 ifelse($#, 2, [$2], 1) +EOF ])dnl dnl -dnl Unsafe version of AC_DEFINE. -dnl Users are responsible for the quoting nightmare. -dnl Well, not all of it. We need to pull the identity function out to -dnl the top level, because m4 doesn't really support nested functions; -dnl it doesn't distinguish between the arguments to the outer -dnl function, which should be expanded, and the arguments to the inner -dnl function, which shouldn't yet. -AC_DEFUN(AC_QUOTE_IDENTITY, -$1)dnl +dnl Similar, but perform shell substitutions $ ` \ once on VALUE. AC_DEFUN(AC_DEFINE_UNQUOTED, -[pushdef([AC_QUOTE_SQUOTE], defn([AC_QUOTE_IDENTITY]))dnl -pushdef([AC_DEFINE_SEDQUOTE], defn([AC_QUOTE_IDENTITY]))dnl -AC_DEFINE($1, $2)dnl -popdef([AC_DEFINE_SEDQUOTE])dnl -popdef([AC_QUOTE_SQUOTE])dnl +[cat >> confdefs.h <&AC_FD_MSG])dnl dnl +dnl AC_CHECKING(FEATURE-DESCRIPTION) AC_DEFUN(AC_CHECKING, [echo "checking $1" 1>&AC_FD_MSG])dnl dnl @@ -962,6 +904,7 @@ AC_DEFUN(AC_MSG_RESULT, [AC_REQUIRE([AC_PROG_ECHO_N])dnl echo "$ac_t""$1" 1>&AC_FD_MSG])dnl dnl +dnl AC_VERBOSE(RESULT-DESCRIPTION) AC_DEFUN(AC_VERBOSE, [AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl echo " $1" 1>&AC_FD_MSG])dnl @@ -978,6 +921,7 @@ dnl dnl ### Selecting which language to use for testing dnl dnl +dnl AC_LANG_C() AC_DEFUN(AC_LANG_C, [define([AC_LANG], [C])dnl ac_ext=c @@ -986,6 +930,7 @@ ac_cpp='${CPP}' ac_compile='${CC-cc} $CFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' ])dnl dnl +dnl AC_LANG_CPLUSPLUS() AC_DEFUN(AC_LANG_CPLUSPLUS, [define([AC_LANG], [CPLUSPLUS])dnl ac_ext=C @@ -995,10 +940,13 @@ ac_compile='${CXX-gcc} $CXXFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1 ])dnl dnl dnl Push the current language on a stack. +dnl +dnl AC_LANG_SAVE() AC_DEFUN(AC_LANG_SAVE, [pushdef([AC_LANG_STACK], AC_LANG)])dnl dnl dnl Restore the current language from the stack. +dnl AC_LANG_RESTORE() AC_DEFUN(AC_LANG_RESTORE, [ifelse(AC_LANG_STACK, C, [ifelse(AC_LANG, C, , [AC_LANG_C])], [ifelse(AC_LANG, CPLUSPLUS, , [AC_LANG_CPLUSPLUS])])[]popdef([AC_LANG_STACK])])dnl dnl @@ -1029,7 +977,7 @@ dnl ### Checking for files - fundamental (caching) dnl dnl dnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND -dnl [, VALUE-IF-NOT-FOUND]) +dnl [, VALUE-IF-NOT-FOUND]) AC_DEFUN(AC_CHECK_PROG, [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 @@ -1121,12 +1069,12 @@ ifelse([$3], , , [test -n "[$]$1" || $1="$3" ])])dnl dnl dnl AC_CHECK_LIB(LIBRARY, FUNCTION, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND -dnl [, OTHER-LIBRARIES]]]) +dnl [, OTHER-LIBRARIES]]]) AC_DEFUN(AC_CHECK_LIB, -[changequote(/, /)dnl -define(/AC_LIB_NAME/, dnl -patsubst(patsubst($1, /lib\([^\.]*\)\.a/, /\1/), /-l/, //))dnl -define(/AC_CV_NAME/, ac_cv_lib_//AC_LIB_NAME)dnl +[changequote(<<, >>)dnl +define(<>, dnl +patsubst(patsubst($1, <>, <<\1>>), <<-l>>, <<>>))dnl +define(<>, ac_cv_lib_<<>>AC_LIB_NAME)dnl changequote([, ])dnl AC_MSG_CHECKING([for -l[]AC_LIB_NAME]) AC_CACHE_VAL(AC_CV_NAME, @@ -1145,8 +1093,8 @@ ifelse([$4], , , [else $4 ])dnl fi -undefine(AC_LIB_NAME)dnl -undefine(AC_CV_NAME)dnl +undefine([AC_LIB_NAME])dnl +undefine([AC_CV_NAME])dnl ])dnl dnl dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND @@ -1168,7 +1116,7 @@ dnl dnl Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must dnl come early, it is not included in AC_BEFORE checks. dnl AC_EGREP_CPP(PATTERN, PROGRAM, ACTION-IF-FOUND [, -dnl ACTION-IF-NOT-FOUND]) +dnl ACTION-IF-NOT-FOUND]) AC_DEFUN(AC_EGREP_CPP, [AC_REQUIRE_CPP()dnl cat > conftest.${ac_ext} < conftest.${ac_ext} <conftest.def < ${CONFIG_STATUS} <> ${CONFIG_STATUS} <<\EOF AC_OUTPUT_FILES($1) ifdef([AC_LIST_HEADERS], [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_LINKS, AC_LIST_FILES)])dnl @@ -1477,14 +1406,49 @@ exit 0 EOF chmod +x ${CONFIG_STATUS} test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} ${CONFIG_STATUS} -dnl config.status should never do recursion. +dnl config.status should not do recursion. ifdef([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl ])dnl dnl -dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted +dnl This is a subroutine of AC_OUTPUT. +dnl AC_OUTPUT_MAKE_DEFS() +AC_DEFUN(AC_OUTPUT_MAKE_DEFS, +[# Transform confdefs.h into DEFS. +dnl Using a here document instead of a string reduces the quoting nightmare. +cat > conftest.defs <<\EOF +changequote(<<, >>)dnl +s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g +# Protect against shell expansion while executing Makefile rules. +s%[ `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +# Protect against Makefile macro expansion. +s%\$%$$%g +# Protect against being on the right side of a sed subst in config.status. +s/[\\&%]/\\&/g +changequote([, ])dnl +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs +])dnl +dnl +dnl This is a subroutine of AC_OUTPUT. It is called inside an unquoted dnl here document whose contents are going into config.status. +dnl AC_OUTPUT_FILES(FILE...) AC_DEFUN(AC_OUTPUT_FILES, -[CONFIG_FILES=${CONFIG_FILES-"$1"} +[cat > conftest.subs <<\CEOF +dnl These here document variables are unquoted when configure runs +dnl but quoted when config.status runs, so variables are expanded once. +$ac_vpsub +dnl Shell code in configure.in might set extrasub. +$extrasub +dnl Insert the sed substitutions of variables. +undivert(AC_DIVERSION_SED) +CEOF +EOF +cat >> ${CONFIG_STATUS} <<\EOF + +CONFIG_FILES=${CONFIG_FILES-"$1"} for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then # Support "outfile[:infile]", defaulting infile="outfile.in". case "$ac_file" in @@ -1551,131 +1515,114 @@ a\\ } " ;; esac - sed -e " -$ac_comsub -EOF -cat >> ${CONFIG_STATUS} <> ${CONFIG_STATUS} <<\EOF -" $ac_given_srcdir/$ac_file_in > $ac_file +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file fi; done +rm -f conftest.subs ])dnl dnl -dnl Create the header files listed in $1. dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted dnl here document whose contents are going into config.status. +dnl AC_OUTPUT_HEADER(HEADER-FILE...) AC_DEFUN(AC_OUTPUT_HEADER, [changequote(<<, >>)dnl -# These sed commands are put into ac_sed_defs when defining a macro. -# They are broken into pieces to make the sed script easier to manage. -# They are passed to sed as "A NAME B NAME C VALUE D", where NAME -# is the cpp macro being defined and VALUE is the value it is being given. -# Each defining turns into a single global substitution command. -# Hopefully no one uses "!" as a variable value. -# Other candidates for the sed separators, like , and @, do get used. +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s!^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*!\1#\2' +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' -ac_dD='!g' +ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s!^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)!\1#\2define\3' +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' -ac_uD='\4!g' +ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s!^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='<<$>>!\1#\2define\3' +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='<<$>>%\1#\2define\3' ac_eC=' ' -ac_eD='!g' +ac_eD='%g' changequote([, ])dnl -rm -f conftest.sed + +CONFIG_HEADERS=${CONFIG_HEADERS-"$1"} +for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + cp $ac_given_srcdir/$ac_file_in conftest.in + EOF -# Turn off quoting long enough to insert the sed commands. -rm -f conftest.sh -cat > conftest.sh < conftest.hdr <<\EOF +changequote(<<, >>)dnl +# Protect against being on the right side of a sed subst in config.status. +s/[\\&%]/\\&/g +# Protect against being in an unquoted here document in config.status. +s%[\\$`]%\\&%g +s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +changequote([, ])dnl EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr -# Break up $ac_sed_defs (now in conftest.sh) because some shells have a limit -# on the size of here documents. +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +changequote(, )dnl +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +changequote([, ])dnl +EOF +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. # Maximum number of lines to put in a single here document. -ac_max_sh_lines=9 +ac_max_here_lines=12 +rm -f conftest.tail while : do - # wc gives bogus results for an empty file on some AIX systems. - ac_lines=`grep -c . conftest.sh` + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - rm -f conftest.s1 conftest.s2 - sed ${ac_max_sh_lines}q conftest.sh > conftest.s1 # Like head -9. - sed 1,${ac_max_sh_lines}d conftest.sh > conftest.s2 # Like tail +10. - # Write a limited-size here document to append to conftest.sed. - echo 'cat >> conftest.sed <> ${CONFIG_STATUS} - cat conftest.s1 >> ${CONFIG_STATUS} - echo 'CONFEOF' >> ${CONFIG_STATUS} - rm -f conftest.s1 conftest.sh - mv conftest.s2 conftest.sh + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> ${CONFIG_STATUS} + sed ${ac_max_here_lines}q conftest.vals >> ${CONFIG_STATUS} + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + mv conftest.out conftest.in +' >> ${CONFIG_STATUS} + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + mv conftest.tail conftest.vals done -rm -f conftest.sh +rm -f conftest.vals # Now back to your regularly scheduled config.status. cat >> ${CONFIG_STATUS} <<\EOF -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it in -[#] $1. -cat >> conftest.sed <<\CONFEOF -changequote(, )dnl -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -changequote([, ])dnl -CONFEOF -rm -f conftest.h -# Break up the sed commands because old seds have small limits. -ac_max_sed_lines=20 - -CONFIG_HEADERS=${CONFIG_HEADERS-"$1"} -for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then - # Support "outfile[:infile]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - echo creating $ac_file - - cp $ac_given_srcdir/$ac_file_in conftest.h1 - cp conftest.sed conftest.stm - while : - do - ac_lines=`grep -c . conftest.stm` - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - rm -f conftest.s1 conftest.s2 conftest.h2 - sed ${ac_max_sed_lines}q conftest.stm > conftest.s1 # Like head -20. - sed 1,${ac_max_sed_lines}d conftest.stm > conftest.s2 # Like tail +21. - sed -f conftest.s1 < conftest.h1 > conftest.h2 - rm -f conftest.s1 conftest.h1 conftest.stm - mv conftest.h2 conftest.h1 - mv conftest.s2 conftest.stm - done - rm -f conftest.stm conftest.h + rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.h1 >> conftest.h - rm -f conftest.h1 + cat conftest.in >> conftest.h + rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then - # The file exists and we would not be changing it. echo "$ac_file is unchanged" rm -f conftest.h else @@ -1683,10 +1630,10 @@ for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then mv conftest.h $ac_file fi fi; done -rm -f conftest.sed ])dnl dnl +dnl AC_OUTPUT_LINKS(DEST..., SOURCE...) AC_DEFUN(AC_OUTPUT_LINKS, [ac_links="$1" ac_files="$2" @@ -1709,6 +1656,7 @@ while test -n "${ac_files}"; do done ])dnl dnl +dnl AC_OUTPUT_SUBDIRS(DIRECTORY...) AC_DEFUN(AC_OUTPUT_SUBDIRS, [if test -z "${norecursion}"; then diff --git a/acspecific.m4 b/acspecific.m4 index 214a2c56b..85e932c2f 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -30,7 +30,8 @@ dnl Idea borrowed from dist 3.0. dnl Internal use only. AC_DEFUN(AC_PROG_ECHO_N, [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn > /dev/null; then ac_n= ac_c=' ' ac_t=' ' else @@ -87,15 +88,14 @@ if test $ac_cv_prog_gcc = yes; then AC_MSG_CHECKING(whether -traditional is needed) AC_CACHE_VAL(ac_cv_prog_gcc_traditional, [ ac_pattern="Autoconf.*'x'" - ac_prog='#include -Autoconf TIOCGETP' - AC_EGREP_CPP($ac_pattern, $ac_prog, + AC_EGREP_CPP($ac_pattern, [#include +Autoconf TIOCGETP], ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no) if test $ac_cv_prog_gcc_traditional = no; then - ac_prog='#include -Autoconf TCGETA' - AC_EGREP_CPP($ac_pattern, $ac_prog, ac_cv_prog_gcc_traditional=yes) + AC_EGREP_CPP($ac_pattern, [#include +Autoconf TCGETA], + ac_cv_prog_gcc_traditional=yes) fi])dnl AC_MSG_RESULT($ac_cv_prog_gcc_traditional) if test $ac_cv_prog_gcc_traditional = yes; then @@ -547,9 +547,10 @@ AC_DEFUN(AC_TYPE_GETGROUPS, [AC_REQUIRE([AC_TYPE_UID_T])dnl AC_MSG_CHECKING(type of array argument to getgroups) AC_CACHE_VAL(ac_cv_type_getgroups, -[changequote(, )dnl -dnl Do not put single quotes in the C program text! -ac_prog='/* Thanks to Mike Rendell for this test. */ +[AC_TRY_RUN( +changequote(<<, >>)dnl +<< +/* Thanks to Mike Rendell for this test. */ #include #define NGID 256 #undef MAX @@ -568,9 +569,9 @@ main() /* Exit non-zero if getgroups seems to require an array of ints. This happens when gid_t is short but getgroups modifies an array of ints. */ exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); -}' +} +>>, changequote([, ])dnl -AC_TRY_RUN([$ac_prog], ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)])dnl AC_MSG_RESULT($ac_cv_type_getgroups) AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups) @@ -1310,9 +1311,10 @@ AC_DEFUN(AC_C_CONST, dnl and with the result message. AC_MSG_CHECKING([for working const]) AC_CACHE_VAL(ac_cv_c_const, -[changequote(, )dnl -dnl Do not put single quotes in the C program text! -ac_prog='/* Ultrix mips cc rejects this. */ +[AC_TRY_LINK(, +changequote(<<, >>)dnl +<< +/* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; @@ -1349,9 +1351,10 @@ ccp = (char const *const *) p; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; -}' +} +>>, changequote([, ])dnl -AC_TRY_LINK(, [$ac_prog], ac_cv_c_const=yes, ac_cv_c_const=no)])dnl +ac_cv_c_const=yes, ac_cv_c_const=no)])dnl AC_MSG_RESULT($ac_cv_c_const) if test $ac_cv_c_const = no; then AC_DEFINE(const, ) diff --git a/autoconf.texi b/autoconf.texi index 15b5442df..e2511df52 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -6,8 +6,8 @@ @c @setchapternewpage odd @c %**end of header -@set EDITION 1.100 -@set VERSION 1.100 +@set EDITION 1.101 +@set VERSION 1.101 @set UPDATED August 1994 @iftex @@ -120,7 +120,6 @@ Making @code{configure} Scripts * Invoking ifnames:: Listing the conditionals in source code. * Invoking autoreconf:: Remaking multiple @code{configure} scripts. * Invoking autoupdate:: Replacing old macro names in @code{configure.in}. -* Invoking shindent:: Making @code{configure} scripts more readable. Specific Tests @@ -383,7 +382,6 @@ Makefile.in ---' `-> Makefile ---' * Invoking ifnames:: Listing the conditionals in source code. * Invoking autoreconf:: Remaking multiple @code{configure} scripts. * Invoking autoupdate:: Replacing old macro names in @code{configure.in}. -* Invoking shindent:: Making @code{configure} scripts more readable. @end menu @node Writing configure.in, Invoking autoconf, , Making configure Scripts @@ -636,7 +634,7 @@ Print the name of each directory where @code{autoreconf} runs Print the version number of @code{autoreconf} and exit. @end table -@node Invoking autoupdate, Invoking shindent, Invoking autoreconf, Making configure Scripts +@node Invoking autoupdate, , Invoking autoreconf, Making configure Scripts @section Invoking autoupdate The @code{autoupdate} program updates a @file{configure.in} file that @@ -674,56 +672,6 @@ default installation directory. Print the version number of @code{autoupdate} and exit. @end table -@node Invoking shindent, , Invoking autoupdate, Making configure Scripts -@section Invoking shindent - -Autoconf-generated @code{configure} scripts can be somewhat hard to -read, because they @emph{look} machine-generated---mainly because they -do not use whitespace rationally. Unfortunately, it is impossible to do -proper indentation using a macro processor like @code{m4}. However, if -you have GNU @code{bash} installed, you can use the @code{shindent} -program, which uses @code{bash} to give a Bourne shell script readable -indentation. - -@code{shindent} indents each script named on the command line, backing -up the original version with the suffix @file{~} (or the value of the -environment variable @code{SIMPLE_BACKUP_SUFFIX}, if that is set). -@code{shindent} places some restrictions on its input, due to the way it -uses @code{bash} to do the indentation: - -@itemize @bullet -@item -It removes comments and blank lines between cases case statements. - -@item -Doing odd things in case statements might cause odd problems. - -@item -The script must not define any shell functions. - -@item -If any string literals or here-documents contain lines that start -with four spaces, those spaces will be removed. - -@item -The script must not be @code{shindent} itself. -@end itemize - -@noindent -@code{shindent} accepts the following options: - -@table @code -@item --help -Print a summary of the command line options and exit. - -@item --macrodir=@var{dir} -Look for the Autoconf macro files in directory @var{dir} instead of the -default installation directory. Only used to get the version number. - -@item --version -Print the version number of @code{shindent} and exit. -@end table - @node Specific Tests, General Purpose Macros, Making configure Scripts, Top @chapter Specific Tests @@ -2259,18 +2207,26 @@ variables. @defmac AC_DEFINE (@var{variable} @r{[}, @var{value}@r{]}) @maindex DEFINE Define C preprocessor variable @var{variable}. If @var{value} is given, -set @var{variable} to that value, otherwise set it to 1. To use a shell -variable as the value, use @code{AC_DEFINE_UNQUOTED} instead and precede -double quotes in the value with backslashes. - -This macro adds to the shell variable @code{DEFS}. @code{AC_OUTPUT} -later substitutes the values in @code{DEFS} into the file(s) that it -generates (typically @file{Makefile}). Alternately, if -@code{AC_CONFIG_HEADER} has been called, @code{AC_OUTPUT} creates a -header file by substituting the correct values into @code{#define} -statements in a template file. - -For example, suppose your @file{configure.in} calls +set @var{variable} to that value (verbatim), otherwise set it to 1. +@var{value} should not contain literal newlines, and if you are not +using @code{AC_CONFIG_HEADER} it should not contain any @samp{#} +characters, as @code{make} tends to eat them. To use a shell variable +as the value, use @code{AC_DEFINE_UNQUOTED} instead. + +@code{AC_OUTPUT} substitutes the values defined by this macro as the +variable @code{DEFS} in the file(s) that it generates (typically +@file{Makefile}). Unlike in Autoconf version 1, there is no variable +@code{DEFS} defined while @code{configure} is running, so macros cannot +check its value for the results of previous tests. This difference is +because properly quoting the contents of that variable turned out to be +too cumbersome and inefficient to do every time @code{AC_DEFINE} is +called. Checking cache variable values is a cleaner way to get the +effect of checking the value of @code{DEFS}. + +If @code{AC_CONFIG_HEADER} has been called, then instead of substituting +@code{DEFS}, @code{AC_OUTPUT} creates a header file by substituting the +correct values into @code{#define} statements in a template file. For +example, suppose your @file{configure.in} calls @code{AC_CONFIG_HEADER(conf.h)} and @code{AC_CHECK_HEADERS(unistd.h)}. You could have code like this in @file{conf.h.in}: @@ -2326,15 +2282,14 @@ AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4); LIBS="$LIBS -lelf") @defmac AC_DEFINE_UNQUOTED (@var{variable} @r{[}, @var{value}@r{]}) @maindex DEFINE_UNQUOTED -Like @code{AC_DEFINE}, but it does nothing to quote @var{value} from -various shell and @code{sed} expansions it will undergo. @var{value} -will be used in many different contexts requiring different quoting, and -it is up to you to make sure it works right. Use this macro instead of -@code{AC_DEFINE} when @var{value} contains a shell variable. For +Like @code{AC_DEFINE}, but three shell expansions are performed once on +@var{value}: variable expansion (@samp{$}), command substitution +(@samp{`}), and backslash escaping (@samp{\}). Use this macro instead +of @code{AC_DEFINE} when @var{value} contains a shell variable. For example: @example -AC_DEFINE_UNQUOTED(config_machfile, $@{machfile@}) +AC_DEFINE_UNQUOTED(config_machfile, "$@{machfile@}") @end example @end defmac @@ -2977,12 +2932,6 @@ AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) fi @end example -@noindent -Unlike in Autoconf version 1, there is no shell variable @code{DEFS} set -while @code{configure} is running. This difference is because properly -quoting the contents of that variable turned out to be too cumbersome to -do every time @code{AC_DEFINE} is called. - @node Test Programs, Multiple Cases, Checking for Symbols, Writing Macros @section Test Programs diff --git a/autoheader.in b/autoheader.in index 31c65a31d..dc0e6b461 100644 --- a/autoheader.in +++ b/autoheader.in @@ -87,6 +87,9 @@ esac frob='define([AC_DEFINE],[# @@@syms="$syms $1"@@@ ])dnl +define([AC_DEFINE_UNQUOTED],[# +@@@syms="$syms $1"@@@ +])dnl define([AC_SIZEOF_TYPE],[# @@@types="$types,$1"@@@ ])dnl diff --git a/autoheader.sh b/autoheader.sh index 31c65a31d..dc0e6b461 100644 --- a/autoheader.sh +++ b/autoheader.sh @@ -87,6 +87,9 @@ esac frob='define([AC_DEFINE],[# @@@syms="$syms $1"@@@ ])dnl +define([AC_DEFINE_UNQUOTED],[# +@@@syms="$syms $1"@@@ +])dnl define([AC_SIZEOF_TYPE],[# @@@types="$types,$1"@@@ ])dnl diff --git a/autoreconf.in b/autoreconf.in index 159e92966..dd7dd883e 100644 --- a/autoreconf.in +++ b/autoreconf.in @@ -66,7 +66,6 @@ while read confin; do cd $dir || exit 1 test $verbose = yes && echo running autoconf in $dir autoconf - # FIXME maybe we should have an option to run shindent here. if grep AC_CONFIG_HEADER configure.in > /dev/null; then test $verbose = yes && echo running autoheader in $dir autoheader diff --git a/autoreconf.sh b/autoreconf.sh index 159e92966..dd7dd883e 100644 --- a/autoreconf.sh +++ b/autoreconf.sh @@ -66,7 +66,6 @@ while read confin; do cd $dir || exit 1 test $verbose = yes && echo running autoconf in $dir autoconf - # FIXME maybe we should have an option to run shindent here. if grep AC_CONFIG_HEADER configure.in > /dev/null; then test $verbose = yes && echo running autoheader in $dir autoheader diff --git a/bin/autoheader.in b/bin/autoheader.in index 31c65a31d..dc0e6b461 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -87,6 +87,9 @@ esac frob='define([AC_DEFINE],[# @@@syms="$syms $1"@@@ ])dnl +define([AC_DEFINE_UNQUOTED],[# +@@@syms="$syms $1"@@@ +])dnl define([AC_SIZEOF_TYPE],[# @@@types="$types,$1"@@@ ])dnl diff --git a/bin/autoreconf.in b/bin/autoreconf.in index 159e92966..dd7dd883e 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -66,7 +66,6 @@ while read confin; do cd $dir || exit 1 test $verbose = yes && echo running autoconf in $dir autoconf - # FIXME maybe we should have an option to run shindent here. if grep AC_CONFIG_HEADER configure.in > /dev/null; then test $verbose = yes && echo running autoheader in $dir autoheader diff --git a/configure.in b/configure.in index d5bb7051c..e1cacb1d9 100644 --- a/configure.in +++ b/configure.in @@ -17,13 +17,6 @@ else AC_MSG_WARN(autoscan will not be built since perl is not found) fi -AC_CHECK_PROG(BASH, bash, no-bash) -if test "$BASH" != no-bash; then - PROGS="$PROGS shindent" -else - AC_MSG_WARN(shindent will not be built since bash is not found) -fi - AC_PROG_INSTALL # Work with the GNU or Cygnus source tree layout. diff --git a/doc/Makefile.in b/doc/Makefile.in index 76b5b9a95..fbbb39b0f 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -57,8 +57,7 @@ DISTFILES = COPYING ChangeLog ChangeLog.1 ChangeLog.0 INSTALL \ acconfig.h acfunctions acgeneral.m4 acheaders acidentifiers \ acmakevars acoldnames.m4 acprograms acspecific.m4 autoconf.info* \ autoconf.m4 autoconf.sh autoconf.texi install.texi \ - autoheader.sh autoreconf.sh autoscan.pl autoupdate.sh \ - shindent.sh ifnames.sh \ + autoheader.sh autoreconf.sh autoscan.pl autoupdate.sh ifnames.sh \ config.guess config.sub configure configure.in \ install.sh mkinstalldirs texinfo.tex \ testsuite/Makefile.in testsuite/config/*.exp \ @@ -86,10 +85,6 @@ autoupdate: autoupdate.sh rm -f $@ $@.tmp $(editsh) $(srcdir)/autoupdate.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@ -shindent: shindent.sh - rm -f $@ $@.tmp - $(editsh) $(srcdir)/shindent.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@ - ifnames: ifnames.sh rm -f $@ $@.tmp $(editsh) $(srcdir)/ifnames.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@ @@ -141,9 +136,6 @@ install: all acgeneral.m4 acoldnames.m4 acspecific.m4 acconfig.h \ $(INSTALL_DATA) $(srcdir)/acconfig.h $(acdatadir)/acconfig.h -if test -f autoscan; then \ $(INSTALL_PROGRAM) autoscan $(bindir)/autoscan; \ - else :; fi - -if test -f shindent; then \ - $(INSTALL_PROGRAM) shindent $(bindir)/shindent; \ $(INSTALL_DATA) $(srcdir)/acfunctions $(acdatadir)/acfunctions; \ $(INSTALL_DATA) $(srcdir)/acheaders $(acdatadir)/acheaders; \ $(INSTALL_DATA) $(srcdir)/acidentifiers $(acdatadir)/acidentifiers; \ @@ -163,8 +155,7 @@ install-info: info installdirs uninstall: rm -f $(bindir)/autoconf $(bindir)/autoheader $(bindir)/autoscan - rm -f $(bindir)/autoreconf $(bindir)/autoupdate - rm -f $(bindir)/shindent $(bindir)/ifnames + rm -f $(bindir)/autoreconf $(bindir)/autoupdate $(bindir)/ifnames rm -fr $(acdatadir) cd $(infodir); rm -f autoconf.info* if test -f standards.info || test -f $(srcdir)/standards.info; \ @@ -188,8 +179,7 @@ clean mostlyclean distclean realclean:: done clean mostlyclean distclean realclean:: - rm -f autoconf autoheader autoscan autoreconf autoupdate - rm -f shindent ifnames *.tmp + rm -f autoconf autoheader autoscan autoreconf autoupdate ifnames *.tmp rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.ma *.mas diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 15b5442df..e2511df52 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -6,8 +6,8 @@ @c @setchapternewpage odd @c %**end of header -@set EDITION 1.100 -@set VERSION 1.100 +@set EDITION 1.101 +@set VERSION 1.101 @set UPDATED August 1994 @iftex @@ -120,7 +120,6 @@ Making @code{configure} Scripts * Invoking ifnames:: Listing the conditionals in source code. * Invoking autoreconf:: Remaking multiple @code{configure} scripts. * Invoking autoupdate:: Replacing old macro names in @code{configure.in}. -* Invoking shindent:: Making @code{configure} scripts more readable. Specific Tests @@ -383,7 +382,6 @@ Makefile.in ---' `-> Makefile ---' * Invoking ifnames:: Listing the conditionals in source code. * Invoking autoreconf:: Remaking multiple @code{configure} scripts. * Invoking autoupdate:: Replacing old macro names in @code{configure.in}. -* Invoking shindent:: Making @code{configure} scripts more readable. @end menu @node Writing configure.in, Invoking autoconf, , Making configure Scripts @@ -636,7 +634,7 @@ Print the name of each directory where @code{autoreconf} runs Print the version number of @code{autoreconf} and exit. @end table -@node Invoking autoupdate, Invoking shindent, Invoking autoreconf, Making configure Scripts +@node Invoking autoupdate, , Invoking autoreconf, Making configure Scripts @section Invoking autoupdate The @code{autoupdate} program updates a @file{configure.in} file that @@ -674,56 +672,6 @@ default installation directory. Print the version number of @code{autoupdate} and exit. @end table -@node Invoking shindent, , Invoking autoupdate, Making configure Scripts -@section Invoking shindent - -Autoconf-generated @code{configure} scripts can be somewhat hard to -read, because they @emph{look} machine-generated---mainly because they -do not use whitespace rationally. Unfortunately, it is impossible to do -proper indentation using a macro processor like @code{m4}. However, if -you have GNU @code{bash} installed, you can use the @code{shindent} -program, which uses @code{bash} to give a Bourne shell script readable -indentation. - -@code{shindent} indents each script named on the command line, backing -up the original version with the suffix @file{~} (or the value of the -environment variable @code{SIMPLE_BACKUP_SUFFIX}, if that is set). -@code{shindent} places some restrictions on its input, due to the way it -uses @code{bash} to do the indentation: - -@itemize @bullet -@item -It removes comments and blank lines between cases case statements. - -@item -Doing odd things in case statements might cause odd problems. - -@item -The script must not define any shell functions. - -@item -If any string literals or here-documents contain lines that start -with four spaces, those spaces will be removed. - -@item -The script must not be @code{shindent} itself. -@end itemize - -@noindent -@code{shindent} accepts the following options: - -@table @code -@item --help -Print a summary of the command line options and exit. - -@item --macrodir=@var{dir} -Look for the Autoconf macro files in directory @var{dir} instead of the -default installation directory. Only used to get the version number. - -@item --version -Print the version number of @code{shindent} and exit. -@end table - @node Specific Tests, General Purpose Macros, Making configure Scripts, Top @chapter Specific Tests @@ -2259,18 +2207,26 @@ variables. @defmac AC_DEFINE (@var{variable} @r{[}, @var{value}@r{]}) @maindex DEFINE Define C preprocessor variable @var{variable}. If @var{value} is given, -set @var{variable} to that value, otherwise set it to 1. To use a shell -variable as the value, use @code{AC_DEFINE_UNQUOTED} instead and precede -double quotes in the value with backslashes. - -This macro adds to the shell variable @code{DEFS}. @code{AC_OUTPUT} -later substitutes the values in @code{DEFS} into the file(s) that it -generates (typically @file{Makefile}). Alternately, if -@code{AC_CONFIG_HEADER} has been called, @code{AC_OUTPUT} creates a -header file by substituting the correct values into @code{#define} -statements in a template file. - -For example, suppose your @file{configure.in} calls +set @var{variable} to that value (verbatim), otherwise set it to 1. +@var{value} should not contain literal newlines, and if you are not +using @code{AC_CONFIG_HEADER} it should not contain any @samp{#} +characters, as @code{make} tends to eat them. To use a shell variable +as the value, use @code{AC_DEFINE_UNQUOTED} instead. + +@code{AC_OUTPUT} substitutes the values defined by this macro as the +variable @code{DEFS} in the file(s) that it generates (typically +@file{Makefile}). Unlike in Autoconf version 1, there is no variable +@code{DEFS} defined while @code{configure} is running, so macros cannot +check its value for the results of previous tests. This difference is +because properly quoting the contents of that variable turned out to be +too cumbersome and inefficient to do every time @code{AC_DEFINE} is +called. Checking cache variable values is a cleaner way to get the +effect of checking the value of @code{DEFS}. + +If @code{AC_CONFIG_HEADER} has been called, then instead of substituting +@code{DEFS}, @code{AC_OUTPUT} creates a header file by substituting the +correct values into @code{#define} statements in a template file. For +example, suppose your @file{configure.in} calls @code{AC_CONFIG_HEADER(conf.h)} and @code{AC_CHECK_HEADERS(unistd.h)}. You could have code like this in @file{conf.h.in}: @@ -2326,15 +2282,14 @@ AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4); LIBS="$LIBS -lelf") @defmac AC_DEFINE_UNQUOTED (@var{variable} @r{[}, @var{value}@r{]}) @maindex DEFINE_UNQUOTED -Like @code{AC_DEFINE}, but it does nothing to quote @var{value} from -various shell and @code{sed} expansions it will undergo. @var{value} -will be used in many different contexts requiring different quoting, and -it is up to you to make sure it works right. Use this macro instead of -@code{AC_DEFINE} when @var{value} contains a shell variable. For +Like @code{AC_DEFINE}, but three shell expansions are performed once on +@var{value}: variable expansion (@samp{$}), command substitution +(@samp{`}), and backslash escaping (@samp{\}). Use this macro instead +of @code{AC_DEFINE} when @var{value} contains a shell variable. For example: @example -AC_DEFINE_UNQUOTED(config_machfile, $@{machfile@}) +AC_DEFINE_UNQUOTED(config_machfile, "$@{machfile@}") @end example @end defmac @@ -2977,12 +2932,6 @@ AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) fi @end example -@noindent -Unlike in Autoconf version 1, there is no shell variable @code{DEFS} set -while @code{configure} is running. This difference is because properly -quoting the contents of that variable turned out to be too cumbersome to -do every time @code{AC_DEFINE} is called. - @node Test Programs, Multiple Cases, Checking for Symbols, Writing Macros @section Test Programs diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 0866d98fc..8f8ca6099 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -35,7 +35,7 @@ Install it before installing Autoconf or set the M4 environment variable to its path name. )m4exit(2)])dnl dnl -define(AC_ACVERSION, 1.100)dnl +define(AC_ACVERSION, 1.101)dnl dnl This is defined by the --version option of the autoconf script. ifdef([AC_PRINT_VERSION], [Autoconf version AC_ACVERSION m4exit(0)])dnl @@ -53,12 +53,12 @@ divert(AC_DIVERSION_NORMAL)dnl dnl dnl Define a macro which automatically provides itself. dnl Use instead of define for macros to be used as functions. -dnl dnl AC_DEFUN(NAME, EXPANSION) define([AC_DEFUN], [define($1, [define([AC_PROVIDE_$1], )][$2])])dnl dnl +dnl AC_INIT_NOTICE() AC_DEFUN(AC_INIT_NOTICE, [# Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version] AC_ACVERSION [ @@ -79,6 +79,7 @@ AC_DEFUN(AC_INIT_NOTICE, # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ])dnl dnl +dnl AC_INIT_PARSE_ARGS() AC_DEFUN(AC_INIT_PARSE_ARGS, [AC_BEFORE([$0], [AC_ARG_ENABLE])dnl AC_BEFORE([$0], [AC_ARG_WITH])dnl @@ -361,12 +362,13 @@ if test -n "$ac_prev"; then fi ])dnl dnl -dnl Try to have only one #! line, just so it doesn't look funny. -dnl +dnl Try to have only one #! line, so the script doesn't look funny. +dnl AC_BINSH() AC_DEFUN(AC_BINSH, [#!/bin/sh ])dnl dnl +dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR) AC_DEFUN(AC_INIT, [AC_REQUIRE([AC_BINSH])dnl AC_INIT_NOTICE @@ -472,6 +474,11 @@ AC_CACHE_LOAD AC_LANG_C undivert(AC_DIVERSION_ARG)dnl +dnl Substitute for predefined variables. +AC_SUBST(LIBS)dnl +AC_SUBST(prefix)dnl +AC_SUBST(exec_prefix)dnl +AC_SUBST(DEFS)dnl ])dnl dnl dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE]) @@ -537,30 +544,33 @@ AC_DEFUN(AC_REVISION, dnl dnl Subroutines of AC_PREREQ. dnl -dnl Change the dots in version number $1 into commas. +dnl Change the dots in NUMBER into commas. +dnl AC_PREREQ_SPLIT(NUMBER) AC_DEFUN(AC_PREREQ_SPLIT, [translit($1, ., [, ])])dnl dnl dnl Default the ternary version number to 0 (e.g., 1, 7 -> 1, 7, 0). +dnl AC_PREREQ_CANON(MAJOR, MINOR [,TERNARY]) AC_DEFUN(AC_PREREQ_CANON, [$1, $2, ifelse([$3], , 0, [$3])])dnl dnl -dnl Complain and exit if the version number in $1 through $3 is less than -dnl the version number in $4 through $6. -dnl $7 is the printable version of the second version number. +dnl Complain and exit if version number 1 is less than version number 2. +dnl PRINTABLE2 is the printable version of version number 2. +dnl AC_PREREQ_COMPARE(MAJOR1, MINOR1, TERNARY1, MAJOR2, MINOR2, TERNARY2, +dnl PRINTABLE2) AC_DEFUN(AC_PREREQ_COMPARE, [ifelse(builtin([eval], [$3 + $2 * 100 + $1 * 10000 < $6 + $5 * 100 + $4 * 10000]), 1, [errprint(Autoconf version $7 or higher is required )m4exit(3)])])dnl dnl -dnl Complain and exit if the Autoconf version is less than $1. +dnl Complain and exit if the Autoconf version is less than VERSION. dnl AC_PREREQ(VERSION) AC_DEFUN(AC_PREREQ, [AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1])])dnl dnl -dnl Run configure in subdirectories $1. +dnl Run configure in subdirectories DIR... dnl Not actually done until AC_OUTPUT_SUBDIRS. dnl AC_CONFIG_SUBDIRS(DIR ...) AC_DEFUN(AC_CONFIG_SUBDIRS, @@ -586,7 +596,7 @@ changequote(<<, >>)dnl changequote([, ])dnl fi fi -undefine(AC_VAR_NAME)dnl +undefine([AC_VAR_NAME])dnl ])dnl AC_DEFUN(AC_PREFIX, [AC_OBSOLETE([$0], [; instead use AC_PREFIX_PROGRAM before AC_INIT])dnl @@ -597,8 +607,8 @@ dnl ### Canonicalizing the system type dnl dnl dnl Find install.sh, config.sub, config.guess, and Cygnus configure -dnl in directory $1. These are auxiliary files used in configuration. -dnl $1 can be either absolute or relative to ${srcdir}. +dnl in directory DIR. These are auxiliary files used in configuration. +dnl DIR can be either absolute or relative to ${srcdir}. dnl AC_CONFIG_AUX_DIR(DIR) AC_DEFUN(AC_CONFIG_AUX_DIR, [AC_CONFIG_AUX_DIRS($1 ${srcdir}/$1)])dnl @@ -738,8 +748,8 @@ AC_SUBST(build_vendor)dnl AC_SUBST(build_os)dnl ])dnl dnl -dnl Link each of the existing files in $2 to the corresponding -dnl link name in $1. +dnl Link each of the existing files FILE... to the corresponding +dnl link name in LINK... dnl Not actually done until AC_OUTPUT_LINKS. dnl AC_LINK_FILES(LINK ..., FILE ...) AC_DEFUN(AC_LINK_FILES, @@ -750,6 +760,7 @@ dnl ### Caching test results dnl dnl dnl Look for site or system specific initialization scripts. +dnl AC_SITE_LOAD() AC_DEFUN(AC_SITE_LOAD, [# Prefer explicitly selected file to automatically selected ones. if test ! -r "$CONFIG_SITE"; then @@ -771,6 +782,7 @@ for ac_site_file in $CONFIG_SITE; do done ])dnl dnl +dnl AC_CACHE_LOAD() AC_DEFUN(AC_CACHE_LOAD, [if test -r "$cache_file"; then echo "loading cache $cache_file" @@ -781,10 +793,11 @@ else fi ])dnl dnl +dnl AC_CACHE_SAVE() AC_DEFUN(AC_CACHE_SAVE, [if test -w $cache_file; then echo "updating cache $cache_file" -cat > $cache_file <<\CEOF +cat > $cache_file <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. @@ -798,7 +811,7 @@ cat > $cache_file <<\CEOF # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. -CEOF +EOF changequote(, )dnl dnl Allow a site initialization script to override cache values. # Ultrix sh set writes to stderr and can't be redirected directly. @@ -809,8 +822,8 @@ echo "not updating unwritable cache $cache_file" fi ])dnl dnl -dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved. +dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) AC_DEFUN(AC_CACHE_VAL, [AC_REQUIRE([AC_PROG_ECHO_N])dnl dnl We used to use the below line, but it fails if the 1st arg is a @@ -827,95 +840,22 @@ dnl dnl ### Setting variables dnl dnl -dnl Several simple subroutines to do various flavors of quoting. -dnl -dnl Quote $1 against shell "s. -AC_DEFUN(AC_QUOTE_DQUOTE, -[dnl We use \1 instead of \& to avoid an m4 1.0.3 bug. -patsubst($1, changequote(, )\([$"`\\]\)changequote([, ]), \\\1)])dnl -dnl -dnl Quote $1 against shell 's. -AC_DEFUN(AC_QUOTE_SQUOTE, -[patsubst($1, ', '\\'')])dnl -dnl -dnl Quote $1 against shell here documents (<> confdefs.h -dnl Define DEFS even if AC_LIST_HEADERS for use in user case statements. -DEFS="$DEFS -D$1=AC_QUOTE_SQUOTE(AC_VAL)" -ifdef([AC_LIST_HEADERS], -ac_sed_defs="dnl -${ac_sed_defs}\${ac_dA}$1\${ac_dB}$1\${ac_dC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_dD} -\${ac_uA}$1\${ac_uB}$1\${ac_uC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_uD} -\${ac_eA}$1\${ac_eB}$1\${ac_eC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_eD} -" -)dnl -} +[cat >> confdefs.h <<\EOF +[#define] $1 ifelse($#, 2, [$2], 1) +EOF ])dnl dnl -dnl Unsafe version of AC_DEFINE. -dnl Users are responsible for the quoting nightmare. -dnl Well, not all of it. We need to pull the identity function out to -dnl the top level, because m4 doesn't really support nested functions; -dnl it doesn't distinguish between the arguments to the outer -dnl function, which should be expanded, and the arguments to the inner -dnl function, which shouldn't yet. -AC_DEFUN(AC_QUOTE_IDENTITY, -$1)dnl +dnl Similar, but perform shell substitutions $ ` \ once on VALUE. AC_DEFUN(AC_DEFINE_UNQUOTED, -[pushdef([AC_QUOTE_SQUOTE], defn([AC_QUOTE_IDENTITY]))dnl -pushdef([AC_DEFINE_SEDQUOTE], defn([AC_QUOTE_IDENTITY]))dnl -AC_DEFINE($1, $2)dnl -popdef([AC_DEFINE_SEDQUOTE])dnl -popdef([AC_QUOTE_SQUOTE])dnl +[cat >> confdefs.h <&AC_FD_MSG])dnl dnl +dnl AC_CHECKING(FEATURE-DESCRIPTION) AC_DEFUN(AC_CHECKING, [echo "checking $1" 1>&AC_FD_MSG])dnl dnl @@ -962,6 +904,7 @@ AC_DEFUN(AC_MSG_RESULT, [AC_REQUIRE([AC_PROG_ECHO_N])dnl echo "$ac_t""$1" 1>&AC_FD_MSG])dnl dnl +dnl AC_VERBOSE(RESULT-DESCRIPTION) AC_DEFUN(AC_VERBOSE, [AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl echo " $1" 1>&AC_FD_MSG])dnl @@ -978,6 +921,7 @@ dnl dnl ### Selecting which language to use for testing dnl dnl +dnl AC_LANG_C() AC_DEFUN(AC_LANG_C, [define([AC_LANG], [C])dnl ac_ext=c @@ -986,6 +930,7 @@ ac_cpp='${CPP}' ac_compile='${CC-cc} $CFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' ])dnl dnl +dnl AC_LANG_CPLUSPLUS() AC_DEFUN(AC_LANG_CPLUSPLUS, [define([AC_LANG], [CPLUSPLUS])dnl ac_ext=C @@ -995,10 +940,13 @@ ac_compile='${CXX-gcc} $CXXFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1 ])dnl dnl dnl Push the current language on a stack. +dnl +dnl AC_LANG_SAVE() AC_DEFUN(AC_LANG_SAVE, [pushdef([AC_LANG_STACK], AC_LANG)])dnl dnl dnl Restore the current language from the stack. +dnl AC_LANG_RESTORE() AC_DEFUN(AC_LANG_RESTORE, [ifelse(AC_LANG_STACK, C, [ifelse(AC_LANG, C, , [AC_LANG_C])], [ifelse(AC_LANG, CPLUSPLUS, , [AC_LANG_CPLUSPLUS])])[]popdef([AC_LANG_STACK])])dnl dnl @@ -1029,7 +977,7 @@ dnl ### Checking for files - fundamental (caching) dnl dnl dnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND -dnl [, VALUE-IF-NOT-FOUND]) +dnl [, VALUE-IF-NOT-FOUND]) AC_DEFUN(AC_CHECK_PROG, [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 @@ -1121,12 +1069,12 @@ ifelse([$3], , , [test -n "[$]$1" || $1="$3" ])])dnl dnl dnl AC_CHECK_LIB(LIBRARY, FUNCTION, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND -dnl [, OTHER-LIBRARIES]]]) +dnl [, OTHER-LIBRARIES]]]) AC_DEFUN(AC_CHECK_LIB, -[changequote(/, /)dnl -define(/AC_LIB_NAME/, dnl -patsubst(patsubst($1, /lib\([^\.]*\)\.a/, /\1/), /-l/, //))dnl -define(/AC_CV_NAME/, ac_cv_lib_//AC_LIB_NAME)dnl +[changequote(<<, >>)dnl +define(<>, dnl +patsubst(patsubst($1, <>, <<\1>>), <<-l>>, <<>>))dnl +define(<>, ac_cv_lib_<<>>AC_LIB_NAME)dnl changequote([, ])dnl AC_MSG_CHECKING([for -l[]AC_LIB_NAME]) AC_CACHE_VAL(AC_CV_NAME, @@ -1145,8 +1093,8 @@ ifelse([$4], , , [else $4 ])dnl fi -undefine(AC_LIB_NAME)dnl -undefine(AC_CV_NAME)dnl +undefine([AC_LIB_NAME])dnl +undefine([AC_CV_NAME])dnl ])dnl dnl dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND @@ -1168,7 +1116,7 @@ dnl dnl Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must dnl come early, it is not included in AC_BEFORE checks. dnl AC_EGREP_CPP(PATTERN, PROGRAM, ACTION-IF-FOUND [, -dnl ACTION-IF-NOT-FOUND]) +dnl ACTION-IF-NOT-FOUND]) AC_DEFUN(AC_EGREP_CPP, [AC_REQUIRE_CPP()dnl cat > conftest.${ac_ext} < conftest.${ac_ext} <conftest.def < ${CONFIG_STATUS} <> ${CONFIG_STATUS} <<\EOF AC_OUTPUT_FILES($1) ifdef([AC_LIST_HEADERS], [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_LINKS, AC_LIST_FILES)])dnl @@ -1477,14 +1406,49 @@ exit 0 EOF chmod +x ${CONFIG_STATUS} test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} ${CONFIG_STATUS} -dnl config.status should never do recursion. +dnl config.status should not do recursion. ifdef([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl ])dnl dnl -dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted +dnl This is a subroutine of AC_OUTPUT. +dnl AC_OUTPUT_MAKE_DEFS() +AC_DEFUN(AC_OUTPUT_MAKE_DEFS, +[# Transform confdefs.h into DEFS. +dnl Using a here document instead of a string reduces the quoting nightmare. +cat > conftest.defs <<\EOF +changequote(<<, >>)dnl +s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g +# Protect against shell expansion while executing Makefile rules. +s%[ `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +# Protect against Makefile macro expansion. +s%\$%$$%g +# Protect against being on the right side of a sed subst in config.status. +s/[\\&%]/\\&/g +changequote([, ])dnl +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs +])dnl +dnl +dnl This is a subroutine of AC_OUTPUT. It is called inside an unquoted dnl here document whose contents are going into config.status. +dnl AC_OUTPUT_FILES(FILE...) AC_DEFUN(AC_OUTPUT_FILES, -[CONFIG_FILES=${CONFIG_FILES-"$1"} +[cat > conftest.subs <<\CEOF +dnl These here document variables are unquoted when configure runs +dnl but quoted when config.status runs, so variables are expanded once. +$ac_vpsub +dnl Shell code in configure.in might set extrasub. +$extrasub +dnl Insert the sed substitutions of variables. +undivert(AC_DIVERSION_SED) +CEOF +EOF +cat >> ${CONFIG_STATUS} <<\EOF + +CONFIG_FILES=${CONFIG_FILES-"$1"} for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then # Support "outfile[:infile]", defaulting infile="outfile.in". case "$ac_file" in @@ -1551,131 +1515,114 @@ a\\ } " ;; esac - sed -e " -$ac_comsub -EOF -cat >> ${CONFIG_STATUS} <> ${CONFIG_STATUS} <<\EOF -" $ac_given_srcdir/$ac_file_in > $ac_file +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file fi; done +rm -f conftest.subs ])dnl dnl -dnl Create the header files listed in $1. dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted dnl here document whose contents are going into config.status. +dnl AC_OUTPUT_HEADER(HEADER-FILE...) AC_DEFUN(AC_OUTPUT_HEADER, [changequote(<<, >>)dnl -# These sed commands are put into ac_sed_defs when defining a macro. -# They are broken into pieces to make the sed script easier to manage. -# They are passed to sed as "A NAME B NAME C VALUE D", where NAME -# is the cpp macro being defined and VALUE is the value it is being given. -# Each defining turns into a single global substitution command. -# Hopefully no one uses "!" as a variable value. -# Other candidates for the sed separators, like , and @, do get used. +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s!^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*!\1#\2' +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' -ac_dD='!g' +ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s!^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)!\1#\2define\3' +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' -ac_uD='\4!g' +ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s!^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='<<$>>!\1#\2define\3' +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='<<$>>%\1#\2define\3' ac_eC=' ' -ac_eD='!g' +ac_eD='%g' changequote([, ])dnl -rm -f conftest.sed + +CONFIG_HEADERS=${CONFIG_HEADERS-"$1"} +for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + cp $ac_given_srcdir/$ac_file_in conftest.in + EOF -# Turn off quoting long enough to insert the sed commands. -rm -f conftest.sh -cat > conftest.sh < conftest.hdr <<\EOF +changequote(<<, >>)dnl +# Protect against being on the right side of a sed subst in config.status. +s/[\\&%]/\\&/g +# Protect against being in an unquoted here document in config.status. +s%[\\$`]%\\&%g +s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +changequote([, ])dnl EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr -# Break up $ac_sed_defs (now in conftest.sh) because some shells have a limit -# on the size of here documents. +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +changequote(, )dnl +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +changequote([, ])dnl +EOF +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. # Maximum number of lines to put in a single here document. -ac_max_sh_lines=9 +ac_max_here_lines=12 +rm -f conftest.tail while : do - # wc gives bogus results for an empty file on some AIX systems. - ac_lines=`grep -c . conftest.sh` + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - rm -f conftest.s1 conftest.s2 - sed ${ac_max_sh_lines}q conftest.sh > conftest.s1 # Like head -9. - sed 1,${ac_max_sh_lines}d conftest.sh > conftest.s2 # Like tail +10. - # Write a limited-size here document to append to conftest.sed. - echo 'cat >> conftest.sed <> ${CONFIG_STATUS} - cat conftest.s1 >> ${CONFIG_STATUS} - echo 'CONFEOF' >> ${CONFIG_STATUS} - rm -f conftest.s1 conftest.sh - mv conftest.s2 conftest.sh + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> ${CONFIG_STATUS} + sed ${ac_max_here_lines}q conftest.vals >> ${CONFIG_STATUS} + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + mv conftest.out conftest.in +' >> ${CONFIG_STATUS} + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + mv conftest.tail conftest.vals done -rm -f conftest.sh +rm -f conftest.vals # Now back to your regularly scheduled config.status. cat >> ${CONFIG_STATUS} <<\EOF -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it in -[#] $1. -cat >> conftest.sed <<\CONFEOF -changequote(, )dnl -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -changequote([, ])dnl -CONFEOF -rm -f conftest.h -# Break up the sed commands because old seds have small limits. -ac_max_sed_lines=20 - -CONFIG_HEADERS=${CONFIG_HEADERS-"$1"} -for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then - # Support "outfile[:infile]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - echo creating $ac_file - - cp $ac_given_srcdir/$ac_file_in conftest.h1 - cp conftest.sed conftest.stm - while : - do - ac_lines=`grep -c . conftest.stm` - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - rm -f conftest.s1 conftest.s2 conftest.h2 - sed ${ac_max_sed_lines}q conftest.stm > conftest.s1 # Like head -20. - sed 1,${ac_max_sed_lines}d conftest.stm > conftest.s2 # Like tail +21. - sed -f conftest.s1 < conftest.h1 > conftest.h2 - rm -f conftest.s1 conftest.h1 conftest.stm - mv conftest.h2 conftest.h1 - mv conftest.s2 conftest.stm - done - rm -f conftest.stm conftest.h + rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.h1 >> conftest.h - rm -f conftest.h1 + cat conftest.in >> conftest.h + rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then - # The file exists and we would not be changing it. echo "$ac_file is unchanged" rm -f conftest.h else @@ -1683,10 +1630,10 @@ for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then mv conftest.h $ac_file fi fi; done -rm -f conftest.sed ])dnl dnl +dnl AC_OUTPUT_LINKS(DEST..., SOURCE...) AC_DEFUN(AC_OUTPUT_LINKS, [ac_links="$1" ac_files="$2" @@ -1709,6 +1656,7 @@ while test -n "${ac_files}"; do done ])dnl dnl +dnl AC_OUTPUT_SUBDIRS(DIRECTORY...) AC_DEFUN(AC_OUTPUT_SUBDIRS, [if test -z "${norecursion}"; then diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 214a2c56b..85e932c2f 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -30,7 +30,8 @@ dnl Idea borrowed from dist 3.0. dnl Internal use only. AC_DEFUN(AC_PROG_ECHO_N, [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn > /dev/null; then ac_n= ac_c=' ' ac_t=' ' else @@ -87,15 +88,14 @@ if test $ac_cv_prog_gcc = yes; then AC_MSG_CHECKING(whether -traditional is needed) AC_CACHE_VAL(ac_cv_prog_gcc_traditional, [ ac_pattern="Autoconf.*'x'" - ac_prog='#include -Autoconf TIOCGETP' - AC_EGREP_CPP($ac_pattern, $ac_prog, + AC_EGREP_CPP($ac_pattern, [#include +Autoconf TIOCGETP], ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no) if test $ac_cv_prog_gcc_traditional = no; then - ac_prog='#include -Autoconf TCGETA' - AC_EGREP_CPP($ac_pattern, $ac_prog, ac_cv_prog_gcc_traditional=yes) + AC_EGREP_CPP($ac_pattern, [#include +Autoconf TCGETA], + ac_cv_prog_gcc_traditional=yes) fi])dnl AC_MSG_RESULT($ac_cv_prog_gcc_traditional) if test $ac_cv_prog_gcc_traditional = yes; then @@ -547,9 +547,10 @@ AC_DEFUN(AC_TYPE_GETGROUPS, [AC_REQUIRE([AC_TYPE_UID_T])dnl AC_MSG_CHECKING(type of array argument to getgroups) AC_CACHE_VAL(ac_cv_type_getgroups, -[changequote(, )dnl -dnl Do not put single quotes in the C program text! -ac_prog='/* Thanks to Mike Rendell for this test. */ +[AC_TRY_RUN( +changequote(<<, >>)dnl +<< +/* Thanks to Mike Rendell for this test. */ #include #define NGID 256 #undef MAX @@ -568,9 +569,9 @@ main() /* Exit non-zero if getgroups seems to require an array of ints. This happens when gid_t is short but getgroups modifies an array of ints. */ exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); -}' +} +>>, changequote([, ])dnl -AC_TRY_RUN([$ac_prog], ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)])dnl AC_MSG_RESULT($ac_cv_type_getgroups) AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups) @@ -1310,9 +1311,10 @@ AC_DEFUN(AC_C_CONST, dnl and with the result message. AC_MSG_CHECKING([for working const]) AC_CACHE_VAL(ac_cv_c_const, -[changequote(, )dnl -dnl Do not put single quotes in the C program text! -ac_prog='/* Ultrix mips cc rejects this. */ +[AC_TRY_LINK(, +changequote(<<, >>)dnl +<< +/* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; @@ -1349,9 +1351,10 @@ ccp = (char const *const *) p; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; -}' +} +>>, changequote([, ])dnl -AC_TRY_LINK(, [$ac_prog], ac_cv_c_const=yes, ac_cv_c_const=no)])dnl +ac_cv_c_const=yes, ac_cv_c_const=no)])dnl AC_MSG_RESULT($ac_cv_c_const) if test $ac_cv_c_const = no; then AC_DEFINE(const, )