2000-12-21 Benjamin Kosnik <bkoz@redhat.com>
[official-gcc.git] / ltcf-cxx.sh
blobfbcf248faa7f5abb0f152d0d81d4d1ba9d031105
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 cygwin* | mingw* | os2*)
599 # This hack is so that the source file can tell whether it is being
600 # built for inclusion in a dll (and should export symbols for example).
601 ac_cv_prog_cc_pic='-DDLL_EXPORT'
603 amigaos*)
604 # FIXME: we need at least 68020 code to build shared libraries, but
605 # adding the `-m68020' flag to GCC prevents building anything better,
606 # like `-m68040'.
607 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
609 sysv4*MP*)
610 if test -d /usr/nec; then
611 ac_cv_prog_cc_pic=-Kconform_pic
615 ac_cv_prog_cc_pic='-fPIC'
617 esac
618 else
619 case "$host_os" in
620 aix4*)
621 # All AIX code is PIC.
623 chorus*)
624 case "$cc_basename" in
625 cxch68)
626 # Green Hills C++ Compiler
627 # 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"
629 esac
631 dgux*)
632 case "$cc_basename" in
633 ec++)
634 ac_cv_prog_cc_pic='-KPIC'
636 ghcx)
637 # Green Hills C++ Compiler
638 ac_cv_prog_cc_pic='-pic'
642 esac
644 freebsd*)
645 # FreeBSD uses GNU C++
647 hpux9* | hpux10* | hpux11*)
648 case "$cc_basename" in
650 ac_cv_prog_cc_wl='-Wl,'
651 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
652 ac_cv_prog_cc_pic='+Z'
654 aCC)
655 ac_cv_prog_cc_wl='-Wl,'
656 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
657 ac_cv_prog_cc_pic='+Z'
661 esac
663 irix5* | irix6*)
664 case "$cc_basename" in
666 ac_cv_prog_cc_wl='-Wl,'
667 ac_cv_prog_cc_static='-non_shared'
668 ac_cv_prog_cc_pic='-KPIC'
672 esac
674 linux*)
675 case "$cc_basename" in
676 KCC)
677 # KAI C++ Compiler
678 ac_cv_prog_cc_wl='--backend -Wl,'
679 ac_cv_prog_cc_pic='-fPIC'
681 cxx)
682 # Compaq C++
683 # Make sure the PIC flag is empty. It appears that all Alpha
684 # Linux and Compaq Tru64 Unix objects are PIC.
685 ac_cv_prog_cc_pic=
686 ac_cv_prog_cc_static='-non_shared'
690 esac
692 lynxos*)
694 m88k*)
696 mvs*)
697 case "$cc_basename" in
698 cxx)
699 ac_cv_prog_cc_pic='-W c,exportall'
703 esac
705 netbsd*)
707 osf3* | osf4* | osf5*)
708 case "$cc_basename" in
709 KCC)
710 ac_cv_prog_cc_wl='--backend -Wl,'
712 RCC)
713 # Rational C++ 2.4.1
714 ac_cv_prog_cc_pic='-pic'
716 cxx)
717 # Digital/Compaq C++
718 ac_cv_prog_cc_wl='-Wl,'
719 # Make sure the PIC flag is empty. It appears that all Alpha
720 # Linux and Compaq Tru64 Unix objects are PIC.
721 ac_cv_prog_cc_pic=
722 ac_cv_prog_cc_static='-non_shared'
726 esac
728 psos*)
730 sco*)
731 case "$cc_basename" in
733 ac_cv_prog_cc_pic='-fPIC'
737 esac
739 solaris*)
740 case "$cc_basename" in
742 # Sun C++ 4.2, 5.x and Centerline C++
743 ac_cv_prog_cc_pic='-KPIC'
744 ac_cv_prog_cc_static='-Bstatic'
745 ac_cv_prog_cc_wl='-Qoption ld '
747 gcx)
748 # Green Hills C++ Compiler
749 ac_cv_prog_cc_pic='-PIC'
753 esac
755 sunos4*)
756 case "$cc_basename" in
758 # Sun C++ 4.x
759 ac_cv_prog_cc_pic='-pic'
760 ac_cv_prog_cc_static='-Bstatic'
762 lcc)
763 # Lucid
764 ac_cv_prog_cc_pic='-pic'
768 esac
770 tandem*)
771 case "$cc_basename" in
772 NCC)
773 # NonStop-UX NCC 3.20
774 ac_cv_prog_cc_pic='-KPIC'
778 esac
780 unixware*)
782 vxworks*)
785 ac_cv_prog_cc_can_build_shared=no
787 esac
789 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
792 # Figure out "hidden" C++ library dependencies from verbose
793 # compiler output whening linking a shared library.
794 cat > conftest.$ac_ext <<EOF
795 class Foo
797 public:
798 Foo (void) { a = 0; }
799 private:
800 int a;
805 if eval $ac_compile 2>&5; then
806 # Parse the compiler output and extract the necessary
807 # objects, libraries and library flags.
809 # Sentinel used to keep track of whether or not we are before
810 # the conftest object file.
811 pre_test_object_deps_done=no
813 for p in `eval $output_verbose_link_cmds`; do
815 case $p in
817 -L* | -R* | -l*)
818 # Some compilers place space between "-{L,R}" and the path.
819 # Remove the space.
820 if test $p = "-L" \
821 || test $p = "-R"; then
822 prev=$p
823 continue
824 else
825 prev=
828 if test "$pre_test_object_deps_done" = no; then
829 case $p in
830 -L* | -R*)
831 # Internal compiler library paths should come after those
832 # provided the user. The postdeps already come after the
833 # user supplied libs so there is no need to process them.
834 if test -z "$compiler_lib_search_path"; then
835 compiler_lib_search_path="${prev}${p}"
836 else
837 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
840 # The "-l" case would never come before the object being
841 # linked, so don't bother handling this case.
842 esac
843 else
844 if test -z "$postdeps"; then
845 postdeps="${prev}${p}"
846 else
847 postdeps="${postdeps} ${prev}${p}"
852 *.$objext)
853 # This assumes that the test object file only shows up
854 # once in the compiler output.
855 if test "$p" = "conftest.$objext"; then
856 pre_test_object_deps_done=yes
857 continue
860 if test "$pre_test_object_deps_done" = no; then
861 if test -z "$predep_objects"; then
862 predep_objects="$p"
863 else
864 predep_objects="$predep_objects $p"
866 else
867 if test -z "$postdep_objects"; then
868 postdep_objects="$p"
869 else
870 postdep_objects="$postdep_objects $p"
875 *) ;; # Ignore the rest.
877 esac
878 done
880 # Clean up.
881 rm -f a.out
882 else
883 echo "ltcf-cxx.sh: error: problem compiling test program"
886 $rm -f confest.$objext
888 case " $postdeps " in
889 *" -lc "*) need_lc=no ;;
890 *) need_lc=yes ;;
891 esac