]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Centralize PICFLAG configuration
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Mon, 22 Aug 2011 16:54:02 +0000 (16:54 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Mon, 22 Aug 2011 16:54:02 +0000 (16:54 +0000)
config:
* picflag.m4: New file.

gcc:
* configure.ac (GCC_PICFLAG_FOR_TARGET): Call it.
(PICFLAG_FOR_TARGET): Substitute.
* aclocal.m4: Regenerate.
* configure: Regenerate.

gcc/ada:
* gcc-interface/Makefile.in (PICFLAG_FOR_TARGET): New.
(GNATLIBCFLAGS_FOR_C): Replace
TARGET_LIBGCC2_CFLAGS by PICFLAG_FOR_TARGET.
(gnatlib-shared-default, gnatlib-shared-dual-win32)
(gnatlib-shared-win32, gnatlib-shared-darwin, gnatlib-shared)
(gnatlib-sjlj, gnatlib-zcx): Likewise.

libada:
* configure.ac: Include ../config/picflag.m4.
(GCC_PICFLAG): Call it.
Substitute.
* configure: Regenerate.
* Makefile.in (TARGET_LIBGCC2_CFLAGS): Replace by PICFLAG.
(GNATLIBCFLAGS_FOR_C): Replace TARGET_LIBGCC2_CFLAGS by PICFLAG.
(LIBADA_FLAGS_TO_PASS): Pass PICFLAG as PICFLAG_FOR_TARGET.
Don't include $(GCC_DIR)/libgcc.mvars.

libiberty:
* aclocal.m4: Include ../config/picflag.m4.
* configure.ac (GCC_PICFLAG): Call it.
(enable_shared): Clear PICFLAG unless shared.
* configure: Regenerate.

From-SVN: r177967

16 files changed:
config/ChangeLog
config/picflag.m4 [new file with mode: 0644]
gcc/ChangeLog
gcc/aclocal.m4
gcc/ada/ChangeLog
gcc/ada/gcc-interface/Makefile.in
gcc/configure
gcc/configure.ac
libada/ChangeLog
libada/Makefile.in
libada/configure
libada/configure.ac
libiberty/ChangeLog
libiberty/aclocal.m4
libiberty/configure
libiberty/configure.ac

index 90f5238ecbee638e1b605e0f35a514879b58116f..047cdf5f007b8558d5d0ba63b813b528373777c5 100644 (file)
@@ -1,3 +1,7 @@
+2011-08-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * picflag.m4: New file.
+
 2011-07-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * elf.m4 (target_elf): Remove *-netware*.
 2011-07-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * elf.m4 (target_elf): Remove *-netware*.
diff --git a/config/picflag.m4 b/config/picflag.m4
new file mode 100644 (file)
index 0000000..f6f1b44
--- /dev/null
@@ -0,0 +1,95 @@
+# _GCC_PICFLAG(FLAG, DISPATCH)
+# ----------------------------
+# Store PIC flag corresponding to DISPATCH triplet in FLAG.
+# Explit use of -fpic in CFLAGS corresponding to FLAG overrides default.
+AC_DEFUN([_GCC_PICFLAG], [
+
+case "${$2}" in
+    # PIC is the default on some targets or must not be used.
+    *-*-darwin*)
+       # PIC is the default on this platform
+       # Common symbols not allowed in MH_DYLIB files
+       $1=-fno-common
+       ;;
+    alpha*-dec-osf5*)
+       # PIC is the default.
+       ;;
+    hppa*64*-*-hpux*)
+       # PIC is the default for 64-bit PA HP-UX.
+       ;;
+    i[[34567]]86-*-cygwin* | i[[34567]]86-*-mingw* | x86_64-*-mingw*)
+       ;;
+    i[[34567]]86-*-interix3*)
+       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+       # Instead, we relocate shared libraries at runtime.
+       ;;
+    i[[34567]]86-*-nto-qnx*)
+       # QNX uses GNU C++, but need to define -shared option too, otherwise
+       # it will coredump.
+       $1='-fPIC -shared'
+       ;;
+    i[[34567]]86-pc-msdosdjgpp*)
+       # DJGPP does not support shared libraries at all.
+       ;;
+    ia64*-*-hpux*)
+       # On IA64 HP-UX, PIC is the default but the pic flag
+       # sets the default TLS model and affects inlining.
+       $1=-fPIC
+       ;;
+    mips-sgi-irix6*)
+       # PIC is the default.
+       ;;
+    rs6000-ibm-aix* | powerpc-ibm-aix*)
+       # All AIX code is PIC.
+       ;;
+
+    # Some targets support both -fPIC and -fpic, but prefer the latter.
+    # FIXME: Why?
+    i[[34567]]86-*-* | x86_64-*-*)
+       $1=-fpic
+       ;;
+    m68k-*-*)
+       $1=-fpic
+       ;;
+    s390*-*-*)
+       $1=-fpic
+       ;;
+    # FIXME: Override -fPIC default in libgcc only? 
+    sh-*-linux* | sh[[2346lbe]]*-*-linux*)
+       $1=-fpic
+       ;;
+    # FIXME: Simplify to sh*-*-netbsd*?
+    sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
+      sh64-*-netbsd* | sh64l*-*-netbsd*)
+       $1=-fpic
+       ;;
+    # Default to -fPIC unless specified otherwise.
+    *)
+       $1=-fPIC
+       ;;
+esac
+
+# If the user explicitly uses -fpic/-fPIC, keep that.
+case "${m4_bpatsubsts($1, PICFLAG, CFLAGS)}" in
+    *-fpic*)
+       $1=-fpic
+       ;;
+    *-fPIC*)
+       $1=-fPIC
+       ;;
+esac
+])
+
+# GCC_PICFLAG
+# -----------
+# Store host PIC flag in PICFLAG.
+AC_DEFUN([GCC_PICFLAG], [
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  _GCC_PICFLAG([PICFLAG], [host])])
+
+# GCC_PICFLAG_FOR_TARGET
+# ----------------------
+# Store target PIC flag in PICFLAG_FOR_TARGET.
+AC_DEFUN([GCC_PICFLAG_FOR_TARGET], [
+  AC_REQUIRE([AC_CANONICAL_TARGET])
+  _GCC_PICFLAG([PICFLAG_FOR_TARGET], [target])])
index dd5531a702dca2973e8b4bb6b023bb5e4d92a2b1..d11c5ceb70bf9a100a1711d3c3955a9a814de2e5 100644 (file)
@@ -1,3 +1,10 @@
+2011-08-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * configure.ac (GCC_PICFLAG_FOR_TARGET): Call it.
+       (PICFLAG_FOR_TARGET): Substitute.
+       * aclocal.m4: Regenerate.
+       * configure: Regenerate.
+
 2011-08-22  Dodji Seketeli  <dodji@redhat.com>
 
        * c-family/c-pch.c (c_common_read_pch): Re-set line table right
 2011-08-22  Dodji Seketeli  <dodji@redhat.com>
 
        * c-family/c-pch.c (c_common_read_pch): Re-set line table right
index 1b90b2f5ee6603b8cdfed2a2f58b4858542b872b..06028cc051f4d057e0d1e6444cce1a12b33c0fd4 100644 (file)
@@ -114,6 +114,7 @@ m4_include([../config/lib-ld.m4])
 m4_include([../config/lib-link.m4])
 m4_include([../config/lib-prefix.m4])
 m4_include([../config/override.m4])
 m4_include([../config/lib-link.m4])
 m4_include([../config/lib-prefix.m4])
 m4_include([../config/override.m4])
+m4_include([../config/picflag.m4])
 m4_include([../config/progtest.m4])
 m4_include([../config/stdint.m4])
 m4_include([../config/warnings.m4])
 m4_include([../config/progtest.m4])
 m4_include([../config/stdint.m4])
 m4_include([../config/warnings.m4])
index caf588550fe2456fb0172c501dfa5fd56ba73747..4b32ee7c12b80fe36196dafd1da1e9c78aff527f 100644 (file)
@@ -1,3 +1,12 @@
+2011-08-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * gcc-interface/Makefile.in (PICFLAG_FOR_TARGET): New.
+       (GNATLIBCFLAGS_FOR_C): Replace
+       TARGET_LIBGCC2_CFLAGS by PICFLAG_FOR_TARGET.
+       (gnatlib-shared-default, gnatlib-shared-dual-win32)
+       (gnatlib-shared-win32, gnatlib-shared-darwin, gnatlib-shared)
+       (gnatlib-sjlj, gnatlib-zcx): Likewise.
+
 2011-08-07  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/Makefile.in (raise-gcc.o): Fix previous change.
 2011-08-07  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/Makefile.in (raise-gcc.o): Fix previous change.
