autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Present But Cannot Be Compiled


From: Paolo Bonzini
Subject: [PATCH] Present But Cannot Be Compiled
Date: Thu, 06 Nov 2008 10:54:08 +0100
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

As a first step on which we all agree, I'll apply this patch in a few
hours (to give Americans some time to wake up) which changes the
behavior of _AC_CHECK_HEADERS_MONGREL to use the compiler's result.

Paolo
diff --git a/ChangeLog b/ChangeLog
index 084a2fa..c7a86cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-11-06  Paolo Bonzini  <address@hidden>
+
+       Change `present but cannot be compiled' behavior to use compiler result.
+       * NEWS: Document it.
+       * doc/autoconf.texi (Present But Cannot Be Compiled): Document it.
+       * lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL): Implement it
+       and adjust warning.
+       * tests/semantics.at (AC_CHECK_HEADERS): Test new behavior.
+
 2008-11-03  Paolo Bonzini  <address@hidden>
 
        Use preprocessor in cpp tests.
diff --git a/NEWS b/NEWS
index e22559f..dd77124 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,11 @@ GNU Autoconf NEWS - User visible changes.
 
 ** Configure scripts now use shell functions.
 
+** Present But Cannot Be Compiled: Autoconf will now proceed with
+   the compiler's result if a header is present but cannot be compiled.
+   The warning is still printed, and you should really fix it by
+   providing a fourth parameter to AC_CHECK_HEADER/AC_CHECK_HEADERS.
+
 ** The following documented m4sugar macros are new:
    m4_curry  m4_default_quoted  m4_map_args  m4_map_args_pair
    m4_set_map
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 2a7fc4a..da6d347 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -22181,11 +22181,10 @@ Present But Cannot Be Compiled
 configuration, and maintainers finally had to deal with this issue
 elsewhere.
 
-As of Autoconf 2.56 both checks are performed, and @command{configure}
-complains loudly if the compiler and the preprocessor do not agree.
-For the time being the result used is that of the preprocessor, to give
-maintainers time to adjust their @file{configure.ac}, but in the
-future, only the compiler will be considered.
+The transition began with Autoconf 2.56.  As of Autoconf 2.64 both
+checks are performed, and @command{configure} complains loudly if the
+compiler and the preprocessor do not agree.  However, only the compiler
+result is considered.
 
 Consider the following example:
 
@@ -22227,8 +22226,7 @@ Present But Cannot Be Compiled
 configure: WARNING: pi.h:     check for missing prerequisite headers?
 configure: WARNING: pi.h: see the Autoconf documentation
 configure: WARNING: pi.h:     section "Present But Cannot Be Compiled"
-configure: WARNING: pi.h: proceeding with the preprocessor's result
-configure: WARNING: pi.h: in the future, the compiler will take precedence
+configure: WARNING: pi.h: proceeding with the compiler's result
 configure: WARNING:     ## -------------------------------------- ##
 configure: WARNING:     ## Report this to bug-example@@example.org ##
 configure: WARNING:     ## -------------------------------------- ##
@@ -22263,7 +22261,7 @@ Present But Cannot Be Compiled
 @end example
 
 See @ref{Particular Headers}, for a list of headers with their
-prerequisite.
+prerequisites.
 
 @c ===================================================== History of Autoconf.
 
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index ae0da81..cb1cb9c 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -121,22 +121,20 @@ case 
$ac_header_compiler:$ac_header_preproc:$ac_[]_AC_LANG_ABBREV[]_preproc_warn
   yes:no: )
     AC_MSG_WARN([$[]2: accepted by the compiler, rejected by the 
preprocessor!])
     AC_MSG_WARN([$[]2: proceeding with the compiler's result])
-    ac_header_preproc=yes
     ;;
   no:yes:* )
     AC_MSG_WARN([$[]2: present but cannot be compiled])
     AC_MSG_WARN([$[]2:     check for missing prerequisite headers?])
     AC_MSG_WARN([$[]2: see the Autoconf documentation])
     AC_MSG_WARN([$[]2:     section "Present But Cannot Be Compiled"])
-    AC_MSG_WARN([$[]2: proceeding with the preprocessor's result])
-    AC_MSG_WARN([$[]2: in the future, the compiler will take precedence])
+    AC_MSG_WARN([$[]2: proceeding with the compiler's result])
 m4_ifset([AC_PACKAGE_BUGREPORT],
 [m4_n([( AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT)
      ) | sed "s/^/$as_me: WARNING:     /" >&2])])dnl
     ;;
 esac
   AC_CACHE_CHECK([for $[]2], [$[]3],
-                [AS_VAR_SET([$[]3], [$ac_header_preproc])])])
+                [AS_VAR_SET([$[]3], [$ac_header_compiler])])])
   AS_LINENO_POP
 ])#_AC_CHECK_HEADER_MONGREL_BODY
 
diff --git a/tests/semantics.at b/tests/semantics.at
index 1c6d70b..1489a17 100644
--- a/tests/semantics.at
+++ b/tests/semantics.at
@@ -170,12 +170,29 @@ AT_CLEANUP
 # ----------------
 # Check that it performs the correct actions:
 # Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H.
-AT_CHECK_MACRO([AC_CHECK_HEADERS],
-[AC_CHECK_HEADERS(stdio.h autoconf_io.h)],
-[AT_CHECK_DEFINES(
+AT_SETUP([AC_CHECK_HEADERS])
+
+AT_DATA([autoconf_io.h],
+[blah blah
+])
+
+AT_CONFIGURE_AC([AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
+AT_CHECK_AUTOCONF([-W obsolete])
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE([CPPFLAGS=-I.], [0], [ignore],
+[configure: WARNING: autoconf_io.h: present but cannot be compiled
+configure: WARNING: autoconf_io.h:     check for missing prerequisite headers?
+configure: WARNING: autoconf_io.h: see the Autoconf documentation
+configure: WARNING: autoconf_io.h:     section "Present But Cannot Be Compiled"
+configure: WARNING: autoconf_io.h: proceeding with the compiler's result
+])
+AT_CHECK_ENV
+AT_CHECK_DEFINES(
 [/* #undef HAVE_AUTOCONF_IO_H */
 #define HAVE_STDIO_H 1
-])])
+])
+
+AT_CLEANUP
 
 
 # AC_CHECK_HEADERS_OLD

reply via email to

[Prev in Thread] Current Thread [Next in Thread]