Declare block/closure byref variable at function scope.
[llvm-gcc-4.2.git] / ltcf-cxx.sh
blob7c9234be9cfaf6d0126da7b2bf520bc5701f9992
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 file_list_spec='${wl}-f,'
132 # When large executables or shared objects are built, AIX ld can
133 # have problems creating the table of contents. If linking a library
134 # or program results in "error TOC overflow" add -mminimal-toc to
135 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
136 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
137 if test "$with_gcc" = yes; then
138 case $host_os in aix4.[012]|aix4.[012].*)
139 # We only want to do this on AIX 4.2 and lower, the check
140 # below for broken collect2 doesn't work under 4.3+
141 collect2name=`${CC} -print-prog-name=collect2`
142 if test -f "$collect2name" && \
143 strings "$collect2name" | grep resolve_lib_name >/dev/null
144 then
145 # We have reworked collect2
146 hardcode_direct=yes
147 else
148 # We have old collect2
149 hardcode_direct=unsupported
150 # It fails to find uninstalled libraries when the uninstalled
151 # path is not listed in the libpath. Setting hardcode_minus_L
152 # to unsupported forces relinking
153 hardcode_minus_L=yes
154 hardcode_libdir_flag_spec='-L$libdir'
155 hardcode_libdir_separator=
157 esac
158 shared_flag='-shared'
159 else
160 # not using gcc
161 if test "$host_cpu" = ia64; then
162 shared_flag='${wl}-G'
163 else
164 shared_flag='${wl}-bM:SRE'
168 if test "$host_cpu" = ia64; then
169 # On IA64, the linker does run time linking by default, so we don't
170 # have to do anything special.
171 aix_use_runtimelinking=no
172 if test $with_gnu_ld = no; then
173 exp_sym_flag='-Bexport'
174 no_entry_flag=""
176 else
177 # Test if we are trying to use run time linking, or normal AIX style linking.
178 # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
179 aix_use_runtimelinking=no
180 for ld_flag in $LDFLAGS; do
181 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
182 aix_use_runtimelinking=yes
183 break
185 done
186 exp_sym_flag='-bexport'
187 no_entry_flag='-bnoentry'
189 # It seems that -bexpall does not export symbols beginning with
190 # underscore (_), so it is better to generate a list of symbols to export.
191 always_export_symbols=yes
192 if test "$aix_use_runtimelinking" = yes; then
193 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
194 allow_undefined_flag=' -Wl,-G'
195 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"
196 else
197 if test "$host_cpu" = ia64; then
198 if test $with_gnu_ld = no; then
199 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
200 allow_undefined_flag="-z nodefs"
201 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"
203 else
204 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
205 # Warning - without using the other run time loading flags, -berok will
206 # link without error, but may produce a broken library.
207 no_undefined_flag=' ${wl}-bnoerok'
208 allow_undefined_flag=' ${wl}-berok'
209 # -bexpall does not export symbols beginning with underscore (_)
210 always_export_symbols=yes
211 # Exported symbols can be pulled into shared objects from archives
212 whole_archive_flag_spec=' '
213 build_libtool_need_lc=yes
214 # This is similar to how AIX traditionally builds it's shared libraries.
215 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'
219 chorus*)
220 case $cc_basename in
222 # FIXME: insert proper C++ library support
223 ld_shlibs=no
225 esac
228 darwin* | rhapsody*)
229 case "$host_os" in
230 rhapsody* | darwin1.[[012]])
231 allow_undefined_flag='-undefined suppress'
233 *) # Darwin 1.3 on
234 if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
235 allow_undefined_flag='-flat_namespace -undefined suppress'
236 else
237 case ${MACOSX_DEPLOYMENT_TARGET} in
238 10.[[012]])
239 allow_undefined_flag='-flat_namespace -undefined suppress'
241 10.*)
242 allow_undefined_flag='-undefined dynamic_lookup'
244 esac
247 esac
248 # Disable shared library build on OS-X older than 10.3.
249 case $host_os in
250 # APPLE LOCAL darwin10
251 darwin[3-6]*)
252 can_build_shared=no
254 darwin7*)
255 can_build_shared=yes
257 esac
258 output_verbose_link_cmd='echo'
260 archive_cmds='$CXX -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
261 module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
263 # Don't fix this by using the ld -exported_symbols_list flag,
264 # it doesn't exist in older darwin ld's
265 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}'
266 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}'
267 hardcode_direct=no
268 hardcode_automatic=yes
269 hardcode_shlibpath_var=unsupported
270 link_all_deplibs=yes
273 dgux*)
274 case $cc_basename in
275 ec++)
276 # FIXME: insert proper C++ library support
277 ld_shlibs=no
279 ghcx)
280 # Green Hills C++ Compiler
281 # FIXME: insert proper C++ library support
282 ld_shlibs=no
285 # FIXME: insert proper C++ library support
286 ld_shlibs=no
288 esac
290 freebsd[12]*)
291 # C++ shared libraries reported to be fairly broken before switch to ELF
292 ld_shlibs=no
294 freebsd* | kfreebsd*-gnu)
295 # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
296 # conventions
297 ld_shlibs=yes
299 gnu*)
301 hpux*)
302 if test $with_gnu_ld = no; then
303 case "$host_cpu" in
304 ia64*)
305 hardcode_libdir_flag_spec='-L$libdir'
306 hardcode_shlibpath_var=no ;;
308 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' ;;
309 esac
310 hardcode_direct=yes
311 hardcode_libdir_separator=:
312 export_dynamic_flag_spec='${wl}-E'
314 hardcode_minus_L=yes # Not in the search PATH, but as the default
315 # location of the library.
317 case $cc_basename in
319 # FIXME: insert proper C++ library support
320 ld_shlibs=no
322 aCC)
323 case $host_os in
324 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' ;;
325 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
326 esac
327 # Commands to make compiler produce verbose output that lists
328 # what "hidden" libraries, object files and flags are used when
329 # linking a shared library.
331 # There doesn't appear to be a way to prevent this compiler from
332 # explicitly linking system object files so we need to strip them
333 # from the output so that they don't get included in the library
334 # dependencies.
335 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'
338 if test $with_gcc = yes; then
339 if test $with_gnu_ld = no; then
340 case "$host_os" in
341 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' ;;
343 case "$host_cpu" in
344 ia64*)
345 archive_cmds='$LD -b +h $soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;;
347 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' ;;
348 esac
350 esac
352 else
353 # FIXME: insert proper C++ library support
354 ld_shlibs=no
357 esac
359 irix5* | irix6*)
360 case $cc_basename in
362 # SGI C++
363 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'
365 # Archives containing C++ object files must be created using
366 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
367 # necessary to make sure instantiated templates are included
368 # in the archive.
369 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
372 if test "$with_gcc" = yes; then
373 if test "$with_gnu_ld" = no; then
374 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'
375 else
376 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'
379 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
380 hardcode_libdir_separator=:
381 link_all_deplibs=yes
383 esac
385 linux*)
386 case $cc_basename in
387 KCC)
388 # Kuck and Associates, Inc. (KAI) C++ Compiler
390 # KCC will only create a shared library if the output file
391 # ends with ".so" (or ".sl" for HP-UX), so rename the library
392 # to its proper name (with version) after linking.
393 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'
394 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'
396 # Commands to make compiler produce verbose output that lists
397 # what "hidden" libraries, object files and flags are used when
398 # linking a shared library.
400 # There doesn't appear to be a way to prevent this compiler from
401 # explicitly linking system object files so we need to strip them
402 # from the output so that they don't get included in the library
403 # dependencies.
404 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'
406 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
407 export_dynamic_flag_spec='${wl}--export-dynamic'
409 # Archives containing C++ object files must be created using
410 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
411 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
413 cxx)
414 # Compaq C++
415 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
416 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'
418 runpath_var=LD_RUN_PATH
419 hardcode_libdir_flag_spec='-rpath $libdir'
420 hardcode_libdir_separator=:
422 # Commands to make compiler produce verbose output that lists
423 # what "hidden" libraries, object files and flags are used when
424 # linking a shared library.
426 # There doesn't appear to be a way to prevent this compiler from
427 # explicitly linking system object files so we need to strip them
428 # from the output so that they don't get included in the library
429 # dependencies.
430 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'
432 esac
434 lynxos*)
435 # FIXME: insert proper C++ library support
436 ld_shlibs=no
438 m88k*)
439 # FIXME: insert proper C++ library support
440 ld_shlibs=no
442 mvs*)
443 case $cc_basename in
444 cxx)
445 # FIXME: insert proper C++ library support
446 ld_shlibs=no
449 # FIXME: insert proper C++ library support
450 ld_shlibs=no
452 esac
454 netbsd* | knetbsd*-gnu)
455 # NetBSD uses g++ - do we need to do anything?
457 osf3*)
458 case $cc_basename in
459 KCC)
460 # Kuck and Associates, Inc. (KAI) C++ Compiler
462 # KCC will only create a shared library if the output file
463 # ends with ".so" (or ".sl" for HP-UX), so rename the library
464 # to its proper name (with version) after linking.
465 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'
467 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
468 hardcode_libdir_separator=:
470 # Archives containing C++ object files must be created using
471 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
472 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
475 RCC)
476 # Rational C++ 2.4.1
477 # FIXME: insert proper C++ library support
478 ld_shlibs=no
480 cxx)
481 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
482 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'
484 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
485 hardcode_libdir_separator=:
487 # Commands to make compiler produce verbose output that lists
488 # what "hidden" libraries, object files and flags are used when
489 # linking a shared library.
491 # There doesn't appear to be a way to prevent this compiler from
492 # explicitly linking system object files so we need to strip them
493 # from the output so that they don't get included in the library
494 # dependencies.
495 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'
498 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
499 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
500 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'
502 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
503 hardcode_libdir_separator=:
505 # Commands to make compiler produce verbose output that lists
506 # what "hidden" libraries, object files and flags are used when
507 # linking a shared library.
508 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
509 else
510 # FIXME: insert proper C++ library support
511 ld_shlibs=no
514 esac
516 osf4* | osf5*)
517 case $cc_basename in
518 KCC)
519 # Kuck and Associates, Inc. (KAI) C++ Compiler
521 # KCC will only create a shared library if the output file
522 # ends with ".so" (or ".sl" for HP-UX), so rename the library
523 # to its proper name (with version) after linking.
524 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'
526 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
527 hardcode_libdir_separator=:
529 # Archives containing C++ object files must be created using
530 # the KAI C++ compiler.
531 old_archive_cmds='$CC -o $oldlib $oldobjs'
533 RCC)
534 # Rational C++ 2.4.1
535 # FIXME: insert proper C++ library support
536 ld_shlibs=no
538 cxx)
539 allow_undefined_flag=' -expect_unresolved \*'
540 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'
541 archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~
542 echo "-hidden">> $lib.exp~
543 $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~
544 $rm $lib.exp'
546 hardcode_libdir_flag_spec='-rpath $libdir'
547 hardcode_libdir_separator=:
549 # Commands to make compiler produce verbose output that lists
550 # what "hidden" libraries, object files and flags are used when
551 # linking a shared library.
553 # There doesn't appear to be a way to prevent this compiler from
554 # explicitly linking system object files so we need to strip them
555 # from the output so that they don't get included in the library
556 # dependencies.
557 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'
560 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
561 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
562 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'
564 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
565 hardcode_libdir_separator=:
567 # Commands to make compiler produce verbose output that lists
568 # what "hidden" libraries, object files and flags are used when
569 # linking a shared library.
570 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
571 else
572 # FIXME: insert proper C++ library support
573 ld_shlibs=no
576 esac
578 psos*)
579 # FIXME: insert proper C++ library support
580 ld_shlibs=no
582 sco*)
583 case $cc_basename in
585 # FIXME: insert proper C++ library support
586 ld_shlibs=no
589 # FIXME: insert proper C++ library support
590 ld_shlibs=no
592 esac
594 sunos4*)
595 case $cc_basename in
597 # Sun C++ 4.x
598 # FIXME: insert proper C++ library support
599 ld_shlibs=no
601 lcc)
602 # Lucid
603 # FIXME: insert proper C++ library support
604 ld_shlibs=no
607 # FIXME: insert proper C++ library support
608 ld_shlibs=no
610 esac
612 solaris*)
613 case $cc_basename in
615 # Sun C++ 4.2, 5.x and Centerline C++
616 no_undefined_flag=' -zdefs'
617 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
618 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
619 $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'
621 hardcode_libdir_flag_spec='-R$libdir'
622 hardcode_shlibpath_var=no
623 case $host_os in
624 solaris2.[0-5] | solaris2.[0-5].*) ;;
626 # The C++ compiler is used as linker so we must use $wl
627 # flag to pass the commands to the underlying system
628 # linker.
629 # Supported since Solaris 2.6 (maybe 2.5.1?)
630 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
632 esac
633 link_all_deplibs=yes
635 # Commands to make compiler produce verbose output that lists
636 # what "hidden" libraries, object files and flags are used when
637 # linking a shared library.
639 # There doesn't appear to be a way to prevent this compiler from
640 # explicitly linking system object files so we need to strip them
641 # from the output so that they don't get included in the library
642 # dependencies.
643 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'
645 # Archives containing C++ object files must be created using
646 # "CC -xar", where "CC" is the Sun C++ compiler. This is
647 # necessary to make sure instantiated templates are included
648 # in the archive.
649 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
651 gcx)
652 # Green Hills C++ Compiler
653 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
655 # The C++ compiler must be used to create the archive.
656 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
659 # GNU C++ compiler with Solaris linker
660 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
661 no_undefined_flag=' ${wl}-z ${wl}defs'
662 if $CC --version | egrep -v '^2\.7' > /dev/null; then
663 archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
664 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
665 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
667 # Commands to make compiler produce verbose output that lists
668 # what "hidden" libraries, object files and flags are used when
669 # linking a shared library.
670 output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
671 else
672 # g++ 2.7 appears to require `-G' NOT `-shared' on this
673 # platform.
674 archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
675 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
676 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
678 # Commands to make compiler produce verbose output that lists
679 # what "hidden" libraries, object files and flags are used when
680 # linking a shared library.
681 output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
684 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
687 esac
689 tandem*)
690 case $cc_basename in
691 NCC)
692 # NonStop-UX NCC 3.20
693 # FIXME: insert proper C++ library support
694 ld_shlibs=no
697 # FIXME: insert proper C++ library support
698 ld_shlibs=no
700 esac
702 tpf*)
703 ld_shlibs=yes
705 unixware*)
706 # FIXME: insert proper C++ library support
707 ld_shlibs=no
709 vxworks*)
710 # FIXME: insert proper C++ library support
711 ld_shlibs=no
714 # FIXME: insert proper C++ library support
715 ld_shlibs=no
717 esac
720 ## Compiler Characteristics: PIC flags, static flags, etc
722 # We don't use cached values here since only the C compiler
723 # characteristics should be cached.
724 ac_cv_prog_cc_pic=
725 ac_cv_prog_cc_shlib=
726 ac_cv_prog_cc_wl=
727 ac_cv_prog_cc_static=
728 ac_cv_prog_cc_no_builtin=
729 ac_cv_prog_cc_can_build_shared=$can_build_shared
731 ac_cv_prog_cc_pic_works=
732 ac_cv_prog_cc_static_works=
734 if test "$with_gcc" = yes; then
735 ac_cv_prog_cc_wl='-Wl,'
736 ac_cv_prog_cc_static='-static'
738 case $host_os in
739 aix*)
740 # All AIX code is PIC.
741 if test "$host_cpu" = ia64; then
742 # AIX 5 now supports IA64 processor
743 lt_cv_prog_cc_static='-Bstatic'
744 else
745 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
748 amigaos*)
749 # FIXME: we need at least 68020 code to build shared libraries, but
750 # adding the `-m68020' flag to GCC prevents building anything better,
751 # like `-m68040'.
752 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
754 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
755 # PIC is the default for these OSes.
757 cygwin* | mingw* | os2*)
758 # This hack is so that the source file can tell whether it is being
759 # built for inclusion in a dll (and should export symbols for example).
760 ac_cv_prog_cc_pic='-DDLL_EXPORT'
762 darwin* | rhapsody*)
763 # PIC is the default on this platform
764 # Common symbols not allowed in MH_DYLIB files
765 ac_cv_prog_cc_pic='-fno-common'
767 *djgpp*)
768 # DJGPP does not support shared libraries at all
769 ac_cv_prog_cc_pic=
771 sysv4*MP*)
772 if test -d /usr/nec; then
773 ac_cv_prog_cc_pic=-Kconform_pic
777 ac_cv_prog_cc_pic='-fPIC'
779 esac
780 else
781 case $host_os in
782 aix4* | aix5*)
783 # All AIX code is PIC.
784 if test "$host_cpu" = ia64; then
785 # AIX 5 now supports IA64 processor
786 lt_cv_prog_cc_static='-Bstatic'
787 else
788 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
791 chorus*)
792 case $cc_basename in
793 cxch68)
794 # Green Hills C++ Compiler
795 # 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"
797 esac
799 dgux*)
800 case $cc_basename in
801 ec++)
802 ac_cv_prog_cc_pic='-KPIC'
804 ghcx)
805 # Green Hills C++ Compiler
806 ac_cv_prog_cc_pic='-pic'
810 esac
812 freebsd* | kfreebsd*-gnu)
813 # FreeBSD uses GNU C++
815 gnu*)
817 hpux9* | hpux10* | hpux11*)
818 case $cc_basename in
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'
824 aCC)
825 ac_cv_prog_cc_wl='-Wl,'
826 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
827 ac_cv_prog_cc_pic='+Z'
831 esac
833 irix5* | irix6*)
834 case $cc_basename in
836 ac_cv_prog_cc_wl='-Wl,'
837 ac_cv_prog_cc_static='-non_shared'
838 ac_cv_prog_cc_pic='-KPIC'
842 esac
844 linux*)
845 case $cc_basename in
846 KCC)
847 # KAI C++ Compiler
848 ac_cv_prog_cc_wl='--backend -Wl,'
849 ac_cv_prog_cc_pic='-fPIC'
851 cxx)
852 # Compaq C++
853 # Make sure the PIC flag is empty. It appears that all Alpha
854 # Linux and Compaq Tru64 Unix objects are PIC.
855 ac_cv_prog_cc_pic=
856 ac_cv_prog_cc_static='-non_shared'
860 esac
862 lynxos*)
864 m88k*)
866 mvs*)
867 case $cc_basename in
868 cxx)
869 ac_cv_prog_cc_pic='-W c,exportall'
873 esac
875 netbsd*)
877 osf3* | osf4* | osf5*)
878 case $cc_basename in
879 KCC)
880 ac_cv_prog_cc_wl='--backend -Wl,'
882 RCC)
883 # Rational C++ 2.4.1
884 ac_cv_prog_cc_pic='-pic'
886 cxx)
887 # Digital/Compaq C++
888 ac_cv_prog_cc_wl='-Wl,'
889 # Make sure the PIC flag is empty. It appears that all Alpha
890 # Linux and Compaq Tru64 Unix objects are PIC.
891 ac_cv_prog_cc_pic=
892 ac_cv_prog_cc_static='-non_shared'
896 esac
898 psos*)
900 sco*)
901 case $cc_basename in
903 ac_cv_prog_cc_pic='-fPIC'
907 esac
909 solaris*)
910 case $cc_basename in
912 # Sun C++ 4.2, 5.x and Centerline C++
913 ac_cv_prog_cc_pic='-KPIC'
914 ac_cv_prog_cc_static='-Bstatic'
915 ac_cv_prog_cc_wl='-Qoption ld '
917 gcx)
918 # Green Hills C++ Compiler
919 ac_cv_prog_cc_pic='-PIC'
923 esac
925 sunos4*)
926 case $cc_basename in
928 # Sun C++ 4.x
929 ac_cv_prog_cc_pic='-pic'
930 ac_cv_prog_cc_static='-Bstatic'
932 lcc)
933 # Lucid
934 ac_cv_prog_cc_pic='-pic'
938 esac
940 tandem*)
941 case $cc_basename in
942 NCC)
943 # NonStop-UX NCC 3.20
944 ac_cv_prog_cc_pic='-KPIC'
948 esac
950 unixware*)
952 vxworks*)
955 ac_cv_prog_cc_can_build_shared=no
957 esac
960 case "$host_os" in
961 # Platforms which do not suport PIC and -DPIC is meaningless
962 # on them:
963 *djgpp*)
964 ac_cv_prog_cc_pic=
967 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
969 esac
972 # Figure out "hidden" C++ library dependencies from verbose
973 # compiler output whening linking a shared library.
974 cat > conftest.$ac_ext <<EOF
975 class Foo
977 public:
978 Foo (void) { a = 0; }
979 private:
980 int a;
985 if (eval $ac_compile) 2>&5; then
986 # Parse the compiler output and extract the necessary
987 # objects, libraries and library flags.
989 # Sentinel used to keep track of whether or not we are before
990 # the conftest object file.
991 pre_test_object_deps_done=no
993 for p in `eval $output_verbose_link_cmd`; do
995 case $p in
997 -L* | -R* | -l*)
998 # Some compilers place space between "-{L,R}" and the path.
999 # Remove the space.
1000 if test $p = "-L" \
1001 || test $p = "-R"; then
1002 prev=$p
1003 continue
1004 else
1005 prev=
1008 if test "$pre_test_object_deps_done" = no; then
1009 case $p in
1010 -L* | -R*)
1011 # Internal compiler library paths should come after those
1012 # provided the user. The postdeps already come after the
1013 # user supplied libs so there is no need to process them.
1014 if test -z "$compiler_lib_search_path"; then
1015 compiler_lib_search_path="${prev}${p}"
1016 else
1017 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
1020 # The "-l" case would never come before the object being
1021 # linked, so don't bother handling this case.
1022 esac
1023 else
1024 if test -z "$postdeps"; then
1025 postdeps="${prev}${p}"
1026 else
1027 postdeps="${postdeps} ${prev}${p}"
1032 *.$objext)
1033 # This assumes that the test object file only shows up
1034 # once in the compiler output.
1035 if test "$p" = "conftest.$objext"; then
1036 pre_test_object_deps_done=yes
1037 continue
1040 if test "$pre_test_object_deps_done" = no; then
1041 if test -z "$predep_objects"; then
1042 predep_objects="$p"
1043 else
1044 predep_objects="$predep_objects $p"
1046 else
1047 if test -z "$postdep_objects"; then
1048 postdep_objects="$p"
1049 else
1050 postdep_objects="$postdep_objects $p"
1055 *) ;; # Ignore the rest.
1057 esac
1058 done
1060 # Clean up.
1061 rm -f a.out
1062 else
1063 echo "ltcf-cxx.sh: error: problem compiling test program"
1066 $rm -f confest.$objext
1068 case " $postdeps " in
1069 *" -lc "*) need_lc=no ;;
1070 *) need_lc=yes ;;
1071 esac