autoconf-patches
[Top][All Lists]
Advanced

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

00-check-4-default-headers.patch


From: Akim Demaille
Subject: 00-check-4-default-headers.patch
Date: 15 Jan 2001 18:14:06 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Crater Lake)

Cleaned up.

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        When default headers are used, check for their presence.
        Suggested by Jim.

        * acgeneral.m4 (_AC_INIT_DEFAULTS): Don't define ac_exeext, nor
        ac_objext, as it's useless, and can even hide Autoconf bugs.
        Don't define ac_includes_default, since...
        (_AC_INCLUDES_DEFAULT_REQUIREMENTS): this new macro now does.
        (AC_INCLUDES_DEFAULT): Require the former when default includes
        are used.
        (AC_CHECK_MEMBERS, _AC_CHECK_TYPE_NEW): Don't require
        AC_HEADERS_STDC, that's a job for stupendous AC_INCLUDES_DEFAULT.
        * acfunctions.m4 (AC_FUNC_MALLOC): Check for stdlib.h.
        (AC_FUNC_VFORK): Look for unistd.h.

Index: acfunctions.m4
===================================================================
RCS file: /cvs/autoconf/acfunctions.m4,v
retrieving revision 1.23
diff -u -u -r1.23 acfunctions.m4
--- acfunctions.m4 2001/01/15 07:29:24 1.23
+++ acfunctions.m4 2001/01/15 17:14:39
@@ -713,6 +713,7 @@
 # Is `malloc (0)' properly handled?
 AC_DEFUN([AC_FUNC_MALLOC],
 [AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_CHECK_HEADERS(stdlib.h)
 AC_CACHE_CHECK([for working malloc], ac_cv_func_malloc_works,
 [AC_TRY_RUN(
 [#if STDC_HEADERS || HAVE_STDLIB_H
@@ -1432,7 +1433,7 @@
 # -------------
 AC_DEFUN([AC_FUNC_VFORK],
 [AC_REQUIRE([AC_TYPE_PID_T])dnl
-AC_CHECK_HEADERS(vfork.h)
+AC_CHECK_HEADERS(unistd.h vfork.h)
 AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
 [AC_TRY_RUN([/* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.653
diff -u -u -r1.653 acgeneral.m4
--- acgeneral.m4 2001/01/15 07:29:24 1.653
+++ acgeneral.m4 2001/01/15 17:14:42
@@ -802,42 +802,6 @@
 ac_tr_sh="sed y%*+%pp%;s%[[^_$ac_cr_alnum]]%_%g"
 ac_tr_cpp="sed y%*$ac_cr_az%P$ac_cr_AZ%;s%[[^_$ac_cr_alnum]]%_%g"
 
-# By default always use an empty string as the executable extension.
-# Only change it if the script calls AC_EXEEXT.
-ac_exeext=
-# By default assume that objects files use an extension of .o.  Only
-# change it if the script calls AC_OBJEXT.
-ac_objext=o
-# Factoring default headers for most tests.
-dnl If ever you change this variable, please keep autoconf.texi in sync.
-ac_includes_default="\
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-# include <string.h>
-#else
-# if HAVE_STRINGS_H
-#  include <strings.h>
-# endif
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
 m4_divert_pop()dnl
 ])# _AC_INIT_DEFAULTS
 
@@ -2263,15 +2227,46 @@
 # Always use the same set of default headers for all the generic
 # macros.  It is easier to document, to extend, and to understand than
 # having specific defaults for each macro.
-
-# Of course, one would like to issue these default headers only if
-# they were used, i.e.., AC_INCLUDES_DEFAULT was called, and the
-# default `branch' was run.  Unfortunately AC_INCLUDES_DEFAULT is
-# called unquoted, so it is unsafe to try to divert from there.
-# Therefore, the following *is* buggy, but this is the kind of
-# tradeoff we accept in order to improve configure.
 
-# See _AC_INIT_PREPARE to see the value of `ac_includes_default'.
+# _AC_INCLUDES_DEFAULT_REQUIREMENTS
+# ---------------------------------
+# Required when AC_INCLUDES_DEFAULT uses its default branch.
+AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
+[m4_divert_text([DEFAULTS],
+[# Factoring default headers for most tests.
+dnl If ever you change this variable, please keep autoconf.texi in sync.
+ac_includes_default="\
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#else
+# if HAVE_STRINGS_H
+#  include <strings.h>
+# endif
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+])dnl
+AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_CHECK_HEADERS(stdlib.h string.h memory.h strings.h inttypes.h unistd.h)
+])
 
 
 # AC_INCLUDES_DEFAULT([INCLUDES])
@@ -2313,15 +2308,15 @@
 # Because I don't see any backward compatible means to fix the
 # brokenness of AC_TRY_COMPILE, we are doomed to leave a extra new
 # line here.
-m4_define([AC_INCLUDES_DEFAULT],
+AC_DEFUN([AC_INCLUDES_DEFAULT],
 [m4_ifval([$1], [$1
 ],
-          [$ac_includes_default])])
+          [AC_REQUIRE([_AC_INCLUDES_DEFAULT_REQUIREMENTS])dnl
+$ac_includes_default])])
 
 
 
 
-
 ## -------------------------- ##
 ## Generic structure checks.  ##
 ## -------------------------- ##
@@ -2338,7 +2333,6 @@
                [AC_FATAL([$0: requires literal arguments])])dnl
 m4_if(m4_regexp([$1], [\.]), -1,
       [AC_FATAL([$0: Did not see any dot in `$1'])])dnl
-AC_REQUIRE([AC_HEADER_STDC])dnl
 AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
 dnl Extract the aggregate name, and the member name
 AC_CACHE_CHECK([for $1], ac_Member,
@@ -3231,8 +3225,7 @@
 # variable, we just use a cast to avoid warnings from the compiler.
 # Suggested by Paul Eggert.
 m4_define([_AC_CHECK_TYPE_NEW],
-[AC_REQUIRE([AC_HEADER_STDC])dnl
-AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
+[AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
 AC_CACHE_CHECK([for $1], ac_Type,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
 [if (($1 *) 0)
Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.412
diff -u -u -r1.412 autoconf.texi
--- doc/autoconf.texi 2001/01/15 07:40:11 1.412
+++ doc/autoconf.texi 2001/01/15 17:14:46
@@ -2672,6 +2672,9 @@
 @end group
 @end example
 
+If the default includes are used, then Autoconf will automatically check
+for the presence of these headers, i.e., you don't need to run
address@hidden, nor check for @file{stdlib.h} etc.
 
 @node Alternative Programs, Libraries, Common Behavior, Existing Tests
 @section Alternative Programs
Index: tests/semantics.at
===================================================================
RCS file: /cvs/autoconf/tests/semantics.at,v
retrieving revision 1.14
diff -u -u -r1.14 semantics.at
--- tests/semantics.at 2001/01/11 15:17:13 1.14
+++ tests/semantics.at 2001/01/15 17:14:47
@@ -103,7 +103,13 @@
 typedef unsigned char ucharchar[2];]])
 AC_CHECK_SIZEOF(ucharcharchar)]],
 [AT_CHECK_DEFINES(
-[#define SIZEOF_CHAR 1
+[#define HAVE_INTTYPES_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_UNISTD_H 1
+#define SIZEOF_CHAR 1
 #define SIZEOF_CHARCHAR 2
 #define SIZEOF_CHARCHARCHAR 0
 #define SIZEOF_UCHARCHAR 2



reply via email to

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