]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Linking shared libraries should usually be done using the C++ compiler rather than...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Jun 2002 08:04:16 +0000 (08:04 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Jun 2002 08:04:16 +0000 (08:04 +0000)
git-svn-id: https://svn.dealii.org/trunk@6112 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
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/development/Makefile
deal.II/doc/development/makefiles.1.html
deal.II/lac/Makefile

index ceb3a34db74d0222d9b7a70058f32274e7ac0fca..13f9cc630c11e89f7f85e7422a811d8c539893a9 100644 (file)
@@ -256,9 +256,21 @@ AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl
     if test "x$DEAL_II_ADVANCE_WARNING" = "xyes" ; then
       CXXFLAGSG="`echo $CXXFLAGSG | perl -pi -e 's/-W //g;'`"
     fi
+
+    dnl In order to link shared libraries, almost all versions of gcc can
+    dnl use CXX, i.e. the C++ compiler. The exception is gcc2.95, for which
+    dnl we have to use the C compiler, unless we want to get linker errors
+    SHLIBLD="$CXX"
+    if test "$GXX_VERSION" = "gcc2.95"; then
+      SHLIBLD="$CC"
+    fi
   
   else
-    dnl Non-gcc compilers
+    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)
index 7c6557013093e04eb897004c98a3f9333f5dbafc..baa1342d462cb44c1ac75f59e5a2410e9b4283d1 100644 (file)
@@ -89,11 +89,11 @@ $(LIBDIR)/libbase.g.a: $(go-files)
 
 $(LIBDIR)/libbase.so: $(o-files)
        @echo "=====base=============optimized==$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(o-files)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files)
 
 $(LIBDIR)/libbase.g.so: $(go-files)
        @echo "=====base=============debug======$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(go-files)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files)
 
 
 
index 98b9d30787be06561a8c579810f52116ad39776d..dc9e4c3df58b82c119f10083719b2505ef78d389 100644 (file)
@@ -22,6 +22,7 @@ D                    = @DEAL2_DIR@
 CC                   = @CC@
 CXX                  = @CXX@
 GXX-VERSION          = @GXX_VERSION@
+SHLIBLD              = @SHLIBLD@
 LDFLAGS              = @LDFLAGS@
 F77                  = @F77@
 F77-VERSION          = @F77_VERSION@
index 3bb2d788c8c206374c846d5344b0f1ddf4c066a4..a02da72747033a6a022a8d3dc4cfa37704b348f0 100755 (executable)
@@ -2834,7 +2834,13 @@ rm -f conftest.$ac_objext conftest.$ac_ext
       CXXFLAGSG="`echo $CXXFLAGSG | perl -pi -e 's/-W //g;'`"
     fi
 
+                SHLIBLD="$CXX"
+    if test "$GXX_VERSION" = "gcc2.95"; then
+      SHLIBLD="$CC"
+    fi
+
   else
+                    SHLIBLD="$CXX"
 
     case "$GXX_VERSION" in
       ibm_xlc)
@@ -3018,6 +3024,7 @@ echo "${ECHO_T}yes" >&6
 
 
 
+
   # Check whether --enable-multithreading or --disable-multithreading was given.
 if test "${enable_multithreading+set}" = set; then
   enableval="$enable_multithreading"
@@ -6952,6 +6959,7 @@ s,@GXX_VERSION@,$GXX_VERSION,;t t
 s,@CXXFLAGSG@,$CXXFLAGSG,;t t
 s,@CXXFLAGSO@,$CXXFLAGSO,;t t
 s,@CXXFLAGSPIC@,$CXXFLAGSPIC,;t t
+s,@SHLIBLD@,$SHLIBLD,;t t
 s,@LDFLAGSPIC@,$LDFLAGSPIC,;t t
 s,@enablemultithreading@,$enablemultithreading,;t t
 s,@withmultithreading@,$withmultithreading,;t t
