]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added a new flag to the Makesystem in order to support dynamic libs
authoroliver <oliver@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 20 Oct 2005 20:09:58 +0000 (20:09 +0000)
committeroliver <oliver@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 20 Oct 2005 20:09:58 +0000 (20:09 +0000)
also on OSX, which uses a slightly different method. Furthermore
a compiler bug in the Apple gcc3.3 version made two minor changes
in the source code necessary.

git-svn-id: https://svn.dealii.org/trunk@11634 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/Makefile
deal.II/common/Make.global_options.in
deal.II/configure.in
deal.II/deal.II/Makefile
deal.II/deal.II/source/grid/tria_accessor.cc
deal.II/lac/Makefile
deal.II/lac/source/block_sparsity_pattern.cc

index 7fe922c948d173422cac6339b2bcec53bde96395..951601f9493250b0525c83c65ef256200d869560 100644 (file)
@@ -57,11 +57,11 @@ $(LIBDIR)/libbase.g$(static-lib-suffix): $(go-files)
 
 $(LIBDIR)/libbase$(shared-lib-suffix): $(o-files)
        @echo "=====base=============optimized==$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files) $(extra-o-files)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(o-files) $(extra-o-files)
 
 $(LIBDIR)/libbase.g$(shared-lib-suffix): $(go-files)
        @echo "=====base=============debug======$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files) $(extra-o-files)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(go-files) $(extra-o-files)
 
 
 
index b2daa43f385cb186fc3f9cbeb3af9138134b2684..36bec09c6731129f5edb0ba9389393c9dba111d5 100644 (file)
@@ -29,6 +29,7 @@ GXX-VERSION-DETAILED = @GXX_VERSION_DETAILED@
 CC                   = @CC@
 CC-VERSION           = @CC_VERSION@
 SHLIBLD              = @SHLIBLD@
+SHLIBFLAGS           = @SHLIBFLAGS@
 AR                   = @AR@
 RANLIB               = @RANLIB@
 LDFLAGS              = @LDFLAGS@
index e88129236f16e9f5b3a634a71c68223a1a247f1a..752d8790a2c8e30714b574aabbdc21819ece9d9f 100644 (file)
@@ -116,6 +116,7 @@ AC_SUBST(CXXFLAGSG)
 AC_SUBST(CXXFLAGSO)
 AC_SUBST(CXXFLAGSPIC)
 AC_SUBST(SHLIBLD)
+AC_SUBST(SHLIBFLAGS)
 AC_SUBST(OBJEXT)
 AC_SUBST(EXEEXT)
 
@@ -270,7 +271,7 @@ shared_lib_suffix=".so"
 static_lib_suffix=".a"
 
 case "$target" in
-   *-aix4* | alpha*-linux* | alpha*-osf[45]* | powerpc-apple-darwin* | hppa64-unknown-linux-gnu )
+   *-aix4* | alpha*-linux* | alpha*-osf[45]* | hppa64-unknown-linux-gnu )
           AC_MSG_WARN(Shared libraries not supported on $target. Using static libs instead)
           enableshared=no 
           ;;
@@ -283,12 +284,31 @@ case "$target" in
            ;;
 esac  
 
+
+dnl TODO Maybe the major version number should be inserted before .dylib 
+dnl (.5.dylib for example).
+case "$target" in
+   powerpc-apple-darwin* )
+           shared_lib_suffix=".dylib"
+           darwin_shared_lib="yes"
+           ;;
+esac  
+
+
 if test "x$enableshared" = "xyes" ; then
   CFLAGS="$CFLAGS $CFLAGSPIC"
   CXXFLAGSG="$CXXFLAGSG $CXXFLAGSPIC"
   CXXFLAGSO="$CXXFLAGSO $CXXFLAGSPIC"
   F77FLAGSG="$F77FLAGSG $F77FLAGSPIC"
   F77FLAGSO="$F77FLAGSO $F77FLAGSPIC"
