]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* aclang.m4 (_AC_PROG_CC_GNU, _AC_PROG_CXX_GNU,
authorAkim Demaille <akim@epita.fr>
Fri, 28 Jul 2000 07:36:11 +0000 (07:36 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 28 Jul 2000 07:36:11 +0000 (07:36 +0000)
_AC_PROG_F77_GNU): Use ac_ext.  Use ACEOF instead of EOF.
(AC_LANG_CONFTEST): New macro.
(_AC_PROG_CC_G, AC_PROG_CC_C_O, _AC_PROG_CXX_G, AC_PROG_F77_C_O,
_AC_PROG_F77_V_OUTPUT): Use it.
* acgeneral.m4 (AC_TRY_CPP, AC_EGREP_CPP, AC_COMPILE_IFELSE,
AC_LINK_IFELSE, AC_RUN_IFELSE): Likewise.

ChangeLog
INSTALL
acgeneral.m4
aclang.m4
lib/autoconf/c.m4
lib/autoconf/fortran.m4
lib/autoconf/general.m4
lib/autoconf/lang.m4

index 423b7d95b6191950bd1b5b2da5ba3cd050701c51..8d55f5c97a62e5fa853af9c824c4954e995cc6f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-07-28  Akim Demaille  <akim@epita.fr>
+
+       * aclang.m4 (_AC_PROG_CC_GNU, _AC_PROG_CXX_GNU,
+       _AC_PROG_F77_GNU): Use ac_ext.  Use ACEOF instead of EOF.
+       (AC_LANG_CONFTEST): New macro.
+       (_AC_PROG_CC_G, AC_PROG_CC_C_O, _AC_PROG_CXX_G, AC_PROG_F77_C_O,
+       _AC_PROG_F77_V_OUTPUT): Use it.
+       * acgeneral.m4 (AC_TRY_CPP, AC_EGREP_CPP, AC_COMPILE_IFELSE,
+       AC_LINK_IFELSE, AC_RUN_IFELSE): Likewise.
+
 2000-07-24  Steven G. Johnson  <stevenj@alum.mit.edu>
 
        * aclang.m4 (AC_F77_FUNC): New macro to give the user a clean
diff --git a/INSTALL b/INSTALL
index cdfa1123d7e78444e080d812cbf06cafe1086f43..ff159e274ff44d5e6245ae6ddec25296f9840d81 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -13,8 +13,8 @@ file `config.log' containing compiler output (useful mainly for
 debugging `configure').
 
    It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=./config.cache' or simply `-C') that
-saves the results of its tests to speed up reconfiguring.  (Caching is
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
 disabled by default to prevent problems with accidental use of stale
 cache files.)
 
@@ -133,7 +133,7 @@ Specifying the System Type
 automatically, but needs to determine by the type of host the package
 will run on.  Usually `configure' can figure that out, but if it prints
 a message saying it cannot guess the host type, give it the
-`--host=TYPE' option.  TYPE can either be a short name for the system
+`--build=TYPE' option.  TYPE can either be a short name for the system
 type, such as `sun4', or a canonical name which has the form:
 
      CPU-COMPANY-SYSTEM
@@ -147,9 +147,18 @@ where SYSTEM can have one of these forms:
 `config.sub' isn't included in this package, then this package doesn't
 need to know the host type.
 
-   If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for.
+   If you are _building_ compiler tools for cross-compiling, you can
+also use the `--target=TYPE' option to select the type of system they
+will produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the host
+platform (i.e., that on which the generated programs will eventually be
+run) with `--host=TYPE'.  In this case, you should also specify the
+build platform with `--build=TYPE', because, in this case, it may not
+be possible to guess the build platform (it sometimes involves
+compiling and running simple test programs, and this can't be done if
+the compiler is a cross compiler).
 
 Sharing Defaults
 ================
