X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=ltcf-c.sh;h=d4d8b63a0bee96fb7cf90fe9270c63a1b1071ee6;hp=3d99a49cc1918c21c4b28a4959a79d776be5c2d0;hb=b7bf3f810a80fdf56d4923f648faad076595bf8d;hpb=88c1d0892b833eb6f5818fa3e37e5f3b2247f167 diff --git a/ltcf-c.sh b/ltcf-c.sh index 3d99a49cc19..d4d8b63a0be 100644 --- a/ltcf-c.sh +++ b/ltcf-c.sh @@ -17,7 +17,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -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 <&2 + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&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,9 +108,9 @@ 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/$soname > $output_objdir/$soname-def' + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' @@ -166,32 +168,20 @@ EOF done; fi~ '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags' + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $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 warning' - archive_cmds='$CC $(if test "$module" = "yes"; then echo -bundle; else - echo -dynamiclib; fi) -o $lib $libobjs $deplibs $linkopts' - archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - ## What we need is to hardcode the path to the library, not the search path - #hardcode_direct=yes - #hardcode_libdir_flag_spec='-install_name $libdir/$lib' - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load' - ;; - - 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= else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -223,6 +213,10 @@ EOF hardcode_shlibpath_var=no ;; + tpf*) + ld_shlibs=yes + ;; + *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -273,6 +267,7 @@ else hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes + file_list_spec='${wl}-f,' # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to @@ -313,8 +308,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. @@ -338,9 +335,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 (_) @@ -381,9 +380,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 @@ -405,7 +447,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 @@ -413,16 +455,32 @@ else ;; hpux9* | hpux10* | hpux11*) - 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' ;; + 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 - 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. export_dynamic_flag_spec='${wl}-E' + hardcode_direct=yes ;; irix5* | irix6*) @@ -436,7 +494,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 @@ -486,13 +544,16 @@ else if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # cc supports -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' fi - hardcode_libdir_flag_spec='-rpath $libdir' hardcode_libdir_separator=: ;; @@ -504,12 +565,16 @@ else ;; solaris*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + no_undefined_flag=' -z defs' + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in @@ -584,8 +649,13 @@ else runpath_var=LD_RUN_PATH ;; - unixware7*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; @@ -612,9 +682,6 @@ else ac_cv_prog_cc_static='-static' case $host_os in - beos* | irix5* | irix6* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then @@ -624,17 +691,29 @@ else lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; - cygwin* | mingw* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - ac_cv_prog_cc_pic='-DDLL_EXPORT' - ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + cygwin* | mingw* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + ac_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + ac_cv_prog_cc_pic='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + ac_cv_prog_cc_pic= + ;; sysv4*MP*) if test -d /usr/nec; then ac_cv_prog_cc_pic=-Kconform_pic @@ -723,7 +802,16 @@ else ;; esac fi - ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC" + case "$host_os" in + # Platforms which do not suport PIC and -DPIC is meaningless + # on them: + *djgpp*) + ac_cv_prog_cc_pic= + ;; + *) + ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC" + ;; + esac fi need_lc=yes @@ -748,7 +836,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