index 6166001cfa700726101db76e00bb9ea4465d63da..044085592ea35eaaedbc8dfbc123f4a28e04a155 100644 (file)
@@ -111,10 +111,11 @@ NO_SIBLING_ADAFLAGS=-fno-optimize-sibling-calls
 NO_REORDER_ADAFLAGS=-fno-toplevel-reorder
 GNATLIBFLAGS = -gnatpg -nostdinc
 GNATLIBCFLAGS = -g -O2
 NO_REORDER_ADAFLAGS=-fno-toplevel-reorder
 GNATLIBFLAGS = -gnatpg -nostdinc
 GNATLIBCFLAGS = -g -O2
+PICFLAG_FOR_TARGET = @PICFLAG_FOR_TARGET@
 # Pretend that _Unwind_GetIPInfo is available for the target by default.  This
 # should be autodetected during the configuration of libada and passed down to
 # here, but we need something for --disable-libada and hope for the best.
 # Pretend that _Unwind_GetIPInfo is available for the target by default.  This
 # should be autodetected during the configuration of libada and passed down to
 # here, but we need something for --disable-libada and hope for the best.
-GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
+GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET) -fexceptions \
        -DIN_RTS -DHAVE_GETIPINFO
 ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
 MOST_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(SOME_ADAFLAGS)
        -DIN_RTS -DHAVE_GETIPINFO
 ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
 MOST_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(SOME_ADAFLAGS)
@@ -2482,7 +2483,7 @@ gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR)
 gnatlib-shared-default:
        $(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
 gnatlib-shared-default:
        $(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
-            GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+            GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
@@ -2490,14 +2491,14 @@ gnatlib-shared-default:
        $(RM) $(RTSDIR)/libgna*$(soext)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
        $(RM) $(RTSDIR)/libgna*$(soext)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
-               $(TARGET_LIBGCC2_CFLAGS) \
+               $(PICFLAG_FOR_TARGET) \
                -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
                $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(MISCLIB) -lm
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
                -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
                $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(MISCLIB) -lm
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
-               $(TARGET_LIBGCC2_CFLAGS) \
+               $(PICFLAG_FOR_TARGET) \
                -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_TASKING_OBJS) \
                $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
                -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_TASKING_OBJS) \
                $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
