* Makefile.am (GENSCRIPTS): Pass prefix.
[binutils.git] / ltcf-cxx.sh
blobfa8dbd08d6337535eb6f245b2da43ee9a332f8cd
1 #### This script is meant to be sourced by ltconfig.
3 # ltcf-cxx.sh - Create a C++ compiler specific configuration
5 # Copyright (C) 1996-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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>
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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.
33 # Source file extension for C++ test sources.
34 ac_ext=cc
36 # Object file extension for compiled C++ test sources.
37 objext=o
39 # Code to be used in simple compile tests
40 lt_simple_compile_test_code="int some_variable = 0;"
42 # Code to be used in simple link tests
43 lt_simple_link_test_code='int main(int, char *[]) { return (0); }'
45 # C++ compiler
46 CXX=${CXX-c++}
48 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
49 CC=${CC-"$CXX"}
50 CFLAGS=${CFLAGS-"$CXXFLAGS"}
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%^.*/%%'`
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
68 # Set up default GNU C++ configuration
70 # Check if GNU C++ uses GNU ld as the underlying linker, since the
71 # archiving commands below assume that GNU ld is being used. The
72 # assumption here is that the linker is going to be the same as that
73 # used by the C compiler. For the purposes of GCC, this is ok, but
74 # if someone uses g++ along with a non-GNU C compiler that doesn't
75 # use GNU ld, we may lose. This is ok for the toolchain tree, since
76 # the only users of ltcf-cxx.sh are libstdc++-v3 and libjava,
77 # anyway, and those use both gcc and g++, so the settings are bound
78 # to be the same.
80 if test "$with_gnu_ld" = yes; then
81 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
82 archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
84 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
85 export_dynamic_flag_spec='${wl}--export-dynamic'
87 # If archive_cmds runs LD, not CC, wlarc should be empty
88 # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
89 # investigate it a little bit more. (MM)
90 wlarc='${wl}'
92 # ancient GNU ld didn't support --whole-archive et. al.
93 if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
94 egrep 'no-whole-archive' > /dev/null; then
95 whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
96 else
97 whole_archive_flag_spec=
99 else
100 wlarc=
102 # A generic and very simple default shared library creation
103 # command for GNU C++ for the case where it uses the native
104 # linker, instead of GNU ld. If possible, this setting should
105 # overridden to take advantage of the native linker features on
106 # the platform it is being used on.
107 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
110 # Commands to make compiler produce verbose output that lists
111 # what "hidden" libraries, object files and flags are used when
112 # linking a shared library.
113 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
115 else
116 with_gcc=no
117 wlarc=
120 # PORTME: fill in a description of your system's C++ link characteristics
121 case $host_os in
122 aix3*)
123 # FIXME: insert proper C++ library support
124 ld_shlibs=no
126 aix4* | aix5*)
127 archive_cmds=''
128 hardcode_direct=yes
129 hardcode_libdir_separator=':'
130 link_all_deplibs=yes
131 # When large executables or shared objects are built, AIX ld can
132 # have problems creating the table of contents. If linking a library
133 # or program results in "error TOC overflow" add -mminimal-toc to
134 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
135 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
136 if test "$with_gcc" = yes; then
137 case $host_os in aix4.[012]|aix4.[012].*)
138 # We only want to do this on AIX 4.2 and lower, the check
139 # below for broken collect2 doesn't work under 4.3+
140 collect2name=`${CC} -print-prog-name=collect2`
141 if test -f "$collect2name" && \
142 strings "$collect2name" | grep resolve_lib_name >/dev/null
143 then
144 # We have reworked collect2
145 hardcode_direct=yes
146 else
147 # We have old collect2
148 hardcode_direct=unsupported
149 # It fails to find uninstalled libraries when the uninstalled
150 # path is not listed in the libpath. Setting hardcode_minus_L
151 # to unsupported forces relinking
152 hardcode_minus_L=yes
153 hardcode_libdir_flag_spec='-L$libdir'
154 hardcode_libdir_separator=
156 esac
157 shared_flag='-shared'
158 else
159 # not using gcc
160 if test "$host_cpu" = ia64; then
161 shared_flag='${wl}-G'
162 else
163 shared_flag='${wl}-bM:SRE'
167 if test "$host_cpu" = ia64; then
168 # On IA64, the linker does run time linking by default, so we don't
169 # have to do anything special.
170 aix_use_runtimelinking=no
171 if test $with_gnu_ld = no; then
172 exp_sym_flag='-Bexport'
173 no_entry_flag=""
175 else
176 # Test if we are trying to use run time linking, or normal AIX style linking.
177 # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
178 aix_use_runtimelinking=no
179 for ld_flag in $LDFLAGS; do
180 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
181 aix_use_runtimelinking=yes
182 break
184 done
185 exp_sym_flag='-bexport'
186 no_entry_flag='-bnoentry'
188 # It seems that -bexpall does not export symbols beginning with
189 # underscore (_), so it is better to generate a list of symbols to export.
190 always_export_symbols=yes
191 if test "$aix_use_runtimelinking" = yes; then
192 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
193 allow_undefined_flag=' -Wl,-G'
194 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}-brtl \${wl}$exp_sym_flag:\$export_symbols"
195 else
196 if test "$host_cpu" = ia64; then
197 if test $with_gnu_ld = no; then
198 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
199 allow_undefined_flag="-z nodefs"
200 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
202 else
203 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
204 # Warning - without using the other run time loading flags, -berok will
205 # link without error, but may produce a broken library.
206 no_undefined_flag=' ${wl}-bnoerok'
207 allow_undefined_flag=' ${wl}-berok'
208 # -bexpall does not export symbols beginning with underscore (_)
209 always_export_symbols=yes
210 # Exported symbols can be pulled into shared objects from archives
211 whole_archive_flag_spec=' '
212 build_libtool_need_lc=yes
213 # This is similar to how AIX traditionally builds it's shared libraries.
214 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
218 chorus*)
219 case $cc_basename in
221 # FIXME: insert proper C++ library support
222 ld_shlibs=no
224 esac
226 dgux*)
227 case $cc_basename in
228 ec++)
229 # FIXME: insert proper C++ library support
230 ld_shlibs=no
232 ghcx)
233 # Green Hills C++ Compiler
234 # FIXME: insert proper C++ library support
235 ld_shlibs=no
238 # FIXME: insert proper C++ library support
239 ld_shlibs=no
241 esac
243 freebsd[12]*)
244 # C++ shared libraries reported to be fairly broken before switch to ELF
245 ld_shlibs=no
247 freebsd* | kfreebsd*-gnu)
248 # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
249 # conventions
250 ld_shlibs=yes
252 gnu*)
254 hpux*)
255 if test $with_gnu_ld = no; then
256 case "$host_cpu" in
257 ia64*)
258 hardcode_libdir_flag_spec='-L$libdir'
259 hardcode_shlibpath_var=no ;;
261 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' ;;
262 esac
263 hardcode_direct=yes
264 hardcode_libdir_separator=:
265 export_dynamic_flag_spec='${wl}-E'
267 hardcode_minus_L=yes # Not in the search PATH, but as the default
268 # location of the library.
270 case $cc_basename in
272 # FIXME: insert proper C++ library support
273 ld_shlibs=no
275 aCC)
276 case $host_os in
277 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' ;;
278 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
279 esac
280 # Commands to make compiler produce verbose output that lists
281 # what "hidden" libraries, object files and flags are used when
282 # linking a shared library.
284 # There doesn't appear to be a way to prevent this compiler from
285 # explicitly linking system object files so we need to strip them
286 # from the output so that they don't get included in the library
287 # dependencies.
288 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'
291 if test $with_gcc = yes; then
292 if test $with_gnu_ld = no; then
293 case "$host_os" in
294 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' ;;
296 case "$host_cpu" in
297 ia64*)
298 archive_cmds='$LD -b +h $soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;;
300 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' ;;
301 esac
303 esac
305 else
306 # FIXME: insert proper C++ library support
307 ld_shlibs=no
310 esac
312 irix5* | irix6*)
313 case $cc_basename in
315 # SGI C++
316 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'
318 # Archives containing C++ object files must be created using
319 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
320 # necessary to make sure instantiated templates are included
321 # in the archive.
322 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
325 if test "$with_gcc" = yes; then
326 if test "$with_gnu_ld" = no; then
327 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'
328 else
329 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
332 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
333 hardcode_libdir_separator=:
334 link_all_deplibs=yes
336 esac
338 linux*)
339 case $cc_basename in
340 KCC)
341 # Kuck and Associates, Inc. (KAI) C++ Compiler
343 # KCC will only create a shared library if the output file
344 # ends with ".so" (or ".sl" for HP-UX), so rename the library
345 # to its proper name (with version) after linking.
346 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'
347 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'
349 # Commands to make compiler produce verbose output that lists
350 # what "hidden" libraries, object files and flags are used when
351 # linking a shared library.
353 # There doesn't appear to be a way to prevent this compiler from
354 # explicitly linking system object files so we need to strip them
355 # from the output so that they don't get included in the library
356 # dependencies.
357 output_verbose_link_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'
359 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
360 export_dynamic_flag_spec='${wl}--export-dynamic'
362 # Archives containing C++ object files must be created using
363 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
364 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
366 cxx)
367 # Compaq C++
368 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
369 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'
371 runpath_var=LD_RUN_PATH
372 hardcode_libdir_flag_spec='-rpath $libdir'
373 hardcode_libdir_separator=:
375 # Commands to make compiler produce verbose output that lists
376 # what "hidden" libraries, object files and flags are used when
377 # linking a shared library.
379 # There doesn't appear to be a way to prevent this compiler from
380 # explicitly linking system object files so we need to strip them
381 # from the output so that they don't get included in the library
382 # dependencies.
383 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'
385 esac
387 lynxos*)
388 # FIXME: insert proper C++ library support
389 ld_shlibs=no
391 m88k*)
392 # FIXME: insert proper C++ library support
393 ld_shlibs=no
395 mvs*)
396 case $cc_basename in
397 cxx)
398 # FIXME: insert proper C++ library support
399 ld_shlibs=no
402 # FIXME: insert proper C++ library support
403 ld_shlibs=no
405 esac
407 netbsd* | knetbsd*-gnu)
408 # NetBSD uses g++ - do we need to do anything?
410 osf3*)
411 case $cc_basename in
412 KCC)
413 # Kuck and Associates, Inc. (KAI) C++ Compiler
415 # KCC will only create a shared library if the output file
416 # ends with ".so" (or ".sl" for HP-UX), so rename the library
417 # to its proper name (with version) after linking.
418 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'
420 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
421 hardcode_libdir_separator=:
423 # Archives containing C++ object files must be created using
424 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
425 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
428 RCC)
429 # Rational C++ 2.4.1
430 # FIXME: insert proper C++ library support
431 ld_shlibs=no
433 cxx)
434 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
435 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'
437 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
438 hardcode_libdir_separator=:
440 # Commands to make compiler produce verbose output that lists
441 # what "hidden" libraries, object files and flags are used when
442 # linking a shared library.
444 # There doesn't appear to be a way to prevent this compiler from
445 # explicitly linking system object files so we need to strip them
446 # from the output so that they don't get included in the library
447 # dependencies.
448 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'
451 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
452 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
453 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'
455 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
456 hardcode_libdir_separator=:
458 # Commands to make compiler produce verbose output that lists
459 # what "hidden" libraries, object files and flags are used when
460 # linking a shared library.
461 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
462 else
463 # FIXME: insert proper C++ library support
464 ld_shlibs=no
467 esac
469 osf4* | osf5*)
470 case $cc_basename in
471 KCC)
472 # Kuck and Associates, Inc. (KAI) C++ Compiler
474 # KCC will only create a shared library if the output file
475 # ends with ".so" (or ".sl" for HP-UX), so rename the library
476 # to its proper name (with version) after linking.
477 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'
479 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
480 hardcode_libdir_separator=:
482 # Archives containing C++ object files must be created using
483 # the KAI C++ compiler.
484 old_archive_cmds='$CC -o $oldlib $oldobjs'
486 RCC)
487 # Rational C++ 2.4.1
488 # FIXME: insert proper C++ library support
489 ld_shlibs=no
491 cxx)
492 allow_undefined_flag=' -expect_unresolved \*'
493 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'
494 archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~
495 echo "-hidden">> $lib.exp~
496 $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~
497 $rm $lib.exp'
499 hardcode_libdir_flag_spec='-rpath $libdir'
500 hardcode_libdir_separator=:
502 # Commands to make compiler produce verbose output that lists
503 # what "hidden" libraries, object files and flags are used when
504 # linking a shared library.
506 # There doesn't appear to be a way to prevent this compiler from
507 # explicitly linking system object files so we need to strip them
508 # from the output so that they don't get included in the library
509 # dependencies.
510 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'
513 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
514 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
515 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'
517 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
518 hardcode_libdir_separator=:
520 # Commands to make compiler produce verbose output that lists
521 # what "hidden" libraries, object files and flags are used when
522 # linking a shared library.
523 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
524 else
525 # FIXME: insert proper C++ library support
526 ld_shlibs=no
529 esac
531 psos*)
532 # FIXME: insert proper C++ library support
533 ld_shlibs=no
535 sco*)
536 case $cc_basename in
538 # FIXME: insert proper C++ library support
539 ld_shlibs=no
542 # FIXME: insert proper C++ library support
543 ld_shlibs=no
545 esac
547 sunos4*)
548 case $cc_basename in
550 # Sun C++ 4.x
551 # FIXME: insert proper C++ library support
552 ld_shlibs=no
554 lcc)
555 # Lucid
556 # FIXME: insert proper C++ library support
557 ld_shlibs=no
560 # FIXME: insert proper C++ library support
561 ld_shlibs=no
563 esac
565 solaris*)
566 case $cc_basename in
568 # Sun C++ 4.2, 5.x and Centerline C++
569 no_undefined_flag=' -zdefs'
570 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
571 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
572 $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'
574 hardcode_libdir_flag_spec='-R$libdir'
575 hardcode_shlibpath_var=no
576 case $host_os in
577 solaris2.[0-5] | solaris2.[0-5].*) ;;
579 # The C++ compiler is used as linker so we must use $wl
580 # flag to pass the commands to the underlying system
581 # linker.
582 # Supported since Solaris 2.6 (maybe 2.5.1?)
583 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
585 esac
586 link_all_deplibs=yes
588 # Commands to make compiler produce verbose output that lists
589 # what "hidden" libraries, object files and flags are used when
590 # linking a shared library.
592 # There doesn't appear to be a way to prevent this compiler from
593 # explicitly linking system object files so we need to strip them
594 # from the output so that they don't get included in the library
595 # dependencies.
596 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'
598 # Archives containing C++ object files must be created using
599 # "CC -xar", where "CC" is the Sun C++ compiler. This is
600 # necessary to make sure instantiated templates are included
601 # in the archive.
602 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
604 gcx)
605 # Green Hills C++ Compiler
606 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
608 # The C++ compiler must be used to create the archive.
609 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
612 # GNU C++ compiler with Solaris linker
613 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
614 no_undefined_flag=' ${wl}-z ${wl}defs'
615 if $CC --version | egrep -v '^2\.7' > /dev/null; then
616 archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
617 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
618 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
620 # Commands to make compiler produce verbose output that lists
621 # what "hidden" libraries, object files and flags are used when
622 # linking a shared library.
623 output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
624 else
625 # g++ 2.7 appears to require `-G' NOT `-shared' on this
626 # platform.
627 archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
628 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
629 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
631 # Commands to make compiler produce verbose output that lists
632 # what "hidden" libraries, object files and flags are used when
633 # linking a shared library.
634 output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
637 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
640 esac
642 tandem*)
643 case $cc_basename in
644 NCC)
645 # NonStop-UX NCC 3.20
646 # FIXME: insert proper C++ library support
647 ld_shlibs=no
650 # FIXME: insert proper C++ library support
651 ld_shlibs=no
653 esac
655 tpf*)
656 ld_shlibs=yes
658 unixware*)
659 # FIXME: insert proper C++ library support
660 ld_shlibs=no
662 vxworks*)
663 # FIXME: insert proper C++ library support
664 ld_shlibs=no
667 # FIXME: insert proper C++ library support
668 ld_shlibs=no
670 esac
673 ## Compiler Characteristics: PIC flags, static flags, etc
675 # We don't use cached values here since only the C compiler
676 # characteristics should be cached.
677 ac_cv_prog_cc_pic=
678 ac_cv_prog_cc_shlib=
679 ac_cv_prog_cc_wl=
680 ac_cv_prog_cc_static=
681 ac_cv_prog_cc_no_builtin=
682 ac_cv_prog_cc_can_build_shared=$can_build_shared
684 ac_cv_prog_cc_pic_works=
685 ac_cv_prog_cc_static_works=
687 if test "$with_gcc" = yes; then
688 ac_cv_prog_cc_wl='-Wl,'
689 ac_cv_prog_cc_static='-static'
691 case $host_os in
692 aix*)
693 # All AIX code is PIC.
694 if test "$host_cpu" = ia64; then
695 # AIX 5 now supports IA64 processor
696 lt_cv_prog_cc_static='-Bstatic'
697 else
698 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
701 amigaos*)
702 # FIXME: we need at least 68020 code to build shared libraries, but
703 # adding the `-m68020' flag to GCC prevents building anything better,
704 # like `-m68040'.
705 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
707 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
708 # PIC is the default for these OSes.
710 cygwin* | mingw* | os2*)
711 # This hack is so that the source file can tell whether it is being
712 # built for inclusion in a dll (and should export symbols for example).
713 ac_cv_prog_cc_pic='-DDLL_EXPORT'
715 darwin* | rhapsody*)
716 # PIC is the default on this platform
717 # Common symbols not allowed in MH_DYLIB files
718 lt_cv_prog_cc_pic='-fno-common'
720 *djgpp*)
721 # DJGPP does not support shared libraries at all
722 ac_cv_prog_cc_pic=
724 sysv4*MP*)
725 if test -d /usr/nec; then
726 ac_cv_prog_cc_pic=-Kconform_pic
730 ac_cv_prog_cc_pic='-fPIC'
732 esac
733 else
734 case $host_os in
735 aix4* | aix5*)
736 # All AIX code is PIC.
737 if test "$host_cpu" = ia64; then
738 # AIX 5 now supports IA64 processor
739 lt_cv_prog_cc_static='-Bstatic'
740 else
741 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
744 chorus*)
745 case $cc_basename in
746 cxch68)
747 # Green Hills C++ Compiler
748 # 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"
750 esac
752 dgux*)
753 case $cc_basename in
754 ec++)
755 ac_cv_prog_cc_pic='-KPIC'
757 ghcx)
758 # Green Hills C++ Compiler
759 ac_cv_prog_cc_pic='-pic'
763 esac
765 freebsd* | kfreebsd*-gnu)
766 # FreeBSD uses GNU C++
768 gnu*)
770 hpux9* | hpux10* | hpux11*)
771 case $cc_basename in
773 ac_cv_prog_cc_wl='-Wl,'
774 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
775 ac_cv_prog_cc_pic='+Z'
777 aCC)
778 ac_cv_prog_cc_wl='-Wl,'
779 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
780 ac_cv_prog_cc_pic='+Z'
784 esac
786 irix5* | irix6*)
787 case $cc_basename in
789 ac_cv_prog_cc_wl='-Wl,'
790 ac_cv_prog_cc_static='-non_shared'
791 ac_cv_prog_cc_pic='-KPIC'
795 esac
797 linux*)
798 case $cc_basename in
799 KCC)
800 # KAI C++ Compiler
801 ac_cv_prog_cc_wl='--backend -Wl,'
802 ac_cv_prog_cc_pic='-fPIC'
804 cxx)
805 # Compaq C++
806 # Make sure the PIC flag is empty. It appears that all Alpha
807 # Linux and Compaq Tru64 Unix objects are PIC.
808 ac_cv_prog_cc_pic=
809 ac_cv_prog_cc_static='-non_shared'
813 esac
815 lynxos*)
817 m88k*)
819 mvs*)
820 case $cc_basename in
821 cxx)
822 ac_cv_prog_cc_pic='-W c,exportall'
826 esac
828 netbsd*)
830 osf3* | osf4* | osf5*)
831 case $cc_basename in
832 KCC)
833 ac_cv_prog_cc_wl='--backend -Wl,'
835 RCC)
836 # Rational C++ 2.4.1
837 ac_cv_prog_cc_pic='-pic'
839 cxx)
840 # Digital/Compaq C++
841 ac_cv_prog_cc_wl='-Wl,'
842 # Make sure the PIC flag is empty. It appears that all Alpha
843 # Linux and Compaq Tru64 Unix objects are PIC.
844 ac_cv_prog_cc_pic=
845 ac_cv_prog_cc_static='-non_shared'
849 esac
851 psos*)
853 sco*)
854 case $cc_basename in
856 ac_cv_prog_cc_pic='-fPIC'
860 esac
862 solaris*)
863 case $cc_basename in
865 # Sun C++ 4.2, 5.x and Centerline C++
866 ac_cv_prog_cc_pic='-KPIC'
867 ac_cv_prog_cc_static='-Bstatic'
868 ac_cv_prog_cc_wl='-Qoption ld '
870 gcx)
871 # Green Hills C++ Compiler
872 ac_cv_prog_cc_pic='-PIC'
876 esac
878 sunos4*)
879 case $cc_basename in
881 # Sun C++ 4.x
882 ac_cv_prog_cc_pic='-pic'
883 ac_cv_prog_cc_static='-Bstatic'
885 lcc)
886 # Lucid
887 ac_cv_prog_cc_pic='-pic'
891 esac
893 tandem*)
894 case $cc_basename in
895 NCC)
896 # NonStop-UX NCC 3.20
897 ac_cv_prog_cc_pic='-KPIC'
901 esac
903 unixware*)
905 vxworks*)
908 ac_cv_prog_cc_can_build_shared=no
910 esac
913 case "$host_os" in
914 # Platforms which do not suport PIC and -DPIC is meaningless
915 # on them:
916 *djgpp*)
917 ac_cv_prog_cc_pic=
920 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
922 esac
925 # Figure out "hidden" C++ library dependencies from verbose
926 # compiler output whening linking a shared library.
927 cat > conftest.$ac_ext <<EOF
928 class Foo
930 public:
931 Foo (void) { a = 0; }
932 private:
933 int a;
938 if (eval $ac_compile) 2>&5; then
939 # Parse the compiler output and extract the necessary
940 # objects, libraries and library flags.
942 # Sentinel used to keep track of whether or not we are before
943 # the conftest object file.
944 pre_test_object_deps_done=no
946 for p in `eval $output_verbose_link_cmd`; do
948 case $p in
950 -L* | -R* | -l*)
951 # Some compilers place space between "-{L,R}" and the path.
952 # Remove the space.
953 if test $p = "-L" \
954 || test $p = "-R"; then
955 prev=$p
956 continue
957 else
958 prev=
961 if test "$pre_test_object_deps_done" = no; then
962 case $p in
963 -L* | -R*)
964 # Internal compiler library paths should come after those
965 # provided the user. The postdeps already come after the
966 # user supplied libs so there is no need to process them.
967 if test -z "$compiler_lib_search_path"; then
968 compiler_lib_search_path="${prev}${p}"
969 else
970 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
973 # The "-l" case would never come before the object being
974 # linked, so don't bother handling this case.
975 esac
976 else
977 if test -z "$postdeps"; then
978 postdeps="${prev}${p}"
979 else
980 postdeps="${postdeps} ${prev}${p}"
985 *.$objext)
986 # This assumes that the test object file only shows up
987 # once in the compiler output.
988 if test "$p" = "conftest.$objext"; then
989 pre_test_object_deps_done=yes
990 continue
993 if test "$pre_test_object_deps_done" = no; then
994 if test -z "$predep_objects"; then
995 predep_objects="$p"
996 else
997 predep_objects="$predep_objects $p"
999 else
1000 if test -z "$postdep_objects"; then
1001 postdep_objects="$p"
1002 else
1003 postdep_objects="$postdep_objects $p"
1008 *) ;; # Ignore the rest.
1010 esac
1011 done
1013 # Clean up.
1014 rm -f a.out
1015 else
1016 echo "ltcf-cxx.sh: error: problem compiling test program"
1019 $rm -f confest.$objext
1021 case " $postdeps " in
1022 *" -lc "*) need_lc=no ;;
1023 *) need_lc=yes ;;
1024 esac