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