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