]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test defs: substitute compilers and flags found at configure time
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 28 Dec 2011 10:40:20 +0000 (11:40 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 23 Jan 2012 08:53:59 +0000 (09:53 +0100)
* 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.

tests/Makefile.am
tests/defs
tests/defs-static.in

index d47be7830b36ada6dc697e3a263a01fccb2d5a7b..d42dd686380c26dd0d27ad715410fb343e76f62d 100644 (file)
@@ -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' \
index 1c5052336f33de9f53937933b44533f066647cfa..08ada588e6154916b7de254da85a9d11b7e7d04e 100644 (file)
@@ -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
index e58a1a1964d5ae6ff5aeda6613b8b2574081646c..b79e39948b9231c511625961271c1425371b6761 100644 (file)
@@ -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@'}}