+  SHLIBFLAGS="-shared"
+
+  case "$target" in
+    powerpc-apple-darwin* )
+       SHLIBFLAGS="-dynamiclib"
+          ;;
+  esac
+
 else
 dnl The gcc compiler needs -static for static linking. For the case
 dnl other compilers do not like this flag we should introduce a
@@ -692,6 +712,14 @@ if test "x$cygwin_shared_lib" = "xyes" ; then
   echo "     executing your programs."
 fi
 
+if test "x$darwin_shared_lib" = "xyes" ; then
+  echo "     Please add the line"
+  echo "        export DYLD_LIBRARY_PATH=\$DYLD_LIBRARY_PATH:$DEAL2_DIR/lib"
+  echo "     to your .bash_profile file so that OSX will be"
+  echo "     able to find the deal.II shared libraries when"
+  echo "     executing your programs."
+fi
+
 if test "x$doxygen_not_found" = "xyes" ; then
   echo "     WARNING: During configuration, no version of the doxygen"
   echo "     WARNING: documentation generation program could be found."
index 316e5f7547cf2aacb5cd5c9568f4d5e32ad7790a..2b5653fde08e7ebb191c11cab623c702e56ad5a9 100644 (file)
@@ -125,29 +125,29 @@ $(LIBDIR)/libdeal_II_3d$(static-lib-suffix): $(o-files-3d)
 
 $(LIBDIR)/libdeal_II_1d.g$(shared-lib-suffix): $(go-files-1d)
        @echo "=====deal.II====1d====debug======$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files-1d) $(deplibs.g)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(go-files-1d) $(deplibs.g)
 
 $(LIBDIR)/libdeal_II_1d$(shared-lib-suffix): $(o-files-1d)
        @echo "=====deal.II====1d====optimized==$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files-1d) $(deplibs.o)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(o-files-1d) $(deplibs.o)
 
 
 $(LIBDIR)/libdeal_II_2d.g$(shared-lib-suffix): $(go-files-2d)
        @echo "=====deal.II====2d====debug======$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files-2d) $(deplibs.g)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(go-files-2d) $(deplibs.g)
 
 $(LIBDIR)/libdeal_II_2d$(shared-lib-suffix): $(o-files-2d)
        @echo "=====deal.II====2d====optimized==$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files-2d) $(deplibs.o)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(o-files-2d) $(deplibs.o)
 
 
 $(LIBDIR)/libdeal_II_3d.g$(shared-lib-suffix): $(go-files-3d)
        @echo "=====deal.II====3d====debug======$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files-3d) $(deplibs.g)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(go-files-3d) $(deplibs.g)
 
 $(LIBDIR)/libdeal_II_3d$(shared-lib-suffix): $(o-files-3d)
        @echo "=====deal.II====3d====optimized==$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files-3d) $(deplibs.o)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(o-files-3d) $(deplibs.o)
 
 
 
index 396bfe22974476268fb08b30569f88e2ba911352..96bfc5c16715cc5c51cf005f4669201d1b98e06d 100644 (file)
 
 #include <cmath>
 
+// Remark: The following explicit instantiations needed to be moved to
+// this place here to work around a problem with gcc3.3 on Apple MacOSX.
+// The reason is that some of the functions instantiated here are used
+// further down; if they are not explicitly instantiated here, then the
+// compiler will do an implicit instantiation and give it internal linkage
+// (despite the later explicit instantiation that should make sure it
+// gets external linkage). To make sure the functions have external
+// linkage, we need to place the explicit instantiation before the first
+// use.
+//
+// For more information, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24331
+// +++++++++++++
+
+
+template class TriaObjectAccessor<1, deal_II_dimension>;
+
+#if deal_II_dimension >= 2
+template class TriaObjectAccessor<2, deal_II_dimension>;
+#endif
+
+#if deal_II_dimension >= 3
+template class TriaObjectAccessor<3, deal_II_dimension>;
+#endif
+
 
 /*------------------------ Functions: LineAccessor ---------------------------*/
 
