xref: /openbsd-src/gnu/lib/libstdc++/ltcf-cxx.sh (revision 303bb1e3b444db65cfc482e0b96fcdf7be227b8b)
103a78d15Sespie#### This script is meant to be sourced by ltconfig.
203a78d15Sespie
303a78d15Sespie# ltcf-cxx.sh - Create a C++ compiler specific configuration
403a78d15Sespie#
503a78d15Sespie# Copyright (C) 1996-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
603a78d15Sespie# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
703a78d15Sespie#
803a78d15Sespie# Original C++ support by:Gary V. Vaughan <gvv@techie.com>
903a78d15Sespie#    Alexandre Oliva <oliva@lsd.ic.unicamp.br>
1003a78d15Sespie#    Ossama Othman <ossama@debian.org>
1103a78d15Sespie#    Thomas Thanner <tanner@gmx.de>
1203a78d15Sespie#
1303a78d15Sespie# This file is free software; you can redistribute it and/or modify it
1403a78d15Sespie# under the terms of the GNU General Public License as published by
1503a78d15Sespie# the Free Software Foundation; either version 2 of the License, or
1603a78d15Sespie# (at your option) any later version.
1703a78d15Sespie#
1803a78d15Sespie# This program is distributed in the hope that it will be useful, but
1903a78d15Sespie# WITHOUT ANY WARRANTY; without even the implied warranty of
2003a78d15Sespie# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2103a78d15Sespie# General Public License for more details.
2203a78d15Sespie#
2303a78d15Sespie# You should have received a copy of the GNU General Public License
2403a78d15Sespie# along with this program; if not, write to the Free Software
2503a78d15Sespie# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2603a78d15Sespie#
2703a78d15Sespie# As a special exception to the GNU General Public License, if you
2803a78d15Sespie# distribute this file as part of a program that contains a
2903a78d15Sespie# configuration script generated by Autoconf, you may include it under
3003a78d15Sespie# the same distribution terms that you use for the rest of that program.
3103a78d15Sespie
3203a78d15Sespie
3303a78d15Sespie# Source file extension for C++ test sources.
3403a78d15Sespieac_ext=cc
3503a78d15Sespie
3603a78d15Sespie# Object file extension for compiled C++ test sources.
3703a78d15Sespieobjext=o
3803a78d15Sespie
3903a78d15Sespie# Code to be used in simple compile tests
4003a78d15Sespielt_simple_compile_test_code="int some_variable = 0;"
4103a78d15Sespie
4203a78d15Sespie# Code to be used in simple link tests
4303a78d15Sespielt_simple_link_test_code='int main(int, char *[]) { return (0); }'
4403a78d15Sespie
4503a78d15Sespie# C++ compiler
4603a78d15SespieCXX=${CXX-c++}
4703a78d15Sespie
4803a78d15Sespie# ltmain only uses $CC for tagged configurations so make sure $CC is set.
4903a78d15SespieCC=${CC-"$CXX"}
5003a78d15SespieCFLAGS=${CFLAGS-"$CXXFLAGS"}
5103a78d15Sespie
5203a78d15Sespie# Allow CC to be a program name with arguments.
5303a78d15Sespieset dummy $CC
5403a78d15Sespiecompiler=$2
5503a78d15Sespiecc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
5603a78d15Sespie
5703a78d15Sespie# Check if we are using GNU gcc  (taken/adapted from configure script)
5803a78d15Sespie# We need to check here since "--with-gcc" is set at configure time,
5903a78d15Sespie# not ltconfig time!
6003a78d15Sespiecat > conftest.$ac_ext <<EOF
6103a78d15Sespie#ifdef __GNUC__
6203a78d15Sespie  yes;
6303a78d15Sespie#endif
6403a78d15SespieEOF
6503a78d15Sespieif { 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
6603a78d15Sespie  with_gcc=yes
6703a78d15Sespie
6803a78d15Sespie  # Set up default GNU C++ configuration
6903a78d15Sespie
7003a78d15Sespie  # Check if GNU C++ uses GNU ld as the underlying linker, since the
7103a78d15Sespie  # archiving commands below assume that GNU ld is being used.  The
7203a78d15Sespie  # assumption here is that the linker is going to be the same as that
7303a78d15Sespie  # used by the C compiler.  For the purposes of GCC, this is ok, but
7403a78d15Sespie  # if someone uses g++ along with a non-GNU C compiler that doesn't
7503a78d15Sespie  # use GNU ld, we may lose.  This is ok for the toolchain tree, since
7603a78d15Sespie  # the only users of ltcf-cxx.sh are libstdc++-v3 and libjava,
7703a78d15Sespie  # anyway, and those use both gcc and g++, so the settings are bound
7803a78d15Sespie  # to be the same.
7903a78d15Sespie
8003a78d15Sespie  if test "$with_gnu_ld" = yes; then
8103a78d15Sespie    archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
8203a78d15Sespie    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'
8303a78d15Sespie
8403a78d15Sespie    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
8503a78d15Sespie    export_dynamic_flag_spec='${wl}--export-dynamic'
8603a78d15Sespie
8703a78d15Sespie    # If archive_cmds runs LD, not CC, wlarc should be empty
8803a78d15Sespie    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
8903a78d15Sespie    #     investigate it a little bit more. (MM)
9003a78d15Sespie    wlarc='${wl}'
9103a78d15Sespie
9203a78d15Sespie    # ancient GNU ld didn't support --whole-archive et. al.
9303a78d15Sespie    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
9403a78d15Sespie        egrep 'no-whole-archive' > /dev/null; then
9503a78d15Sespie      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
9603a78d15Sespie    else
9703a78d15Sespie      whole_archive_flag_spec=
9803a78d15Sespie    fi
9903a78d15Sespie  else
10003a78d15Sespie    wlarc=
10103a78d15Sespie
10203a78d15Sespie    # A generic and very simple default shared library creation
10303a78d15Sespie    # command for GNU C++ for the case where it uses the native
10403a78d15Sespie    # linker, instead of GNU ld.  If possible, this setting should
10503a78d15Sespie    # overridden to take advantage of the native linker features on
10603a78d15Sespie    # the platform it is being used on.
10703a78d15Sespie    archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
10803a78d15Sespie  fi
10903a78d15Sespie
11003a78d15Sespie  # Commands to make compiler produce verbose output that lists
11103a78d15Sespie  # what "hidden" libraries, object files and flags are used when
11203a78d15Sespie  # linking a shared library.
11303a78d15Sespie  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
11403a78d15Sespie
11503a78d15Sespieelse
11603a78d15Sespie  with_gcc=no
11703a78d15Sespie  wlarc=
11803a78d15Sespiefi
11903a78d15Sespie
12003a78d15Sespie# PORTME: fill in a description of your system's C++ link characteristics
12103a78d15Sespiecase $host_os in
12203a78d15Sespie  aix3*)
12303a78d15Sespie    # FIXME: insert proper C++ library support
12403a78d15Sespie    ld_shlibs=no
12503a78d15Sespie    ;;
12603a78d15Sespie  aix4* | aix5*)
12703a78d15Sespie    archive_cmds=''
12803a78d15Sespie    hardcode_direct=yes
12903a78d15Sespie    hardcode_libdir_separator=':'
13003a78d15Sespie    link_all_deplibs=yes
13103a78d15Sespie    # When large executables or shared objects are built, AIX ld can
13203a78d15Sespie    # have problems creating the table of contents.  If linking a library
13303a78d15Sespie    # or program results in "error TOC overflow" add -mminimal-toc to
13403a78d15Sespie    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
13503a78d15Sespie    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
13603a78d15Sespie    if test "$with_gcc" = yes; then
13703a78d15Sespie      case $host_os in aix4.[012]|aix4.[012].*)
13803a78d15Sespie      # We only want to do this on AIX 4.2 and lower, the check
13903a78d15Sespie      # below for broken collect2 doesn't work under 4.3+
14003a78d15Sespie        collect2name=`${CC} -print-prog-name=collect2`
14103a78d15Sespie        if test -f "$collect2name" && \
14203a78d15Sespie	   strings "$collect2name" | grep resolve_lib_name >/dev/null
14303a78d15Sespie        then
14403a78d15Sespie	  # We have reworked collect2
14503a78d15Sespie	  hardcode_direct=yes
14603a78d15Sespie        else
14703a78d15Sespie	  # We have old collect2
14803a78d15Sespie	  hardcode_direct=unsupported
14903a78d15Sespie	  # It fails to find uninstalled libraries when the uninstalled
15003a78d15Sespie	  # path is not listed in the libpath.  Setting hardcode_minus_L
15103a78d15Sespie	  # to unsupported forces relinking
15203a78d15Sespie	  hardcode_minus_L=yes
15303a78d15Sespie	  hardcode_libdir_flag_spec='-L$libdir'
15403a78d15Sespie	  hardcode_libdir_separator=
15503a78d15Sespie        fi
15603a78d15Sespie      esac
15703a78d15Sespie      shared_flag='-shared'
15803a78d15Sespie    else
15903a78d15Sespie      # not using gcc
16003a78d15Sespie      if test "$host_cpu" = ia64; then
16103a78d15Sespie        shared_flag='${wl}-G'
16203a78d15Sespie      else
16303a78d15Sespie        shared_flag='${wl}-bM:SRE'
16403a78d15Sespie      fi
16503a78d15Sespie    fi
16603a78d15Sespie
16703a78d15Sespie    if test "$host_cpu" = ia64; then
16803a78d15Sespie      # On IA64, the linker does run time linking by default, so we don't
16903a78d15Sespie      # have to do anything special.
17003a78d15Sespie      aix_use_runtimelinking=no
17103a78d15Sespie      if test $with_gnu_ld = no; then
17203a78d15Sespie        exp_sym_flag='-Bexport'
17303a78d15Sespie        no_entry_flag=""
17403a78d15Sespie      fi
17503a78d15Sespie    else
17603a78d15Sespie      # Test if we are trying to use run time linking, or normal AIX style linking.
17703a78d15Sespie      # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
17803a78d15Sespie      aix_use_runtimelinking=no
17903a78d15Sespie      for ld_flag in $LDFLAGS; do
18003a78d15Sespie        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
18103a78d15Sespie          aix_use_runtimelinking=yes
18203a78d15Sespie          break
18303a78d15Sespie        fi
18403a78d15Sespie      done
18503a78d15Sespie      exp_sym_flag='-bexport'
18603a78d15Sespie      no_entry_flag='-bnoentry'
18703a78d15Sespie    fi
18803a78d15Sespie    # It seems that -bexpall does not export symbols beginning with
18903a78d15Sespie    # underscore (_), so it is better to generate a list of symbols to export.
19003a78d15Sespie    always_export_symbols=yes
19103a78d15Sespie    if test "$aix_use_runtimelinking" = yes; then
19203a78d15Sespie      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
19303a78d15Sespie      allow_undefined_flag=' -Wl,-G'
19403a78d15Sespie      archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}-brtl \${wl}$exp_sym_flag:\$export_symbols"
19503a78d15Sespie     else
19603a78d15Sespie      if test "$host_cpu" = ia64; then
19703a78d15Sespie        if test $with_gnu_ld = no; then
19803a78d15Sespie          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
19903a78d15Sespie          allow_undefined_flag="-z nodefs"
20003a78d15Sespie          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"
20103a78d15Sespie        fi
20203a78d15Sespie      else
20303a78d15Sespie        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
20403a78d15Sespie        # Warning - without using the other run time loading flags, -berok will
20503a78d15Sespie        #           link without error, but may produce a broken library.
20603a78d15Sespie        no_undefined_flag=' ${wl}-bnoerok'
20703a78d15Sespie        allow_undefined_flag=' ${wl}-berok'
20803a78d15Sespie        # -bexpall does not export symbols beginning with underscore (_)
20903a78d15Sespie        always_export_symbols=yes
21003a78d15Sespie        # Exported symbols can be pulled into shared objects from archives
21103a78d15Sespie        whole_archive_flag_spec=' '
21203a78d15Sespie        build_libtool_need_lc=yes
21303a78d15Sespie        # This is similar to how AIX traditionally builds it's shared libraries.
21403a78d15Sespie        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
21503a78d15Sespie      fi
21603a78d15Sespie    fi
21703a78d15Sespie    ;;
21803a78d15Sespie  chorus*)
21903a78d15Sespie    case $cc_basename in
22003a78d15Sespie      *)
22103a78d15Sespie        # FIXME: insert proper C++ library support
22203a78d15Sespie        ld_shlibs=no
22303a78d15Sespie        ;;
22403a78d15Sespie    esac
22503a78d15Sespie    ;;
22603a78d15Sespie  dgux*)
22703a78d15Sespie    case $cc_basename in
22803a78d15Sespie      ec++)
22903a78d15Sespie        # FIXME: insert proper C++ library support
23003a78d15Sespie        ld_shlibs=no
23103a78d15Sespie        ;;
23203a78d15Sespie      ghcx)
23303a78d15Sespie        # Green Hills C++ Compiler
23403a78d15Sespie        # FIXME: insert proper C++ library support
23503a78d15Sespie        ld_shlibs=no
23603a78d15Sespie        ;;
23703a78d15Sespie      *)
23803a78d15Sespie        # FIXME: insert proper C++ library support
23903a78d15Sespie        ld_shlibs=no
24003a78d15Sespie        ;;
24103a78d15Sespie    esac
24203a78d15Sespie    ;;
24303a78d15Sespie  freebsd[12]*)
24403a78d15Sespie    # C++ shared libraries reported to be fairly broken before switch to ELF
24503a78d15Sespie    ld_shlibs=no
24603a78d15Sespie    ;;
24703a78d15Sespie  freebsd*)
24803a78d15Sespie    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
24903a78d15Sespie    # conventions
25003a78d15Sespie    ld_shlibs=yes
25103a78d15Sespie    ;;
25203a78d15Sespie  gnu*)
25303a78d15Sespie    ;;
25403a78d15Sespie  hpux*)
25503a78d15Sespie    if test $with_gnu_ld = no; then
25603a78d15Sespie      case "$host_cpu" in
25703a78d15Sespie	ia64*)
25803a78d15Sespie	  hardcode_libdir_flag_spec='-L$libdir'
25903a78d15Sespie	  hardcode_shlibpath_var=no ;;
26003a78d15Sespie	*)
26103a78d15Sespie	  hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' ;;
26203a78d15Sespie      esac
26303a78d15Sespie      hardcode_direct=yes
26403a78d15Sespie      hardcode_libdir_separator=:
26503a78d15Sespie      export_dynamic_flag_spec='${wl}-E'
26603a78d15Sespie    fi
26703a78d15Sespie    hardcode_minus_L=yes # Not in the search PATH, but as the default
26803a78d15Sespie			 # location of the library.
26903a78d15Sespie
27003a78d15Sespie    case $cc_basename in
27103a78d15Sespie      CC)
27203a78d15Sespie        # FIXME: insert proper C++ library support
27303a78d15Sespie        ld_shlibs=no
27403a78d15Sespie        ;;
27503a78d15Sespie      aCC)
27603a78d15Sespie	case $host_os in
27703a78d15Sespie	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' ;;
27803a78d15Sespie	*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
27903a78d15Sespie	esac
28003a78d15Sespie        # Commands to make compiler produce verbose output that lists
28103a78d15Sespie        # what "hidden" libraries, object files and flags are used when
28203a78d15Sespie        # linking a shared library.
28303a78d15Sespie        #
28403a78d15Sespie        # There doesn't appear to be a way to prevent this compiler from
28503a78d15Sespie        # explicitly linking system object files so we need to strip them
28603a78d15Sespie        # from the output so that they don't get included in the library
28703a78d15Sespie        # dependencies.
28803a78d15Sespie        output_verbose_link_cmd='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'
28903a78d15Sespie        ;;
29003a78d15Sespie      *)
29103a78d15Sespie        if test $with_gcc = yes; then
29203a78d15Sespie	  if test $with_gnu_ld = no; then
29303a78d15Sespie	    case "$host_os" in
29403a78d15Sespie	    hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${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' ;;
29503a78d15Sespie	    *)
29603a78d15Sespie	      case "$host_cpu" in
29703a78d15Sespie		ia64*)
29803a78d15Sespie		  archive_cmds='$LD -b +h $soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;;
29903a78d15Sespie		*)
30003a78d15Sespie		  archive_cmds='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
30103a78d15Sespie	      esac
30203a78d15Sespie	      ;;
30303a78d15Sespie	    esac
30403a78d15Sespie	  fi
30503a78d15Sespie	else
30603a78d15Sespie	  # FIXME: insert proper C++ library support
30703a78d15Sespie          ld_shlibs=no
30803a78d15Sespie	fi
30903a78d15Sespie        ;;
31003a78d15Sespie    esac
31103a78d15Sespie    ;;
31203a78d15Sespie  irix5* | irix6*)
31303a78d15Sespie    case $cc_basename in
31403a78d15Sespie      CC)
31503a78d15Sespie        # SGI C++
31603a78d15Sespie        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'
31703a78d15Sespie
31803a78d15Sespie	# Archives containing C++ object files must be created using
31903a78d15Sespie	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
32003a78d15Sespie	# necessary to make sure instantiated templates are included
32103a78d15Sespie	# in the archive.
32203a78d15Sespie	old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
32303a78d15Sespie	;;
32403a78d15Sespie      *)
32503a78d15Sespie        if test "$with_gcc" = yes; then
32603a78d15Sespie          if test "$with_gnu_ld" = no; then
32703a78d15Sespie            archive_cmds='$CC -shared -nostdlib $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'
32803a78d15Sespie          else
32903a78d15Sespie            archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
33003a78d15Sespie          fi
33103a78d15Sespie        fi
33203a78d15Sespie        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
33303a78d15Sespie        hardcode_libdir_separator=:
33403a78d15Sespie        link_all_deplibs=yes
33503a78d15Sespie        ;;
33603a78d15Sespie    esac
33703a78d15Sespie    ;;
33803a78d15Sespie  linux*)
33903a78d15Sespie    case $cc_basename in
34003a78d15Sespie      KCC)
34103a78d15Sespie        # Kuck and Associates, Inc. (KAI) C++ Compiler
34203a78d15Sespie
34303a78d15Sespie        # KCC will only create a shared library if the output file
34403a78d15Sespie        # ends with ".so" (or ".sl" for HP-UX), so rename the library
34503a78d15Sespie        # to its proper name (with version) after linking.
34603a78d15Sespie        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'
34703a78d15Sespie        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'
34803a78d15Sespie
34903a78d15Sespie        # Commands to make compiler produce verbose output that lists
35003a78d15Sespie        # what "hidden" libraries, object files and flags are used when
35103a78d15Sespie        # linking a shared library.
35203a78d15Sespie        #
35303a78d15Sespie        # There doesn't appear to be a way to prevent this compiler from
35403a78d15Sespie        # explicitly linking system object files so we need to strip them
35503a78d15Sespie        # from the output so that they don't get included in the library
35603a78d15Sespie        # dependencies.
35703a78d15Sespie        output_verbose_link_cmd='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'
35803a78d15Sespie
35903a78d15Sespie        hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
36003a78d15Sespie        export_dynamic_flag_spec='${wl}--export-dynamic'
36103a78d15Sespie
36203a78d15Sespie	# Archives containing C++ object files must be created using
36303a78d15Sespie	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
36403a78d15Sespie        old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
36503a78d15Sespie        ;;
36603a78d15Sespie      cxx)
36703a78d15Sespie        # Compaq C++
36803a78d15Sespie        archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
36903a78d15Sespie        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'
37003a78d15Sespie
37103a78d15Sespie        runpath_var=LD_RUN_PATH
37203a78d15Sespie        hardcode_libdir_flag_spec='-rpath $libdir'
37303a78d15Sespie        hardcode_libdir_separator=:
37403a78d15Sespie
37503a78d15Sespie        # Commands to make compiler produce verbose output that lists
37603a78d15Sespie        # what "hidden" libraries, object files and flags are used when
37703a78d15Sespie        # linking a shared library.
37803a78d15Sespie        #
37903a78d15Sespie        # There doesn't appear to be a way to prevent this compiler from
38003a78d15Sespie        # explicitly linking system object files so we need to strip them
38103a78d15Sespie        # from the output so that they don't get included in the library
38203a78d15Sespie        # dependencies.
38303a78d15Sespie        output_verbose_link_cmd='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'
38403a78d15Sespie        ;;
38503a78d15Sespie    esac
38603a78d15Sespie    ;;
38703a78d15Sespie  lynxos*)
38803a78d15Sespie    # FIXME: insert proper C++ library support
38903a78d15Sespie    ld_shlibs=no
39003a78d15Sespie    ;;
39103a78d15Sespie  m88k*)
39203a78d15Sespie    # FIXME: insert proper C++ library support
39303a78d15Sespie    ld_shlibs=no
39403a78d15Sespie    ;;
39503a78d15Sespie  mvs*)
39603a78d15Sespie    case $cc_basename in
39703a78d15Sespie      cxx)
39803a78d15Sespie        # FIXME: insert proper C++ library support
39903a78d15Sespie        ld_shlibs=no
40003a78d15Sespie        ;;
40103a78d15Sespie      *)
40203a78d15Sespie        # FIXME: insert proper C++ library support
40303a78d15Sespie        ld_shlibs=no
40403a78d15Sespie        ;;
40503a78d15Sespie    esac
40603a78d15Sespie    ;;
40703a78d15Sespie  netbsd*)
40803a78d15Sespie    # NetBSD uses g++ - do we need to do anything?
40903a78d15Sespie    ;;
410c5bbcf84Sespie  openbsd*)
411c5bbcf84Sespie    if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
412c5bbcf84Sespie      # MM: OpenBSD 2.7 uses G++, but not GNU ld
413c5bbcf84Sespie      archive_cmds='$CC $pic_flag -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
414c5bbcf84Sespie      archive_expsym_cmds='$CC $pic_flag -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
415c5bbcf84Sespie      old_archive_cmds="$old_archive_cmds~"'$RANLIB $oldlib'
416c5bbcf84Sespie      hardcode_libdir_flag_spec='${wl}-R$libdir'
417c5bbcf84Sespie      hardcode_direct=yes
418c5bbcf84Sespie      hardcode_shlibpath_var=no
419c5bbcf84Sespie      remove_lgcc=yes
420c5bbcf84Sespie      output_verbose_link_cmds='$CC $ac_cv_prog_cc_pic -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
421c5bbcf84Sespie    fi
422ad3b768aSmickey    if [ "$host_cpu" = "hppa" ]; then
423ad3b768aSmickey      deplibs_check_method=pass_all;
424ad3b768aSmickey    fi
425*303bb1e3Sdrahn    if [ "$host_cpu" = "sh" ]; then
426*303bb1e3Sdrahn      deplibs_check_method=pass_all;
427*303bb1e3Sdrahn    fi
428c5bbcf84Sespie    ;;
42903a78d15Sespie  osf3*)
43003a78d15Sespie    case $cc_basename in
43103a78d15Sespie      KCC)
43203a78d15Sespie        # Kuck and Associates, Inc. (KAI) C++ Compiler
43303a78d15Sespie
43403a78d15Sespie        # KCC will only create a shared library if the output file
43503a78d15Sespie        # ends with ".so" (or ".sl" for HP-UX), so rename the library
43603a78d15Sespie        # to its proper name (with version) after linking.
43703a78d15Sespie        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'
43803a78d15Sespie
43903a78d15Sespie        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
44003a78d15Sespie        hardcode_libdir_separator=:
44103a78d15Sespie
44203a78d15Sespie	# Archives containing C++ object files must be created using
44303a78d15Sespie	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
44403a78d15Sespie        old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
44503a78d15Sespie
44603a78d15Sespie        ;;
44703a78d15Sespie      RCC)
44803a78d15Sespie        # Rational C++ 2.4.1
44903a78d15Sespie        # FIXME: insert proper C++ library support
45003a78d15Sespie        ld_shlibs=no
45103a78d15Sespie        ;;
45203a78d15Sespie      cxx)
45303a78d15Sespie        allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
45403a78d15Sespie        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'
45503a78d15Sespie
45603a78d15Sespie        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
45703a78d15Sespie        hardcode_libdir_separator=:
45803a78d15Sespie
45903a78d15Sespie        # Commands to make compiler produce verbose output that lists
46003a78d15Sespie        # what "hidden" libraries, object files and flags are used when
46103a78d15Sespie        # linking a shared library.
46203a78d15Sespie        #
46303a78d15Sespie        # There doesn't appear to be a way to prevent this compiler from
46403a78d15Sespie        # explicitly linking system object files so we need to strip them
46503a78d15Sespie        # from the output so that they don't get included in the library
46603a78d15Sespie        # dependencies.
46703a78d15Sespie        output_verbose_link_cmd='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'
46803a78d15Sespie        ;;
46903a78d15Sespie      *)
47003a78d15Sespie	if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
47103a78d15Sespie	  allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
47203a78d15Sespie	  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'
47303a78d15Sespie
47403a78d15Sespie	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
47503a78d15Sespie	  hardcode_libdir_separator=:
47603a78d15Sespie
47703a78d15Sespie	  # Commands to make compiler produce verbose output that lists
47803a78d15Sespie	  # what "hidden" libraries, object files and flags are used when
47903a78d15Sespie	  # linking a shared library.
48003a78d15Sespie	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
48103a78d15Sespie    else
48203a78d15Sespie          # FIXME: insert proper C++ library support
48303a78d15Sespie          ld_shlibs=no
48403a78d15Sespie    fi
48503a78d15Sespie        ;;
48603a78d15Sespie    esac
48703a78d15Sespie    ;;
48803a78d15Sespie  osf4* | osf5*)
48903a78d15Sespie    case $cc_basename in
49003a78d15Sespie      KCC)
49103a78d15Sespie        # Kuck and Associates, Inc. (KAI) C++ Compiler
49203a78d15Sespie
49303a78d15Sespie        # KCC will only create a shared library if the output file
49403a78d15Sespie        # ends with ".so" (or ".sl" for HP-UX), so rename the library
49503a78d15Sespie        # to its proper name (with version) after linking.
49603a78d15Sespie        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'
49703a78d15Sespie
49803a78d15Sespie        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
49903a78d15Sespie        hardcode_libdir_separator=:
50003a78d15Sespie
50103a78d15Sespie	# Archives containing C++ object files must be created using
50203a78d15Sespie	# the KAI C++ compiler.
50303a78d15Sespie        old_archive_cmds='$CC -o $oldlib $oldobjs'
50403a78d15Sespie        ;;
50503a78d15Sespie      RCC)
50603a78d15Sespie        # Rational C++ 2.4.1
50703a78d15Sespie        # FIXME: insert proper C++ library support
50803a78d15Sespie        ld_shlibs=no
50903a78d15Sespie        ;;
51003a78d15Sespie      cxx)
51103a78d15Sespie        allow_undefined_flag=' -expect_unresolved \*'
51203a78d15Sespie        archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
51303a78d15Sespie	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~
51403a78d15Sespie	  echo "-hidden">> $lib.exp~
51503a78d15Sespie	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry $objdir/so_locations -o $lib~
51603a78d15Sespie	  $rm $lib.exp'
51703a78d15Sespie
51803a78d15Sespie        hardcode_libdir_flag_spec='-rpath $libdir'
51903a78d15Sespie        hardcode_libdir_separator=:
52003a78d15Sespie
52103a78d15Sespie        # Commands to make compiler produce verbose output that lists
52203a78d15Sespie        # what "hidden" libraries, object files and flags are used when
52303a78d15Sespie        # linking a shared library.
52403a78d15Sespie        #
52503a78d15Sespie        # There doesn't appear to be a way to prevent this compiler from
52603a78d15Sespie        # explicitly linking system object files so we need to strip them
52703a78d15Sespie        # from the output so that they don't get included in the library
52803a78d15Sespie        # dependencies.
52903a78d15Sespie        output_verbose_link_cmd='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'
53003a78d15Sespie        ;;
53103a78d15Sespie      *)
53203a78d15Sespie	if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
53303a78d15Sespie	  allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
53403a78d15Sespie	  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'
53503a78d15Sespie
53603a78d15Sespie	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
53703a78d15Sespie	  hardcode_libdir_separator=:
53803a78d15Sespie
53903a78d15Sespie	  # Commands to make compiler produce verbose output that lists
54003a78d15Sespie	  # what "hidden" libraries, object files and flags are used when
54103a78d15Sespie	  # linking a shared library.
54203a78d15Sespie	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
54303a78d15Sespie    else
54403a78d15Sespie	  # FIXME: insert proper C++ library support
54503a78d15Sespie	  ld_shlibs=no
54603a78d15Sespie    fi
54703a78d15Sespie        ;;
54803a78d15Sespie    esac
54903a78d15Sespie    ;;
55003a78d15Sespie  psos*)
55103a78d15Sespie    # FIXME: insert proper C++ library support
55203a78d15Sespie    ld_shlibs=no
55303a78d15Sespie    ;;
55403a78d15Sespie  sco*)
55503a78d15Sespie    case $cc_basename in
55603a78d15Sespie      CC)
55703a78d15Sespie        # FIXME: insert proper C++ library support
55803a78d15Sespie        ld_shlibs=no
55903a78d15Sespie        ;;
56003a78d15Sespie      *)
56103a78d15Sespie        # FIXME: insert proper C++ library support
56203a78d15Sespie        ld_shlibs=no
56303a78d15Sespie        ;;
56403a78d15Sespie    esac
56503a78d15Sespie    ;;
56603a78d15Sespie  sunos4*)
56703a78d15Sespie    case $cc_basename in
56803a78d15Sespie      CC)
56903a78d15Sespie        # Sun C++ 4.x
57003a78d15Sespie        # FIXME: insert proper C++ library support
57103a78d15Sespie        ld_shlibs=no
57203a78d15Sespie        ;;
57303a78d15Sespie      lcc)
57403a78d15Sespie        # Lucid
57503a78d15Sespie        # FIXME: insert proper C++ library support
57603a78d15Sespie        ld_shlibs=no
57703a78d15Sespie        ;;
57803a78d15Sespie      *)
57903a78d15Sespie        # FIXME: insert proper C++ library support
58003a78d15Sespie        ld_shlibs=no
58103a78d15Sespie        ;;
58203a78d15Sespie    esac
58303a78d15Sespie    ;;
58403a78d15Sespie  solaris*)
58503a78d15Sespie    case $cc_basename in
58603a78d15Sespie      CC)
58703a78d15Sespie	# Sun C++ 4.2, 5.x and Centerline C++
58803a78d15Sespie        no_undefined_flag=' -zdefs'
58903a78d15Sespie        archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
59003a78d15Sespie        archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
59103a78d15Sespie        $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'
59203a78d15Sespie
59303a78d15Sespie        hardcode_libdir_flag_spec='-R$libdir'
59403a78d15Sespie        hardcode_shlibpath_var=no
59503a78d15Sespie        case $host_os in
59603a78d15Sespie          solaris2.[0-5] | solaris2.[0-5].*) ;;
59703a78d15Sespie          *)
59803a78d15Sespie            # The C++ compiler is used as linker so we must use $wl
59903a78d15Sespie            # flag to pass the commands to the underlying system
60003a78d15Sespie            # linker.
60103a78d15Sespie            # Supported since Solaris 2.6 (maybe 2.5.1?)
60203a78d15Sespie            whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
60303a78d15Sespie            ;;
60403a78d15Sespie        esac
60503a78d15Sespie        link_all_deplibs=yes
60603a78d15Sespie
60703a78d15Sespie        # Commands to make compiler produce verbose output that lists
60803a78d15Sespie        # what "hidden" libraries, object files and flags are used when
60903a78d15Sespie        # linking a shared library.
61003a78d15Sespie        #
61103a78d15Sespie        # There doesn't appear to be a way to prevent this compiler from
61203a78d15Sespie        # explicitly linking system object files so we need to strip them
61303a78d15Sespie        # from the output so that they don't get included in the library
61403a78d15Sespie        # dependencies.
61503a78d15Sespie        output_verbose_link_cmd='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'
61603a78d15Sespie
61703a78d15Sespie	# Archives containing C++ object files must be created using
61803a78d15Sespie	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
61903a78d15Sespie        # necessary to make sure instantiated templates are included
62003a78d15Sespie        # in the archive.
62103a78d15Sespie        old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
62203a78d15Sespie        ;;
62303a78d15Sespie      gcx)
62403a78d15Sespie        # Green Hills C++ Compiler
62503a78d15Sespie        archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
62603a78d15Sespie
62703a78d15Sespie        # The C++ compiler must be used to create the archive.
62803a78d15Sespie        old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
62903a78d15Sespie        ;;
63003a78d15Sespie      *)
63103a78d15Sespie        # GNU C++ compiler with Solaris linker
63203a78d15Sespie        if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
63303a78d15Sespie	  no_undefined_flag=' ${wl}-z ${wl}defs'
63403a78d15Sespie          if $CC --version | egrep -v '^2\.7' > /dev/null; then
63503a78d15Sespie            archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
63603a78d15Sespie            archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
63703a78d15Sespie		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
63803a78d15Sespie
63903a78d15Sespie            # Commands to make compiler produce verbose output that lists
64003a78d15Sespie            # what "hidden" libraries, object files and flags are used when
64103a78d15Sespie            # linking a shared library.
64203a78d15Sespie            output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
64303a78d15Sespie          else
64403a78d15Sespie            # g++ 2.7 appears to require `-G' NOT `-shared' on this
64503a78d15Sespie            # platform.
64603a78d15Sespie            archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
64703a78d15Sespie            archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
64803a78d15Sespie		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
64903a78d15Sespie
65003a78d15Sespie            # Commands to make compiler produce verbose output that lists
65103a78d15Sespie            # what "hidden" libraries, object files and flags are used when
65203a78d15Sespie            # linking a shared library.
65303a78d15Sespie            output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
65403a78d15Sespie          fi
65503a78d15Sespie
65603a78d15Sespie          hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
65703a78d15Sespie        fi
65803a78d15Sespie        ;;
65903a78d15Sespie    esac
66003a78d15Sespie    ;;
66103a78d15Sespie  tandem*)
66203a78d15Sespie    case $cc_basename in
66303a78d15Sespie      NCC)
66403a78d15Sespie        # NonStop-UX NCC 3.20
66503a78d15Sespie        # FIXME: insert proper C++ library support
66603a78d15Sespie        ld_shlibs=no
66703a78d15Sespie        ;;
66803a78d15Sespie      *)
66903a78d15Sespie        # FIXME: insert proper C++ library support
67003a78d15Sespie        ld_shlibs=no
67103a78d15Sespie        ;;
67203a78d15Sespie    esac
67303a78d15Sespie    ;;
67403a78d15Sespie  unixware*)
67503a78d15Sespie    # FIXME: insert proper C++ library support
67603a78d15Sespie    ld_shlibs=no
67703a78d15Sespie    ;;
67803a78d15Sespie  vxworks*)
67903a78d15Sespie    # FIXME: insert proper C++ library support
68003a78d15Sespie    ld_shlibs=no
68103a78d15Sespie    ;;
68203a78d15Sespie  *)
68303a78d15Sespie    # FIXME: insert proper C++ library support
68403a78d15Sespie    ld_shlibs=no
68503a78d15Sespie    ;;
68603a78d15Sespieesac
68703a78d15Sespie
68803a78d15Sespie
68903a78d15Sespie## Compiler Characteristics: PIC flags, static flags, etc
69003a78d15Sespie
69103a78d15Sespie# We don't use cached values here since only the C compiler
69203a78d15Sespie# characteristics should be cached.
69303a78d15Sespieac_cv_prog_cc_pic=
69403a78d15Sespieac_cv_prog_cc_shlib=
69503a78d15Sespieac_cv_prog_cc_wl=
69603a78d15Sespieac_cv_prog_cc_static=
69703a78d15Sespieac_cv_prog_cc_no_builtin=
69803a78d15Sespieac_cv_prog_cc_can_build_shared=$can_build_shared
69903a78d15Sespie
70003a78d15Sespieac_cv_prog_cc_pic_works=
70103a78d15Sespieac_cv_prog_cc_static_works=
70203a78d15Sespie
70303a78d15Sespieif test "$with_gcc" = yes; then
70403a78d15Sespie  ac_cv_prog_cc_wl='-Wl,'
70503a78d15Sespie  ac_cv_prog_cc_static='-static'
70603a78d15Sespie
70703a78d15Sespie  case $host_os in
70803a78d15Sespie  aix*)
70903a78d15Sespie    # All AIX code is PIC.
71003a78d15Sespie    if test "$host_cpu" = ia64; then
71103a78d15Sespie      # AIX 5 now supports IA64 processor
71203a78d15Sespie      lt_cv_prog_cc_static='-Bstatic'
71303a78d15Sespie    else
71403a78d15Sespie      lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
71503a78d15Sespie    fi
71603a78d15Sespie    ;;
71703a78d15Sespie  amigaos*)
71803a78d15Sespie    # FIXME: we need at least 68020 code to build shared libraries, but
71903a78d15Sespie    # adding the `-m68020' flag to GCC prevents building anything better,
72003a78d15Sespie    # like `-m68040'.
72103a78d15Sespie    ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
72203a78d15Sespie    ;;
72303a78d15Sespie  beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
72403a78d15Sespie    # PIC is the default for these OSes.
72503a78d15Sespie    ;;
72603a78d15Sespie  cygwin* | mingw* | os2*)
72703a78d15Sespie    # This hack is so that the source file can tell whether it is being
72803a78d15Sespie    # built for inclusion in a dll (and should export symbols for example).
72903a78d15Sespie    ac_cv_prog_cc_pic='-DDLL_EXPORT'
73003a78d15Sespie    ;;
73103a78d15Sespie  darwin* | rhapsody*)
73203a78d15Sespie    # PIC is the default on this platform
73303a78d15Sespie    # Common symbols not allowed in MH_DYLIB files
73403a78d15Sespie    lt_cv_prog_cc_pic='-fno-common'
73503a78d15Sespie    ;;
73603a78d15Sespie  *djgpp*)
73703a78d15Sespie    # DJGPP does not support shared libraries at all
73803a78d15Sespie    ac_cv_prog_cc_pic=
73903a78d15Sespie    ;;
74003a78d15Sespie  sysv4*MP*)
74103a78d15Sespie    if test -d /usr/nec; then
74203a78d15Sespie      ac_cv_prog_cc_pic=-Kconform_pic
74303a78d15Sespie    fi
74403a78d15Sespie    ;;
74503a78d15Sespie  *)
74603a78d15Sespie    ac_cv_prog_cc_pic='-fPIC'
74703a78d15Sespie    ;;
74803a78d15Sespie  esac
74903a78d15Sespieelse
75003a78d15Sespie  case $host_os in
75103a78d15Sespie    aix4* | aix5*)
75203a78d15Sespie      # All AIX code is PIC.
75303a78d15Sespie      if test "$host_cpu" = ia64; then
75403a78d15Sespie        # AIX 5 now supports IA64 processor
75503a78d15Sespie        lt_cv_prog_cc_static='-Bstatic'
75603a78d15Sespie      else
75703a78d15Sespie        lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
75803a78d15Sespie      fi
75903a78d15Sespie      ;;
76003a78d15Sespie    chorus*)
76103a78d15Sespie      case $cc_basename in
76203a78d15Sespie      cxch68)
76303a78d15Sespie        # Green Hills C++ Compiler
76403a78d15Sespie        # 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"
76503a78d15Sespie        ;;
76603a78d15Sespie      esac
76703a78d15Sespie      ;;
76803a78d15Sespie    dgux*)
76903a78d15Sespie      case $cc_basename in
77003a78d15Sespie        ec++)
77103a78d15Sespie          ac_cv_prog_cc_pic='-KPIC'
77203a78d15Sespie          ;;
77303a78d15Sespie        ghcx)
77403a78d15Sespie          # Green Hills C++ Compiler
77503a78d15Sespie          ac_cv_prog_cc_pic='-pic'
77603a78d15Sespie          ;;
77703a78d15Sespie        *)
77803a78d15Sespie          ;;
77903a78d15Sespie      esac
78003a78d15Sespie      ;;
78103a78d15Sespie    freebsd*)
78203a78d15Sespie      # FreeBSD uses GNU C++
78303a78d15Sespie      ;;
78403a78d15Sespie    gnu*)
78503a78d15Sespie      ;;
78603a78d15Sespie    hpux9* | hpux10* | hpux11*)
78703a78d15Sespie      case $cc_basename in
78803a78d15Sespie        CC)
78903a78d15Sespie          ac_cv_prog_cc_wl='-Wl,'
79003a78d15Sespie          ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
79103a78d15Sespie          ac_cv_prog_cc_pic='+Z'
79203a78d15Sespie          ;;
79303a78d15Sespie        aCC)
79403a78d15Sespie          ac_cv_prog_cc_wl='-Wl,'
79503a78d15Sespie          ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
79603a78d15Sespie          ac_cv_prog_cc_pic='+Z'
79703a78d15Sespie          ;;
79803a78d15Sespie        *)
79903a78d15Sespie          ;;
80003a78d15Sespie      esac
80103a78d15Sespie      ;;
80203a78d15Sespie    irix5* | irix6*)
80303a78d15Sespie      case $cc_basename in
80403a78d15Sespie        CC)
80503a78d15Sespie          ac_cv_prog_cc_wl='-Wl,'
80603a78d15Sespie          ac_cv_prog_cc_static='-non_shared'
80703a78d15Sespie          ac_cv_prog_cc_pic='-KPIC'
80803a78d15Sespie          ;;
80903a78d15Sespie        *)
81003a78d15Sespie          ;;
81103a78d15Sespie      esac
81203a78d15Sespie      ;;
81303a78d15Sespie    linux*)
81403a78d15Sespie      case $cc_basename in
81503a78d15Sespie        KCC)
81603a78d15Sespie          # KAI C++ Compiler
81703a78d15Sespie          ac_cv_prog_cc_wl='--backend -Wl,'
81803a78d15Sespie          ac_cv_prog_cc_pic='-fPIC'
81903a78d15Sespie          ;;
82003a78d15Sespie        cxx)
82103a78d15Sespie          # Compaq C++
82203a78d15Sespie          # Make sure the PIC flag is empty.  It appears that all Alpha
82303a78d15Sespie          # Linux and Compaq Tru64 Unix objects are PIC.
82403a78d15Sespie          ac_cv_prog_cc_pic=
82503a78d15Sespie          ac_cv_prog_cc_static='-non_shared'
82603a78d15Sespie          ;;
82703a78d15Sespie        *)
82803a78d15Sespie          ;;
82903a78d15Sespie      esac
83003a78d15Sespie      ;;
83103a78d15Sespie    lynxos*)
83203a78d15Sespie      ;;
83303a78d15Sespie    m88k*)
83403a78d15Sespie      ;;
83503a78d15Sespie    mvs*)
83603a78d15Sespie      case $cc_basename in
83703a78d15Sespie        cxx)
83803a78d15Sespie          ac_cv_prog_cc_pic='-W c,exportall'
83903a78d15Sespie          ;;
84003a78d15Sespie        *)
84103a78d15Sespie          ;;
84203a78d15Sespie      esac
84303a78d15Sespie      ;;
84403a78d15Sespie    netbsd*)
84503a78d15Sespie      ;;
84603a78d15Sespie    osf3* | osf4* | osf5*)
84703a78d15Sespie      case $cc_basename in
84803a78d15Sespie        KCC)
84903a78d15Sespie          ac_cv_prog_cc_wl='--backend -Wl,'
85003a78d15Sespie          ;;
85103a78d15Sespie        RCC)
85203a78d15Sespie          # Rational C++ 2.4.1
85303a78d15Sespie          ac_cv_prog_cc_pic='-pic'
85403a78d15Sespie          ;;
85503a78d15Sespie        cxx)
85603a78d15Sespie          # Digital/Compaq C++
85703a78d15Sespie          ac_cv_prog_cc_wl='-Wl,'
85803a78d15Sespie          # Make sure the PIC flag is empty.  It appears that all Alpha
85903a78d15Sespie          # Linux and Compaq Tru64 Unix objects are PIC.
86003a78d15Sespie          ac_cv_prog_cc_pic=
86103a78d15Sespie          ac_cv_prog_cc_static='-non_shared'
86203a78d15Sespie          ;;
86303a78d15Sespie        *)
86403a78d15Sespie          ;;
86503a78d15Sespie      esac
86603a78d15Sespie      ;;
86703a78d15Sespie    psos*)
86803a78d15Sespie      ;;
86903a78d15Sespie    sco*)
87003a78d15Sespie      case $cc_basename in
87103a78d15Sespie        CC)
87203a78d15Sespie          ac_cv_prog_cc_pic='-fPIC'
87303a78d15Sespie          ;;
87403a78d15Sespie        *)
87503a78d15Sespie          ;;
87603a78d15Sespie      esac
87703a78d15Sespie      ;;
87803a78d15Sespie    solaris*)
87903a78d15Sespie      case $cc_basename in
88003a78d15Sespie        CC)
88103a78d15Sespie          # Sun C++ 4.2, 5.x and Centerline C++
88203a78d15Sespie          ac_cv_prog_cc_pic='-KPIC'
88303a78d15Sespie          ac_cv_prog_cc_static='-Bstatic'
88403a78d15Sespie          ac_cv_prog_cc_wl='-Qoption ld '
88503a78d15Sespie          ;;
88603a78d15Sespie        gcx)
88703a78d15Sespie          # Green Hills C++ Compiler
88803a78d15Sespie          ac_cv_prog_cc_pic='-PIC'
88903a78d15Sespie          ;;
89003a78d15Sespie        *)
89103a78d15Sespie          ;;
89203a78d15Sespie      esac
89303a78d15Sespie      ;;
89403a78d15Sespie    sunos4*)
89503a78d15Sespie      case $cc_basename in
89603a78d15Sespie        CC)
89703a78d15Sespie          # Sun C++ 4.x
89803a78d15Sespie          ac_cv_prog_cc_pic='-pic'
89903a78d15Sespie          ac_cv_prog_cc_static='-Bstatic'
90003a78d15Sespie          ;;
90103a78d15Sespie        lcc)
90203a78d15Sespie          # Lucid
90303a78d15Sespie          ac_cv_prog_cc_pic='-pic'
90403a78d15Sespie          ;;
90503a78d15Sespie        *)
90603a78d15Sespie          ;;
90703a78d15Sespie      esac
90803a78d15Sespie      ;;
90903a78d15Sespie    tandem*)
91003a78d15Sespie      case $cc_basename in
91103a78d15Sespie        NCC)
91203a78d15Sespie          # NonStop-UX NCC 3.20
91303a78d15Sespie          ac_cv_prog_cc_pic='-KPIC'
91403a78d15Sespie          ;;
91503a78d15Sespie        *)
91603a78d15Sespie          ;;
91703a78d15Sespie      esac
91803a78d15Sespie      ;;
91903a78d15Sespie    unixware*)
92003a78d15Sespie      ;;
92103a78d15Sespie    vxworks*)
92203a78d15Sespie      ;;
92303a78d15Sespie    *)
92403a78d15Sespie      ac_cv_prog_cc_can_build_shared=no
92503a78d15Sespie      ;;
92603a78d15Sespie  esac
92703a78d15Sespiefi
92803a78d15Sespie
92903a78d15Sespiecase "$host_os" in
93003a78d15Sespie    # Platforms which do not suport PIC and -DPIC is meaningless
93103a78d15Sespie    # on them:
93203a78d15Sespie    *djgpp*)
93303a78d15Sespie      ac_cv_prog_cc_pic=
93403a78d15Sespie      ;;
93503a78d15Sespie    *)
93603a78d15Sespie      ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
93703a78d15Sespie      ;;
93803a78d15Sespieesac
93903a78d15Sespie
94003a78d15Sespie
94103a78d15Sespie# Figure out "hidden" C++ library dependencies from verbose
94203a78d15Sespie# compiler output whening linking a shared library.
94303a78d15Sespiecat > conftest.$ac_ext <<EOF
94403a78d15Sespieclass Foo
94503a78d15Sespie{
94603a78d15Sespiepublic:
94703a78d15Sespie  Foo (void) { a = 0; }
94803a78d15Sespieprivate:
94903a78d15Sespie  int a;
95003a78d15Sespie};
95103a78d15SespieEOF
95203a78d15Sespie
95303a78d15Sespie
95403a78d15Sespieif (eval $ac_compile) 2>&5; then
95503a78d15Sespie  # Parse the compiler output and extract the necessary
95603a78d15Sespie  # objects, libraries and library flags.
95703a78d15Sespie
95803a78d15Sespie  # Sentinel used to keep track of whether or not we are before
95903a78d15Sespie  # the conftest object file.
96003a78d15Sespie  pre_test_object_deps_done=no
96103a78d15Sespie
96203a78d15Sespie  for p in `eval $output_verbose_link_cmd`; do
96303a78d15Sespie
96403a78d15Sespie    case $p in
96503a78d15Sespie
96603a78d15Sespie    -L* | -R* | -l*)
96703a78d15Sespie       # Some compilers place space between "-{L,R}" and the path.
96803a78d15Sespie       # Remove the space.
96903a78d15Sespie       if test $p = "-L" \
97003a78d15Sespie          || test $p = "-R"; then
97103a78d15Sespie         prev=$p
97203a78d15Sespie         continue
97303a78d15Sespie       else
97403a78d15Sespie         prev=
97503a78d15Sespie       fi
97603a78d15Sespie
97703a78d15Sespie       if test "$pre_test_object_deps_done" = no; then
97803a78d15Sespie         case $p in
97903a78d15Sespie	 -L* | -R*)
98003a78d15Sespie	   # Internal compiler library paths should come after those
98103a78d15Sespie	   # provided the user.  The postdeps already come after the
98203a78d15Sespie	   # user supplied libs so there is no need to process them.
98303a78d15Sespie           if test -z "$compiler_lib_search_path"; then
98403a78d15Sespie             compiler_lib_search_path="${prev}${p}"
98503a78d15Sespie           else
98603a78d15Sespie             compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
98703a78d15Sespie           fi
98803a78d15Sespie           ;;
98903a78d15Sespie         # The "-l" case would never come before the object being
99003a78d15Sespie         # linked, so don't bother handling this case.
99103a78d15Sespie         esac
99203a78d15Sespie       else
99303a78d15Sespie         if test -z "$postdeps"; then
99403a78d15Sespie           postdeps="${prev}${p}"
99503a78d15Sespie         else
99603a78d15Sespie           postdeps="${postdeps} ${prev}${p}"
99703a78d15Sespie         fi
99803a78d15Sespie       fi
99903a78d15Sespie       ;;
100003a78d15Sespie
100103a78d15Sespie    *.$objext)
100203a78d15Sespie       # This assumes that the test object file only shows up
100303a78d15Sespie       # once in the compiler output.
100403a78d15Sespie       if test "$p" = "conftest.$objext"; then
100503a78d15Sespie         pre_test_object_deps_done=yes
100603a78d15Sespie         continue
100703a78d15Sespie       fi
100803a78d15Sespie
100903a78d15Sespie       if test "$pre_test_object_deps_done" = no; then
101003a78d15Sespie         if test -z "$predep_objects"; then
101103a78d15Sespie           predep_objects="$p"
101203a78d15Sespie         else
101303a78d15Sespie           predep_objects="$predep_objects $p"
101403a78d15Sespie         fi
101503a78d15Sespie       else
101603a78d15Sespie         if test -z "$postdep_objects"; then
101703a78d15Sespie           postdep_objects="$p"
101803a78d15Sespie         else
101903a78d15Sespie           postdep_objects="$postdep_objects $p"
102003a78d15Sespie         fi
102103a78d15Sespie       fi
102203a78d15Sespie       ;;
102303a78d15Sespie
102403a78d15Sespie    *) ;; # Ignore the rest.
102503a78d15Sespie
102603a78d15Sespie    esac
102703a78d15Sespie  done
102803a78d15Sespie
102903a78d15Sespie  # Clean up.
103003a78d15Sespie  rm -f a.out
103103a78d15Sespieelse
103203a78d15Sespie  echo "ltcf-cxx.sh: error: problem compiling test program"
103303a78d15Sespiefi
103403a78d15Sespie
103503a78d15Sespie$rm -f confest.$objext
103603a78d15Sespie
103703a78d15Sespiecase " $postdeps " in
103803a78d15Sespie*" -lc "*) need_lc=no ;;
103903a78d15Sespie*) need_lc=yes ;;
104003a78d15Sespieesac
1041