@@ -193,7 +202,7 @@ operates.
 
 `--cache-file=FILE'
      Enable the cache: use and save the results of the tests in FILE,
-     traditionally `./config.cache'.  FILE defaults to `/dev/null' to
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
      disable caching.
 
 `--config-cache'
index cbc4766a78a5db8345d60254727f698b97af1431..3e575267dd3718ddffef874901bde7d3a36e258e 100644 (file)
@@ -3162,13 +3162,11 @@ popdef([AC_Lib_Name])dnl
 # INCLUDES are not defaulted.
 AC_DEFUN([AC_TRY_CPP],
 [AC_REQUIRE_CPP()dnl
-cat >conftest.$ac_ext <<EOF
-AC_LANG_SOURCE([[$1]])
-EOF
-dnl Capture the stderr of cpp.  eval is necessary to expand ac_cpp.
-dnl We used to copy stderr to stdout and capture it in a variable, but
-dnl that breaks under sh -x, which writes compile commands starting
-dnl with ` +' to stderr in eval and subshells.
+AC_LANG_CONFTEST([AC_LANG_SOURCE([[$1]])])
+# Capture the stderr of cpp.  eval is necessary to expand ac_cpp.  We
+# used to copy stderr to stdout and capture it in a variable, but that
+# breaks under sh -x, which writes compile commands starting with ` +'
+# to stderr in eval and subshells.
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 AC_TRY_EVAL(ac_try)
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
@@ -3199,9 +3197,7 @@ AC_DEFUN([AC_EGREP_HEADER],
 # come early, it is not included in AC_BEFORE checks.
 AC_DEFUN([AC_EGREP_CPP],
 [AC_REQUIRE_CPP()dnl
-cat >conftest.$ac_ext <<EOF
-AC_LANG_SOURCE([[$2]])
-EOF
+AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
 dnl eval is necessary to expand ac_cpp.
 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_LOG |
@@ -3228,9 +3224,7 @@ rm -f conftest*
 # --------------------------------------------------------------------
 # Try to compile PROGRAM.
 AC_DEFUN([AC_COMPILE_IFELSE],
-[cat >conftest.$ac_ext <<EOF
-$1
-EOF
+[AC_LANG_CONFTEST([$1])
 if AC_TRY_EVAL(ac_compile) && test -s conftest.$ac_objext; then
   m4_default([$2], :)
 else
@@ -3261,9 +3255,7 @@ AC_DEFUN([AC_TRY_COMPILE],
 # -----------------------------------------------------------------
 # Try to link PROGRAM.
 AC_DEFUN([AC_LINK_IFELSE],
-[cat >conftest.$ac_ext <<EOF
-$1
-EOF
+[AC_LANG_CONFTEST([$1])
 if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
   m4_default([$2], :)
 else
@@ -3312,9 +3304,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
 # -----------------------------------------------------------
 # Compile, link, and run.
 AC_DEFUN([AC_RUN_IFELSE],
-[cat >conftest.$ac_ext <<EOF
-$1
-EOF
+[AC_LANG_CONFTEST([$1])
 if AC_TRY_EVAL(ac_link) &&
    test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null; then
   m4_default([$2], :)
index ed1f02d16c33311b7be3f5e59cdda818724bbbb9..e0effda338d7d32f0a00cf5ceb1964a3b6f5bdc2 100644 (file)
--- a/aclang.m4
+++ b/aclang.m4
@@ -168,7 +168,7 @@ define([AC_LANG(C)],
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${CC-cc} -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_gcc
 ])
 
@@ -191,7 +191,7 @@ define([AC_LANG(C++)],
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${CXX-g++} -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_gxx
 ])
 
@@ -212,7 +212,7 @@ AU_DEFUN([AC_LANG_CPLUSPLUS], [AC_LANG(C++)])
 define([AC_LANG(Fortran 77)],
 [ac_ext=f
 ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${F77-f77} -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_g77
 ])
 
@@ -230,14 +230,26 @@ AU_DEFUN([AC_LANG_FORTRAN77], [AC_LANG(Fortran 77)])
 ## 2.Producing programs.  ##
 ## ---------------------- ##
 
+
 # ---------------------- #
 # 2a. Generic routines.  #
 # ---------------------- #
 
+
+# AC_LANG_CONFTEST(BODY)
+# ---------------------
+# Save the BODY in `conftest.$acext'.  Add a trailing new line.
+define([AC_LANG_CONFTEST],
+[cat >conftest.$ac_ext <<ACEOF
+$1
+ACEOF])
+
+
 # AC_LANG_SOURCE(BODY)
 # --------------------
 # Produce a valid source for the current language, which includes the
-# BODY.  Include the `#line' sync lines.
+# BODY, and as much as possible `confdefs.h' and the `#line' sync
+# lines.
 AC_DEFUN([AC_LANG_SOURCE],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
@@ -574,12 +586,12 @@ AC_LANG_POP
 define([_AC_PROG_CC_GNU],
 [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
 [# The semicolon is to pacify NeXT's syntax-checking cpp.
-cat >conftest.c <<EOF
+cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes;
 #endif
-EOF
-if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND(${CC-cc} -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -603,8 +615,8 @@ define([_AC_PROG_CC_G],
 ac_save_CFLAGS=$CFLAGS
 CFLAGS=
 AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
-[echo 'void f(){}' >conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+if test -z "`${CC-cc} -g -c conftest.$ac_ext 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
   ac_cv_prog_cc_g=no
@@ -666,21 +678,21 @@ fi
 set dummy $CC; ac_cc=`echo $[2] |
                      sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
-[echo 'foo(){}' >conftest.c
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # Make sure it works both with $CC and with simple cc.
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
-ac_try='${CC-cc} -c conftest.c -o conftest.o >&AC_FD_LOG'
+ac_try='${CC-cc} -c conftest.$ac_ext -o conftest.$objext >&AC_FD_LOG'
 if AC_TRY_EVAL(ac_try) &&
-   test -f conftest.o && AC_TRY_EVAL(ac_try);
+   test -f conftest.$objext && AC_TRY_EVAL(ac_try);
 then
   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
   if test "x$CC" != xcc; then
     # Test first that cc exists at all.
-    if AC_TRY_COMMAND(cc -c conftest.c >&AC_FD_LOG); then
-      ac_try='cc -c conftest.c -o conftest.o >&AC_FD_LOG'
+    if AC_TRY_COMMAND(cc -c conftest.$ac_ext >&AC_FD_LOG); then
+      ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&AC_FD_LOG'
       if AC_TRY_EVAL(ac_try) &&
-        test -f conftest.o && AC_TRY_EVAL(ac_try);
+        test -f conftest.$objext && AC_TRY_EVAL(ac_try);
       then
         # cc works too.
         :
@@ -766,12 +778,12 @@ AC_LANG_POP
 define([_AC_PROG_CXX_GNU],
 [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
 [# The semicolon is to pacify NeXT's syntax-checking cpp.
-cat >conftest.cc <<EOF
+cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes;
 #endif
-EOF
-if AC_TRY_COMMAND(${CXX-g++} -E conftest.cc) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND(${CXX-g++} -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -795,8 +807,8 @@ define([_AC_PROG_CXX_G],
 ac_save_CXXFLAGS=$CXXFLAGS
 CXXFLAGS=
 AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
-[echo 'void f(){}' >conftest.cc
-if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+if test -z "`${CXX-g++} -g -c conftest.$ac_ext 2>&1`"; then
   ac_cv_prog_cxx_g=yes
 else
   ac_cv_prog_cxx_g=no
@@ -868,12 +880,12 @@ AC_LANG_POP
 # do CPP pre-processing.
 define([_AC_PROG_F77_GNU],
 [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77,
-[cat >conftest.f <<EOF
+[cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes
 #endif
-EOF
-if AC_TRY_COMMAND($F77 -E conftest.f) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND($F77 -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_g77=yes
 else
   ac_cv_prog_g77=no
@@ -932,14 +944,12 @@ AC_DEFUN([AC_PROG_F77_C_O],
 [AC_REQUIRE([AC_PROG_F77])dnl
 AC_CACHE_CHECK([whether $F77 understand -c and -o together],
                [ac_cv_prog_f77_c_o],
-[cat >conftest.f <<EOF
-AC_LANG_PROGRAM([])
-EOF
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # We do the `AC_TRY_EVAL' test twice because some compilers refuse to
 # overwrite an existing `.o' file with `-o', although they will create
 # one.
-ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o >&AC_FD_LOG'
-if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then
+ac_try='$F77 $FFLAGS -c conftest.$ac_ext -o conftest.$objext >&AC_FD_LOG'
+if AC_TRY_EVAL(ac_try) && test -f conftest.$objext && AC_TRY_EVAL(ac_try); then
   ac_cv_prog_f77_c_o=yes
 else
   ac_cv_prog_f77_c_o=no
@@ -1309,9 +1319,7 @@ AC_DEFUN([_AC_PROG_F77_V_OUTPUT],
 [AC_REQUIRE([AC_PROG_F77])dnl
 AC_LANG_PUSH(Fortran 77)
 
-cat >conftest.$ac_ext <<EOF
-AC_LANG_PROGRAM()
-EOF
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 
 # Compile and link our simple test program by passing a flag
 # (argument 1 to this macro) to the Fortran 77 compiler in
index ed1f02d16c33311b7be3f5e59cdda818724bbbb9..e0effda338d7d32f0a00cf5ceb1964a3b6f5bdc2 100644 (file)
@@ -168,7 +168,7 @@ define([AC_LANG(C)],
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${CC-cc} -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_gcc
 ])
 
@@ -191,7 +191,7 @@ define([AC_LANG(C++)],
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${CXX-g++} -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_gxx
 ])
 
@@ -212,7 +212,7 @@ AU_DEFUN([AC_LANG_CPLUSPLUS], [AC_LANG(C++)])
 define([AC_LANG(Fortran 77)],
 [ac_ext=f
 ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${F77-f77} -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_g77
 ])
 
@@ -230,14 +230,26 @@ AU_DEFUN([AC_LANG_FORTRAN77], [AC_LANG(Fortran 77)])
 ## 2.Producing programs.  ##
 ## ---------------------- ##
 
+
 # ---------------------- #
 # 2a. Generic routines.  #
 # ---------------------- #
 
+
+# AC_LANG_CONFTEST(BODY)
+# ---------------------
+# Save the BODY in `conftest.$acext'.  Add a trailing new line.
+define([AC_LANG_CONFTEST],
+[cat >conftest.$ac_ext <<ACEOF
+$1
+ACEOF])
+
+
 # AC_LANG_SOURCE(BODY)
 # --------------------
 # Produce a valid source for the current language, which includes the
-# BODY.  Include the `#line' sync lines.
+# BODY, and as much as possible `confdefs.h' and the `#line' sync
+# lines.
 AC_DEFUN([AC_LANG_SOURCE],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
@@ -574,12 +586,12 @@ AC_LANG_POP
 define([_AC_PROG_CC_GNU],
 [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
 [# The semicolon is to pacify NeXT's syntax-checking cpp.
-cat >conftest.c <<EOF
+cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes;
 #endif
-EOF
-if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND(${CC-cc} -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -603,8 +615,8 @@ define([_AC_PROG_CC_G],
 ac_save_CFLAGS=$CFLAGS
 CFLAGS=
 AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
-[echo 'void f(){}' >conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+if test -z "`${CC-cc} -g -c conftest.$ac_ext 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
   ac_cv_prog_cc_g=no
@@ -666,21 +678,21 @@ fi
 set dummy $CC; ac_cc=`echo $[2] |
                      sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
-[echo 'foo(){}' >conftest.c
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # Make sure it works both with $CC and with simple cc.
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
-ac_try='${CC-cc} -c conftest.c -o conftest.o >&AC_FD_LOG'
+ac_try='${CC-cc} -c conftest.$ac_ext -o conftest.$objext >&AC_FD_LOG'
 if AC_TRY_EVAL(ac_try) &&
-   test -f conftest.o && AC_TRY_EVAL(ac_try);
+   test -f conftest.$objext && AC_TRY_EVAL(ac_try);
 then
   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
   if test "x$CC" != xcc; then
     # Test first that cc exists at all.
-    if AC_TRY_COMMAND(cc -c conftest.c >&AC_FD_LOG); then
-      ac_try='cc -c conftest.c -o conftest.o >&AC_FD_LOG'
+    if AC_TRY_COMMAND(cc -c conftest.$ac_ext >&AC_FD_LOG); then
+      ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&AC_FD_LOG'
       if AC_TRY_EVAL(ac_try) &&
-        test -f conftest.o && AC_TRY_EVAL(ac_try);
+        test -f conftest.$objext && AC_TRY_EVAL(ac_try);
       then
         # cc works too.
         :
@@ -766,12 +778,12 @@ AC_LANG_POP
 define([_AC_PROG_CXX_GNU],
 [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
 [# The semicolon is to pacify NeXT's syntax-checking cpp.
-cat >conftest.cc <<EOF
+cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes;
 #endif
-EOF
-if AC_TRY_COMMAND(${CXX-g++} -E conftest.cc) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND(${CXX-g++} -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -795,8 +807,8 @@ define([_AC_PROG_CXX_G],
 ac_save_CXXFLAGS=$CXXFLAGS
 CXXFLAGS=
 AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
-[echo 'void f(){}' >conftest.cc
-if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+if test -z "`${CXX-g++} -g -c conftest.$ac_ext 2>&1`"; then
   ac_cv_prog_cxx_g=yes
 else
   ac_cv_prog_cxx_g=no
@@ -868,12 +880,12 @@ AC_LANG_POP
 # do CPP pre-processing.
 define([_AC_PROG_F77_GNU],
 [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77,
-[cat >conftest.f <<EOF
+[cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes
 #endif
-EOF
-if AC_TRY_COMMAND($F77 -E conftest.f) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND($F77 -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_g77=yes
 else
   ac_cv_prog_g77=no
@@ -932,14 +944,12 @@ AC_DEFUN([AC_PROG_F77_C_O],
 [AC_REQUIRE([AC_PROG_F77])dnl
 AC_CACHE_CHECK([whether $F77 understand -c and -o together],
                [ac_cv_prog_f77_c_o],
-[cat >conftest.f <<EOF
-AC_LANG_PROGRAM([])
-EOF
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # We do the `AC_TRY_EVAL' test twice because some compilers refuse to
 # overwrite an existing `.o' file with `-o', although they will create
 # one.
-ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o >&AC_FD_LOG'
-if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then
+ac_try='$F77 $FFLAGS -c conftest.$ac_ext -o conftest.$objext >&AC_FD_LOG'
+if AC_TRY_EVAL(ac_try) && test -f conftest.$objext && AC_TRY_EVAL(ac_try); then
   ac_cv_prog_f77_c_o=yes
 else
   ac_cv_prog_f77_c_o=no
@@ -1309,9 +1319,7 @@ AC_DEFUN([_AC_PROG_F77_V_OUTPUT],
 [AC_REQUIRE([AC_PROG_F77])dnl
 AC_LANG_PUSH(Fortran 77)
 
-cat >conftest.$ac_ext <<EOF
-AC_LANG_PROGRAM()
-EOF
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 
 # Compile and link our simple test program by passing a flag
 # (argument 1 to this macro) to the Fortran 77 compiler in
index ed1f02d16c33311b7be3f5e59cdda818724bbbb9..e0effda338d7d32f0a00cf5ceb1964a3b6f5bdc2 100644 (file)
@@ -168,7 +168,7 @@ define([AC_LANG(C)],
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${CC-cc} -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_gcc
 ])
 
@@ -191,7 +191,7 @@ define([AC_LANG(C++)],
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${CXX-g++} -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_gxx
 ])
 
@@ -212,7 +212,7 @@ AU_DEFUN([AC_LANG_CPLUSPLUS], [AC_LANG(C++)])
 define([AC_LANG(Fortran 77)],
 [ac_ext=f
 ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${F77-f77} -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_g77
 ])
 
@@ -230,14 +230,26 @@ AU_DEFUN([AC_LANG_FORTRAN77], [AC_LANG(Fortran 77)])
 ## 2.Producing programs.  ##
 ## ---------------------- ##
 
+
 # ---------------------- #
 # 2a. Generic routines.  #
 # ---------------------- #
 
+
+# AC_LANG_CONFTEST(BODY)
+# ---------------------
+# Save the BODY in `conftest.$acext'.  Add a trailing new line.
+define([AC_LANG_CONFTEST],
+[cat >conftest.$ac_ext <<ACEOF
+$1
+ACEOF])
+
+
 # AC_LANG_SOURCE(BODY)
 # --------------------
 # Produce a valid source for the current language, which includes the
-# BODY.  Include the `#line' sync lines.
+# BODY, and as much as possible `confdefs.h' and the `#line' sync
+# lines.
 AC_DEFUN([AC_LANG_SOURCE],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
@@ -574,12 +586,12 @@ AC_LANG_POP
 define([_AC_PROG_CC_GNU],
 [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
 [# The semicolon is to pacify NeXT's syntax-checking cpp.
-cat >conftest.c <<EOF
+cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes;
 #endif
-EOF
-if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND(${CC-cc} -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -603,8 +615,8 @@ define([_AC_PROG_CC_G],
 ac_save_CFLAGS=$CFLAGS
 CFLAGS=
 AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
-[echo 'void f(){}' >conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+if test -z "`${CC-cc} -g -c conftest.$ac_ext 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
   ac_cv_prog_cc_g=no
@@ -666,21 +678,21 @@ fi
 set dummy $CC; ac_cc=`echo $[2] |
                      sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
-[echo 'foo(){}' >conftest.c
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # Make sure it works both with $CC and with simple cc.
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
-ac_try='${CC-cc} -c conftest.c -o conftest.o >&AC_FD_LOG'
+ac_try='${CC-cc} -c conftest.$ac_ext -o conftest.$objext >&AC_FD_LOG'
 if AC_TRY_EVAL(ac_try) &&
-   test -f conftest.o && AC_TRY_EVAL(ac_try);
+   test -f conftest.$objext && AC_TRY_EVAL(ac_try);
 then
   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
   if test "x$CC" != xcc; then
     # Test first that cc exists at all.
-    if AC_TRY_COMMAND(cc -c conftest.c >&AC_FD_LOG); then
-      ac_try='cc -c conftest.c -o conftest.o >&AC_FD_LOG'
+    if AC_TRY_COMMAND(cc -c conftest.$ac_ext >&AC_FD_LOG); then
+      ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&AC_FD_LOG'
       if AC_TRY_EVAL(ac_try) &&
-        test -f conftest.o && AC_TRY_EVAL(ac_try);
+        test -f conftest.$objext && AC_TRY_EVAL(ac_try);
       then
         # cc works too.
         :
@@ -766,12 +778,12 @@ AC_LANG_POP
 define([_AC_PROG_CXX_GNU],
 [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
 [# The semicolon is to pacify NeXT's syntax-checking cpp.
-cat >conftest.cc <<EOF
+cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes;
 #endif
-EOF
-if AC_TRY_COMMAND(${CXX-g++} -E conftest.cc) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND(${CXX-g++} -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -795,8 +807,8 @@ define([_AC_PROG_CXX_G],
 ac_save_CXXFLAGS=$CXXFLAGS
 CXXFLAGS=
 AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
-[echo 'void f(){}' >conftest.cc
-if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+if test -z "`${CXX-g++} -g -c conftest.$ac_ext 2>&1`"; then
   ac_cv_prog_cxx_g=yes
 else
   ac_cv_prog_cxx_g=no
@@ -868,12 +880,12 @@ AC_LANG_POP
 # do CPP pre-processing.
 define([_AC_PROG_F77_GNU],
 [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77,
-[cat >conftest.f <<EOF
+[cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes
 #endif
-EOF
-if AC_TRY_COMMAND($F77 -E conftest.f) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND($F77 -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_g77=yes
 else
   ac_cv_prog_g77=no
@@ -932,14 +944,12 @@ AC_DEFUN([AC_PROG_F77_C_O],
 [AC_REQUIRE([AC_PROG_F77])dnl
 AC_CACHE_CHECK([whether $F77 understand -c and -o together],
                [ac_cv_prog_f77_c_o],
-[cat >conftest.f <<EOF
-AC_LANG_PROGRAM([])
-EOF
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # We do the `AC_TRY_EVAL' test twice because some compilers refuse to
 # overwrite an existing `.o' file with `-o', although they will create
 # one.
-ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o >&AC_FD_LOG'
-if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then
+ac_try='$F77 $FFLAGS -c conftest.$ac_ext -o conftest.$objext >&AC_FD_LOG'
+if AC_TRY_EVAL(ac_try) && test -f conftest.$objext && AC_TRY_EVAL(ac_try); then
   ac_cv_prog_f77_c_o=yes
 else
   ac_cv_prog_f77_c_o=no
@@ -1309,9 +1319,7 @@ AC_DEFUN([_AC_PROG_F77_V_OUTPUT],
 [AC_REQUIRE([AC_PROG_F77])dnl
 AC_LANG_PUSH(Fortran 77)
 
-cat >conftest.$ac_ext <<EOF
-AC_LANG_PROGRAM()
-EOF
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 
 # Compile and link our simple test program by passing a flag
 # (argument 1 to this macro) to the Fortran 77 compiler in
index cbc4766a78a5db8345d60254727f698b97af1431..3e575267dd3718ddffef874901bde7d3a36e258e 100644 (file)
@@ -3162,13 +3162,11 @@ popdef([AC_Lib_Name])dnl
 # INCLUDES are not defaulted.
 AC_DEFUN([AC_TRY_CPP],
 [AC_REQUIRE_CPP()dnl
-cat >conftest.$ac_ext <<EOF
-AC_LANG_SOURCE([[$1]])
-EOF
-dnl Capture the stderr of cpp.  eval is necessary to expand ac_cpp.
-dnl We used to copy stderr to stdout and capture it in a variable, but
-dnl that breaks under sh -x, which writes compile commands starting
-dnl with ` +' to stderr in eval and subshells.
+AC_LANG_CONFTEST([AC_LANG_SOURCE([[$1]])])
+# Capture the stderr of cpp.  eval is necessary to expand ac_cpp.  We
+# used to copy stderr to stdout and capture it in a variable, but that
+# breaks under sh -x, which writes compile commands starting with ` +'
+# to stderr in eval and subshells.
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 AC_TRY_EVAL(ac_try)
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
@@ -3199,9 +3197,7 @@ AC_DEFUN([AC_EGREP_HEADER],
 # come early, it is not included in AC_BEFORE checks.
 AC_DEFUN([AC_EGREP_CPP],
 [AC_REQUIRE_CPP()dnl
-cat >conftest.$ac_ext <<EOF
-AC_LANG_SOURCE([[$2]])
-EOF
+AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
 dnl eval is necessary to expand ac_cpp.
 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_LOG |
@@ -3228,9 +3224,7 @@ rm -f conftest*
 # --------------------------------------------------------------------
 # Try to compile PROGRAM.
 AC_DEFUN([AC_COMPILE_IFELSE],
-[cat >conftest.$ac_ext <<EOF
-$1
-EOF
+[AC_LANG_CONFTEST([$1])
 if AC_TRY_EVAL(ac_compile) && test -s conftest.$ac_objext; then
   m4_default([$2], :)
 else
@@ -3261,9 +3255,7 @@ AC_DEFUN([AC_TRY_COMPILE],
 # -----------------------------------------------------------------
 # Try to link PROGRAM.
 AC_DEFUN([AC_LINK_IFELSE],
-[cat >conftest.$ac_ext <<EOF
-$1
-EOF
+[AC_LANG_CONFTEST([$1])
 if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
   m4_default([$2], :)
 else
@@ -3312,9 +3304,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
 # -----------------------------------------------------------
 # Compile, link, and run.
 AC_DEFUN([AC_RUN_IFELSE],
-[cat >conftest.$ac_ext <<EOF
-$1
-EOF
+[AC_LANG_CONFTEST([$1])
 if AC_TRY_EVAL(ac_link) &&
    test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null; then
   m4_default([$2], :)
index ed1f02d16c33311b7be3f5e59cdda818724bbbb9..e0effda338d7d32f0a00cf5ceb1964a3b6f5bdc2 100644 (file)
@@ -168,7 +168,7 @@ define([AC_LANG(C)],
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${CC-cc} -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_gcc
 ])
 
@@ -191,7 +191,7 @@ define([AC_LANG(C++)],
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${CXX-g++} -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_gxx
 ])
 
@@ -212,7 +212,7 @@ AU_DEFUN([AC_LANG_CPLUSPLUS], [AC_LANG(C++)])
 define([AC_LANG(Fortran 77)],
 [ac_ext=f
 ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext >&AC_FD_LOG'
-ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
+ac_link='${F77-f77} -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
 ac_gnu_compiler=$ac_cv_prog_g77
 ])
 
@@ -230,14 +230,26 @@ AU_DEFUN([AC_LANG_FORTRAN77], [AC_LANG(Fortran 77)])
 ## 2.Producing programs.  ##
 ## ---------------------- ##
 
+
 # ---------------------- #
 # 2a. Generic routines.  #
 # ---------------------- #
 
+
+# AC_LANG_CONFTEST(BODY)
+# ---------------------
+# Save the BODY in `conftest.$acext'.  Add a trailing new line.
+define([AC_LANG_CONFTEST],
+[cat >conftest.$ac_ext <<ACEOF
+$1
+ACEOF])
+
+
 # AC_LANG_SOURCE(BODY)
 # --------------------
 # Produce a valid source for the current language, which includes the
-# BODY.  Include the `#line' sync lines.
+# BODY, and as much as possible `confdefs.h' and the `#line' sync
+# lines.
 AC_DEFUN([AC_LANG_SOURCE],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
@@ -574,12 +586,12 @@ AC_LANG_POP
 define([_AC_PROG_CC_GNU],
 [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
 [# The semicolon is to pacify NeXT's syntax-checking cpp.
-cat >conftest.c <<EOF
+cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes;
 #endif
-EOF
-if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND(${CC-cc} -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -603,8 +615,8 @@ define([_AC_PROG_CC_G],
 ac_save_CFLAGS=$CFLAGS
 CFLAGS=
 AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
-[echo 'void f(){}' >conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+if test -z "`${CC-cc} -g -c conftest.$ac_ext 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
   ac_cv_prog_cc_g=no
@@ -666,21 +678,21 @@ fi
 set dummy $CC; ac_cc=`echo $[2] |
                      sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
-[echo 'foo(){}' >conftest.c
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # Make sure it works both with $CC and with simple cc.
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
-ac_try='${CC-cc} -c conftest.c -o conftest.o >&AC_FD_LOG'
+ac_try='${CC-cc} -c conftest.$ac_ext -o conftest.$objext >&AC_FD_LOG'
 if AC_TRY_EVAL(ac_try) &&
-   test -f conftest.o && AC_TRY_EVAL(ac_try);
+   test -f conftest.$objext && AC_TRY_EVAL(ac_try);
 then
   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
   if test "x$CC" != xcc; then
     # Test first that cc exists at all.
-    if AC_TRY_COMMAND(cc -c conftest.c >&AC_FD_LOG); then
-      ac_try='cc -c conftest.c -o conftest.o >&AC_FD_LOG'
+    if AC_TRY_COMMAND(cc -c conftest.$ac_ext >&AC_FD_LOG); then
+      ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&AC_FD_LOG'
       if AC_TRY_EVAL(ac_try) &&
-        test -f conftest.o && AC_TRY_EVAL(ac_try);
+        test -f conftest.$objext && AC_TRY_EVAL(ac_try);
       then
         # cc works too.
         :
@@ -766,12 +778,12 @@ AC_LANG_POP
 define([_AC_PROG_CXX_GNU],
 [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
 [# The semicolon is to pacify NeXT's syntax-checking cpp.
-cat >conftest.cc <<EOF
+cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes;
 #endif
-EOF
-if AC_TRY_COMMAND(${CXX-g++} -E conftest.cc) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND(${CXX-g++} -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -795,8 +807,8 @@ define([_AC_PROG_CXX_G],
 ac_save_CXXFLAGS=$CXXFLAGS
 CXXFLAGS=
 AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
-[echo 'void f(){}' >conftest.cc
-if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+if test -z "`${CXX-g++} -g -c conftest.$ac_ext 2>&1`"; then
   ac_cv_prog_cxx_g=yes
 else
   ac_cv_prog_cxx_g=no
@@ -868,12 +880,12 @@ AC_LANG_POP
 # do CPP pre-processing.
 define([_AC_PROG_F77_GNU],
 [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77,
-[cat >conftest.f <<EOF
+[cat >conftest.$ac_ext <<ACEOF
 #ifdef __GNUC__
   yes
 #endif
-EOF
-if AC_TRY_COMMAND($F77 -E conftest.f) | egrep yes >/dev/null 2>&1; then
+ACEOF
+if AC_TRY_COMMAND($F77 -E conftest.$ac_ext) | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_g77=yes
 else
   ac_cv_prog_g77=no
@@ -932,14 +944,12 @@ AC_DEFUN([AC_PROG_F77_C_O],
 [AC_REQUIRE([AC_PROG_F77])dnl
 AC_CACHE_CHECK([whether $F77 understand -c and -o together],
                [ac_cv_prog_f77_c_o],
-[cat >conftest.f <<EOF
-AC_LANG_PROGRAM([])
-EOF
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # We do the `AC_TRY_EVAL' test twice because some compilers refuse to
 # overwrite an existing `.o' file with `-o', although they will create
 # one.
-ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o >&AC_FD_LOG'
-if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then
+ac_try='$F77 $FFLAGS -c conftest.$ac_ext -o conftest.$objext >&AC_FD_LOG'
+if AC_TRY_EVAL(ac_try) && test -f conftest.$objext && AC_TRY_EVAL(ac_try); then
   ac_cv_prog_f77_c_o=yes
 else
   ac_cv_prog_f77_c_o=no
@@ -1309,9 +1319,7 @@ AC_DEFUN([_AC_PROG_F77_V_OUTPUT],
 [AC_REQUIRE([AC_PROG_F77])dnl
 AC_LANG_PUSH(Fortran 77)
 
-cat >conftest.$ac_ext <<EOF
-AC_LANG_PROGRAM()
-EOF
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 
 # Compile and link our simple test program by passing a flag
 # (argument 1 to this macro) to the Fortran 77 compiler in