OSDN Git Service

use "#if defined( HAV..." instead of "#if HAV..."
[pf3gnuchains/gcc-fork.git] / ltcf-c.sh
1 #### This script is meant to be sourced by ltconfig.
2
3 # $Id: ltcf-c.sh,v 1.1 2000/07/28 18:04:21 bkoz Exp $
4
5 # ltcf-c.sh - Create a C compiler specific configuration
6 #
7 # Copyright (C) 1996-2000 Free Software Foundation, Inc.
8 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9 #
10 # This file is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
14 #
15 # This program is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 # General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #
24 # As a special exception to the GNU General Public License, if you
25 # distribute this file as part of a program that contains a
26 # configuration script generated by Autoconf, you may include it under
27 # the same distribution terms that you use for the rest of that program.
28
29
30 # Source file extension for C test sources.
31 ac_ext=c
32
33 # Object file extension for compiled C test sources.
34 objext=o
35
36 # Code to be used in simple compile tests
37 lt_simple_compile_test_code="int some_variable = 0;"
38
39 # Code to be used in simple link tests
40 lt_simple_link_test_code='main(){return(0);}'
41
42 ## Linker Characteristics
43 case "$host_os" in
44 cygwin* | mingw*)
45   # FIXME: the MSVC++ port hasn't been tested in a loooong time
46   # When not using gcc, we currently assume that we are using
47   # Microsoft Visual C++.
48   if test "$with_gcc" != yes; then
49     with_gnu_ld=no
50   fi
51   ;;
52
53 esac
54
55 ld_shlibs=yes
56 if test "$with_gnu_ld" = yes; then
57   # If archive_cmds runs LD, not CC, wlarc should be empty
58   wlarc='${wl}'
59
60   # See if GNU ld supports shared libraries.
61   case "$host_os" in
62   aix3* | aix4*)
63     # On AIX, the GNU linker is very broken
64     ld_shlibs=no
65     cat <<EOF 1>&2
66
67 *** Warning: the GNU linker, at least up to release 2.9.1, is reported
68 *** to be unable to reliably create shared libraries on AIX.
69 *** Therefore, libtool is disabling shared libraries support.  If you
70 *** really care for shared libraries, you may want to modify your PATH
71 *** so that a non-GNU linker is found, and then restart.
72
73 EOF
74     ;;
75
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
80
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
88     ;;
89
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 $linker_flags ${wl}-soname $wl$soname -o $lib'
96     else
97       ld_shlibs=no
98     fi
99     ;;
100
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
107
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$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
112       else $CC -o impgen impgen.c ; fi)~
113       $output_objdir/impgen $dir/$soname > $output_objdir/$soname-def'
114
115     old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
116
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~
127       ;;
128     esac
129
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
133
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=
143     fi
144
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'
152
153     # If DATA tags from a recent dlltool are present, honour them!
154     archive_expsym_cmds='echo EXPORTS > $output_objdir/$soname-def~
155       _lt_hint=1;
156       cat $export_symbols | while read symbol; do
157         set dummy \$symbol;
158         case \$# in
159           2) echo "     \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
160           *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
161         esac;
162         _lt_hint=`expr 1 + \$_lt_hint`;
163       done~
164       '"$ltdll_cmds"'
165       $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~
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 -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~
168       $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~
169       $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags'
170     ;;
171
172   netbsd*)
173     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
174       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
175       wlarc=
176     else
177       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
178       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
179     fi
180     ;;
181
182   solaris* | sysv5*)
183     if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
184       ld_shlibs=no
185       cat <<EOF 1>&2
186
187 *** Warning: The releases 2.8.* of the GNU linker cannot reliably
188 *** create shared libraries on Solaris systems.  Therefore, libtool
189 *** is disabling shared libraries support.  We urge you to upgrade GNU
190 *** binutils to release 2.9.1 or newer.  Another option is to modify
191 *** your PATH or compiler configuration so that the native linker is
192 *** used, and then restart.
193
194 EOF
195     elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
196       archive_cmds='$CC -shared $libobjs $deplibs $linker_flags ${wl}-soname $wl$soname -o $lib'
197       archive_expsym_cmds='$CC -shared $libobjs $deplibs $linker_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
198     else
199       ld_shlibs=no
200     fi
201     ;;
202
203   sunos4*)
204     archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
205     wlarc=
206     hardcode_direct=yes
207     hardcode_shlibpath_var=no
208     ;;
209
210   *)
211     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
212       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
213       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
214     else
215       ld_shlibs=no
216     fi
217     ;;
218   esac
219
220   if test "$ld_shlibs" = yes; then
221     runpath_var=LD_RUN_PATH
222     hardcode_libdir_flag_spec="$wlarc"'--rpath '"$wlarc"'$libdir'
223     export_dynamic_flag_spec="$wlarc"'--export-dynamic'
224     case $host_os in
225     cygwin* | mingw*)
226       # dlltool doesn't understand --whole-archive et. al.
227       whole_archive_flag_spec=
228       ;;
229     *)
230       # ancient GNU ld didn't support --whole-archive et. al.
231       if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
232         whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
233       else
234         whole_archive_flag_spec=
235       fi
236       ;;
237     esac
238   fi
239 else
240   # PORTME fill in a description of your system's linker (not GNU ld)
241   case "$host_os" in
242   aix3*)
243     allow_undefined_flag=unsupported
244     always_export_symbols=yes
245     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'
246     # Note: this linker hardcodes the directories in LIBPATH if there
247     # are no directories specified by -L.
248     hardcode_minus_L=yes
249     if test "$with_gcc" = yes && test -z "$link_static_flag"; then
250       # Neither direct hardcoding nor static linking is supported with a
251       # broken collect2.
252       hardcode_direct=unsupported
253     fi
254     ;;
255
256   aix4*)
257     hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
258     hardcode_libdir_separator=':'
259     if test "$with_gcc" = yes; then
260       collect2name=`${CC} -print-prog-name=collect2`
261       if test -f "$collect2name" && \
262          strings "$collect2name" | grep resolve_lib_name >/dev/null
263       then
264         # We have reworked collect2
265         hardcode_direct=yes
266       else
267         # We have old collect2
268         hardcode_direct=unsupported
269         # It fails to find uninstalled libraries when the uninstalled
270         # path is not listed in the libpath.  Setting hardcode_minus_L
271         # to unsupported forces relinking
272         hardcode_minus_L=yes
273         hardcode_libdir_flag_spec='-L$libdir'
274         hardcode_libdir_separator=
275       fi
276       shared_flag='-shared'
277     else
278       shared_flag='${wl}-bM:SRE'
279       hardcode_direct=yes
280     fi
281     allow_undefined_flag=' ${wl}-berok'
282     archive_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
283     archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
284     case "$host_os" in aix4.[01]|aix4.[01].*)
285       # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
286       always_export_symbols=yes ;;
287     esac
288    ;;
289
290   amigaos*)
291     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)'
292     hardcode_libdir_flag_spec='-L$libdir'
293     hardcode_minus_L=yes
294     # see comment about different semantics on the GNU ld section
295     ld_shlibs=no
296     ;;
297
298   cygwin* | mingw*)
299     # When not using gcc, we currently assume that we are using
300     # Microsoft Visual C++.
301     # hardcode_libdir_flag_spec is actually meaningless, as there is
302     # no search path for DLLs.
303     hardcode_libdir_flag_spec=' '
304     allow_undefined_flag=unsupported
305     # Tell ltmain to make .lib files, not .a files.
306     libext=lib
307     # FIXME: Setting linknames here is a bad hack.
308     archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
309     # The linker will automatically build a .lib file if we build a DLL.
310     old_archive_from_new_cmds='true'
311     # FIXME: Should let the user specify the lib program.
312     old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
313     fix_srcfile_path='`cygpath -w $srcfile`'
314     ;;
315
316   freebsd1*)
317     ld_shlibs=no
318     ;;
319
320   # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
321   # support.  Future versions do this automatically, but an explicit c++rt0.o
322   # does not break anything, and helps significantly (at the cost of a little
323   # extra space).
324   freebsd2.2*)
325     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
326     hardcode_libdir_flag_spec='-R$libdir'
327     hardcode_direct=yes
328     hardcode_shlibpath_var=no
329     ;;
330
331   # Unfortunately, older versions of FreeBSD 2 do not have this feature.
332   freebsd2*)
333     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
334     hardcode_direct=yes
335     hardcode_minus_L=yes
336     hardcode_shlibpath_var=no
337     ;;
338
339   # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
340   freebsd*)
341     archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
342     hardcode_libdir_flag_spec='-R$libdir'
343     hardcode_direct=yes
344     hardcode_shlibpath_var=no
345     ;;
346
347   hpux9* | hpux10* | hpux11*)
348     case "$host_os" in
349     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' ;;
350     *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
351     esac
352     hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
353     hardcode_libdir_separator=:
354     hardcode_direct=yes
355     hardcode_minus_L=yes # Not in the search PATH, but as the default
356                          # location of the library.
357     export_dynamic_flag_spec='${wl}-E'
358     ;;
359
360   irix5* | irix6*)
361     if test "$with_gcc" = yes; then
362       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'
363     else
364       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
365     fi
366     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
367     hardcode_libdir_separator=:
368     link_all_deplibs=yes
369     ;;
370
371   netbsd*)
372     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
373       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
374     else
375       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
376     fi
377     hardcode_libdir_flag_spec='${wl}-R$libdir'
378     hardcode_direct=yes
379     hardcode_shlibpath_var=no
380     ;;
381
382   openbsd*)
383     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
384     hardcode_libdir_flag_spec='-R$libdir'
385     hardcode_direct=yes
386     hardcode_shlibpath_var=no
387     ;;
388
389   os2*)
390     hardcode_libdir_flag_spec='-L$libdir'
391     hardcode_minus_L=yes
392     allow_undefined_flag=unsupported
393     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'
394     old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
395     ;;
396
397   osf3*)
398     if test "$with_gcc" = yes; then
399       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
400       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'
401     else
402       allow_undefined_flag=' -expect_unresolved \*'
403       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'
404     fi
405     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
406     hardcode_libdir_separator=:
407     ;;
408
409   osf4* | osf5*)        # as osf3* with the addition of -msym flag
410     if test "$with_gcc" = yes; then
411       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
412       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'
413     else
414       allow_undefined_flag=' -expect_unresolved \*'
415       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'
416     fi
417     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
418     hardcode_libdir_separator=:
419     ;;
420
421   sco3.2v5*)
422     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
423     hardcode_shlibpath_var=no
424     runpath_var=LD_RUN_PATH
425     hardcode_runpath_var=yes
426     ;;
427
428   solaris*)
429     no_undefined_flag=' -z text'
430     # $CC -shared without GNU ld will not create a library from C++
431     # object files and a static libstdc++, better avoid it by now
432     archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
433     archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
434                 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
435     hardcode_libdir_flag_spec='-R$libdir'
436     hardcode_shlibpath_var=no
437     case "$host_os" in
438     solaris2.[0-5] | solaris2.[0-5].*) ;;
439     *) # Supported since Solaris 2.6 (maybe 2.5.1?)
440       whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
441     esac
442     link_all_deplibs=yes
443     ;;
444
445   sunos4*)
446     archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
447     hardcode_libdir_flag_spec='-L$libdir'
448     hardcode_direct=yes
449     hardcode_minus_L=yes
450     hardcode_shlibpath_var=no
451     ;;
452
453   sysv4)
454     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
455     runpath_var='LD_RUN_PATH'
456     hardcode_shlibpath_var=no
457     hardcode_direct=no #Motorola manual says yes, but my tests say they lie
458     ;;
459
460   sysv4.3*)
461     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
462     hardcode_shlibpath_var=no
463     export_dynamic_flag_spec='-Bexport'
464     ;;
465
466   sysv5*)
467     no_undefined_flag=' -z text'
468     # $CC -shared without GNU ld will not create a library from C++
469     # object files and a static libstdc++, better avoid it by now
470     archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
471     archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
472                 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
473     hardcode_libdir_flag_spec=
474     hardcode_shlibpath_var=no
475     runpath_var='LD_RUN_PATH'
476     ;;
477
478   uts4*)
479     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
480     hardcode_libdir_flag_spec='-L$libdir'
481     hardcode_shlibpath_var=no
482     ;;
483
484   dgux*)
485     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
486     hardcode_libdir_flag_spec='-L$libdir'
487     hardcode_shlibpath_var=no
488     ;;
489
490   sysv4*MP*)
491     if test -d /usr/nec; then
492       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
493       hardcode_shlibpath_var=no
494       runpath_var=LD_RUN_PATH
495       hardcode_runpath_var=yes
496       ld_shlibs=yes
497     fi
498     ;;
499
500   sysv4.2uw2*)
501     archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
502     hardcode_direct=yes
503     hardcode_minus_L=no
504     hardcode_shlibpath_var=no
505     hardcode_runpath_var=yes
506     runpath_var=LD_RUN_PATH
507     ;;
508
509   unixware7*)
510     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
511     runpath_var='LD_RUN_PATH'
512     hardcode_shlibpath_var=no
513     ;;
514
515   *)
516     ld_shlibs=no
517     ;;
518   esac
519 fi
520
521 ## Compiler Characteristics: PIC flags, static flags, etc
522 if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
523   :
524 else
525   ac_cv_prog_cc_pic=
526   ac_cv_prog_cc_shlib=
527   ac_cv_prog_cc_wl=
528   ac_cv_prog_cc_static=
529   ac_cv_prog_cc_no_builtin=
530   ac_cv_prog_cc_can_build_shared=$can_build_shared
531
532   if test "$with_gcc" = yes; then
533     ac_cv_prog_cc_wl='-Wl,'
534     ac_cv_prog_cc_static='-static'
535
536     case "$host_os" in
537     beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
538       # PIC is the default for these OSes.
539       ;;
540     aix*)
541       # Below there is a dirty hack to force normal static linking with -ldl
542       # The problem is because libdl dynamically linked with both libc and
543       # libC (AIX C++ library), which obviously doesn't included in libraries
544       # list by gcc. This cause undefined symbols with -static flags.
545       # This hack allows C programs to be linked with "-static -ldl", but
546       # we not sure about C++ programs.
547       ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
548       ;;
549     cygwin* | mingw* | os2*)
550       # This hack is so that the source file can tell whether it is being
551       # built for inclusion in a dll (and should export symbols for example).
552       ac_cv_prog_cc_pic='-DDLL_EXPORT'
553       ;;
554     amigaos*)
555       # FIXME: we need at least 68020 code to build shared libraries, but
556       # adding the `-m68020' flag to GCC prevents building anything better,
557       # like `-m68040'.
558       ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
559       ;;
560     sysv4*MP*)
561       if test -d /usr/nec; then
562          ac_cv_prog_cc_pic=-Kconform_pic
563       fi
564       ;;
565     *)
566       ac_cv_prog_cc_pic='-fPIC'
567       ;;
568     esac
569   else
570     # PORTME Check for PIC flags for the system compiler.
571     case "$host_os" in
572     aix3* | aix4*)
573      # All AIX code is PIC.
574       ac_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
575       ;;
576
577     hpux9* | hpux10* | hpux11*)
578       # Is there a better ac_cv_prog_cc_static that works with the bundled CC?
579       ac_cv_prog_cc_wl='-Wl,'
580       ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
581       ac_cv_prog_cc_pic='+Z'
582       ;;
583
584     irix5* | irix6*)
585       ac_cv_prog_cc_wl='-Wl,'
586       ac_cv_prog_cc_static='-non_shared'
587       # PIC (with -KPIC) is the default.
588       ;;
589
590     cygwin* | mingw* | os2*)
591       # This hack is so that the source file can tell whether it is being
592       # built for inclusion in a dll (and should export symbols for example).
593       ac_cv_prog_cc_pic='-DDLL_EXPORT'
594       ;;
595
596     osf3* | osf4* | osf5*)
597       # All OSF/1 code is PIC.
598       ac_cv_prog_cc_wl='-Wl,'
599       ac_cv_prog_cc_static='-non_shared'
600       ;;
601
602     sco3.2v5*)
603       ac_cv_prog_cc_pic='-Kpic'
604       ac_cv_prog_cc_static='-dn'
605       ac_cv_prog_cc_shlib='-belf'
606       ;;
607
608     solaris*)
609       ac_cv_prog_cc_pic='-KPIC'
610       ac_cv_prog_cc_static='-Bstatic'
611       ac_cv_prog_cc_wl='-Wl,'
612       ;;
613
614     sunos4*)
615       ac_cv_prog_cc_pic='-PIC'
616       ac_cv_prog_cc_static='-Bstatic'
617       ac_cv_prog_cc_wl='-Qoption ld '
618       ;;
619
620     sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
621       ac_cv_prog_cc_pic='-KPIC'
622       ac_cv_prog_cc_static='-Bstatic'
623       ac_cv_prog_cc_wl='-Wl,'
624       ;;
625
626     uts4*)
627       ac_cv_prog_cc_pic='-pic'
628       ac_cv_prog_cc_static='-Bstatic'
629       ;;
630
631     sysv4*MP*)
632       if test -d /usr/nec ;then
633         ac_cv_prog_cc_pic='-Kconform_pic'
634         ac_cv_prog_cc_static='-Bstatic'
635       fi
636       ;;
637
638     *)
639       ac_cv_prog_cc_can_build_shared=no
640       ;;
641     esac
642   fi
643   ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
644 fi
645
646 need_lc=yes
647 if test "$enable_shared" = yes && test "$with_gcc" = yes; then
648   case "$archive_cmds" in
649   *'~'*)
650     # FIXME: we may have to deal with multi-command sequences.
651     ;;
652   '$CC '*)
653     # Test whether the compiler implicitly links with -lc since on some
654     # systems, -lgcc has to come before -lc. If gcc already passes -lc
655     # to ld, don't add -lc before -lgcc.
656     echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
657     if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
658       echo $ac_n "(cached) $ac_c" 1>&6
659       need_lc=$ac_cv_archive_cmds_needs_lc
660     else
661       $rm conftest*
662       echo "static int dummy;" > conftest.$ac_ext
663       if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
664         # Append any warnings to the config.log.
665         cat conftest.err 1>&5
666         soname=conftest
667         lib=conftest
668         libobjs=conftest.o
669         deplibs=
670         wl=$ac_cv_prog_cc_wl
671         compiler_flags=-v
672         linker_flags=-v
673         verstring=
674         output_objdir=.
675         libname=conftest
676         allow_undefined_flag=
677         if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
678           need_lc=no
679         fi
680       else
681         cat conftest.err 1>&5
682       fi
683     fi
684     $rm conftest*
685     echo "$ac_t$need_lc" 1>&6
686     ;;
687   esac
688 fi
689 ac_cv_archive_cmds_needs_lc=$need_lc