]>
Commit | Line | Data |
---|---|---|
be98a80a ILT |
1 | #### This script is meant to be sourced by ltconfig. |
2 | ||
3 | # ltcf-cxx.sh - Create a C++ compiler specific configuration | |
4 | # | |
7487e485 | 5 | # Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc. |
be98a80a ILT |
6 | # Originally by Gordon Matzigkeit <[email protected]>, 1996 |
7 | # | |
8 | # Original C++ support by:Gary V. Vaughan <[email protected]> | |
9 | # Alexandre Oliva <[email protected]> | |
10 | # Ossama Othman <[email protected]> | |
11 | # Thomas Thanner <[email protected]> | |
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. | |
6be7c12c | 109 | output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' |
be98a80a ILT |
110 | |
111 | else | |
112 | with_gcc=no | |
113 | with_gnu_ld=no | |
114 | wlarc= | |
115 | fi | |
116 | ||
be98a80a | 117 | # PORTME: fill in a description of your system's C++ link characteristics |
469b781c | 118 | case $host_os in |
be98a80a ILT |
119 | aix3*) |
120 | # FIXME: insert proper C++ library support | |
121 | ld_shlibs=no | |
122 | ;; | |
469b781c AO |
123 | aix4* | aix5*) |
124 | archive_cmds='' | |
125 | hardcode_direct=yes | |
126 | hardcode_libdir_separator=':' | |
127 | link_all_deplibs=yes | |
128 | # When large executables or shared objects are built, AIX ld can | |
129 | # have problems creating the table of contents. If linking a library | |
130 | # or program results in "error TOC overflow" add -mminimal-toc to | |
131 | # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not | |
132 | # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. | |
133 | if test "$with_gcc" = yes; then | |
134 | case $host_os in aix4.[012]|aix4.[012].*) | |
135 | # We only want to do this on AIX 4.2 and lower, the check | |
136 | # below for broken collect2 doesn't work under 4.3+ | |
137 | collect2name=`${CC} -print-prog-name=collect2` | |
138 | if test -f "$collect2name" && \ | |
139 | strings "$collect2name" | grep resolve_lib_name >/dev/null | |
140 | then | |
141 | # We have reworked collect2 | |
142 | hardcode_direct=yes | |
143 | else | |
144 | # We have old collect2 | |
145 | hardcode_direct=unsupported | |
146 | # It fails to find uninstalled libraries when the uninstalled | |
147 | # path is not listed in the libpath. Setting hardcode_minus_L | |
148 | # to unsupported forces relinking | |
149 | hardcode_minus_L=yes | |
150 | hardcode_libdir_flag_spec='-L$libdir' | |
151 | hardcode_libdir_separator= | |
152 | fi | |
153 | esac | |
154 | shared_flag='-shared' | |
155 | else | |
156 | # not using gcc | |
157 | if test "$host_cpu" = ia64; then | |
158 | shared_flag='${wl}-G' | |
159 | else | |
160 | shared_flag='${wl}-bM:SRE' | |
161 | fi | |
162 | fi | |
163 | ||
164 | if test "$host_cpu" = ia64; then | |
165 | # On IA64, the linker does run time linking by default, so we don't | |
166 | # have to do anything special. | |
167 | aix_use_runtimelinking=no | |
4a02fdb2 JH |
168 | if test $with_gnu_ld = no; then |
169 | exp_sym_flag='-Bexport' | |
170 | no_entry_flag="" | |
171 | fi | |
469b781c AO |
172 | else |
173 | # Test if we are trying to use run time linking, or normal AIX style linking. | |
174 | # If -brtl is somewhere in LDFLAGS, we need to do run time linking. | |
175 | aix_use_runtimelinking=no | |
176 | for ld_flag in $LDFLAGS; do | |
177 | if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then | |
178 | aix_use_runtimelinking=yes | |
179 | break | |
180 | fi | |
181 | done | |
182 | exp_sym_flag='-bexport' | |
183 | no_entry_flag='-bnoentry' | |
184 | fi | |
185 | # It seems that -bexpall does not export symbols beginning with | |
186 | # underscore (_), so it is better to generate a list of symbols to export. | |
be98a80a | 187 | always_export_symbols=yes |
469b781c AO |
188 | if test "$aix_use_runtimelinking" = yes; then |
189 | hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' | |
190 | allow_undefined_flag=' -Wl,-G' | |
191 | archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}-brtl \${wl}$exp_sym_flag:\$export_symbols" | |
192 | else | |
193 | if test "$host_cpu" = ia64; then | |
4a02fdb2 JH |
194 | if test $with_gnu_ld = no; then |
195 | hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' | |
196 | allow_undefined_flag="-z nodefs" | |
197 | archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" | |
198 | fi | |
469b781c AO |
199 | else |
200 | hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' | |
201 | # Warning - without using the other run time loading flags, -berok will | |
202 | # link without error, but may produce a broken library. | |
18611226 AO |
203 | no_undefined_flag=' ${wl}-bnoerok' |
204 | allow_undefined_flag=' ${wl}-berok' | |
469b781c AO |
205 | # -bexpall does not export symbols beginning with underscore (_) |
206 | always_export_symbols=yes | |
207 | # Exported symbols can be pulled into shared objects from archives | |
208 | whole_archive_flag_spec=' ' | |
209 | build_libtool_need_lc=yes | |
210 | # This is similar to how AIX traditionally builds it's shared libraries. | |
211 | 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' | |
212 | fi | |
213 | fi | |
be98a80a ILT |
214 | ;; |
215 | chorus*) | |
469b781c | 216 | case $cc_basename in |
be98a80a ILT |
217 | *) |
218 | # FIXME: insert proper C++ library support | |
219 | ld_shlibs=no | |
220 | ;; | |
469b781c | 221 | esac |
be98a80a ILT |
222 | ;; |
223 | dgux*) | |
469b781c | 224 | case $cc_basename in |
be98a80a ILT |
225 | ec++) |
226 | # FIXME: insert proper C++ library support | |
227 | ld_shlibs=no | |
228 | ;; | |
229 | ghcx) | |
230 | # Green Hills C++ Compiler | |
231 | # FIXME: insert proper C++ library support | |
232 | ld_shlibs=no | |
233 | ;; | |
234 | *) | |
235 | # FIXME: insert proper C++ library support | |
236 | ld_shlibs=no | |
237 | ;; | |
238 | esac | |
239 | ;; | |
8cc32590 AO |
240 | freebsd[12]*) |
241 | # C++ shared libraries reported to be fairly broken before switch to ELF | |
be98a80a ILT |
242 | ld_shlibs=no |
243 | ;; | |
8cc32590 AO |
244 | freebsd*) |
245 | # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF | |
246 | # conventions | |
247 | ld_shlibs=yes | |
248 | ;; | |
4a02fdb2 JH |
249 | gnu*) |
250 | ;; | |
be98a80a | 251 | hpux*) |
b5bf43f2 AO |
252 | if test $with_gnu_ld = no; then |
253 | hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' | |
254 | hardcode_libdir_separator=: | |
255 | export_dynamic_flag_spec='${wl}-E' | |
256 | fi | |
469b781c AO |
257 | hardcode_direct=yes |
258 | hardcode_minus_L=yes # Not in the search PATH, but as the default | |
259 | # location of the library. | |
469b781c AO |
260 | |
261 | case $cc_basename in | |
be98a80a ILT |
262 | CC) |
263 | # FIXME: insert proper C++ library support | |
264 | ld_shlibs=no | |
265 | ;; | |
266 | aCC) | |
469b781c | 267 | case $host_os in |
be98a80a ILT |
268 | 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' ;; |
269 | *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; | |
270 | esac | |
be98a80a ILT |
271 | # Commands to make compiler produce verbose output that lists |
272 | # what "hidden" libraries, object files and flags are used when | |
273 | # linking a shared library. | |
274 | # | |
275 | # There doesn't appear to be a way to prevent this compiler from | |
276 | # explicitly linking system object files so we need to strip them | |
277 | # from the output so that they don't get included in the library | |
278 | # dependencies. | |
6be7c12c | 279 | output_verbose_link_cmd='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' |
be98a80a ILT |
280 | ;; |
281 | *) | |
469b781c | 282 | if test $with_gcc = yes; then |
b5bf43f2 AO |
283 | if test $with_gnu_ld = no; then |
284 | case "$host_os" in | |
6be7c12c AO |
285 | hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${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' ;; |
286 | *) archive_cmds='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; | |
b5bf43f2 AO |
287 | esac |
288 | fi | |
469b781c AO |
289 | else |
290 | # FIXME: insert proper C++ library support | |
291 | ld_shlibs=no | |
292 | fi | |
be98a80a ILT |
293 | ;; |
294 | esac | |
295 | ;; | |
296 | irix5* | irix6*) | |
469b781c | 297 | case $cc_basename in |
be98a80a ILT |
298 | CC) |
299 | # SGI C++ | |
300 | 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' | |
301 | ||
302 | # Archives containing C++ object files must be created using | |
303 | # "CC -ar", where "CC" is the IRIX C++ compiler. This is | |
304 | # necessary to make sure instantiated templates are included | |
305 | # in the archive. | |
306 | old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs' | |
307 | ;; | |
308 | *) | |
309 | if test "$with_gcc" = yes; then | |
310 | if test "$with_gnu_ld" = no; then | |
6be7c12c | 311 | archive_cmds='$CC -shared -nostdlib $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' |
be98a80a | 312 | else |
6be7c12c | 313 | archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' |
be98a80a ILT |
314 | fi |
315 | fi | |
316 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' | |
317 | hardcode_libdir_separator=: | |
318 | link_all_deplibs=yes | |
319 | ;; | |
320 | esac | |
321 | ;; | |
322 | linux*) | |
469b781c | 323 | case $cc_basename in |
be98a80a ILT |
324 | KCC) |
325 | # Kuck and Associates, Inc. (KAI) C++ Compiler | |
326 | ||
327 | # KCC will only create a shared library if the output file | |
328 | # ends with ".so" (or ".sl" for HP-UX), so rename the library | |
329 | # to its proper name (with version) after linking. | |
330 | 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' | |
331 | 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' | |
332 | ||
333 | # Commands to make compiler produce verbose output that lists | |
334 | # what "hidden" libraries, object files and flags are used when | |
335 | # linking a shared library. | |
336 | # | |
337 | # There doesn't appear to be a way to prevent this compiler from | |
338 | # explicitly linking system object files so we need to strip them | |
339 | # from the output so that they don't get included in the library | |
340 | # dependencies. | |
6be7c12c | 341 | output_verbose_link_cmd='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' |
be98a80a ILT |
342 | |
343 | hardcode_libdir_flag_spec='${wl}--rpath,$libdir' | |
344 | export_dynamic_flag_spec='${wl}--export-dynamic' | |
345 | ||
346 | # Archives containing C++ object files must be created using | |
347 | # "CC -Bstatic", where "CC" is the KAI C++ compiler. | |
348 | old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs' | |
349 | ;; | |
350 | cxx) | |
351 | # Compaq C++ | |
352 | archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' | |
353 | 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' | |
354 | ||
355 | runpath_var=LD_RUN_PATH | |
356 | hardcode_libdir_flag_spec='-rpath $libdir' | |
357 | hardcode_libdir_separator=: | |
358 | ||
359 | # Commands to make compiler produce verbose output that lists | |
360 | # what "hidden" libraries, object files and flags are used when | |
361 | # linking a shared library. | |
362 | # | |
363 | # There doesn't appear to be a way to prevent this compiler from | |
364 | # explicitly linking system object files so we need to strip them | |
365 | # from the output so that they don't get included in the library | |
366 | # dependencies. | |
6be7c12c | 367 | output_verbose_link_cmd='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' |
be98a80a ILT |
368 | ;; |
369 | esac | |
370 | ;; | |
371 | lynxos*) | |
372 | # FIXME: insert proper C++ library support | |
373 | ld_shlibs=no | |
374 | ;; | |
375 | m88k*) | |
376 | # FIXME: insert proper C++ library support | |
377 | ld_shlibs=no | |
378 | ;; | |
379 | mvs*) | |
469b781c | 380 | case $cc_basename in |
be98a80a ILT |
381 | cxx) |
382 | # FIXME: insert proper C++ library support | |
383 | ld_shlibs=no | |
384 | ;; | |
385 | *) | |
386 | # FIXME: insert proper C++ library support | |
387 | ld_shlibs=no | |
388 | ;; | |
469b781c | 389 | esac |
be98a80a ILT |
390 | ;; |
391 | netbsd*) | |
392 | # NetBSD uses g++ - do we need to do anything? | |
393 | ;; | |
394 | osf3*) | |
469b781c | 395 | case $cc_basename in |
be98a80a ILT |
396 | KCC) |
397 | # Kuck and Associates, Inc. (KAI) C++ Compiler | |
398 | ||
399 | # KCC will only create a shared library if the output file | |
400 | # ends with ".so" (or ".sl" for HP-UX), so rename the library | |
401 | # to its proper name (with version) after linking. | |
402 | 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' | |
403 | ||
404 | hardcode_libdir_flag_spec='${wl}-rpath,$libdir' | |
405 | hardcode_libdir_separator=: | |
406 | ||
407 | # Archives containing C++ object files must be created using | |
408 | # "CC -Bstatic", where "CC" is the KAI C++ compiler. | |
409 | old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs' | |
410 | ||
411 | ;; | |
412 | RCC) | |
413 | # Rational C++ 2.4.1 | |
414 | # FIXME: insert proper C++ library support | |
415 | ld_shlibs=no | |
416 | ;; | |
417 | cxx) | |
418 | allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' | |
419 | 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' | |
420 | ||
421 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' | |
422 | hardcode_libdir_separator=: | |
423 | ||
424 | # Commands to make compiler produce verbose output that lists | |
425 | # what "hidden" libraries, object files and flags are used when | |
426 | # linking a shared library. | |
427 | # | |
428 | # There doesn't appear to be a way to prevent this compiler from | |
429 | # explicitly linking system object files so we need to strip them | |
430 | # from the output so that they don't get included in the library | |
431 | # dependencies. | |
6be7c12c | 432 | output_verbose_link_cmd='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' |
be98a80a ILT |
433 | ;; |
434 | *) | |
e877bb69 AO |
435 | if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then |
436 | allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' | |
437 | 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' | |
438 | ||
439 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' | |
440 | hardcode_libdir_separator=: | |
441 | ||
442 | # Commands to make compiler produce verbose output that lists | |
443 | # what "hidden" libraries, object files and flags are used when | |
444 | # linking a shared library. | |
445 | output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' | |
446 | else | |
447 | # FIXME: insert proper C++ library support | |
448 | ld_shlibs=no | |
449 | fi | |
be98a80a ILT |
450 | ;; |
451 | esac | |
452 | ;; | |
453 | osf4* | osf5*) | |
469b781c | 454 | case $cc_basename in |
be98a80a ILT |
455 | KCC) |
456 | # Kuck and Associates, Inc. (KAI) C++ Compiler | |
457 | ||
458 | # KCC will only create a shared library if the output file | |
459 | # ends with ".so" (or ".sl" for HP-UX), so rename the library | |
460 | # to its proper name (with version) after linking. | |
461 | 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' | |
462 | ||
463 | hardcode_libdir_flag_spec='${wl}-rpath,$libdir' | |
464 | hardcode_libdir_separator=: | |
465 | ||
466 | # Archives containing C++ object files must be created using | |
467 | # the KAI C++ compiler. | |
468 | old_archive_cmds='$CC -o $oldlib $oldobjs' | |
469 | ;; | |
470 | RCC) | |
471 | # Rational C++ 2.4.1 | |
472 | # FIXME: insert proper C++ library support | |
473 | ld_shlibs=no | |
474 | ;; | |
475 | cxx) | |
469b781c AO |
476 | allow_undefined_flag=' -expect_unresolved \*' |
477 | archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' | |
8cc32590 AO |
478 | archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~ |
479 | echo "-hidden">> $lib.exp~ | |
480 | $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ | |
481 | $rm $lib.exp' | |
469b781c AO |
482 | |
483 | hardcode_libdir_flag_spec='-rpath $libdir' | |
be98a80a ILT |
484 | hardcode_libdir_separator=: |
485 | ||
486 | # Commands to make compiler produce verbose output that lists | |
487 | # what "hidden" libraries, object files and flags are used when | |
488 | # linking a shared library. | |
489 | # | |
490 | # There doesn't appear to be a way to prevent this compiler from | |
491 | # explicitly linking system object files so we need to strip them | |
492 | # from the output so that they don't get included in the library | |
493 | # dependencies. | |
6be7c12c | 494 | output_verbose_link_cmd='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' |
be98a80a ILT |
495 | ;; |
496 | *) | |
e877bb69 AO |
497 | if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then |
498 | allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' | |
499 | 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' | |
500 | ||
501 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' | |
502 | hardcode_libdir_separator=: | |
503 | ||
504 | # Commands to make compiler produce verbose output that lists | |
505 | # what "hidden" libraries, object files and flags are used when | |
506 | # linking a shared library. | |
507 | output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' | |
508 | else | |
509 | # FIXME: insert proper C++ library support | |
510 | ld_shlibs=no | |
511 | fi | |
be98a80a ILT |
512 | ;; |
513 | esac | |
514 | ;; | |
515 | psos*) | |
516 | # FIXME: insert proper C++ library support | |
517 | ld_shlibs=no | |
518 | ;; | |
519 | sco*) | |
469b781c | 520 | case $cc_basename in |
be98a80a ILT |
521 | CC) |
522 | # FIXME: insert proper C++ library support | |
523 | ld_shlibs=no | |
524 | ;; | |
525 | *) | |
526 | # FIXME: insert proper C++ library support | |
527 | ld_shlibs=no | |
528 | ;; | |
529 | esac | |
530 | ;; | |
531 | sunos4*) | |
469b781c | 532 | case $cc_basename in |
be98a80a ILT |
533 | CC) |
534 | # Sun C++ 4.x | |
535 | # FIXME: insert proper C++ library support | |
536 | ld_shlibs=no | |
537 | ;; | |
538 | lcc) | |
539 | # Lucid | |
540 | # FIXME: insert proper C++ library support | |
541 | ld_shlibs=no | |
542 | ;; | |
543 | *) | |
544 | # FIXME: insert proper C++ library support | |
545 | ld_shlibs=no | |
546 | ;; | |
547 | esac | |
548 | ;; | |
549 | solaris*) | |
469b781c | 550 | case $cc_basename in |
be98a80a ILT |
551 | CC) |
552 | # Sun C++ 4.2, 5.x and Centerline C++ | |
8cc32590 | 553 | no_undefined_flag=' -zdefs' |
be98a80a ILT |
554 | archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' |
555 | archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ | |
556 | $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' | |
557 | ||
558 | hardcode_libdir_flag_spec='-R$libdir' | |
559 | hardcode_shlibpath_var=no | |
469b781c | 560 | case $host_os in |
be98a80a ILT |
561 | solaris2.[0-5] | solaris2.[0-5].*) ;; |
562 | *) | |
563 | # The C++ compiler is used as linker so we must use $wl | |
564 | # flag to pass the commands to the underlying system | |
565 | # linker. | |
566 | # Supported since Solaris 2.6 (maybe 2.5.1?) | |
567 | whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' | |
568 | ;; | |
569 | esac | |
570 | link_all_deplibs=yes | |
571 | ||
572 | # Commands to make compiler produce verbose output that lists | |
573 | # what "hidden" libraries, object files and flags are used when | |
574 | # linking a shared library. | |
575 | # | |
576 | # There doesn't appear to be a way to prevent this compiler from | |
577 | # explicitly linking system object files so we need to strip them | |
578 | # from the output so that they don't get included in the library | |
579 | # dependencies. | |
6be7c12c | 580 | output_verbose_link_cmd='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' |
be98a80a ILT |
581 | |
582 | # Archives containing C++ object files must be created using | |
583 | # "CC -xar", where "CC" is the Sun C++ compiler. This is | |
584 | # necessary to make sure instantiated templates are included | |
585 | # in the archive. | |
586 | old_archive_cmds='$CC -xar -o $oldlib $oldobjs' | |
587 | ;; | |
588 | gcx) | |
589 | # Green Hills C++ Compiler | |
590 | archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' | |
591 | ||
592 | # The C++ compiler must be used to create the archive. | |
593 | old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs' | |
594 | ;; | |
595 | *) | |
596 | # GNU C++ compiler with Solaris linker | |
597 | if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then | |
8cc32590 | 598 | no_undefined_flag=' ${wl}-z ${wl}defs' |
be98a80a | 599 | if $CC --version | egrep -v '^2\.7' > /dev/null; then |
469b781c | 600 | archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' |
be98a80a | 601 | archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ |
469b781c | 602 | $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' |
be98a80a ILT |
603 | |
604 | # Commands to make compiler produce verbose output that lists | |
605 | # what "hidden" libraries, object files and flags are used when | |
606 | # linking a shared library. | |
6be7c12c | 607 | output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" |
be98a80a ILT |
608 | else |
609 | # g++ 2.7 appears to require `-G' NOT `-shared' on this | |
610 | # platform. | |
469b781c | 611 | archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' |
be98a80a | 612 | archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ |
469b781c | 613 | $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' |
be98a80a ILT |
614 | |
615 | # Commands to make compiler produce verbose output that lists | |
616 | # what "hidden" libraries, object files and flags are used when | |
617 | # linking a shared library. | |
6be7c12c | 618 | output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" |
be98a80a ILT |
619 | fi |
620 | ||
621 | hardcode_libdir_flag_spec='${wl}-R $wl$libdir' | |
622 | fi | |
623 | ;; | |
469b781c | 624 | esac |
be98a80a ILT |
625 | ;; |
626 | tandem*) | |
469b781c | 627 | case $cc_basename in |
be98a80a ILT |
628 | NCC) |
629 | # NonStop-UX NCC 3.20 | |
630 | # FIXME: insert proper C++ library support | |
631 | ld_shlibs=no | |
632 | ;; | |
633 | *) | |
634 | # FIXME: insert proper C++ library support | |
635 | ld_shlibs=no | |
636 | ;; | |
469b781c | 637 | esac |
be98a80a ILT |
638 | ;; |
639 | unixware*) | |
640 | # FIXME: insert proper C++ library support | |
641 | ld_shlibs=no | |
642 | ;; | |
643 | vxworks*) | |
644 | # FIXME: insert proper C++ library support | |
645 | ld_shlibs=no | |
646 | ;; | |
647 | *) | |
648 | # FIXME: insert proper C++ library support | |
649 | ld_shlibs=no | |
650 | ;; | |
651 | esac | |
652 | ||
653 | ||
654 | ## Compiler Characteristics: PIC flags, static flags, etc | |
655 | ||
656 | # We don't use cached values here since only the C compiler | |
657 | # characteristics should be cached. | |
658 | ac_cv_prog_cc_pic= | |
659 | ac_cv_prog_cc_shlib= | |
660 | ac_cv_prog_cc_wl= | |
661 | ac_cv_prog_cc_static= | |
662 | ac_cv_prog_cc_no_builtin= | |
663 | ac_cv_prog_cc_can_build_shared=$can_build_shared | |
664 | ||
8679174d MS |
665 | ac_cv_prog_cc_pic_works= |
666 | ac_cv_prog_cc_static_works= | |
be98a80a ILT |
667 | |
668 | if test "$with_gcc" = yes; then | |
669 | ac_cv_prog_cc_wl='-Wl,' | |
670 | ac_cv_prog_cc_static='-static' | |
671 | ||
469b781c | 672 | case $host_os in |
be98a80a | 673 | aix*) |
469b781c AO |
674 | # All AIX code is PIC. |
675 | if test "$host_cpu" = ia64; then | |
676 | # AIX 5 now supports IA64 processor | |
677 | lt_cv_prog_cc_static='-Bstatic' | |
678 | else | |
679 | lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' | |
680 | fi | |
be98a80a | 681 | ;; |
8cc32590 AO |
682 | amigaos*) |
683 | # FIXME: we need at least 68020 code to build shared libraries, but | |
684 | # adding the `-m68020' flag to GCC prevents building anything better, | |
685 | # like `-m68040'. | |
686 | ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' | |
687 | ;; | |
688 | beos* | irix5* | irix6* | osf3* | osf4* | osf5*) | |
689 | # PIC is the default for these OSes. | |
7389ff65 | 690 | ;; |
be98a80a ILT |
691 | cygwin* | mingw* | os2*) |
692 | # This hack is so that the source file can tell whether it is being | |
693 | # built for inclusion in a dll (and should export symbols for example). | |
694 | ac_cv_prog_cc_pic='-DDLL_EXPORT' | |
695 | ;; | |
8cc32590 AO |
696 | darwin* | rhapsody*) |
697 | # PIC is the default on this platform | |
698 | # Common symbols not allowed in MH_DYLIB files | |
699 | lt_cv_prog_cc_pic='-fno-common' | |
700 | ;; | |
701 | *djgpp*) | |
702 | # DJGPP does not support shared libraries at all | |
703 | ac_cv_prog_cc_pic= | |
be98a80a ILT |
704 | ;; |
705 | sysv4*MP*) | |
706 | if test -d /usr/nec; then | |
707 | ac_cv_prog_cc_pic=-Kconform_pic | |
708 | fi | |
709 | ;; | |
710 | *) | |
711 | ac_cv_prog_cc_pic='-fPIC' | |
712 | ;; | |
713 | esac | |
714 | else | |
469b781c AO |
715 | case $host_os in |
716 | aix4* | aix5*) | |
be98a80a | 717 | # All AIX code is PIC. |
469b781c AO |
718 | if test "$host_cpu" = ia64; then |
719 | # AIX 5 now supports IA64 processor | |
720 | lt_cv_prog_cc_static='-Bstatic' | |
721 | else | |
722 | lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' | |
723 | fi | |
be98a80a ILT |
724 | ;; |
725 | chorus*) | |
469b781c | 726 | case $cc_basename in |
be98a80a ILT |
727 | cxch68) |
728 | # Green Hills C++ Compiler | |
729 | # 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" | |
730 | ;; | |
469b781c | 731 | esac |
be98a80a ILT |
732 | ;; |
733 | dgux*) | |
469b781c | 734 | case $cc_basename in |
be98a80a ILT |
735 | ec++) |
736 | ac_cv_prog_cc_pic='-KPIC' | |
737 | ;; | |
738 | ghcx) | |
739 | # Green Hills C++ Compiler | |
740 | ac_cv_prog_cc_pic='-pic' | |
741 | ;; | |
742 | *) | |
743 | ;; | |
744 | esac | |
745 | ;; | |
746 | freebsd*) | |
747 | # FreeBSD uses GNU C++ | |
748 | ;; | |
4a02fdb2 JH |
749 | gnu*) |
750 | ;; | |
be98a80a | 751 | hpux9* | hpux10* | hpux11*) |
469b781c | 752 | case $cc_basename in |
be98a80a ILT |
753 | CC) |
754 | ac_cv_prog_cc_wl='-Wl,' | |
755 | ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" | |
756 | ac_cv_prog_cc_pic='+Z' | |
757 | ;; | |
758 | aCC) | |
759 | ac_cv_prog_cc_wl='-Wl,' | |
760 | ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" | |
761 | ac_cv_prog_cc_pic='+Z' | |
762 | ;; | |
763 | *) | |
764 | ;; | |
765 | esac | |
766 | ;; | |
767 | irix5* | irix6*) | |
469b781c | 768 | case $cc_basename in |
be98a80a ILT |
769 | CC) |
770 | ac_cv_prog_cc_wl='-Wl,' | |
771 | ac_cv_prog_cc_static='-non_shared' | |
772 | ac_cv_prog_cc_pic='-KPIC' | |
773 | ;; | |
774 | *) | |
775 | ;; | |
776 | esac | |
777 | ;; | |
778 | linux*) | |
469b781c | 779 | case $cc_basename in |
be98a80a ILT |
780 | KCC) |
781 | # KAI C++ Compiler | |
782 | ac_cv_prog_cc_wl='--backend -Wl,' | |
783 | ac_cv_prog_cc_pic='-fPIC' | |
784 | ;; | |
785 | cxx) | |
786 | # Compaq C++ | |
787 | # Make sure the PIC flag is empty. It appears that all Alpha | |
788 | # Linux and Compaq Tru64 Unix objects are PIC. | |
789 | ac_cv_prog_cc_pic= | |
790 | ac_cv_prog_cc_static='-non_shared' | |
791 | ;; | |
792 | *) | |
793 | ;; | |
794 | esac | |
795 | ;; | |
796 | lynxos*) | |
797 | ;; | |
798 | m88k*) | |
799 | ;; | |
800 | mvs*) | |
469b781c | 801 | case $cc_basename in |
be98a80a ILT |
802 | cxx) |
803 | ac_cv_prog_cc_pic='-W c,exportall' | |
804 | ;; | |
805 | *) | |
806 | ;; | |
469b781c | 807 | esac |
be98a80a ILT |
808 | ;; |
809 | netbsd*) | |
810 | ;; | |
811 | osf3* | osf4* | osf5*) | |
469b781c | 812 | case $cc_basename in |
be98a80a ILT |
813 | KCC) |
814 | ac_cv_prog_cc_wl='--backend -Wl,' | |
815 | ;; | |
816 | RCC) | |
817 | # Rational C++ 2.4.1 | |
818 | ac_cv_prog_cc_pic='-pic' | |
819 | ;; | |
820 | cxx) | |
821 | # Digital/Compaq C++ | |
822 | ac_cv_prog_cc_wl='-Wl,' | |
823 | # Make sure the PIC flag is empty. It appears that all Alpha | |
824 | # Linux and Compaq Tru64 Unix objects are PIC. | |
825 | ac_cv_prog_cc_pic= | |
826 | ac_cv_prog_cc_static='-non_shared' | |
827 | ;; | |
828 | *) | |
829 | ;; | |
830 | esac | |
831 | ;; | |
832 | psos*) | |
833 | ;; | |
834 | sco*) | |
469b781c | 835 | case $cc_basename in |
be98a80a ILT |
836 | CC) |
837 | ac_cv_prog_cc_pic='-fPIC' | |
838 | ;; | |
839 | *) | |
840 | ;; | |
841 | esac | |
842 | ;; | |
843 | solaris*) | |
469b781c | 844 | case $cc_basename in |
be98a80a ILT |
845 | CC) |
846 | # Sun C++ 4.2, 5.x and Centerline C++ | |
847 | ac_cv_prog_cc_pic='-KPIC' | |
848 | ac_cv_prog_cc_static='-Bstatic' | |
849 | ac_cv_prog_cc_wl='-Qoption ld ' | |
850 | ;; | |
851 | gcx) | |
852 | # Green Hills C++ Compiler | |
853 | ac_cv_prog_cc_pic='-PIC' | |
854 | ;; | |
855 | *) | |
856 | ;; | |
469b781c | 857 | esac |
be98a80a ILT |
858 | ;; |
859 | sunos4*) | |
469b781c | 860 | case $cc_basename in |
be98a80a ILT |
861 | CC) |
862 | # Sun C++ 4.x | |
863 | ac_cv_prog_cc_pic='-pic' | |
864 | ac_cv_prog_cc_static='-Bstatic' | |
865 | ;; | |
866 | lcc) | |
867 | # Lucid | |
868 | ac_cv_prog_cc_pic='-pic' | |
869 | ;; | |
870 | *) | |
871 | ;; | |
872 | esac | |
873 | ;; | |
874 | tandem*) | |
469b781c | 875 | case $cc_basename in |
be98a80a ILT |
876 | NCC) |
877 | # NonStop-UX NCC 3.20 | |
878 | ac_cv_prog_cc_pic='-KPIC' | |
879 | ;; | |
880 | *) | |
881 | ;; | |
469b781c | 882 | esac |
be98a80a ILT |
883 | ;; |
884 | unixware*) | |
885 | ;; | |
886 | vxworks*) | |
887 | ;; | |
888 | *) | |
889 | ac_cv_prog_cc_can_build_shared=no | |
890 | ;; | |
891 | esac | |
892 | fi | |
7389ff65 AO |
893 | |
894 | case "$host_os" in | |
895 | # Platforms which do not suport PIC and -DPIC is meaningless | |
896 | # on them: | |
897 | *djgpp*) | |
898 | ac_cv_prog_cc_pic= | |
899 | ;; | |
900 | *) | |
901 | ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC" | |
902 | ;; | |
903 | esac | |
be98a80a ILT |
904 | |
905 | ||
906 | # Figure out "hidden" C++ library dependencies from verbose | |
907 | # compiler output whening linking a shared library. | |
908 | cat > conftest.$ac_ext <<EOF | |
909 | class Foo | |
910 | { | |
911 | public: | |
912 | Foo (void) { a = 0; } | |
913 | private: | |
914 | int a; | |
915 | }; | |
916 | EOF | |
917 | ||
918 | ||
4cc5853d | 919 | if (eval $ac_compile) 2>&5; then |
be98a80a ILT |
920 | # Parse the compiler output and extract the necessary |
921 | # objects, libraries and library flags. | |
922 | ||
923 | # Sentinel used to keep track of whether or not we are before | |
924 | # the conftest object file. | |
925 | pre_test_object_deps_done=no | |
926 | ||
6be7c12c | 927 | for p in `eval $output_verbose_link_cmd`; do |
be98a80a ILT |
928 | |
929 | case $p in | |
930 | ||
931 | -L* | -R* | -l*) | |
932 | # Some compilers place space between "-{L,R}" and the path. | |
933 | # Remove the space. | |
934 | if test $p = "-L" \ | |
935 | || test $p = "-R"; then | |
936 | prev=$p | |
937 | continue | |
938 | else | |
939 | prev= | |
940 | fi | |
941 | ||
942 | if test "$pre_test_object_deps_done" = no; then | |
943 | case $p in | |
944 | -L* | -R*) | |
945 | # Internal compiler library paths should come after those | |
946 | # provided the user. The postdeps already come after the | |
947 | # user supplied libs so there is no need to process them. | |
948 | if test -z "$compiler_lib_search_path"; then | |
949 | compiler_lib_search_path="${prev}${p}" | |
950 | else | |
951 | compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}" | |
952 | fi | |
953 | ;; | |
954 | # The "-l" case would never come before the object being | |
955 | # linked, so don't bother handling this case. | |
956 | esac | |
957 | else | |
958 | if test -z "$postdeps"; then | |
959 | postdeps="${prev}${p}" | |
960 | else | |
961 | postdeps="${postdeps} ${prev}${p}" | |
962 | fi | |
963 | fi | |
964 | ;; | |
965 | ||
966 | *.$objext) | |
967 | # This assumes that the test object file only shows up | |
968 | # once in the compiler output. | |
969 | if test "$p" = "conftest.$objext"; then | |
970 | pre_test_object_deps_done=yes | |
971 | continue | |
972 | fi | |
973 | ||
974 | if test "$pre_test_object_deps_done" = no; then | |
975 | if test -z "$predep_objects"; then | |
976 | predep_objects="$p" | |
977 | else | |
978 | predep_objects="$predep_objects $p" | |
979 | fi | |
980 | else | |
981 | if test -z "$postdep_objects"; then | |
982 | postdep_objects="$p" | |
983 | else | |
984 | postdep_objects="$postdep_objects $p" | |
985 | fi | |
986 | fi | |
987 | ;; | |
988 | ||
989 | *) ;; # Ignore the rest. | |
990 | ||
991 | esac | |
992 | done | |
993 | ||
994 | # Clean up. | |
995 | rm -f a.out | |
996 | else | |
997 | echo "ltcf-cxx.sh: error: problem compiling test program" | |
998 | fi | |
999 | ||
1000 | $rm -f confest.$objext | |
1001 | ||
1002 | case " $postdeps " in | |
1003 | *" -lc "*) need_lc=no ;; | |
1004 | *) need_lc=yes ;; | |
1005 | esac |