home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 2001 January / CT_SW0101.ISO / pc / software / kommunik / ftp / kmago112.tgz / kmago112.tar / kmago-1.1.2 / admin / ltcf-c.sh < prev    next >
Text File  |  2001-04-19  |  29KB  |  747 lines

  1. #### This script is meant to be sourced by ltconfig.
  2.  
  3. # $Id: ltcf-c.sh,v 1.3 2001/04/19 10:12:10 sergio Exp $
  4.  
  5. # ltcf-c.sh - Create a C compiler specific configuration
  6. #
  7. # Copyright (C) 1996-2000 Free Software Foundation, Inc.
  8. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  9. #
  10. # This file is free software; you can redistribute it and/or modify it
  11. # under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful, but
  16. # WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18. # General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program; if not, write to the Free Software
  22. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. #
  24. # As a special exception to the GNU General Public License, if you
  25. # distribute this file as part of a program that contains a
  26. # configuration script generated by Autoconf, you may include it under
  27. # the same distribution terms that you use for the rest of that program.
  28.  
  29.  
  30. # Source file extension for C test sources.
  31. ac_ext=c
  32.  
  33. # Object file extension for compiled C test sources.
  34. objext=o
  35.  
  36. # Code to be used in simple compile tests
  37. lt_simple_compile_test_code="int some_variable = 0;"
  38.  
  39. # Code to be used in simple link tests
  40. lt_simple_link_test_code='main(){return(0);}'
  41.  
  42. ## Linker Characteristics
  43. case "$host_os" in
  44. cygwin* | mingw*)
  45.   # FIXME: the MSVC++ port hasn't been tested in a loooong time
  46.   # When not using gcc, we currently assume that we are using
  47.   # Microsoft Visual C++.
  48.   if test "$with_gcc" != yes; then
  49.     with_gnu_ld=no
  50.   fi
  51.   ;;
  52.  
  53. esac
  54.  
  55. ld_shlibs=yes
  56. if test "$with_gnu_ld" = yes; then
  57.   # If archive_cmds runs LD, not CC, wlarc should be empty
  58.   wlarc='${wl}'
  59.  
  60.   # See if GNU ld supports shared libraries.
  61.   case "$host_os" in
  62.   aix3* | aix4*)
  63.     # On AIX, the GNU linker is very broken
  64.     ld_shlibs=no
  65.     cat <<EOF 1>&2
  66.  
  67. *** Warning: the GNU linker, at least up to release 2.9.1, is reported
  68. *** to be unable to reliably create shared libraries on AIX.
  69. *** Therefore, libtool is disabling shared libraries support.  If you
  70. *** really care for shared libraries, you may want to modify your PATH
  71. *** so that a non-GNU linker is found, and then restart.
  72.  
  73. EOF
  74.     ;;
  75.  
  76.   amigaos*)
  77.     archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
  78.     hardcode_libdir_flag_spec='-L$libdir'
  79.     hardcode_minus_L=yes
  80.  
  81.     # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
  82.     # that the semantics of dynamic libraries on AmigaOS, at least up
  83.     # to version 4, is to share data among multiple programs linked
  84.     # with the same dynamic library.  Since this doesn't match the
  85.     # behavior of shared libraries on other platforms, we can use
  86.     # them.
  87.     ld_shlibs=no
  88.     ;;
  89.  
  90.   beos*)
  91.     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
  92.       allow_undefined_flag=unsupported
  93.       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
  94.       # support --undefined.  This deserves some investigation.  FIXME
  95.       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
  96.     else
  97.       ld_shlibs=no
  98.     fi
  99.     ;;
  100.  
  101.   cygwin* | mingw*)
  102.     # hardcode_libdir_flag_spec is actually meaningless, as there is
  103.     # no search path for DLLs.
  104.     hardcode_libdir_flag_spec='-L$libdir'
  105.     allow_undefined_flag=unsupported
  106.     always_export_symbols=yes
  107.  
  108.     extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
  109.       sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
  110.       test -f $output_objdir/impgen.exe || (cd $output_objdir && \
  111.       if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
  112.       else $CC -o impgen impgen.c ; fi)~
  113.       $output_objdir/impgen $dir/$soname > $output_objdir/$soname-def'
  114.  
  115.     old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
  116.  
  117.     # cygwin and mingw dlls have different entry points and sets of symbols
  118.     # to exclude.
  119.     # FIXME: what about values for MSVC?
  120.     dll_entry=__cygwin_dll_entry@12
  121.     dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
  122.     case "$host_os" in
  123.     mingw*)
  124.       # mingw values
  125.       dll_entry=_DllMainCRTStartup@12
  126.       dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
  127.       ;;
  128.     esac
  129.  
  130.     # mingw and cygwin differ, and it's simplest to just exclude the union
  131.     # of the two symbol sets.
  132.     dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
  133.  
  134.     # recent cygwin and mingw systems supply a stub DllMain which the user
  135.     # can override, but on older systems we have to supply one (in ltdll.c)
  136.     if test "x$lt_cv_need_dllmain" = "xyes"; then
  137.       ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
  138.       ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
  139.     test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
  140.     else
  141.       ltdll_obj=
  142.       ltdll_cmds=
  143.     fi
  144.  
  145.     # Extract the symbol export list from an `--export-all' def file,
  146.     # then regenerate the def file from the symbol export list, so that
  147.     # the compiled dll only exports the symbol export list.
  148.     # Be careful not to strip the DATA tag left be newer dlltools.
  149.     export_symbols_cmds="$ltdll_cmds"'
  150.       $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
  151.       sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
  152.  
  153.     # If DATA tags from a recent dlltool are present, honour them!
  154.     archive_expsym_cmds='echo EXPORTS > $output_objdir/$soname-def~
  155.       _lt_hint=1;
  156.       cat $export_symbols | while read symbol; do
  157.     set dummy \$symbol;
  158.     case \$# in
  159.       2) echo "    \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
  160.       *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
  161.     esac;
  162.     _lt_hint=`expr 1 + \$_lt_hint`;
  163.       done~
  164.       '"$ltdll_cmds"'
  165.       $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~
  166.       $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~
  167.       $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~
  168.       $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~
  169.       $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags'
  170.     ;;
  171.  
  172.   darwin*|rhapsody*)
  173.     allow_undefined_flag='-undefined warning'
  174.     archive_cmds='$CC $(if test "$module" = "yes"; then echo -bundle; else
  175.       echo -dynamiclib; fi) -o $lib $libobjs $deplibs $linkopts'
  176.     archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
  177.     ## What we need is to hardcode the path to the library, not the search path
  178.     #hardcode_direct=yes
  179.     #hardcode_libdir_flag_spec='-install_name $libdir/$lib'
  180.     hardcode_shlibpath_var=no
  181.     whole_archive_flag_spec='-all_load'
  182.     ;;
  183.  
  184.   netbsd*)
  185.     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
  186.       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
  187.       wlarc=
  188.     else
  189.       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
  190.       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
  191.     fi
  192.     ;;
  193.  
  194.   solaris* | sysv5*)
  195.     if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
  196.       ld_shlibs=no
  197.       cat <<EOF 1>&2
  198.  
  199. *** Warning: The releases 2.8.* of the GNU linker cannot reliably
  200. *** create shared libraries on Solaris systems.  Therefore, libtool
  201. *** is disabling shared libraries support.  We urge you to upgrade GNU
  202. *** binutils to release 2.9.1 or newer.  Another option is to modify
  203. *** your PATH or compiler configuration so that the native linker is
  204. *** used, and then restart.
  205.  
  206. EOF
  207.     elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
  208.       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
  209.       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
  210.     else
  211.       ld_shlibs=no
  212.     fi
  213.     ;;
  214.  
  215.   sunos4*)
  216.     archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
  217.     wlarc=
  218.     hardcode_direct=yes
  219.     hardcode_shlibpath_var=no
  220.     ;;
  221.  
  222.   *)
  223.     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
  224.       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
  225.       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
  226.     else
  227.       ld_shlibs=no
  228.     fi
  229.     ;;
  230.   esac
  231.  
  232.   case "$host_os" in
  233.   freebsd*)
  234.     skip_need_lc_check=yes
  235.     ;;
  236.   esac
  237.  
  238.   if test "$ld_shlibs" = yes; then
  239.     runpath_var=LD_RUN_PATH
  240.     hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
  241.     export_dynamic_flag_spec='${wl}--export-dynamic'
  242.     case $host_os in
  243.     cygwin* | mingw*)
  244.       # dlltool doesn't understand --whole-archive et. al.
  245.       whole_archive_flag_spec=
  246.       ;;
  247.     *)
  248.       # ancient GNU ld didn't support --whole-archive et. al.
  249.       if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
  250.     whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
  251.       else
  252.     whole_archive_flag_spec=
  253.       fi
  254.       ;;
  255.     esac
  256.   fi
  257. else
  258.   # PORTME fill in a description of your system's linker (not GNU ld)
  259.   case "$host_os" in
  260.   aix3*)
  261.     allow_undefined_flag=unsupported
  262.     always_export_symbols=yes
  263.     archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
  264.     # Note: this linker hardcodes the directories in LIBPATH if there
  265.     # are no directories specified by -L.
  266.     hardcode_minus_L=yes
  267.     if test "$with_gcc" = yes && test -z "$link_static_flag"; then
  268.       # Neither direct hardcoding nor static linking is supported with a
  269.       # broken collect2.
  270.       hardcode_direct=unsupported
  271.     fi
  272.     ;;
  273.  
  274.   # this was the old aix4 code, Reza Arbab says, it isn't working anymore (MM)
  275.   #aix4*)
  276.   #  hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
  277.   #  hardcode_libdir_separator=':'
  278.   #  if test "$with_gcc" = yes; then
  279.   #    collect2name=`${CC} -print-prog-name=collect2`
  280.   #    if test -f "$collect2name" && \
  281.   #       strings "$collect2name" | grep resolve_lib_name >/dev/null
  282.   #    then
  283.   #      # We have reworked collect2
  284.   #      hardcode_direct=yes
  285.   #    else
  286.   #      # We have old collect2
  287.   #      hardcode_direct=unsupported
  288.   #      # It fails to find uninstalled libraries when the uninstalled
  289.   #      # path is not listed in the libpath.  Setting hardcode_minus_L
  290.   #      # to unsupported forces relinking
  291.   #      hardcode_minus_L=yes
  292.   #      hardcode_libdir_flag_spec='-L$libdir'
  293.   #      hardcode_libdir_separator=
  294.   #    fi
  295.   #    shared_flag='-shared'
  296.   #  else
  297.   #    shared_flag='${wl}-bM:SRE'
  298.   #    hardcode_direct=yes
  299.   #  fi
  300.   #  allow_undefined_flag=' ${wl}-berok'
  301.   #  archive_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
  302.   #  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
  303.   #  case "$host_os" in aix4.[01]|aix4.[01].*)
  304.   #    # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
  305.   #    always_export_symbols=yes ;;
  306.   #  esac
  307.   #;;                                                                         
  308.  
  309.   aix4*)
  310.     if test "$with_gcc" = yes; then
  311.       # GNU compiler
  312.       archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G -o $lib'
  313.       archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G ${wl}-bE:$export_symbols -o $lib'
  314.     else
  315.       # IBM compiler (xlc).  Anything older than Visual Age C 5.0 probably won't work.
  316.       archive_cmds='$CC -qmkshrobj $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G -o $lib'
  317.       archive_expsym_cmds='$CC -qmkshrobj $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G ${wl}-bE:$export_symbols -o $lib'
  318.     fi
  319.   
  320.     hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
  321.     hardcode_libdir_separator=':'
  322.     hardcode_direct=unsupported
  323.     link_all_deplibs=yes
  324.    ;;
  325.  
  326.   amigaos*)
  327.     archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
  328.     hardcode_libdir_flag_spec='-L$libdir'
  329.     hardcode_minus_L=yes
  330.     # see comment about different semantics on the GNU ld section
  331.     ld_shlibs=no
  332.     ;;
  333.  
  334.   cygwin* | mingw*)
  335.     # When not using gcc, we currently assume that we are using
  336.     # Microsoft Visual C++.
  337.     # hardcode_libdir_flag_spec is actually meaningless, as there is
  338.     # no search path for DLLs.
  339.     hardcode_libdir_flag_spec=' '
  340.     allow_undefined_flag=unsupported
  341.     # Tell ltmain to make .lib files, not .a files.
  342.     libext=lib
  343.     # FIXME: Setting linknames here is a bad hack.
  344.     archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
  345.     # The linker will automatically build a .lib file if we build a DLL.
  346.     old_archive_from_new_cmds='true'
  347.     # FIXME: Should let the user specify the lib program.
  348.     old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
  349.     fix_srcfile_path='`cygpath -w "$srcfile"`'
  350.     ;;
  351.  
  352.   freebsd1*)
  353.     ld_shlibs=no
  354.     ;;
  355.  
  356.   # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
  357.   # support.  Future versions do this automatically, but an explicit c++rt0.o
  358.   # does not break anything, and helps significantly (at the cost of a little
  359.   # extra space).
  360.   freebsd2.2*)
  361.     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
  362.     hardcode_libdir_flag_spec='-R$libdir'
  363.     hardcode_direct=yes
  364.     hardcode_shlibpath_var=no
  365.     ;;
  366.  
  367.   # Unfortunately, older versions of FreeBSD 2 do not have this feature.
  368.   freebsd2*)
  369.     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
  370.     hardcode_direct=yes
  371.     hardcode_minus_L=yes
  372.     hardcode_shlibpath_var=no
  373.     ;;
  374.  
  375.   # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
  376.   freebsd*)
  377.     archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
  378.     hardcode_libdir_flag_spec='-R$libdir'
  379.     hardcode_direct=yes
  380.     hardcode_shlibpath_var=no
  381.     skip_need_lc_check=yes
  382.     ;;
  383.  
  384.   hpux9* | hpux10* | hpux11*)
  385.     case "$host_os" in
  386.     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' ;;
  387.     *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
  388.     esac
  389.     hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
  390.     hardcode_libdir_separator=:
  391.     hardcode_direct=yes
  392.     hardcode_minus_L=yes # Not in the search PATH, but as the default
  393.              # location of the library.
  394.     export_dynamic_flag_spec='${wl}-E'
  395.     ;;
  396.  
  397.   irix5* | irix6*)
  398.     if test "$with_gcc" = yes; then
  399.       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
  400.     else
  401.       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
  402.     fi
  403.     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  404.     hardcode_libdir_separator=:
  405.     link_all_deplibs=yes
  406.     ;;
  407.  
  408.   netbsd*)
  409.     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
  410.       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
  411.     else
  412.       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
  413.     fi
  414.     hardcode_libdir_flag_spec='-R$libdir'
  415.     hardcode_direct=yes
  416.     hardcode_shlibpath_var=no
  417.     ;;
  418.  
  419.   newsos6)
  420.     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
  421.     hardcode_direct=yes
  422.     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  423.     hardcode_libdir_separator=:
  424.     hardcode_shlibpath_var=no
  425.     ;;
  426.  
  427.   openbsd*)
  428.     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
  429.     hardcode_libdir_flag_spec='-R$libdir'
  430.     hardcode_direct=yes
  431.     hardcode_shlibpath_var=no
  432.     ;;
  433.  
  434.   os2*)
  435.     hardcode_libdir_flag_spec='-L$libdir'
  436.     hardcode_minus_L=yes
  437.     allow_undefined_flag=unsupported
  438.     archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
  439.     old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
  440.     ;;
  441.  
  442.   osf3*)
  443.     if test "$with_gcc" = yes; then
  444.       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
  445.       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
  446.     else
  447.       allow_undefined_flag=' -expect_unresolved \*'
  448.       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
  449.     fi
  450.     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  451.     hardcode_libdir_separator=:
  452.     ;;
  453.  
  454.   osf4* | osf5*)    # as osf3* with the addition of -msym flag
  455.     if test "$with_gcc" = yes; then
  456.       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
  457.       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'
  458.     else
  459.       allow_undefined_flag=' -expect_unresolved \*'
  460.       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'
  461.       archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
  462.       $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'
  463.     fi
  464.     hardcode_libdir_flag_spec='-rpath $libdir'
  465.     hardcode_libdir_separator=:
  466.     ;;
  467.  
  468.   sco3.2v5*)
  469.     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
  470.     hardcode_shlibpath_var=no
  471.     runpath_var=LD_RUN_PATH
  472.     hardcode_runpath_var=yes
  473.     ;;
  474.  
  475.   solaris*)
  476.     no_undefined_flag=' -z text'
  477.     # $CC -shared without GNU ld will not create a library from C++
  478.     # object files and a static libstdc++, better avoid it by now
  479.     archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
  480.     archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
  481.         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
  482.     hardcode_libdir_flag_spec='-R$libdir'
  483.     hardcode_shlibpath_var=no
  484.     case "$host_os" in
  485.     solaris2.[0-5] | solaris2.[0-5].*) ;;
  486.     *) # Supported since Solaris 2.6 (maybe 2.5.1?)
  487.       whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
  488.     esac
  489.     link_all_deplibs=yes
  490.     ;;
  491.  
  492.   sunos4*)
  493.     archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
  494.     hardcode_libdir_flag_spec='-L$libdir'
  495.     hardcode_direct=yes
  496.     hardcode_minus_L=yes
  497.     hardcode_shlibpath_var=no
  498.     ;;
  499.  
  500.   sysv4)
  501.     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
  502.     runpath_var='LD_RUN_PATH'
  503.     hardcode_shlibpath_var=no
  504.     hardcode_direct=no #Motorola manual says yes, but my tests say they lie
  505.     ;;
  506.  
  507.   sysv4.3*)
  508.     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
  509.     hardcode_shlibpath_var=no
  510.     export_dynamic_flag_spec='-Bexport'
  511.     ;;
  512.  
  513.   sysv5*)
  514.     no_undefined_flag=' -z text'
  515.     # $CC -shared without GNU ld will not create a library from C++
  516.     # object files and a static libstdc++, better avoid it by now
  517.     archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
  518.     archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
  519.         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
  520.     hardcode_libdir_flag_spec=
  521.     hardcode_shlibpath_var=no
  522.     runpath_var='LD_RUN_PATH'
  523.     ;;
  524.  
  525.   uts4*)
  526.     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
  527.     hardcode_libdir_flag_spec='-L$libdir'
  528.     hardcode_shlibpath_var=no
  529.     ;;
  530.  
  531.   dgux*)
  532.     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
  533.     hardcode_libdir_flag_spec='-L$libdir'
  534.     hardcode_shlibpath_var=no
  535.     ;;
  536.  
  537.   sysv4*MP*)
  538.     if test -d /usr/nec; then
  539.       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
  540.       hardcode_shlibpath_var=no
  541.       runpath_var=LD_RUN_PATH
  542.       hardcode_runpath_var=yes
  543.       ld_shlibs=yes
  544.     fi
  545.     ;;
  546.  
  547.   sysv4.2uw2*)
  548.     archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
  549.     hardcode_direct=yes
  550.     hardcode_minus_L=no
  551.     hardcode_shlibpath_var=no
  552.     hardcode_runpath_var=yes
  553.     runpath_var=LD_RUN_PATH
  554.     ;;
  555.  
  556.   unixware7*)
  557.     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
  558.     runpath_var='LD_RUN_PATH'
  559.     hardcode_shlibpath_var=no
  560.     ;;
  561.  
  562.   *)
  563.     ld_shlibs=no
  564.     ;;
  565.   esac
  566. fi
  567.  
  568. ## Compiler Characteristics: PIC flags, static flags, etc
  569. if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
  570.   :
  571. else
  572.   ac_cv_prog_cc_pic=
  573.   ac_cv_prog_cc_shlib=
  574.   ac_cv_prog_cc_wl=
  575.   ac_cv_prog_cc_static=
  576.   ac_cv_prog_cc_no_builtin=
  577.   ac_cv_prog_cc_can_build_shared=$can_build_shared
  578.  
  579.   if test "$with_gcc" = yes; then
  580.     ac_cv_prog_cc_wl='-Wl,'
  581.     ac_cv_prog_cc_static='-static'
  582.  
  583.     case "$host_os" in
  584.     beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
  585.       # PIC is the default for these OSes.
  586.       ;;
  587.     aix*)
  588.       # Below there is a dirty hack to force normal static linking with -ldl
  589.       # The problem is because libdl dynamically linked with both libc and
  590.       # libC (AIX C++ library), which obviously doesn't included in libraries
  591.       # list by gcc. This cause undefined symbols with -static flags.
  592.       # This hack allows C programs to be linked with "-static -ldl", but
  593.       # we not sure about C++ programs.
  594.       ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
  595.       ;;
  596.     cygwin* | mingw* | os2*)
  597.       # This hack is so that the source file can tell whether it is being
  598.       # built for inclusion in a dll (and should export symbols for example).
  599.       ac_cv_prog_cc_pic='-DDLL_EXPORT'
  600.       ;;
  601.     amigaos*)
  602.       # FIXME: we need at least 68020 code to build shared libraries, but
  603.       # adding the `-m68020' flag to GCC prevents building anything better,
  604.       # like `-m68040'.
  605.       ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
  606.       ;;
  607.     sysv4*MP*)
  608.       if test -d /usr/nec; then
  609.      ac_cv_prog_cc_pic=-Kconform_pic
  610.       fi
  611.       ;;
  612.     *)
  613.       ac_cv_prog_cc_pic='-fPIC'
  614.       ;;
  615.     esac
  616.   else
  617.     # PORTME Check for PIC flags for the system compiler.
  618.     case "$host_os" in
  619.     aix3* | aix4*)
  620.      # All AIX code is PIC.
  621.       ac_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
  622.       ;;
  623.  
  624.     hpux9* | hpux10* | hpux11*)
  625.       # Is there a better ac_cv_prog_cc_static that works with the bundled CC?
  626.       ac_cv_prog_cc_wl='-Wl,'
  627.       ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
  628.       ac_cv_prog_cc_pic='+Z'
  629.       ;;
  630.  
  631.     irix5* | irix6*)
  632.       ac_cv_prog_cc_wl='-Wl,'
  633.       ac_cv_prog_cc_static='-non_shared'
  634.       # PIC (with -KPIC) is the default.
  635.       ;;
  636.  
  637.     cygwin* | mingw* | os2*)
  638.       # This hack is so that the source file can tell whether it is being
  639.       # built for inclusion in a dll (and should export symbols for example).
  640.       ac_cv_prog_cc_pic='-DDLL_EXPORT'
  641.       ;;
  642.  
  643.     newsos6)
  644.       ac_cv_prog_cc_pic='-KPIC'
  645.       ac_cv_prog_cc_static='-Bstatic'
  646.       ;;
  647.  
  648.     osf3* | osf4* | osf5*)
  649.       # All OSF/1 code is PIC.
  650.       ac_cv_prog_cc_wl='-Wl,'
  651.       ac_cv_prog_cc_static='-non_shared'
  652.       ;;
  653.  
  654.     sco3.2v5*)
  655.       ac_cv_prog_cc_pic='-Kpic'
  656.       ac_cv_prog_cc_static='-dn'
  657.       ac_cv_prog_cc_shlib='-belf'
  658.       ;;
  659.  
  660.     solaris*)
  661.       ac_cv_prog_cc_pic='-KPIC'
  662.       ac_cv_prog_cc_static='-Bstatic'
  663.       ac_cv_prog_cc_wl='-Wl,'
  664.       ;;
  665.  
  666.     sunos4*)
  667.       ac_cv_prog_cc_pic='-PIC'
  668.       ac_cv_prog_cc_static='-Bstatic'
  669.       ac_cv_prog_cc_wl='-Qoption ld '
  670.       ;;
  671.  
  672.     sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
  673.       ac_cv_prog_cc_pic='-KPIC'
  674.       ac_cv_prog_cc_static='-Bstatic'
  675.       ac_cv_prog_cc_wl='-Wl,'
  676.       ;;
  677.  
  678.     uts4*)
  679.       ac_cv_prog_cc_pic='-pic'
  680.       ac_cv_prog_cc_static='-Bstatic'
  681.       ;;
  682.  
  683.     sysv4*MP*)
  684.       if test -d /usr/nec ;then
  685.     ac_cv_prog_cc_pic='-Kconform_pic'
  686.     ac_cv_prog_cc_static='-Bstatic'
  687.       fi
  688.       ;;
  689.  
  690.     *)
  691.       ac_cv_prog_cc_can_build_shared=no
  692.       ;;
  693.     esac
  694.   fi
  695.   ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
  696. fi
  697.  
  698. need_lc=yes
  699. if test "$enable_shared" = yes && test "$with_gcc" = yes; then
  700.   case "$archive_cmds" in
  701.   *'~'*)
  702.     # FIXME: we may have to deal with multi-command sequences.
  703.     ;;
  704.   '$CC '*)
  705.     # Test whether the compiler implicitly links with -lc since on some
  706.     # systems, -lgcc has to come before -lc. If gcc already passes -lc
  707.     # to ld, don't add -lc before -lgcc.
  708.     echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
  709.     if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
  710.       echo $ac_n "(cached) $ac_c" 1>&6
  711.       need_lc=$ac_cv_archive_cmds_needs_lc
  712.     elif test "x$skip_need_lc_check" = "xyes" ; then
  713.       echo $ac_n "(skipping, using no) $ac_c" 1>&6
  714.       need_lc=no
  715.     else
  716.       $rm conftest*
  717.       echo "static int dummy;" > conftest.$ac_ext
  718.       if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
  719.     # Append any warnings to the config.log.
  720.     cat conftest.err 1>&5
  721.     soname=conftest
  722.     lib=conftest
  723.     libobjs=conftest.$ac_objext
  724.     deplibs=
  725.     wl=$ac_cv_prog_cc_wl
  726.     compiler_flags=-v
  727.     linker_flags=-v
  728.     verstring=
  729.     output_objdir=.
  730.     libname=conftest
  731.     save_allow_undefined_flag=$allow_undefined_flag
  732.     allow_undefined_flag=
  733.     if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
  734.       need_lc=no
  735.     fi
  736.     allow_undefined_flag=$save_allow_undefined_flag
  737.       else
  738.     cat conftest.err 1>&5
  739.       fi
  740.     fi
  741.     $rm conftest*
  742.     echo "$ac_t$need_lc" 1>&6
  743.     ;;
  744.   esac
  745. fi
  746. ac_cv_archive_cmds_needs_lc=$need_lc
  747.