autoconf-patches
[Top][All Lists]
Advanced

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

AC_CHECK_HEADERS with CC only


From: Akim Demaille
Subject: AC_CHECK_HEADERS with CC only
Date: 02 Oct 2002 08:35:34 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

I have never heard of any difference between using CC or CPP for
testing for the presence of a header (although we had some sentinel:
see the patch below).  Given that it is the former (CC) that we want
to know, given that it also relieves us from computing a preproc in
most cases, I think this is a big win.

For your information, here is the result of this patch on the
Coreutils 4.5.1:

-rwxr-xr-x    1 akim     lrde        1004K 2002-09-30 11:15 configure.old*
-rwxr-xr-x    1 akim     lrde         862K 2002-10-02 08:25 configure*

we spend a very significant space and a bit of time in checking with
CPP in addition to CC:

| --- configure.old.log 2002-10-02 08:29:20.000000000 +0200
| +++ configure.log     2002-10-02 08:31:35.000000000 +0200
| @@ -31,8 +31,6 @@
|  checking for inttypes.h... yes
|  checking for stdint.h... yes
|  checking for unistd.h... yes
| -checking minix/config.h usability... no
| -checking minix/config.h presence... no
|  checking for minix/config.h... no
|  checking for uname... yes
|  checking for chroot... yes
| @@ -50,109 +48,43 @@
|  checking for working volatile... yes
|  checking for inline... inline
|  checking for working long double with more range or precision than double... 
no
| -checking errno.h usability... yes
| -checking errno.h presence... yes
|  checking for errno.h... yes
| -checking fcntl.h usability... yes
| -checking fcntl.h presence... yes
|  checking for fcntl.h... yes
| -checking fenv.h usability... yes
| -checking fenv.h presence... yes
|  checking for fenv.h... yes
| -checking float.h usability... yes
| -checking float.h presence... yes
|  checking for float.h... yes
| -checking hurd.h usability... no
| -checking hurd.h presence... no
|  checking for hurd.h... no
| -checking limits.h usability... yes
| -checking limits.h presence... yes
|  checking for limits.h... yes
|  checking for memory.h... (cached) yes
| -checking mntent.h usability... yes
| -checking mntent.h presence... yes
|  checking for mntent.h... yes
| -checking mnttab.h usability... no
| -checking mnttab.h presence... no
|  checking for mnttab.h... no
| -checking netdb.h usability... yes
| -checking netdb.h presence... yes
|  checking for netdb.h... yes
| -checking paths.h usability... yes
| -checking paths.h presence... yes
|  checking for paths.h... yes
|  checking for stdlib.h... (cached) yes
| -checking stddef.h usability... yes
| -checking stddef.h presence... yes
|  checking for stddef.h... yes
|  checking for stdint.h... (cached) yes
|  checking for string.h... (cached) yes
| -checking sys/filsys.h usability... no
| -checking sys/filsys.h presence... no
|  checking for sys/filsys.h... no
| -checking sys/fs/s5param.h usability... no
| -checking sys/fs/s5param.h presence... no
|  checking for sys/fs/s5param.h... no
| -checking sys/fs_types.h usability... no
| -checking sys/fs_types.h presence... no
|  checking for sys/fs_types.h... no
| -checking sys/fstyp.h usability... no
| -checking sys/fstyp.h presence... no
|  checking for sys/fstyp.h... no
| -checking sys/ioctl.h usability... yes
| -checking sys/ioctl.h presence... yes
|  checking for sys/ioctl.h... yes
| -checking sys/mntent.h usability... no
| -checking sys/mntent.h presence... no
|  checking for sys/mntent.h... no
| -checking sys/mount.h usability... yes
| -checking sys/mount.h presence... yes
|  checking for sys/mount.h... yes
| -checking sys/param.h usability... yes
| -checking sys/param.h presence... yes
|  checking for sys/param.h... yes
| -checking sys/resource.h usability... yes
| -checking sys/resource.h presence... yes
|  checking for sys/resource.h... yes
| -checking sys/socket.h usability... yes
| -checking sys/socket.h presence... yes
|  checking for sys/socket.h... yes
| -checking sys/statfs.h usability... yes
| -checking sys/statfs.h presence... yes
|  checking for sys/statfs.h... yes
| -checking sys/statvfs.h usability... yes
| -checking sys/statvfs.h presence... yes
|  checking for sys/statvfs.h... yes
| -checking sys/sysctl.h usability... yes
| -checking sys/sysctl.h presence... yes
|  checking for sys/sysctl.h... yes
| -checking sys/systeminfo.h usability... no
| -checking sys/systeminfo.h presence... no
|  checking for sys/systeminfo.h... no
| -checking sys/time.h usability... yes
| -checking sys/time.h presence... yes
|  checking for sys/time.h... yes
| -checking sys/timeb.h usability... yes
| -checking sys/timeb.h presence... yes
|  checking for sys/timeb.h... yes
| -checking sys/vfs.h usability... yes
| -checking sys/vfs.h presence... yes
|  checking for sys/vfs.h... yes
| -checking sys/wait.h usability... yes
| -checking sys/wait.h presence... yes
|  checking for sys/wait.h... yes
| -checking syslog.h usability... yes
| -checking syslog.h presence... yes
|  checking for syslog.h... yes
| -checking termios.h usability... yes
| -checking termios.h presence... yes
|  checking for termios.h... yes
|  checking for unistd.h... (cached) yes
| -checking utime.h usability... yes
| -checking utime.h presence... yes
|  checking for utime.h... yes
| -checking values.h usability... yes
| -checking values.h presence... yes
|  checking for values.h... yes
|  checking for dirent.h that defines DIR... yes
|  checking for library containing opendir... none required
| @@ -181,23 +113,15 @@
|  checking for struct utimbuf... yes
|  checking for d_type member in directory struct... yes
|  checking for d_ino member in directory struct... yes
| -checking grp.h usability... yes
| -checking grp.h presence... yes
|  checking for grp.h... yes
|  checking for memory.h... (cached) yes
| -checking pwd.h usability... yes
| -checking pwd.h presence... yes
|  checking for pwd.h... yes
|  checking for string.h... (cached) yes
|  checking for strings.h... (cached) yes
|  checking for stdlib.h... (cached) yes
|  checking for unistd.h... (cached) yes
|  checking for sys/time.h... (cached) yes
| -checking utmp.h usability... yes
| -checking utmp.h presence... yes
|  checking for utmp.h... yes
| -checking utmpx.h usability... yes
| -checking utmpx.h presence... yes
|  checking for utmpx.h... yes
|  checking whether free is declared... yes
|  checking whether getenv is declared... yes
| @@ -233,8 +157,6 @@
|  checking whether getcontext is declared... yes
|  checking whether sigaltstack is declared... yes
|  checking for sys/resource.h... (cached) yes
| -checking ucontext.h usability... yes
| -checking ucontext.h presence... yes
|  checking for ucontext.h... yes
|  checking for unistd.h... (cached) yes
|  checking for stack_t... yes
| @@ -246,11 +168,7 @@
|  checking for string.h... (cached) yes
|  checking for netdb.h... (cached) yes
|  checking for sys/socket.h... (cached) yes
| -checking netinet/in.h usability... yes
| -checking netinet/in.h presence... yes
|  checking for netinet/in.h... yes
| -checking arpa/inet.h usability... yes
| -checking arpa/inet.h presence... yes
|  checking for arpa/inet.h... yes
|  checking for string.h... (cached) yes
|  checking for strerror... yes
| @@ -265,12 +183,8 @@
|  checking for working GNU fnmatch... yes
|  checking for stdbool.h that conforms to C99... no
|  checking for getpagesize... yes
| -checking OS.h usability... no
| -checking OS.h presence... no
|  checking for OS.h... no
|  checking for unistd.h... (cached) yes
| -checking locale.h usability... yes
| -checking locale.h presence... yes
|  checking for locale.h... yes
|  checking for stdlib.h... (cached) yes
|  checking for string.h... (cached) yes
| @@ -283,11 +197,7 @@
|  checking for limits.h... (cached) yes
|  checking for stdlib.h... (cached) yes
|  checking for string.h... (cached) yes
| -checking wchar.h usability... yes
| -checking wchar.h presence... yes
|  checking for wchar.h... yes
| -checking wctype.h usability... yes
| -checking wctype.h presence... yes
|  checking for wctype.h... yes
|  checking for isascii... yes
|  checking for iswcntrl... yes
| @@ -299,11 +209,7 @@
|  checking for mbstate_t... (cached) yes
|  checking for limits.h... (cached) yes
|  checking for stdlib.h... (cached) yes
| -checking bp-sym.h usability... no
| -checking bp-sym.h presence... no
|  checking for bp-sym.h... no
| -checking sys/pstat.h usability... no
| -checking sys/pstat.h presence... no
|  checking for sys/pstat.h... no
|  checking for unistd.h... (cached) yes
|  checking for pstat_getstatic... no
| @@ -347,17 +253,11 @@
|  checking for bcopy... yes
|  checking for isascii... (cached) yes
|  checking for btowc... yes
| -checking alloca.h usability... yes
| -checking alloca.h presence... yes
|  checking for alloca.h... yes
| -checking libintl.h usability... yes
| -checking libintl.h presence... yes
|  checking for libintl.h... yes
|  checking for wctype.h... (cached) yes
|  checking for wchar.h... (cached) yes
|  checking for long long... yes
| -checking sys/sysmacros.h usability... yes
| -checking sys/sysmacros.h presence... yes
|  checking for sys/sysmacros.h... yes
|  checking for sys/statvfs.h... (cached) yes
|  checking for sys/vfs.h... (cached) yes
| @@ -404,8 +304,6 @@
|  checking for dirfd... yes
|  checking whether dirfd is declared... yes
|  checking whether dirfd is a macro... no
| -checking sys/acl.h usability... no
| -checking sys/acl.h presence... no
|  checking for sys/acl.h... no
|  checking for acl... no
|  checking for lchown... yes
| @@ -491,8 +389,6 @@
|  checking for mbrlen... yes
|  checking for struct tm.tm_gmtoff... yes
|  checking for sys/time.h... (cached) yes
| -checking stdio_ext.h usability... yes
| -checking stdio_ext.h presence... yes
|  checking for stdio_ext.h... yes
|  checking for __fpending... yes
|  checking whether __fpending is declared... yes
| @@ -523,8 +419,6 @@
|  checking for working re_compile_pattern... yes
|  checking for locale.h... (cached) yes
|  checking for unistd.h... (cached) yes
| -checking mach/mach.h usability... no
| -checking mach/mach.h presence... no
|  checking for mach/mach.h... no
|  checking for fcntl.h... (cached) yes
|  checking for setlocale... (cached) yes
| @@ -612,8 +506,6 @@
|  checking for getmntinfo... (cached) no
|  checking for mntent.h... (cached) yes
|  checking for sys/param.h... (cached) yes
| -checking sys/ucred.h usability... no
| -checking sys/ucred.h presence... no
|  checking for sys/ucred.h... no
|  checking for sys/mount.h... (cached) yes
|  checking for sys/fs_types.h... (cached) no
| @@ -662,8 +554,6 @@
|  checking for fesetround in -lm... yes
|  checking for library containing yp_match... no
|  checking for library containing getspnam... none required
| -checking shadow.h usability... yes
| -checking shadow.h presence... yes
|  checking for shadow.h... yes
|  checking for struct spwd.sp_pwdp... yes
|  checking for getspnam... yes
| @@ -674,7 +564,7 @@
|  checking for msgmerge... /usr/bin/msgmerge
|  checking whether NLS is requested... yes
|  checking for GNU gettext in libc... yes
| -configure.old: creating ./config.status
| +configure: creating ./config.status
|  config.status: creating Makefile
|  config.status: creating doc/Makefile
|  config.status: creating lib/Makefile
| @@ -733,4 +623,4 @@
|  config.status: executing default-1 commands
|  config.status: creating po/POTFILES
|  config.status: creating po/Makefile
| -./configure.old  43,95s user 22,53s system 81% cpu 1:21,62 total
| +./configure  42,86s user 21,37s system 81% cpu 1:18,96 total


