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