OSDN Git Service

Patch from Robert Millan.
[pf3gnuchains/gcc-fork.git] / ltcf-c.sh
index 1ce95e2..7cc273d 100644 (file)
--- a/ltcf-c.sh
+++ b/ltcf-c.sh
@@ -58,9 +58,10 @@ if test "$with_gnu_ld" = yes; then
   # See if GNU ld supports shared libraries.
   case $host_os in
   aix3* | aix4* | aix5*)
-    # On AIX, the GNU linker is very broken
-    ld_shlibs=no
-    cat <<EOF 1>&2
+    # On AIX/PPC, the GNU linker is very broken
+    if test "$host_cpu" != ia64; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
 
 *** Warning: the GNU linker, at least up to release 2.9.1, is reported
 *** to be unable to reliably create shared libraries on AIX.
@@ -69,6 +70,7 @@ if test "$with_gnu_ld" = yes; then
 *** so that a non-GNU linker is found, and then restart.
 
 EOF
+    fi
     ;;
 
   amigaos*)
@@ -106,7 +108,7 @@ EOF
     extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
       sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
       test -f $output_objdir/impgen.exe || (cd $output_objdir && \
-      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \
       else $CC -o impgen impgen.c ; fi)~
       $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
 
@@ -173,17 +175,7 @@ EOF
       $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
     ;;
 
-  darwin* | rhapsody*)
-    allow_undefined_flag='-undefined suppress'
-    archive_cmds='$CC `test .$module = .yes && echo -bundle || echo -dynamiclib` $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname `test -n "$verstring" -a x$verstring != x0.0 && echo $verstring`'
-    # We need to add '_' to the symbols in $export_symbols first
-    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    whole_archive_flag_spec='-all_load $convenience'
-    ;;
-
-  netbsd*)
+  netbsd* | knetbsd*-gnu)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
       wlarc=
@@ -311,8 +303,10 @@ else
       # On IA64, the linker does run time linking by default, so we don't
       # have to do anything special.
       aix_use_runtimelinking=no
-      exp_sym_flag='-Bexport'
-      no_entry_flag=""
+      if test $with_gnu_ld = no; then
+        exp_sym_flag='-Bexport'
+        no_entry_flag=""
+      fi
     else
       # Test if we are trying to use run time linking, or normal AIX style linking.
       # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
@@ -336,9 +330,11 @@ else
       archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
     else
       if test "$host_cpu" = ia64; then
-        hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
-        allow_undefined_flag="-z nodefs"
-        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+        if test $with_gnu_ld = no; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+          allow_undefined_flag="-z nodefs"
+          archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+        fi
       else
         allow_undefined_flag=' ${wl}-berok'
         # -bexpall does not export symbols beginning with underscore (_)
@@ -379,9 +375,52 @@ else
     fix_srcfile_path='`cygpath -w "$srcfile"`'
     ;;
 
-  freebsd1*)
-    ld_shlibs=no
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+       allow_undefined_flag='-undefined suppress'
+       ;;
+    *) # Darwin 1.3 on
+    if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       allow_undefined_flag='-flat_namespace -undefined suppress'
+    else
+       case ${MACOSX_DEPLOYMENT_TARGET} in
+           10.[[012]])
+               allow_undefined_flag='-flat_namespace -undefined suppress'
+               ;;
+           10.*)
+               allow_undefined_flag='-undefined dynamic_lookup'
+               ;;
+       esac
+    fi
     ;;
+    esac
+    # Disable shared library build on OS-X older than 10.3.
+    case $host_os in
+       darwin[1-6]*)
+           can_build_shared=no
+           ;;
+       darwin7*)
+           can_build_shared=yes
+           ;;
+    esac
+    output_verbose_link_cmd='echo'
+    archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
+    module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+    # Don't fix this by using the ld -exported_symbols_list flag,
+    # it doesn't exist in older darwin ld's
+    archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag  -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    hardcode_direct=no
+    hardcode_automatic=yes
+    hardcode_shlibpath_var=unsupported
+    whole_archive_flag_spec='-all_load $convenience'
+    link_all_deplibs=yes
+    ;;
+
+  freebsd1*)
+  ld_shlibs=no
+  ;;
 
   # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
   # support.  Future versions do this automatically, but an explicit c++rt0.o
@@ -403,7 +442,7 @@ else
     ;;
 
   # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-  freebsd*)
+  freebsd* | kfreebsd*-gnu)
     archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
@@ -411,23 +450,32 @@ else
     ;;
 
   hpux9* | hpux10* | hpux11*)
-    if test $with_gcc = yes; then
-      case "$host_os" in
-      hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
-      *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;;
-      esac
-    else
-      case $host_os in
-      hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
-      *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
-      esac
-    fi
-    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-    hardcode_libdir_separator=:
-    hardcode_direct=yes
-    hardcode_minus_L=yes # Not in the search PATH, but as the default
-                        # location of the library.
+    case "$host_cpu" in
+    ia64*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir' ;;
+    *)
+      if test $with_gcc = yes; then
+        case "$host_os" in
+        hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+        *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;;
+        esac
+      else
+        case $host_os in
+        hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+        *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+        esac
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_minus_L=yes # Not in the search PATH, but as the default
+                          # location of the library.
+      ;;
+    esac
     export_dynamic_flag_spec='${wl}-E'
+    hardcode_direct=yes
     ;;
 
   irix5* | irix6*)
@@ -441,7 +489,7 @@ else
     link_all_deplibs=yes
     ;;
 
-  netbsd*)
+  netbsd* | knetbsd*-gnu)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
     else
@@ -655,7 +703,7 @@ else
     darwin* | rhapsody*)
       # PIC is the default on this platform
       # Common symbols not allowed in MH_DYLIB files
-      lt_cv_prog_cc_pic='-fno-common'
+      ac_cv_prog_cc_pic='-fno-common'
       ;;
     *djgpp*)
       # DJGPP does not support shared libraries at all
@@ -783,7 +831,7 @@ if test "$enable_shared" = yes && test "$with_gcc" = yes; then
        cat conftest.err 1>&5
        soname=conftest
        lib=conftest
-       libobjs=conftest.$ac_objext
+       libobjs=conftest.$objext
        deplibs=
        wl=$ac_cv_prog_cc_wl
        compiler_flags=-v