2001-02-04 Philip Blundell <philb@gnu.org>
[binutils.git] / ltcf-cxx.sh
blobab9e62721deac6461d8c163448613168c87e9fe9
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.
72 if eval "`$CC -print-prog-name=ld` --version 2>&1" | \
73 egrep 'GNU ld' > /dev/null; then
74 with_gnu_ld=yes
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'
79 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
80 export_dynamic_flag_spec='${wl}--export-dynamic'
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}'
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=
94 else
95 with_gnu_ld=no
96 wlarc=
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'
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"'
111 else
112 with_gcc=no
113 with_gnu_ld=no
114 wlarc=
117 # In general, the C++ compiler should always link C++ objects.
118 case $target in
119 *aix3* | *aix4*)
120 # AIX just has to be different, doesn't it? :-\
121 LD=makeC++SharedLib_r
122 LDFLAGS="$LDFLAGS -p 0"
125 LD="$CC"
126 LDFLAGS="$LDFLAGS"
128 esac
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
137 # We don't want to build shared libraries on unknown CPU types.
138 case $host_cpu in
139 powerpc | rs6000) ;;
140 *) ld_shlibs=no ;;
141 esac
143 aix4*)
144 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'
145 # -bexpall does not export symbols beginning with underscore (_)
146 always_export_symbols=yes
147 # Exported symbols can be pulled into shared objects from archives
148 whole_archive_flag_spec=' '
149 build_libtool_need_lc=yes
151 chorus*)
152 case "$cc_basename" in
154 # FIXME: insert proper C++ library support
155 ld_shlibs=no
157 esac
159 dgux*)
160 case "$cc_basename" in
161 ec++)
162 # FIXME: insert proper C++ library support
163 ld_shlibs=no
165 ghcx)
166 # Green Hills C++ Compiler
167 # FIXME: insert proper C++ library support
168 ld_shlibs=no
171 # FIXME: insert proper C++ library support
172 ld_shlibs=no
174 esac
176 freebsd*)
177 # FreeBSD uses GNU C++ and GNU ld
178 # FIXME: insert proper C++ library support
179 ld_shlibs=no
181 hpux*)
182 case "$cc_basename" in
184 # FIXME: insert proper C++ library support
185 ld_shlibs=no
187 aCC)
188 case "$host_os" in
189 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' ;;
190 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
191 esac
192 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
193 hardcode_libdir_separator=:
194 hardcode_direct=yes
195 hardcode_minus_L=yes # Not in the search PATH, but as the default
196 # location of the library.
197 export_dynamic_flag_spec='${wl}-E'
199 # Commands to make compiler produce verbose output that lists
200 # what "hidden" libraries, object files and flags are used when
201 # linking a shared library.
203 # There doesn't appear to be a way to prevent this compiler from
204 # explicitly linking system object files so we need to strip them
205 # from the output so that they don't get included in the library
206 # dependencies.
207 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'
210 # FIXME: insert proper C++ library support
211 ld_shlibs=no
213 esac
215 irix5* | irix6*)
216 case "$cc_basename" in
218 # SGI C++
219 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'
221 # Archives containing C++ object files must be created using
222 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
223 # necessary to make sure instantiated templates are included
224 # in the archive.
225 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
228 if test "$with_gcc" = yes; then
229 if test "$with_gnu_ld" = no; then
230 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'
231 else
232 archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
235 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
236 hardcode_libdir_separator=:
237 link_all_deplibs=yes
239 esac
241 linux*)
242 case "$cc_basename" in
243 KCC)
244 # Kuck and Associates, Inc. (KAI) C++ Compiler
246 # KCC will only create a shared library if the output file
247 # ends with ".so" (or ".sl" for HP-UX), so rename the library
248 # to its proper name (with version) after linking.
249 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'
250 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'
252 # Commands to make compiler produce verbose output that lists
253 # what "hidden" libraries, object files and flags are used when
254 # linking a shared library.
256 # There doesn't appear to be a way to prevent this compiler from
257 # explicitly linking system object files so we need to strip them
258 # from the output so that they don't get included in the library
259 # dependencies.
260 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'
262 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
263 export_dynamic_flag_spec='${wl}--export-dynamic'
265 # Archives containing C++ object files must be created using
266 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
267 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
269 cxx)
270 # Compaq C++
271 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
272 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'
274 runpath_var=LD_RUN_PATH
275 hardcode_libdir_flag_spec='-rpath $libdir'
276 hardcode_libdir_separator=:
278 # Commands to make compiler produce verbose output that lists
279 # what "hidden" libraries, object files and flags are used when
280 # linking a shared library.
282 # There doesn't appear to be a way to prevent this compiler from
283 # explicitly linking system object files so we need to strip them
284 # from the output so that they don't get included in the library
285 # dependencies.
286 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'
288 esac
290 lynxos*)
291 # FIXME: insert proper C++ library support
292 ld_shlibs=no
294 m88k*)
295 # FIXME: insert proper C++ library support
296 ld_shlibs=no
298 mvs*)
299 case "$cc_basename" in
300 cxx)
301 # FIXME: insert proper C++ library support
302 ld_shlibs=no
305 # FIXME: insert proper C++ library support
306 ld_shlibs=no
308 esac
310 netbsd*)
311 # NetBSD uses g++ - do we need to do anything?
313 osf3*)
314 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
315 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
316 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'
318 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
319 hardcode_libdir_separator=:
321 # Commands to make compiler produce verbose output that lists
322 # what "hidden" libraries, object files and flags are used when
323 # linking a shared library.
324 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
327 case "$cc_basename" in
328 KCC)
329 # Kuck and Associates, Inc. (KAI) C++ Compiler
331 # KCC will only create a shared library if the output file
332 # ends with ".so" (or ".sl" for HP-UX), so rename the library
333 # to its proper name (with version) after linking.
334 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'
336 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
337 hardcode_libdir_separator=:
339 # Archives containing C++ object files must be created using
340 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
341 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
344 RCC)
345 # Rational C++ 2.4.1
346 # FIXME: insert proper C++ library support
347 ld_shlibs=no
349 cxx)
350 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
351 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'
353 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
354 hardcode_libdir_separator=:
356 # Commands to make compiler produce verbose output that lists
357 # what "hidden" libraries, object files and flags are used when
358 # linking a shared library.
360 # There doesn't appear to be a way to prevent this compiler from
361 # explicitly linking system object files so we need to strip them
362 # from the output so that they don't get included in the library
363 # dependencies.
364 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'
367 # FIXME: insert proper C++ library support
368 ld_shlibs=no
370 esac
372 osf4* | osf5*)
373 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
374 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
375 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'
377 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
378 hardcode_libdir_separator=:
380 # Commands to make compiler produce verbose output that lists
381 # what "hidden" libraries, object files and flags are used when
382 # linking a shared library.
383 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
386 case "$cc_basename" in
387 KCC)
388 # Kuck and Associates, Inc. (KAI) C++ Compiler
390 # KCC will only create a shared library if the output file
391 # ends with ".so" (or ".sl" for HP-UX), so rename the library
392 # to its proper name (with version) after linking.
393 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'
395 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
396 hardcode_libdir_separator=:
398 # Archives containing C++ object files must be created using
399 # the KAI C++ compiler.
400 old_archive_cmds='$CC -o $oldlib $oldobjs'
402 RCC)
403 # Rational C++ 2.4.1
404 # FIXME: insert proper C++ library support
405 ld_shlibs=no
407 cxx)
408 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
409 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'
411 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
412 hardcode_libdir_separator=:
414 # Commands to make compiler produce verbose output that lists
415 # what "hidden" libraries, object files and flags are used when
416 # linking a shared library.
418 # There doesn't appear to be a way to prevent this compiler from
419 # explicitly linking system object files so we need to strip them
420 # from the output so that they don't get included in the library
421 # dependencies.
422 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'
425 # FIXME: insert proper C++ library support
426 ld_shlibs=no
428 esac
430 psos*)
431 # FIXME: insert proper C++ library support
432 ld_shlibs=no
434 sco*)
435 case "$cc_basename" in
437 # FIXME: insert proper C++ library support
438 ld_shlibs=no
441 # FIXME: insert proper C++ library support
442 ld_shlibs=no
444 esac
446 sunos4*)
447 case "$cc_basename" in
449 # Sun C++ 4.x
450 # FIXME: insert proper C++ library support
451 ld_shlibs=no
453 lcc)
454 # Lucid
455 # FIXME: insert proper C++ library support
456 ld_shlibs=no
459 # FIXME: insert proper C++ library support
460 ld_shlibs=no
462 esac
464 solaris*)
465 case "$cc_basename" in
467 # Sun C++ 4.2, 5.x and Centerline C++
468 no_undefined_flag=' -ztext'
469 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
470 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
471 $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'
473 hardcode_libdir_flag_spec='-R$libdir'
474 hardcode_shlibpath_var=no
475 case "$host_os" in
476 solaris2.[0-5] | solaris2.[0-5].*) ;;
478 # The C++ compiler is used as linker so we must use $wl
479 # flag to pass the commands to the underlying system
480 # linker.
481 # Supported since Solaris 2.6 (maybe 2.5.1?)
482 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
484 esac
485 link_all_deplibs=yes
487 # Commands to make compiler produce verbose output that lists
488 # what "hidden" libraries, object files and flags are used when
489 # linking a shared library.
491 # There doesn't appear to be a way to prevent this compiler from
492 # explicitly linking system object files so we need to strip them
493 # from the output so that they don't get included in the library
494 # dependencies.
495 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'
497 # Archives containing C++ object files must be created using
498 # "CC -xar", where "CC" is the Sun C++ compiler. This is
499 # necessary to make sure instantiated templates are included
500 # in the archive.
501 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
503 gcx)
504 # Green Hills C++ Compiler
505 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
507 # The C++ compiler must be used to create the archive.
508 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
511 # GNU C++ compiler with Solaris linker
512 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
513 if $CC --version | egrep -v '^2\.7' > /dev/null; then
514 archive_cmds='$LD -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
515 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
516 $LD -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
518 # Commands to make compiler produce verbose output that lists
519 # what "hidden" libraries, object files and flags are used when
520 # linking a shared library.
521 output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
522 else
523 # g++ 2.7 appears to require `-G' NOT `-shared' on this
524 # platform.
525 archive_cmds='$LD -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
526 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
527 $LD -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
529 # Commands to make compiler produce verbose output that lists
530 # what "hidden" libraries, object files and flags are used when
531 # linking a shared library.
532 output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
535 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
538 esac
540 tandem*)
541 case "$cc_basename" in
542 NCC)
543 # NonStop-UX NCC 3.20
544 # FIXME: insert proper C++ library support
545 ld_shlibs=no
548 # FIXME: insert proper C++ library support
549 ld_shlibs=no
551 esac
553 unixware*)
554 # FIXME: insert proper C++ library support
555 ld_shlibs=no
557 vxworks*)
558 # FIXME: insert proper C++ library support
559 ld_shlibs=no
562 # FIXME: insert proper C++ library support
563 ld_shlibs=no
565 esac
568 ## Compiler Characteristics: PIC flags, static flags, etc
570 # We don't use cached values here since only the C compiler
571 # characteristics should be cached.
572 ac_cv_prog_cc_pic=
573 ac_cv_prog_cc_shlib=
574 ac_cv_prog_cc_wl=
575 ac_cv_prog_cc_static=
576 ac_cv_prog_cc_no_builtin=
577 ac_cv_prog_cc_can_build_shared=$can_build_shared
579 ac_cv_prog_cc_pic_works=
580 ac_cv_prog_cc_static_works=
582 if test "$with_gcc" = yes; then
583 ac_cv_prog_cc_wl='-Wl,'
584 ac_cv_prog_cc_static='-static'
586 case "$host_os" in
587 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
588 # PIC is the default for these OSes.
590 aix*)
591 # Below there is a dirty hack to force normal static linking with -ldl
592 # The problem is because libdl dynamically linked with both libc and
593 # libC (AIX C++ library), which obviously doesn't included in libraries
594 # list by gcc. This cause undefined symbols with -static flags.
595 # This hack allows C programs to be linked with "-static -ldl", but
596 # we not sure about C++ programs.
597 ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
599 cygwin* | mingw* | os2*)
600 # This hack is so that the source file can tell whether it is being
601 # built for inclusion in a dll (and should export symbols for example).
602 ac_cv_prog_cc_pic='-DDLL_EXPORT'
604 amigaos*)
605 # FIXME: we need at least 68020 code to build shared libraries, but
606 # adding the `-m68020' flag to GCC prevents building anything better,
607 # like `-m68040'.
608 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
610 sysv4*MP*)
611 if test -d /usr/nec; then
612 ac_cv_prog_cc_pic=-Kconform_pic
616 ac_cv_prog_cc_pic='-fPIC'
618 esac
619 else
620 case "$host_os" in
621 aix4*)
622 # All AIX code is PIC.
624 chorus*)
625 case "$cc_basename" in
626 cxch68)
627 # Green Hills C++ Compiler
628 # 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"
630 esac
632 dgux*)
633 case "$cc_basename" in
634 ec++)
635 ac_cv_prog_cc_pic='-KPIC'
637 ghcx)
638 # Green Hills C++ Compiler
639 ac_cv_prog_cc_pic='-pic'
643 esac
645 freebsd*)
646 # FreeBSD uses GNU C++
648 hpux9* | hpux10* | hpux11*)
649 case "$cc_basename" in
651 ac_cv_prog_cc_wl='-Wl,'
652 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
653 ac_cv_prog_cc_pic='+Z'
655 aCC)
656 ac_cv_prog_cc_wl='-Wl,'
657 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
658 ac_cv_prog_cc_pic='+Z'
662 esac
664 irix5* | irix6*)
665 case "$cc_basename" in
667 ac_cv_prog_cc_wl='-Wl,'
668 ac_cv_prog_cc_static='-non_shared'
669 ac_cv_prog_cc_pic='-KPIC'
673 esac
675 linux*)
676 case "$cc_basename" in
677 KCC)
678 # KAI C++ Compiler
679 ac_cv_prog_cc_wl='--backend -Wl,'
680 ac_cv_prog_cc_pic='-fPIC'
682 cxx)
683 # Compaq C++
684 # Make sure the PIC flag is empty. It appears that all Alpha
685 # Linux and Compaq Tru64 Unix objects are PIC.
686 ac_cv_prog_cc_pic=
687 ac_cv_prog_cc_static='-non_shared'
691 esac
693 lynxos*)
695 m88k*)
697 mvs*)
698 case "$cc_basename" in
699 cxx)
700 ac_cv_prog_cc_pic='-W c,exportall'
704 esac
706 netbsd*)
708 osf3* | osf4* | osf5*)
709 case "$cc_basename" in
710 KCC)
711 ac_cv_prog_cc_wl='--backend -Wl,'
713 RCC)
714 # Rational C++ 2.4.1
715 ac_cv_prog_cc_pic='-pic'
717 cxx)
718 # Digital/Compaq C++
719 ac_cv_prog_cc_wl='-Wl,'
720 # Make sure the PIC flag is empty. It appears that all Alpha
721 # Linux and Compaq Tru64 Unix objects are PIC.
722 ac_cv_prog_cc_pic=
723 ac_cv_prog_cc_static='-non_shared'
727 esac
729 psos*)
731 sco*)
732 case "$cc_basename" in
734 ac_cv_prog_cc_pic='-fPIC'
738 esac
740 solaris*)
741 case "$cc_basename" in
743 # Sun C++ 4.2, 5.x and Centerline C++
744 ac_cv_prog_cc_pic='-KPIC'
745 ac_cv_prog_cc_static='-Bstatic'
746 ac_cv_prog_cc_wl='-Qoption ld '
748 gcx)
749 # Green Hills C++ Compiler
750 ac_cv_prog_cc_pic='-PIC'
754 esac
756 sunos4*)
757 case "$cc_basename" in
759 # Sun C++ 4.x
760 ac_cv_prog_cc_pic='-pic'
761 ac_cv_prog_cc_static='-Bstatic'
763 lcc)
764 # Lucid
765 ac_cv_prog_cc_pic='-pic'
769 esac
771 tandem*)
772 case "$cc_basename" in
773 NCC)
774 # NonStop-UX NCC 3.20
775 ac_cv_prog_cc_pic='-KPIC'
779 esac
781 unixware*)
783 vxworks*)
786 ac_cv_prog_cc_can_build_shared=no
788 esac
790 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
793 # Figure out "hidden" C++ library dependencies from verbose
794 # compiler output whening linking a shared library.
795 cat > conftest.$ac_ext <<EOF
796 class Foo
798 public:
799 Foo (void) { a = 0; }
800 private:
801 int a;
806 if (eval $ac_compile) 2>&5; then
807 # Parse the compiler output and extract the necessary
808 # objects, libraries and library flags.
810 # Sentinel used to keep track of whether or not we are before
811 # the conftest object file.
812 pre_test_object_deps_done=no
814 for p in `eval $output_verbose_link_cmds`; do
816 case $p in
818 -L* | -R* | -l*)
819 # Some compilers place space between "-{L,R}" and the path.
820 # Remove the space.
821 if test $p = "-L" \
822 || test $p = "-R"; then
823 prev=$p
824 continue
825 else
826 prev=
829 if test "$pre_test_object_deps_done" = no; then
830 case $p in
831 -L* | -R*)
832 # Internal compiler library paths should come after those
833 # provided the user. The postdeps already come after the
834 # user supplied libs so there is no need to process them.
835 if test -z "$compiler_lib_search_path"; then
836 compiler_lib_search_path="${prev}${p}"
837 else
838 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
841 # The "-l" case would never come before the object being
842 # linked, so don't bother handling this case.
843 esac
844 else
845 if test -z "$postdeps"; then
846 postdeps="${prev}${p}"
847 else
848 postdeps="${postdeps} ${prev}${p}"
853 *.$objext)
854 # This assumes that the test object file only shows up
855 # once in the compiler output.
856 if test "$p" = "conftest.$objext"; then
857 pre_test_object_deps_done=yes
858 continue
861 if test "$pre_test_object_deps_done" = no; then
862 if test -z "$predep_objects"; then
863 predep_objects="$p"
864 else
865 predep_objects="$predep_objects $p"
867 else
868 if test -z "$postdep_objects"; then
869 postdep_objects="$p"
870 else
871 postdep_objects="$postdep_objects $p"
876 *) ;; # Ignore the rest.
878 esac
879 done
881 # Clean up.
882 rm -f a.out
883 else
884 echo "ltcf-cxx.sh: error: problem compiling test program"
887 $rm -f confest.$objext
889 case " $postdeps " in
890 *" -lc "*) need_lc=no ;;
891 *) need_lc=yes ;;
892 esac