2000-08-22 Brent Verner <brent@rcfile.org>
[official-gcc.git] / ltcf-cxx.sh
blob5b28674f3f82bde1ce900a09c0a988942a2e4184
1 #### This script is meant to be sourced by ltconfig.
3 # $Id: ltcf-cxx.sh,v 1.1 2000/07/28 18:04:21 bkoz Exp $
5 # ltcf-cxx.sh - Create a C++ compiler specific configuration
7 # Copyright (C) 1996-1999,2000 Free Software Foundation, Inc.
8 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
10 # Original C++ support by:
11 # Alexandre Oliva <oliva@lsd.ic.unicamp.br>
12 # Ossama Othman <ossama@debian.org>
13 # Thomas Thanner <tanner@gmx.de>
15 # This file is free software; you can redistribute it and/or modify it
16 # under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
20 # This program is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 # As a special exception to the GNU General Public License, if you
30 # distribute this file as part of a program that contains a
31 # configuration script generated by Autoconf, you may include it under
32 # the same distribution terms that you use for the rest of that program.
35 # Source file extension for C++ test sources.
36 ac_ext=cc
38 # Object file extension for compiled C++ test sources.
39 objext=o
41 # Code to be used in simple compile tests
42 lt_simple_compile_test_code="int some_variable = 0;"
44 # Code to be used in simple link tests
45 lt_simple_link_test_code='int main(int, char *[]) { return (0); }'
47 # C++ compiler
48 CXX=${CXX-c++}
50 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
51 CC=${CC-"$CXX"}
52 CFLAGS=${CFLAGS-"$CXXFLAGS"}
54 # Allow CC to be a program name with arguments.
55 set dummy $CC
56 compiler=$2
57 cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
59 # Check if we are using GNU gcc (taken/adapted from configure script)
60 # We need to check here since "--with-gcc" is set at configure time,
61 # not ltconfig time!
62 cat > conftest.$ac_ext <<EOF
63 #ifdef __GNUC__
64 yes;
65 #endif
66 EOF
67 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
68 with_gcc=yes
70 # Set up default GNU C++ configuration
72 # Check if GNU C++ uses GNU ld as the underlying linker, since the
73 # archiving commands below assume that GNU ld is being used.
74 if eval "`$CC -print-prog-name=ld` --version 2>&1" | \
75 egrep 'GNU ld' > /dev/null; then
76 with_gnu_ld=yes
78 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
79 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'
81 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
82 export_dynamic_flag_spec='${wl}--export-dynamic'
84 # If archive_cmds runs LD, not CC, wlarc should be empty
85 # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
86 # investigate it a little bit more. (MM)
87 wlarc='${wl}'
89 # ancient GNU ld didn't support --whole-archive et. al.
90 if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
91 egrep 'no-whole-archive' > /dev/null; then
92 whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
93 else
94 whole_archive_flag_spec=
96 else
97 with_gnu_ld=no
98 wlarc=
100 # A generic and very simple default shared library creation
101 # command for GNU C++ for the case where it uses the native
102 # linker, instead of GNU ld. If possible, this setting should
103 # overridden to take advantage of the native linker features on
104 # the platform it is being used on.
105 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
108 # Commands to make compiler produce verbose output that lists
109 # what "hidden" libraries, object files and flags are used when
110 # linking a shared library.
111 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
113 else
114 with_gcc=no
115 with_gnu_ld=no
116 wlarc=
119 # In general, the C++ compiler should always link C++ objects.
120 case $target in
121 *aix3* | *aix4*)
122 # AIX just has to be different, doesn't it? :-\
123 LD=makeC++SharedLib_r
124 LDFLAGS="$LDFLAGS -p 0"
127 LD="$CC"
128 LDFLAGS="$LDFLAGS"
130 esac
133 # PORTME: fill in a description of your system's C++ link characteristics
134 case "$host_os" in
135 aix3*)
136 # FIXME: insert proper C++ library support
137 ld_shlibs=no
139 aix4*)
140 # FIXME: insert proper C++ library support
141 ld_shlibs=no
143 chorus*)
144 case "$cc_basename" in
146 # FIXME: insert proper C++ library support
147 ld_shlibs=no
149 esac
151 dgux*)
152 case "$cc_basename" in
153 ec++)
154 # FIXME: insert proper C++ library support
155 ld_shlibs=no
157 ghcx)
158 # Green Hills C++ Compiler
159 # FIXME: insert proper C++ library support
160 ld_shlibs=no
163 # FIXME: insert proper C++ library support
164 ld_shlibs=no
166 esac
168 freebsd*)
169 # FreeBSD uses GNU C++ and GNU ld
170 # FIXME: insert proper C++ library support
171 ld_shlibs=no
173 hpux*)
174 case "$cc_basename" in
176 # FIXME: insert proper C++ library support
177 ld_shlibs=no
179 aCC)
180 case "$host_os" in
181 hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
182 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;;
183 esac
184 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
185 hardcode_libdir_separator=:
186 hardcode_direct=yes
187 hardcode_minus_L=yes # Not in the search PATH, but as the default
188 # location of the library.
189 export_dynamic_flag_spec='${wl}-E'
191 # Commands to make compiler produce verbose output that lists
192 # what "hidden" libraries, object files and flags are used when
193 # linking a shared library.
195 # There doesn't appear to be a way to prevent this compiler from
196 # explicitly linking system object files so we need to strip them
197 # from the output so that they don't get included in the library
198 # dependencies.
199 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'
202 # FIXME: insert proper C++ library support
203 ld_shlibs=no
205 esac
207 irix5* | irix6*)
208 case "$cc_basename" in
210 # SGI C++
211 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'
214 if test "$with_gcc" = yes; then
215 if test "$with_gnu_ld" = no; then
216 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
217 else
218 archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
221 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
222 hardcode_libdir_separator=:
223 link_all_deplibs=yes
225 esac
227 linux*)
228 case "$cc_basename" in
229 KCC)
230 # Kuck and Associates, Inc. (KAI) C++ Compiler
232 # KCC will only create a shared library if the output file
233 # ends with ".so" (or ".sl" for HP-UX), so rename the library
234 # to its proper name (with version) after linking.
235 archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $linker_flags --soname $soname -o \$templib; mv \$templib $lib'
236 archive_expsym_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $linker_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
238 # Commands to make compiler produce verbose output that lists
239 # what "hidden" libraries, object files and flags are used when
240 # linking a shared library.
242 # There doesn't appear to be a way to prevent this compiler from
243 # explicitly linking system object files so we need to strip them
244 # from the output so that they don't get included in the library
245 # dependencies.
246 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'
248 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
249 export_dynamic_flag_spec='${wl}--export-dynamic'
251 # Archives containing C++ object files must be created using
252 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
253 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
255 cxx)
256 # Compaq C++
257 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-soname $wl$soname -o $lib'
258 archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
260 runpath_var=LD_RUN_PATH
261 hardcode_libdir_flag_spec='-rpath $libdir'
262 hardcode_libdir_separator=:
264 # Commands to make compiler produce verbose output that lists
265 # what "hidden" libraries, object files and flags are used when
266 # linking a shared library.
268 # There doesn't appear to be a way to prevent this compiler from
269 # explicitly linking system object files so we need to strip them
270 # from the output so that they don't get included in the library
271 # dependencies.
272 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'
274 esac
276 lynxos*)
277 # FIXME: insert proper C++ library support
278 ld_shlibs=no
280 m88k*)
281 # FIXME: insert proper C++ library support
282 ld_shlibs=no
284 mvs*)
285 case "$cc_basename" in
286 cxx)
287 # FIXME: insert proper C++ library support
288 ld_shlibs=no
291 # FIXME: insert proper C++ library support
292 ld_shlibs=no
294 esac
296 netbsd*)
297 # FIXME: insert proper C++ library support
298 ld_shlibs=no
300 osf3*)
301 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
302 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
303 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'
305 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
306 hardcode_libdir_separator=:
308 # Commands to make compiler produce verbose output that lists
309 # what "hidden" libraries, object files and flags are used when
310 # linking a shared library.
311 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
314 case "$cc_basename" in
315 KCC)
316 # Kuck and Associates, Inc. (KAI) C++ Compiler
318 # KCC will only create a shared library if the output file
319 # ends with ".so" (or ".sl" for HP-UX), so rename the library
320 # to its proper name (with version) after linking.
321 archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $linker_flags --soname $soname -o \$templib; mv \$templib $lib'
323 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
324 hardcode_libdir_separator=:
326 # Archives containing C++ object files must be created using
327 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
328 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
331 RCC)
332 # Rational C++ 2.4.1
333 # FIXME: insert proper C++ library support
334 ld_shlibs=no
336 cxx)
337 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
338 archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
340 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
341 hardcode_libdir_separator=:
343 # Commands to make compiler produce verbose output that lists
344 # what "hidden" libraries, object files and flags are used when
345 # linking a shared library.
347 # There doesn't appear to be a way to prevent this compiler from
348 # explicitly linking system object files so we need to strip them
349 # from the output so that they don't get included in the library
350 # dependencies.
351 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'
354 # FIXME: insert proper C++ library support
355 ld_shlibs=no
357 esac
359 osf4* | osf5*)
360 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
361 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
362 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'
364 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
365 hardcode_libdir_separator=:
367 # Commands to make compiler produce verbose output that lists
368 # what "hidden" libraries, object files and flags are used when
369 # linking a shared library.
370 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
373 case "$cc_basename" in
374 KCC)
375 # Kuck and Associates, Inc. (KAI) C++ Compiler
377 # KCC will only create a shared library if the output file
378 # ends with ".so" (or ".sl" for HP-UX), so rename the library
379 # to its proper name (with version) after linking.
380 archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $linker_flags --soname $soname -o \$templib; mv \$templib $lib'
382 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
383 hardcode_libdir_separator=:
385 # Archives containing C++ object files must be created using
386 # the KAI C++ compiler.
387 old_archive_cmds='$CC -o $oldlib $oldobjs'
389 RCC)
390 # Rational C++ 2.4.1
391 # FIXME: insert proper C++ library support
392 ld_shlibs=no
394 cxx)
395 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
396 archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-msym ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
398 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
399 hardcode_libdir_separator=:
401 # Commands to make compiler produce verbose output that lists
402 # what "hidden" libraries, object files and flags are used when
403 # linking a shared library.
405 # There doesn't appear to be a way to prevent this compiler from
406 # explicitly linking system object files so we need to strip them
407 # from the output so that they don't get included in the library
408 # dependencies.
409 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'
412 # FIXME: insert proper C++ library support
413 ld_shlibs=no
415 esac
417 psos*)
418 # FIXME: insert proper C++ library support
419 ld_shlibs=no
421 sco*)
422 case "$cc_basename" in
424 # FIXME: insert proper C++ library support
425 ld_shlibs=no
428 # FIXME: insert proper C++ library support
429 ld_shlibs=no
431 esac
433 sunos4*)
434 case "$cc_basename" in
436 # Sun C++ 4.x
437 # FIXME: insert proper C++ library support
438 ld_shlibs=no
440 lcc)
441 # Lucid
442 # FIXME: insert proper C++ library support
443 ld_shlibs=no
446 # FIXME: insert proper C++ library support
447 ld_shlibs=no
449 esac
451 solaris*)
452 case "$cc_basename" in
454 # Sun C++ 4.2, 5.x and Centerline C++
455 no_undefined_flag=' -ztext'
456 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
457 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
458 $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
460 hardcode_libdir_flag_spec='-R$libdir'
461 hardcode_shlibpath_var=no
462 case "$host_os" in
463 solaris2.[0-5] | solaris2.[0-5].*) ;;
465 # The C++ compiler is used as linker so we must use $wl
466 # flag to pass the commands to the underlying system
467 # linker.
468 # Supported since Solaris 2.6 (maybe 2.5.1?)
469 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
471 esac
472 link_all_deplibs=yes
474 # Commands to make compiler produce verbose output that lists
475 # what "hidden" libraries, object files and flags are used when
476 # linking a shared library.
478 # There doesn't appear to be a way to prevent this compiler from
479 # explicitly linking system object files so we need to strip them
480 # from the output so that they don't get included in the library
481 # dependencies.
482 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'
484 # Archives containing C++ object files must be created using
485 # "CC -xar", where "CC" is the Sun C++ compiler. This is
486 # necessary to make sure instantiated templates are included
487 # in the archive.
488 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
490 gcx)
491 # Green Hills C++ Compiler
492 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
494 # The C++ compiler must be used to create the archive.
495 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
498 # GNU C++ compiler with Solaris linker
499 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
500 if $CC --version | egrep -v '^2\.7' > /dev/null; then
501 archive_cmds='$LD -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
502 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
503 $LD -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
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_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
509 else
510 # g++ 2.7 appears to require `-G' NOT `-shared' on this
511 # platform.
512 archive_cmds='$LD -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
513 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
514 $LD -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
516 # Commands to make compiler produce verbose output that lists
517 # what "hidden" libraries, object files and flags are used when
518 # linking a shared library.
519 output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
522 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
525 esac
527 tandem*)
528 case "$cc_basename" in
529 NCC)
530 # NonStop-UX NCC 3.20
531 # FIXME: insert proper C++ library support
532 ld_shlibs=no
535 # FIXME: insert proper C++ library support
536 ld_shlibs=no
538 esac
540 unixware*)
541 # FIXME: insert proper C++ library support
542 ld_shlibs=no
544 vxworks*)
545 # FIXME: insert proper C++ library support
546 ld_shlibs=no
549 # FIXME: insert proper C++ library support
550 ld_shlibs=no
552 esac
555 ## Compiler Characteristics: PIC flags, static flags, etc
557 # We don't use cached values here since only the C compiler
558 # characteristics should be cached.
559 ac_cv_prog_cc_pic=
560 ac_cv_prog_cc_shlib=
561 ac_cv_prog_cc_wl=
562 ac_cv_prog_cc_static=
563 ac_cv_prog_cc_no_builtin=
564 ac_cv_prog_cc_can_build_shared=$can_build_shared
566 # It is not enough to reset these cached values, they must be unset.
567 unset ac_cv_prog_cc_pic_works
568 unset ac_cv_prog_cc_static_works
570 if test "$with_gcc" = yes; then
571 ac_cv_prog_cc_wl='-Wl,'
572 ac_cv_prog_cc_static='-static'
574 case "$host_os" in
575 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
576 # PIC is the default for these OSes.
578 aix*)
579 # Below there is a dirty hack to force normal static linking with -ldl
580 # The problem is because libdl dynamically linked with both libc and
581 # libC (AIX C++ library), which obviously doesn't included in libraries
582 # list by gcc. This cause undefined symbols with -static flags.
583 # This hack allows C programs to be linked with "-static -ldl", but
584 # we not sure about C++ programs.
585 ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
587 cygwin* | mingw* | os2*)
588 # This hack is so that the source file can tell whether it is being
589 # built for inclusion in a dll (and should export symbols for example).
590 ac_cv_prog_cc_pic='-DDLL_EXPORT'
592 amigaos*)
593 # FIXME: we need at least 68020 code to build shared libraries, but
594 # adding the `-m68020' flag to GCC prevents building anything better,
595 # like `-m68040'.
596 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
598 sysv4*MP*)
599 if test -d /usr/nec; then
600 ac_cv_prog_cc_pic=-Kconform_pic
604 ac_cv_prog_cc_pic='-fPIC'
606 esac
607 else
608 case "$host_os" in
609 aix4*)
610 # All AIX code is PIC.
612 chorus*)
613 case "$cc_basename" in
614 cxch68)
615 # Green Hills C++ Compiler
616 # 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"
618 esac
620 dgux*)
621 case "$cc_basename" in
622 ec++)
623 ac_cv_prog_cc_pic='-KPIC'
625 ghcx)
626 # Green Hills C++ Compiler
627 ac_cv_prog_cc_pic='-pic'
631 esac
633 freebsd*)
634 # FreeBSD uses GNU C++
636 hpux9* | hpux10* | hpux11*)
637 case "$cc_basename" in
639 ac_cv_prog_cc_wl='-Wl,'
640 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
641 ac_cv_prog_cc_pic='+Z'
643 aCC)
644 ac_cv_prog_cc_wl='-Wl,'
645 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
646 ac_cv_prog_cc_pic='+Z'
650 esac
652 irix5* | irix6*)
653 case "$cc_basename" in
655 ac_cv_prog_cc_wl='-Wl,'
656 ac_cv_prog_cc_static='-non_shared'
657 ac_cv_prog_cc_pic='-KPIC'
661 esac
663 linux*)
664 case "$cc_basename" in
665 KCC)
666 # KAI C++ Compiler
667 ac_cv_prog_cc_wl='--backend -Wl,'
668 ac_cv_prog_cc_pic='-fPIC'
670 cxx)
671 # Compaq C++
672 # Make sure the PIC flag is empty. It appears that all Alpha
673 # Linux and Compaq Tru64 Unix objects are PIC.
674 ac_cv_prog_cc_pic=
675 ac_cv_prog_cc_static='-non_shared'
679 esac
681 lynxos*)
683 m88k*)
685 mvs*)
686 case "$cc_basename" in
687 cxx)
688 ac_cv_prog_cc_pic='-W c,exportall'
692 esac
694 netbsd*)
696 osf3* | osf4* | osf5*)
697 case "$cc_basename" in
698 KCC)
699 ac_cv_prog_cc_wl='--backend -Wl,'
701 RCC)
702 # Rational C++ 2.4.1
703 ac_cv_prog_cc_pic='-pic'
705 cxx)
706 # Digital/Compaq C++
707 ac_cv_prog_cc_wl='-Wl,'
708 # Make sure the PIC flag is empty. It appears that all Alpha
709 # Linux and Compaq Tru64 Unix objects are PIC.
710 ac_cv_prog_cc_pic=
711 ac_cv_prog_cc_static='-non_shared'
715 esac
717 psos*)
719 sco*)
720 case "$cc_basename" in
722 ac_cv_prog_cc_pic='-fPIC'
726 esac
728 solaris*)
729 case "$cc_basename" in
731 # Sun C++ 4.2, 5.x and Centerline C++
732 ac_cv_prog_cc_pic='-KPIC'
733 ac_cv_prog_cc_static='-Bstatic'
734 ac_cv_prog_cc_wl='-Qoption ld '
736 gcx)
737 # Green Hills C++ Compiler
738 ac_cv_prog_cc_pic='-PIC'
742 esac
744 sunos4*)
745 case "$cc_basename" in
747 # Sun C++ 4.x
748 ac_cv_prog_cc_pic='-pic'
749 ac_cv_prog_cc_static='-Bstatic'
751 lcc)
752 # Lucid
753 ac_cv_prog_cc_pic='-pic'
757 esac
759 tandem*)
760 case "$cc_basename" in
761 NCC)
762 # NonStop-UX NCC 3.20
763 ac_cv_prog_cc_pic='-KPIC'
767 esac
769 unixware*)
771 vxworks*)
774 ac_cv_prog_cc_can_build_shared=no
776 esac
778 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
781 # Figure out "hidden" C++ library dependencies from verbose
782 # compiler output whening linking a shared library.
783 cat > conftest.$ac_ext <<EOF
784 class Foo
786 public:
787 Foo (void) { a = 0; }
788 private:
789 int a;
794 if eval $ac_compile 2>&5; then
795 # Parse the compiler output and extract the necessary
796 # objects, libraries and library flags.
798 # Sentinel used to keep track of whether or not we are before
799 # the conftest object file.
800 pre_test_object_deps_done=no
802 for p in `eval $output_verbose_link_cmds`; do
804 case $p in
806 -L* | -R* | -l*)
807 # Some compilers place space between "-{L,R}" and the path.
808 # Remove the space.
809 if test $p = "-L" \
810 || test $p = "-R"; then
811 prev=$p
812 continue
813 else
814 prev=
817 if test "$pre_test_object_deps_done" = no; then
818 case $p in
819 -L* | -R*)
820 # Internal compiler library paths should come after those
821 # provided the user. The postdeps already come after the
822 # user supplied libs so there is no need to process them.
823 if test -z "$compiler_lib_search_path"; then
824 compiler_lib_search_path="${prev}${p}"
825 else
826 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
829 # The "-l" case would never come before the object being
830 # linked, so don't bother handling this case.
831 esac
832 else
833 if test -z "$postdeps"; then
834 postdeps="${prev}${p}"
835 else
836 postdeps="${postdeps} ${prev}${p}"
841 *.$objext)
842 # This assumes that the test object file only shows up
843 # once in the compiler output.
844 if test "$p" = "conftest.$objext"; then
845 pre_test_object_deps_done=yes
846 continue
849 if test "$pre_test_object_deps_done" = no; then
850 if test -z "$predep_objects"; then
851 predep_objects="$p"
852 else
853 predep_objects="$predep_objects $p"
855 else
856 if test -z "$postdep_objects"; then
857 postdep_objects="$p"
858 else
859 postdep_objects="$postdep_objects $p"
864 *) ;; # Ignore the rest.
866 esac
867 done
869 # Clean up.
870 rm -f a.out
871 else
872 echo "ltcf-cxx.sh: error: problem compiling test program"
875 $rm -f confest.$objext
877 case " $postdeps " in
878 *" -lc "*) need_lc=no ;;
879 *) need_lc=yes ;;
880 esac