2003-12-09 Michael Koch <konqueror@gmx.de>
[official-gcc.git] / ltcf-c.sh
blob2c51fd3d55c655bdd9e8cac827df79230d965658
1 #### This script is meant to be sourced by ltconfig.
3 # ltcf-c.sh - Create a C compiler specific configuration
5 # Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This file is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
28 # Source file extension for C test sources.
29 ac_ext=c
31 # Object file extension for compiled C test sources.
32 objext=o
34 # Code to be used in simple compile tests
35 lt_simple_compile_test_code="int some_variable = 0;"
37 # Code to be used in simple link tests
38 lt_simple_link_test_code='main(){return(0);}'
40 ## Linker Characteristics
41 case $host_os in
42 cygwin* | mingw*)
43 # FIXME: the MSVC++ port hasn't been tested in a loooong time
44 # When not using gcc, we currently assume that we are using
45 # Microsoft Visual C++.
46 if test "$with_gcc" != yes; then
47 with_gnu_ld=no
51 esac
53 ld_shlibs=yes
54 if test "$with_gnu_ld" = yes; then
55 # If archive_cmds runs LD, not CC, wlarc should be empty
56 wlarc='${wl}'
58 # See if GNU ld supports shared libraries.
59 case $host_os in
60 aix3* | aix4* | aix5*)
61 # On AIX/PPC, the GNU linker is very broken
62 if test "$host_cpu" != ia64; then
63 ld_shlibs=no
64 cat <<EOF 1>&2
66 *** Warning: the GNU linker, at least up to release 2.9.1, is reported
67 *** to be unable to reliably create shared libraries on AIX.
68 *** Therefore, libtool is disabling shared libraries support. If you
69 *** really care for shared libraries, you may want to modify your PATH
70 *** so that a non-GNU linker is found, and then restart.
72 EOF
76 amigaos*)
77 archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
78 hardcode_libdir_flag_spec='-L$libdir'
79 hardcode_minus_L=yes
81 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
82 # that the semantics of dynamic libraries on AmigaOS, at least up
83 # to version 4, is to share data among multiple programs linked
84 # with the same dynamic library. Since this doesn't match the
85 # behavior of shared libraries on other platforms, we can use
86 # them.
87 ld_shlibs=no
90 beos*)
91 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
92 allow_undefined_flag=unsupported
93 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
94 # support --undefined. This deserves some investigation. FIXME
95 archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
96 else
97 ld_shlibs=no
101 cygwin* | mingw*)
102 # hardcode_libdir_flag_spec is actually meaningless, as there is
103 # no search path for DLLs.
104 hardcode_libdir_flag_spec='-L$libdir'
105 allow_undefined_flag=unsupported
106 always_export_symbols=yes
108 extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
109 sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
110 test -f $output_objdir/impgen.exe || (cd $output_objdir && \
111 if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \
112 else $CC -o impgen impgen.c ; fi)~
113 $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
115 old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
117 # cygwin and mingw dlls have different entry points and sets of symbols
118 # to exclude.
119 # FIXME: what about values for MSVC?
120 dll_entry=__cygwin_dll_entry@12
121 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
122 case $host_os in
123 mingw*)
124 # mingw values
125 dll_entry=_DllMainCRTStartup@12
126 dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
128 esac
130 # mingw and cygwin differ, and it's simplest to just exclude the union
131 # of the two symbol sets.
132 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
134 # recent cygwin and mingw systems supply a stub DllMain which the user
135 # can override, but on older systems we have to supply one (in ltdll.c)
136 if test "x$lt_cv_need_dllmain" = "xyes"; then
137 ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
138 ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
139 test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
140 else
141 ltdll_obj=
142 ltdll_cmds=
145 # Extract the symbol export list from an `--export-all' def file,
146 # then regenerate the def file from the symbol export list, so that
147 # the compiled dll only exports the symbol export list.
148 # Be careful not to strip the DATA tag left be newer dlltools.
149 export_symbols_cmds="$ltdll_cmds"'
150 $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
151 sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
153 # If the export-symbols file already is a .def file (1st line
154 # is EXPORTS), use it as is.
155 # If DATA tags from a recent dlltool are present, honour them!
156 archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
157 cp $export_symbols $output_objdir/$soname-def;
158 else
159 echo EXPORTS > $output_objdir/$soname-def;
160 _lt_hint=1;
161 cat $export_symbols | while read symbol; do
162 set dummy \$symbol;
163 case \[$]# in
164 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
165 *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
166 esac;
167 _lt_hint=`expr 1 + \$_lt_hint`;
168 done;
170 '"$ltdll_cmds"'
171 $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
172 $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
173 $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
174 $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
175 $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
178 netbsd*)
179 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
180 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
181 wlarc=
182 else
183 archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
184 archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
188 solaris* | sysv5*)
189 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
190 ld_shlibs=no
191 cat <<EOF 1>&2
193 *** Warning: The releases 2.8.* of the GNU linker cannot reliably
194 *** create shared libraries on Solaris systems. Therefore, libtool
195 *** is disabling shared libraries support. We urge you to upgrade GNU
196 *** binutils to release 2.9.1 or newer. Another option is to modify
197 *** your PATH or compiler configuration so that the native linker is
198 *** used, and then restart.
201 elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
202 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
203 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
204 else
205 ld_shlibs=no
209 sunos4*)
210 archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
211 wlarc=
212 hardcode_direct=yes
213 hardcode_shlibpath_var=no
217 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
218 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
219 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
220 else
221 ld_shlibs=no
224 esac
226 if test "$ld_shlibs" = yes; then
227 runpath_var=LD_RUN_PATH
228 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
229 export_dynamic_flag_spec='${wl}--export-dynamic'
230 case $host_os in
231 cygwin* | mingw*)
232 # dlltool doesn't understand --whole-archive et. al.
233 whole_archive_flag_spec=
236 # ancient GNU ld didn't support --whole-archive et. al.
237 if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
238 whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
239 else
240 whole_archive_flag_spec=
243 esac
245 else
246 # PORTME fill in a description of your system's linker (not GNU ld)
247 case $host_os in
248 aix3*)
249 allow_undefined_flag=unsupported
250 always_export_symbols=yes
251 archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
252 # Note: this linker hardcodes the directories in LIBPATH if there
253 # are no directories specified by -L.
254 hardcode_minus_L=yes
255 if test "$with_gcc" = yes && test -z "$link_static_flag"; then
256 # Neither direct hardcoding nor static linking is supported with a
257 # broken collect2.
258 hardcode_direct=unsupported
262 aix4* | aix5*)
263 hardcode_direct=yes
264 hardcode_libdir_separator=':'
265 link_all_deplibs=yes
266 # When large executables or shared objects are built, AIX ld can
267 # have problems creating the table of contents. If linking a library
268 # or program results in "error TOC overflow" add -mminimal-toc to
269 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
270 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
271 if test "$with_gcc" = yes; then
272 case $host_os in aix4.[012]|aix4.[012].*)
273 # We only want to do this on AIX 4.2 and lower, the check
274 # below for broken collect2 doesn't work under 4.3+
275 collect2name=`${CC} -print-prog-name=collect2`
276 if test -f "$collect2name" && \
277 strings "$collect2name" | grep resolve_lib_name >/dev/null
278 then
279 # We have reworked collect2
280 hardcode_direct=yes
281 else
282 # We have old collect2
283 hardcode_direct=unsupported
284 # It fails to find uninstalled libraries when the uninstalled
285 # path is not listed in the libpath. Setting hardcode_minus_L
286 # to unsupported forces relinking
287 hardcode_minus_L=yes
288 hardcode_libdir_flag_spec='-L$libdir'
289 hardcode_libdir_separator=
291 esac
292 shared_flag='-shared'
293 else
294 # not using gcc
295 if test "$host_cpu" = ia64; then
296 shared_flag='${wl}-G'
297 else
298 shared_flag='${wl}-bM:SRE'
302 if test "$host_cpu" = ia64; then
303 # On IA64, the linker does run time linking by default, so we don't
304 # have to do anything special.
305 aix_use_runtimelinking=no
306 if test $with_gnu_ld = no; then
307 exp_sym_flag='-Bexport'
308 no_entry_flag=""
310 else
311 # Test if we are trying to use run time linking, or normal AIX style linking.
312 # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
313 aix_use_runtimelinking=no
314 for ld_flag in $LDFLAGS; do
315 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
316 aix_use_runtimelinking=yes
317 break
319 done
320 exp_sym_flag='-bexport'
321 no_entry_flag='-bnoentry'
323 # -bexpall does not export symbols beginning with underscore (_)
324 always_export_symbols=yes
325 if test "$aix_use_runtimelinking" = yes; then
326 # Warning - without using the other run time loading flags (-brtl), -berok will
327 # link without error, but may produce a broken library.
328 allow_undefined_flag=' ${wl}-berok'
329 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
330 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
331 else
332 if test "$host_cpu" = ia64; then
333 if test $with_gnu_ld = no; then
334 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
335 allow_undefined_flag="-z nodefs"
336 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"
338 else
339 allow_undefined_flag=' ${wl}-berok'
340 # -bexpall does not export symbols beginning with underscore (_)
341 always_export_symbols=yes
342 # Exported symbols can be pulled into shared objects from archives
343 whole_archive_flag_spec=' '
344 build_libtool_need_lc=yes
345 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
346 # This is similar to how AIX traditionally builds it's shared libraries.
347 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'
352 amigaos*)
353 archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
354 hardcode_libdir_flag_spec='-L$libdir'
355 hardcode_minus_L=yes
356 # see comment about different semantics on the GNU ld section
357 ld_shlibs=no
360 cygwin* | mingw*)
361 # When not using gcc, we currently assume that we are using
362 # Microsoft Visual C++.
363 # hardcode_libdir_flag_spec is actually meaningless, as there is
364 # no search path for DLLs.
365 hardcode_libdir_flag_spec=' '
366 allow_undefined_flag=unsupported
367 # Tell ltmain to make .lib files, not .a files.
368 libext=lib
369 # FIXME: Setting linknames here is a bad hack.
370 archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
371 # The linker will automatically build a .lib file if we build a DLL.
372 old_archive_from_new_cmds='true'
373 # FIXME: Should let the user specify the lib program.
374 old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
375 fix_srcfile_path='`cygpath -w "$srcfile"`'
378 darwin* | rhapsody*)
379 case "$host_os" in
380 rhapsody* | darwin1.[[012]])
381 allow_undefined_flag='-undefined suppress'
383 *) # Darwin 1.3 on
384 if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
385 allow_undefined_flag='-flat_namespace -undefined suppress'
386 else
387 case ${MACOSX_DEPLOYMENT_TARGET} in
388 10.[[012]])
389 allow_undefined_flag='-flat_namespace -undefined suppress'
391 10.*)
392 allow_undefined_flag='-undefined dynamic_lookup'
394 esac
397 esac
398 # Disable shared library build on OS-X older than 10.3.
399 case $host_os in
400 darwin[1-6]*)
401 can_build_shared=no
403 darwin7*)
404 can_build_shared=yes
406 esac
407 output_verbose_link_cmd='echo'
408 archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
409 module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
410 # Don't fix this by using the ld -exported_symbols_list flag,
411 # it doesn't exist in older darwin ld's
412 archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
413 module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
414 hardcode_direct=no
415 hardcode_automatic=yes
416 hardcode_shlibpath_var=unsupported
417 whole_archive_flag_spec='-all_load $convenience'
418 link_all_deplibs=yes
421 freebsd1*)
422 ld_shlibs=no
425 # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
426 # support. Future versions do this automatically, but an explicit c++rt0.o
427 # does not break anything, and helps significantly (at the cost of a little
428 # extra space).
429 freebsd2.2*)
430 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
431 hardcode_libdir_flag_spec='-R$libdir'
432 hardcode_direct=yes
433 hardcode_shlibpath_var=no
436 # Unfortunately, older versions of FreeBSD 2 do not have this feature.
437 freebsd2*)
438 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
439 hardcode_direct=yes
440 hardcode_minus_L=yes
441 hardcode_shlibpath_var=no
444 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
445 freebsd*)
446 archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
447 hardcode_libdir_flag_spec='-R$libdir'
448 hardcode_direct=yes
449 hardcode_shlibpath_var=no
452 hpux9* | hpux10* | hpux11*)
453 case "$host_cpu" in
454 ia64*)
455 hardcode_direct=no
456 hardcode_shlibpath_var=no
457 archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
458 hardcode_libdir_flag_spec='-L$libdir' ;;
460 if test $with_gcc = yes; then
461 case "$host_os" in
462 hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
463 *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;;
464 esac
465 else
466 case $host_os in
467 hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
468 *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
469 esac
471 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
472 hardcode_libdir_separator=:
473 hardcode_minus_L=yes # Not in the search PATH, but as the default
474 # location of the library.
476 esac
477 export_dynamic_flag_spec='${wl}-E'
478 hardcode_direct=yes
481 irix5* | irix6*)
482 if test "$with_gcc" = yes; then
483 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
484 else
485 archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
487 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
488 hardcode_libdir_separator=:
489 link_all_deplibs=yes
492 netbsd*)
493 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
494 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
495 else
496 archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
498 hardcode_libdir_flag_spec='-R$libdir'
499 hardcode_direct=yes
500 hardcode_shlibpath_var=no
503 newsos6)
504 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
505 hardcode_direct=yes
506 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
507 hardcode_libdir_separator=:
508 hardcode_shlibpath_var=no
511 openbsd*)
512 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
513 hardcode_libdir_flag_spec='-R$libdir'
514 hardcode_direct=yes
515 hardcode_shlibpath_var=no
518 os2*)
519 hardcode_libdir_flag_spec='-L$libdir'
520 hardcode_minus_L=yes
521 allow_undefined_flag=unsupported
522 archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
523 old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
526 osf3*)
527 if test "$with_gcc" = yes; then
528 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
529 archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
530 else
531 allow_undefined_flag=' -expect_unresolved \*'
532 archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
534 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
535 hardcode_libdir_separator=:
538 osf4* | osf5*) # as osf3* with the addition of -msym flag
539 if test "$with_gcc" = yes; then
540 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
541 archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $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'
542 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
543 else
544 allow_undefined_flag=' -expect_unresolved \*'
545 archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
546 archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
547 $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
549 # cc supports -rpath directly
550 hardcode_libdir_flag_spec='-rpath $libdir'
552 hardcode_libdir_separator=:
555 sco3.2v5*)
556 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
557 hardcode_shlibpath_var=no
558 runpath_var=LD_RUN_PATH
559 hardcode_runpath_var=yes
562 solaris*)
563 no_undefined_flag=' -z defs'
564 if test "$with_gcc" = yes; then
565 archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
566 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
567 $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
568 else
569 archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
570 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
571 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
573 hardcode_libdir_flag_spec='-R$libdir'
574 hardcode_shlibpath_var=no
575 case $host_os in
576 solaris2.[0-5] | solaris2.[0-5].*) ;;
577 *) # Supported since Solaris 2.6 (maybe 2.5.1?)
578 whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
579 esac
580 link_all_deplibs=yes
583 sunos4*)
584 archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
585 hardcode_libdir_flag_spec='-L$libdir'
586 hardcode_direct=yes
587 hardcode_minus_L=yes
588 hardcode_shlibpath_var=no
591 sysv4)
592 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
593 runpath_var='LD_RUN_PATH'
594 hardcode_shlibpath_var=no
595 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
598 sysv4.3*)
599 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
600 hardcode_shlibpath_var=no
601 export_dynamic_flag_spec='-Bexport'
604 sysv5*)
605 no_undefined_flag=' -z text'
606 # $CC -shared without GNU ld will not create a library from C++
607 # object files and a static libstdc++, better avoid it by now
608 archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
609 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
610 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
611 hardcode_libdir_flag_spec=
612 hardcode_shlibpath_var=no
613 runpath_var='LD_RUN_PATH'
616 uts4*)
617 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
618 hardcode_libdir_flag_spec='-L$libdir'
619 hardcode_shlibpath_var=no
622 dgux*)
623 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
624 hardcode_libdir_flag_spec='-L$libdir'
625 hardcode_shlibpath_var=no
628 sysv4*MP*)
629 if test -d /usr/nec; then
630 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
631 hardcode_shlibpath_var=no
632 runpath_var=LD_RUN_PATH
633 hardcode_runpath_var=yes
634 ld_shlibs=yes
638 sysv4.2uw2*)
639 archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
640 hardcode_direct=yes
641 hardcode_minus_L=no
642 hardcode_shlibpath_var=no
643 hardcode_runpath_var=yes
644 runpath_var=LD_RUN_PATH
647 sysv5uw7* | unixware7*)
648 no_undefined_flag='${wl}-z ${wl}text'
649 if test "$GCC" = yes; then
650 archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
651 else
652 archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
654 runpath_var='LD_RUN_PATH'
655 hardcode_shlibpath_var=no
659 ld_shlibs=no
661 esac
664 ## Compiler Characteristics: PIC flags, static flags, etc
665 if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
667 else
668 ac_cv_prog_cc_pic=
669 ac_cv_prog_cc_shlib=
670 ac_cv_prog_cc_wl=
671 ac_cv_prog_cc_static=
672 ac_cv_prog_cc_no_builtin=
673 ac_cv_prog_cc_can_build_shared=$can_build_shared
675 if test "$with_gcc" = yes; then
676 ac_cv_prog_cc_wl='-Wl,'
677 ac_cv_prog_cc_static='-static'
679 case $host_os in
680 aix*)
681 # All AIX code is PIC.
682 if test "$host_cpu" = ia64; then
683 # AIX 5 now supports IA64 processor
684 lt_cv_prog_cc_static='-Bstatic'
685 else
686 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
689 amigaos*)
690 # FIXME: we need at least 68020 code to build shared libraries, but
691 # adding the `-m68020' flag to GCC prevents building anything better,
692 # like `-m68040'.
693 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
695 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
696 # PIC is the default for these OSes.
698 cygwin* | mingw* | os2*)
699 # This hack is so that the source file can tell whether it is being
700 # built for inclusion in a dll (and should export symbols for example).
701 ac_cv_prog_cc_pic='-DDLL_EXPORT'
703 darwin* | rhapsody*)
704 # PIC is the default on this platform
705 # Common symbols not allowed in MH_DYLIB files
706 ac_cv_prog_cc_pic='-fno-common'
708 *djgpp*)
709 # DJGPP does not support shared libraries at all
710 ac_cv_prog_cc_pic=
712 sysv4*MP*)
713 if test -d /usr/nec; then
714 ac_cv_prog_cc_pic=-Kconform_pic
718 ac_cv_prog_cc_pic='-fPIC'
720 esac
721 else
722 # PORTME Check for PIC flags for the system compiler.
723 case $host_os in
724 aix*)
725 # All AIX code is PIC.
726 ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
729 hpux9* | hpux10* | hpux11*)
730 # Is there a better ac_cv_prog_cc_static that works with the bundled CC?
731 ac_cv_prog_cc_wl='-Wl,'
732 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
733 ac_cv_prog_cc_pic='+Z'
736 irix5* | irix6*)
737 ac_cv_prog_cc_wl='-Wl,'
738 ac_cv_prog_cc_static='-non_shared'
739 # PIC (with -KPIC) is the default.
742 cygwin* | mingw* | os2*)
743 # This hack is so that the source file can tell whether it is being
744 # built for inclusion in a dll (and should export symbols for example).
745 ac_cv_prog_cc_pic='-DDLL_EXPORT'
748 newsos6)
749 ac_cv_prog_cc_pic='-KPIC'
750 ac_cv_prog_cc_static='-Bstatic'
753 osf3* | osf4* | osf5*)
754 # All OSF/1 code is PIC.
755 ac_cv_prog_cc_wl='-Wl,'
756 ac_cv_prog_cc_static='-non_shared'
759 sco3.2v5*)
760 ac_cv_prog_cc_pic='-Kpic'
761 ac_cv_prog_cc_static='-dn'
762 ac_cv_prog_cc_shlib='-belf'
765 solaris*)
766 ac_cv_prog_cc_pic='-KPIC'
767 ac_cv_prog_cc_static='-Bstatic'
768 ac_cv_prog_cc_wl='-Wl,'
771 sunos4*)
772 ac_cv_prog_cc_pic='-PIC'
773 ac_cv_prog_cc_static='-Bstatic'
774 ac_cv_prog_cc_wl='-Qoption ld '
777 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
778 ac_cv_prog_cc_pic='-KPIC'
779 ac_cv_prog_cc_static='-Bstatic'
780 ac_cv_prog_cc_wl='-Wl,'
783 uts4*)
784 ac_cv_prog_cc_pic='-pic'
785 ac_cv_prog_cc_static='-Bstatic'
788 sysv4*MP*)
789 if test -d /usr/nec ;then
790 ac_cv_prog_cc_pic='-Kconform_pic'
791 ac_cv_prog_cc_static='-Bstatic'
796 ac_cv_prog_cc_can_build_shared=no
798 esac
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=
807 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
809 esac
812 need_lc=yes
813 if test "$enable_shared" = yes && test "$with_gcc" = yes; then
814 case $archive_cmds in
815 *'~'*)
816 # FIXME: we may have to deal with multi-command sequences.
818 '$CC '*)
819 # Test whether the compiler implicitly links with -lc since on some
820 # systems, -lgcc has to come before -lc. If gcc already passes -lc
821 # to ld, don't add -lc before -lgcc.
822 echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
823 if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
824 echo $ac_n "(cached) $ac_c" 1>&6
825 need_lc=$ac_cv_archive_cmds_needs_lc
826 else
827 $rm conftest*
828 echo "static int dummy;" > conftest.$ac_ext
829 if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
830 # Append any warnings to the config.log.
831 cat conftest.err 1>&5
832 soname=conftest
833 lib=conftest
834 libobjs=conftest.$objext
835 deplibs=
836 wl=$ac_cv_prog_cc_wl
837 compiler_flags=-v
838 linker_flags=-v
839 verstring=
840 output_objdir=.
841 libname=conftest
842 save_allow_undefined_flag=$allow_undefined_flag
843 allow_undefined_flag=
844 if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
845 need_lc=no
847 allow_undefined_flag=$save_allow_undefined_flag
848 else
849 cat conftest.err 1>&5
852 $rm conftest*
853 echo "$ac_t$need_lc" 1>&6
855 esac
857 ac_cv_archive_cmds_needs_lc=$need_lc