2001-01-03 Philip Blundell <pb@futuretv.com>
[binutils.git] / ltcf-cxx.sh
blobcefa0085624a6868760c38c6a04d7032a9e50a2b
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 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 aix4*)
138 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
139 # -bexpall does not export symbols beginning with underscore (_)
140 always_export_symbols=yes
141 # Exported symbols can be pulled into shared objects from archives
142 whole_archive_flag_spec=' '
143 build_libtool_need_lc=yes
145 chorus*)
146 case "$cc_basename" in
148 # FIXME: insert proper C++ library support
149 ld_shlibs=no
151 esac
153 dgux*)
154 case "$cc_basename" in
155 ec++)
156 # FIXME: insert proper C++ library support
157 ld_shlibs=no
159 ghcx)
160 # Green Hills C++ Compiler
161 # FIXME: insert proper C++ library support
162 ld_shlibs=no
165 # FIXME: insert proper C++ library support
166 ld_shlibs=no
168 esac
170 freebsd*)
171 # FreeBSD uses GNU C++ and GNU ld
172 # FIXME: insert proper C++ library support
173 ld_shlibs=no
175 hpux*)
176 case "$cc_basename" in
178 # FIXME: insert proper C++ library support
179 ld_shlibs=no
181 aCC)
182 case "$host_os" in
183 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' ;;
184 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
185 esac
186 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
187 hardcode_libdir_separator=:
188 hardcode_direct=yes
189 hardcode_minus_L=yes # Not in the search PATH, but as the default
190 # location of the library.
191 export_dynamic_flag_spec='${wl}-E'
193 # Commands to make compiler produce verbose output that lists
194 # what "hidden" libraries, object files and flags are used when
195 # linking a shared library.
197 # There doesn't appear to be a way to prevent this compiler from
198 # explicitly linking system object files so we need to strip them
199 # from the output so that they don't get included in the library
200 # dependencies.
201 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'
204 # FIXME: insert proper C++ library support
205 ld_shlibs=no
207 esac
209 irix5* | irix6*)
210 case "$cc_basename" in
212 # SGI C++
213 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'
215 # Archives containing C++ object files must be created using
216 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
217 # necessary to make sure instantiated templates are included
218 # in the archive.
219 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
222 if test "$with_gcc" = yes; then
223 if test "$with_gnu_ld" = no; then
224 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'
225 else
226 archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
229 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
230 hardcode_libdir_separator=:
231 link_all_deplibs=yes
233 esac
235 linux*)
236 case "$cc_basename" in
237 KCC)
238 # Kuck and Associates, Inc. (KAI) C++ Compiler
240 # KCC will only create a shared library if the output file
241 # ends with ".so" (or ".sl" for HP-UX), so rename the library
242 # to its proper name (with version) after linking.
243 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'
244 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'
246 # Commands to make compiler produce verbose output that lists
247 # what "hidden" libraries, object files and flags are used when
248 # linking a shared library.
250 # There doesn't appear to be a way to prevent this compiler from
251 # explicitly linking system object files so we need to strip them
252 # from the output so that they don't get included in the library
253 # dependencies.
254 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'
256 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
257 export_dynamic_flag_spec='${wl}--export-dynamic'
259 # Archives containing C++ object files must be created using
260 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
261 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
263 cxx)
264 # Compaq C++
265 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
266 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'
268 runpath_var=LD_RUN_PATH
269 hardcode_libdir_flag_spec='-rpath $libdir'
270 hardcode_libdir_separator=:
272 # Commands to make compiler produce verbose output that lists
273 # what "hidden" libraries, object files and flags are used when
274 # linking a shared library.
276 # There doesn't appear to be a way to prevent this compiler from
277 # explicitly linking system object files so we need to strip them
278 # from the output so that they don't get included in the library
279 # dependencies.
280 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'
282 esac
284 lynxos*)
285 # FIXME: insert proper C++ library support
286 ld_shlibs=no
288 m88k*)
289 # FIXME: insert proper C++ library support
290 ld_shlibs=no
292 mvs*)
293 case "$cc_basename" in
294 cxx)
295 # FIXME: insert proper C++ library support
296 ld_shlibs=no
299 # FIXME: insert proper C++ library support
300 ld_shlibs=no
302 esac
304 netbsd*)
305 # NetBSD uses g++ - do we need to do anything?
307 osf3*)
308 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
309 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
310 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'
312 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
313 hardcode_libdir_separator=:
315 # Commands to make compiler produce verbose output that lists
316 # what "hidden" libraries, object files and flags are used when
317 # linking a shared library.
318 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
321 case "$cc_basename" in
322 KCC)
323 # Kuck and Associates, Inc. (KAI) C++ Compiler
325 # KCC will only create a shared library if the output file
326 # ends with ".so" (or ".sl" for HP-UX), so rename the library
327 # to its proper name (with version) after linking.
328 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'
330 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
331 hardcode_libdir_separator=:
333 # Archives containing C++ object files must be created using
334 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
335 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
338 RCC)
339 # Rational C++ 2.4.1
340 # FIXME: insert proper C++ library support
341 ld_shlibs=no
343 cxx)
344 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
345 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'
347 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
348 hardcode_libdir_separator=:
350 # Commands to make compiler produce verbose output that lists
351 # what "hidden" libraries, object files and flags are used when
352 # linking a shared library.
354 # There doesn't appear to be a way to prevent this compiler from
355 # explicitly linking system object files so we need to strip them
356 # from the output so that they don't get included in the library
357 # dependencies.
358 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'
361 # FIXME: insert proper C++ library support
362 ld_shlibs=no
364 esac
366 osf4* | osf5*)
367 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
368 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
369 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'
371 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
372 hardcode_libdir_separator=:
374 # Commands to make compiler produce verbose output that lists
375 # what "hidden" libraries, object files and flags are used when
376 # linking a shared library.
377 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
380 case "$cc_basename" in
381 KCC)
382 # Kuck and Associates, Inc. (KAI) C++ Compiler
384 # KCC will only create a shared library if the output file
385 # ends with ".so" (or ".sl" for HP-UX), so rename the library
386 # to its proper name (with version) after linking.
387 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'
389 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
390 hardcode_libdir_separator=:
392 # Archives containing C++ object files must be created using
393 # the KAI C++ compiler.
394 old_archive_cmds='$CC -o $oldlib $oldobjs'
396 RCC)
397 # Rational C++ 2.4.1
398 # FIXME: insert proper C++ library support
399 ld_shlibs=no
401 cxx)
402 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
403 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'
405 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
406 hardcode_libdir_separator=:
408 # Commands to make compiler produce verbose output that lists
409 # what "hidden" libraries, object files and flags are used when
410 # linking a shared library.
412 # There doesn't appear to be a way to prevent this compiler from
413 # explicitly linking system object files so we need to strip them
414 # from the output so that they don't get included in the library
415 # dependencies.
416 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'
419 # FIXME: insert proper C++ library support
420 ld_shlibs=no
422 esac
424 psos*)
425 # FIXME: insert proper C++ library support
426 ld_shlibs=no
428 sco*)
429 case "$cc_basename" in
431 # FIXME: insert proper C++ library support
432 ld_shlibs=no
435 # FIXME: insert proper C++ library support
436 ld_shlibs=no
438 esac
440 sunos4*)
441 case "$cc_basename" in
443 # Sun C++ 4.x
444 # FIXME: insert proper C++ library support
445 ld_shlibs=no
447 lcc)
448 # Lucid
449 # FIXME: insert proper C++ library support
450 ld_shlibs=no
453 # FIXME: insert proper C++ library support
454 ld_shlibs=no
456 esac
458 solaris*)
459 case "$cc_basename" in
461 # Sun C++ 4.2, 5.x and Centerline C++
462 no_undefined_flag=' -ztext'
463 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
464 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
465 $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'
467 hardcode_libdir_flag_spec='-R$libdir'
468 hardcode_shlibpath_var=no
469 case "$host_os" in
470 solaris2.[0-5] | solaris2.[0-5].*) ;;
472 # The C++ compiler is used as linker so we must use $wl
473 # flag to pass the commands to the underlying system
474 # linker.
475 # Supported since Solaris 2.6 (maybe 2.5.1?)
476 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
478 esac
479 link_all_deplibs=yes
481 # Commands to make compiler produce verbose output that lists
482 # what "hidden" libraries, object files and flags are used when
483 # linking a shared library.
485 # There doesn't appear to be a way to prevent this compiler from
486 # explicitly linking system object files so we need to strip them
487 # from the output so that they don't get included in the library
488 # dependencies.
489 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'
491 # Archives containing C++ object files must be created using
492 # "CC -xar", where "CC" is the Sun C++ compiler. This is
493 # necessary to make sure instantiated templates are included
494 # in the archive.
495 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
497 gcx)
498 # Green Hills C++ Compiler
499 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
501 # The C++ compiler must be used to create the archive.
502 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
505 # GNU C++ compiler with Solaris linker
506 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
507 if $CC --version | egrep -v '^2\.7' > /dev/null; then
508 archive_cmds='$LD -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
509 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
510 $LD -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
512 # Commands to make compiler produce verbose output that lists
513 # what "hidden" libraries, object files and flags are used when
514 # linking a shared library.
515 output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
516 else
517 # g++ 2.7 appears to require `-G' NOT `-shared' on this
518 # platform.
519 archive_cmds='$LD -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
520 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
521 $LD -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
523 # Commands to make compiler produce verbose output that lists
524 # what "hidden" libraries, object files and flags are used when
525 # linking a shared library.
526 output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
529 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
532 esac
534 tandem*)
535 case "$cc_basename" in
536 NCC)
537 # NonStop-UX NCC 3.20
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 unixware*)
548 # FIXME: insert proper C++ library support
549 ld_shlibs=no
551 vxworks*)
552 # FIXME: insert proper C++ library support
553 ld_shlibs=no
556 # FIXME: insert proper C++ library support
557 ld_shlibs=no
559 esac
562 ## Compiler Characteristics: PIC flags, static flags, etc
564 # We don't use cached values here since only the C compiler
565 # characteristics should be cached.
566 ac_cv_prog_cc_pic=
567 ac_cv_prog_cc_shlib=
568 ac_cv_prog_cc_wl=
569 ac_cv_prog_cc_static=
570 ac_cv_prog_cc_no_builtin=
571 ac_cv_prog_cc_can_build_shared=$can_build_shared
573 # It is not enough to reset these cached values, they must be unset.
574 unset ac_cv_prog_cc_pic_works
575 unset ac_cv_prog_cc_static_works
577 if test "$with_gcc" = yes; then
578 ac_cv_prog_cc_wl='-Wl,'
579 ac_cv_prog_cc_static='-static'
581 case "$host_os" in
582 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
583 # PIC is the default for these OSes.
585 aix*)
586 # Below there is a dirty hack to force normal static linking with -ldl
587 # The problem is because libdl dynamically linked with both libc and
588 # libC (AIX C++ library), which obviously doesn't included in libraries
589 # list by gcc. This cause undefined symbols with -static flags.
590 # This hack allows C programs to be linked with "-static -ldl", but
591 # we not sure about C++ programs.
592 ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
594 cygwin* | mingw* | os2*)
595 # This hack is so that the source file can tell whether it is being
596 # built for inclusion in a dll (and should export symbols for example).
597 ac_cv_prog_cc_pic='-DDLL_EXPORT'
599 amigaos*)
600 # FIXME: we need at least 68020 code to build shared libraries, but
601 # adding the `-m68020' flag to GCC prevents building anything better,
602 # like `-m68040'.
603 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
605 sysv4*MP*)
606 if test -d /usr/nec; then
607 ac_cv_prog_cc_pic=-Kconform_pic
611 ac_cv_prog_cc_pic='-fPIC'
613 esac
614 else
615 case "$host_os" in
616 aix4*)
617 # All AIX code is PIC.
619 chorus*)
620 case "$cc_basename" in
621 cxch68)
622 # Green Hills C++ Compiler
623 # 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"
625 esac
627 dgux*)
628 case "$cc_basename" in
629 ec++)
630 ac_cv_prog_cc_pic='-KPIC'
632 ghcx)
633 # Green Hills C++ Compiler
634 ac_cv_prog_cc_pic='-pic'
638 esac
640 freebsd*)
641 # FreeBSD uses GNU C++
643 hpux9* | hpux10* | hpux11*)
644 case "$cc_basename" in
646 ac_cv_prog_cc_wl='-Wl,'
647 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
648 ac_cv_prog_cc_pic='+Z'
650 aCC)
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'
657 esac
659 irix5* | irix6*)
660 case "$cc_basename" in
662 ac_cv_prog_cc_wl='-Wl,'
663 ac_cv_prog_cc_static='-non_shared'
664 ac_cv_prog_cc_pic='-KPIC'
668 esac
670 linux*)
671 case "$cc_basename" in
672 KCC)
673 # KAI C++ Compiler
674 ac_cv_prog_cc_wl='--backend -Wl,'
675 ac_cv_prog_cc_pic='-fPIC'
677 cxx)
678 # Compaq C++
679 # Make sure the PIC flag is empty. It appears that all Alpha
680 # Linux and Compaq Tru64 Unix objects are PIC.
681 ac_cv_prog_cc_pic=
682 ac_cv_prog_cc_static='-non_shared'
686 esac
688 lynxos*)
690 m88k*)
692 mvs*)
693 case "$cc_basename" in
694 cxx)
695 ac_cv_prog_cc_pic='-W c,exportall'
699 esac
701 netbsd*)
703 osf3* | osf4* | osf5*)
704 case "$cc_basename" in
705 KCC)
706 ac_cv_prog_cc_wl='--backend -Wl,'
708 RCC)
709 # Rational C++ 2.4.1
710 ac_cv_prog_cc_pic='-pic'
712 cxx)
713 # Digital/Compaq C++
714 ac_cv_prog_cc_wl='-Wl,'
715 # Make sure the PIC flag is empty. It appears that all Alpha
716 # Linux and Compaq Tru64 Unix objects are PIC.
717 ac_cv_prog_cc_pic=
718 ac_cv_prog_cc_static='-non_shared'
722 esac
724 psos*)
726 sco*)
727 case "$cc_basename" in
729 ac_cv_prog_cc_pic='-fPIC'
733 esac
735 solaris*)
736 case "$cc_basename" in
738 # Sun C++ 4.2, 5.x and Centerline C++
739 ac_cv_prog_cc_pic='-KPIC'
740 ac_cv_prog_cc_static='-Bstatic'
741 ac_cv_prog_cc_wl='-Qoption ld '
743 gcx)
744 # Green Hills C++ Compiler
745 ac_cv_prog_cc_pic='-PIC'
749 esac
751 sunos4*)
752 case "$cc_basename" in
754 # Sun C++ 4.x
755 ac_cv_prog_cc_pic='-pic'
756 ac_cv_prog_cc_static='-Bstatic'
758 lcc)
759 # Lucid
760 ac_cv_prog_cc_pic='-pic'
764 esac
766 tandem*)
767 case "$cc_basename" in
768 NCC)
769 # NonStop-UX NCC 3.20
770 ac_cv_prog_cc_pic='-KPIC'
774 esac
776 unixware*)
778 vxworks*)
781 ac_cv_prog_cc_can_build_shared=no
783 esac
785 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
788 # Figure out "hidden" C++ library dependencies from verbose
789 # compiler output whening linking a shared library.
790 cat > conftest.$ac_ext <<EOF
791 class Foo
793 public:
794 Foo (void) { a = 0; }
795 private:
796 int a;
801 if eval $ac_compile 2>&5; then
802 # Parse the compiler output and extract the necessary
803 # objects, libraries and library flags.
805 # Sentinel used to keep track of whether or not we are before
806 # the conftest object file.
807 pre_test_object_deps_done=no
809 for p in `eval $output_verbose_link_cmds`; do
811 case $p in
813 -L* | -R* | -l*)
814 # Some compilers place space between "-{L,R}" and the path.
815 # Remove the space.
816 if test $p = "-L" \
817 || test $p = "-R"; then
818 prev=$p
819 continue
820 else
821 prev=
824 if test "$pre_test_object_deps_done" = no; then
825 case $p in
826 -L* | -R*)
827 # Internal compiler library paths should come after those
828 # provided the user. The postdeps already come after the
829 # user supplied libs so there is no need to process them.
830 if test -z "$compiler_lib_search_path"; then
831 compiler_lib_search_path="${prev}${p}"
832 else
833 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
836 # The "-l" case would never come before the object being
837 # linked, so don't bother handling this case.
838 esac
839 else
840 if test -z "$postdeps"; then
841 postdeps="${prev}${p}"
842 else
843 postdeps="${postdeps} ${prev}${p}"
848 *.$objext)
849 # This assumes that the test object file only shows up
850 # once in the compiler output.
851 if test "$p" = "conftest.$objext"; then
852 pre_test_object_deps_done=yes
853 continue
856 if test "$pre_test_object_deps_done" = no; then
857 if test -z "$predep_objects"; then
858 predep_objects="$p"
859 else
860 predep_objects="$predep_objects $p"
862 else
863 if test -z "$postdep_objects"; then
864 postdep_objects="$p"
865 else
866 postdep_objects="$postdep_objects $p"
871 *) ;; # Ignore the rest.
873 esac
874 done
876 # Clean up.
877 rm -f a.out
878 else
879 echo "ltcf-cxx.sh: error: problem compiling test program"
882 $rm -f confest.$objext
884 case " $postdeps " in
885 *" -lc "*) need_lc=no ;;
886 *) need_lc=yes ;;
887 esac