From: maier Date: Fri, 14 Sep 2012 09:29:53 +0000 (+0000) Subject: "TODO-Liste" aktualisiert X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=006fc5d7886dc0f24f8258b6d02f890aab300eca;p=dealii-svn.git "TODO-Liste" aktualisiert git-svn-id: https://svn.dealii.org/branches/branch_cmake@26373 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 2acb1aab4b..7ce0f60b28 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -69,7 +69,7 @@ SET(VERSION "8.0.pre") OPTION(DEAL_II_WITH_FUNCTIONPARSER "Build deal.II with support for functionparser." - OFF) + ON) OPTION(DEAL_II_WITH_METIS "Build deal.II with support for Metis." @@ -109,11 +109,11 @@ OPTION(DEAL_II_ALLOW_CONTRIB OPTION(DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER "Always use the bundled functionparser library instead of an external one." - OFF) + ON) OPTION(DEAL_II_FORCE_CONTRIB_BOOST "Always use the bundled boost library instead of an external one." - OFF) + ON) OPTION(DEAL_II_FORCE_CONTRIB_TBB "Always use the bundled tbb library instead of an external one." diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 deleted file mode 100644 index 9f3a1d3bb1..0000000000 --- a/deal.II/aclocal.m4 +++ /dev/null @@ -1,5587 +0,0 @@ -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, - dnl do not use the relevant warning flag - CXXFLAGS="-Wreturn-type -Werror" - AC_MSG_CHECKING(whether qualifiers in return types lead to a warning) - AC_TRY_COMPILE( - [ - const double foo() { return 1.; } - ], - [;], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes) - 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 - dnl difficulties when linking libraries for several dimensions, - dnl as some symbols are defined in all of them. This leads to a - dnl linker error. We force the linker to ignore multiple symbols, - dnl but of course this might lead to strange program behaviour if - dnl you accidentally defined one symbol multiple times... - dnl (added 2005/07/13, Ralf B. Schulz) - dnl (modified 2005/12/20, Ralf B. Schulz) - CXXFLAGSPIC= - LDFLAGS="$LDFLAGS -Xlinker --allow-multiple-definition" - SHLIBFLAGS="$SHLIBFLAGS -Xlinker --allow-multiple-definition" - ;; - - *) - CXXFLAGSPIC="-fPIC" - LDFLAGSPIC="-fPIC" - ;; - esac - - dnl Some gcc compiler versions have a problem when using an unsigned count - dnl in the std::advance function. Unfortunately, this also happens - dnl occasionally from within the standard library, so we can't prevent the - dnl warning messages. Since this is annoying, switch of the flag -W which - dnl causes this. - DEAL_II_CHECK_ADVANCE_WARNING - if test "x$DEAL_II_ADVANCE_WARNING" = "xyes" ; then - CXXFLAGSG="`echo $CXXFLAGSG | perl -pi -e 's/-W //g;'`" - fi - - if test "x$DEAL_II_USE_MPI" = "xyes" ; then - AC_MSG_CHECKING(whether MPI headers have unused parameters) - CXXFLAGS="-Wunused-parameter -Werror" - AC_TRY_COMPILE( - [ - #include - ], - [;], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -Wno-unused-parameter" - CXXFLAGSO="$CXXFLAGSO -Wno-unused-parameter" - ]) - fi - - dnl Some system specific things - case "$target" in - dnl Use -Wno-long-long on Apple Darwin to avoid some unnecessary - dnl warnings. However, newer gccs on that platform do not have - dnl this flag any more, so check whether we can indeed do this - dnl - dnl Also, the TBB tries to determine whether the system is - dnl 64-bit enabled and if so, it builds the object files in 64bit. - dnl In order to be able to link with these files, we then have to - dnl link with -m64 as well - *apple-darwin*) - OLD_CXXFLAGS="$CXXFLAGS" - CXXFLAGS=-Wno-long-double - - AC_MSG_CHECKING(whether we can use -Wno-long-double) - AC_TRY_COMPILE([], [;], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -Wno-long-double" - CXXFLAGSO="$CXXFLAGSO -Wno-long-double" - ], - [ - AC_MSG_RESULT(no) - ]) - - if test "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ; then - CXXFLAGS="$CXXFLAGS -m64" - CXXFLAGSG="$CXXFLAGSG -m64" - CXXFLAGSO="$CXXFLAGSO -m64" - - CFLAGS="$CFLAGS -m64" - CFLAGSG="$CFLAGSG -m64" - CFLAGSO="$CFLAGSO -m64" - - LDFLAGS="$LDFLAGS -m64" - fi - - CXXFLAGS="${OLD_CXXFLAGS}" - ;; - - dnl On DEC OSF, including both stdio.h and unistd.h causes a warning - dnl from the preprocessor that cuserid is redefined as a preprocessor - dnl variable. Suppress this if necessary by switching off warnings - dnl from the preprocessor - *dec-osf*) - AC_MSG_CHECKING(for preprocessor warning with cuserid) - CXXFLAGS="$CXXFLAGSG -Werror" - AC_TRY_COMPILE( - [ -# include -# include - ], - [;], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -Wp,-w" - CXXFLAGSO="$CXXFLAGSO -Wp,-w" - ]) - ;; - esac - - SHLIBLD="$CXX" - - else - dnl Non-gcc compilers. By default, use the C++ compiler also for linking - dnl shared libraries. If some compiler cannot do that and needs something - dnl different, then this must be specified in the respective section - dnl below, overriding this define: - SHLIBLD="$CXX" - - case "$GXX_VERSION" in - ibm_xlc) - dnl Set flags for IBM's xlC compiler. As of version 11.1, it still - dnl doesn't grok all of deal.II, but it's getting closer. The - dnl -qxflag=EnableIssue214PartialOrdering flag is necessary to - dnl resolve code like this that we have in the MemoryConsumption - dnl namespace: - dnl ---------------------------------------------- - dnl template void f (T* const); - dnl template void f (const T &); - dnl - dnl void g() { - dnl int *p; - dnl f(p); - dnl } - dnl ---------------------------------------------- - dnl - dnl Similarly, -qxflag=IgnoreCVOnTopOfFunctionTypes is necessary for - dnl ---------------------------------------------- - dnl struct S {}; - dnl S & foo (const S&); - dnl - dnl struct X { - dnl template - dnl void f (const T &t) const; - dnl }; - dnl - dnl void - dnl print_summary () - dnl { - dnl X x; - dnl x.f (foo); - dnl } - dnl ---------------------------------------------- - dnl We have this kind of code with S=std::ostream, foo=std::endl - dnl and X=LogStream when we do things like - dnl deallog << std::endl; - CXXFLAGSG="$CXXFLAGSG -DDEBUG -check=bounds -info=all -qrtti=all -qsuppress=1540-2907 -qsuppress=1540-2909 -qxflag=EnableIssue214PartialOrdering -qxflag=IgnoreCVOnTopOfFunctionTypes" - CXXFLAGSO="$CXXFLAGSO -O2 -w -qansialias -qrtti=all -qsuppress=1540-2907 -qsuppress=1540-2909 -qxflag=EnableIssue214PartialOrdering -qxflag=IgnoreCVOnTopOfFunctionTypes" - CXXFLAGSPIC="-qpic" - LDFLAGSPIC="-qpic" - ;; - - MIPSpro*) - dnl Disable some compiler warnings, as they trigger some warnings in - dnl system and compiler include files - dnl cc-1429 CC: WARNING File = /usr/include/internal/stdlib_core.h, Line = 128 - dnl The type "long long" is nonstandard. - dnl cc-1066 CC: WARNING File = /usr/include/CC/stl_ctype.h, Line = 28 - dnl The indicated enumeration value is out of "int" range. - dnl cc-1485 CC: WARNING File = /usr/include/CC/iomanip, Line = 122 - dnl This form for taking the address of a member function is nonstandard. - CXXFLAGSG="$CXXFLAGSG -DDEBUG -D__sgi__ -no_auto_include -ansiW -woff 1429,1066,1485" - dnl Disable some compiler warnings, that warn about variables - dnl which are used in Assert templates but not in optimized mode - dnl cc-1174 CC: full_matrix.templates.h, Line = 1461 - dnl The variable "typical_diagonal_element" was declared but never referenced. - dnl cc-1552 CC: WARNING File = source/data_out_base.cc, Line = 3493 - dnl The variable "ierr" is set but never used. - CXXFLAGSO="$CXXFLAGSO -D__sgi__ -O2 -no_auto_include -woff 1174,1552" - CXXFLAGSPIC="-KPIC" - LDFLAGSPIC="-KPIC" - dnl Avoid output of prelinker (-quiet_prelink) - dnl Disable compiler warning: - dnl ld32: WARNING 131: Multiply defined weak symbol: - dnl (_M_acquire_lock__Q2_3std15_STL_mutex_lockGv) in auto_derivative_function.g.o - dnl and convergence_table.g.o (2nd definition ignored) - LDFLAGS="$LDFLAGS -quiet_prelink -woff 131" - dnl - dnl Always link with math library: The -lm option must be at the end of the - dnl linker command, therefore it cannot be included into LDFLAGS - DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lm) - ;; - - clang*) - dnl Like many other compilers, clang produces warnings for array - dnl accesses out of bounds, even if they are in code that's dead - dnl for this dimension. Suppress this. - dnl - dnl There are a number of other warnings we get that can't easily - dnl be worked around and that are definitely not useful. Suppress - dnl those too. - CXXFLAGSG="$CXXFLAGS -DDEBUG -g -Wall -Wno-array-bounds -Wno-parentheses -Wno-delete-non-virtual-dtor -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-variable" - CXXFLAGSO="$CXXFLAGS -O2 -Wno-array-bounds -Wno-parentheses -Wno-delete-non-virtual-dtor -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-variable" - CXXFLAGSPIC="-fPIC" - LDFLAGSPIC="-fPIC" - ;; - - intel_icc*) - dnl Earlier icc versions used -Kxxx for flags. Later versions use - dnl the gcc convention -fxxx. Also, at least since icc11, the - dnl flag -inline_debug_info has been deprecated, so don't use - dnl it any more - dnl - dnl Exception handling is also standard in later versions, as is rtti - case "$GXX_VERSION" in - intel_icc5 | intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CXXFLAGSG="$CXXFLAGSG -Kc++eh -Krtti -DDEBUG -inline_debug_info" - CXXFLAGSO="$CXXFLAGSO -Kc++eh -Krtti -O2 -unroll" - CXXFLAGSPIC="-KPIC" - LDFLAGSPIC="-KPIC" - ;; - - intel_icc*) - CXXFLAGSG="$CXXFLAGSG -DDEBUG" - CXXFLAGSO="$CXXFLAGSO -O2 -unroll" - CXXFLAGSPIC="-fPIC" - LDFLAGS="$LDFLAGS -lstdc++ -lpthread" - LDFLAGSPIC="-fPIC" - ;; - esac - - dnl Disable some compiler warnings, as they often are wrong on - dnl our code: - dnl #11: ` unrecognized preprocessing directive" (we use - dnl #warning at one place) - dnl #175: `subscript out of range' (doesn't take into account that - dnl some code is only reachable for some dimensions) - dnl #327: `NULL reference is not allowed' (this happens when we - dnl write "*static_cast(0)" or some such thing, - dnl which we do to create invalid references) - dnl #424: `extra ";" ignored' - dnl #525: `type "DataOutBase::DataOutBase" is an inaccessible type - dnl (allowed for compatibility)' (I don't understand what the - dnl compiler means) - dnl #734: `X::X(const X&), required for copy that was eliminated, is - dnl inaccessible' - dnl (valid, but annoying and sometimes hard to work around) - dnl #858: `type qualifier on return type is meaningless' - dnl (on conversion operators to types that are already const) - dnl #1565: attributes are ignored on a class declaration that is not - dnl also a definition (this happens in BOOST in a number of - dnl places) - CXXFLAGSG="$CXXFLAGSG -w1 -wd175 -wd525 -wd327 -wd424 -wd11 -wd734 -wd858 -wd1565" - CXXFLAGSO="$CXXFLAGSO -w0 -wd424 -wd11" - - dnl To reduce output, use -opt_report_levelmin where possible, - dnl i.e. post icc5. from icc10 onwards, this flag is called - dnl -opt-report, and -vec-report controls output of the - dnl autovectorizer (to make things simpler, one of the two options - dnl wants a space between option and level, whereas the other does - dnl not) - dnl - dnl Since only the x86 and x86_64 compilers can vectorize, this - dnl flag needs to be suppressed on ia64 (itanium) - case "$GXX_VERSION" in - intel_icc5) - ;; - intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CXXFLAGSO="$CXXFLAGSO -opt_report_levelmin" - ;; - *) - case "$target" in - *ia64*) - CXXFLAGSO="$CXXFLAGSO -opt-report 0" - ;; - *) - CXXFLAGSO="$CXXFLAGSO -opt-report 0 -vec-report0" - ;; - esac - ;; - esac - - dnl Some versions of icc on some platforms issue a lot of warnings - dnl about the unreliability of floating point comparisons. Check - dnl whether we can switch that off - DEAL_II_ICC_WD_1572 - - dnl We would really like to use -ansi -Xc, since that - dnl is _very_ picky about standard C++, and is thus very efficient - dnl in detecting slight standard violations, but these flags are - dnl also very efficient in crashing the compiler (it generates a - dnl segfault), at least with versions prior to 7.0. So only - dnl use these flags with versions we know are safe - dnl - dnl Second thing: icc7 allows using alias information for - dnl optimization. Use this. - if test "x$GXX_VERSION" = "xintel_icc7"; then - CXXFLAGSG="$CXXFLAGSG -Xc -ansi" - CXXFLAGSO="$CXXFLAGSO -ansi_alias" - dnl For icc8: - dnl avoid the annoying `LOOP WAS VECTORIZED' remarks - dnl use -vec_report0 for reducing output - else if test "x$GXX_VERSION" = "xintel_icc8" ; then - CXXFLAGSO="$CXXFLAGSO -ansi_alias -vec_report0" - fi fi - - dnl If we are on an x86 platform, add -tpp6 to optimization - dnl flags (for version <10), or the equivalent for later - dnl processors - case "$target" in - *x86_64*) - LDFLAGS="$LDFLAGS -lpthread" - ;; - - *86*) - case "$GXX_VERSION" in - intel_icc5) - ;; - intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CXXFLAGSO="$CXXFLAGSO -tpp6" - ;; - *) - CXXFLAGSO="$CXXFLAGSO -mcpu=pentium4" - ;; - esac - ;; - esac - - dnl Intel's MPI implementation based on ICC requires that - dnl mpi.h be included *before* things like or - dnl . How they envision this to work is beyond - dnl me because they may be indirectly included from other - dnl header files. Besides this, autoconf generates tests - dnl that don't follow this rule and so fail at ./configure - dnl time. There is nothing we can do about it. However, - dnl there is a workaround described here: - dnl http://software.intel.com/en-us/articles/intel-mpi-library-for-linux-running-list-of-known-issues/#A3 - dnl We switch this on if we use Intel's ICC + MPI - if test "x$DEAL_II_USE_MPI" = "xyes" ; then - CXXFLAGSG="$CXXFLAGSG -DMPICH_IGNORE_CXX_SEEK" - CXXFLAGSO="$CXXFLAGSO -DMPICH_IGNORE_CXX_SEEK" - fi - - dnl Finally, see if the compiler supports C++0x - DEAL_II_CHECK_CXX1X - ;; - - compaq_cxx) - dnl Disable some warning messages: - dnl #11: ` unrecognized preprocessing directive" (we use - dnl #warning at one place) - dnl #175: `subscript out of range' (detected when instantiating a - dnl template and looking at the indices of an array of - dnl template dependent size, this error is triggered in a - dnl branch that is not taken for the present space dimension) - dnl #236 and - dnl #237: `controlling expression is constant' (in while(true), or - dnl switch(dim)) - dnl #381: `extra ";" ignored' (at function or namespace closing - dnl brace) - dnl #487: `Inline function ... cannot be explicitly instantiated' - dnl (also reported when we instantiate the entire class) - dnl #1136:`conversion to integral type of smaller size could lose data' - dnl (occurs rather often in addition of int and x.size(), - dnl because the latter is size_t=long unsigned int on Alpha) - dnl #1156:`meaningless qualifiers not compatible with "..." and "..."' - dnl (cause unknown, happens when taking the address of a - dnl template member function) - dnl #111 and - dnl #1182:`statement either is unreachable or causes unreachable code' - dnl (happens in switch(dim) clauses for other dimensions than - dnl the present one) - dnl #450:`the type "long long" is nonstandard' - dnl BOOST uses long long, unfortunately - dnl - dnl Also disable the following error: - dnl #265: `class "..." is inaccessible' (happens when we try to - dnl initialize a static member variable in terms of another - dnl static member variable of the same class if the latter is - dnl not public and therefore not accessible at global scope in - dnl general. I nevertheless think that this is valid.) - dnl - dnl Besides this, choose the most standard conforming mode of the - dnl compiler, i.e. -model ansi and -std strict_ansi. Unfortunately, - dnl we have to also add the flag -implicit_local (generating implicit - dnl instantiations of template with the `weak' link flag) since - dnl otherwise not all templates are instantiated (also some from the - dnl standards library are missing). - - CXXFLAGSG="$CXXFLAGSG -model ansi -std strict_ansi -w1 -msg_display_number -timplicit_local -DDEBUG" - CXXFLAGSO="$CXXFLAGSO -model ansi -std strict_ansi -w2 -msg_display_number -timplicit_local -fast" - - for i in 11 175 236 237 381 487 1136 1156 111 1182 265 450 ; do - CXXFLAGSG="$CXXFLAGSG -msg_disable $i" - CXXFLAGSO="$CXXFLAGSO -msg_disable $i" - done - - - dnl If we use -model ansi to compile the files, we also have to - dnl specify it for linking - LDFLAGS="$LDFLAGS -model ansi" - - dnl For some reason, cxx also forgets to add the math lib to the - dnl linker line, so we do that ourselves - LDFLAGS="$LDFLAGS -lm" - - CXXFLAGSPIC="-shared" - LDFLAGSPIC="" - ;; - - sun_workshop | sun_forte) - - CXXFLAGSG="$CXXFLAGSG -DDEBUG -w" - CXXFLAGSO="$CXXFLAGSO -w" - CXXFLAGSPIC="-KPIC" - LDFLAGSPIC="-G" - - dnl See if the flag -library=stlport4 is available, and if so use it - CXXFLAGS="$CXXFLAGSG -library=stlport4" - AC_MSG_CHECKING(whether -library=stlport4 works) - AC_TRY_COMPILE( - [ - ], - [ - ; - ], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -library=stlport4" - CXXFLAGSO="$CXXFLAGSO -library=stlport4" - ], - [ - AC_MSG_RESULT(no) - ]) - ;; - - pgCC*) - dnl Suppress warnings: - dnl #68: "integer conversion resulted in a change of sign". This - dnl is what we get every time we use - dnl numbers::invalid_unsigned_int - dnl #111: "Statement unreachable": we use return statements - dnl occasionally after case-switches where you cannot - dnl fall though, but other compilers sometimes complain - dnl that the function might not return with a value, if - dnl it can't figure out that the function always uses - dnl one case. Also: a return statement after a failing - dnl assertion - dnl #128: a similar case -- code not reachable because there's - dnl a return that's active for a particular space dimension - dnl #155: no va_start() seen -- happens alwas in lines 138 and 891 - dnl and seems to be spurious - dnl #177: "function declared but not used": might happen with - dnl templates and conditional compilation - dnl #175: "out-of-bounds array indices": the same reason as - dnl for Compaq cxx - dnl #185: "dynamic initialization in unreachable code". similar to - dnl the case #128 above - dnl #236: "controlling expression is constant". this triggers - dnl somewhere in BOOST with BOOST_ASSERT. I have no idea - dnl what happens here - dnl #284: "NULL references not allowed" - dnl #497: "declaration of "dim" hides template parameter" (while - dnl theoretically useful, pgCC unfortunately gets this one - dnl wrong on legitimate code where no such parameter is - dnl hidden, see the email by ayaydemir on 9/3/2012) - CXXFLAGSG="$CXXFLAGSG -DDEBUG -g --display_error_number --diag_suppress 68 --diag_suppress 111 --diag_suppress 128 --diag_suppress 155 --diag_suppress 177 --diag_suppress 175 --diag_suppress 185 --diag_suppress 236 --diag_suppress 284 --diag_suppress 497" - CXXFLAGSO="$CXXFLAGSO -fast -O2 --display_error_number --diag_suppress 68 --diag_suppress 111 --diag_suppress 128 --diag_suppress 155 --diag_suppress 177 --diag_suppress 175 --diag_suppress 185 --diag_suppress 236 --diag_suppress 284 --diag_suppress 497" - CXXFLAGSPIC="-Kpic" - - dnl pgCC can't (as of writing this, with version 12.5 in mid-2012) compile a part of BOOST. - dnl Fortunately, BOOST provides a workaround by setting a specific preprocessor - dnl symbol that can be set. Do so. - CXXFLAGSG="$CXXFLAGSG -DBOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE" - CXXFLAGSO="$CXXFLAGSO -DBOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE" - ;; - - kai_cc) - CXXFLAGSG="$CXXFLAGSG --strict -D__KAI_STRICT --max_pending_instantiations 32 --display_error_number -g +K0 --no_implicit_typename" - CXXFLAGSO="$CXXFLAGSO +K3 -O2 --abstract_float --abstract_pointer -w --display_error_number --max_pending_instantiations 32 --display_error_number" - CXXFLAGSPIC="-fPIC" - ;; - - hp_aCC) - dnl ??? disable warning 655 (about all-inlined functions) which - dnl triggers for each and every of our DeclExceptionX calls ??? - CXXFLAGSG="$CXXFLAGSG -g1 -AA +p" - CXXFLAGSO="$CXXFLAGSO -z +O2 -AA" - CXXFLAGSPIC="+Z" - # for linking shared libs, -b is also necessary... - ;; - - borland_bcc) - CXXFLAGSG="$CXXFLAGSG -q -DDEBUG -w -w-use -w-amp -w-prc" - CXXFLAGSO="$CXXFLAGSO -q -O2" - CXXFLAGSPIC="" - LDFLAGSPIC="" - AC_MSG_ERROR(Attention! deal.II is not known to work with Borland C++! - If you intend to port it to Borland C++, please remove this message from aclocal.m4 and call autoconf and configure. If you do not understand this, you will NOT want to do it!) - ;; - - pathscale_cc) - CXXFLAGSG="$CXXFLAGSG -DDEBUG -g" - CXXFLAGSO="$CXXFLAGSO -O3" - ;; - - *) - CXXFLAGSG="$CXXFLAGSG -DDEBUG" - CXXFLAGSO="$CXXFLAGSO -O2" - AC_MSG_RESULT(Unknown C++ compiler - using generic options) - ;; - esac - fi -]) - - - -dnl ------------------------------------------------------------- -dnl Depending on what compiler we use, set the flag necessary to -dnl obtain debug output. We will usually use -ggdb, but on DEC Alpha -dnl OSF1, this leads to stabs symbols that are too long for the system -dnl assembler. We will therefore check whether the assembler can handle -dnl these symbols by a rather perverse function with many templates, -dnl and if the assembler can't handle them, then use -gstabs -dnl instead. This reduces debugging possibilities, but no other -dnl way is known at present. -dnl -dnl For all compilers other than gcc, use -g instead and don't check. -dnl -dnl Usage: DEAL_II_SET_CXX_DEBUG_FLAG -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_SET_CXX_DEBUG_FLAG, dnl -[ - if test "$GXX" = yes ; then - case "$target" in - dnl On Alpha, use the special treatment - alpha*-osf*) - AC_MSG_CHECKING(whether -ggdb works for long symbols) - CXXFLAGS="-ggdb $CXXFLAGSG" - AC_TRY_COMPILE( - [ -# include -# include - using namespace std; - - typedef map > > T; - - bool f(T& t1, const T* t2) { - t1["s"] = map >(); - map > > - ::const_iterator i2=t1.begin(); - map > > - ::const_iterator i1=t2->begin(); - return (i1==i2); - } - ], - [ - ; - ], - [ - CXXFLAGSG="-ggdb $CXXFLAGSG" - AC_MSG_RESULT(yes) - ], - [ - CXXFLAGSG="-gstabs $CXXFLAGSG" - AC_MSG_RESULT(no -- using -gstabs instead) - ]) - ;; - - dnl For all other systems test whether -ggdb works at all, and if - dnl not fall back on -g instead. This test is mainly used to - dnl accomodate for a failure on Mac OS X, where -ggdb leads to - dnl information the assembler does not understand (see mailing - dnl list thread on this from mid-October 2002) - *) - AC_MSG_CHECKING(whether -ggdb works) - CXXFLAGS="-ggdb $CXXFLAGSG" - AC_TRY_COMPILE( - [], - [ ; ], - [ - CXXFLAGSG="-ggdb $CXXFLAGSG" - AC_MSG_RESULT(yes) - ], - [ - CXXFLAGSG="-g $CXXFLAGSG" - AC_MSG_RESULT(no -- using -g instead) - ]) - ;; - esac - - else - dnl Non-gcc compilers use -g instead of -ggdb, except for Borland C++ - dnl which wants something entirely different - case "$GXX_VERSION" in - borland_bcc) - CXXFLAGSG="-v -y $CXXFLAGSG" - ;; - - *) - CXXFLAGSG="-g $CXXFLAGSG" - ;; - esac - fi -]) - - - - - - -dnl ------------------------------------------------------------- -dnl Determine the C compiler in use. Return the name and possibly -dnl version of this compiler in CC_VERSION. This function is almost -dnl identifical to DEAL_II_DETERMINE_CXX_BRAND and therefore lacks -dnl a lot of the comments found there to keep it short -dnl -dnl Usage: DEAL_II_DETERMINE_CC_BRAND -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_DETERMINE_CC_BRAND, dnl -[ - if test "$GCC" = "yes" ; then - dnl Verify that we indeed have a compiler that identifies - dnl itself as GCC - CC_VERSION_STRING=`($CC -v 2>&1) | grep "gcc version"` - if test "x$CC_VERSION_STRING" = "x" ; then - GCC=no - fi - - dnl Then icc came along and started to identify itself as - dnl icc version 12.1.0 (gcc version 4.2.1 compatibility) - dnl which also doesn't help... - CC_VERSION_STRING=`($CC -v 2>&1) | grep "icc"` - if test "x$CC_VERSION_STRING" != "x" ; then - GCC=no - fi - fi - - if test "$GCC" = yes ; then - dnl find out the right version - CC_VERSION_STRING=`($CC -v 2>&1) | grep "gcc version"` - - full_version=`echo "$CC_VERSION_STRING" | perl -pi -e 's/.*version (\d\.\d\.\d).*/\1/g;'` - CC_VERSION=gcc`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'` - - AC_MSG_RESULT(C compiler is $CC_VERSION) - 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="`($CC 2>&1) | egrep 'VisualAge C|C Set ++|C for AIX Compiler'`" - 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) - CC_VERSION=ibm_xlc - else - - dnl Check whether we are dealing with the MIPSpro C compiler - mips_pro="`($CC -version 2>&1) | grep MIPSpro`" - if test "x$mips_pro" != "x" ; then - 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) - CC_VERSION=MIPSpro7.3 - ;; - *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) - CC_VERSION=MIPSpro7.4 - ;; - *7.41* | *7.42* | *7.43* | *7.44*) - AC_MSG_RESULT(C compiler is MIPSpro compiler 7.4x) - CC_VERSION=MIPSpro7.4x - ;; - *"7.5"*) - AC_MSG_RESULT(C compiler is MIPSpro compiler 7.5) - CC_VERSION=MIPSpro7.5 - ;; - *) - AC_MSG_RESULT(C compiler is unknown version but accepted MIPSpro compiler version) - CC_VERSION=MIPSpro-other - ;; - esac - else - - dnl Intel's ICC C compiler? On Linux, it uses -V, on Windows - dnl it is -help - dnl - dnl Annoyingly, ecc6.0 prints its version number on a separate - dnl line (the previous one ends with the string "applications"), - dnl so join this one to the previous one with a little bit of - dnl perl. - is_intel_icc1="`($CC -V 2>&1) | grep 'Intel'`" - is_intel_icc2="`($CC -help 2>&1) | grep 'Intel'`" - is_intel_ecc="`($CC -V 2>&1) | perl -pi -e 's/applications\n/\1/g;' | grep 'Intel(R) C++ Itanium(TM) Compiler'`" - is_intel_icc="$is_intel_icc1$is_intel_icc2$is_intel_ecc" - - 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 - version_string="`($CC -V 2>&1) | grep 'Version'` `($CC -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'`" - if test "x$version5" != "x" ; then - AC_MSG_RESULT(C compiler is icc-5) - CC_VERSION=intel_icc5 - else if test "x$version6" != "x" ; then - AC_MSG_RESULT(C compiler is icc-6) - CC_VERSION=intel_icc6 - else if test "x$version7" != "x" ; then - AC_MSG_RESULT(C compiler is icc-7) - CC_VERSION=intel_icc7 - else if test "x$version8" != "x" ; then - AC_MSG_RESULT(C compiler is icc-8) - CC_VERSION=intel_icc8 - else if test "x$version9" != "x" ; then - AC_MSG_RESULT(C compiler is icc-9) - CC_VERSION=intel_icc9 - else if test "x$version10" != "x" ; then - AC_MSG_RESULT(C compiler is icc-10) - CC_VERSION=intel_icc10 - else - AC_MSG_RESULT(C compiler is icc) - CC_VERSION=intel_icc - fi fi fi fi fi fi - else - - dnl Or DEC's cxx compiler? - is_dec_cxx="`($CC -V 2>&1) | grep 'Compaq C'`" - if test "x$is_dec_cxx" != "x" ; then - AC_MSG_RESULT(C compiler is Compaq cxx) - CC_VERSION=compaq_cxx - else - - dnl Sun Workshop? - is_sun_cc="`($CC -V 2>&1) | grep 'Sun WorkShop'`" - if test "x$is_sun_cc" != "x" ; then - AC_MSG_RESULT(C compiler is Sun Workshop compiler) - CC_VERSION=sun_workshop - else - - dnl Sun Forte? - is_sun_forte_cc="`($CC -V 2>&1) | grep 'Forte'`" - is_sun_cc="`($CC -V 2>&1) | grep 'Sun C'`" - if test "x$is_sun_forte_cc$is_sun_cc" != "x" ; then - AC_MSG_RESULT(C compiler is Sun C compiler) - CC_VERSION=sun_cc - else - - dnl Portland Group C? - is_pgcc="`($CC -V 2>&1) | grep 'Portland Group'`" - if test "x$is_pgcc" != "x" ; then - CC_VERSION_STRING=`($CC -V 2>&1) | grep "^pgcc"` - full_version=`echo "$CC_VERSION_STRING" | perl -pi -e 's/.*pgcc\s+(\S+).*/\1/g;'` - CC_VERSION=pgcc`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'` - AC_MSG_RESULT(C compiler is Portland Group C $full_version) - else - - dnl HP aCC? - is_aCC="`($CC -V 2>&1) | grep 'aCC'`" - if test "x$is_aCC" != "x" ; then - AC_MSG_RESULT(C compiler is HP aCC) - CC_VERSION=hp_aCC - else - - dnl Borland C - is_bcc="`($CC -h 2>&1) | grep 'Borland'`" - if test "x$is_bcc" != "x" ; then - AC_MSG_RESULT(C compiler is Borland C) - CC_VERSION=borland_bcc - else - - is_clang="`($CC --version 2>&1) | grep clang`" - if test "x$is_clang" != x ; then - AC_MSG_RESULT(C compiler is clang) - CC_VERSION=clang - 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="`($CC --version 2>&1) | grep 'KAI C'`" - is_kai_cc="$is_kai_cc`($CC -v 2>&1) | grep /KCC/`" - if test "x$is_kai_cc" != "x" ; then - AC_MSG_RESULT(C compiler is KAI C) - CC_VERSION=kai_cc - else - - dnl Aw, nothing suitable found... - AC_MSG_RESULT([Unrecognized compiler -- still trying]) - CC_VERSION=unknown_cc - 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 CFLAGS.o : flags for optimized mode -dnl CFLAGS.g : flags for debug mode -dnl -dnl Usage: DEAL_II_SET_CC_FLAGS -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_SET_CC_FLAGS, dnl -[ - dnl First the flags for gcc compilers - if test "$GCC" = yes ; then - CFLAGSO="$CFLAGS -O3 -funroll-loops -funroll-all-loops -fstrict-aliasing" - CFLAGSG="$CFLAGS -g" - 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. - case "$target" in - *aix* ) - CFLAGSPIC= - ;; - - *dec-osf* ) - CFLAGSPIC="-fPIC" - ;; - - *cygwin*) - CFLAGSPIC= - ;; - - *apple-darwin*) - dnl The TBB tries to determine whether the system is - dnl 64-bit enabled and if so, it builds the object files in 64bit. - dnl In order to be able to link with these files, we then have to - dnl link with -m64 as well - if test "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ; then - CFLAGS="$CFLAGS -m64" - fi - ;; - - *) - CFLAGSPIC="-fPIC" - ;; - esac - - else - dnl Non-gcc compilers. By default, use the C compiler also for linking - dnl shared libraries. If some compiler cannot do that and needs something - dnl different, then this must be specified in the respective section - dnl below, overriding this define: - SHLIBLD="$CC" - - case "$CC_VERSION" in - ibm_xlc) - CFLAGSO="$CFLAGS -O2" - CFLAGSPIC="-fPIC" - SHLIBLD="$CXX" - ;; - - MIPSpro*) - CFLAGSO="$CFLAGS -O2" - CFLAGSPIC="-KPIC" - ;; - - intel_icc*) - CFLAGSO="$CFLAGS -O2 -unroll" - case "$CC_VERSION" in - intel_icc5 | intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CFLAGSPIC="-KPIC" - ;; - - intel_icc*) - CFLAGSPIC="-fPIC" - ;; - esac - - dnl To reduce output, use -opt_report_levelmin where possible, - dnl i.e. post icc5. from icc10 onwards, this flag is called - dnl -opt-report, and -vec-report controls output of the - dnl autovectorizer (to make things simpler, one of the two options - dnl wants a space between option and level, whereas the other does - dnl not) - case "$CC_VERSION" in - intel_icc5) - ;; - intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CFLAGSO="$CFLAGSO -opt_report_levelmin" - ;; - *) - CFLAGSO="$CFLAGSO -opt-report 0 -vec-report0" - ;; - esac - - CFLAGSO="$CFLAGSO -ansi_alias -vec_report0" - - dnl If we are on an x86 platform, add -tpp6 to optimization - dnl flags - case "$target" in - *86*) - case "$CC_VERSION" in - intel_icc5) - ;; - intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CFLAGSO="$CFLAGSO -tpp6" - ;; - *) - CFLAGSO="$CFLAGSO -mcpu=pentium4" - ;; - esac - ;; - esac - - dnl Check whether we can switch off the annoying 1572 warning - dnl message about unreliable floating point comparisons - DEAL_II_ICC_C_WD_1572 - - ;; - - clang) - CFLAGS="$CFLAGS -g" - CFLAGSO="$CFLAGS -O2" - CFLAGSPIC="-fPIC" - ;; - - sun_cc*) - CFLAGS="$CFLAGS -g" - CFLAGSO="$CFLAGS -fast -O2" - CFLAGSPIC="-fPIC" - ;; - - *) - AC_MSG_RESULT(Unknown C compiler - using generic options) - CFLAGSO="$CFLAGSO -O2" - ;; - esac - fi -]) - - - -dnl ------------------------------------------------------------- -dnl Determine the F77 compiler in use. Return the name and possibly -dnl version of this compiler in F77_VERSION. -dnl -dnl Usage: DEAL_II_DETERMINE_F77_BRAND -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_DETERMINE_F77_BRAND, dnl -[ - if test "x$F77" != "x" ; then - - dnl Get version string of the compiler. Some compilers, most - dnl notably the IBM compilers have the bad habit of dumping - dnl all of their helptexts here, so only consider the first - dnl 10 lines. Otherwise we'll have a problem later on when - dnl we do things like "echo $F77_VERSION_STRING | grep ..." and - dnl the shell says that we exceeded the limit for the length of - dnl command lines :-( - F77_VERSION_STRING="`($F77 -v 2>&1) | head -n 10`" - if test -n "`echo $F77_VERSION_STRING | grep \"GNU F77\"`" -o \ - -n "`echo $F77_VERSION_STRING | grep \"gcc version\"`" ; then - dnl Yes, this is a GNU g77 version. find out the right version - G77_VERSION_STRING="`($F77 -v 2>&1) | grep \"gcc version\"`" - - full_version=`echo "$G77_VERSION_STRING" | perl -pi -e 's/.*version (\d\.\d\.\d).*/\1/g;'` - F77_VERSION=gcc`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'` - - AC_MSG_RESULT(F77 compiler is $CC_VERSION) - - else - - dnl No GNU g77 version, something else. Try to find out what it is: - if test -n "`echo $F77_VERSION_STRING | grep \"XL Fortran for AIX\"`" ; then - - dnl This is the "XL Fortran for AIX" compiler - F77_VERSION=AIXF77 - AC_MSG_RESULT(F77 compiler is AIX Fortran77) - - else - - dnl Umh, still something else unknown. Try to find it out by a - dnl different method (-V instead of -v): - F77_VERSION_STRING=`($F77 -V 2>&1)` - if test -n "`echo $F77_VERSION_STRING | grep \"WorkShop Compilers\"`" \ - -o \ - -n "`echo $F77_VERSION_STRING | grep \"Sun WorkShop\"`" \ - -o \ - -n "`echo $F77_VERSION_STRING | grep \"Forte Developer\"`" ; then - dnl OK, this is the Sun Fortran77 compiler - AC_MSG_RESULT(F77 compiler is Sun WorkShop f77) - F77_VERSION="SunF77" - - else - - dnl If we can detect IRIX's f77 somehow, then the following flags - dnl might be appropriate: - F77_VERSION_STRING=`($F77 -version 2>&1)` - if test -n "`echo $F77_VERSION_STRING | grep MIPSpro`" ; then - AC_MSG_RESULT(F77 compiler is MIPSpro f77) - F77_VERSION="MIPSproF77" - - else - - F77_VERSION_STRING=`($F77 -V 2>&1)` - is_intel_ifc="`echo $F77_VERSION_STRING | grep 'Intel(R) Fortran'`" - if test "x$is_intel_ifc" != "x" ; then - AC_MSG_RESULT(F77 compiler is Intel Fortran) - F77_VERSION=INTEL_F77 - - else - - - dnl Now, this is a hard case, we have no more clues... - F77_VERSION="UnknownF77" - AC_MSG_RESULT(F77 compiler is unknown. no flags set!) - fi - fi - fi - fi - fi - fi -]) - - -dnl ------------------------------------------------------------- -dnl Set F77 compiler flags to their default values. -dnl -dnl F77FLAGSO : flags for optimized mode -dnl F77FLAGSG : flags for debug mode -dnl F77LIBS : libraries to link with when using F77 -dnl F77FLAGSPIC: since we don't presently use libtool to link F77 libs, -dnl this is the flag to use for f77 compilers when using -dnl shared libraries -dnl -dnl Usage: DEAL_II_SET_F77_FLAGS -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_SET_F77_FLAGS, dnl -[ - case "$F77_VERSION" in - gcc*) - F77FLAGSG="$FFLAGS -ggdb -DDEBUG -pedantic -W -Wall" - F77FLAGSO="$FFLAGS -O2 -funroll-loops -funroll-all-loops -fstrict-aliasing" - - case "$target" in - *cygwin* ) - F77FLAGSPIC= - ;; - - *apple-darwin*) - dnl Add -m64 to flags for the same TBB-related reason as - dnl above when setting CXXFLAGS - if test "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ; then - F77FLAGSG="$F77FLAGSG -m64" - F77FLAGSO="$F77FLAGSO -m64" - fi - ;; - - * ) - F77FLAGSPIC="-fPIC" - ;; - esac - - dnl Make sure we link both possible libraries here. Shame on gfortran! - AC_CHECK_LIB(g2c, e_wsfe, [ F77LIBS="$F77LIBS -lg2c" ]) - - dnl Check whether libgfortran contains certain symbols. We used - dnl to use _gfortran_allocate but that appears to have disappeared - dnl at one point in time so if we can't find it check other symbols - dnl till we find one we recognize - AC_CHECK_LIB(gfortran, _gfortran_allocate, [found=1]) - AC_CHECK_LIB(gfortran, _gfortran_st_write_done, [found=1]) - - dnl libgfortran appears to exist. Link with it. - if test "x$found" = "x1" ; then - F77LIBS="$F77LIBS -lgfortran" - fi - ;; - - AIXF77) - dnl Set flags for AIX's xlf compiler. -qextname instructs the compiler - dnl to append an underscore to external function names, which is what - dnl we expect when linking with FORTRAN functions - F77FLAGSG="$FFLAGS -g -qextname" - F77FLAGSO="$FFLAGS -O3 -w -qextname" - F77LIBS="$F77LIBS -lxlf90" - - F77FLAGSPIC="unknown!" - ;; - - SunF77) - F77FLAGSG="$FFLAGS -silent -g" - F77FLAGSO="$FFLAGS -silent -O3 -w" - F77LIBS="$F77LIBS -lF77 -lsunmath -lM77" - F77FLAGSPIC="-PIC" - ;; - - MIPSproF77) - F77FLAGSG="$FFLAGS -ansi -g" - F77FLAGSO="$FFLAGS -O3 -woffall" - F77LIBS="$F77LIBS -lftn" - - F77FLAGSPIC="shared -KPIC" - ;; - - INTEL_F77*) - F77FLAGSG="$FFLAGS" - F77FLAGSO="$FFLAGS -O3" - ;; - - UnknownF77) - dnl Disable unknown FORTRAN compiler. - dnl Allows configure to finish, - dnl but disables compiling FORTRAN code - F77="UnknownF77" - F77FLAGSG="$FFLAGS -g" - F77FLAGSO="$FFLAGS -O2" - F77LIBS="$F77LIBS" - - F77FLAGSPIC="unknown!" - AC_MSG_RESULT(Unknown FORTRAN compiler has been disabled!) - ;; - - dnl Keep this line just in case we change default options - dnl back to error message - *) - AC_MSG_ERROR(No compiler options for F77 compiler "$F77_VERSION" specified: modification of aclocal.m4 necessary) - ;; - esac -]) - - -dnl ------------------------------------------------------------- -dnl -dnl Check whether we can use -rpath for linking. If so, we can use -dnl -rpath instead of -L in LDFLAGS below, so the dynamic linker -dnl finds all libraries. -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_RPATH, -[ OLD_LDFLAGS="$LDFLAGS" - LDFLAGS="-Wl,-rpath,$DEAL_II_PATH/lib $LDFLAGS" - AC_MSG_CHECKING([whether compiler understands option -Wl,-rpath]) - AC_LINK_IFELSE( - [ AC_LANG_PROGRAM([[]],[[]])], - [ AC_MSG_RESULT(yes) - LD_PATH_OPTION="-Wl,-rpath," - DEAL_II_LD_UNDERSTANDS_RPATH=yes - ], - [ AC_MSG_RESULT(no) - LDFLAGS="$OLD_LDFLAGS" - LD_PATH_OPTION="no" - ]) - AC_SUBST(DEAL_II_LD_UNDERSTANDS_RPATH) -]) - - - -dnl ------------------------------------------------------------- -dnl -dnl Check whether we can use -soname for linking in the shared -dnl library version. On Mac OS X, -soname is called -dnl -dylib_install_name -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_LINK_SONAME, -[ - dnl First try -soname - OLD_LDFLAGS="$LDFLAGS" - LDFLAGS="-Wl,-soname,libbase.so.6.2.1 $LDFLAGS $LDFLAGSPIC $SHLIBFLAGS" - AC_MSG_CHECKING([whether compiler understands option -Wl,-soname]) - AC_LINK_IFELSE( - [ AC_LANG_PROGRAM([[]],[[]])], - [ - AC_MSG_RESULT(yes) - DEAL_II_LD_UNDERSTANDS_SONAME="yes" - ], - [ - AC_MSG_RESULT(no) - DEAL_II_LD_UNDERSTANDS_SONAME="no" - ] - ) - LDFLAGS="$OLD_LDFLAGS" - AC_SUBST(DEAL_II_LD_UNDERSTANDS_SONAME) - - dnl Now try the -dylib_install_name thing - OLD_LDFLAGS="$LDFLAGS" - LDFLAGS="-Wl,-dynamic,-install_name -Wl,libbase.so.6.2.1 $LDFLAGS -shared" - AC_MSG_CHECKING([whether compiler understands option -Wl,-dynamic,-install_name]) - AC_LINK_IFELSE( - [ AC_LANG_PROGRAM([[]],[[]])], - [ - AC_MSG_RESULT(yes) - DEAL_II_LD_UNDERSTANDS_DYLIB_INSTALL_NAME="yes" - ], - [ - AC_MSG_RESULT(no) - DEAL_II_LD_UNDERSTANDS_DYLIB_INSTALL_NAME="no" - ] - ) - LDFLAGS="$OLD_LDFLAGS" - AC_SUBST(DEAL_II_LD_UNDERSTANDS_DYLIB_INSTALL_NAME) -]) - - - -dnl ------------------------------------------------------------- -dnl -dnl Check for a problem with dynamic cast on dynamic libs on -dnl Mac OS X Snow Leopard. The test is only called on Mac OS X. -dnl The test is due to Scott Miller -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_DYNAMIC_CAST_BUG, -[ - AC_MSG_CHECKING(for dynamic_cast problem with shared libs) - - if (cd contrib/config/tests/darwin-dynamic-cast ; \ - echo $CXX > compile_line; \ - $CXX -dynamiclib BaseClass.cpp -o libDynamicCastTestLib.dylib ; \ - $CXX -L. -lDynamicCastTestLib main.cc -o main ; \ - ./main) ; then - AC_MSG_RESULT(no) ; - else - AC_MSG_RESULT(yes) ; - AC_DEFINE(DEAL_II_HAVE_DARWIN_DYNACAST_BUG, 1, - [Defined if the compiler has a bug with dynamic casting - and dynamic libraries]) - if(test "`sw_vers -productVersion`" != "10.8");then - CXXFLAGSG="$CXXFLAGSG -mmacosx-version-min=10.4" - CXXFLAGSO="$CXXFLAGSO -mmacosx-version-min=10.4" - LDFLAGS="$LDFLAGS -mmacosx-version-min=10.4" - fi - fi - rm -f contrib/config/tests/darwin-dynamic-cast/libDynamicCastTestLib.dylib - rm -f contrib/config/tests/darwin-dynamic-cast/main.o - rm -f contrib/config/tests/darwin-dynamic-cast/main -]) - - - -dnl ------------------------------------------------------------- -dnl Check whether user wants optimization for a certain type of -dnl CPU. If so, then set some flags, dependent on what he -dnl wants and the compiler. Not very many CPUS are listed here, -dnl but this is simple to expand if desired. -dnl -dnl To use this feature, use --with-cpu=something -dnl -dnl Usage: DEAL_II_CHECK_CPU_OPTIMIZATIONS -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_CPU_OPTIMIZATIONS, dnl -[ - AC_ARG_WITH(cpu, - [AS_HELP_STRING([--with-cpu=cpu], - [Optimize specifically for the given CPU type, rather than just generating code for this processor family.])], - withcpu="$withval", - withcpu="") - AC_MSG_CHECKING(for CPU to optimize for) - case "$withcpu" in - PowerPC64) - AC_MSG_RESULT(PowerPC64) - case "$GXX_VERSION" in - gcc*) - dnl Tune for this processor - CXXFLAGSG="$CXXFLAGSG -maix64" - CXXFLAGSO="$CXXFLAGSO -maix64 -mpowerpc64 -mcpu=powerpc64 -mtune=powerpc64" - - dnl On this stupid system, we get TOC overflows if we use the - dnl standard flags, so restrict TOC entries to the absolute minimal - CXXFLAGSG="$CXXFLAGSG -mminimal-toc" - CXXFLAGSO="$CXXFLAGSO -mminimal-toc" - - dnl Also set 64-bit mode for f77 compiler, assuming we use IBM's xlf - F77FLAGSG="$F77FLAGSG -q64" - F77FLAGSO="$F77FLAGSO -q64" - - dnl When generating 64-bit code, we need to pass respective flags when - dnl linking (also for static libs) - AR="$AR -X 64" - LDFLAGS="$LDFLAGS -maix64" - - dnl And we must always link with pthreads - DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lpthread) - ;; - esac - ;; - athlon* | pentium* | i386 | i486 | i586 | i686 | k6* | winchip* | opteron) - AC_MSG_RESULT(x86 derivate ($withcpu)) - case "$GXX_VERSION" in - gcc*) - dnl Tune for this processor - CXXFLAGSG="$CXXFLAGSG -march=$withcpu" - CXXFLAGSO="$CXXFLAGSO -march=$withcpu" - - dnl Also set the mode for f77 compiler - F77FLAGSG="$F77FLAGSG -march=$withcpu" - F77FLAGSO="$F77FLAGSO -march=$withcpu" - ;; - esac - ;; - - native) - AC_MSG_RESULT(native processor variant) - case "$GXX_VERSION" in - gcc*) - dnl Tune for this processor - CXXFLAGSG="$CXXFLAGSG -march=native" - CXXFLAGSO="$CXXFLAGSO -march=native" - - dnl Also set the mode for f77 compiler - F77FLAGSG="$F77FLAGSG -march=native" - F77FLAGSO="$F77FLAGSO -march=native" - ;; - - intel_icc*) - dnl Same, but for the icc compiler - CXXFLAGSO="$CXXFLAGSO -xhost" - CXXFLAGSG="$CXXFLAGSG -xhost" - ;; - esac - ;; - - *) - AC_MSG_RESULT(none given or not recognized) - ;; - esac -]) - - - - -dnl ------------------------------------------------------------- -dnl On some systems, notably AIX and SUN Solaris, using threads -dnl leads to warnings since the POSIX_MUTEX_INITIALIZER preprocessor -dnl variable used to initialize POSIX mutex objects does not contain -dnl initializers for all elements of the mutex. This is not wrong, -dnl but leads to the message "warning: aggregate has a partly -dnl bracketed initializer", which is annoying since it shows up -dnl _very_ often in our files, although this is something that -dnl happens inside gcc systems headers. So avoid the warning if -dnl necessary -dnl -dnl Usage: -dnl DEAL_II_CHECK_CHECK_PARTLY_BRACKETED_INITIALIZER -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_PARTLY_BRACKETED_INITIALIZER, dnl -[ - if test "$enablethreads" = yes ; then - case "$GXX_VERSION" in - gcc*) - AC_MSG_CHECKING(for only partly bracketed mutex initializer) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG -Werror" - AC_TRY_COMPILE( - [ -# include - ], - [;], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -Wno-missing-braces" - CXXFLAGSO="$CXXFLAGSO -Wno-missing-braces" - ]) - ;; - *) - ;; - esac - fi -]) - - - -dnl ------------------------------------------------------------- -dnl Check whether some backward compatibility features are disabled -dnl Usage: -dnl DEAL_II_CHECK_COMPAT_BLOCKER -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_COMPAT_BLOCKER, dnl -[ - AC_ARG_ENABLE(compat-blocker, - [AS_HELP_STRING([--enable-compat-blocker=mapping], - [Block functions that implicitely assume a Q1 mapping])], - enable_compat_blocker="$enableval", - enable_compat_blocker="") - - dnl Replace the comma-separated list by a space-separated one - disable_compat=`echo $enable_compat_blocker | perl -pi -e 's/,/ /g;'` - - dnl Check that each entry is an allowed one - for i in $disable_compat ; do - case $i in - mapping) - AC_MSG_RESULT(Disabling backward compatibility feature: "$i") - ;; - *) - AC_MSG_ERROR(Backward compatibility feature "$i" unknown) - ;; - esac - done - - dnl Now for each known feature, either disable it or enable it. - dnl Default is to enable. In order to have these flags in config.h, - dnl it is necessary to AC_DEFINE them actually by name, rather than - dnl by some loop variable, since otherwise autoheader can't generate - dnl an entry for config.h for this variable - for i in mapping ; do - uppercase=`echo $i | perl -pi -e 'tr/a-z/A-Z/;'` - if test -n "`echo $disable_compat | grep $i`" ; then - compat_value=false - else - compat_value=true - fi - - case $i in - mapping) - AC_DEFINE_UNQUOTED(DEAL_II_COMPAT_MAPPING,$compat_value, - [Backward compatibility support for functions - and classes that do not take an explicit - mapping variable, but rather use a default - Q1 mapping instead]) - ;; - - *) - AC_MSG_ERROR(Backward compatibility feature "$i" unknown) - ;; - esac - done -]) - - - -dnl ------------------------------------------------------------- -dnl On SunOS 4.x, the `getrusage' function exists, but is not declared -dnl in the respective header file `resource.h', as one would think when -dnl reading the man pages. Then we have to declare this function -dnl ourselves in those files that use this function. The question whether -dnl we have to do so is controlled by a preprocessor variable. -dnl -dnl If the function is not properly declared, then set the preprocessor -dnl variable NO_HAVE_GETRUSAGE -dnl -dnl Usage: DEAL_II_CHECK_GETRUSAGE -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_GETRUSAGE, dnl -[ - AC_MSG_CHECKING(whether getrusage is properly declared) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG" - AC_TRY_COMPILE( - [ -#include - ], - [ - rusage *ru; - getrusage(RUSAGE_SELF,ru); - ], - [ - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - AC_DEFINE(NO_HAVE_GETRUSAGE, 1, - [On SunOS 4.x, the getrusage() function exists, but - is not declared in the respective header file - , as one would think when reading the - man pages. Then we have to declare this function - ourselves in those files that use this function. - The question whether we have to do so is controlled - by the preprocessor variable.]) - ]) -] -) - - - -dnl ------------------------------------------------------------- -dnl On some systems (well, DEC Alphas are the only ones we know of), -dnl gcc2.95 throws the hands in the air if it sees one of the AssertThrow -dnl calls, and dies with an internal compiler error. If this is the case, -dnl we disable AssertThrow and simply replace it with an `abort' if the -dnl condition is not satisfied. -dnl -dnl Usage: DEAL_II_CHECK_ASSERT_THROW("description of options set", -dnl "compiler options set", -dnl action if compiler crashes) -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_ASSERT_THROW, dnl -[ - AC_MSG_CHECKING(whether AssertThrow works with $1 flags) - AC_LANG(C++) - CXXFLAGS="$2" - AC_TRY_COMPILE( - [ -#include -#include -#include - -#ifndef __GNUC__ -# define __PRETTY_FUNCTION__ "(unknown)" -#endif -class ExceptionBase : public std::exception { - public: - ExceptionBase (); - ExceptionBase (const char* f, const int l, const char *func, - const char* c, const char *e); - virtual ~ExceptionBase () throw(); - void SetFields (const char *f, const int l, const char *func, - const char *c, const char *e); - void PrintExcData (std::ostream &out) const; - virtual void PrintInfo (std::ostream &out) const; - virtual const char * what () const throw (); - protected: - const char *file; - unsigned int line; - const char *function, *cond, *exc; -}; - -template -void __IssueError_Assert (const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - exc e){ - e.SetFields (file, line, function, cond, exc_name); - std::cerr << "--------------------------------------------------------" - << std::endl; - e.PrintExcData (std::cerr); - e.PrintInfo (std::cerr); - std::cerr << "--------------------------------------------------------" - << std::endl; - std::abort (); -} - -template -void __IssueError_Throw (const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - exc e) { - // Fill the fields of the exception object - e.SetFields (file, line, function, cond, exc_name); - throw e; -} - -#define AssertThrow(cond, exc) \ - { \ - if (!(cond)) \ - __IssueError_Throw (__FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, #cond, #exc, exc); \ - } - -#define DeclException0(Exception0) \ -class Exception0 : public ExceptionBase {} - -namespace StandardExceptions -{ - DeclException0 (ExcInternalError); -} -using namespace StandardExceptions; - ], - [ - AssertThrow (false, ExcInternalError()); - ], - [ - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - $3 - ]) -]) - - - -dnl ------------------------------------------------------------- -dnl Sun's Forte compiler (at least up to the Version 7 Early Access -dnl release) has a problem with the following code, when compiling -dnl with debug output: -dnl -dnl /* ---------------------------------------------------------- */ -dnl /* Internal compiler error in abi2_mangler::entity_expression */ -dnl /* when compiled with -g. */ -dnl template < int dim > struct T { -dnl typedef T SubT; -dnl T (SubT); -dnl }; -dnl -dnl template T::T (SubT) {}; -dnl -dnl template class T<3> ; -dnl /* ---------------------------------------------------------- */ -dnl -dnl The compiler gets an internal compiler error, so we work around -dnl this problem by a really evil hack in the sources. -dnl -dnl Usage: DEAL_II_CHECK_LOCAL_TYPEDEF_COMP -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_LOCAL_TYPEDEF_COMP, dnl -[ - AC_MSG_CHECKING(for local computed template typedef bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG -g" - AC_TRY_COMPILE( - [ - template < int dim > struct T { - typedef T SubT; - T (SubT); - }; - - template T::T (SubT) {} - - template class T<3>; - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE(DEAL_II_LOCAL_TYPEDEF_COMP_WORKAROUND, 1, - [Define if we have to work around a bug in Sun's Forte compiler. - See the aclocal.m4 file in the top-level directory for a - description of this bug.]) - ]) -]) - - - -dnl ------------------------------------------------------------- -dnl Sun's Forte compiler (at least up to the Version 7 Early Access -dnl release) have a problem with the following code, when compiling -dnl with debug output: -dnl -dnl /* ----------------------------------------------- */ -dnl /* Problem 14: Access control. Friendship is not */ -dnl /* granted although explicitly declared. */ -dnl template class T { int bar (); }; -dnl -dnl template class T<1,M> { -dnl private: -dnl static int i; -dnl template friend class T; -dnl }; -dnl -dnl template int T::bar () { -dnl return T::i; -dnl }; -dnl -dnl template class T<2,1> ; -dnl /* ---------------------------------------------------------- */ -dnl -dnl The compiler does not allow access to T<1,1>::i, although the -dnl accessing class is explicitly marked friend. -dnl -dnl Usage: DEAL_II_CHECK_TEMPLATE_SPEC_ACCESS -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_TEMPLATE_SPEC_ACCESS, dnl -[ - AC_MSG_CHECKING(for partially specialized template access control bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG" - AC_TRY_COMPILE( - [ - template struct T { int bar (); }; - - template struct T<1,M> { - T (); - private: - static int i; - template friend class T; - }; - - template int T::bar () { - return T::i; - } - - template class T<2,1>; - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE(DEAL_II_TEMPLATE_SPEC_ACCESS_WORKAROUND, 1, - [Define if we have to work around a bug in Sun's Forte compiler. - See the aclocal.m4 file in the top-level directory for a - description of this bug.]) - ]) -]) - - - -dnl ------------------------------------------------------------- -dnl Some compiler versions, notably ICC, have trouble with the -dnl following code in which we explicitly call a destructor. -dnl This has to be worked around with a typedef. The problem is -dnl that the workaround fails with some other compilers, so that -dnl we can not unconditionally use the workaround... -dnl -dnl Usage: DEAL_II_CHECK_EXPLICIT_DESTRUCTOR_BUG -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_EXPLICIT_DESTRUCTOR_BUG, dnl -[ - AC_MSG_CHECKING(for explicit destructor call bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG" - AC_TRY_COMPILE( - [ - namespace dealii - { - namespace FEValuesViews - { - template struct Scalar {}; - } - - template - struct X - { - FEValuesViews::Scalar scalars[dim*spacedim]; - - void f() - { - scalars[0].dealii::FEValuesViews::Scalar::~Scalar (); - } - }; - - template struct X<2,2>; - } - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE_UNQUOTED(DEAL_II_EXPLICIT_DESTRUCTOR_BUG, 1, - [Define if we have to work around a bug where the - compiler doesn't accept an explicit destructor call. - See the aclocal.m4 file in the top-level directory - for a description of this bug.]) - ]) -]) - - -dnl ------------------------------------------------------------- -dnl Versions of GCC before 3.0 had a problem with the following -dnl code: -dnl -dnl /* ----------------------------------------------- */ -dnl namespace NS { -dnl template class C { -dnl template friend class C; -dnl }; -dnl }; -dnl /* ----------------------------------------------- */ -dnl -dnl This is fixed with gcc at least in snapshots before version 3.1, -dnl but the following bug remains: -dnl -dnl /* ----------------------------------------------- */ -dnl namespace NS { template class C; }; -dnl -dnl template class X { -dnl template friend class NS::C; -dnl }; -dnl -dnl template class X; -dnl /* ----------------------------------------------- */ -dnl -dnl The compiler gets an internal error for these cases. Since we need this -dnl construct at various places, we check for it and if the compiler -dnl dies, we use a workaround that is non-ISO C++ but works for these -dnl compilers. -dnl -dnl Usage: DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG, dnl -[ - AC_MSG_CHECKING(for 1st template friend in namespace bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG" - AC_TRY_COMPILE( - [ - namespace NS { - template class C { - C(const C&); - template friend class C; - }; - } - - namespace NS2 { template class C; } - - template class X { - template friend class NS2::C; - template friend class NS::C; - }; - - template class X; - - namespace NS { - template - inline C::C(const C&) - {} - } - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE_UNQUOTED(DEAL_II_NAMESP_TEMPL_FRIEND_BUG, 1, - [Define if we have to work around a bug in gcc with - marking all instances of a template class as friends - to this class if the class is inside a namespace. - See the aclocal.m4 file in the top-level directory - for a description of this bug.]) - ]) -]) - - - -dnl ------------------------------------------------------------- -dnl Another bug in gcc with template and namespaces (fixed since 3.2, -dnl but present in 3.0): -dnl -dnl /* ----------------------------------------------- */ -dnl namespace NS { -dnl template struct Foo; -dnl } -dnl -dnl class Bar { -dnl template friend struct NS::Foo; -dnl }; -dnl -dnl namespace NS { -dnl template struct Foo { Foo (); }; -dnl } -dnl -dnl template struct NS::Foo; -dnl /* ----------------------------------------------- */ -dnl -dnl gcc2.95 provides a really unhelpful error message, 3.0 gets an -dnl internal compiler error. -dnl -dnl Usage: DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG2 -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG2, dnl -[ - AC_MSG_CHECKING(for 2nd template friend in namespace bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG -Werror" - AC_TRY_COMPILE( - [ - namespace NS { - template struct Foo; - } - - class Bar { - template friend struct NS::Foo; - }; - - namespace NS { - template struct Foo { Foo (); }; - } - - template struct NS::Foo; - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE_UNQUOTED(DEAL_II_NAMESP_TEMPL_FRIEND_BUG2, 1, - [Define if we have to work around another bug in gcc with - marking all instances of a template class as friends - to this class if the class is inside a namespace. - See the aclocal.m4 file in the top-level directory - for a description of this bug.]) - ]) -]) - - - -dnl ------------------------------------------------------------- -dnl In some cases, we would like to name partial specializations -dnl as friends. However, the standard forbids us to do so. But -dnl then, we can declare the general template as a friend, and -dnl at least gcc extends the friendship to all specializations -dnl of the templates, which is not what the standard says. -dnl -dnl With other compilers, most notably cxx, this does not work. -dnl In this case, we can make individual specializations friends, -dnl which in turn gcc rejects. So check, whether this is possible. -dnl -dnl The respective clause in the standard is 14.5.3.1, which gives -dnl this example: -dnl template class task { -dnl friend class task; -dnl }; -dnl -dnl -dnl Usage: DEAL_II_CHECK_TEMPL_SPEC_FRIEND_BUG -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_TEMPL_SPEC_FRIEND_BUG, dnl -[ - AC_MSG_CHECKING(for template specialization friend bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG" - AC_TRY_COMPILE( - [ -template class X; -template class X<1,T>; - -template class Y { - static int i; - template friend class X; - friend class X<1,P>; -}; - -template class X<1,T> { - int f () { return Y::i; }; // access private field -}; - -template class X<1,int>; - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes) - AC_DEFINE_UNQUOTED(DEAL_II_TEMPL_SPEC_FRIEND_BUG, 1, - [Define if we have to work around a bug with some - compilers that will not allow us to specify a - fully specialized class of a template as a friend. - See the aclocal.m4 file in the top-level directory - for a description of this bug.]) - ]) -]) - - - -dnl ------------------------------------------------------------- -dnl DEC/Compaq's cxx compiler does not want us to implement -dnl virtual functions that were declared abstract before. We do -dnl this with the destructor of the Function class, since we want -dnl to avoid people making objects of that class, but all functions -dnl have default implementations, so the class is not abstract -dnl without that. Since every derived class has a destructor, it -dnl is sufficient to mark the destructor =0. -dnl -dnl Unfortunately, cxx refuses to grok that. It sees the respective -dnl function in the .cc file, but does not instantiate it, leading -dnl to linker errors. Thus, check this misfeature, and if present -dnl simply do not mark the function abstract for this particular -dnl compiler. -dnl -dnl Usage: DEAL_II_CHECK_IMPLEMENTED_PURE_FUNCTION_BUG -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_IMPLEMENTED_PURE_FUNCTION_BUG, dnl -[ - AC_MSG_CHECKING(for bug with implementing pure functions) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG" - AC_TRY_COMPILE( - [ - template - struct Function - { - public: - virtual ~Function () = 0; - }; - - template - Function::~Function () - {} - - template class Function<1>; - template Function<1>::~Function(); - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE(DEAL_II_IMPLEMENTED_PURE_FUNCTION_BUG, 1, - [Defined if the compiler refuses to compile the definition - of a function that was previously declared abstract.]) - ]) -]) - - - -dnl ------------------------------------------------------------- -dnl gcc 2.95 dies on this construct: -dnl ----------------------------- -dnl template struct TT { typedef int type; }; -dnl -dnl template