-dnl -------------------------------------------------------------
-dnl Determine the C++ compiler in use. Return the name and possibly
-dnl version of this compiler in GXX_VERSION.
-dnl
-dnl Usage: DEAL_II_DETERMINE_CXX_BRAND
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_DETERMINE_CXX_BRAND, dnl
-[
- dnl It used to be the case that AC_PROG_CXX could properly detect
- dnl whether we are working with gcc or not, but then Intel came across
- dnl the brilliant idea to disguise it's compiler as gcc by setting
- dnl GCC preprocessor variables for versions etc. So we have to figure
- dnl out again whether this is really gcc
- if test "$GXX" = "yes" ; then
- GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "gcc version"`
- if test "x$GXX_VERSION_STRING" = "x" ; then
- GXX=no
- fi
- fi
-
- dnl And because it is so convenient, the PathScale compiler also identifies
- dnl itself as GCC...
- if test "$GXX" = "yes" ; then
- GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "PathScale"`
- if test "x$GXX_VERSION_STRING" != "x" ; then
- GXX=no
- fi
- fi
-
- dnl Then icc came along and started to identify itself as
- dnl icpc version 12.1.0 (gcc version 4.2.1 compatibility)
- dnl which also doesn't help...
- if test "$GXX" = "yes" ; then
- GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "icpc"`
- if test "x$GXX_VERSION_STRING" != "x" ; then
- GXX=no
- fi
- fi
-
- if test "$GXX" = yes ; then
- dnl find out the right version
- GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "gcc version"`
-
- full_version=`echo "$GXX_VERSION_STRING" | perl -pi -e 's/.*version (\d\.\d\.\d).*/\1/g;'`
- GXX_BRAND=GNU
- GXX_VERSION=gcc`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'`
- GXX_VERSION_DETAILED=gcc$full_version
-
- AC_MSG_RESULT([C++ compiler is $GXX_VERSION (subversion $GXX_VERSION_DETAILED)])
-
-
- else
- dnl Check other (non-gcc) compilers
-
- dnl Check for IBM xlC. For some reasons, depending on some environment
- dnl variables, moon position, and other reasons unknown to me, the
- dnl compiler displays different names in the first line of output, so
- dnl check various possibilities
- is_ibm_xlc="`($CXX -qversion 2>&1) | grep IBM`"
- if test "x$is_ibm_xlc" != "x" ; then
- dnl Ah, this is IBM's C++ compiler. Unfortunately, we don't presently
- dnl know how to check the version number, so assume that is sufficiently
- dnl high...
- AC_MSG_RESULT(C++ compiler is IBM xlC)
- GXX_BRAND=IBM
- GXX_VERSION=ibm_xlc
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Check whether we are dealing with the MIPSpro C++ compiler
- mips_pro="`($CXX -version 2>&1) | grep MIPSpro`"
- if test "x$mips_pro" != "x" ; then
- GXX_BRAND=MIPSpro
- case "$mips_pro" in
- *7.0* | *7.1* | *7.2* | *7.3*)
- dnl MIPSpro 7.3 does not support standard C++, therefore it is not
- dnl able to compile deal.II. Previous compiler versions neither.
- AC_MSG_RESULT(C++ compiler is $mips_pro)
- AC_MSG_ERROR(This compiler is not supported)
- GXX_VERSION=MIPSpro7.3
- GXX_VERSION_DETAILED="$GXX_VERSION"
- ;;
- *7.4)
- AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.4)
- AC_MSG_ERROR(This compiler is not supported. Use MIPSPro compiler 7.4x)
- GXX_VERSION=MIPSpro7.4
- GXX_VERSION_DETAILED="$GXX_VERSION"
- ;;
- *7.41* | *7.42* | *7.43* | *7.44*)
- AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.4x)
- GXX_VERSION=MIPSpro7.4x
- GXX_VERSION_DETAILED="$GXX_VERSION"
- ;;
- *"7.5"*)
- AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.5)
- GXX_VERSION=MIPSpro7.5
- GXX_VERSION_DETAILED="$GXX_VERSION"
- ;;
- *)
- AC_MSG_RESULT(C++ compiler is unknown version but accepted MIPSpro compiler version)
- GXX_VERSION=MIPSpro-other
- GXX_VERSION_DETAILED="$GXX_VERSION"
- ;;
- esac
- else
-
- dnl Intel's ICC C++ compiler? On Linux, it uses -V, on Windows
- dnl it is -help
- is_intel_icc1="`($CXX -V 2>&1) | grep 'Intel'`"
- is_intel_icc2="`($CXX -help 2>&1) | grep 'Intel'`"
- is_intel_icc="$is_intel_icc1$is_intel_icc2"
-
- dnl When calling the Portland Group compiler, it also
- dnl outputs the string 'Intel' in its help text, so make
- dnl sure we're not confused
- is_pgi="`($CXX -V 2>&1) | grep 'Portland'`"
-
- if test "x$is_intel_icc" != "x" -a "x$is_pgi" = "x" ; then
- GXX_BRAND=Intel
- version_string="`($CXX -V 2>&1) | grep 'Version'` `($CXX -help 2>&1) | grep 'Version'`"
- version5="`echo $version_string | grep 'Version 5'`"
- version6="`echo $version_string | grep 'Version 6'`"
- version7="`echo $version_string | grep 'Version 7'`"
- version8="`echo $version_string | grep 'Version 8'`"
- version9="`echo $version_string | grep 'Version 9'`"
- version10="`echo $version_string | grep 'Version 10'`"
- version11="`echo $version_string | grep 'Version 11'`"
- if test "x$version5" != "x" ; then
- AC_MSG_RESULT(C++ compiler is icc-5)
- GXX_VERSION=intel_icc5
- else if test "x$version6" != "x" ; then
- AC_MSG_RESULT(C++ compiler is icc-6)
- GXX_VERSION=intel_icc6
- else if test "x$version7" != "x" ; then
- AC_MSG_RESULT(C++ compiler is icc-7)
- GXX_VERSION=intel_icc7
- else if test "x$version8" != "x" ; then
- AC_MSG_RESULT(C++ compiler is icc-8)
- GXX_VERSION=intel_icc8
- else if test "x$version9" != "x" ; then
- AC_MSG_RESULT(C++ compiler is icc-9)
- GXX_VERSION=intel_icc9
- else if test "x$version10" != "x" ; then
- AC_MSG_RESULT(C++ compiler is icc-10)
- GXX_VERSION=intel_icc10
- else if test "x$version11" != "x" ; then
- AC_MSG_RESULT(C++ compiler is icc-11)
- GXX_VERSION=intel_icc11
- else if test "x$version12" != "x" ; then
- AC_MSG_RESULT(C++ compiler is icc-12)
- GXX_VERSION=intel_icc12
- else
- AC_MSG_RESULT(C++ compiler is icc)
- GXX_VERSION=intel_icc
- fi fi fi fi fi fi fi fi
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Or DEC's cxx compiler?
- is_dec_cxx="`($CXX -V 2>&1) | grep 'Compaq C++'`"
- if test "x$is_dec_cxx" != "x" ; then
- AC_MSG_RESULT(C++ compiler is Compaq-cxx)
- GXX_BRAND=Compaq
- GXX_VERSION=compaq_cxx
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Sun Workshop/Studio?
- is_sun_cc_1="`($CXX -V 2>&1) | grep 'Sun WorkShop'`"
- is_sun_cc_2="`($CXX -V 2>&1) | grep 'Sun C++'`"
- if test "x$is_sun_cc_1$is_sun_cc_2" != "x" ; then
- AC_MSG_RESULT(C++ compiler is Sun Workshop compiler)
- GXX_BRAND=SunWorkshop
- GXX_VERSION=sun_workshop
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Sun Forte?
- is_sun_forte_cc="`($CXX -V 2>&1) | grep 'Forte'`"
- if test "x$is_sun_forte_cc" != "x" ; then
- AC_MSG_RESULT(C++ compiler is Sun Forte compiler)
- GXX_BRAND=SunForte
- GXX_VERSION=sun_forte
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Portland Group C++?
- is_pgcc="`($CXX -V 2>&1) | grep 'Portland Group'`"
- if test "x$is_pgcc" != "x" ; then
- GXX_VERSION_STRING=`($CXX -V 2>&1) | grep "^pgCC"`
- full_version=`echo "$GXX_VERSION_STRING" | perl -pi -e 's/.*pgCC\s+(\S+).*/\1/g;'`
- GXX_BRAND=PortlandGroup
- GXX_VERSION=pgCC`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'`
- GXX_VERSION_DETAILED=pgCC"$full_version"
- AC_MSG_RESULT(C++ compiler is Portland Group C++ $full_version)
- else
-
- dnl HP aCC?
- is_aCC="`($CXX -V 2>&1) | grep 'aCC'`"
- if test "x$is_aCC" != "x" ; then
- AC_MSG_RESULT(C++ compiler is HP aCC)
- GXX_BRAND=HP
- GXX_VERSION=hp_aCC
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Borland C++
- is_bcc="`($CXX -h 2>&1) | grep 'Borland'`"
- if test "x$is_bcc" != "x" ; then
- AC_MSG_RESULT(C++ compiler is Borland C++)
- GXX_BRAND=Borland
- GXX_VERSION=borland_bcc
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl KAI C++? It seems as if the documented options
- dnl -V and --version are not always supported, so give
- dnl the whole thing a second try by looking for /KCC/
- dnl somewhere in the paths that are output by -v. This
- dnl is risky business, since this combination of
- dnl characters might appear on other installations
- dnl of other compilers as well, so put this test to
- dnl the very end of the detection chain for the
- dnl various compilers
- is_kai_cc="`($CXX --version 2>&1) | grep 'KAI C++'`"
- is_kai_cc="$is_kai_cc`($CXX -v 2>&1) | grep /KCC/`"
- if test "x$is_kai_cc" != "x" ; then
- AC_MSG_RESULT(C++ compiler is KAI C++)
- GXX_BRAND=KAI
- GXX_VERSION=kai_cc
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Maybe PathScale's compiler?
- is_pathscale="`($CXX -v 2>&1) | grep PathScale`"
- if test "x$is_pathscale" != "x" ; then
- AC_MSG_RESULT(C++ compiler is PathScale C++)
- GXX_BRAND=PathScale
- GXX_VERSION=pathscale_cc
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Maybe CLang?
- is_clang="`($CXX --version 2>&1) | grep clang`"
- if test "x$is_clang" != x ; then
- AC_MSG_RESULT(C++ compiler is clang)
- GXX_BRAND=clang
- GXX_VERSION=clang
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Maybe Cray C++?
- is_cray="`($CXX -V 2>&1) | grep Cray`"
- if test "x$is_cray" != x ; then
- AC_MSG_RESULT(C++ compiler is Cray C++)
- GXX_BRAND=cray
- GXX_VERSION=cray
- GXX_VERSION_DETAILED="$GXX_VERSION"
- else
-
- dnl Aw, nothing suitable found...
- AC_MSG_RESULT(Unrecognized C++ compiler -- Try to go ahead and get help from dealii@dealii.org)
- GXX_BRAND=Unknown
- GXX_VERSION=unknown_cc
- GXX_VERSION_DETAILED="$GXX_VERSION"
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- fi
-])
-
-
-
-dnl -------------------------------------------------------------
-dnl Set C++ compiler flags to their default values. They will be
-dnl modified according to other options in later steps of
-dnl configuration
-dnl
-dnl CXXFLAGSO : flags for optimized mode
-dnl CXXFLAGSG : flags for debug mode
-dnl CXXFLAGSPIC: flags for generation of object files that are suitable
-dnl for shared libs
-dnl LDFLAGSPIC : flags needed for linking of object files to shared
-dnl libraries
-dnl
-dnl Usage: DEAL_II_SET_CXX_FLAGS
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl
-[
- dnl If CXXFLAGSG or CXXFLAGSO are not set, then initialize them with
- dnl CXXFLAGS
- if test "x$CXXFLAGSG" = "x" ; then
- CXXFLAGSG="$CXXFLAGS" ;
- fi
-
- if test "x$CXXFLAGSO" = "x" ; then
- CXXFLAGSO="$CXXFLAGS" ;
- fi
-
- dnl In no case do we want to induce BOOST to use deprecated header files
- CXXFLAGSG="$CXXFLAGSG -DBOOST_NO_HASH -DBOOST_NO_SLIST"
- CXXFLAGSO="$CXXFLAGSO -DBOOST_NO_HASH -DBOOST_NO_SLIST"
-
- dnl First the flags for gcc compilers
- if test "$GXX" = yes ; then
- CXXFLAGSO="$CXXFLAGSO -O2 -funroll-loops -funroll-all-loops -fstrict-aliasing -Wuninitialized -felide-constructors"
- CXXFLAGSG="$CXXFLAGSG -DDEBUG -Wall -W -Wpointer-arith -Wwrite-strings -Wsynth -Wsign-compare -Wswitch"
-
- dnl gcc 4.4 has an interesting problem in that it doesn't
- dnl care for one of BOOST signals2's header files and produces
- dnl dozens of pages of error messages of the form
- dnl warning: invoking macro BOOST_PP_CAT argument 1: empty macro arguments are undefined in ISO C90 and ISO C++98
- dnl This can be avoided by not using -pedantic for this compiler.
- dnl For all other versions, we use this flag, however.
- if test $GXX_VERSION != gcc4.4 ; then
- CXXFLAGS="$CXXFLAGS -pedantic"
- fi
-
- dnl BOOST uses long long, so don't warn about this
- CXXFLAGSG="$CXXFLAGSG -Wno-long-long"
-
- dnl Newer versions have a flag -Wunused-local-typedefs that, though in principle
- dnl a good idea, triggers a lot in BOOST in various places. Unfortunately,
- dnl this warning is included in -W/-Wall, so disable it if the compiler
- dnl supports it.
- CXXFLAGS="-Wunused-local-typedefs"
- AC_MSG_CHECKING(whether the compiler supports the -Wunused-local-typedefs flag)
- AC_TRY_COMPILE(
- [
- ],
- [;],
- [
- AC_MSG_RESULT(yes)
- CXXFLAGSG="$CXXFLAGSG -Wno-unused-local-typedefs"
- ],
- [
- AC_MSG_RESULT(no)
- dnl Nothing to do here then. We can't disable it if the
- dnl flag doesn't exist
- ])
-
-
- dnl See whether the gcc we use already has a flag for C++2011 features
- dnl and whether we can mark functions as deprecated with an attributed
- DEAL_II_CHECK_CXX1X
- DEAL_II_CHECK_DEPRECATED
-
-
dnl On some gcc 4.3 snapshots, a 'const' qualifier on a return type triggers a
dnl warning. This is unfortunate, since we happen to stumble on this
dnl in some of our template trickery with iterator classes. If necessary,
CXXFLAGSG="$CXXFLAGSG -Wno-return-type"
])
- dnl Newer versions of gcc can pass a flag to the assembler to
- dnl compress debug sections. At the time of writing this test,
- dnl this can save around 230 MB of disk space on the object
- dnl files we produce (810MB down to 570MB for the debug versions
- dnl of object files). Unfortunately, the sections have to be
- dnl unpacked again when they are put into the shared libs, so
- dnl no savings there.
- dnl
- dnl The flag also doesn't appear to be working on Cygwin, as
- dnl per email by John Fowkes on the mailing list in Feb 2012,
- dnl so don't run the test on cygwin.
- case "$target" in
- *cygwin* )
- ;;
- * )
- CXXFLAGS="-Wa,--compress-debug-sections"
- AC_MSG_CHECKING([whether the assembler understands -Wa,--compress-debug-sections])
- AC_TRY_LINK(
- [
- ],
- [;],
- [
- AC_MSG_RESULT(yes)
- CXXFLAGSG="$CXXFLAGSG -Wa,--compress-debug-sections"
- ],
- [
- AC_MSG_RESULT(no)
- ])
- ;;
- esac
-
- dnl Set PIC flags. On some systems, -fpic/PIC is implied, so don't set
- dnl anything to avoid a warning. on AIX make sure we always pass -lpthread
- dnl because this seems to be somehow required to make things work. Likewise
- dnl DEC OSF and linux on x86_64.
- case "$target" in
- *aix* )
- CXXFLAGSPIC=
- LDFLAGSPIC=
- LDFLAGS="$LDFLAGS -lpthread"
- ;;
-
- *dec-osf* )
- CXXFLAGSPIC="-fPIC"
- LDFLAGSPIC="-fPIC"
- LDFLAGS="$LDFLAGS -lpthread"
- ;;
-
- *x86_64*)
- CXXFLAGSPIC="-fPIC"
- LDFLAGSPIC="-fPIC"
- LDFLAGS="$LDFLAGS -lpthread"
- ;;
*cygwin* )
dnl On Cygwin, when using shared libraries, there might occur