@@ -2529,7 +2530,7 @@ gnatlib-shared-dual:
 gnatlib-shared-dual-win32:
        $(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
 gnatlib-shared-dual-win32:
        $(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
-            GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+            GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
@@ -2552,7 +2553,7 @@ gnatlib-shared-dual-win32:
 gnatlib-shared-win32:
        $(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
 gnatlib-shared-win32:
        $(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
-            GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+            GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
@@ -2560,13 +2561,13 @@ gnatlib-shared-win32:
        $(RM) $(RTSDIR)/libgna*$(soext)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
        $(RM) $(RTSDIR)/libgna*$(soext)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
-               $(TARGET_LIBGCC2_CFLAGS) \
+               $(PICFLAG_FOR_TARGET) \
                -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
                $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
                -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
                $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
-               $(TARGET_LIBGCC2_CFLAGS) \
+               $(PICFLAG_FOR_TARGET) \
                -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_TASKING_OBJS) \
                $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
                -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_TASKING_OBJS) \
                $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
@@ -2575,21 +2576,21 @@ gnatlib-shared-win32:
 gnatlib-shared-darwin:
        $(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
 gnatlib-shared-darwin:
        $(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
-            GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+            GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) -fno-common" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
             gnatlib
        $(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) -fno-common" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
             gnatlib
        $(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
-                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
+                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
                -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
                $(SO_OPTS) \
                -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(MISCLIB) -lm
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
                $(SO_OPTS) \
                -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(MISCLIB) -lm
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
-                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
+                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
                -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_TASKING_OBJS) \
                $(SO_OPTS) \
                -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
                $(GNATRTL_TASKING_OBJS) \
                $(SO_OPTS) \
@@ -2638,7 +2639,7 @@ gnatlib-shared:
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
-            TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
+            PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
              $(GNATLIB_SHARED)
 
 gnatlib-sjlj:
              $(GNATLIB_SHARED)
 
 gnatlib-sjlj:
@@ -2653,7 +2654,7 @@ gnatlib-sjlj:
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
-            TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
+            PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib
 
 gnatlib-zcx:
        $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \
 
 gnatlib-zcx:
        $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \
@@ -2667,7 +2668,7 @@ gnatlib-zcx:
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
             GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
             MULTISUBDIR="$(MULTISUBDIR)" \
             THREAD_KIND="$(THREAD_KIND)" \
-            TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
+            PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib
 
 # .s files for cross-building
 gnat-cross: force
 
 # .s files for cross-building
 gnat-cross: force
index 749dd2e6078e63b120e2cfc9e703e394922e7462..0feb91111c091d6d79e799870d04d01f159928ce 100755 (executable)
@@ -784,6 +784,7 @@ loose_warn
 EGREP
 GREP
 CPP
 EGREP
 GREP
 CPP
+PICFLAG_FOR_TARGET
 OUTPUT_OPTION
 NO_MINUS_C_MINUS_O
 GNATMAKE
 OUTPUT_OPTION
 NO_MINUS_C_MINUS_O
 GNATMAKE
@@ -4873,6 +4874,88 @@ case "$CC" in
 esac
 
 
 esac
 
 
+# Determine PICFLAG for target gnatlib.
+
+
+
+
+case "${target}" in
+    # PIC is the default on some targets or must not be used.
+    *-*-darwin*)
+       # PIC is the default on this platform
+       # Common symbols not allowed in MH_DYLIB files
+       PICFLAG_FOR_TARGET=-fno-common
+       ;;
+    alpha*-dec-osf5*)
+       # PIC is the default.
+       ;;
+    hppa*64*-*-hpux*)
+       # PIC is the default for 64-bit PA HP-UX.
+       ;;
+    i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
+       ;;
+    i[34567]86-*-interix3*)
+       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+       # Instead, we relocate shared libraries at runtime.
+       ;;
+    i[34567]86-*-nto-qnx*)
+       # QNX uses GNU C++, but need to define -shared option too, otherwise
+       # it will coredump.
+       PICFLAG_FOR_TARGET='-fPIC -shared'
+       ;;
+    i[34567]86-pc-msdosdjgpp*)
+       # DJGPP does not support shared libraries at all.
+       ;;
+    ia64*-*-hpux*)
+       # On IA64 HP-UX, PIC is the default but the pic flag
+       # sets the default TLS model and affects inlining.
+       PICFLAG_FOR_TARGET=-fPIC
+       ;;
+    mips-sgi-irix6*)
+       # PIC is the default.
+       ;;
+    rs6000-ibm-aix* | powerpc-ibm-aix*)
+       # All AIX code is PIC.
+       ;;
+
+    # Some targets support both -fPIC and -fpic, but prefer the latter.
+    # FIXME: Why?
+    i[34567]86-*-* | x86_64-*-*)
+       PICFLAG_FOR_TARGET=-fpic
+       ;;
+    m68k-*-*)
+       PICFLAG_FOR_TARGET=-fpic
+       ;;
+    s390*-*-*)
+       PICFLAG_FOR_TARGET=-fpic
+       ;;
+    # FIXME: Override -fPIC default in libgcc only?
+    sh-*-linux* | sh[2346lbe]*-*-linux*)
+       PICFLAG_FOR_TARGET=-fpic
+       ;;
+    # FIXME: Simplify to sh*-*-netbsd*?
+    sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
+      sh64-*-netbsd* | sh64l*-*-netbsd*)
+       PICFLAG_FOR_TARGET=-fpic
+       ;;
+    # Default to -fPIC unless specified otherwise.
+    *)
+       PICFLAG_FOR_TARGET=-fPIC
+       ;;
+esac
+
+# If the user explicitly uses -fpic/-fPIC, keep that.
+case "${CFLAGS_FOR_TARGET}" in
+    *-fpic*)
+       PICFLAG_FOR_TARGET=-fpic
+       ;;
+    *-fPIC*)
+       PICFLAG_FOR_TARGET=-fPIC
+       ;;
+esac
+
+
+
 # -------------------------
 # Check C compiler features
 # -------------------------
 # -------------------------
 # Check C compiler features
 # -------------------------
