ltcf-c.sh 31 KB

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