+2000-10-18 Morten Eriksen <mortene@sim.no>
+
+ * aclang.m4 (_AC_PROG_CC_G): Use the _AC_COMPILE_IFELSE macro
+ instead of reinventing the wheel. This also takes care of a bug
+ where the "-g" option was accepted if the compiler silently exits
+ with status unequal to 0.
+ (_AC_PROG_CXX_G): Likewise.
+ (AC_PROG_CC): As _AC_PROG_CC_G depends on $ac_objext and
+ $ac_exeext, move the expansion of _AC_OBJEXT and _AC_EXEEXT in
+ front of _AC_PROG_CC_G.
+ (AC_PROG_CXX, AC_PROG_F77): Likewise.
+
2000-10-18 Akim Demaille <akim@epita.fr>
* tests/atgeneral.m4 (AT_INIT): Avoid foo="`bar`", foo=`bar` is
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
GCC=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_CC_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_CC_G
AC_LANG_POP
])# AC_PROG_CC
define([_AC_PROG_CC_G],
[ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-CFLAGS=
+CFLAGS="-g"
AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-if ${CC-cc} -g -c conftest.$ac_ext 2>&1 | grep . >/dev/null; then
- ac_cv_prog_cc_g=no
-else
- ac_cv_prog_cc_g=yes
-fi
-rm -f conftest*
-])
+ [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes],
+ [ac_cv_prog_cc_g=no])])
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
GXX=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_CXX_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_CXX_G
AC_LANG_POP
])# AC_PROG_CXX
define([_AC_PROG_CXX_G],
[ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS=
+CXXFLAGS="-g"
AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-if ${CXX-g++} -g -c conftest.$ac_ext 2>&1 | grep . >/dev/null; then
- ac_cv_prog_cxx_g=no
-else
- ac_cv_prog_cxx_g=yes
-fi
-rm -f conftest*
-])
+ [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [ac_cv_prog_cxx_g=yes],
+ [ac_cv_prog_cxx_g=no])])
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
G77=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_F77_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_F77_G
AC_LANG_POP
])# AC_PROG_F77
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
GCC=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_CC_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_CC_G
AC_LANG_POP
])# AC_PROG_CC
define([_AC_PROG_CC_G],
[ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-CFLAGS=
+CFLAGS="-g"
AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-if ${CC-cc} -g -c conftest.$ac_ext 2>&1 | grep . >/dev/null; then
- ac_cv_prog_cc_g=no
-else
- ac_cv_prog_cc_g=yes
-fi
-rm -f conftest*
-])
+ [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes],
+ [ac_cv_prog_cc_g=no])])
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
GXX=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_CXX_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_CXX_G
AC_LANG_POP
])# AC_PROG_CXX
define([_AC_PROG_CXX_G],
[ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS=
+CXXFLAGS="-g"
AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-if ${CXX-g++} -g -c conftest.$ac_ext 2>&1 | grep . >/dev/null; then
- ac_cv_prog_cxx_g=no
-else
- ac_cv_prog_cxx_g=yes
-fi
-rm -f conftest*
-])
+ [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [ac_cv_prog_cxx_g=yes],
+ [ac_cv_prog_cxx_g=no])])
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
G77=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_F77_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_F77_G
AC_LANG_POP
])# AC_PROG_F77
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
GCC=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_CC_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_CC_G
AC_LANG_POP
])# AC_PROG_CC
define([_AC_PROG_CC_G],
[ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-CFLAGS=
+CFLAGS="-g"
AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-if ${CC-cc} -g -c conftest.$ac_ext 2>&1 | grep . >/dev/null; then
- ac_cv_prog_cc_g=no
-else
- ac_cv_prog_cc_g=yes
-fi
-rm -f conftest*
-])
+ [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes],
+ [ac_cv_prog_cc_g=no])])
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
GXX=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_CXX_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_CXX_G
AC_LANG_POP
])# AC_PROG_CXX
define([_AC_PROG_CXX_G],
[ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS=
+CXXFLAGS="-g"
AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-if ${CXX-g++} -g -c conftest.$ac_ext 2>&1 | grep . >/dev/null; then
- ac_cv_prog_cxx_g=no
-else
- ac_cv_prog_cxx_g=yes
-fi
-rm -f conftest*
-])
+ [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [ac_cv_prog_cxx_g=yes],
+ [ac_cv_prog_cxx_g=no])])
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
G77=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_F77_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_F77_G
AC_LANG_POP
])# AC_PROG_F77
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
GCC=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_CC_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_CC_G
AC_LANG_POP
])# AC_PROG_CC
define([_AC_PROG_CC_G],
[ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-CFLAGS=
+CFLAGS="-g"
AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-if ${CC-cc} -g -c conftest.$ac_ext 2>&1 | grep . >/dev/null; then
- ac_cv_prog_cc_g=no
-else
- ac_cv_prog_cc_g=yes
-fi
-rm -f conftest*
-])
+ [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes],
+ [ac_cv_prog_cc_g=no])])
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
GXX=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_CXX_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_CXX_G
AC_LANG_POP
])# AC_PROG_CXX
define([_AC_PROG_CXX_G],
[ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS=
+CXXFLAGS="-g"
AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-if ${CXX-g++} -g -c conftest.$ac_ext 2>&1 | grep . >/dev/null; then
- ac_cv_prog_cxx_g=no
-else
- ac_cv_prog_cxx_g=yes
-fi
-rm -f conftest*
-])
+ [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [ac_cv_prog_cxx_g=yes],
+ [ac_cv_prog_cxx_g=no])])
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
_AC_LANG_COMPILER_WORKS
_AC_LANG_COMPILER_GNU
G77=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_F77_G
AC_EXPAND_ONCE([_AC_OBJEXT])
AC_EXPAND_ONCE([_AC_EXEEXT])
+_AC_PROG_F77_G
AC_LANG_POP
])# AC_PROG_F77