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