]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Support for shared libraries.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 26 Jan 2000 15:40:23 +0000 (15:40 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 26 Jan 2000 15:40:23 +0000 (15:40 +0000)
git-svn-id: https://svn.dealii.org/trunk@2268 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/Makefile
deal.II/common/Make.global_options.in
deal.II/configure
deal.II/configure.in
deal.II/deal.II/Makefile
deal.II/doc/readme.html
deal.II/lac/Makefile

index fbc9ce7527e097533d5174ac29392bf000293fa4..dde509afa8adb197c839ede7b2717c89c1f365a5 100644 (file)
@@ -60,8 +60,14 @@ lib/o/%.o :
 
 
 # rules
-lib: lib/libbase.g.a lib/libbase.a
-libg: lib/libbase.g.a
+ifeq ($(enable-shared),yes)
+  lib: lib/libbase.g.so lib/libbase.so
+  libg: lib/libbase.g.so
+else
+  lib: lib/libbase.g.a lib/libbase.a
+  libg: lib/libbase.g.a
+endif
+
 
 lib/libbase.a: $(forward-declarations) $(o-files)
        @echo =====base=============debug========= Updating library:   $@
@@ -72,6 +78,17 @@ lib/libbase.g.a: $(forward-declarations) $(go-files)
        @ar ruv $@ $(go-files)
 
 
+lib/libbase.so: $(forward-declarations) $(o-files)
+       @echo =====base=============optimized===== Updating library:   $@
+       @$(CC) $(CXXFLAGS.o) -shared -o $@ $(o-files)
+
+lib/libbase.g.so: $(forward-declarations) $(go-files)
+       @echo =====base=============debug========= Updating library:   $@
+       @$(CC) $(CXXFLAGS.g) -shared -o $@ $(go-files)
+
+
+
+
 clean:
        -rm -f *~ include/*~ include/*/*~ lib/lib* lib/o/*.o lib/go/*.go \
                include/base/forward_declarations.h* lib/Makefile.dep
index e67da36c089b8f659b3a6602a7883afb29dafb5f..c23c2ebf62affa75e5033ce3b129618e58d31c49 100644 (file)
@@ -8,26 +8,58 @@
 # to libraries. The following symbols defined in this file may be of
 # interest:
 #
-# CXX                -- path and filename of the compiler
-# PERL               -- path and filename of the 'perl' program
 #
-# lib-path-base      -- path to the library files of the /base library
-# lib-path-lac       -- same for the /lac library
-# lib-path-deal2     -- same for the /deal.II library
-# LIBPATH            -- all the library pathes prefixed by -L, i.e. the
-#                       flags needed by the compiler to find the libraries
-#                       when they are linked in using -lbase -llac -ldeal_II_2d
-#                       (for example). These -L paths are appended to what
-#                       was in $(LIBPATH) before
+# General
+# -------
+#   CXX                -- executable name of the C++ compiler
+#   CC                 -- executable name of the C compiler, which
+#                         is used to generate shared libraries
+#   PERL               -- executable name of the 'perl' program
 #
-# include-path-base  -- same as for lib-path-base, but contains the paths
-#                       to the include files of the /base library
-# include-path-lac   -- same for the /lac library
-# include-path-deal2 -- same for the /deal.II library
-# INCLUDE            -- all the include pathes prefixed by -I
 #
-# CXXFLAGS.g         -- compiler flags for debug mode
-# CXXFLAGS.o         -- compiler flags for optimized mode
+# Paths to libraries
+# -------------------
+#   lib-path-base      -- path to the library files of the /base library
+#   lib-path-lac       -- same for the /lac library
+#   lib-path-deal2     -- same for the /deal.II library
+#   LIBPATH            -- all the library pathes prefixed by -L, i.e. the
+#                         flags needed by the compiler to find the libraries
+#                         when they are linked in using -lbase -llac -ldeal_II_2d
+#                         (for example). These -L paths are appended to what
+#                         was in $(LIBPATH) before
+#
+#
+# Paths and filenames of libraries
+# --------------------------------
+#   lib-base.o         -- path and filename of the base library in optimized
+#                         mode. depending on whether shared libraries were
+#                         or were not enabled, the suffix of the value of this
+#                         variable is either .so or .a
+#   lib-base.g         -- same, for the library in debug mode
+#
+#   lib-lac.o          -- same for the lac libraries
+#   lib-lac.g 
+#
+#   lib-deal2-1d.o lib-deal2-1d.g  -- same for the deal.II libraries in the various
+#   lib-deal2-2d.o lib-deal2-2d.g     dimensions
+#   lib-deal2-3d.o lib-deal2-3d.g
+#
+#
+#
+# Pathes to include files
+# -----------------------
+#   include-path-base  -- same as for lib-path-base, but contains the paths
+#                         to the include files of the /base library
+#   include-path-lac   -- same for the /lac library
+#   include-path-deal2 -- same for the /deal.II library
+#   INCLUDE            -- all the include pathes prefixed by -I
+#
+#
+# Compiler flags
+# --------------
+#   CXXFLAGS.g         -- compiler flags for debug mode
+#   CXXFLAGS.o         -- compiler flags for optimized mode
+#
 #
 #
 # If --with-multithreading was given to ./configure, $(INCLUDE) and
 # of ./configure
 
 D                    = @DEAL2_DIR@
+CC                   = @CC@
 CXX                  = @CXX@
 GXX-VERSION          = @GXX_VERSION@
 OS                   = @OS@
 PERL                 = @PERL@
 enable-multithreading= @enablemultithreading@
 with-multithreading  = @withmultithreading@
-
+enable-shared        = @enableshared@
 
 
 ######################################################
@@ -78,6 +111,27 @@ vpath %.a $(lib-path-base)
 vpath %.a $(lib-path-lac)
 vpath %.a $(lib-path-deal2)
 
+ifeq ($(enable-shared),yes)
+  lib-suffix = .so
+else
+  lib-suffix = .a
+endif
+
+
+lib-base.o     = $(lib-path-base)/libbase$(lib-suffix)
+lib-base.g     = $(lib-path-base)/libbase.g$(lib-suffix)
+
+lib-lac.o      = $(lib-path-lac)/liblac$(lib-suffix)
+lib-lac.g      = $(lib-path-lac)/liblac.g$(lib-suffix)
+
+lib-deal2-1d.o = $(lib-path-deal2)/libdeal_II_1d$(lib-suffix)
+lib-deal2-2d.o = $(lib-path-deal2)/libdeal_II_2d$(lib-suffix)
+lib-deal2-3d.o = $(lib-path-deal2)/libdeal_II_3d$(lib-suffix)
+
+lib-deal2-1d.g = $(lib-path-deal2)/libdeal_II_1d.g$(lib-suffix)
+lib-deal2-2d.g = $(lib-path-deal2)/libdeal_II_2d.g$(lib-suffix)
+lib-deal2-3d.g = $(lib-path-deal2)/libdeal_II_3d.g$(lib-suffix)
+
 
 # include paths. add library paths to existing variable
 
@@ -145,3 +199,8 @@ ifneq ($(with-multithreading),no)
   vpath %.a $(ACE_ROOT)
 endif
 
+
+ifeq ($(enable-shared),yes)
+  CXXFLAGS.g += -fPIC
+  CXXFLAGS.o += -fPIC
+endif
index 77d867ddf133d91ef52de2f6855cfe109e5857d9..ca43cd6346cd801d014b375767520d870234ed28 100755 (executable)
@@ -15,6 +15,8 @@ ac_help="$ac_help
   --enable-multithreading Set compiler flags to allow for multithreaded programs"
 ac_help="$ac_help
   --with-multithreading=DIR use DIR as path to the ACE library"
+ac_help="$ac_help
+  --enable-shared Set compiler flags to generate shared libraries"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -524,12 +526,236 @@ DEAL2_DIR=`pwd`
 
 
 
+# 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:533: 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
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+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:563: 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
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+       continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # 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:614: 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
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:646: 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.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 657 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:662: \"$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
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+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:688: 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:693: 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
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:702: \"$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
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+
+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:721: 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
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+
+
+
 for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
 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:533: checking for $ac_word" >&5
+echo "configure:759: 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
@@ -561,7 +787,7 @@ test -n "$CXX" || CXX="gcc"
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:565: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:791: 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.
@@ -572,12 +798,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 576 "configure"
+#line 802 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:807: \"$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
@@ -603,12 +829,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:607: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:833: 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:612: checking whether we are using GNU C++" >&5
+echo "configure:838: 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
@@ -617,7 +843,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:621: \"$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:847: \"$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
@@ -636,7 +862,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:640: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:866: 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
@@ -678,7 +904,7 @@ if test $GXX = yes ; then
       echo "$ac_t""Compiler is gcc-2.95" 1>&6
       GXX_VERSION=gcc2.95
     else
-      echo "$ac_t""Compiler is unknown and accepted" 1>&6
+      echo "$ac_t""Compiler is unknown but accepted" 1>&6
       GXX_VERSION=other
     fi
   fi
@@ -698,7 +924,7 @@ OS=`uname`
 # 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:702: checking for $ac_word" >&5
+echo "configure:928: 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
@@ -753,7 +979,7 @@ fi
 
 if test $withmultithreading != no ; then
   echo $ac_n "checking checking for ACE""... $ac_c" 1>&6
-echo "configure:757: checking checking for ACE" >&5
+echo "configure:983: checking checking for ACE" >&5
   if test -d $withmultithreading ; then
     echo "$ac_t""found" 1>&6
   else
@@ -764,6 +990,24 @@ fi
 
 
 
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  enableshared=$enableval
+else
+  enableshared=yes
+fi
+
+if test $enableshared = yes ; then
+   echo "$ac_t""Configuring deal.II for shared libraries" 1>&6
+else
+   echo "$ac_t""Configuring deal.II for statically linked libraries" 1>&6
+fi
+
+
+
+
 trap '' 1 2 15
 
 trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
@@ -863,12 +1107,14 @@ s%@oldincludedir@%$oldincludedir%g
 s%@infodir@%$infodir%g
 s%@mandir@%$mandir%g
 s%@DEAL2_DIR@%$DEAL2_DIR%g
+s%@CC@%$CC%g
 s%@CXX@%$CXX%g
 s%@GXX_VERSION@%$GXX_VERSION%g
 s%@OS@%$OS%g
 s%@PERL@%$PERL%g
 s%@enablemultithreading@%$enablemultithreading%g
 s%@withmultithreading@%$withmultithreading%g
+s%@enableshared@%$enableshared%g
 
 CEOF
 EOF
index f0e4ceb8ae42d39844d8054c95adc77e7b8fc328..74b8cbd505a6d15e4baa8cb9891c29664a6efe32 100644 (file)
@@ -19,6 +19,11 @@ DEAL2_DIR=`pwd`
 AC_SUBST(DEAL2_DIR)
 
 
+dnl    Find a C compiler, which is used when building
+dnl    shared libaries. This modifies the variable CC
+AC_PROG_CC
+
+
 dnl    Find the right C++ compiler. This modifies the following
 dnl    variables: CXX, GXX, CXXFLAGS
 AC_PROG_CXX
@@ -83,6 +88,22 @@ fi
 AC_SUBST(withmultithreading)
 
 
+
+dnl    Test whether shared libraries support is requested. Note:
+dnl    default is 'yes'
+AC_ARG_ENABLE(shared,
+[  --enable-shared Set compiler flags to generate shared libraries],
+    enableshared=$enableval,
+    enableshared=yes)
+if test $enableshared = yes ; then
+   AC_MSG_RESULT(Configuring deal.II for shared libraries)
+else
+   AC_MSG_RESULT(Configuring deal.II for statically linked libraries)
+fi
+AC_SUBST(enableshared)
+
+
+
 dnl    Write output to the global options file
 AC_OUTPUT(common/Make.global_options)
 
index 5f92bd7f32b44d54c76313a86f8e6b0f3f43ef59..b87e17cd31640e84c685d8d277dc264bdd8e1022 100644 (file)
@@ -9,12 +9,21 @@ D=..
 # top level targets
 default: 2dg 2d
 
-1dg: lib/libdeal_II_1d.g.a 
-1d : lib/libdeal_II_1d.a
-2dg: lib/libdeal_II_2d.g.a 
-2d : lib/libdeal_II_2d.a
-3dg: lib/libdeal_II_3d.g.a 
-3d : lib/libdeal_II_3d.a
+ifeq ($(enable-shared),yes)
+  1dg: lib/libdeal_II_1d.g.so
+  1d : lib/libdeal_II_1d.so
+  2dg: lib/libdeal_II_2d.g.so 
+  2d : lib/libdeal_II_2d.so
+  3dg: lib/libdeal_II_3d.g.so 
+  3d : lib/libdeal_II_3d.so
+else
+  1dg: lib/libdeal_II_1d.g.so
+  1d : lib/libdeal_II_1d.so
+  2dg: lib/libdeal_II_2d.g.so
+  2d : lib/libdeal_II_2d.so
+  3dg: lib/libdeal_II_3d.g.so 
+  3d : lib/libdeal_II_3d.so
+endif
 
 
 # create lists of file names. note that we need several output
@@ -85,6 +94,7 @@ lib/libdeal_II_1d.a: $(o-files-1d)
        @echo =====deal.II====1d====optimized===== Updating library:   $(@F)
        @ar ruv $@ $(o-files-1d)
 
+
 lib/libdeal_II_2d.g.a: $(go-files-2d)
        @echo =====deal.II====2d====debug========= Updating library:   $(@F)
        @ar ruv $@ $(go-files-2d)
@@ -92,6 +102,7 @@ lib/libdeal_II_2d.a: $(o-files-2d)
        @echo =====deal.II====2d====optimized===== Updating library:   $(@F)
        @ar ruv $@ $(o-files-2d)
 
+
 lib/libdeal_II_3d.g.a: $(go-files-3d)
        @echo =====deal.II====3d====debug========= Updating library:   $(@F)
        @ar ruv $@ $(go-files-3d)
@@ -100,6 +111,35 @@ lib/libdeal_II_3d.a: $(o-files-3d)
        @ar ruv $@ $(o-files-3d)
 
 
+lib/libdeal_II_1d.g.so: $(go-files-1d)
+       @echo =====deal.II====1d====debug========= Updating library:   $(@F)
+       @$(CC) $(CXXFLAGS.o) -shared -o $@ $(go-files-1d)
+
+lib/libdeal_II_1d.so: $(o-files-1d)
+       @echo =====deal.II====1d====optimized===== Updating library:   $(@F)
+       @$(CC) $(CXXFLAGS.o) -shared -o $@ $(o-files-1d)
+
+
+lib/libdeal_II_2d.g.so: $(go-files-2d)
+       @echo =====deal.II====2d====debug========= Updating library:   $(@F)
+       @$(CC) $(CXXFLAGS.o) -shared -o $@ $(go-files-2d)
+
+lib/libdeal_II_2d.so: $(o-files-2d)
+       @echo =====deal.II====2d====optimized===== Updating library:   $(@F)
+       @$(CC) $(CXXFLAGS.o) -shared -o $@ $(o-files-2d)
+
+
+lib/libdeal_II_3d.g.so: $(go-files-3d)
+       @echo =====deal.II====3d====debug========= Updating library:   $(@F)
+       @$(CC) $(CXXFLAGS.o) -shared -o $@ $(go-files-3d)
+
+lib/libdeal_II_3d.so: $(o-files-3d)
+       @echo =====deal.II====3d====optimized===== Updating library:   $(@F)
+       @$(CC) $(CXXFLAGS.o) -shared -o $@ $(o-files-3d)
+
+
+
+
 
 #Rule to generate the dependency file. This file is
 #automagically remade whenever needed, i.e. whenever
index 0c357870ba05772b0d15579a2699a5c424e1498b..f3319dd642b1ea9687bd479c0bbabd71102cc912 100644 (file)
 
     You can give several flags to ./configure:
     <ul>
+    <li>
+      <code>--enable-shared</code>: Compile the files of deal.II
+      into shared libraries, rather than statically linked
+      libraries. Enabling this option saves disk space, link time and
+      start-up time, so this is the default. However, some systems
+      might not support shared libraries, in which case you should
+      call ./configure with the parameter
+      <code>--disable-shared</code>. 
+
     <li>
       <code>--enable-multithreading</code>: This sets compiler
       variables such that the resulting program supports
index a3964c0d43ab551b5eeb4f850c74c7da214d53fb..e0613aa77274ca2e1dba52ec19205a6b470cb6d0 100644 (file)
@@ -33,8 +33,15 @@ lib/o/%.o :
 
 
 # rules
-lib: lib/liblac.g.a lib/liblac.a
-libg: lib/liblac.g.a
+ifeq ($(enable-shared),yes)
+  lib: lib/liblac.g.so lib/liblac.so
+  libg: lib/liblac.g.so
+else
+  lib: lib/liblac.g.a lib/liblac.a
+  libg: lib/liblac.g.a
+endif
+
+
 
 lib/liblac.a: $(forward-declarations) $(o-files)
        @echo =====lac==============optimized===== Updating library:   $@
@@ -45,6 +52,16 @@ lib/liblac.g.a: $(forward-declarations) $(go-files)
        @ar ruv $@ $(go-files)
 
 
+lib/liblac.so: $(forward-declarations) $(o-files)
+       @echo =====lac==============optimized===== Updating library:   $@
+       @$(CC) $(CXXFLAGS.o) -shared -o $@ $(o-files)
+
+lib/liblac.g.so: $(forward-declarations) $(go-files)
+       @echo =====lac==============debug========= Updating library:   $@
+       @$(CC) $(CXXFLAGS.g) -shared -o $@ $(go-files)
+
+
+
 clean:
        -rm -f *~ include/*~ include/*/*~ lib/lib* lib/o/*.o lib/go/*.go \
                include/base/forward_declarations.h* lib/Makefile.dep

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.