From: Stefano Lattarini Date: Wed, 28 Dec 2011 10:40:20 +0000 (+0100) Subject: test defs: substitute compilers and flags found at configure time X-Git-Tag: ng-0.5a~27^2~2^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a354283eb7d49574b6c4390fb338b78906a446ed;p=thirdparty%2Fautomake.git test defs: substitute compilers and flags found at configure time * tests/Makefile.am (do_subst): Also substitute CC, CXX, F77, FC, CPPFLAGS, CFLAGS, CXXFLAGS, FCFLAGS and FFLAGS. * tests/defs-static.in: Define those variables, allowing for overrides from the environment. * tests/defs (for tool in $required): Export (subsets of) those variables when the stuff in `$required' calls for it. Add related explanatory comments. --- diff --git a/tests/Makefile.am b/tests/Makefile.am index d47be7830..d42dd6863 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -147,6 +147,15 @@ do_subst = sed \ -e 's|@PERL[@]|$(PERL)|g' \ -e 's|@EGREP[@]|$(EGREP)|g' \ -e 's|@FGREP[@]|$(FGREP)|g' \ + -e 's|@CPPFLAGS[@]|$(CPPFLAGS)|g' \ + -e 's|@CC[@]|$(CC)|g' \ + -e 's|@CFLAGS[@]|$(CFLAGS)|g' \ + -e 's|@CXX[@]|$(CXX)|g' \ + -e 's|@CXXFLAGS[@]|$(CXXFLAGS)|g' \ + -e 's|@F77[@]|$(F77)|g' \ + -e 's|@FFLAGS[@]|$(FFLAGS)|g' \ + -e 's|@FC[@]|$(FC)|g' \ + -e 's|@FCFLAGS[@]|$(FCFLAGS)|g' \ -e 's|@GNU_CFLAGS[@]|$(GNU_CFLAGS)|g' \ -e 's|@GNU_CXXFLAGS[@]|$(GNU_CXXFLAGS)|g' \ -e 's|@GNU_FFLAGS[@]|$(GNU_FFLAGS)|g' \ diff --git a/tests/defs b/tests/defs index 1c5052336..08ada588e 100644 --- a/tests/defs +++ b/tests/defs @@ -641,13 +641,21 @@ do case $tool in :) ;; cc) - test "$CC" = false && skip_all_ "no C compiler available";; + test "$CC" = false && skip_all_ "no C compiler available" + export CC CFLAGS CPPFLAGS + ;; c++) - test "$CXX" = false && skip_all_ "no C++ compiler available";; + test "$CXX" = false && skip_all_ "no C++ compiler available" + export CXX CXXFLAGS CPPFLAGS + ;; fortran) - test "$FC" = false && skip_all_ "no Fortran compiler available";; + test "$FC" = false && skip_all_ "no Fortran compiler available" + export FC FCFLAGS + ;; fortran77) - test "$F77" = false && skip_all_ "no Fortran 77 compiler available";; + test "$F77" = false && skip_all_ "no Fortran 77 compiler available" + export F77 FFLAGS + ;; xsi-shell) require_xsi "$SHELL";; xsi-bin-sh) @@ -667,7 +675,11 @@ do ;; cl) CC=cl - export CC + # Don't export CFLAGS, as that could have been initialized to only + # work with the C compiler detected at configure time. If the user + # wants CFLAGS to also influence `cl', he can still export CFLAGS + # in the environment "by hand" before calling the testsuite. + export CC CPPFLAGS echo "$me: running $CC -?" $CC -? || skip_all_ "Microsoft C compiler \`$CC' not available" ;; @@ -704,7 +716,7 @@ do # prefer gcc to other compilers. CC=${am__tool_prefix}gcc CFLAGS=$GNU_CFLAGS - export CC CFLAGS + export CC CFLAGS CPPFLAGS echo "$me: running $CC --version" $CC --version || skip_all_ "GNU C compiler not available" echo "$me: running $CC -v" @@ -721,7 +733,7 @@ do g++) CXX=${am__tool_prefix}g++ CXXFLAGS=$GNU_CXXFLAGS - export CXX CXXFLAGS + export CXX CXXFLAGS CPPFLAGS echo "$me: running $CXX --version" $CXX --version || skip_all_ "GNU C++ compiler not available" echo "$me: running $CXX -v" @@ -755,7 +767,7 @@ do ;; icc) CC=icc - export CC + export CC CPPFLAGS # But not CFLAGS (see comments for `cl' above). # There is no way to ask *only* the compiler's version. # This tool always wants to do something (by default # it will try link *nothing* and complain it cannot find diff --git a/tests/defs-static.in b/tests/defs-static.in index e58a1a196..b79e39948 100644 --- a/tests/defs-static.in +++ b/tests/defs-static.in @@ -194,6 +194,18 @@ AUTORECONF="$AUTORECONF -B /no/such/dir" EGREP=${AM_TESTSUITE_EGREP-'@EGREP@'} FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'} +# Compilers and their flags. These can point to non-GNU compilers (and +# on non-Linux and non-BSD systems, they probably will). +CC=${AM_TESTSUITE_CC-${CC-'@CC@'}} +CXX=${AM_TESTSUITE_CXX-${CXX-'@CXX@'}} +F77=${AM_TESTSUITE_F77-${F77-'@F77@'}} +FC=${AM_TESTSUITE_FC-${FC-'@FC@'}} +CFLAGS=${AM_TESTSUITE_CFLAGS-${CFLAGS-'@CFLAGS@'}} +CXXFLAGS=${AM_TESTSUITE_CXXFLAGS-${CXXFLAGS-'@CXXFLAGS@'}} +FCFLAGS=${AM_TESTSUITE_FCFLAGS-${FCFLAGS-'@FCFLAGS@'}} +FFLAGS=${AM_TESTSUITE_FFLAGS-${FFLAGS-'@FFLAGS@'}} +CPPFLAGS=${AM_TESTSUITE_CPPFLAGS-${CPPFLAGS-'@CPPFLAGS@'}} + # Flags for the GNU compilers. GNU_FFLAGS=${AM_TESTSUITE_GNU_FFLAGS-${GNU_FFLAGS-'@GNU_FFLAGS@'}} GNU_FCFLAGS=${AM_TESTSUITE_GNU_FCFLAGS-${GNU_FCFLAGS-'@GNU_FCFLAGS@'}}