_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-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
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.)
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
`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
================
`--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'
# 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}\$"`
# 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 |
# --------------------------------------------------------------------
# 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
# -----------------------------------------------------------------
# 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
# -----------------------------------------------------------
# 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], :)
# 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
])
# 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
])
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
])
## 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, $@)])
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
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
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.
:
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
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
# 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
[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
[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
# 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
])
# 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
])
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
])
## 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, $@)])
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
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
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.
:
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
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
# 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
[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
[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
# 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
])
# 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
])
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
])
## 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, $@)])
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
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
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.
:
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
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
# 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
[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
[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
# 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}\$"`
# 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 |
# --------------------------------------------------------------------
# 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
# -----------------------------------------------------------------
# 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
# -----------------------------------------------------------
# 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], :)
# 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
])
# 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
])
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
])
## 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, $@)])
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
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
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.
:
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
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
# 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
[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
[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