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