2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / ltcf-cxx.sh
blob2ecd53e5758b9325ecfbb5c86c26e9b5dbb8eb93
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'
257 archive_cmds='$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'
258 module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
260 # Don't fix this by using the ld -exported_symbols_list flag,
261 # it doesn't exist in older darwin ld's
262 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}'
263 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}'
264 hardcode_direct=no
265 hardcode_automatic=yes
266 hardcode_shlibpath_var=unsupported
267 whole_archive_flag_spec='-all_load $convenience'
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*)
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*)
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 unixware*)
701 # FIXME: insert proper C++ library support
702 ld_shlibs=no
704 vxworks*)
705 # FIXME: insert proper C++ library support
706 ld_shlibs=no
709 # FIXME: insert proper C++ library support
710 ld_shlibs=no
712 esac
715 ## Compiler Characteristics: PIC flags, static flags, etc
717 # We don't use cached values here since only the C compiler
718 # characteristics should be cached.
719 ac_cv_prog_cc_pic=
720 ac_cv_prog_cc_shlib=
721 ac_cv_prog_cc_wl=
722 ac_cv_prog_cc_static=
723 ac_cv_prog_cc_no_builtin=
724 ac_cv_prog_cc_can_build_shared=$can_build_shared
726 ac_cv_prog_cc_pic_works=
727 ac_cv_prog_cc_static_works=
729 if test "$with_gcc" = yes; then
730 ac_cv_prog_cc_wl='-Wl,'
731 ac_cv_prog_cc_static='-static'
733 case $host_os in
734 aix*)
735 # All AIX code is PIC.
736 if test "$host_cpu" = ia64; then
737 # AIX 5 now supports IA64 processor
738 lt_cv_prog_cc_static='-Bstatic'
739 else
740 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
743 amigaos*)
744 # FIXME: we need at least 68020 code to build shared libraries, but
745 # adding the `-m68020' flag to GCC prevents building anything better,
746 # like `-m68040'.
747 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
749 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
750 # PIC is the default for these OSes.
752 cygwin* | mingw* | os2*)
753 # This hack is so that the source file can tell whether it is being
754 # built for inclusion in a dll (and should export symbols for example).
755 ac_cv_prog_cc_pic='-DDLL_EXPORT'
757 darwin* | rhapsody*)
758 # PIC is the default on this platform
759 # Common symbols not allowed in MH_DYLIB files
760 ac_cv_prog_cc_pic='-fno-common'
762 *djgpp*)
763 # DJGPP does not support shared libraries at all
764 ac_cv_prog_cc_pic=
766 sysv4*MP*)
767 if test -d /usr/nec; then
768 ac_cv_prog_cc_pic=-Kconform_pic
772 ac_cv_prog_cc_pic='-fPIC'
774 esac
775 else
776 case $host_os in
777 aix4* | aix5*)
778 # All AIX code is PIC.
779 if test "$host_cpu" = ia64; then
780 # AIX 5 now supports IA64 processor
781 lt_cv_prog_cc_static='-Bstatic'
782 else
783 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
786 chorus*)
787 case $cc_basename in
788 cxch68)
789 # Green Hills C++ Compiler
790 # 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"
792 esac
794 dgux*)
795 case $cc_basename in
796 ec++)
797 ac_cv_prog_cc_pic='-KPIC'
799 ghcx)
800 # Green Hills C++ Compiler
801 ac_cv_prog_cc_pic='-pic'
805 esac
807 freebsd*)
808 # FreeBSD uses GNU C++
810 gnu*)
812 hpux9* | hpux10* | hpux11*)
813 case $cc_basename in
815 ac_cv_prog_cc_wl='-Wl,'
816 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
817 ac_cv_prog_cc_pic='+Z'
819 aCC)
820 ac_cv_prog_cc_wl='-Wl,'
821 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
822 ac_cv_prog_cc_pic='+Z'
826 esac
828 irix5* | irix6*)
829 case $cc_basename in
831 ac_cv_prog_cc_wl='-Wl,'
832 ac_cv_prog_cc_static='-non_shared'
833 ac_cv_prog_cc_pic='-KPIC'
837 esac
839 linux*)
840 case $cc_basename in
841 KCC)
842 # KAI C++ Compiler
843 ac_cv_prog_cc_wl='--backend -Wl,'
844 ac_cv_prog_cc_pic='-fPIC'
846 cxx)
847 # Compaq C++
848 # Make sure the PIC flag is empty. It appears that all Alpha
849 # Linux and Compaq Tru64 Unix objects are PIC.
850 ac_cv_prog_cc_pic=
851 ac_cv_prog_cc_static='-non_shared'
855 esac
857 lynxos*)
859 m88k*)
861 mvs*)
862 case $cc_basename in
863 cxx)
864 ac_cv_prog_cc_pic='-W c,exportall'
868 esac
870 netbsd*)
872 osf3* | osf4* | osf5*)
873 case $cc_basename in
874 KCC)
875 ac_cv_prog_cc_wl='--backend -Wl,'
877 RCC)
878 # Rational C++ 2.4.1
879 ac_cv_prog_cc_pic='-pic'
881 cxx)
882 # Digital/Compaq C++
883 ac_cv_prog_cc_wl='-Wl,'
884 # Make sure the PIC flag is empty. It appears that all Alpha
885 # Linux and Compaq Tru64 Unix objects are PIC.
886 ac_cv_prog_cc_pic=
887 ac_cv_prog_cc_static='-non_shared'
891 esac
893 psos*)
895 sco*)
896 case $cc_basename in
898 ac_cv_prog_cc_pic='-fPIC'
902 esac
904 solaris*)
905 case $cc_basename in
907 # Sun C++ 4.2, 5.x and Centerline C++
908 ac_cv_prog_cc_pic='-KPIC'
909 ac_cv_prog_cc_static='-Bstatic'
910 ac_cv_prog_cc_wl='-Qoption ld '
912 gcx)
913 # Green Hills C++ Compiler
914 ac_cv_prog_cc_pic='-PIC'
918 esac
920 sunos4*)
921 case $cc_basename in
923 # Sun C++ 4.x
924 ac_cv_prog_cc_pic='-pic'
925 ac_cv_prog_cc_static='-Bstatic'
927 lcc)
928 # Lucid
929 ac_cv_prog_cc_pic='-pic'
933 esac
935 tandem*)
936 case $cc_basename in
937 NCC)
938 # NonStop-UX NCC 3.20
939 ac_cv_prog_cc_pic='-KPIC'
943 esac
945 unixware*)
947 vxworks*)
950 ac_cv_prog_cc_can_build_shared=no
952 esac
955 case "$host_os" in
956 # Platforms which do not suport PIC and -DPIC is meaningless
957 # on them:
958 *djgpp*)
959 ac_cv_prog_cc_pic=
962 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
964 esac
967 # Figure out "hidden" C++ library dependencies from verbose
968 # compiler output whening linking a shared library.
969 cat > conftest.$ac_ext <<EOF
970 class Foo
972 public:
973 Foo (void) { a = 0; }
974 private:
975 int a;
980 if (eval $ac_compile) 2>&5; then
981 # Parse the compiler output and extract the necessary
982 # objects, libraries and library flags.
984 # Sentinel used to keep track of whether or not we are before
985 # the conftest object file.
986 pre_test_object_deps_done=no
988 for p in `eval $output_verbose_link_cmd`; do
990 case $p in
992 -L* | -R* | -l*)
993 # Some compilers place space between "-{L,R}" and the path.
994 # Remove the space.
995 if test $p = "-L" \
996 || test $p = "-R"; then
997 prev=$p
998 continue
999 else
1000 prev=
1003 if test "$pre_test_object_deps_done" = no; then
1004 case $p in
1005 -L* | -R*)
1006 # Internal compiler library paths should come after those
1007 # provided the user. The postdeps already come after the
1008 # user supplied libs so there is no need to process them.
1009 if test -z "$compiler_lib_search_path"; then
1010 compiler_lib_search_path="${prev}${p}"
1011 else
1012 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
1015 # The "-l" case would never come before the object being
1016 # linked, so don't bother handling this case.
1017 esac
1018 else
1019 if test -z "$postdeps"; then
1020 postdeps="${prev}${p}"
1021 else
1022 postdeps="${postdeps} ${prev}${p}"
1027 *.$objext)
1028 # This assumes that the test object file only shows up
1029 # once in the compiler output.
1030 if test "$p" = "conftest.$objext"; then
1031 pre_test_object_deps_done=yes
1032 continue
1035 if test "$pre_test_object_deps_done" = no; then
1036 if test -z "$predep_objects"; then
1037 predep_objects="$p"
1038 else
1039 predep_objects="$predep_objects $p"
1041 else
1042 if test -z "$postdep_objects"; then
1043 postdep_objects="$p"
1044 else
1045 postdep_objects="$postdep_objects $p"
1050 *) ;; # Ignore the rest.
1052 esac
1053 done
1055 # Clean up.
1056 rm -f a.out
1057 else
1058 echo "ltcf-cxx.sh: error: problem compiling test program"
1061 $rm -f confest.$objext
1063 case " $postdeps " in
1064 *" -lc "*) need_lc=no ;;
1065 *) need_lc=yes ;;
1066 esac