OSDN Git Service

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