From 26629403800950ea5d07f1196572d48fd10293c0 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 25 Mar 2000 09:04:13 +0000 Subject: [PATCH] * acgeneral.m4 (AC_TRY_COMPILER): Use AC_LINK_IFELSE. (AC_TRY_LINK_FUNC, AC_CHECK_LIB, AC_CHECK_FUNC): Don't check that the current language is C++ to output `extern "C"': the CPP condition is enough. --- ChangeLog | 7 ++++++ acgeneral.m4 | 48 ++++++++++++++++------------------------- lib/autoconf/general.m4 | 48 ++++++++++++++++------------------------- 3 files changed, 45 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 796f26f0..64dcb218 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-03-25 Akim Demaille + + * acgeneral.m4 (AC_TRY_COMPILER): Use AC_LINK_IFELSE. + (AC_TRY_LINK_FUNC, AC_CHECK_LIB, AC_CHECK_FUNC): Don't check that + the current language is C++ to output `extern "C"': the CPP + condition is enough. + 2000-03-25 Akim Demaille * acgeneral.m4 (AC_LINK_IFELSE, AC_COMPILE_IFELSE): New macros. diff --git a/acgeneral.m4 b/acgeneral.m4 index 46c1812c..4e54c92a 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2698,23 +2698,16 @@ popdef([AC_Prog])dnl # `AC_TRY_COMPILER()', call `AC_LANG_*' to set-up for the right # language. AC_DEFUN(AC_TRY_COMPILER, -[cat >conftest.$ac_ext </dev/null; then [$3]=no else [$3]=yes - fi -else - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC - [$2]=no -fi -rm -fr conftest*]) + fi], +[[$2]=no])[]dnl +])# AC_TRY_COMPILER @@ -2731,16 +2724,15 @@ rm -fr conftest*]) AC_DEFUN(AC_TRY_LINK_FUNC, [AC_TRY_LINK( AC_LANG_CASE([FORTRAN77], , -ifelse([$1], [main], , dnl Avoid conflicting decl of main. +[ifelse([$1], [main], , dnl Avoid conflicting decl of main. [/* Override any gcc2 internal prototype to avoid an error. */ -]AC_LANG_CASE(C++, [#ifdef __cplusplus +#ifdef __cplusplus extern "C" #endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ char $1(); -])), +])]), [$1()], [$2], [$3])]) @@ -2792,16 +2784,15 @@ AC_CACHE_CHECK([for $2 in -l$1], ac_Lib, LIBS="-l$1 $5 $LIBS" AC_TRY_LINK(dnl AC_LANG_CASE([FORTRAN77], , -ifelse([$2], [main], , dnl Avoid conflicting decl of main. +[ifelse([$2], [main], , dnl Avoid conflicting decl of main. [/* Override any gcc2 internal prototype to avoid an error. */ -]AC_LANG_CASE(C++, [#ifdef __cplusplus +#ifdef __cplusplus extern "C" #endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ char $2(); -])), +])]), [$2()], AC_VAR_SET(ac_Lib, yes), AC_VAR_SET(ac_Lib, no)) LIBS="$ac_save_LIBS"]) @@ -2963,7 +2954,7 @@ rm -f conftest*[]dnl # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ----------------------------------------------------- # Should the INCLUDES be defaulted here? -# Contrarily to AC_LINK_IF, this macro double quote its first two args. +# Contrarily to AC_LINK_IFELSE, this macro double quote its first two args. # FIXME: WARNING: The code to compile was different in the case of # Fortran between AC_TRY_COMPILE and AC_TRY_LINK, though they should # equivalent as far as I can tell from the semantics and the docs. In @@ -3155,12 +3146,11 @@ dnl select. Similarly for bzero. which can conflict with char $1(); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ -]AC_LANG_CASE(C++, [#ifdef __cplusplus +#ifdef __cplusplus extern "C" #endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ char $1(); char (*f)(); ], [ diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 46c1812c..4e54c92a 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2698,23 +2698,16 @@ popdef([AC_Prog])dnl # `AC_TRY_COMPILER()', call `AC_LANG_*' to set-up for the right # language. AC_DEFUN(AC_TRY_COMPILER, -[cat >conftest.$ac_ext </dev/null; then [$3]=no else [$3]=yes - fi -else - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC - [$2]=no -fi -rm -fr conftest*]) + fi], +[[$2]=no])[]dnl +])# AC_TRY_COMPILER @@ -2731,16 +2724,15 @@ rm -fr conftest*]) AC_DEFUN(AC_TRY_LINK_FUNC, [AC_TRY_LINK( AC_LANG_CASE([FORTRAN77], , -ifelse([$1], [main], , dnl Avoid conflicting decl of main. +[ifelse([$1], [main], , dnl Avoid conflicting decl of main. [/* Override any gcc2 internal prototype to avoid an error. */ -]AC_LANG_CASE(C++, [#ifdef __cplusplus +#ifdef __cplusplus extern "C" #endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ char $1(); -])), +])]), [$1()], [$2], [$3])]) @@ -2792,16 +2784,15 @@ AC_CACHE_CHECK([for $2 in -l$1], ac_Lib, LIBS="-l$1 $5 $LIBS" AC_TRY_LINK(dnl AC_LANG_CASE([FORTRAN77], , -ifelse([$2], [main], , dnl Avoid conflicting decl of main. +[ifelse([$2], [main], , dnl Avoid conflicting decl of main. [/* Override any gcc2 internal prototype to avoid an error. */ -]AC_LANG_CASE(C++, [#ifdef __cplusplus +#ifdef __cplusplus extern "C" #endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ char $2(); -])), +])]), [$2()], AC_VAR_SET(ac_Lib, yes), AC_VAR_SET(ac_Lib, no)) LIBS="$ac_save_LIBS"]) @@ -2963,7 +2954,7 @@ rm -f conftest*[]dnl # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ----------------------------------------------------- # Should the INCLUDES be defaulted here? -# Contrarily to AC_LINK_IF, this macro double quote its first two args. +# Contrarily to AC_LINK_IFELSE, this macro double quote its first two args. # FIXME: WARNING: The code to compile was different in the case of # Fortran between AC_TRY_COMPILE and AC_TRY_LINK, though they should # equivalent as far as I can tell from the semantics and the docs. In @@ -3155,12 +3146,11 @@ dnl select. Similarly for bzero. which can conflict with char $1(); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ -]AC_LANG_CASE(C++, [#ifdef __cplusplus +#ifdef __cplusplus extern "C" #endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ char $1(); char (*f)(); ], [