]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acheaders.m4 (AC_CHECK_HEADER): When INCLUDES are set, use the
authorAkim Demaille <akim@epita.fr>
Tue, 3 Jul 2001 14:12:40 +0000 (14:12 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 3 Jul 2001 14:12:40 +0000 (14:12 +0000)
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.

ChangeLog
Makefile.am
Makefile.in
acgeneral.m4
acheaders.m4
doc/autoconf.texi
lib/autoconf/general.m4
lib/autoconf/headers.m4

index ac8cba8ddc5da1081b0f04ff1a4061dfce7701da..3adaff21152c37ef539031273f187957d7687454 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-07-03  Akim Demaille  <akim@epita.fr>
+
+       * 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.
+
 2001-07-03  Akim Demaille  <akim@epita.fr>
 
        * autoscan.in ($initfile): Remove.
index 5c7f81b78a44b98fae0f98dfa8bd8ab79ed71251..ad69002fafe59bb703e069c75ed2e5b7e658ed57 100644 (file)
@@ -180,11 +180,19 @@ autoscan: $(srcdir)/autoscan.in $(srcdir)/configure.in
 # 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 @@ autoscan: $(srcdir)/autoscan.in $(srcdir)/configure.in
        $(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 498fca183a269d6422ddb1e310a99faa2d919bae..6d4ff03a0ce64db2ec1ff7dbc776faf01e518136 100644 (file)
@@ -495,11 +495,19 @@ autoscan: $(srcdir)/autoscan.in $(srcdir)/configure.in
 # 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 \
@@ -508,8 +516,8 @@ autoscan: $(srcdir)/autoscan.in $(srcdir)/configure.in
        $(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 c82b96414dac976c3c7a2b657ea878ab179a6b1b..7e6faeb54c27524d6f1a5ebcb61c91aef8d6bc2e 100644 (file)
@@ -2237,15 +2237,9 @@ ac_includes_default="\
 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 44da612b0a7ba3fd620b4f9f1719481f2191ad65..ac88b23e489df8c5ec1feb01cc43af89fd5eed80 100644 (file)
 ## 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([@%:@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_CHECK_HEADER($ac_header,
                 [$3],
                 [$4])dnl
 done
-])
+])# AC_CHECK_HEADERS
 
 
 
index 169cfa63dcc8b663f2fbd089454ef8d1cf0fc279..5277605052c169a6dcb93fbc0b48c82c1544fc5f 100644 (file)
@@ -923,8 +923,8 @@ argument explicit, or you may simply omit the trailing commas.  The
 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 @@ test for it (@pxref{Writing Tests}).
 
 @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.
+If the system header file @var{header-file} is usable, 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}:
+
+@table @asis
+@item if @var{includes} is empty
+check whether
+
+@example
+@var{header-file}
+@end example
+
+@noindent
+can be @emph{preprocessed} without error.
+
+@item if @var{include} is set
+Check whether
+
+@example
+@var{includes}
+#include <@var{header-file}>
+@end example
+
+@noindent
+can be @emph{compiled} without error.  You may use
+@code{AC_CHECK_HEADER} (and @code{AC_CHECK_HEADERS}) to check whether
+two headers are compatible.
+@end table
 
-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.
+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 (@var{header-file}@dots{}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes})
@@ -3957,10 +3984,8 @@ 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.
+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
index c82b96414dac976c3c7a2b657ea878ab179a6b1b..7e6faeb54c27524d6f1a5ebcb61c91aef8d6bc2e 100644 (file)
@@ -2237,15 +2237,9 @@ ac_includes_default="\
 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 44da612b0a7ba3fd620b4f9f1719481f2191ad65..ac88b23e489df8c5ec1feb01cc43af89fd5eed80 100644 (file)
 ## 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([@%:@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_CHECK_HEADER($ac_header,
                 [$3],
                 [$4])dnl
 done
-])
+])# AC_CHECK_HEADERS