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