]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Revamp configury machinery.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 2 Jun 2000 13:39:32 +0000 (13:39 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 2 Jun 2000 13:39:32 +0000 (13:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@2987 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4 [new file with mode: 0644]
deal.II/common/Make.global_options.in
deal.II/configure
deal.II/configure.in

diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4
new file mode 100644 (file)
index 0000000..4498dce
--- /dev/null
@@ -0,0 +1,78 @@
+dnl ----------------------------------------------------
+dnl        Platform specific autoconf tests
+dnl
+dnl    This is part of the input for the ./configure script of
+dnl    the deal.II libraries. All options and paths are stored in
+dnl    the file common/Make.global_options.
+dnl
+dnl    In doc/Makefile some information on the kind of documentation
+dnl    is stored.
+dnl
+dnl
+dnl author: Wolfgang Bangerth, 2000
+dnl
+dnl $Id$
+
+
+
+
+dnl In some cases, -threads (or whatever else command line option)
+dnl switches on some preprocessor flags. If this is not the case,
+dnl then define them explicitely.
+dnl 
+dnl Usage: DEAL_II_THREAD_CPPFLAGS
+dnl
+AC_DEFUN(DEAL_II_THREAD_CPPFLAGS, dnl
+[
+  AC_MSG_CHECKING(for platform specific multi-threading defines)
+  AC_REQUIRE([AC_LANG_CPLUSPLUS])
+  AC_TRY_COMPILE(
+   [
+#if !defined (_REENTRANT) && !defined (_THREAD_SAFE)
+#error Neither _REENTRANT nor _THREAD_SAFE were defined.
+nonsense
+#endif
+   ],
+   [
+       ;
+   ],
+   [
+       AC_MSG_RESULT("not necessary")
+   ],
+   [
+       AC_MSG_RESULT("-D_REENTRANT -D_THREAD_SAFE")
+       CXXFLAGSG="$CXXFLAGSG -D_REENTRANT -D_THREAD_SAFE"
+       CXXFLAGSO="$CXXFLAGSO -D_REENTRANT -D_THREAD_SAFE"
+   ])
+])
+
+
+
+
+dnl Versions of gcc on different platforms use a multitude of flags to
+dnl denote thread safe libraries and the like. They are, for example
+dnl -threads/-pthread/-mthread, sometimes *thread, sometimes *threads. 
+dnl Find out which is the right one on the present platform
+dnl
+dnl Usage: DEAL_II_FIND_THREAD_FLAGS
+dnl
+AC_DEFUN(DEAL_II_GET_THREAD_FLAGS, dnl
+[
+  AC_MSG_CHECKING(for platform specific thread flags)
+  AC_REQUIRE([AC_LANG_CPLUSPLUS])
+  for i in threads mt pthread pthreads mthreads Kthread kthread; do
+    CXXFLAGS="$CXXFLAGSG -$i"
+    AC_TRY_COMPILE(
+       [],
+       [;],
+       [
+         thread_flag=$i
+         CXXFLAGSG="$CXXFLAGSG -$i"
+         CXXFLAGSO="$CXXFLAGSO -$i"
+       
+         dnl The right parameter was found, so exit
+         break
+       ])
+  done
+  AC_MSG_RESULT("$thread_flag")
+])
index 67095293901a0e03405e490382e61e8d31bd71c0..425380e71709e7654e5316275c3d9c9372aa7162 100644 (file)
@@ -22,7 +22,6 @@ D                    = @DEAL2_DIR@
 CC                   = @CC@
 CXX                  = @CXX@
 GXX-VERSION          = @GXX_VERSION@
-OS                   = @OS@
 PERL                 = @PERL@
 enable-multithreading= @enablemultithreading@
 with-multithreading  = @withmultithreading@
@@ -74,61 +73,8 @@ INCLUDE           += $(addprefix -I, $(include-path-base) \
                                      $(include-path-deal2))
 
 # compiler flags for debug and optimized mode
-
-CXXFLAGS.g   = @DEFS@ @shared_libs@ \
-               -DDEBUG -ggdb -Wall -W -Wconversion \
-               -Winline -Woverloaded-virtual\
-              -ftemplate-depth-32\
-               $(INCLUDE) \
-              $(LIBPATH)
-CXXFLAGS.o   = @DEFS@ @shared_libs@ @throw_opt@ \
-               -O2 -Wuninitialized \
-               -felide-constructors -fnonnull-objects \
-              -ftemplate-depth-32 \
-               $(INCLUDE) \
-              $(LIBPATH)
-
-
-# if not egcs-1.1 we can use additional flags for which that compiler
-# had quirks
-ifneq ($(GXX-VERSION),egcs1.1)
-  CXXFLAGS.o += -funroll-loops -funroll-all-loops
-endif
-
-
-# if not on Linux and we use egcs-1.1: enable -fno-vtable-thunks,
-# since vtable-thunks are broken and yield incorrect code. in fact,
-# they are also broken on Linux, but we can't link programs compiled
-# with -fno-vtable-thunks unless the whole compiler is recompiled,
-# which we don't want to force on the users
-ifneq ($(OS),Linux)
-  ifeq ($(GXX-VERSION),egcs1.1)
-    CXXFLAGS.g += -fno-vtable-thunks 
-    CXXFLAGS.o += -fno-vtable-thunks 
-  endif
-endif
-
-
-
-# after egcs1.1, the optimization flag -fstrict-aliasing was
-# introduced, which enables better optimizations for well-written C++
-# code. we believe that deal.II falls into that category and thus
-# enable the flag
-ifneq ($(GXX-Version),egcs1.1)
-  CXXFLAGS.o += -fstrict-aliasing
-endif
-
-
-
-# if --enable-multithreading was given, then set the compiler flags
-# accordingly. note that this only sets the flags to generate programs
-# which use thread-safe allocation functions, include the right files,
-# etc, but the library won't use its multithread code. for this you
-# have to specify another flag.
-ifeq ($(enable-multithreading),yes)
-  CXXFLAGS.g += -threads -D__USE_MALLOC
-  CXXFLAGS.o += -threads -D__USE_MALLOC
-endif
+CXXFLAGS.g   = @CXXFLAGSG@  $(INCLUDE)  $(LIBPATH)
+CXXFLAGS.o   = @CXXFLAGSO@  $(INCLUDE)  $(LIBPATH)
 
 
 # if multithread support in the library is requested, then set the
@@ -140,8 +86,5 @@ ifneq ($(with-multithreading),no)
 
   lib-ACE     = $(ACE_ROOT)/ace/libACE.so
 
-  CXXFLAGS.g += -DDEAL_II_USE_MT
-  CXXFLAGS.o += -DDEAL_II_USE_MT
-
   vpath %.a $(ACE_ROOT)
 endif
index a2f6fb418ea0c432b9b90db73252ba6bc76f64c0..a09c125b24226979c9af1595af795b09244f01db 100755 (executable)
@@ -652,10 +652,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
 
 
 
+
+
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:659: checking for $ac_word" >&5
+echo "configure:661: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -685,7 +687,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:689: checking for $ac_word" >&5
+echo "configure:691: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -736,7 +738,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:740: checking for $ac_word" >&5
+echo "configure:742: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -768,7 +770,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:772: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:774: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -779,12 +781,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 783 "configure"
+#line 785 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -810,12 +812,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:814: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:816: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:819: checking whether we are using GNU C" >&5
+echo "configure:821: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -824,7 +826,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -843,7 +845,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:847: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:849: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -877,7 +879,7 @@ fi
 # Extract the first word of "$CC", so it can be a program name with args.
 set dummy $CC; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:881: checking for $ac_word" >&5
+echo "configure:883: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -916,7 +918,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:920: checking for $ac_word" >&5
+echo "configure:922: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -948,7 +950,7 @@ test -n "$CXX" || CXX="gcc"
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:952: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:954: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
 
 ac_ext=C
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -959,12 +961,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 963 "configure"
+#line 965 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cxx_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -990,12 +992,12 @@ if test $ac_cv_prog_cxx_works = no; then
   { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:994: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:996: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
 cross_compiling=$ac_cv_prog_cxx_cross
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:999: checking whether we are using GNU C++" >&5
+echo "configure:1001: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1004,7 +1006,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1010: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -1023,7 +1025,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1027: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1029: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1057,7 +1059,7 @@ fi
 # Extract the first word of "$CXX", so it can be a program name with args.
 set dummy $CXX; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1061: checking for $ac_word" >&5
+echo "configure:1063: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1116,7 +1118,7 @@ fi
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1120: checking for $ac_word" >&5
+echo "configure:1122: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1152,6 +1154,41 @@ fi
 
 
 
+if test $GXX = yes ; then
+  CXXFLAGSO="-O2 -Wuninitialized -felide-constructors -fnonnull-objects -ftemplate-depth-32"
+  CXXFLAGSG="-DDEBUG -ggdb -Wall -W -Wconversion -Winline -Woverloaded-virtual -ftemplate-depth-32"
+
+                      
+  case "$GXXVERSION" in
+    egcs1.1)
+        case "$target" in
+         *linux*)
+             ;;
+
+         *)
+             CXXFLAGSG = "$CXXFLAGSG -fno-vtable-thunks"
+             CXXFLAGSO = "$CXXFLAGSO -fno-vtable-thunks"
+             ;;
+       esac
+       ;;
+
+        *)
+       CXXFLAGSO="$CXXFLAGSO -funroll-loops -funroll-all-loops -fstrict-aliasing"
+       ;;
+  esac
+else
+    { echo "configure: error: No compiler options for this C++ compiler
+               specified at present" 1>&2; exit 1; }
+  exit 1
+fi
+
+
+
+
+
+
+
+
 # Check whether --enable-multithreading or --disable-multithreading was given.
 if test "${enable_multithreading+set}" = set; then
   enableval="$enable_multithreading"
@@ -1163,6 +1200,81 @@ fi
 
 
 
+if test $enablemultithreading = yes ; then
+  
+  echo $ac_n "checking for platform specific thread flags""... $ac_c" 1>&6
+echo "configure:1207: checking for platform specific thread flags" >&5
+  
+  for i in threads mt pthread pthreads mthreads Kthread kthread; do
+    CXXFLAGS="$CXXFLAGSG -$i"
+    cat > conftest.$ac_ext <<EOF
+#line 1212 "configure"
+#include "confdefs.h"
+
+int main() {
+;
+; return 0; }
+EOF
+if { (eval echo configure:1219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+         thread_flag=$i
+         CXXFLAGSG="$CXXFLAGSG -$i"
+         CXXFLAGSO="$CXXFLAGSO -$i"
+       
+                 break
+       
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  done
+  echo "$ac_t"""$thread_flag"" 1>&6
+
+  
+  echo $ac_n "checking for platform specific multi-threading defines""... $ac_c" 1>&6
+echo "configure:1238: checking for platform specific multi-threading defines" >&5
+  
+  cat > conftest.$ac_ext <<EOF
+#line 1241 "configure"
+#include "confdefs.h"
+
+#if !defined (_REENTRANT) && !defined (_THREAD_SAFE)
+#error Neither _REENTRANT nor _THREAD_SAFE were defined.
+nonsense
+#endif
+   
+int main() {
+
+       ;
+   
+; return 0; }
+EOF
+if { (eval echo configure:1255: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+       echo "$ac_t"""not necessary"" 1>&6
+   
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+       echo "$ac_t"""-D_REENTRANT -D_THREAD_SAFE"" 1>&6
+       CXXFLAGSG="$CXXFLAGSG -D_REENTRANT -D_THREAD_SAFE"
+       CXXFLAGSO="$CXXFLAGSO -D_REENTRANT -D_THREAD_SAFE"
+   
+fi
+rm -f conftest*
+
+
+  CXXFLAGSG="$CXXFLAGSG -D__USE_MALLOC"
+  CXXFLAGSO="$CXXFLAGSO -D__USE_MALLOC"
+fi
+
+
+
 # Check whether --with-multithreading or --without-multithreading was given.
 if test "${with_multithreading+set}" = set; then
   withval="$with_multithreading"
@@ -1173,13 +1285,16 @@ fi
 
 if test $withmultithreading != no ; then
   echo $ac_n "checking for ACE""... $ac_c" 1>&6
-echo "configure:1177: checking for ACE" >&5
+echo "configure:1289: checking for ACE" >&5
   if test -d $withmultithreading ; then
     echo "$ac_t""found" 1>&6
   else
     echo "$ac_t""not found" 1>&6
     { echo "configure: error: Invalid ACE path" 1>&2; exit 1; }
   fi
+
+  CXXFLAGSG="$CXXFLAGSG -DDEAL_II_USE_MT"
+  CXXFLAGSO="$CXXFLAGSO -DDEAL_II_USE_MT"
 fi
 
 
@@ -1194,6 +1309,33 @@ else
 fi
 
 
+case "$target" in
+   *-aix* | alpha*-linux* ) 
+          echo "configure: warning: Shared libraries not supported on $target. Using static libs instead" 1>&2
+          enableshared=no 
+          ;;
+esac
+
+
+if test $enableshared = yes ; then
+  echo "$ac_t""Configuring for shared libraries" 1>&6
+  CXXFLAGSG="$CXXFLAGSG -fPIC"
+  CXXFLAGSO="$CXXFLAGSO -fPIC"
+
+  lib_suffix=.so;
+else
+  echo "$ac_t""Configuring for static libraries" 1>&6
+
+  lib_suffix=.a;
+fi
+
+
+
+
+
+
+
+
 
 # Check whether --enable-multigrid or --disable-multigrid was given.
 if test "${enable_multigrid+set}" = set; then
@@ -1209,6 +1351,10 @@ fi
 
 if test $enablemultigrid = yes ; then
    echo "$ac_t""Configuring multigrid" 1>&6
+   cat >> confdefs.h <<\EOF
+#define ENABLE_MULTIGRID 1
+EOF
+
 fi
 
 
@@ -1225,7 +1371,7 @@ else
 fi
 
 echo $ac_n "checking for kdoc""... $ac_c" 1>&6
-echo "configure:1229: checking for kdoc" >&5
+echo "configure:1375: checking for kdoc" >&5
 if test -r $kdocdir/kdoc ; then
   echo "$ac_t""found" 1>&6
 else
@@ -1254,7 +1400,7 @@ if test "$docxx" = to-be-determined ; then
   # Extract the first word of ""doc++"", so it can be a program name with args.
 set dummy "doc++"; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1258: checking for $ac_word" >&5
+echo "configure:1404: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_docxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1288,7 +1434,7 @@ fi
 
 else
   echo $ac_n "checking for doc++""... $ac_c" 1>&6
-echo "configure:1292: checking for doc++" >&5
+echo "configure:1438: checking for doc++" >&5
   if test -x "$docxx" ; then
     echo "$ac_t""yes" 1>&6
   else
@@ -1299,30 +1445,75 @@ fi
 
 
 
-case "$target" in
-
-      
-   *-linux*) OS=Linux;;
 
-   
-   *-aix*) enableshared=no ;;
-esac
 
 
 case "$target" in
-   alpha*-linux*) throw_opt=-DNO_THROW enableshared=no ;;
+         alpha*-linux*)
+       CXXFLAGSG="$CXXFLAGSG  -DNO_THROW"
+       CXXFLAGSO="$CXXFLAGSO  -DNO_THROW"
+       ;;
 esac
 
 
