From af8eb3314f8e23df0a9aa3c4da46e94a62512728 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 29 Mar 2000 16:48:00 +0000 Subject: [PATCH] Rewrite the autoheader chain on top of `autoconf --trace'. * autoheader.m4: Dispatch the prototypes next to there AC_ siblings. (AH_TEMPLATE, AH_VERBATIM): Move to... * acgeneral.m4: here. (AH_OUTPUT): New macro. * autoheader.sh: Run `autoconf --trace' instead of `m4 autoheader.m4'. * autoheader.m4: Remove. * Makefile.am: Adjust. * tests/tools.m4 (AH_DEFUN): Remove, no longer makes sense. * tests/actests.m4 (autoheader::AC_TATOOINE): Remove, was used by the test above. --- ChangeLog | 16 +++ Makefile.am | 7 +- Makefile.in | 7 +- acgeneral.m4 | 92 +++++++++++-- aclang.m4 | 19 ++- acspecific.m4 | 26 +++- autoheader.in | 43 ++---- autoheader.m4 | 291 --------------------------------------- autoheader.sh | 43 ++---- bin/autoheader.in | 43 ++---- configure | 26 ++-- lib/autoconf/c.m4 | 19 ++- lib/autoconf/fortran.m4 | 19 ++- lib/autoconf/general.m4 | 92 +++++++++++-- lib/autoconf/lang.m4 | 19 ++- lib/autoconf/specific.m4 | 26 +++- tests/actest.m4 | 7 - tests/tools.m4 | 36 ----- 18 files changed, 342 insertions(+), 489 deletions(-) delete mode 100644 autoheader.m4 diff --git a/ChangeLog b/ChangeLog index 96bbb72f..a604eb0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2000-03-29 Akim Demaille + + Rewrite the autoheader chain on top of `autoconf --trace'. + + * autoheader.m4: Dispatch the prototypes next to there AC_ + siblings. + (AH_TEMPLATE, AH_VERBATIM): Move to... + * acgeneral.m4: here. + (AH_OUTPUT): New macro. + * autoheader.sh: Run `autoconf --trace' instead of `m4 autoheader.m4'. + * autoheader.m4: Remove. + * Makefile.am: Adjust. + * tests/tools.m4 (AH_DEFUN): Remove, no longer makes sense. + * tests/actests.m4 (autoheader::AC_TATOOINE): Remove, was used by + the test above. + 2000-03-29 Akim Demaille silent.m4 depends upon the current quotation in m4, which changes diff --git a/Makefile.am b/Makefile.am index 913877c5..980dfb7c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,10 +36,10 @@ EXTRA_SCRIPTS = autoscan distpkgdataDATA = \ acfunctions acheaders acidentifiers acmakevars acprograms \ -libm4.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 autoconf.m4 autoheader.m4 \ +libm4.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 autoconf.m4 \ autoupdate.m4 aclang.m4 -nodistpkgdataDATA = autoconf.m4f autoheader.m4f autoupdate.m4f acversion.m4 +nodistpkgdataDATA = autoconf.m4f autoupdate.m4f acversion.m4 pkgdata_DATA = $(distpkgdataDATA) $(nodistpkgdataDATA) @@ -51,7 +51,7 @@ $(distpkgdataDATA) # Files that should be removed, but which Automake does not know: # the frozen files and the scripts. -CLEANFILES = autoconf.m4f autoheader.m4f autoupdate.m4f \ +CLEANFILES = autoconf.m4f autoupdate.m4f \ $(bin_SCRIPTS) # INSTALL is a special case. Automake seems to have a single name space @@ -98,5 +98,4 @@ common = libm4.m4 acgeneral.m4 acspecific.m4 acoldnames.m4 acversion.m4 \ aclang.m4 autoconf.m4f: autoconf.m4 $(common) -autoheader.m4f: autoheader.m4 $(common) autoupdate.m4f: autoupdate.m4 $(common) diff --git a/Makefile.in b/Makefile.in index 43b67bde..4531c6ce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,10 +79,10 @@ EXTRA_SCRIPTS = autoscan # s/nodistpackageDATA/nodist_pkgdata_DATA/ # and adapt dependencies once we use a more recent Automake -distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms libm4.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 autoconf.m4 autoheader.m4 autoupdate.m4 aclang.m4 +distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms libm4.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 autoconf.m4 autoupdate.m4 aclang.m4 -nodistpkgdataDATA = autoconf.m4f autoheader.m4f autoupdate.m4f acversion.m4 +nodistpkgdataDATA = autoconf.m4f autoupdate.m4f acversion.m4 pkgdata_DATA = $(distpkgdataDATA) $(nodistpkgdataDATA) @@ -92,7 +92,7 @@ EXTRA_DIST = $(OLDCHANGELOGS) autoconf.sh autoheader.sh autoreconf.sh autoupdate # Files that should be removed, but which Automake does not know: # the frozen files and the scripts. -CLEANFILES = autoconf.m4f autoheader.m4f autoupdate.m4f $(bin_SCRIPTS) +CLEANFILES = autoconf.m4f autoupdate.m4f $(bin_SCRIPTS) # The scripts. @@ -444,7 +444,6 @@ install-data-hook: INSTALL.txt esac autoconf.m4f: autoconf.m4 $(common) -autoheader.m4f: autoheader.m4 $(common) autoupdate.m4f: autoupdate.m4 $(common) # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/acgeneral.m4 b/acgeneral.m4 index 2a932609..815da747 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -368,6 +368,44 @@ AU_DEFINE([$1], [$2], [$3])dnl +## ------------------------- ## +## Interface to autoheader. ## +## ------------------------- ## + + +# AH_OUTPUT(TEXT) +# --------------- +# Pass TEXT to autoheader. +# This macro is `read' only via `autoconf --trace', it outputs nothing. +define([AH_OUTPUT], []) + + +# AH_VERBATIM(KEY, TEMPLATE) +# -------------------------- +# If KEY is direct (i.e., no indirection such as in KEY=$my_func which +# may occur if there is AC_CHECK_FUNCS($my_func)), issue an autoheader +# TEMPLATE associated to the KEY. Otherwise, do nothing. TEMPLATE is +# output as is, with no formating. +define([AH_VERBATIM], +[AC_VAR_IF_INDIR([$1],, +[# +AH_OUTPUT(ac_verbatim_$1="\ +_AC_SH_QUOTE([$2])" +) +])]) + + +# AH_TEMPLATE(KEY, DESCRIPTION) +# ----------------------------- +# Issue an autoheader template for KEY, i.e., a comment composed of +# DESCRIPTION (properly wrapped), and then #undef KEY. +define([AH_TEMPLATE], +[AH_VERBATIM([$1], + m4_wrap([$2 */], [ ], [/* ])[ +#undef $1])]) + + + ## --------------------- ## ## Some /bin/sh idioms. ## ## --------------------- ## @@ -1924,7 +1962,8 @@ AC_MSG_RESULT_UNQUOTED(AC_VAR_GET([$2]))]) # and if VARIABLE is affected the same VALUE, do nothing, else # die. The third argument is used by autoheader. define(AC_DEFINE, -[cat >>confdefs.h <<\EOF +[ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl +cat >>confdefs.h <<\EOF [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) EOF ]) @@ -1935,7 +1974,8 @@ EOF # ---------------------------------------------------- # Similar, but perform shell substitutions $ ` \ once on VALUE. define(AC_DEFINE_UNQUOTED, -[cat >>confdefs.h <>confdefs.h < header file.])])]) + # AC_CHECK_HEADERS(HEADER-FILE... # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ---------------------------------------------------------- AC_DEFUN(AC_CHECK_HEADERS, -[for ac_header in $1 +[AH_CHECK_HEADERS([$1])dnl +for ac_header in $1 do AC_CHECK_HEADER($ac_header, [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_$ac_header)) $2], @@ -2848,7 +2905,8 @@ AC_VAR_POPDEF([ac_File])dnl AC_DEFUN(AC_CHECK_FILES, [AC_FOREACH([AC_FILE_NAME], [$1], [AC_SPECIALIZE([AC_CHECK_FILE], AC_FILE_NAME, - [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_FILE_NAME)) + [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_FILE_NAME), 1, + [Define if you have the file `]AC_File['.]) $2], [$3])])]) @@ -2888,7 +2946,9 @@ AC_VAR_POPDEF([ac_Symbol])dnl AC_DEFUN([AC_CHECK_DECLS], [m4_foreach([AC_Symbol], [$1], [AC_SPECIALIZE([AC_CHECK_DECL], AC_Symbol, - [AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 1) + [AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 1, + [Define to 1 if you have the declaration + of `]AC_Symbol[', and to 0 if you don't.]) $2], [AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 0) $3], @@ -2942,7 +3002,10 @@ AC_VAR_POPDEF([ac_var])dnl # FIXME: Should we die if there are not enough arguments, or just # ignore? AC_DEFUN(AC_CHECK_FUNCS, -[for ac_func in $1 +[AC_FOREACH([AC_Func], [$1], + [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Func), + [Define if you have the `]AC_Func[' function.])])dnl +for ac_func in $1 do AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_$ac_func)) $2], @@ -2984,7 +3047,9 @@ main () AC_VAR_SET(ac_Sizeof, `cat conftestval`), AC_VAR_SET(ac_Sizeof, 0), ifval([$2], AC_VAR_SET(ac_Sizeof, $2)))]) -AC_DEFINE_UNQUOTED(AC_TR_CPP(sizeof_$1), AC_VAR_GET(ac_Sizeof)) +AC_DEFINE_UNQUOTED(AC_TR_CPP(sizeof_$1), + AC_VAR_GET(ac_Sizeof), + [The number of bytes in a `]$1['.]) AC_VAR_POPDEF([ac_Sizeof])dnl ]) @@ -3102,7 +3167,9 @@ AC_VAR_POPDEF([ac_Type])dnl AC_DEFUN([AC_CHECK_TYPES], [m4_foreach([AC_Type], [$1], [AC_SPECIALIZE([_AC_CHECK_TYPE_NEW], AC_Type, - [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Type)) + [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Type), 1, + [Define if the system has the type + `]AC_Type['.]) $2], [$3], [$4])])]) @@ -3115,7 +3182,8 @@ $2], # have to clean this up. AC_DEFUN([_AC_CHECK_TYPE_OLD], [_AC_CHECK_TYPE_NEW([$1],, - [AC_DEFINE_UNQUOTED([$1], [$2])])dnl + [AC_DEFINE_UNQUOTED([$1], [$2], + [Define to `$2' if does not define.])])dnl ])# _AC_CHECK_TYPE_OLD diff --git a/aclang.m4 b/aclang.m4 index 1aef9b7d..f9031d1d 100644 --- a/aclang.m4 +++ b/aclang.m4 @@ -912,7 +912,12 @@ AC_DEFUN(AC_C_CROSS, # AC_C_CHAR_UNSIGNED # ------------------ AC_DEFUN(AC_C_CHAR_UNSIGNED, -[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, +[AH_VERBATIM([__CHAR_UNSIGNED__], +[/* Define if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif])dnl +AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, [if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. AC_EGREP_CPP(yes, @@ -1436,7 +1441,17 @@ AC_LANG_RESTORE()dnl # underscores, respectively, so that they match the name mangling # scheme used by the Fortran 77 compiler. AC_DEFUN(AC_F77_WRAPPERS, -[AC_CACHE_CHECK([if we can define Fortran 77 name-mangling macros], +[AH_TEMPLATE([F77_FUNC], + [Define to a macro that performs the appropriate name + mangling on its argument to make the C identifier, which + *does not* contain underscores, match the name mangling + scheme of the Fortran 77 compiler.])dnl +AH_TEMPLATE([F77_FUNC_], + [Define to a macro that performs the appropriate name + mangling on its argument to make the C identifier, which + *does* contain underscores, match the name mangling + scheme of the Fortran 77 compiler.])dnl +AC_CACHE_CHECK([if we can define Fortran 77 name-mangling macros], ac_cv_f77_wrappers, [# Be optimistic at first. ac_cv_f77_wrappers="yes" diff --git a/acspecific.m4 b/acspecific.m4 index 90cde823..2ad76dae 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -143,7 +143,9 @@ AC_DEFUN(AC_PROG_YACC, # AC_PROG_LEX # ----------- AC_DEFUN(AC_PROG_LEX, -[AC_CHECK_PROG(LEX, flex, flex, lex) +[AH_CHECK_LIB(fl)dnl +AH_CHECK_LIB(l)dnl +AC_CHECK_PROG(LEX, flex, flex, lex) if test -z "$LEXLIB" then case "$LEX" in @@ -359,7 +361,8 @@ fi # Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that # defines `DIR'. define(_AC_CHECK_HEADERS_DIRENT, -[for ac_hdr in $1 +[AH_CHECK_HEADERS([$1])dnl +for ac_hdr in $1 do _AC_CHECK_HEADER_DIRENT($ac_hdr, [changequote(, )dnl @@ -683,7 +686,15 @@ AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal, # AC_FUNC_ALLOCA # -------------- AC_DEFUN(AC_FUNC_ALLOCA, -[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. +[AH_VERBATIM([STACK_DIRECTION], +[/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +@%:@undef STACK_DIRECTION])dnl +AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h, @@ -2448,7 +2459,14 @@ AC_SUBST(OBJEXT)]) # AC_AIX # ------ AC_DEFUN(AC_AIX, -[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl +[AH_VERBATIM([_ALL_SOURCE], +[/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif])dnl +AC_BEFORE([$0], [AC_TRY_COMPILE])dnl AC_BEFORE([$0], [AC_TRY_RUN])dnl AC_MSG_CHECKING(for AIX) AC_EGREP_CPP(yes, diff --git a/autoheader.in b/autoheader.in index 466b0146..9674a8fe 100644 --- a/autoheader.in +++ b/autoheader.in @@ -71,19 +71,6 @@ if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # would break. ac_LF_and_DOT=`echo; echo .` -# 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@} -case "$M4" in -/*) 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 &1` in -*reload-state*);; -*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;; -esac - # Variables. : ${AC_MACRODIR=@datadir@} debug=false @@ -139,11 +126,6 @@ while test $# -gt 0 ; do esac done -# Running m4. -test -n "$localdir" && use_localdir="-I$localdir" -run_m4="$M4 $use_localdir -I $AC_MACRODIR autoheader.m4" -run_m4f="$M4 $use_localdir --reload $AC_MACRODIR/autoheader.m4f" - acconfigs= test -r $localdir/acconfig.h && acconfigs="$acconfigs $localdir/acconfig.h" @@ -168,21 +150,14 @@ $debug || config_h= syms= -# Extract assignments of `ah_verbatim_SYMBOL' from the modified -# autoconf processing of the input file. The sed hair is necessary to -# win for multi-line macro invocations. -$run_m4f $infile >$tmpbase.exp -sed -n -e ' - : again - /^@@@.*@@@$/s/^@@@\(.*\)@@@$/\1/p - /^@@@/{ - s/^@@@//p - n - s/^/@@@/ - b again - }' $tmpbase.exp >$tmpbase.decls +# Source what the traces are trying to tell us. +autoconf=`echo "$0" | sed -e 's/autoheader$/autoconf/'` +test -n "$localdir" && autoconf="$autoconf -l $localdir" +export AC_MACRODIR +$autoconf --trace AH_OUTPUT:'$1' --trace AC_CONFIG_HEADERS:'config_h="$1"' \ + $infile >$tmpbase.decls . $tmpbase.decls -$debug || rm -f $tmpbase.exp $tmpbase.decls +$debug || rm -f $tmpbase.decls # Make SYMS newline-separated rather than blank-separated, and remove dups. # Start each symbol with a blank (to match the blank after "#undef") @@ -190,6 +165,9 @@ $debug || rm -f $tmpbase.exp $tmpbase.decls # is a substring of it. syms=`for sym in $syms; do echo $sym; done | sort | uniq | sed 's@^@ @'` + +# We template only the first CONFIG_HEADER. +config_h=`echo "$config_h" | sed -e 's/ .*//'` # Support "outfile[:infile]", defaulting infile="outfile.in". case "$config_h" in "") echo "$me: error: AC_CONFIG_HEADERS not found in $infile" >&2; exit 1 ;; @@ -198,6 +176,7 @@ case "$config_h" in *) config_h_in="$config_h.in" ;; esac + # Don't write "do not edit" -- it will get copied into the # config.h, which it's ok to edit. cat <$tmpout diff --git a/autoheader.m4 b/autoheader.m4 deleted file mode 100644 index 433b8863..00000000 --- a/autoheader.m4 +++ /dev/null @@ -1,291 +0,0 @@ -include(libm4.m4)# -*- Autoconf -*- -# This file is part of Autoconf. -# Driver and redefinitions of some Autoconf macros for autoheader. -# Copyright (C) 1994, 95, 99, 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. -# -# Originally written by Roland McGrath. -# -# Do not sinclude acsite.m4 here, because it may not be installed -# yet when Autoconf is frozen. -# Do not sinclude ./aclocal.m4 here, to prevent it from being frozen. -m4_include(acversion.m4) -m4_include(acgeneral.m4) -m4_include(aclang.m4) -m4_include(acspecific.m4) -m4_include(acoldnames.m4) -m4_namespace_push(autoheader) - - -# AH_DEFUN(MACRO, VALUE) -# ---------------------- -# -# Assign VALUE *and* the current value of MACRO to MACRO, in the -# namespace `autoheader'. We enter the namespace `autoheader' when -# running autoheader. -# -# There are several motivations for not just defining to be equivalent to -# AUTOHEADER-NAME. -# -# Let autoconf::AC_FOO (abbreviated AC_FOO below) be -# | AC_DEFINE(FOO, 1) -# | AC_DEFINE(BAR, 1) -# | AC_DEFINE(BAZ, 1, The value of BAZ.) -# Let autoheader::AC_FOO (abbreviated AH_FOO below) be -# | AH_TEMPLATE(FOO, The value of FOO.) -# -# If we hook AC_FOO to be AH_FOO only, then only FOO will be templated. -# If we hook AC_FOO to expand in both the former AC_FOO and AH_FOO, then -# both FOO and BAZ are templated. -# -# Additionaly, if AC_FOO is hooked to AH_FOO only, then we loose track -# of the other AC_DEFINE, and the autoheader machinery (see the use of -# the shell variable SYMS in AC_TEMPLATE) won't be able to see that BAR -# is not templated at all. Hooking AC_FOO on both its AC_ and AH_ faces -# makes sure we keep track of non templated DEFINEs. -# -# -# Finally, if AC_FOO requires a macro which AC_DEFINEs a symbol, -# then, if we used AH_FOO only, the required macro would not be -# expanded, thus its symbols would not be prototyped. -define(AH_DEFUN, -[m4_namespace_define(autoheader, [$1], -defn([$1]) -[$2])]) - -# The definition of `AH_DEFUN' above is used for accumulating the -# definitions before entering the `autoheader' namespace. Once we -# enter the autoheader::, `AH_DEFUN' must be understood as immediatly -# defining. This happens when we read user m4 files. -m4_define([autoheader::AH_DEFUN], -defn([m4_define])) -m4_namespace_register([AH_DEFUN], [autoheader]) - - - -# These are alternate definitions of some macros, which produce -# strings in the output marked with "@@@" so we can easily extract -# the information we want. The `#' at the end of the first line of -# each definition seems to be necessary to prevent m4 from eating -# the newline, which makes the @@@ not always be at the beginning of -# a line. - - -# Autoheader is not the right program to complain about cross-compiling. -AH_DEFUN([AC_TRY_RUN], -[$2 -$3 -$4]) - - -# AH_DEFINE(VARIABLE, [VALUE], [DESCRIPTION]) -# ------------------------------------------- -# When running autoheader, this macro replaces AC_DEFINE and -# AC_DEFINE_UNQUOTED. -# -# If DESCRIPTION is not given, then there is a risk that VARIABLE will -# not be properly templated. To control later that it has been -# templated elsewhere, store VARIABLE in a shell growing string, SYMS. -AH_DEFUN([AH_DEFINE], -[ifval([$3], - [AH_TEMPLATE([$1], [$3])], - [# -dnl Ignore CPP macro arguments. -@@@syms="$syms patsubst($1, [(.*$])"@@@ -])]) - -AH_DEFUN([AC_DEFINE], [AH_DEFINE($@)]) -AH_DEFUN([AC_DEFINE_UNQUOTED], [AH_DEFINE($@)]) - - -# AH_TEMPLATE(KEY, DESCRIPTION) -# ----------------------------- -# Issue an autoheader template for KEY, i.e., a comment composed -# of DESCRIPTION (properly wrapped), and then #undef KEY. -AH_DEFUN([AH_TEMPLATE], -[AH_VERBATIM([$1], - m4_wrap([$2 */], [ ], [/* ])[ -#undef $1])]) - - -# AH_VERBATIM(KEY, TEMPLATE) -# -------------------------- -# If KEY is direct (i.e., no indirection such as in KEY=$my_func which may -# occur if there is AC_CHECK_FUNCS($my_func)), issue an autoheader TEMPLATE -# associated to the KEY. Otherwise, do nothing. -# TEMPLATE is output as is, with no formating. -AH_DEFUN([AH_VERBATIM], -[AC_VAR_IF_INDIR([$1],, -[# -@@@ -ac_verbatim_$1="\ -_AC_SH_QUOTE([$2])" -@@@ -])]) - -# FIXME: To be rigorous, this should not be systematic: depending -# upon the arguments of AC_CHECK_LIB, we might not AC_DEFINE. -AH_DEFUN([AC_CHECK_LIB], -[AH_TEMPLATE(AC_TR_CPP(HAVE_LIB$1), - [Define if you have the `]$1[' library (-l]$1[).]) -# Success -$3 -# Failure -$4]) - -AH_DEFUN([AH_CHECK_HEADERS], -[AC_FOREACH([AC_Header], [$1], - [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Header), - [Define if you have the <]AC_Header[> header file.]) - # Success - $2 - # Failure - $3])]) - -AH_DEFUN([AC_CHECK_HEADERS], [AH_CHECK_HEADERS($@)]) -AH_DEFUN([_AC_CHECK_HEADERS_DIRENT], [AH_CHECK_HEADERS($@)]) - - -AH_DEFUN([AC_CHECK_FILES], -[AC_FOREACH([AC_File], [$1], - [AH_TEMPLATE(AC_TR_CPP([HAVE_]AC_File), - [Define if you have the file `]AC_File['.]) - # Success - $2 - # Failure - $3])]) - - -AH_DEFUN([AC_CHECK_DECLS], -[m4_foreach([AC_Symbol], [$1], - [AH_TEMPLATE(AC_TR_CPP([HAVE_DECL_]AC_Symbol), - [Define to 1 if you have the declaration of `]AC_Symbol[', - and to 0 if you don't.]) - # Success - $2 - # Failure - $3])]) - - -AH_DEFUN([AC_CHECK_FUNCS], -[AC_FOREACH([AC_Func], [$1], - [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Func), - [Define if you have the `]AC_Func[' function.]) - # Success - $2 - # Failure - $3]) -]) - -AH_DEFUN([AC_CHECK_SIZEOF], -[AH_TEMPLATE(AC_TR_CPP(SIZEOF_$1), - [The number of bytes in a `]$1['.])]) - - -AH_DEFUN([AC_PROG_LEX], -[AC_CHECK_LIB(fl) -AC_CHECK_LIB(l)]) - - -AH_DEFUN([AC_CHECK_MEMBERS], -[m4_foreach([AC_Member], [$1], - [pushdef(AC_Member_Aggregate, [patsubst(AC_Member, [\.[^.]*])]) - pushdef(AC_Member_Member, [patsubst(AC_Member, [.*\.])]) - AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Member), - [Define if `]AC_Member_Member[' is member of] - [`]AC_Member_Aggregate['.]) - popdef([AC_Member_Member]) - popdef([AC_Member_Aggregate]) - # Success - $2 - # Failure - $3]) -]) - - -# _AC_CHECK_TYPE_OLD(TYPE, DEFAULT) -# --------------------------------- -AH_DEFUN([_AC_CHECK_TYPE_OLD], -[AH_TEMPLATE([$1], [Define to `$2' if does not define.])]) - - -# AC_FUNC_ALLOCA -# -------------- -AH_DEFUN([AC_FUNC_ALLOCA], -[AH_VERBATIM([STACK_DIRECTION], -[/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION]) -])dnl AH_FUNC_ALLOCA - - -# AH_CHECK_TYPES((TYPES, ...)) -# ---------------------------- -AH_DEFUN([AC_CHECK_TYPES], -[m4_foreach([AC_Type], [$1], - [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Type), - [Define if the system has the type `]AC_Type['.]) - # Success - $2 - # Failure - $3]) -]) - - -AH_DEFUN([AC_C_CHAR_UNSIGNED], -[AH_VERBATIM([__CHAR_UNSIGNED__], -[/* Define if type `char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -# undef __CHAR_UNSIGNED__ -#endif]) -]) - - -AH_DEFUN([AC_AIX], -[AH_VERBATIM([_ALL_SOURCE], -[/* Define if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif]) -]) - - -AH_DEFUN([AC_F77_WRAPPERS], -[AH_TEMPLATE([F77_FUNC], - [Define to a macro that performs the appropriate name - mangling on its argument to make the C identifier, which - *does not* contain underscores, match the name mangling - scheme of the Fortran 77 compiler.]) -AH_TEMPLATE([F77_FUNC_], - [Define to a macro that performs the appropriate name - mangling on its argument to make the C identifier, which - *does* contain underscores, match the name mangling - scheme of the Fortran 77 compiler.])]) - - -AH_DEFUN([AC_CONFIG_HEADERS], -[@@@config_h=patsubst($1, [ .*$], [])@@@ -]) - -# Enter the `autoheader' name space -m4_enable(autoheader) diff --git a/autoheader.sh b/autoheader.sh index 466b0146..9674a8fe 100644 --- a/autoheader.sh +++ b/autoheader.sh @@ -71,19 +71,6 @@ if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # would break. ac_LF_and_DOT=`echo; echo .` -# 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@} -case "$M4" in -/*) 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 &1` in -*reload-state*);; -*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;; -esac - # Variables. : ${AC_MACRODIR=@datadir@} debug=false @@ -139,11 +126,6 @@ while test $# -gt 0 ; do esac done -# Running m4. -test -n "$localdir" && use_localdir="-I$localdir" -run_m4="$M4 $use_localdir -I $AC_MACRODIR autoheader.m4" -run_m4f="$M4 $use_localdir --reload $AC_MACRODIR/autoheader.m4f" - acconfigs= test -r $localdir/acconfig.h && acconfigs="$acconfigs $localdir/acconfig.h" @@ -168,21 +150,14 @@ $debug || config_h= syms= -# Extract assignments of `ah_verbatim_SYMBOL' from the modified -# autoconf processing of the input file. The sed hair is necessary to -# win for multi-line macro invocations. -$run_m4f $infile >$tmpbase.exp -sed -n -e ' - : again - /^@@@.*@@@$/s/^@@@\(.*\)@@@$/\1/p - /^@@@/{ - s/^@@@//p - n - s/^/@@@/ - b again - }' $tmpbase.exp >$tmpbase.decls +# Source what the traces are trying to tell us. +autoconf=`echo "$0" | sed -e 's/autoheader$/autoconf/'` +test -n "$localdir" && autoconf="$autoconf -l $localdir" +export AC_MACRODIR +$autoconf --trace AH_OUTPUT:'$1' --trace AC_CONFIG_HEADERS:'config_h="$1"' \ + $infile >$tmpbase.decls . $tmpbase.decls -$debug || rm -f $tmpbase.exp $tmpbase.decls +$debug || rm -f $tmpbase.decls # Make SYMS newline-separated rather than blank-separated, and remove dups. # Start each symbol with a blank (to match the blank after "#undef") @@ -190,6 +165,9 @@ $debug || rm -f $tmpbase.exp $tmpbase.decls # is a substring of it. syms=`for sym in $syms; do echo $sym; done | sort | uniq | sed 's@^@ @'` + +# We template only the first CONFIG_HEADER. +config_h=`echo "$config_h" | sed -e 's/ .*//'` # Support "outfile[:infile]", defaulting infile="outfile.in". case "$config_h" in "") echo "$me: error: AC_CONFIG_HEADERS not found in $infile" >&2; exit 1 ;; @@ -198,6 +176,7 @@ case "$config_h" in *) config_h_in="$config_h.in" ;; esac + # Don't write "do not edit" -- it will get copied into the # config.h, which it's ok to edit. cat <$tmpout diff --git a/bin/autoheader.in b/bin/autoheader.in index 466b0146..9674a8fe 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -71,19 +71,6 @@ if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # would break. ac_LF_and_DOT=`echo; echo .` -# 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@} -case "$M4" in -/*) 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 &1` in -*reload-state*);; -*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;; -esac - # Variables. : ${AC_MACRODIR=@datadir@} debug=false @@ -139,11 +126,6 @@ while test $# -gt 0 ; do esac done -# Running m4. -test -n "$localdir" && use_localdir="-I$localdir" -run_m4="$M4 $use_localdir -I $AC_MACRODIR autoheader.m4" -run_m4f="$M4 $use_localdir --reload $AC_MACRODIR/autoheader.m4f" - acconfigs= test -r $localdir/acconfig.h && acconfigs="$acconfigs $localdir/acconfig.h" @@ -168,21 +150,14 @@ $debug || config_h= syms= -# Extract assignments of `ah_verbatim_SYMBOL' from the modified -# autoconf processing of the input file. The sed hair is necessary to -# win for multi-line macro invocations. -$run_m4f $infile >$tmpbase.exp -sed -n -e ' - : again - /^@@@.*@@@$/s/^@@@\(.*\)@@@$/\1/p - /^@@@/{ - s/^@@@//p - n - s/^/@@@/ - b again - }' $tmpbase.exp >$tmpbase.decls +# Source what the traces are trying to tell us. +autoconf=`echo "$0" | sed -e 's/autoheader$/autoconf/'` +test -n "$localdir" && autoconf="$autoconf -l $localdir" +export AC_MACRODIR +$autoconf --trace AH_OUTPUT:'$1' --trace AC_CONFIG_HEADERS:'config_h="$1"' \ + $infile >$tmpbase.decls . $tmpbase.decls -$debug || rm -f $tmpbase.exp $tmpbase.decls +$debug || rm -f $tmpbase.decls # Make SYMS newline-separated rather than blank-separated, and remove dups. # Start each symbol with a blank (to match the blank after "#undef") @@ -190,6 +165,9 @@ $debug || rm -f $tmpbase.exp $tmpbase.decls # is a substring of it. syms=`for sym in $syms; do echo $sym; done | sort | uniq | sed 's@^@ @'` + +# We template only the first CONFIG_HEADER. +config_h=`echo "$config_h" | sed -e 's/ .*//'` # Support "outfile[:infile]", defaulting infile="outfile.in". case "$config_h" in "") echo "$me: error: AC_CONFIG_HEADERS not found in $infile" >&2; exit 1 ;; @@ -198,6 +176,7 @@ case "$config_h" in *) config_h_in="$config_h.in" ;; esac + # Don't write "do not edit" -- it will get copied into the # config.h, which it's ok to edit. cat <$tmpout diff --git a/configure b/configure index 0969d128..29a8be62 100755 --- a/configure +++ b/configure @@ -819,17 +819,21 @@ VERSION=2.14a if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } fi +# + cat >>confdefs.h <>confdefs.h <&6 -echo "configure:738: checking for working aclocal" 1>&5 +echo "configure:740: checking for working aclocal" 1>&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -842,7 +846,7 @@ else fi echo $ECHO_N "checking for working autoconf... $ECHO_C" 1>&6 -echo "configure:750: checking for working autoconf" 1>&5 +echo "configure:752: checking for working autoconf" 1>&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -855,7 +859,7 @@ else fi echo $ECHO_N "checking for working automake... $ECHO_C" 1>&6 -echo "configure:762: checking for working automake" 1>&5 +echo "configure:764: checking for working automake" 1>&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -868,7 +872,7 @@ else fi echo $ECHO_N "checking for working autoheader... $ECHO_C" 1>&6 -echo "configure:774: checking for working autoheader" 1>&5 +echo "configure:776: checking for working autoheader" 1>&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -881,7 +885,7 @@ else fi echo $ECHO_N "checking for working makeinfo... $ECHO_C" 1>&6 -echo "configure:786: checking for working makeinfo" 1>&5 +echo "configure:788: checking for working makeinfo" 1>&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -900,7 +904,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ECHO_N "checking for $ac_word... $ECHO_C" 1>&6 -echo "configure:803: checking for $ac_word" 1>&5 +echo "configure:805: checking for $ac_word" 1>&5 if test "${ac_cv_path_M4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" 1>&6 else @@ -934,7 +938,7 @@ done test -n "$M4" || M4="m4" echo $ECHO_N "checking whether m4 supports frozen files... $ECHO_C" 1>&6 -echo "configure:835: checking whether m4 supports frozen files" 1>&5 +echo "configure:837: checking whether m4 supports frozen files" 1>&5 if test "${ac_cv_prog_gnu_m4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" 1>&6 else @@ -955,7 +959,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ECHO_N "checking for $ac_word... $ECHO_C" 1>&6 -echo "configure:855: checking for $ac_word" 1>&5 +echo "configure:857: checking for $ac_word" 1>&5 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" 1>&6 else @@ -988,7 +992,7 @@ test -n "$AWK" && break done echo $ECHO_N "checking for working help2man... $ECHO_C" 1>&6 -echo "configure:886: checking for working help2man" 1>&5 +echo "configure:888: checking for working help2man" 1>&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1003,7 +1007,7 @@ fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ECHO_N "checking for $ac_word... $ECHO_C" 1>&6 -echo "configure:900: checking for $ac_word" 1>&5 +echo "configure:902: checking for $ac_word" 1>&5 if test "${ac_cv_path_PERL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" 1>&6 else @@ -1051,7 +1055,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" 1>&6 -echo "configure:946: checking for a BSD compatible install" 1>&5 +echo "configure:948: checking for a BSD compatible install" 1>&5 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" 1>&6 diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 1aef9b7d..f9031d1d 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -912,7 +912,12 @@ AC_DEFUN(AC_C_CROSS, # AC_C_CHAR_UNSIGNED # ------------------ AC_DEFUN(AC_C_CHAR_UNSIGNED, -[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, +[AH_VERBATIM([__CHAR_UNSIGNED__], +[/* Define if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif])dnl +AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, [if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. AC_EGREP_CPP(yes, @@ -1436,7 +1441,17 @@ AC_LANG_RESTORE()dnl # underscores, respectively, so that they match the name mangling # scheme used by the Fortran 77 compiler. AC_DEFUN(AC_F77_WRAPPERS, -[AC_CACHE_CHECK([if we can define Fortran 77 name-mangling macros], +[AH_TEMPLATE([F77_FUNC], + [Define to a macro that performs the appropriate name + mangling on its argument to make the C identifier, which + *does not* contain underscores, match the name mangling + scheme of the Fortran 77 compiler.])dnl +AH_TEMPLATE([F77_FUNC_], + [Define to a macro that performs the appropriate name + mangling on its argument to make the C identifier, which + *does* contain underscores, match the name mangling + scheme of the Fortran 77 compiler.])dnl +AC_CACHE_CHECK([if we can define Fortran 77 name-mangling macros], ac_cv_f77_wrappers, [# Be optimistic at first. ac_cv_f77_wrappers="yes" diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index 1aef9b7d..f9031d1d 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -912,7 +912,12 @@ AC_DEFUN(AC_C_CROSS, # AC_C_CHAR_UNSIGNED # ------------------ AC_DEFUN(AC_C_CHAR_UNSIGNED, -[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, +[AH_VERBATIM([__CHAR_UNSIGNED__], +[/* Define if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif])dnl +AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, [if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. AC_EGREP_CPP(yes, @@ -1436,7 +1441,17 @@ AC_LANG_RESTORE()dnl # underscores, respectively, so that they match the name mangling # scheme used by the Fortran 77 compiler. AC_DEFUN(AC_F77_WRAPPERS, -[AC_CACHE_CHECK([if we can define Fortran 77 name-mangling macros], +[AH_TEMPLATE([F77_FUNC], + [Define to a macro that performs the appropriate name + mangling on its argument to make the C identifier, which + *does not* contain underscores, match the name mangling + scheme of the Fortran 77 compiler.])dnl +AH_TEMPLATE([F77_FUNC_], + [Define to a macro that performs the appropriate name + mangling on its argument to make the C identifier, which + *does* contain underscores, match the name mangling + scheme of the Fortran 77 compiler.])dnl +AC_CACHE_CHECK([if we can define Fortran 77 name-mangling macros], ac_cv_f77_wrappers, [# Be optimistic at first. ac_cv_f77_wrappers="yes" diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 2a932609..815da747 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -368,6 +368,44 @@ AU_DEFINE([$1], [$2], [$3])dnl +## ------------------------- ## +## Interface to autoheader. ## +## ------------------------- ## + + +# AH_OUTPUT(TEXT) +# --------------- +# Pass TEXT to autoheader. +# This macro is `read' only via `autoconf --trace', it outputs nothing. +define([AH_OUTPUT], []) + + +# AH_VERBATIM(KEY, TEMPLATE) +# -------------------------- +# If KEY is direct (i.e., no indirection such as in KEY=$my_func which +# may occur if there is AC_CHECK_FUNCS($my_func)), issue an autoheader +# TEMPLATE associated to the KEY. Otherwise, do nothing. TEMPLATE is +# output as is, with no formating. +define([AH_VERBATIM], +[AC_VAR_IF_INDIR([$1],, +[# +AH_OUTPUT(ac_verbatim_$1="\ +_AC_SH_QUOTE([$2])" +) +])]) + + +# AH_TEMPLATE(KEY, DESCRIPTION) +# ----------------------------- +# Issue an autoheader template for KEY, i.e., a comment composed of +# DESCRIPTION (properly wrapped), and then #undef KEY. +define([AH_TEMPLATE], +[AH_VERBATIM([$1], + m4_wrap([$2 */], [ ], [/* ])[ +#undef $1])]) + + + ## --------------------- ## ## Some /bin/sh idioms. ## ## --------------------- ## @@ -1924,7 +1962,8 @@ AC_MSG_RESULT_UNQUOTED(AC_VAR_GET([$2]))]) # and if VARIABLE is affected the same VALUE, do nothing, else # die. The third argument is used by autoheader. define(AC_DEFINE, -[cat >>confdefs.h <<\EOF +[ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl +cat >>confdefs.h <<\EOF [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) EOF ]) @@ -1935,7 +1974,8 @@ EOF # ---------------------------------------------------- # Similar, but perform shell substitutions $ ` \ once on VALUE. define(AC_DEFINE_UNQUOTED, -[cat >>confdefs.h <>confdefs.h < header file.])])]) + # AC_CHECK_HEADERS(HEADER-FILE... # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ---------------------------------------------------------- AC_DEFUN(AC_CHECK_HEADERS, -[for ac_header in $1 +[AH_CHECK_HEADERS([$1])dnl +for ac_header in $1 do AC_CHECK_HEADER($ac_header, [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_$ac_header)) $2], @@ -2848,7 +2905,8 @@ AC_VAR_POPDEF([ac_File])dnl AC_DEFUN(AC_CHECK_FILES, [AC_FOREACH([AC_FILE_NAME], [$1], [AC_SPECIALIZE([AC_CHECK_FILE], AC_FILE_NAME, - [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_FILE_NAME)) + [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_FILE_NAME), 1, + [Define if you have the file `]AC_File['.]) $2], [$3])])]) @@ -2888,7 +2946,9 @@ AC_VAR_POPDEF([ac_Symbol])dnl AC_DEFUN([AC_CHECK_DECLS], [m4_foreach([AC_Symbol], [$1], [AC_SPECIALIZE([AC_CHECK_DECL], AC_Symbol, - [AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 1) + [AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 1, + [Define to 1 if you have the declaration + of `]AC_Symbol[', and to 0 if you don't.]) $2], [AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 0) $3], @@ -2942,7 +3002,10 @@ AC_VAR_POPDEF([ac_var])dnl # FIXME: Should we die if there are not enough arguments, or just # ignore? AC_DEFUN(AC_CHECK_FUNCS, -[for ac_func in $1 +[AC_FOREACH([AC_Func], [$1], + [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Func), + [Define if you have the `]AC_Func[' function.])])dnl +for ac_func in $1 do AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_$ac_func)) $2], @@ -2984,7 +3047,9 @@ main () AC_VAR_SET(ac_Sizeof, `cat conftestval`), AC_VAR_SET(ac_Sizeof, 0), ifval([$2], AC_VAR_SET(ac_Sizeof, $2)))]) -AC_DEFINE_UNQUOTED(AC_TR_CPP(sizeof_$1), AC_VAR_GET(ac_Sizeof)) +AC_DEFINE_UNQUOTED(AC_TR_CPP(sizeof_$1), + AC_VAR_GET(ac_Sizeof), + [The number of bytes in a `]$1['.]) AC_VAR_POPDEF([ac_Sizeof])dnl ]) @@ -3102,7 +3167,9 @@ AC_VAR_POPDEF([ac_Type])dnl AC_DEFUN([AC_CHECK_TYPES], [m4_foreach([AC_Type], [$1], [AC_SPECIALIZE([_AC_CHECK_TYPE_NEW], AC_Type, - [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Type)) + [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Type), 1, + [Define if the system has the type + `]AC_Type['.]) $2], [$3], [$4])])]) @@ -3115,7 +3182,8 @@ $2], # have to clean this up. AC_DEFUN([_AC_CHECK_TYPE_OLD], [_AC_CHECK_TYPE_NEW([$1],, - [AC_DEFINE_UNQUOTED([$1], [$2])])dnl + [AC_DEFINE_UNQUOTED([$1], [$2], + [Define to `$2' if does not define.])])dnl ])# _AC_CHECK_TYPE_OLD diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4 index 1aef9b7d..f9031d1d 100644 --- a/lib/autoconf/lang.m4 +++ b/lib/autoconf/lang.m4 @@ -912,7 +912,12 @@ AC_DEFUN(AC_C_CROSS, # AC_C_CHAR_UNSIGNED # ------------------ AC_DEFUN(AC_C_CHAR_UNSIGNED, -[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, +[AH_VERBATIM([__CHAR_UNSIGNED__], +[/* Define if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif])dnl +AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, [if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. AC_EGREP_CPP(yes, @@ -1436,7 +1441,17 @@ AC_LANG_RESTORE()dnl # underscores, respectively, so that they match the name mangling # scheme used by the Fortran 77 compiler. AC_DEFUN(AC_F77_WRAPPERS, -[AC_CACHE_CHECK([if we can define Fortran 77 name-mangling macros], +[AH_TEMPLATE([F77_FUNC], + [Define to a macro that performs the appropriate name + mangling on its argument to make the C identifier, which + *does not* contain underscores, match the name mangling + scheme of the Fortran 77 compiler.])dnl +AH_TEMPLATE([F77_FUNC_], + [Define to a macro that performs the appropriate name + mangling on its argument to make the C identifier, which + *does* contain underscores, match the name mangling + scheme of the Fortran 77 compiler.])dnl +AC_CACHE_CHECK([if we can define Fortran 77 name-mangling macros], ac_cv_f77_wrappers, [# Be optimistic at first. ac_cv_f77_wrappers="yes" diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 90cde823..2ad76dae 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -143,7 +143,9 @@ AC_DEFUN(AC_PROG_YACC, # AC_PROG_LEX # ----------- AC_DEFUN(AC_PROG_LEX, -[AC_CHECK_PROG(LEX, flex, flex, lex) +[AH_CHECK_LIB(fl)dnl +AH_CHECK_LIB(l)dnl +AC_CHECK_PROG(LEX, flex, flex, lex) if test -z "$LEXLIB" then case "$LEX" in @@ -359,7 +361,8 @@ fi # Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that # defines `DIR'. define(_AC_CHECK_HEADERS_DIRENT, -[for ac_hdr in $1 +[AH_CHECK_HEADERS([$1])dnl +for ac_hdr in $1 do _AC_CHECK_HEADER_DIRENT($ac_hdr, [changequote(, )dnl @@ -683,7 +686,15 @@ AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal, # AC_FUNC_ALLOCA # -------------- AC_DEFUN(AC_FUNC_ALLOCA, -[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. +[AH_VERBATIM([STACK_DIRECTION], +[/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +@%:@undef STACK_DIRECTION])dnl +AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h, @@ -2448,7 +2459,14 @@ AC_SUBST(OBJEXT)]) # AC_AIX # ------ AC_DEFUN(AC_AIX, -[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl +[AH_VERBATIM([_ALL_SOURCE], +[/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif])dnl +AC_BEFORE([$0], [AC_TRY_COMPILE])dnl AC_BEFORE([$0], [AC_TRY_RUN])dnl AC_MSG_CHECKING(for AIX) AC_EGREP_CPP(yes, diff --git a/tests/actest.m4 b/tests/actest.m4 index c67e415a..ef2a8b3d 100644 --- a/tests/actest.m4 +++ b/tests/actest.m4 @@ -61,10 +61,3 @@ AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), [Define to a long string if your `Autoconf' works properly.]) AC_SUBST(AC_DUMMY_VAR($1))]) - - -# autoheader::AC_TATOOINE -# ----------------------- -# Template a dummy entries for config header. -AH_DEFUN(AC_TATOOINE, -[AH_TEMPLATE(Tatooine, The planet where Luke was raised.)]) diff --git a/tests/tools.m4 b/tests/tools.m4 index d40c530b..eca7678c 100644 --- a/tests/tools.m4 +++ b/tests/tools.m4 @@ -68,42 +68,6 @@ AT_CLEANUP -## ---------- ## -## AH_DEFUN. ## -## ---------- ## - -# We check that both the AH_DEFUN given in auxiliary files and in -# `configure.in' function properly. -AT_SETUP(AH_DEFUN) - -AT_DATA(configure.in, -[[AC_INCLUDE(actest.m4) -AH_DEFUN(AC_ANAKIN, -[AH_TEMPLATE(Anakin, [The future Darth Vador?])]) -AC_INIT -AC_TATOOINE -AC_ANAKIN -AC_CONFIG_HEADERS(config.h:config.hin) -AC_OUTPUT -]]) - -# Checking `autoheader'. -AT_CHECK([../autoheader -m .. -l $at_srcdir], 0) -AT_CHECK([cat config.hin], 0, -[/* config.hin. Generated automatically from configure.in by autoheader. */ - -/* The future Darth Vador? */ -#undef Anakin - -/* The planet where Luke was raised. */ -#undef Tatooine -]) - -AT_CLEANUP(config.hin) - - - - ## ------------ ## ## autoupdate. ## ## ------------ ##