2001-01-13 Philip Blundell <philb@gnu.org>
[binutils.git] / ltcf-c.sh
blobe57abb1cb2b243ee47c7d4b8b787d3ca36285dfd
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 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*)
61 # On AIX, the GNU linker is very broken
62 ld_shlibs=no
63 cat <<EOF 1>&2
65 *** Warning: the GNU linker, at least up to release 2.9.1, is reported
66 *** to be unable to reliably create shared libraries on AIX.
67 *** Therefore, libtool is disabling shared libraries support. If you
68 *** really care for shared libraries, you may want to modify your PATH
69 *** so that a non-GNU linker is found, and then restart.
71 EOF
74 amigaos*)
75 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)'
76 hardcode_libdir_flag_spec='-L$libdir'
77 hardcode_minus_L=yes
79 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
80 # that the semantics of dynamic libraries on AmigaOS, at least up
81 # to version 4, is to share data among multiple programs linked
82 # with the same dynamic library. Since this doesn't match the
83 # behavior of shared libraries on other platforms, we can use
84 # them.
85 ld_shlibs=no
88 beos*)
89 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
90 allow_undefined_flag=unsupported
91 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
92 # support --undefined. This deserves some investigation. FIXME
93 archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
94 else
95 ld_shlibs=no
99 cygwin* | mingw*)
100 # hardcode_libdir_flag_spec is actually meaningless, as there is
101 # no search path for DLLs.
102 hardcode_libdir_flag_spec='-L$libdir'
103 allow_undefined_flag=unsupported
104 always_export_symbols=yes
106 extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
107 sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
108 test -f $output_objdir/impgen.exe || (cd $output_objdir && \
109 if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
110 else $CC -o impgen impgen.c ; fi)~
111 $output_objdir/impgen $dir/$soname > $output_objdir/$soname-def'
113 old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
115 # cygwin and mingw dlls have different entry points and sets of symbols
116 # to exclude.
117 # FIXME: what about values for MSVC?
118 dll_entry=__cygwin_dll_entry@12
119 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
120 case "$host_os" in
121 mingw*)
122 # mingw values
123 dll_entry=_DllMainCRTStartup@12
124 dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
126 esac
128 # mingw and cygwin differ, and it's simplest to just exclude the union
129 # of the two symbol sets.
130 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
132 # recent cygwin and mingw systems supply a stub DllMain which the user
133 # can override, but on older systems we have to supply one (in ltdll.c)
134 if test "x$lt_cv_need_dllmain" = "xyes"; then
135 ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
136 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~
137 test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
138 else
139 ltdll_obj=
140 ltdll_cmds=
143 # Extract the symbol export list from an `--export-all' def file,
144 # then regenerate the def file from the symbol export list, so that
145 # the compiled dll only exports the symbol export list.
146 # Be careful not to strip the DATA tag left be newer dlltools.
147 export_symbols_cmds="$ltdll_cmds"'
148 $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
149 sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
151 # If DATA tags from a recent dlltool are present, honour them!
152 archive_expsym_cmds='echo EXPORTS > $output_objdir/$soname-def~
153 _lt_hint=1;
154 cat $export_symbols | while read symbol; do
155 set dummy \$symbol;
156 case \$# in
157 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
158 *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
159 esac;
160 _lt_hint=`expr 1 + \$_lt_hint`;
161 done~
162 '"$ltdll_cmds"'
163 $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~
164 $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~
165 $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~
166 $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~
167 $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags'
170 netbsd*)
171 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
172 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
173 wlarc=
174 else
175 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
176 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
180 solaris* | sysv5*)
181 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
182 ld_shlibs=no
183 cat <<EOF 1>&2
185 *** Warning: The releases 2.8.* of the GNU linker cannot reliably
186 *** create shared libraries on Solaris systems. Therefore, libtool
187 *** is disabling shared libraries support. We urge you to upgrade GNU
188 *** binutils to release 2.9.1 or newer. Another option is to modify
189 *** your PATH or compiler configuration so that the native linker is
190 *** used, and then restart.
193 elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
194 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
195 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
196 else
197 ld_shlibs=no
201 sunos4*)
202 archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
203 wlarc=
204 hardcode_direct=yes
205 hardcode_shlibpath_var=no
209 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
210 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
211 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
212 else
213 ld_shlibs=no
216 esac
218 if test "$ld_shlibs" = yes; then
219 runpath_var=LD_RUN_PATH
220 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
221 export_dynamic_flag_spec='${wl}--export-dynamic'
222 case $host_os in
223 cygwin* | mingw*)
224 # dlltool doesn't understand --whole-archive et. al.
225 whole_archive_flag_spec=
228 # ancient GNU ld didn't support --whole-archive et. al.
229 if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
230 whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
231 else
232 whole_archive_flag_spec=
235 esac
237 else
238 # PORTME fill in a description of your system's linker (not GNU ld)
239 case "$host_os" in
240 aix3*)
241 allow_undefined_flag=unsupported
242 always_export_symbols=yes
243 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'
244 # Note: this linker hardcodes the directories in LIBPATH if there
245 # are no directories specified by -L.
246 hardcode_minus_L=yes
247 if test "$with_gcc" = yes && test -z "$link_static_flag"; then
248 # Neither direct hardcoding nor static linking is supported with a
249 # broken collect2.
250 hardcode_direct=unsupported
254 aix4*)
255 hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
256 hardcode_libdir_separator=':'
257 if test "$with_gcc" = yes; then
258 collect2name=`${CC} -print-prog-name=collect2`
259 if test -f "$collect2name" && \
260 strings "$collect2name" | grep resolve_lib_name >/dev/null
261 then
262 # We have reworked collect2
263 hardcode_direct=yes
264 else
265 # We have old collect2
266 hardcode_direct=unsupported
267 # It fails to find uninstalled libraries when the uninstalled
268 # path is not listed in the libpath. Setting hardcode_minus_L
269 # to unsupported forces relinking
270 hardcode_minus_L=yes
271 hardcode_libdir_flag_spec='-L$libdir'
272 hardcode_libdir_separator=
274 shared_flag='-shared'
275 else
276 shared_flag='${wl}-bM:SRE'
277 hardcode_direct=yes
279 allow_undefined_flag=' ${wl}-berok'
280 archive_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
281 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
282 case "$host_os" in aix4.[01]|aix4.[01].*)
283 # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
284 always_export_symbols=yes ;;
285 esac
288 amigaos*)
289 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)'
290 hardcode_libdir_flag_spec='-L$libdir'
291 hardcode_minus_L=yes
292 # see comment about different semantics on the GNU ld section
293 ld_shlibs=no
296 cygwin* | mingw*)
297 # When not using gcc, we currently assume that we are using
298 # Microsoft Visual C++.
299 # hardcode_libdir_flag_spec is actually meaningless, as there is
300 # no search path for DLLs.
301 hardcode_libdir_flag_spec=' '
302 allow_undefined_flag=unsupported
303 # Tell ltmain to make .lib files, not .a files.
304 libext=lib
305 # FIXME: Setting linknames here is a bad hack.
306 archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
307 # The linker will automatically build a .lib file if we build a DLL.
308 old_archive_from_new_cmds='true'
309 # FIXME: Should let the user specify the lib program.
310 old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
311 fix_srcfile_path='`cygpath -w $srcfile`'
314 freebsd1*)
315 ld_shlibs=no
318 # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
319 # support. Future versions do this automatically, but an explicit c++rt0.o
320 # does not break anything, and helps significantly (at the cost of a little
321 # extra space).
322 freebsd2.2*)
323 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
324 hardcode_libdir_flag_spec='-R$libdir'
325 hardcode_direct=yes
326 hardcode_shlibpath_var=no
329 # Unfortunately, older versions of FreeBSD 2 do not have this feature.
330 freebsd2*)
331 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
332 hardcode_direct=yes
333 hardcode_minus_L=yes
334 hardcode_shlibpath_var=no
337 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
338 freebsd*)
339 archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
340 hardcode_libdir_flag_spec='-R$libdir'
341 hardcode_direct=yes
342 hardcode_shlibpath_var=no
345 hpux9* | hpux10* | hpux11*)
346 case "$host_os" in
347 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' ;;
348 *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
349 esac
350 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
351 hardcode_libdir_separator=:
352 hardcode_direct=yes
353 hardcode_minus_L=yes # Not in the search PATH, but as the default
354 # location of the library.
355 export_dynamic_flag_spec='${wl}-E'
358 irix5* | irix6*)
359 if test "$with_gcc" = yes; then
360 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'
361 else
362 archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
364 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
365 hardcode_libdir_separator=:
366 link_all_deplibs=yes
369 netbsd*)
370 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
371 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
372 else
373 archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
375 hardcode_libdir_flag_spec='${wl}-R$libdir'
376 hardcode_direct=yes
377 hardcode_shlibpath_var=no
380 openbsd*)
381 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
382 hardcode_libdir_flag_spec='-R$libdir'
383 hardcode_direct=yes
384 hardcode_shlibpath_var=no
387 os2*)
388 hardcode_libdir_flag_spec='-L$libdir'
389 hardcode_minus_L=yes
390 allow_undefined_flag=unsupported
391 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'
392 old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
395 osf3*)
396 if test "$with_gcc" = yes; then
397 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
398 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'
399 else
400 allow_undefined_flag=' -expect_unresolved \*'
401 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'
403 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
404 hardcode_libdir_separator=:
407 osf4* | osf5*) # as osf3* with the addition of -msym flag
408 if test "$with_gcc" = yes; then
409 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
410 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'
411 else
412 allow_undefined_flag=' -expect_unresolved \*'
413 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'
415 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
416 hardcode_libdir_separator=:
419 sco3.2v5*)
420 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
421 hardcode_shlibpath_var=no
422 runpath_var=LD_RUN_PATH
423 hardcode_runpath_var=yes
426 solaris*)
427 no_undefined_flag=' -z text'
428 # $CC -shared without GNU ld will not create a library from C++
429 # object files and a static libstdc++, better avoid it by now
430 archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
431 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
432 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
433 hardcode_libdir_flag_spec='-R$libdir'
434 hardcode_shlibpath_var=no
435 case "$host_os" in
436 solaris2.[0-5] | solaris2.[0-5].*) ;;
437 *) # Supported since Solaris 2.6 (maybe 2.5.1?)
438 whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
439 esac
440 link_all_deplibs=yes
443 sunos4*)
444 archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
445 hardcode_libdir_flag_spec='-L$libdir'
446 hardcode_direct=yes
447 hardcode_minus_L=yes
448 hardcode_shlibpath_var=no
451 sysv4)
452 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
453 runpath_var='LD_RUN_PATH'
454 hardcode_shlibpath_var=no
455 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
458 sysv4.3*)
459 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
460 hardcode_shlibpath_var=no
461 export_dynamic_flag_spec='-Bexport'
464 sysv5*)
465 no_undefined_flag=' -z text'
466 # $CC -shared without GNU ld will not create a library from C++
467 # object files and a static libstdc++, better avoid it by now
468 archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
469 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
470 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
471 hardcode_libdir_flag_spec=
472 hardcode_shlibpath_var=no
473 runpath_var='LD_RUN_PATH'
476 uts4*)
477 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
478 hardcode_libdir_flag_spec='-L$libdir'
479 hardcode_shlibpath_var=no
482 dgux*)
483 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
484 hardcode_libdir_flag_spec='-L$libdir'
485 hardcode_shlibpath_var=no
488 sysv4*MP*)
489 if test -d /usr/nec; then
490 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
491 hardcode_shlibpath_var=no
492 runpath_var=LD_RUN_PATH
493 hardcode_runpath_var=yes
494 ld_shlibs=yes
498 sysv4.2uw2*)
499 archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
500 hardcode_direct=yes
501 hardcode_minus_L=no
502 hardcode_shlibpath_var=no
503 hardcode_runpath_var=yes
504 runpath_var=LD_RUN_PATH
507 unixware7*)
508 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
509 runpath_var='LD_RUN_PATH'
510 hardcode_shlibpath_var=no
514 ld_shlibs=no
516 esac
519 ## Compiler Characteristics: PIC flags, static flags, etc
520 if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
522 else
523 ac_cv_prog_cc_pic=
524 ac_cv_prog_cc_shlib=
525 ac_cv_prog_cc_wl=
526 ac_cv_prog_cc_static=
527 ac_cv_prog_cc_no_builtin=
528 ac_cv_prog_cc_can_build_shared=$can_build_shared
530 if test "$with_gcc" = yes; then
531 ac_cv_prog_cc_wl='-Wl,'
532 ac_cv_prog_cc_static='-static'
534 case "$host_os" in
535 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
536 # PIC is the default for these OSes.
538 aix*)
539 # Below there is a dirty hack to force normal static linking with -ldl
540 # The problem is because libdl dynamically linked with both libc and
541 # libC (AIX C++ library), which obviously doesn't included in libraries
542 # list by gcc. This cause undefined symbols with -static flags.
543 # This hack allows C programs to be linked with "-static -ldl", but
544 # we not sure about C++ programs.
545 ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
547 cygwin* | mingw* | os2*)
548 # This hack is so that the source file can tell whether it is being
549 # built for inclusion in a dll (and should export symbols for example).
550 ac_cv_prog_cc_pic='-DDLL_EXPORT'
552 amigaos*)
553 # FIXME: we need at least 68020 code to build shared libraries, but
554 # adding the `-m68020' flag to GCC prevents building anything better,
555 # like `-m68040'.
556 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
558 sysv4*MP*)
559 if test -d /usr/nec; then
560 ac_cv_prog_cc_pic=-Kconform_pic
564 ac_cv_prog_cc_pic='-fPIC'
566 esac
567 else
568 # PORTME Check for PIC flags for the system compiler.
569 case "$host_os" in
570 aix3* | aix4*)
571 # All AIX code is PIC.
572 ac_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
575 hpux9* | hpux10* | hpux11*)
576 # Is there a better ac_cv_prog_cc_static that works with the bundled CC?
577 ac_cv_prog_cc_wl='-Wl,'
578 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
579 ac_cv_prog_cc_pic='+Z'
582 irix5* | irix6*)
583 ac_cv_prog_cc_wl='-Wl,'
584 ac_cv_prog_cc_static='-non_shared'
585 # PIC (with -KPIC) is the default.
588 cygwin* | mingw* | os2*)
589 # This hack is so that the source file can tell whether it is being
590 # built for inclusion in a dll (and should export symbols for example).
591 ac_cv_prog_cc_pic='-DDLL_EXPORT'
594 osf3* | osf4* | osf5*)
595 # All OSF/1 code is PIC.
596 ac_cv_prog_cc_wl='-Wl,'
597 ac_cv_prog_cc_static='-non_shared'
600 sco3.2v5*)
601 ac_cv_prog_cc_pic='-Kpic'
602 ac_cv_prog_cc_static='-dn'
603 ac_cv_prog_cc_shlib='-belf'
606 solaris*)
607 ac_cv_prog_cc_pic='-KPIC'
608 ac_cv_prog_cc_static='-Bstatic'
609 ac_cv_prog_cc_wl='-Wl,'
612 sunos4*)
613 ac_cv_prog_cc_pic='-PIC'
614 ac_cv_prog_cc_static='-Bstatic'
615 ac_cv_prog_cc_wl='-Qoption ld '
618 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
619 ac_cv_prog_cc_pic='-KPIC'
620 ac_cv_prog_cc_static='-Bstatic'
621 ac_cv_prog_cc_wl='-Wl,'
624 uts4*)
625 ac_cv_prog_cc_pic='-pic'
626 ac_cv_prog_cc_static='-Bstatic'
629 sysv4*MP*)
630 if test -d /usr/nec ;then
631 ac_cv_prog_cc_pic='-Kconform_pic'
632 ac_cv_prog_cc_static='-Bstatic'
637 ac_cv_prog_cc_can_build_shared=no
639 esac
641 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
644 need_lc=yes
645 if test "$enable_shared" = yes && test "$with_gcc" = yes; then
646 case "$archive_cmds" in
647 *'~'*)
648 # FIXME: we may have to deal with multi-command sequences.
650 '$CC '*)
651 # Test whether the compiler implicitly links with -lc since on some
652 # systems, -lgcc has to come before -lc. If gcc already passes -lc
653 # to ld, don't add -lc before -lgcc.
654 echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
655 if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
656 echo $ac_n "(cached) $ac_c" 1>&6
657 need_lc=$ac_cv_archive_cmds_needs_lc
658 else
659 $rm conftest*
660 echo "static int dummy;" > conftest.$ac_ext
661 if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
662 # Append any warnings to the config.log.
663 cat conftest.err 1>&5
664 soname=conftest
665 lib=conftest
666 libobjs=conftest.o
667 deplibs=
668 wl=$ac_cv_prog_cc_wl
669 compiler_flags=-v
670 linker_flags=-v
671 verstring=
672 output_objdir=.
673 libname=conftest
674 save_allow_undefined_flag=$allow_undefined_flag
675 allow_undefined_flag=
676 if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
677 need_lc=no
679 allow_undefined_flag=$save_allow_undefined_flag
680 else
681 cat conftest.err 1>&5
684 $rm conftest*
685 echo "$ac_t$need_lc" 1>&6
687 esac
689 ac_cv_archive_cmds_needs_lc=$need_lc