* 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.
This commit is contained in:
Akim Demaille 2001-07-03 14:12:40 +00:00
parent 02adf2d812
commit 8ce8361c3d
8 changed files with 109 additions and 52 deletions

View File

@ -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.

View 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 \

View 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 \

View 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])

View File

@ -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([@%:@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

View 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.
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.
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
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

View 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])

View File

@ -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([@%:@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