* ltcf-c.sh (ld_shlibs) [aix5*]: Disable on unknown CPU types.
[deliverable/binutils-gdb.git] / ltcf-cxx.sh
CommitLineData
be98a80a
ILT
1#### This script is meant to be sourced by ltconfig.
2
3# ltcf-cxx.sh - Create a C++ compiler specific configuration
4#
7487e485 5# Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
be98a80a
ILT
6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7#
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>
12#
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.
17#
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.
22#
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.
26#
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.
31
32
33# Source file extension for C++ test sources.
34ac_ext=cc
35
36# Object file extension for compiled C++ test sources.
37objext=o
38
39# Code to be used in simple compile tests
40lt_simple_compile_test_code="int some_variable = 0;"
41
42# Code to be used in simple link tests
43lt_simple_link_test_code='int main(int, char *[]) { return (0); }'
44
45# C++ compiler
46CXX=${CXX-c++}
47
48# ltmain only uses $CC for tagged configurations so make sure $CC is set.
49CC=${CC-"$CXX"}
50CFLAGS=${CFLAGS-"$CXXFLAGS"}
51
52# Allow CC to be a program name with arguments.
53set dummy $CC
54compiler=$2
55cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
56
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!
60cat > conftest.$ac_ext <<EOF
61#ifdef __GNUC__
62 yes;
63#endif
64EOF
65if { 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
67
68 # Set up default GNU C++ configuration
69
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
75
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'
78
79 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
80 export_dynamic_flag_spec='${wl}--export-dynamic'
81
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}'
86
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=
93 fi
94 else
95 with_gnu_ld=no
96 wlarc=
97
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'
104 fi
105
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"'
110
111else
112 with_gcc=no
113 with_gnu_ld=no
114 wlarc=
115fi
116
117# In general, the C++ compiler should always link C++ objects.
118case $target in
119*aix3* | *aix4*)
120 # AIX just has to be different, doesn't it? :-\
121 LD=makeC++SharedLib_r
122 LDFLAGS="$LDFLAGS -p 0"
123 ;;
124*)
125 LD="$CC"
126 LDFLAGS="$LDFLAGS"
127 ;;
128esac
129
130
131# PORTME: fill in a description of your system's C++ link characteristics
132case "$host_os" in
133 aix3*)
134 # FIXME: insert proper C++ library support
135 ld_shlibs=no
7487e485
AO
136
137 # We don't want to build shared libraries on unknown CPU types.
138 case $host_cpu in
139 powerpc | rs6000) ;;
140 *) ld_shlibs=no ;;
141 esac
be98a80a
ILT
142 ;;
143 aix4*)
144 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'
145 # -bexpall does not export symbols beginning with underscore (_)
146 always_export_symbols=yes
147 # Exported symbols can be pulled into shared objects from archives
148 whole_archive_flag_spec=' '
149 build_libtool_need_lc=yes
150 ;;
151 chorus*)
152 case "$cc_basename" in
153 *)
154 # FIXME: insert proper C++ library support
155 ld_shlibs=no
156 ;;
157 esac
158 ;;
159 dgux*)
160 case "$cc_basename" in
161 ec++)
162 # FIXME: insert proper C++ library support
163 ld_shlibs=no
164 ;;
165 ghcx)
166 # Green Hills C++ Compiler
167 # FIXME: insert proper C++ library support
168 ld_shlibs=no
169 ;;
170 *)
171 # FIXME: insert proper C++ library support
172 ld_shlibs=no
173 ;;
174 esac
175 ;;
176 freebsd*)
177 # FreeBSD uses GNU C++ and GNU ld
178 # FIXME: insert proper C++ library support
179 ld_shlibs=no
180 ;;
181 hpux*)
182 case "$cc_basename" in
183 CC)
184 # FIXME: insert proper C++ library support
185 ld_shlibs=no
186 ;;
187 aCC)
188 case "$host_os" in
189 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' ;;
190 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
191 esac
192 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
193 hardcode_libdir_separator=:
194 hardcode_direct=yes
195 hardcode_minus_L=yes # Not in the search PATH, but as the default
196 # location of the library.
197 export_dynamic_flag_spec='${wl}-E'
198
199 # Commands to make compiler produce verbose output that lists
200 # what "hidden" libraries, object files and flags are used when
201 # linking a shared library.
202 #
203 # There doesn't appear to be a way to prevent this compiler from
204 # explicitly linking system object files so we need to strip them
205 # from the output so that they don't get included in the library
206 # dependencies.
207 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'
208 ;;
209 *)
210 # FIXME: insert proper C++ library support
211 ld_shlibs=no
212 ;;
213 esac
214 ;;
215 irix5* | irix6*)
216 case "$cc_basename" in
217 CC)
218 # SGI C++
219 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'
220
221 # Archives containing C++ object files must be created using
222 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
223 # necessary to make sure instantiated templates are included
224 # in the archive.
225 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
226 ;;
227 *)
228 if test "$with_gcc" = yes; then
229 if test "$with_gnu_ld" = no; then
230 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'
231 else
232 archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
233 fi
234 fi
235 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
236 hardcode_libdir_separator=:
237 link_all_deplibs=yes
238 ;;
239 esac
240 ;;
241 linux*)
242 case "$cc_basename" in
243 KCC)
244 # Kuck and Associates, Inc. (KAI) C++ Compiler
245
246 # KCC will only create a shared library if the output file
247 # ends with ".so" (or ".sl" for HP-UX), so rename the library
248 # to its proper name (with version) after linking.
249 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'
250 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'
251
252 # Commands to make compiler produce verbose output that lists
253 # what "hidden" libraries, object files and flags are used when
254 # linking a shared library.
255 #
256 # There doesn't appear to be a way to prevent this compiler from
257 # explicitly linking system object files so we need to strip them
258 # from the output so that they don't get included in the library
259 # dependencies.
260 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'
261
262 hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
263 export_dynamic_flag_spec='${wl}--export-dynamic'
264
265 # Archives containing C++ object files must be created using
266 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
267 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
268 ;;
269 cxx)
270 # Compaq C++
271 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
272 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'
273
274 runpath_var=LD_RUN_PATH
275 hardcode_libdir_flag_spec='-rpath $libdir'
276 hardcode_libdir_separator=:
277
278 # Commands to make compiler produce verbose output that lists
279 # what "hidden" libraries, object files and flags are used when
280 # linking a shared library.
281 #
282 # There doesn't appear to be a way to prevent this compiler from
283 # explicitly linking system object files so we need to strip them
284 # from the output so that they don't get included in the library
285 # dependencies.
286 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'
287 ;;
288 esac
289 ;;
290 lynxos*)
291 # FIXME: insert proper C++ library support
292 ld_shlibs=no
293 ;;
294 m88k*)
295 # FIXME: insert proper C++ library support
296 ld_shlibs=no
297 ;;
298 mvs*)
299 case "$cc_basename" in
300 cxx)
301 # FIXME: insert proper C++ library support
302 ld_shlibs=no
303 ;;
304 *)
305 # FIXME: insert proper C++ library support
306 ld_shlibs=no
307 ;;
308 esac
309 ;;
310 netbsd*)
311 # NetBSD uses g++ - do we need to do anything?
312 ;;
313 osf3*)
314 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
315 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
316 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'
317
318 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
319 hardcode_libdir_separator=:
320
321 # Commands to make compiler produce verbose output that lists
322 # what "hidden" libraries, object files and flags are used when
323 # linking a shared library.
324 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
325 fi
326
327 case "$cc_basename" in
328 KCC)
329 # Kuck and Associates, Inc. (KAI) C++ Compiler
330
331 # KCC will only create a shared library if the output file
332 # ends with ".so" (or ".sl" for HP-UX), so rename the library
333 # to its proper name (with version) after linking.
334 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'
335
336 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
337 hardcode_libdir_separator=:
338
339 # Archives containing C++ object files must be created using
340 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
341 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
342
343 ;;
344 RCC)
345 # Rational C++ 2.4.1
346 # FIXME: insert proper C++ library support
347 ld_shlibs=no
348 ;;
349 cxx)
350 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
351 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'
352
353 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
354 hardcode_libdir_separator=:
355
356 # Commands to make compiler produce verbose output that lists
357 # what "hidden" libraries, object files and flags are used when
358 # linking a shared library.
359 #
360 # There doesn't appear to be a way to prevent this compiler from
361 # explicitly linking system object files so we need to strip them
362 # from the output so that they don't get included in the library
363 # dependencies.
364 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'
365 ;;
366 *)
367 # FIXME: insert proper C++ library support
368 ld_shlibs=no
369 ;;
370 esac
371 ;;
372 osf4* | osf5*)
373 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
374 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
375 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'
376
377 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
378 hardcode_libdir_separator=:
379
380 # Commands to make compiler produce verbose output that lists
381 # what "hidden" libraries, object files and flags are used when
382 # linking a shared library.
383 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
384 fi
385
386 case "$cc_basename" in
387 KCC)
388 # Kuck and Associates, Inc. (KAI) C++ Compiler
389
390 # KCC will only create a shared library if the output file
391 # ends with ".so" (or ".sl" for HP-UX), so rename the library
392 # to its proper name (with version) after linking.
393 archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
394
395 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
396 hardcode_libdir_separator=:
397
398 # Archives containing C++ object files must be created using
399 # the KAI C++ compiler.
400 old_archive_cmds='$CC -o $oldlib $oldobjs'
401 ;;
402 RCC)
403 # Rational C++ 2.4.1
404 # FIXME: insert proper C++ library support
405 ld_shlibs=no
406 ;;
407 cxx)
408 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
409 archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
410
411 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
412 hardcode_libdir_separator=:
413
414 # Commands to make compiler produce verbose output that lists
415 # what "hidden" libraries, object files and flags are used when
416 # linking a shared library.
417 #
418 # There doesn't appear to be a way to prevent this compiler from
419 # explicitly linking system object files so we need to strip them
420 # from the output so that they don't get included in the library
421 # dependencies.
422 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'
423 ;;
424 *)
425 # FIXME: insert proper C++ library support
426 ld_shlibs=no
427 ;;
428 esac
429 ;;
430 psos*)
431 # FIXME: insert proper C++ library support
432 ld_shlibs=no
433 ;;
434 sco*)
435 case "$cc_basename" in
436 CC)
437 # FIXME: insert proper C++ library support
438 ld_shlibs=no
439 ;;
440 *)
441 # FIXME: insert proper C++ library support
442 ld_shlibs=no
443 ;;
444 esac
445 ;;
446 sunos4*)
447 case "$cc_basename" in
448 CC)
449 # Sun C++ 4.x
450 # FIXME: insert proper C++ library support
451 ld_shlibs=no
452 ;;
453 lcc)
454 # Lucid
455 # FIXME: insert proper C++ library support
456 ld_shlibs=no
457 ;;
458 *)
459 # FIXME: insert proper C++ library support
460 ld_shlibs=no
461 ;;
462 esac
463 ;;
464 solaris*)
465 case "$cc_basename" in
466 CC)
467 # Sun C++ 4.2, 5.x and Centerline C++
468 no_undefined_flag=' -ztext'
469 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
470 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
471 $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'
472
473 hardcode_libdir_flag_spec='-R$libdir'
474 hardcode_shlibpath_var=no
475 case "$host_os" in
476 solaris2.[0-5] | solaris2.[0-5].*) ;;
477 *)
478 # The C++ compiler is used as linker so we must use $wl
479 # flag to pass the commands to the underlying system
480 # linker.
481 # Supported since Solaris 2.6 (maybe 2.5.1?)
482 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
483 ;;
484 esac
485 link_all_deplibs=yes
486
487 # Commands to make compiler produce verbose output that lists
488 # what "hidden" libraries, object files and flags are used when
489 # linking a shared library.
490 #
491 # There doesn't appear to be a way to prevent this compiler from
492 # explicitly linking system object files so we need to strip them
493 # from the output so that they don't get included in the library
494 # dependencies.
495 output_verbose_link_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'
496
497 # Archives containing C++ object files must be created using
498 # "CC -xar", where "CC" is the Sun C++ compiler. This is
499 # necessary to make sure instantiated templates are included
500 # in the archive.
501 old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
502 ;;
503 gcx)
504 # Green Hills C++ Compiler
505 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
506
507 # The C++ compiler must be used to create the archive.
508 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
509 ;;
510 *)
511 # GNU C++ compiler with Solaris linker
512 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
513 if $CC --version | egrep -v '^2\.7' > /dev/null; then
514 archive_cmds='$LD -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
515 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
516 $LD -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
517
518 # Commands to make compiler produce verbose output that lists
519 # what "hidden" libraries, object files and flags are used when
520 # linking a shared library.
521 output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
522 else
523 # g++ 2.7 appears to require `-G' NOT `-shared' on this
524 # platform.
525 archive_cmds='$LD -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
526 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
527 $LD -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
528
529 # Commands to make compiler produce verbose output that lists
530 # what "hidden" libraries, object files and flags are used when
531 # linking a shared library.
532 output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
533 fi
534
535 hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
536 fi
537 ;;
538 esac
539 ;;
540 tandem*)
541 case "$cc_basename" in
542 NCC)
543 # NonStop-UX NCC 3.20
544 # FIXME: insert proper C++ library support
545 ld_shlibs=no
546 ;;
547 *)
548 # FIXME: insert proper C++ library support
549 ld_shlibs=no
550 ;;
551 esac
552 ;;
553 unixware*)
554 # FIXME: insert proper C++ library support
555 ld_shlibs=no
556 ;;
557 vxworks*)
558 # FIXME: insert proper C++ library support
559 ld_shlibs=no
560 ;;
561 *)
562 # FIXME: insert proper C++ library support
563 ld_shlibs=no
564 ;;
565esac
566
567
568## Compiler Characteristics: PIC flags, static flags, etc
569
570# We don't use cached values here since only the C compiler
571# characteristics should be cached.
572ac_cv_prog_cc_pic=
573ac_cv_prog_cc_shlib=
574ac_cv_prog_cc_wl=
575ac_cv_prog_cc_static=
576ac_cv_prog_cc_no_builtin=
577ac_cv_prog_cc_can_build_shared=$can_build_shared
578
579# It is not enough to reset these cached values, they must be unset.
580unset ac_cv_prog_cc_pic_works
581unset ac_cv_prog_cc_static_works
582
583if test "$with_gcc" = yes; then
584 ac_cv_prog_cc_wl='-Wl,'
585 ac_cv_prog_cc_static='-static'
586
587 case "$host_os" in
588 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
589 # PIC is the default for these OSes.
590 ;;
591 aix*)
592 # Below there is a dirty hack to force normal static linking with -ldl
593 # The problem is because libdl dynamically linked with both libc and
594 # libC (AIX C++ library), which obviously doesn't included in libraries
595 # list by gcc. This cause undefined symbols with -static flags.
596 # This hack allows C programs to be linked with "-static -ldl", but
597 # we not sure about C++ programs.
598 ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
599 ;;
600 cygwin* | mingw* | os2*)
601 # This hack is so that the source file can tell whether it is being
602 # built for inclusion in a dll (and should export symbols for example).
603 ac_cv_prog_cc_pic='-DDLL_EXPORT'
604 ;;
605 amigaos*)
606 # FIXME: we need at least 68020 code to build shared libraries, but
607 # adding the `-m68020' flag to GCC prevents building anything better,
608 # like `-m68040'.
609 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
610 ;;
611 sysv4*MP*)
612 if test -d /usr/nec; then
613 ac_cv_prog_cc_pic=-Kconform_pic
614 fi
615 ;;
616 *)
617 ac_cv_prog_cc_pic='-fPIC'
618 ;;
619 esac
620else
621 case "$host_os" in
622 aix4*)
623 # All AIX code is PIC.
624 ;;
625 chorus*)
626 case "$cc_basename" in
627 cxch68)
628 # Green Hills C++ Compiler
629 # 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"
630 ;;
631 esac
632 ;;
633 dgux*)
634 case "$cc_basename" in
635 ec++)
636 ac_cv_prog_cc_pic='-KPIC'
637 ;;
638 ghcx)
639 # Green Hills C++ Compiler
640 ac_cv_prog_cc_pic='-pic'
641 ;;
642 *)
643 ;;
644 esac
645 ;;
646 freebsd*)
647 # FreeBSD uses GNU C++
648 ;;
649 hpux9* | hpux10* | hpux11*)
650 case "$cc_basename" in
651 CC)
652 ac_cv_prog_cc_wl='-Wl,'
653 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
654 ac_cv_prog_cc_pic='+Z'
655 ;;
656 aCC)
657 ac_cv_prog_cc_wl='-Wl,'
658 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
659 ac_cv_prog_cc_pic='+Z'
660 ;;
661 *)
662 ;;
663 esac
664 ;;
665 irix5* | irix6*)
666 case "$cc_basename" in
667 CC)
668 ac_cv_prog_cc_wl='-Wl,'
669 ac_cv_prog_cc_static='-non_shared'
670 ac_cv_prog_cc_pic='-KPIC'
671 ;;
672 *)
673 ;;
674 esac
675 ;;
676 linux*)
677 case "$cc_basename" in
678 KCC)
679 # KAI C++ Compiler
680 ac_cv_prog_cc_wl='--backend -Wl,'
681 ac_cv_prog_cc_pic='-fPIC'
682 ;;
683 cxx)
684 # Compaq C++
685 # Make sure the PIC flag is empty. It appears that all Alpha
686 # Linux and Compaq Tru64 Unix objects are PIC.
687 ac_cv_prog_cc_pic=
688 ac_cv_prog_cc_static='-non_shared'
689 ;;
690 *)
691 ;;
692 esac
693 ;;
694 lynxos*)
695 ;;
696 m88k*)
697 ;;
698 mvs*)
699 case "$cc_basename" in
700 cxx)
701 ac_cv_prog_cc_pic='-W c,exportall'
702 ;;
703 *)
704 ;;
705 esac
706 ;;
707 netbsd*)
708 ;;
709 osf3* | osf4* | osf5*)
710 case "$cc_basename" in
711 KCC)
712 ac_cv_prog_cc_wl='--backend -Wl,'
713 ;;
714 RCC)
715 # Rational C++ 2.4.1
716 ac_cv_prog_cc_pic='-pic'
717 ;;
718 cxx)
719 # Digital/Compaq C++
720 ac_cv_prog_cc_wl='-Wl,'
721 # Make sure the PIC flag is empty. It appears that all Alpha
722 # Linux and Compaq Tru64 Unix objects are PIC.
723 ac_cv_prog_cc_pic=
724 ac_cv_prog_cc_static='-non_shared'
725 ;;
726 *)
727 ;;
728 esac
729 ;;
730 psos*)
731 ;;
732 sco*)
733 case "$cc_basename" in
734 CC)
735 ac_cv_prog_cc_pic='-fPIC'
736 ;;
737 *)
738 ;;
739 esac
740 ;;
741 solaris*)
742 case "$cc_basename" in
743 CC)
744 # Sun C++ 4.2, 5.x and Centerline C++
745 ac_cv_prog_cc_pic='-KPIC'
746 ac_cv_prog_cc_static='-Bstatic'
747 ac_cv_prog_cc_wl='-Qoption ld '
748 ;;
749 gcx)
750 # Green Hills C++ Compiler
751 ac_cv_prog_cc_pic='-PIC'
752 ;;
753 *)
754 ;;
755 esac
756 ;;
757 sunos4*)
758 case "$cc_basename" in
759 CC)
760 # Sun C++ 4.x
761 ac_cv_prog_cc_pic='-pic'
762 ac_cv_prog_cc_static='-Bstatic'
763 ;;
764 lcc)
765 # Lucid
766 ac_cv_prog_cc_pic='-pic'
767 ;;
768 *)
769 ;;
770 esac
771 ;;
772 tandem*)
773 case "$cc_basename" in
774 NCC)
775 # NonStop-UX NCC 3.20
776 ac_cv_prog_cc_pic='-KPIC'
777 ;;
778 *)
779 ;;
780 esac
781 ;;
782 unixware*)
783 ;;
784 vxworks*)
785 ;;
786 *)
787 ac_cv_prog_cc_can_build_shared=no
788 ;;
789 esac
790fi
791ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
792
793
794# Figure out "hidden" C++ library dependencies from verbose
795# compiler output whening linking a shared library.
796cat > conftest.$ac_ext <<EOF
797class Foo
798{
799public:
800 Foo (void) { a = 0; }
801private:
802 int a;
803};
804EOF
805
806
807if eval $ac_compile 2>&5; then
808 # Parse the compiler output and extract the necessary
809 # objects, libraries and library flags.
810
811 # Sentinel used to keep track of whether or not we are before
812 # the conftest object file.
813 pre_test_object_deps_done=no
814
815 for p in `eval $output_verbose_link_cmds`; do
816
817 case $p in
818
819 -L* | -R* | -l*)
820 # Some compilers place space between "-{L,R}" and the path.
821 # Remove the space.
822 if test $p = "-L" \
823 || test $p = "-R"; then
824 prev=$p
825 continue
826 else
827 prev=
828 fi
829
830 if test "$pre_test_object_deps_done" = no; then
831 case $p in
832 -L* | -R*)
833 # Internal compiler library paths should come after those
834 # provided the user. The postdeps already come after the
835 # user supplied libs so there is no need to process them.
836 if test -z "$compiler_lib_search_path"; then
837 compiler_lib_search_path="${prev}${p}"
838 else
839 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
840 fi
841 ;;
842 # The "-l" case would never come before the object being
843 # linked, so don't bother handling this case.
844 esac
845 else
846 if test -z "$postdeps"; then
847 postdeps="${prev}${p}"
848 else
849 postdeps="${postdeps} ${prev}${p}"
850 fi
851 fi
852 ;;
853
854 *.$objext)
855 # This assumes that the test object file only shows up
856 # once in the compiler output.
857 if test "$p" = "conftest.$objext"; then
858 pre_test_object_deps_done=yes
859 continue
860 fi
861
862 if test "$pre_test_object_deps_done" = no; then
863 if test -z "$predep_objects"; then
864 predep_objects="$p"
865 else
866 predep_objects="$predep_objects $p"
867 fi
868 else
869 if test -z "$postdep_objects"; then
870 postdep_objects="$p"
871 else
872 postdep_objects="$postdep_objects $p"
873 fi
874 fi
875 ;;
876
877 *) ;; # Ignore the rest.
878
879 esac
880 done
881
882 # Clean up.
883 rm -f a.out
884else
885 echo "ltcf-cxx.sh: error: problem compiling test program"
886fi
887
888$rm -f confest.$objext
889
890case " $postdeps " in
891*" -lc "*) need_lc=no ;;
892*) need_lc=yes ;;
893esac
This page took 0.059002 seconds and 4 git commands to generate.