1130803Smarcel#### This script is meant to be sourced by ltconfig.
2130803Smarcel
3130803Smarcel# ltcf-cxx.sh - Create a C++ compiler specific configuration
4130803Smarcel#
5130803Smarcel# Copyright (C) 1996-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
6130803Smarcel# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7130803Smarcel#
8130803Smarcel# Original C++ support by:Gary V. Vaughan <gvv@techie.com>
9130803Smarcel#    Alexandre Oliva <oliva@lsd.ic.unicamp.br>
10130803Smarcel#    Ossama Othman <ossama@debian.org>
11130803Smarcel#    Thomas Thanner <tanner@gmx.de>
12130803Smarcel#
13130803Smarcel# This file is free software; you can redistribute it and/or modify it
14130803Smarcel# under the terms of the GNU General Public License as published by
15130803Smarcel# the Free Software Foundation; either version 2 of the License, or
16130803Smarcel# (at your option) any later version.
17130803Smarcel#
18130803Smarcel# This program is distributed in the hope that it will be useful, but
19130803Smarcel# WITHOUT ANY WARRANTY; without even the implied warranty of
20130803Smarcel# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21130803Smarcel# General Public License for more details.
22130803Smarcel#
23130803Smarcel# You should have received a copy of the GNU General Public License
24130803Smarcel# along with this program; if not, write to the Free Software
25130803Smarcel# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26130803Smarcel#
27130803Smarcel# As a special exception to the GNU General Public License, if you
28130803Smarcel# distribute this file as part of a program that contains a
29130803Smarcel# configuration script generated by Autoconf, you may include it under
30130803Smarcel# the same distribution terms that you use for the rest of that program.
31130803Smarcel
32130803Smarcel
33130803Smarcel# Source file extension for C++ test sources.
34130803Smarcelac_ext=cc
35130803Smarcel
36130803Smarcel# Object file extension for compiled C++ test sources.
37130803Smarcelobjext=o
38130803Smarcel
39130803Smarcel# Code to be used in simple compile tests
40130803Smarcellt_simple_compile_test_code="int some_variable = 0;"
41130803Smarcel
42130803Smarcel# Code to be used in simple link tests
43130803Smarcellt_simple_link_test_code='int main(int, char *[]) { return (0); }'
44130803Smarcel
45130803Smarcel# C++ compiler
46130803SmarcelCXX=${CXX-c++}
47130803Smarcel
48130803Smarcel# ltmain only uses $CC for tagged configurations so make sure $CC is set.
49130803SmarcelCC=${CC-"$CXX"}
50130803SmarcelCFLAGS=${CFLAGS-"$CXXFLAGS"}
51130803Smarcel
52130803Smarcel# Allow CC to be a program name with arguments.
53130803Smarcelset dummy $CC
54130803Smarcelcompiler=$2
55130803Smarcelcc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
56130803Smarcel
57130803Smarcel# Check if we are using GNU gcc  (taken/adapted from configure script)
58130803Smarcel# We need to check here since "--with-gcc" is set at configure time,
59130803Smarcel# not ltconfig time!
60130803Smarcelcat > conftest.$ac_ext <<EOF
61130803Smarcel#ifdef __GNUC__
62130803Smarcel  yes;
63130803Smarcel#endif
64130803SmarcelEOF
65130803Smarcelif { 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
66130803Smarcel  with_gcc=yes
67130803Smarcel
68130803Smarcel  # Set up default GNU C++ configuration
69130803Smarcel
70130803Smarcel  # Check if GNU C++ uses GNU ld as the underlying linker, since the
71130803Smarcel  # archiving commands below assume that GNU ld is being used.  The
72130803Smarcel  # assumption here is that the linker is going to be the same as that
73130803Smarcel  # used by the C compiler.  For the purposes of GCC, this is ok, but
74130803Smarcel  # if someone uses g++ along with a non-GNU C compiler that doesn't
75130803Smarcel  # use GNU ld, we may lose.  This is ok for the toolchain tree, since
76130803Smarcel  # the only users of ltcf-cxx.sh are libstdc++-v3 and libjava,
77130803Smarcel  # anyway, and those use both gcc and g++, so the settings are bound
78130803Smarcel  # to be the same.
79130803Smarcel
80130803Smarcel  if test "$with_gnu_ld" = yes; then
81130803Smarcel    archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
82130803Smarcel    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'
83130803Smarcel
84130803Smarcel    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
85130803Smarcel    export_dynamic_flag_spec='${wl}--export-dynamic'
86130803Smarcel
87130803Smarcel    # If archive_cmds runs LD, not CC, wlarc should be empty
88130803Smarcel    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
89130803Smarcel    #     investigate it a little bit more. (MM)
90130803Smarcel    wlarc='${wl}'
91130803Smarcel
92130803Smarcel    # ancient GNU ld didn't support --whole-archive et. al.
93130803Smarcel    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
94130803Smarcel        egrep 'no-whole-archive' > /dev/null; then
95130803Smarcel      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
96130803Smarcel    else
97130803Smarcel      whole_archive_flag_spec=
98130803Smarcel    fi
99130803Smarcel  else
100130803Smarcel    wlarc=
101130803Smarcel
102130803Smarcel    # A generic and very simple default shared library creation
103130803Smarcel    # command for GNU C++ for the case where it uses the native
104130803Smarcel    # linker, instead of GNU ld.  If possible, this setting should
105130803Smarcel    # overridden to take advantage of the native linker features on
106130803Smarcel    # the platform it is being used on.
107130803Smarcel    archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
108130803Smarcel  fi
109130803Smarcel
110130803Smarcel  # Commands to make compiler produce verbose output that lists
111130803Smarcel  # what "hidden" libraries, object files and flags are used when
112130803Smarcel  # linking a shared library.
113130803Smarcel  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
114130803Smarcel
115130803Smarcelelse
116130803Smarcel  with_gcc=no
117130803Smarcel  wlarc=
118130803Smarcelfi
119130803Smarcel
120130803Smarcel# PORTME: fill in a description of your system's C++ link characteristics
121130803Smarcelcase $host_os in
122130803Smarcel  aix3*)
123130803Smarcel    # FIXME: insert proper C++ library support
124130803Smarcel    ld_shlibs=no
125130803Smarcel    ;;
126130803Smarcel  aix4* | aix5*)
127130803Smarcel    archive_cmds=''
128130803Smarcel    hardcode_direct=yes
129130803Smarcel    hardcode_libdir_separator=':'
130130803Smarcel    link_all_deplibs=yes
131130803Smarcel    # When large executables or shared objects are built, AIX ld can
132130803Smarcel    # have problems creating the table of contents.  If linking a library
133130803Smarcel    # or program results in "error TOC overflow" add -mminimal-toc to
134130803Smarcel    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
135130803Smarcel    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
136130803Smarcel    if test "$with_gcc" = yes; then
137130803Smarcel      case $host_os in aix4.[012]|aix4.[012].*)
138130803Smarcel      # We only want to do this on AIX 4.2 and lower, the check
139130803Smarcel      # below for broken collect2 doesn't work under 4.3+
140130803Smarcel        collect2name=`${CC} -print-prog-name=collect2`
141130803Smarcel        if test -f "$collect2name" && \
142130803Smarcel	   strings "$collect2name" | grep resolve_lib_name >/dev/null
143130803Smarcel        then
144130803Smarcel	  # We have reworked collect2
145130803Smarcel	  hardcode_direct=yes
146130803Smarcel        else
147130803Smarcel	  # We have old collect2
148130803Smarcel	  hardcode_direct=unsupported
149130803Smarcel	  # It fails to find uninstalled libraries when the uninstalled
150130803Smarcel	  # path is not listed in the libpath.  Setting hardcode_minus_L
151130803Smarcel	  # to unsupported forces relinking
152130803Smarcel	  hardcode_minus_L=yes
153130803Smarcel	  hardcode_libdir_flag_spec='-L$libdir'
154130803Smarcel	  hardcode_libdir_separator=
155130803Smarcel        fi
156130803Smarcel      esac
157130803Smarcel      shared_flag='-shared'
158130803Smarcel    else
159130803Smarcel      # not using gcc
160130803Smarcel      if test "$host_cpu" = ia64; then
161130803Smarcel        shared_flag='${wl}-G'
162130803Smarcel      else
163130803Smarcel        shared_flag='${wl}-bM:SRE'
164130803Smarcel      fi
165130803Smarcel    fi
166130803Smarcel
167130803Smarcel    if test "$host_cpu" = ia64; then
168130803Smarcel      # On IA64, the linker does run time linking by default, so we don't
169130803Smarcel      # have to do anything special.
170130803Smarcel      aix_use_runtimelinking=no
171130803Smarcel      if test $with_gnu_ld = no; then
172130803Smarcel        exp_sym_flag='-Bexport'
173130803Smarcel        no_entry_flag=""
174130803Smarcel      fi
175130803Smarcel    else
176130803Smarcel      # Test if we are trying to use run time linking, or normal AIX style linking.
177130803Smarcel      # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
178130803Smarcel      aix_use_runtimelinking=no
179130803Smarcel      for ld_flag in $LDFLAGS; do
180130803Smarcel        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
181130803Smarcel          aix_use_runtimelinking=yes
182130803Smarcel          break
183130803Smarcel        fi
184130803Smarcel      done
185130803Smarcel      exp_sym_flag='-bexport'
186130803Smarcel      no_entry_flag='-bnoentry'
187130803Smarcel    fi
188130803Smarcel    # It seems that -bexpall does not export symbols beginning with
189130803Smarcel    # underscore (_), so it is better to generate a list of symbols to export.
190130803Smarcel    always_export_symbols=yes
191130803Smarcel    if test "$aix_use_runtimelinking" = yes; then
192130803Smarcel      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
193130803Smarcel      allow_undefined_flag=' -Wl,-G'
194130803Smarcel      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"
195130803Smarcel     else
196130803Smarcel      if test "$host_cpu" = ia64; then
197130803Smarcel        if test $with_gnu_ld = no; then
198130803Smarcel          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
199130803Smarcel          allow_undefined_flag="-z nodefs"
200130803Smarcel          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"
201130803Smarcel        fi
202130803Smarcel      else
203130803Smarcel        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
204130803Smarcel        # Warning - without using the other run time loading flags, -berok will
205130803Smarcel        #           link without error, but may produce a broken library.
206130803Smarcel        no_undefined_flag=' ${wl}-bnoerok'
207130803Smarcel        allow_undefined_flag=' ${wl}-berok'
208130803Smarcel        # -bexpall does not export symbols beginning with underscore (_)
209130803Smarcel        always_export_symbols=yes
210130803Smarcel        # Exported symbols can be pulled into shared objects from archives
211130803Smarcel        whole_archive_flag_spec=' '
212130803Smarcel        build_libtool_need_lc=yes
213130803Smarcel        # This is similar to how AIX traditionally builds it's shared libraries.
214130803Smarcel        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'
215130803Smarcel      fi
216130803Smarcel    fi
217130803Smarcel    ;;
218130803Smarcel  chorus*)
219130803Smarcel    case $cc_basename in
220130803Smarcel      *)
221130803Smarcel        # FIXME: insert proper C++ library support
222130803Smarcel        ld_shlibs=no
223130803Smarcel        ;;
224130803Smarcel    esac
225130803Smarcel    ;;
226130803Smarcel  dgux*)
227130803Smarcel    case $cc_basename in
228130803Smarcel      ec++)
229130803Smarcel        # FIXME: insert proper C++ library support
230130803Smarcel        ld_shlibs=no
231130803Smarcel        ;;
232130803Smarcel      ghcx)
233130803Smarcel        # Green Hills C++ Compiler
234130803Smarcel        # FIXME: insert proper C++ library support
235130803Smarcel        ld_shlibs=no
236130803Smarcel        ;;
237130803Smarcel      *)
238130803Smarcel        # FIXME: insert proper C++ library support
239130803Smarcel        ld_shlibs=no
240130803Smarcel        ;;
241130803Smarcel    esac
242130803Smarcel    ;;
243130803Smarcel  freebsd[12]*)
244130803Smarcel    # C++ shared libraries reported to be fairly broken before switch to ELF
245130803Smarcel    ld_shlibs=no
246130803Smarcel    ;;
247130803Smarcel  freebsd*)
248130803Smarcel    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
249130803Smarcel    # conventions
250130803Smarcel    ld_shlibs=yes
251130803Smarcel    ;;
252130803Smarcel  gnu*)
253130803Smarcel    ;;
254130803Smarcel  hpux*)
255130803Smarcel    if test $with_gnu_ld = no; then
256130803Smarcel      case "$host_cpu" in
257130803Smarcel	ia64*)
258130803Smarcel	  hardcode_libdir_flag_spec='-L$libdir'
259130803Smarcel	  hardcode_shlibpath_var=no ;;
260130803Smarcel	*)
261130803Smarcel	  hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' ;;
262130803Smarcel      esac
263130803Smarcel      hardcode_direct=yes
264130803Smarcel      hardcode_libdir_separator=:
265130803Smarcel      export_dynamic_flag_spec='${wl}-E'
266130803Smarcel    fi
267130803Smarcel    hardcode_minus_L=yes # Not in the search PATH, but as the default
268130803Smarcel			 # location of the library.
269130803Smarcel
270130803Smarcel    case $cc_basename in
271130803Smarcel      CC)
272130803Smarcel        # FIXME: insert proper C++ library support
273130803Smarcel        ld_shlibs=no
274130803Smarcel        ;;
275130803Smarcel      aCC)
276130803Smarcel	case $host_os in
277130803Smarcel	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' ;;
278130803Smarcel	*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
279130803Smarcel	esac
280130803Smarcel        # Commands to make compiler produce verbose output that lists
281130803Smarcel        # what "hidden" libraries, object files and flags are used when
282130803Smarcel        # linking a shared library.
283130803Smarcel        #
284130803Smarcel        # There doesn't appear to be a way to prevent this compiler from
285130803Smarcel        # explicitly linking system object files so we need to strip them
286130803Smarcel        # from the output so that they don't get included in the library
287130803Smarcel        # dependencies.
288130803Smarcel        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'
289130803Smarcel        ;;
290130803Smarcel      *)
291130803Smarcel        if test $with_gcc = yes; then
292130803Smarcel	  if test $with_gnu_ld = no; then
293130803Smarcel	    case "$host_os" in
294130803Smarcel	    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' ;;
295130803Smarcel	    *)
296130803Smarcel	      case "$host_cpu" in
297130803Smarcel		ia64*)
298130803Smarcel		  archive_cmds='$LD -b +h $soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;;
299130803Smarcel		*)
300130803Smarcel		  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' ;;
301130803Smarcel	      esac
302130803Smarcel	      ;;
303130803Smarcel	    esac
304130803Smarcel	  fi
305130803Smarcel	else
306130803Smarcel	  # FIXME: insert proper C++ library support
307130803Smarcel          ld_shlibs=no
308130803Smarcel	fi
309130803Smarcel        ;;
310130803Smarcel    esac
311130803Smarcel    ;;
312130803Smarcel  irix5* | irix6*)
313130803Smarcel    case $cc_basename in
314130803Smarcel      CC)
315130803Smarcel        # SGI C++
316130803Smarcel        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'
317130803Smarcel
318130803Smarcel	# Archives containing C++ object files must be created using
319130803Smarcel	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
320130803Smarcel	# necessary to make sure instantiated templates are included
321130803Smarcel	# in the archive.
322130803Smarcel	old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
323130803Smarcel	;;
324130803Smarcel      *)
325130803Smarcel        if test "$with_gcc" = yes; then
326130803Smarcel          if test "$with_gnu_ld" = no; then
327130803Smarcel            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'
328130803Smarcel          else
329130803Smarcel            archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
330130803Smarcel          fi
331130803Smarcel        fi
332130803Smarcel        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
333130803Smarcel        hardcode_libdir_separator=:
334130803Smarcel        link_all_deplibs=yes
335130803Smarcel        ;;
336130803Smarcel    esac
337130803Smarcel    ;;
338130803Smarcel  linux*)
339130803Smarcel    case $cc_basename in
340130803Smarcel      KCC)
341130803Smarcel        # Kuck and Associates, Inc. (KAI) C++ Compiler
342130803Smarcel
343130803Smarcel        # KCC will only create a shared library if the output file
344130803Smarcel        # ends with ".so" (or ".sl" for HP-UX), so rename the library
345130803Smarcel        # to its proper name (with version) after linking.
346130803Smarcel        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'
347130803Smarcel        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'
348130803Smarcel
349130803Smarcel        # Commands to make compiler produce verbose output that lists
350130803Smarcel        # what "hidden" libraries, object files and flags are used when
351130803Smarcel        # linking a shared library.
352130803Smarcel        #
353130803Smarcel        # There doesn't appear to be a way to prevent this compiler from
354130803Smarcel        # explicitly linking system object files so we need to strip them
355130803Smarcel        # from the output so that they don't get included in the library
356130803Smarcel        # dependencies.
357130803Smarcel        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'
358130803Smarcel
359130803Smarcel        hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
360130803Smarcel        export_dynamic_flag_spec='${wl}--export-dynamic'
361130803Smarcel
362130803Smarcel	# Archives containing C++ object files must be created using
363130803Smarcel	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
364130803Smarcel        old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
365130803Smarcel        ;;
366130803Smarcel      cxx)
367130803Smarcel        # Compaq C++
368130803Smarcel        archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
369130803Smarcel        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'
370130803Smarcel
371130803Smarcel        runpath_var=LD_RUN_PATH
372130803Smarcel        hardcode_libdir_flag_spec='-rpath $libdir'
373130803Smarcel        hardcode_libdir_separator=:
374130803Smarcel
375130803Smarcel        # Commands to make compiler produce verbose output that lists
376130803Smarcel        # what "hidden" libraries, object files and flags are used when
377130803Smarcel        # linking a shared library.
378130803Smarcel        #
379130803Smarcel        # There doesn't appear to be a way to prevent this compiler from
380130803Smarcel        # explicitly linking system object files so we need to strip them
381130803Smarcel        # from the output so that they don't get included in the library
382130803Smarcel        # dependencies.
383130803Smarcel        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'
384130803Smarcel        ;;
385130803Smarcel    esac
386130803Smarcel    ;;
387130803Smarcel  lynxos*)
388130803Smarcel    # FIXME: insert proper C++ library support
389130803Smarcel    ld_shlibs=no
390130803Smarcel    ;;
391130803Smarcel  m88k*)
392130803Smarcel    # FIXME: insert proper C++ library support
393130803Smarcel    ld_shlibs=no
394130803Smarcel    ;;
395130803Smarcel  mvs*)
396130803Smarcel    case $cc_basename in
397130803Smarcel      cxx)
398130803Smarcel        # FIXME: insert proper C++ library support
399130803Smarcel        ld_shlibs=no
400130803Smarcel        ;;
401130803Smarcel      *)
402130803Smarcel        # FIXME: insert proper C++ library support
403130803Smarcel        ld_shlibs=no
404130803Smarcel        ;;
405130803Smarcel    esac
406130803Smarcel    ;;
407130803Smarcel  netbsd*)
408130803Smarcel    # NetBSD uses g++ - do we need to do anything?
409130803Smarcel    ;;
410130803Smarcel  osf3*)
411130803Smarcel    case $cc_basename in
412130803Smarcel      KCC)
413130803Smarcel        # Kuck and Associates, Inc. (KAI) C++ Compiler
414130803Smarcel
415130803Smarcel        # KCC will only create a shared library if the output file
416130803Smarcel        # ends with ".so" (or ".sl" for HP-UX), so rename the library
417130803Smarcel        # to its proper name (with version) after linking.
418130803Smarcel        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'
419130803Smarcel
420130803Smarcel        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
421130803Smarcel        hardcode_libdir_separator=:
422130803Smarcel
423130803Smarcel	# Archives containing C++ object files must be created using
424130803Smarcel	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
425130803Smarcel        old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
426130803Smarcel
427130803Smarcel        ;;
428130803Smarcel      RCC)
429130803Smarcel        # Rational C++ 2.4.1
430130803Smarcel        # FIXME: insert proper C++ library support
431130803Smarcel        ld_shlibs=no
432130803Smarcel        ;;
433130803Smarcel      cxx)
434130803Smarcel        allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
435130803Smarcel        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'
436130803Smarcel
437130803Smarcel        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
438130803Smarcel        hardcode_libdir_separator=:
439130803Smarcel
440130803Smarcel        # Commands to make compiler produce verbose output that lists
441130803Smarcel        # what "hidden" libraries, object files and flags are used when
442130803Smarcel        # linking a shared library.
443130803Smarcel        #
444130803Smarcel        # There doesn't appear to be a way to prevent this compiler from
445130803Smarcel        # explicitly linking system object files so we need to strip them
446130803Smarcel        # from the output so that they don't get included in the library
447130803Smarcel        # dependencies.
448130803Smarcel        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'
449130803Smarcel        ;;
450130803Smarcel      *)
451130803Smarcel	if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
452130803Smarcel	  allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
453130803Smarcel	  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'
454130803Smarcel
455130803Smarcel	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
456130803Smarcel	  hardcode_libdir_separator=:
457130803Smarcel
458130803Smarcel	  # Commands to make compiler produce verbose output that lists
459130803Smarcel	  # what "hidden" libraries, object files and flags are used when
460130803Smarcel	  # linking a shared library.
461130803Smarcel	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
462130803Smarcel    else
463130803Smarcel          # FIXME: insert proper C++ library support
464130803Smarcel          ld_shlibs=no
465130803Smarcel    fi
466130803Smarcel        ;;
467130803Smarcel    esac
468130803Smarcel    ;;
469130803Smarcel  osf4* | osf5*)
470130803Smarcel    case $cc_basename in
471130803Smarcel      KCC)
472130803Smarcel        # Kuck and Associates, Inc. (KAI) C++ Compiler
473130803Smarcel
474130803Smarcel        # KCC will only create a shared library if the output file
475130803Smarcel        # ends with ".so" (or ".sl" for HP-UX), so rename the library
476130803Smarcel        # to its proper name (with version) after linking.
477130803Smarcel        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'
478130803Smarcel
479130803Smarcel        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
480130803Smarcel        hardcode_libdir_separator=:
481130803Smarcel
482130803Smarcel	# Archives containing C++ object files must be created using
483130803Smarcel	# the KAI C++ compiler.
484130803Smarcel        old_archive_cmds='$CC -o $oldlib $oldobjs'
485130803Smarcel        ;;
486130803Smarcel      RCC)
487130803Smarcel        # Rational C++ 2.4.1
488130803Smarcel        # FIXME: insert proper C++ library support
489130803Smarcel        ld_shlibs=no
490130803Smarcel        ;;
491130803Smarcel      cxx)
492130803Smarcel        allow_undefined_flag=' -expect_unresolved \*'
493130803Smarcel        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'
494130803Smarcel	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~
495130803Smarcel	  echo "-hidden">> $lib.exp~
496130803Smarcel	  $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~
497130803Smarcel	  $rm $lib.exp'
498130803Smarcel
499130803Smarcel        hardcode_libdir_flag_spec='-rpath $libdir'
500130803Smarcel        hardcode_libdir_separator=:
501130803Smarcel
502130803Smarcel        # Commands to make compiler produce verbose output that lists
503130803Smarcel        # what "hidden" libraries, object files and flags are used when
504130803Smarcel        # linking a shared library.
505130803Smarcel        #
506130803Smarcel        # There doesn't appear to be a way to prevent this compiler from
507130803Smarcel        # explicitly linking system object files so we need to strip them
508130803Smarcel        # from the output so that they don't get included in the library
509130803Smarcel        # dependencies.
510130803Smarcel        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'
511130803Smarcel        ;;
512130803Smarcel      *)
513130803Smarcel	if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
514130803Smarcel	  allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
515130803Smarcel	  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'
516130803Smarcel	  
517130803Smarcel	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
518130803Smarcel	  hardcode_libdir_separator=:
519130803Smarcel	  
520130803Smarcel	  # Commands to make compiler produce verbose output that lists
521130803Smarcel	  # what "hidden" libraries, object files and flags are used when
522130803Smarcel	  # linking a shared library.
523130803Smarcel	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
524130803Smarcel    else
525130803Smarcel	  # FIXME: insert proper C++ library support
526130803Smarcel	  ld_shlibs=no
527130803Smarcel    fi
528130803Smarcel        ;;
529130803Smarcel    esac
530130803Smarcel    ;;
531130803Smarcel  psos*)
532130803Smarcel    # FIXME: insert proper C++ library support
533130803Smarcel    ld_shlibs=no
534130803Smarcel    ;;
535130803Smarcel  sco*)
536130803Smarcel    case $cc_basename in
537130803Smarcel      CC)
538130803Smarcel        # FIXME: insert proper C++ library support
539130803Smarcel        ld_shlibs=no
540130803Smarcel        ;;
541130803Smarcel      *)
542130803Smarcel        # FIXME: insert proper C++ library support
543130803Smarcel        ld_shlibs=no
544130803Smarcel        ;;
545130803Smarcel    esac
546130803Smarcel    ;;
547130803Smarcel  sunos4*)
548130803Smarcel    case $cc_basename in
549130803Smarcel      CC)
550130803Smarcel        # Sun C++ 4.x
551130803Smarcel        # FIXME: insert proper C++ library support
552130803Smarcel        ld_shlibs=no
553130803Smarcel        ;;
554130803Smarcel      lcc)
555130803Smarcel        # Lucid
556130803Smarcel        # FIXME: insert proper C++ library support
557130803Smarcel        ld_shlibs=no
558130803Smarcel        ;;
559130803Smarcel      *)
560130803Smarcel        # FIXME: insert proper C++ library support
561130803Smarcel        ld_shlibs=no
562130803Smarcel        ;;
563130803Smarcel    esac
564130803Smarcel    ;;
565130803Smarcel  solaris*)
566130803Smarcel    case $cc_basename in
567130803Smarcel      CC)
568130803Smarcel	# Sun C++ 4.2, 5.x and Centerline C++
569130803Smarcel        no_undefined_flag=' -zdefs'
570130803Smarcel        archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
571130803Smarcel        archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
572130803Smarcel        $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'
573130803Smarcel
574130803Smarcel        hardcode_libdir_flag_spec='-R$libdir'
575130803Smarcel        hardcode_shlibpath_var=no
576130803Smarcel        case $host_os in
577130803Smarcel          solaris2.[0-5] | solaris2.[0-5].*) ;;
578130803Smarcel          *)
579130803Smarcel            # The C++ compiler is used as linker so we must use $wl
580130803Smarcel            # flag to pass the commands to the underlying system
581130803Smarcel            # linker.
582130803Smarcel            # Supported since Solaris 2.6 (maybe 2.5.1?)
583130803Smarcel            whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
584130803Smarcel            ;;
585130803Smarcel        esac
586130803Smarcel        link_all_deplibs=yes
587130803Smarcel
588130803Smarcel        # Commands to make compiler produce verbose output that lists
589130803Smarcel        # what "hidden" libraries, object files and flags are used when
590130803Smarcel        # linking a shared library.
591130803Smarcel        #
592130803Smarcel        # There doesn't appear to be a way to prevent this compiler from
593130803Smarcel        # explicitly linking system object files so we need to strip them
594130803Smarcel        # from the output so that they don't get included in the library
595130803Smarcel        # dependencies.
596130803Smarcel        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'
597130803Smarcel
598130803Smarcel	# Archives containing C++ object files must be created using
599130803Smarcel	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
600130803Smarcel        # necessary to make sure instantiated templates are included
601130803Smarcel        # in the archive.
602130803Smarcel        old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
603130803Smarcel        ;;
604130803Smarcel      gcx)
605130803Smarcel        # Green Hills C++ Compiler
606130803Smarcel        archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
607130803Smarcel
608130803Smarcel        # The C++ compiler must be used to create the archive.
609130803Smarcel        old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
610130803Smarcel        ;;
611130803Smarcel      *)
612130803Smarcel        # GNU C++ compiler with Solaris linker
613130803Smarcel        if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
614130803Smarcel	  no_undefined_flag=' ${wl}-z ${wl}defs'
615130803Smarcel          if $CC --version | egrep -v '^2\.7' > /dev/null; then
616130803Smarcel            archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
617130803Smarcel            archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
618130803Smarcel		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
619130803Smarcel
620130803Smarcel            # Commands to make compiler produce verbose output that lists
621130803Smarcel            # what "hidden" libraries, object files and flags are used when
622130803Smarcel            # linking a shared library.
623130803Smarcel            output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
624130803Smarcel          else
625130803Smarcel            # g++ 2.7 appears to require `-G' NOT `-shared' on this
626130803Smarcel            # platform.
627130803Smarcel            archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
628130803Smarcel            archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
629130803Smarcel		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
630130803Smarcel
631130803Smarcel            # Commands to make compiler produce verbose output that lists
632130803Smarcel            # what "hidden" libraries, object files and flags are used when
633130803Smarcel            # linking a shared library.
634130803Smarcel            output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
635130803Smarcel          fi
636130803Smarcel
637130803Smarcel          hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
638130803Smarcel        fi
639130803Smarcel        ;;
640130803Smarcel    esac
641130803Smarcel    ;;
642130803Smarcel  tandem*)
643130803Smarcel    case $cc_basename in
644130803Smarcel      NCC)
645130803Smarcel        # NonStop-UX NCC 3.20
646130803Smarcel        # FIXME: insert proper C++ library support
647130803Smarcel        ld_shlibs=no
648130803Smarcel        ;;
649130803Smarcel      *)
650130803Smarcel        # FIXME: insert proper C++ library support
651130803Smarcel        ld_shlibs=no
652130803Smarcel        ;;
653130803Smarcel    esac
654130803Smarcel    ;;
655130803Smarcel  unixware*)
656130803Smarcel    # FIXME: insert proper C++ library support
657130803Smarcel    ld_shlibs=no
658130803Smarcel    ;;
659130803Smarcel  vxworks*)
660130803Smarcel    # FIXME: insert proper C++ library support
661130803Smarcel    ld_shlibs=no
662130803Smarcel    ;;
663130803Smarcel  *)
664130803Smarcel    # FIXME: insert proper C++ library support
665130803Smarcel    ld_shlibs=no
666130803Smarcel    ;;
667130803Smarcelesac
668130803Smarcel
669130803Smarcel
670130803Smarcel## Compiler Characteristics: PIC flags, static flags, etc
671130803Smarcel
672130803Smarcel# We don't use cached values here since only the C compiler
673130803Smarcel# characteristics should be cached.
674130803Smarcelac_cv_prog_cc_pic=
675130803Smarcelac_cv_prog_cc_shlib=
676130803Smarcelac_cv_prog_cc_wl=
677130803Smarcelac_cv_prog_cc_static=
678130803Smarcelac_cv_prog_cc_no_builtin=
679130803Smarcelac_cv_prog_cc_can_build_shared=$can_build_shared
680130803Smarcel
681130803Smarcelac_cv_prog_cc_pic_works=
682130803Smarcelac_cv_prog_cc_static_works=
683130803Smarcel
684130803Smarcelif test "$with_gcc" = yes; then
685130803Smarcel  ac_cv_prog_cc_wl='-Wl,'
686130803Smarcel  ac_cv_prog_cc_static='-static'
687130803Smarcel
688130803Smarcel  case $host_os in
689130803Smarcel  aix*)
690130803Smarcel    # All AIX code is PIC.
691130803Smarcel    if test "$host_cpu" = ia64; then
692130803Smarcel      # AIX 5 now supports IA64 processor
693130803Smarcel      lt_cv_prog_cc_static='-Bstatic'
694130803Smarcel    else
695130803Smarcel      lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
696130803Smarcel    fi
697130803Smarcel    ;;
698130803Smarcel  amigaos*)
699130803Smarcel    # FIXME: we need at least 68020 code to build shared libraries, but
700130803Smarcel    # adding the `-m68020' flag to GCC prevents building anything better,
701130803Smarcel    # like `-m68040'.
702130803Smarcel    ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
703130803Smarcel    ;;
704130803Smarcel  beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
705130803Smarcel    # PIC is the default for these OSes.
706130803Smarcel    ;;
707130803Smarcel  cygwin* | mingw* | os2*)
708130803Smarcel    # This hack is so that the source file can tell whether it is being
709130803Smarcel    # built for inclusion in a dll (and should export symbols for example).
710130803Smarcel    ac_cv_prog_cc_pic='-DDLL_EXPORT'
711130803Smarcel    ;;
712130803Smarcel  darwin* | rhapsody*)
713130803Smarcel    # PIC is the default on this platform
714130803Smarcel    # Common symbols not allowed in MH_DYLIB files
715130803Smarcel    lt_cv_prog_cc_pic='-fno-common'
716130803Smarcel    ;;
717130803Smarcel  *djgpp*)
718130803Smarcel    # DJGPP does not support shared libraries at all
719130803Smarcel    ac_cv_prog_cc_pic=
720130803Smarcel    ;;
721130803Smarcel  sysv4*MP*)
722130803Smarcel    if test -d /usr/nec; then
723130803Smarcel      ac_cv_prog_cc_pic=-Kconform_pic
724130803Smarcel    fi
725130803Smarcel    ;;
726130803Smarcel  *)
727130803Smarcel    ac_cv_prog_cc_pic='-fPIC'
728130803Smarcel    ;;
729130803Smarcel  esac
730130803Smarcelelse
731130803Smarcel  case $host_os in
732130803Smarcel    aix4* | aix5*)
733130803Smarcel      # All AIX code is PIC.
734130803Smarcel      if test "$host_cpu" = ia64; then
735130803Smarcel        # AIX 5 now supports IA64 processor
736130803Smarcel        lt_cv_prog_cc_static='-Bstatic'
737130803Smarcel      else
738130803Smarcel        lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
739130803Smarcel      fi
740130803Smarcel      ;;
741130803Smarcel    chorus*)
742130803Smarcel      case $cc_basename in
743130803Smarcel      cxch68)
744130803Smarcel        # Green Hills C++ Compiler
745130803Smarcel        # 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"
746130803Smarcel        ;;
747130803Smarcel      esac
748130803Smarcel      ;;
749130803Smarcel    dgux*)
750130803Smarcel      case $cc_basename in
751130803Smarcel        ec++)
752130803Smarcel          ac_cv_prog_cc_pic='-KPIC'
753130803Smarcel          ;;
754130803Smarcel        ghcx)
755130803Smarcel          # Green Hills C++ Compiler
756130803Smarcel          ac_cv_prog_cc_pic='-pic'
757130803Smarcel          ;;
758130803Smarcel        *)
759130803Smarcel          ;;
760130803Smarcel      esac
761130803Smarcel      ;;
762130803Smarcel    freebsd*)
763130803Smarcel      # FreeBSD uses GNU C++
764130803Smarcel      ;;
765130803Smarcel    gnu*)
766130803Smarcel      ;;
767130803Smarcel    hpux9* | hpux10* | hpux11*)
768130803Smarcel      case $cc_basename in
769130803Smarcel        CC)
770130803Smarcel          ac_cv_prog_cc_wl='-Wl,'
771130803Smarcel          ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
772130803Smarcel          ac_cv_prog_cc_pic='+Z'
773130803Smarcel          ;;
774130803Smarcel        aCC)
775130803Smarcel          ac_cv_prog_cc_wl='-Wl,'
776130803Smarcel          ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
777130803Smarcel          ac_cv_prog_cc_pic='+Z'
778130803Smarcel          ;;
779130803Smarcel        *)
780130803Smarcel          ;;
781130803Smarcel      esac
782130803Smarcel      ;;
783130803Smarcel    irix5* | irix6*)
784130803Smarcel      case $cc_basename in
785130803Smarcel        CC)
786130803Smarcel          ac_cv_prog_cc_wl='-Wl,'
787130803Smarcel          ac_cv_prog_cc_static='-non_shared'
788130803Smarcel          ac_cv_prog_cc_pic='-KPIC'
789130803Smarcel          ;;
790130803Smarcel        *)
791130803Smarcel          ;;
792130803Smarcel      esac
793130803Smarcel      ;;
794130803Smarcel    linux*)
795130803Smarcel      case $cc_basename in
796130803Smarcel        KCC)
797130803Smarcel          # KAI C++ Compiler
798130803Smarcel          ac_cv_prog_cc_wl='--backend -Wl,'
799130803Smarcel          ac_cv_prog_cc_pic='-fPIC'
800130803Smarcel          ;;
801130803Smarcel        cxx)
802130803Smarcel          # Compaq C++
803130803Smarcel          # Make sure the PIC flag is empty.  It appears that all Alpha
804130803Smarcel          # Linux and Compaq Tru64 Unix objects are PIC.
805130803Smarcel          ac_cv_prog_cc_pic=
806130803Smarcel          ac_cv_prog_cc_static='-non_shared'
807130803Smarcel          ;;
808130803Smarcel        *)
809130803Smarcel          ;;
810130803Smarcel      esac
811130803Smarcel      ;;
812130803Smarcel    lynxos*)
813130803Smarcel      ;;
814130803Smarcel    m88k*)
815130803Smarcel      ;;
816130803Smarcel    mvs*)
817130803Smarcel      case $cc_basename in
818130803Smarcel        cxx)
819130803Smarcel          ac_cv_prog_cc_pic='-W c,exportall'
820130803Smarcel          ;;
821130803Smarcel        *)
822130803Smarcel          ;;
823130803Smarcel      esac
824130803Smarcel      ;;
825130803Smarcel    netbsd*)
826130803Smarcel      ;;
827130803Smarcel    osf3* | osf4* | osf5*)
828130803Smarcel      case $cc_basename in
829130803Smarcel        KCC)
830130803Smarcel          ac_cv_prog_cc_wl='--backend -Wl,'
831130803Smarcel          ;;
832130803Smarcel        RCC)
833130803Smarcel          # Rational C++ 2.4.1
834130803Smarcel          ac_cv_prog_cc_pic='-pic'
835130803Smarcel          ;;
836130803Smarcel        cxx)
837130803Smarcel          # Digital/Compaq C++
838130803Smarcel          ac_cv_prog_cc_wl='-Wl,'
839130803Smarcel          # Make sure the PIC flag is empty.  It appears that all Alpha
840130803Smarcel          # Linux and Compaq Tru64 Unix objects are PIC.
841130803Smarcel          ac_cv_prog_cc_pic=
842130803Smarcel          ac_cv_prog_cc_static='-non_shared'
843130803Smarcel          ;;
844130803Smarcel        *)
845130803Smarcel          ;;
846130803Smarcel      esac
847130803Smarcel      ;;
848130803Smarcel    psos*)
849130803Smarcel      ;;
850130803Smarcel    sco*)
851130803Smarcel      case $cc_basename in
852130803Smarcel        CC)
853130803Smarcel          ac_cv_prog_cc_pic='-fPIC'
854130803Smarcel          ;;
855130803Smarcel        *)
856130803Smarcel          ;;
857130803Smarcel      esac
858130803Smarcel      ;;
859130803Smarcel    solaris*)
860130803Smarcel      case $cc_basename in
861130803Smarcel        CC)
862130803Smarcel          # Sun C++ 4.2, 5.x and Centerline C++
863130803Smarcel          ac_cv_prog_cc_pic='-KPIC'
864130803Smarcel          ac_cv_prog_cc_static='-Bstatic'
865130803Smarcel          ac_cv_prog_cc_wl='-Qoption ld '
866130803Smarcel          ;;
867130803Smarcel        gcx)
868130803Smarcel          # Green Hills C++ Compiler
869130803Smarcel          ac_cv_prog_cc_pic='-PIC'
870130803Smarcel          ;;
871130803Smarcel        *)
872130803Smarcel          ;;
873130803Smarcel      esac
874130803Smarcel      ;;
875130803Smarcel    sunos4*)
876130803Smarcel      case $cc_basename in
877130803Smarcel        CC)
878130803Smarcel          # Sun C++ 4.x
879130803Smarcel          ac_cv_prog_cc_pic='-pic'
880130803Smarcel          ac_cv_prog_cc_static='-Bstatic'
881130803Smarcel          ;;
882130803Smarcel        lcc)
883130803Smarcel          # Lucid
884130803Smarcel          ac_cv_prog_cc_pic='-pic'
885130803Smarcel          ;;
886130803Smarcel        *)
887130803Smarcel          ;;
888130803Smarcel      esac
889130803Smarcel      ;;
890130803Smarcel    tandem*)
891130803Smarcel      case $cc_basename in
892130803Smarcel        NCC)
893130803Smarcel          # NonStop-UX NCC 3.20
894130803Smarcel          ac_cv_prog_cc_pic='-KPIC'
895130803Smarcel          ;;
896130803Smarcel        *)
897130803Smarcel          ;;
898130803Smarcel      esac
899130803Smarcel      ;;
900130803Smarcel    unixware*)
901130803Smarcel      ;;
902130803Smarcel    vxworks*)
903130803Smarcel      ;;
904130803Smarcel    *)
905130803Smarcel      ac_cv_prog_cc_can_build_shared=no
906130803Smarcel      ;;
907130803Smarcel  esac
908130803Smarcelfi
909130803Smarcel
910130803Smarcelcase "$host_os" in
911130803Smarcel    # Platforms which do not suport PIC and -DPIC is meaningless
912130803Smarcel    # on them:
913130803Smarcel    *djgpp*)
914130803Smarcel      ac_cv_prog_cc_pic=
915130803Smarcel      ;;
916130803Smarcel    *)
917130803Smarcel      ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
918130803Smarcel      ;;
919130803Smarcelesac
920130803Smarcel
921130803Smarcel
922130803Smarcel# Figure out "hidden" C++ library dependencies from verbose
923130803Smarcel# compiler output whening linking a shared library.
924130803Smarcelcat > conftest.$ac_ext <<EOF
925130803Smarcelclass Foo
926130803Smarcel{
927130803Smarcelpublic:
928130803Smarcel  Foo (void) { a = 0; }
929130803Smarcelprivate:
930130803Smarcel  int a;
931130803Smarcel};
932130803SmarcelEOF
933130803Smarcel
934130803Smarcel
935130803Smarcelif (eval $ac_compile) 2>&5; then
936130803Smarcel  # Parse the compiler output and extract the necessary
937130803Smarcel  # objects, libraries and library flags.
938130803Smarcel
939130803Smarcel  # Sentinel used to keep track of whether or not we are before
940130803Smarcel  # the conftest object file.
941130803Smarcel  pre_test_object_deps_done=no
942130803Smarcel
943130803Smarcel  for p in `eval $output_verbose_link_cmd`; do
944130803Smarcel
945130803Smarcel    case $p in
946130803Smarcel
947130803Smarcel    -L* | -R* | -l*)
948130803Smarcel       # Some compilers place space between "-{L,R}" and the path.
949130803Smarcel       # Remove the space.
950130803Smarcel       if test $p = "-L" \
951130803Smarcel          || test $p = "-R"; then
952130803Smarcel         prev=$p
953130803Smarcel         continue
954130803Smarcel       else
955130803Smarcel         prev=
956130803Smarcel       fi
957130803Smarcel
958130803Smarcel       if test "$pre_test_object_deps_done" = no; then
959130803Smarcel         case $p in
960130803Smarcel	 -L* | -R*)
961130803Smarcel	   # Internal compiler library paths should come after those
962130803Smarcel	   # provided the user.  The postdeps already come after the
963130803Smarcel	   # user supplied libs so there is no need to process them.
964130803Smarcel           if test -z "$compiler_lib_search_path"; then
965130803Smarcel             compiler_lib_search_path="${prev}${p}"
966130803Smarcel           else
967130803Smarcel             compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
968130803Smarcel           fi
969130803Smarcel           ;;
970130803Smarcel         # The "-l" case would never come before the object being
971130803Smarcel         # linked, so don't bother handling this case.
972130803Smarcel         esac
973130803Smarcel       else
974130803Smarcel         if test -z "$postdeps"; then
975130803Smarcel           postdeps="${prev}${p}"
976130803Smarcel         else
977130803Smarcel           postdeps="${postdeps} ${prev}${p}"
978130803Smarcel         fi
979130803Smarcel       fi
980130803Smarcel       ;;
981130803Smarcel
982130803Smarcel    *.$objext)
983130803Smarcel       # This assumes that the test object file only shows up
984130803Smarcel       # once in the compiler output.
985130803Smarcel       if test "$p" = "conftest.$objext"; then
986130803Smarcel         pre_test_object_deps_done=yes
987130803Smarcel         continue
988130803Smarcel       fi
989130803Smarcel
990130803Smarcel       if test "$pre_test_object_deps_done" = no; then
991130803Smarcel         if test -z "$predep_objects"; then
992130803Smarcel           predep_objects="$p"
993130803Smarcel         else
994130803Smarcel           predep_objects="$predep_objects $p"
995130803Smarcel         fi
996130803Smarcel       else
997130803Smarcel         if test -z "$postdep_objects"; then
998130803Smarcel           postdep_objects="$p"
999130803Smarcel         else
1000130803Smarcel           postdep_objects="$postdep_objects $p"
1001130803Smarcel         fi
1002130803Smarcel       fi
1003130803Smarcel       ;;
1004130803Smarcel
1005130803Smarcel    *) ;; # Ignore the rest.
1006130803Smarcel
1007130803Smarcel    esac
1008130803Smarcel  done
1009130803Smarcel
1010130803Smarcel  # Clean up.
1011130803Smarcel  rm -f a.out
1012130803Smarcelelse
1013130803Smarcel  echo "ltcf-cxx.sh: error: problem compiling test program"
1014130803Smarcelfi
1015130803Smarcel
1016130803Smarcel$rm -f confest.$objext
1017130803Smarcel
1018130803Smarcelcase " $postdeps " in
1019130803Smarcel*" -lc "*) need_lc=no ;;
1020130803Smarcel*) need_lc=yes ;;
1021130803Smarcelesac
1022