-if test $enableshared = yes ; then
-  echo "$ac_t""Configuring shared libraries" 1>&6
-  shared_libs=-fPIC;
-  lib_suffix=.so;
+
+
+
+
+
+echo $ac_n "checking for consistency of CXXFLAGSG flags""... $ac_c" 1>&6
+echo "configure:1466: checking for consistency of CXXFLAGSG flags" >&5
+CXXFLAGS="$CXXFLAGSG"
+cat > conftest.$ac_ext <<EOF
+#line 1469 "configure"
+#include "confdefs.h"
+
+int main() {
+;
+; return 0; }
+EOF
+if { (eval echo configure:1476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+    echo "$ac_t""yes" 1>&6
+  
 else
-  echo "$ac_t""Configuring static libraries" 1>&6
-  shared_libs='';
-  lib_suffix=.a;
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+    { echo "configure: error: invalid combination of flags!" 1>&2; exit 1; }
+    exit 1;
+  
+fi
+rm -f conftest*
+
+echo $ac_n "checking for consistency of CXXFLAGSO flags""... $ac_c" 1>&6
+echo "configure:1493: checking for consistency of CXXFLAGSO flags" >&5
+CXXFLAGS="$CXXFLAGSO"
+cat > conftest.$ac_ext <<EOF
+#line 1496 "configure"
+#include "confdefs.h"
+
+int main() {
+;
+; return 0; }
+EOF
+if { (eval echo configure:1503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+    echo "$ac_t""yes" 1>&6
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+    { echo "configure: error: invalid combination of flags!" 1>&2; exit 1; }
+    exit 1;
+  
 fi
+rm -f conftest*
 
 
 
@@ -1457,17 +1648,16 @@ s%@CC@%$CC%g
 s%@CXX@%$CXX%g
 s%@GXX_VERSION@%$GXX_VERSION%g
 s%@PERL@%$PERL%g
+s%@CXXFLAGSG@%$CXXFLAGSG%g
+s%@CXXFLAGSO@%$CXXFLAGSO%g
 s%@enablemultithreading@%$enablemultithreading%g
 s%@withmultithreading@%$withmultithreading%g
+s%@enableshared@%$enableshared%g
+s%@lib_suffix@%$lib_suffix%g
 s%@enablemultigrid@%$enablemultigrid%g
 s%@kdocdir@%$kdocdir%g
 s%@kdocversion@%$kdocversion%g
 s%@docxx@%$docxx%g
-s%@OS@%$OS%g
-s%@enableshared@%$enableshared%g
-s%@shared_libs@%$shared_libs%g
-s%@lib_suffix@%$lib_suffix%g
-s%@throw_opt@%$throw_opt%g
 s%@subdirs@%$subdirs%g
 
 CEOF
index f745f8979679312d6fdf1ead629aaffa7b53a16e..315ca0dc235928055b618851f7ebb53c38be44a1 100644 (file)
@@ -1,8 +1,8 @@
 dnl $Id$
 dnl
 dnl    This is the input for the ./configure script of the deal.II
-dnl    libraries. The file is common/Make.global_options
-dnl    where all options and paths are stored.
+dnl    libraries. All options and paths are stored in
+dnl    the file common/Make.global_options.
 dnl
 dnl    In doc/Makefile some information on the kind of documentation
 dnl    is stored.
@@ -32,6 +32,8 @@ AC_LANG_CPLUSPLUS
 
 
 
+
+
 dnl -------------------------------------------------------------
 dnl Find external programs
 dnl -------------------------------------------------------------
@@ -77,6 +79,61 @@ AC_PATH_PROG(PERL, perl)
 
 
 
+dnl -------------------------------------------------------------
+dnl Set compiler flags to their default values. They will be 
+dnl modified according to other options further down below
+dnl
+dnl CXXFLAGSO are the flags for optimized mode
+dnl CXXFLAGSG are the flags for debug mode
+dnl -------------------------------------------------------------
+
+if test $GXX = yes ; then
+  CXXFLAGSO="-O2 -Wuninitialized -felide-constructors -fnonnull-objects -ftemplate-depth-32"
+  CXXFLAGSG="-DDEBUG -ggdb -Wall -W -Wconversion -Winline -Woverloaded-virtual -ftemplate-depth-32"
+
+  dnl set some flags that are specific to some versions of the
+  dnl compiler:
+  dnl - egcs1.1 yielded incorrect code with some loop unrolling
+  dnl - after egcs1.1, the optimization flag -fstrict-aliasing was
+  dnl   introduced, which enables better optimizations for
+  dnl   well-written C++ code. we believe that deal.II falls into that
+  dnl   category and thus enable the flag 
+  dnl - egcs1.1 yielded incorrect code with vtable-thunks. thus disable
+  dnl   them for egcs1.1. however, if on Linux, disabling them
+  dnl   prevents programs from being linked, so take the risk of broken
+  dnl   thunks on this platform
+
+  case "$GXXVERSION" in
+    egcs1.1)
+        case "$target" in
+         *linux*)
+             ;;
+
+         *)
+             CXXFLAGSG = "$CXXFLAGSG -fno-vtable-thunks"
+             CXXFLAGSO = "$CXXFLAGSO -fno-vtable-thunks"
+             ;;
+       esac
+       ;;
+
+    dnl All other gcc versions
+    *)
+       CXXFLAGSO="$CXXFLAGSO -funroll-loops -funroll-all-loops -fstrict-aliasing"
+       ;;
+  esac
+else
+  dnl Other compiler
+  AC_MSG_ERROR(No compiler options for this C++ compiler
+               specified at present)
+  exit 1
+fi
+
+AC_SUBST(CXXFLAGSG)
+AC_SUBST(CXXFLAGSO)
+
+
+
+
 dnl -------------------------------------------------------------
 dnl Multithreading
 dnl -------------------------------------------------------------