@@ -17830,7 +17913,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17833 "configure"
+#line 17916 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17936,7 +18019,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17939 "configure"
+#line 18022 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index ed01904635841189c35e8d365c64b6057a52a413..51ab3acd4093e8c8ac128c2279db0c13022ab85c 100644 (file)
@@ -297,6 +297,10 @@ case "$CC" in
 esac
 AC_SUBST(CFLAGS)
 
 esac
 AC_SUBST(CFLAGS)
 
+# Determine PICFLAG for target gnatlib.
+GCC_PICFLAG_FOR_TARGET
+AC_SUBST(PICFLAG_FOR_TARGET)
+
 # -------------------------
 # Check C compiler features
 # -------------------------
 # -------------------------
 # Check C compiler features
 # -------------------------
index 321712898be8e3770bfb8417eb298c69a291f08c..689e9fb1a3249e60187003bbaf11047625a89181 100644 (file)
@@ -1,3 +1,14 @@
+2011-08-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * configure.ac: Include ../config/picflag.m4.
+       (GCC_PICFLAG): Call it.
+       Substitute.
+       * configure: Regenerate.
+       * Makefile.in (TARGET_LIBGCC2_CFLAGS): Replace by PICFLAG.
+       (GNATLIBCFLAGS_FOR_C): Replace TARGET_LIBGCC2_CFLAGS by PICFLAG.
+       (LIBADA_FLAGS_TO_PASS): Pass PICFLAG as PICFLAG_FOR_TARGET.
+       Don't include $(GCC_DIR)/libgcc.mvars.
+
 2010-11-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        PR other/46202
 2010-11-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        PR other/46202
index cd518239b21e4248c752df8c62a2208467af8b71..6f3df38c322efead9ba960e00379941ed45b0388 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for libada.
 # Makefile for libada.
-#   Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc.
+#   Copyright 2003, 2004, 2009, 2010, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -56,15 +56,13 @@ LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
 GCC_WARN_CFLAGS = $(LOOSE_WARN)
 WARN_CFLAGS = @warn_cflags@
 
 GCC_WARN_CFLAGS = $(LOOSE_WARN)
 WARN_CFLAGS = @warn_cflags@
 
-TARGET_LIBGCC2_CFLAGS=
+PICFLAG = @PICFLAG@
 GNATLIBCFLAGS= -g -O2
 GNATLIBCFLAGS= -g -O2
-GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
+GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(PICFLAG) -fexceptions \
        -DIN_RTS @have_getipinfo@
 
        -DIN_RTS @have_getipinfo@
 
-# Get target-specific overrides for TARGET_LIBGCC2_CFLAGS.
 host_subdir = @host_subdir@
 GCC_DIR=$(MULTIBUILDTOP)../../$(host_subdir)/gcc
 host_subdir = @host_subdir@
 GCC_DIR=$(MULTIBUILDTOP)../../$(host_subdir)/gcc
-include $(GCC_DIR)/libgcc.mvars
 
 target_noncanonical:=@target_noncanonical@
 version := $(shell cat $(srcdir)/../gcc/BASE-VER)
 
 target_noncanonical:=@target_noncanonical@
 version := $(shell cat $(srcdir)/../gcc/BASE-VER)
@@ -83,7 +81,7 @@ LIBADA_FLAGS_TO_PASS = \
         "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \
         "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \
         "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \
         "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \
         "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \
         "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \
-        "TARGET_LIBGCC2_CFLAGS=$(TARGET_LIBGCC2_CFLAGS)" \
+        "PICFLAG_FOR_TARGET=$(PICFLAG)" \
         "THREAD_KIND=$(THREAD_KIND)" \
         "TRACE=$(TRACE)" \
         "MULTISUBDIR=$(MULTISUBDIR)" \
         "THREAD_KIND=$(THREAD_KIND)" \
         "TRACE=$(TRACE)" \
         "MULTISUBDIR=$(MULTISUBDIR)" \
index 4137364df2110c90bf0304654e18fb4d47c6a048..c0a294fdd0cb8f7073c10a23acf4741407d129fa 100755 (executable)
@@ -558,6 +558,7 @@ have_getipinfo
 default_gnatlib_target
 LN_S
 AWK
 default_gnatlib_target
 LN_S
 AWK
