]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acgeneral.m4 (AC_TRY_COMPILER): Use AC_LINK_IFELSE.
authorAkim Demaille <akim@epita.fr>
Sat, 25 Mar 2000 09:04:13 +0000 (09:04 +0000)
committerAkim Demaille <akim@epita.fr>
Sat, 25 Mar 2000 09:04:13 +0000 (09:04 +0000)
(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
acgeneral.m4
lib/autoconf/general.m4

index 796f26f04b65ecd6c5eae4a4fcc9d1ef77ce0b70..64dcb218aab71de6ca4309ff20ee5e28cd5dc9fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-03-25  Akim Demaille  <akim@epita.fr>
+
+       * 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  <akim@epita.fr>
 
        * acgeneral.m4 (AC_LINK_IFELSE, AC_COMPILE_IFELSE): New macros.
index 46c1812c99ff6d4f3f9f51bc9c3044d1bba94189..4e54c92a29670f44f07d228eeb4c893a683123f2 100644 (file)
@@ -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 <<EOF
-AC_LANG_SOURCE([[$1]])
-EOF
-if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
-  [$2]=yes
+[AC_LINK_IFELSE([AC_LANG_SOURCE([[$1]])],
+[[$2]=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/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 <assert.h>
 /* 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)();
 ], [
index 46c1812c99ff6d4f3f9f51bc9c3044d1bba94189..4e54c92a29670f44f07d228eeb4c893a683123f2 100644 (file)
@@ -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 <<EOF
-AC_LANG_SOURCE([[$1]])
-EOF
-if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
-  [$2]=yes
+[AC_LINK_IFELSE([AC_LANG_SOURCE([[$1]])],
+[[$2]=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/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 <assert.h>
 /* 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)();
 ], [