@@ -91,6 +148,20 @@ AC_ARG_ENABLE(multithreading,
 AC_SUBST(enablemultithreading)
 
 
+dnl Adjust compiler parameters if multithreading is desired:
+dnl - Use the right -threads/-pthread/-mthread option
+dnl - Set preprocessor directives if necessary
+dnl - __USE_MALLOC tells gcc to use thread safe STL allocators
+if test $enablemultithreading = yes ; then
+  DEAL_II_GET_THREAD_FLAGS
+  DEAL_II_THREAD_CPPFLAGS
+
+  CXXFLAGSG="$CXXFLAGSG -D__USE_MALLOC"
+  CXXFLAGSO="$CXXFLAGSO -D__USE_MALLOC"
+fi
+
+
+
 dnl    Test whether the user wants the multithread code in the 
 dnl    library to be used
 AC_ARG_WITH(multithreading,
@@ -105,6 +176,9 @@ if test $withmultithreading != no ; then
     AC_MSG_RESULT(not found)
     AC_MSG_ERROR(Invalid ACE path)
   fi
+
+  CXXFLAGSG="$CXXFLAGSG -DDEAL_II_USE_MT"
+  CXXFLAGSO="$CXXFLAGSO -DDEAL_II_USE_MT"
 fi
 AC_SUBST(withmultithreading)
 
@@ -120,12 +194,45 @@ AC_ARG_ENABLE(shared,
     enableshared=$enableval,
     enableshared=yes)
 
+dnl On AIX and alpha, shared libs don't work for us at present, so 
+dnl disable them (we should probably use libtool there)
+case "$target" in
+   *-aix* | alpha*-linux* ) 
+          AC_MSG_WARN(Shared libraries not supported on $target. Using static libs instead)
+          enableshared=no 
+          ;;
+esac
+
+
+dnl Set compile flags accordingly
+if test $enableshared = yes ; then
+  AC_MSG_RESULT(Configuring for shared libraries)
+  CXXFLAGSG="$CXXFLAGSG -fPIC"
+  CXXFLAGSO="$CXXFLAGSO -fPIC"
+
+  lib_suffix=.so;
+else
+  AC_MSG_RESULT(Configuring for static libraries)
+
+  lib_suffix=.a;
+fi
+
+
+AC_SUBST(enableshared)
+AC_SUBST(lib_suffix)
+
+
+
+
 dnl -------------------------------------------------------------
 dnl Multigrid
 dnl -------------------------------------------------------------
 
 dnl    Test if multigrid should be enabled
 dnl    default is no
+dnl
+dnl    ??Is this still the present state??
+dnl
 AC_ARG_ENABLE(multigrid,
 [  --enable-multigrid Include multigrid code in library],
     enablemultigrid=$enableval,
@@ -188,49 +295,62 @@ else
 fi
 AC_SUBST(docxx)
 
+
+
+
 dnl -------------------------------------------------------------
-dnl Check for operating system
+dnl Check for specific machine types
 dnl -------------------------------------------------------------
 
 case "$target" in
+   dnl On Alpha, there was an internal compiler error in exceptions.h.
+   dnl Disable "throw" for this platform
+   alpha*-linux*)
+       CXXFLAGSG="$CXXFLAGSG  -DNO_THROW"
+       CXXFLAGSO="$CXXFLAGSO  -DNO_THROW"
+       ;;
+esac
 
-   dnl This line should be replaced by proper handling of conditions in configure
-   dnl Right now Make.global_options needs this definition.
 
-   *-linux*) OS=Linux;;
 
