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.

2455 lines
69 KiB

25 years ago
  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun ltconfig.
  3. #
  4. # Copyright (C) 1996-1998 Free Software Foundation, Inc.
  5. # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25. # The name of this program.
  26. progname=`$echo "$0" | sed 's%^.*/%%'`
  27. modename="$progname"
  28. # Constants.
  29. PROGRAM=ltmain.sh
  30. PACKAGE=libtool
  31. VERSION=1.2
  32. default_mode=
  33. help="Try \`$progname --help' for more information."
  34. magic="%%%MAGIC variable%%%"
  35. mkdir="mkdir"
  36. mv="mv -f"
  37. rm="rm -f"
  38. # Sed substitution that helps us do robust quoting. It backslashifies
  39. # metacharacters that are still active within double-quoted strings.
  40. Xsed='sed -e s/^X//'
  41. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  42. # NLS nuisances.
  43. # Only set LANG and LC_ALL to C if already set.
  44. # These must not be set unconditionally because not all systems understand
  45. # e.g. LANG=C (notably SCO).
  46. if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
  47. if test "${LANG+set}" = set; then LANG=C; export LANG; fi
  48. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  49. echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  50. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  51. exit 1
  52. fi
  53. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  54. echo "$modename: not configured to build any kind of library" 1>&2
  55. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  56. exit 1
  57. fi
  58. # Global variables.
  59. mode=$default_mode
  60. nonopt=
  61. prev=
  62. prevopt=
  63. run=
  64. show="$echo"
  65. show_help=
  66. execute_dlfiles=
  67. # Parse our command line options once, thoroughly.
  68. while test $# -gt 0
  69. do
  70. arg="$1"
  71. shift
  72. case "$arg" in
  73. -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  74. *) optarg= ;;
  75. esac
  76. # If the previous option needs an argument, assign it.
  77. if test -n "$prev"; then
  78. case "$prev" in
  79. execute_dlfiles)
  80. eval "$prev=\"\$$prev \$arg\""
  81. ;;
  82. *)
  83. eval "$prev=\$arg"
  84. ;;
  85. esac
  86. prev=
  87. prevopt=
  88. continue
  89. fi
  90. # Have we seen a non-optional argument yet?
  91. case "$arg" in
  92. --help)
  93. show_help=yes
  94. ;;
  95. --version)
  96. echo "$PROGRAM (GNU $PACKAGE) $VERSION"
  97. exit 0
  98. ;;
  99. --dry-run | -n)
  100. run=:
  101. ;;
  102. --features)
  103. echo "host: $host"
  104. if test "$build_libtool_libs" = yes; then
  105. echo "enable shared libraries"
  106. else
  107. echo "disable shared libraries"
  108. fi
  109. if test "$build_old_libs" = yes; then
  110. echo "enable static libraries"
  111. else
  112. echo "disable static libraries"
  113. fi
  114. exit 0
  115. ;;
  116. --finish) mode="finish" ;;
  117. --mode) prevopt="--mode" prev=mode ;;
  118. --mode=*) mode="$optarg" ;;
  119. --quiet | --silent)
  120. show=:
  121. ;;
  122. -dlopen)
  123. prevopt="-dlopen"
  124. prev=execute_dlfiles
  125. ;;
  126. -*)
  127. $echo "$modename: unrecognized option \`$arg'" 1>&2
  128. $echo "$help" 1>&2
  129. exit 1
  130. ;;
  131. *)
  132. nonopt="$arg"
  133. break
  134. ;;
  135. esac
  136. done
  137. if test -n "$prevopt"; then
  138. $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  139. $echo "$help" 1>&2
  140. exit 1
  141. fi
  142. if test -z "$show_help"; then
  143. # Infer the operation mode.
  144. if test -z "$mode"; then
  145. case "$nonopt" in
  146. *cc | *++ | gcc* | *-gcc*)
  147. mode=link
  148. for arg
  149. do
  150. case "$arg" in
  151. -c)
  152. mode=compile
  153. break
  154. ;;
  155. esac
  156. done
  157. ;;
  158. *db | *dbx)
  159. mode=execute
  160. ;;
  161. *install*|cp|mv)
  162. mode=install
  163. ;;
  164. *rm)
  165. mode=uninstall
  166. ;;
  167. *)
  168. # If we have no mode, but dlfiles were specified, then do execute mode.
  169. test -n "$execute_dlfiles" && mode=execute
  170. # Just use the default operation mode.
  171. if test -z "$mode"; then
  172. if test -n "$nonopt"; then
  173. $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  174. else
  175. $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  176. fi
  177. fi
  178. ;;
  179. esac
  180. fi
  181. # Only execute mode is allowed to have -dlopen flags.
  182. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  183. $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  184. $echo "$help" 1>&2
  185. exit 1
  186. fi
  187. # Change the help message to a mode-specific one.
  188. generic_help="$help"
  189. help="Try \`$modename --help --mode=$mode' for more information."
  190. # These modes are in order of execution frequency so that they run quickly.
  191. case "$mode" in
  192. # libtool compile mode
  193. compile)
  194. modename="$modename: compile"
  195. # Get the compilation command and the source file.
  196. base_compile=
  197. lastarg=
  198. srcfile="$nonopt"
  199. suppress_output=
  200. for arg
  201. do
  202. # Accept any command-line options.
  203. case "$arg" in
  204. -o)
  205. $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
  206. $echo "$help" 1>&2
  207. exit 1
  208. ;;
  209. -static)
  210. build_libtool_libs=no
  211. build_old_libs=yes
  212. continue
  213. ;;
  214. esac
  215. # Accept the current argument as the source file.
  216. lastarg="$srcfile"
  217. srcfile="$arg"
  218. # Aesthetically quote the previous argument.
  219. # Backslashify any backslashes, double quotes, and dollar signs.
  220. # These are the only characters that are still specially
  221. # interpreted inside of double-quoted scrings.
  222. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  223. # Double-quote args containing other shell metacharacters.
  224. # Many Bourne shells cannot handle close brackets correctly in scan
  225. # sets, so we specify it separately.
  226. case "$lastarg" in
  227. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  228. lastarg="\"$lastarg\""
  229. ;;
  230. esac
  231. # Add the previous argument to base_compile.
  232. if test -z "$base_compile"; then
  233. base_compile="$lastarg"
  234. else
  235. base_compile="$base_compile $lastarg"
  236. fi
  237. done
  238. # Get the name of the library object.
  239. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  240. # Recognize several different file suffixes.
  241. xform='[cCFSfms]'
  242. case "$libobj" in
  243. *.ada) xform=ada ;;
  244. *.adb) xform=adb ;;
  245. *.ads) xform=ads ;;
  246. *.asm) xform=asm ;;
  247. *.c++) xform=c++ ;;
  248. *.cc) xform=cc ;;
  249. *.cpp) xform=cpp ;;
  250. *.cxx) xform=cxx ;;
  251. *.f90) xform=f90 ;;
  252. *.for) xform=for ;;
  253. esac
  254. libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  255. case "$libobj" in
  256. *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
  257. *)
  258. $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
  259. exit 1
  260. ;;
  261. esac
  262. if test -z "$base_compile"; then
  263. $echo "$modename: you must specify a compilation command" 1>&2
  264. $echo "$help" 1>&2
  265. exit 1
  266. fi
  267. # Delete any leftover library objects.
  268. if test "$build_old_libs" = yes; then
  269. $run $rm $obj $libobj
  270. trap "$run $rm $obj $libobj; exit 1" 1 2 15
  271. else
  272. $run $rm $libobj
  273. trap "$run $rm $libobj; exit 1" 1 2 15
  274. fi
  275. # Only build a PIC object if we are building libtool libraries.
  276. if test "$build_libtool_libs" = yes; then
  277. # Without this assignment, base_compile gets emptied.
  278. fbsd_hideous_sh_bug=$base_compile
  279. # All platforms use -DPIC, to notify preprocessed assembler code.
  280. $show "$base_compile$pic_flag -DPIC $srcfile"
  281. if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
  282. else
  283. test -n "$obj" && $run $rm $obj
  284. exit 1
  285. fi
  286. # If we have no pic_flag, then copy the object into place and finish.
  287. if test -z "$pic_flag"; then
  288. $show "$LN_S $obj $libobj"
  289. $run $LN_S $obj $libobj
  290. exit $?
  291. fi
  292. # Just move the object, then go on to compile the next one
  293. $show "$mv $obj $libobj"
  294. $run $mv $obj $libobj || exit 1
  295. # Allow error messages only from the first compilation.
  296. suppress_output=' >/dev/null 2>&1'
  297. fi
  298. # Only build a position-dependent object if we build old libraries.
  299. if test "$build_old_libs" = yes; then
  300. # Suppress compiler output if we already did a PIC compilation.
  301. $show "$base_compile $srcfile$suppress_output"
  302. if $run eval "$base_compile \$srcfile$suppress_output"; then :
  303. else
  304. $run $rm $obj $libobj
  305. exit 1
  306. fi
  307. fi
  308. # Create an invalid libtool object if no PIC, so that we do not
  309. # accidentally link it into a program.
  310. if test "$build_libtool_libs" != yes; then
  311. $show "echo timestamp > $libobj"
  312. $run eval "echo timestamp > \$libobj" || exit $?
  313. fi
  314. exit 0
  315. ;;
  316. # libtool link mode
  317. link)
  318. modename="$modename: link"
  319. CC="$nonopt"
  320. allow_undefined=yes
  321. compile_command="$CC"
  322. finalize_command="$CC"
  323. compile_shlibpath=
  324. finalize_shlibpath=
  325. deplibs=
  326. dlfiles=
  327. dlprefiles=
  328. export_dynamic=no
  329. hardcode_libdirs=
  330. libobjs=
  331. link_against_libtool_libs=
  332. ltlibs=
  333. objs=
  334. olibobjs=
  335. prev=
  336. prevarg=
  337. release=
  338. rpath=
  339. perm_rpath=
  340. temp_rpath=
  341. vinfo=
  342. # We need to know -static, to get the right output filenames.
  343. for arg
  344. do
  345. case "$arg" in
  346. -all-static | -static)
  347. if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  348. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  349. fi
  350. build_libtool_libs=no
  351. build_old_libs=yes
  352. break
  353. ;;
  354. esac
  355. done
  356. # See if our shared archives depend on static archives.
  357. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  358. # Go through the arguments, transforming them on the way.
  359. for arg
  360. do
  361. # If the previous option needs an argument, assign it.
  362. if test -n "$prev"; then
  363. case "$prev" in
  364. output)
  365. compile_command="$compile_command @OUTPUT@"
  366. finalize_command="$finalize_command @OUTPUT@"
  367. ;;
  368. esac
  369. case "$prev" in
  370. dlfiles|dlprefiles)
  371. case "$arg" in
  372. *.la | *.lo) ;; # We handle these cases below.
  373. *)
  374. dlprefiles="$dlprefiles $arg"
  375. test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
  376. prev=
  377. ;;
  378. esac
  379. ;;
  380. release)
  381. release="-$arg"
  382. prev=
  383. continue
  384. ;;
  385. rpath)
  386. rpath="$rpath $arg"
  387. prev=
  388. continue
  389. ;;
  390. *)
  391. eval "$prev=\"\$arg\""
  392. prev=
  393. continue
  394. ;;
  395. esac
  396. fi
  397. prevarg="$arg"
  398. case "$arg" in
  399. -all-static)
  400. if test -n "$link_static_flag"; then
  401. compile_command="$compile_command $link_static_flag"
  402. finalize_command="$finalize_command $link_static_flag"
  403. fi
  404. continue
  405. ;;
  406. -allow-undefined)
  407. # FIXME: remove this flag sometime in the future.
  408. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  409. continue
  410. ;;
  411. -dlopen)
  412. prev=dlfiles
  413. continue
  414. ;;
  415. -dlpreopen)
  416. prev=dlprefiles
  417. continue
  418. ;;
  419. -export-dynamic)
  420. if test "$export_dynamic" != yes; then
  421. export_dynamic=yes
  422. if test -n "$export_dynamic_flag_spec"; then
  423. eval arg=\"$export_dynamic_flag_spec\"
  424. else
  425. arg=
  426. fi
  427. # Add the symbol object into the linking commands.
  428. compile_command="$compile_command @SYMFILE@"
  429. finalize_command="$finalize_command @SYMFILE@"
  430. fi
  431. ;;
  432. -L*)
  433. dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
  434. case "$dir" in
  435. /* | [A-Za-z]:\\*)
  436. # Add the corresponding hardcode_libdir_flag, if it is not identical.
  437. ;;
  438. *)
  439. $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
  440. exit 1
  441. ;;
  442. esac
  443. deplibs="$deplibs $arg"
  444. ;;
  445. -l*) deplibs="$deplibs $arg" ;;
  446. -no-undefined)
  447. allow_undefined=no
  448. continue
  449. ;;
  450. -o) prev=output ;;
  451. -release)
  452. prev=release
  453. continue
  454. ;;
  455. -rpath)
  456. prev=rpath
  457. continue
  458. ;;
  459. -static)
  460. # If we have no pic_flag, then this is the same as -all-static.
  461. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  462. compile_command="$compile_command $link_static_flag"
  463. finalize_command="$finalize_command $link_static_flag"
  464. fi
  465. continue
  466. ;;
  467. -version-info)
  468. prev=vinfo
  469. continue
  470. ;;
  471. # Some other compiler flag.
  472. -* | +*)
  473. # Unknown arguments in both finalize_command and compile_command need
  474. # to be aesthetically quoted because they are evaled later.
  475. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  476. case "$arg" in
  477. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  478. arg="\"$arg\""
  479. ;;
  480. esac
  481. ;;
  482. *.o | *.a)
  483. # A standard object.
  484. objs="$objs $arg"
  485. ;;
  486. *.lo)
  487. # A library object.
  488. if test "$prev" = dlfiles; then
  489. dlfiles="$dlfiles $arg"
  490. if test "$build_libtool_libs" = yes; then
  491. prev=
  492. continue
  493. else
  494. # If libtool objects are unsupported, then we need to preload.
  495. prev=dlprefiles
  496. fi
  497. fi
  498. if test "$prev" = dlprefiles; then
  499. # Preload the old-style object.
  500. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
  501. prev=
  502. fi
  503. libobjs="$libobjs $arg"
  504. olibobjs="$olibobjs "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
  505. ;;
  506. *.la)
  507. # A libtool-controlled library.
  508. dlname=
  509. libdir=
  510. library_names=
  511. old_library=
  512. # Check to see that this really is a libtool archive.
  513. if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
  514. else
  515. $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  516. exit 1
  517. fi
  518. # If there is no directory component, then add one.
  519. case "$arg" in
  520. */* | *\\*) . $arg ;;
  521. *) . ./$arg ;;
  522. esac
  523. if test -z "$libdir"; then
  524. $echo "$modename: \`$arg' contains no -rpath information" 1>&2
  525. exit 1
  526. fi
  527. # Get the name of the library we link against.
  528. linklib=
  529. for l in $old_library $library_names; do
  530. linklib="$l"
  531. done
  532. if test -z "$linklib"; then
  533. $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  534. exit 1
  535. fi
  536. # Find the relevant object directory and library name.
  537. name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  538. dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  539. if test "X$dir" = "X$arg"; then
  540. dir="$objdir"
  541. else
  542. dir="$dir/$objdir"
  543. fi
  544. # This library was specified with -dlopen.
  545. if test "$prev" = dlfiles; then
  546. dlfiles="$dlfiles $arg"
  547. if test -z "$dlname"; then
  548. # If there is no dlname, we need to preload.
  549. prev=dlprefiles
  550. else
  551. # We should not create a dependency on this library, but we
  552. # may need any libraries it requires.
  553. compile_command="$compile_command$dependency_libs"
  554. finalize_command="$finalize_command$dependency_libs"
  555. prev=
  556. continue
  557. fi
  558. fi
  559. # The library was specified with -dlpreopen.
  560. if test "$prev" = dlprefiles; then
  561. # Prefer using a static library (so that no silly _DYNAMIC symbols
  562. # are required to link).
  563. if test -n "$old_library"; then
  564. dlprefiles="$dlprefiles $dir/$old_library"
  565. else
  566. dlprefiles="$dlprefiles $dir/$linklib"
  567. fi
  568. prev=
  569. fi
  570. if test "$build_libtool_libs" = yes && test -n "$library_names"; then
  571. link_against_libtool_libs="$link_against_libtool_libs $arg"
  572. if test -n "$shlibpath_var"; then
  573. # Make sure the rpath contains only unique directories.
  574. case "$temp_rpath " in
  575. *" $dir "*) ;;
  576. *) temp_rpath="$temp_rpath $dir" ;;
  577. esac
  578. fi
  579. # This is the magic to use -rpath.
  580. if test -n "$hardcode_libdir_flag_spec"; then
  581. if test -n "$hardcode_libdir_separator"; then
  582. if test -z "$hardcode_libdirs"; then
  583. # Put the magic libdir with the hardcode flag.
  584. hardcode_libdirs="$libdir"
  585. libdir="@HARDCODE_LIBDIRS@"
  586. else
  587. # Just accumulate the unique libdirs.
  588. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  589. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  590. ;;
  591. *)
  592. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  593. ;;
  594. esac
  595. libdir=
  596. fi
  597. fi
  598. if test -n "$libdir"; then
  599. eval flag=\"$hardcode_libdir_flag_spec\"
  600. compile_command="$compile_command $flag"
  601. finalize_command="$finalize_command $flag"
  602. fi
  603. elif test -n "$runpath_var"; then
  604. # Do the same for the permanent run path.
  605. case "$perm_rpath " in
  606. *" $libdir "*) ;;
  607. *) perm_rpath="$perm_rpath $libdir" ;;
  608. esac
  609. fi
  610. case "$hardcode_action" in
  611. immediate)
  612. if test "$hardcode_direct" = no; then
  613. compile_command="$compile_command $dir/$linklib"
  614. elif test "$hardcode_minus_L" = no; then
  615. compile_command="$compile_command -L$dir -l$name"
  616. elif test "$hardcode_shlibpath_var" = no; then
  617. compile_shlibpath="$compile_shlibpath$dir:"
  618. compile_command="$compile_command -l$name"
  619. fi
  620. ;;
  621. relink)
  622. # We need an absolute path.
  623. case "$dir" in
  624. /* | [A-Za-z]:\\*) ;;
  625. *)
  626. absdir=`cd "$dir" && pwd`
  627. if test -z "$absdir"; then
  628. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  629. exit 1
  630. fi
  631. dir="$absdir"
  632. ;;
  633. esac
  634. if test "$hardcode_direct" = yes; then
  635. compile_command="$compile_command $dir/$linklib"
  636. elif test "$hardcode_minus_L" = yes; then
  637. compile_command="$compile_command -L$dir -l$name"
  638. elif test "$hardcode_shlibpath_var" = yes; then
  639. compile_shlibpath="$compile_shlibpath$dir:"
  640. compile_command="$compile_command -l$name"
  641. fi
  642. ;;
  643. *)
  644. $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2
  645. exit 1
  646. ;;
  647. esac
  648. # Finalize command for both is simple: just hardcode it.
  649. if test "$hardcode_direct" = yes; then
  650. finalize_command="$finalize_command $libdir/$linklib"
  651. elif test "$hardcode_minus_L" = yes; then
  652. finalize_command="$finalize_command -L$libdir -l$name"
  653. elif test "$hardcode_shlibpath_var" = yes; then
  654. finalize_shlibpath="$finalize_shlibpath$libdir:"
  655. finalize_command="$finalize_command -l$name"
  656. else
  657. # We cannot seem to hardcode it, guess we'll fake it.
  658. finalize_command="$finalize_command -L$libdir -l$name"
  659. fi
  660. else
  661. # Transform directly to old archives if we don't build new libraries.
  662. if test -n "$pic_flag" && test -z "$old_library"; then
  663. $echo "$modename: cannot find static library for \`$arg'" 1>&2
  664. exit 1
  665. fi
  666. # Here we assume that one of hardcode_direct or hardcode_minus_L
  667. # is not unsupported. This is valid on all known static and
  668. # shared platforms.
  669. if test "$hardcode_direct" != unsupported; then
  670. test -n "$old_library" && linklib="$old_library"
  671. compile_command="$compile_command $dir/$linklib"
  672. finalize_command="$finalize_command $dir/$linklib"
  673. else
  674. compile_command="$compile_command -L$dir -l$name"
  675. finalize_command="$finalize_command -L$dir -l$name"
  676. fi
  677. fi
  678. # Add in any libraries that this one depends upon.
  679. compile_command="$compile_command$dependency_libs"
  680. finalize_command="$finalize_command$dependency_libs"
  681. continue
  682. ;;
  683. # Some other compiler argument.
  684. *)
  685. # Unknown arguments in both finalize_command and compile_command need
  686. # to be aesthetically quoted because they are evaled later.
  687. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  688. case "$arg" in
  689. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  690. arg="\"$arg\""
  691. ;;
  692. esac
  693. ;;
  694. esac
  695. # Now actually substitute the argument into the commands.
  696. if test -n "$arg"; then
  697. compile_command="$compile_command $arg"
  698. finalize_command="$finalize_command $arg"
  699. fi
  700. done
  701. if test -n "$prev"; then
  702. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  703. $echo "$help" 1>&2
  704. exit 1
  705. fi
  706. if test -n "$vinfo" && test -n "$release"; then
  707. $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2
  708. $echo "$help" 1>&2
  709. exit 1
  710. fi
  711. oldlib=
  712. oldobjs=
  713. case "$output" in
  714. "")
  715. $echo "$modename: you must specify an output file" 1>&2
  716. $echo "$help" 1>&2
  717. exit 1
  718. ;;
  719. */* | *\\*)
  720. $echo "$modename: output file \`$output' must have no directory components" 1>&2
  721. exit 1
  722. ;;
  723. *.a)
  724. # Now set the variables for building old libraries.
  725. build_libtool_libs=no
  726. build_old_libs=yes
  727. oldlib="$output"
  728. $show "$rm $oldlib"
  729. $run $rm $oldlib
  730. ;;
  731. *.la)
  732. # Make sure we only generate libraries of the form `libNAME.la'.
  733. case "$output" in
  734. lib*) ;;
  735. *)
  736. $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
  737. $echo "$help" 1>&2
  738. exit 1
  739. ;;
  740. esac
  741. name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  742. eval libname=\"$libname_spec\"
  743. # All the library-specific variables (install_libdir is set above).
  744. library_names=
  745. old_library=
  746. dlname=
  747. current=0
  748. revision=0
  749. age=0
  750. if test -n "$objs"; then
  751. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  752. exit 1
  753. fi
  754. # How the heck are we supposed to write a wrapper for a shared library?
  755. if test -n "$link_against_libtool_libs"; then
  756. $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
  757. exit 1
  758. fi
  759. if test -n "$dlfiles$dlprefiles"; then
  760. $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
  761. # Nullify the symbol file.
  762. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  763. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  764. fi
  765. if test -z "$rpath"; then
  766. $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
  767. $echo "$help" 1>&2
  768. exit 1
  769. fi
  770. set dummy $rpath
  771. if test $# -gt 2; then
  772. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  773. fi
  774. install_libdir="$2"
  775. # Parse the version information argument.
  776. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
  777. set dummy $vinfo
  778. IFS="$save_ifs"
  779. if test -n "$5"; then
  780. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  781. $echo "$help" 1>&2
  782. exit 1
  783. fi
  784. test -n "$2" && current="$2"
  785. test -n "$3" && revision="$3"
  786. test -n "$4" && age="$4"
  787. # Check that each of the things are valid numbers.
  788. case "$current" in
  789. 0 | [1-9] | [1-9][0-9]*) ;;
  790. *)
  791. $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  792. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  793. exit 1
  794. ;;
  795. esac
  796. case "$revision" in
  797. 0 | [1-9] | [1-9][0-9]*) ;;
  798. *)
  799. $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  800. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  801. exit 1
  802. ;;
  803. esac
  804. case "$age" in
  805. 0 | [1-9] | [1-9][0-9]*) ;;
  806. *)
  807. $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  808. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  809. exit 1
  810. ;;
  811. esac
  812. if test $age -gt $current; then
  813. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  814. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  815. exit 1
  816. fi
  817. # Calculate the version variables.
  818. version_vars="version_type current age revision"
  819. case "$version_type" in
  820. none) ;;
  821. linux)
  822. version_vars="$version_vars major versuffix"
  823. major=`expr $current - $age`
  824. versuffix="$major.$age.$revision"
  825. ;;
  826. osf)
  827. version_vars="$version_vars versuffix verstring"
  828. major=`expr $current - $age`
  829. versuffix="$current.$age.$revision"
  830. verstring="$versuffix"
  831. # Add in all the interfaces that we are compatible with.
  832. loop=$age
  833. while test $loop != 0; do
  834. iface=`expr $current - $loop`
  835. loop=`expr $loop - 1`
  836. verstring="$verstring:${iface}.0"
  837. done
  838. # Make executables depend on our current version.
  839. verstring="$verstring:${current}.0"
  840. ;;
  841. sunos)
  842. version_vars="$version_vars major versuffix"
  843. major="$current"
  844. versuffix="$current.$revision"
  845. ;;
  846. *)
  847. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  848. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  849. exit 1
  850. ;;
  851. esac
  852. # Create the output directory, or remove our outputs if we need to.
  853. if test -d $objdir; then
  854. $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
  855. $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
  856. else
  857. $show "$mkdir $objdir"
  858. $run $mkdir $objdir
  859. status=$?
  860. if test $status -eq 0 || test -d $objdir; then :
  861. else
  862. exit $status
  863. fi
  864. fi
  865. # Check to see if the archive will have undefined symbols.
  866. if test "$allow_undefined" = yes; then
  867. if test "$allow_undefined_flag" = unsupported; then
  868. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  869. build_libtool_libs=no
  870. build_old_libs=yes
  871. fi
  872. else
  873. # Don't allow undefined symbols.
  874. allow_undefined_flag="$no_undefined_flag"
  875. fi
  876. # Add libc to deplibs on all systems.
  877. dependency_libs="$deplibs"
  878. deplibs="$deplibs -lc"
  879. if test "$build_libtool_libs" = yes; then
  880. # Get the real and link names of the library.
  881. eval library_names=\"$library_names_spec\"
  882. set dummy $library_names
  883. realname="$2"
  884. shift; shift
  885. if test -n "$soname_spec"; then
  886. eval soname=\"$soname_spec\"
  887. else
  888. soname="$realname"
  889. fi
  890. lib="$objdir/$realname"
  891. for link
  892. do
  893. linknames="$linknames $link"
  894. done
  895. # Use standard objects if they are PIC.
  896. test -z "$pic_flag" && libobjs="$olibobjs"
  897. # Do each of the archive commands.
  898. eval cmds=\"$archive_cmds\"
  899. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  900. for cmd in $cmds; do
  901. IFS="$save_ifs"
  902. $show "$cmd"
  903. $run eval "$cmd" || exit $?
  904. done
  905. IFS="$save_ifs"
  906. # Create links to the real library.
  907. for linkname in $linknames; do
  908. $show "(cd $objdir && $LN_S $realname $linkname)"
  909. $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
  910. done
  911. # If -export-dynamic was specified, set the dlname.
  912. if test "$export_dynamic" = yes; then
  913. # On all known operating systems, these are identical.
  914. dlname="$soname"
  915. fi
  916. fi
  917. # Now set the variables for building old libraries.
  918. oldlib="$objdir/$libname.a"
  919. ;;
  920. *.lo | *.o)
  921. if test -n "$link_against_libtool_libs"; then
  922. $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
  923. exit 1
  924. fi
  925. if test -n "$deplibs"; then
  926. $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
  927. fi
  928. if test -n "$dlfiles$dlprefiles"; then
  929. $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
  930. # Nullify the symbol file.
  931. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  932. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  933. fi
  934. if test -n "$rpath"; then
  935. $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
  936. fi
  937. if test -n "$vinfo"; then
  938. $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
  939. fi
  940. if test -n "$release"; then
  941. $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
  942. fi
  943. case "$output" in
  944. *.lo)
  945. if test -n "$objs"; then
  946. $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  947. exit 1
  948. fi
  949. libobj="$output"
  950. obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
  951. ;;
  952. *)
  953. libobj=
  954. obj="$output"
  955. ;;
  956. esac
  957. # Delete the old objects.
  958. $run $rm $obj $libobj
  959. # Create the old-style object.
  960. reload_objs="$objs $olibobjs"
  961. output="$obj"
  962. eval cmds=\"$reload_cmds\"
  963. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  964. for cmd in $cmds; do
  965. IFS="$save_ifs"
  966. $show "$cmd"
  967. $run eval "$cmd" || exit $?
  968. done
  969. IFS="$save_ifs"
  970. # Exit if we aren't doing a library object file.
  971. test -z "$libobj" && exit 0
  972. if test "$build_libtool_libs" != yes; then
  973. # Create an invalid libtool object if no PIC, so that we don't
  974. # accidentally link it into a program.
  975. $show "echo timestamp > $libobj"
  976. $run eval "echo timestamp > $libobj" || exit $?
  977. exit 0
  978. fi
  979. if test -n "$pic_flag"; then
  980. # Only do commands if we really have different PIC objects.
  981. reload_objs="$libobjs"
  982. output="$libobj"
  983. eval cmds=\"$reload_cmds\"
  984. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  985. for cmd in $cmds; do
  986. IFS="$save_ifs"
  987. $show "$cmd"
  988. $run eval "$cmd" || exit $?
  989. done
  990. IFS="$save_ifs"
  991. else
  992. # Just create a symlink.
  993. $show "$LN_S $obj $libobj"
  994. $run $LN_S $obj $libobj || exit 1
  995. fi
  996. exit 0
  997. ;;
  998. *)
  999. if test -n "$vinfo"; then
  1000. $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
  1001. fi
  1002. if test -n "$release"; then
  1003. $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
  1004. fi
  1005. if test -n "$rpath"; then
  1006. # If the user specified any rpath flags, then add them.
  1007. for libdir in $rpath; do
  1008. if test -n "$hardcode_libdir_flag_spec"; then
  1009. if test -n "$hardcode_libdir_separator"; then
  1010. if test -z "$hardcode_libdirs"; then
  1011. # Put the magic libdir with the hardcode flag.
  1012. hardcode_libdirs="$libdir"
  1013. libdir="@HARDCODE_LIBDIRS@"
  1014. else
  1015. # Just accumulate the unique libdirs.
  1016. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1017. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1018. ;;
  1019. *)
  1020. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1021. ;;
  1022. esac
  1023. libdir=
  1024. fi
  1025. fi
  1026. if test -n "$libdir"; then
  1027. eval flag=\"$hardcode_libdir_flag_spec\"
  1028. compile_command="$compile_command $flag"
  1029. finalize_command="$finalize_command $flag"
  1030. fi
  1031. elif test -n "$runpath_var"; then
  1032. case "$perm_rpath " in
  1033. *" $libdir "*) ;;
  1034. *) perm_rpath="$perm_rpath $libdir" ;;
  1035. esac
  1036. fi
  1037. done
  1038. fi
  1039. # Substitute the hardcoded libdirs into the compile commands.
  1040. if test -n "$hardcode_libdir_separator"; then
  1041. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  1042. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  1043. fi
  1044. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  1045. # Transform all the library objects into standard objects.
  1046. compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1047. finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1048. fi
  1049. if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
  1050. dlsyms="${output}S.c"
  1051. else
  1052. dlsyms=
  1053. fi
  1054. if test -n "$dlsyms"; then
  1055. # Add our own program objects to the preloaded list.
  1056. dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1057. # Discover the nlist of each of the dlfiles.
  1058. nlist="$objdir/${output}.nm"
  1059. if test -d $objdir; then
  1060. $show "$rm $nlist ${nlist}T"
  1061. $run $rm "$nlist" "${nlist}T"
  1062. else
  1063. $show "$mkdir $objdir"
  1064. $run $mkdir $objdir
  1065. status=$?
  1066. if test $status -eq 0 || test -d $objdir; then :
  1067. else
  1068. exit $status
  1069. fi
  1070. fi
  1071. for arg in $dlprefiles; do
  1072. $show "extracting global C symbols from \`$arg'"
  1073. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1074. done
  1075. # Parse the name list into a source file.
  1076. $show "creating $objdir/$dlsyms"
  1077. if test -z "$run"; then
  1078. # Make sure we at least have an empty file.
  1079. test -f "$nlist" || : > "$nlist"
  1080. # Try sorting and uniquifying the output.
  1081. if sort "$nlist" | uniq > "$nlist"T; then
  1082. mv -f "$nlist"T "$nlist"
  1083. wcout=`wc "$nlist" 2>/dev/null`
  1084. count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
  1085. (test "$count" -ge 0) 2>/dev/null || count=-1
  1086. else
  1087. $rm "$nlist"T
  1088. count=-1
  1089. fi
  1090. case "$dlsyms" in
  1091. "") ;;
  1092. *.c)
  1093. $echo > "$objdir/$dlsyms" "\
  1094. /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
  1095. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
  1096. #ifdef __cplusplus
  1097. extern \"C\" {
  1098. #endif
  1099. /* Prevent the only kind of declaration conflicts we can make. */
  1100. #define dld_preloaded_symbol_count some_other_symbol
  1101. #define dld_preloaded_symbols some_other_symbol
  1102. /* External symbol declarations for the compiler. */\
  1103. "
  1104. if test -f "$nlist"; then
  1105. sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
  1106. else
  1107. echo '/* NONE */' >> "$objdir/$dlsyms"
  1108. fi
  1109. $echo >> "$objdir/$dlsyms" "\
  1110. #undef dld_preloaded_symbol_count
  1111. #undef dld_preloaded_symbols
  1112. #if defined (__STDC__) && __STDC__
  1113. # define __ptr_t void *
  1114. #else
  1115. # define __ptr_t char *
  1116. #endif
  1117. /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
  1118. int dld_preloaded_symbol_count = $count;
  1119. /* The mapping between symbol names and symbols. */
  1120. struct {
  1121. char *name;
  1122. __ptr_t address;
  1123. }
  1124. dld_preloaded_symbols[] =
  1125. {\
  1126. "
  1127. if test -f "$nlist"; then
  1128. sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
  1129. fi
  1130. $echo >> "$objdir/$dlsyms" "\
  1131. {0, (__ptr_t) 0}
  1132. };
  1133. #ifdef __cplusplus
  1134. }
  1135. #endif\
  1136. "
  1137. ;;
  1138. *)
  1139. $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  1140. exit 1
  1141. ;;
  1142. esac
  1143. fi
  1144. # Now compile the dynamic symbol file.
  1145. $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
  1146. $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
  1147. # Transform the symbol file into the correct name.
  1148. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
  1149. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
  1150. elif test "$export_dynamic" != yes; then
  1151. test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
  1152. else
  1153. # We keep going just in case the user didn't refer to
  1154. # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
  1155. # really was required.
  1156. $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  1157. # Nullify the symbol file.
  1158. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  1159. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1160. fi
  1161. if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  1162. # Replace the output file specification.
  1163. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1164. finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1165. # We have no uninstalled library dependencies, so finalize right now.
  1166. $show "$compile_command"
  1167. $run eval "$compile_command"
  1168. exit $?
  1169. fi
  1170. # Replace the output file specification.
  1171. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
  1172. finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
  1173. # Create the binary in the object directory, then wrap it.
  1174. if test -d $objdir; then :
  1175. else
  1176. $show "$mkdir $objdir"
  1177. $run $mkdir $objdir
  1178. status=$?
  1179. if test $status -eq 0 || test -d $objdir; then :
  1180. else
  1181. exit $status
  1182. fi
  1183. fi
  1184. if test -n "$shlibpath_var"; then
  1185. # We should set the shlibpath_var
  1186. rpath=
  1187. for dir in $temp_rpath; do
  1188. case "$dir" in
  1189. /* | [A-Za-z]:\\*)
  1190. # Absolute path.
  1191. rpath="$rpath$dir:"
  1192. ;;
  1193. *)
  1194. # Relative path: add a thisdir entry.
  1195. rpath="$rpath\$thisdir/$dir:"
  1196. ;;
  1197. esac
  1198. done
  1199. temp_rpath="$rpath"
  1200. fi
  1201. # Delete the old output file.
  1202. $run $rm $output
  1203. if test -n "$compile_shlibpath"; then
  1204. compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
  1205. fi
  1206. if test -n "$finalize_shlibpath"; then
  1207. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  1208. fi
  1209. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  1210. # We should set the runpath_var.
  1211. rpath=
  1212. for dir in $perm_rpath; do
  1213. rpath="$rpath$dir:"
  1214. done
  1215. compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
  1216. finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
  1217. fi
  1218. case "$hardcode_action" in
  1219. relink)
  1220. # AGH! Flame the AIX and HP-UX people for me, will ya?
  1221. $echo "$modename: warning: using a buggy system linker" 1>&2
  1222. $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
  1223. ;;
  1224. esac
  1225. $show "$compile_command"
  1226. $run eval "$compile_command" || exit $?
  1227. # Now create the wrapper script.
  1228. $show "creating $output"
  1229. # Quote the finalize command for shipping.
  1230. finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
  1231. # Quote $echo for shipping.
  1232. qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  1233. # Only actually do things if our run command is non-null.
  1234. if test -z "$run"; then
  1235. $rm $output
  1236. trap "$rm $output; exit 1" 1 2 15
  1237. $echo > $output "\
  1238. #! /bin/sh
  1239. # $output - temporary wrapper script for $objdir/$output
  1240. # Generated by ltmain.sh - GNU $PACKAGE $VERSION
  1241. #
  1242. # The $output program cannot be directly executed until all the libtool
  1243. # libraries that it depends on are installed.
  1244. #
  1245. # This wrapper script should never be moved out of \``pwd`'.
  1246. # If it is, it will not operate correctly.
  1247. # Sed substitution that helps us do robust quoting. It backslashifies
  1248. # metacharacters that are still active within double-quoted strings.
  1249. Xsed='sed -e s/^X//'
  1250. sed_quote_subst='$sed_quote_subst'
  1251. # The HP-UX ksh and POSIX shell print the target directory to stdout
  1252. # if CDPATH is set.
  1253. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
  1254. # This environment variable determines our operation mode.
  1255. if test \"\$libtool_install_magic\" = \"$magic\"; then
  1256. # install mode needs the following variables:
  1257. link_against_libtool_libs='$link_against_libtool_libs'
  1258. finalize_command=\"$finalize_command\"
  1259. else
  1260. # When we are sourced in execute mode, \$file and \$echo are already set.
  1261. if test \"\$libtool_execute_magic\" = \"$magic\"; then :
  1262. else
  1263. echo=\"$qecho\"
  1264. file=\"\$0\"
  1265. fi\
  1266. "
  1267. $echo >> $output "\
  1268. # Find the directory that this script lives in.
  1269. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  1270. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  1271. # Follow symbolic links until we get to the real thisdir.
  1272. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  1273. while test -n \"\$file\"; do
  1274. destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  1275. # If there was a directory component, then change thisdir.
  1276. if test \"x\$destdir\" != \"x\$file\"; then
  1277. case \"\$destdir\" in
  1278. /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;;
  1279. *) thisdir=\"\$thisdir/\$destdir\" ;;
  1280. esac
  1281. fi
  1282. file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  1283. file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  1284. done
  1285. # Try to get the absolute directory name.
  1286. absdir=\`cd \"\$thisdir\" && pwd\`
  1287. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  1288. progdir=\"\$thisdir/$objdir\"
  1289. program='$output'
  1290. if test -f \"\$progdir/\$program\"; then"
  1291. # Export our shlibpath_var if we have one.
  1292. if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  1293. $echo >> $output "\
  1294. # Add our own library path to $shlibpath_var
  1295. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  1296. # Some systems cannot cope with colon-terminated $shlibpath_var
  1297. $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
  1298. export $shlibpath_var
  1299. "
  1300. fi
  1301. $echo >> $output "\
  1302. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  1303. # Run the actual program with our arguments.
  1304. # Export the path to the program.
  1305. PATH=\"\$progdir:\$PATH\"
  1306. export PATH
  1307. exec \$program \${1+\"\$@\"}
  1308. \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  1309. exit 1
  1310. fi
  1311. else
  1312. # The program doesn't exist.
  1313. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1314. \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1315. echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1316. exit 1
  1317. fi
  1318. fi\
  1319. "
  1320. chmod +x $output
  1321. fi
  1322. exit 0
  1323. ;;
  1324. esac
  1325. # See if we need to build an old-fashioned archive.
  1326. if test "$build_old_libs" = "yes"; then
  1327. # Transform .lo files to .o files.
  1328. oldobjs="$objs $olibobjs"
  1329. # Do each command in the archive commands.
  1330. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1331. eval cmds=\"$old_archive_from_new_cmds\"
  1332. else
  1333. eval cmds=\"$old_archive_cmds\"
  1334. fi
  1335. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  1336. for cmd in $cmds; do
  1337. IFS="$save_ifs"
  1338. $show "$cmd"
  1339. $run eval "$cmd" || exit $?
  1340. done
  1341. IFS="$save_ifs"
  1342. fi
  1343. # Now create the libtool archive.
  1344. case "$output" in
  1345. *.la)
  1346. old_library=
  1347. test "$build_old_libs" = yes && old_library="$libname.a"
  1348. $show "creating $output"
  1349. # Only create the output if not a dry run.
  1350. if test -z "$run"; then
  1351. $echo > $output "\
  1352. # $output - a libtool library file
  1353. # Generated by ltmain.sh - GNU $PACKAGE $VERSION
  1354. # The name that we can dlopen(3).
  1355. dlname='$dlname'
  1356. # Names of this library.
  1357. library_names='$library_names'
  1358. # The name of the static archive.
  1359. old_library='$old_library'
  1360. # Libraries that this one depends upon.
  1361. dependency_libs='$dependency_libs'
  1362. # Version information for $libname.
  1363. current=$current
  1364. age=$age
  1365. revision=$revision
  1366. # Directory that this library needs to be installed in:
  1367. libdir='$install_libdir'\
  1368. "
  1369. fi
  1370. # Do a symbolic link so that the libtool archive can be found in
  1371. # LD_LIBRARY_PATH before the program is installed.
  1372. $show "(cd $objdir && $LN_S ../$output $output)"
  1373. $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
  1374. ;;
  1375. esac
  1376. exit 0
  1377. ;;
  1378. # libtool install mode
  1379. install)
  1380. modename="$modename: install"
  1381. # There may be an optional /bin/sh argument at the beginning of
  1382. # install_prog (especially on Windows NT).
  1383. if test "$nonopt" = "$SHELL"; then
  1384. # Aesthetically quote it.
  1385. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  1386. case "$arg" in
  1387. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1388. arg="\"$arg\""
  1389. ;;
  1390. esac
  1391. install_prog="$arg "
  1392. arg="$1"
  1393. shift
  1394. else
  1395. install_prog=
  1396. arg="$nonopt"
  1397. fi
  1398. # The real first argument should be the name of the installation program.
  1399. # Aesthetically quote it.
  1400. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1401. case "$arg" in
  1402. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1403. arg="\"$arg\""
  1404. ;;
  1405. esac
  1406. install_prog="$install_prog$arg"
  1407. # We need to accept at least all the BSD install flags.
  1408. dest=
  1409. files=
  1410. opts=
  1411. prev=
  1412. install_type=
  1413. isdir=
  1414. stripme=
  1415. for arg
  1416. do
  1417. if test -n "$dest"; then
  1418. files="$files $dest"
  1419. dest="$arg"
  1420. continue
  1421. fi
  1422. case "$arg" in
  1423. -d) isdir=yes ;;
  1424. -f) prev="-f" ;;
  1425. -g) prev="-g" ;;
  1426. -m) prev="-m" ;;
  1427. -o) prev="-o" ;;
  1428. -s)
  1429. stripme=" -s"
  1430. continue
  1431. ;;
  1432. -*) ;;
  1433. *)
  1434. # If the previous option needed an argument, then skip it.
  1435. if test -n "$prev"; then
  1436. prev=
  1437. else
  1438. dest="$arg"
  1439. continue
  1440. fi
  1441. ;;
  1442. esac
  1443. # Aesthetically quote the argument.
  1444. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1445. case "$arg" in
  1446. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1447. arg="\"$arg\""
  1448. ;;
  1449. esac
  1450. install_prog="$install_prog $arg"
  1451. done
  1452. if test -z "$install_prog"; then
  1453. $echo "$modename: you must specify an install program" 1>&2
  1454. $echo "$help" 1>&2
  1455. exit 1
  1456. fi
  1457. if test -n "$prev"; then
  1458. $echo "$modename: the \`$prev' option requires an argument" 1>&2
  1459. $echo "$help" 1>&2
  1460. exit 1
  1461. fi
  1462. if test -z "$files"; then
  1463. if test -z "$dest"; then
  1464. $echo "$modename: no file or destination specified" 1>&2
  1465. else
  1466. $echo "$modename: you must specify a destination" 1>&2
  1467. fi
  1468. $echo "$help" 1>&2
  1469. exit 1
  1470. fi
  1471. # Strip any trailing slash from the destination.
  1472. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  1473. # Check to see that the destination is a directory.
  1474. test -d "$dest" && isdir=yes
  1475. if test -n "$isdir"; then
  1476. destdir="$dest"
  1477. destname=
  1478. else
  1479. destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  1480. test "X$destdir" = "X$dest" && destdir=.
  1481. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  1482. # Not a directory, so check to see that there is only one file specified.
  1483. set dummy $files
  1484. if test $# -gt 2; then
  1485. $echo "$modename: \`$dest' is not a directory" 1>&2
  1486. $echo "$help" 1>&2
  1487. exit 1
  1488. fi
  1489. fi
  1490. case "$destdir" in
  1491. /* | [A-Za-z]:\\*) ;;
  1492. *)
  1493. for file in $files; do
  1494. case "$file" in
  1495. *.lo) ;;
  1496. *)
  1497. $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  1498. $echo "$help" 1>&2
  1499. exit 1
  1500. ;;
  1501. esac
  1502. done
  1503. ;;
  1504. esac
  1505. # This variable tells wrapper scripts just to set variables rather
  1506. # than running their programs.
  1507. libtool_install_magic="$magic"
  1508. staticlibs=
  1509. future_libdirs=
  1510. current_libdirs=
  1511. for file in $files; do
  1512. # Do each installation.
  1513. case "$file" in
  1514. *.a)
  1515. # Do the static libraries later.
  1516. staticlibs="$staticlibs $file"
  1517. ;;
  1518. *.la)
  1519. # Check to see that this really is a libtool archive.
  1520. if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
  1521. else
  1522. $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  1523. $echo "$help" 1>&2
  1524. exit 1
  1525. fi
  1526. library_names=
  1527. old_library=
  1528. # If there is no directory component, then add one.
  1529. case "$file" in
  1530. */* | *\\*) . $file ;;
  1531. *) . ./$file ;;
  1532. esac
  1533. # Add the libdir to current_libdirs if it is the destination.
  1534. if test "X$destdir" = "X$libdir"; then
  1535. case "$current_libdirs " in
  1536. *" $libdir "*) ;;
  1537. *) current_libdirs="$current_libdirs $libdir" ;;
  1538. esac
  1539. else
  1540. # Note the libdir as a future libdir.
  1541. case "$future_libdirs " in
  1542. *" $libdir "*) ;;
  1543. *) future_libdirs="$future_libdirs $libdir" ;;
  1544. esac
  1545. fi
  1546. dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  1547. test "X$dir" = "X$file/" && dir=
  1548. dir="$dir$objdir"
  1549. # See the names of the shared library.
  1550. set dummy $library_names
  1551. if test -n "$2"; then
  1552. realname="$2"
  1553. shift
  1554. shift
  1555. # Install the shared library and build the symlinks.
  1556. $show "$install_prog $dir/$realname $destdir/$realname"
  1557. $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  1558. test "X$dlname" = "X$realname" && dlname=
  1559. if test $# -gt 0; then
  1560. # Delete the old symlinks.
  1561. rmcmd="$rm"
  1562. for linkname
  1563. do
  1564. rmcmd="$rmcmd $destdir/$linkname"
  1565. done
  1566. $show "$rmcmd"
  1567. $run $rmcmd
  1568. # ... and create new ones.
  1569. for linkname
  1570. do
  1571. test "X$dlname" = "X$linkname" && dlname=
  1572. $show "(cd $destdir && $LN_S $realname $linkname)"
  1573. $run eval "(cd $destdir && $LN_S $realname $linkname)"
  1574. done
  1575. fi
  1576. if test -n "$dlname"; then
  1577. # Install the dynamically-loadable library.
  1578. $show "$install_prog $dir/$dlname $destdir/$dlname"
  1579. $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
  1580. fi
  1581. # Do each command in the postinstall commands.
  1582. lib="$destdir/$realname"
  1583. eval cmds=\"$postinstall_cmds\"
  1584. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  1585. for cmd in $cmds; do
  1586. IFS="$save_ifs"
  1587. $show "$cmd"
  1588. $run eval "$cmd" || exit $?
  1589. done
  1590. IFS="$save_ifs"
  1591. fi
  1592. # Install the pseudo-library for information purposes.
  1593. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1594. $show "$install_prog $file $destdir/$name"
  1595. $run eval "$install_prog $file $destdir/$name" || exit $?
  1596. # Maybe install the static library, too.
  1597. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  1598. ;;
  1599. *.lo)
  1600. # Install (i.e. copy) a libtool object.
  1601. # Figure out destination file name, if it wasn't already specified.
  1602. if test -n "$destname"; then
  1603. destfile="$destdir/$destname"
  1604. else
  1605. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1606. destfile="$destdir/$destfile"
  1607. fi
  1608. # Deduce the name of the destination old-style object file.
  1609. case "$destfile" in
  1610. *.lo)
  1611. staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'`
  1612. ;;
  1613. *.o)
  1614. staticdest="$destfile"
  1615. destfile=
  1616. ;;
  1617. *)
  1618. $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  1619. $echo "$help" 1>&2
  1620. exit 1
  1621. ;;
  1622. esac
  1623. # Install the libtool object if requested.
  1624. if test -n "$destfile"; then
  1625. $show "$install_prog $file $destfile"
  1626. $run eval "$install_prog $file $destfile" || exit $?
  1627. fi
  1628. # Install the old object if enabled.
  1629. if test "$build_old_libs" = yes; then
  1630. # Deduce the name of the old-style object file.
  1631. staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'`
  1632. $show "$install_prog $staticobj $staticdest"
  1633. $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  1634. fi
  1635. exit 0
  1636. ;;
  1637. *)
  1638. # Do a test to see if this is really a libtool program.
  1639. if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
  1640. link_against_libtool_libs=
  1641. finalize_command=
  1642. # If there is no directory component, then add one.
  1643. case "$file" in
  1644. */* | *\\*) . $file ;;
  1645. *) . ./$file ;;
  1646. esac
  1647. # Check the variables that should have been set.
  1648. if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
  1649. $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  1650. exit 1
  1651. fi
  1652. finalize=yes
  1653. for lib in $link_against_libtool_libs; do
  1654. # Check to see that each library is installed.
  1655. libdir=
  1656. if test -f "$lib"; then
  1657. # If there is no directory component, then add one.
  1658. case "$lib" in
  1659. */* | *\\*) . $lib ;;
  1660. *) . ./$lib ;;
  1661. esac
  1662. fi
  1663. libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  1664. if test -z "$libdir"; then
  1665. $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2
  1666. elif test -f "$libfile"; then :
  1667. else
  1668. $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  1669. finalize=no
  1670. fi
  1671. done
  1672. if test "$hardcode_action" = relink; then
  1673. if test "$finalize" = yes; then
  1674. $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
  1675. $show "$finalize_command"
  1676. if $run eval "$finalize_command"; then :
  1677. else
  1678. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  1679. continue
  1680. fi
  1681. file="$objdir/$file"T
  1682. else
  1683. $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
  1684. fi
  1685. else
  1686. # Install the binary that we compiled earlier.
  1687. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1688. fi
  1689. fi
  1690. $show "$install_prog$stripme $file $dest"
  1691. $run eval "$install_prog\$stripme \$file \$dest" || exit $?
  1692. ;;
  1693. esac
  1694. done
  1695. for file in $staticlibs; do
  1696. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1697. # Set up the ranlib parameters.
  1698. oldlib="$destdir/$name"
  1699. $show "$install_prog $file $oldlib"
  1700. $run eval "$install_prog \$file \$oldlib" || exit $?
  1701. # Do each command in the postinstall commands.
  1702. eval cmds=\"$old_postinstall_cmds\"
  1703. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  1704. for cmd in $cmds; do
  1705. IFS="$save_ifs"
  1706. $show "$cmd"
  1707. $run eval "$cmd" || exit $?
  1708. done
  1709. IFS="$save_ifs"
  1710. done
  1711. if test -n "$future_libdirs"; then
  1712. $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  1713. fi
  1714. if test -n "$current_libdirs"; then
  1715. # Maybe just do a dry run.
  1716. test -n "$run" && current_libdirs=" -n$current_libdirs"
  1717. exec $SHELL $0 --finish$current_libdirs
  1718. exit 1
  1719. fi
  1720. exit 0
  1721. ;;
  1722. # libtool finish mode
  1723. finish)
  1724. modename="$modename: finish"
  1725. libdirs="$nonopt"
  1726. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  1727. for dir
  1728. do
  1729. libdirs="$libdirs $dir"
  1730. done
  1731. for libdir in $libdirs; do
  1732. if test -n "$finish_cmds"; then
  1733. # Do each command in the finish commands.
  1734. eval cmds=\"$finish_cmds\"
  1735. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  1736. for cmd in $cmds; do
  1737. IFS="$save_ifs"
  1738. $show "$cmd"
  1739. $run eval "$cmd"
  1740. done
  1741. IFS="$save_ifs"
  1742. fi
  1743. if test -n "$finish_eval"; then
  1744. # Do the single finish_eval.
  1745. eval cmds=\"$finish_eval\"
  1746. $run eval "$cmds"
  1747. fi
  1748. done
  1749. fi
  1750. echo "------------------------------------------------------------------------------"
  1751. echo "Libraries have been installed in:"
  1752. for libdir in $libdirs; do
  1753. echo " $libdir"
  1754. done
  1755. echo
  1756. echo "To link against installed libraries in a given directory, LIBDIR,"
  1757. echo "you must use the \`-LLIBDIR' flag during linking."
  1758. echo
  1759. echo " You will also need to do one of the following:"
  1760. if test -n "$shlibpath_var"; then
  1761. echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
  1762. echo " during execution"
  1763. fi
  1764. if test -n "$runpath_var"; then
  1765. echo " - add LIBDIR to the \`$runpath_var' environment variable"
  1766. echo " during linking"
  1767. fi
  1768. if test -n "$hardcode_libdir_flag_spec"; then
  1769. libdir=LIBDIR
  1770. eval flag=\"$hardcode_libdir_flag_spec\"
  1771. echo " - use the \`$flag' linker flag"
  1772. fi
  1773. if test -f /etc/ld.so.conf; then
  1774. echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1775. fi
  1776. echo
  1777. echo "See any operating system documentation about shared libraries for"
  1778. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1779. echo "------------------------------------------------------------------------------"
  1780. exit 0
  1781. ;;
  1782. # libtool execute mode
  1783. execute)
  1784. modename="$modename: execute"
  1785. # The first argument is the command name.
  1786. cmd="$nonopt"
  1787. if test -z "$cmd"; then
  1788. $echo "$modename: you must specify a COMMAND" 1>&2
  1789. $echo "$help"
  1790. exit 1
  1791. fi
  1792. # Handle -dlopen flags immediately.
  1793. for file in $execute_dlfiles; do
  1794. if test -f "$file"; then :
  1795. else
  1796. $echo "$modename: \`$file' is not a file" 1>&2
  1797. $echo "$help" 1>&2
  1798. exit 1
  1799. fi
  1800. dir=
  1801. case "$file" in
  1802. *.la)
  1803. # Check to see that this really is a libtool archive.
  1804. if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
  1805. else
  1806. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1807. $echo "$help" 1>&2
  1808. exit 1
  1809. fi
  1810. # Read the libtool library.
  1811. dlname=
  1812. library_names=
  1813. # If there is no directory component, then add one.
  1814. case "$file" in
  1815. */* | *\\*) . $file ;;
  1816. *) . ./$file ;;
  1817. esac
  1818. # Skip this library if it cannot be dlopened.
  1819. if test -z "$dlname"; then
  1820. # Warn if it was a shared library.
  1821. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  1822. continue
  1823. fi
  1824. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  1825. test "X$dir" = "X$file" && dir=.
  1826. if test -f "$dir/$objdir/$dlname"; then
  1827. dir="$dir/$objdir"
  1828. else
  1829. $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  1830. exit 1
  1831. fi
  1832. ;;
  1833. *.lo)
  1834. # Just add the directory containing the .lo file.
  1835. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  1836. test "X$dir" = "X$file" && dir=.
  1837. ;;
  1838. *)
  1839. $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  1840. continue
  1841. ;;
  1842. esac
  1843. # Get the absolute pathname.
  1844. absdir=`cd "$dir" && pwd`
  1845. test -n "$absdir" && dir="$absdir"
  1846. # Now add the directory to shlibpath_var.
  1847. if eval "test -z \"\$$shlibpath_var\""; then
  1848. eval "$shlibpath_var=\"\$dir\""
  1849. else
  1850. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  1851. fi
  1852. done
  1853. # This variable tells wrapper scripts just to set shlibpath_var
  1854. # rather than running their programs.
  1855. libtool_execute_magic="$magic"
  1856. # Check if any of the arguments is a wrapper script.
  1857. args=
  1858. for file
  1859. do
  1860. case "$file" in
  1861. -*) ;;
  1862. *)
  1863. # Do a test to see if this is really a libtool program.
  1864. if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
  1865. # If there is no directory component, then add one.
  1866. case "$file" in
  1867. */* | *\\*) . $file ;;
  1868. *) . ./$file ;;
  1869. esac
  1870. # Transform arg to wrapped name.
  1871. file="$progdir/$program"
  1872. fi
  1873. ;;
  1874. esac
  1875. # Quote arguments (to preserve shell metacharacters).
  1876. file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  1877. args="$args \"$file\""
  1878. done
  1879. if test -z "$run"; then
  1880. # Export the shlibpath_var.
  1881. eval "export $shlibpath_var"
  1882. # Now actually exec the command.
  1883. eval "exec \$cmd$args"
  1884. $echo "$modename: cannot exec \$cmd$args"
  1885. exit 1
  1886. else
  1887. # Display what would be done.
  1888. eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  1889. $echo "export $shlibpath_var"
  1890. $echo "$cmd$args"
  1891. exit 0
  1892. fi
  1893. ;;
  1894. # libtool uninstall mode
  1895. uninstall)
  1896. modename="$modename: uninstall"
  1897. rm="$nonopt"
  1898. files=
  1899. for arg
  1900. do
  1901. case "$arg" in
  1902. -*) rm="$rm $arg" ;;
  1903. *) files="$files $arg" ;;
  1904. esac
  1905. done
  1906. if test -z "$rm"; then
  1907. $echo "$modename: you must specify an RM program" 1>&2
  1908. $echo "$help" 1>&2
  1909. exit 1
  1910. fi
  1911. for file in $files; do
  1912. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  1913. test "X$dir" = "X$file" && dir=.
  1914. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1915. rmfiles="$file"
  1916. case "$name" in
  1917. *.la)
  1918. # Possibly a libtool archive, so verify it.
  1919. if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
  1920. . $dir/$name
  1921. # Delete the libtool libraries and symlinks.
  1922. for n in $library_names; do
  1923. rmfiles="$rmfiles $dir/$n"
  1924. test "X$n" = "X$dlname" && dlname=
  1925. done
  1926. test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
  1927. test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  1928. $show "$rm $rmfiles"
  1929. $run $rm $rmfiles
  1930. if test -n "$library_names"; then
  1931. # Do each command in the postuninstall commands.
  1932. eval cmds=\"$postuninstall_cmds\"
  1933. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  1934. for cmd in $cmds; do
  1935. IFS="$save_ifs"
  1936. $show "$cmd"
  1937. $run eval "$cmd"
  1938. done
  1939. IFS="$save_ifs"
  1940. fi
  1941. if test -n "$old_library"; then
  1942. # Do each command in the old_postuninstall commands.
  1943. eval cmds=\"$old_postuninstall_cmds\"
  1944. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  1945. for cmd in $cmds; do
  1946. IFS="$save_ifs"
  1947. $show "$cmd"
  1948. $run eval "$cmd"
  1949. done
  1950. IFS="$save_ifs"
  1951. fi
  1952. # FIXME: should reinstall the best remaining shared library.
  1953. fi
  1954. ;;
  1955. *.lo)
  1956. if test "$build_old_libs" = yes; then
  1957. oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'`
  1958. rmfiles="$rmfiles $dir/$oldobj"
  1959. fi
  1960. $show "$rm $rmfiles"
  1961. $run $rm $rmfiles
  1962. ;;
  1963. *)
  1964. $show "$rm $rmfiles"
  1965. $run $rm $rmfiles
  1966. ;;
  1967. esac
  1968. done
  1969. exit 0
  1970. ;;
  1971. "")
  1972. $echo "$modename: you must specify a MODE" 1>&2
  1973. $echo "$generic_help" 1>&2
  1974. exit 1
  1975. ;;
  1976. esac
  1977. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  1978. $echo "$generic_help" 1>&2
  1979. exit 1
  1980. fi # test -z "$show_help"
  1981. # We need to display help for each of the modes.
  1982. case "$mode" in
  1983. "") $echo \
  1984. "Usage: $modename [OPTION]... [MODE-ARG]...
  1985. Provide generalized library-building support services.
  1986. -n, --dry-run display commands without modifying any files
  1987. --features display configuration information and exit
  1988. --finish same as \`--mode=finish'
  1989. --help display this help message and exit
  1990. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
  1991. --quiet same as \`--silent'
  1992. --silent don't print informational messages
  1993. --version print version information
  1994. MODE must be one of the following:
  1995. compile compile a source file into a libtool object
  1996. execute automatically set library path, then run a program
  1997. finish complete the installation of libtool libraries
  1998. install install libraries or executables
  1999. link create a library or an executable
  2000. uninstall remove libraries from an installed directory
  2001. MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
  2002. a more detailed description of MODE."
  2003. exit 0
  2004. ;;
  2005. compile)
  2006. $echo \
  2007. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  2008. Compile a source file into a libtool library object.
  2009. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  2010. from the given SOURCEFILE.
  2011. The output file name is determined by removing the directory component from
  2012. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  2013. library object suffix, \`.lo'."
  2014. ;;
  2015. execute)
  2016. $echo \
  2017. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  2018. Automatically set library path, then run a program.
  2019. This mode accepts the following additional options:
  2020. -dlopen FILE add the directory containing FILE to the library path
  2021. This mode sets the library path environment variable according to \`-dlopen'
  2022. flags.
  2023. If any of the ARGS are libtool executable wrappers, then they are translated
  2024. into their corresponding uninstalled binary, and any of their required library
  2025. directories are added to the library path.
  2026. Then, COMMAND is executed, with ARGS as arguments."
  2027. ;;
  2028. finish)
  2029. $echo \
  2030. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  2031. Complete the installation of libtool libraries.
  2032. Each LIBDIR is a directory that contains libtool libraries.
  2033. The commands that this mode executes may require superuser privileges. Use
  2034. the \`--dry-run' option if you just want to see what would be executed."
  2035. ;;
  2036. install)
  2037. $echo \
  2038. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  2039. Install executables or libraries.
  2040. INSTALL-COMMAND is the installation command. The first component should be
  2041. either the \`install' or \`cp' program.
  2042. The rest of the components are interpreted as arguments to that command (only
  2043. BSD-compatible install options are recognized)."
  2044. ;;
  2045. link)
  2046. $echo \
  2047. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  2048. Link object files or libraries together to form another library, or to
  2049. create an executable program.
  2050. LINK-COMMAND is a command using the C compiler that you would use to create
  2051. a program from several object files.
  2052. The following components of LINK-COMMAND are treated specially:
  2053. -all-static do not do any dynamic linking at all
  2054. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  2055. -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
  2056. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  2057. -LLIBDIR search LIBDIR for required installed libraries
  2058. -lNAME OUTPUT-FILE requires the installed library libNAME
  2059. -no-undefined declare that a library does not refer to external symbols
  2060. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  2061. -release RELEASE specify package release information
  2062. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  2063. -static do not do any dynamic linking of libtool libraries
  2064. -version-info CURRENT[:REVISION[:AGE]]
  2065. specify library version info [each variable defaults to 0]
  2066. All other options (arguments beginning with \`-') are ignored.
  2067. Every other argument is treated as a filename. Files ending in \`.la' are
  2068. treated as uninstalled libtool libraries, other files are standard or library
  2069. object files.
  2070. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
  2071. library objects (\`.lo' files) may be specified, and \`-rpath' is required.
  2072. If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
  2073. and \`ranlib'.
  2074. If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
  2075. created, otherwise an executable program is created."
  2076. ;;
  2077. uninstall)
  2078. $echo
  2079. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  2080. Remove libraries from an installation directory.
  2081. RM is the name of the program to use to delete files associated with each FILE
  2082. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  2083. to RM.
  2084. If FILE is a libtool library, all the files associated with it are deleted.
  2085. Otherwise, only FILE itself is deleted using RM."
  2086. ;;
  2087. *)
  2088. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  2089. $echo "$help" 1>&2
  2090. exit 1
  2091. ;;
  2092. esac
  2093. echo
  2094. $echo "Try \`$modename --help' for more information about other modes."
  2095. exit 0
  2096. # Local Variables:
  2097. # mode:shell-script
  2098. # sh-indentation:2
  2099. # End: