Dispatch on AC_LANG_CONFTEST

* lib/autoconf/c.m4 (AC_LANG_CONFTEST(C)): Define instead of
AC_LANG_SOURCE(C).
* lib/autoconf/general.m4 (_AC_INIT_PREPARE): Add a comment at the
top of confdefs.h, which also works around cpp deficiencies.
* lib/autoconf/lang.m4 (AC_LANG_DEFINE): Define AC_LANG_CONFTEST(xyz)
(AC_LANG_CONFTEST): Dispatch based on _AC_LANG.
(AC_LANG_CONFTEST()): New.
This commit is contained in:
Paolo Bonzini 2008-11-03 10:25:23 +01:00
parent cf5862afae
commit 8e27cc7f52
4 changed files with 28 additions and 9 deletions

View File

@ -1,3 +1,14 @@
2008-11-03 Paolo Bonzini <bonzini@gnu.org>
Eliminate a fork per invocation of AC_LANG_CONFTEST.
* lib/autoconf/c.m4 (AC_LANG_CONFTEST(C)): Define instead of
AC_LANG_SOURCE(C).
* lib/autoconf/general.m4 (_AC_INIT_PREPARE): Add a comment at the
top of confdefs.h, which also works around cpp deficiencies.
* lib/autoconf/lang.m4 (AC_LANG_DEFINE): Define AC_LANG_CONFTEST(xyz)
(AC_LANG_CONFTEST): Dispatch based on _AC_LANG.
(AC_LANG_CONFTEST()): New.
2008-11-03 Paolo Bonzini <bonzini@gnu.org>
Reorganize definition of languages.

View File

@ -99,18 +99,17 @@ AU_DEFUN([AC_LANG_C], [AC_LANG(C)])
# ------------------------ #
# AC_LANG_SOURCE(C)(BODY)
# AC_LANG_CONFTEST(C)(BODY)
# -----------------------
# We can't use '#line $LINENO "configure"' here, since
# Sun c89 (Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09)
# 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 - <<_ACEOF >>conftest.$ac_ext
m4_define([AC_LANG_CONFTEST(C)],
[cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$1])
$1
_ACEOF])
# AC_LANG_PROGRAM(C)([PROLOGUE], [BODY])

View File

@ -1324,9 +1324,10 @@ ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
dnl AIX cpp loses on an empty file, NextStep 3.3 (patch 3) loses on a file
dnl containing less than 14 bytes (including the newline).
dnl But the defines below solve this problem.
AS_ECHO(["/* confdefs.h */"]) > confdefs.h
# Predefined preprocessor variables.
AC_DEFINE_UNQUOTED([PACKAGE_NAME], ["$PACKAGE_NAME"],

View File

@ -188,11 +188,12 @@ m4_defun([AC_LANG_ASSERT],
# ABBREV and Makefile variable prefix PREFIX. AC_LANG(NAME) is defined
# to SHELL-VARS, other macros are copied from language COPY-FROM. Even if
# COPY-FROM is empty, a default definition is provided for language-specific
# macro AC_LANG_SOURCE(NAME).
# macros AC_LANG_SOURCE(NAME) and AC_LANG_CONFTEST(NAME).
m4_define([AC_LANG_DEFINE],
[m4_define([AC_LANG($1)], [$5])]
[m4_define([_AC_LANG_ABBREV($1)], [$2])]
[m4_define([_AC_LANG_PREFIX($1)], [$3])]
[m4_copy([AC_LANG_CONFTEST($4)], [AC_LANG_CONFTEST($1)])]
[m4_copy([AC_LANG_SOURCE($4)], [AC_LANG_SOURCE($1)])]
[m4_ifval([$4],
[m4_copy([AC_LANG_PROGRAM($4)], [AC_LANG_PROGRAM($1)])]
@ -210,7 +211,14 @@ m4_define([AC_LANG_DEFINE],
# ----------------------
# Save the BODY in `conftest.$ac_ext'. Add a trailing new line.
AC_DEFUN([AC_LANG_CONFTEST],
[cat >conftest.$ac_ext <<_ACEOF
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# AC_LANG_CONFTEST()(BODY)
# ------------------------
# Default implementation of AC_LANG_CONFTEST.
m4_define([AC_LANG_CONFTEST()],
[cat > conftest.$ac_ext <<_ACEOF
$1
_ACEOF])