index a22cda94f2e64bb905a177bee9f55c8f20cf4689..9f31b0045ca4eba422ce607570a6c4c463a32b06 100644 (file)
@@ -106,6 +106,7 @@ AC_SUBST(GXX_VERSION)
 AC_SUBST(CXXFLAGSG)
 AC_SUBST(CXXFLAGSO)
 AC_SUBST(CXXFLAGSPIC)
+AC_SUBST(SHLIBLD)
 AC_SUBST(LIBS)
 AC_SUBST(LDFLAGS)
 AC_SUBST(LDFLAGSPIC)
index ec1d60fccaf41f6186c525967e5ce822c3514318..2a8ac960d7322067982d6cd584a4bedbc6c47d8c 100644 (file)
@@ -119,29 +119,29 @@ $(LIBDIR)/libdeal_II_3d.a: $(o-files-3d)
 
 $(LIBDIR)/libdeal_II_1d.g.so: $(go-files-1d)
        @echo "=====deal.II====1d====debug======$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(go-files-1d)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files-1d)
 
 $(LIBDIR)/libdeal_II_1d.so: $(o-files-1d)
        @echo "=====deal.II====1d====optimized==$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(o-files-1d)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files-1d)
 
 
 $(LIBDIR)/libdeal_II_2d.g.so: $(go-files-2d)
        @echo "=====deal.II====2d====debug======$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(go-files-2d)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files-2d)
 
 $(LIBDIR)/libdeal_II_2d.so: $(o-files-2d)
        @echo "=====deal.II====2d====optimized==$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(o-files-2d)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files-2d)
 
 
 $(LIBDIR)/libdeal_II_3d.g.so: $(go-files-3d)
        @echo "=====deal.II====3d====debug======$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(go-files-3d)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files-3d)
 
 $(LIBDIR)/libdeal_II_3d.so: $(o-files-3d)
        @echo "=====deal.II====3d====optimized==$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(o-files-3d)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files-3d)
 
 
 
index e7d96bac5fb8d3b56d16a6280ae4d463921a7e82..80639e119cd9170c8b9ab7b980c8c13675d9f446 100644 (file)
@@ -16,6 +16,7 @@ makefiles.html: Makefile makefiles.1.html $D/common/Make.global_options makefile
        @echo '<li><code>GXX-VERSION=$(GXX-VERSION)</code>' >> $@
        @echo '<li><code>F77=$(F77)</code>' >> $@
        @echo '<li><code>F77-VERSION=$(F77-VERSION)</code>' >> $@
+       @echo '<li><code>SHLIBLD=$(SHLIBLD)</code>' >> $@
        @echo '<li><code>PERL=$(PERL)</code>' >> $@
        @echo '<li><code>DEAL_II_MAJOR=$(DEAL_II_MAJOR)</code>' >> $@
        @echo '<li><code>DEAL_II_MINOR=$(DEAL_II_MINOR)</code>' >> $@
index 08bf31075b7281ab5539e3577ba1fb0487c185a4..4f6b10b404d1c1bbd656d01d546839acd382829a 100644 (file)
       </dd>
 
 
+      <dt> <code>SHLIBLD</code> </dt>
+      <dd> <p>
+           Executable name of compiler that is used to link object
+           files to shared libraries. This will usually be the C++
+           compiler, but as this does not work for gcc 2.95, it is the
+           C compiler in that case.
+           </p>
+      </dd>
+
+
       <dt> <code>PERL</code> </dt>
       <dd> <p>
            Executable name of the `perl' program
index e111fa0262c797e2cff0232910b40269e07017cc..4726750f1653e20aeeaf9f7821bf391302c4c3fe 100644 (file)
@@ -62,11 +62,11 @@ $(LIBDIR)/liblac.g.a: $(go-files)
 
 $(LIBDIR)/liblac.so: $(o-files)
        @echo "=====lac==============optimized==$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(o-files)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(o-files)
 
 $(LIBDIR)/liblac.g.so: $(go-files)
        @echo "=====lac==============debug======$(MT)== Linking library:   $(@F)"
-       @$(CXX) $(LDFLAGS) -shared -o $@ $(go-files)
+       @$(SHLIBLD) $(LDFLAGS) -shared -o $@ $(go-files)
 
 
 

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.