+PICFLAG
 enable_shared
 OBJEXT
 EXEEXT
 enable_shared
 OBJEXT
 EXEEXT
@@ -2817,6 +2818,87 @@ fi
 
 
 
 
 
 
+
+
+
+
+case "${host}" in
+    # PIC is the default on some targets or must not be used.
+    *-*-darwin*)
+       # PIC is the default on this platform
+       # Common symbols not allowed in MH_DYLIB files
+       PICFLAG=-fno-common
+       ;;
+    alpha*-dec-osf5*)
+       # PIC is the default.
+       ;;
+    hppa*64*-*-hpux*)
+       # PIC is the default for 64-bit PA HP-UX.
+       ;;
+    i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
+       ;;
+    i[34567]86-*-interix3*)
+       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+       # Instead, we relocate shared libraries at runtime.
+       ;;
+    i[34567]86-*-nto-qnx*)
+       # QNX uses GNU C++, but need to define -shared option too, otherwise
+       # it will coredump.
+       PICFLAG='-fPIC -shared'
+       ;;
+    i[34567]86-pc-msdosdjgpp*)
+       # DJGPP does not support shared libraries at all.
+       ;;
+    ia64*-*-hpux*)
+       # On IA64 HP-UX, PIC is the default but the pic flag
+       # sets the default TLS model and affects inlining.
+       PICFLAG=-fPIC
+       ;;
+    mips-sgi-irix6*)
+       # PIC is the default.
+       ;;
+    rs6000-ibm-aix* | powerpc-ibm-aix*)
+       # All AIX code is PIC.
+       ;;
+
+    # Some targets support both -fPIC and -fpic, but prefer the latter.
+    # FIXME: Why?
+    i[34567]86-*-* | x86_64-*-*)
+       PICFLAG=-fpic
+       ;;
+    m68k-*-*)
+       PICFLAG=-fpic
+       ;;
+    s390*-*-*)
+       PICFLAG=-fpic
+       ;;
+    # FIXME: Override -fPIC default in libgcc only?
+    sh-*-linux* | sh[2346lbe]*-*-linux*)
+       PICFLAG=-fpic
+       ;;
+    # FIXME: Simplify to sh*-*-netbsd*?
+    sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
+      sh64-*-netbsd* | sh64l*-*-netbsd*)
+       PICFLAG=-fpic
+       ;;
+    # Default to -fPIC unless specified otherwise.
+    *)
+       PICFLAG=-fPIC
+       ;;
+esac
+
+# If the user explicitly uses -fpic/-fPIC, keep that.
+case "${CFLAGS}" in
+    *-fpic*)
+       PICFLAG=-fpic
+       ;;
+    *-fPIC*)
+       PICFLAG=-fPIC
+       ;;
+esac
+
+
+
 # These must be passed down, or are needed by gcc/libgcc.mvars
 for ac_prog in gawk mawk nawk awk
 do
 # These must be passed down, or are needed by gcc/libgcc.mvars
 for ac_prog in gawk mawk nawk awk
 do
index 3aa8a62a522554aa4f2b817f5e440aba3bfb4ba3..f9b9c5ab3b00e47c45c871ff1c37ff52591ed897 100644 (file)
@@ -1,5 +1,5 @@
 # Configure script for libada.
 # Configure script for libada.
-#   Copyright 2003, 2004, 2009 Free Software Foundation, Inc.
+#   Copyright 2003, 2004, 2009, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
 sinclude(../config/acx.m4)
 sinclude(../config/multi.m4)
 sinclude(../config/override.m4)
 sinclude(../config/acx.m4)
 sinclude(../config/multi.m4)
 sinclude(../config/override.m4)
+sinclude(../config/picflag.m4)
 sinclude(../config/unwind_ipinfo.m4)
 
 AC_INIT
 sinclude(../config/unwind_ipinfo.m4)
 
 AC_INIT
@@ -118,6 +119,9 @@ esac
 ], [enable_shared=yes])
 AC_SUBST([enable_shared])
 
 ], [enable_shared=yes])
 AC_SUBST([enable_shared])
 
+GCC_PICFLAG
+AC_SUBST([PICFLAG])
+
 # These must be passed down, or are needed by gcc/libgcc.mvars
 AC_PROG_AWK
 AC_PROG_LN_S
 # These must be passed down, or are needed by gcc/libgcc.mvars
 AC_PROG_AWK
 AC_PROG_LN_S
