OSDN Git Service

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