* combine.c (try_combine): Use memcpy, not bcopy.
[official-gcc.git] / ltcf-cxx.sh
blobc399d34c9dc254696b8a391c862891299a34f870
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 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # Original C++ support by:Gary V. Vaughan <gvv@techie.com>
9 # Alexandre Oliva <oliva@lsd.ic.unicamp.br>
10 # Ossama Othman <ossama@debian.org>
11 # Thomas Thanner <tanner@gmx.de>
13 # This file is free software; you can redistribute it and/or modify it
14 # under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 # General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 # As a special exception to the GNU General Public License, if you
28 # distribute this file as part of a program that contains a
29 # configuration script generated by Autoconf, you may include it under
30 # the same distribution terms that you use for the rest of that program.
33 # Source file extension for C++ test sources.
34 ac_ext=cc
36 # Object file extension for compiled C++ test sources.
37 objext=o
39 # Code to be used in simple compile tests
40 lt_simple_compile_test_code="int some_variable = 0;"
42 # Code to be used in simple link tests
43 lt_simple_link_test_code='int main(int, char *[]) { return (0); }'
45 # C++ compiler
46 CXX=${CXX-c++}
48 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
49 CC=${CC-"$CXX"}
50 CFLAGS=${CFLAGS-"$CXXFLAGS"}
52 # Allow CC to be a program name with arguments.
53 set dummy $CC
54 compiler=$2
55 cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
57 # Check if we are using GNU gcc (taken/adapted from configure script)
58 # We need to check here since "--with-gcc" is set at configure time,
59 # not ltconfig time!
60 cat > conftest.$ac_ext <<EOF
61 #ifdef __GNUC__
62 yes;
63 #endif
64 EOF
65 if { ac_try='${CC-c++} -E conftest.$ac_ext'; { (eval echo \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
66 with_gcc=yes
68 # Set up default GNU C++ configuration
70 # Check if GNU C++ uses GNU ld as the underlying linker, since the
71 # archiving commands below assume that GNU ld is being used.
72 if eval "`$CC -print-prog-name=ld` --version 2>&1" | \
73 egrep 'GNU ld' > /dev/null; then
74 with_gnu_ld=yes
76 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
77 archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
79 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
80 export_dynamic_flag_spec='${wl}--export-dynamic'
82 # If archive_cmds runs LD, not CC, wlarc should be empty
83 # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
84 # investigate it a little bit more. (MM)
85 wlarc='${wl}'
87 # ancient GNU ld didn't support --whole-archive et. al.
88 if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
89 egrep 'no-whole-archive' > /dev/null; then
90 whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
91 else
92 whole_archive_flag_spec=
94 else
95 with_gnu_ld=no
96 wlarc=
98 # A generic and very simple default shared library creation
99 # command for GNU C++ for the case where it uses the native
100 # linker, instead of GNU ld. If possible, this setting should
101 # overridden to take advantage of the native linker features on
102 # the platform it is being used on.
103 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
106 # Commands to make compiler produce verbose output that lists
107 # what "hidden" libraries, object files and flags are used when
108 # linking a shared library.
109 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
111 else
112 with_gcc=no
113 with_gnu_ld=no
114 wlarc=
117 # PORTME: fill in a description of your system's C++ link characteristics
118 case $host_os in
119 aix3*)
120 # FIXME: insert proper C++ library support
121 ld_shlibs=no
123 aix4* | aix5*)
124 archive_cmds=''
125 hardcode_direct=yes
126 hardcode_libdir_separator=':'
127 link_all_deplibs=yes
128 # When large executables or shared objects are built, AIX ld can
129 # have problems creating the table of contents. If linking a library
130 # or program results in "error TOC overflow" add -mminimal-toc to
131 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
132 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
133 if test "$with_gcc" = yes; then
134 case $host_os in aix4.[012]|aix4.[012].*)
135 # We only want to do this on AIX 4.2 and lower, the check
136 # below for broken collect2 doesn't work under 4.3+
137 collect2name=`${CC} -print-prog-name=collect2`
138 if test -f "$collect2name" && \
139 strings "$collect2name" | grep resolve_lib_name >/dev/null
140 then
141 # We have reworked collect2
142 hardcode_direct=yes
143 else
144 # We have old collect2
145 hardcode_direct=unsupported
146 # It fails to find uninstalled libraries when the uninstalled
147 # path is not listed in the libpath. Setting hardcode_minus_L
148 # to unsupported forces relinking
149 hardcode_minus_L=yes
150 hardcode_libdir_flag_spec='-L$libdir'
151 hardcode_libdir_separator=
153 esac
154 shared_flag='-shared'
155 else
156 # not using gcc
157 if test "$host_cpu" = ia64; then
158 shared_flag='${wl}-G'
159 else
160 shared_flag='${wl}-bM:SRE'
164 if test "$host_cpu" = ia64; then
165 # On IA64, the linker does run time linking by default, so we don't
166 # have to do anything special.
167 aix_use_runtimelinking=no
168 exp_sym_flag='-Bexport'
169 no_entry_flag=""
170 else
171 # Test if we are trying to use run time linking, or normal AIX style linking.
172 # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
173 aix_use_runtimelinking=no
174 for ld_flag in $LDFLAGS; do
175 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
176 aix_use_runtimelinking=yes
177 break
179 done
180 exp_sym_flag='-bexport'
181 no_entry_flag='-bnoentry'
183 # It seems that -bexpall does not export symbols beginning with
184 # underscore (_), so it is better to generate a list of symbols to export.
185 always_export_symbols=yes
186 if test "$aix_use_runtimelinking" = yes; then
187 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
188 allow_undefined_flag=' -Wl,-G'
189 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"
190 else
191 if test "$host_cpu" = ia64; then
192 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
193 allow_undefined_flag="-z nodefs"
194 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"
195 else
196 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
197 # Warning - without using the other run time loading flags, -berok will
198 # link without error, but may produce a broken library.
199 no_undefined_flag='${wl}-bnoerok'
200 allow_undefined_flag='${wl}-berok"
201 # -bexpall does not export symbols beginning with underscore (_)
202 always_export_symbols=yes
203 # Exported symbols can be pulled into shared objects from archives
204 whole_archive_flag_spec=' '
205 build_libtool_need_lc=yes
206 # This is similar to how AIX traditionally builds it's shared libraries.
207 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'
211 chorus*)
212 case $cc_basename in
214 # FIXME: insert proper C++ library support
215 ld_shlibs=no
217 esac
219 dgux*)
220 case $cc_basename in
221 ec++)
222 # FIXME: insert proper C++ library support
223 ld_shlibs=no
225 ghcx)
226 # Green Hills C++ Compiler
227 # FIXME: insert proper C++ library support
228 ld_shlibs=no
231 # FIXME: insert proper C++ library support
232 ld_shlibs=no
234 esac
236 freebsd*)
237 # FreeBSD uses GNU C++ and GNU ld
238 # FIXME: insert proper C++ library support
239 ld_shlibs=no
241 hpux*)
242 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
243 hardcode_libdir_separator=:
244 hardcode_direct=yes
245 hardcode_minus_L=yes # Not in the search PATH, but as the default
246 # location of the library.
247 export_dynamic_flag_spec='${wl}-E'
249 case $cc_basename in
251 # FIXME: insert proper C++ library support
252 ld_shlibs=no
254 aCC)
255 case $host_os in
256 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' ;;
257 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
258 esac
259 # Commands to make compiler produce verbose output that lists
260 # what "hidden" libraries, object files and flags are used when
261 # linking a shared library.
263 # There doesn't appear to be a way to prevent this compiler from
264 # explicitly linking system object files so we need to strip them
265 # from the output so that they don't get included in the library
266 # dependencies.
267 output_verbose_link_cmds='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
270 if test $with_gcc = yes; then
271 case "$host_os" in
272 hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -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' ;;
273 *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
274 esac
275 else
276 # FIXME: insert proper C++ library support
277 ld_shlibs=no
280 esac
282 irix5* | irix6*)
283 case $cc_basename in
285 # SGI C++
286 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'
288 # Archives containing C++ object files must be created using
289 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
290 # necessary to make sure instantiated templates are included
291 # in the archive.
292 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
295 if test "$with_gcc" = yes; then
296 if test "$with_gnu_ld" = no; then
297 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
298 else
299 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
302 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
303 hardcode_libdir_separator=:
304 link_all_deplibs=yes
306 esac
308 linux*)
309 case $cc_basename in
310 KCC)
311 # Kuck and Associates, Inc. (KAI) C++ Compiler
313 # KCC will only create a shared library if the output file
314 # ends with ".so" (or ".sl" for HP-UX), so rename the library
315 # to its proper name (with version) after linking.
316 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'
317 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'
319 # Commands to make compiler produce verbose output that lists
320 # what "hidden" libraries, object files and flags are used when
321 # linking a shared library.
323 # There doesn't appear to be a way to prevent this compiler from
324 # explicitly linking system object files so we need to strip them
325 # from the output so that they don't get included in the library
326 # dependencies.
327 output_verbose_link_cmds='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | egrep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
329 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
330 export_dynamic_flag_spec='${wl}--export-dynamic'
332 # Archives containing C++ object files must be created using
333 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
334 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
336 cxx)
337 # Compaq C++
338 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
339 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'
341 runpath_var=LD_RUN_PATH
342 hardcode_libdir_flag_spec='-rpath $libdir'
343 hardcode_libdir_separator=:
345 # Commands to make compiler produce verbose output that lists
346 # what "hidden" libraries, object files and flags are used when
347 # linking a shared library.
349 # There doesn't appear to be a way to prevent this compiler from
350 # explicitly linking system object files so we need to strip them
351 # from the output so that they don't get included in the library
352 # dependencies.
353 output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
355 esac
357 lynxos*)
358 # FIXME: insert proper C++ library support
359 ld_shlibs=no
361 m88k*)
362 # FIXME: insert proper C++ library support
363 ld_shlibs=no
365 mvs*)
366 case $cc_basename in
367 cxx)
368 # FIXME: insert proper C++ library support
369 ld_shlibs=no
372 # FIXME: insert proper C++ library support
373 ld_shlibs=no
375 esac
377 netbsd*)
378 # NetBSD uses g++ - do we need to do anything?
380 osf3*)
381 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
382 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
383 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'
385 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
386 hardcode_libdir_separator=:
388 # Commands to make compiler produce verbose output that lists
389 # what "hidden" libraries, object files and flags are used when
390 # linking a shared library.
391 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
394 case $cc_basename in
395 KCC)
396 # Kuck and Associates, Inc. (KAI) C++ Compiler
398 # KCC will only create a shared library if the output file
399 # ends with ".so" (or ".sl" for HP-UX), so rename the library
400 # to its proper name (with version) after linking.
401 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'
403 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
404 hardcode_libdir_separator=:
406 # Archives containing C++ object files must be created using
407 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
408 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
411 RCC)
412 # Rational C++ 2.4.1
413 # FIXME: insert proper C++ library support
414 ld_shlibs=no
416 cxx)
417 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
418 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'
420 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
421 hardcode_libdir_separator=:
423 # Commands to make compiler produce verbose output that lists
424 # what "hidden" libraries, object files and flags are used when
425 # linking a shared library.
427 # There doesn't appear to be a way to prevent this compiler from
428 # explicitly linking system object files so we need to strip them
429 # from the output so that they don't get included in the library
430 # dependencies.
431 output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
434 # FIXME: insert proper C++ library support
435 ld_shlibs=no
437 esac
439 osf4* | osf5*)
440 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
441 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
442 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'
444 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
445 hardcode_libdir_separator=:
447 # Commands to make compiler produce verbose output that lists
448 # what "hidden" libraries, object files and flags are used when
449 # linking a shared library.
450 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
453 case $cc_basename in
454 KCC)
455 # Kuck and Associates, Inc. (KAI) C++ Compiler
457 # KCC will only create a shared library if the output file
458 # ends with ".so" (or ".sl" for HP-UX), so rename the library
459 # to its proper name (with version) after linking.
460 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'
462 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
463 hardcode_libdir_separator=:
465 # Archives containing C++ object files must be created using
466 # the KAI C++ compiler.
467 old_archive_cmds='$CC -o $oldlib $oldobjs'
469 RCC)
470 # Rational C++ 2.4.1
471 # FIXME: insert proper C++ library support
472 ld_shlibs=no
474 cxx)
475 allow_undefined_flag=' -expect_unresolved \*'
476 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'
478 hardcode_libdir_flag_spec='-rpath $libdir'
479 hardcode_libdir_separator=:
481 # Commands to make compiler produce verbose output that lists
482 # what "hidden" libraries, object files and flags are used when
483 # linking a shared library.
485 # There doesn't appear to be a way to prevent this compiler from
486 # explicitly linking system object files so we need to strip them
487 # from the output so that they don't get included in the library
488 # dependencies.
489 output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
492 # FIXME: insert proper C++ library support
493 ld_shlibs=no
495 esac
497 psos*)
498 # FIXME: insert proper C++ library support
499 ld_shlibs=no
501 sco*)
502 case $cc_basename in
504 # FIXME: insert proper C++ library support
505 ld_shlibs=no
508 # FIXME: insert proper C++ library support
509 ld_shlibs=no
511 esac
513 sunos4*)
514 case $cc_basename in
516 # Sun C++ 4.x
517 # FIXME: insert proper C++ library support
518 ld_shlibs=no
520 lcc)
521 # Lucid
522 # FIXME: insert proper C++ library support
523 ld_shlibs=no
526 # FIXME: insert proper C++ library support
527 ld_shlibs=no
529 esac
531 solaris*)
532 case $cc_basename in
534 # Sun C++ 4.2, 5.x and Centerline C++
535 no_undefined_flag=' -ztext'
536 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
537 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
538 $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'
540 hardcode_libdir_flag_spec='-R$libdir'
541 hardcode_shlibpath_var=no
542 case $host_os in
543 solaris2.[0-5] | solaris2.[0-5].*) ;;
545 # The C++ compiler is used as linker so we must use $wl
546 # flag to pass the commands to the underlying system
547 # linker.
548 # Supported since Solaris 2.6 (maybe 2.5.1?)
549 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
551 esac
552 link_all_deplibs=yes
554 # Commands to make compiler produce verbose output that lists
555 # what "hidden" libraries, object files and flags are used when
556 # linking a shared library.
558 # There doesn't appear to be a way to prevent this compiler from
559 # explicitly linking system object files so we need to strip them
560 # from the output so that they don't get included in the library
561 # dependencies.
562 output_verbose_link_cmds='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep "\-R|\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
564 # Archives containing C++ object files must be created using
565 # "CC -xar", where "CC" is the Sun C++ compiler. This is
566 # necessary to make sure instantiated templates are included
567 # in the archive.
568 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
570 gcx)
571 # Green Hills C++ Compiler
572 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
574 # The C++ compiler must be used to create the archive.
575 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
578 # GNU C++ compiler with Solaris linker
579 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
580 if $CC --version | egrep -v '^2\.7' > /dev/null; then
581 archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
582 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
583 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
585 # Commands to make compiler produce verbose output that lists
586 # what "hidden" libraries, object files and flags are used when
587 # linking a shared library.
588 output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
589 else
590 # g++ 2.7 appears to require `-G' NOT `-shared' on this
591 # platform.
592 archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
593 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
594 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
596 # Commands to make compiler produce verbose output that lists
597 # what "hidden" libraries, object files and flags are used when
598 # linking a shared library.
599 output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
602 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
605 esac
607 tandem*)
608 case $cc_basename in
609 NCC)
610 # NonStop-UX NCC 3.20
611 # FIXME: insert proper C++ library support
612 ld_shlibs=no
615 # FIXME: insert proper C++ library support
616 ld_shlibs=no
618 esac
620 unixware*)
621 # FIXME: insert proper C++ library support
622 ld_shlibs=no
624 vxworks*)
625 # FIXME: insert proper C++ library support
626 ld_shlibs=no
629 # FIXME: insert proper C++ library support
630 ld_shlibs=no
632 esac
635 ## Compiler Characteristics: PIC flags, static flags, etc
637 # We don't use cached values here since only the C compiler
638 # characteristics should be cached.
639 ac_cv_prog_cc_pic=
640 ac_cv_prog_cc_shlib=
641 ac_cv_prog_cc_wl=
642 ac_cv_prog_cc_static=
643 ac_cv_prog_cc_no_builtin=
644 ac_cv_prog_cc_can_build_shared=$can_build_shared
646 ac_cv_prog_cc_pic_works=
647 ac_cv_prog_cc_static_works=
649 if test "$with_gcc" = yes; then
650 ac_cv_prog_cc_wl='-Wl,'
651 ac_cv_prog_cc_static='-static'
653 case $host_os in
654 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
655 # PIC is the default for these OSes.
657 aix*)
658 # All AIX code is PIC.
659 if test "$host_cpu" = ia64; then
660 # AIX 5 now supports IA64 processor
661 lt_cv_prog_cc_static='-Bstatic'
662 else
663 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
666 *djgpp*)
667 # DJGPP does not support shared libraries at all
668 ac_cv_prog_cc_pic=
670 cygwin* | mingw* | os2*)
671 # This hack is so that the source file can tell whether it is being
672 # built for inclusion in a dll (and should export symbols for example).
673 ac_cv_prog_cc_pic='-DDLL_EXPORT'
675 amigaos*)
676 # FIXME: we need at least 68020 code to build shared libraries, but
677 # adding the `-m68020' flag to GCC prevents building anything better,
678 # like `-m68040'.
679 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
681 sysv4*MP*)
682 if test -d /usr/nec; then
683 ac_cv_prog_cc_pic=-Kconform_pic
687 ac_cv_prog_cc_pic='-fPIC'
689 esac
690 else
691 case $host_os in
692 aix4* | aix5*)
693 # All AIX code is PIC.
694 if test "$host_cpu" = ia64; then
695 # AIX 5 now supports IA64 processor
696 lt_cv_prog_cc_static='-Bstatic'
697 else
698 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
701 chorus*)
702 case $cc_basename in
703 cxch68)
704 # Green Hills C++ Compiler
705 # 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"
707 esac
709 dgux*)
710 case $cc_basename in
711 ec++)
712 ac_cv_prog_cc_pic='-KPIC'
714 ghcx)
715 # Green Hills C++ Compiler
716 ac_cv_prog_cc_pic='-pic'
720 esac
722 freebsd*)
723 # FreeBSD uses GNU C++
725 hpux9* | hpux10* | hpux11*)
726 case $cc_basename in
728 ac_cv_prog_cc_wl='-Wl,'
729 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
730 ac_cv_prog_cc_pic='+Z'
732 aCC)
733 ac_cv_prog_cc_wl='-Wl,'
734 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
735 ac_cv_prog_cc_pic='+Z'
739 esac
741 irix5* | irix6*)
742 case $cc_basename in
744 ac_cv_prog_cc_wl='-Wl,'
745 ac_cv_prog_cc_static='-non_shared'
746 ac_cv_prog_cc_pic='-KPIC'
750 esac
752 linux*)
753 case $cc_basename in
754 KCC)
755 # KAI C++ Compiler
756 ac_cv_prog_cc_wl='--backend -Wl,'
757 ac_cv_prog_cc_pic='-fPIC'
759 cxx)
760 # Compaq C++
761 # Make sure the PIC flag is empty. It appears that all Alpha
762 # Linux and Compaq Tru64 Unix objects are PIC.
763 ac_cv_prog_cc_pic=
764 ac_cv_prog_cc_static='-non_shared'
768 esac
770 lynxos*)
772 m88k*)
774 mvs*)
775 case $cc_basename in
776 cxx)
777 ac_cv_prog_cc_pic='-W c,exportall'
781 esac
783 netbsd*)
785 osf3* | osf4* | osf5*)
786 case $cc_basename in
787 KCC)
788 ac_cv_prog_cc_wl='--backend -Wl,'
790 RCC)
791 # Rational C++ 2.4.1
792 ac_cv_prog_cc_pic='-pic'
794 cxx)
795 # Digital/Compaq C++
796 ac_cv_prog_cc_wl='-Wl,'
797 # Make sure the PIC flag is empty. It appears that all Alpha
798 # Linux and Compaq Tru64 Unix objects are PIC.
799 ac_cv_prog_cc_pic=
800 ac_cv_prog_cc_static='-non_shared'
804 esac
806 psos*)
808 sco*)
809 case $cc_basename in
811 ac_cv_prog_cc_pic='-fPIC'
815 esac
817 solaris*)
818 case $cc_basename in
820 # Sun C++ 4.2, 5.x and Centerline C++
821 ac_cv_prog_cc_pic='-KPIC'
822 ac_cv_prog_cc_static='-Bstatic'
823 ac_cv_prog_cc_wl='-Qoption ld '
825 gcx)
826 # Green Hills C++ Compiler
827 ac_cv_prog_cc_pic='-PIC'
831 esac
833 sunos4*)
834 case $cc_basename in
836 # Sun C++ 4.x
837 ac_cv_prog_cc_pic='-pic'
838 ac_cv_prog_cc_static='-Bstatic'
840 lcc)
841 # Lucid
842 ac_cv_prog_cc_pic='-pic'
846 esac
848 tandem*)
849 case $cc_basename in
850 NCC)
851 # NonStop-UX NCC 3.20
852 ac_cv_prog_cc_pic='-KPIC'
856 esac
858 unixware*)
860 vxworks*)
863 ac_cv_prog_cc_can_build_shared=no
865 esac
868 case "$host_os" in
869 # Platforms which do not suport PIC and -DPIC is meaningless
870 # on them:
871 *djgpp*)
872 ac_cv_prog_cc_pic=
875 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
877 esac
880 # Figure out "hidden" C++ library dependencies from verbose
881 # compiler output whening linking a shared library.
882 cat > conftest.$ac_ext <<EOF
883 class Foo
885 public:
886 Foo (void) { a = 0; }
887 private:
888 int a;
893 if (eval $ac_compile) 2>&5; then
894 # Parse the compiler output and extract the necessary
895 # objects, libraries and library flags.
897 # Sentinel used to keep track of whether or not we are before
898 # the conftest object file.
899 pre_test_object_deps_done=no
901 for p in `eval $output_verbose_link_cmds`; do
903 case $p in
905 -L* | -R* | -l*)
906 # Some compilers place space between "-{L,R}" and the path.
907 # Remove the space.
908 if test $p = "-L" \
909 || test $p = "-R"; then
910 prev=$p
911 continue
912 else
913 prev=
916 if test "$pre_test_object_deps_done" = no; then
917 case $p in
918 -L* | -R*)
919 # Internal compiler library paths should come after those
920 # provided the user. The postdeps already come after the
921 # user supplied libs so there is no need to process them.
922 if test -z "$compiler_lib_search_path"; then
923 compiler_lib_search_path="${prev}${p}"
924 else
925 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
928 # The "-l" case would never come before the object being
929 # linked, so don't bother handling this case.
930 esac
931 else
932 if test -z "$postdeps"; then
933 postdeps="${prev}${p}"
934 else
935 postdeps="${postdeps} ${prev}${p}"
940 *.$objext)
941 # This assumes that the test object file only shows up
942 # once in the compiler output.
943 if test "$p" = "conftest.$objext"; then
944 pre_test_object_deps_done=yes
945 continue
948 if test "$pre_test_object_deps_done" = no; then
949 if test -z "$predep_objects"; then
950 predep_objects="$p"
951 else
952 predep_objects="$predep_objects $p"
954 else
955 if test -z "$postdep_objects"; then
956 postdep_objects="$p"
957 else
958 postdep_objects="$postdep_objects $p"
963 *) ;; # Ignore the rest.
965 esac
966 done
968 # Clean up.
969 rm -f a.out
970 else
971 echo "ltcf-cxx.sh: error: problem compiling test program"
974 $rm -f confest.$objext
976 case " $postdeps " in
977 *" -lc "*) need_lc=no ;;
978 *) need_lc=yes ;;
979 esac