config.rpath 15 KB

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