From: Akim Demaille Date: Wed, 18 Oct 2000 16:18:18 +0000 (+0000) Subject: * aclang.m4 (_AC_PROG_CC_G): Use the _AC_COMPILE_IFELSE macro X-Git-Tag: autoconf-2.50~554 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9021957ad91cbe2555d76d71bb4de8f3efcfff7;p=thirdparty%2Fautoconf.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 9bd867bc1..5ed3aca98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-10-18 Morten Eriksen + + * 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 * tests/atgeneral.m4 (AT_INIT): Avoid foo="`bar`", foo=`bar` is diff --git a/aclang.m4 b/aclang.m4 index f7bf46f74..c60ebc691 100644 --- a/aclang.m4 +++ b/aclang.m4 @@ -712,9 +712,9 @@ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) _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 @@ -727,16 +727,10 @@ AC_LANG_POP 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 @@ -907,9 +901,9 @@ AC_CHECK_TOOLS(CXX, _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 @@ -922,16 +916,11 @@ AC_LANG_POP 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 @@ -997,9 +986,9 @@ AC_CHECK_TOOLS(F77, _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 diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index f7bf46f74..c60ebc691 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -712,9 +712,9 @@ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) _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 @@ -727,16 +727,10 @@ AC_LANG_POP 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 @@ -907,9 +901,9 @@ AC_CHECK_TOOLS(CXX, _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 @@ -922,16 +916,11 @@ AC_LANG_POP 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 @@ -997,9 +986,9 @@ AC_CHECK_TOOLS(F77, _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 diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index f7bf46f74..c60ebc691 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -712,9 +712,9 @@ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) _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 @@ -727,16 +727,10 @@ AC_LANG_POP 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 @@ -907,9 +901,9 @@ AC_CHECK_TOOLS(CXX, _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 @@ -922,16 +916,11 @@ AC_LANG_POP 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 @@ -997,9 +986,9 @@ AC_CHECK_TOOLS(F77, _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 diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4 index f7bf46f74..c60ebc691 100644 --- a/lib/autoconf/lang.m4 +++ b/lib/autoconf/lang.m4 @@ -712,9 +712,9 @@ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) _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 @@ -727,16 +727,10 @@ AC_LANG_POP 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 @@ -907,9 +901,9 @@ AC_CHECK_TOOLS(CXX, _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 @@ -922,16 +916,11 @@ AC_LANG_POP 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 @@ -997,9 +986,9 @@ AC_CHECK_TOOLS(F77, _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