index eabc69dc7ff4663b4ac8b8d16ce43dd9a9d40912..844b1ee47455745968d92cf20b676538ee0d16bc 100644 (file)
@@ -1,3 +1,10 @@
+2011-08-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * aclocal.m4: Include ../config/picflag.m4.
+       * configure.ac (GCC_PICFLAG): Call it.
+       (enable_shared): Clear PICFLAG unless shared.
+       * configure: Regenerate.
+
 2011-08-12  Steve Ellcey  <sje@cup.hp.com>
 
        * md5.c (md5_read_ctx): Handle mis-aligned resbuf pointer.
 2011-08-12  Steve Ellcey  <sje@cup.hp.com>
 
        * md5.c (md5_read_ctx): Handle mis-aligned resbuf pointer.
index f2091c9927e79316f78e98984c43717f6058c163..a528604d70e5d498a15fdced40c00e2caa8f2bf2 100644 (file)
@@ -1,6 +1,7 @@
 sinclude(../config/acx.m4)
 sinclude(../config/no-executables.m4)
 sinclude(../config/override.m4)
 sinclude(../config/acx.m4)
 sinclude(../config/no-executables.m4)
 sinclude(../config/override.m4)
+sinclude(../config/picflag.m4)
 sinclude(../config/warnings.m4)
 
 dnl See whether strncmp reads past the end of its string parameters.
 sinclude(../config/warnings.m4)
 
 dnl See whether strncmp reads past the end of its string parameters.
index 35b8ce5049bb38f10fa06e74d8bfe8731370920f..c798937deecfd8c6da2c634a9b5652fdb9b0004f 100755 (executable)
@@ -4840,6 +4840,86 @@ if [ -n "${frag}" ]; then
   frag=${libiberty_topdir}/libiberty/config/$frag
 fi
 
   frag=${libiberty_topdir}/libiberty/config/$frag
 fi
 
+
+
+
+
+case "${host}" in
+    # PIC is the default on some targets or must not be used.
+    *-*-darwin*)
+       # PIC is the default on this platform
+       # Common symbols not allowed in MH_DYLIB files
+       PICFLAG=-fno-common
+       ;;
+    alpha*-dec-osf5*)
+       # PIC is the default.
+       ;;
+    hppa*64*-*-hpux*)
+       # PIC is the default for 64-bit PA HP-UX.
+       ;;
+    i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
+       ;;
+    i[34567]86-*-interix3*)
+       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+       # Instead, we relocate shared libraries at runtime.
+       ;;
+    i[34567]86-*-nto-qnx*)
+       # QNX uses GNU C++, but need to define -shared option too, otherwise
+       # it will coredump.
+       PICFLAG='-fPIC -shared'
+       ;;
+    i[34567]86-pc-msdosdjgpp*)
+       # DJGPP does not support shared libraries at all.
+       ;;
+    ia64*-*-hpux*)
+       # On IA64 HP-UX, PIC is the default but the pic flag
+       # sets the default TLS model and affects inlining.
+       PICFLAG=-fPIC
+       ;;
+    mips-sgi-irix6*)
+       # PIC is the default.
+       ;;
+    rs6000-ibm-aix* | powerpc-ibm-aix*)
+       # All AIX code is PIC.
+       ;;
+
+    # Some targets support both -fPIC and -fpic, but prefer the latter.
+    # FIXME: Why?
+    i[34567]86-*-* | x86_64-*-*)
+       PICFLAG=-fpic
+       ;;
+    m68k-*-*)
+       PICFLAG=-fpic
+       ;;
+    s390*-*-*)
+       PICFLAG=-fpic
+       ;;
+    # FIXME: Override -fPIC default in libgcc only?
+    sh-*-linux* | sh[2346lbe]*-*-linux*)
+       PICFLAG=-fpic
+       ;;
+    # FIXME: Simplify to sh*-*-netbsd*?
+    sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
+      sh64-*-netbsd* | sh64l*-*-netbsd*)
+       PICFLAG=-fpic
+       ;;
+    # Default to -fPIC unless specified otherwise.
+    *)
+       PICFLAG=-fPIC
+       ;;
+esac
+
+# If the user explicitly uses -fpic/-fPIC, keep that.
+case "${CFLAGS}" in
+    *-fpic*)
+       PICFLAG=-fpic
+       ;;
+    *-fPIC*)
+       PICFLAG=-fPIC
+       ;;
+esac
+
+
 # If they didn't specify --enable-shared, don't generate shared libs.
 case "${enable_shared}" in
   yes) shared=yes ;;
 # If they didn't specify --enable-shared, don't generate shared libs.
 case "${enable_shared}" in
   yes) shared=yes ;;
