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.

5062 lines
139 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun configure.
  3. #
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
  5. # Free Software Foundation, Inc.
  6. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. # General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. #
  22. # As a special exception to the GNU General Public License, if you
  23. # distribute this file as part of a program that contains a
  24. # configuration script generated by Autoconf, you may include it under
  25. # the same distribution terms that you use for the rest of that program.
  26. # Check that we have a working $echo.
  27. if test "X$1" = X--no-reexec; then
  28. # Discard the --no-reexec flag, and continue.
  29. shift
  30. elif test "X$1" = X--fallback-echo; then
  31. # Avoid inline document here, it may be left over
  32. :
  33. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  34. # Yippee, $echo works!
  35. :
  36. else
  37. # Restart under the correct shell, and then maybe $echo will work.
  38. exec $SHELL "$0" --no-reexec ${1+"$@"}
  39. fi
  40. if test "X$1" = X--fallback-echo; then
  41. # used as fallback echo
  42. shift
  43. cat <<EOF
  44. $*
  45. EOF
  46. exit 0
  47. fi
  48. # The name of this program.
  49. progname=`$echo "$0" | ${SED} 's%^.*/%%'`
  50. modename="$progname"
  51. # Constants.
  52. PROGRAM=ltmain.sh
  53. PACKAGE=libtool
  54. VERSION=1.4.3
  55. TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
  56. default_mode=
  57. help="Try \`$progname --help' for more information."
  58. magic="%%%MAGIC variable%%%"
  59. mkdir="mkdir"
  60. mv="mv -f"
  61. rm="rm -f"
  62. # Sed substitution that helps us do robust quoting. It backslashifies
  63. # metacharacters that are still active within double-quoted strings.
  64. Xsed="${SED}"' -e 1s/^X//'
  65. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  66. # test EBCDIC or ASCII
  67. case `echo A|od -x` in
  68. *[Cc]1*) # EBCDIC based system
  69. SP2NL="tr '\100' '\n'"
  70. NL2SP="tr '\r\n' '\100\100'"
  71. ;;
  72. *) # Assume ASCII based system
  73. SP2NL="tr '\040' '\012'"
  74. NL2SP="tr '\015\012' '\040\040'"
  75. ;;
  76. esac
  77. # NLS nuisances.
  78. # Only set LANG and LC_ALL to C if already set.
  79. # These must not be set unconditionally because not all systems understand
  80. # e.g. LANG=C (notably SCO).
  81. # We save the old values to restore during execute mode.
  82. if test "${LC_ALL+set}" = set; then
  83. save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  84. fi
  85. if test "${LANG+set}" = set; then
  86. save_LANG="$LANG"; LANG=C; export LANG
  87. fi
  88. # Make sure IFS has a sensible default
  89. : ${IFS=" "}
  90. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  91. echo "$modename: not configured to build any kind of library" 1>&2
  92. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  93. exit 1
  94. fi
  95. # Global variables.
  96. mode=$default_mode
  97. nonopt=
  98. prev=
  99. prevopt=
  100. run=
  101. show="$echo"
  102. show_help=
  103. execute_dlfiles=
  104. lo2o="s/\\.lo\$/.${objext}/"
  105. o2lo="s/\\.${objext}\$/.lo/"
  106. # Parse our command line options once, thoroughly.
  107. while test $# -gt 0
  108. do
  109. arg="$1"
  110. shift
  111. case $arg in
  112. -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  113. *) optarg= ;;
  114. esac
  115. # If the previous option needs an argument, assign it.
  116. if test -n "$prev"; then
  117. case $prev in
  118. execute_dlfiles)
  119. execute_dlfiles="$execute_dlfiles $arg"
  120. ;;
  121. *)
  122. eval "$prev=\$arg"
  123. ;;
  124. esac
  125. prev=
  126. prevopt=
  127. continue
  128. fi
  129. # Have we seen a non-optional argument yet?
  130. case $arg in
  131. --help)
  132. show_help=yes
  133. ;;
  134. --version)
  135. echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  136. exit 0
  137. ;;
  138. --config)
  139. ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
  140. exit 0
  141. ;;
  142. --debug)
  143. echo "$progname: enabling shell trace mode"
  144. set -x
  145. ;;
  146. --dry-run | -n)
  147. run=:
  148. ;;
  149. --features)
  150. echo "host: $host"
  151. if test "$build_libtool_libs" = yes; then
  152. echo "enable shared libraries"
  153. else
  154. echo "disable shared libraries"
  155. fi
  156. if test "$build_old_libs" = yes; then
  157. echo "enable static libraries"
  158. else
  159. echo "disable static libraries"
  160. fi
  161. exit 0
  162. ;;
  163. --finish) mode="finish" ;;
  164. --mode) prevopt="--mode" prev=mode ;;
  165. --mode=*) mode="$optarg" ;;
  166. --preserve-dup-deps) duplicate_deps="yes" ;;
  167. --quiet | --silent)
  168. show=:
  169. ;;
  170. -dlopen)
  171. prevopt="-dlopen"
  172. prev=execute_dlfiles
  173. ;;
  174. -*)
  175. $echo "$modename: unrecognized option \`$arg'" 1>&2
  176. $echo "$help" 1>&2
  177. exit 1
  178. ;;
  179. *)
  180. nonopt="$arg"
  181. break
  182. ;;
  183. esac
  184. done
  185. if test -n "$prevopt"; then
  186. $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  187. $echo "$help" 1>&2
  188. exit 1
  189. fi
  190. # If this variable is set in any of the actions, the command in it
  191. # will be execed at the end. This prevents here-documents from being
  192. # left over by shells.
  193. exec_cmd=
  194. if test -z "$show_help"; then
  195. # Infer the operation mode.
  196. if test -z "$mode"; then
  197. case $nonopt in
  198. *cc | *++ | gcc* | *-gcc* | xlc*)
  199. mode=link
  200. for arg
  201. do
  202. case $arg in
  203. -c)
  204. mode=compile
  205. break
  206. ;;
  207. esac
  208. done
  209. ;;
  210. *db | *dbx | *strace | *truss)
  211. mode=execute
  212. ;;
  213. *install*|cp|mv)
  214. mode=install
  215. ;;
  216. *rm)
  217. mode=uninstall
  218. ;;
  219. *)
  220. # If we have no mode, but dlfiles were specified, then do execute mode.
  221. test -n "$execute_dlfiles" && mode=execute
  222. # Just use the default operation mode.
  223. if test -z "$mode"; then
  224. if test -n "$nonopt"; then
  225. $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  226. else
  227. $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  228. fi
  229. fi
  230. ;;
  231. esac
  232. fi
  233. # Only execute mode is allowed to have -dlopen flags.
  234. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  235. $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  236. $echo "$help" 1>&2
  237. exit 1
  238. fi
  239. # Change the help message to a mode-specific one.
  240. generic_help="$help"
  241. help="Try \`$modename --help --mode=$mode' for more information."
  242. # These modes are in order of execution frequency so that they run quickly.
  243. case $mode in
  244. # libtool compile mode
  245. compile)
  246. modename="$modename: compile"
  247. # Get the compilation command and the source file.
  248. base_compile=
  249. prev=
  250. lastarg=
  251. srcfile="$nonopt"
  252. suppress_output=
  253. user_target=no
  254. for arg
  255. do
  256. case $prev in
  257. "") ;;
  258. xcompiler)
  259. # Aesthetically quote the previous argument.
  260. prev=
  261. lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  262. case $arg in
  263. # Double-quote args containing other shell metacharacters.
  264. # Many Bourne shells cannot handle close brackets correctly
  265. # in scan sets, so we specify it separately.
  266. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  267. arg="\"$arg\""
  268. ;;
  269. esac
  270. # Add the previous argument to base_compile.
  271. if test -z "$base_compile"; then
  272. base_compile="$lastarg"
  273. else
  274. base_compile="$base_compile $lastarg"
  275. fi
  276. continue
  277. ;;
  278. esac
  279. # Accept any command-line options.
  280. case $arg in
  281. -o)
  282. if test "$user_target" != "no"; then
  283. $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  284. exit 1
  285. fi
  286. user_target=next
  287. ;;
  288. -static)
  289. build_old_libs=yes
  290. continue
  291. ;;
  292. -prefer-pic)
  293. pic_mode=yes
  294. continue
  295. ;;
  296. -prefer-non-pic)
  297. pic_mode=no
  298. continue
  299. ;;
  300. -Xcompiler)
  301. prev=xcompiler
  302. continue
  303. ;;
  304. -Wc,*)
  305. args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
  306. lastarg=
  307. save_ifs="$IFS"; IFS=','
  308. for arg in $args; do
  309. IFS="$save_ifs"
  310. # Double-quote args containing other shell metacharacters.
  311. # Many Bourne shells cannot handle close brackets correctly
  312. # in scan sets, so we specify it separately.
  313. case $arg in
  314. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  315. arg="\"$arg\""
  316. ;;
  317. esac
  318. lastarg="$lastarg $arg"
  319. done
  320. IFS="$save_ifs"
  321. lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
  322. # Add the arguments to base_compile.
  323. if test -z "$base_compile"; then
  324. base_compile="$lastarg"
  325. else
  326. base_compile="$base_compile $lastarg"
  327. fi
  328. continue
  329. ;;
  330. esac
  331. case $user_target in
  332. next)
  333. # The next one is the -o target name
  334. user_target=yes
  335. continue
  336. ;;
  337. yes)
  338. # We got the output file
  339. user_target=set
  340. libobj="$arg"
  341. continue
  342. ;;
  343. esac
  344. # Accept the current argument as the source file.
  345. lastarg="$srcfile"
  346. srcfile="$arg"
  347. # Aesthetically quote the previous argument.
  348. # Backslashify any backslashes, double quotes, and dollar signs.
  349. # These are the only characters that are still specially
  350. # interpreted inside of double-quoted scrings.
  351. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  352. # Double-quote args containing other shell metacharacters.
  353. # Many Bourne shells cannot handle close brackets correctly
  354. # in scan sets, so we specify it separately.
  355. case $lastarg in
  356. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  357. lastarg="\"$lastarg\""
  358. ;;
  359. esac
  360. # Add the previous argument to base_compile.
  361. if test -z "$base_compile"; then
  362. base_compile="$lastarg"
  363. else
  364. base_compile="$base_compile $lastarg"
  365. fi
  366. done
  367. case $user_target in
  368. set)
  369. ;;
  370. no)
  371. # Get the name of the library object.
  372. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  373. ;;
  374. *)
  375. $echo "$modename: you must specify a target with \`-o'" 1>&2
  376. exit 1
  377. ;;
  378. esac
  379. # Recognize several different file suffixes.
  380. # If the user specifies -o file.o, it is replaced with file.lo
  381. xform='[cCFSfmso]'
  382. case $libobj in
  383. *.ada) xform=ada ;;
  384. *.adb) xform=adb ;;
  385. *.ads) xform=ads ;;
  386. *.asm) xform=asm ;;
  387. *.c++) xform=c++ ;;
  388. *.cc) xform=cc ;;
  389. *.cpp) xform=cpp ;;
  390. *.cxx) xform=cxx ;;
  391. *.f90) xform=f90 ;;
  392. *.for) xform=for ;;
  393. esac
  394. libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  395. case $libobj in
  396. *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  397. *)
  398. $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  399. exit 1
  400. ;;
  401. esac
  402. if test -z "$base_compile"; then
  403. $echo "$modename: you must specify a compilation command" 1>&2
  404. $echo "$help" 1>&2
  405. exit 1
  406. fi
  407. # Delete any leftover library objects.
  408. if test "$build_old_libs" = yes; then
  409. removelist="$obj $libobj"
  410. else
  411. removelist="$libobj"
  412. fi
  413. $run $rm $removelist
  414. trap "$run $rm $removelist; exit 1" 1 2 15
  415. # On Cygwin there's no "real" PIC flag so we must build both object types
  416. case $host_os in
  417. cygwin* | mingw* | pw32* | os2*)
  418. pic_mode=default
  419. ;;
  420. esac
  421. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  422. # non-PIC code in shared libraries is not supported
  423. pic_mode=default
  424. fi
  425. # Calculate the filename of the output object if compiler does
  426. # not support -o with -c
  427. if test "$compiler_c_o" = no; then
  428. output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  429. lockfile="$output_obj.lock"
  430. removelist="$removelist $output_obj $lockfile"
  431. trap "$run $rm $removelist; exit 1" 1 2 15
  432. else
  433. need_locks=no
  434. lockfile=
  435. fi
  436. # Lock this critical section if it is needed
  437. # We use this script file to make the link, it avoids creating a new file
  438. if test "$need_locks" = yes; then
  439. until $run ln "$0" "$lockfile" 2>/dev/null; do
  440. $show "Waiting for $lockfile to be removed"
  441. sleep 2
  442. done
  443. elif test "$need_locks" = warn; then
  444. if test -f "$lockfile"; then
  445. echo "\
  446. *** ERROR, $lockfile exists and contains:
  447. `cat $lockfile 2>/dev/null`
  448. This indicates that another process is trying to use the same
  449. temporary object file, and libtool could not work around it because
  450. your compiler does not support \`-c' and \`-o' together. If you
  451. repeat this compilation, it may succeed, by chance, but you had better
  452. avoid parallel builds (make -j) in this platform, or get a better
  453. compiler."
  454. $run $rm $removelist
  455. exit 1
  456. fi
  457. echo $srcfile > "$lockfile"
  458. fi
  459. if test -n "$fix_srcfile_path"; then
  460. eval srcfile=\"$fix_srcfile_path\"
  461. fi
  462. # Only build a PIC object if we are building libtool libraries.
  463. if test "$build_libtool_libs" = yes; then
  464. # Without this assignment, base_compile gets emptied.
  465. fbsd_hideous_sh_bug=$base_compile
  466. if test "$pic_mode" != no; then
  467. # All platforms use -DPIC, to notify preprocessed assembler code.
  468. command="$base_compile $srcfile $pic_flag -DPIC"
  469. else
  470. # Don't build PIC code
  471. command="$base_compile $srcfile"
  472. fi
  473. if test "$build_old_libs" = yes; then
  474. lo_libobj="$libobj"
  475. dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  476. if test "X$dir" = "X$libobj"; then
  477. dir="$objdir"
  478. else
  479. dir="$dir/$objdir"
  480. fi
  481. libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  482. if test -d "$dir"; then
  483. $show "$rm $libobj"
  484. $run $rm $libobj
  485. else
  486. $show "$mkdir $dir"
  487. $run $mkdir $dir
  488. status=$?
  489. if test $status -ne 0 && test ! -d $dir; then
  490. exit $status
  491. fi
  492. fi
  493. fi
  494. if test "$compiler_o_lo" = yes; then
  495. output_obj="$libobj"
  496. command="$command -o $output_obj"
  497. elif test "$compiler_c_o" = yes; then
  498. output_obj="$obj"
  499. command="$command -o $output_obj"
  500. fi
  501. $run $rm "$output_obj"
  502. $show "$command"
  503. if $run eval "$command"; then :
  504. else
  505. test -n "$output_obj" && $run $rm $removelist
  506. exit 1
  507. fi
  508. if test "$need_locks" = warn &&
  509. test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  510. echo "\
  511. *** ERROR, $lockfile contains:
  512. `cat $lockfile 2>/dev/null`
  513. but it should contain:
  514. $srcfile
  515. This indicates that another process is trying to use the same
  516. temporary object file, and libtool could not work around it because
  517. your compiler does not support \`-c' and \`-o' together. If you
  518. repeat this compilation, it may succeed, by chance, but you had better
  519. avoid parallel builds (make -j) in this platform, or get a better
  520. compiler."
  521. $run $rm $removelist
  522. exit 1
  523. fi
  524. # Just move the object if needed, then go on to compile the next one
  525. if test x"$output_obj" != x"$libobj"; then
  526. $show "$mv $output_obj $libobj"
  527. if $run $mv $output_obj $libobj; then :
  528. else
  529. error=$?
  530. $run $rm $removelist
  531. exit $error
  532. fi
  533. fi
  534. # If we have no pic_flag, then copy the object into place and finish.
  535. if (test -z "$pic_flag" || test "$pic_mode" != default) &&
  536. test "$build_old_libs" = yes; then
  537. # Rename the .lo from within objdir to obj
  538. if test -f $obj; then
  539. $show $rm $obj
  540. $run $rm $obj
  541. fi
  542. $show "$mv $libobj $obj"
  543. if $run $mv $libobj $obj; then :
  544. else
  545. error=$?
  546. $run $rm $removelist
  547. exit $error
  548. fi
  549. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  550. if test "X$xdir" = "X$obj"; then
  551. xdir="."
  552. else
  553. xdir="$xdir"
  554. fi
  555. baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
  556. libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  557. # Now arrange that obj and lo_libobj become the same file
  558. $show "(cd $xdir && $LN_S $baseobj $libobj)"
  559. if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
  560. # Unlock the critical section if it was locked
  561. if test "$need_locks" != no; then
  562. $run $rm "$lockfile"
  563. fi
  564. exit 0
  565. else
  566. error=$?
  567. $run $rm $removelist
  568. exit $error
  569. fi
  570. fi
  571. # Allow error messages only from the first compilation.
  572. suppress_output=' >/dev/null 2>&1'
  573. fi
  574. # Only build a position-dependent object if we build old libraries.
  575. if test "$build_old_libs" = yes; then
  576. if test "$pic_mode" != yes; then
  577. # Don't build PIC code
  578. command="$base_compile $srcfile"
  579. else
  580. # All platforms use -DPIC, to notify preprocessed assembler code.
  581. command="$base_compile $srcfile $pic_flag -DPIC"
  582. fi
  583. if test "$compiler_c_o" = yes; then
  584. command="$command -o $obj"
  585. output_obj="$obj"
  586. fi
  587. # Suppress compiler output if we already did a PIC compilation.
  588. command="$command$suppress_output"
  589. $run $rm "$output_obj"
  590. $show "$command"
  591. if $run eval "$command"; then :
  592. else
  593. $run $rm $removelist
  594. exit 1
  595. fi
  596. if test "$need_locks" = warn &&
  597. test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  598. echo "\
  599. *** ERROR, $lockfile contains:
  600. `cat $lockfile 2>/dev/null`
  601. but it should contain:
  602. $srcfile
  603. This indicates that another process is trying to use the same
  604. temporary object file, and libtool could not work around it because
  605. your compiler does not support \`-c' and \`-o' together. If you
  606. repeat this compilation, it may succeed, by chance, but you had better
  607. avoid parallel builds (make -j) in this platform, or get a better
  608. compiler."
  609. $run $rm $removelist
  610. exit 1
  611. fi
  612. # Just move the object if needed
  613. if test x"$output_obj" != x"$obj"; then
  614. $show "$mv $output_obj $obj"
  615. if $run $mv $output_obj $obj; then :
  616. else
  617. error=$?
  618. $run $rm $removelist
  619. exit $error
  620. fi
  621. fi
  622. # Create an invalid libtool object if no PIC, so that we do not
  623. # accidentally link it into a program.
  624. if test "$build_libtool_libs" != yes; then
  625. $show "echo timestamp > $libobj"
  626. $run eval "echo timestamp > \$libobj" || exit $?
  627. else
  628. # Move the .lo from within objdir
  629. $show "$mv $libobj $lo_libobj"
  630. if $run $mv $libobj $lo_libobj; then :
  631. else
  632. error=$?
  633. $run $rm $removelist
  634. exit $error
  635. fi
  636. fi
  637. fi
  638. # Unlock the critical section if it was locked
  639. if test "$need_locks" != no; then
  640. $run $rm "$lockfile"
  641. fi
  642. exit 0
  643. ;;
  644. # libtool link mode
  645. link | relink)
  646. modename="$modename: link"
  647. case $host in
  648. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  649. # It is impossible to link a dll without this setting, and
  650. # we shouldn't force the makefile maintainer to figure out
  651. # which system we are compiling for in order to pass an extra
  652. # flag for every libtool invokation.
  653. # allow_undefined=no
  654. # FIXME: Unfortunately, there are problems with the above when trying
  655. # to make a dll which has undefined symbols, in which case not
  656. # even a static library is built. For now, we need to specify
  657. # -no-undefined on the libtool link line when we can be certain
  658. # that all symbols are satisfied, otherwise we get a static library.
  659. allow_undefined=yes
  660. ;;
  661. *)
  662. allow_undefined=yes
  663. ;;
  664. esac
  665. libtool_args="$nonopt"
  666. compile_command="$nonopt"
  667. finalize_command="$nonopt"
  668. compile_rpath=
  669. finalize_rpath=
  670. compile_shlibpath=
  671. finalize_shlibpath=
  672. convenience=
  673. old_convenience=
  674. deplibs=
  675. old_deplibs=
  676. compiler_flags=
  677. linker_flags=
  678. dllsearchpath=
  679. lib_search_path=`pwd`
  680. avoid_version=no
  681. dlfiles=
  682. dlprefiles=
  683. dlself=no
  684. export_dynamic=no
  685. export_symbols=
  686. export_symbols_regex=
  687. generated=
  688. libobjs=
  689. ltlibs=
  690. module=no
  691. no_install=no
  692. objs=
  693. prefer_static_libs=no
  694. preload=no
  695. prev=
  696. prevarg=
  697. release=
  698. rpath=
  699. xrpath=
  700. perm_rpath=
  701. temp_rpath=
  702. thread_safe=no
  703. vinfo=
  704. # We need to know -static, to get the right output filenames.
  705. for arg
  706. do
  707. case $arg in
  708. -all-static | -static)
  709. if test "X$arg" = "X-all-static"; then
  710. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  711. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  712. fi
  713. if test -n "$link_static_flag"; then
  714. dlopen_self=$dlopen_self_static
  715. fi
  716. else
  717. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  718. dlopen_self=$dlopen_self_static
  719. fi
  720. fi
  721. build_libtool_libs=no
  722. build_old_libs=yes
  723. prefer_static_libs=yes
  724. break
  725. ;;
  726. esac
  727. done
  728. # See if our shared archives depend on static archives.
  729. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  730. # Go through the arguments, transforming them on the way.
  731. while test $# -gt 0; do
  732. arg="$1"
  733. shift
  734. case $arg in
  735. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  736. qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  737. ;;
  738. *) qarg=$arg ;;
  739. esac
  740. libtool_args="$libtool_args $qarg"
  741. # If the previous option needs an argument, assign it.
  742. if test -n "$prev"; then
  743. case $prev in
  744. output)
  745. compile_command="$compile_command @OUTPUT@"
  746. finalize_command="$finalize_command @OUTPUT@"
  747. ;;
  748. esac
  749. case $prev in
  750. dlfiles|dlprefiles)
  751. if test "$preload" = no; then
  752. # Add the symbol object into the linking commands.
  753. compile_command="$compile_command @SYMFILE@"
  754. finalize_command="$finalize_command @SYMFILE@"
  755. preload=yes
  756. fi
  757. case $arg in
  758. *.la | *.lo) ;; # We handle these cases below.
  759. force)
  760. if test "$dlself" = no; then
  761. dlself=needless
  762. export_dynamic=yes
  763. fi
  764. prev=
  765. continue
  766. ;;
  767. self)
  768. if test "$prev" = dlprefiles; then
  769. dlself=yes
  770. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  771. dlself=yes
  772. else
  773. dlself=needless
  774. export_dynamic=yes
  775. fi
  776. prev=
  777. continue
  778. ;;
  779. *)
  780. if test "$prev" = dlfiles; then
  781. dlfiles="$dlfiles $arg"
  782. else
  783. dlprefiles="$dlprefiles $arg"
  784. fi
  785. prev=
  786. continue
  787. ;;
  788. esac
  789. ;;
  790. expsyms)
  791. export_symbols="$arg"
  792. if test ! -f "$arg"; then
  793. $echo "$modename: symbol file \`$arg' does not exist"
  794. exit 1
  795. fi
  796. prev=
  797. continue
  798. ;;
  799. expsyms_regex)
  800. export_symbols_regex="$arg"
  801. prev=
  802. continue
  803. ;;
  804. release)
  805. release="-$arg"
  806. prev=
  807. continue
  808. ;;
  809. rpath | xrpath)
  810. # We need an absolute path.
  811. case $arg in
  812. [\\/]* | [A-Za-z]:[\\/]*) ;;
  813. *)
  814. $echo "$modename: only absolute run-paths are allowed" 1>&2
  815. exit 1
  816. ;;
  817. esac
  818. if test "$prev" = rpath; then
  819. case "$rpath " in
  820. *" $arg "*) ;;
  821. *) rpath="$rpath $arg" ;;
  822. esac
  823. else
  824. case "$xrpath " in
  825. *" $arg "*) ;;
  826. *) xrpath="$xrpath $arg" ;;
  827. esac
  828. fi
  829. prev=
  830. continue
  831. ;;
  832. xcompiler)
  833. compiler_flags="$compiler_flags $qarg"
  834. prev=
  835. compile_command="$compile_command $qarg"
  836. finalize_command="$finalize_command $qarg"
  837. continue
  838. ;;
  839. xlinker)
  840. linker_flags="$linker_flags $qarg"
  841. compiler_flags="$compiler_flags $wl$qarg"
  842. prev=
  843. compile_command="$compile_command $wl$qarg"
  844. finalize_command="$finalize_command $wl$qarg"
  845. continue
  846. ;;
  847. *)
  848. eval "$prev=\"\$arg\""
  849. prev=
  850. continue
  851. ;;
  852. esac
  853. fi # test -n $prev
  854. prevarg="$arg"
  855. case $arg in
  856. -all-static)
  857. if test -n "$link_static_flag"; then
  858. compile_command="$compile_command $link_static_flag"
  859. finalize_command="$finalize_command $link_static_flag"
  860. fi
  861. continue
  862. ;;
  863. -allow-undefined)
  864. # FIXME: remove this flag sometime in the future.
  865. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  866. continue
  867. ;;
  868. -avoid-version)
  869. avoid_version=yes
  870. continue
  871. ;;
  872. -dlopen)
  873. prev=dlfiles
  874. continue
  875. ;;
  876. -dlpreopen)
  877. prev=dlprefiles
  878. continue
  879. ;;
  880. -export-dynamic)
  881. export_dynamic=yes
  882. continue
  883. ;;
  884. -export-symbols | -export-symbols-regex)
  885. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  886. $echo "$modename: more than one -exported-symbols argument is not allowed"
  887. exit 1
  888. fi
  889. if test "X$arg" = "X-export-symbols"; then
  890. prev=expsyms
  891. else
  892. prev=expsyms_regex
  893. fi
  894. continue
  895. ;;
  896. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  897. # so, if we see these flags be careful not to treat them like -L
  898. -L[A-Z][A-Z]*:*)
  899. case $with_gcc/$host in
  900. no/*-*-irix* | no/*-*-nonstopux*)
  901. compile_command="$compile_command $arg"
  902. finalize_command="$finalize_command $arg"
  903. ;;
  904. esac
  905. continue
  906. ;;
  907. -L*)
  908. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  909. # We need an absolute path.
  910. case $dir in
  911. [\\/]* | [A-Za-z]:[\\/]*) ;;
  912. *)
  913. absdir=`cd "$dir" && pwd`
  914. if test -z "$absdir"; then
  915. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  916. exit 1
  917. fi
  918. dir="$absdir"
  919. ;;
  920. esac
  921. case "$deplibs " in
  922. *" -L$dir "*) ;;
  923. *)
  924. deplibs="$deplibs -L$dir"
  925. lib_search_path="$lib_search_path $dir"
  926. ;;
  927. esac
  928. case $host in
  929. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  930. case :$dllsearchpath: in
  931. *":$dir:"*) ;;
  932. *) dllsearchpath="$dllsearchpath:$dir";;
  933. esac
  934. ;;
  935. esac
  936. continue
  937. ;;
  938. -l*)
  939. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  940. case $host in
  941. *-*-cygwin* | *-*-pw32* | *-*-beos*)
  942. # These systems don't actually have a C or math library (as such)
  943. continue
  944. ;;
  945. *-*-mingw* | *-*-os2*)
  946. # These systems don't actually have a C library (as such)
  947. test "X$arg" = "X-lc" && continue
  948. ;;
  949. *-*-openbsd* | *-*-freebsd*)
  950. # Do not include libc due to us having libc/libc_r.
  951. test "X$arg" = "X-lc" && continue
  952. ;;
  953. esac
  954. elif test "X$arg" = "X-lc_r"; then
  955. case $host in
  956. *-*-openbsd* | *-*-freebsd*)
  957. # Do not include libc_r directly, use -pthread flag.
  958. continue
  959. ;;
  960. esac
  961. fi
  962. deplibs="$deplibs $arg"
  963. continue
  964. ;;
  965. -module)
  966. module=yes
  967. continue
  968. ;;
  969. -no-fast-install)
  970. fast_install=no
  971. continue
  972. ;;
  973. -no-install)
  974. case $host in
  975. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  976. # The PATH hackery in wrapper scripts is required on Windows
  977. # in order for the loader to find any dlls it needs.
  978. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  979. $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  980. fast_install=no
  981. ;;
  982. *) no_install=yes ;;
  983. esac
  984. continue
  985. ;;
  986. -no-undefined)
  987. allow_undefined=no
  988. continue
  989. ;;
  990. -o) prev=output ;;
  991. -release)
  992. prev=release
  993. continue
  994. ;;
  995. -rpath)
  996. prev=rpath
  997. continue
  998. ;;
  999. -R)
  1000. prev=xrpath
  1001. continue
  1002. ;;
  1003. -R*)
  1004. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1005. # We need an absolute path.
  1006. case $dir in
  1007. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1008. *)
  1009. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1010. exit 1
  1011. ;;
  1012. esac
  1013. case "$xrpath " in
  1014. *" $dir "*) ;;
  1015. *) xrpath="$xrpath $dir" ;;
  1016. esac
  1017. continue
  1018. ;;
  1019. -static)
  1020. # The effects of -static are defined in a previous loop.
  1021. # We used to do the same as -all-static on platforms that
  1022. # didn't have a PIC flag, but the assumption that the effects
  1023. # would be equivalent was wrong. It would break on at least
  1024. # Digital Unix and AIX.
  1025. continue
  1026. ;;
  1027. -thread-safe)
  1028. thread_safe=yes
  1029. continue
  1030. ;;
  1031. -version-info)
  1032. prev=vinfo
  1033. continue
  1034. ;;
  1035. -Wc,*)
  1036. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1037. arg=
  1038. save_ifs="$IFS"; IFS=','
  1039. for flag in $args; do
  1040. IFS="$save_ifs"
  1041. case $flag in
  1042. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1043. flag="\"$flag\""
  1044. ;;
  1045. esac
  1046. arg="$arg $wl$flag"
  1047. compiler_flags="$compiler_flags $flag"
  1048. done
  1049. IFS="$save_ifs"
  1050. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1051. ;;
  1052. -Wl,*)
  1053. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1054. arg=
  1055. save_ifs="$IFS"; IFS=','
  1056. for flag in $args; do
  1057. IFS="$save_ifs"
  1058. case $flag in
  1059. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1060. flag="\"$flag\""
  1061. ;;
  1062. esac
  1063. arg="$arg $wl$flag"
  1064. compiler_flags="$compiler_flags $wl$flag"
  1065. linker_flags="$linker_flags $flag"
  1066. done
  1067. IFS="$save_ifs"
  1068. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1069. ;;
  1070. -Xcompiler)
  1071. prev=xcompiler
  1072. continue
  1073. ;;
  1074. -Xlinker)
  1075. prev=xlinker
  1076. continue
  1077. ;;
  1078. # Some other compiler flag.
  1079. -* | +*)
  1080. # Unknown arguments in both finalize_command and compile_command need
  1081. # to be aesthetically quoted because they are evaled later.
  1082. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1083. case $arg in
  1084. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1085. arg="\"$arg\""
  1086. ;;
  1087. esac
  1088. ;;
  1089. *.lo | *.$objext)
  1090. # A library or standard object.
  1091. if test "$prev" = dlfiles; then
  1092. # This file was specified with -dlopen.
  1093. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1094. dlfiles="$dlfiles $arg"
  1095. prev=
  1096. continue
  1097. else
  1098. # If libtool objects are unsupported, then we need to preload.
  1099. prev=dlprefiles
  1100. fi
  1101. fi
  1102. if test "$prev" = dlprefiles; then
  1103. # Preload the old-style object.
  1104. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1105. prev=
  1106. else
  1107. case $arg in
  1108. *.lo) libobjs="$libobjs $arg" ;;
  1109. *) objs="$objs $arg" ;;
  1110. esac
  1111. fi
  1112. ;;
  1113. *.$libext)
  1114. # An archive.
  1115. deplibs="$deplibs $arg"
  1116. old_deplibs="$old_deplibs $arg"
  1117. continue
  1118. ;;
  1119. *.la)
  1120. # A libtool-controlled library.
  1121. if test "$prev" = dlfiles; then
  1122. # This library was specified with -dlopen.
  1123. dlfiles="$dlfiles $arg"
  1124. prev=
  1125. elif test "$prev" = dlprefiles; then
  1126. # The library was specified with -dlpreopen.
  1127. dlprefiles="$dlprefiles $arg"
  1128. prev=
  1129. else
  1130. deplibs="$deplibs $arg"
  1131. fi
  1132. continue
  1133. ;;
  1134. # Some other compiler argument.
  1135. *)
  1136. # Unknown arguments in both finalize_command and compile_command need
  1137. # to be aesthetically quoted because they are evaled later.
  1138. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1139. case $arg in
  1140. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1141. arg="\"$arg\""
  1142. ;;
  1143. esac
  1144. ;;
  1145. esac # arg
  1146. # Now actually substitute the argument into the commands.
  1147. if test -n "$arg"; then
  1148. compile_command="$compile_command $arg"
  1149. finalize_command="$finalize_command $arg"
  1150. fi
  1151. done # argument parsing loop
  1152. if test -n "$prev"; then
  1153. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1154. $echo "$help" 1>&2
  1155. exit 1
  1156. fi
  1157. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1158. eval arg=\"$export_dynamic_flag_spec\"
  1159. compile_command="$compile_command $arg"
  1160. finalize_command="$finalize_command $arg"
  1161. fi
  1162. # calculate the name of the file, without its directory
  1163. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1164. libobjs_save="$libobjs"
  1165. if test -n "$shlibpath_var"; then
  1166. # get the directories listed in $shlibpath_var
  1167. eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1168. else
  1169. shlib_search_path=
  1170. fi
  1171. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1172. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1173. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1174. if test "X$output_objdir" = "X$output"; then
  1175. output_objdir="$objdir"
  1176. else
  1177. output_objdir="$output_objdir/$objdir"
  1178. fi
  1179. # Create the object directory.
  1180. if test ! -d $output_objdir; then
  1181. $show "$mkdir $output_objdir"
  1182. $run $mkdir $output_objdir
  1183. status=$?
  1184. if test $status -ne 0 && test ! -d $output_objdir; then
  1185. exit $status
  1186. fi
  1187. fi
  1188. # Determine the type of output
  1189. case $output in
  1190. "")
  1191. $echo "$modename: you must specify an output file" 1>&2
  1192. $echo "$help" 1>&2
  1193. exit 1
  1194. ;;
  1195. *.$libext) linkmode=oldlib ;;
  1196. *.lo | *.$objext) linkmode=obj ;;
  1197. *.la) linkmode=lib ;;
  1198. *) linkmode=prog ;; # Anything else should be a program.
  1199. esac
  1200. specialdeplibs=
  1201. libs=
  1202. # Find all interdependent deplibs by searching for libraries
  1203. # that are linked more than once (e.g. -la -lb -la)
  1204. for deplib in $deplibs; do
  1205. if test "X$duplicate_deps" = "Xyes" ; then
  1206. case "$libs " in
  1207. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1208. esac
  1209. fi
  1210. libs="$libs $deplib"
  1211. done
  1212. deplibs=
  1213. newdependency_libs=
  1214. newlib_search_path=
  1215. need_relink=no # whether we're linking any uninstalled libtool libraries
  1216. notinst_deplibs= # not-installed libtool libraries
  1217. notinst_path= # paths that contain not-installed libtool libraries
  1218. case $linkmode in
  1219. lib)
  1220. passes="conv link"
  1221. for file in $dlfiles $dlprefiles; do
  1222. case $file in
  1223. *.la) ;;
  1224. *)
  1225. $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1226. exit 1
  1227. ;;
  1228. esac
  1229. done
  1230. ;;
  1231. prog)
  1232. compile_deplibs=
  1233. finalize_deplibs=
  1234. alldeplibs=no
  1235. newdlfiles=
  1236. newdlprefiles=
  1237. passes="conv scan dlopen dlpreopen link"
  1238. ;;
  1239. *) passes="conv"
  1240. ;;
  1241. esac
  1242. for pass in $passes; do
  1243. if test $linkmode = prog; then
  1244. # Determine which files to process
  1245. case $pass in
  1246. dlopen)
  1247. libs="$dlfiles"
  1248. save_deplibs="$deplibs" # Collect dlpreopened libraries
  1249. deplibs=
  1250. ;;
  1251. dlpreopen) libs="$dlprefiles" ;;
  1252. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1253. esac
  1254. fi
  1255. for deplib in $libs; do
  1256. lib=
  1257. found=no
  1258. case $deplib in
  1259. -l*)
  1260. if test $linkmode = oldlib && test $linkmode = obj; then
  1261. $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
  1262. continue
  1263. fi
  1264. if test $pass = conv; then
  1265. deplibs="$deplib $deplibs"
  1266. continue
  1267. fi
  1268. name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1269. for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1270. # Search the libtool library
  1271. lib="$searchdir/lib${name}.la"
  1272. if test -f "$lib"; then
  1273. found=yes
  1274. break
  1275. fi
  1276. done
  1277. if test "$found" != yes; then
  1278. # deplib doesn't seem to be a libtool library
  1279. if test "$linkmode,$pass" = "prog,link"; then
  1280. compile_deplibs="$deplib $compile_deplibs"
  1281. finalize_deplibs="$deplib $finalize_deplibs"
  1282. else
  1283. deplibs="$deplib $deplibs"
  1284. test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
  1285. fi
  1286. continue
  1287. fi
  1288. ;; # -l
  1289. -L*)
  1290. case $linkmode in
  1291. lib)
  1292. deplibs="$deplib $deplibs"
  1293. test $pass = conv && continue
  1294. newdependency_libs="$deplib $newdependency_libs"
  1295. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1296. ;;
  1297. prog)
  1298. if test $pass = conv; then
  1299. deplibs="$deplib $deplibs"
  1300. continue
  1301. fi
  1302. if test $pass = scan; then
  1303. deplibs="$deplib $deplibs"
  1304. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1305. else
  1306. compile_deplibs="$deplib $compile_deplibs"
  1307. finalize_deplibs="$deplib $finalize_deplibs"
  1308. fi
  1309. ;;
  1310. *)
  1311. $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
  1312. ;;
  1313. esac # linkmode
  1314. continue
  1315. ;; # -L
  1316. -R*)
  1317. if test $pass = link; then
  1318. dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1319. # Make sure the xrpath contains only unique directories.
  1320. case "$xrpath " in
  1321. *" $dir "*) ;;
  1322. *) xrpath="$xrpath $dir" ;;
  1323. esac
  1324. fi
  1325. deplibs="$deplib $deplibs"
  1326. continue
  1327. ;;
  1328. *.la) lib="$deplib" ;;
  1329. *.$libext)
  1330. if test $pass = conv; then
  1331. deplibs="$deplib $deplibs"
  1332. continue
  1333. fi
  1334. case $linkmode in
  1335. lib)
  1336. if test "$deplibs_check_method" != pass_all; then
  1337. echo
  1338. echo "*** Warning: Trying to link with static lib archive $deplib."
  1339. echo "*** I have the capability to make that library automatically link in when"
  1340. echo "*** you link to this library. But I can only do this if you have a"
  1341. echo "*** shared version of the library, which you do not appear to have"
  1342. echo "*** because the file extensions .$libext of this argument makes me believe"
  1343. echo "*** that it is just a static archive that I should not used here."
  1344. else
  1345. echo
  1346. echo "*** Warning: Linking the shared library $output against the"
  1347. echo "*** static library $deplib is not portable!"
  1348. deplibs="$deplib $deplibs"
  1349. fi
  1350. continue
  1351. ;;
  1352. prog)
  1353. if test $pass != link; then
  1354. deplibs="$deplib $deplibs"
  1355. else
  1356. compile_deplibs="$deplib $compile_deplibs"
  1357. finalize_deplibs="$deplib $finalize_deplibs"
  1358. fi
  1359. continue
  1360. ;;
  1361. esac # linkmode
  1362. ;; # *.$libext
  1363. *.lo | *.$objext)
  1364. if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1365. # If there is no dlopen support or we're linking statically,
  1366. # we need to preload.
  1367. newdlprefiles="$newdlprefiles $deplib"
  1368. compile_deplibs="$deplib $compile_deplibs"
  1369. finalize_deplibs="$deplib $finalize_deplibs"
  1370. else
  1371. newdlfiles="$newdlfiles $deplib"
  1372. fi
  1373. continue
  1374. ;;
  1375. %DEPLIBS%)
  1376. alldeplibs=yes
  1377. continue
  1378. ;;
  1379. esac # case $deplib
  1380. if test $found = yes || test -f "$lib"; then :
  1381. else
  1382. $echo "$modename: cannot find the library \`$lib'" 1>&2
  1383. exit 1
  1384. fi
  1385. # Check to see that this really is a libtool archive.
  1386. if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1387. else
  1388. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1389. exit 1
  1390. fi
  1391. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1392. test "X$ladir" = "X$lib" && ladir="."
  1393. dlname=
  1394. dlopen=
  1395. dlpreopen=
  1396. libdir=
  1397. library_names=
  1398. old_library=
  1399. # If the library was installed with an old release of libtool,
  1400. # it will not redefine variable installed.
  1401. installed=yes
  1402. # Read the .la file
  1403. case $lib in
  1404. */* | *\\*) . $lib ;;
  1405. *) . ./$lib ;;
  1406. esac
  1407. if test "$linkmode,$pass" = "lib,link" ||
  1408. test "$linkmode,$pass" = "prog,scan" ||
  1409. { test $linkmode = oldlib && test $linkmode = obj; }; then
  1410. # Add dl[pre]opened files of deplib
  1411. test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  1412. test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  1413. fi
  1414. if test $pass = conv; then
  1415. # Only check for convenience libraries
  1416. deplibs="$lib $deplibs"
  1417. if test -z "$libdir"; then
  1418. if test -z "$old_library"; then
  1419. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1420. exit 1
  1421. fi
  1422. # It is a libtool convenience library, so add in its objects.
  1423. convenience="$convenience $ladir/$objdir/$old_library"
  1424. old_convenience="$old_convenience $ladir/$objdir/$old_library"
  1425. tmp_libs=
  1426. for deplib in $dependency_libs; do
  1427. deplibs="$deplib $deplibs"
  1428. if test "X$duplicate_deps" = "Xyes" ; then
  1429. case "$tmp_libs " in
  1430. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1431. esac
  1432. fi
  1433. tmp_libs="$tmp_libs $deplib"
  1434. done
  1435. elif test $linkmode != prog && test $linkmode != lib; then
  1436. $echo "$modename: \`$lib' is not a convenience library" 1>&2
  1437. exit 1
  1438. fi
  1439. continue
  1440. fi # $pass = conv
  1441. # Get the name of the library we link against.
  1442. linklib=
  1443. for l in $old_library $library_names; do
  1444. linklib="$l"
  1445. done
  1446. if test -z "$linklib"; then
  1447. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1448. exit 1
  1449. fi
  1450. # This library was specified with -dlopen.
  1451. if test $pass = dlopen; then
  1452. if test -z "$libdir"; then
  1453. $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  1454. exit 1
  1455. fi
  1456. if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1457. # If there is no dlname, no dlopen support or we're linking
  1458. # statically, we need to preload.
  1459. dlprefiles="$dlprefiles $lib"
  1460. else
  1461. newdlfiles="$newdlfiles $lib"
  1462. fi
  1463. continue
  1464. fi # $pass = dlopen
  1465. # We need an absolute path.
  1466. case $ladir in
  1467. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  1468. *)
  1469. abs_ladir=`cd "$ladir" && pwd`
  1470. if test -z "$abs_ladir"; then
  1471. $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  1472. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1473. abs_ladir="$ladir"
  1474. fi
  1475. ;;
  1476. esac
  1477. laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1478. # Find the relevant object directory and library name.
  1479. if test "X$installed" = Xyes; then
  1480. if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1481. $echo "$modename: warning: library \`$lib' was moved." 1>&2
  1482. dir="$ladir"
  1483. absdir="$abs_ladir"
  1484. libdir="$abs_ladir"
  1485. else
  1486. dir="$libdir"
  1487. absdir="$libdir"
  1488. fi
  1489. else
  1490. dir="$ladir/$objdir"
  1491. absdir="$abs_ladir/$objdir"
  1492. # Remove this search path later
  1493. notinst_path="$notinst_path $abs_ladir"
  1494. fi # $installed = yes
  1495. name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1496. # This library was specified with -dlpreopen.
  1497. if test $pass = dlpreopen; then
  1498. if test -z "$libdir"; then
  1499. $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  1500. exit 1
  1501. fi
  1502. # Prefer using a static library (so that no silly _DYNAMIC symbols
  1503. # are required to link).
  1504. if test -n "$old_library"; then
  1505. newdlprefiles="$newdlprefiles $dir/$old_library"
  1506. # Otherwise, use the dlname, so that lt_dlopen finds it.
  1507. elif test -n "$dlname"; then
  1508. newdlprefiles="$newdlprefiles $dir/$dlname"
  1509. else
  1510. newdlprefiles="$newdlprefiles $dir/$linklib"
  1511. fi
  1512. fi # $pass = dlpreopen
  1513. if test -z "$libdir"; then
  1514. # Link the convenience library
  1515. if test $linkmode = lib; then
  1516. deplibs="$dir/$old_library $deplibs"
  1517. elif test "$linkmode,$pass" = "prog,link"; then
  1518. compile_deplibs="$dir/$old_library $compile_deplibs"
  1519. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  1520. else
  1521. deplibs="$lib $deplibs"
  1522. fi
  1523. continue
  1524. fi
  1525. if test $linkmode = prog && test $pass != link; then
  1526. newlib_search_path="$newlib_search_path $ladir"
  1527. deplibs="$lib $deplibs"
  1528. linkalldeplibs=no
  1529. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  1530. test "$build_libtool_libs" = no; then
  1531. linkalldeplibs=yes
  1532. fi
  1533. tmp_libs=
  1534. for deplib in $dependency_libs; do
  1535. case $deplib in
  1536. -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  1537. esac
  1538. # Need to link against all dependency_libs?
  1539. if test $linkalldeplibs = yes; then
  1540. deplibs="$deplib $deplibs"
  1541. else
  1542. # Need to hardcode shared library paths
  1543. # or/and link against static libraries
  1544. newdependency_libs="$deplib $newdependency_libs"
  1545. fi
  1546. if test "X$duplicate_deps" = "Xyes" ; then
  1547. case "$tmp_libs " in
  1548. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1549. esac
  1550. fi
  1551. tmp_libs="$tmp_libs $deplib"
  1552. done # for deplib
  1553. continue
  1554. fi # $linkmode = prog...
  1555. link_static=no # Whether the deplib will be linked statically
  1556. if test -n "$library_names" &&
  1557. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1558. # Link against this shared library
  1559. if test "$linkmode,$pass" = "prog,link" ||
  1560. { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
  1561. # Hardcode the library path.
  1562. # Skip directories that are in the system default run-time
  1563. # search path.
  1564. case " $sys_lib_dlsearch_path " in
  1565. *" $absdir "*) ;;
  1566. *)
  1567. case "$compile_rpath " in
  1568. *" $absdir "*) ;;
  1569. *) compile_rpath="$compile_rpath $absdir"
  1570. esac
  1571. ;;
  1572. esac
  1573. case " $sys_lib_dlsearch_path " in
  1574. *" $libdir "*) ;;
  1575. *)
  1576. case "$finalize_rpath " in
  1577. *" $libdir "*) ;;
  1578. *) finalize_rpath="$finalize_rpath $libdir"
  1579. esac
  1580. ;;
  1581. esac
  1582. if test $linkmode = prog; then
  1583. # We need to hardcode the library path
  1584. if test -n "$shlibpath_var"; then
  1585. # Make sure the rpath contains only unique directories.
  1586. case "$temp_rpath " in
  1587. *" $dir "*) ;;
  1588. *" $absdir "*) ;;
  1589. *) temp_rpath="$temp_rpath $dir" ;;
  1590. esac
  1591. fi
  1592. fi
  1593. fi # $linkmode,$pass = prog,link...
  1594. if test "$alldeplibs" = yes &&
  1595. { test "$deplibs_check_method" = pass_all ||
  1596. { test "$build_libtool_libs" = yes &&
  1597. test -n "$library_names"; }; }; then
  1598. # We only need to search for static libraries
  1599. continue
  1600. fi
  1601. if test "$installed" = no; then
  1602. notinst_deplibs="$notinst_deplibs $lib"
  1603. need_relink=yes
  1604. fi
  1605. if test -n "$old_archive_from_expsyms_cmds"; then
  1606. # figure out the soname
  1607. set dummy $library_names
  1608. realname="$2"
  1609. shift; shift
  1610. libname=`eval \\$echo \"$libname_spec\"`
  1611. # use dlname if we got it. it's perfectly good, no?
  1612. if test -n "$dlname"; then
  1613. soname="$dlname"
  1614. elif test -n "$soname_spec"; then
  1615. # bleh windows
  1616. case $host in
  1617. *cygwin*)
  1618. major=`expr $current - $age`
  1619. versuffix="-$major"
  1620. ;;
  1621. esac
  1622. eval soname=\"$soname_spec\"
  1623. else
  1624. soname="$realname"
  1625. fi
  1626. # Make a new name for the extract_expsyms_cmds to use
  1627. soroot="$soname"
  1628. soname=`echo $soroot | ${SED} -e 's/^.*\///'`
  1629. newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  1630. # If the library has no export list, then create one now
  1631. if test -f "$output_objdir/$soname-def"; then :
  1632. else
  1633. $show "extracting exported symbol list from \`$soname'"
  1634. save_ifs="$IFS"; IFS='~'
  1635. eval cmds=\"$extract_expsyms_cmds\"
  1636. for cmd in $cmds; do
  1637. IFS="$save_ifs"
  1638. $show "$cmd"
  1639. $run eval "$cmd" || exit $?
  1640. done
  1641. IFS="$save_ifs"
  1642. fi
  1643. # Create $newlib
  1644. if test -f "$output_objdir/$newlib"; then :; else
  1645. $show "generating import library for \`$soname'"
  1646. save_ifs="$IFS"; IFS='~'
  1647. eval cmds=\"$old_archive_from_expsyms_cmds\"
  1648. for cmd in $cmds; do
  1649. IFS="$save_ifs"
  1650. $show "$cmd"
  1651. $run eval "$cmd" || exit $?
  1652. done
  1653. IFS="$save_ifs"
  1654. fi
  1655. # make sure the library variables are pointing to the new library
  1656. dir=$output_objdir
  1657. linklib=$newlib
  1658. fi # test -n $old_archive_from_expsyms_cmds
  1659. if test $linkmode = prog || test "$mode" != relink; then
  1660. add_shlibpath=
  1661. add_dir=
  1662. add=
  1663. lib_linked=yes
  1664. case $hardcode_action in
  1665. immediate | unsupported)
  1666. if test "$hardcode_direct" = no; then
  1667. add="$dir/$linklib"
  1668. elif test "$hardcode_minus_L" = no; then
  1669. case $host in
  1670. *-*-sunos*) add_shlibpath="$dir" ;;
  1671. esac
  1672. add_dir="-L$dir"
  1673. add="-l$name"
  1674. elif test "$hardcode_shlibpath_var" = no; then
  1675. add_shlibpath="$dir"
  1676. add="-l$name"
  1677. else
  1678. lib_linked=no
  1679. fi
  1680. ;;
  1681. relink)
  1682. if test "$hardcode_direct" = yes; then
  1683. add="$dir/$linklib"
  1684. elif test "$hardcode_minus_L" = yes; then
  1685. add_dir="-L$dir"
  1686. add="-l$name"
  1687. elif test "$hardcode_shlibpath_var" = yes; then
  1688. add_shlibpath="$dir"
  1689. add="-l$name"
  1690. else
  1691. lib_linked=no
  1692. fi
  1693. ;;
  1694. *) lib_linked=no ;;
  1695. esac
  1696. if test "$lib_linked" != yes; then
  1697. $echo "$modename: configuration error: unsupported hardcode properties"
  1698. exit 1
  1699. fi
  1700. if test -n "$add_shlibpath"; then
  1701. case :$compile_shlibpath: in
  1702. *":$add_shlibpath:"*) ;;
  1703. *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  1704. esac
  1705. fi
  1706. if test $linkmode = prog; then
  1707. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  1708. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  1709. else
  1710. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  1711. test -n "$add" && deplibs="$add $deplibs"
  1712. if test "$hardcode_direct" != yes && \
  1713. test "$hardcode_minus_L" != yes && \
  1714. test "$hardcode_shlibpath_var" = yes; then
  1715. case :$finalize_shlibpath: in
  1716. *":$libdir:"*) ;;
  1717. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  1718. esac
  1719. fi
  1720. fi
  1721. fi
  1722. if test $linkmode = prog || test "$mode" = relink; then
  1723. add_shlibpath=
  1724. add_dir=
  1725. add=
  1726. # Finalize command for both is simple: just hardcode it.
  1727. if test "$hardcode_direct" = yes; then
  1728. add="$libdir/$linklib"
  1729. elif test "$hardcode_minus_L" = yes; then
  1730. add_dir="-L$libdir"
  1731. add="-l$name"
  1732. elif test "$hardcode_shlibpath_var" = yes; then
  1733. case :$finalize_shlibpath: in
  1734. *":$libdir:"*) ;;
  1735. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  1736. esac
  1737. add="-l$name"
  1738. else
  1739. # We cannot seem to hardcode it, guess we'll fake it.
  1740. add_dir="-L$libdir"
  1741. add="-l$name"
  1742. fi
  1743. if test $linkmode = prog; then
  1744. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  1745. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  1746. else
  1747. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  1748. test -n "$add" && deplibs="$add $deplibs"
  1749. fi
  1750. fi
  1751. elif test $linkmode = prog; then
  1752. if test "$alldeplibs" = yes &&
  1753. { test "$deplibs_check_method" = pass_all ||
  1754. { test "$build_libtool_libs" = yes &&
  1755. test -n "$library_names"; }; }; then
  1756. # We only need to search for static libraries
  1757. continue
  1758. fi
  1759. # Try to link the static library
  1760. # Here we assume that one of hardcode_direct or hardcode_minus_L
  1761. # is not unsupported. This is valid on all known static and
  1762. # shared platforms.
  1763. if test "$hardcode_direct" != unsupported; then
  1764. test -n "$old_library" && linklib="$old_library"
  1765. compile_deplibs="$dir/$linklib $compile_deplibs"
  1766. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  1767. else
  1768. compile_deplibs="-l$name -L$dir $compile_deplibs"
  1769. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  1770. fi
  1771. elif test "$build_libtool_libs" = yes; then
  1772. # Not a shared library
  1773. if test "$deplibs_check_method" != pass_all; then
  1774. # We're trying link a shared library against a static one
  1775. # but the system doesn't support it.
  1776. # Just print a warning and add the library to dependency_libs so
  1777. # that the program can be linked against the static library.
  1778. echo
  1779. echo "*** Warning: This system can not link to static lib archive $lib."
  1780. echo "*** I have the capability to make that library automatically link in when"
  1781. echo "*** you link to this library. But I can only do this if you have a"
  1782. echo "*** shared version of the library, which you do not appear to have."
  1783. if test "$module" = yes; then
  1784. echo "*** But as you try to build a module library, libtool will still create "
  1785. echo "*** a static module, that should work as long as the dlopening application"
  1786. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  1787. if test -z "$global_symbol_pipe"; then
  1788. echo
  1789. echo "*** However, this would only work if libtool was able to extract symbol"
  1790. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1791. echo "*** not find such a program. So, this module is probably useless."
  1792. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1793. fi
  1794. if test "$build_old_libs" = no; then
  1795. build_libtool_libs=module
  1796. build_old_libs=yes
  1797. else
  1798. build_libtool_libs=no
  1799. fi
  1800. fi
  1801. else
  1802. convenience="$convenience $dir/$old_library"
  1803. old_convenience="$old_convenience $dir/$old_library"
  1804. deplibs="$dir/$old_library $deplibs"
  1805. link_static=yes
  1806. fi
  1807. fi # link shared/static library?
  1808. if test $linkmode = lib; then
  1809. if test -n "$dependency_libs" &&
  1810. { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
  1811. test $link_static = yes; }; then
  1812. # Extract -R from dependency_libs
  1813. temp_deplibs=
  1814. for libdir in $dependency_libs; do
  1815. case $libdir in
  1816. -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  1817. case " $xrpath " in
  1818. *" $temp_xrpath "*) ;;
  1819. *) xrpath="$xrpath $temp_xrpath";;
  1820. esac;;
  1821. *) temp_deplibs="$temp_deplibs $libdir";;
  1822. esac
  1823. done
  1824. dependency_libs="$temp_deplibs"
  1825. fi
  1826. newlib_search_path="$newlib_search_path $absdir"
  1827. # Link against this library
  1828. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  1829. # ... and its dependency_libs
  1830. tmp_libs=
  1831. for deplib in $dependency_libs; do
  1832. newdependency_libs="$deplib $newdependency_libs"
  1833. if test "X$duplicate_deps" = "Xyes" ; then
  1834. case "$tmp_libs " in
  1835. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1836. esac
  1837. fi
  1838. tmp_libs="$tmp_libs $deplib"
  1839. done
  1840. if test $link_all_deplibs != no; then
  1841. # Add the search paths of all dependency libraries
  1842. for deplib in $dependency_libs; do
  1843. case $deplib in
  1844. -L*) path="$deplib" ;;
  1845. *.la)
  1846. dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  1847. test "X$dir" = "X$deplib" && dir="."
  1848. # We need an absolute path.
  1849. case $dir in
  1850. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1851. *)
  1852. absdir=`cd "$dir" && pwd`
  1853. if test -z "$absdir"; then
  1854. $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1855. absdir="$dir"
  1856. fi
  1857. ;;
  1858. esac
  1859. if grep "^installed=no" $deplib > /dev/null; then
  1860. path="-L$absdir/$objdir"
  1861. else
  1862. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1863. if test -z "$libdir"; then
  1864. $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1865. exit 1
  1866. fi
  1867. if test "$absdir" != "$libdir"; then
  1868. $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  1869. fi
  1870. path="-L$absdir"
  1871. fi
  1872. ;;
  1873. *) continue ;;
  1874. esac
  1875. case " $deplibs " in
  1876. *" $path "*) ;;
  1877. *) deplibs="$deplibs $path" ;;
  1878. esac
  1879. done
  1880. fi # link_all_deplibs != no
  1881. fi # linkmode = lib
  1882. done # for deplib in $libs
  1883. if test $pass = dlpreopen; then
  1884. # Link the dlpreopened libraries before other libraries
  1885. for deplib in $save_deplibs; do
  1886. deplibs="$deplib $deplibs"
  1887. done
  1888. fi
  1889. if test $pass != dlopen; then
  1890. test $pass != scan && dependency_libs="$newdependency_libs"
  1891. if test $pass != conv; then
  1892. # Make sure lib_search_path contains only unique directories.
  1893. lib_search_path=
  1894. for dir in $newlib_search_path; do
  1895. case "$lib_search_path " in
  1896. *" $dir "*) ;;
  1897. *) lib_search_path="$lib_search_path $dir" ;;
  1898. esac
  1899. done
  1900. newlib_search_path=
  1901. fi
  1902. if test "$linkmode,$pass" != "prog,link"; then
  1903. vars="deplibs"
  1904. else
  1905. vars="compile_deplibs finalize_deplibs"
  1906. fi
  1907. for var in $vars dependency_libs; do
  1908. # Add libraries to $var in reverse order
  1909. eval tmp_libs=\"\$$var\"
  1910. new_libs=
  1911. for deplib in $tmp_libs; do
  1912. case $deplib in
  1913. -L*) new_libs="$deplib $new_libs" ;;
  1914. *)
  1915. case " $specialdeplibs " in
  1916. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  1917. *)
  1918. case " $new_libs " in
  1919. *" $deplib "*) ;;
  1920. *) new_libs="$deplib $new_libs" ;;
  1921. esac
  1922. ;;
  1923. esac
  1924. ;;
  1925. esac
  1926. done
  1927. tmp_libs=
  1928. for deplib in $new_libs; do
  1929. case $deplib in
  1930. -L*)
  1931. case " $tmp_libs " in
  1932. *" $deplib "*) ;;
  1933. *) tmp_libs="$tmp_libs $deplib" ;;
  1934. esac
  1935. ;;
  1936. *) tmp_libs="$tmp_libs $deplib" ;;
  1937. esac
  1938. done
  1939. eval $var=\"$tmp_libs\"
  1940. done # for var
  1941. fi
  1942. if test "$pass" = "conv" &&
  1943. { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
  1944. libs="$deplibs" # reset libs
  1945. deplibs=
  1946. fi
  1947. done # for pass
  1948. if test $linkmode = prog; then
  1949. dlfiles="$newdlfiles"
  1950. dlprefiles="$newdlprefiles"
  1951. fi
  1952. case $linkmode in
  1953. oldlib)
  1954. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1955. $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1956. fi
  1957. if test -n "$rpath"; then
  1958. $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1959. fi
  1960. if test -n "$xrpath"; then
  1961. $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1962. fi
  1963. if test -n "$vinfo"; then
  1964. $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1965. fi
  1966. if test -n "$release"; then
  1967. $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1968. fi
  1969. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1970. $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1971. fi
  1972. # Now set the variables for building old libraries.
  1973. build_libtool_libs=no
  1974. oldlibs="$output"
  1975. objs="$objs$old_deplibs"
  1976. ;;
  1977. lib)
  1978. # Make sure we only generate libraries of the form `libNAME.la'.
  1979. case $outputname in
  1980. lib*)
  1981. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1982. eval libname=\"$libname_spec\"
  1983. ;;
  1984. *)
  1985. if test "$module" = no; then
  1986. $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1987. $echo "$help" 1>&2
  1988. exit 1
  1989. fi
  1990. if test "$need_lib_prefix" != no; then
  1991. # Add the "lib" prefix for modules if required
  1992. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1993. eval libname=\"$libname_spec\"
  1994. else
  1995. libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1996. fi
  1997. ;;
  1998. esac
  1999. if test -n "$objs"; then
  2000. if test "$deplibs_check_method" != pass_all; then
  2001. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  2002. exit 1
  2003. else
  2004. echo
  2005. echo "*** Warning: Linking the shared library $output against the non-libtool"
  2006. echo "*** objects $objs is not portable!"
  2007. libobjs="$libobjs $objs"
  2008. fi
  2009. fi
  2010. if test "$dlself" != no; then
  2011. $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  2012. fi
  2013. set dummy $rpath
  2014. if test $# -gt 2; then
  2015. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  2016. fi
  2017. install_libdir="$2"
  2018. oldlibs=
  2019. if test -z "$rpath"; then
  2020. if test "$build_libtool_libs" = yes; then
  2021. # Building a libtool convenience library.
  2022. libext=al
  2023. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  2024. build_libtool_libs=convenience
  2025. build_old_libs=yes
  2026. fi
  2027. if test -n "$vinfo"; then
  2028. $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  2029. fi
  2030. if test -n "$release"; then
  2031. $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  2032. fi
  2033. else
  2034. # Parse the version information argument.
  2035. save_ifs="$IFS"; IFS=':'
  2036. set dummy $vinfo 0 0 0
  2037. IFS="$save_ifs"
  2038. if test -n "$8"; then
  2039. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  2040. $echo "$help" 1>&2
  2041. exit 1
  2042. fi
  2043. current="$2"
  2044. revision="$3"
  2045. age="$4"
  2046. # Check that each of the things are valid numbers.
  2047. case $current in
  2048. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2049. *)
  2050. $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  2051. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2052. exit 1
  2053. ;;
  2054. esac
  2055. case $revision in
  2056. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2057. *)
  2058. $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  2059. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2060. exit 1
  2061. ;;
  2062. esac
  2063. case $age in
  2064. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2065. *)
  2066. $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  2067. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2068. exit 1
  2069. ;;
  2070. esac
  2071. if test $age -gt $current; then
  2072. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  2073. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2074. exit 1
  2075. fi
  2076. # Calculate the version variables.
  2077. major=
  2078. versuffix=
  2079. verstring=
  2080. case $version_type in
  2081. none) ;;
  2082. darwin)
  2083. # Like Linux, but with the current version available in
  2084. # verstring for coding it into the library header
  2085. major=.`expr $current - $age`
  2086. versuffix="$major.$age.$revision"
  2087. # Darwin ld doesn't like 0 for these options...
  2088. minor_current=`expr $current + 1`
  2089. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  2090. ;;
  2091. freebsd-aout)
  2092. major=".$current"
  2093. versuffix=".$current.$revision";
  2094. ;;
  2095. freebsd-elf)
  2096. major=".$current"
  2097. versuffix=".$current";
  2098. ;;
  2099. irix | nonstopux)
  2100. major=`expr $current - $age + 1`
  2101. case $version_type in
  2102. nonstopux) verstring_prefix=nonstopux ;;
  2103. *) verstring_prefix=sgi ;;
  2104. esac
  2105. verstring="$verstring_prefix$major.$revision"
  2106. # Add in all the interfaces that we are compatible with.
  2107. loop=$revision
  2108. while test $loop != 0; do
  2109. iface=`expr $revision - $loop`
  2110. loop=`expr $loop - 1`
  2111. verstring="$verstring_prefix$major.$iface:$verstring"
  2112. done
  2113. # Before this point, $major must not contain `.'.
  2114. major=.$major
  2115. versuffix="$major.$revision"
  2116. ;;
  2117. linux)
  2118. major=.`expr $current - $age`
  2119. versuffix="$major.$age.$revision"
  2120. ;;
  2121. osf)
  2122. major=.`expr $current - $age`
  2123. versuffix=".$current.$age.$revision"
  2124. verstring="$current.$age.$revision"
  2125. # Add in all the interfaces that we are compatible with.
  2126. loop=$age
  2127. while test $loop != 0; do
  2128. iface=`expr $current - $loop`
  2129. loop=`expr $loop - 1`
  2130. verstring="$verstring:${iface}.0"
  2131. done
  2132. # Make executables depend on our current version.
  2133. verstring="$verstring:${current}.0"
  2134. ;;
  2135. sunos)
  2136. major=".$current"
  2137. versuffix=".$current.$revision"
  2138. ;;
  2139. windows)
  2140. # Use '-' rather than '.', since we only want one
  2141. # extension on DOS 8.3 filesystems.
  2142. major=`expr $current - $age`
  2143. versuffix="-$major"
  2144. ;;
  2145. *)
  2146. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  2147. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  2148. exit 1
  2149. ;;
  2150. esac
  2151. # Clear the version info if we defaulted, and they specified a release.
  2152. if test -z "$vinfo" && test -n "$release"; then
  2153. major=
  2154. verstring="0.0"
  2155. case $version_type in
  2156. darwin)
  2157. # we can't check for "0.0" in archive_cmds due to quoting
  2158. # problems, so we reset it completely
  2159. verstring=""
  2160. ;;
  2161. *)
  2162. verstring="0.0"
  2163. ;;
  2164. esac
  2165. if test "$need_version" = no; then
  2166. versuffix=
  2167. else
  2168. versuffix=".0.0"
  2169. fi
  2170. fi
  2171. # Remove version info from name if versioning should be avoided
  2172. if test "$avoid_version" = yes && test "$need_version" = no; then
  2173. major=
  2174. versuffix=
  2175. verstring=""
  2176. fi
  2177. # Check to see if the archive will have undefined symbols.
  2178. if test "$allow_undefined" = yes; then
  2179. if test "$allow_undefined_flag" = unsupported; then
  2180. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  2181. build_libtool_libs=no
  2182. build_old_libs=yes
  2183. fi
  2184. else
  2185. # Don't allow undefined symbols.
  2186. allow_undefined_flag="$no_undefined_flag"
  2187. fi
  2188. fi
  2189. if test "$mode" != relink; then
  2190. # Remove our outputs.
  2191. $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  2192. $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  2193. fi
  2194. # Now set the variables for building old libraries.
  2195. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  2196. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  2197. # Transform .lo files to .o files.
  2198. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  2199. fi
  2200. # Eliminate all temporary directories.
  2201. for path in $notinst_path; do
  2202. lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
  2203. deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
  2204. dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
  2205. done
  2206. if test -n "$xrpath"; then
  2207. # If the user specified any rpath flags, then add them.
  2208. temp_xrpath=
  2209. for libdir in $xrpath; do
  2210. temp_xrpath="$temp_xrpath -R$libdir"
  2211. case "$finalize_rpath " in
  2212. *" $libdir "*) ;;
  2213. *) finalize_rpath="$finalize_rpath $libdir" ;;
  2214. esac
  2215. done
  2216. if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
  2217. dependency_libs="$temp_xrpath $dependency_libs"
  2218. fi
  2219. fi
  2220. # Make sure dlfiles contains only unique files that won't be dlpreopened
  2221. old_dlfiles="$dlfiles"
  2222. dlfiles=
  2223. for lib in $old_dlfiles; do
  2224. case " $dlprefiles $dlfiles " in
  2225. *" $lib "*) ;;
  2226. *) dlfiles="$dlfiles $lib" ;;
  2227. esac
  2228. done
  2229. # Make sure dlprefiles contains only unique files
  2230. old_dlprefiles="$dlprefiles"
  2231. dlprefiles=
  2232. for lib in $old_dlprefiles; do
  2233. case "$dlprefiles " in
  2234. *" $lib "*) ;;
  2235. *) dlprefiles="$dlprefiles $lib" ;;
  2236. esac
  2237. done
  2238. if test "$build_libtool_libs" = yes; then
  2239. if test -n "$rpath"; then
  2240. case $host in
  2241. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  2242. # these systems don't actually have a c library (as such)!
  2243. ;;
  2244. *-*-rhapsody* | *-*-darwin1.[012])
  2245. # Rhapsody C library is in the System framework
  2246. deplibs="$deplibs -framework System"
  2247. ;;
  2248. *-*-netbsd*)
  2249. # Don't link with libc until the a.out ld.so is fixed.
  2250. ;;
  2251. *-*-openbsd* | *-*-freebsd*)
  2252. # Do not include libc due to us having libc/libc_r.
  2253. ;;
  2254. *)
  2255. # Add libc to deplibs on all other systems if necessary.
  2256. if test $build_libtool_need_lc = "yes"; then
  2257. deplibs="$deplibs -lc"
  2258. fi
  2259. ;;
  2260. esac
  2261. fi
  2262. # Transform deplibs into only deplibs that can be linked in shared.
  2263. name_save=$name
  2264. libname_save=$libname
  2265. release_save=$release
  2266. versuffix_save=$versuffix
  2267. major_save=$major
  2268. # I'm not sure if I'm treating the release correctly. I think
  2269. # release should show up in the -l (ie -lgmp5) so we don't want to
  2270. # add it in twice. Is that correct?
  2271. release=""
  2272. versuffix=""
  2273. major=""
  2274. newdeplibs=
  2275. droppeddeps=no
  2276. case $deplibs_check_method in
  2277. pass_all)
  2278. # Don't check for shared/static. Everything works.
  2279. # This might be a little naive. We might want to check
  2280. # whether the library exists or not. But this is on
  2281. # osf3 & osf4 and I'm not really sure... Just
  2282. # implementing what was already the behaviour.
  2283. newdeplibs=$deplibs
  2284. ;;
  2285. test_compile)
  2286. # This code stresses the "libraries are programs" paradigm to its
  2287. # limits. Maybe even breaks it. We compile a program, linking it
  2288. # against the deplibs as a proxy for the library. Then we can check
  2289. # whether they linked in statically or dynamically with ldd.
  2290. $rm conftest.c
  2291. cat > conftest.c <<EOF
  2292. int main() { return 0; }
  2293. EOF
  2294. $rm conftest
  2295. $CC -o conftest conftest.c $deplibs
  2296. if test $? -eq 0 ; then
  2297. ldd_output=`ldd conftest`
  2298. for i in $deplibs; do
  2299. name="`expr $i : '-l\(.*\)'`"
  2300. # If $name is empty we are operating on a -L argument.
  2301. if test -n "$name" && test "$name" != "0"; then
  2302. libname=`eval \\$echo \"$libname_spec\"`
  2303. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  2304. set dummy $deplib_matches
  2305. deplib_match=$2
  2306. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  2307. newdeplibs="$newdeplibs $i"
  2308. else
  2309. droppeddeps=yes
  2310. echo
  2311. echo "*** Warning: dynamic linker does not accept needed library $i."
  2312. echo "*** I have the capability to make that library automatically link in when"
  2313. echo "*** you link to this library. But I can only do this if you have a"
  2314. echo "*** shared version of the library, which I believe you do not have"
  2315. echo "*** because a test_compile did reveal that the linker did not use it for"
  2316. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  2317. fi
  2318. else
  2319. newdeplibs="$newdeplibs $i"
  2320. fi
  2321. done
  2322. else
  2323. # Error occured in the first compile. Let's try to salvage
  2324. # the situation: Compile a separate program for each library.
  2325. for i in $deplibs; do
  2326. name="`expr $i : '-l\(.*\)'`"
  2327. # If $name is empty we are operating on a -L argument.
  2328. if test -n "$name" && test "$name" != "0"; then
  2329. $rm conftest
  2330. $CC -o conftest conftest.c $i
  2331. # Did it work?
  2332. if test $? -eq 0 ; then
  2333. ldd_output=`ldd conftest`
  2334. libname=`eval \\$echo \"$libname_spec\"`
  2335. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  2336. set dummy $deplib_matches
  2337. deplib_match=$2
  2338. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  2339. newdeplibs="$newdeplibs $i"
  2340. else
  2341. droppeddeps=yes
  2342. echo
  2343. echo "*** Warning: dynamic linker does not accept needed library $i."
  2344. echo "*** I have the capability to make that library automatically link in when"
  2345. echo "*** you link to this library. But I can only do this if you have a"
  2346. echo "*** shared version of the library, which you do not appear to have"
  2347. echo "*** because a test_compile did reveal that the linker did not use this one"
  2348. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  2349. fi
  2350. else
  2351. droppeddeps=yes
  2352. echo
  2353. echo "*** Warning! Library $i is needed by this library but I was not able to"
  2354. echo "*** make it link in! You will probably need to install it or some"
  2355. echo "*** library that it depends on before this library will be fully"
  2356. echo "*** functional. Installing it before continuing would be even better."
  2357. fi
  2358. else
  2359. newdeplibs="$newdeplibs $i"
  2360. fi
  2361. done
  2362. fi
  2363. ;;
  2364. file_magic*)
  2365. set dummy $deplibs_check_method
  2366. file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  2367. for a_deplib in $deplibs; do
  2368. name="`expr $a_deplib : '-l\(.*\)'`"
  2369. # If $name is empty we are operating on a -L argument.
  2370. if test -n "$name" && test "$name" != "0"; then
  2371. libname=`eval \\$echo \"$libname_spec\"`
  2372. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  2373. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  2374. for potent_lib in $potential_libs; do
  2375. # Follow soft links.
  2376. if ls -lLd "$potent_lib" 2>/dev/null \
  2377. | grep " -> " >/dev/null; then
  2378. continue
  2379. fi
  2380. # The statement above tries to avoid entering an
  2381. # endless loop below, in case of cyclic links.
  2382. # We might still enter an endless loop, since a link
  2383. # loop can be closed while we follow links,
  2384. # but so what?
  2385. potlib="$potent_lib"
  2386. while test -h "$potlib" 2>/dev/null; do
  2387. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  2388. case $potliblink in
  2389. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  2390. *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  2391. esac
  2392. done
  2393. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  2394. | ${SED} 10q \
  2395. | egrep "$file_magic_regex" > /dev/null; then
  2396. newdeplibs="$newdeplibs $a_deplib"
  2397. a_deplib=""
  2398. break 2
  2399. fi
  2400. done
  2401. done
  2402. if test -n "$a_deplib" ; then
  2403. droppeddeps=yes
  2404. echo
  2405. echo "*** Warning: linker path does not have real file for library $a_deplib."
  2406. echo "*** I have the capability to make that library automatically link in when"
  2407. echo "*** you link to this library. But I can only do this if you have a"
  2408. echo "*** shared version of the library, which you do not appear to have"
  2409. echo "*** because I did check the linker path looking for a file starting"
  2410. if test -z "$potlib" ; then
  2411. echo "*** with $libname but no candidates were found. (...for file magic test)"
  2412. else
  2413. echo "*** with $libname and none of the candidates passed a file format test"
  2414. echo "*** using a file magic. Last file checked: $potlib"
  2415. fi
  2416. fi
  2417. else
  2418. # Add a -L argument.
  2419. newdeplibs="$newdeplibs $a_deplib"
  2420. fi
  2421. done # Gone through all deplibs.
  2422. ;;
  2423. match_pattern*)
  2424. set dummy $deplibs_check_method
  2425. match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  2426. for a_deplib in $deplibs; do
  2427. name="`expr $a_deplib : '-l\(.*\)'`"
  2428. # If $name is empty we are operating on a -L argument.
  2429. if test -n "$name" && test "$name" != "0"; then
  2430. libname=`eval \\$echo \"$libname_spec\"`
  2431. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  2432. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  2433. for potent_lib in $potential_libs; do
  2434. potlib="$potent_lib" # see symlink-check below in file_magic test
  2435. if eval echo \"$potent_lib\" 2>/dev/null \
  2436. | ${SED} 10q \
  2437. | egrep "$match_pattern_regex" > /dev/null; then
  2438. newdeplibs="$newdeplibs $a_deplib"
  2439. a_deplib=""
  2440. break 2
  2441. fi
  2442. done
  2443. done
  2444. if test -n "$a_deplib" ; then
  2445. droppeddeps=yes
  2446. echo
  2447. echo "*** Warning: linker path does not have real file for library $a_deplib."
  2448. echo "*** I have the capability to make that library automatically link in when"
  2449. echo "*** you link to this library. But I can only do this if you have a"
  2450. echo "*** shared version of the library, which you do not appear to have"
  2451. echo "*** because I did check the linker path looking for a file starting"
  2452. if test -z "$potlib" ; then
  2453. echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  2454. else
  2455. echo "*** with $libname and none of the candidates passed a file format test"
  2456. echo "*** using a regex pattern. Last file checked: $potlib"
  2457. fi
  2458. fi
  2459. else
  2460. # Add a -L argument.
  2461. newdeplibs="$newdeplibs $a_deplib"
  2462. fi
  2463. done # Gone through all deplibs.
  2464. ;;
  2465. none | unknown | *)
  2466. newdeplibs=""
  2467. if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  2468. -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
  2469. grep . >/dev/null; then
  2470. echo
  2471. if test "X$deplibs_check_method" = "Xnone"; then
  2472. echo "*** Warning: inter-library dependencies are not supported in this platform."
  2473. else
  2474. echo "*** Warning: inter-library dependencies are not known to be supported."
  2475. fi
  2476. echo "*** All declared inter-library dependencies are being dropped."
  2477. droppeddeps=yes
  2478. fi
  2479. ;;
  2480. esac
  2481. versuffix=$versuffix_save
  2482. major=$major_save
  2483. release=$release_save
  2484. libname=$libname_save
  2485. name=$name_save
  2486. case $host in
  2487. *-*-rhapsody* | *-*-darwin1.[012])
  2488. # On Rhapsody replace the C library is the System framework
  2489. newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  2490. ;;
  2491. esac
  2492. if test "$droppeddeps" = yes; then
  2493. if test "$module" = yes; then
  2494. echo
  2495. echo "*** Warning: libtool could not satisfy all declared inter-library"
  2496. echo "*** dependencies of module $libname. Therefore, libtool will create"
  2497. echo "*** a static module, that should work as long as the dlopening"
  2498. echo "*** application is linked with the -dlopen flag."
  2499. if test -z "$global_symbol_pipe"; then
  2500. echo
  2501. echo "*** However, this would only work if libtool was able to extract symbol"
  2502. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2503. echo "*** not find such a program. So, this module is probably useless."
  2504. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2505. fi
  2506. if test "$build_old_libs" = no; then
  2507. oldlibs="$output_objdir/$libname.$libext"
  2508. build_libtool_libs=module
  2509. build_old_libs=yes
  2510. else
  2511. build_libtool_libs=no
  2512. fi
  2513. else
  2514. echo "*** The inter-library dependencies that have been dropped here will be"
  2515. echo "*** automatically added whenever a program is linked with this library"
  2516. echo "*** or is declared to -dlopen it."
  2517. if test $allow_undefined = no; then
  2518. echo
  2519. echo "*** Since this library must not contain undefined symbols,"
  2520. echo "*** because either the platform does not support them or"
  2521. echo "*** it was explicitly requested with -no-undefined,"
  2522. echo "*** libtool will only create a static version of it."
  2523. if test "$build_old_libs" = no; then
  2524. oldlibs="$output_objdir/$libname.$libext"
  2525. build_libtool_libs=module
  2526. build_old_libs=yes
  2527. else
  2528. build_libtool_libs=no
  2529. fi
  2530. fi
  2531. fi
  2532. fi
  2533. # Done checking deplibs!
  2534. deplibs=$newdeplibs
  2535. fi
  2536. # All the library-specific variables (install_libdir is set above).
  2537. library_names=
  2538. old_library=
  2539. dlname=
  2540. # Test again, we may have decided not to build it any more
  2541. if test "$build_libtool_libs" = yes; then
  2542. if test $hardcode_into_libs = yes; then
  2543. # Hardcode the library paths
  2544. hardcode_libdirs=
  2545. dep_rpath=
  2546. rpath="$finalize_rpath"
  2547. test "$mode" != relink && rpath="$compile_rpath$rpath"
  2548. for libdir in $rpath; do
  2549. if test -n "$hardcode_libdir_flag_spec"; then
  2550. if test -n "$hardcode_libdir_separator"; then
  2551. if test -z "$hardcode_libdirs"; then
  2552. hardcode_libdirs="$libdir"
  2553. else
  2554. # Just accumulate the unique libdirs.
  2555. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  2556. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2557. ;;
  2558. *)
  2559. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2560. ;;
  2561. esac
  2562. fi
  2563. else
  2564. eval flag=\"$hardcode_libdir_flag_spec\"
  2565. dep_rpath="$dep_rpath $flag"
  2566. fi
  2567. elif test -n "$runpath_var"; then
  2568. case "$perm_rpath " in
  2569. *" $libdir "*) ;;
  2570. *) perm_rpath="$perm_rpath $libdir" ;;
  2571. esac
  2572. fi
  2573. done
  2574. # Substitute the hardcoded libdirs into the rpath.
  2575. if test -n "$hardcode_libdir_separator" &&
  2576. test -n "$hardcode_libdirs"; then
  2577. libdir="$hardcode_libdirs"
  2578. eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  2579. fi
  2580. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  2581. # We should set the runpath_var.
  2582. rpath=
  2583. for dir in $perm_rpath; do
  2584. rpath="$rpath$dir:"
  2585. done
  2586. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  2587. fi
  2588. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  2589. fi
  2590. shlibpath="$finalize_shlibpath"
  2591. test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  2592. if test -n "$shlibpath"; then
  2593. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  2594. fi
  2595. # Get the real and link names of the library.
  2596. eval library_names=\"$library_names_spec\"
  2597. set dummy $library_names
  2598. realname="$2"
  2599. shift; shift
  2600. if test -n "$soname_spec"; then
  2601. eval soname=\"$soname_spec\"
  2602. else
  2603. soname="$realname"
  2604. fi
  2605. test -z "$dlname" && dlname=$soname
  2606. lib="$output_objdir/$realname"
  2607. for link
  2608. do
  2609. linknames="$linknames $link"
  2610. done
  2611. # Ensure that we have .o objects for linkers which dislike .lo
  2612. # (e.g. aix) in case we are running --disable-static
  2613. for obj in $libobjs; do
  2614. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  2615. if test "X$xdir" = "X$obj"; then
  2616. xdir="."
  2617. else
  2618. xdir="$xdir"
  2619. fi
  2620. baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  2621. oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2622. if test ! -f $xdir/$oldobj; then
  2623. $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
  2624. $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
  2625. fi
  2626. done
  2627. # Use standard objects if they are pic
  2628. test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2629. # Prepare the list of exported symbols
  2630. if test -z "$export_symbols"; then
  2631. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  2632. $show "generating symbol list for \`$libname.la'"
  2633. export_symbols="$output_objdir/$libname.exp"
  2634. $run $rm $export_symbols
  2635. eval cmds=\"$export_symbols_cmds\"
  2636. save_ifs="$IFS"; IFS='~'
  2637. for cmd in $cmds; do
  2638. IFS="$save_ifs"
  2639. $show "$cmd"
  2640. $run eval "$cmd" || exit $?
  2641. done
  2642. IFS="$save_ifs"
  2643. if test -n "$export_symbols_regex"; then
  2644. $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  2645. $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  2646. $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  2647. $run eval '$mv "${export_symbols}T" "$export_symbols"'
  2648. fi
  2649. fi
  2650. fi
  2651. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  2652. $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  2653. fi
  2654. if test -n "$convenience"; then
  2655. if test -n "$whole_archive_flag_spec"; then
  2656. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  2657. else
  2658. gentop="$output_objdir/${outputname}x"
  2659. $show "${rm}r $gentop"
  2660. $run ${rm}r "$gentop"
  2661. $show "mkdir $gentop"
  2662. $run mkdir "$gentop"
  2663. status=$?
  2664. if test $status -ne 0 && test ! -d "$gentop"; then
  2665. exit $status
  2666. fi
  2667. generated="$generated $gentop"
  2668. for xlib in $convenience; do
  2669. # Extract the objects.
  2670. case $xlib in
  2671. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2672. *) xabs=`pwd`"/$xlib" ;;
  2673. esac
  2674. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2675. xdir="$gentop/$xlib"
  2676. $show "${rm}r $xdir"
  2677. $run ${rm}r "$xdir"
  2678. $show "mkdir $xdir"
  2679. $run mkdir "$xdir"
  2680. status=$?
  2681. if test $status -ne 0 && test ! -d "$xdir"; then
  2682. exit $status
  2683. fi
  2684. $show "(cd $xdir && $AR x $xabs)"
  2685. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2686. libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2687. done
  2688. fi
  2689. fi
  2690. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  2691. eval flag=\"$thread_safe_flag_spec\"
  2692. linker_flags="$linker_flags $flag"
  2693. fi
  2694. # Make a backup of the uninstalled library when relinking
  2695. if test "$mode" = relink; then
  2696. $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  2697. fi
  2698. # Do each of the archive commands.
  2699. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  2700. eval cmds=\"$archive_expsym_cmds\"
  2701. else
  2702. save_deplibs="$deplibs"
  2703. for conv in $convenience; do
  2704. tmp_deplibs=
  2705. for test_deplib in $deplibs; do
  2706. if test "$test_deplib" != "$conv"; then
  2707. tmp_deplibs="$tmp_deplibs $test_deplib"
  2708. fi
  2709. done
  2710. deplibs="$tmp_deplibs"
  2711. done
  2712. eval cmds=\"$archive_cmds\"
  2713. deplibs="$save_deplibs"
  2714. fi
  2715. save_ifs="$IFS"; IFS='~'
  2716. for cmd in $cmds; do
  2717. IFS="$save_ifs"
  2718. $show "$cmd"
  2719. $run eval "$cmd" || exit $?
  2720. done
  2721. IFS="$save_ifs"
  2722. # Restore the uninstalled library and exit
  2723. if test "$mode" = relink; then
  2724. $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  2725. exit 0
  2726. fi
  2727. # Create links to the real library.
  2728. for linkname in $linknames; do
  2729. if test "$realname" != "$linkname"; then
  2730. $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  2731. $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  2732. fi
  2733. done
  2734. # If -module or -export-dynamic was specified, set the dlname.
  2735. if test "$module" = yes || test "$export_dynamic" = yes; then
  2736. # On all known operating systems, these are identical.
  2737. dlname="$soname"
  2738. fi
  2739. fi
  2740. ;;
  2741. obj)
  2742. if test -n "$deplibs"; then
  2743. $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  2744. fi
  2745. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2746. $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  2747. fi
  2748. if test -n "$rpath"; then
  2749. $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  2750. fi
  2751. if test -n "$xrpath"; then
  2752. $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  2753. fi
  2754. if test -n "$vinfo"; then
  2755. $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  2756. fi
  2757. if test -n "$release"; then
  2758. $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  2759. fi
  2760. case $output in
  2761. *.lo)
  2762. if test -n "$objs$old_deplibs"; then
  2763. $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  2764. exit 1
  2765. fi
  2766. libobj="$output"
  2767. obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  2768. ;;
  2769. *)
  2770. libobj=
  2771. obj="$output"
  2772. ;;
  2773. esac
  2774. # Delete the old objects.
  2775. $run $rm $obj $libobj
  2776. # Objects from convenience libraries. This assumes
  2777. # single-version convenience libraries. Whenever we create
  2778. # different ones for PIC/non-PIC, this we'll have to duplicate
  2779. # the extraction.
  2780. reload_conv_objs=
  2781. gentop=
  2782. # reload_cmds runs $LD directly, so let us get rid of
  2783. # -Wl from whole_archive_flag_spec
  2784. wl=
  2785. if test -n "$convenience"; then
  2786. if test -n "$whole_archive_flag_spec"; then
  2787. eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  2788. else
  2789. gentop="$output_objdir/${obj}x"
  2790. $show "${rm}r $gentop"
  2791. $run ${rm}r "$gentop"
  2792. $show "mkdir $gentop"
  2793. $run mkdir "$gentop"
  2794. status=$?
  2795. if test $status -ne 0 && test ! -d "$gentop"; then
  2796. exit $status
  2797. fi
  2798. generated="$generated $gentop"
  2799. for xlib in $convenience; do
  2800. # Extract the objects.
  2801. case $xlib in
  2802. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2803. *) xabs=`pwd`"/$xlib" ;;
  2804. esac
  2805. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2806. xdir="$gentop/$xlib"
  2807. $show "${rm}r $xdir"
  2808. $run ${rm}r "$xdir"
  2809. $show "mkdir $xdir"
  2810. $run mkdir "$xdir"
  2811. status=$?
  2812. if test $status -ne 0 && test ! -d "$xdir"; then
  2813. exit $status
  2814. fi
  2815. $show "(cd $xdir && $AR x $xabs)"
  2816. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2817. reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2818. done
  2819. fi
  2820. fi
  2821. # Create the old-style object.
  2822. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  2823. output="$obj"
  2824. eval cmds=\"$reload_cmds\"
  2825. save_ifs="$IFS"; IFS='~'
  2826. for cmd in $cmds; do
  2827. IFS="$save_ifs"
  2828. $show "$cmd"
  2829. $run eval "$cmd" || exit $?
  2830. done
  2831. IFS="$save_ifs"
  2832. # Exit if we aren't doing a library object file.
  2833. if test -z "$libobj"; then
  2834. if test -n "$gentop"; then
  2835. $show "${rm}r $gentop"
  2836. $run ${rm}r $gentop
  2837. fi
  2838. exit 0
  2839. fi
  2840. if test "$build_libtool_libs" != yes; then
  2841. if test -n "$gentop"; then
  2842. $show "${rm}r $gentop"
  2843. $run ${rm}r $gentop
  2844. fi
  2845. # Create an invalid libtool object if no PIC, so that we don't
  2846. # accidentally link it into a program.
  2847. $show "echo timestamp > $libobj"
  2848. $run eval "echo timestamp > $libobj" || exit $?
  2849. exit 0
  2850. fi
  2851. if test -n "$pic_flag" || test "$pic_mode" != default; then
  2852. # Only do commands if we really have different PIC objects.
  2853. reload_objs="$libobjs $reload_conv_objs"
  2854. output="$libobj"
  2855. eval cmds=\"$reload_cmds\"
  2856. save_ifs="$IFS"; IFS='~'
  2857. for cmd in $cmds; do
  2858. IFS="$save_ifs"
  2859. $show "$cmd"
  2860. $run eval "$cmd" || exit $?
  2861. done
  2862. IFS="$save_ifs"
  2863. else
  2864. # Just create a symlink.
  2865. $show $rm $libobj
  2866. $run $rm $libobj
  2867. xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  2868. if test "X$xdir" = "X$libobj"; then
  2869. xdir="."
  2870. else
  2871. xdir="$xdir"
  2872. fi
  2873. baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  2874. oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2875. $show "(cd $xdir && $LN_S $oldobj $baseobj)"
  2876. $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
  2877. fi
  2878. if test -n "$gentop"; then
  2879. $show "${rm}r $gentop"
  2880. $run ${rm}r $gentop
  2881. fi
  2882. exit 0
  2883. ;;
  2884. prog)
  2885. case $host in
  2886. *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  2887. esac
  2888. if test -n "$vinfo"; then
  2889. $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  2890. fi
  2891. if test -n "$release"; then
  2892. $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  2893. fi
  2894. if test "$preload" = yes; then
  2895. if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  2896. test "$dlopen_self_static" = unknown; then
  2897. $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  2898. fi
  2899. fi
  2900. case $host in
  2901. *-*-rhapsody* | *-*-darwin1.[012])
  2902. # On Rhapsody replace the C library is the System framework
  2903. compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  2904. finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  2905. case $host in
  2906. *darwin*)
  2907. # Don't allow lazy linking, it breaks C++ global constructors
  2908. compile_command="$compile_command ${wl}-bind_at_load"
  2909. finalize_command="$finalize_command ${wl}-bind_at_load"
  2910. ;;
  2911. esac
  2912. ;;
  2913. esac
  2914. compile_command="$compile_command $compile_deplibs"
  2915. finalize_command="$finalize_command $finalize_deplibs"
  2916. if test -n "$rpath$xrpath"; then
  2917. # If the user specified any rpath flags, then add them.
  2918. for libdir in $rpath $xrpath; do
  2919. # This is the magic to use -rpath.
  2920. case "$finalize_rpath " in
  2921. *" $libdir "*) ;;
  2922. *) finalize_rpath="$finalize_rpath $libdir" ;;
  2923. esac
  2924. done
  2925. fi
  2926. # Now hardcode the library paths
  2927. rpath=
  2928. hardcode_libdirs=
  2929. for libdir in $compile_rpath $finalize_rpath; do
  2930. if test -n "$hardcode_libdir_flag_spec"; then
  2931. if test -n "$hardcode_libdir_separator"; then
  2932. if test -z "$hardcode_libdirs"; then
  2933. hardcode_libdirs="$libdir"
  2934. else
  2935. # Just accumulate the unique libdirs.
  2936. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  2937. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2938. ;;
  2939. *)
  2940. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2941. ;;
  2942. esac
  2943. fi
  2944. else
  2945. eval flag=\"$hardcode_libdir_flag_spec\"
  2946. rpath="$rpath $flag"
  2947. fi
  2948. elif test -n "$runpath_var"; then
  2949. case "$perm_rpath " in
  2950. *" $libdir "*) ;;
  2951. *) perm_rpath="$perm_rpath $libdir" ;;
  2952. esac
  2953. fi
  2954. case $host in
  2955. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  2956. case :$dllsearchpath: in
  2957. *":$libdir:"*) ;;
  2958. *) dllsearchpath="$dllsearchpath:$libdir";;
  2959. esac
  2960. ;;
  2961. esac
  2962. done
  2963. # Substitute the hardcoded libdirs into the rpath.
  2964. if test -n "$hardcode_libdir_separator" &&
  2965. test -n "$hardcode_libdirs"; then
  2966. libdir="$hardcode_libdirs"
  2967. eval rpath=\" $hardcode_libdir_flag_spec\"
  2968. fi
  2969. compile_rpath="$rpath"
  2970. rpath=
  2971. hardcode_libdirs=
  2972. for libdir in $finalize_rpath; do
  2973. if test -n "$hardcode_libdir_flag_spec"; then
  2974. if test -n "$hardcode_libdir_separator"; then
  2975. if test -z "$hardcode_libdirs"; then
  2976. hardcode_libdirs="$libdir"
  2977. else
  2978. # Just accumulate the unique libdirs.
  2979. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  2980. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2981. ;;
  2982. *)
  2983. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2984. ;;
  2985. esac
  2986. fi
  2987. else
  2988. eval flag=\"$hardcode_libdir_flag_spec\"
  2989. rpath="$rpath $flag"
  2990. fi
  2991. elif test -n "$runpath_var"; then
  2992. case "$finalize_perm_rpath " in
  2993. *" $libdir "*) ;;
  2994. *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  2995. esac
  2996. fi
  2997. done
  2998. # Substitute the hardcoded libdirs into the rpath.
  2999. if test -n "$hardcode_libdir_separator" &&
  3000. test -n "$hardcode_libdirs"; then
  3001. libdir="$hardcode_libdirs"
  3002. eval rpath=\" $hardcode_libdir_flag_spec\"
  3003. fi
  3004. finalize_rpath="$rpath"
  3005. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  3006. # Transform all the library objects into standard objects.
  3007. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3008. finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3009. fi
  3010. dlsyms=
  3011. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3012. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  3013. dlsyms="${outputname}S.c"
  3014. else
  3015. $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  3016. fi
  3017. fi
  3018. if test -n "$dlsyms"; then
  3019. case $dlsyms in
  3020. "") ;;
  3021. *.c)
  3022. # Discover the nlist of each of the dlfiles.
  3023. nlist="$output_objdir/${outputname}.nm"
  3024. $show "$rm $nlist ${nlist}S ${nlist}T"
  3025. $run $rm "$nlist" "${nlist}S" "${nlist}T"
  3026. # Parse the name list into a source file.
  3027. $show "creating $output_objdir/$dlsyms"
  3028. test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  3029. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  3030. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  3031. #ifdef __cplusplus
  3032. extern \"C\" {
  3033. #endif
  3034. /* Prevent the only kind of declaration conflicts we can make. */
  3035. #define lt_preloaded_symbols some_other_symbol
  3036. /* External symbol declarations for the compiler. */\
  3037. "
  3038. if test "$dlself" = yes; then
  3039. $show "generating symbol list for \`$output'"
  3040. test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  3041. # Add our own program objects to the symbol list.
  3042. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3043. for arg in $progfiles; do
  3044. $show "extracting global C symbols from \`$arg'"
  3045. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  3046. done
  3047. if test -n "$exclude_expsyms"; then
  3048. $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  3049. $run eval '$mv "$nlist"T "$nlist"'
  3050. fi
  3051. if test -n "$export_symbols_regex"; then
  3052. $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  3053. $run eval '$mv "$nlist"T "$nlist"'
  3054. fi
  3055. # Prepare the list of exported symbols
  3056. if test -z "$export_symbols"; then
  3057. export_symbols="$output_objdir/$output.exp"
  3058. $run $rm $export_symbols
  3059. $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  3060. else
  3061. $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  3062. $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  3063. $run eval 'mv "$nlist"T "$nlist"'
  3064. fi
  3065. fi
  3066. for arg in $dlprefiles; do
  3067. $show "extracting global C symbols from \`$arg'"
  3068. name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
  3069. $run eval 'echo ": $name " >> "$nlist"'
  3070. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  3071. done
  3072. if test -z "$run"; then
  3073. # Make sure we have at least an empty file.
  3074. test -f "$nlist" || : > "$nlist"
  3075. if test -n "$exclude_expsyms"; then
  3076. egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  3077. $mv "$nlist"T "$nlist"
  3078. fi
  3079. # Try sorting and uniquifying the output.
  3080. if grep -v "^: " < "$nlist" |
  3081. if sort -k 3 </dev/null >/dev/null 2>&1; then
  3082. sort -k 3
  3083. else
  3084. sort +2
  3085. fi |
  3086. uniq > "$nlist"S; then
  3087. :
  3088. else
  3089. grep -v "^: " < "$nlist" > "$nlist"S
  3090. fi
  3091. if test -f "$nlist"S; then
  3092. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  3093. else
  3094. echo '/* NONE */' >> "$output_objdir/$dlsyms"
  3095. fi
  3096. $echo >> "$output_objdir/$dlsyms" "\
  3097. #undef lt_preloaded_symbols
  3098. #if defined (__STDC__) && __STDC__
  3099. # define lt_ptr void *
  3100. #else
  3101. # define lt_ptr char *
  3102. # define const
  3103. #endif
  3104. /* The mapping between symbol names and symbols. */
  3105. const struct {
  3106. const char *name;
  3107. lt_ptr address;
  3108. }
  3109. lt_preloaded_symbols[] =
  3110. {\
  3111. "
  3112. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
  3113. $echo >> "$output_objdir/$dlsyms" "\
  3114. {0, (lt_ptr) 0}
  3115. };
  3116. /* This works around a problem in FreeBSD linker */
  3117. #ifdef FREEBSD_WORKAROUND
  3118. static const void *lt_preloaded_setup() {
  3119. return lt_preloaded_symbols;
  3120. }
  3121. #endif
  3122. #ifdef __cplusplus
  3123. }
  3124. #endif\
  3125. "
  3126. fi
  3127. pic_flag_for_symtable=
  3128. case $host in
  3129. # compiling the symbol table file with pic_flag works around
  3130. # a FreeBSD bug that causes programs to crash when -lm is
  3131. # linked before any other PIC object. But we must not use
  3132. # pic_flag when linking with -static. The problem exists in
  3133. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  3134. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  3135. case "$compile_command " in
  3136. *" -static "*) ;;
  3137. *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  3138. esac;;
  3139. *-*-hpux*)
  3140. case "$compile_command " in
  3141. *" -static "*) ;;
  3142. *) pic_flag_for_symtable=" $pic_flag -DPIC";;
  3143. esac
  3144. esac
  3145. # Now compile the dynamic symbol file.
  3146. $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  3147. $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  3148. # Clean up the generated files.
  3149. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  3150. $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  3151. # Transform the symbol file into the correct name.
  3152. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  3153. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  3154. ;;
  3155. *)
  3156. $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  3157. exit 1
  3158. ;;
  3159. esac
  3160. else
  3161. # We keep going just in case the user didn't refer to
  3162. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  3163. # really was required.
  3164. # Nullify the symbol file.
  3165. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  3166. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  3167. fi
  3168. if test $need_relink = no || test "$build_libtool_libs" != yes; then
  3169. # Replace the output file specification.
  3170. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  3171. link_command="$compile_command$compile_rpath"
  3172. # We have no uninstalled library dependencies, so finalize right now.
  3173. $show "$link_command"
  3174. $run eval "$link_command"
  3175. status=$?
  3176. # Delete the generated files.
  3177. if test -n "$dlsyms"; then
  3178. $show "$rm $output_objdir/${outputname}S.${objext}"
  3179. $run $rm "$output_objdir/${outputname}S.${objext}"
  3180. fi
  3181. exit $status
  3182. fi
  3183. if test -n "$shlibpath_var"; then
  3184. # We should set the shlibpath_var
  3185. rpath=
  3186. for dir in $temp_rpath; do
  3187. case $dir in
  3188. [\\/]* | [A-Za-z]:[\\/]*)
  3189. # Absolute path.
  3190. rpath="$rpath$dir:"
  3191. ;;
  3192. *)
  3193. # Relative path: add a thisdir entry.
  3194. rpath="$rpath\$thisdir/$dir:"
  3195. ;;
  3196. esac
  3197. done
  3198. temp_rpath="$rpath"
  3199. fi
  3200. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  3201. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  3202. fi
  3203. if test -n "$finalize_shlibpath"; then
  3204. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  3205. fi
  3206. compile_var=
  3207. finalize_var=
  3208. if test -n "$runpath_var"; then
  3209. if test -n "$perm_rpath"; then
  3210. # We should set the runpath_var.
  3211. rpath=
  3212. for dir in $perm_rpath; do
  3213. rpath="$rpath$dir:"
  3214. done
  3215. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  3216. fi
  3217. if test -n "$finalize_perm_rpath"; then
  3218. # We should set the runpath_var.
  3219. rpath=
  3220. for dir in $finalize_perm_rpath; do
  3221. rpath="$rpath$dir:"
  3222. done
  3223. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  3224. fi
  3225. fi
  3226. if test "$no_install" = yes; then
  3227. # We don't need to create a wrapper script.
  3228. link_command="$compile_var$compile_command$compile_rpath"
  3229. # Replace the output file specification.
  3230. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  3231. # Delete the old output file.
  3232. $run $rm $output
  3233. # Link the executable and exit
  3234. $show "$link_command"
  3235. $run eval "$link_command" || exit $?
  3236. exit 0
  3237. fi
  3238. if test "$hardcode_action" = relink; then
  3239. # Fast installation is not supported
  3240. link_command="$compile_var$compile_command$compile_rpath"
  3241. relink_command="$finalize_var$finalize_command$finalize_rpath"
  3242. $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  3243. $echo "$modename: \`$output' will be relinked during installation" 1>&2
  3244. else
  3245. if test "$fast_install" != no; then
  3246. link_command="$finalize_var$compile_command$finalize_rpath"
  3247. if test "$fast_install" = yes; then
  3248. relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  3249. else
  3250. # fast_install is set to needless
  3251. relink_command=
  3252. fi
  3253. else
  3254. link_command="$compile_var$compile_command$compile_rpath"
  3255. relink_command="$finalize_var$finalize_command$finalize_rpath"
  3256. fi
  3257. fi
  3258. # Replace the output file specification.
  3259. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  3260. # Delete the old output files.
  3261. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  3262. $show "$link_command"
  3263. $run eval "$link_command" || exit $?
  3264. # Now create the wrapper script.
  3265. $show "creating $output"
  3266. # Quote the relink command for shipping.
  3267. if test -n "$relink_command"; then
  3268. # Preserve any variables that may affect compiler behavior
  3269. for var in $variables_saved_for_relink; do
  3270. if eval test -z \"\${$var+set}\"; then
  3271. relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  3272. elif eval var_value=\$$var; test -z "$var_value"; then
  3273. relink_command="$var=; export $var; $relink_command"
  3274. else
  3275. var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  3276. relink_command="$var=\"$var_value\"; export $var; $relink_command"
  3277. fi
  3278. done
  3279. relink_command="(cd `pwd`; $relink_command)"
  3280. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  3281. fi
  3282. # Quote $echo for shipping.
  3283. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  3284. case $0 in
  3285. [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  3286. *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  3287. esac
  3288. qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  3289. else
  3290. qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  3291. fi
  3292. # Only actually do things if our run command is non-null.
  3293. if test -z "$run"; then
  3294. # win32 will think the script is a binary if it has
  3295. # a .exe suffix, so we strip it off here.
  3296. case $output in
  3297. *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
  3298. esac
  3299. # test for cygwin because mv fails w/o .exe extensions
  3300. case $host in
  3301. *cygwin*) exeext=.exe ;;
  3302. *) exeext= ;;
  3303. esac
  3304. $rm $output
  3305. trap "$rm $output; exit 1" 1 2 15
  3306. $echo > $output "\
  3307. #! $SHELL
  3308. # $output - temporary wrapper script for $objdir/$outputname
  3309. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  3310. #
  3311. # The $output program cannot be directly executed until all the libtool
  3312. # libraries that it depends on are installed.
  3313. #
  3314. # This wrapper script should never be moved out of the build directory.
  3315. # If it is, it will not operate correctly.
  3316. # Sed substitution that helps us do robust quoting. It backslashifies
  3317. # metacharacters that are still active within double-quoted strings.
  3318. Xsed="${SED}"' -e 1s/^X//'
  3319. sed_quote_subst='$sed_quote_subst'
  3320. # The HP-UX ksh and POSIX shell print the target directory to stdout
  3321. # if CDPATH is set.
  3322. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  3323. relink_command=\"$relink_command\"
  3324. # This environment variable determines our operation mode.
  3325. if test \"\$libtool_install_magic\" = \"$magic\"; then
  3326. # install mode needs the following variable:
  3327. notinst_deplibs='$notinst_deplibs'
  3328. else
  3329. # When we are sourced in execute mode, \$file and \$echo are already set.
  3330. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  3331. echo=\"$qecho\"
  3332. file=\"\$0\"
  3333. # Make sure echo works.
  3334. if test \"X\$1\" = X--no-reexec; then
  3335. # Discard the --no-reexec flag, and continue.
  3336. shift
  3337. elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  3338. # Yippee, \$echo works!
  3339. :
  3340. else
  3341. # Restart under the correct shell, and then maybe \$echo will work.
  3342. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  3343. fi
  3344. fi\
  3345. "
  3346. $echo >> $output "\
  3347. # Find the directory that this script lives in.
  3348. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  3349. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  3350. # Follow symbolic links until we get to the real thisdir.
  3351. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  3352. while test -n \"\$file\"; do
  3353. destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  3354. # If there was a directory component, then change thisdir.
  3355. if test \"x\$destdir\" != \"x\$file\"; then
  3356. case \"\$destdir\" in
  3357. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  3358. *) thisdir=\"\$thisdir/\$destdir\" ;;
  3359. esac
  3360. fi
  3361. file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  3362. file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  3363. done
  3364. # Try to get the absolute directory name.
  3365. absdir=\`cd \"\$thisdir\" && pwd\`
  3366. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  3367. "
  3368. if test "$fast_install" = yes; then
  3369. echo >> $output "\
  3370. program=lt-'$outputname'$exeext
  3371. progdir=\"\$thisdir/$objdir\"
  3372. if test ! -f \"\$progdir/\$program\" || \\
  3373. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  3374. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  3375. file=\"\$\$-\$program\"
  3376. if test ! -d \"\$progdir\"; then
  3377. $mkdir \"\$progdir\"
  3378. else
  3379. $rm \"\$progdir/\$file\"
  3380. fi"
  3381. echo >> $output "\
  3382. # relink executable if necessary
  3383. if test -n \"\$relink_command\"; then
  3384. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  3385. else
  3386. $echo \"\$relink_command_output\" >&2
  3387. $rm \"\$progdir/\$file\"
  3388. exit 1
  3389. fi
  3390. fi
  3391. $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  3392. { $rm \"\$progdir/\$program\";
  3393. $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  3394. $rm \"\$progdir/\$file\"
  3395. fi"
  3396. else
  3397. echo >> $output "\
  3398. program='$outputname'
  3399. progdir=\"\$thisdir/$objdir\"
  3400. "
  3401. fi
  3402. echo >> $output "\
  3403. if test -f \"\$progdir/\$program\"; then"
  3404. # Export our shlibpath_var if we have one.
  3405. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  3406. $echo >> $output "\
  3407. # Add our own library path to $shlibpath_var
  3408. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  3409. # Some systems cannot cope with colon-terminated $shlibpath_var
  3410. # The second colon is a workaround for a bug in BeOS R4 ${SED}
  3411. $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  3412. export $shlibpath_var
  3413. "
  3414. fi
  3415. # fixup the dll searchpath if we need to.
  3416. if test -n "$dllsearchpath"; then
  3417. $echo >> $output "\
  3418. # Add the dll search path components to the executable PATH
  3419. PATH=$dllsearchpath:\$PATH
  3420. "
  3421. fi
  3422. $echo >> $output "\
  3423. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  3424. # Run the actual program with our arguments.
  3425. "
  3426. case $host in
  3427. # win32 systems need to use the prog path for dll
  3428. # lookup to work
  3429. *-*-cygwin* | *-*-pw32*)
  3430. $echo >> $output "\
  3431. exec \$progdir/\$program \${1+\"\$@\"}
  3432. "
  3433. ;;
  3434. # Backslashes separate directories on plain windows
  3435. *-*-mingw | *-*-os2*)
  3436. $echo >> $output "\
  3437. exec \$progdir\\\\\$program \${1+\"\$@\"}
  3438. "
  3439. ;;
  3440. *)
  3441. $echo >> $output "\
  3442. # Export the path to the program.
  3443. PATH=\"\$progdir:\$PATH\"
  3444. export PATH
  3445. exec \$program \${1+\"\$@\"}
  3446. "
  3447. ;;
  3448. esac
  3449. $echo >> $output "\
  3450. \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  3451. exit 1
  3452. fi
  3453. else
  3454. # The program doesn't exist.
  3455. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  3456. \$echo \"This script is just a wrapper for \$program.\" 1>&2
  3457. echo \"See the $PACKAGE documentation for more information.\" 1>&2
  3458. exit 1
  3459. fi
  3460. fi\
  3461. "
  3462. chmod +x $output
  3463. fi
  3464. exit 0
  3465. ;;
  3466. esac
  3467. # See if we need to build an old-fashioned archive.
  3468. for oldlib in $oldlibs; do
  3469. if test "$build_libtool_libs" = convenience; then
  3470. oldobjs="$libobjs_save"
  3471. addlibs="$convenience"
  3472. build_libtool_libs=no
  3473. else
  3474. if test "$build_libtool_libs" = module; then
  3475. oldobjs="$libobjs_save"
  3476. build_libtool_libs=no
  3477. else
  3478. oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  3479. fi
  3480. addlibs="$old_convenience"
  3481. fi
  3482. if test -n "$addlibs"; then
  3483. gentop="$output_objdir/${outputname}x"
  3484. $show "${rm}r $gentop"
  3485. $run ${rm}r "$gentop"
  3486. $show "mkdir $gentop"
  3487. $run mkdir "$gentop"
  3488. status=$?
  3489. if test $status -ne 0 && test ! -d "$gentop"; then
  3490. exit $status
  3491. fi
  3492. generated="$generated $gentop"
  3493. # Add in members from convenience archives.
  3494. for xlib in $addlibs; do
  3495. # Extract the objects.
  3496. case $xlib in
  3497. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  3498. *) xabs=`pwd`"/$xlib" ;;
  3499. esac
  3500. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  3501. xdir="$gentop/$xlib"
  3502. $show "${rm}r $xdir"
  3503. $run ${rm}r "$xdir"
  3504. $show "mkdir $xdir"
  3505. $run mkdir "$xdir"
  3506. status=$?
  3507. if test $status -ne 0 && test ! -d "$xdir"; then
  3508. exit $status
  3509. fi
  3510. $show "(cd $xdir && $AR x $xabs)"
  3511. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  3512. oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  3513. done
  3514. fi
  3515. # Do each command in the archive commands.
  3516. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  3517. eval cmds=\"$old_archive_from_new_cmds\"
  3518. else
  3519. # Ensure that we have .o objects in place in case we decided
  3520. # not to build a shared library, and have fallen back to building
  3521. # static libs even though --disable-static was passed!
  3522. for oldobj in $oldobjs; do
  3523. if test ! -f $oldobj; then
  3524. xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
  3525. if test "X$xdir" = "X$oldobj"; then
  3526. xdir="."
  3527. else
  3528. xdir="$xdir"
  3529. fi
  3530. baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
  3531. obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  3532. $show "(cd $xdir && ${LN_S} $obj $baseobj)"
  3533. $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
  3534. fi
  3535. done
  3536. eval cmds=\"$old_archive_cmds\"
  3537. fi
  3538. save_ifs="$IFS"; IFS='~'
  3539. for cmd in $cmds; do
  3540. IFS="$save_ifs"
  3541. $show "$cmd"
  3542. $run eval "$cmd" || exit $?
  3543. done
  3544. IFS="$save_ifs"
  3545. done
  3546. if test -n "$generated"; then
  3547. $show "${rm}r$generated"
  3548. $run ${rm}r$generated
  3549. fi
  3550. # Now create the libtool archive.
  3551. case $output in
  3552. *.la)
  3553. old_library=
  3554. test "$build_old_libs" = yes && old_library="$libname.$libext"
  3555. $show "creating $output"
  3556. # Preserve any variables that may affect compiler behavior
  3557. for var in $variables_saved_for_relink; do
  3558. if eval test -z \"\${$var+set}\"; then
  3559. relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  3560. elif eval var_value=\$$var; test -z "$var_value"; then
  3561. relink_command="$var=; export $var; $relink_command"
  3562. else
  3563. var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  3564. relink_command="$var=\"$var_value\"; export $var; $relink_command"
  3565. fi
  3566. done
  3567. # Quote the link command for shipping.
  3568. relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
  3569. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  3570. # Only create the output if not a dry run.
  3571. if test -z "$run"; then
  3572. for installed in no yes; do
  3573. if test "$installed" = yes; then
  3574. if test -z "$install_libdir"; then
  3575. break
  3576. fi
  3577. output="$output_objdir/$outputname"i
  3578. # Replace all uninstalled libtool libraries with the installed ones
  3579. newdependency_libs=
  3580. for deplib in $dependency_libs; do
  3581. case $deplib in
  3582. *.la)
  3583. name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  3584. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  3585. if test -z "$libdir"; then
  3586. $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  3587. exit 1
  3588. fi
  3589. newdependency_libs="$newdependency_libs $libdir/$name"
  3590. ;;
  3591. *) newdependency_libs="$newdependency_libs $deplib" ;;
  3592. esac
  3593. done
  3594. dependency_libs="$newdependency_libs"
  3595. newdlfiles=
  3596. for lib in $dlfiles; do
  3597. name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  3598. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  3599. if test -z "$libdir"; then
  3600. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3601. exit 1
  3602. fi
  3603. newdlfiles="$newdlfiles $libdir/$name"
  3604. done
  3605. dlfiles="$newdlfiles"
  3606. newdlprefiles=
  3607. for lib in $dlprefiles; do
  3608. name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  3609. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  3610. if test -z "$libdir"; then
  3611. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3612. exit 1
  3613. fi
  3614. newdlprefiles="$newdlprefiles $libdir/$name"
  3615. done
  3616. dlprefiles="$newdlprefiles"
  3617. fi
  3618. $rm $output
  3619. # place dlname in correct position for cygwin
  3620. tdlname=$dlname
  3621. case $host,$output,$installed,$module,$dlname in
  3622. *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  3623. esac
  3624. $echo > $output "\
  3625. # $outputname - a libtool library file
  3626. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  3627. #
  3628. # Please DO NOT delete this file!
  3629. # It is necessary for linking the library.
  3630. # The name that we can dlopen(3).
  3631. dlname='$tdlname'
  3632. # Names of this library.
  3633. library_names='$library_names'
  3634. # The name of the static archive.
  3635. old_library='$old_library'
  3636. # Libraries that this one depends upon.
  3637. dependency_libs='$dependency_libs'
  3638. # Version information for $libname.
  3639. current=$current
  3640. age=$age
  3641. revision=$revision
  3642. # Is this an already installed library?
  3643. installed=$installed
  3644. # Files to dlopen/dlpreopen
  3645. dlopen='$dlfiles'
  3646. dlpreopen='$dlprefiles'
  3647. # Directory that this library needs to be installed in:
  3648. libdir='$install_libdir'"
  3649. if test "$installed" = no && test $need_relink = yes; then
  3650. $echo >> $output "\
  3651. relink_command=\"$relink_command\""
  3652. fi
  3653. done
  3654. fi
  3655. # Do a symbolic link so that the libtool archive can be found in
  3656. # LD_LIBRARY_PATH before the program is installed.
  3657. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  3658. $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  3659. ;;
  3660. esac
  3661. exit 0
  3662. ;;
  3663. # libtool install mode
  3664. install)
  3665. modename="$modename: install"
  3666. # There may be an optional sh(1) argument at the beginning of
  3667. # install_prog (especially on Windows NT).
  3668. if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  3669. # Allow the use of GNU shtool's install command.
  3670. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
  3671. # Aesthetically quote it.
  3672. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  3673. case $arg in
  3674. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  3675. arg="\"$arg\""
  3676. ;;
  3677. esac
  3678. install_prog="$arg "
  3679. arg="$1"
  3680. shift
  3681. else
  3682. install_prog=
  3683. arg="$nonopt"
  3684. fi
  3685. # The real first argument should be the name of the installation program.
  3686. # Aesthetically quote it.
  3687. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3688. case $arg in
  3689. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  3690. arg="\"$arg\""
  3691. ;;
  3692. esac
  3693. install_prog="$install_prog$arg"
  3694. # We need to accept at least all the BSD install flags.
  3695. dest=
  3696. files=
  3697. opts=
  3698. prev=
  3699. install_type=
  3700. isdir=no
  3701. stripme=
  3702. for arg
  3703. do
  3704. if test -n "$dest"; then
  3705. files="$files $dest"
  3706. dest="$arg"
  3707. continue
  3708. fi
  3709. case $arg in
  3710. -d) isdir=yes ;;
  3711. -f) prev="-f" ;;
  3712. -g) prev="-g" ;;
  3713. -m) prev="-m" ;;
  3714. -o) prev="-o" ;;
  3715. -s)
  3716. stripme=" -s"
  3717. continue
  3718. ;;
  3719. -*) ;;
  3720. *)
  3721. # If the previous option needed an argument, then skip it.
  3722. if test -n "$prev"; then
  3723. prev=
  3724. else
  3725. dest="$arg"
  3726. continue
  3727. fi
  3728. ;;
  3729. esac
  3730. # Aesthetically quote the argument.
  3731. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3732. case $arg in
  3733. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  3734. arg="\"$arg\""
  3735. ;;
  3736. esac
  3737. install_prog="$install_prog $arg"
  3738. done
  3739. if test -z "$install_prog"; then
  3740. $echo "$modename: you must specify an install program" 1>&2
  3741. $echo "$help" 1>&2
  3742. exit 1
  3743. fi
  3744. if test -n "$prev"; then
  3745. $echo "$modename: the \`$prev' option requires an argument" 1>&2
  3746. $echo "$help" 1>&2
  3747. exit 1
  3748. fi
  3749. if test -z "$files"; then
  3750. if test -z "$dest"; then
  3751. $echo "$modename: no file or destination specified" 1>&2
  3752. else
  3753. $echo "$modename: you must specify a destination" 1>&2
  3754. fi
  3755. $echo "$help" 1>&2
  3756. exit 1
  3757. fi
  3758. # Strip any trailing slash from the destination.
  3759. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  3760. # Check to see that the destination is a directory.
  3761. test -d "$dest" && isdir=yes
  3762. if test "$isdir" = yes; then
  3763. destdir="$dest"
  3764. destname=
  3765. else
  3766. destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  3767. test "X$destdir" = "X$dest" && destdir=.
  3768. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  3769. # Not a directory, so check to see that there is only one file specified.
  3770. set dummy $files
  3771. if test $# -gt 2; then
  3772. $echo "$modename: \`$dest' is not a directory" 1>&2
  3773. $echo "$help" 1>&2
  3774. exit 1
  3775. fi
  3776. fi
  3777. case $destdir in
  3778. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3779. *)
  3780. for file in $files; do
  3781. case $file in
  3782. *.lo) ;;
  3783. *)
  3784. $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  3785. $echo "$help" 1>&2
  3786. exit 1
  3787. ;;
  3788. esac
  3789. done
  3790. ;;
  3791. esac
  3792. # This variable tells wrapper scripts just to set variables rather
  3793. # than running their programs.
  3794. libtool_install_magic="$magic"
  3795. staticlibs=
  3796. future_libdirs=
  3797. current_libdirs=
  3798. for file in $files; do
  3799. # Do each installation.
  3800. case $file in
  3801. *.$libext)
  3802. # Do the static libraries later.
  3803. staticlibs="$staticlibs $file"
  3804. ;;
  3805. *.la)
  3806. # Check to see that this really is a libtool archive.
  3807. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3808. else
  3809. $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  3810. $echo "$help" 1>&2
  3811. exit 1
  3812. fi
  3813. library_names=
  3814. old_library=
  3815. relink_command=
  3816. # If there is no directory component, then add one.
  3817. case $file in
  3818. */* | *\\*) . $file ;;
  3819. *) . ./$file ;;
  3820. esac
  3821. # Add the libdir to current_libdirs if it is the destination.
  3822. if test "X$destdir" = "X$libdir"; then
  3823. case "$current_libdirs " in
  3824. *" $libdir "*) ;;
  3825. *) current_libdirs="$current_libdirs $libdir" ;;
  3826. esac
  3827. else
  3828. # Note the libdir as a future libdir.
  3829. case "$future_libdirs " in
  3830. *" $libdir "*) ;;
  3831. *) future_libdirs="$future_libdirs $libdir" ;;
  3832. esac
  3833. fi
  3834. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
  3835. test "X$dir" = "X$file/" && dir=
  3836. dir="$dir$objdir"
  3837. if test -n "$relink_command"; then
  3838. $echo "$modename: warning: relinking \`$file'" 1>&2
  3839. $show "$relink_command"
  3840. if $run eval "$relink_command"; then :
  3841. else
  3842. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  3843. continue
  3844. fi
  3845. fi
  3846. # See the names of the shared library.
  3847. set dummy $library_names
  3848. if test -n "$2"; then
  3849. realname="$2"
  3850. shift
  3851. shift
  3852. srcname="$realname"
  3853. test -n "$relink_command" && srcname="$realname"T
  3854. # Install the shared library and build the symlinks.
  3855. $show "$install_prog $dir/$srcname $destdir/$realname"
  3856. $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  3857. if test -n "$stripme" && test -n "$striplib"; then
  3858. $show "$striplib $destdir/$realname"
  3859. $run eval "$striplib $destdir/$realname" || exit $?
  3860. fi
  3861. if test $# -gt 0; then
  3862. # Delete the old symlinks, and create new ones.
  3863. for linkname
  3864. do
  3865. if test "$linkname" != "$realname"; then
  3866. $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3867. $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3868. fi
  3869. done
  3870. fi
  3871. # Do each command in the postinstall commands.
  3872. lib="$destdir/$realname"
  3873. eval cmds=\"$postinstall_cmds\"
  3874. save_ifs="$IFS"; IFS='~'
  3875. for cmd in $cmds; do
  3876. IFS="$save_ifs"
  3877. $show "$cmd"
  3878. $run eval "$cmd" || exit $?
  3879. done
  3880. IFS="$save_ifs"
  3881. fi
  3882. # Install the pseudo-library for information purposes.
  3883. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3884. instname="$dir/$name"i
  3885. $show "$install_prog $instname $destdir/$name"
  3886. $run eval "$install_prog $instname $destdir/$name" || exit $?
  3887. # Maybe install the static library, too.
  3888. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  3889. ;;
  3890. *.lo)
  3891. # Install (i.e. copy) a libtool object.
  3892. # Figure out destination file name, if it wasn't already specified.
  3893. if test -n "$destname"; then
  3894. destfile="$destdir/$destname"
  3895. else
  3896. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3897. destfile="$destdir/$destfile"
  3898. fi
  3899. # Deduce the name of the destination old-style object file.
  3900. case $destfile in
  3901. *.lo)
  3902. staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  3903. ;;
  3904. *.$objext)
  3905. staticdest="$destfile"
  3906. destfile=
  3907. ;;
  3908. *)
  3909. $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  3910. $echo "$help" 1>&2
  3911. exit 1
  3912. ;;
  3913. esac
  3914. # Install the libtool object if requested.
  3915. if test -n "$destfile"; then
  3916. $show "$install_prog $file $destfile"
  3917. $run eval "$install_prog $file $destfile" || exit $?
  3918. fi
  3919. # Install the old object if enabled.
  3920. if test "$build_old_libs" = yes; then
  3921. # Deduce the name of the old-style object file.
  3922. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  3923. $show "$install_prog $staticobj $staticdest"
  3924. $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  3925. fi
  3926. exit 0
  3927. ;;
  3928. *)
  3929. # Figure out destination file name, if it wasn't already specified.
  3930. if test -n "$destname"; then
  3931. destfile="$destdir/$destname"
  3932. else
  3933. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3934. destfile="$destdir/$destfile"
  3935. fi
  3936. # Do a test to see if this is really a libtool program.
  3937. case $host in
  3938. *cygwin*|*mingw*)
  3939. wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
  3940. ;;
  3941. *)
  3942. wrapper=$file
  3943. ;;
  3944. esac
  3945. if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
  3946. notinst_deplibs=
  3947. relink_command=
  3948. # If there is no directory component, then add one.
  3949. case $file in
  3950. */* | *\\*) . $wrapper ;;
  3951. *) . ./$wrapper ;;
  3952. esac
  3953. # Check the variables that should have been set.
  3954. if test -z "$notinst_deplibs"; then
  3955. $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  3956. exit 1
  3957. fi
  3958. finalize=yes
  3959. for lib in $notinst_deplibs; do
  3960. # Check to see that each library is installed.
  3961. libdir=
  3962. if test -f "$lib"; then
  3963. # If there is no directory component, then add one.
  3964. case $lib in
  3965. */* | *\\*) . $lib ;;
  3966. *) . ./$lib ;;
  3967. esac
  3968. fi
  3969. libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  3970. if test -n "$libdir" && test ! -f "$libfile"; then
  3971. $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  3972. finalize=no
  3973. fi
  3974. done
  3975. relink_command=
  3976. # If there is no directory component, then add one.
  3977. case $file in
  3978. */* | *\\*) . $wrapper ;;
  3979. *) . ./$wrapper ;;
  3980. esac
  3981. outputname=
  3982. if test "$fast_install" = no && test -n "$relink_command"; then
  3983. if test "$finalize" = yes && test -z "$run"; then
  3984. tmpdir="/tmp"
  3985. test -n "$TMPDIR" && tmpdir="$TMPDIR"
  3986. tmpdir="$tmpdir/libtool-$$"
  3987. if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  3988. else
  3989. $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  3990. continue
  3991. fi
  3992. file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3993. outputname="$tmpdir/$file"
  3994. # Replace the output file specification.
  3995. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  3996. $show "$relink_command"
  3997. if $run eval "$relink_command"; then :
  3998. else
  3999. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  4000. ${rm}r "$tmpdir"
  4001. continue
  4002. fi
  4003. file="$outputname"
  4004. else
  4005. $echo "$modename: warning: cannot relink \`$file'" 1>&2
  4006. fi
  4007. else
  4008. # Install the binary that we compiled earlier.
  4009. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  4010. fi
  4011. fi
  4012. # remove .exe since cygwin /usr/bin/install will append another
  4013. # one anyways
  4014. case $install_prog,$host in
  4015. /usr/bin/install*,*cygwin*)
  4016. case $file:$destfile in
  4017. *.exe:*.exe)
  4018. # this is ok
  4019. ;;
  4020. *.exe:*)
  4021. destfile=$destfile.exe
  4022. ;;
  4023. *:*.exe)
  4024. destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
  4025. ;;
  4026. esac
  4027. ;;
  4028. esac
  4029. $show "$install_prog$stripme $file $destfile"
  4030. $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  4031. test -n "$outputname" && ${rm}r "$tmpdir"
  4032. ;;
  4033. esac
  4034. done
  4035. for file in $staticlibs; do
  4036. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  4037. # Set up the ranlib parameters.
  4038. oldlib="$destdir/$name"
  4039. $show "$install_prog $file $oldlib"
  4040. $run eval "$install_prog \$file \$oldlib" || exit $?
  4041. if test -n "$stripme" && test -n "$striplib"; then
  4042. $show "$old_striplib $oldlib"
  4043. $run eval "$old_striplib $oldlib" || exit $?
  4044. fi
  4045. # Do each command in the postinstall commands.
  4046. eval cmds=\"$old_postinstall_cmds\"
  4047. save_ifs="$IFS"; IFS='~'
  4048. for cmd in $cmds; do
  4049. IFS="$save_ifs"
  4050. $show "$cmd"
  4051. $run eval "$cmd" || exit $?
  4052. done
  4053. IFS="$save_ifs"
  4054. done
  4055. if test -n "$future_libdirs"; then
  4056. $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  4057. fi
  4058. if test -n "$current_libdirs"; then
  4059. # Maybe just do a dry run.
  4060. test -n "$run" && current_libdirs=" -n$current_libdirs"
  4061. exec_cmd='$SHELL $0 --finish$current_libdirs'
  4062. else
  4063. exit 0
  4064. fi
  4065. ;;
  4066. # libtool finish mode
  4067. finish)
  4068. modename="$modename: finish"
  4069. libdirs="$nonopt"
  4070. admincmds=
  4071. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  4072. for dir
  4073. do
  4074. libdirs="$libdirs $dir"
  4075. done
  4076. for libdir in $libdirs; do
  4077. if test -n "$finish_cmds"; then
  4078. # Do each command in the finish commands.
  4079. eval cmds=\"$finish_cmds\"
  4080. save_ifs="$IFS"; IFS='~'
  4081. for cmd in $cmds; do
  4082. IFS="$save_ifs"
  4083. $show "$cmd"
  4084. $run eval "$cmd" || admincmds="$admincmds
  4085. $cmd"
  4086. done
  4087. IFS="$save_ifs"
  4088. fi
  4089. if test -n "$finish_eval"; then
  4090. # Do the single finish_eval.
  4091. eval cmds=\"$finish_eval\"
  4092. $run eval "$cmds" || admincmds="$admincmds
  4093. $cmds"
  4094. fi
  4095. done
  4096. fi
  4097. # Exit here if they wanted silent mode.
  4098. test "$show" = ":" && exit 0
  4099. echo "----------------------------------------------------------------------"
  4100. echo "Libraries have been installed in:"
  4101. for libdir in $libdirs; do
  4102. echo " $libdir"
  4103. done
  4104. echo
  4105. echo "If you ever happen to want to link against installed libraries"
  4106. echo "in a given directory, LIBDIR, you must either use libtool, and"
  4107. echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  4108. echo "flag during linking and do at least one of the following:"
  4109. if test -n "$shlibpath_var"; then
  4110. echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
  4111. echo " during execution"
  4112. fi
  4113. if test -n "$runpath_var"; then
  4114. echo " - add LIBDIR to the \`$runpath_var' environment variable"
  4115. echo " during linking"
  4116. fi
  4117. if test -n "$hardcode_libdir_flag_spec"; then
  4118. libdir=LIBDIR
  4119. eval flag=\"$hardcode_libdir_flag_spec\"
  4120. echo " - use the \`$flag' linker flag"
  4121. fi
  4122. if test -n "$admincmds"; then
  4123. echo " - have your system administrator run these commands:$admincmds"
  4124. fi
  4125. if test -f /etc/ld.so.conf; then
  4126. echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  4127. fi
  4128. echo
  4129. echo "See any operating system documentation about shared libraries for"
  4130. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  4131. echo "----------------------------------------------------------------------"
  4132. exit 0
  4133. ;;
  4134. # libtool execute mode
  4135. execute)
  4136. modename="$modename: execute"
  4137. # The first argument is the command name.
  4138. cmd="$nonopt"
  4139. if test -z "$cmd"; then
  4140. $echo "$modename: you must specify a COMMAND" 1>&2
  4141. $echo "$help"
  4142. exit 1
  4143. fi
  4144. # Handle -dlopen flags immediately.
  4145. for file in $execute_dlfiles; do
  4146. if test ! -f "$file"; then
  4147. $echo "$modename: \`$file' is not a file" 1>&2
  4148. $echo "$help" 1>&2
  4149. exit 1
  4150. fi
  4151. dir=
  4152. case $file in
  4153. *.la)
  4154. # Check to see that this really is a libtool archive.
  4155. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  4156. else
  4157. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  4158. $echo "$help" 1>&2
  4159. exit 1
  4160. fi
  4161. # Read the libtool library.
  4162. dlname=
  4163. library_names=
  4164. # If there is no directory component, then add one.
  4165. case $file in
  4166. */* | *\\*) . $file ;;
  4167. *) . ./$file ;;
  4168. esac
  4169. # Skip this library if it cannot be dlopened.
  4170. if test -z "$dlname"; then
  4171. # Warn if it was a shared library.
  4172. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  4173. continue
  4174. fi
  4175. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  4176. test "X$dir" = "X$file" && dir=.
  4177. if test -f "$dir/$objdir/$dlname"; then
  4178. dir="$dir/$objdir"
  4179. else
  4180. $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  4181. exit 1
  4182. fi
  4183. ;;
  4184. *.lo)
  4185. # Just add the directory containing the .lo file.
  4186. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  4187. test "X$dir" = "X$file" && dir=.
  4188. ;;
  4189. *)
  4190. $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  4191. continue
  4192. ;;
  4193. esac
  4194. # Get the absolute pathname.
  4195. absdir=`cd "$dir" && pwd`
  4196. test -n "$absdir" && dir="$absdir"
  4197. # Now add the directory to shlibpath_var.
  4198. if eval "test -z \"\$$shlibpath_var\""; then
  4199. eval "$shlibpath_var=\"\$dir\""
  4200. else
  4201. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  4202. fi
  4203. done
  4204. # This variable tells wrapper scripts just to set shlibpath_var
  4205. # rather than running their programs.
  4206. libtool_execute_magic="$magic"
  4207. # Check if any of the arguments is a wrapper script.
  4208. args=
  4209. for file
  4210. do
  4211. case $file in
  4212. -*) ;;
  4213. *)
  4214. # Do a test to see if this is really a libtool program.
  4215. if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  4216. # If there is no directory component, then add one.
  4217. case $file in
  4218. */* | *\\*) . $file ;;
  4219. *) . ./$file ;;
  4220. esac
  4221. # Transform arg to wrapped name.
  4222. file="$progdir/$program"
  4223. fi
  4224. ;;
  4225. esac
  4226. # Quote arguments (to preserve shell metacharacters).
  4227. file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  4228. args="$args \"$file\""
  4229. done
  4230. if test -z "$run"; then
  4231. if test -n "$shlibpath_var"; then
  4232. # Export the shlibpath_var.
  4233. eval "export $shlibpath_var"
  4234. fi
  4235. # Restore saved enviroment variables
  4236. if test "${save_LC_ALL+set}" = set; then
  4237. LC_ALL="$save_LC_ALL"; export LC_ALL
  4238. fi
  4239. if test "${save_LANG+set}" = set; then
  4240. LANG="$save_LANG"; export LANG
  4241. fi
  4242. # Now prepare to actually exec the command.
  4243. exec_cmd="\$cmd$args"
  4244. else
  4245. # Display what would be done.
  4246. if test -n "$shlibpath_var"; then
  4247. eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  4248. $echo "export $shlibpath_var"
  4249. fi
  4250. $echo "$cmd$args"
  4251. exit 0
  4252. fi
  4253. ;;
  4254. # libtool clean and uninstall mode
  4255. clean | uninstall)
  4256. modename="$modename: $mode"
  4257. rm="$nonopt"
  4258. files=
  4259. rmforce=
  4260. exit_status=0
  4261. # This variable tells wrapper scripts just to set variables rather
  4262. # than running their programs.
  4263. libtool_install_magic="$magic"
  4264. for arg
  4265. do
  4266. case $arg in
  4267. -f) rm="$rm $arg"; rmforce=yes ;;
  4268. -*) rm="$rm $arg" ;;
  4269. *) files="$files $arg" ;;
  4270. esac
  4271. done
  4272. if test -z "$rm"; then
  4273. $echo "$modename: you must specify an RM program" 1>&2
  4274. $echo "$help" 1>&2
  4275. exit 1
  4276. fi
  4277. rmdirs=
  4278. for file in $files; do
  4279. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  4280. if test "X$dir" = "X$file"; then
  4281. dir=.
  4282. objdir="$objdir"
  4283. else
  4284. objdir="$dir/$objdir"
  4285. fi
  4286. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  4287. test $mode = uninstall && objdir="$dir"
  4288. # Remember objdir for removal later, being careful to avoid duplicates
  4289. if test $mode = clean; then
  4290. case " $rmdirs " in
  4291. *" $objdir "*) ;;
  4292. *) rmdirs="$rmdirs $objdir" ;;
  4293. esac
  4294. fi
  4295. # Don't error if the file doesn't exist and rm -f was used.
  4296. if (test -L "$file") >/dev/null 2>&1 \
  4297. || (test -h "$file") >/dev/null 2>&1 \
  4298. || test -f "$file"; then
  4299. :
  4300. elif test -d "$file"; then
  4301. exit_status=1
  4302. continue
  4303. elif test "$rmforce" = yes; then
  4304. continue
  4305. fi
  4306. rmfiles="$file"
  4307. case $name in
  4308. *.la)
  4309. # Possibly a libtool archive, so verify it.
  4310. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  4311. . $dir/$name
  4312. # Delete the libtool libraries and symlinks.
  4313. for n in $library_names; do
  4314. rmfiles="$rmfiles $objdir/$n"
  4315. done
  4316. test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  4317. test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  4318. if test $mode = uninstall; then
  4319. if test -n "$library_names"; then
  4320. # Do each command in the postuninstall commands.
  4321. eval cmds=\"$postuninstall_cmds\"
  4322. save_ifs="$IFS"; IFS='~'
  4323. for cmd in $cmds; do
  4324. IFS="$save_ifs"
  4325. $show "$cmd"
  4326. $run eval "$cmd"
  4327. if test $? != 0 && test "$rmforce" != yes; then
  4328. exit_status=1
  4329. fi
  4330. done
  4331. IFS="$save_ifs"
  4332. fi
  4333. if test -n "$old_library"; then
  4334. # Do each command in the old_postuninstall commands.
  4335. eval cmds=\"$old_postuninstall_cmds\"
  4336. save_ifs="$IFS"; IFS='~'
  4337. for cmd in $cmds; do
  4338. IFS="$save_ifs"
  4339. $show "$cmd"
  4340. $run eval "$cmd"
  4341. if test $? != 0 && test "$rmforce" != yes; then
  4342. exit_status=1
  4343. fi
  4344. done
  4345. IFS="$save_ifs"
  4346. fi
  4347. # FIXME: should reinstall the best remaining shared library.
  4348. fi
  4349. fi
  4350. ;;
  4351. *.lo)
  4352. if test "$build_old_libs" = yes; then
  4353. oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  4354. rmfiles="$rmfiles $dir/$oldobj"
  4355. fi
  4356. ;;
  4357. *)
  4358. # Do a test to see if this is a libtool program.
  4359. if test $mode = clean &&
  4360. (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  4361. relink_command=
  4362. . $dir/$file
  4363. rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  4364. if test "$fast_install" = yes && test -n "$relink_command"; then
  4365. rmfiles="$rmfiles $objdir/lt-$name"
  4366. fi
  4367. fi
  4368. ;;
  4369. esac
  4370. $show "$rm $rmfiles"
  4371. $run $rm $rmfiles || exit_status=1
  4372. done
  4373. # Try to remove the ${objdir}s in the directories where we deleted files
  4374. for dir in $rmdirs; do
  4375. if test -d "$dir"; then
  4376. $show "rmdir $dir"
  4377. $run rmdir $dir >/dev/null 2>&1
  4378. fi
  4379. done
  4380. exit $exit_status
  4381. ;;
  4382. "")
  4383. $echo "$modename: you must specify a MODE" 1>&2
  4384. $echo "$generic_help" 1>&2
  4385. exit 1
  4386. ;;
  4387. esac
  4388. if test -z "$exec_cmd"; then
  4389. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  4390. $echo "$generic_help" 1>&2
  4391. exit 1
  4392. fi
  4393. fi # test -z "$show_help"
  4394. if test -n "$exec_cmd"; then
  4395. eval exec $exec_cmd
  4396. exit 1
  4397. fi
  4398. # We need to display help for each of the modes.
  4399. case $mode in
  4400. "") $echo \
  4401. "Usage: $modename [OPTION]... [MODE-ARG]...
  4402. Provide generalized library-building support services.
  4403. --config show all configuration variables
  4404. --debug enable verbose shell tracing
  4405. -n, --dry-run display commands without modifying any files
  4406. --features display basic configuration information and exit
  4407. --finish same as \`--mode=finish'
  4408. --help display this help message and exit
  4409. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
  4410. --quiet same as \`--silent'
  4411. --silent don't print informational messages
  4412. --version print version information
  4413. MODE must be one of the following:
  4414. clean remove files from the build directory
  4415. compile compile a source file into a libtool object
  4416. execute automatically set library path, then run a program
  4417. finish complete the installation of libtool libraries
  4418. install install libraries or executables
  4419. link create a library or an executable
  4420. uninstall remove libraries from an installed directory
  4421. MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
  4422. a more detailed description of MODE."
  4423. exit 0
  4424. ;;
  4425. clean)
  4426. $echo \
  4427. "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  4428. Remove files from the build directory.
  4429. RM is the name of the program to use to delete files associated with each FILE
  4430. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  4431. to RM.
  4432. If FILE is a libtool library, object or program, all the files associated
  4433. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  4434. ;;
  4435. compile)
  4436. $echo \
  4437. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  4438. Compile a source file into a libtool library object.
  4439. This mode accepts the following additional options:
  4440. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  4441. -prefer-pic try to building PIC objects only
  4442. -prefer-non-pic try to building non-PIC objects only
  4443. -static always build a \`.o' file suitable for static linking
  4444. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  4445. from the given SOURCEFILE.
  4446. The output file name is determined by removing the directory component from
  4447. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  4448. library object suffix, \`.lo'."
  4449. ;;
  4450. execute)
  4451. $echo \
  4452. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  4453. Automatically set library path, then run a program.
  4454. This mode accepts the following additional options:
  4455. -dlopen FILE add the directory containing FILE to the library path
  4456. This mode sets the library path environment variable according to \`-dlopen'
  4457. flags.
  4458. If any of the ARGS are libtool executable wrappers, then they are translated
  4459. into their corresponding uninstalled binary, and any of their required library
  4460. directories are added to the library path.
  4461. Then, COMMAND is executed, with ARGS as arguments."
  4462. ;;
  4463. finish)
  4464. $echo \
  4465. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  4466. Complete the installation of libtool libraries.
  4467. Each LIBDIR is a directory that contains libtool libraries.
  4468. The commands that this mode executes may require superuser privileges. Use
  4469. the \`--dry-run' option if you just want to see what would be executed."
  4470. ;;
  4471. install)
  4472. $echo \
  4473. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  4474. Install executables or libraries.
  4475. INSTALL-COMMAND is the installation command. The first component should be
  4476. either the \`install' or \`cp' program.
  4477. The rest of the components are interpreted as arguments to that command (only
  4478. BSD-compatible install options are recognized)."
  4479. ;;
  4480. link)
  4481. $echo \
  4482. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  4483. Link object files or libraries together to form another library, or to
  4484. create an executable program.
  4485. LINK-COMMAND is a command using the C compiler that you would use to create
  4486. a program from several object files.
  4487. The following components of LINK-COMMAND are treated specially:
  4488. -all-static do not do any dynamic linking at all
  4489. -avoid-version do not add a version suffix if possible
  4490. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  4491. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  4492. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  4493. -export-symbols SYMFILE
  4494. try to export only the symbols listed in SYMFILE
  4495. -export-symbols-regex REGEX
  4496. try to export only the symbols matching REGEX
  4497. -LLIBDIR search LIBDIR for required installed libraries
  4498. -lNAME OUTPUT-FILE requires the installed library libNAME
  4499. -module build a library that can dlopened
  4500. -no-fast-install disable the fast-install mode
  4501. -no-install link a not-installable executable
  4502. -no-undefined declare that a library does not refer to external symbols
  4503. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  4504. -release RELEASE specify package release information
  4505. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  4506. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  4507. -static do not do any dynamic linking of libtool libraries
  4508. -version-info CURRENT[:REVISION[:AGE]]
  4509. specify library version info [each variable defaults to 0]
  4510. All other options (arguments beginning with \`-') are ignored.
  4511. Every other argument is treated as a filename. Files ending in \`.la' are
  4512. treated as uninstalled libtool libraries, other files are standard or library
  4513. object files.
  4514. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  4515. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  4516. required, except when creating a convenience library.
  4517. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  4518. using \`ar' and \`ranlib', or on Windows using \`lib'.
  4519. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  4520. is created, otherwise an executable program is created."
  4521. ;;
  4522. uninstall)
  4523. $echo \
  4524. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  4525. Remove libraries from an installation directory.
  4526. RM is the name of the program to use to delete files associated with each FILE
  4527. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  4528. to RM.
  4529. If FILE is a libtool library, all the files associated with it are deleted.
  4530. Otherwise, only FILE itself is deleted using RM."
  4531. ;;
  4532. *)
  4533. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  4534. $echo "$help" 1>&2
  4535. exit 1
  4536. ;;
  4537. esac
  4538. echo
  4539. $echo "Try \`$modename --help' for more information about other modes."
  4540. exit 0
  4541. # Local Variables:
  4542. # mode:shell-script
  4543. # sh-indentation:2
  4544. # End: