PR middle-end/19583
[official-gcc.git] / ltcf-cxx.sh
blob48d5a53f2f7d9b919bc9bf01e8f17017330043bf
1 #### This script is meant to be sourced by ltconfig.
3 # ltcf-cxx.sh - Create a C++ compiler specific configuration
5 # Copyright (C) 1996-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # Original C++ support by:Gary V. Vaughan <gvv@techie.com>
9 # Alexandre Oliva <oliva@lsd.ic.unicamp.br>
10 # Ossama Othman <ossama@debian.org>
11 # Thomas Thanner <tanner@gmx.de>
13 # This file is free software; you can redistribute it and/or modify it
14 # under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 # General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 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. The
72 # assumption here is that the linker is going to be the same as that
73 # used by the C compiler. For the purposes of GCC, this is ok, but
74 # if someone uses g++ along with a non-GNU C compiler that doesn't
75 # use GNU ld, we may lose. This is ok for the toolchain tree, since
76 # the only users of ltcf-cxx.sh are libstdc++-v3 and libjava,
77 # anyway, and those use both gcc and g++, so the settings are bound
78 # to be the same.
80 if test "$with_gnu_ld" = yes; then
81 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
82 archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
84 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
85 export_dynamic_flag_spec='${wl}--export-dynamic'
87 # If archive_cmds runs LD, not CC, wlarc should be empty
88 # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
89 # investigate it a little bit more. (MM)
90 wlarc='${wl}'
92 # ancient GNU ld didn't support --whole-archive et. al.
93 if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
94 egrep 'no-whole-archive' > /dev/null; then
95 whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
96 else
97 whole_archive_flag_spec=
99 else
100 wlarc=
102 # A generic and very simple default shared library creation
103 # command for GNU C++ for the case where it uses the native
104 # linker, instead of GNU ld. If possible, this setting should
105 # overridden to take advantage of the native linker features on
106 # the platform it is being used on.
107 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
110 # Commands to make compiler produce verbose output that lists
111 # what "hidden" libraries, object files and flags are used when
112 # linking a shared library.
113 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
115 else
116 with_gcc=no
117 wlarc=
120 # PORTME: fill in a description of your system's C++ link characteristics
121 case $host_os in
122 aix3*)
123 # FIXME: insert proper C++ library support
124 ld_shlibs=no
126 aix4* | aix5*)
127 archive_cmds=''
128 hardcode_direct=yes
129 hardcode_libdir_separator=':'
130 link_all_deplibs=yes
131 # When large executables or shared objects are built, AIX ld can
132 # have problems creating the table of contents. If linking a library
133 # or program results in "error TOC overflow" add -mminimal-toc to
134 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
135 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
136 if test "$with_gcc" = yes; then
137 case $host_os in aix4.[012]|aix4.[012].*)
138 # We only want to do this on AIX 4.2 and lower, the check
139 # below for broken collect2 doesn't work under 4.3+
140 collect2name=`${CC} -print-prog-name=collect2`
141 if test -f "$collect2name" && \
142 strings "$collect2name" | grep resolve_lib_name >/dev/null
143 then
144 # We have reworked collect2
145 hardcode_direct=yes
146 else
147 # We have old collect2
148 hardcode_direct=unsupported
149 # It fails to find uninstalled libraries when the uninstalled
150 # path is not listed in the libpath. Setting hardcode_minus_L
151 # to unsupported forces relinking
152 hardcode_minus_L=yes
153 hardcode_libdir_flag_spec='-L$libdir'
154 hardcode_libdir_separator=
156 esac
157 shared_flag='-shared'
158 else
159 # not using gcc
160 if test "$host_cpu" = ia64; then
161 shared_flag='${wl}-G'
162 else
163 shared_flag='${wl}-bM:SRE'
167 if test "$host_cpu" = ia64; then
168 # On IA64, the linker does run time linking by default, so we don't
169 # have to do anything special.
170 aix_use_runtimelinking=no
171 if test $with_gnu_ld = no; then
172 exp_sym_flag='-Bexport'
173 no_entry_flag=""
175 else
176 # Test if we are trying to use run time linking, or normal AIX style linking.
177 # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
178 aix_use_runtimelinking=no
179 for ld_flag in $LDFLAGS; do
180 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
181 aix_use_runtimelinking=yes
182 break
184 done
185 exp_sym_flag='-bexport'
186 no_entry_flag='-bnoentry'
188 # It seems that -bexpall does not export symbols beginning with
189 # underscore (_), so it is better to generate a list of symbols to export.
190 always_export_symbols=yes
191 if test "$aix_use_runtimelinking" = yes; then
192 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
193 allow_undefined_flag=' -Wl,-G'
194 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}-brtl \${wl}$exp_sym_flag:\$export_symbols"
195 else
196 if test "$host_cpu" = ia64; then
197 if test $with_gnu_ld = no; then
198 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
199 allow_undefined_flag="-z nodefs"
200 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
202 else
203 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
204 # Warning - without using the other run time loading flags, -berok will
205 # link without error, but may produce a broken library.
206 no_undefined_flag=' ${wl}-bnoerok'
207 allow_undefined_flag=' ${wl}-berok'
208 # -bexpall does not export symbols beginning with underscore (_)
209 always_export_symbols=yes
210 # Exported symbols can be pulled into shared objects from archives
211 whole_archive_flag_spec=' '
212 build_libtool_need_lc=yes
213 # This is similar to how AIX traditionally builds it's shared libraries.
214 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
218 chorus*)
219 case $cc_basename in
221 # FIXME: insert proper C++ library support
222 ld_shlibs=no
224 esac
227 darwin* | rhapsody*)
228 case "$host_os" in
229 rhapsody* | darwin1.[[012]])
230 allow_undefined_flag='-undefined suppress'
232 *) # Darwin 1.3 on
233 if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
234 allow_undefined_flag='-flat_namespace -undefined suppress'
235 else
236 case ${MACOSX_DEPLOYMENT_TARGET} in
237 10.[[012]])
238 allow_undefined_flag='-flat_namespace -undefined suppress'
240 10.*)
241 allow_undefined_flag='-undefined dynamic_lookup'
243 esac
246 esac
247 # Disable shared library build on OS-X older than 10.3.
248 case $host_os in
249 darwin[1-6]*)
250 can_build_shared=no
252 darwin7*)
253 can_build_shared=yes
255 esac
256 output_verbose_link_cmd='echo'
258 archive_cmds='$CXX -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
259 module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
261 # Don't fix this by using the ld -exported_symbols_list flag,
262 # it doesn't exist in older darwin ld's
263 archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
264 module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
265 hardcode_direct=no
266 hardcode_automatic=yes
267 hardcode_shlibpath_var=unsupported
268 link_all_deplibs=yes
271 dgux*)
272 case $cc_basename in
273 ec++)
274 # FIXME: insert proper C++ library support
275 ld_shlibs=no
277 ghcx)
278 # Green Hills C++ Compiler
279 # FIXME: insert proper C++ library support
280 ld_shlibs=no
283 # FIXME: insert proper C++ library support
284 ld_shlibs=no
286 esac
288 freebsd[12]*)
289 # C++ shared libraries reported to be fairly broken before switch to ELF
290 ld_shlibs=no
292 freebsd* | kfreebsd*-gnu)
293 # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
294 # conventions
295 ld_shlibs=yes
297 gnu*)
299 hpux*)
300 if test $with_gnu_ld = no; then
301 case "$host_cpu" in
302 ia64*)
303 hardcode_libdir_flag_spec='-L$libdir'
304 hardcode_shlibpath_var=no ;;
306 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' ;;
307 esac
308 hardcode_direct=yes
309 hardcode_libdir_separator=:
310 export_dynamic_flag_spec='${wl}-E'
312 hardcode_minus_L=yes # Not in the search PATH, but as the default
313 # location of the library.
315 case $cc_basename in
317 # FIXME: insert proper C++ library support
318 ld_shlibs=no
320 aCC)
321 case $host_os in
322 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' ;;
323 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
324 esac
325 # Commands to make compiler produce verbose output that lists
326 # what "hidden" libraries, object files and flags are used when
327 # linking a shared library.
329 # There doesn't appear to be a way to prevent this compiler from
330 # explicitly linking system object files so we need to strip them
331 # from the output so that they don't get included in the library
332 # dependencies.
333 output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
336 if test $with_gcc = yes; then
337 if test $with_gnu_ld = no; then
338 case "$host_os" in
339 hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
341 case "$host_cpu" in
342 ia64*)
343 archive_cmds='$LD -b +h $soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;;
345 archive_cmds='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
346 esac
348 esac
350 else
351 # FIXME: insert proper C++ library support
352 ld_shlibs=no
355 esac
357 irix5* | irix6*)
358 case $cc_basename in
360 # SGI C++
361 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'
363 # Archives containing C++ object files must be created using
364 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
365 # necessary to make sure instantiated templates are included
366 # in the archive.
367 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
370 if test "$with_gcc" = yes; then
371 if test "$with_gnu_ld" = no; then
372 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
373 else
374 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
377 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
378 hardcode_libdir_separator=:
379 link_all_deplibs=yes
381 esac
383 linux*)
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'
392 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'
394 # Commands to make compiler produce verbose output that lists
395 # what "hidden" libraries, object files and flags are used when
396 # linking a shared library.
398 # There doesn't appear to be a way to prevent this compiler from
399 # explicitly linking system object files so we need to strip them
400 # from the output so that they don't get included in the library
401 # dependencies.
402 output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | egrep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
404 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
405 export_dynamic_flag_spec='${wl}--export-dynamic'
407 # Archives containing C++ object files must be created using
408 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
409 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
411 cxx)
412 # Compaq C++
413 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
414 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'
416 runpath_var=LD_RUN_PATH
417 hardcode_libdir_flag_spec='-rpath $libdir'
418 hardcode_libdir_separator=:
420 # Commands to make compiler produce verbose output that lists
421 # what "hidden" libraries, object files and flags are used when
422 # linking a shared library.
424 # There doesn't appear to be a way to prevent this compiler from
425 # explicitly linking system object files so we need to strip them
426 # from the output so that they don't get included in the library
427 # dependencies.
428 output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
430 esac
432 lynxos*)
433 # FIXME: insert proper C++ library support
434 ld_shlibs=no
436 m88k*)
437 # FIXME: insert proper C++ library support
438 ld_shlibs=no
440 mvs*)
441 case $cc_basename in
442 cxx)
443 # FIXME: insert proper C++ library support
444 ld_shlibs=no
447 # FIXME: insert proper C++ library support
448 ld_shlibs=no
450 esac
452 netbsd* | knetbsd*-gnu)
453 # NetBSD uses g++ - do we need to do anything?
455 osf3*)
456 case $cc_basename in
457 KCC)
458 # Kuck and Associates, Inc. (KAI) C++ Compiler
460 # KCC will only create a shared library if the output file
461 # ends with ".so" (or ".sl" for HP-UX), so rename the library
462 # to its proper name (with version) after linking.
463 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'
465 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
466 hardcode_libdir_separator=:
468 # Archives containing C++ object files must be created using
469 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
470 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
473 RCC)
474 # Rational C++ 2.4.1
475 # FIXME: insert proper C++ library support
476 ld_shlibs=no
478 cxx)
479 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
480 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'
482 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
483 hardcode_libdir_separator=:
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_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
496 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
497 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
498 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'
500 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
501 hardcode_libdir_separator=:
503 # Commands to make compiler produce verbose output that lists
504 # what "hidden" libraries, object files and flags are used when
505 # linking a shared library.
506 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
507 else
508 # FIXME: insert proper C++ library support
509 ld_shlibs=no
512 esac
514 osf4* | osf5*)
515 case $cc_basename in
516 KCC)
517 # Kuck and Associates, Inc. (KAI) C++ Compiler
519 # KCC will only create a shared library if the output file
520 # ends with ".so" (or ".sl" for HP-UX), so rename the library
521 # to its proper name (with version) after linking.
522 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'
524 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
525 hardcode_libdir_separator=:
527 # Archives containing C++ object files must be created using
528 # the KAI C++ compiler.
529 old_archive_cmds='$CC -o $oldlib $oldobjs'
531 RCC)
532 # Rational C++ 2.4.1
533 # FIXME: insert proper C++ library support
534 ld_shlibs=no
536 cxx)
537 allow_undefined_flag=' -expect_unresolved \*'
538 archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
539 archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~
540 echo "-hidden">> $lib.exp~
541 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~
542 $rm $lib.exp'
544 hardcode_libdir_flag_spec='-rpath $libdir'
545 hardcode_libdir_separator=:
547 # Commands to make compiler produce verbose output that lists
548 # what "hidden" libraries, object files and flags are used when
549 # linking a shared library.
551 # There doesn't appear to be a way to prevent this compiler from
552 # explicitly linking system object files so we need to strip them
553 # from the output so that they don't get included in the library
554 # dependencies.
555 output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
558 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
559 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
560 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'
562 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
563 hardcode_libdir_separator=:
565 # Commands to make compiler produce verbose output that lists
566 # what "hidden" libraries, object files and flags are used when
567 # linking a shared library.
568 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
569 else
570 # FIXME: insert proper C++ library support
571 ld_shlibs=no
574 esac
576 psos*)
577 # FIXME: insert proper C++ library support
578 ld_shlibs=no
580 sco*)
581 case $cc_basename in
583 # FIXME: insert proper C++ library support
584 ld_shlibs=no
587 # FIXME: insert proper C++ library support
588 ld_shlibs=no
590 esac
592 sunos4*)
593 case $cc_basename in
595 # Sun C++ 4.x
596 # FIXME: insert proper C++ library support
597 ld_shlibs=no
599 lcc)
600 # Lucid
601 # FIXME: insert proper C++ library support
602 ld_shlibs=no
605 # FIXME: insert proper C++ library support
606 ld_shlibs=no
608 esac
610 solaris*)
611 case $cc_basename in
613 # Sun C++ 4.2, 5.x and Centerline C++
614 no_undefined_flag=' -zdefs'
615 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
616 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
617 $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'
619 hardcode_libdir_flag_spec='-R$libdir'
620 hardcode_shlibpath_var=no
621 case $host_os in
622 solaris2.[0-5] | solaris2.[0-5].*) ;;
624 # The C++ compiler is used as linker so we must use $wl
625 # flag to pass the commands to the underlying system
626 # linker.
627 # Supported since Solaris 2.6 (maybe 2.5.1?)
628 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
630 esac
631 link_all_deplibs=yes
633 # Commands to make compiler produce verbose output that lists
634 # what "hidden" libraries, object files and flags are used when
635 # linking a shared library.
637 # There doesn't appear to be a way to prevent this compiler from
638 # explicitly linking system object files so we need to strip them
639 # from the output so that they don't get included in the library
640 # dependencies.
641 output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep "\-R|\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
643 # Archives containing C++ object files must be created using
644 # "CC -xar", where "CC" is the Sun C++ compiler. This is
645 # necessary to make sure instantiated templates are included
646 # in the archive.
647 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
649 gcx)
650 # Green Hills C++ Compiler
651 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
653 # The C++ compiler must be used to create the archive.
654 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
657 # GNU C++ compiler with Solaris linker
658 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
659 no_undefined_flag=' ${wl}-z ${wl}defs'
660 if $CC --version | egrep -v '^2\.7' > /dev/null; then
661 archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
662 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
663 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
665 # Commands to make compiler produce verbose output that lists
666 # what "hidden" libraries, object files and flags are used when
667 # linking a shared library.
668 output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
669 else
670 # g++ 2.7 appears to require `-G' NOT `-shared' on this
671 # platform.
672 archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
673 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
674 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
676 # Commands to make compiler produce verbose output that lists
677 # what "hidden" libraries, object files and flags are used when
678 # linking a shared library.
679 output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
682 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
685 esac
687 tandem*)
688 case $cc_basename in
689 NCC)
690 # NonStop-UX NCC 3.20
691 # FIXME: insert proper C++ library support
692 ld_shlibs=no
695 # FIXME: insert proper C++ library support
696 ld_shlibs=no
698 esac
700 tpf*)
701 ld_shlibs=yes
703 unixware*)
704 # FIXME: insert proper C++ library support
705 ld_shlibs=no
707 vxworks*)
708 # FIXME: insert proper C++ library support
709 ld_shlibs=no
712 # FIXME: insert proper C++ library support
713 ld_shlibs=no
715 esac
718 ## Compiler Characteristics: PIC flags, static flags, etc
720 # We don't use cached values here since only the C compiler
721 # characteristics should be cached.
722 ac_cv_prog_cc_pic=
723 ac_cv_prog_cc_shlib=
724 ac_cv_prog_cc_wl=
725 ac_cv_prog_cc_static=
726 ac_cv_prog_cc_no_builtin=
727 ac_cv_prog_cc_can_build_shared=$can_build_shared
729 ac_cv_prog_cc_pic_works=
730 ac_cv_prog_cc_static_works=
732 if test "$with_gcc" = yes; then
733 ac_cv_prog_cc_wl='-Wl,'
734 ac_cv_prog_cc_static='-static'
736 case $host_os in
737 aix*)
738 # All AIX code is PIC.
739 if test "$host_cpu" = ia64; then
740 # AIX 5 now supports IA64 processor
741 lt_cv_prog_cc_static='-Bstatic'
742 else
743 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
746 amigaos*)
747 # FIXME: we need at least 68020 code to build shared libraries, but
748 # adding the `-m68020' flag to GCC prevents building anything better,
749 # like `-m68040'.
750 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
752 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
753 # PIC is the default for these OSes.
755 cygwin* | mingw* | os2*)
756 # This hack is so that the source file can tell whether it is being
757 # built for inclusion in a dll (and should export symbols for example).
758 ac_cv_prog_cc_pic='-DDLL_EXPORT'
760 darwin* | rhapsody*)
761 # PIC is the default on this platform
762 # Common symbols not allowed in MH_DYLIB files
763 ac_cv_prog_cc_pic='-fno-common'
765 *djgpp*)
766 # DJGPP does not support shared libraries at all
767 ac_cv_prog_cc_pic=
769 sysv4*MP*)
770 if test -d /usr/nec; then
771 ac_cv_prog_cc_pic=-Kconform_pic
775 ac_cv_prog_cc_pic='-fPIC'
777 esac
778 else
779 case $host_os in
780 aix4* | aix5*)
781 # All AIX code is PIC.
782 if test "$host_cpu" = ia64; then
783 # AIX 5 now supports IA64 processor
784 lt_cv_prog_cc_static='-Bstatic'
785 else
786 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
789 chorus*)
790 case $cc_basename in
791 cxch68)
792 # Green Hills C++ Compiler
793 # 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"
795 esac
797 dgux*)
798 case $cc_basename in
799 ec++)
800 ac_cv_prog_cc_pic='-KPIC'
802 ghcx)
803 # Green Hills C++ Compiler
804 ac_cv_prog_cc_pic='-pic'
808 esac
810 freebsd* | kfreebsd*-gnu)
811 # FreeBSD uses GNU C++
813 gnu*)
815 hpux9* | hpux10* | hpux11*)
816 case $cc_basename in
818 ac_cv_prog_cc_wl='-Wl,'
819 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
820 ac_cv_prog_cc_pic='+Z'
822 aCC)
823 ac_cv_prog_cc_wl='-Wl,'
824 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
825 ac_cv_prog_cc_pic='+Z'
829 esac
831 irix5* | irix6*)
832 case $cc_basename in
834 ac_cv_prog_cc_wl='-Wl,'
835 ac_cv_prog_cc_static='-non_shared'
836 ac_cv_prog_cc_pic='-KPIC'
840 esac
842 linux*)
843 case $cc_basename in
844 KCC)
845 # KAI C++ Compiler
846 ac_cv_prog_cc_wl='--backend -Wl,'
847 ac_cv_prog_cc_pic='-fPIC'
849 cxx)
850 # Compaq C++
851 # Make sure the PIC flag is empty. It appears that all Alpha
852 # Linux and Compaq Tru64 Unix objects are PIC.
853 ac_cv_prog_cc_pic=
854 ac_cv_prog_cc_static='-non_shared'
858 esac
860 lynxos*)
862 m88k*)
864 mvs*)
865 case $cc_basename in
866 cxx)
867 ac_cv_prog_cc_pic='-W c,exportall'
871 esac
873 netbsd*)
875 osf3* | osf4* | osf5*)
876 case $cc_basename in
877 KCC)
878 ac_cv_prog_cc_wl='--backend -Wl,'
880 RCC)
881 # Rational C++ 2.4.1
882 ac_cv_prog_cc_pic='-pic'
884 cxx)
885 # Digital/Compaq C++
886 ac_cv_prog_cc_wl='-Wl,'
887 # Make sure the PIC flag is empty. It appears that all Alpha
888 # Linux and Compaq Tru64 Unix objects are PIC.
889 ac_cv_prog_cc_pic=
890 ac_cv_prog_cc_static='-non_shared'
894 esac
896 psos*)
898 sco*)
899 case $cc_basename in
901 ac_cv_prog_cc_pic='-fPIC'
905 esac
907 solaris*)
908 case $cc_basename in
910 # Sun C++ 4.2, 5.x and Centerline C++
911 ac_cv_prog_cc_pic='-KPIC'
912 ac_cv_prog_cc_static='-Bstatic'
913 ac_cv_prog_cc_wl='-Qoption ld '
915 gcx)
916 # Green Hills C++ Compiler
917 ac_cv_prog_cc_pic='-PIC'
921 esac
923 sunos4*)
924 case $cc_basename in
926 # Sun C++ 4.x
927 ac_cv_prog_cc_pic='-pic'
928 ac_cv_prog_cc_static='-Bstatic'
930 lcc)
931 # Lucid
932 ac_cv_prog_cc_pic='-pic'
936 esac
938 tandem*)
939 case $cc_basename in
940 NCC)
941 # NonStop-UX NCC 3.20
942 ac_cv_prog_cc_pic='-KPIC'
946 esac
948 unixware*)
950 vxworks*)
953 ac_cv_prog_cc_can_build_shared=no
955 esac
958 case "$host_os" in
959 # Platforms which do not suport PIC and -DPIC is meaningless
960 # on them:
961 *djgpp*)
962 ac_cv_prog_cc_pic=
965 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
967 esac
970 # Figure out "hidden" C++ library dependencies from verbose
971 # compiler output whening linking a shared library.
972 cat > conftest.$ac_ext <<EOF
973 class Foo
975 public:
976 Foo (void) { a = 0; }
977 private:
978 int a;
983 if (eval $ac_compile) 2>&5; then
984 # Parse the compiler output and extract the necessary
985 # objects, libraries and library flags.
987 # Sentinel used to keep track of whether or not we are before
988 # the conftest object file.
989 pre_test_object_deps_done=no
991 for p in `eval $output_verbose_link_cmd`; do
993 case $p in
995 -L* | -R* | -l*)
996 # Some compilers place space between "-{L,R}" and the path.
997 # Remove the space.
998 if test $p = "-L" \
999 || test $p = "-R"; then
1000 prev=$p
1001 continue
1002 else
1003 prev=
1006 if test "$pre_test_object_deps_done" = no; then
1007 case $p in
1008 -L* | -R*)
1009 # Internal compiler library paths should come after those
1010 # provided the user. The postdeps already come after the
1011 # user supplied libs so there is no need to process them.
1012 if test -z "$compiler_lib_search_path"; then
1013 compiler_lib_search_path="${prev}${p}"
1014 else
1015 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
1018 # The "-l" case would never come before the object being
1019 # linked, so don't bother handling this case.
1020 esac
1021 else
1022 if test -z "$postdeps"; then
1023 postdeps="${prev}${p}"
1024 else
1025 postdeps="${postdeps} ${prev}${p}"
1030 *.$objext)
1031 # This assumes that the test object file only shows up
1032 # once in the compiler output.
1033 if test "$p" = "conftest.$objext"; then
1034 pre_test_object_deps_done=yes
1035 continue
1038 if test "$pre_test_object_deps_done" = no; then
1039 if test -z "$predep_objects"; then
1040 predep_objects="$p"
1041 else
1042 predep_objects="$predep_objects $p"
1044 else
1045 if test -z "$postdep_objects"; then
1046 postdep_objects="$p"
1047 else
1048 postdep_objects="$postdep_objects $p"
1053 *) ;; # Ignore the rest.
1055 esac
1056 done
1058 # Clean up.
1059 rm -f a.out
1060 else
1061 echo "ltcf-cxx.sh: error: problem compiling test program"
1064 $rm -f confest.$objext
1066 case " $postdeps " in
1067 *" -lc "*) need_lc=no ;;
1068 *) need_lc=yes ;;
1069 esac