PageRenderTime 2579ms CodeModel.GetById 1ms RepoModel.GetById 8ms app.codeStats 1ms

/external/rk-pcba-test/libjpegtwrp/ltmain.sh

https://gitlab.com/brian0218/rk3188_r-box_android4.2.2_sdk
Shell | 1757 lines | 1455 code | 149 blank | 153 comment | 150 complexity | 391193dcb34b1610f7ce5f11944da0d8 MD5 | raw file
  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. prev=
  335. prevarg=
  336. release=
  337. rpath=
  338. perm_rpath=
  339. temp_rpath=
  340. vinfo=
  341. # We need to know -static, to get the right output filenames.
  342. for arg
  343. do
  344. case "$arg" in
  345. -all-static | -static)
  346. if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  347. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  348. fi
  349. build_libtool_libs=no
  350. build_old_libs=yes
  351. break
  352. ;;
  353. esac
  354. done
  355. # See if our shared archives depend on static archives.
  356. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  357. # Go through the arguments, transforming them on the way.
  358. for arg
  359. do
  360. # If the previous option needs an argument, assign it.
  361. if test -n "$prev"; then
  362. case "$prev" in
  363. output)
  364. compile_command="$compile_command @OUTPUT@"
  365. finalize_command="$finalize_command @OUTPUT@"
  366. ;;
  367. esac
  368. case "$prev" in
  369. dlfiles|dlprefiles)
  370. case "$arg" in
  371. *.la | *.lo) ;; # We handle these cases below.
  372. *)
  373. dlprefiles="$dlprefiles $arg"
  374. test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
  375. prev=
  376. ;;
  377. esac
  378. ;;
  379. release)
  380. release="-$arg"
  381. prev=
  382. continue
  383. ;;
  384. rpath)
  385. rpath="$rpath $arg"
  386. prev=
  387. continue
  388. ;;
  389. *)
  390. eval "$prev=\"\$arg\""
  391. prev=
  392. continue
  393. ;;
  394. esac
  395. fi
  396. prevarg="$arg"
  397. case "$arg" in
  398. -all-static)
  399. if test -n "$link_static_flag"; then
  400. compile_command="$compile_command $link_static_flag"
  401. finalize_command="$finalize_command $link_static_flag"
  402. fi
  403. continue
  404. ;;
  405. -allow-undefined)
  406. # FIXME: remove this flag sometime in the future.
  407. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  408. continue
  409. ;;
  410. -dlopen)
  411. prev=dlfiles
  412. continue
  413. ;;
  414. -dlpreopen)
  415. prev=dlprefiles
  416. continue
  417. ;;
  418. -export-dynamic)
  419. if test "$export_dynamic" != yes; then
  420. export_dynamic=yes
  421. if test -n "$export_dynamic_flag_spec"; then
  422. eval arg=\"$export_dynamic_flag_spec\"
  423. else
  424. arg=
  425. fi
  426. # Add the symbol object into the linking commands.
  427. compile_command="$compile_command @SYMFILE@"
  428. finalize_command="$finalize_command @SYMFILE@"
  429. fi
  430. ;;
  431. -L*)
  432. dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
  433. case "$dir" in
  434. /* | [A-Za-z]:\\*)
  435. # Add the corresponding hardcode_libdir_flag, if it is not identical.
  436. ;;
  437. *)
  438. $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
  439. exit 1
  440. ;;
  441. esac
  442. deplibs="$deplibs $arg"
  443. ;;
  444. -l*) deplibs="$deplibs $arg" ;;
  445. -no-undefined)
  446. allow_undefined=no
  447. continue
  448. ;;
  449. -o) prev=output ;;
  450. -release)
  451. prev=release
  452. continue
  453. ;;
  454. -rpath)
  455. prev=rpath
  456. continue
  457. ;;
  458. -static)
  459. # If we have no pic_flag, then this is the same as -all-static.
  460. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  461. compile_command="$compile_command $link_static_flag"
  462. finalize_command="$finalize_command $link_static_flag"
  463. fi
  464. continue
  465. ;;
  466. -version-info)
  467. prev=vinfo
  468. continue
  469. ;;
  470. # Some other compiler flag.
  471. -* | +*)
  472. # Unknown arguments in both finalize_command and compile_command need
  473. # to be aesthetically quoted because they are evaled later.
  474. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  475. case "$arg" in
  476. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  477. arg="\"$arg\""
  478. ;;
  479. esac
  480. ;;
  481. *.o | *.a)
  482. # A standard object.
  483. objs="$objs $arg"
  484. ;;
  485. *.lo)
  486. # A library object.
  487. if test "$prev" = dlfiles; then
  488. dlfiles="$dlfiles $arg"
  489. if test "$build_libtool_libs" = yes; then
  490. prev=
  491. continue
  492. else
  493. # If libtool objects are unsupported, then we need to preload.
  494. prev=dlprefiles
  495. fi
  496. fi
  497. if test "$prev" = dlprefiles; then
  498. # Preload the old-style object.
  499. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
  500. prev=
  501. fi
  502. libobjs="$libobjs $arg"
  503. ;;
  504. *.la)
  505. # A libtool-controlled library.
  506. dlname=
  507. libdir=
  508. library_names=
  509. old_library=
  510. # Check to see that this really is a libtool archive.
  511. if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
  512. else
  513. $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  514. exit 1
  515. fi
  516. # If there is no directory component, then add one.
  517. case "$arg" in
  518. */* | *\\*) . $arg ;;
  519. *) . ./$arg ;;
  520. esac
  521. if test -z "$libdir"; then
  522. $echo "$modename: \`$arg' contains no -rpath information" 1>&2
  523. exit 1
  524. fi
  525. # Get the name of the library we link against.
  526. linklib=
  527. for l in $old_library $library_names; do
  528. linklib="$l"
  529. done
  530. if test -z "$linklib"; then
  531. $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  532. exit 1
  533. fi
  534. # Find the relevant object directory and library name.
  535. name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  536. dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  537. if test "X$dir" = "X$arg"; then
  538. dir="$objdir"
  539. else
  540. dir="$dir/$objdir"
  541. fi
  542. # This library was specified with -dlopen.
  543. if test "$prev" = dlfiles; then
  544. dlfiles="$dlfiles $arg"
  545. if test -z "$dlname"; then
  546. # If there is no dlname, we need to preload.
  547. prev=dlprefiles
  548. else
  549. # We should not create a dependency on this library, but we
  550. # may need any libraries it requires.
  551. compile_command="$compile_command$dependency_libs"
  552. finalize_command="$finalize_command$dependency_libs"
  553. prev=
  554. continue
  555. fi
  556. fi
  557. # The library was specified with -dlpreopen.
  558. if test "$prev" = dlprefiles; then
  559. # Prefer using a static library (so that no silly _DYNAMIC symbols
  560. # are required to link).
  561. if test -n "$old_library"; then
  562. dlprefiles="$dlprefiles $dir/$old_library"
  563. else
  564. dlprefiles="$dlprefiles $dir/$linklib"
  565. fi
  566. prev=
  567. fi
  568. if test "$build_libtool_libs" = yes && test -n "$library_names"; then
  569. link_against_libtool_libs="$link_against_libtool_libs $arg"
  570. if test -n "$shlibpath_var"; then
  571. # Make sure the rpath contains only unique directories.
  572. case "$temp_rpath " in
  573. *" $dir "*) ;;
  574. *) temp_rpath="$temp_rpath $dir" ;;
  575. esac
  576. fi
  577. # This is the magic to use -rpath.
  578. if test -n "$hardcode_libdir_flag_spec"; then
  579. if test -n "$hardcode_libdir_separator"; then
  580. if test -z "$hardcode_libdirs"; then
  581. # Put the magic libdir with the hardcode flag.
  582. hardcode_libdirs="$libdir"
  583. libdir="@HARDCODE_LIBDIRS@"
  584. else
  585. # Just accumulate the unique libdirs.
  586. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  587. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  588. ;;
  589. *)
  590. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  591. ;;
  592. esac
  593. libdir=
  594. fi
  595. fi
  596. if test -n "$libdir"; then
  597. eval flag=\"$hardcode_libdir_flag_spec\"
  598. compile_command="$compile_command $flag"
  599. finalize_command="$finalize_command $flag"
  600. fi
  601. elif test -n "$runpath_var"; then
  602. # Do the same for the permanent run path.
  603. case "$perm_rpath " in
  604. *" $libdir "*) ;;
  605. *) perm_rpath="$perm_rpath $libdir" ;;
  606. esac
  607. fi
  608. case "$hardcode_action" in
  609. immediate)
  610. if test "$hardcode_direct" = no; then
  611. compile_command="$compile_command $dir/$linklib"
  612. elif test "$hardcode_minus_L" = no; then
  613. compile_command="$compile_command -L$dir -l$name"
  614. elif test "$hardcode_shlibpath_var" = no; then
  615. compile_shlibpath="$compile_shlibpath$dir:"
  616. compile_command="$compile_command -l$name"
  617. fi
  618. ;;
  619. relink)
  620. # We need an absolute path.
  621. case "$dir" in
  622. /* | [A-Za-z]:\\*) ;;
  623. *)
  624. absdir=`cd "$dir" && pwd`
  625. if test -z "$absdir"; then
  626. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  627. exit 1
  628. fi
  629. dir="$absdir"
  630. ;;
  631. esac
  632. if test "$hardcode_direct" = yes; then
  633. compile_command="$compile_command $dir/$linklib"
  634. elif test "$hardcode_minus_L" = yes; then
  635. compile_command="$compile_command -L$dir -l$name"
  636. elif test "$hardcode_shlibpath_var" = yes; then
  637. compile_shlibpath="$compile_shlibpath$dir:"
  638. compile_command="$compile_command -l$name"
  639. fi
  640. ;;
  641. *)
  642. $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2
  643. exit 1
  644. ;;
  645. esac
  646. # Finalize command for both is simple: just hardcode it.
  647. if test "$hardcode_direct" = yes; then
  648. finalize_command="$finalize_command $libdir/$linklib"
  649. elif test "$hardcode_minus_L" = yes; then
  650. finalize_command="$finalize_command -L$libdir -l$name"
  651. elif test "$hardcode_shlibpath_var" = yes; then
  652. finalize_shlibpath="$finalize_shlibpath$libdir:"
  653. finalize_command="$finalize_command -l$name"
  654. else
  655. # We cannot seem to hardcode it, guess we'll fake it.
  656. finalize_command="$finalize_command -L$libdir -l$name"
  657. fi
  658. else
  659. # Transform directly to old archives if we don't build new libraries.
  660. if test -n "$pic_flag" && test -z "$old_library"; then
  661. $echo "$modename: cannot find static library for \`$arg'" 1>&2
  662. exit 1
  663. fi
  664. # Here we assume that one of hardcode_direct or hardcode_minus_L
  665. # is not unsupported. This is valid on all known static and
  666. # shared platforms.
  667. if test "$hardcode_direct" != unsupported; then
  668. test -n "$old_library" && linklib="$old_library"
  669. compile_command="$compile_command $dir/$linklib"
  670. finalize_command="$finalize_command $dir/$linklib"
  671. else
  672. compile_command="$compile_command -L$dir -l$name"
  673. finalize_command="$finalize_command -L$dir -l$name"
  674. fi
  675. fi
  676. # Add in any libraries that this one depends upon.
  677. compile_command="$compile_command$dependency_libs"
  678. finalize_command="$finalize_command$dependency_libs"
  679. continue
  680. ;;
  681. # Some other compiler argument.
  682. *)
  683. # Unknown arguments in both finalize_command and compile_command need
  684. # to be aesthetically quoted because they are evaled later.
  685. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  686. case "$arg" in
  687. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  688. arg="\"$arg\""
  689. ;;
  690. esac
  691. ;;
  692. esac
  693. # Now actually substitute the argument into the commands.
  694. if test -n "$arg"; then
  695. compile_command="$compile_command $arg"
  696. finalize_command="$finalize_command $arg"
  697. fi
  698. done
  699. if test -n "$prev"; then
  700. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  701. $echo "$help" 1>&2
  702. exit 1
  703. fi
  704. if test -n "$vinfo" && test -n "$release"; then
  705. $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2
  706. $echo "$help" 1>&2
  707. exit 1
  708. fi
  709. oldlib=
  710. oldobjs=
  711. case "$output" in
  712. "")
  713. $echo "$modename: you must specify an output file" 1>&2
  714. $echo "$help" 1>&2
  715. exit 1
  716. ;;
  717. */* | *\\*)
  718. $echo "$modename: output file \`$output' must have no directory components" 1>&2
  719. exit 1
  720. ;;
  721. *.a)
  722. # Now set the variables for building old libraries.
  723. build_libtool_libs=no
  724. build_old_libs=yes
  725. oldlib="$output"
  726. $show "$rm $oldlib"
  727. $run $rm $oldlib
  728. ;;
  729. *.la)
  730. # Make sure we only generate libraries of the form `libNAME.la'.
  731. case "$output" in
  732. lib*) ;;
  733. *)
  734. $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
  735. $echo "$help" 1>&2
  736. exit 1
  737. ;;
  738. esac
  739. name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  740. eval libname=\"$libname_spec\"
  741. # All the library-specific variables (install_libdir is set above).
  742. library_names=
  743. old_library=
  744. dlname=
  745. current=0
  746. revision=0
  747. age=0
  748. if test -n "$objs"; then
  749. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  750. exit 1
  751. fi
  752. # How the heck are we supposed to write a wrapper for a shared library?
  753. if test -n "$link_against_libtool_libs"; then
  754. $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
  755. exit 1
  756. fi
  757. if test -n "$dlfiles$dlprefiles"; then
  758. $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
  759. # Nullify the symbol file.
  760. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  761. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  762. fi
  763. if test -z "$rpath"; then
  764. $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
  765. $echo "$help" 1>&2
  766. exit 1
  767. fi
  768. set dummy $rpath
  769. if test $# -gt 2; then
  770. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  771. fi
  772. install_libdir="$2"
  773. # Parse the version information argument.
  774. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
  775. set dummy $vinfo
  776. IFS="$save_ifs"
  777. if test -n "$5"; then
  778. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  779. $echo "$help" 1>&2
  780. exit 1
  781. fi
  782. test -n "$2" && current="$2"
  783. test -n "$3" && revision="$3"
  784. test -n "$4" && age="$4"
  785. # Check that each of the things are valid numbers.
  786. case "$current" in
  787. 0 | [1-9] | [1-9][0-9]*) ;;
  788. *)
  789. $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  790. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  791. exit 1
  792. ;;
  793. esac
  794. case "$revision" in
  795. 0 | [1-9] | [1-9][0-9]*) ;;
  796. *)
  797. $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  798. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  799. exit 1
  800. ;;
  801. esac
  802. case "$age" in
  803. 0 | [1-9] | [1-9][0-9]*) ;;
  804. *)
  805. $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  806. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  807. exit 1
  808. ;;
  809. esac
  810. if test $age -gt $current; then
  811. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  812. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  813. exit 1
  814. fi
  815. # Calculate the version variables.
  816. version_vars="version_type current age revision"
  817. case "$version_type" in
  818. none) ;;
  819. linux)
  820. version_vars="$version_vars major versuffix"
  821. major=`expr $current - $age`
  822. versuffix="$major.$age.$revision"
  823. ;;
  824. osf)
  825. version_vars="$version_vars versuffix verstring"
  826. major=`expr $current - $age`
  827. versuffix="$current.$age.$revision"
  828. verstring="$versuffix"
  829. # Add in all the interfaces that we are compatible with.
  830. loop=$age
  831. while test $loop != 0; do
  832. iface=`expr $current - $loop`
  833. loop=`expr $loop - 1`
  834. verstring="$verstring:${iface}.0"
  835. done
  836. # Make executables depend on our current version.
  837. verstring="$verstring:${current}.0"
  838. ;;
  839. sunos)
  840. version_vars="$version_vars major versuffix"
  841. major="$current"
  842. versuffix="$current.$revision"
  843. ;;
  844. *)
  845. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  846. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  847. exit 1
  848. ;;
  849. esac
  850. # Create the output directory, or remove our outputs if we need to.
  851. if test -d $objdir; then
  852. $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
  853. $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
  854. else
  855. $show "$mkdir $objdir"
  856. $run $mkdir $objdir
  857. status=$?
  858. if test $status -eq 0 || test -d $objdir; then :
  859. else
  860. exit $status
  861. fi
  862. fi
  863. # Check to see if the archive will have undefined symbols.
  864. if test "$allow_undefined" = yes; then
  865. if test "$allow_undefined_flag" = unsupported; then
  866. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  867. build_libtool_libs=no
  868. build_old_libs=yes
  869. fi
  870. else
  871. # Don't allow undefined symbols.
  872. allow_undefined_flag="$no_undefined_flag"
  873. fi
  874. # Add libc to deplibs on all systems.
  875. dependency_libs="$deplibs"
  876. deplibs="$deplibs -lc"
  877. if test "$build_libtool_libs" = yes; then
  878. # Get the real and link names of the library.
  879. eval library_names=\"$library_names_spec\"
  880. set dummy $library_names
  881. realname="$2"
  882. shift; shift
  883. if test -n "$soname_spec"; then
  884. eval soname=\"$soname_spec\"
  885. else
  886. soname="$realname"
  887. fi
  888. lib="$objdir/$realname"
  889. for link
  890. do
  891. linknames="$linknames $link"
  892. done
  893. # Use standard objects if they are PIC.
  894. test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
  895. # Do each of the archive commands.
  896. eval cmds=\"$archive_cmds\"
  897. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  898. for cmd in $cmds; do
  899. IFS="$save_ifs"
  900. $show "$cmd"
  901. $run eval "$cmd" || exit $?
  902. done
  903. IFS="$save_ifs"
  904. # Create links to the real library.
  905. for linkname in $linknames; do
  906. $show "(cd $objdir && $LN_S $realname $linkname)"
  907. $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
  908. done
  909. # If -export-dynamic was specified, set the dlname.
  910. if test "$export_dynamic" = yes; then
  911. # On all known operating systems, these are identical.
  912. dlname="$soname"
  913. fi
  914. fi
  915. # Now set the variables for building old libraries.
  916. oldlib="$objdir/$libname.a"
  917. ;;
  918. *.lo | *.o)
  919. if test -n "$link_against_libtool_libs"; then
  920. $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
  921. exit 1
  922. fi
  923. if test -n "$deplibs"; then
  924. $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
  925. fi
  926. if test -n "$dlfiles$dlprefiles"; then
  927. $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
  928. # Nullify the symbol file.
  929. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  930. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  931. fi
  932. if test -n "$rpath"; then
  933. $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
  934. fi
  935. if test -n "$vinfo"; then
  936. $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
  937. fi
  938. if test -n "$release"; then
  939. $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
  940. fi
  941. case "$output" in
  942. *.lo)
  943. if test -n "$objs"; then
  944. $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  945. exit 1
  946. fi
  947. libobj="$output"
  948. obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
  949. ;;
  950. *)
  951. libobj=
  952. obj="$output"
  953. ;;
  954. esac
  955. # Delete the old objects.
  956. $run $rm $obj $libobj
  957. # Create the old-style object.
  958. reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
  959. output="$obj"
  960. eval cmds=\"$reload_cmds\"
  961. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  962. for cmd in $cmds; do
  963. IFS="$save_ifs"
  964. $show "$cmd"
  965. $run eval "$cmd" || exit $?
  966. done
  967. IFS="$save_ifs"
  968. # Exit if we aren't doing a library object file.
  969. test -z "$libobj" && exit 0
  970. if test "$build_libtool_libs" != yes; then
  971. # Create an invalid libtool object if no PIC, so that we don't
  972. # accidentally link it into a program.
  973. $show "echo timestamp > $libobj"
  974. $run eval "echo timestamp > $libobj" || exit $?
  975. exit 0
  976. fi
  977. if test -n "$pic_flag"; then
  978. # Only do commands if we really have different PIC objects.
  979. reload_objs="$libobjs"
  980. output="$libobj"
  981. eval cmds=\"$reload_cmds\"
  982. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  983. for cmd in $cmds; do
  984. IFS="$save_ifs"
  985. $show "$cmd"
  986. $run eval "$cmd" || exit $?
  987. done
  988. IFS="$save_ifs"
  989. else
  990. # Just create a symlink.
  991. $show "$LN_S $obj $libobj"
  992. $run $LN_S $obj $libobj || exit 1
  993. fi
  994. exit 0
  995. ;;
  996. *)
  997. if test -n "$vinfo"; then
  998. $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
  999. fi
  1000. if test -n "$release"; then
  1001. $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
  1002. fi
  1003. if test -n "$rpath"; then
  1004. # If the user specified any rpath flags, then add them.
  1005. for libdir in $rpath; do
  1006. if test -n "$hardcode_libdir_flag_spec"; then
  1007. if test -n "$hardcode_libdir_separator"; then
  1008. if test -z "$hardcode_libdirs"; then
  1009. # Put the magic libdir with the hardcode flag.
  1010. hardcode_libdirs="$libdir"
  1011. libdir="@HARDCODE_LIBDIRS@"
  1012. else
  1013. # Just accumulate the unique libdirs.
  1014. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1015. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1016. ;;
  1017. *)
  1018. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1019. ;;
  1020. esac
  1021. libdir=
  1022. fi
  1023. fi
  1024. if test -n "$libdir"; then
  1025. eval flag=\"$hardcode_libdir_flag_spec\"
  1026. compile_command="$compile_command $flag"
  1027. finalize_command="$finalize_command $flag"
  1028. fi
  1029. elif test -n "$runpath_var"; then
  1030. case "$perm_rpath " in
  1031. *" $libdir "*) ;;
  1032. *) perm_rpath="$perm_rpath $libdir" ;;
  1033. esac
  1034. fi
  1035. done
  1036. fi
  1037. # Substitute the hardcoded libdirs into the compile commands.
  1038. if test -n "$hardcode_libdir_separator"; then
  1039. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  1040. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  1041. fi
  1042. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  1043. # Transform all the library objects into standard objects.
  1044. compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1045. finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1046. fi
  1047. if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
  1048. dlsyms="${output}S.c"
  1049. else
  1050. dlsyms=
  1051. fi
  1052. if test -n "$dlsyms"; then
  1053. # Add our own program objects to the preloaded list.
  1054. dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1055. # Discover the nlist of each of the dlfiles.
  1056. nlist="$objdir/${output}.nm"
  1057. if test -d $objdir; then
  1058. $show "$rm $nlist ${nlist}T"
  1059. $run $rm "$nlist" "${nlist}T"
  1060. else
  1061. $show "$mkdir $objdir"
  1062. $run $mkdir $objdir
  1063. status=$?
  1064. if test $status -eq 0 || test -d $objdir; then :
  1065. else
  1066. exit $status
  1067. fi
  1068. fi
  1069. for arg in $dlprefiles; do
  1070. $show "extracting global C symbols from \`$arg'"
  1071. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1072. done
  1073. # Parse the name list into a source file.
  1074. $show "creating $objdir/$dlsyms"
  1075. if test -z "$run"; then
  1076. # Make sure we at least have an empty file.
  1077. test -f "$nlist" || : > "$nlist"
  1078. # Try sorting and uniquifying the output.
  1079. if sort "$nlist" | uniq > "$nlist"T; then
  1080. mv -f "$nlist"T "$nlist"
  1081. wcout=`wc "$nlist" 2>/dev/null`
  1082. count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
  1083. (test "$count" -ge 0) 2>/dev/null || count=-1
  1084. else
  1085. $rm "$nlist"T
  1086. count=-1
  1087. fi
  1088. case "$dlsyms" in
  1089. "") ;;
  1090. *.c)
  1091. $echo > "$objdir/$dlsyms" "\
  1092. /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
  1093. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
  1094. #ifdef __cplusplus
  1095. extern \"C\" {
  1096. #endif
  1097. /* Prevent the only kind of declaration conflicts we can make. */
  1098. #define dld_preloaded_symbol_count some_other_symbol
  1099. #define dld_preloaded_symbols some_other_symbol
  1100. /* External symbol declarations for the compiler. */\
  1101. "
  1102. if test -f "$nlist"; then
  1103. sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
  1104. else
  1105. echo '/* NONE */' >> "$objdir/$dlsyms"
  1106. fi
  1107. $echo >> "$objdir/$dlsyms" "\
  1108. #undef dld_preloaded_symbol_count
  1109. #undef dld_preloaded_symbols
  1110. #if defined (__STDC__) && __STDC__
  1111. # define __ptr_t void *
  1112. #else
  1113. # define __ptr_t char *
  1114. #endif
  1115. /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
  1116. int dld_preloaded_symbol_count = $count;
  1117. /* The mapping between symbol names and symbols. */
  1118. struct {
  1119. char *name;
  1120. __ptr_t address;
  1121. }
  1122. dld_preloaded_symbols[] =
  1123. {\
  1124. "
  1125. if test -f "$nlist"; then
  1126. sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
  1127. fi
  1128. $echo >> "$objdir/$dlsyms" "\
  1129. {0, (__ptr_t) 0}
  1130. };
  1131. #ifdef __cplusplus
  1132. }
  1133. #endif\
  1134. "
  1135. ;;
  1136. *)
  1137. $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  1138. exit 1
  1139. ;;
  1140. esac
  1141. fi
  1142. # Now compile the dynamic symbol file.
  1143. $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
  1144. $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
  1145. # Transform the symbol file into the correct name.
  1146. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
  1147. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
  1148. elif test "$export_dynamic" != yes; then
  1149. test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
  1150. else
  1151. # We keep going just in case the user didn't refer to
  1152. # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
  1153. # really was required.
  1154. $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  1155. # Nullify the symbol file.
  1156. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  1157. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1158. fi
  1159. if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  1160. # Replace the output file specification.
  1161. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1162. finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1163. # We have no uninstalled library dependencies, so finalize right now.
  1164. $show "$compile_command"
  1165. $run eval "$compile_command"
  1166. exit $?
  1167. fi
  1168. # Replace the output file specification.
  1169. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
  1170. finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
  1171. # Create the binary in the object directory, then wrap it.
  1172. if test -d $objdir; then :
  1173. else
  1174. $show "$mkdir $objdir"
  1175. $run $mkdir $objdir
  1176. status=$?
  1177. if test $status -eq 0 || test -d $objdir; then :
  1178. else
  1179. exit $status
  1180. fi
  1181. fi
  1182. if test -n "$shlibpath_var"; then
  1183. # We should set the shlibpath_var
  1184. rpath=
  1185. for dir in $temp_rpath; do
  1186. case "$dir" in
  1187. /* | [A-Za-z]:\\*)
  1188. # Absolute path.
  1189. rpath="$rpath$dir:"
  1190. ;;
  1191. *)
  1192. # Relative path: add a thisdir entry.
  1193. rpath="$rpath\$thisdir/$dir:"
  1194. ;;
  1195. esac
  1196. done
  1197. temp_rpath="$rpath"
  1198. fi
  1199. # Delete the old output file.
  1200. $run $rm $output
  1201. if test -n "$compile_shlibpath"; then
  1202. compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
  1203. fi
  1204. if test -n "$finalize_shlibpath"; then
  1205. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  1206. fi
  1207. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  1208. # We should set the runpath_var.
  1209. rpath=
  1210. for dir in $perm_rpath; do
  1211. rpath="$rpath$dir:"
  1212. done
  1213. compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
  1214. finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
  1215. fi
  1216. case "$hardcode_action" in
  1217. relink)
  1218. # AGH! Flame the AIX and HP-UX people for me, will ya?
  1219. $echo "$modename: warning: using a buggy system linker" 1>&2
  1220. $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
  1221. ;;
  1222. esac
  1223. $show "$compile_command"
  1224. $run eval "$compile_command" || exit $?
  1225. # Now create the wrapper script.
  1226. $show "creating $output"
  1227. # Quote the finalize command for shipping.
  1228. finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
  1229. # Quote $echo for shipping.
  1230. qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  1231. # Only actually do things if our run command is non-null.
  1232. if test -z "$run"; then
  1233. $rm $output
  1234. trap "$rm $output; exit 1" 1 2 15
  1235. $echo > $output "\
  1236. #! /bin/sh
  1237. # $output - temporary wrapper script for $objdir/$output
  1238. # Generated by ltmain.sh - GNU $PACKAGE $VERSION
  1239. #
  1240. # The $output program cannot be directly executed until all the libtool
  1241. # libraries that it depends on are installed.
  1242. #
  1243. # This wrapper script should never be moved out of \``pwd`'.
  1244. # If it is, it will not operate correctly.
  1245. # Sed substitution that helps us do robust quoting. It backslashifies
  1246. # metacharacters that are still active within double-quoted strings.
  1247. Xsed='sed -e s/^X//'
  1248. sed_quote_subst='$sed_quote_subst'
  1249. # The HP-UX ksh and POSIX shell print the target directory to stdout
  1250. # if CDPATH is set.
  1251. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
  1252. # This environment variable determines our operation mode.
  1253. if test \"\$libtool_install_magic\" = \"$magic\"; then
  1254. # install mode needs the following variables:
  1255. link_against_libtool_libs='$link_against_libtool_libs'
  1256. finalize_command=\"$finalize_command\"
  1257. else
  1258. # When we are sourced in execute mode, \$file and \$echo are already set.
  1259. if test \"\$libtool_execute_magic\" = \"$magic\"; then :
  1260. else
  1261. echo=\"$qecho\"
  1262. file=\"\$0\"
  1263. fi\
  1264. "
  1265. $echo >> $output "\
  1266. # Find the directory that this script lives in.
  1267. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  1268. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  1269. # Follow symbolic links until we get to the real thisdir.
  1270. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  1271. while test -n \"\$file\"; do
  1272. destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  1273. # If there was a directory component, then change thisdir.
  1274. if test \"x\$destdir\" != \"x\$file\"; then
  1275. case \"\$destdir\" in
  1276. /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;;
  1277. *) thisdir=\"\$thisdir/\$destdir\" ;;
  1278. esac
  1279. fi
  1280. file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  1281. file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  1282. done
  1283. # Try to get the absolute directory name.
  1284. absdir=\`cd \"\$thisdir\" && pwd\`
  1285. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  1286. progdir=\"\$thisdir/$objdir\"
  1287. program='$output'
  1288. if test -f \"\$progdir/\$program\"; then"
  1289. # Export our shlibpath_var if we have one.
  1290. if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  1291. $echo >> $output "\
  1292. # Add our own library path to $shlibpath_var
  1293. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  1294. # Some systems cannot cope with colon-terminated $shlibpath_var
  1295. $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
  1296. export $shlibpath_var
  1297. "
  1298. fi
  1299. $echo >> $output "\
  1300. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  1301. # Run the actual program with our arguments.
  1302. # Export the path to the program.
  1303. PATH=\"\$progdir:\$PATH\"
  1304. export PATH
  1305. exec \$program \${1+\"\$@\"}
  1306. \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  1307. exit 1
  1308. fi
  1309. else
  1310. # The program doesn't exist.
  1311. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1312. \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1313. echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1314. exit 1
  1315. fi
  1316. fi\
  1317. "
  1318. chmod +x $output
  1319. fi
  1320. exit 0
  1321. ;;
  1322. esac
  1323. # See if we need to build an old-fashioned archive.
  1324. if test "$build_old_libs" = "yes"; then
  1325. # Transform .lo files to .o files.
  1326. oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
  1327. # Do each command in the archive commands.
  1328. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1329. eval cmds=\"$old_archive_from_new_cmds\"
  1330. else
  1331. eval cmds=\"$old_archive_cmds\"
  1332. fi
  1333. IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
  1334. for cmd in $cmds; do
  1335. IFS="$save_ifs"
  1336. $show "$cmd"
  1337. $run eval "$cmd" || exit $?
  1338. done
  1339. IFS="$save_ifs"
  1340. fi
  1341. # Now create the libtool archive.
  1342. case "$output" in
  1343. *.la)
  1344. old_library=
  1345. test "$build_old_libs" = yes && old_library="$libname.a"
  1346. $show "creating $output"
  1347. # Only create the output if not a dry run.
  1348. if test -z "$run"; then
  1349. $echo > $output "\
  1350. # $output - a libtool library file
  1351. # Generated by ltmain.sh - GNU $PACKAGE $VERSION
  1352. # The name that we can dlopen(3).
  1353. dlname='$dlname'
  1354. # Names of this library.
  1355. library_names='$library_names'
  1356. # The name of the static archive.
  1357. old_library='$old_library'
  1358. # Libraries that this one depends upon.
  1359. dependency_libs='$dependency_libs'
  1360. # Version information for $libname.
  1361. current=$current
  1362. age=$age
  1363. revision=$revision
  1364. # Directory that this library needs to be installed in:
  1365. libdir='$install_libdir'\
  1366. "
  1367. fi
  1368. # Do a symbolic link so that the libtool archive can be found in
  1369. # LD_LIBRARY_PATH before the program is installed.
  1370. $show "(cd $objdir && $LN_S ../$output $output)"
  1371. $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
  1372. ;;
  1373. esac
  1374. exit 0
  1375. ;;
  1376. # libtool install mode
  1377. install)
  1378. modename="$modename: install"
  1379. # There may be an optional /bin/sh argument at the beginning of
  1380. # install_prog (especially on Windows NT).
  1381. if test "$nonopt" = "$SHELL"; then
  1382. # Aesthetically quote it.
  1383. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  1384. case "$arg" in
  1385. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1386. arg="\"$arg\""
  1387. ;;
  1388. esac
  1389. install_prog="$arg "
  1390. arg="$1"
  1391. shift
  1392. else
  1393. install_prog=
  1394. arg="$nonopt"
  1395. fi
  1396. # The real first argument should be the name of the installation program.
  1397. # Aesthetically quote it.
  1398. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1399. case "$arg" in
  1400. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1401. arg="\"$arg\""
  1402. ;;
  1403. esac
  1404. install_prog="$install_prog$arg"
  1405. # We need to accept at least all the BSD install flags.
  1406. dest=
  1407. files=
  1408. opts=
  1409. prev=
  1410. install_type=
  1411. isdir=
  1412. stripme=
  1413. for arg
  1414. do
  1415. if test -n "$dest"; then
  1416. files="$files $dest"
  1417. dest="$arg"
  1418. continue
  1419. fi
  1420. case "$arg" in
  1421. -d) isdir=yes ;;
  1422. -f) prev="-f" ;;
  1423. -g) prev="-g" ;;
  1424. -m) prev="-m" ;;
  1425. -o) prev="-o" ;;
  1426. -s)
  1427. stripme=" -s"
  1428. continue
  1429. ;;
  1430. -*) ;;
  1431. *)
  1432. # If the previous option needed an argument, then skip it.
  1433. if test -n "$prev"; then
  1434. prev=
  1435. else
  1436. dest="$arg"
  1437. continue
  1438. fi
  1439. ;;
  1440. esac
  1441. # Aesthetically quote the argument.
  1442. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1443. case "$arg" in
  1444. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1445. arg="\"$arg\""
  1446. ;;
  1447. esac
  1448. install_prog="$install_prog $arg"
  1449. done
  1450. if test -z "$install_prog"; then
  1451. $echo "$modename: you must specify an install program" 1>&2
  1452. $echo "$help" 1>&2
  1453. exit 1
  1454. fi
  1455. if test -n "$prev"; then
  1456. $echo "$modename: the \`$prev' option requires an argument" 1>&2
  1457. $echo "$help" 1>&2
  1458. exit 1
  1459. fi
  1460. if test -z "$files"; then
  1461. if test -z "$dest"; then
  1462. $echo "$modename: no file or destination specified" 1>&2
  1463. else
  1464. $echo "$modename: you must specify a destination" 1>&2
  1465. fi
  1466. $echo "$help" 1>&2
  1467. exit 1
  1468. fi
  1469. # Strip any trailing slash from the destination.
  1470. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  1471. # Check to see that the destination is a directory.
  1472. test -d "$dest" && isdir=yes
  1473. if test -n "$isdir"; then
  1474. destdir="$dest"
  1475. destname=
  1476. else
  1477. destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  1478. test "X$destdir" = "X$dest" && destdir=.
  1479. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  1480. # Not a directory, so check to see that there is only one file specified.
  1481. set dummy $files
  1482. if test $# -gt 2; then
  1483. $echo "$modename: \`$dest' is not a directory" 1>&2
  1484. $echo "$help" 1>&2
  1485. exit 1
  1486. fi
  1487. fi
  1488. case "$destdir" in
  1489. /* | [A-Za-z]:\\*) ;;
  1490. *)
  1491. for file in $files; do
  1492. case "$file" in
  1493. *.lo) ;;
  1494. *)
  1495. $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  1496. $echo "$help" 1>&2
  1497. exit 1
  1498. ;;
  1499. esac
  1500. done
  1501. ;;
  1502. esac
  1503. # This variable tells wrapper scripts just to set variables rather
  1504. # than running their programs.
  1505. libtool_install_magic="$magic"
  1506. staticlibs=
  1507. future_libdirs=
  1508. current_libdirs=
  1509. for file in $files; do
  1510. # Do each installation.
  1511. case "$file" in
  1512. *.a)
  1513. # Do the static libraries later.
  1514. staticlibs="$staticlibs