autoconf-patches
[Top][All Lists]
Advanced

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

FYI: ac-check-headers.patch


From: Akim Demaille
Subject: FYI: ac-check-headers.patch
Date: 02 Jul 2001 09:11:40 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        
        * acheaders.m4 (AC_CHECK_HEADER): When INCLUDES are set, use the
        compiler, not the preprocessor.
        * acgeneral.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS): No longer use
        dedicated code to check for inttypes.h, as AC_CHECK_HEADERS does
        the right thing.
        * Makefile.am (.m4.m4f): Emphasize M4 error messages and fail
        earlier if there are.
        
Index: Makefile.am
--- Makefile.am Sat, 23 Jun 2001 23:01:08 +0200 akim (ace/45_Makefile.a 1.47 
644)
+++ Makefile.am Sun, 01 Jul 2001 18:35:42 +0200 akim (ace/45_Makefile.a 1.47 
644)
@@ -180,11 +180,19 @@
 # force an end of line when reporting errors.
 .m4.m4f:
        $(M4) --include $(srcdir) --fatal-warning --define divert \
-             $(srcdir)/$*.m4 | \
+             $(srcdir)/$*.m4 2>error.log | \
          sed 's/#.*//;/^$$/d' >process.log
+       if grep . error.log >/dev/null 2>&1; then \
+         echo "ERROR: Processing $(srcdir)/$*.m4 produced errors:" >&2; \
+         sed "s,^,$(srcdir)/$*.m4: ," <error.log >&2; \
+         echo >&2; \
+         exit 1; \
+       else \
+         rm -f error.log; \
+       fi
        if grep . process.log >/dev/null 2>&1; then \
-         echo "Processing $(srcdir)/$*.m4 produced output:" >&2; \
-         sed "s,^,$(srcdir)/$*.m4: ," < process.log >&2; \
+         echo "ERROR: Processing $(srcdir)/$*.m4 produced output:" >&2; \
+         sed "s,^,$(srcdir)/$*.m4: ," <process.log >&2; \
          echo >&2; \
          exit 1; \
        else \
@@ -193,8 +201,8 @@
        $(M4) --include $(srcdir) --fatal-warning --freeze-state=$*.m4f \
              $(srcdir)/$*.m4 >freeze.log
        if grep . freeze.log >/dev/null 2>&1; then \
-         echo "Freezing $(srcdir)/$*.m4 produced output:" >&2; \
-         sed "s,^,$(srcdir)/$*.m4: ," < freeze.log >&2; \
+         echo "ERROR: Freezing $(srcdir)/$*.m4 produced output:" >&2; \
+         sed "s,^,$(srcdir)/$*.m4: ," <freeze.log >&2; \
          echo >&2; \
          exit 1; \
        else \
Index: acgeneral.m4
--- acgeneral.m4 Sat, 23 Jun 2001 23:01:08 +0200 akim (ace/27_acgeneral. 
1.169.8.136 644)
+++ acgeneral.m4 Sun, 01 Jul 2001 18:30:00 +0200 akim (ace/27_acgeneral. 
1.169.8.136 644)
@@ -2237,15 +2237,9 @@ AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREME
 AC_REQUIRE([AC_HEADER_STDC])dnl
 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
 AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                  stdint.h unistd.h],
+                  inttypes.h stdint.h unistd.h],
                  [], [], $ac_includes_default)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define HAVE_INTTYPES_H 1
-$ac_includes_default])],
-                  [ac_cv_header_inttypes_h=yes,
-AC_DEFINE([HAVE_INTTYPES_H], 1,
-          [Define if you have the <inttypes.h> header file.])],
-                  [ac_cv_header_inttypes_h=no])
-])
+])# _AC_INCLUDES_DEFAULT_REQUIREMENTS
 
 
 # AC_INCLUDES_DEFAULT([INCLUDES])
Index: acheaders.m4
--- acheaders.m4 Sat, 23 Jun 2001 23:01:08 +0200 akim (ace/b/48_acheaders. 1.9 
644)
+++ acheaders.m4 Sun, 01 Jul 2001 18:38:43 +0200 akim (ace/b/48_acheaders. 1.9 
644)
@@ -60,17 +60,26 @@
 ## 1. Generic tests for headers.  ##
 ## ------------------------------ ##
 
+
 # AC_CHECK_HEADER(HEADER-FILE,
 #                 [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
 #                 [INCLUDES])
 # ---------------------------------------------------------
+# If INCLUDES is empty and strictly empty, use the preprocessor to
+# check whether HEADER-FILE exists.  If INCLUDES is set, then use the
+# compiler to check whether INCLUDES followed by HEADER-FILE compiles
+# with success.
 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([m4_n([$4])dnl
+            [m4_ifval([$4],
+                      [AC_COMPILE_IFELSE([AC_LANG_SOURCE([$4
 @%:@include <$1>])],
-                                  [AS_VAR_SET(ac_Header, yes)],
-                                  [AS_VAR_SET(ac_Header, no)])])
+                                         [AS_VAR_SET(ac_Header, yes)],
+                                         [AS_VAR_SET(ac_Header, no)])],
+                      
[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
@@ -85,8 +94,8 @@ m4_define([AH_CHECK_HEADERS],
 
 
 # AC_CHECK_HEADERS(HEADER-FILE...
-#                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#                 [INCLUDES])
+#                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#                  [INCLUDES])
 # ----------------------------------------------------------
 AC_DEFUN([AC_CHECK_HEADERS],
 [AH_CHECK_HEADERS([$1])dnl
@@ -97,7 +106,7 @@ AC_DEFUN([AC_CHECK_HEADERS],
                 [$3],
                 [$4])dnl
 done
-])
+])# AC_CHECK_HEADERS
 
 
 
Index: doc/autoconf.texi
--- doc/autoconf.texi Sun, 24 Jun 2001 01:04:02 +0200 akim (ace/16_autoconf.t 
1.61.2.112.1.1 644)
+++ doc/autoconf.texi Sun, 01 Jul 2001 18:45:41 +0200 akim (ace/16_autoconf.t 
1.61.2.112.1.1 644)
@@ -923,8 +923,8 @@ @node Autoconf Language, configure.ac La
 three lines below are equivalent:
 
 @example
-AC_CHECK_HEADERS(stdio.h, [], [])
-AC_CHECK_HEADERS(stdio.h,,)
+AC_CHECK_HEADERS(stdio.h, [], [], [])
+AC_CHECK_HEADERS(stdio.h,,,)
 AC_CHECK_HEADERS(stdio.h)
 @end example
 
@@ -3935,15 +3935,42 @@ @node Generic Headers,  , Particular Hea
 
 @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
address@hidden, 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
address@hidden  Note that the @var{includes} are @emph{not}
-defaulted.  They might be in future releases.
+If the system header file @var{header-file} is usable, execute shell
+commands @var{action-if-found}, otherwise execute
address@hidden  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, a comment, to check whether @var{header-file} compiles
+with success.
 @end defmac
 
 @defmac AC_CHECK_HEADERS (@address@hidden, @ovar{action-if-found}, 
@ovar{action-if-not-found}, @ovar{includes})
@@ -3957,10 +3984,8 @@ @node Generic Headers,  , Particular Hea
 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
address@hidden  Note that the @var{includes} are @emph{not}
-defaulted.  They might be in future releases.
+Be sure to read the documentation of @code{AC_CHECK_HEADER} to
+understand the influence of @var{includes}.
 @end defmac
 
 @node Declarations, Structures, Header Files, Existing Tests




reply via email to

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