-   dnl AIX does not allow shared libraries
 
-   *-aix*) enableshared=no ;;
-esac
 
-dnl -------------------------------------------------------------
-dnl Check for specific machine types
-dnl -------------------------------------------------------------
 
-case "$target" in
-   alpha*-linux*) throw_opt=-DNO_THROW enableshared=no ;;
-esac
 
 dnl -------------------------------------------------------------
-dnl Adjust option settings for OS / machine
+dnl Last check: test whether CXXFLAGS are ok
 dnl -------------------------------------------------------------
+AC_MSG_CHECKING(for consistency of CXXFLAGSG flags)
+CXXFLAGS="$CXXFLAGSG"
+AC_TRY_COMPILE(
+  [],
+  [;],
+  [
+    AC_MSG_RESULT(yes)
+  ],
+  [
+    AC_MSG_ERROR(invalid combination of flags!)
+    exit 1;
+  ])
+
+AC_MSG_CHECKING(for consistency of CXXFLAGSO flags)
+CXXFLAGS="$CXXFLAGSO"
+AC_TRY_COMPILE(
+  [],
+  [;],
+  [
+    AC_MSG_RESULT(yes)
+  ],
+  [
+    AC_MSG_ERROR(invalid combination of flags!)
+    exit 1;
+  ])
+
+
+
+
 
-if test $enableshared = yes ; then
-  AC_MSG_RESULT(Configuring shared libraries)
-  shared_libs=-fPIC;
-  lib_suffix=.so;
-else
-  AC_MSG_RESULT(Configuring static libraries)
-  shared_libs='';
-  lib_suffix=.a;
-fi
 
-AC_SUBST(OS)
-AC_SUBST(enableshared)
-AC_SUBST(shared_libs)
-AC_SUBST(lib_suffix)
-AC_SUBST(throw_opt)
 
 dnl -------------------------------------------------------------
 dnl Configure other packages

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.