@@ -2183,10 +2207,13 @@ neighbor_child_on_subface (const unsigned int face,
 #endif
 
 
+// Remark: The explicit instantiations for "TriaObjectAccessor" were moved
+// to the top of this source file. The reason is a slightly buggy version
+// of the Apple gcc v.3.3.
+// For more information, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24331
 
 // explicit instantiations
 template class TriaAccessor<deal_II_dimension>;
-template class TriaObjectAccessor<1, deal_II_dimension>;
 template class CellAccessor<deal_II_dimension>;
 template class TriaRawIterator<deal_II_dimension,TriaObjectAccessor<1, deal_II_dimension> >;
 template class TriaRawIterator<deal_II_dimension,CellAccessor<deal_II_dimension> >;
@@ -2196,14 +2223,12 @@ template class TriaActiveIterator<deal_II_dimension,TriaObjectAccessor<1, deal_I
 template class TriaActiveIterator<deal_II_dimension,CellAccessor<deal_II_dimension> >;
 
 #if deal_II_dimension >= 2
-template class TriaObjectAccessor<2, deal_II_dimension>;
 template class TriaRawIterator<deal_II_dimension,TriaObjectAccessor<2, deal_II_dimension> >;
 template class TriaIterator<deal_II_dimension,TriaObjectAccessor<2, deal_II_dimension> >;
 template class TriaActiveIterator<deal_II_dimension,TriaObjectAccessor<2, deal_II_dimension> >;
 #endif
 
 #if deal_II_dimension >= 3
-template class TriaObjectAccessor<3, deal_II_dimension>;
 template class TriaRawIterator<deal_II_dimension,TriaObjectAccessor<3, deal_II_dimension> >;
 template class TriaIterator<deal_II_dimension,TriaObjectAccessor<3, deal_II_dimension> >;
 template class TriaActiveIterator<deal_II_dimension,TriaObjectAccessor<3, deal_II_dimension> >;
index 3a4ddbedbfe3491896305e037d515651b431b2e9..7d8c45910e43c1d51dab38c057bf8cf1e0e0eb12 100644 (file)
@@ -89,12 +89,11 @@ $(LIBDIR)/liblac.g$(static-lib-suffix): $(go-files)
 
 $(LIBDIR)/liblac$(shared-lib-suffix): $(o-files)
        @echo "=====lac==============optimized==$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files) $(deplibs.o)
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(o-files) $(deplibs.o)
 
 $(LIBDIR)/liblac.g$(shared-lib-suffix): $(go-files)
        @echo "=====lac==============debug======$(MT)== Linking library:   $(@F)"
-       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files) $(deplibs.g)
-
+       @$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $@ $(go-files) $(deplibs.g)
 
 
 clean:
index 06b63a7155517145cf644cfd58d69830dd37a060..7fb3c57a506dcfe765a19188048c4ea800125528 100644 (file)
 #include <lac/block_sparsity_pattern.h>
 
 
+// Remark: The following explicit instantiations needed to be moved to
+// this place here to work around a problem with gcc3.3 on Apple MacOSX.
+// The reason is that some of the functions instantiated here are used
+// further down; if they are not explicitly instantiated here, then the
+// compiler will do an implicit instantiation and give it internal linkage
+// (despite the later explicit instantiation that should make sure it
+// gets external linkage). To make sure the functions have external
+// linkage, we need to place the explicit instantiation before the first
+// use.
+//
+// For more information, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24331
+// +++++++++++++
+
+
+template class BlockSparsityPatternBase<SparsityPattern>;
+template class BlockSparsityPatternBase<CompressedSparsityPattern>;
+
 
 template <class SparsityPatternBase>
 BlockSparsityPatternBase<SparsityPatternBase>::BlockSparsityPatternBase ()
@@ -340,7 +357,7 @@ CompressedBlockSparsityPattern (const unsigned int n_rows,
 {}
 
 
-
-// explicit instantiations
-template class BlockSparsityPatternBase<SparsityPattern>;
-template class BlockSparsityPatternBase<CompressedSparsityPattern>;
+// Remark: The explicit instantiations for "BlockSparsityPatternBase" were moved
+// to the top of this source file. The reason is a slightly buggy version
+// of the Apple gcc v.3.3.
+// For more information, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24331

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.