From: Akim Demaille Date: Tue, 8 Feb 2000 09:19:18 +0000 (+0000) Subject: It seems quite delicate to have AC_INCLUDES_DEFAULT insert the X-Git-Tag: autoconf-2.50~1220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4d2980dbd9c7af78523217f128fc3afe3df925a;p=thirdparty%2Fautoconf.git It seems quite delicate to have AC_INCLUDES_DEFAULT insert the default headers in the INIT section of configure: the reason is that AC_INCLUDES_DEFAULT is called unquoted, and this results in an un expected behavior. Thanks to Roman V. Shaposhnick for the details. The current implementation is not satisfying: the default headers are defined in the INIT section even if they are not used. * acgeneral.m4 (Prologue of AC_INCLUDES_DEFAULTS): Dump the definition of ac_includes_default in the INIT section of configure. (AC_INCLUDES_DEFAULTS): Use it. --- diff --git a/ChangeLog b/ChangeLog index 473a68086..4a39f5f2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2000-02-08 Akim Demaille + + It seems quite delicate to have AC_INCLUDES_DEFAULT insert the + default headers in the INIT section of configure: the reason is + that AC_INCLUDES_DEFAULT is called unquoted, and this results in + an un expected behavior. Thanks to Roman V. Shaposhnick for the + details. + + The current implementation is not satisfying: the default headers + are defined in the INIT section even if they are not used. + + * acgeneral.m4 (Prologue of AC_INCLUDES_DEFAULTS): Dump the + definition of ac_includes_default in the INIT section of + configure. + (AC_INCLUDES_DEFAULTS): Use it. + 2000-02-08 Akim Demaille * TODO: Updated. diff --git a/acgeneral.m4 b/acgeneral.m4 index 0db4fc38a..1fcc46be7 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -1818,7 +1818,62 @@ AC_DEFUN(AC_TRY_COMMAND, -# ### Generic structure checks +## ----------------- ## +## Default headers. ## +## ----------------- ## + +# Always use the same set of default headers for all the generic +# macros. It is easier to document, to extend, and to understand than +# having specific defaults for each macro. + +# Of course, one would like to issue these default headers only if +# they were used, i.e.., AC_INCLUDES_DEFAULT was called, and the +# default `branch' was run. Unfortunately AC_INCLUDES_DEFAULT is +# called unquoted, so it is unsafe to try to divert from there. +# Therefore, the following *is* buggy, but this is the kind of +# tradeoff we accept in order to improve configure. + +AC_DIVERT_PUSH(AC_DIVERSION_INIT)dnl +# Factorizing default headers for most tests. +# Mandatory included if its is not used. +ac_includes_default='\ +#include +#include +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#else +# if HAVE_STRINGS_H +# include +# endif +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif' +AC_DIVERT_POP() + + +# AC_INCLUDES_DEFAULT([INCLUDES]) +# ------------------------------- +# If INCLUDES is empty, expand in default includes, otherwise in +# INCLUDES. +define(AC_INCLUDES_DEFAULT, +[m4_default([$1], [$ac_includes_default])]) + + +## ------------------------ ## +## Generic structure checks ## +## ------------------------ ## # AC_CHECK_MEMBER(AGGREGATE.MEMBER, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], @@ -1865,42 +1920,6 @@ $2], -dnl ### Default headers. - -# Always use the same set of default headers for all the generic macros. -# It is easier to document, to extend, and to understand than having -# specific defaults for each macro. - -# AC_INCLUDES_DEFAULT([INCLUDES]) -# ------------------------------- -# If INCLUDES is empty, expand in default includes, otherwise in -# INCLUDES. -AC_DEFUN(AC_INCLUDES_DEFAULT, -[m4_default([$1], -[#include -#include -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#else -# if HAVE_STRINGS_H -# include -# endif -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif -])]) ## --------------------- ## diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 0db4fc38a..1fcc46be7 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1818,7 +1818,62 @@ AC_DEFUN(AC_TRY_COMMAND, -# ### Generic structure checks +## ----------------- ## +## Default headers. ## +## ----------------- ## + +# Always use the same set of default headers for all the generic +# macros. It is easier to document, to extend, and to understand than +# having specific defaults for each macro. + +# Of course, one would like to issue these default headers only if +# they were used, i.e.., AC_INCLUDES_DEFAULT was called, and the +# default `branch' was run. Unfortunately AC_INCLUDES_DEFAULT is +# called unquoted, so it is unsafe to try to divert from there. +# Therefore, the following *is* buggy, but this is the kind of +# tradeoff we accept in order to improve configure. + +AC_DIVERT_PUSH(AC_DIVERSION_INIT)dnl +# Factorizing default headers for most tests. +# Mandatory included if its is not used. +ac_includes_default='\ +#include +#include +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#else +# if HAVE_STRINGS_H +# include +# endif +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif' +AC_DIVERT_POP() + + +# AC_INCLUDES_DEFAULT([INCLUDES]) +# ------------------------------- +# If INCLUDES is empty, expand in default includes, otherwise in +# INCLUDES. +define(AC_INCLUDES_DEFAULT, +[m4_default([$1], [$ac_includes_default])]) + + +## ------------------------ ## +## Generic structure checks ## +## ------------------------ ## # AC_CHECK_MEMBER(AGGREGATE.MEMBER, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], @@ -1865,42 +1920,6 @@ $2], -dnl ### Default headers. - -# Always use the same set of default headers for all the generic macros. -# It is easier to document, to extend, and to understand than having -# specific defaults for each macro. - -# AC_INCLUDES_DEFAULT([INCLUDES]) -# ------------------------------- -# If INCLUDES is empty, expand in default includes, otherwise in -# INCLUDES. -AC_DEFUN(AC_INCLUDES_DEFAULT, -[m4_default([$1], -[#include -#include -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#else -# if HAVE_STRINGS_H -# include -# endif -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif -])]) ## --------------------- ##