Hello,

currently, conftest.c contains a copy of confdefs.h.
This feature was introduced by Akim in 2002, see
http://lists.gnu.org/archive/html/autoconf-patches/2002-10/msg00072.html

The reasoning mentions "better logs", not problems with #include.

But the comment above the definition of AC_LANG_SOURCE(C) at that time
mentioned that
        # This sometimes fails to find confdefs.h, for some reason.
(By mistake, the comment is still there.)
But as I said, this was not the reason for avoiding #include.

So I suggest the following optimization.
OK to commit?

Stepan
2005-09-07  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/autoconf/general.m4 (_AC_MSG_LOG_CONFTEST): Move...
        * lib/autoconf/lang.m4 (_AC_MSG_LOG_CONFTEST): ...here. If a language
          specific definition is available, call it.  Otherwise use the
          previous code.
        * lib/autoconf/c.m4 (_AC_MSG_LOG_CONFTEST(C), 
_AC_MSG_LOG_CONFTEST(C++)):
          New macro, add confdefs.h to the log.
        (AC_LANG_SOURCE(C)): Do not copy confdefs.h, include it.

Index: lib/autoconf/c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.202
diff -u -r1.202 c.m4
--- lib/autoconf/c.m4   6 Jul 2005 21:39:31 -0000       1.202
+++ lib/autoconf/c.m4   7 Sep 2005 13:32:32 -0000
@@ -82,6 +82,15 @@
 m4_define([_AC_LANG_PREFIX(C)], [C])
 
 
+# _AC_MSG_LOG_CONFTEST(C)
+# -----------------------
+m4_define([_AC_MSG_LOG_CONFTEST(C)],
+[sed 's,^#include "confdefs\.h",/* & */,;s,^,| ,;'"1i\
+$as_me: failed program was:
+" confdefs.h conftest.$ac_ext >&AS_MESSAGE_LOG_FD
+])
+
+
 # ---------------------- #
 # 1c. The C++ language.  #
 # ---------------------- #
@@ -114,6 +123,11 @@
 m4_define([_AC_LANG_PREFIX(C++)], [CXX])
 
 
+# _AC_MSG_LOG_CONFTEST(C++)
+# -------------------------
+m4_copy([_AC_MSG_LOG_CONFTEST(C)], [_AC_MSG_LOG_CONFTEST(C++)])
+
+
 
 ## ---------------------- ##
 ## 2.Producing programs.  ##
@@ -132,11 +146,7 @@
 # rejects $LINENO greater than 32767, and some configure scripts
 # are longer than 32767 lines.
 m4_define([AC_LANG_SOURCE(C)],
-[/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+[#include "confdefs.h"
 $1])
 
 
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.885
diff -u -r1.885 general.m4
--- lib/autoconf/general.m4     6 Sep 2005 15:39:01 -0000       1.885
+++ lib/autoconf/general.m4     7 Sep 2005 13:32:33 -0000
@@ -2041,14 +2041,6 @@
 See `config.log' for more details.], [$2])])
 
 
-# _AC_MSG_LOG_CONFTEST
-# --------------------
-m4_define([_AC_MSG_LOG_CONFTEST],
-[echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD
-sed 's/^/| /' conftest.$ac_ext >&AS_MESSAGE_LOG_FD
-])
-
-
 # AU::AC_CHECKING(FEATURE)
 # ------------------------
 AU_DEFUN([AC_CHECKING],
Index: lib/autoconf/lang.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/lang.m4,v
retrieving revision 1.171
diff -u -r1.171 lang.m4
--- lib/autoconf/lang.m4        14 May 2005 07:00:40 -0000      1.171
+++ lib/autoconf/lang.m4        7 Sep 2005 13:32:33 -0000
@@ -195,6 +195,18 @@
        [m4_fatal([$0: current language is not $1: ] _AC_LANG)])])
 
 
+# _AC_MSG_LOG_CONFTEST
+# --------------------
+m4_define([_AC_MSG_LOG_CONFTEST],
+[m4_ifdef([_AC_MSG_LOG_CONFTEST(]_AC_LANG[)],
+       [m4_indir([_AC_MSG_LOG_CONFTEST(]_AC_LANG[)])],
+       [sed "s/^/| /;1i\
+$as_me: failed program was:
+" conftest.$ac_ext >&AS_MESSAGE_LOG_FD
+])dnl
+])
+
+
 
 ## ---------------------- ##
 ## 2.Producing programs.  ##
@@ -263,6 +275,7 @@
 # EXPRESSION into `conftest.val'.
 AC_DEFUN([AC_LANG_INT_SAVE],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
 
 
 ## -------------------------------------------- ##

Reply via email to