From: oliver Date: Thu, 20 Oct 2005 20:09:58 +0000 (+0000) Subject: Added a new flag to the Makesystem in order to support dynamic libs X-Git-Tag: v8.0.0~12969 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4b59b6e8deb261cb0a27daeb48bd005efb5fff3;p=dealii.git Added a new flag to the Makesystem in order to support dynamic libs 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 --- diff --git a/deal.II/base/Makefile b/deal.II/base/Makefile index 7fe922c948..951601f949 100644 --- a/deal.II/base/Makefile +++ b/deal.II/base/Makefile @@ -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) diff --git a/deal.II/common/Make.global_options.in b/deal.II/common/Make.global_options.in index b2daa43f38..36bec09c67 100644 --- a/deal.II/common/Make.global_options.in +++ b/deal.II/common/Make.global_options.in @@ -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@ diff --git a/deal.II/configure.in b/deal.II/configure.in index e88129236f..752d8790a2 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -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." diff --git a/deal.II/deal.II/Makefile b/deal.II/deal.II/Makefile index 316e5f7547..2b5653fde0 100644 --- a/deal.II/deal.II/Makefile +++ b/deal.II/deal.II/Makefile @@ -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) diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 396bfe2297..96bfc5c167 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -24,6 +24,30 @@ #include +// 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; -template class TriaObjectAccessor<1, deal_II_dimension>; template class CellAccessor; template class TriaRawIterator >; template class TriaRawIterator >; @@ -2196,14 +2223,12 @@ template class TriaActiveIterator >; #if deal_II_dimension >= 2 -template class TriaObjectAccessor<2, deal_II_dimension>; template class TriaRawIterator >; template class TriaIterator >; template class TriaActiveIterator >; #endif #if deal_II_dimension >= 3 -template class TriaObjectAccessor<3, deal_II_dimension>; template class TriaRawIterator >; template class TriaIterator >; template class TriaActiveIterator >; diff --git a/deal.II/lac/Makefile b/deal.II/lac/Makefile index 3a4ddbedbf..7d8c45910e 100644 --- a/deal.II/lac/Makefile +++ b/deal.II/lac/Makefile @@ -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: diff --git a/deal.II/lac/source/block_sparsity_pattern.cc b/deal.II/lac/source/block_sparsity_pattern.cc index 06b63a7155..7fb3c57a50 100644 --- a/deal.II/lac/source/block_sparsity_pattern.cc +++ b/deal.II/lac/source/block_sparsity_pattern.cc @@ -15,6 +15,23 @@ #include +// 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; +template class BlockSparsityPatternBase; + template BlockSparsityPatternBase::BlockSparsityPatternBase () @@ -340,7 +357,7 @@ CompressedBlockSparsityPattern (const unsigned int n_rows, {} - -// explicit instantiations -template class BlockSparsityPatternBase; -template class BlockSparsityPatternBase; +// 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