To be honest: I would also like to get rid of the `-' stuff which
still uses the old way, with the preprocessor.  These changes are very
important, because they help people moving to understanding that
configure must use proper headers.  In the very near future,
AC_CHECK_FUNCS should also AC_CHECK_DECLS the functions.  This is also
preleminary to the discussions about C++.  Let's not hurry.  Let's do
it properly step by step.  If we hurry, we will inherit from a broken
interface, backward compatibility burden etc.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        No longer use CPP to check for the existing of headers: use CC to
        check for compilability.

        * lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL): Remove.
        (AC_CHECK_HEADER): Adjust.

Index: lib/autoconf/headers.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/headers.m4,v
retrieving revision 1.22
diff -u -u -r1.22 headers.m4
--- lib/autoconf/headers.m4 28 Sep 2002 16:38:48 -0000 1.22
+++ lib/autoconf/headers.m4 2 Oct 2002 06:22:42 -0000
@@ -85,57 +85,9 @@
 # semantics only.
 AC_DEFUN([AC_CHECK_HEADER],
 [m4_case([$4],
-         [],  [_AC_CHECK_HEADER_MONGREL($@)],
          [-], [_AC_CHECK_HEADER_OLD($@)],
               [_AC_CHECK_HEADER_NEW($@)])
 ])# AC_CHECK_HEADER
-
-
-# _AC_CHECK_HEADER_MONGREL(HEADER-FILE,
-#                          [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
-#                          [INCLUDES])
-# --------------------------------------------------------------
-# Check using both the compiler and the preprocessor.  If they disagree,
-# warn, and the preproc wins.
-#
-# This is not based on _AC_CHECK_HEADER_NEW and _AC_CHECK_HEADER_OLD
-# because it obfuscate the code to try to factor everything, in particular
-# because of the cache variables, and the `checking...' messages.
-m4_define([_AC_CHECK_HEADER_MONGREL],
-[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
-AS_VAR_SET_IF(ac_Header,
-              [AC_CACHE_CHECK([for $1], ac_Header, [])],
-              [# Is the header compilable?
-AC_MSG_CHECKING([$1 usability])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT([$4])
address@hidden:@include <$1>])],
-                  [ac_header_compiler=yes],
-                  [ac_header_compiler=no])
-AC_MSG_RESULT([$ac_header_compiler])
-
-# Is the header present?
-AC_MSG_CHECKING([$1 presence])
-AC_PREPROC_IFELSE([AC_LANG_SOURCE(address@hidden:@include <$1>])],
-                  [ac_header_preproc=yes],
-                  [ac_header_preproc=no])
-AC_MSG_RESULT([$ac_header_preproc])
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    AC_MSG_WARN([$1: accepted by the compiler, rejected by the preprocessor!])
-    AC_MSG_WARN([$1: proceeding with the preprocessor's result]);;
-  no:yes )
-    AC_MSG_WARN([$1: present but cannot be compiled])
-    AC_MSG_WARN([$1: check for missing prerequisite headers?])
-    AC_MSG_WARN([$1: proceeding with the preprocessor's result]);;
-esac
-AC_CACHE_CHECK([for $1], ac_Header,
-               [AS_VAR_SET(ac_Header, $ac_header_preproc)])
-])dnl ! set ac_HEADER
-AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl
-AS_VAR_POPDEF([ac_Header])dnl
-])# _AC_CHECK_HEADER_MONGREL
 
 
 # _AC_CHECK_HEADER_NEW(HEADER-FILE,




reply via email to

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