From: Akim Demaille Date: Wed, 13 Jun 2001 07:51:09 +0000 (+0000) Subject: * acheaders.m4 (AC_CHECK_HEADER, AC_CHECK_HEADERS): Support $4 = X-Git-Tag: AUTOCONF-2.50a~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc0cb140fd52887a86af06f2d6d75ee833bf9cbc;p=thirdparty%2Fautoconf.git * acheaders.m4 (AC_CHECK_HEADER, AC_CHECK_HEADERS): Support $4 = INCLUDES. --- diff --git a/ChangeLog b/ChangeLog index afc1f929b..5e432d456 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-06-13 Akim Demaille + + * acheaders.m4 (AC_CHECK_HEADER, AC_CHECK_HEADERS): Support $4 = + INCLUDES. + 2001-06-12 Maciej W. Rozycki * acspecific.m4 (AC_PATH_XTRA): Check if linking against libX11 diff --git a/NEWS b/NEWS index 10fdd6ba7..39ce02b2f 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,10 @@ Now include stdint.h. - configure accepts --prefix='' again. - AC_CHECK_LIB works properly when its first argument is not a literal. + +** Generic macros +- AC_CHECK_HEADER and AC_CHECK_HEADERS support a fourth argument to + specify pre-includes. * Major changes in Autoconf 2.50 diff --git a/acheaders.m4 b/acheaders.m4 index 56c0b3d0b..17287581b 100644 --- a/acheaders.m4 +++ b/acheaders.m4 @@ -60,12 +60,15 @@ ## 1. Generic tests for headers. ## ## ------------------------------ ## -# AC_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ---------------------------------------------------------------------- +# AC_CHECK_HEADER(HEADER-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# --------------------------------------------------------- AC_DEFUN([AC_CHECK_HEADER], [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl AC_CACHE_CHECK([for $1], ac_Header, - [AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include <$1>])], + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([m4_n([$4])dnl +@%:@include <$1>])], [AS_VAR_SET(ac_Header, yes)], [AS_VAR_SET(ac_Header, no)])]) AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl @@ -83,6 +86,7 @@ m4_define([AH_CHECK_HEADERS], # AC_CHECK_HEADERS(HEADER-FILE... # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# [INCLUDES]) # ---------------------------------------------------------- AC_DEFUN([AC_CHECK_HEADERS], [AH_CHECK_HEADERS([$1])dnl @@ -90,7 +94,8 @@ for ac_header in $1 do AC_CHECK_HEADER($ac_header, [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$ac_header)) $2], - [$3])dnl + [$3], + [$4])dnl done ]) diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 2ec87f936..e843628a7 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -3860,15 +3860,20 @@ These macros are used to find system header files not covered by the as well as find out whether it is present, you have to write your own test for it (@pxref{Writing Tests}). -@defmac AC_CHECK_HEADER (@var{header-file}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@defmac AC_CHECK_HEADER (@var{header-file}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) @maindex CHECK_HEADER If the system header file @var{header-file} exists, execute shell commands @var{action-if-found}, otherwise execute @var{action-if-not-found}. If you just want to define a symbol if the header file is available, consider using @code{AC_CHECK_HEADERS} instead. + +This macro actually checks whether @var{header-file} can be included +without error. If @var{includes} is specified, they are included before +@var{header-file}. Note that the @var{includes} are @emph{not} +defaulted. They might be in future releases. @end defmac -@defmac AC_CHECK_HEADERS (@var{header-file}@dots{}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@defmac AC_CHECK_HEADERS (@var{header-file}@dots{}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) @maindex CHECK_HEADERS @cvindex HAVE_@var{header} For each given system header file @var{header-file} in the @@ -3878,6 +3883,11 @@ is given, it is additional shell code to execute when one of the header files is found. You can give it a value of @samp{break} to break out of the loop on the first match. If @var{action-if-not-found} is given, it is executed when one of the header files is not found. + +This macro actually checks whether @var{header-file} can be included +without error. If @var{includes} is specified, they are included before +@var{header-file}. Note that the @var{includes} are @emph{not} +defaulted. They might be in future releases. @end defmac @node Declarations, Structures, Header Files, Existing Tests diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4 index 56c0b3d0b..17287581b 100644 --- a/lib/autoconf/headers.m4 +++ b/lib/autoconf/headers.m4 @@ -60,12 +60,15 @@ ## 1. Generic tests for headers. ## ## ------------------------------ ## -# AC_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ---------------------------------------------------------------------- +# AC_CHECK_HEADER(HEADER-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# --------------------------------------------------------- AC_DEFUN([AC_CHECK_HEADER], [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl AC_CACHE_CHECK([for $1], ac_Header, - [AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include <$1>])], + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([m4_n([$4])dnl +@%:@include <$1>])], [AS_VAR_SET(ac_Header, yes)], [AS_VAR_SET(ac_Header, no)])]) AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl @@ -83,6 +86,7 @@ m4_define([AH_CHECK_HEADERS], # AC_CHECK_HEADERS(HEADER-FILE... # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# [INCLUDES]) # ---------------------------------------------------------- AC_DEFUN([AC_CHECK_HEADERS], [AH_CHECK_HEADERS([$1])dnl @@ -90,7 +94,8 @@ for ac_header in $1 do AC_CHECK_HEADER($ac_header, [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$ac_header)) $2], - [$3])dnl + [$3], + [$4])dnl done ])