Index: ChangeLog from Akim Demaille No longer use CPP to check for the existing of headers: use CC to check for compilability. * lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL) (AC_CHECK_HEADER, _AC_CHECK_HEADER_OLD): Remove. (_AC_CHECK_HEADER_NEW): Rename as... (AC_CHECK_HEADER): this. Index: NEWS =================================================================== RCS file: /cvsroot/autoconf/autoconf/NEWS,v retrieving revision 1.261 diff -u -u -r1.261 NEWS --- NEWS 27 Sep 2002 09:25:41 -0000 1.261 +++ NEWS 11 Oct 2002 09:42:20 -0000 @@ -6,6 +6,10 @@ - New macros AC_FUNC_MBRTOWC +- AC_CHECK_HEADER/AC_CHECK_HEADERS + These macros now check whether the header is compilable, i.e., they + run CC on them. The `-' support was removed. + ** Bug Fixes - Portability of the Autoconf package to Solaris. Index: doc/autoconf.texi =================================================================== RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.686 diff -u -u -r1.686 autoconf.texi --- doc/autoconf.texi 8 Oct 2002 23:05:17 -0000 1.686 +++ doc/autoconf.texi 11 Oct 2002 09:42:32 -0000 @@ -4459,42 +4459,20 @@ @defmac AC_CHECK_HEADER (@var{header-file}, @ovar{action-if-found}, @ovar{action-if-not-found}, @dvar{includes, default-includes}) @acindex CHECK_HEADER -If the system header file @var{header-file} is usable, execute shell +If the system header file @var{header-file} is compilable, 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. -The meaning of ``usable'' depends upon the content of @var{includes}: - address@hidden @asis address@hidden if @var{includes} is empty -check whether - address@hidden address@hidden address@hidden example - address@hidden -can be @emph{preprocessed} without error. - address@hidden if @var{include} is set -Check whether - address@hidden address@hidden -#include <@var{header-file}> address@hidden example - address@hidden -can be @emph{compiled} without error. You may use address@hidden (and @code{AC_CHECK_HEADERS}) to check whether -two headers are compatible. address@hidden table - -You may pass any kind of dummy content for @var{includes}, such as a -single space or a comment, to check whether @var{header-file} compiles -with success. +By the past Autoconf used to check whether the header was accepted by +the preprocessor. This was changed because this test was not realistic: +when headers are needed in a package, they are required to address@hidden the project, not to preprocess its files. This had in +some occasion the consequence of accepting headers that turned out to +clash between them, and it also resulted in some of Autoconf macros +(e.g., @code{AC_HEADER_TIME}) which sole existence was justified by +working around former @code{AC_CHECK_HEADER} limitations. @end defmac @defmac AC_CHECK_HEADERS (@address@hidden, @ovar{action-if-found}, @ovar{action-if-not-found}, @dvar{includes, default-includes}) @@ -4507,9 +4485,6 @@ 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. - -Be sure to read the documentation of @code{AC_CHECK_HEADER} to -understand the influence of @var{includes}. @end defmac @node Declarations Index: lib/autoconf/headers.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/headers.m4,v retrieving revision 1.22 diff -u -u -r1.22 headers.m4 --- lib/autoconf/headers.m4 28 Sep 2002 16:38:48 -0000 1.22 +++ lib/autoconf/headers.m4 11 Oct 2002 09:42:32 -0000 @@ -1,7 +1,6 @@ # This file is part of Autoconf. -*- Autoconf -*- # Checking for headers. -# Copyright 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 2000, 2001 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 @@ -67,83 +66,8 @@ # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], # [INCLUDES]) # --------------------------------------------------------- -# We are slowly moving to checking headers with the compiler instead -# of the preproc, so that we actually learn about the usability of a -# header instead of its mere presence. But since users are used to -# the old semantics, they check for headers in random order and -# without providing prerequisite headers. This macro implements the -# transition phase, and should be cleaned up latter to use compilation -# only. -# -# If INCLUDES is empty, then check both via the compiler and preproc. -# If the results are different, issue a warning, but keep the preproc -# result. -# -# If INCLUDES is `-', keep only the old semantics. -# -# If INCLUDES is specified and different from `-', then use the new -# semantics only. -AC_DEFUN([AC_CHECK_HEADER], -[m4_case([$4], - [], [_AC_CHECK_HEADER_MONGREL($@)], - [-], [_AC_CHECK_HEADER_OLD($@)], - [_AC_CHECK_HEADER_NEW($@)]) -])# AC_CHECK_HEADER - - -# _AC_CHECK_HEADER_MONGREL(HEADER-FILE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], -# [INCLUDES]) -# -------------------------------------------------------------- -# Check using both the compiler and the preprocessor. If they disagree, -# warn, and the preproc wins. -# -# This is not based on _AC_CHECK_HEADER_NEW and _AC_CHECK_HEADER_OLD -# because it obfuscate the code to try to factor everything, in particular -# because of the cache variables, and the `checking...' messages. -m4_define([_AC_CHECK_HEADER_MONGREL], -[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl -AS_VAR_SET_IF(ac_Header, - [AC_CACHE_CHECK([for $1], ac_Header, [])], - [# Is the header compilable? -AC_MSG_CHECKING([$1 usability]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT([$4]) address@hidden:@include <$1>])], - [ac_header_compiler=yes], - [ac_header_compiler=no]) -AC_MSG_RESULT([$ac_header_compiler]) - -# Is the header present? -AC_MSG_CHECKING([$1 presence]) -AC_PREPROC_IFELSE([AC_LANG_SOURCE(address@hidden:@include <$1>])], - [ac_header_preproc=yes], - [ac_header_preproc=no]) -AC_MSG_RESULT([$ac_header_preproc]) - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - AC_MSG_WARN([$1: accepted by the compiler, rejected by the preprocessor!]) - AC_MSG_WARN([$1: proceeding with the preprocessor's result]);; - no:yes ) - AC_MSG_WARN([$1: present but cannot be compiled]) - AC_MSG_WARN([$1: check for missing prerequisite headers?]) - AC_MSG_WARN([$1: proceeding with the preprocessor's result]);; -esac -AC_CACHE_CHECK([for $1], ac_Header, - [AS_VAR_SET(ac_Header, $ac_header_preproc)]) -])dnl ! set ac_HEADER -AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl -AS_VAR_POPDEF([ac_Header])dnl -])# _AC_CHECK_HEADER_MONGREL - - -# _AC_CHECK_HEADER_NEW(HEADER-FILE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], -# [INCLUDES]) -# -------------------------------------------------------------- # Check the compiler accepts HEADER-FILE. The INCLUDES are defaulted. -m4_define([_AC_CHECK_HEADER_NEW], +AC_DEFUN([AC_CHECK_HEADER], [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl AC_CACHE_CHECK([for $1], ac_Header, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT([$4]) @@ -152,22 +76,7 @@ [AS_VAR_SET(ac_Header, no)])]) AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl AS_VAR_POPDEF([ac_Header])dnl -])# _AC_CHECK_HEADER_NEW - - -# _AC_CHECK_HEADER_OLD(HEADER-FILE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -------------------------------------------------------------- -# Check the preprocessor accepts HEADER-FILE. -m4_define([_AC_CHECK_HEADER_OLD], -[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl -AC_CACHE_CHECK([for $1], ac_Header, - [AC_PREPROC_IFELSE([AC_LANG_SOURCE(address@hidden:@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 -AS_VAR_POPDEF([ac_Header])dnl -])# _AC_CHECK_HEADER_OLD +])# AC_CHECK_HEADER # AH_CHECK_HEADERS(HEADER-FILE...)