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