1#### This script is meant to be sourced by ltconfig.
2
3# ltcf-c.sh - Create a C compiler specific configuration
4#
5# Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7#
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.
12#
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.
17#
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21#
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.
26
27
28# Source file extension for C test sources.
29ac_ext=c
30
31# Object file extension for compiled C test sources.
32objext=o
33
34# Code to be used in simple compile tests
35lt_simple_compile_test_code="int some_variable = 0;"
36
37# Code to be used in simple link tests
38lt_simple_link_test_code='main(){return(0);}'
39
40## Linker Characteristics
41case $host_os in
42cygwin* | 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
48  fi
49  ;;
50
51esac
52
53ld_shlibs=yes
54if test "$with_gnu_ld" = yes; then
55  # If archive_cmds runs LD, not CC, wlarc should be empty
56  wlarc='${wl}'
57
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
65
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.
71
72EOF
73    fi
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 $compiler_flags ${wl}-soname $wl$soname -o $lib'
96    else
97      ld_shlibs=no
98    fi
99    ;;
100
101  haiku*)
102    allow_undefined_flag=unsupported
103    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
104    ;;
105
106  cygwin* | mingw*)
107    # hardcode_libdir_flag_spec is actually meaningless, as there is
108    # no search path for DLLs.
109    hardcode_libdir_flag_spec='-L$libdir'
110    allow_undefined_flag=unsupported
111    always_export_symbols=yes
112
113    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
114      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
115      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
116      if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \
117      else $CC -o impgen impgen.c ; fi)~
118      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
119
120    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
121
122    # cygwin and mingw dlls have different entry points and sets of symbols
123    # to exclude.
124    # FIXME: what about values for MSVC?
125    dll_entry=__cygwin_dll_entry@12
126    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
127    case $host_os in
128    mingw*)
129      # mingw values
130      dll_entry=_DllMainCRTStartup@12
131      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
132      ;;
133    esac
134
135    # mingw and cygwin differ, and it's simplest to just exclude the union
136    # of the two symbol sets.
137    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
138
139    # recent cygwin and mingw systems supply a stub DllMain which the user
140    # can override, but on older systems we have to supply one (in ltdll.c)
141    if test "x$lt_cv_need_dllmain" = "xyes"; then
142      ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
143      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~
144	test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
145    else
146      ltdll_obj=
147      ltdll_cmds=
148    fi
149
150    # Extract the symbol export list from an `--export-all' def file,
151    # then regenerate the def file from the symbol export list, so that
152    # the compiled dll only exports the symbol export list.
153    # Be careful not to strip the DATA tag left be newer dlltools.
154    export_symbols_cmds="$ltdll_cmds"'
155      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
156      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
157
158    # If the export-symbols file already is a .def file (1st line
159    # is EXPORTS), use it as is.
160    # If DATA tags from a recent dlltool are present, honour them!
161    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
162        cp $export_symbols $output_objdir/$soname-def;
163      else
164        echo EXPORTS > $output_objdir/$soname-def;
165        _lt_hint=1;
166        cat $export_symbols | while read symbol; do
167         set dummy \$symbol;
168         case \[$]# in
169           2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
170           *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
171         esac;
172         _lt_hint=`expr 1 + \$_lt_hint`;
173        done;
174      fi~
175      '"$ltdll_cmds"'
176      $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~
177      $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~
178      $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~
179      $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~
180      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
181    ;;
182
183  darwin* | rhapsody*)
184    allow_undefined_flag='-undefined suppress'
185    archive_cmds='$CC `test .$module = .yes && echo -bundle || echo -dynamiclib` $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname `test -n "$verstring" -a x$verstring != x0.0 && echo $verstring`'
186    # We need to add '_' to the symbols in $export_symbols first
187    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
188    hardcode_direct=yes
189    hardcode_shlibpath_var=no
190    whole_archive_flag_spec='-all_load $convenience'
191    ;;
192
193  netbsd* | knetbsd*-gnu)
194    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
195      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
196      wlarc=
197    else
198      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
199      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
200    fi
201    ;;
202
203  solaris* | sysv5*)
204    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
205      ld_shlibs=no
206      cat <<EOF 1>&2
207
208*** Warning: The releases 2.8.* of the GNU linker cannot reliably
209*** create shared libraries on Solaris systems.  Therefore, libtool
210*** is disabling shared libraries support.  We urge you to upgrade GNU
211*** binutils to release 2.9.1 or newer.  Another option is to modify
212*** your PATH or compiler configuration so that the native linker is
213*** used, and then restart.
214
215EOF
216    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
217      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
218      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
219    else
220      ld_shlibs=no
221    fi
222    ;;
223
224  sunos4*)
225    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
226    wlarc=
227    hardcode_direct=yes
228    hardcode_shlibpath_var=no
229    ;;
230
231  tpf*)
232    ld_shlibs=yes
233    ;;
234
235  *)
236    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
237      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
238      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
239    else
240      ld_shlibs=no
241    fi
242    ;;
243  esac
244
245  if test "$ld_shlibs" = yes; then
246    runpath_var=LD_RUN_PATH
247    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
248    export_dynamic_flag_spec='${wl}--export-dynamic'
249    case $host_os in
250    cygwin* | mingw*)
251      # dlltool doesn't understand --whole-archive et. al.
252      whole_archive_flag_spec=
253      ;;
254    *)
255      # ancient GNU ld didn't support --whole-archive et. al.
256      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
257	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
258      else
259	whole_archive_flag_spec=
260      fi
261      ;;
262    esac
263  fi
264else
265  # PORTME fill in a description of your system's linker (not GNU ld)
266  case $host_os in
267  aix3*)
268    allow_undefined_flag=unsupported
269    always_export_symbols=yes
270    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'
271    # Note: this linker hardcodes the directories in LIBPATH if there
272    # are no directories specified by -L.
273    hardcode_minus_L=yes
274    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
275      # Neither direct hardcoding nor static linking is supported with a
276      # broken collect2.
277      hardcode_direct=unsupported
278    fi
279    ;;
280
281  aix4* | aix5*)
282    hardcode_direct=yes
283    hardcode_libdir_separator=':'
284    link_all_deplibs=yes
285    # When large executables or shared objects are built, AIX ld can
286    # have problems creating the table of contents.  If linking a library
287    # or program results in "error TOC overflow" add -mminimal-toc to
288    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
289    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
290    if test "$with_gcc" = yes; then
291      case $host_os in aix4.[012]|aix4.[012].*)
292      # We only want to do this on AIX 4.2 and lower, the check
293      # below for broken collect2 doesn't work under 4.3+
294        collect2name=`${CC} -print-prog-name=collect2`
295        if test -f "$collect2name" && \
296	   strings "$collect2name" | grep resolve_lib_name >/dev/null
297        then
298	  # We have reworked collect2
299	  hardcode_direct=yes
300        else
301	  # We have old collect2
302	  hardcode_direct=unsupported
303	  # It fails to find uninstalled libraries when the uninstalled
304	  # path is not listed in the libpath.  Setting hardcode_minus_L
305	  # to unsupported forces relinking
306	  hardcode_minus_L=yes
307	  hardcode_libdir_flag_spec='-L$libdir'
308	  hardcode_libdir_separator=
309        fi
310      esac
311      shared_flag='-shared'
312    else
313      # not using gcc
314      if test "$host_cpu" = ia64; then
315        shared_flag='${wl}-G'
316      else
317        shared_flag='${wl}-bM:SRE'
318      fi
319    fi
320
321    if test "$host_cpu" = ia64; then
322      # On IA64, the linker does run time linking by default, so we don't
323      # have to do anything special.
324      aix_use_runtimelinking=no
325      if test $with_gnu_ld = no; then
326        exp_sym_flag='-Bexport'
327        no_entry_flag=""
328      fi
329    else
330      # Test if we are trying to use run time linking, or normal AIX style linking.
331      # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
332      aix_use_runtimelinking=no
333      for ld_flag in $LDFLAGS; do
334        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
335          aix_use_runtimelinking=yes
336          break
337        fi
338      done
339      exp_sym_flag='-bexport'
340      no_entry_flag='-bnoentry'
341    fi
342    # -bexpall does not export symbols beginning with underscore (_)
343    always_export_symbols=yes
344    if test "$aix_use_runtimelinking" = yes; then
345      # Warning - without using the other run time loading flags (-brtl), -berok will
346      #           link without error, but may produce a broken library.
347      allow_undefined_flag=' ${wl}-berok'
348      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
349      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"
350    else
351      if test "$host_cpu" = ia64; then
352        if test $with_gnu_ld = no; then
353          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
354          allow_undefined_flag="-z nodefs"
355          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"
356        fi
357      else
358        allow_undefined_flag=' ${wl}-berok'
359        # -bexpall does not export symbols beginning with underscore (_)
360        always_export_symbols=yes
361        # Exported symbols can be pulled into shared objects from archives
362        whole_archive_flag_spec=' '
363        build_libtool_need_lc=yes
364        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
365        # This is similar to how AIX traditionally builds it's shared libraries.
366        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'
367      fi
368    fi
369    ;;
370
371  amigaos*)
372    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)'
373    hardcode_libdir_flag_spec='-L$libdir'
374    hardcode_minus_L=yes
375    # see comment about different semantics on the GNU ld section
376    ld_shlibs=no
377    ;;
378
379  cygwin* | mingw*)
380    # When not using gcc, we currently assume that we are using
381    # Microsoft Visual C++.
382    # hardcode_libdir_flag_spec is actually meaningless, as there is
383    # no search path for DLLs.
384    hardcode_libdir_flag_spec=' '
385    allow_undefined_flag=unsupported
386    # Tell ltmain to make .lib files, not .a files.
387    libext=lib
388    # FIXME: Setting linknames here is a bad hack.
389    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
390    # The linker will automatically build a .lib file if we build a DLL.
391    old_archive_from_new_cmds='true'
392    # FIXME: Should let the user specify the lib program.
393    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
394    fix_srcfile_path='`cygpath -w "$srcfile"`'
395    ;;
396
397  freebsd1*)
398    ld_shlibs=no
399    ;;
400
401  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
402  # support.  Future versions do this automatically, but an explicit c++rt0.o
403  # does not break anything, and helps significantly (at the cost of a little
404  # extra space).
405  freebsd2.2*)
406    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
407    hardcode_libdir_flag_spec='-R$libdir'
408    hardcode_direct=yes
409    hardcode_shlibpath_var=no
410    ;;
411
412  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
413  freebsd2*)
414    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
415    hardcode_direct=yes
416    hardcode_minus_L=yes
417    hardcode_shlibpath_var=no
418    ;;
419
420  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
421  freebsd* | kfreebsd*-gnu)
422    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
423    hardcode_libdir_flag_spec='-R$libdir'
424    hardcode_direct=yes
425    hardcode_shlibpath_var=no
426    ;;
427
428  hpux9* | hpux10* | hpux11*)
429    case "$host_cpu" in
430    ia64*)
431      hardcode_direct=no
432      hardcode_shlibpath_var=no
433      archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
434      hardcode_libdir_flag_spec='-L$libdir' ;;
435    *)
436      if test $with_gcc = yes; then
437        case "$host_os" in
438        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' ;;
439        *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;;
440        esac
441      else
442        case $host_os in
443        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' ;;
444        *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
445        esac
446      fi
447      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
448      hardcode_libdir_separator=:
449      hardcode_minus_L=yes # Not in the search PATH, but as the default
450			   # location of the library.
451      ;;
452    esac
453    export_dynamic_flag_spec='${wl}-E'
454    hardcode_direct=yes
455    ;;
456
457  irix5* | irix6*)
458    if test "$with_gcc" = yes; then
459      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'
460    else
461      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
462    fi
463    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
464    hardcode_libdir_separator=:
465    link_all_deplibs=yes
466    ;;
467
468  netbsd* | knetbsd*-gnu)
469    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
470      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
471    else
472      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
473    fi
474    hardcode_libdir_flag_spec='-R$libdir'
475    hardcode_direct=yes
476    hardcode_shlibpath_var=no
477    ;;
478
479  newsos6)
480    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
481    hardcode_direct=yes
482    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
483    hardcode_libdir_separator=:
484    hardcode_shlibpath_var=no
485    ;;
486
487  openbsd*)
488    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
489    hardcode_libdir_flag_spec='-R$libdir'
490    hardcode_direct=yes
491    hardcode_shlibpath_var=no
492    ;;
493
494  os2*)
495    hardcode_libdir_flag_spec='-L$libdir'
496    hardcode_minus_L=yes
497    allow_undefined_flag=unsupported
498    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'
499    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
500    ;;
501
502  osf3*)
503    if test "$with_gcc" = yes; then
504      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
505      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'
506    else
507      allow_undefined_flag=' -expect_unresolved \*'
508      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'
509    fi
510    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
511    hardcode_libdir_separator=:
512    ;;
513
514  osf4* | osf5*)	# as osf3* with the addition of -msym flag
515    if test "$with_gcc" = yes; then
516      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
517      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'
518      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
519    else
520      allow_undefined_flag=' -expect_unresolved \*'
521      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'
522      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
523      $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'
524
525      # cc supports -rpath directly
526      hardcode_libdir_flag_spec='-rpath $libdir'
527    fi
528    hardcode_libdir_separator=:
529    ;;
530
531  sco3.2v5*)
532    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
533    hardcode_shlibpath_var=no
534    runpath_var=LD_RUN_PATH
535    hardcode_runpath_var=yes
536    ;;
537
538  solaris*)
539    no_undefined_flag=' -z defs'
540    if test "$with_gcc" = yes; then
541      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
542      archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
543                  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
544    else
545      archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
546      archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
547		  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
548    fi
549    hardcode_libdir_flag_spec='-R$libdir'
550    hardcode_shlibpath_var=no
551    case $host_os in
552    solaris2.[0-5] | solaris2.[0-5].*) ;;
553    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
554      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
555    esac
556    link_all_deplibs=yes
557    ;;
558
559  sunos4*)
560    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
561    hardcode_libdir_flag_spec='-L$libdir'
562    hardcode_direct=yes
563    hardcode_minus_L=yes
564    hardcode_shlibpath_var=no
565    ;;
566
567  sysv4)
568    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
569    runpath_var='LD_RUN_PATH'
570    hardcode_shlibpath_var=no
571    hardcode_direct=no #Motorola manual says yes, but my tests say they lie
572    ;;
573
574  sysv4.3*)
575    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
576    hardcode_shlibpath_var=no
577    export_dynamic_flag_spec='-Bexport'
578    ;;
579
580  sysv5*)
581    no_undefined_flag=' -z text'
582    # $CC -shared without GNU ld will not create a library from C++
583    # object files and a static libstdc++, better avoid it by now
584    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
585    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
586		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
587    hardcode_libdir_flag_spec=
588    hardcode_shlibpath_var=no
589    runpath_var='LD_RUN_PATH'
590    ;;
591
592  uts4*)
593    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
594    hardcode_libdir_flag_spec='-L$libdir'
595    hardcode_shlibpath_var=no
596    ;;
597
598  dgux*)
599    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
600    hardcode_libdir_flag_spec='-L$libdir'
601    hardcode_shlibpath_var=no
602    ;;
603
604  sysv4*MP*)
605    if test -d /usr/nec; then
606      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
607      hardcode_shlibpath_var=no
608      runpath_var=LD_RUN_PATH
609      hardcode_runpath_var=yes
610      ld_shlibs=yes
611    fi
612    ;;
613
614  sysv4.2uw2*)
615    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
616    hardcode_direct=yes
617    hardcode_minus_L=no
618    hardcode_shlibpath_var=no
619    hardcode_runpath_var=yes
620    runpath_var=LD_RUN_PATH
621    ;;
622
623  sysv5uw7* | unixware7*)
624    no_undefined_flag='${wl}-z ${wl}text'
625    if test "$GCC" = yes; then
626      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
627    else
628      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
629    fi
630    runpath_var='LD_RUN_PATH'
631    hardcode_shlibpath_var=no
632    ;;
633
634  *)
635    ld_shlibs=no
636    ;;
637  esac
638fi
639
640## Compiler Characteristics: PIC flags, static flags, etc
641if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
642  :
643else
644  ac_cv_prog_cc_pic=
645  ac_cv_prog_cc_shlib=
646  ac_cv_prog_cc_wl=
647  ac_cv_prog_cc_static=
648  ac_cv_prog_cc_no_builtin=
649  ac_cv_prog_cc_can_build_shared=$can_build_shared
650
651  if test "$with_gcc" = yes; then
652    ac_cv_prog_cc_wl='-Wl,'
653    ac_cv_prog_cc_static='-static'
654
655    case $host_os in
656    aix*)
657      # All AIX code is PIC.
658      if test "$host_cpu" = ia64; then
659        # AIX 5 now supports IA64 processor
660        lt_cv_prog_cc_static='-Bstatic'
661      else
662        lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
663      fi
664      ;;
665    amigaos*)
666      # FIXME: we need at least 68020 code to build shared libraries, but
667      # adding the `-m68020' flag to GCC prevents building anything better,
668      # like `-m68040'.
669      ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
670      ;;
671    beos* | irix5* | irix6* | osf3* | osf4* | osf5* | haiku*)
672      # PIC is the default for these OSes.
673      ;;
674    cygwin* | mingw* | os2*)
675      # This hack is so that the source file can tell whether it is being
676      # built for inclusion in a dll (and should export symbols for example).
677      ac_cv_prog_cc_pic='-DDLL_EXPORT'
678      ;;
679    darwin* | rhapsody*)
680      # PIC is the default on this platform
681      # Common symbols not allowed in MH_DYLIB files
682      lt_cv_prog_cc_pic='-fno-common'
683      ;;
684    *djgpp*)
685      # DJGPP does not support shared libraries at all
686      ac_cv_prog_cc_pic=
687      ;;
688    sysv4*MP*)
689      if test -d /usr/nec; then
690	 ac_cv_prog_cc_pic=-Kconform_pic
691      fi
692      ;;
693    *)
694      ac_cv_prog_cc_pic='-fPIC'
695      ;;
696    esac
697  else
698    # PORTME Check for PIC flags for the system compiler.
699    case $host_os in
700    aix*)
701     # All AIX code is PIC.
702      ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
703      ;;
704
705    hpux9* | hpux10* | hpux11*)
706      # Is there a better ac_cv_prog_cc_static that works with the bundled CC?
707      ac_cv_prog_cc_wl='-Wl,'
708      ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
709      ac_cv_prog_cc_pic='+Z'
710      ;;
711
712    irix5* | irix6*)
713      ac_cv_prog_cc_wl='-Wl,'
714      ac_cv_prog_cc_static='-non_shared'
715      # PIC (with -KPIC) is the default.
716      ;;
717
718    cygwin* | mingw* | os2*)
719      # This hack is so that the source file can tell whether it is being
720      # built for inclusion in a dll (and should export symbols for example).
721      ac_cv_prog_cc_pic='-DDLL_EXPORT'
722      ;;
723
724    newsos6)
725      ac_cv_prog_cc_pic='-KPIC'
726      ac_cv_prog_cc_static='-Bstatic'
727      ;;
728
729    osf3* | osf4* | osf5*)
730      # All OSF/1 code is PIC.
731      ac_cv_prog_cc_wl='-Wl,'
732      ac_cv_prog_cc_static='-non_shared'
733      ;;
734
735    sco3.2v5*)
736      ac_cv_prog_cc_pic='-Kpic'
737      ac_cv_prog_cc_static='-dn'
738      ac_cv_prog_cc_shlib='-belf'
739      ;;
740
741    solaris*)
742      ac_cv_prog_cc_pic='-KPIC'
743      ac_cv_prog_cc_static='-Bstatic'
744      ac_cv_prog_cc_wl='-Wl,'
745      ;;
746
747    sunos4*)
748      ac_cv_prog_cc_pic='-PIC'
749      ac_cv_prog_cc_static='-Bstatic'
750      ac_cv_prog_cc_wl='-Qoption ld '
751      ;;
752
753    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
754      ac_cv_prog_cc_pic='-KPIC'
755      ac_cv_prog_cc_static='-Bstatic'
756      ac_cv_prog_cc_wl='-Wl,'
757      ;;
758
759    uts4*)
760      ac_cv_prog_cc_pic='-pic'
761      ac_cv_prog_cc_static='-Bstatic'
762      ;;
763
764    sysv4*MP*)
765      if test -d /usr/nec ;then
766	ac_cv_prog_cc_pic='-Kconform_pic'
767	ac_cv_prog_cc_static='-Bstatic'
768      fi
769      ;;
770
771    *)
772      ac_cv_prog_cc_can_build_shared=no
773      ;;
774    esac
775  fi
776  case "$host_os" in
777      # Platforms which do not suport PIC and -DPIC is meaningless
778      # on them:
779      *djgpp*)
780        ac_cv_prog_cc_pic=
781        ;;
782      *)
783        ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
784        ;;
785  esac
786fi
787
788need_lc=yes
789if test "$enable_shared" = yes && test "$with_gcc" = yes; then
790  case $archive_cmds in
791  *'~'*)
792    # FIXME: we may have to deal with multi-command sequences.
793    ;;
794  '$CC '*)
795    # Test whether the compiler implicitly links with -lc since on some
796    # systems, -lgcc has to come before -lc. If gcc already passes -lc
797    # to ld, don't add -lc before -lgcc.
798    echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
799    if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
800      echo $ac_n "(cached) $ac_c" 1>&6
801      need_lc=$ac_cv_archive_cmds_needs_lc
802    else
803      $rm conftest*
804      echo "static int dummy;" > conftest.$ac_ext
805      if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
806	# Append any warnings to the config.log.
807	cat conftest.err 1>&5
808	soname=conftest
809	lib=conftest
810	libobjs=conftest.$objext
811	deplibs=
812	wl=$ac_cv_prog_cc_wl
813	compiler_flags=-v
814	linker_flags=-v
815	verstring=
816	output_objdir=.
817	libname=conftest
818	save_allow_undefined_flag=$allow_undefined_flag
819	allow_undefined_flag=
820	if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
821	  need_lc=no
822	fi
823	allow_undefined_flag=$save_allow_undefined_flag
824      else
825	cat conftest.err 1>&5
826      fi
827    fi
828    $rm conftest*
829    echo "$ac_t$need_lc" 1>&6
830    ;;
831  esac
832fi
833ac_cv_archive_cmds_needs_lc=$need_lc
834