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