Fix ommision from previous ChangeLog entry.
[official-gcc.git] / ltcf-cxx.sh
blob9c7782f2791a91c0d76ca04d9a85413d9eb25938
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[12]*)
171 # C++ shared libraries reported to be fairly broken before switch to ELF
172 ld_shlibs=no
174 freebsd*)
175 # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
176 # conventions
177 ld_shlibs=yes
179 hpux*)
180 case "$cc_basename" in
182 # FIXME: insert proper C++ library support
183 ld_shlibs=no
185 aCC)
186 case "$host_os" in
187 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' ;;
188 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
189 esac
190 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
191 hardcode_libdir_separator=:
192 hardcode_direct=yes
193 hardcode_minus_L=yes # Not in the search PATH, but as the default
194 # location of the library.
195 export_dynamic_flag_spec='${wl}-E'
197 # Commands to make compiler produce verbose output that lists
198 # what "hidden" libraries, object files and flags are used when
199 # linking a shared library.
201 # There doesn't appear to be a way to prevent this compiler from
202 # explicitly linking system object files so we need to strip them
203 # from the output so that they don't get included in the library
204 # dependencies.
205 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'
208 # FIXME: insert proper C++ library support
209 ld_shlibs=no
211 esac
213 irix5* | irix6*)
214 case "$cc_basename" in
216 # SGI C++
217 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'
219 # Archives containing C++ object files must be created using
220 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
221 # necessary to make sure instantiated templates are included
222 # in the archive.
223 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
226 if test "$with_gcc" = yes; then
227 if test "$with_gnu_ld" = no; then
228 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'
229 else
230 archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
233 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
234 hardcode_libdir_separator=:
235 link_all_deplibs=yes
237 esac
239 linux*)
240 case "$cc_basename" in
241 KCC)
242 # Kuck and Associates, Inc. (KAI) C++ Compiler
244 # KCC will only create a shared library if the output file
245 # ends with ".so" (or ".sl" for HP-UX), so rename the library
246 # to its proper name (with version) after linking.
247 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'
248 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'
250 # Commands to make compiler produce verbose output that lists
251 # what "hidden" libraries, object files and flags are used when
252 # linking a shared library.
254 # There doesn't appear to be a way to prevent this compiler from
255 # explicitly linking system object files so we need to strip them
256 # from the output so that they don't get included in the library
257 # dependencies.
258 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'
260 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
261 export_dynamic_flag_spec='${wl}--export-dynamic'
263 # Archives containing C++ object files must be created using
264 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
265 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
267 cxx)
268 # Compaq C++
269 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
270 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'
272 runpath_var=LD_RUN_PATH
273 hardcode_libdir_flag_spec='-rpath $libdir'
274 hardcode_libdir_separator=:
276 # Commands to make compiler produce verbose output that lists
277 # what "hidden" libraries, object files and flags are used when
278 # linking a shared library.
280 # There doesn't appear to be a way to prevent this compiler from
281 # explicitly linking system object files so we need to strip them
282 # from the output so that they don't get included in the library
283 # dependencies.
284 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'
286 esac
288 lynxos*)
289 # FIXME: insert proper C++ library support
290 ld_shlibs=no
292 m88k*)
293 # FIXME: insert proper C++ library support
294 ld_shlibs=no
296 mvs*)
297 case "$cc_basename" in
298 cxx)
299 # FIXME: insert proper C++ library support
300 ld_shlibs=no
303 # FIXME: insert proper C++ library support
304 ld_shlibs=no
306 esac
308 netbsd*)
309 # NetBSD uses g++ - do we need to do anything?
311 osf3*)
312 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
313 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
314 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'
316 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
317 hardcode_libdir_separator=:
319 # Commands to make compiler produce verbose output that lists
320 # what "hidden" libraries, object files and flags are used when
321 # linking a shared library.
322 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
325 case "$cc_basename" in
326 KCC)
327 # Kuck and Associates, Inc. (KAI) C++ Compiler
329 # KCC will only create a shared library if the output file
330 # ends with ".so" (or ".sl" for HP-UX), so rename the library
331 # to its proper name (with version) after linking.
332 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'
334 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
335 hardcode_libdir_separator=:
337 # Archives containing C++ object files must be created using
338 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
339 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
342 RCC)
343 # Rational C++ 2.4.1
344 # FIXME: insert proper C++ library support
345 ld_shlibs=no
347 cxx)
348 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
349 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'
351 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
352 hardcode_libdir_separator=:
354 # Commands to make compiler produce verbose output that lists
355 # what "hidden" libraries, object files and flags are used when
356 # linking a shared library.
358 # There doesn't appear to be a way to prevent this compiler from
359 # explicitly linking system object files so we need to strip them
360 # from the output so that they don't get included in the library
361 # dependencies.
362 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'
365 # FIXME: insert proper C++ library support
366 ld_shlibs=no
368 esac
370 osf4* | osf5*)
371 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
372 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
373 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'
375 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
376 hardcode_libdir_separator=:
378 # Commands to make compiler produce verbose output that lists
379 # what "hidden" libraries, object files and flags are used when
380 # linking a shared library.
381 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
384 case "$cc_basename" in
385 KCC)
386 # Kuck and Associates, Inc. (KAI) C++ Compiler
388 # KCC will only create a shared library if the output file
389 # ends with ".so" (or ".sl" for HP-UX), so rename the library
390 # to its proper name (with version) after linking.
391 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'
393 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
394 hardcode_libdir_separator=:
396 # Archives containing C++ object files must be created using
397 # the KAI C++ compiler.
398 old_archive_cmds='$CC -o $oldlib $oldobjs'
400 RCC)
401 # Rational C++ 2.4.1
402 # FIXME: insert proper C++ library support
403 ld_shlibs=no
405 cxx)
406 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
407 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'
409 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
410 hardcode_libdir_separator=:
412 # Commands to make compiler produce verbose output that lists
413 # what "hidden" libraries, object files and flags are used when
414 # linking a shared library.
416 # There doesn't appear to be a way to prevent this compiler from
417 # explicitly linking system object files so we need to strip them
418 # from the output so that they don't get included in the library
419 # dependencies.
420 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'
423 # FIXME: insert proper C++ library support
424 ld_shlibs=no
426 esac
428 psos*)
429 # FIXME: insert proper C++ library support
430 ld_shlibs=no
432 sco*)
433 case "$cc_basename" in
435 # FIXME: insert proper C++ library support
436 ld_shlibs=no
439 # FIXME: insert proper C++ library support
440 ld_shlibs=no
442 esac
444 sunos4*)
445 case "$cc_basename" in
447 # Sun C++ 4.x
448 # FIXME: insert proper C++ library support
449 ld_shlibs=no
451 lcc)
452 # Lucid
453 # FIXME: insert proper C++ library support
454 ld_shlibs=no
457 # FIXME: insert proper C++ library support
458 ld_shlibs=no
460 esac
462 solaris*)
463 case "$cc_basename" in
465 # Sun C++ 4.2, 5.x and Centerline C++
466 no_undefined_flag=' -ztext'
467 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
468 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
469 $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'
471 hardcode_libdir_flag_spec='-R$libdir'
472 hardcode_shlibpath_var=no
473 case "$host_os" in
474 solaris2.[0-5] | solaris2.[0-5].*) ;;
476 # The C++ compiler is used as linker so we must use $wl
477 # flag to pass the commands to the underlying system
478 # linker.
479 # Supported since Solaris 2.6 (maybe 2.5.1?)
480 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
482 esac
483 link_all_deplibs=yes
485 # Commands to make compiler produce verbose output that lists
486 # what "hidden" libraries, object files and flags are used when
487 # linking a shared library.
489 # There doesn't appear to be a way to prevent this compiler from
490 # explicitly linking system object files so we need to strip them
491 # from the output so that they don't get included in the library
492 # dependencies.
493 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'
495 # Archives containing C++ object files must be created using
496 # "CC -xar", where "CC" is the Sun C++ compiler. This is
497 # necessary to make sure instantiated templates are included
498 # in the archive.
499 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
501 gcx)
502 # Green Hills C++ Compiler
503 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
505 # The C++ compiler must be used to create the archive.
506 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
509 # GNU C++ compiler with Solaris linker
510 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
511 if $CC --version | egrep -v '^2\.7' > /dev/null; then
512 archive_cmds='$LD -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
513 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
514 $LD -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
516 # Commands to make compiler produce verbose output that lists
517 # what "hidden" libraries, object files and flags are used when
518 # linking a shared library.
519 output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
520 else
521 # g++ 2.7 appears to require `-G' NOT `-shared' on this
522 # platform.
523 archive_cmds='$LD -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
524 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
525 $LD -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
527 # Commands to make compiler produce verbose output that lists
528 # what "hidden" libraries, object files and flags are used when
529 # linking a shared library.
530 output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
533 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
536 esac
538 tandem*)
539 case "$cc_basename" in
540 NCC)
541 # NonStop-UX NCC 3.20
542 # FIXME: insert proper C++ library support
543 ld_shlibs=no
546 # FIXME: insert proper C++ library support
547 ld_shlibs=no
549 esac
551 unixware*)
552 # FIXME: insert proper C++ library support
553 ld_shlibs=no
555 vxworks*)
556 # FIXME: insert proper C++ library support
557 ld_shlibs=no
560 # FIXME: insert proper C++ library support
561 ld_shlibs=no
563 esac
566 ## Compiler Characteristics: PIC flags, static flags, etc
568 # We don't use cached values here since only the C compiler
569 # characteristics should be cached.
570 ac_cv_prog_cc_pic=
571 ac_cv_prog_cc_shlib=
572 ac_cv_prog_cc_wl=
573 ac_cv_prog_cc_static=
574 ac_cv_prog_cc_no_builtin=
575 ac_cv_prog_cc_can_build_shared=$can_build_shared
577 # It is not enough to reset these cached values, they must be unset.
578 unset ac_cv_prog_cc_pic_works
579 unset ac_cv_prog_cc_static_works
581 if test "$with_gcc" = yes; then
582 ac_cv_prog_cc_wl='-Wl,'
583 ac_cv_prog_cc_static='-static'
585 case "$host_os" in
586 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
587 # PIC is the default for these OSes.
589 aix*)
590 # Below there is a dirty hack to force normal static linking with -ldl
591 # The problem is because libdl dynamically linked with both libc and
592 # libC (AIX C++ library), which obviously doesn't included in libraries
593 # list by gcc. This cause undefined symbols with -static flags.
594 # This hack allows C programs to be linked with "-static -ldl", but
595 # we not sure about C++ programs.
596 ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
598 *djgpp*)
599 # DJGPP does not support shared libraries at all
600 ac_cv_prog_cc_pic=
602 cygwin* | mingw* | os2*)
603 # This hack is so that the source file can tell whether it is being
604 # built for inclusion in a dll (and should export symbols for example).
605 ac_cv_prog_cc_pic='-DDLL_EXPORT'
607 amigaos*)
608 # FIXME: we need at least 68020 code to build shared libraries, but
609 # adding the `-m68020' flag to GCC prevents building anything better,
610 # like `-m68040'.
611 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
613 sysv4*MP*)
614 if test -d /usr/nec; then
615 ac_cv_prog_cc_pic=-Kconform_pic
619 ac_cv_prog_cc_pic='-fPIC'
621 esac
622 else
623 case "$host_os" in
624 aix4*)
625 # All AIX code is PIC.
627 chorus*)
628 case "$cc_basename" in
629 cxch68)
630 # Green Hills C++ Compiler
631 # 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"
633 esac
635 dgux*)
636 case "$cc_basename" in
637 ec++)
638 ac_cv_prog_cc_pic='-KPIC'
640 ghcx)
641 # Green Hills C++ Compiler
642 ac_cv_prog_cc_pic='-pic'
646 esac
648 freebsd*)
649 # FreeBSD uses GNU C++
651 hpux9* | hpux10* | hpux11*)
652 case "$cc_basename" in
654 ac_cv_prog_cc_wl='-Wl,'
655 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
656 ac_cv_prog_cc_pic='+Z'
658 aCC)
659 ac_cv_prog_cc_wl='-Wl,'
660 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
661 ac_cv_prog_cc_pic='+Z'
665 esac
667 irix5* | irix6*)
668 case "$cc_basename" in
670 ac_cv_prog_cc_wl='-Wl,'
671 ac_cv_prog_cc_static='-non_shared'
672 ac_cv_prog_cc_pic='-KPIC'
676 esac
678 linux*)
679 case "$cc_basename" in
680 KCC)
681 # KAI C++ Compiler
682 ac_cv_prog_cc_wl='--backend -Wl,'
683 ac_cv_prog_cc_pic='-fPIC'
685 cxx)
686 # Compaq C++
687 # Make sure the PIC flag is empty. It appears that all Alpha
688 # Linux and Compaq Tru64 Unix objects are PIC.
689 ac_cv_prog_cc_pic=
690 ac_cv_prog_cc_static='-non_shared'
694 esac
696 lynxos*)
698 m88k*)
700 mvs*)
701 case "$cc_basename" in
702 cxx)
703 ac_cv_prog_cc_pic='-W c,exportall'
707 esac
709 netbsd*)
711 osf3* | osf4* | osf5*)
712 case "$cc_basename" in
713 KCC)
714 ac_cv_prog_cc_wl='--backend -Wl,'
716 RCC)
717 # Rational C++ 2.4.1
718 ac_cv_prog_cc_pic='-pic'
720 cxx)
721 # Digital/Compaq C++
722 ac_cv_prog_cc_wl='-Wl,'
723 # Make sure the PIC flag is empty. It appears that all Alpha
724 # Linux and Compaq Tru64 Unix objects are PIC.
725 ac_cv_prog_cc_pic=
726 ac_cv_prog_cc_static='-non_shared'
730 esac
732 psos*)
734 sco*)
735 case "$cc_basename" in
737 ac_cv_prog_cc_pic='-fPIC'
741 esac
743 solaris*)
744 case "$cc_basename" in
746 # Sun C++ 4.2, 5.x and Centerline C++
747 ac_cv_prog_cc_pic='-KPIC'
748 ac_cv_prog_cc_static='-Bstatic'
749 ac_cv_prog_cc_wl='-Qoption ld '
751 gcx)
752 # Green Hills C++ Compiler
753 ac_cv_prog_cc_pic='-PIC'
757 esac
759 sunos4*)
760 case "$cc_basename" in
762 # Sun C++ 4.x
763 ac_cv_prog_cc_pic='-pic'
764 ac_cv_prog_cc_static='-Bstatic'
766 lcc)
767 # Lucid
768 ac_cv_prog_cc_pic='-pic'
772 esac
774 tandem*)
775 case "$cc_basename" in
776 NCC)
777 # NonStop-UX NCC 3.20
778 ac_cv_prog_cc_pic='-KPIC'
782 esac
784 unixware*)
786 vxworks*)
789 ac_cv_prog_cc_can_build_shared=no
791 esac
794 case "$host_os" in
795 # Platforms which do not suport PIC and -DPIC is meaningless
796 # on them:
797 *djgpp*)
798 ac_cv_prog_cc_pic=
801 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
803 esac
806 # Figure out "hidden" C++ library dependencies from verbose
807 # compiler output whening linking a shared library.
808 cat > conftest.$ac_ext <<EOF
809 class Foo
811 public:
812 Foo (void) { a = 0; }
813 private:
814 int a;
819 if eval $ac_compile 2>&5; then
820 # Parse the compiler output and extract the necessary
821 # objects, libraries and library flags.
823 # Sentinel used to keep track of whether or not we are before
824 # the conftest object file.
825 pre_test_object_deps_done=no
827 for p in `eval $output_verbose_link_cmds`; do
829 case $p in
831 -L* | -R* | -l*)
832 # Some compilers place space between "-{L,R}" and the path.
833 # Remove the space.
834 if test $p = "-L" \
835 || test $p = "-R"; then
836 prev=$p
837 continue
838 else
839 prev=
842 if test "$pre_test_object_deps_done" = no; then
843 case $p in
844 -L* | -R*)
845 # Internal compiler library paths should come after those
846 # provided the user. The postdeps already come after the
847 # user supplied libs so there is no need to process them.
848 if test -z "$compiler_lib_search_path"; then
849 compiler_lib_search_path="${prev}${p}"
850 else
851 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
854 # The "-l" case would never come before the object being
855 # linked, so don't bother handling this case.
856 esac
857 else
858 if test -z "$postdeps"; then
859 postdeps="${prev}${p}"
860 else
861 postdeps="${postdeps} ${prev}${p}"
866 *.$objext)
867 # This assumes that the test object file only shows up
868 # once in the compiler output.
869 if test "$p" = "conftest.$objext"; then
870 pre_test_object_deps_done=yes
871 continue
874 if test "$pre_test_object_deps_done" = no; then
875 if test -z "$predep_objects"; then
876 predep_objects="$p"
877 else
878 predep_objects="$predep_objects $p"
880 else
881 if test -z "$postdep_objects"; then
882 postdep_objects="$p"
883 else
884 postdep_objects="$postdep_objects $p"
889 *) ;; # Ignore the rest.
891 esac
892 done
894 # Clean up.
895 rm -f a.out
896 else
897 echo "ltcf-cxx.sh: error: problem compiling test program"
900 $rm -f confest.$objext
902 case " $postdeps " in
903 *" -lc "*) need_lc=no ;;
904 *) need_lc=yes ;;
905 esac