darwin-crt3.c: Avoid compilation when compiling for a kext multilib.
[official-gcc.git] / ltcf-cxx.sh
blobe264452dd6f853de31b4a0b64c05cf0ed48d12d1
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 darwin[1-6]*)
251 can_build_shared=no
253 darwin7*)
254 can_build_shared=yes
256 esac
257 output_verbose_link_cmd='echo'
259 archive_cmds='$CXX -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
260 module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
262 # Don't fix this by using the ld -exported_symbols_list flag,
263 # it doesn't exist in older darwin ld's
264 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}'
265 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}'
266 hardcode_direct=no
267 hardcode_automatic=yes
268 hardcode_shlibpath_var=unsupported
269 link_all_deplibs=yes
272 dgux*)
273 case $cc_basename in
274 ec++)
275 # FIXME: insert proper C++ library support
276 ld_shlibs=no
278 ghcx)
279 # Green Hills C++ Compiler
280 # FIXME: insert proper C++ library support
281 ld_shlibs=no
284 # FIXME: insert proper C++ library support
285 ld_shlibs=no
287 esac
289 freebsd[12]*)
290 # C++ shared libraries reported to be fairly broken before switch to ELF
291 ld_shlibs=no
293 freebsd* | kfreebsd*-gnu)
294 # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
295 # conventions
296 ld_shlibs=yes
298 gnu*)
300 hpux*)
301 if test $with_gnu_ld = no; then
302 case "$host_cpu" in
303 ia64*)
304 hardcode_libdir_flag_spec='-L$libdir'
305 hardcode_shlibpath_var=no ;;
307 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' ;;
308 esac
309 hardcode_direct=yes
310 hardcode_libdir_separator=:
311 export_dynamic_flag_spec='${wl}-E'
313 hardcode_minus_L=yes # Not in the search PATH, but as the default
314 # location of the library.
316 case $cc_basename in
318 # FIXME: insert proper C++ library support
319 ld_shlibs=no
321 aCC)
322 case $host_os in
323 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' ;;
324 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
325 esac
326 # Commands to make compiler produce verbose output that lists
327 # what "hidden" libraries, object files and flags are used when
328 # linking a shared library.
330 # There doesn't appear to be a way to prevent this compiler from
331 # explicitly linking system object files so we need to strip them
332 # from the output so that they don't get included in the library
333 # dependencies.
334 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'
337 if test $with_gcc = yes; then
338 if test $with_gnu_ld = no; then
339 case "$host_os" in
340 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' ;;
342 case "$host_cpu" in
343 ia64*)
344 archive_cmds='$LD -b +h $soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;;
346 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' ;;
347 esac
349 esac
351 else
352 # FIXME: insert proper C++ library support
353 ld_shlibs=no
356 esac
358 irix5* | irix6*)
359 case $cc_basename in
361 # SGI C++
362 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'
364 # Archives containing C++ object files must be created using
365 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
366 # necessary to make sure instantiated templates are included
367 # in the archive.
368 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
371 if test "$with_gcc" = yes; then
372 if test "$with_gnu_ld" = no; then
373 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'
374 else
375 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'
378 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
379 hardcode_libdir_separator=:
380 link_all_deplibs=yes
382 esac
384 linux*)
385 case $cc_basename in
386 KCC)
387 # Kuck and Associates, Inc. (KAI) C++ Compiler
389 # KCC will only create a shared library if the output file
390 # ends with ".so" (or ".sl" for HP-UX), so rename the library
391 # to its proper name (with version) after linking.
392 archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
393 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'
395 # Commands to make compiler produce verbose output that lists
396 # what "hidden" libraries, object files and flags are used when
397 # linking a shared library.
399 # There doesn't appear to be a way to prevent this compiler from
400 # explicitly linking system object files so we need to strip them
401 # from the output so that they don't get included in the library
402 # dependencies.
403 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'
405 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
406 export_dynamic_flag_spec='${wl}--export-dynamic'
408 # Archives containing C++ object files must be created using
409 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
410 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
412 cxx)
413 # Compaq C++
414 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
415 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'
417 runpath_var=LD_RUN_PATH
418 hardcode_libdir_flag_spec='-rpath $libdir'
419 hardcode_libdir_separator=:
421 # Commands to make compiler produce verbose output that lists
422 # what "hidden" libraries, object files and flags are used when
423 # linking a shared library.
425 # There doesn't appear to be a way to prevent this compiler from
426 # explicitly linking system object files so we need to strip them
427 # from the output so that they don't get included in the library
428 # dependencies.
429 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'
431 esac
433 lynxos*)
434 # FIXME: insert proper C++ library support
435 ld_shlibs=no
437 m88k*)
438 # FIXME: insert proper C++ library support
439 ld_shlibs=no
441 mvs*)
442 case $cc_basename in
443 cxx)
444 # FIXME: insert proper C++ library support
445 ld_shlibs=no
448 # FIXME: insert proper C++ library support
449 ld_shlibs=no
451 esac
453 netbsd* | knetbsd*-gnu)
454 # NetBSD uses g++ - do we need to do anything?
456 osf3*)
457 case $cc_basename in
458 KCC)
459 # Kuck and Associates, Inc. (KAI) C++ Compiler
461 # KCC will only create a shared library if the output file
462 # ends with ".so" (or ".sl" for HP-UX), so rename the library
463 # to its proper name (with version) after linking.
464 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'
466 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
467 hardcode_libdir_separator=:
469 # Archives containing C++ object files must be created using
470 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
471 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
474 RCC)
475 # Rational C++ 2.4.1
476 # FIXME: insert proper C++ library support
477 ld_shlibs=no
479 cxx)
480 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
481 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'
483 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
484 hardcode_libdir_separator=:
486 # Commands to make compiler produce verbose output that lists
487 # what "hidden" libraries, object files and flags are used when
488 # linking a shared library.
490 # There doesn't appear to be a way to prevent this compiler from
491 # explicitly linking system object files so we need to strip them
492 # from the output so that they don't get included in the library
493 # dependencies.
494 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'
497 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
498 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
499 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'
501 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
502 hardcode_libdir_separator=:
504 # Commands to make compiler produce verbose output that lists
505 # what "hidden" libraries, object files and flags are used when
506 # linking a shared library.
507 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
508 else
509 # FIXME: insert proper C++ library support
510 ld_shlibs=no
513 esac
515 osf4* | osf5*)
516 case $cc_basename in
517 KCC)
518 # Kuck and Associates, Inc. (KAI) C++ Compiler
520 # KCC will only create a shared library if the output file
521 # ends with ".so" (or ".sl" for HP-UX), so rename the library
522 # to its proper name (with version) after linking.
523 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'
525 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
526 hardcode_libdir_separator=:
528 # Archives containing C++ object files must be created using
529 # the KAI C++ compiler.
530 old_archive_cmds='$CC -o $oldlib $oldobjs'
532 RCC)
533 # Rational C++ 2.4.1
534 # FIXME: insert proper C++ library support
535 ld_shlibs=no
537 cxx)
538 allow_undefined_flag=' -expect_unresolved \*'
539 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'
540 archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~
541 echo "-hidden">> $lib.exp~
542 $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~
543 $rm $lib.exp'
545 hardcode_libdir_flag_spec='-rpath $libdir'
546 hardcode_libdir_separator=:
548 # Commands to make compiler produce verbose output that lists
549 # what "hidden" libraries, object files and flags are used when
550 # linking a shared library.
552 # There doesn't appear to be a way to prevent this compiler from
553 # explicitly linking system object files so we need to strip them
554 # from the output so that they don't get included in the library
555 # dependencies.
556 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'
559 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
560 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
561 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'
563 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
564 hardcode_libdir_separator=:
566 # Commands to make compiler produce verbose output that lists
567 # what "hidden" libraries, object files and flags are used when
568 # linking a shared library.
569 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
570 else
571 # FIXME: insert proper C++ library support
572 ld_shlibs=no
575 esac
577 psos*)
578 # FIXME: insert proper C++ library support
579 ld_shlibs=no
581 sco*)
582 case $cc_basename in
584 # FIXME: insert proper C++ library support
585 ld_shlibs=no
588 # FIXME: insert proper C++ library support
589 ld_shlibs=no
591 esac
593 sunos4*)
594 case $cc_basename in
596 # Sun C++ 4.x
597 # FIXME: insert proper C++ library support
598 ld_shlibs=no
600 lcc)
601 # Lucid
602 # FIXME: insert proper C++ library support
603 ld_shlibs=no
606 # FIXME: insert proper C++ library support
607 ld_shlibs=no
609 esac
611 solaris*)
612 case $cc_basename in
614 # Sun C++ 4.2, 5.x and Centerline C++
615 no_undefined_flag=' -zdefs'
616 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
617 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
618 $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'
620 hardcode_libdir_flag_spec='-R$libdir'
621 hardcode_shlibpath_var=no
622 case $host_os in
623 solaris2.[0-5] | solaris2.[0-5].*) ;;
625 # The C++ compiler is used as linker so we must use $wl
626 # flag to pass the commands to the underlying system
627 # linker.
628 # Supported since Solaris 2.6 (maybe 2.5.1?)
629 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
631 esac
632 link_all_deplibs=yes
634 # Commands to make compiler produce verbose output that lists
635 # what "hidden" libraries, object files and flags are used when
636 # linking a shared library.
638 # There doesn't appear to be a way to prevent this compiler from
639 # explicitly linking system object files so we need to strip them
640 # from the output so that they don't get included in the library
641 # dependencies.
642 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'
644 # Archives containing C++ object files must be created using
645 # "CC -xar", where "CC" is the Sun C++ compiler. This is
646 # necessary to make sure instantiated templates are included
647 # in the archive.
648 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
650 gcx)
651 # Green Hills C++ Compiler
652 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
654 # The C++ compiler must be used to create the archive.
655 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
658 # GNU C++ compiler with Solaris linker
659 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
660 no_undefined_flag=' ${wl}-z ${wl}defs'
661 if $CC --version | egrep -v '^2\.7' > /dev/null; then
662 archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
663 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
664 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
666 # Commands to make compiler produce verbose output that lists
667 # what "hidden" libraries, object files and flags are used when
668 # linking a shared library.
669 output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
670 else
671 # g++ 2.7 appears to require `-G' NOT `-shared' on this
672 # platform.
673 archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
674 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
675 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
677 # Commands to make compiler produce verbose output that lists
678 # what "hidden" libraries, object files and flags are used when
679 # linking a shared library.
680 output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
683 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
686 esac
688 tandem*)
689 case $cc_basename in
690 NCC)
691 # NonStop-UX NCC 3.20
692 # FIXME: insert proper C++ library support
693 ld_shlibs=no
696 # FIXME: insert proper C++ library support
697 ld_shlibs=no
699 esac
701 tpf*)
702 ld_shlibs=yes
704 unixware*)
705 # FIXME: insert proper C++ library support
706 ld_shlibs=no
708 vxworks*)
709 # FIXME: insert proper C++ library support
710 ld_shlibs=no
713 # FIXME: insert proper C++ library support
714 ld_shlibs=no
716 esac
719 ## Compiler Characteristics: PIC flags, static flags, etc
721 # We don't use cached values here since only the C compiler
722 # characteristics should be cached.
723 ac_cv_prog_cc_pic=
724 ac_cv_prog_cc_shlib=
725 ac_cv_prog_cc_wl=
726 ac_cv_prog_cc_static=
727 ac_cv_prog_cc_no_builtin=
728 ac_cv_prog_cc_can_build_shared=$can_build_shared
730 ac_cv_prog_cc_pic_works=
731 ac_cv_prog_cc_static_works=
733 if test "$with_gcc" = yes; then
734 ac_cv_prog_cc_wl='-Wl,'
735 ac_cv_prog_cc_static='-static'
737 case $host_os in
738 aix*)
739 # All AIX code is PIC.
740 if test "$host_cpu" = ia64; then
741 # AIX 5 now supports IA64 processor
742 lt_cv_prog_cc_static='-Bstatic'
743 else
744 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
747 amigaos*)
748 # FIXME: we need at least 68020 code to build shared libraries, but
749 # adding the `-m68020' flag to GCC prevents building anything better,
750 # like `-m68040'.
751 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
753 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
754 # PIC is the default for these OSes.
756 cygwin* | mingw* | os2*)
757 # This hack is so that the source file can tell whether it is being
758 # built for inclusion in a dll (and should export symbols for example).
759 ac_cv_prog_cc_pic='-DDLL_EXPORT'
761 darwin* | rhapsody*)
762 # PIC is the default on this platform
763 # Common symbols not allowed in MH_DYLIB files
764 ac_cv_prog_cc_pic='-fno-common'
766 *djgpp*)
767 # DJGPP does not support shared libraries at all
768 ac_cv_prog_cc_pic=
770 sysv4*MP*)
771 if test -d /usr/nec; then
772 ac_cv_prog_cc_pic=-Kconform_pic
776 ac_cv_prog_cc_pic='-fPIC'
778 esac
779 else
780 case $host_os in
781 aix4* | aix5*)
782 # All AIX code is PIC.
783 if test "$host_cpu" = ia64; then
784 # AIX 5 now supports IA64 processor
785 lt_cv_prog_cc_static='-Bstatic'
786 else
787 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
790 chorus*)
791 case $cc_basename in
792 cxch68)
793 # Green Hills C++ Compiler
794 # 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"
796 esac
798 dgux*)
799 case $cc_basename in
800 ec++)
801 ac_cv_prog_cc_pic='-KPIC'
803 ghcx)
804 # Green Hills C++ Compiler
805 ac_cv_prog_cc_pic='-pic'
809 esac
811 freebsd* | kfreebsd*-gnu)
812 # FreeBSD uses GNU C++
814 gnu*)
816 hpux9* | hpux10* | hpux11*)
817 case $cc_basename in
819 ac_cv_prog_cc_wl='-Wl,'
820 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
821 ac_cv_prog_cc_pic='+Z'
823 aCC)
824 ac_cv_prog_cc_wl='-Wl,'
825 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
826 ac_cv_prog_cc_pic='+Z'
830 esac
832 irix5* | irix6*)
833 case $cc_basename in
835 ac_cv_prog_cc_wl='-Wl,'
836 ac_cv_prog_cc_static='-non_shared'
837 ac_cv_prog_cc_pic='-KPIC'
841 esac
843 linux*)
844 case $cc_basename in
845 KCC)
846 # KAI C++ Compiler
847 ac_cv_prog_cc_wl='--backend -Wl,'
848 ac_cv_prog_cc_pic='-fPIC'
850 cxx)
851 # Compaq C++
852 # Make sure the PIC flag is empty. It appears that all Alpha
853 # Linux and Compaq Tru64 Unix objects are PIC.
854 ac_cv_prog_cc_pic=
855 ac_cv_prog_cc_static='-non_shared'
859 esac
861 lynxos*)
863 m88k*)
865 mvs*)
866 case $cc_basename in
867 cxx)
868 ac_cv_prog_cc_pic='-W c,exportall'
872 esac
874 netbsd*)
876 osf3* | osf4* | osf5*)
877 case $cc_basename in
878 KCC)
879 ac_cv_prog_cc_wl='--backend -Wl,'
881 RCC)
882 # Rational C++ 2.4.1
883 ac_cv_prog_cc_pic='-pic'
885 cxx)
886 # Digital/Compaq C++
887 ac_cv_prog_cc_wl='-Wl,'
888 # Make sure the PIC flag is empty. It appears that all Alpha
889 # Linux and Compaq Tru64 Unix objects are PIC.
890 ac_cv_prog_cc_pic=
891 ac_cv_prog_cc_static='-non_shared'
895 esac
897 psos*)
899 sco*)
900 case $cc_basename in
902 ac_cv_prog_cc_pic='-fPIC'
906 esac
908 solaris*)
909 case $cc_basename in
911 # Sun C++ 4.2, 5.x and Centerline C++
912 ac_cv_prog_cc_pic='-KPIC'
913 ac_cv_prog_cc_static='-Bstatic'
914 ac_cv_prog_cc_wl='-Qoption ld '
916 gcx)
917 # Green Hills C++ Compiler
918 ac_cv_prog_cc_pic='-PIC'
922 esac
924 sunos4*)
925 case $cc_basename in
927 # Sun C++ 4.x
928 ac_cv_prog_cc_pic='-pic'
929 ac_cv_prog_cc_static='-Bstatic'
931 lcc)
932 # Lucid
933 ac_cv_prog_cc_pic='-pic'
937 esac
939 tandem*)
940 case $cc_basename in
941 NCC)
942 # NonStop-UX NCC 3.20
943 ac_cv_prog_cc_pic='-KPIC'
947 esac
949 unixware*)
951 vxworks*)
954 ac_cv_prog_cc_can_build_shared=no
956 esac
959 case "$host_os" in
960 # Platforms which do not suport PIC and -DPIC is meaningless
961 # on them:
962 *djgpp*)
963 ac_cv_prog_cc_pic=
966 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
968 esac
971 # Figure out "hidden" C++ library dependencies from verbose
972 # compiler output whening linking a shared library.
973 cat > conftest.$ac_ext <<EOF
974 class Foo
976 public:
977 Foo (void) { a = 0; }
978 private:
979 int a;
984 if (eval $ac_compile) 2>&5; then
985 # Parse the compiler output and extract the necessary
986 # objects, libraries and library flags.
988 # Sentinel used to keep track of whether or not we are before
989 # the conftest object file.
990 pre_test_object_deps_done=no
992 for p in `eval $output_verbose_link_cmd`; do
994 case $p in
996 -L* | -R* | -l*)
997 # Some compilers place space between "-{L,R}" and the path.
998 # Remove the space.
999 if test $p = "-L" \
1000 || test $p = "-R"; then
1001 prev=$p
1002 continue
1003 else
1004 prev=
1007 if test "$pre_test_object_deps_done" = no; then
1008 case $p in
1009 -L* | -R*)
1010 # Internal compiler library paths should come after those
1011 # provided the user. The postdeps already come after the
1012 # user supplied libs so there is no need to process them.
1013 if test -z "$compiler_lib_search_path"; then
1014 compiler_lib_search_path="${prev}${p}"
1015 else
1016 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
1019 # The "-l" case would never come before the object being
1020 # linked, so don't bother handling this case.
1021 esac
1022 else
1023 if test -z "$postdeps"; then
1024 postdeps="${prev}${p}"
1025 else
1026 postdeps="${postdeps} ${prev}${p}"
1031 *.$objext)
1032 # This assumes that the test object file only shows up
1033 # once in the compiler output.
1034 if test "$p" = "conftest.$objext"; then
1035 pre_test_object_deps_done=yes
1036 continue
1039 if test "$pre_test_object_deps_done" = no; then
1040 if test -z "$predep_objects"; then
1041 predep_objects="$p"
1042 else
1043 predep_objects="$predep_objects $p"
1045 else
1046 if test -z "$postdep_objects"; then
1047 postdep_objects="$p"
1048 else
1049 postdep_objects="$postdep_objects $p"
1054 *) ;; # Ignore the rest.
1056 esac
1057 done
1059 # Clean up.
1060 rm -f a.out
1061 else
1062 echo "ltcf-cxx.sh: error: problem compiling test program"
1065 $rm -f confest.$objext
1067 case " $postdeps " in
1068 *" -lc "*) need_lc=no ;;
1069 *) need_lc=yes ;;
1070 esac