1
#### This script is meant to be sourced by ltconfig.
3
# $Id: ltcf-cxx.sh,v 1.31 2001/02/19 02:40:15 matz 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.
38
# Object file extension for compiled C++ test sources.
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); }'
50
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
52
CFLAGS=${CFLAGS-"$CXXFLAGS"}
54
# Allow CC (or CXX) to be a program name with arguments.
57
cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
59
# we are optimistic. (Too optimistic if you ask me, down there we switch it
60
# off again for most platforms ;) (MM)
63
# Check if we are using GNU gcc (taken/adapted from configure script)
64
# We need to check here since "--with-gcc" is set at configure time,
66
cat > conftest.$ac_ext <<EOF
71
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
74
# Set up default GNU C++ configuration
76
# Check if GNU C++ uses GNU ld as the underlying linker, since the
77
# archiving commands below assume that GNU ld is being used.
78
if eval "`$CC -print-prog-name=ld` --version 2>&1" | \
79
egrep 'GNU ld' > /dev/null; then
82
archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
83
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'
85
runpath_var=LD_RUN_PATH
86
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
87
export_dynamic_flag_spec='${wl}--export-dynamic'
89
# If archive_cmds runs LD, not CC, wlarc should be empty
90
# XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
91
# investigate it a little bit more. (MM)
94
# ancient GNU ld didn't support --whole-archive et. al.
95
if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
96
egrep 'no-whole-archive' > /dev/null; then
97
whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
99
whole_archive_flag_spec=
105
# A generic and very simple default shared library creation
106
# command for GNU C++ for the case where it uses the native
107
# linker, instead of GNU ld. If possible, this setting should
108
# overridden to take advantage of the native linker features on
109
# the platform it is being used on.
110
archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
113
# Commands to make compiler produce verbose output that lists
114
# what "hidden" libraries, object files and flags are used when
115
# linking a shared library.
116
output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
124
echo "ltcf-cxx: with_gcc=$with_gcc ; with_gnu_ld=$with_gnu_ld"
126
# In general, the C++ compiler should always link C++ objects.
130
# PORTME: fill in a description of your system's C++ link characteristics
133
# FIXME: insert proper C++ library support
137
case "$cc_basename" in
139
# IBM C++ compiler (xlC). Anything older than Visual Age C++ 5.0 probably won't work.
140
archive_cmds='$CC -qmkshrobj $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G -o $lib'
141
archive_expsym_cmds='$CC -qmkshrobj $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G ${wl}-bE:$export_symbols -o $lib'
144
if test "$with_gcc" = yes; then
146
archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G -o $lib'
147
archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G ${wl}-bE:$export_symbols -o $lib'
152
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
153
hardcode_libdir_separator=':'
154
hardcode_direct=unsupported
158
case "$cc_basename" in
160
# FIXME: insert proper C++ library support
166
case "$cc_basename" in
168
# FIXME: insert proper C++ library support
172
# Green Hills C++ Compiler
173
# FIXME: insert proper C++ library support
177
# FIXME: insert proper C++ library support
183
# FreeBSD uses GNU C++ and GNU ld
184
skip_need_lc_check=yes
188
case "$cc_basename" in
190
# FIXME: insert proper C++ library support
195
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' ;;
196
*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
198
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
199
hardcode_libdir_separator=:
201
hardcode_minus_L=yes # Not in the search PATH, but as the default
202
# location of the library.
203
export_dynamic_flag_spec='${wl}-E'
205
# Commands to make compiler produce verbose output that lists
206
# what "hidden" libraries, object files and flags are used when
207
# linking a shared library.
209
# There doesn't appear to be a way to prevent this compiler from
210
# explicitly linking system object files so we need to strip them
211
# from the output so that they don't get included in the library
213
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'
216
if test "$with_gcc" = yes && test "$with_gnu_ld" = no ; then
217
# MM: for HP-UX and g++ -fPIC is needed to link pic objects together
218
archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
219
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
220
hardcode_libdir_separator=:
223
export_dynamic_flag_spec='${wl}-E'
224
output_verbose_link_cmds='$CC -shared -fPIC $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
227
if test "$with_gcc" = no ; then
228
# FIXME: insert proper C++ library support
235
case "$cc_basename" in
238
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'
240
# Archives containing C++ object files must be created using
241
# "CC -ar", where "CC" is the IRIX C++ compiler. This is
242
# necessary to make sure instantiated templates are included
244
old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
247
if test "$with_gcc" = yes; then
248
if test "$with_gnu_ld" = no; then
249
archive_cmds='$CC -nostdlib -D_LANGUAGE_C_CPLUS_PLUS -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'
251
archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
256
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
257
hardcode_libdir_separator=:
261
case "$cc_basename" in
263
# Kuck and Associates, Inc. (KAI) C++ Compiler
265
# KCC will only create a shared library if the output file
266
# ends with ".so" (or ".sl" for HP-UX), so rename the library
267
# to its proper name (with version) after linking.
268
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'
269
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'
271
# Commands to make compiler produce verbose output that lists
272
# what "hidden" libraries, object files and flags are used when
273
# linking a shared library.
275
# There doesn't appear to be a way to prevent this compiler from
276
# explicitly linking system object files so we need to strip them
277
# from the output so that they don't get included in the library
279
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'
281
hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
282
export_dynamic_flag_spec='${wl}--export-dynamic'
284
# Archives containing C++ object files must be created using
285
# "CC -Bstatic", where "CC" is the KAI C++ compiler.
286
old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
290
archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
291
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'
293
runpath_var=LD_RUN_PATH
294
hardcode_libdir_flag_spec='-rpath $libdir'
295
hardcode_libdir_separator=:
297
# Commands to make compiler produce verbose output that lists
298
# what "hidden" libraries, object files and flags are used when
299
# linking a shared library.
301
# There doesn't appear to be a way to prevent this compiler from
302
# explicitly linking system object files so we need to strip them
303
# from the output so that they don't get included in the library
305
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'
308
if test "$with_gcc" = yes; then
309
# Insure++ together with gcc probably means also GNU ld
310
# only -whole-archive isn't supported
311
whole_archive_flag_spec=""
312
# and we can't use -nostdlib, because bloody insure has no way to
313
# output the linkline (-Zvm isn't working as documented), so we don't
314
# know the depending libs. So we hope, insure gets it right anyway.
315
archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
316
runpath_var=LD_RUN_PATH
317
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
318
export_dynamic_flag_spec='${wl}--export-dynamic'
319
output_verbose_link_cmds=""
324
# FIXME: insert proper C++ library support
328
# FIXME: insert proper C++ library support
332
case "$cc_basename" in
334
# FIXME: insert proper C++ library support
338
# FIXME: insert proper C++ library support
344
if test "$with_gcc" = no || test "$with_gnu_ld" = no; then
345
# This should only be triggered for NetBSD/a.out
346
# Add in C++ constructor/destructor support
347
if test -f /usr/pkg/lib/c++rt0/c++rt0.o.PIC; then
348
cppopts="/usr/pkg/lib/c++rt0/c++rt0.o.PIC"
349
elif test -f /usr/lib/c++rt0.o; then
350
cppopts="/usr/lib/c++rt0.o"
352
archive_cmds='ld -Bshareable -o $lib '"$cppopts"' $libobjs $deplibs $linkopts'
356
if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
357
# MM: OpenBSD 2.7 uses G++, but not GNU ld
358
archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
359
archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
360
old_archive_cmds="$old_archive_cmds~"'$RANLIB $oldlib'
361
hardcode_libdir_flag_spec='${wl}-R$libdir'
363
hardcode_shlibpath_var=no
364
whole_archive_flag_spec='${wl}-Bforcearchive'
369
if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
370
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
371
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'
373
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
374
hardcode_libdir_separator=:
376
# Commands to make compiler produce verbose output that lists
377
# what "hidden" libraries, object files and flags are used when
378
# linking a shared library.
379
output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
381
case "$cc_basename" in
383
# Kuck and Associates, Inc. (KAI) C++ Compiler
385
# KCC will only create a shared library if the output file
386
# ends with ".so" (or ".sl" for HP-UX), so rename the library
387
# to its proper name (with version) after linking.
388
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'
390
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
391
hardcode_libdir_separator=:
393
# Archives containing C++ object files must be created using
394
# "CC -Bstatic", where "CC" is the KAI C++ compiler.
395
old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
400
# FIXME: insert proper C++ library support
404
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
405
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'
407
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
408
hardcode_libdir_separator=:
410
# Commands to make compiler produce verbose output that lists
411
# what "hidden" libraries, object files and flags are used when
412
# linking a shared library.
414
# There doesn't appear to be a way to prevent this compiler from
415
# explicitly linking system object files so we need to strip them
416
# from the output so that they don't get included in the library
418
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'
421
# FIXME: insert proper C++ library support
428
if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
429
allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*'
430
no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*'
431
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'
433
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
434
hardcode_libdir_separator=:
436
# Commands to make compiler produce verbose output that lists
437
# what "hidden" libraries, object files and flags are used when
438
# linking a shared library.
439
output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
441
case "$cc_basename" in
443
# Kuck and Associates, Inc. (KAI) C++ Compiler
445
# KCC will only create a shared library if the output file
446
# ends with ".so" (or ".sl" for HP-UX), so rename the library
447
# to its proper name (with version) after linking.
448
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'
450
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
451
hardcode_libdir_separator=:
453
# Archives containing C++ object files must be created using
454
# the KAI C++ compiler.
455
old_archive_cmds='$CC -o $oldlib $oldobjs'
459
# FIXME: insert proper C++ library support
463
allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*'
464
no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*'
465
archive_cmds='$CC -shared${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` -update_registry ${objdir}/so_locations -o $lib'
467
hardcode_libdir_flag_spec='-rpath $libdir'
468
hardcode_libdir_separator=:
470
# Commands to make compiler produce verbose output that lists
471
# what "hidden" libraries, object files and flags are used when
472
# linking a shared library.
474
# There doesn't appear to be a way to prevent this compiler from
475
# explicitly linking system object files so we need to strip them
476
# from the output so that they don't get included in the library
478
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'
481
# FIXME: insert proper C++ library support
488
# FIXME: insert proper C++ library support
492
case "$cc_basename" in
494
# FIXME: insert proper C++ library support
498
# FIXME: insert proper C++ library support
504
case "$cc_basename" in
507
# FIXME: insert proper C++ library support
512
# FIXME: insert proper C++ library support
516
# FIXME: insert proper C++ library support
522
case "$cc_basename" in
524
# Sun C++ 4.2, 5.x and Centerline C++
525
no_undefined_flag=' -ztext'
526
archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
527
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
528
$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'
530
hardcode_libdir_flag_spec='-R$libdir'
531
hardcode_shlibpath_var=no
533
solaris2.[0-5] | solaris2.[0-5].*) ;;
535
# The C++ compiler is used as linker so we must use $wl
536
# flag to pass the commands to the underlying system
538
# Supported since Solaris 2.6 (maybe 2.5.1?)
539
whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
544
# Commands to make compiler produce verbose output that lists
545
# what "hidden" libraries, object files and flags are used when
546
# linking a shared library.
548
# There doesn't appear to be a way to prevent this compiler from
549
# explicitly linking system object files so we need to strip them
550
# from the output so that they don't get included in the library
552
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'
554
# Archives containing C++ object files must be created using
555
# "CC -xar", where "CC" is the Sun C++ compiler. This is
556
# necessary to make sure instantiated templates are included
558
old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
561
# Green Hills C++ Compiler
562
archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
564
# The C++ compiler must be used to create the archive.
565
old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
568
# GNU C++ compiler with Solaris linker
569
if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
570
if $CC --version | egrep -v '^2\.7' > /dev/null; then
571
archive_cmds='$LD -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
572
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
573
$LD -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname~$rm $lib.exp'
575
# Commands to make compiler produce verbose output that lists
576
# what "hidden" libraries, object files and flags are used when
577
# linking a shared library.
578
output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
580
# g++ 2.7 appears to require `-G' NOT `-shared' on this
582
archive_cmds='$LD -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
583
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
584
$LD -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname~$rm $lib.exp'
586
# Commands to make compiler produce verbose output that lists
587
# what "hidden" libraries, object files and flags are used when
588
# linking a shared library.
589
output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
592
hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
598
case "$cc_basename" in
600
# NonStop-UX NCC 3.20
601
# FIXME: insert proper C++ library support
605
# FIXME: insert proper C++ library support
611
# FIXME: insert proper C++ library support
615
# FIXME: insert proper C++ library support
619
# FIXME: insert proper C++ library support
625
## Compiler Characteristics: PIC flags, static flags, etc
627
# We don't use cached values here since only the C compiler
628
# characteristics should be cached.
632
ac_cv_prog_cc_static=
633
ac_cv_prog_cc_no_builtin=
634
ac_cv_prog_cc_can_build_shared=$can_build_shared
636
# It is not enough to reset these cached values, they must be unset.
637
unset ac_cv_prog_cc_pic_works
638
unset ac_cv_prog_cc_static_works
640
if test "$with_gcc" = yes; then
641
ac_cv_prog_cc_wl='-Wl,'
642
ac_cv_prog_cc_static='-static'
645
beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
646
# PIC is the default for these OSes.
649
# Below there is a dirty hack to force normal static linking with -ldl
650
# The problem is because libdl dynamically linked with both libc and
651
# libC (AIX C++ library), which obviously doesn't included in libraries
652
# list by gcc. This cause undefined symbols with -static flags.
653
# This hack allows C programs to be linked with "-static -ldl", but
654
# we not sure about C++ programs.
655
ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
657
cygwin* | mingw* | os2*)
658
# This hack is so that the source file can tell whether it is being
659
# built for inclusion in a dll (and should export symbols for example).
660
ac_cv_prog_cc_pic='-DDLL_EXPORT'
663
# FIXME: we need at least 68020 code to build shared libraries, but
664
# adding the `-m68020' flag to GCC prevents building anything better,
666
ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
669
if test -d /usr/nec; then
670
ac_cv_prog_cc_pic=-Kconform_pic
674
ac_cv_prog_cc_pic='-fPIC'
680
# All AIX code is PIC.
683
case "$cc_basename" in
685
# Green Hills C++ Compiler
686
# 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"
691
case "$cc_basename" in
693
ac_cv_prog_cc_pic='-KPIC'
696
# Green Hills C++ Compiler
697
ac_cv_prog_cc_pic='-pic'
704
# FreeBSD uses GNU C++
706
hpux9* | hpux10* | hpux11*)
707
case "$cc_basename" in
709
ac_cv_prog_cc_wl='-Wl,'
710
ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
711
ac_cv_prog_cc_pic='+Z'
714
ac_cv_prog_cc_wl='-Wl,'
715
ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
716
ac_cv_prog_cc_pic='+Z'
723
case "$cc_basename" in
725
ac_cv_prog_cc_wl='-Wl,'
726
ac_cv_prog_cc_static='-non_shared'
727
ac_cv_prog_cc_pic='-KPIC'
734
case "$cc_basename" in
737
ac_cv_prog_cc_wl='--backend -Wl,'
738
ac_cv_prog_cc_pic='-fPIC'
742
# Make sure the PIC flag is empty. It appears that all Alpha
743
# Linux and Compaq Tru64 Unix objects are PIC.
745
ac_cv_prog_cc_static='-non_shared'
756
case "$cc_basename" in
758
ac_cv_prog_cc_pic='-W c,exportall'
766
osf3* | osf4* | osf5*)
767
case "$cc_basename" in
769
ac_cv_prog_cc_wl='--backend -Wl,'
773
ac_cv_prog_cc_pic='-pic'
777
ac_cv_prog_cc_wl='-Wl,'
778
# Make sure the PIC flag is empty. It appears that all Alpha
779
# Linux and Compaq Tru64 Unix objects are PIC.
781
ac_cv_prog_cc_static='-non_shared'
790
case "$cc_basename" in
792
ac_cv_prog_cc_pic='-fPIC'
799
case "$cc_basename" in
801
# Sun C++ 4.2, 5.x and Centerline C++
802
ac_cv_prog_cc_pic='-KPIC'
803
ac_cv_prog_cc_static='-Bstatic'
804
ac_cv_prog_cc_wl='-Qoption ld '
807
# Green Hills C++ Compiler
808
ac_cv_prog_cc_pic='-PIC'
815
case "$cc_basename" in
818
ac_cv_prog_cc_pic='-pic'
819
ac_cv_prog_cc_static='-Bstatic'
823
ac_cv_prog_cc_pic='-pic'
830
case "$cc_basename" in
832
# NonStop-UX NCC 3.20
833
ac_cv_prog_cc_pic='-KPIC'
844
ac_cv_prog_cc_can_build_shared=no
848
ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
851
# Figure out "hidden" C++ library dependencies from verbose
852
# compiler output whening linking a shared library.
853
cat > conftest.$ac_ext <<EOF
857
Foo (void) { a = 0; }
864
if (eval $ac_compile) 2>&5; then
865
# Parse the compiler output and extract the necessary
866
# objects, libraries and library flags.
868
# Sentinel used to keep track of whether or not we are before
869
# the conftest object file.
870
pre_test_object_deps_done=no
872
for p in `eval $output_verbose_link_cmds`; do
877
# Some compilers place space between "-{L,R}" and the path.
880
|| test $p = "-R"; then
887
if test "$pre_test_object_deps_done" = no; then
890
# Internal compiler library paths should come after those
891
# provided the user. The postdeps already come after the
892
# user supplied libs so there is no need to process them.
893
if test -z "$compiler_lib_search_path"; then
894
compiler_lib_search_path="${prev}${p}"
896
compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
899
# The "-l" case would never come before the object being
900
# linked, so don't bother handling this case.
904
if test "x$remove_lgcc" = "xyes" ; then
909
if test -n "$add" ; then
910
if test -z "$postdeps"; then
913
postdeps="${postdeps} ${add}"
920
# This assumes that the test object file only shows up
921
# once in the compiler output.
922
if test "$p" = "conftest.$objext"; then
923
pre_test_object_deps_done=yes
927
if test "$pre_test_object_deps_done" = no; then
928
if test -z "$predep_objects"; then
931
predep_objects="$predep_objects $p"
934
if test -z "$postdep_objects"; then
937
postdep_objects="$postdep_objects $p"
942
*) ;; # Ignore the rest.
950
echo "ltcf-cxx.sh: error: problem compiling test program"
953
$rm -f confest.$objext
955
if test "x$skip_need_lc_check" = "xyes" ; then
958
case " $postdeps " in
959
*" -lc "*) need_lc=no ;;