OSDN Git Service

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