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-cxx.sh < prev    next >
Text File  |  2001-04-19  |  35KB  |  963 lines

  1. #### This script is meant to be sourced by ltconfig.
  2.  
  3. # $Id: ltcf-cxx.sh,v 1.3 2001/04/19 10:12:10 sergio Exp $
  4.  
  5. # ltcf-cxx.sh - Create a C++ compiler specific configuration
  6. #
  7. # Copyright (C) 1996-1999,2000 Free Software Foundation, Inc.
  8. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  9. #
  10. # Original C++ support by:
  11. #    Alexandre Oliva <oliva@lsd.ic.unicamp.br>
  12. #    Ossama Othman <ossama@debian.org>
  13. #    Thomas Thanner <tanner@gmx.de>
  14. #
  15. # This file is free software; you can redistribute it and/or modify it
  16. # under the terms of the GNU General Public License as published by
  17. # the Free Software Foundation; either version 2 of the License, or
  18. # (at your option) any later version.
  19. #
  20. # This program is distributed in the hope that it will be useful, but
  21. # WITHOUT ANY WARRANTY; without even the implied warranty of
  22. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  23. # General Public License for more details.
  24. #
  25. # You should have received a copy of the GNU General Public License
  26. # along with this program; if not, write to the Free Software
  27. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  28. #
  29. # As a special exception to the GNU General Public License, if you
  30. # distribute this file as part of a program that contains a
  31. # configuration script generated by Autoconf, you may include it under
  32. # the same distribution terms that you use for the rest of that program.
  33.  
  34.  
  35. # Source file extension for C++ test sources.
  36. ac_ext=cc
  37.  
  38. # Object file extension for compiled C++ test sources.
  39. objext=o
  40.  
  41. # Code to be used in simple compile tests
  42. lt_simple_compile_test_code="int some_variable = 0;"
  43.  
  44. # Code to be used in simple link tests
  45. lt_simple_link_test_code='int main(int, char *[]) { return (0); }'
  46.  
  47. # C++ compiler
  48. CXX=${CXX-c++}
  49.  
  50. # ltmain only uses $CC for tagged configurations so make sure $CC is set.
  51. CC=${CC-"$CXX"}
  52. CFLAGS=${CFLAGS-"$CXXFLAGS"}
  53.  
  54. # Allow CC (or CXX) to be a program name with arguments.
  55. set dummy $CC
  56. compiler=$2
  57. cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
  58.  
  59. # we are optimistic. (Too optimistic if you ask me, down there we switch it
  60. # off again for most platforms ;) (MM)
  61. ld_shlibs=yes
  62.  
  63. # Check if we are using GNU gcc  (taken/adapted from configure script)
  64. # We need to check here since "--with-gcc" is set at configure time,
  65. # not ltconfig time!
  66. cat > conftest.$ac_ext <<EOF
  67. #ifdef __GNUC__
  68.   yes;
  69. #endif
  70. EOF
  71. if { ac_try='${CC-c++} -E conftest.$ac_ext'; { (eval echo \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
  72.   with_gcc=yes
  73.  
  74.   # Set up default GNU C++ configuration
  75.  
  76.   # Check if GNU C++ uses GNU ld as the underlying linker, since the
  77.   # archiving commands below assume that GNU ld is being used.
  78.   if eval "`$CC -print-prog-name=ld` --version 2>&1" | \
  79.       egrep 'GNU ld' > /dev/null; then
  80.     with_gnu_ld=yes
  81.  
  82.     archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
  83.     archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
  84.  
  85.     runpath_var=LD_RUN_PATH
  86.     hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
  87.     export_dynamic_flag_spec='${wl}--export-dynamic'
  88.  
  89.     # If archive_cmds runs LD, not CC, wlarc should be empty
  90.     # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
  91.     #     investigate it a little bit more. (MM)
  92.     wlarc='${wl}'
  93.  
  94.     # ancient GNU ld didn't support --whole-archive et. al.
  95.     if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
  96.         egrep 'no-whole-archive' > /dev/null; then
  97.       whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
  98.     else
  99.       whole_archive_flag_spec=
  100.     fi
  101.   else
  102.     with_gnu_ld=no
  103.     wlarc=
  104.  
  105.     # A generic and very simple default shared library creation
  106.     # command for GNU C++ for the case where it uses the native
  107.     # linker, instead of GNU ld.  If possible, this setting should
  108.     # overridden to take advantage of the native linker features on
  109.     # the platform it is being used on.
  110.     archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
  111.   fi
  112.  
  113.   # Commands to make compiler produce verbose output that lists
  114.   # what "hidden" libraries, object files and flags are used when
  115.   # linking a shared library.
  116.   output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
  117.  
  118. else
  119.   with_gcc=no
  120.   with_gnu_ld=no
  121.   wlarc=
  122. fi
  123.  
  124. echo "ltcf-cxx: with_gcc=$with_gcc ; with_gnu_ld=$with_gnu_ld"
  125.  
  126. # In general, the C++ compiler should always link C++ objects.
  127. LD="$CC"
  128. LDFLAGS="$LDFLAGS"
  129.  
  130. # PORTME: fill in a description of your system's C++ link characteristics
  131. case "$host_os" in
  132.   aix3*)
  133.     # FIXME: insert proper C++ library support
  134.     ld_shlibs=no
  135.     ;;
  136.   aix4*)
  137.     case "$cc_basename" in
  138.       xlC)
  139.         # IBM C++ compiler (xlC).  Anything older than Visual Age C++ 5.0 probably won't work.
  140.         archive_cmds='$CC -qmkshrobj $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G -o $lib'
  141.         archive_expsym_cmds='$CC -qmkshrobj $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G ${wl}-bE:$export_symbols -o $lib'
  142.         ;;
  143.       *)
  144.         if test "$with_gcc" = yes; then
  145.           # GNU C++ compiler
  146.           archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G -o $lib'
  147.           archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G ${wl}-bE:$export_symbols -o $lib'
  148.         fi
  149.         ;;
  150.     esac
  151.   
  152.     hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
  153.     hardcode_libdir_separator=':'
  154.     hardcode_direct=unsupported
  155.     link_all_deplibs=yes
  156.     ;;
  157.   chorus*)
  158.     case "$cc_basename" in
  159.       *)
  160.         # FIXME: insert proper C++ library support
  161.         ld_shlibs=no
  162.         ;;
  163.     esac
  164.     ;;
  165.   dgux*)
  166.     case "$cc_basename" in
  167.       ec++)
  168.         # FIXME: insert proper C++ library support
  169.         ld_shlibs=no
  170.         ;;
  171.       ghcx)
  172.         # Green Hills C++ Compiler
  173.         # FIXME: insert proper C++ library support
  174.         ld_shlibs=no
  175.         ;;
  176.       *)
  177.         # FIXME: insert proper C++ library support
  178.         ld_shlibs=no
  179.         ;;
  180.     esac
  181.     ;;
  182.   freebsd*)
  183.     # FreeBSD uses GNU C++ and GNU ld
  184.     skip_need_lc_check=yes
  185.     remove_lgcc=yes
  186.     ;;
  187.   hpux*)
  188.     case "$cc_basename" in
  189.       CC)
  190.         # FIXME: insert proper C++ library support
  191.         ld_shlibs=no
  192.         ;;
  193.       aCC)
  194.     case "$host_os" in
  195.     hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
  196.     *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
  197.     esac
  198.     hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
  199.     hardcode_libdir_separator=:
  200.     hardcode_direct=yes
  201.     hardcode_minus_L=yes # Not in the search PATH, but as the default
  202.                  # location of the library.
  203.     export_dynamic_flag_spec='${wl}-E'
  204.  
  205.         # Commands to make compiler produce verbose output that lists
  206.         # what "hidden" libraries, object files and flags are used when
  207.         # linking a shared library.
  208.         #
  209.         # There doesn't appear to be a way to prevent this compiler from
  210.         # explicitly linking system object files so we need to strip them
  211.         # from the output so that they don't get included in the library
  212.         # dependencies.
  213.         output_verbose_link_cmds='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
  214.         ;;
  215.       *)
  216.         if test "$with_gcc" = yes && test "$with_gnu_ld" = no ; then
  217.       # MM: for HP-UX and g++ -fPIC is needed to link pic objects together
  218.       archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
  219.       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
  220.       hardcode_libdir_separator=:
  221.       hardcode_direct=yes
  222.       hardcode_minus_L=yes
  223.       export_dynamic_flag_spec='${wl}-E'
  224.       output_verbose_link_cmds='$CC -shared -fPIC $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
  225.       remove_lgcc=yes
  226.         fi
  227.         if test "$with_gcc" = no ; then
  228.       # FIXME: insert proper C++ library support
  229.           ld_shlibs=no
  230.     fi
  231.         ;;
  232.     esac
  233.     ;;
  234.   irix5* | irix6*)
  235.     case "$cc_basename" in
  236.       CC)
  237.         # SGI C++
  238.         archive_cmds='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
  239.  
  240.     # Archives containing C++ object files must be created using
  241.     # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
  242.     # necessary to make sure instantiated templates are included
  243.     # in the archive.
  244.     old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
  245.         ;;
  246.       *)
  247.         if test "$with_gcc" = yes; then
  248.           if test "$with_gnu_ld" = no; then
  249.             archive_cmds='$CC -nostdlib -D_LANGUAGE_C_CPLUS_PLUS -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
  250.           else
  251.             archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
  252.           fi
  253.         fi
  254.         ;;
  255.     esac
  256.     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  257.     hardcode_libdir_separator=:
  258.     link_all_deplibs=yes
  259.     ;;
  260.   linux*)
  261.     case "$cc_basename" in
  262.       KCC)
  263.         # Kuck and Associates, Inc. (KAI) C++ Compiler
  264.  
  265.         # KCC will only create a shared library if the output file
  266.         # ends with ".so" (or ".sl" for HP-UX), so rename the library
  267.         # to its proper name (with version) after linking.
  268.         archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
  269.         archive_expsym_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
  270.  
  271.         # Commands to make compiler produce verbose output that lists
  272.         # what "hidden" libraries, object files and flags are used when
  273.         # linking a shared library.
  274.         #
  275.         # There doesn't appear to be a way to prevent this compiler from
  276.         # explicitly linking system object files so we need to strip them
  277.         # from the output so that they don't get included in the library
  278.         # dependencies.
  279.         output_verbose_link_cmds='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | egrep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
  280.  
  281.         hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
  282.         export_dynamic_flag_spec='${wl}--export-dynamic'
  283.  
  284.     # Archives containing C++ object files must be created using
  285.     # "CC -Bstatic", where "CC" is the KAI C++ compiler.
  286.         old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
  287.         ;;
  288.       cxx)
  289.         # Compaq C++
  290.         archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
  291.         archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
  292.  
  293.         runpath_var=LD_RUN_PATH
  294.         hardcode_libdir_flag_spec='-rpath $libdir'
  295.         hardcode_libdir_separator=:
  296.  
  297.         # Commands to make compiler produce verbose output that lists
  298.         # what "hidden" libraries, object files and flags are used when
  299.         # linking a shared library.
  300.         #
  301.         # There doesn't appear to be a way to prevent this compiler from
  302.         # explicitly linking system object files so we need to strip them
  303.         # from the output so that they don't get included in the library
  304.         # dependencies.
  305.         output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
  306.         ;;
  307.       insure)
  308.         if test "$with_gcc" = yes; then
  309.       # Insure++ together with gcc probably means also GNU ld
  310.       # only -whole-archive isn't supported
  311.       whole_archive_flag_spec=""
  312.       # and we can't use -nostdlib, because bloody insure has no way to
  313.       # output the linkline (-Zvm isn't working as documented), so we don't
  314.       # know the depending libs. So we hope, insure gets it right anyway.
  315.       archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
  316.       runpath_var=LD_RUN_PATH
  317.       hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
  318.       export_dynamic_flag_spec='${wl}--export-dynamic'
  319.       output_verbose_link_cmds=""
  320.     fi
  321.     esac
  322.     ;;
  323.   lynxos*)
  324.     # FIXME: insert proper C++ library support
  325.     ld_shlibs=no
  326.     ;;
  327.   m88k*)
  328.     # FIXME: insert proper C++ library support
  329.     ld_shlibs=no
  330.     ;;
  331.   mvs*)
  332.     case "$cc_basename" in
  333.       cxx)
  334.         # FIXME: insert proper C++ library support
  335.         ld_shlibs=no
  336.         ;;
  337.       *)
  338.         # FIXME: insert proper C++ library support
  339.         ld_shlibs=no
  340.         ;;
  341.     esac   
  342.     ;;
  343.   netbsd*)
  344.     if test "$with_gcc" = no || test "$with_gnu_ld" = no; then
  345.       # This should only be triggered for NetBSD/a.out
  346.       # Add in C++ constructor/destructor support
  347.       if test -f /usr/pkg/lib/c++rt0/c++rt0.o.PIC; then
  348.         cppopts="/usr/pkg/lib/c++rt0/c++rt0.o.PIC"
  349.       elif test -f /usr/lib/c++rt0.o; then
  350.         cppopts="/usr/lib/c++rt0.o"
  351.       fi
  352.       archive_cmds='ld -Bshareable -o $lib '"$cppopts"' $libobjs $deplibs $linkopts'
  353.     fi
  354.     ;;
  355.   openbsd*)
  356.     if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
  357.       # MM: OpenBSD 2.7 uses G++, but not GNU ld
  358.       archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
  359.       archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
  360.       old_archive_cmds="$old_archive_cmds~"'$RANLIB $oldlib'
  361.       hardcode_libdir_flag_spec='${wl}-R$libdir'
  362.       hardcode_direct=yes
  363.       hardcode_shlibpath_var=no
  364.       whole_archive_flag_spec='${wl}-Bforcearchive'
  365.       remove_lgcc=yes
  366.     fi
  367.     ;;
  368.   osf3*)
  369.     if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
  370.       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
  371.       archive_cmds='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
  372.  
  373.       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  374.       hardcode_libdir_separator=:
  375.  
  376.       # Commands to make compiler produce verbose output that lists
  377.       # what "hidden" libraries, object files and flags are used when
  378.       # linking a shared library.
  379.       output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
  380.     else
  381.       case "$cc_basename" in
  382.     KCC)
  383.       # Kuck and Associates, Inc. (KAI) C++ Compiler
  384.  
  385.       # KCC will only create a shared library if the output file
  386.       # ends with ".so" (or ".sl" for HP-UX), so rename the library
  387.       # to its proper name (with version) after linking.
  388.       archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
  389.  
  390.       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
  391.       hardcode_libdir_separator=:
  392.  
  393.       # Archives containing C++ object files must be created using
  394.       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
  395.       old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
  396.  
  397.       ;;
  398.     RCC)
  399.       # Rational C++ 2.4.1
  400.       # FIXME: insert proper C++ library support
  401.       ld_shlibs=no
  402.       ;;
  403.     cxx)
  404.       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
  405.       archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
  406.  
  407.       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  408.       hardcode_libdir_separator=:
  409.  
  410.       # Commands to make compiler produce verbose output that lists
  411.       # what "hidden" libraries, object files and flags are used when
  412.       # linking a shared library.
  413.       #
  414.       # There doesn't appear to be a way to prevent this compiler from
  415.       # explicitly linking system object files so we need to strip them
  416.       # from the output so that they don't get included in the library
  417.       # dependencies.
  418.       output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
  419.       ;;
  420.     *)
  421.       # FIXME: insert proper C++ library support
  422.       ld_shlibs=no
  423.       ;;
  424.       esac
  425.     fi
  426.     ;;
  427.   osf4* | osf5*)
  428.     if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
  429.       allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*'
  430.       no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*'
  431.       archive_cmds='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $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'
  432.  
  433.       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  434.       hardcode_libdir_separator=:
  435.  
  436.       # Commands to make compiler produce verbose output that lists
  437.       # what "hidden" libraries, object files and flags are used when
  438.       # linking a shared library.
  439.       output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
  440.     else
  441.       case "$cc_basename" in
  442.     KCC)
  443.       # Kuck and Associates, Inc. (KAI) C++ Compiler
  444.  
  445.       # KCC will only create a shared library if the output file
  446.       # ends with ".so" (or ".sl" for HP-UX), so rename the library
  447.       # to its proper name (with version) after linking.
  448.       archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
  449.  
  450.       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
  451.       hardcode_libdir_separator=:
  452.  
  453.       # Archives containing C++ object files must be created using
  454.       # the KAI C++ compiler.
  455.       old_archive_cmds='$CC -o $oldlib $oldobjs'
  456.       ;;
  457.     RCC)
  458.       # Rational C++ 2.4.1
  459.       # FIXME: insert proper C++ library support
  460.       ld_shlibs=no
  461.       ;;
  462.     cxx)
  463.       allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*'
  464.       no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*'
  465.       archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -update_registry ${objdir}/so_locations -o $lib'
  466.       
  467.       hardcode_libdir_flag_spec='-rpath $libdir'
  468.       hardcode_libdir_separator=:
  469.  
  470.       # Commands to make compiler produce verbose output that lists
  471.       # what "hidden" libraries, object files and flags are used when
  472.       # linking a shared library.
  473.       #
  474.       # There doesn't appear to be a way to prevent this compiler from
  475.       # explicitly linking system object files so we need to strip them
  476.       # from the output so that they don't get included in the library
  477.       # dependencies.
  478.       output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
  479.       ;;
  480.     *)
  481.       # FIXME: insert proper C++ library support
  482.       ld_shlibs=no
  483.       ;;
  484.       esac
  485.     fi
  486.     ;;
  487.   psos*)
  488.     # FIXME: insert proper C++ library support
  489.     ld_shlibs=no
  490.     ;;
  491.   sco*)
  492.     case "$cc_basename" in
  493.       CC)
  494.         # FIXME: insert proper C++ library support
  495.         ld_shlibs=no
  496.         ;;
  497.       *)
  498.         # FIXME: insert proper C++ library support
  499.         ld_shlibs=no
  500.         ;;
  501.     esac
  502.     ;;
  503.   sunos4*)
  504.     case "$cc_basename" in
  505.       CC)
  506.         # Sun C++ 4.x
  507.         # FIXME: insert proper C++ library support
  508.         ld_shlibs=no
  509.         ;;
  510.       lcc)
  511.         # Lucid
  512.         # FIXME: insert proper C++ library support
  513.         ld_shlibs=no
  514.         ;;
  515.       *)
  516.         # FIXME: insert proper C++ library support
  517.         ld_shlibs=no
  518.         ;;
  519.     esac
  520.     ;;
  521.   solaris*)
  522.     case "$cc_basename" in
  523.       CC)
  524.     # Sun C++ 4.2, 5.x and Centerline C++
  525.         no_undefined_flag=' -ztext'
  526.         archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
  527.         archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
  528.         $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
  529.  
  530.         hardcode_libdir_flag_spec='-R$libdir'
  531.         hardcode_shlibpath_var=no
  532.         case "$host_os" in
  533.           solaris2.[0-5] | solaris2.[0-5].*) ;;
  534.           *)
  535.             # The C++ compiler is used as linker so we must use $wl
  536.             # flag to pass the commands to the underlying system
  537.             # linker.
  538.             # Supported since Solaris 2.6 (maybe 2.5.1?)
  539.             whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
  540.             ;;
  541.         esac
  542.         link_all_deplibs=yes
  543.  
  544.         # Commands to make compiler produce verbose output that lists
  545.         # what "hidden" libraries, object files and flags are used when
  546.         # linking a shared library.
  547.         #
  548.         # There doesn't appear to be a way to prevent this compiler from
  549.         # explicitly linking system object files so we need to strip them
  550.         # from the output so that they don't get included in the library
  551.         # dependencies.
  552.         output_verbose_link_cmds='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep "\-R|\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
  553.  
  554.     # Archives containing C++ object files must be created using
  555.     # "CC -xar", where "CC" is the Sun C++ compiler.  This is
  556.         # necessary to make sure instantiated templates are included
  557.         # in the archive.
  558.         old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
  559.         ;;
  560.       gcx)
  561.         # Green Hills C++ Compiler
  562.         archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
  563.  
  564.         # The C++ compiler must be used to create the archive.
  565.         old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
  566.         ;;
  567.       *)
  568.         # GNU C++ compiler with Solaris linker
  569.         if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
  570.           if $CC --version | egrep -v '^2\.7' > /dev/null; then
  571.             archive_cmds='$LD -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
  572.             archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
  573.         $LD -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname~$rm $lib.exp'
  574.  
  575.             # Commands to make compiler produce verbose output that lists
  576.             # what "hidden" libraries, object files and flags are used when
  577.             # linking a shared library.
  578.             output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
  579.           else
  580.             # g++ 2.7 appears to require `-G' NOT `-shared' on this
  581.             # platform.
  582.             archive_cmds='$LD -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
  583.             archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
  584.         $LD -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname~$rm $lib.exp'
  585.  
  586.             # Commands to make compiler produce verbose output that lists
  587.             # what "hidden" libraries, object files and flags are used when
  588.             # linking a shared library.
  589.             output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
  590.           fi
  591.  
  592.           hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
  593.         fi
  594.         ;;
  595.     esac
  596.     ;;
  597.   tandem*)
  598.     case "$cc_basename" in
  599.       NCC)
  600.         # NonStop-UX NCC 3.20
  601.         # FIXME: insert proper C++ library support
  602.         ld_shlibs=no
  603.         ;;
  604.       *)
  605.         # FIXME: insert proper C++ library support
  606.         ld_shlibs=no
  607.         ;;
  608.     esac
  609.     ;;
  610.   unixware*)
  611.     # FIXME: insert proper C++ library support
  612.     ld_shlibs=no
  613.     ;;
  614.   vxworks*)
  615.     # FIXME: insert proper C++ library support
  616.     ld_shlibs=no
  617.     ;;
  618.   *)
  619.     # FIXME: insert proper C++ library support
  620.     ld_shlibs=no
  621.     ;;
  622. esac
  623.  
  624.  
  625. ## Compiler Characteristics: PIC flags, static flags, etc
  626.  
  627. # We don't use cached values here since only the C compiler
  628. # characteristics should be cached.
  629. ac_cv_prog_cc_pic=
  630. ac_cv_prog_cc_shlib=
  631. ac_cv_prog_cc_wl=
  632. ac_cv_prog_cc_static=
  633. ac_cv_prog_cc_no_builtin=
  634. ac_cv_prog_cc_can_build_shared=$can_build_shared
  635.  
  636. # It is not enough to reset these cached values, they must be unset.
  637. unset ac_cv_prog_cc_pic_works
  638. unset ac_cv_prog_cc_static_works
  639.  
  640. if test "$with_gcc" = yes; then
  641.   ac_cv_prog_cc_wl='-Wl,'
  642.   ac_cv_prog_cc_static='-static'
  643.  
  644.   case "$host_os" in
  645.   beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
  646.     # PIC is the default for these OSes.
  647.     ;;
  648.   aix*)
  649.     # Below there is a dirty hack to force normal static linking with -ldl
  650.     # The problem is because libdl dynamically linked with both libc and
  651.     # libC (AIX C++ library), which obviously doesn't included in libraries
  652.     # list by gcc. This cause undefined symbols with -static flags.
  653.     # This hack allows C programs to be linked with "-static -ldl", but
  654.     # we not sure about C++ programs.
  655.     ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
  656.     ;;
  657.   cygwin* | mingw* | os2*)
  658.     # This hack is so that the source file can tell whether it is being
  659.     # built for inclusion in a dll (and should export symbols for example).
  660.     ac_cv_prog_cc_pic='-DDLL_EXPORT'
  661.     ;;
  662.   amigaos*)
  663.     # FIXME: we need at least 68020 code to build shared libraries, but
  664.     # adding the `-m68020' flag to GCC prevents building anything better,
  665.     # like `-m68040'.
  666.     ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
  667.     ;;
  668.   sysv4*MP*)
  669.     if test -d /usr/nec; then
  670.       ac_cv_prog_cc_pic=-Kconform_pic
  671.     fi
  672.     ;;
  673.   *)
  674.     ac_cv_prog_cc_pic='-fPIC'
  675.     ;;
  676.   esac
  677. else
  678.   case "$host_os" in
  679.     aix4*)
  680.       # All AIX code is PIC.
  681.       ;;
  682.     chorus*)
  683.       case "$cc_basename" in
  684.       cxch68)
  685.         # Green Hills C++ Compiler
  686.         # ac_cv_prog_cc_static="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
  687.         ;;
  688.       esac
  689.       ;;
  690.     dgux*)
  691.       case "$cc_basename" in
  692.         ec++)
  693.           ac_cv_prog_cc_pic='-KPIC'
  694.           ;;
  695.         ghcx)
  696.           # Green Hills C++ Compiler
  697.           ac_cv_prog_cc_pic='-pic'
  698.           ;;
  699.         *)
  700.           ;;
  701.       esac
  702.       ;;
  703.     freebsd*)
  704.       # FreeBSD uses GNU C++
  705.       ;;
  706.     hpux9* | hpux10* | hpux11*)
  707.       case "$cc_basename" in
  708.         CC)
  709.           ac_cv_prog_cc_wl='-Wl,'
  710.           ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
  711.           ac_cv_prog_cc_pic='+Z'
  712.           ;;
  713.         aCC)
  714.           ac_cv_prog_cc_wl='-Wl,'
  715.           ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
  716.           ac_cv_prog_cc_pic='+Z'
  717.           ;;
  718.         *)
  719.           ;;
  720.       esac
  721.       ;;
  722.     irix5* | irix6*)
  723.       case "$cc_basename" in
  724.         CC)
  725.           ac_cv_prog_cc_wl='-Wl,'
  726.           ac_cv_prog_cc_static='-non_shared'
  727.           ac_cv_prog_cc_pic='-KPIC'
  728.           ;;
  729.         *)
  730.           ;;
  731.       esac
  732.       ;;
  733.     linux*)
  734.       case "$cc_basename" in
  735.         KCC)
  736.           # KAI C++ Compiler
  737.           ac_cv_prog_cc_wl='--backend -Wl,'
  738.           ac_cv_prog_cc_pic='-fPIC'
  739.           ;;
  740.         cxx)
  741.           # Compaq C++
  742.           # Make sure the PIC flag is empty.  It appears that all Alpha
  743.           # Linux and Compaq Tru64 Unix objects are PIC.
  744.           ac_cv_prog_cc_pic=
  745.           ac_cv_prog_cc_static='-non_shared'
  746.           ;;
  747.         *)
  748.           ;;
  749.       esac
  750.       ;;
  751.     lynxos*)
  752.       ;;
  753.     m88k*)
  754.       ;;
  755.     mvs*)
  756.       case "$cc_basename" in
  757.         cxx)
  758.           ac_cv_prog_cc_pic='-W c,exportall'
  759.           ;;
  760.         *)
  761.           ;;
  762.       esac
  763.       ;;
  764.     netbsd*)
  765.       ;;
  766.     osf3* | osf4* | osf5*)
  767.       case "$cc_basename" in
  768.         KCC)
  769.           ac_cv_prog_cc_wl='--backend -Wl,'
  770.           ;;
  771.         RCC)
  772.           # Rational C++ 2.4.1
  773.           ac_cv_prog_cc_pic='-pic'
  774.           ;;
  775.         cxx)
  776.           # Digital/Compaq C++
  777.           ac_cv_prog_cc_wl='-Wl,'
  778.           # Make sure the PIC flag is empty.  It appears that all Alpha
  779.           # Linux and Compaq Tru64 Unix objects are PIC.
  780.           ac_cv_prog_cc_pic=
  781.           ac_cv_prog_cc_static='-non_shared'
  782.           ;;
  783.         *)
  784.           ;;
  785.       esac
  786.       ;;
  787.     psos*)
  788.       ;;
  789.     sco*)
  790.       case "$cc_basename" in
  791.         CC)
  792.           ac_cv_prog_cc_pic='-fPIC'
  793.           ;;
  794.         *)
  795.           ;;
  796.       esac
  797.       ;;
  798.     solaris*)
  799.       case "$cc_basename" in
  800.         CC)
  801.           # Sun C++ 4.2, 5.x and Centerline C++
  802.           ac_cv_prog_cc_pic='-KPIC'
  803.           ac_cv_prog_cc_static='-Bstatic'
  804.           ac_cv_prog_cc_wl='-Qoption ld '
  805.           ;;
  806.         gcx)
  807.           # Green Hills C++ Compiler
  808.           ac_cv_prog_cc_pic='-PIC'
  809.           ;;
  810.         *)
  811.           ;;
  812.       esac
  813.       ;;
  814.     sunos4*)
  815.       case "$cc_basename" in
  816.         CC)
  817.           # Sun C++ 4.x
  818.           ac_cv_prog_cc_pic='-pic'
  819.           ac_cv_prog_cc_static='-Bstatic'
  820.           ;;
  821.         lcc)
  822.           # Lucid
  823.           ac_cv_prog_cc_pic='-pic'
  824.           ;;
  825.         *)
  826.           ;;
  827.       esac
  828.       ;;
  829.     tandem*)
  830.       case "$cc_basename" in
  831.         NCC)
  832.           # NonStop-UX NCC 3.20
  833.           ac_cv_prog_cc_pic='-KPIC'
  834.           ;;
  835.         *)
  836.           ;;
  837.       esac
  838.       ;;
  839.     unixware*)
  840.       ;;
  841.     vxworks*)
  842.       ;;
  843.     *)
  844.       ac_cv_prog_cc_can_build_shared=no
  845.       ;;
  846.   esac
  847. fi
  848. ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
  849.  
  850.  
  851. # Figure out "hidden" C++ library dependencies from verbose
  852. # compiler output whening linking a shared library.
  853. cat > conftest.$ac_ext <<EOF
  854. class Foo
  855. {
  856. public:
  857.   Foo (void) { a = 0; }
  858. private:
  859.   int a;
  860. };
  861. EOF
  862.  
  863.  
  864. if (eval $ac_compile) 2>&5; then
  865.   # Parse the compiler output and extract the necessary
  866.   # objects, libraries and library flags.
  867.  
  868.   # Sentinel used to keep track of whether or not we are before
  869.   # the conftest object file.
  870.   pre_test_object_deps_done=no
  871.  
  872.   for p in `eval $output_verbose_link_cmds`; do
  873.  
  874.     case $p in
  875.  
  876.     -L* | -R* | -l*)
  877.        # Some compilers place space between "-{L,R}" and the path.
  878.        # Remove the space.
  879.        if test $p = "-L" \
  880.           || test $p = "-R"; then
  881.          prev=$p
  882.          continue
  883.        else
  884.          prev=
  885.        fi
  886.  
  887.        if test "$pre_test_object_deps_done" = no; then
  888.          case $p in
  889.      -L* | -R*)
  890.        # Internal compiler library paths should come after those
  891.        # provided the user.  The postdeps already come after the
  892.        # user supplied libs so there is no need to process them.
  893.            if test -z "$compiler_lib_search_path"; then
  894.              compiler_lib_search_path="${prev}${p}"
  895.            else
  896.              compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
  897.            fi
  898.            ;;
  899.          # The "-l" case would never come before the object being
  900.          # linked, so don't bother handling this case.
  901.          esac
  902.        else
  903.      add="${prev}${p}"
  904.      if test "x$remove_lgcc" = "xyes" ; then
  905.        case "$add" in
  906.          -lgcc ) add="" ;;
  907.        esac
  908.      fi
  909.      if test -n "$add" ; then
  910.            if test -z "$postdeps"; then
  911.              postdeps="$add"
  912.            else
  913.              postdeps="${postdeps} ${add}"
  914.            fi
  915.          fi
  916.        fi
  917.        ;;
  918.  
  919.     *.$objext)
  920.        # This assumes that the test object file only shows up
  921.        # once in the compiler output.
  922.        if test "$p" = "conftest.$objext"; then
  923.          pre_test_object_deps_done=yes
  924.          continue
  925.        fi
  926.  
  927.        if test "$pre_test_object_deps_done" = no; then
  928.          if test -z "$predep_objects"; then
  929.            predep_objects="$p"
  930.          else
  931.            predep_objects="$predep_objects $p"
  932.          fi
  933.        else
  934.          if test -z "$postdep_objects"; then
  935.            postdep_objects="$p"
  936.          else
  937.            postdep_objects="$postdep_objects $p"
  938.          fi
  939.        fi
  940.        ;;
  941.  
  942.     *) ;; # Ignore the rest.
  943.  
  944.     esac
  945.   done
  946.  
  947.   # Clean up.
  948.   rm -f a.out
  949. else
  950.   echo "ltcf-cxx.sh: error: problem compiling test program"
  951. fi
  952.  
  953. $rm -f confest.$objext
  954.  
  955. if test "x$skip_need_lc_check" = "xyes" ; then
  956.   need_lc=no
  957. else
  958.   case " $postdeps " in
  959.   *" -lc "*) need_lc=no ;;
  960.   *) need_lc=yes ;;
  961.   esac
  962. fi
  963.