OSDN Git Service

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