autoconf-patches
[Top][All Lists]
Advanced

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

Re: FYI: preproc vs. compiler in CHECK_HEADER


From: Akim Demaille
Subject: Re: FYI: preproc vs. compiler in CHECK_HEADER
Date: Fri, 28 Feb 2003 11:44:22 +0100
User-agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.2

| > AC_MSG_WARN([$1: accepted by the compiler, rejected by the preprocessor!])
| > AC_MSG_WARN([$1: proceeding with the compiler's result])
| 
| I'd add another...
| 
| AC_MSG_WARN([$1: did you put any options to CFLAGS that belong in CPPFLAGS?])
| 
| In particular, this bit me recently when I gave -mno-cygwin option to CFLAGS 
| instead of CPPFLAGS, so the preprocessor saw the Cygwin header files and the 
| compiler saw the Mingw32 set of headers.
| 
| Paolo Bonzini

Please, isntall your patch :)

I'm installing the following.

Index: ChangeLog
from  +2003-02-28  Akim Demaille  <address@hidden>

        * doc/autoconf.texi (Present But Cannot Be Compiled): New.

Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.289
diff -u -u -r1.289 NEWS
--- NEWS 28 Feb 2003 10:11:08 -0000 1.289
+++ NEWS 28 Feb 2003 10:43:22 -0000
@@ -3,6 +3,15 @@
 * Improve DJGPP portability
   The Autoconf tools and configure behave better under DJGPP.
 
+* Present But Cannot Be Compiled
+  New FAQ section dedicated to the mystic
+
+    configure: WARNING: pi.h: present but cannot be compiled
+    configure: WARNING: pi.h: check for missing prerequisite headers?
+    configure: WARNING: pi.h: proceeding with the preprocessor's result
+
+  messages.
+
 * Major changes in Autoconf 2.57
 
   Released 2002-12-03 by Paul Eggert.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.720
diff -u -u -r1.720 autoconf.texi
--- doc/autoconf.texi 25 Feb 2003 06:45:37 -0000 1.720
+++ doc/autoconf.texi 28 Feb 2003 10:43:33 -0000
@@ -172,7 +172,7 @@
 @detailmenu
  --- The Detailed Node Listing ---
 
-The GNU Build System
+The @acronym{GNU} Build System
 
 * Automake::                    Escaping Makefile hell
 * Libtool::                     Building libraries portably
@@ -442,6 +442,7 @@
 * Why Not Imake::               Why @acronym{GNU} uses @command{configure} 
instead of Imake
 * Defining Directories::        Passing @code{datadir} to program
 * autom4te.cache::              What is it?  Can I remove it?
+* Present But Cannot Be Compiled::  Compiler and Preprocessor Disagree
 
 History of Autoconf
 
@@ -453,7 +454,6 @@
 
 Copying This Manual
 
-* GNU Free Documentation License::  License for copying this manual
 
 Indices
 
@@ -14357,6 +14357,7 @@
 * Why Not Imake::               Why @acronym{GNU} uses @command{configure} 
instead of Imake
 * Defining Directories::        Passing @code{datadir} to program
 * autom4te.cache::              What is it?  Can I remove it?
+* Present But Cannot Be Compiled::  Compiler and Preprocessor Disagree
 @end menu
 
 @node Distributing
@@ -14645,6 +14646,95 @@
 not fully exploited}, and eight times slower than without
 @option{--force}.
 
+
address@hidden Present But Cannot Be Compiled
address@hidden Header Present But Cannot Be Compiled
+
+The most important guideline to bare in mind when checking for
+features is to mock as much as possible the intended use.
+Unfortunately, old versions of @code{AC_CHECK_HEADER} and
address@hidden failed to follow this idea, and used to call
+the preprocessor, instead of the compiler, to check for headers.  As a
+result, incompatibilities between headers went unnoticed during
+configuration, and maintainers finally had to deal with this issue
+elsewhere.
+
+Since Autoconf 2.56 both checks are performed, and @code{configure}
+complains loudly if the compiler and the preprocessor do not agree.
+For the time being the result is that of the preprocessor, so that
+maintainers can adjust their @file{configure.ac}, but in the near
+future, the compiler only will be considered.
+
+Consider the following example:
+
address@hidden
+$ @kbd{cat number.h}
+typedef int number;
+$ @kbd{cat pi.h}
+const number pi = 3;
+$ @kbd{cat configure.ac}
+AC_INIT
+AC_CHECK_HEADERS(pi.h)
+$ @kbd{autoconf -Wall}
+$ @kbd{./configure}
+checking for gcc... gcc
+checking for C compiler default output... a.out
+checking whether the C compiler works... yes
+checking whether we are cross compiling... no
+checking for suffix of executables...
+checking for suffix of object files... o
+checking whether we are using the GNU C compiler... yes
+checking whether gcc accepts -g... yes
+checking for gcc option to accept ANSI C... none needed
+checking how to run the C preprocessor... gcc -E
+checking for egrep... grep -E
+checking for ANSI C header files... yes
+checking for sys/types.h... yes
+checking for sys/stat.h... yes
+checking for stdlib.h... yes
+checking for string.h... yes
+checking for memory.h... yes
+checking for strings.h... yes
+checking for inttypes.h... yes
+checking for stdint.h... yes
+checking for unistd.h... yes
+checking pi.h usability... no
+checking pi.h presence... yes
+configure: WARNING: pi.h: present but cannot be compiled
+configure: WARNING: pi.h: check for missing prerequisite headers?
+configure: WARNING: pi.h: proceeding with the preprocessor's result
+configure: WARNING:     ## ------------------------------------ ##
+configure: WARNING:     ## Report this to bug-autoconf@@gnu.org. ##
+configure: WARNING:     ## ------------------------------------ ##
+checking for pi.h... yes
address@hidden example
+
address@hidden
+The proper way the handle this case is using the fourth argument
+(@pxref{Generic Headers}):
+
address@hidden
+$ @kbd{cat configure.ac}
+AC_INIT
+AC_CHECK_HEADERS(number.h pi.h,,,
+[[#if HAVE_NUMBER_H
+# include <number.h>
+#endif
+]])
+$ @kbd{autoconf -Wall}
+$ @kbd{./configure}
+checking for gcc... gcc
+checking for C compiler default output... a.out
+checking whether the C compiler works... yes
+checking whether we are cross compiling... no
+checking for suffix of executables...
+checking for suffix of object files... o
+checking whether we are using the GNU C compiler... yes
+checking whether gcc accepts -g... yes
+checking for gcc option to accept ANSI C... none needed
+checking for number.h... yes
+checking for pi.h... yes
address@hidden example
 
 @c ===================================================== History of Autoconf.
 




reply via email to

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