@@ -4847,27 +4927,8 @@ case "${enable_shared}" in
   "") shared=no ;;
   *) shared=yes ;;
 esac
   "") shared=no ;;
   *) shared=yes ;;
 esac
-if [ "${shared}" = "yes" ]; then
-  case "${host}" in
-    *-*-cygwin*)       ;;
-    alpha*-*-linux*)   PICFLAG=-fPIC ;;
-    arm*-*-*)          PICFLAG=-fPIC ;;
-    hppa*-*-*)         PICFLAG=-fPIC ;;
-    i370-*-*)          PICFLAG=-fPIC ;;
-    ia64-*-*)          PICFLAG=-fpic ;;
-    i[34567]86-*-* | x86_64-*-*)
-                       PICFLAG=-fpic ;;
-    m68k-*-*)          PICFLAG=-fpic ;;
-    mips*-*-linux*)    PICFLAG=-fPIC ;;
-    powerpc*-*-aix*)   ;;
-    powerpc*-*-*)      PICFLAG=-fPIC ;;
-    sparc*-*-*)                case "${CFLAGS}" in
-                         *-fpic* ) PICFLAG=-fpic ;;
-                         * ) PICFLAG=-fPIC ;;
-                       esac ;;
-    s390*-*-*)         PICFLAG=-fpic ;;
-    sh*-*-*)           PICFLAG=-fPIC ;;
-  esac
+if [ "${shared}" != "yes" ]; then
+  PICFLAG=
 fi
 
 
 fi
 
 
index eebd7e991056f629baeb474ae551903306196119..754b66a061930c9e86c4b974fd2db0c17c291a3a 100644 (file)
@@ -191,6 +191,8 @@ if [[ -n "${frag}" ]]; then
   frag=${libiberty_topdir}/libiberty/config/$frag
 fi
 
   frag=${libiberty_topdir}/libiberty/config/$frag
 fi
 
+GCC_PICFLAG
+
 # If they didn't specify --enable-shared, don't generate shared libs.
 case "${enable_shared}" in
   yes) shared=yes ;;
 # If they didn't specify --enable-shared, don't generate shared libs.
 case "${enable_shared}" in
   yes) shared=yes ;;
@@ -198,27 +200,8 @@ case "${enable_shared}" in
   "") shared=no ;;
   *) shared=yes ;;
 esac
   "") shared=no ;;
   *) shared=yes ;;
 esac
-if [[ "${shared}" = "yes" ]]; then
-  case "${host}" in
-    *-*-cygwin*)       ;;
-    alpha*-*-linux*)   PICFLAG=-fPIC ;;
-    arm*-*-*)          PICFLAG=-fPIC ;;
-    hppa*-*-*)         PICFLAG=-fPIC ;;
-    i370-*-*)          PICFLAG=-fPIC ;;
-    ia64-*-*)          PICFLAG=-fpic ;;
-    i[[34567]]86-*-* | x86_64-*-*)
-                       PICFLAG=-fpic ;;
-    m68k-*-*)          PICFLAG=-fpic ;;
-    mips*-*-linux*)    PICFLAG=-fPIC ;;
-    powerpc*-*-aix*)   ;;
-    powerpc*-*-*)      PICFLAG=-fPIC ;;
-    sparc*-*-*)                case "${CFLAGS}" in
-                         *-fpic* ) PICFLAG=-fpic ;;
-                         * ) PICFLAG=-fPIC ;;
-                       esac ;;
-    s390*-*-*)         PICFLAG=-fpic ;;
-    sh*-*-*)           PICFLAG=-fPIC ;;
-  esac
+if [[ "${shared}" != "yes" ]]; then
+  PICFLAG=
 fi
 AC_SUBST(PICFLAG)
 
 fi
 AC_SUBST(PICFLAG)