ltcf-c.sh 33 KB

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