You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

619 lines
16 KiB

  1. #! /bin/sh
  2. # Output a system dependent set of variables, describing how to set the
  3. # run time search path of shared libraries in an executable.
  4. #
  5. # Copyright 1996-2006 Free Software Foundation, Inc.
  6. # Taken from GNU libtool, 2001
  7. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  8. #
  9. # This file is free software; the Free Software Foundation gives
  10. # unlimited permission to copy and/or distribute it, with or without
  11. # modifications, as long as this notice is preserved.
  12. #
  13. # The first argument passed to this file is the canonical host specification,
  14. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
  15. # or
  16. # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
  17. # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
  18. # should be set by the caller.
  19. #
  20. # The set of defined variables is at the end of this script.
  21. # Known limitations:
  22. # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
  23. # than 256 bytes, otherwise the compiler driver will dump core. The only
  24. # known workaround is to choose shorter directory names for the build
  25. # directory and/or the installation directory.
  26. # All known linkers require a `.a' archive for static linking (except MSVC,
  27. # which needs '.lib').
  28. libext=a
  29. shrext=.so
  30. host="$1"
  31. host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  32. host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  33. host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  34. # Code taken from libtool.m4's _LT_CC_BASENAME.
  35. for cc_temp in $CC""; do
  36. case $cc_temp in
  37. compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
  38. distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
  39. \-*) ;;
  40. *) break;;
  41. esac
  42. done
  43. cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
  44. # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
  45. wl=
  46. if test "$GCC" = yes; then
  47. wl='-Wl,'
  48. else
  49. case "$host_os" in
  50. aix*)
  51. wl='-Wl,'
  52. ;;
  53. darwin*)
  54. case $cc_basename in
  55. xlc*)
  56. wl='-Wl,'
  57. ;;
  58. esac
  59. ;;
  60. mingw* | pw32* | os2*)
  61. ;;
  62. hpux9* | hpux10* | hpux11*)
  63. wl='-Wl,'
  64. ;;
  65. irix5* | irix6* | nonstopux*)
  66. wl='-Wl,'
  67. ;;
  68. newsos6)
  69. ;;
  70. linux*)
  71. case $cc_basename in
  72. icc* | ecc*)
  73. wl='-Wl,'
  74. ;;
  75. pgcc | pgf77 | pgf90)
  76. wl='-Wl,'
  77. ;;
  78. ccc*)
  79. wl='-Wl,'
  80. ;;
  81. como)
  82. wl='-lopt='
  83. ;;
  84. *)
  85. case `$CC -V 2>&1 | sed 5q` in
  86. *Sun\ C*)
  87. wl='-Wl,'
  88. ;;
  89. esac
  90. ;;
  91. esac
  92. ;;
  93. osf3* | osf4* | osf5*)
  94. wl='-Wl,'
  95. ;;
  96. sco3.2v5*)
  97. ;;
  98. solaris*)
  99. wl='-Wl,'
  100. ;;
  101. sunos4*)
  102. wl='-Qoption ld '
  103. ;;
  104. sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
  105. wl='-Wl,'
  106. ;;
  107. sysv4*MP*)
  108. ;;
  109. unicos*)
  110. wl='-Wl,'
  111. ;;
  112. uts4*)
  113. ;;
  114. esac
  115. fi
  116. # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
  117. hardcode_libdir_flag_spec=
  118. hardcode_libdir_separator=
  119. hardcode_direct=no
  120. hardcode_minus_L=no
  121. case "$host_os" in
  122. cygwin* | mingw* | pw32*)
  123. # FIXME: the MSVC++ port hasn't been tested in a loooong time
  124. # When not using gcc, we currently assume that we are using
  125. # Microsoft Visual C++.
  126. if test "$GCC" != yes; then
  127. with_gnu_ld=no
  128. fi
  129. ;;
  130. interix*)
  131. # we just hope/assume this is gcc and not c89 (= MSVC++)
  132. with_gnu_ld=yes
  133. ;;
  134. openbsd*)
  135. with_gnu_ld=no
  136. ;;
  137. esac
  138. ld_shlibs=yes
  139. if test "$with_gnu_ld" = yes; then
  140. # Set some defaults for GNU ld with shared library support. These
  141. # are reset later if shared libraries are not supported. Putting them
  142. # here allows them to be overridden if necessary.
  143. # Unlike libtool, we use -rpath here, not --rpath, since the documented
  144. # option of GNU ld is called -rpath, not --rpath.
  145. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  146. case "$host_os" in
  147. aix3* | aix4* | aix5*)
  148. # On AIX/PPC, the GNU linker is very broken
  149. if test "$host_cpu" != ia64; then
  150. ld_shlibs=no
  151. fi
  152. ;;
  153. amigaos*)
  154. hardcode_libdir_flag_spec='-L$libdir'
  155. hardcode_minus_L=yes
  156. # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
  157. # that the semantics of dynamic libraries on AmigaOS, at least up
  158. # to version 4, is to share data among multiple programs linked
  159. # with the same dynamic library. Since this doesn't match the
  160. # behavior of shared libraries on other platforms, we cannot use
  161. # them.
  162. ld_shlibs=no
  163. ;;
  164. beos*)
  165. if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
  166. :
  167. else
  168. ld_shlibs=no
  169. fi
  170. ;;
  171. cygwin* | mingw* | pw32*)
  172. # hardcode_libdir_flag_spec is actually meaningless, as there is
  173. # no search path for DLLs.
  174. hardcode_libdir_flag_spec='-L$libdir'
  175. if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
  176. :
  177. else
  178. ld_shlibs=no
  179. fi
  180. ;;
  181. interix3*)
  182. hardcode_direct=no
  183. hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
  184. ;;
  185. linux*)
  186. if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
  187. :
  188. else
  189. ld_shlibs=no
  190. fi
  191. ;;
  192. netbsd*)
  193. ;;
  194. solaris*)
  195. if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
  196. ld_shlibs=no
  197. elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
  198. :
  199. else
  200. ld_shlibs=no
  201. fi
  202. ;;
  203. sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
  204. case `$LD -v 2>&1` in
  205. *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
  206. ld_shlibs=no
  207. ;;
  208. *)
  209. if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
  210. hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
  211. else
  212. ld_shlibs=no
  213. fi
  214. ;;
  215. esac
  216. ;;
  217. sunos4*)
  218. hardcode_direct=yes
  219. ;;
  220. *)
  221. if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
  222. :
  223. else
  224. ld_shlibs=no
  225. fi
  226. ;;
  227. esac
  228. if test "$ld_shlibs" = no; then
  229. hardcode_libdir_flag_spec=
  230. fi
  231. else
  232. case "$host_os" in
  233. aix3*)
  234. # Note: this linker hardcodes the directories in LIBPATH if there
  235. # are no directories specified by -L.
  236. hardcode_minus_L=yes
  237. if test "$GCC" = yes; then
  238. # Neither direct hardcoding nor static linking is supported with a
  239. # broken collect2.
  240. hardcode_direct=unsupported
  241. fi
  242. ;;
  243. aix4* | aix5*)
  244. if test "$host_cpu" = ia64; then
  245. # On IA64, the linker does run time linking by default, so we don't
  246. # have to do anything special.
  247. aix_use_runtimelinking=no
  248. else
  249. aix_use_runtimelinking=no
  250. # Test if we are trying to use run time linking or normal
  251. # AIX style linking. If -brtl is somewhere in LDFLAGS, we
  252. # need to do runtime linking.
  253. case $host_os in aix4.[23]|aix4.[23].*|aix5*)
  254. for ld_flag in $LDFLAGS; do
  255. if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
  256. aix_use_runtimelinking=yes
  257. break
  258. fi
  259. done
  260. ;;
  261. esac
  262. fi
  263. hardcode_direct=yes
  264. hardcode_libdir_separator=':'
  265. if test "$GCC" = yes; then
  266. case $host_os in aix4.[012]|aix4.[012].*)
  267. collect2name=`${CC} -print-prog-name=collect2`
  268. if test -f "$collect2name" && \
  269. strings "$collect2name" | grep resolve_lib_name >/dev/null
  270. then
  271. # We have reworked collect2
  272. hardcode_direct=yes
  273. else
  274. # We have old collect2
  275. hardcode_direct=unsupported
  276. hardcode_minus_L=yes
  277. hardcode_libdir_flag_spec='-L$libdir'
  278. hardcode_libdir_separator=
  279. fi
  280. ;;
  281. esac
  282. fi
  283. # Begin _LT_AC_SYS_LIBPATH_AIX.
  284. echo 'int main () { return 0; }' > conftest.c
  285. ${CC} ${LDFLAGS} conftest.c -o conftest
  286. aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
  287. }'`
  288. if test -z "$aix_libpath"; then
  289. aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
  290. }'`
  291. fi
  292. if test -z "$aix_libpath"; then
  293. aix_libpath="/usr/lib:/lib"
  294. fi
  295. rm -f conftest.c conftest
  296. # End _LT_AC_SYS_LIBPATH_AIX.
  297. if test "$aix_use_runtimelinking" = yes; then
  298. hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
  299. else
  300. if test "$host_cpu" = ia64; then
  301. hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
  302. else
  303. hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
  304. fi
  305. fi
  306. ;;
  307. amigaos*)
  308. hardcode_libdir_flag_spec='-L$libdir'
  309. hardcode_minus_L=yes
  310. # see comment about different semantics on the GNU ld section
  311. ld_shlibs=no
  312. ;;
  313. bsdi[45]*)
  314. ;;
  315. cygwin* | mingw* | pw32*)
  316. # When not using gcc, we currently assume that we are using
  317. # Microsoft Visual C++.
  318. # hardcode_libdir_flag_spec is actually meaningless, as there is
  319. # no search path for DLLs.
  320. hardcode_libdir_flag_spec=' '
  321. libext=lib
  322. ;;
  323. darwin* | rhapsody*)
  324. hardcode_direct=no
  325. if test "$GCC" = yes ; then
  326. :
  327. else
  328. case $cc_basename in
  329. xlc*)
  330. ;;
  331. *)
  332. ld_shlibs=no
  333. ;;
  334. esac
  335. fi
  336. ;;
  337. dgux*)
  338. hardcode_libdir_flag_spec='-L$libdir'
  339. ;;
  340. freebsd1*)
  341. ld_shlibs=no
  342. ;;
  343. freebsd2.2*)
  344. hardcode_libdir_flag_spec='-R$libdir'
  345. hardcode_direct=yes
  346. ;;
  347. freebsd2*)
  348. hardcode_direct=yes
  349. hardcode_minus_L=yes
  350. ;;
  351. freebsd* | kfreebsd*-gnu)
  352. hardcode_libdir_flag_spec='-R$libdir'
  353. hardcode_direct=yes
  354. ;;
  355. dragonfly*)
  356. hardcode_libdir_flag_spec='-R$libdir'
  357. hardcode_direct=yes
  358. ;;
  359. hpux9*)
  360. hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
  361. hardcode_libdir_separator=:
  362. hardcode_direct=yes
  363. # hardcode_minus_L: Not really in the search PATH,
  364. # but as the default location of the library.
  365. hardcode_minus_L=yes
  366. ;;
  367. hpux10*)
  368. if test "$with_gnu_ld" = no; then
  369. hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
  370. hardcode_libdir_separator=:
  371. hardcode_direct=yes
  372. # hardcode_minus_L: Not really in the search PATH,
  373. # but as the default location of the library.
  374. hardcode_minus_L=yes
  375. fi
  376. ;;
  377. hpux11*)
  378. if test "$with_gnu_ld" = no; then
  379. hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
  380. hardcode_libdir_separator=:
  381. case $host_cpu in
  382. hppa*64*|ia64*)
  383. hardcode_direct=no
  384. ;;
  385. *)
  386. hardcode_direct=yes
  387. # hardcode_minus_L: Not really in the search PATH,
  388. # but as the default location of the library.
  389. hardcode_minus_L=yes
  390. ;;
  391. esac
  392. fi
  393. ;;
  394. irix5* | irix6* | nonstopux*)
  395. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  396. hardcode_libdir_separator=:
  397. ;;
  398. netbsd*)
  399. hardcode_libdir_flag_spec='-R$libdir'
  400. hardcode_direct=yes
  401. ;;
  402. newsos6)
  403. hardcode_direct=yes
  404. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  405. hardcode_libdir_separator=:
  406. ;;
  407. openbsd*)
  408. hardcode_direct=yes
  409. if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
  410. hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
  411. else
  412. case "$host_os" in
  413. openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
  414. hardcode_libdir_flag_spec='-R$libdir'
  415. ;;
  416. *)
  417. hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
  418. ;;
  419. esac
  420. fi
  421. ;;
  422. os2*)
  423. hardcode_libdir_flag_spec='-L$libdir'
  424. hardcode_minus_L=yes
  425. ;;
  426. osf3*)
  427. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  428. hardcode_libdir_separator=:
  429. ;;
  430. osf4* | osf5*)
  431. if test "$GCC" = yes; then
  432. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  433. else
  434. # Both cc and cxx compiler support -rpath directly
  435. hardcode_libdir_flag_spec='-rpath $libdir'
  436. fi
  437. hardcode_libdir_separator=:
  438. ;;
  439. solaris*)
  440. hardcode_libdir_flag_spec='-R$libdir'
  441. ;;
  442. sunos4*)
  443. hardcode_libdir_flag_spec='-L$libdir'
  444. hardcode_direct=yes
  445. hardcode_minus_L=yes
  446. ;;
  447. sysv4)
  448. case $host_vendor in
  449. sni)
  450. hardcode_direct=yes # is this really true???
  451. ;;
  452. siemens)
  453. hardcode_direct=no
  454. ;;
  455. motorola)
  456. hardcode_direct=no #Motorola manual says yes, but my tests say they lie
  457. ;;
  458. esac
  459. ;;
  460. sysv4.3*)
  461. ;;
  462. sysv4*MP*)
  463. if test -d /usr/nec; then
  464. ld_shlibs=yes
  465. fi
  466. ;;
  467. sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
  468. ;;
  469. sysv5* | sco3.2v5* | sco5v6*)
  470. hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
  471. hardcode_libdir_separator=':'
  472. ;;
  473. uts4*)
  474. hardcode_libdir_flag_spec='-L$libdir'
  475. ;;
  476. *)
  477. ld_shlibs=no
  478. ;;
  479. esac
  480. fi
  481. # Check dynamic linker characteristics
  482. # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
  483. libname_spec='lib$name'
  484. case "$host_os" in
  485. aix3*)
  486. ;;
  487. aix4* | aix5*)
  488. ;;
  489. amigaos*)
  490. ;;
  491. beos*)
  492. ;;
  493. bsdi[45]*)
  494. ;;
  495. cygwin* | mingw* | pw32*)
  496. shrext=.dll
  497. ;;
  498. darwin* | rhapsody*)
  499. shrext=.dylib
  500. ;;
  501. dgux*)
  502. ;;
  503. freebsd1*)
  504. ;;
  505. kfreebsd*-gnu)
  506. ;;
  507. freebsd* | dragonfly*)
  508. ;;
  509. gnu*)
  510. ;;
  511. hpux9* | hpux10* | hpux11*)
  512. case $host_cpu in
  513. ia64*)
  514. shrext=.so
  515. ;;
  516. hppa*64*)
  517. shrext=.sl
  518. ;;
  519. *)
  520. shrext=.sl
  521. ;;
  522. esac
  523. ;;
  524. interix3*)
  525. ;;
  526. irix5* | irix6* | nonstopux*)
  527. case "$host_os" in
  528. irix5* | nonstopux*)
  529. libsuff= shlibsuff=
  530. ;;
  531. *)
  532. case $LD in
  533. *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
  534. *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
  535. *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
  536. *) libsuff= shlibsuff= ;;
  537. esac
  538. ;;
  539. esac
  540. ;;
  541. linux*oldld* | linux*aout* | linux*coff*)
  542. ;;
  543. linux*)
  544. ;;
  545. knetbsd*-gnu)
  546. ;;
  547. netbsd*)
  548. ;;
  549. newsos6)
  550. ;;
  551. nto-qnx*)
  552. ;;
  553. openbsd*)
  554. ;;
  555. os2*)
  556. libname_spec='$name'
  557. shrext=.dll
  558. ;;
  559. osf3* | osf4* | osf5*)
  560. ;;
  561. solaris*)
  562. ;;
  563. sunos4*)
  564. ;;
  565. sysv4 | sysv4.3*)
  566. ;;
  567. sysv4*MP*)
  568. ;;
  569. sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
  570. ;;
  571. uts4*)
  572. ;;
  573. esac
  574. sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
  575. escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
  576. shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
  577. escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
  578. LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
  579. # How to pass a linker flag through the compiler.
  580. wl="$escaped_wl"
  581. # Static library suffix (normally "a").
  582. libext="$libext"
  583. # Shared library suffix (normally "so").
  584. shlibext="$shlibext"
  585. # Flag to hardcode \$libdir into a binary during linking.
  586. # This must work even if \$libdir does not exist.
  587. hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
  588. # Whether we need a single -rpath flag with a separated argument.
  589. hardcode_libdir_separator="$hardcode_libdir_separator"
  590. # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
  591. # resulting binary.
  592. hardcode_direct="$hardcode_direct"
  593. # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
  594. # resulting binary.
  595. hardcode_minus_L="$hardcode_minus_L"
  596. EOF