glibc configury: ac_includes_default

2011-09-19 Thread Thomas Schwinge
Hi!

In glibc, we can't make configure decisions based on the host system's C
library, as we must be independent of it -- we're about to build the C
library at this time.

But, $ac_includes_default (as used via AC_INCLUDES_DEFAULT by default) in
several autoconf tests (headers, etc.) contains #include [...] for
several C library headers -- but this will pick up the host system's from
/usr/include/.

Is there/can there be an officially sanctioned way for doing the
following; emptying ac_includes_default?

diff --git a/configure.in b/configure.in
index fbc64b9..fbeab8e 100644
--- a/configure.in
+++ b/configure.in
@@ -6,6 +6,12 @@ AC_CONFIG_SRCDIR([include/features.h])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([scripts])
 
+# Do not make decisions based on the host system's C library, as we must be
+# independent of it.
+AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
+  [m4_divert_text([DEFAULTS],
+[ac_includes_default='/* none */'])])
+
 dnl This is here so we can set $subdirs directly based on configure fragments.
 AC_CONFIG_SUBDIRS()
 

Instead of mucking with autoconf's internals, can we for example get a
AC_INCLUDES_DEFAULT_INIT([...]), or similar?


Together with the following hunk:

diff --git a/aclocal.m4 b/aclocal.m4
index 6ad3c87..5d441a7 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -5,6 +5,7 @@ dnl AC_REQUIREs or AC_BEFOREs duplicating their code.
 dnl
 define([GLIBC_PROVIDES], [dnl
 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_PROVIDE([_AC_INCLUDES_DEFAULT_REQUIREMENTS])dnl
 AC_PROVIDE([AC_CONFIG_SUBDIRS])dnl
 AC_PROVIDE([_AS_ECHO_N_PREPARE])dnl
 AC_PROVIDE([_AS_ECHO_PREPARE])dnl

..., this results in the following configure simplifications/corrections
in glibc:

diff --git a/configure b/configure
index 6cf85e5..1576b46 100755
--- a/configure
+++ b/configure
@@ -559,42 +559,7 @@ PACKAGE_URL='http://www.gnu.org/software/c-library/'
 
 ac_unique_file=include/features.h
 enable_option_checking=no
-# Factoring default headers for most tests.
-ac_includes_default=\
-#include stdio.h
-#ifdef HAVE_SYS_TYPES_H
-# include sys/types.h
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include sys/stat.h
-#endif
-#ifdef STDC_HEADERS
-# include stdlib.h
-# include stddef.h
-#else
-# ifdef HAVE_STDLIB_H
-#  include stdlib.h
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS  defined HAVE_MEMORY_H
-#  include memory.h
-# endif
-# include string.h
-#endif
-#ifdef HAVE_STRINGS_H
-# include strings.h
-#endif
-#ifdef HAVE_INTTYPES_H
-# include inttypes.h
-#endif
-#ifdef HAVE_STDINT_H
-# include stdint.h
-#endif
-#ifdef HAVE_UNISTD_H
-# include unistd.h
-#endif
-
+ac_includes_default='/* none */'
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 RELEASE
@@ -626,8 +591,6 @@ libc_cv_slibdir
 old_glibc_headers
 libc_cv_gcc_unwind_find_fde
 sizeof_long_double
-EGREP
-GREP
 have_selinux
 have_libcap
 have_libaudit
@@ -1935,37 +1898,6 @@ rm -f conftest.val
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_compute_int
-
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# ---
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
-  as_lineno=${as_lineno-$1} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo $as_me:${as_lineno-$LINENO}: checking for $2 5
-$as_echo_n checking for $2...  6; }
-if eval test \\${$3+set}\ = set; then :
-  $as_echo_n (cached)  6
-else
-  cat confdefs.h - _ACEOF conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include $2
-_ACEOF
-if ac_fn_c_try_compile $LINENO; then :
-  eval $3=yes
-else
-  eval $3=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-  { $as_echo $as_me:${as_lineno-$LINENO}: result: $ac_res 5
-$as_echo $ac_res 6; }
-  eval $as_lineno_stack; test x$as_lineno_stack = x  { as_lineno=; unset 
as_lineno;}
-
-} # ac_fn_c_check_header_compile
 cat config.log _ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -2351,6 +2283,10 @@ ac_configure=$SHELL $ac_aux_dir/configure  # Please 
don't use this var.
 
 
 
+# Do not make decisions based on the host system's C library, as we must be
+# independent of it.
+
+
 
 
 subdirs=$subdirs 
@@ -7323,265 +7259,6 @@ fi
 
 
 
-{ $as_echo $as_me:${as_lineno-$LINENO}: checking for grep that handles long 
lines and -e 5
-$as_echo_n checking for grep that handles long lines and -e...  6; }
-if test ${ac_cv_path_GREP+set} = set; then :
-  $as_echo_n (cached)  6
-else
-  if test -z $GREP; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z $as_dir  as_dir=.
-for ac_prog in grep ggrep; do
-for ac_exec_ext in '' $ac_executable_extensions; do
-  

Re: glibc configury: ac_includes_default

2011-09-19 Thread Paul Eggert
On 09/19/11 03:51, Thomas Schwinge wrote:
 Instead of mucking with autoconf's internals, can we for example get a
 AC_INCLUDES_DEFAULT_INIT([...]), or similar?

This looks like a good idea, thanks.  Would someone like to write up
a patch to Autoconf?  (As usual, the documentation is probably the
hardest part ...)

___
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf