PageRenderTime 70ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 1ms

/ghmm-0.7.0/ltmain.sh

http://github.com/jcnossen/hmmgenefinder
Shell | 6422 lines | 5468 code | 407 blank | 547 comment | 656 complexity | e112867921e7d6f38281b55b50fa5133 MD5 | raw file
Possible License(s): GPL-2.0
  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun configure.
  3. #
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
  5. # Free Software Foundation, Inc.
  6. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. # General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. #
  22. # As a special exception to the GNU General Public License, if you
  23. # distribute this file as part of a program that contains a
  24. # configuration script generated by Autoconf, you may include it under
  25. # the same distribution terms that you use for the rest of that program.
  26. basename="s,^.*/,,g"
  27. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  28. # is ksh but when the shell is invoked as "sh" and the current value of
  29. # the _XPG environment variable is not equal to 1 (one), the special
  30. # positional parameter $0, within a function call, is the name of the
  31. # function.
  32. progpath="$0"
  33. # The name of this program:
  34. progname=`echo "$progpath" | $SED $basename`
  35. modename="$progname"
  36. # Global variables:
  37. EXIT_SUCCESS=0
  38. EXIT_FAILURE=1
  39. PROGRAM=ltmain.sh
  40. PACKAGE=libtool
  41. VERSION=1.5.6
  42. TIMESTAMP=" (1.1220.2.94 2004/04/10 16:27:27)"
  43. # Check that we have a working $echo.
  44. if test "X$1" = X--no-reexec; then
  45. # Discard the --no-reexec flag, and continue.
  46. shift
  47. elif test "X$1" = X--fallback-echo; then
  48. # Avoid inline document here, it may be left over
  49. :
  50. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  51. # Yippee, $echo works!
  52. :
  53. else
  54. # Restart under the correct shell, and then maybe $echo will work.
  55. exec $SHELL "$progpath" --no-reexec ${1+"$@"}
  56. fi
  57. if test "X$1" = X--fallback-echo; then
  58. # used as fallback echo
  59. shift
  60. cat <<EOF
  61. $*
  62. EOF
  63. exit $EXIT_SUCCESS
  64. fi
  65. default_mode=
  66. help="Try \`$progname --help' for more information."
  67. magic="%%%MAGIC variable%%%"
  68. mkdir="mkdir"
  69. mv="mv -f"
  70. rm="rm -f"
  71. # Sed substitution that helps us do robust quoting. It backslashifies
  72. # metacharacters that are still active within double-quoted strings.
  73. Xsed="${SED}"' -e 1s/^X//'
  74. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  75. # test EBCDIC or ASCII
  76. case `echo A|tr A '\301'` in
  77. A) # EBCDIC based system
  78. SP2NL="tr '\100' '\n'"
  79. NL2SP="tr '\r\n' '\100\100'"
  80. ;;
  81. *) # Assume ASCII based system
  82. SP2NL="tr '\040' '\012'"
  83. NL2SP="tr '\015\012' '\040\040'"
  84. ;;
  85. esac
  86. # NLS nuisances.
  87. # Only set LANG and LC_ALL to C if already set.
  88. # These must not be set unconditionally because not all systems understand
  89. # e.g. LANG=C (notably SCO).
  90. # We save the old values to restore during execute mode.
  91. if test "${LC_ALL+set}" = set; then
  92. save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  93. fi
  94. if test "${LANG+set}" = set; then
  95. save_LANG="$LANG"; LANG=C; export LANG
  96. fi
  97. # Make sure IFS has a sensible default
  98. : ${IFS="
  99. "}
  100. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  101. $echo "$modename: not configured to build any kind of library" 1>&2
  102. $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  103. exit $EXIT_FAILURE
  104. fi
  105. # Global variables.
  106. mode=$default_mode
  107. nonopt=
  108. prev=
  109. prevopt=
  110. run=
  111. show="$echo"
  112. show_help=
  113. execute_dlfiles=
  114. lo2o="s/\\.lo\$/.${objext}/"
  115. o2lo="s/\\.${objext}\$/.lo/"
  116. #####################################
  117. # Shell function definitions:
  118. # This seems to be the best place for them
  119. # func_win32_libid arg
  120. # return the library type of file 'arg'
  121. #
  122. # Need a lot of goo to handle *both* DLLs and import libs
  123. # Has to be a shell function in order to 'eat' the argument
  124. # that is supplied when $file_magic_command is called.
  125. func_win32_libid () {
  126. win32_libid_type="unknown"
  127. win32_fileres=`file -L $1 2>/dev/null`
  128. case $win32_fileres in
  129. *ar\ archive\ import\ library*) # definitely import
  130. win32_libid_type="x86 archive import"
  131. ;;
  132. *ar\ archive*) # could be an import, or static
  133. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
  134. $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
  135. win32_nmres=`eval $NM -f posix -A $1 | \
  136. sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
  137. if test "X$win32_nmres" = "Ximport" ; then
  138. win32_libid_type="x86 archive import"
  139. else
  140. win32_libid_type="x86 archive static"
  141. fi
  142. fi
  143. ;;
  144. *DLL*)
  145. win32_libid_type="x86 DLL"
  146. ;;
  147. *executable*) # but shell scripts are "executable" too...
  148. case $win32_fileres in
  149. *MS\ Windows\ PE\ Intel*)
  150. win32_libid_type="x86 DLL"
  151. ;;
  152. esac
  153. ;;
  154. esac
  155. $echo $win32_libid_type
  156. }
  157. # func_infer_tag arg
  158. # Infer tagged configuration to use if any are available and
  159. # if one wasn't chosen via the "--tag" command line option.
  160. # Only attempt this if the compiler in the base compile
  161. # command doesn't match the default compiler.
  162. # arg is usually of the form 'gcc ...'
  163. func_infer_tag () {
  164. if test -n "$available_tags" && test -z "$tagname"; then
  165. CC_quoted=
  166. for arg in $CC; do
  167. case $arg in
  168. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  169. arg="\"$arg\""
  170. ;;
  171. esac
  172. CC_quoted="$CC_quoted $arg"
  173. done
  174. case $@ in
  175. # Blanks in the command may have been stripped by the calling shell,
  176. # but not from the CC environment variable when configure was run.
  177. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
  178. # Blanks at the start of $base_compile will cause this to fail
  179. # if we don't check for them as well.
  180. *)
  181. for z in $available_tags; do
  182. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  183. # Evaluate the configuration.
  184. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  185. CC_quoted=
  186. for arg in $CC; do
  187. # Double-quote args containing other shell metacharacters.
  188. case $arg in
  189. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  190. arg="\"$arg\""
  191. ;;
  192. esac
  193. CC_quoted="$CC_quoted $arg"
  194. done
  195. case "$@ " in
  196. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
  197. # The compiler in the base compile command matches
  198. # the one in the tagged configuration.
  199. # Assume this is the tagged configuration we want.
  200. tagname=$z
  201. break
  202. ;;
  203. esac
  204. fi
  205. done
  206. # If $tagname still isn't set, then no tagged configuration
  207. # was found and let the user know that the "--tag" command
  208. # line option must be used.
  209. if test -z "$tagname"; then
  210. $echo "$modename: unable to infer tagged configuration"
  211. $echo "$modename: specify a tag with \`--tag'" 1>&2
  212. exit $EXIT_FAILURE
  213. # else
  214. # $echo "$modename: using $tagname tagged configuration"
  215. fi
  216. ;;
  217. esac
  218. fi
  219. }
  220. # End of Shell function definitions
  221. #####################################
  222. # Darwin sucks
  223. eval std_shrext=\"$shrext_cmds\"
  224. # Parse our command line options once, thoroughly.
  225. while test "$#" -gt 0
  226. do
  227. arg="$1"
  228. shift
  229. case $arg in
  230. -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  231. *) optarg= ;;
  232. esac
  233. # If the previous option needs an argument, assign it.
  234. if test -n "$prev"; then
  235. case $prev in
  236. execute_dlfiles)
  237. execute_dlfiles="$execute_dlfiles $arg"
  238. ;;
  239. tag)
  240. tagname="$arg"
  241. preserve_args="${preserve_args}=$arg"
  242. # Check whether tagname contains only valid characters
  243. case $tagname in
  244. *[!-_A-Za-z0-9,/]*)
  245. $echo "$progname: invalid tag name: $tagname" 1>&2
  246. exit $EXIT_FAILURE
  247. ;;
  248. esac
  249. case $tagname in
  250. CC)
  251. # Don't test for the "default" C tag, as we know, it's there, but
  252. # not specially marked.
  253. ;;
  254. *)
  255. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
  256. taglist="$taglist $tagname"
  257. # Evaluate the configuration.
  258. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
  259. else
  260. $echo "$progname: ignoring unknown tag $tagname" 1>&2
  261. fi
  262. ;;
  263. esac
  264. ;;
  265. *)
  266. eval "$prev=\$arg"
  267. ;;
  268. esac
  269. prev=
  270. prevopt=
  271. continue
  272. fi
  273. # Have we seen a non-optional argument yet?
  274. case $arg in
  275. --help)
  276. show_help=yes
  277. ;;
  278. --version)
  279. $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  280. $echo
  281. $echo "Copyright (C) 2003 Free Software Foundation, Inc."
  282. $echo "This is free software; see the source for copying conditions. There is NO"
  283. $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  284. exit $EXIT_SUCCESS
  285. ;;
  286. --config)
  287. ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
  288. # Now print the configurations for the tags.
  289. for tagname in $taglist; do
  290. ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
  291. done
  292. exit $EXIT_SUCCESS
  293. ;;
  294. --debug)
  295. $echo "$progname: enabling shell trace mode"
  296. set -x
  297. preserve_args="$preserve_args $arg"
  298. ;;
  299. --dry-run | -n)
  300. run=:
  301. ;;
  302. --features)
  303. $echo "host: $host"
  304. if test "$build_libtool_libs" = yes; then
  305. $echo "enable shared libraries"
  306. else
  307. $echo "disable shared libraries"
  308. fi
  309. if test "$build_old_libs" = yes; then
  310. $echo "enable static libraries"
  311. else
  312. $echo "disable static libraries"
  313. fi
  314. exit $EXIT_SUCCESS
  315. ;;
  316. --finish) mode="finish" ;;
  317. --mode) prevopt="--mode" prev=mode ;;
  318. --mode=*) mode="$optarg" ;;
  319. --preserve-dup-deps) duplicate_deps="yes" ;;
  320. --quiet | --silent)
  321. show=:
  322. preserve_args="$preserve_args $arg"
  323. ;;
  324. --tag) prevopt="--tag" prev=tag ;;
  325. --tag=*)
  326. set tag "$optarg" ${1+"$@"}
  327. shift
  328. prev=tag
  329. preserve_args="$preserve_args --tag"
  330. ;;
  331. -dlopen)
  332. prevopt="-dlopen"
  333. prev=execute_dlfiles
  334. ;;
  335. -*)
  336. $echo "$modename: unrecognized option \`$arg'" 1>&2
  337. $echo "$help" 1>&2
  338. exit $EXIT_FAILURE
  339. ;;
  340. *)
  341. nonopt="$arg"
  342. break
  343. ;;
  344. esac
  345. done
  346. if test -n "$prevopt"; then
  347. $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  348. $echo "$help" 1>&2
  349. exit $EXIT_FAILURE
  350. fi
  351. # If this variable is set in any of the actions, the command in it
  352. # will be execed at the end. This prevents here-documents from being
  353. # left over by shells.
  354. exec_cmd=
  355. if test -z "$show_help"; then
  356. # Infer the operation mode.
  357. if test -z "$mode"; then
  358. $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
  359. $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
  360. case $nonopt in
  361. *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
  362. mode=link
  363. for arg
  364. do
  365. case $arg in
  366. -c)
  367. mode=compile
  368. break
  369. ;;
  370. esac
  371. done
  372. ;;
  373. *db | *dbx | *strace | *truss)
  374. mode=execute
  375. ;;
  376. *install*|cp|mv)
  377. mode=install
  378. ;;
  379. *rm)
  380. mode=uninstall
  381. ;;
  382. *)
  383. # If we have no mode, but dlfiles were specified, then do execute mode.
  384. test -n "$execute_dlfiles" && mode=execute
  385. # Just use the default operation mode.
  386. if test -z "$mode"; then
  387. if test -n "$nonopt"; then
  388. $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  389. else
  390. $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  391. fi
  392. fi
  393. ;;
  394. esac
  395. fi
  396. # Only execute mode is allowed to have -dlopen flags.
  397. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  398. $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  399. $echo "$help" 1>&2
  400. exit $EXIT_FAILURE
  401. fi
  402. # Change the help message to a mode-specific one.
  403. generic_help="$help"
  404. help="Try \`$modename --help --mode=$mode' for more information."
  405. # These modes are in order of execution frequency so that they run quickly.
  406. case $mode in
  407. # libtool compile mode
  408. compile)
  409. modename="$modename: compile"
  410. # Get the compilation command and the source file.
  411. base_compile=
  412. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  413. suppress_opt=yes
  414. suppress_output=
  415. arg_mode=normal
  416. libobj=
  417. later=
  418. for arg
  419. do
  420. case "$arg_mode" in
  421. arg )
  422. # do not "continue". Instead, add this to base_compile
  423. lastarg="$arg"
  424. arg_mode=normal
  425. ;;
  426. target )
  427. libobj="$arg"
  428. arg_mode=normal
  429. continue
  430. ;;
  431. normal )
  432. # Accept any command-line options.
  433. case $arg in
  434. -o)
  435. if test -n "$libobj" ; then
  436. $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  437. exit $EXIT_FAILURE
  438. fi
  439. arg_mode=target
  440. continue
  441. ;;
  442. -static | -prefer-pic | -prefer-non-pic)
  443. later="$later $arg"
  444. continue
  445. ;;
  446. -no-suppress)
  447. suppress_opt=no
  448. continue
  449. ;;
  450. -Xcompiler)
  451. arg_mode=arg # the next one goes into the "base_compile" arg list
  452. continue # The current "srcfile" will either be retained or
  453. ;; # replaced later. I would guess that would be a bug.
  454. -Wc,*)
  455. args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
  456. lastarg=
  457. save_ifs="$IFS"; IFS=','
  458. for arg in $args; do
  459. IFS="$save_ifs"
  460. # Double-quote args containing other shell metacharacters.
  461. # Many Bourne shells cannot handle close brackets correctly
  462. # in scan sets, so we specify it separately.
  463. case $arg in
  464. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  465. arg="\"$arg\""
  466. ;;
  467. esac
  468. lastarg="$lastarg $arg"
  469. done
  470. IFS="$save_ifs"
  471. lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
  472. # Add the arguments to base_compile.
  473. base_compile="$base_compile $lastarg"
  474. continue
  475. ;;
  476. * )
  477. # Accept the current argument as the source file.
  478. # The previous "srcfile" becomes the current argument.
  479. #
  480. lastarg="$srcfile"
  481. srcfile="$arg"
  482. ;;
  483. esac # case $arg
  484. ;;
  485. esac # case $arg_mode
  486. # Aesthetically quote the previous argument.
  487. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  488. case $lastarg in
  489. # Double-quote args containing other shell metacharacters.
  490. # Many Bourne shells cannot handle close brackets correctly
  491. # in scan sets, so we specify it separately.
  492. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  493. lastarg="\"$lastarg\""
  494. ;;
  495. esac
  496. base_compile="$base_compile $lastarg"
  497. done # for arg
  498. case $arg_mode in
  499. arg)
  500. $echo "$modename: you must specify an argument for -Xcompile"
  501. exit $EXIT_FAILURE
  502. ;;
  503. target)
  504. $echo "$modename: you must specify a target with \`-o'" 1>&2
  505. exit $EXIT_FAILURE
  506. ;;
  507. *)
  508. # Get the name of the library object.
  509. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  510. ;;
  511. esac
  512. # Recognize several different file suffixes.
  513. # If the user specifies -o file.o, it is replaced with file.lo
  514. xform='[cCFSifmso]'
  515. case $libobj in
  516. *.ada) xform=ada ;;
  517. *.adb) xform=adb ;;
  518. *.ads) xform=ads ;;
  519. *.asm) xform=asm ;;
  520. *.c++) xform=c++ ;;
  521. *.cc) xform=cc ;;
  522. *.ii) xform=ii ;;
  523. *.class) xform=class ;;
  524. *.cpp) xform=cpp ;;
  525. *.cxx) xform=cxx ;;
  526. *.f90) xform=f90 ;;
  527. *.for) xform=for ;;
  528. *.java) xform=java ;;
  529. esac
  530. libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  531. case $libobj in
  532. *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  533. *)
  534. $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  535. exit $EXIT_FAILURE
  536. ;;
  537. esac
  538. func_infer_tag $base_compile
  539. for arg in $later; do
  540. case $arg in
  541. -static)
  542. build_old_libs=yes
  543. continue
  544. ;;
  545. -prefer-pic)
  546. pic_mode=yes
  547. continue
  548. ;;
  549. -prefer-non-pic)
  550. pic_mode=no
  551. continue
  552. ;;
  553. esac
  554. done
  555. objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  556. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  557. if test "X$xdir" = "X$obj"; then
  558. xdir=
  559. else
  560. xdir=$xdir/
  561. fi
  562. lobj=${xdir}$objdir/$objname
  563. if test -z "$base_compile"; then
  564. $echo "$modename: you must specify a compilation command" 1>&2
  565. $echo "$help" 1>&2
  566. exit $EXIT_FAILURE
  567. fi
  568. # Delete any leftover library objects.
  569. if test "$build_old_libs" = yes; then
  570. removelist="$obj $lobj $libobj ${libobj}T"
  571. else
  572. removelist="$lobj $libobj ${libobj}T"
  573. fi
  574. $run $rm $removelist
  575. trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  576. # On Cygwin there's no "real" PIC flag so we must build both object types
  577. case $host_os in
  578. cygwin* | mingw* | pw32* | os2*)
  579. pic_mode=default
  580. ;;
  581. esac
  582. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  583. # non-PIC code in shared libraries is not supported
  584. pic_mode=default
  585. fi
  586. # Calculate the filename of the output object if compiler does
  587. # not support -o with -c
  588. if test "$compiler_c_o" = no; then
  589. output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  590. lockfile="$output_obj.lock"
  591. removelist="$removelist $output_obj $lockfile"
  592. trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  593. else
  594. output_obj=
  595. need_locks=no
  596. lockfile=
  597. fi
  598. # Lock this critical section if it is needed
  599. # We use this script file to make the link, it avoids creating a new file
  600. if test "$need_locks" = yes; then
  601. until $run ln "$progpath" "$lockfile" 2>/dev/null; do
  602. $show "Waiting for $lockfile to be removed"
  603. sleep 2
  604. done
  605. elif test "$need_locks" = warn; then
  606. if test -f "$lockfile"; then
  607. $echo "\
  608. *** ERROR, $lockfile exists and contains:
  609. `cat $lockfile 2>/dev/null`
  610. This indicates that another process is trying to use the same
  611. temporary object file, and libtool could not work around it because
  612. your compiler does not support \`-c' and \`-o' together. If you
  613. repeat this compilation, it may succeed, by chance, but you had better
  614. avoid parallel builds (make -j) in this platform, or get a better
  615. compiler."
  616. $run $rm $removelist
  617. exit $EXIT_FAILURE
  618. fi
  619. $echo $srcfile > "$lockfile"
  620. fi
  621. if test -n "$fix_srcfile_path"; then
  622. eval srcfile=\"$fix_srcfile_path\"
  623. fi
  624. $run $rm "$libobj" "${libobj}T"
  625. # Create a libtool object file (analogous to a ".la" file),
  626. # but don't create it if we're doing a dry run.
  627. test -z "$run" && cat > ${libobj}T <<EOF
  628. # $libobj - a libtool object file
  629. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  630. #
  631. # Please DO NOT delete this file!
  632. # It is necessary for linking the library.
  633. # Name of the PIC object.
  634. EOF
  635. # Only build a PIC object if we are building libtool libraries.
  636. if test "$build_libtool_libs" = yes; then
  637. # Without this assignment, base_compile gets emptied.
  638. fbsd_hideous_sh_bug=$base_compile
  639. if test "$pic_mode" != no; then
  640. command="$base_compile $srcfile $pic_flag"
  641. else
  642. # Don't build PIC code
  643. command="$base_compile $srcfile"
  644. fi
  645. if test ! -d "${xdir}$objdir"; then
  646. $show "$mkdir ${xdir}$objdir"
  647. $run $mkdir ${xdir}$objdir
  648. status=$?
  649. if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
  650. exit $status
  651. fi
  652. fi
  653. if test -z "$output_obj"; then
  654. # Place PIC objects in $objdir
  655. command="$command -o $lobj"
  656. fi
  657. $run $rm "$lobj" "$output_obj"
  658. $show "$command"
  659. if $run eval "$command"; then :
  660. else
  661. test -n "$output_obj" && $run $rm $removelist
  662. exit $EXIT_FAILURE
  663. fi
  664. if test "$need_locks" = warn &&
  665. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  666. $echo "\
  667. *** ERROR, $lockfile contains:
  668. `cat $lockfile 2>/dev/null`
  669. but it should contain:
  670. $srcfile
  671. This indicates that another process is trying to use the same
  672. temporary object file, and libtool could not work around it because
  673. your compiler does not support \`-c' and \`-o' together. If you
  674. repeat this compilation, it may succeed, by chance, but you had better
  675. avoid parallel builds (make -j) in this platform, or get a better
  676. compiler."
  677. $run $rm $removelist
  678. exit $EXIT_FAILURE
  679. fi
  680. # Just move the object if needed, then go on to compile the next one
  681. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  682. $show "$mv $output_obj $lobj"
  683. if $run $mv $output_obj $lobj; then :
  684. else
  685. error=$?
  686. $run $rm $removelist
  687. exit $error
  688. fi
  689. fi
  690. # Append the name of the PIC object to the libtool object file.
  691. test -z "$run" && cat >> ${libobj}T <<EOF
  692. pic_object='$objdir/$objname'
  693. EOF
  694. # Allow error messages only from the first compilation.
  695. if test "$suppress_opt" = yes; then
  696. suppress_output=' >/dev/null 2>&1'
  697. fi
  698. else
  699. # No PIC object so indicate it doesn't exist in the libtool
  700. # object file.
  701. test -z "$run" && cat >> ${libobj}T <<EOF
  702. pic_object=none
  703. EOF
  704. fi
  705. # Only build a position-dependent object if we build old libraries.
  706. if test "$build_old_libs" = yes; then
  707. if test "$pic_mode" != yes; then
  708. # Don't build PIC code
  709. command="$base_compile $srcfile"
  710. else
  711. command="$base_compile $srcfile $pic_flag"
  712. fi
  713. if test "$compiler_c_o" = yes; then
  714. command="$command -o $obj"
  715. fi
  716. # Suppress compiler output if we already did a PIC compilation.
  717. command="$command$suppress_output"
  718. $run $rm "$obj" "$output_obj"
  719. $show "$command"
  720. if $run eval "$command"; then :
  721. else
  722. $run $rm $removelist
  723. exit $EXIT_FAILURE
  724. fi
  725. if test "$need_locks" = warn &&
  726. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  727. $echo "\
  728. *** ERROR, $lockfile contains:
  729. `cat $lockfile 2>/dev/null`
  730. but it should contain:
  731. $srcfile
  732. This indicates that another process is trying to use the same
  733. temporary object file, and libtool could not work around it because
  734. your compiler does not support \`-c' and \`-o' together. If you
  735. repeat this compilation, it may succeed, by chance, but you had better
  736. avoid parallel builds (make -j) in this platform, or get a better
  737. compiler."
  738. $run $rm $removelist
  739. exit $EXIT_FAILURE
  740. fi
  741. # Just move the object if needed
  742. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  743. $show "$mv $output_obj $obj"
  744. if $run $mv $output_obj $obj; then :
  745. else
  746. error=$?
  747. $run $rm $removelist
  748. exit $error
  749. fi
  750. fi
  751. # Append the name of the non-PIC object the libtool object file.
  752. # Only append if the libtool object file exists.
  753. test -z "$run" && cat >> ${libobj}T <<EOF
  754. # Name of the non-PIC object.
  755. non_pic_object='$objname'
  756. EOF
  757. else
  758. # Append the name of the non-PIC object the libtool object file.
  759. # Only append if the libtool object file exists.
  760. test -z "$run" && cat >> ${libobj}T <<EOF
  761. # Name of the non-PIC object.
  762. non_pic_object=none
  763. EOF
  764. fi
  765. $run $mv "${libobj}T" "${libobj}"
  766. # Unlock the critical section if it was locked
  767. if test "$need_locks" != no; then
  768. $run $rm "$lockfile"
  769. fi
  770. exit $EXIT_SUCCESS
  771. ;;
  772. # libtool link mode
  773. link | relink)
  774. modename="$modename: link"
  775. case $host in
  776. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  777. # It is impossible to link a dll without this setting, and
  778. # we shouldn't force the makefile maintainer to figure out
  779. # which system we are compiling for in order to pass an extra
  780. # flag for every libtool invocation.
  781. # allow_undefined=no
  782. # FIXME: Unfortunately, there are problems with the above when trying
  783. # to make a dll which has undefined symbols, in which case not
  784. # even a static library is built. For now, we need to specify
  785. # -no-undefined on the libtool link line when we can be certain
  786. # that all symbols are satisfied, otherwise we get a static library.
  787. allow_undefined=yes
  788. ;;
  789. *)
  790. allow_undefined=yes
  791. ;;
  792. esac
  793. libtool_args="$nonopt"
  794. base_compile="$nonopt $@"
  795. compile_command="$nonopt"
  796. finalize_command="$nonopt"
  797. compile_rpath=
  798. finalize_rpath=
  799. compile_shlibpath=
  800. finalize_shlibpath=
  801. convenience=
  802. old_convenience=
  803. deplibs=
  804. old_deplibs=
  805. compiler_flags=
  806. linker_flags=
  807. dllsearchpath=
  808. lib_search_path=`pwd`
  809. inst_prefix_dir=
  810. avoid_version=no
  811. dlfiles=
  812. dlprefiles=
  813. dlself=no
  814. export_dynamic=no
  815. export_symbols=
  816. export_symbols_regex=
  817. generated=
  818. libobjs=
  819. ltlibs=
  820. module=no
  821. no_install=no
  822. objs=
  823. non_pic_objects=
  824. precious_files_regex=
  825. prefer_static_libs=no
  826. preload=no
  827. prev=
  828. prevarg=
  829. release=
  830. rpath=
  831. xrpath=
  832. perm_rpath=
  833. temp_rpath=
  834. thread_safe=no
  835. vinfo=
  836. vinfo_number=no
  837. func_infer_tag $base_compile
  838. # We need to know -static, to get the right output filenames.
  839. for arg
  840. do
  841. case $arg in
  842. -all-static | -static)
  843. if test "X$arg" = "X-all-static"; then
  844. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  845. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  846. fi
  847. if test -n "$link_static_flag"; then
  848. dlopen_self=$dlopen_self_static
  849. fi
  850. else
  851. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  852. dlopen_self=$dlopen_self_static
  853. fi
  854. fi
  855. build_libtool_libs=no
  856. build_old_libs=yes
  857. prefer_static_libs=yes
  858. break
  859. ;;
  860. esac
  861. done
  862. # See if our shared archives depend on static archives.
  863. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  864. # Go through the arguments, transforming them on the way.
  865. while test "$#" -gt 0; do
  866. arg="$1"
  867. shift
  868. case $arg in
  869. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  870. qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  871. ;;
  872. *) qarg=$arg ;;
  873. esac
  874. libtool_args="$libtool_args $qarg"
  875. # If the previous option needs an argument, assign it.
  876. if test -n "$prev"; then
  877. case $prev in
  878. output)
  879. compile_command="$compile_command @OUTPUT@"
  880. finalize_command="$finalize_command @OUTPUT@"
  881. ;;
  882. esac
  883. case $prev in
  884. dlfiles|dlprefiles)
  885. if test "$preload" = no; then
  886. # Add the symbol object into the linking commands.
  887. compile_command="$compile_command @SYMFILE@"
  888. finalize_command="$finalize_command @SYMFILE@"
  889. preload=yes
  890. fi
  891. case $arg in
  892. *.la | *.lo) ;; # We handle these cases below.
  893. force)
  894. if test "$dlself" = no; then
  895. dlself=needless
  896. export_dynamic=yes
  897. fi
  898. prev=
  899. continue
  900. ;;
  901. self)
  902. if test "$prev" = dlprefiles; then
  903. dlself=yes
  904. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  905. dlself=yes
  906. else
  907. dlself=needless
  908. export_dynamic=yes
  909. fi
  910. prev=
  911. continue
  912. ;;
  913. *)
  914. if test "$prev" = dlfiles; then
  915. dlfiles="$dlfiles $arg"
  916. else
  917. dlprefiles="$dlprefiles $arg"
  918. fi
  919. prev=
  920. continue
  921. ;;
  922. esac
  923. ;;
  924. expsyms)
  925. export_symbols="$arg"
  926. if test ! -f "$arg"; then
  927. $echo "$modename: symbol file \`$arg' does not exist"
  928. exit $EXIT_FAILURE
  929. fi
  930. prev=
  931. continue
  932. ;;
  933. expsyms_regex)
  934. export_symbols_regex="$arg"
  935. prev=
  936. continue
  937. ;;
  938. inst_prefix)
  939. inst_prefix_dir="$arg"
  940. prev=
  941. continue
  942. ;;
  943. precious_regex)
  944. precious_files_regex="$arg"
  945. prev=
  946. continue
  947. ;;
  948. release)
  949. release="-$arg"
  950. prev=
  951. continue
  952. ;;
  953. objectlist)
  954. if test -f "$arg"; then
  955. save_arg=$arg
  956. moreargs=
  957. for fil in `cat $save_arg`
  958. do
  959. # moreargs="$moreargs $fil"
  960. arg=$fil
  961. # A libtool-controlled object.
  962. # Check to see that this really is a libtool object.
  963. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  964. pic_object=
  965. non_pic_object=
  966. # Read the .lo file
  967. # If there is no directory component, then add one.
  968. case $arg in
  969. */* | *\\*) . $arg ;;
  970. *) . ./$arg ;;
  971. esac
  972. if test -z "$pic_object" || \
  973. test -z "$non_pic_object" ||
  974. test "$pic_object" = none && \
  975. test "$non_pic_object" = none; then
  976. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  977. exit $EXIT_FAILURE
  978. fi
  979. # Extract subdirectory from the argument.
  980. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  981. if test "X$xdir" = "X$arg"; then
  982. xdir=
  983. else
  984. xdir="$xdir/"
  985. fi
  986. if test "$pic_object" != none; then
  987. # Prepend the subdirectory the object is found in.
  988. pic_object="$xdir$pic_object"
  989. if test "$prev" = dlfiles; then
  990. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  991. dlfiles="$dlfiles $pic_object"
  992. prev=
  993. continue
  994. else
  995. # If libtool objects are unsupported, then we need to preload.
  996. prev=dlprefiles
  997. fi
  998. fi
  999. # CHECK ME: I think I busted this. -Ossama
  1000. if test "$prev" = dlprefiles; then
  1001. # Preload the old-style object.
  1002. dlprefiles="$dlprefiles $pic_object"
  1003. prev=
  1004. fi
  1005. # A PIC object.
  1006. libobjs="$libobjs $pic_object"
  1007. arg="$pic_object"
  1008. fi
  1009. # Non-PIC object.
  1010. if test "$non_pic_object" != none; then
  1011. # Prepend the subdirectory the object is found in.
  1012. non_pic_object="$xdir$non_pic_object"
  1013. # A standard non-PIC object
  1014. non_pic_objects="$non_pic_objects $non_pic_object"
  1015. if test -z "$pic_object" || test "$pic_object" = none ; then
  1016. arg="$non_pic_object"
  1017. fi
  1018. fi
  1019. else
  1020. # Only an error if not doing a dry-run.
  1021. if test -z "$run"; then
  1022. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1023. exit $EXIT_FAILURE
  1024. else
  1025. # Dry-run case.
  1026. # Extract subdirectory from the argument.
  1027. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1028. if test "X$xdir" = "X$arg"; then
  1029. xdir=
  1030. else
  1031. xdir="$xdir/"
  1032. fi
  1033. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1034. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1035. libobjs="$libobjs $pic_object"
  1036. non_pic_objects="$non_pic_objects $non_pic_object"
  1037. fi
  1038. fi
  1039. done
  1040. else
  1041. $echo "$modename: link input file \`$save_arg' does not exist"
  1042. exit $EXIT_FAILURE
  1043. fi
  1044. arg=$save_arg
  1045. prev=
  1046. continue
  1047. ;;
  1048. rpath | xrpath)
  1049. # We need an absolute path.
  1050. case $arg in
  1051. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1052. *)
  1053. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1054. exit $EXIT_FAILURE
  1055. ;;
  1056. esac
  1057. if test "$prev" = rpath; then
  1058. case "$rpath " in
  1059. *" $arg "*) ;;
  1060. *) rpath="$rpath $arg" ;;
  1061. esac
  1062. else
  1063. case "$xrpath " in
  1064. *" $arg "*) ;;
  1065. *) xrpath="$xrpath $arg" ;;
  1066. esac
  1067. fi
  1068. prev=
  1069. continue
  1070. ;;
  1071. xcompiler)
  1072. compiler_flags="$compiler_flags $qarg"
  1073. prev=
  1074. compile_command="$compile_command $qarg"
  1075. finalize_command="$finalize_command $qarg"
  1076. continue
  1077. ;;
  1078. xlinker)
  1079. linker_flags="$linker_flags $qarg"
  1080. compiler_flags="$compiler_flags $wl$qarg"
  1081. prev=
  1082. compile_command="$compile_command $wl$qarg"
  1083. finalize_command="$finalize_command $wl$qarg"
  1084. continue
  1085. ;;
  1086. xcclinker)
  1087. linker_flags="$linker_flags $qarg"
  1088. compiler_flags="$compiler_flags $qarg"
  1089. prev=
  1090. compile_command="$compile_command $qarg"
  1091. finalize_command="$finalize_command $qarg"
  1092. continue
  1093. ;;
  1094. shrext)
  1095. shrext_cmds="$arg"
  1096. prev=
  1097. continue
  1098. ;;
  1099. *)
  1100. eval "$prev=\"\$arg\""
  1101. prev=
  1102. continue
  1103. ;;
  1104. esac
  1105. fi # test -n "$prev"
  1106. prevarg="$arg"
  1107. case $arg in
  1108. -all-static)
  1109. if test -n "$link_static_flag"; then
  1110. compile_command="$compile_command $link_static_flag"
  1111. finalize_command="$finalize_command $link_static_flag"
  1112. fi
  1113. continue
  1114. ;;
  1115. -allow-undefined)
  1116. # FIXME: remove this flag sometime in the future.
  1117. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1118. continue
  1119. ;;
  1120. -avoid-version)
  1121. avoid_version=yes
  1122. continue
  1123. ;;
  1124. -dlopen)
  1125. prev=dlfiles
  1126. continue
  1127. ;;
  1128. -dlpreopen)
  1129. prev=dlprefiles
  1130. continue
  1131. ;;
  1132. -export-dynamic)
  1133. export_dynamic=yes
  1134. continue
  1135. ;;
  1136. -export-symbols | -export-symbols-regex)
  1137. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1138. $echo "$modename: more than one -exported-symbols argument is not allowed"
  1139. exit $EXIT_FAILURE
  1140. fi
  1141. if test "X$arg" = "X-export-symbols"; then
  1142. prev=expsyms
  1143. else
  1144. prev=expsyms_regex
  1145. fi
  1146. continue
  1147. ;;
  1148. -inst-prefix-dir)
  1149. prev=inst_prefix
  1150. continue
  1151. ;;
  1152. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1153. # so, if we see these flags be careful not to treat them like -L
  1154. -L[A-Z][A-Z]*:*)
  1155. case $with_gcc/$host in
  1156. no/*-*-irix* | /*-*-irix*)
  1157. compile_command="$compile_command $arg"
  1158. finalize_command="$finalize_command $arg"
  1159. ;;
  1160. esac
  1161. continue
  1162. ;;
  1163. -L*)
  1164. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1165. # We need an absolute path.
  1166. case $dir in
  1167. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1168. *)
  1169. absdir=`cd "$dir" && pwd`
  1170. if test -z "$absdir"; then
  1171. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1172. exit $EXIT_FAILURE
  1173. fi
  1174. dir="$absdir"
  1175. ;;
  1176. esac
  1177. case "$deplibs " in
  1178. *" -L$dir "*) ;;
  1179. *)
  1180. deplibs="$deplibs -L$dir"
  1181. lib_search_path="$lib_search_path $dir"
  1182. ;;
  1183. esac
  1184. case $host in
  1185. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1186. case :$dllsearchpath: in
  1187. *":$dir:"*) ;;
  1188. *) dllsearchpath="$dllsearchpath:$dir";;
  1189. esac
  1190. ;;
  1191. esac
  1192. continue
  1193. ;;
  1194. -l*)
  1195. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1196. case $host in
  1197. *-*-cygwin* | *-*-pw32* | *-*-beos*)
  1198. # These systems don't actually have a C or math library (as such)
  1199. continue
  1200. ;;
  1201. *-*-mingw* | *-*-os2*)
  1202. # These systems don't actually have a C library (as such)
  1203. test "X$arg" = "X-lc" && continue
  1204. ;;
  1205. *-*-openbsd* | *-*-freebsd*)
  1206. # Do not include libc due to us having libc/libc_r.
  1207. test "X$arg" = "X-lc" && continue
  1208. ;;
  1209. *-*-rhapsody* | *-*-darwin1.[012])
  1210. # Rhapsody C and math libraries are in the System framework
  1211. deplibs="$deplibs -framework System"
  1212. continue
  1213. esac
  1214. elif test "X$arg" = "X-lc_r"; then
  1215. case $host in
  1216. *-*-openbsd* | *-*-freebsd*)
  1217. # Do not include libc_r directly, use -pthread flag.
  1218. continue
  1219. ;;
  1220. esac
  1221. fi
  1222. deplibs="$deplibs $arg"
  1223. continue
  1224. ;;
  1225. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1226. deplibs="$deplibs $arg"
  1227. continue
  1228. ;;
  1229. -module)
  1230. module=yes
  1231. continue
  1232. ;;
  1233. # gcc -m* arguments should be passed to the linker via $compiler_flags
  1234. # in order to pass architecture information to the linker
  1235. # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
  1236. # but this is not reliable with gcc because gcc may use -mfoo to
  1237. # select a different linker, different libraries, etc, while
  1238. # -Wl,-mfoo simply passes -mfoo to the linker.
  1239. -m*)
  1240. # Unknown arguments in both finalize_command and compile_command need
  1241. # to be aesthetically quoted because they are evaled later.
  1242. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1243. case $arg in
  1244. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1245. arg="\"$arg\""
  1246. ;;
  1247. esac
  1248. compile_command="$compile_command $arg"
  1249. finalize_command="$finalize_command $arg"
  1250. if test "$with_gcc" = "yes" ; then
  1251. compiler_flags="$compiler_flags $arg"
  1252. fi
  1253. continue
  1254. ;;
  1255. -shrext)
  1256. prev=shrext
  1257. continue
  1258. ;;
  1259. -no-fast-install)
  1260. fast_install=no
  1261. continue
  1262. ;;
  1263. -no-install)
  1264. case $host in
  1265. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1266. # The PATH hackery in wrapper scripts is required on Windows
  1267. # in order for the loader to find any dlls it needs.
  1268. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1269. $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1270. fast_install=no
  1271. ;;
  1272. *) no_install=yes ;;
  1273. esac
  1274. continue
  1275. ;;
  1276. -no-undefined)
  1277. allow_undefined=no
  1278. continue
  1279. ;;
  1280. -objectlist)
  1281. prev=objectlist
  1282. continue
  1283. ;;
  1284. -o) prev=output ;;
  1285. -precious-files-regex)
  1286. prev=precious_regex
  1287. continue
  1288. ;;
  1289. -release)
  1290. prev=release
  1291. continue
  1292. ;;
  1293. -rpath)
  1294. prev=rpath
  1295. continue
  1296. ;;
  1297. -R)
  1298. prev=xrpath
  1299. continue
  1300. ;;
  1301. -R*)
  1302. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1303. # We need an absolute path.
  1304. case $dir in
  1305. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1306. *)
  1307. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1308. exit $EXIT_FAILURE
  1309. ;;
  1310. esac
  1311. case "$xrpath " in
  1312. *" $dir "*) ;;
  1313. *) xrpath="$xrpath $dir" ;;
  1314. esac
  1315. continue
  1316. ;;
  1317. -static)
  1318. # The effects of -static are defined in a previous loop.
  1319. # We used to do the same as -all-static on platforms that
  1320. # didn't have a PIC flag, but the assumption that the effects
  1321. # would be equivalent was wrong. It would break on at least
  1322. # Digital Unix and AIX.
  1323. continue
  1324. ;;
  1325. -thread-safe)
  1326. thread_safe=yes
  1327. continue
  1328. ;;
  1329. -version-info)
  1330. prev=vinfo
  1331. continue
  1332. ;;
  1333. -version-number)
  1334. prev=vinfo
  1335. vinfo_number=yes
  1336. continue
  1337. ;;
  1338. -Wc,*)
  1339. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1340. arg=
  1341. save_ifs="$IFS"; IFS=','
  1342. for flag in $args; do
  1343. IFS="$save_ifs"
  1344. case $flag in
  1345. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1346. flag="\"$flag\""
  1347. ;;
  1348. esac
  1349. arg="$arg $wl$flag"
  1350. compiler_flags="$compiler_flags $flag"
  1351. done
  1352. IFS="$save_ifs"
  1353. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1354. ;;
  1355. -Wl,*)
  1356. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1357. arg=
  1358. save_ifs="$IFS"; IFS=','
  1359. for flag in $args; do
  1360. IFS="$save_ifs"
  1361. case $flag in
  1362. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1363. flag="\"$flag\""
  1364. ;;
  1365. esac
  1366. arg="$arg $wl$flag"
  1367. compiler_flags="$compiler_flags $wl$flag"
  1368. linker_flags="$linker_flags $flag"
  1369. done
  1370. IFS="$save_ifs"
  1371. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1372. ;;
  1373. -Xcompiler)
  1374. prev=xcompiler
  1375. continue
  1376. ;;
  1377. -Xlinker)
  1378. prev=xlinker
  1379. continue
  1380. ;;
  1381. -XCClinker)
  1382. prev=xcclinker
  1383. continue
  1384. ;;
  1385. # Some other compiler flag.
  1386. -* | +*)
  1387. # Unknown arguments in both finalize_command and compile_command need
  1388. # to be aesthetically quoted because they are evaled later.
  1389. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1390. case $arg in
  1391. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1392. arg="\"$arg\""
  1393. ;;
  1394. esac
  1395. ;;
  1396. *.$objext)
  1397. # A standard object.
  1398. objs="$objs $arg"
  1399. ;;
  1400. *.lo)
  1401. # A libtool-controlled object.
  1402. # Check to see that this really is a libtool object.
  1403. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1404. pic_object=
  1405. non_pic_object=
  1406. # Read the .lo file
  1407. # If there is no directory component, then add one.
  1408. case $arg in
  1409. */* | *\\*) . $arg ;;
  1410. *) . ./$arg ;;
  1411. esac
  1412. if test -z "$pic_object" || \
  1413. test -z "$non_pic_object" ||
  1414. test "$pic_object" = none && \
  1415. test "$non_pic_object" = none; then
  1416. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1417. exit $EXIT_FAILURE
  1418. fi
  1419. # Extract subdirectory from the argument.
  1420. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1421. if test "X$xdir" = "X$arg"; then
  1422. xdir=
  1423. else
  1424. xdir="$xdir/"
  1425. fi
  1426. if test "$pic_object" != none; then
  1427. # Prepend the subdirectory the object is found in.
  1428. pic_object="$xdir$pic_object"
  1429. if test "$prev" = dlfiles; then
  1430. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1431. dlfiles="$dlfiles $pic_object"
  1432. prev=
  1433. continue
  1434. else
  1435. # If libtool objects are unsupported, then we need to preload.
  1436. prev=dlprefiles
  1437. fi
  1438. fi
  1439. # CHECK ME: I think I busted this. -Ossama
  1440. if test "$prev" = dlprefiles; then
  1441. # Preload the old-style object.
  1442. dlprefiles="$dlprefiles $pic_object"
  1443. prev=
  1444. fi
  1445. # A PIC object.
  1446. libobjs="$libobjs $pic_object"
  1447. arg="$pic_object"
  1448. fi
  1449. # Non-PIC object.
  1450. if test "$non_pic_object" != none; then
  1451. # Prepend the subdirectory the object is found in.
  1452. non_pic_object="$xdir$non_pic_object"
  1453. # A standard non-PIC object
  1454. non_pic_objects="$non_pic_objects $non_pic_object"
  1455. if test -z "$pic_object" || test "$pic_object" = none ; then
  1456. arg="$non_pic_object"
  1457. fi
  1458. fi
  1459. else
  1460. # Only an error if not doing a dry-run.
  1461. if test -z "$run"; then
  1462. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1463. exit $EXIT_FAILURE
  1464. else
  1465. # Dry-run case.
  1466. # Extract subdirectory from the argument.
  1467. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1468. if test "X$xdir" = "X$arg"; then
  1469. xdir=
  1470. else
  1471. xdir="$xdir/"
  1472. fi
  1473. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1474. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1475. libobjs="$libobjs $pic_object"
  1476. non_pic_objects="$non_pic_objects $non_pic_object"
  1477. fi
  1478. fi
  1479. ;;
  1480. *.$libext)
  1481. # An archive.
  1482. deplibs="$deplibs $arg"
  1483. old_deplibs="$old_deplibs $arg"
  1484. continue
  1485. ;;
  1486. *.la)
  1487. # A libtool-controlled library.
  1488. if test "$prev" = dlfiles; then
  1489. # This library was specified with -dlopen.
  1490. dlfiles="$dlfiles $arg"
  1491. prev=
  1492. elif test "$prev" = dlprefiles; then
  1493. # The library was specified with -dlpreopen.
  1494. dlprefiles="$dlprefiles $arg"
  1495. prev=
  1496. else
  1497. deplibs="$deplibs $arg"
  1498. fi
  1499. continue
  1500. ;;
  1501. # Some other compiler argument.
  1502. *)
  1503. # Unknown arguments in both finalize_command and compile_command need
  1504. # to be aesthetically quoted because they are evaled later.
  1505. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1506. case $arg in
  1507. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1508. arg="\"$arg\""
  1509. ;;
  1510. esac
  1511. ;;
  1512. esac # arg
  1513. # Now actually substitute the argument into the commands.
  1514. if test -n "$arg"; then
  1515. compile_command="$compile_command $arg"
  1516. finalize_command="$finalize_command $arg"
  1517. fi
  1518. done # argument parsing loop
  1519. if test -n "$prev"; then
  1520. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1521. $echo "$help" 1>&2
  1522. exit $EXIT_FAILURE
  1523. fi
  1524. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1525. eval arg=\"$export_dynamic_flag_spec\"
  1526. compile_command="$compile_command $arg"
  1527. finalize_command="$finalize_command $arg"
  1528. fi
  1529. oldlibs=
  1530. # calculate the name of the file, without its directory
  1531. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1532. libobjs_save="$libobjs"
  1533. if test -n "$shlibpath_var"; then
  1534. # get the directories listed in $shlibpath_var
  1535. eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1536. else
  1537. shlib_search_path=
  1538. fi
  1539. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1540. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1541. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1542. if test "X$output_objdir" = "X$output"; then
  1543. output_objdir="$objdir"
  1544. else
  1545. output_objdir="$output_objdir/$objdir"
  1546. fi
  1547. # Create the object directory.
  1548. if test ! -d "$output_objdir"; then
  1549. $show "$mkdir $output_objdir"
  1550. $run $mkdir $output_objdir
  1551. status=$?
  1552. if test "$status" -ne 0 && test ! -d "$output_objdir"; then
  1553. exit $status
  1554. fi
  1555. fi
  1556. # Determine the type of output
  1557. case $output in
  1558. "")
  1559. $echo "$modename: you must specify an output file" 1>&2
  1560. $echo "$help" 1>&2
  1561. exit $EXIT_FAILURE
  1562. ;;
  1563. *.$libext) linkmode=oldlib ;;
  1564. *.lo | *.$objext) linkmode=obj ;;
  1565. *.la) linkmode=lib ;;
  1566. *) linkmode=prog ;; # Anything else should be a program.
  1567. esac
  1568. case $host in
  1569. *cygwin* | *mingw* | *pw32*)
  1570. # don't eliminate duplications in $postdeps and $predeps
  1571. duplicate_compiler_generated_deps=yes
  1572. ;;
  1573. *)
  1574. duplicate_compiler_generated_deps=$duplicate_deps
  1575. ;;
  1576. esac
  1577. specialdeplibs=
  1578. libs=
  1579. # Find all interdependent deplibs by searching for libraries
  1580. # that are linked more than once (e.g. -la -lb -la)
  1581. for deplib in $deplibs; do
  1582. if test "X$duplicate_deps" = "Xyes" ; then
  1583. case "$libs " in
  1584. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1585. esac
  1586. fi
  1587. libs="$libs $deplib"
  1588. done
  1589. if test "$linkmode" = lib; then
  1590. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1591. # Compute libraries that are listed more than once in $predeps
  1592. # $postdeps and mark them as special (i.e., whose duplicates are
  1593. # not to be eliminated).
  1594. pre_post_deps=
  1595. if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1596. for pre_post_dep in $predeps $postdeps; do
  1597. case "$pre_post_deps " in
  1598. *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1599. esac
  1600. pre_post_deps="$pre_post_deps $pre_post_dep"
  1601. done
  1602. fi
  1603. pre_post_deps=
  1604. fi
  1605. deplibs=
  1606. newdependency_libs=
  1607. newlib_search_path=
  1608. need_relink=no # whether we're linking any uninstalled libtool libraries
  1609. notinst_deplibs= # not-installed libtool libraries
  1610. notinst_path= # paths that contain not-installed libtool libraries
  1611. case $linkmode in
  1612. lib)
  1613. passes="conv link"
  1614. for file in $dlfiles $dlprefiles; do
  1615. case $file in
  1616. *.la) ;;
  1617. *)
  1618. $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1619. exit $EXIT_FAILURE
  1620. ;;
  1621. esac
  1622. done
  1623. ;;
  1624. prog)
  1625. compile_deplibs=
  1626. finalize_deplibs=
  1627. alldeplibs=no
  1628. newdlfiles=
  1629. newdlprefiles=
  1630. passes="conv scan dlopen dlpreopen link"
  1631. ;;
  1632. *) passes="conv"
  1633. ;;
  1634. esac
  1635. for pass in $passes; do
  1636. if test "$linkmode,$pass" = "lib,link" ||
  1637. test "$linkmode,$pass" = "prog,scan"; then
  1638. libs="$deplibs"
  1639. deplibs=
  1640. fi
  1641. if test "$linkmode" = prog; then
  1642. case $pass in
  1643. dlopen) libs="$dlfiles" ;;
  1644. dlpreopen) libs="$dlprefiles" ;;
  1645. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1646. esac
  1647. fi
  1648. if test "$pass" = dlopen; then
  1649. # Collect dlpreopened libraries
  1650. save_deplibs="$deplibs"
  1651. deplibs=
  1652. fi
  1653. for deplib in $libs; do
  1654. lib=
  1655. found=no
  1656. case $deplib in
  1657. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1658. if test "$linkmode,$pass" = "prog,link"; then
  1659. compile_deplibs="$deplib $compile_deplibs"
  1660. finalize_deplibs="$deplib $finalize_deplibs"
  1661. else
  1662. deplibs="$deplib $deplibs"
  1663. fi
  1664. continue
  1665. ;;
  1666. -l*)
  1667. if test "$linkmode" != lib && test "$linkmode" != prog; then
  1668. $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1669. continue
  1670. fi
  1671. if test "$pass" = conv; then
  1672. deplibs="$deplib $deplibs"
  1673. continue
  1674. fi
  1675. name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1676. for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1677. for search_ext in .la $std_shrext .so .a; do
  1678. # Search the libtool library
  1679. lib="$searchdir/lib${name}${search_ext}"
  1680. if test -f "$lib"; then
  1681. if test "$search_ext" = ".la"; then
  1682. found=yes
  1683. else
  1684. found=no
  1685. fi
  1686. break 2
  1687. fi
  1688. done
  1689. done
  1690. if test "$found" != yes; then
  1691. # deplib doesn't seem to be a libtool library
  1692. if test "$linkmode,$pass" = "prog,link"; then
  1693. compile_deplibs="$deplib $compile_deplibs"
  1694. finalize_deplibs="$deplib $finalize_deplibs"
  1695. else
  1696. deplibs="$deplib $deplibs"
  1697. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1698. fi
  1699. continue
  1700. else # deplib is a libtool library
  1701. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1702. # We need to do some special things here, and not later.
  1703. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1704. case " $predeps $postdeps " in
  1705. *" $deplib "*)
  1706. if (${SED} -e '2q' $lib |
  1707. grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1708. library_names=
  1709. old_library=
  1710. case $lib in
  1711. */* | *\\*) . $lib ;;
  1712. *) . ./$lib ;;
  1713. esac
  1714. for l in $old_library $library_names; do
  1715. ll="$l"
  1716. done
  1717. if test "X$ll" = "X$old_library" ; then # only static version available
  1718. found=no
  1719. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1720. test "X$ladir" = "X$lib" && ladir="."
  1721. lib=$ladir/$old_library
  1722. if test "$linkmode,$pass" = "prog,link"; then
  1723. compile_deplibs="$deplib $compile_deplibs"
  1724. finalize_deplibs="$deplib $finalize_deplibs"
  1725. else
  1726. deplibs="$deplib $deplibs"
  1727. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1728. fi
  1729. continue
  1730. fi
  1731. fi
  1732. ;;
  1733. *) ;;
  1734. esac
  1735. fi
  1736. fi
  1737. ;; # -l
  1738. -L*)
  1739. case $linkmode in
  1740. lib)
  1741. deplibs="$deplib $deplibs"
  1742. test "$pass" = conv && continue
  1743. newdependency_libs="$deplib $newdependency_libs"
  1744. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1745. ;;
  1746. prog)
  1747. if test "$pass" = conv; then
  1748. deplibs="$deplib $deplibs"
  1749. continue
  1750. fi
  1751. if test "$pass" = scan; then
  1752. deplibs="$deplib $deplibs"
  1753. else
  1754. compile_deplibs="$deplib $compile_deplibs"
  1755. finalize_deplibs="$deplib $finalize_deplibs"
  1756. fi
  1757. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1758. ;;
  1759. *)
  1760. $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1761. ;;
  1762. esac # linkmode
  1763. continue
  1764. ;; # -L
  1765. -R*)
  1766. if test "$pass" = link; then
  1767. dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1768. # Make sure the xrpath contains only unique directories.
  1769. case "$xrpath " in
  1770. *" $dir "*) ;;
  1771. *) xrpath="$xrpath $dir" ;;
  1772. esac
  1773. fi
  1774. deplibs="$deplib $deplibs"
  1775. continue
  1776. ;;
  1777. *.la) lib="$deplib" ;;
  1778. *.$libext)
  1779. if test "$pass" = conv; then
  1780. deplibs="$deplib $deplibs"
  1781. continue
  1782. fi
  1783. case $linkmode in
  1784. lib)
  1785. if test "$deplibs_check_method" != pass_all; then
  1786. $echo
  1787. $echo "*** Warning: Trying to link with static lib archive $deplib."
  1788. $echo "*** I have the capability to make that library automatically link in when"
  1789. $echo "*** you link to this library. But I can only do this if you have a"
  1790. $echo "*** shared version of the library, which you do not appear to have"
  1791. $echo "*** because the file extensions .$libext of this argument makes me believe"
  1792. $echo "*** that it is just a static archive that I should not used here."
  1793. else
  1794. $echo
  1795. $echo "*** Warning: Linking the shared library $output against the"
  1796. $echo "*** static library $deplib is not portable!"
  1797. deplibs="$deplib $deplibs"
  1798. fi
  1799. continue
  1800. ;;
  1801. prog)
  1802. if test "$pass" != link; then
  1803. deplibs="$deplib $deplibs"
  1804. else
  1805. compile_deplibs="$deplib $compile_deplibs"
  1806. finalize_deplibs="$deplib $finalize_deplibs"
  1807. fi
  1808. continue
  1809. ;;
  1810. esac # linkmode
  1811. ;; # *.$libext
  1812. *.lo | *.$objext)
  1813. if test "$pass" = conv; then
  1814. deplibs="$deplib $deplibs"
  1815. elif test "$linkmode" = prog; then
  1816. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1817. # If there is no dlopen support or we're linking statically,
  1818. # we need to preload.
  1819. newdlprefiles="$newdlprefiles $deplib"
  1820. compile_deplibs="$deplib $compile_deplibs"
  1821. finalize_deplibs="$deplib $finalize_deplibs"
  1822. else
  1823. newdlfiles="$newdlfiles $deplib"
  1824. fi
  1825. fi
  1826. continue
  1827. ;;
  1828. %DEPLIBS%)
  1829. alldeplibs=yes
  1830. continue
  1831. ;;
  1832. esac # case $deplib
  1833. if test "$found" = yes || test -f "$lib"; then :
  1834. else
  1835. $echo "$modename: cannot find the library \`$lib'" 1>&2
  1836. exit $EXIT_FAILURE
  1837. fi
  1838. # Check to see that this really is a libtool archive.
  1839. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1840. else
  1841. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1842. exit $EXIT_FAILURE
  1843. fi
  1844. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1845. test "X$ladir" = "X$lib" && ladir="."
  1846. dlname=
  1847. dlopen=
  1848. dlpreopen=
  1849. libdir=
  1850. library_names=
  1851. old_library=
  1852. # If the library was installed with an old release of libtool,
  1853. # it will not redefine variables installed, or shouldnotlink
  1854. installed=yes
  1855. shouldnotlink=no
  1856. # Read the .la file
  1857. case $lib in
  1858. */* | *\\*) . $lib ;;
  1859. *) . ./$lib ;;
  1860. esac
  1861. if test "$linkmode,$pass" = "lib,link" ||
  1862. test "$linkmode,$pass" = "prog,scan" ||
  1863. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  1864. test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  1865. test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  1866. fi
  1867. if test "$pass" = conv; then
  1868. # Only check for convenience libraries
  1869. deplibs="$lib $deplibs"
  1870. if test -z "$libdir"; then
  1871. if test -z "$old_library"; then
  1872. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1873. exit $EXIT_FAILURE
  1874. fi
  1875. # It is a libtool convenience library, so add in its objects.
  1876. convenience="$convenience $ladir/$objdir/$old_library"
  1877. old_convenience="$old_convenience $ladir/$objdir/$old_library"
  1878. tmp_libs=
  1879. for deplib in $dependency_libs; do
  1880. deplibs="$deplib $deplibs"
  1881. if test "X$duplicate_deps" = "Xyes" ; then
  1882. case "$tmp_libs " in
  1883. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1884. esac
  1885. fi
  1886. tmp_libs="$tmp_libs $deplib"
  1887. done
  1888. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  1889. $echo "$modename: \`$lib' is not a convenience library" 1>&2
  1890. exit $EXIT_FAILURE
  1891. fi
  1892. continue
  1893. fi # $pass = conv
  1894. # Get the name of the library we link against.
  1895. linklib=
  1896. for l in $old_library $library_names; do
  1897. linklib="$l"
  1898. done
  1899. if test -z "$linklib"; then
  1900. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1901. exit $EXIT_FAILURE
  1902. fi
  1903. # This library was specified with -dlopen.
  1904. if test "$pass" = dlopen; then
  1905. if test -z "$libdir"; then
  1906. $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  1907. exit $EXIT_FAILURE
  1908. fi
  1909. if test -z "$dlname" ||
  1910. test "$dlopen_support" != yes ||
  1911. test "$build_libtool_libs" = no; then
  1912. # If there is no dlname, no dlopen support or we're linking
  1913. # statically, we need to preload. We also need to preload any
  1914. # dependent libraries so libltdl's deplib preloader doesn't
  1915. # bomb out in the load deplibs phase.
  1916. dlprefiles="$dlprefiles $lib $dependency_libs"
  1917. else
  1918. newdlfiles="$newdlfiles $lib"
  1919. fi
  1920. continue
  1921. fi # $pass = dlopen
  1922. # We need an absolute path.
  1923. case $ladir in
  1924. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  1925. *)
  1926. abs_ladir=`cd "$ladir" && pwd`
  1927. if test -z "$abs_ladir"; then
  1928. $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  1929. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1930. abs_ladir="$ladir"
  1931. fi
  1932. ;;
  1933. esac
  1934. laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1935. # Find the relevant object directory and library name.
  1936. if test "X$installed" = Xyes; then
  1937. if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1938. $echo "$modename: warning: library \`$lib' was moved." 1>&2
  1939. dir="$ladir"
  1940. absdir="$abs_ladir"
  1941. libdir="$abs_ladir"
  1942. else
  1943. dir="$libdir"
  1944. absdir="$libdir"
  1945. fi
  1946. else
  1947. dir="$ladir/$objdir"
  1948. absdir="$abs_ladir/$objdir"
  1949. # Remove this search path later
  1950. notinst_path="$notinst_path $abs_ladir"
  1951. fi # $installed = yes
  1952. name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1953. # This library was specified with -dlpreopen.
  1954. if test "$pass" = dlpreopen; then
  1955. if test -z "$libdir"; then
  1956. $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  1957. exit $EXIT_FAILURE
  1958. fi
  1959. # Prefer using a static library (so that no silly _DYNAMIC symbols
  1960. # are required to link).
  1961. if test -n "$old_library"; then
  1962. newdlprefiles="$newdlprefiles $dir/$old_library"
  1963. # Otherwise, use the dlname, so that lt_dlopen finds it.
  1964. elif test -n "$dlname"; then
  1965. newdlprefiles="$newdlprefiles $dir/$dlname"
  1966. else
  1967. newdlprefiles="$newdlprefiles $dir/$linklib"
  1968. fi
  1969. fi # $pass = dlpreopen
  1970. if test -z "$libdir"; then
  1971. # Link the convenience library
  1972. if test "$linkmode" = lib; then
  1973. deplibs="$dir/$old_library $deplibs"
  1974. elif test "$linkmode,$pass" = "prog,link"; then
  1975. compile_deplibs="$dir/$old_library $compile_deplibs"
  1976. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  1977. else
  1978. deplibs="$lib $deplibs" # used for prog,scan pass
  1979. fi
  1980. continue
  1981. fi
  1982. if test "$linkmode" = prog && test "$pass" != link; then
  1983. newlib_search_path="$newlib_search_path $ladir"
  1984. deplibs="$lib $deplibs"
  1985. linkalldeplibs=no
  1986. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  1987. test "$build_libtool_libs" = no; then
  1988. linkalldeplibs=yes
  1989. fi
  1990. tmp_libs=
  1991. for deplib in $dependency_libs; do
  1992. case $deplib in
  1993. -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  1994. esac
  1995. # Need to link against all dependency_libs?
  1996. if test "$linkalldeplibs" = yes; then
  1997. deplibs="$deplib $deplibs"
  1998. else
  1999. # Need to hardcode shared library paths
  2000. # or/and link against static libraries
  2001. newdependency_libs="$deplib $newdependency_libs"
  2002. fi
  2003. if test "X$duplicate_deps" = "Xyes" ; then
  2004. case "$tmp_libs " in
  2005. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2006. esac
  2007. fi
  2008. tmp_libs="$tmp_libs $deplib"
  2009. done # for deplib
  2010. continue
  2011. fi # $linkmode = prog...
  2012. if test "$linkmode,$pass" = "prog,link"; then
  2013. if test -n "$library_names" &&
  2014. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2015. # We need to hardcode the library path
  2016. if test -n "$shlibpath_var"; then
  2017. # Make sure the rpath contains only unique directories.
  2018. case "$temp_rpath " in
  2019. *" $dir "*) ;;
  2020. *" $absdir "*) ;;
  2021. *) temp_rpath="$temp_rpath $dir" ;;
  2022. esac
  2023. fi
  2024. # Hardcode the library path.
  2025. # Skip directories that are in the system default run-time
  2026. # search path.
  2027. case " $sys_lib_dlsearch_path " in
  2028. *" $absdir "*) ;;
  2029. *)
  2030. case "$compile_rpath " in
  2031. *" $absdir "*) ;;
  2032. *) compile_rpath="$compile_rpath $absdir"
  2033. esac
  2034. ;;
  2035. esac
  2036. case " $sys_lib_dlsearch_path " in
  2037. *" $libdir "*) ;;
  2038. *)
  2039. case "$finalize_rpath " in
  2040. *" $libdir "*) ;;
  2041. *) finalize_rpath="$finalize_rpath $libdir"
  2042. esac
  2043. ;;
  2044. esac
  2045. fi # $linkmode,$pass = prog,link...
  2046. if test "$alldeplibs" = yes &&
  2047. { test "$deplibs_check_method" = pass_all ||
  2048. { test "$build_libtool_libs" = yes &&
  2049. test -n "$library_names"; }; }; then
  2050. # We only need to search for static libraries
  2051. continue
  2052. fi
  2053. fi
  2054. link_static=no # Whether the deplib will be linked statically
  2055. if test -n "$library_names" &&
  2056. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2057. if test "$installed" = no; then
  2058. notinst_deplibs="$notinst_deplibs $lib"
  2059. need_relink=yes
  2060. fi
  2061. # This is a shared library
  2062. # Warn about portability, can't link against -module's on
  2063. # some systems (darwin)
  2064. if test "$shouldnotlink" = yes && test "$pass" = link ; then
  2065. $echo
  2066. if test "$linkmode" = prog; then
  2067. $echo "*** Warning: Linking the executable $output against the loadable module"
  2068. else
  2069. $echo "*** Warning: Linking the shared library $output against the loadable module"
  2070. fi
  2071. $echo "*** $linklib is not portable!"
  2072. fi
  2073. if test "$linkmode" = lib &&
  2074. test "$hardcode_into_libs" = yes; then
  2075. # Hardcode the library path.
  2076. # Skip directories that are in the system default run-time
  2077. # search path.
  2078. case " $sys_lib_dlsearch_path " in
  2079. *" $absdir "*) ;;
  2080. *)
  2081. case "$compile_rpath " in
  2082. *" $absdir "*) ;;
  2083. *) compile_rpath="$compile_rpath $absdir"
  2084. esac
  2085. ;;
  2086. esac
  2087. case " $sys_lib_dlsearch_path " in
  2088. *" $libdir "*) ;;
  2089. *)
  2090. case "$finalize_rpath " in
  2091. *" $libdir "*) ;;
  2092. *) finalize_rpath="$finalize_rpath $libdir"
  2093. esac
  2094. ;;
  2095. esac
  2096. fi
  2097. if test -n "$old_archive_from_expsyms_cmds"; then
  2098. # figure out the soname
  2099. set dummy $library_names
  2100. realname="$2"
  2101. shift; shift
  2102. libname=`eval \\$echo \"$libname_spec\"`
  2103. # use dlname if we got it. it's perfectly good, no?
  2104. if test -n "$dlname"; then
  2105. soname="$dlname"
  2106. elif test -n "$soname_spec"; then
  2107. # bleh windows
  2108. case $host in
  2109. *cygwin* | mingw*)
  2110. major=`expr $current - $age`
  2111. versuffix="-$major"
  2112. ;;
  2113. esac
  2114. eval soname=\"$soname_spec\"
  2115. else
  2116. soname="$realname"
  2117. fi
  2118. # Make a new name for the extract_expsyms_cmds to use
  2119. soroot="$soname"
  2120. soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  2121. newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  2122. # If the library has no export list, then create one now
  2123. if test -f "$output_objdir/$soname-def"; then :
  2124. else
  2125. $show "extracting exported symbol list from \`$soname'"
  2126. save_ifs="$IFS"; IFS='~'
  2127. cmds=$extract_expsyms_cmds
  2128. for cmd in $cmds; do
  2129. IFS="$save_ifs"
  2130. eval cmd=\"$cmd\"
  2131. $show "$cmd"
  2132. $run eval "$cmd" || exit $?
  2133. done
  2134. IFS="$save_ifs"
  2135. fi
  2136. # Create $newlib
  2137. if test -f "$output_objdir/$newlib"; then :; else
  2138. $show "generating import library for \`$soname'"
  2139. save_ifs="$IFS"; IFS='~'
  2140. cmds=$old_archive_from_expsyms_cmds
  2141. for cmd in $cmds; do
  2142. IFS="$save_ifs"
  2143. eval cmd=\"$cmd\"
  2144. $show "$cmd"
  2145. $run eval "$cmd" || exit $?
  2146. done
  2147. IFS="$save_ifs"
  2148. fi
  2149. # make sure the library variables are pointing to the new library
  2150. dir=$output_objdir
  2151. linklib=$newlib
  2152. fi # test -n "$old_archive_from_expsyms_cmds"
  2153. if test "$linkmode" = prog || test "$mode" != relink; then
  2154. add_shlibpath=
  2155. add_dir=
  2156. add=
  2157. lib_linked=yes
  2158. case $hardcode_action in
  2159. immediate | unsupported)
  2160. if test "$hardcode_direct" = no; then
  2161. add="$dir/$linklib"
  2162. case $host in
  2163. *-*-sco3.2v5* ) add_dir="-L$dir" ;;
  2164. *-*-darwin* )
  2165. # if the lib is a module then we can not link against
  2166. # it, someone is ignoring the new warnings I added
  2167. if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
  2168. $echo "** Warning, lib $linklib is a module, not a shared library"
  2169. if test -z "$old_library" ; then
  2170. $echo
  2171. $echo "** And there doesn't seem to be a static archive available"
  2172. $echo "** The link will probably fail, sorry"
  2173. else
  2174. add="$dir/$old_library"
  2175. fi
  2176. fi
  2177. esac
  2178. elif test "$hardcode_minus_L" = no; then
  2179. case $host in
  2180. *-*-sunos*) add_shlibpath="$dir" ;;
  2181. esac
  2182. add_dir="-L$dir"
  2183. add="-l$name"
  2184. elif test "$hardcode_shlibpath_var" = no; then
  2185. add_shlibpath="$dir"
  2186. add="-l$name"
  2187. else
  2188. lib_linked=no
  2189. fi
  2190. ;;
  2191. relink)
  2192. if test "$hardcode_direct" = yes; then
  2193. add="$dir/$linklib"
  2194. elif test "$hardcode_minus_L" = yes; then
  2195. add_dir="-L$dir"
  2196. # Try looking first in the location we're being installed to.
  2197. if test -n "$inst_prefix_dir"; then
  2198. case "$libdir" in
  2199. [\\/]*)
  2200. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2201. ;;
  2202. esac
  2203. fi
  2204. add="-l$name"
  2205. elif test "$hardcode_shlibpath_var" = yes; then
  2206. add_shlibpath="$dir"
  2207. add="-l$name"
  2208. else
  2209. lib_linked=no
  2210. fi
  2211. ;;
  2212. *) lib_linked=no ;;
  2213. esac
  2214. if test "$lib_linked" != yes; then
  2215. $echo "$modename: configuration error: unsupported hardcode properties"
  2216. exit $EXIT_FAILURE
  2217. fi
  2218. if test -n "$add_shlibpath"; then
  2219. case :$compile_shlibpath: in
  2220. *":$add_shlibpath:"*) ;;
  2221. *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  2222. esac
  2223. fi
  2224. if test "$linkmode" = prog; then
  2225. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  2226. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  2227. else
  2228. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2229. test -n "$add" && deplibs="$add $deplibs"
  2230. if test "$hardcode_direct" != yes && \
  2231. test "$hardcode_minus_L" != yes && \
  2232. test "$hardcode_shlibpath_var" = yes; then
  2233. case :$finalize_shlibpath: in
  2234. *":$libdir:"*) ;;
  2235. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2236. esac
  2237. fi
  2238. fi
  2239. fi
  2240. if test "$linkmode" = prog || test "$mode" = relink; then
  2241. add_shlibpath=
  2242. add_dir=
  2243. add=
  2244. # Finalize command for both is simple: just hardcode it.
  2245. if test "$hardcode_direct" = yes; then
  2246. add="$libdir/$linklib"
  2247. elif test "$hardcode_minus_L" = yes; then
  2248. add_dir="-L$libdir"
  2249. add="-l$name"
  2250. elif test "$hardcode_shlibpath_var" = yes; then
  2251. case :$finalize_shlibpath: in
  2252. *":$libdir:"*) ;;
  2253. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2254. esac
  2255. add="-l$name"
  2256. elif test "$hardcode_automatic" = yes; then
  2257. if test -n "$inst_prefix_dir" &&
  2258. test -f "$inst_prefix_dir$libdir/$linklib" ; then
  2259. add="$inst_prefix_dir$libdir/$linklib"
  2260. else
  2261. add="$libdir/$linklib"
  2262. fi
  2263. else
  2264. # We cannot seem to hardcode it, guess we'll fake it.
  2265. add_dir="-L$libdir"
  2266. # Try looking first in the location we're being installed to.
  2267. if test -n "$inst_prefix_dir"; then
  2268. case "$libdir" in
  2269. [\\/]*)
  2270. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2271. ;;
  2272. esac
  2273. fi
  2274. add="-l$name"
  2275. fi
  2276. if test "$linkmode" = prog; then
  2277. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  2278. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  2279. else
  2280. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2281. test -n "$add" && deplibs="$add $deplibs"
  2282. fi
  2283. fi
  2284. elif test "$linkmode" = prog; then
  2285. # Here we assume that one of hardcode_direct or hardcode_minus_L
  2286. # is not unsupported. This is valid on all known static and
  2287. # shared platforms.
  2288. if test "$hardcode_direct" != unsupported; then
  2289. test -n "$old_library" && linklib="$old_library"
  2290. compile_deplibs="$dir/$linklib $compile_deplibs"
  2291. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  2292. else
  2293. compile_deplibs="-l$name -L$dir $compile_deplibs"
  2294. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  2295. fi
  2296. elif test "$build_libtool_libs" = yes; then
  2297. # Not a shared library
  2298. if test "$deplibs_check_method" != pass_all; then
  2299. # We're trying link a shared library against a static one
  2300. # but the system doesn't support it.
  2301. # Just print a warning and add the library to dependency_libs so
  2302. # that the program can be linked against the static library.
  2303. $echo
  2304. $echo "*** Warning: This system can not link to static lib archive $lib."
  2305. $echo "*** I have the capability to make that library automatically link in when"
  2306. $echo "*** you link to this library. But I can only do this if you have a"
  2307. $echo "*** shared version of the library, which you do not appear to have."
  2308. if test "$module" = yes; then
  2309. $echo "*** But as you try to build a module library, libtool will still create "
  2310. $echo "*** a static module, that should work as long as the dlopening application"
  2311. $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  2312. if test -z "$global_symbol_pipe"; then
  2313. $echo
  2314. $echo "*** However, this would only work if libtool was able to extract symbol"
  2315. $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2316. $echo "*** not find such a program. So, this module is probably useless."
  2317. $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2318. fi
  2319. if test "$build_old_libs" = no; then
  2320. build_libtool_libs=module
  2321. build_old_libs=yes
  2322. else
  2323. build_libtool_libs=no
  2324. fi
  2325. fi
  2326. else
  2327. convenience="$convenience $dir/$old_library"
  2328. old_convenience="$old_convenience $dir/$old_library"
  2329. deplibs="$dir/$old_library $deplibs"
  2330. link_static=yes
  2331. fi
  2332. fi # link shared/static library?
  2333. if test "$linkmode" = lib; then
  2334. if test -n "$dependency_libs" &&
  2335. { test "$hardcode_into_libs" != yes ||
  2336. test "$build_old_libs" = yes ||
  2337. test "$link_static" = yes; }; then
  2338. # Extract -R from dependency_libs
  2339. temp_deplibs=
  2340. for libdir in $dependency_libs; do
  2341. case $libdir in
  2342. -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  2343. case " $xrpath " in
  2344. *" $temp_xrpath "*) ;;
  2345. *) xrpath="$xrpath $temp_xrpath";;
  2346. esac;;
  2347. *) temp_deplibs="$temp_deplibs $libdir";;
  2348. esac
  2349. done
  2350. dependency_libs="$temp_deplibs"
  2351. fi
  2352. newlib_search_path="$newlib_search_path $absdir"
  2353. # Link against this library
  2354. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  2355. # ... and its dependency_libs
  2356. tmp_libs=
  2357. for deplib in $dependency_libs; do
  2358. newdependency_libs="$deplib $newdependency_libs"
  2359. if test "X$duplicate_deps" = "Xyes" ; then
  2360. case "$tmp_libs " in
  2361. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2362. esac
  2363. fi
  2364. tmp_libs="$tmp_libs $deplib"
  2365. done
  2366. if test "$link_all_deplibs" != no; then
  2367. # Add the search paths of all dependency libraries
  2368. for deplib in $dependency_libs; do
  2369. case $deplib in
  2370. -L*) path="$deplib" ;;
  2371. *.la)
  2372. dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  2373. test "X$dir" = "X$deplib" && dir="."
  2374. # We need an absolute path.
  2375. case $dir in
  2376. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  2377. *)
  2378. absdir=`cd "$dir" && pwd`
  2379. if test -z "$absdir"; then
  2380. $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  2381. absdir="$dir"
  2382. fi
  2383. ;;
  2384. esac
  2385. if grep "^installed=no" $deplib > /dev/null; then
  2386. path="$absdir/$objdir"
  2387. else
  2388. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  2389. if test -z "$libdir"; then
  2390. $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  2391. exit $EXIT_FAILURE
  2392. fi
  2393. if test "$absdir" != "$libdir"; then
  2394. $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  2395. fi
  2396. path="$absdir"
  2397. fi
  2398. depdepl=
  2399. case $host in
  2400. *-*-darwin*)
  2401. # we do not want to link against static libs,
  2402. # but need to link against shared
  2403. eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  2404. if test -n "$deplibrary_names" ; then
  2405. for tmp in $deplibrary_names ; do
  2406. depdepl=$tmp
  2407. done
  2408. if test -f "$path/$depdepl" ; then
  2409. depdepl="$path/$depdepl"
  2410. fi
  2411. # do not add paths which are already there
  2412. case " $newlib_search_path " in
  2413. *" $path "*) ;;
  2414. *) newlib_search_path="$newlib_search_path $path";;
  2415. esac
  2416. fi
  2417. path=""
  2418. ;;
  2419. *)
  2420. path="-L$path"
  2421. ;;
  2422. esac
  2423. ;;
  2424. -l*)
  2425. case $host in
  2426. *-*-darwin*)
  2427. # Again, we only want to link against shared libraries
  2428. eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  2429. for tmp in $newlib_search_path ; do
  2430. if test -f "$tmp/lib$tmp_libs.dylib" ; then
  2431. eval depdepl="$tmp/lib$tmp_libs.dylib"
  2432. break
  2433. fi
  2434. done
  2435. path=""
  2436. ;;
  2437. *) continue ;;
  2438. esac
  2439. ;;
  2440. *) continue ;;
  2441. esac
  2442. case " $deplibs " in
  2443. *" $depdepl "*) ;;
  2444. *) deplibs="$depdepl $deplibs" ;;
  2445. esac
  2446. case " $deplibs " in
  2447. *" $path "*) ;;
  2448. *) deplibs="$deplibs $path" ;;
  2449. esac
  2450. done
  2451. fi # link_all_deplibs != no
  2452. fi # linkmode = lib
  2453. done # for deplib in $libs
  2454. dependency_libs="$newdependency_libs"
  2455. if test "$pass" = dlpreopen; then
  2456. # Link the dlpreopened libraries before other libraries
  2457. for deplib in $save_deplibs; do
  2458. deplibs="$deplib $deplibs"
  2459. done
  2460. fi
  2461. if test "$pass" != dlopen; then
  2462. if test "$pass" != conv; then
  2463. # Make sure lib_search_path contains only unique directories.
  2464. lib_search_path=
  2465. for dir in $newlib_search_path; do
  2466. case "$lib_search_path " in
  2467. *" $dir "*) ;;
  2468. *) lib_search_path="$lib_search_path $dir" ;;
  2469. esac
  2470. done
  2471. newlib_search_path=
  2472. fi
  2473. if test "$linkmode,$pass" != "prog,link"; then
  2474. vars="deplibs"
  2475. else
  2476. vars="compile_deplibs finalize_deplibs"
  2477. fi
  2478. for var in $vars dependency_libs; do
  2479. # Add libraries to $var in reverse order
  2480. eval tmp_libs=\"\$$var\"
  2481. new_libs=
  2482. for deplib in $tmp_libs; do
  2483. # FIXME: Pedantically, this is the right thing to do, so
  2484. # that some nasty dependency loop isn't accidentally
  2485. # broken:
  2486. #new_libs="$deplib $new_libs"
  2487. # Pragmatically, this seems to cause very few problems in
  2488. # practice:
  2489. case $deplib in
  2490. -L*) new_libs="$deplib $new_libs" ;;
  2491. -R*) ;;
  2492. *)
  2493. # And here is the reason: when a library appears more
  2494. # than once as an explicit dependence of a library, or
  2495. # is implicitly linked in more than once by the
  2496. # compiler, it is considered special, and multiple
  2497. # occurrences thereof are not removed. Compare this
  2498. # with having the same library being listed as a
  2499. # dependency of multiple other libraries: in this case,
  2500. # we know (pedantically, we assume) the library does not
  2501. # need to be listed more than once, so we keep only the
  2502. # last copy. This is not always right, but it is rare
  2503. # enough that we require users that really mean to play
  2504. # such unportable linking tricks to link the library
  2505. # using -Wl,-lname, so that libtool does not consider it
  2506. # for duplicate removal.
  2507. case " $specialdeplibs " in
  2508. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  2509. *)
  2510. case " $new_libs " in
  2511. *" $deplib "*) ;;
  2512. *) new_libs="$deplib $new_libs" ;;
  2513. esac
  2514. ;;
  2515. esac
  2516. ;;
  2517. esac
  2518. done
  2519. tmp_libs=
  2520. for deplib in $new_libs; do
  2521. case $deplib in
  2522. -L*)
  2523. case " $tmp_libs " in
  2524. *" $deplib "*) ;;
  2525. *) tmp_libs="$tmp_libs $deplib" ;;
  2526. esac
  2527. ;;
  2528. *) tmp_libs="$tmp_libs $deplib" ;;
  2529. esac
  2530. done
  2531. eval $var=\"$tmp_libs\"
  2532. done # for var
  2533. fi
  2534. # Last step: remove runtime libs from dependency_libs
  2535. # (they stay in deplibs)
  2536. tmp_libs=
  2537. for i in $dependency_libs ; do
  2538. case " $predeps $postdeps $compiler_lib_search_path " in
  2539. *" $i "*)
  2540. i=""
  2541. ;;
  2542. esac
  2543. if test -n "$i" ; then
  2544. tmp_libs="$tmp_libs $i"
  2545. fi
  2546. done
  2547. dependency_libs=$tmp_libs
  2548. done # for pass
  2549. if test "$linkmode" = prog; then
  2550. dlfiles="$newdlfiles"
  2551. dlprefiles="$newdlprefiles"
  2552. fi
  2553. case $linkmode in
  2554. oldlib)
  2555. if test -n "$deplibs"; then
  2556. $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  2557. fi
  2558. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2559. $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  2560. fi
  2561. if test -n "$rpath"; then
  2562. $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  2563. fi
  2564. if test -n "$xrpath"; then
  2565. $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  2566. fi
  2567. if test -n "$vinfo"; then
  2568. $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
  2569. fi
  2570. if test -n "$release"; then
  2571. $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  2572. fi
  2573. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  2574. $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  2575. fi
  2576. # Now set the variables for building old libraries.
  2577. build_libtool_libs=no
  2578. oldlibs="$output"
  2579. objs="$objs$old_deplibs"
  2580. ;;
  2581. lib)
  2582. # Make sure we only generate libraries of the form `libNAME.la'.
  2583. case $outputname in
  2584. lib*)
  2585. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  2586. eval shared_ext=\"$shrext_cmds\"
  2587. eval libname=\"$libname_spec\"
  2588. ;;
  2589. *)
  2590. if test "$module" = no; then
  2591. $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  2592. $echo "$help" 1>&2
  2593. exit $EXIT_FAILURE
  2594. fi
  2595. if test "$need_lib_prefix" != no; then
  2596. # Add the "lib" prefix for modules if required
  2597. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  2598. eval shared_ext=\"$shrext_cmds\"
  2599. eval libname=\"$libname_spec\"
  2600. else
  2601. libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  2602. fi
  2603. ;;
  2604. esac
  2605. if test -n "$objs"; then
  2606. if test "$deplibs_check_method" != pass_all; then
  2607. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  2608. exit $EXIT_FAILURE
  2609. else
  2610. $echo
  2611. $echo "*** Warning: Linking the shared library $output against the non-libtool"
  2612. $echo "*** objects $objs is not portable!"
  2613. libobjs="$libobjs $objs"
  2614. fi
  2615. fi
  2616. if test "$dlself" != no; then
  2617. $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  2618. fi
  2619. set dummy $rpath
  2620. if test "$#" -gt 2; then
  2621. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  2622. fi
  2623. install_libdir="$2"
  2624. oldlibs=
  2625. if test -z "$rpath"; then
  2626. if test "$build_libtool_libs" = yes; then
  2627. # Building a libtool convenience library.
  2628. # Some compilers have problems with a `.al' extension so
  2629. # convenience libraries should have the same extension an
  2630. # archive normally would.
  2631. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  2632. build_libtool_libs=convenience
  2633. build_old_libs=yes
  2634. fi
  2635. if test -n "$vinfo"; then
  2636. $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
  2637. fi
  2638. if test -n "$release"; then
  2639. $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  2640. fi
  2641. else
  2642. # Parse the version information argument.
  2643. save_ifs="$IFS"; IFS=':'
  2644. set dummy $vinfo 0 0 0
  2645. IFS="$save_ifs"
  2646. if test -n "$8"; then
  2647. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  2648. $echo "$help" 1>&2
  2649. exit $EXIT_FAILURE
  2650. fi
  2651. # convert absolute version numbers to libtool ages
  2652. # this retains compatibility with .la files and attempts
  2653. # to make the code below a bit more comprehensible
  2654. case $vinfo_number in
  2655. yes)
  2656. number_major="$2"
  2657. number_minor="$3"
  2658. number_revision="$4"
  2659. #
  2660. # There are really only two kinds -- those that
  2661. # use the current revision as the major version
  2662. # and those that subtract age and use age as
  2663. # a minor version. But, then there is irix
  2664. # which has an extra 1 added just for fun
  2665. #
  2666. case $version_type in
  2667. darwin|linux|osf|windows)
  2668. current=`expr $number_major + $number_minor`
  2669. age="$number_minor"
  2670. revision="$number_revision"
  2671. ;;
  2672. freebsd-aout|freebsd-elf|sunos)
  2673. current="$number_major"
  2674. revision="$number_minor"
  2675. age="0"
  2676. ;;
  2677. irix|nonstopux)
  2678. current=`expr $number_major + $number_minor - 1`
  2679. age="$number_minor"
  2680. revision="$number_minor"
  2681. ;;
  2682. esac
  2683. ;;
  2684. no)
  2685. current="$2"
  2686. revision="$3"
  2687. age="$4"
  2688. ;;
  2689. esac
  2690. # Check that each of the things are valid numbers.
  2691. case $current in
  2692. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2693. *)
  2694. $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  2695. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2696. exit $EXIT_FAILURE
  2697. ;;
  2698. esac
  2699. case $revision in
  2700. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2701. *)
  2702. $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  2703. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2704. exit $EXIT_FAILURE
  2705. ;;
  2706. esac
  2707. case $age in
  2708. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2709. *)
  2710. $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  2711. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2712. exit $EXIT_FAILURE
  2713. ;;
  2714. esac
  2715. if test "$age" -gt "$current"; then
  2716. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  2717. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2718. exit $EXIT_FAILURE
  2719. fi
  2720. # Calculate the version variables.
  2721. major=
  2722. versuffix=
  2723. verstring=
  2724. case $version_type in
  2725. none) ;;
  2726. darwin)
  2727. # Like Linux, but with the current version available in
  2728. # verstring for coding it into the library header
  2729. major=.`expr $current - $age`
  2730. versuffix="$major.$age.$revision"
  2731. # Darwin ld doesn't like 0 for these options...
  2732. minor_current=`expr $current + 1`
  2733. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  2734. ;;
  2735. freebsd-aout)
  2736. major=".$current"
  2737. versuffix=".$current.$revision";
  2738. ;;
  2739. freebsd-elf)
  2740. major=".$current"
  2741. versuffix=".$current";
  2742. ;;
  2743. irix | nonstopux)
  2744. major=`expr $current - $age + 1`
  2745. case $version_type in
  2746. nonstopux) verstring_prefix=nonstopux ;;
  2747. *) verstring_prefix=sgi ;;
  2748. esac
  2749. verstring="$verstring_prefix$major.$revision"
  2750. # Add in all the interfaces that we are compatible with.
  2751. loop=$revision
  2752. while test "$loop" -ne 0; do
  2753. iface=`expr $revision - $loop`
  2754. loop=`expr $loop - 1`
  2755. verstring="$verstring_prefix$major.$iface:$verstring"
  2756. done
  2757. # Before this point, $major must not contain `.'.
  2758. major=.$major
  2759. versuffix="$major.$revision"
  2760. ;;
  2761. linux)
  2762. major=.`expr $current - $age`
  2763. versuffix="$major.$age.$revision"
  2764. ;;
  2765. osf)
  2766. major=.`expr $current - $age`
  2767. versuffix=".$current.$age.$revision"
  2768. verstring="$current.$age.$revision"
  2769. # Add in all the interfaces that we are compatible with.
  2770. loop=$age
  2771. while test "$loop" -ne 0; do
  2772. iface=`expr $current - $loop`
  2773. loop=`expr $loop - 1`
  2774. verstring="$verstring:${iface}.0"
  2775. done
  2776. # Make executables depend on our current version.
  2777. verstring="$verstring:${current}.0"
  2778. ;;
  2779. sunos)
  2780. major=".$current"
  2781. versuffix=".$current.$revision"
  2782. ;;
  2783. windows)
  2784. # Use '-' rather than '.', since we only want one
  2785. # extension on DOS 8.3 filesystems.
  2786. major=`expr $current - $age`
  2787. versuffix="-$major"
  2788. ;;
  2789. *)
  2790. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  2791. $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  2792. exit $EXIT_FAILURE
  2793. ;;
  2794. esac
  2795. # Clear the version info if we defaulted, and they specified a release.
  2796. if test -z "$vinfo" && test -n "$release"; then
  2797. major=
  2798. case $version_type in
  2799. darwin)
  2800. # we can't check for "0.0" in archive_cmds due to quoting
  2801. # problems, so we reset it completely
  2802. verstring=
  2803. ;;
  2804. *)
  2805. verstring="0.0"
  2806. ;;
  2807. esac
  2808. if test "$need_version" = no; then
  2809. versuffix=
  2810. else
  2811. versuffix=".0.0"
  2812. fi
  2813. fi
  2814. # Remove version info from name if versioning should be avoided
  2815. if test "$avoid_version" = yes && test "$need_version" = no; then
  2816. major=
  2817. versuffix=
  2818. verstring=""
  2819. fi
  2820. # Check to see if the archive will have undefined symbols.
  2821. if test "$allow_undefined" = yes; then
  2822. if test "$allow_undefined_flag" = unsupported; then
  2823. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  2824. build_libtool_libs=no
  2825. build_old_libs=yes
  2826. fi
  2827. else
  2828. # Don't allow undefined symbols.
  2829. allow_undefined_flag="$no_undefined_flag"
  2830. fi
  2831. fi
  2832. if test "$mode" != relink; then
  2833. # Remove our outputs, but don't remove object files since they
  2834. # may have been created when compiling PIC objects.
  2835. removelist=
  2836. tempremovelist=`$echo "$output_objdir/*"`
  2837. for p in $tempremovelist; do
  2838. case $p in
  2839. *.$objext)
  2840. ;;
  2841. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  2842. if test "X$precious_files_regex" != "X"; then
  2843. if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  2844. then
  2845. continue
  2846. fi
  2847. fi
  2848. removelist="$removelist $p"
  2849. ;;
  2850. *) ;;
  2851. esac
  2852. done
  2853. if test -n "$removelist"; then
  2854. $show "${rm}r $removelist"
  2855. $run ${rm}r $removelist
  2856. fi
  2857. fi
  2858. # Now set the variables for building old libraries.
  2859. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  2860. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  2861. # Transform .lo files to .o files.
  2862. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  2863. fi
  2864. # Eliminate all temporary directories.
  2865. for path in $notinst_path; do
  2866. lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
  2867. deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
  2868. dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
  2869. done
  2870. if test -n "$xrpath"; then
  2871. # If the user specified any rpath flags, then add them.
  2872. temp_xrpath=
  2873. for libdir in $xrpath; do
  2874. temp_xrpath="$temp_xrpath -R$libdir"
  2875. case "$finalize_rpath " in
  2876. *" $libdir "*) ;;
  2877. *) finalize_rpath="$finalize_rpath $libdir" ;;
  2878. esac
  2879. done
  2880. if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  2881. dependency_libs="$temp_xrpath $dependency_libs"
  2882. fi
  2883. fi
  2884. # Make sure dlfiles contains only unique files that won't be dlpreopened
  2885. old_dlfiles="$dlfiles"
  2886. dlfiles=
  2887. for lib in $old_dlfiles; do
  2888. case " $dlprefiles $dlfiles " in
  2889. *" $lib "*) ;;
  2890. *) dlfiles="$dlfiles $lib" ;;
  2891. esac
  2892. done
  2893. # Make sure dlprefiles contains only unique files
  2894. old_dlprefiles="$dlprefiles"
  2895. dlprefiles=
  2896. for lib in $old_dlprefiles; do
  2897. case "$dlprefiles " in
  2898. *" $lib "*) ;;
  2899. *) dlprefiles="$dlprefiles $lib" ;;
  2900. esac
  2901. done
  2902. if test "$build_libtool_libs" = yes; then
  2903. if test -n "$rpath"; then
  2904. case $host in
  2905. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  2906. # these systems don't actually have a c library (as such)!
  2907. ;;
  2908. *-*-rhapsody* | *-*-darwin1.[012])
  2909. # Rhapsody C library is in the System framework
  2910. deplibs="$deplibs -framework System"
  2911. ;;
  2912. *-*-netbsd*)
  2913. # Don't link with libc until the a.out ld.so is fixed.
  2914. ;;
  2915. *-*-openbsd* | *-*-freebsd*)
  2916. # Do not include libc due to us having libc/libc_r.
  2917. test "X$arg" = "X-lc" && continue
  2918. ;;
  2919. *)
  2920. # Add libc to deplibs on all other systems if necessary.
  2921. if test "$build_libtool_need_lc" = "yes"; then
  2922. deplibs="$deplibs -lc"
  2923. fi
  2924. ;;
  2925. esac
  2926. fi
  2927. # Transform deplibs into only deplibs that can be linked in shared.
  2928. name_save=$name
  2929. libname_save=$libname
  2930. release_save=$release
  2931. versuffix_save=$versuffix
  2932. major_save=$major
  2933. # I'm not sure if I'm treating the release correctly. I think
  2934. # release should show up in the -l (ie -lgmp5) so we don't want to
  2935. # add it in twice. Is that correct?
  2936. release=""
  2937. versuffix=""
  2938. major=""
  2939. newdeplibs=
  2940. droppeddeps=no
  2941. case $deplibs_check_method in
  2942. pass_all)
  2943. # Don't check for shared/static. Everything works.
  2944. # This might be a little naive. We might want to check
  2945. # whether the library exists or not. But this is on
  2946. # osf3 & osf4 and I'm not really sure... Just
  2947. # implementing what was already the behavior.
  2948. newdeplibs=$deplibs
  2949. ;;
  2950. test_compile)
  2951. # This code stresses the "libraries are programs" paradigm to its
  2952. # limits. Maybe even breaks it. We compile a program, linking it
  2953. # against the deplibs as a proxy for the library. Then we can check
  2954. # whether they linked in statically or dynamically with ldd.
  2955. $rm conftest.c
  2956. cat > conftest.c <<EOF
  2957. int main() { return 0; }
  2958. EOF
  2959. $rm conftest
  2960. $LTCC -o conftest conftest.c $deplibs
  2961. if test "$?" -eq 0 ; then
  2962. ldd_output=`ldd conftest`
  2963. for i in $deplibs; do
  2964. name="`expr $i : '-l\(.*\)'`"
  2965. # If $name is empty we are operating on a -L argument.
  2966. if test "$name" != "" && test "$name" -ne "0"; then
  2967. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  2968. case " $predeps $postdeps " in
  2969. *" $i "*)
  2970. newdeplibs="$newdeplibs $i"
  2971. i=""
  2972. ;;
  2973. esac
  2974. fi
  2975. if test -n "$i" ; then
  2976. libname=`eval \\$echo \"$libname_spec\"`
  2977. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  2978. set dummy $deplib_matches
  2979. deplib_match=$2
  2980. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  2981. newdeplibs="$newdeplibs $i"
  2982. else
  2983. droppeddeps=yes
  2984. $echo
  2985. $echo "*** Warning: dynamic linker does not accept needed library $i."
  2986. $echo "*** I have the capability to make that library automatically link in when"
  2987. $echo "*** you link to this library. But I can only do this if you have a"
  2988. $echo "*** shared version of the library, which I believe you do not have"
  2989. $echo "*** because a test_compile did reveal that the linker did not use it for"
  2990. $echo "*** its dynamic dependency list that programs get resolved with at runtime."
  2991. fi
  2992. fi
  2993. else
  2994. newdeplibs="$newdeplibs $i"
  2995. fi
  2996. done
  2997. else
  2998. # Error occurred in the first compile. Let's try to salvage
  2999. # the situation: Compile a separate program for each library.
  3000. for i in $deplibs; do
  3001. name="`expr $i : '-l\(.*\)'`"
  3002. # If $name is empty we are operating on a -L argument.
  3003. if test "$name" != "" && test "$name" != "0"; then
  3004. $rm conftest
  3005. $LTCC -o conftest conftest.c $i
  3006. # Did it work?
  3007. if test "$?" -eq 0 ; then
  3008. ldd_output=`ldd conftest`
  3009. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3010. case " $predeps $postdeps " in
  3011. *" $i "*)
  3012. newdeplibs="$newdeplibs $i"
  3013. i=""
  3014. ;;
  3015. esac
  3016. fi
  3017. if test -n "$i" ; then
  3018. libname=`eval \\$echo \"$libname_spec\"`
  3019. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3020. set dummy $deplib_matches
  3021. deplib_match=$2
  3022. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3023. newdeplibs="$newdeplibs $i"
  3024. else
  3025. droppeddeps=yes
  3026. $echo
  3027. $echo "*** Warning: dynamic linker does not accept needed library $i."
  3028. $echo "*** I have the capability to make that library automatically link in when"
  3029. $echo "*** you link to this library. But I can only do this if you have a"
  3030. $echo "*** shared version of the library, which you do not appear to have"
  3031. $echo "*** because a test_compile did reveal that the linker did not use this one"
  3032. $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  3033. fi
  3034. fi
  3035. else
  3036. droppeddeps=yes
  3037. $echo
  3038. $echo "*** Warning! Library $i is needed by this library but I was not able to"
  3039. $echo "*** make it link in! You will probably need to install it or some"
  3040. $echo "*** library that it depends on before this library will be fully"
  3041. $echo "*** functional. Installing it before continuing would be even better."
  3042. fi
  3043. else
  3044. newdeplibs="$newdeplibs $i"
  3045. fi
  3046. done
  3047. fi
  3048. ;;
  3049. file_magic*)
  3050. set dummy $deplibs_check_method
  3051. file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3052. for a_deplib in $deplibs; do
  3053. name="`expr $a_deplib : '-l\(.*\)'`"
  3054. # If $name is empty we are operating on a -L argument.
  3055. if test "$name" != "" && test "$name" != "0"; then
  3056. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3057. case " $predeps $postdeps " in
  3058. *" $a_deplib "*)
  3059. newdeplibs="$newdeplibs $a_deplib"
  3060. a_deplib=""
  3061. ;;
  3062. esac
  3063. fi
  3064. if test -n "$a_deplib" ; then
  3065. libname=`eval \\$echo \"$libname_spec\"`
  3066. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3067. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3068. for potent_lib in $potential_libs; do
  3069. # Follow soft links.
  3070. if ls -lLd "$potent_lib" 2>/dev/null \
  3071. | grep " -> " >/dev/null; then
  3072. continue
  3073. fi
  3074. # The statement above tries to avoid entering an
  3075. # endless loop below, in case of cyclic links.
  3076. # We might still enter an endless loop, since a link
  3077. # loop can be closed while we follow links,
  3078. # but so what?
  3079. potlib="$potent_lib"
  3080. while test -h "$potlib" 2>/dev/null; do
  3081. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  3082. case $potliblink in
  3083. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  3084. *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  3085. esac
  3086. done
  3087. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  3088. | ${SED} 10q \
  3089. | $EGREP "$file_magic_regex" > /dev/null; then
  3090. newdeplibs="$newdeplibs $a_deplib"
  3091. a_deplib=""
  3092. break 2
  3093. fi
  3094. done
  3095. done
  3096. fi
  3097. if test -n "$a_deplib" ; then
  3098. droppeddeps=yes
  3099. $echo
  3100. $echo "*** Warning: linker path does not have real file for library $a_deplib."
  3101. $echo "*** I have the capability to make that library automatically link in when"
  3102. $echo "*** you link to this library. But I can only do this if you have a"
  3103. $echo "*** shared version of the library, which you do not appear to have"
  3104. $echo "*** because I did check the linker path looking for a file starting"
  3105. if test -z "$potlib" ; then
  3106. $echo "*** with $libname but no candidates were found. (...for file magic test)"
  3107. else
  3108. $echo "*** with $libname and none of the candidates passed a file format test"
  3109. $echo "*** using a file magic. Last file checked: $potlib"
  3110. fi
  3111. fi
  3112. else
  3113. # Add a -L argument.
  3114. newdeplibs="$newdeplibs $a_deplib"
  3115. fi
  3116. done # Gone through all deplibs.
  3117. ;;
  3118. match_pattern*)
  3119. set dummy $deplibs_check_method
  3120. match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3121. for a_deplib in $deplibs; do
  3122. name="`expr $a_deplib : '-l\(.*\)'`"
  3123. # If $name is empty we are operating on a -L argument.
  3124. if test -n "$name" && test "$name" != "0"; then
  3125. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3126. case " $predeps $postdeps " in
  3127. *" $a_deplib "*)
  3128. newdeplibs="$newdeplibs $a_deplib"
  3129. a_deplib=""
  3130. ;;
  3131. esac
  3132. fi
  3133. if test -n "$a_deplib" ; then
  3134. libname=`eval \\$echo \"$libname_spec\"`
  3135. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3136. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3137. for potent_lib in $potential_libs; do
  3138. potlib="$potent_lib" # see symlink-check above in file_magic test
  3139. if eval $echo \"$potent_lib\" 2>/dev/null \
  3140. | ${SED} 10q \
  3141. | $EGREP "$match_pattern_regex" > /dev/null; then
  3142. newdeplibs="$newdeplibs $a_deplib"
  3143. a_deplib=""
  3144. break 2
  3145. fi
  3146. done
  3147. done
  3148. fi
  3149. if test -n "$a_deplib" ; then
  3150. droppeddeps=yes
  3151. $echo
  3152. $echo "*** Warning: linker path does not have real file for library $a_deplib."
  3153. $echo "*** I have the capability to make that library automatically link in when"
  3154. $echo "*** you link to this library. But I can only do this if you have a"
  3155. $echo "*** shared version of the library, which you do not appear to have"
  3156. $echo "*** because I did check the linker path looking for a file starting"
  3157. if test -z "$potlib" ; then
  3158. $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  3159. else
  3160. $echo "*** with $libname and none of the candidates passed a file format test"
  3161. $echo "*** using a regex pattern. Last file checked: $potlib"
  3162. fi
  3163. fi
  3164. else
  3165. # Add a -L argument.
  3166. newdeplibs="$newdeplibs $a_deplib"
  3167. fi
  3168. done # Gone through all deplibs.
  3169. ;;
  3170. none | unknown | *)
  3171. newdeplibs=""
  3172. tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  3173. -e 's/ -[LR][^ ]*//g'`
  3174. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3175. for i in $predeps $postdeps ; do
  3176. # can't use Xsed below, because $i might contain '/'
  3177. tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
  3178. done
  3179. fi
  3180. if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
  3181. | grep . >/dev/null; then
  3182. $echo
  3183. if test "X$deplibs_check_method" = "Xnone"; then
  3184. $echo "*** Warning: inter-library dependencies are not supported in this platform."
  3185. else
  3186. $echo "*** Warning: inter-library dependencies are not known to be supported."
  3187. fi
  3188. $echo "*** All declared inter-library dependencies are being dropped."
  3189. droppeddeps=yes
  3190. fi
  3191. ;;
  3192. esac
  3193. versuffix=$versuffix_save
  3194. major=$major_save
  3195. release=$release_save
  3196. libname=$libname_save
  3197. name=$name_save
  3198. case $host in
  3199. *-*-rhapsody* | *-*-darwin1.[012])
  3200. # On Rhapsody replace the C library is the System framework
  3201. newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3202. ;;
  3203. esac
  3204. if test "$droppeddeps" = yes; then
  3205. if test "$module" = yes; then
  3206. $echo
  3207. $echo "*** Warning: libtool could not satisfy all declared inter-library"
  3208. $echo "*** dependencies of module $libname. Therefore, libtool will create"
  3209. $echo "*** a static module, that should work as long as the dlopening"
  3210. $echo "*** application is linked with the -dlopen flag."
  3211. if test -z "$global_symbol_pipe"; then
  3212. $echo
  3213. $echo "*** However, this would only work if libtool was able to extract symbol"
  3214. $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  3215. $echo "*** not find such a program. So, this module is probably useless."
  3216. $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  3217. fi
  3218. if test "$build_old_libs" = no; then
  3219. oldlibs="$output_objdir/$libname.$libext"
  3220. build_libtool_libs=module
  3221. build_old_libs=yes
  3222. else
  3223. build_libtool_libs=no
  3224. fi
  3225. else
  3226. $echo "*** The inter-library dependencies that have been dropped here will be"
  3227. $echo "*** automatically added whenever a program is linked with this library"
  3228. $echo "*** or is declared to -dlopen it."
  3229. if test "$allow_undefined" = no; then
  3230. $echo
  3231. $echo "*** Since this library must not contain undefined symbols,"
  3232. $echo "*** because either the platform does not support them or"
  3233. $echo "*** it was explicitly requested with -no-undefined,"
  3234. $echo "*** libtool will only create a static version of it."
  3235. if test "$build_old_libs" = no; then
  3236. oldlibs="$output_objdir/$libname.$libext"
  3237. build_libtool_libs=module
  3238. build_old_libs=yes
  3239. else
  3240. build_libtool_libs=no
  3241. fi
  3242. fi
  3243. fi
  3244. fi
  3245. # Done checking deplibs!
  3246. deplibs=$newdeplibs
  3247. fi
  3248. # All the library-specific variables (install_libdir is set above).
  3249. library_names=
  3250. old_library=
  3251. dlname=
  3252. # Test again, we may have decided not to build it any more
  3253. if test "$build_libtool_libs" = yes; then
  3254. if test "$hardcode_into_libs" = yes; then
  3255. # Hardcode the library paths
  3256. hardcode_libdirs=
  3257. dep_rpath=
  3258. rpath="$finalize_rpath"
  3259. test "$mode" != relink && rpath="$compile_rpath$rpath"
  3260. for libdir in $rpath; do
  3261. if test -n "$hardcode_libdir_flag_spec"; then
  3262. if test -n "$hardcode_libdir_separator"; then
  3263. if test -z "$hardcode_libdirs"; then
  3264. hardcode_libdirs="$libdir"
  3265. else
  3266. # Just accumulate the unique libdirs.
  3267. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3268. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3269. ;;
  3270. *)
  3271. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3272. ;;
  3273. esac
  3274. fi
  3275. else
  3276. eval flag=\"$hardcode_libdir_flag_spec\"
  3277. dep_rpath="$dep_rpath $flag"
  3278. fi
  3279. elif test -n "$runpath_var"; then
  3280. case "$perm_rpath " in
  3281. *" $libdir "*) ;;
  3282. *) perm_rpath="$perm_rpath $libdir" ;;
  3283. esac
  3284. fi
  3285. done
  3286. # Substitute the hardcoded libdirs into the rpath.
  3287. if test -n "$hardcode_libdir_separator" &&
  3288. test -n "$hardcode_libdirs"; then
  3289. libdir="$hardcode_libdirs"
  3290. if test -n "$hardcode_libdir_flag_spec_ld"; then
  3291. eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  3292. else
  3293. eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  3294. fi
  3295. fi
  3296. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  3297. # We should set the runpath_var.
  3298. rpath=
  3299. for dir in $perm_rpath; do
  3300. rpath="$rpath$dir:"
  3301. done
  3302. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  3303. fi
  3304. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  3305. fi
  3306. shlibpath="$finalize_shlibpath"
  3307. test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  3308. if test -n "$shlibpath"; then
  3309. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  3310. fi
  3311. # Get the real and link names of the library.
  3312. eval shared_ext=\"$shrext_cmds\"
  3313. eval library_names=\"$library_names_spec\"
  3314. set dummy $library_names
  3315. realname="$2"
  3316. shift; shift
  3317. if test -n "$soname_spec"; then
  3318. eval soname=\"$soname_spec\"
  3319. else
  3320. soname="$realname"
  3321. fi
  3322. if test -z "$dlname"; then
  3323. dlname=$soname
  3324. fi
  3325. lib="$output_objdir/$realname"
  3326. for link
  3327. do
  3328. linknames="$linknames $link"
  3329. done
  3330. # Use standard objects if they are pic
  3331. test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3332. # Prepare the list of exported symbols
  3333. if test -z "$export_symbols"; then
  3334. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  3335. $show "generating symbol list for \`$libname.la'"
  3336. export_symbols="$output_objdir/$libname.exp"
  3337. $run $rm $export_symbols
  3338. cmds=$export_symbols_cmds
  3339. save_ifs="$IFS"; IFS='~'
  3340. for cmd in $cmds; do
  3341. IFS="$save_ifs"
  3342. eval cmd=\"$cmd\"
  3343. if len=`expr "X$cmd" : ".*"` &&
  3344. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3345. $show "$cmd"
  3346. $run eval "$cmd" || exit $?
  3347. skipped_export=false
  3348. else
  3349. # The command line is too long to execute in one step.
  3350. $show "using reloadable object file for export list..."
  3351. skipped_export=:
  3352. fi
  3353. done
  3354. IFS="$save_ifs"
  3355. if test -n "$export_symbols_regex"; then
  3356. $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  3357. $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  3358. $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  3359. $run eval '$mv "${export_symbols}T" "$export_symbols"'
  3360. fi
  3361. fi
  3362. fi
  3363. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  3364. $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  3365. fi
  3366. tmp_deplibs=
  3367. for test_deplib in $deplibs; do
  3368. case " $convenience " in
  3369. *" $test_deplib "*) ;;
  3370. *)
  3371. tmp_deplibs="$tmp_deplibs $test_deplib"
  3372. ;;
  3373. esac
  3374. done
  3375. deplibs="$tmp_deplibs"
  3376. if test -n "$convenience"; then
  3377. if test -n "$whole_archive_flag_spec"; then
  3378. save_libobjs=$libobjs
  3379. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  3380. else
  3381. gentop="$output_objdir/${outputname}x"
  3382. $show "${rm}r $gentop"
  3383. $run ${rm}r "$gentop"
  3384. $show "$mkdir $gentop"
  3385. $run $mkdir "$gentop"
  3386. status=$?
  3387. if test "$status" -ne 0 && test ! -d "$gentop"; then
  3388. exit $status
  3389. fi
  3390. generated="$generated $gentop"
  3391. for xlib in $convenience; do
  3392. # Extract the objects.
  3393. case $xlib in
  3394. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  3395. *) xabs=`pwd`"/$xlib" ;;
  3396. esac
  3397. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  3398. xdir="$gentop/$xlib"
  3399. $show "${rm}r $xdir"
  3400. $run ${rm}r "$xdir"
  3401. $show "$mkdir $xdir"
  3402. $run $mkdir "$xdir"
  3403. status=$?
  3404. if test "$status" -ne 0 && test ! -d "$xdir"; then
  3405. exit $status
  3406. fi
  3407. # We will extract separately just the conflicting names and we will no
  3408. # longer touch any unique names. It is faster to leave these extract
  3409. # automatically by $AR in one run.
  3410. $show "(cd $xdir && $AR x $xabs)"
  3411. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  3412. if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  3413. :
  3414. else
  3415. $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  3416. $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  3417. $AR t "$xabs" | sort | uniq -cd | while read -r count name
  3418. do
  3419. i=1
  3420. while test "$i" -le "$count"
  3421. do
  3422. # Put our $i before any first dot (extension)
  3423. # Never overwrite any file
  3424. name_to="$name"
  3425. while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  3426. do
  3427. name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  3428. done
  3429. $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  3430. $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  3431. i=`expr $i + 1`
  3432. done
  3433. done
  3434. fi
  3435. libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  3436. done
  3437. fi
  3438. fi
  3439. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  3440. eval flag=\"$thread_safe_flag_spec\"
  3441. linker_flags="$linker_flags $flag"
  3442. fi
  3443. # Make a backup of the uninstalled library when relinking
  3444. if test "$mode" = relink; then
  3445. $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  3446. fi
  3447. # Do each of the archive commands.
  3448. if test "$module" = yes && test -n "$module_cmds" ; then
  3449. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  3450. eval test_cmds=\"$module_expsym_cmds\"
  3451. cmds=$module_expsym_cmds
  3452. else
  3453. eval test_cmds=\"$module_cmds\"
  3454. cmds=$module_cmds
  3455. fi
  3456. else
  3457. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  3458. eval test_cmds=\"$archive_expsym_cmds\"
  3459. cmds=$archive_expsym_cmds
  3460. else
  3461. eval test_cmds=\"$archive_cmds\"
  3462. cmds=$archive_cmds
  3463. fi
  3464. fi
  3465. if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
  3466. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3467. :
  3468. else
  3469. # The command line is too long to link in one step, link piecewise.
  3470. $echo "creating reloadable object files..."
  3471. # Save the value of $output and $libobjs because we want to
  3472. # use them later. If we have whole_archive_flag_spec, we
  3473. # want to use save_libobjs as it was before
  3474. # whole_archive_flag_spec was expanded, because we can't
  3475. # assume the linker understands whole_archive_flag_spec.
  3476. # This may have to be revisited, in case too many
  3477. # convenience libraries get linked in and end up exceeding
  3478. # the spec.
  3479. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  3480. save_libobjs=$libobjs
  3481. fi
  3482. save_output=$output
  3483. # Clear the reloadable object creation command queue and
  3484. # initialize k to one.
  3485. test_cmds=
  3486. concat_cmds=
  3487. objlist=
  3488. delfiles=
  3489. last_robj=
  3490. k=1
  3491. output=$output_objdir/$save_output-${k}.$objext
  3492. # Loop over the list of objects to be linked.
  3493. for obj in $save_libobjs
  3494. do
  3495. eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  3496. if test "X$objlist" = X ||
  3497. { len=`expr "X$test_cmds" : ".*"` &&
  3498. test "$len" -le "$max_cmd_len"; }; then
  3499. objlist="$objlist $obj"
  3500. else
  3501. # The command $test_cmds is almost too long, add a
  3502. # command to the queue.
  3503. if test "$k" -eq 1 ; then
  3504. # The first file doesn't have a previous command to add.
  3505. eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  3506. else
  3507. # All subsequent reloadable object files will link in
  3508. # the last one created.
  3509. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  3510. fi
  3511. last_robj=$output_objdir/$save_output-${k}.$objext
  3512. k=`expr $k + 1`
  3513. output=$output_objdir/$save_output-${k}.$objext
  3514. objlist=$obj
  3515. len=1
  3516. fi
  3517. done
  3518. # Handle the remaining objects by creating one last
  3519. # reloadable object file. All subsequent reloadable object
  3520. # files will link in the last one created.
  3521. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  3522. eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  3523. if ${skipped_export-false}; then
  3524. $show "generating symbol list for \`$libname.la'"
  3525. export_symbols="$output_objdir/$libname.exp"
  3526. $run $rm $export_symbols
  3527. libobjs=$output
  3528. # Append the command to create the export file.
  3529. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  3530. fi
  3531. # Set up a command to remove the reloadale object files
  3532. # after they are used.
  3533. i=0
  3534. while test "$i" -lt "$k"
  3535. do
  3536. i=`expr $i + 1`
  3537. delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
  3538. done
  3539. $echo "creating a temporary reloadable object file: $output"
  3540. # Loop through the commands generated above and execute them.
  3541. save_ifs="$IFS"; IFS='~'
  3542. for cmd in $concat_cmds; do
  3543. IFS="$save_ifs"
  3544. $show "$cmd"
  3545. $run eval "$cmd" || exit $?
  3546. done
  3547. IFS="$save_ifs"
  3548. libobjs=$output
  3549. # Restore the value of output.
  3550. output=$save_output
  3551. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  3552. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  3553. fi
  3554. # Expand the library linking commands again to reset the
  3555. # value of $libobjs for piecewise linking.
  3556. # Do each of the archive commands.
  3557. if test "$module" = yes && test -n "$module_cmds" ; then
  3558. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  3559. cmds=$module_expsym_cmds
  3560. else
  3561. cmds=$module_cmds
  3562. fi
  3563. else
  3564. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  3565. cmds=$archive_expsym_cmds
  3566. else
  3567. cmds=$archive_cmds
  3568. fi
  3569. fi
  3570. # Append the command to remove the reloadable object files
  3571. # to the just-reset $cmds.
  3572. eval cmds=\"\$cmds~\$rm $delfiles\"
  3573. fi
  3574. save_ifs="$IFS"; IFS='~'
  3575. for cmd in $cmds; do
  3576. IFS="$save_ifs"
  3577. eval cmd=\"$cmd\"
  3578. $show "$cmd"
  3579. $run eval "$cmd" || exit $?
  3580. done
  3581. IFS="$save_ifs"
  3582. # Restore the uninstalled library and exit
  3583. if test "$mode" = relink; then
  3584. $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  3585. exit $EXIT_SUCCESS
  3586. fi
  3587. # Create links to the real library.
  3588. for linkname in $linknames; do
  3589. if test "$realname" != "$linkname"; then
  3590. $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  3591. $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  3592. fi
  3593. done
  3594. # If -module or -export-dynamic was specified, set the dlname.
  3595. if test "$module" = yes || test "$export_dynamic" = yes; then
  3596. # On all known operating systems, these are identical.
  3597. dlname="$soname"
  3598. fi
  3599. fi
  3600. ;;
  3601. obj)
  3602. if test -n "$deplibs"; then
  3603. $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  3604. fi
  3605. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3606. $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  3607. fi
  3608. if test -n "$rpath"; then
  3609. $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  3610. fi
  3611. if test -n "$xrpath"; then
  3612. $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  3613. fi
  3614. if test -n "$vinfo"; then
  3615. $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  3616. fi
  3617. if test -n "$release"; then
  3618. $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  3619. fi
  3620. case $output in
  3621. *.lo)
  3622. if test -n "$objs$old_deplibs"; then
  3623. $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  3624. exit $EXIT_FAILURE
  3625. fi
  3626. libobj="$output"
  3627. obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  3628. ;;
  3629. *)
  3630. libobj=
  3631. obj="$output"
  3632. ;;
  3633. esac
  3634. # Delete the old objects.
  3635. $run $rm $obj $libobj
  3636. # Objects from convenience libraries. This assumes
  3637. # single-version convenience libraries. Whenever we create
  3638. # different ones for PIC/non-PIC, this we'll have to duplicate
  3639. # the extraction.
  3640. reload_conv_objs=
  3641. gentop=
  3642. # reload_cmds runs $LD directly, so let us get rid of
  3643. # -Wl from whole_archive_flag_spec
  3644. wl=
  3645. if test -n "$convenience"; then
  3646. if test -n "$whole_archive_flag_spec"; then
  3647. eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  3648. else
  3649. gentop="$output_objdir/${obj}x"
  3650. $show "${rm}r $gentop"
  3651. $run ${rm}r "$gentop"
  3652. $show "$mkdir $gentop"
  3653. $run $mkdir "$gentop"
  3654. status=$?
  3655. if test "$status" -ne 0 && test ! -d "$gentop"; then
  3656. exit $status
  3657. fi
  3658. generated="$generated $gentop"
  3659. for xlib in $convenience; do
  3660. # Extract the objects.
  3661. case $xlib in
  3662. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  3663. *) xabs=`pwd`"/$xlib" ;;
  3664. esac
  3665. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  3666. xdir="$gentop/$xlib"
  3667. $show "${rm}r $xdir"
  3668. $run ${rm}r "$xdir"
  3669. $show "$mkdir $xdir"
  3670. $run $mkdir "$xdir"
  3671. status=$?
  3672. if test "$status" -ne 0 && test ! -d "$xdir"; then
  3673. exit $status
  3674. fi
  3675. # We will extract separately just the conflicting names and we will no
  3676. # longer touch any unique names. It is faster to leave these extract
  3677. # automatically by $AR in one run.
  3678. $show "(cd $xdir && $AR x $xabs)"
  3679. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  3680. if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  3681. :
  3682. else
  3683. $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  3684. $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  3685. $AR t "$xabs" | sort | uniq -cd | while read -r count name
  3686. do
  3687. i=1
  3688. while test "$i" -le "$count"
  3689. do
  3690. # Put our $i before any first dot (extension)
  3691. # Never overwrite any file
  3692. name_to="$name"
  3693. while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  3694. do
  3695. name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  3696. done
  3697. $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  3698. $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  3699. i=`expr $i + 1`
  3700. done
  3701. done
  3702. fi
  3703. reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  3704. done
  3705. fi
  3706. fi
  3707. # Create the old-style object.
  3708. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  3709. output="$obj"
  3710. cmds=$reload_cmds
  3711. save_ifs="$IFS"; IFS='~'
  3712. for cmd in $cmds; do
  3713. IFS="$save_ifs"
  3714. eval cmd=\"$cmd\"
  3715. $show "$cmd"
  3716. $run eval "$cmd" || exit $?
  3717. done
  3718. IFS="$save_ifs"
  3719. # Exit if we aren't doing a library object file.
  3720. if test -z "$libobj"; then
  3721. if test -n "$gentop"; then
  3722. $show "${rm}r $gentop"
  3723. $run ${rm}r $gentop
  3724. fi
  3725. exit $EXIT_SUCCESS
  3726. fi
  3727. if test "$build_libtool_libs" != yes; then
  3728. if test -n "$gentop"; then
  3729. $show "${rm}r $gentop"
  3730. $run ${rm}r $gentop
  3731. fi
  3732. # Create an invalid libtool object if no PIC, so that we don't
  3733. # accidentally link it into a program.
  3734. # $show "echo timestamp > $libobj"
  3735. # $run eval "echo timestamp > $libobj" || exit $?
  3736. exit $EXIT_SUCCESS
  3737. fi
  3738. if test -n "$pic_flag" || test "$pic_mode" != default; then
  3739. # Only do commands if we really have different PIC objects.
  3740. reload_objs="$libobjs $reload_conv_objs"
  3741. output="$libobj"
  3742. cmds=$reload_cmds
  3743. save_ifs="$IFS"; IFS='~'
  3744. for cmd in $cmds; do
  3745. IFS="$save_ifs"
  3746. eval cmd=\"$cmd\"
  3747. $show "$cmd"
  3748. $run eval "$cmd" || exit $?
  3749. done
  3750. IFS="$save_ifs"
  3751. fi
  3752. if test -n "$gentop"; then
  3753. $show "${rm}r $gentop"
  3754. $run ${rm}r $gentop
  3755. fi
  3756. exit $EXIT_SUCCESS
  3757. ;;
  3758. prog)
  3759. case $host in
  3760. *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  3761. esac
  3762. if test -n "$vinfo"; then
  3763. $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  3764. fi
  3765. if test -n "$release"; then
  3766. $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  3767. fi
  3768. if test "$preload" = yes; then
  3769. if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  3770. test "$dlopen_self_static" = unknown; then
  3771. $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  3772. fi
  3773. fi
  3774. case $host in
  3775. *-*-rhapsody* | *-*-darwin1.[012])
  3776. # On Rhapsody replace the C library is the System framework
  3777. compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3778. finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3779. ;;
  3780. esac
  3781. case $host in
  3782. *darwin*)
  3783. # Don't allow lazy linking, it breaks C++ global constructors
  3784. if test "$tagname" = CXX ; then
  3785. compile_command="$compile_command ${wl}-bind_at_load"
  3786. finalize_command="$finalize_command ${wl}-bind_at_load"
  3787. fi
  3788. ;;
  3789. esac
  3790. compile_command="$compile_command $compile_deplibs"
  3791. finalize_command="$finalize_command $finalize_deplibs"
  3792. if test -n "$rpath$xrpath"; then
  3793. # If the user specified any rpath flags, then add them.
  3794. for libdir in $rpath $xrpath; do
  3795. # This is the magic to use -rpath.
  3796. case "$finalize_rpath " in
  3797. *" $libdir "*) ;;
  3798. *) finalize_rpath="$finalize_rpath $libdir" ;;
  3799. esac
  3800. done
  3801. fi
  3802. # Now hardcode the library paths
  3803. rpath=
  3804. hardcode_libdirs=
  3805. for libdir in $compile_rpath $finalize_rpath; do
  3806. if test -n "$hardcode_libdir_flag_spec"; then
  3807. if test -n "$hardcode_libdir_separator"; then
  3808. if test -z "$hardcode_libdirs"; then
  3809. hardcode_libdirs="$libdir"
  3810. else
  3811. # Just accumulate the unique libdirs.
  3812. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3813. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3814. ;;
  3815. *)
  3816. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3817. ;;
  3818. esac
  3819. fi
  3820. else
  3821. eval flag=\"$hardcode_libdir_flag_spec\"
  3822. rpath="$rpath $flag"
  3823. fi
  3824. elif test -n "$runpath_var"; then
  3825. case "$perm_rpath " in
  3826. *" $libdir "*) ;;
  3827. *) perm_rpath="$perm_rpath $libdir" ;;
  3828. esac
  3829. fi
  3830. case $host in
  3831. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  3832. case :$dllsearchpath: in
  3833. *":$libdir:"*) ;;
  3834. *) dllsearchpath="$dllsearchpath:$libdir";;
  3835. esac
  3836. ;;
  3837. esac
  3838. done
  3839. # Substitute the hardcoded libdirs into the rpath.
  3840. if test -n "$hardcode_libdir_separator" &&
  3841. test -n "$hardcode_libdirs"; then
  3842. libdir="$hardcode_libdirs"
  3843. eval rpath=\" $hardcode_libdir_flag_spec\"
  3844. fi
  3845. compile_rpath="$rpath"
  3846. rpath=
  3847. hardcode_libdirs=
  3848. for libdir in $finalize_rpath; do
  3849. if test -n "$hardcode_libdir_flag_spec"; then
  3850. if test -n "$hardcode_libdir_separator"; then
  3851. if test -z "$hardcode_libdirs"; then
  3852. hardcode_libdirs="$libdir"
  3853. else
  3854. # Just accumulate the unique libdirs.
  3855. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3856. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3857. ;;
  3858. *)
  3859. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3860. ;;
  3861. esac
  3862. fi
  3863. else
  3864. eval flag=\"$hardcode_libdir_flag_spec\"
  3865. rpath="$rpath $flag"
  3866. fi
  3867. elif test -n "$runpath_var"; then
  3868. case "$finalize_perm_rpath " in
  3869. *" $libdir "*) ;;
  3870. *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  3871. esac
  3872. fi
  3873. done
  3874. # Substitute the hardcoded libdirs into the rpath.
  3875. if test -n "$hardcode_libdir_separator" &&
  3876. test -n "$hardcode_libdirs"; then
  3877. libdir="$hardcode_libdirs"
  3878. eval rpath=\" $hardcode_libdir_flag_spec\"
  3879. fi
  3880. finalize_rpath="$rpath"
  3881. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  3882. # Transform all the library objects into standard objects.
  3883. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3884. finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3885. fi
  3886. dlsyms=
  3887. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3888. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  3889. dlsyms="${outputname}S.c"
  3890. else
  3891. $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  3892. fi
  3893. fi
  3894. if test -n "$dlsyms"; then
  3895. case $dlsyms in
  3896. "") ;;
  3897. *.c)
  3898. # Discover the nlist of each of the dlfiles.
  3899. nlist="$output_objdir/${outputname}.nm"
  3900. $show "$rm $nlist ${nlist}S ${nlist}T"
  3901. $run $rm "$nlist" "${nlist}S" "${nlist}T"
  3902. # Parse the name list into a source file.
  3903. $show "creating $output_objdir/$dlsyms"
  3904. test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  3905. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  3906. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  3907. #ifdef __cplusplus
  3908. extern \"C\" {
  3909. #endif
  3910. /* Prevent the only kind of declaration conflicts we can make. */
  3911. #define lt_preloaded_symbols some_other_symbol
  3912. /* External symbol declarations for the compiler. */\
  3913. "
  3914. if test "$dlself" = yes; then
  3915. $show "generating symbol list for \`$output'"
  3916. test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  3917. # Add our own program objects to the symbol list.
  3918. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3919. for arg in $progfiles; do
  3920. $show "extracting global C symbols from \`$arg'"
  3921. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  3922. done
  3923. if test -n "$exclude_expsyms"; then
  3924. $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  3925. $run eval '$mv "$nlist"T "$nlist"'
  3926. fi
  3927. if test -n "$export_symbols_regex"; then
  3928. $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  3929. $run eval '$mv "$nlist"T "$nlist"'
  3930. fi
  3931. # Prepare the list of exported symbols
  3932. if test -z "$export_symbols"; then
  3933. export_symbols="$output_objdir/$output.exp"
  3934. $run $rm $export_symbols
  3935. $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  3936. else
  3937. $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  3938. $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  3939. $run eval 'mv "$nlist"T "$nlist"'
  3940. fi
  3941. fi
  3942. for arg in $dlprefiles; do
  3943. $show "extracting global C symbols from \`$arg'"
  3944. name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
  3945. $run eval '$echo ": $name " >> "$nlist"'
  3946. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  3947. done
  3948. if test -z "$run"; then
  3949. # Make sure we have at least an empty file.
  3950. test -f "$nlist" || : > "$nlist"
  3951. if test -n "$exclude_expsyms"; then
  3952. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  3953. $mv "$nlist"T "$nlist"
  3954. fi
  3955. # Try sorting and uniquifying the output.
  3956. if grep -v "^: " < "$nlist" |
  3957. if sort -k 3 </dev/null >/dev/null 2>&1; then
  3958. sort -k 3
  3959. else
  3960. sort +2
  3961. fi |
  3962. uniq > "$nlist"S; then
  3963. :
  3964. else
  3965. grep -v "^: " < "$nlist" > "$nlist"S
  3966. fi
  3967. if test -f "$nlist"S; then
  3968. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  3969. else
  3970. $echo '/* NONE */' >> "$output_objdir/$dlsyms"
  3971. fi
  3972. $echo >> "$output_objdir/$dlsyms" "\
  3973. #undef lt_preloaded_symbols
  3974. #if defined (__STDC__) && __STDC__
  3975. # define lt_ptr void *
  3976. #else
  3977. # define lt_ptr char *
  3978. # define const
  3979. #endif
  3980. /* The mapping between symbol names and symbols. */
  3981. const struct {
  3982. const char *name;
  3983. lt_ptr address;
  3984. }
  3985. lt_preloaded_symbols[] =
  3986. {\
  3987. "
  3988. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
  3989. $echo >> "$output_objdir/$dlsyms" "\
  3990. {0, (lt_ptr) 0}
  3991. };
  3992. /* This works around a problem in FreeBSD linker */
  3993. #ifdef FREEBSD_WORKAROUND
  3994. static const void *lt_preloaded_setup() {
  3995. return lt_preloaded_symbols;
  3996. }
  3997. #endif
  3998. #ifdef __cplusplus
  3999. }
  4000. #endif\
  4001. "
  4002. fi
  4003. pic_flag_for_symtable=
  4004. case $host in
  4005. # compiling the symbol table file with pic_flag works around
  4006. # a FreeBSD bug that causes programs to crash when -lm is
  4007. # linked before any other PIC object. But we must not use
  4008. # pic_flag when linking with -static. The problem exists in
  4009. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4010. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4011. case "$compile_command " in
  4012. *" -static "*) ;;
  4013. *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
  4014. esac;;
  4015. *-*-hpux*)
  4016. case "$compile_command " in
  4017. *" -static "*) ;;
  4018. *) pic_flag_for_symtable=" $pic_flag";;
  4019. esac
  4020. esac
  4021. # Now compile the dynamic symbol file.
  4022. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  4023. $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  4024. # Clean up the generated files.
  4025. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  4026. $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  4027. # Transform the symbol file into the correct name.
  4028. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4029. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4030. ;;
  4031. *)
  4032. $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  4033. exit $EXIT_FAILURE
  4034. ;;
  4035. esac
  4036. else
  4037. # We keep going just in case the user didn't refer to
  4038. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4039. # really was required.
  4040. # Nullify the symbol file.
  4041. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  4042. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  4043. fi
  4044. if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  4045. # Replace the output file specification.
  4046. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4047. link_command="$compile_command$compile_rpath"
  4048. # We have no uninstalled library dependencies, so finalize right now.
  4049. $show "$link_command"
  4050. $run eval "$link_command"
  4051. status=$?
  4052. # Delete the generated files.
  4053. if test -n "$dlsyms"; then
  4054. $show "$rm $output_objdir/${outputname}S.${objext}"
  4055. $run $rm "$output_objdir/${outputname}S.${objext}"
  4056. fi
  4057. exit $status
  4058. fi
  4059. if test -n "$shlibpath_var"; then
  4060. # We should set the shlibpath_var
  4061. rpath=
  4062. for dir in $temp_rpath; do
  4063. case $dir in
  4064. [\\/]* | [A-Za-z]:[\\/]*)
  4065. # Absolute path.
  4066. rpath="$rpath$dir:"
  4067. ;;
  4068. *)
  4069. # Relative path: add a thisdir entry.
  4070. rpath="$rpath\$thisdir/$dir:"
  4071. ;;
  4072. esac
  4073. done
  4074. temp_rpath="$rpath"
  4075. fi
  4076. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  4077. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  4078. fi
  4079. if test -n "$finalize_shlibpath"; then
  4080. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  4081. fi
  4082. compile_var=
  4083. finalize_var=
  4084. if test -n "$runpath_var"; then
  4085. if test -n "$perm_rpath"; then
  4086. # We should set the runpath_var.
  4087. rpath=
  4088. for dir in $perm_rpath; do
  4089. rpath="$rpath$dir:"
  4090. done
  4091. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4092. fi
  4093. if test -n "$finalize_perm_rpath"; then
  4094. # We should set the runpath_var.
  4095. rpath=
  4096. for dir in $finalize_perm_rpath; do
  4097. rpath="$rpath$dir:"
  4098. done
  4099. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4100. fi
  4101. fi
  4102. if test "$no_install" = yes; then
  4103. # We don't need to create a wrapper script.
  4104. link_command="$compile_var$compile_command$compile_rpath"
  4105. # Replace the output file specification.
  4106. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4107. # Delete the old output file.
  4108. $run $rm $output
  4109. # Link the executable and exit
  4110. $show "$link_command"
  4111. $run eval "$link_command" || exit $?
  4112. exit $EXIT_SUCCESS
  4113. fi
  4114. if test "$hardcode_action" = relink; then
  4115. # Fast installation is not supported
  4116. link_command="$compile_var$compile_command$compile_rpath"
  4117. relink_command="$finalize_var$finalize_command$finalize_rpath"
  4118. $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  4119. $echo "$modename: \`$output' will be relinked during installation" 1>&2
  4120. else
  4121. if test "$fast_install" != no; then
  4122. link_command="$finalize_var$compile_command$finalize_rpath"
  4123. if test "$fast_install" = yes; then
  4124. relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  4125. else
  4126. # fast_install is set to needless
  4127. relink_command=
  4128. fi
  4129. else
  4130. link_command="$compile_var$compile_command$compile_rpath"
  4131. relink_command="$finalize_var$finalize_command$finalize_rpath"
  4132. fi
  4133. fi
  4134. # Replace the output file specification.
  4135. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  4136. # Delete the old output files.
  4137. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  4138. $show "$link_command"
  4139. $run eval "$link_command" || exit $?
  4140. # Now create the wrapper script.
  4141. $show "creating $output"
  4142. # Quote the relink command for shipping.
  4143. if test -n "$relink_command"; then
  4144. # Preserve any variables that may affect compiler behavior
  4145. for var in $variables_saved_for_relink; do
  4146. if eval test -z \"\${$var+set}\"; then
  4147. relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  4148. elif eval var_value=\$$var; test -z "$var_value"; then
  4149. relink_command="$var=; export $var; $relink_command"
  4150. else
  4151. var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  4152. relink_command="$var=\"$var_value\"; export $var; $relink_command"
  4153. fi
  4154. done
  4155. relink_command="(cd `pwd`; $relink_command)"
  4156. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  4157. fi
  4158. # Quote $echo for shipping.
  4159. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
  4160. case $progpath in
  4161. [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
  4162. *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
  4163. esac
  4164. qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  4165. else
  4166. qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  4167. fi
  4168. # Only actually do things if our run command is non-null.
  4169. if test -z "$run"; then
  4170. # win32 will think the script is a binary if it has
  4171. # a .exe suffix, so we strip it off here.
  4172. case $output in
  4173. *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
  4174. esac
  4175. # test for cygwin because mv fails w/o .exe extensions
  4176. case $host in
  4177. *cygwin*)
  4178. exeext=.exe
  4179. outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
  4180. *) exeext= ;;
  4181. esac
  4182. case $host in
  4183. *cygwin* | *mingw* )
  4184. cwrappersource=`$echo ${objdir}/lt-${output}.c`
  4185. cwrapper=`$echo ${output}.exe`
  4186. $rm $cwrappersource $cwrapper
  4187. trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  4188. cat > $cwrappersource <<EOF
  4189. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  4190. Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4191. The $output program cannot be directly executed until all the libtool
  4192. libraries that it depends on are installed.
  4193. This wrapper executable should never be moved out of the build directory.
  4194. If it is, it will not operate correctly.
  4195. Currently, it simply execs the wrapper *script* "/bin/sh $output",
  4196. but could eventually absorb all of the scripts functionality and
  4197. exec $objdir/$outputname directly.
  4198. */
  4199. EOF
  4200. cat >> $cwrappersource<<"EOF"
  4201. #include <stdio.h>
  4202. #include <stdlib.h>
  4203. #include <unistd.h>
  4204. #include <malloc.h>
  4205. #include <stdarg.h>
  4206. #include <assert.h>
  4207. #if defined(PATH_MAX)
  4208. # define LT_PATHMAX PATH_MAX
  4209. #elif defined(MAXPATHLEN)
  4210. # define LT_PATHMAX MAXPATHLEN
  4211. #else
  4212. # define LT_PATHMAX 1024
  4213. #endif
  4214. #ifndef DIR_SEPARATOR
  4215. #define DIR_SEPARATOR '/'
  4216. #endif
  4217. #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  4218. defined (__OS2__)
  4219. #define HAVE_DOS_BASED_FILE_SYSTEM
  4220. #ifndef DIR_SEPARATOR_2
  4221. #define DIR_SEPARATOR_2 '\\'
  4222. #endif
  4223. #endif
  4224. #ifndef DIR_SEPARATOR_2
  4225. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  4226. #else /* DIR_SEPARATOR_2 */
  4227. # define IS_DIR_SEPARATOR(ch) \
  4228. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  4229. #endif /* DIR_SEPARATOR_2 */
  4230. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  4231. #define XFREE(stale) do { \
  4232. if (stale) { free ((void *) stale); stale = 0; } \
  4233. } while (0)
  4234. const char *program_name = NULL;
  4235. void * xmalloc (size_t num);
  4236. char * xstrdup (const char *string);
  4237. char * basename (const char *name);
  4238. char * fnqualify(const char *path);
  4239. char * strendzap(char *str, const char *pat);
  4240. void lt_fatal (const char *message, ...);
  4241. int
  4242. main (int argc, char *argv[])
  4243. {
  4244. char **newargz;
  4245. int i;
  4246. program_name = (char *) xstrdup ((char *) basename (argv[0]));
  4247. newargz = XMALLOC(char *, argc+2);
  4248. EOF
  4249. cat >> $cwrappersource <<EOF
  4250. newargz[0] = "$SHELL";
  4251. EOF
  4252. cat >> $cwrappersource <<"EOF"
  4253. newargz[1] = fnqualify(argv[0]);
  4254. /* we know the script has the same name, without the .exe */
  4255. /* so make sure newargz[1] doesn't end in .exe */
  4256. strendzap(newargz[1],".exe");
  4257. for (i = 1; i < argc; i++)
  4258. newargz[i+1] = xstrdup(argv[i]);
  4259. newargz[argc+1] = NULL;
  4260. EOF
  4261. cat >> $cwrappersource <<EOF
  4262. execv("$SHELL",newargz);
  4263. EOF
  4264. cat >> $cwrappersource <<"EOF"
  4265. }
  4266. void *
  4267. xmalloc (size_t num)
  4268. {
  4269. void * p = (void *) malloc (num);
  4270. if (!p)
  4271. lt_fatal ("Memory exhausted");
  4272. return p;
  4273. }
  4274. char *
  4275. xstrdup (const char *string)
  4276. {
  4277. return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
  4278. ;
  4279. }
  4280. char *
  4281. basename (const char *name)
  4282. {
  4283. const char *base;
  4284. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4285. /* Skip over the disk name in MSDOS pathnames. */
  4286. if (isalpha (name[0]) && name[1] == ':')
  4287. name += 2;
  4288. #endif
  4289. for (base = name; *name; name++)
  4290. if (IS_DIR_SEPARATOR (*name))
  4291. base = name + 1;
  4292. return (char *) base;
  4293. }
  4294. char *
  4295. fnqualify(const char *path)
  4296. {
  4297. size_t size;
  4298. char *p;
  4299. char tmp[LT_PATHMAX + 1];
  4300. assert(path != NULL);
  4301. /* Is it qualified already? */
  4302. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4303. if (isalpha (path[0]) && path[1] == ':')
  4304. return xstrdup (path);
  4305. #endif
  4306. if (IS_DIR_SEPARATOR (path[0]))
  4307. return xstrdup (path);
  4308. /* prepend the current directory */
  4309. /* doesn't handle '~' */
  4310. if (getcwd (tmp, LT_PATHMAX) == NULL)
  4311. lt_fatal ("getcwd failed");
  4312. size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
  4313. p = XMALLOC(char, size);
  4314. sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
  4315. return p;
  4316. }
  4317. char *
  4318. strendzap(char *str, const char *pat)
  4319. {
  4320. size_t len, patlen;
  4321. assert(str != NULL);
  4322. assert(pat != NULL);
  4323. len = strlen(str);
  4324. patlen = strlen(pat);
  4325. if (patlen <= len)
  4326. {
  4327. str += len - patlen;
  4328. if (strcmp(str, pat) == 0)
  4329. *str = '\0';
  4330. }
  4331. return str;
  4332. }
  4333. static void
  4334. lt_error_core (int exit_status, const char * mode,
  4335. const char * message, va_list ap)
  4336. {
  4337. fprintf (stderr, "%s: %s: ", program_name, mode);
  4338. vfprintf (stderr, message, ap);
  4339. fprintf (stderr, ".\n");
  4340. if (exit_status >= 0)
  4341. exit (exit_status);
  4342. }
  4343. void
  4344. lt_fatal (const char *message, ...)
  4345. {
  4346. va_list ap;
  4347. va_start (ap, message);
  4348. lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  4349. va_end (ap);
  4350. }
  4351. EOF
  4352. # we should really use a build-platform specific compiler
  4353. # here, but OTOH, the wrappers (shell script and this C one)
  4354. # are only useful if you want to execute the "real" binary.
  4355. # Since the "real" binary is built for $host, then this
  4356. # wrapper might as well be built for $host, too.
  4357. $run $LTCC -s -o $cwrapper $cwrappersource
  4358. ;;
  4359. esac
  4360. $rm $output
  4361. trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  4362. $echo > $output "\
  4363. #! $SHELL
  4364. # $output - temporary wrapper script for $objdir/$outputname
  4365. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4366. #
  4367. # The $output program cannot be directly executed until all the libtool
  4368. # libraries that it depends on are installed.
  4369. #
  4370. # This wrapper script should never be moved out of the build directory.
  4371. # If it is, it will not operate correctly.
  4372. # Sed substitution that helps us do robust quoting. It backslashifies
  4373. # metacharacters that are still active within double-quoted strings.
  4374. Xsed='${SED} -e 1s/^X//'
  4375. sed_quote_subst='$sed_quote_subst'
  4376. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4377. # if CDPATH is set.
  4378. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  4379. relink_command=\"$relink_command\"
  4380. # This environment variable determines our operation mode.
  4381. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4382. # install mode needs the following variable:
  4383. notinst_deplibs='$notinst_deplibs'
  4384. else
  4385. # When we are sourced in execute mode, \$file and \$echo are already set.
  4386. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4387. echo=\"$qecho\"
  4388. file=\"\$0\"
  4389. # Make sure echo works.
  4390. if test \"X\$1\" = X--no-reexec; then
  4391. # Discard the --no-reexec flag, and continue.
  4392. shift
  4393. elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  4394. # Yippee, \$echo works!
  4395. :
  4396. else
  4397. # Restart under the correct shell, and then maybe \$echo will work.
  4398. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  4399. fi
  4400. fi\
  4401. "
  4402. $echo >> $output "\
  4403. # Find the directory that this script lives in.
  4404. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  4405. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4406. # Follow symbolic links until we get to the real thisdir.
  4407. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  4408. while test -n \"\$file\"; do
  4409. destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  4410. # If there was a directory component, then change thisdir.
  4411. if test \"x\$destdir\" != \"x\$file\"; then
  4412. case \"\$destdir\" in
  4413. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4414. *) thisdir=\"\$thisdir/\$destdir\" ;;
  4415. esac
  4416. fi
  4417. file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  4418. file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  4419. done
  4420. # Try to get the absolute directory name.
  4421. absdir=\`cd \"\$thisdir\" && pwd\`
  4422. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4423. "
  4424. if test "$fast_install" = yes; then
  4425. $echo >> $output "\
  4426. program=lt-'$outputname'$exeext
  4427. progdir=\"\$thisdir/$objdir\"
  4428. if test ! -f \"\$progdir/\$program\" || \\
  4429. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  4430. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  4431. file=\"\$\$-\$program\"
  4432. if test ! -d \"\$progdir\"; then
  4433. $mkdir \"\$progdir\"
  4434. else
  4435. $rm \"\$progdir/\$file\"
  4436. fi"
  4437. $echo >> $output "\
  4438. # relink executable if necessary
  4439. if test -n \"\$relink_command\"; then
  4440. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  4441. else
  4442. $echo \"\$relink_command_output\" >&2
  4443. $rm \"\$progdir/\$file\"
  4444. exit $EXIT_FAILURE
  4445. fi
  4446. fi
  4447. $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  4448. { $rm \"\$progdir/\$program\";
  4449. $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  4450. $rm \"\$progdir/\$file\"
  4451. fi"
  4452. else
  4453. $echo >> $output "\
  4454. program='$outputname'
  4455. progdir=\"\$thisdir/$objdir\"
  4456. "
  4457. fi
  4458. $echo >> $output "\
  4459. if test -f \"\$progdir/\$program\"; then"
  4460. # Export our shlibpath_var if we have one.
  4461. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  4462. $echo >> $output "\
  4463. # Add our own library path to $shlibpath_var
  4464. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  4465. # Some systems cannot cope with colon-terminated $shlibpath_var
  4466. # The second colon is a workaround for a bug in BeOS R4 sed
  4467. $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  4468. export $shlibpath_var
  4469. "
  4470. fi
  4471. # fixup the dll searchpath if we need to.
  4472. if test -n "$dllsearchpath"; then
  4473. $echo >> $output "\
  4474. # Add the dll search path components to the executable PATH
  4475. PATH=$dllsearchpath:\$PATH
  4476. "
  4477. fi
  4478. $echo >> $output "\
  4479. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4480. # Run the actual program with our arguments.
  4481. "
  4482. case $host in
  4483. # Backslashes separate directories on plain windows
  4484. *-*-mingw | *-*-os2*)
  4485. $echo >> $output "\
  4486. exec \$progdir\\\\\$program \${1+\"\$@\"}
  4487. "
  4488. ;;
  4489. *)
  4490. $echo >> $output "\
  4491. exec \$progdir/\$program \${1+\"\$@\"}
  4492. "
  4493. ;;
  4494. esac
  4495. $echo >> $output "\
  4496. \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  4497. exit $EXIT_FAILURE
  4498. fi
  4499. else
  4500. # The program doesn't exist.
  4501. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  4502. \$echo \"This script is just a wrapper for \$program.\" 1>&2
  4503. $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  4504. exit $EXIT_FAILURE
  4505. fi
  4506. fi\
  4507. "
  4508. chmod +x $output
  4509. fi
  4510. exit $EXIT_SUCCESS
  4511. ;;
  4512. esac
  4513. # See if we need to build an old-fashioned archive.
  4514. for oldlib in $oldlibs; do
  4515. if test "$build_libtool_libs" = convenience; then
  4516. oldobjs="$libobjs_save"
  4517. addlibs="$convenience"
  4518. build_libtool_libs=no
  4519. else
  4520. if test "$build_libtool_libs" = module; then
  4521. oldobjs="$libobjs_save"
  4522. build_libtool_libs=no
  4523. else
  4524. oldobjs="$old_deplibs $non_pic_objects"
  4525. fi
  4526. addlibs="$old_convenience"
  4527. fi
  4528. if test -n "$addlibs"; then
  4529. gentop="$output_objdir/${outputname}x"
  4530. $show "${rm}r $gentop"
  4531. $run ${rm}r "$gentop"
  4532. $show "$mkdir $gentop"
  4533. $run $mkdir "$gentop"
  4534. status=$?
  4535. if test "$status" -ne 0 && test ! -d "$gentop"; then
  4536. exit $status
  4537. fi
  4538. generated="$generated $gentop"
  4539. # Add in members from convenience archives.
  4540. for xlib in $addlibs; do
  4541. # Extract the objects.
  4542. case $xlib in
  4543. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  4544. *) xabs=`pwd`"/$xlib" ;;
  4545. esac
  4546. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  4547. xdir="$gentop/$xlib"
  4548. $show "${rm}r $xdir"
  4549. $run ${rm}r "$xdir"
  4550. $show "$mkdir $xdir"
  4551. $run $mkdir "$xdir"
  4552. status=$?
  4553. if test "$status" -ne 0 && test ! -d "$xdir"; then
  4554. exit $status
  4555. fi
  4556. # We will extract separately just the conflicting names and we will no
  4557. # longer touch any unique names. It is faster to leave these extract
  4558. # automatically by $AR in one run.
  4559. $show "(cd $xdir && $AR x $xabs)"
  4560. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  4561. if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  4562. :
  4563. else
  4564. $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  4565. $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  4566. $AR t "$xabs" | sort | uniq -cd | while read -r count name
  4567. do
  4568. i=1
  4569. while test "$i" -le "$count"
  4570. do
  4571. # Put our $i before any first dot (extension)
  4572. # Never overwrite any file
  4573. name_to="$name"
  4574. while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  4575. do
  4576. name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  4577. done
  4578. $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  4579. $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  4580. i=`expr $i + 1`
  4581. done
  4582. done
  4583. fi
  4584. oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  4585. done
  4586. fi
  4587. # Do each command in the archive commands.
  4588. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  4589. cmds=$old_archive_from_new_cmds
  4590. else
  4591. eval cmds=\"$old_archive_cmds\"
  4592. if len=`expr "X$cmds" : ".*"` &&
  4593. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  4594. cmds=$old_archive_cmds
  4595. else
  4596. # the command line is too long to link in one step, link in parts
  4597. $echo "using piecewise archive linking..."
  4598. save_RANLIB=$RANLIB
  4599. RANLIB=:
  4600. objlist=
  4601. concat_cmds=
  4602. save_oldobjs=$oldobjs
  4603. # GNU ar 2.10+ was changed to match POSIX; thus no paths are
  4604. # encoded into archives. This makes 'ar r' malfunction in
  4605. # this piecewise linking case whenever conflicting object
  4606. # names appear in distinct ar calls; check, warn and compensate.
  4607. if (for obj in $save_oldobjs
  4608. do
  4609. $echo "X$obj" | $Xsed -e 's%^.*/%%'
  4610. done | sort | sort -uc >/dev/null 2>&1); then
  4611. :
  4612. else
  4613. $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
  4614. $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
  4615. AR_FLAGS=cq
  4616. fi
  4617. # Is there a better way of finding the last object in the list?
  4618. for obj in $save_oldobjs
  4619. do
  4620. last_oldobj=$obj
  4621. done
  4622. for obj in $save_oldobjs
  4623. do
  4624. oldobjs="$objlist $obj"
  4625. objlist="$objlist $obj"
  4626. eval test_cmds=\"$old_archive_cmds\"
  4627. if len=`expr "X$test_cmds" : ".*"` &&
  4628. test "$len" -le "$max_cmd_len"; then
  4629. :
  4630. else
  4631. # the above command should be used before it gets too long
  4632. oldobjs=$objlist
  4633. if test "$obj" = "$last_oldobj" ; then
  4634. RANLIB=$save_RANLIB
  4635. fi
  4636. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  4637. eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  4638. objlist=
  4639. fi
  4640. done
  4641. RANLIB=$save_RANLIB
  4642. oldobjs=$objlist
  4643. if test "X$oldobjs" = "X" ; then
  4644. eval cmds=\"\$concat_cmds\"
  4645. else
  4646. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  4647. fi
  4648. fi
  4649. fi
  4650. save_ifs="$IFS"; IFS='~'
  4651. for cmd in $cmds; do
  4652. eval cmd=\"$cmd\"
  4653. IFS="$save_ifs"
  4654. $show "$cmd"
  4655. $run eval "$cmd" || exit $?
  4656. done
  4657. IFS="$save_ifs"
  4658. done
  4659. if test -n "$generated"; then
  4660. $show "${rm}r$generated"
  4661. $run ${rm}r$generated
  4662. fi
  4663. # Now create the libtool archive.
  4664. case $output in
  4665. *.la)
  4666. old_library=
  4667. test "$build_old_libs" = yes && old_library="$libname.$libext"
  4668. $show "creating $output"
  4669. # Preserve any variables that may affect compiler behavior
  4670. for var in $variables_saved_for_relink; do
  4671. if eval test -z \"\${$var+set}\"; then
  4672. relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  4673. elif eval var_value=\$$var; test -z "$var_value"; then
  4674. relink_command="$var=; export $var; $relink_command"
  4675. else
  4676. var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  4677. relink_command="$var=\"$var_value\"; export $var; $relink_command"
  4678. fi
  4679. done
  4680. # Quote the link command for shipping.
  4681. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  4682. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  4683. if test "$hardcode_automatic" = yes ; then
  4684. relink_command=
  4685. fi
  4686. # Only create the output if not a dry run.
  4687. if test -z "$run"; then
  4688. for installed in no yes; do
  4689. if test "$installed" = yes; then
  4690. if test -z "$install_libdir"; then
  4691. break
  4692. fi
  4693. output="$output_objdir/$outputname"i
  4694. # Replace all uninstalled libtool libraries with the installed ones
  4695. newdependency_libs=
  4696. for deplib in $dependency_libs; do
  4697. case $deplib in
  4698. *.la)
  4699. name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  4700. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  4701. if test -z "$libdir"; then
  4702. $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  4703. exit $EXIT_FAILURE
  4704. fi
  4705. newdependency_libs="$newdependency_libs $libdir/$name"
  4706. ;;
  4707. *) newdependency_libs="$newdependency_libs $deplib" ;;
  4708. esac
  4709. done
  4710. dependency_libs="$newdependency_libs"
  4711. newdlfiles=
  4712. for lib in $dlfiles; do
  4713. name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  4714. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  4715. if test -z "$libdir"; then
  4716. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  4717. exit $EXIT_FAILURE
  4718. fi
  4719. newdlfiles="$newdlfiles $libdir/$name"
  4720. done
  4721. dlfiles="$newdlfiles"
  4722. newdlprefiles=
  4723. for lib in $dlprefiles; do
  4724. name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  4725. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  4726. if test -z "$libdir"; then
  4727. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  4728. exit $EXIT_FAILURE
  4729. fi
  4730. newdlprefiles="$newdlprefiles $libdir/$name"
  4731. done
  4732. dlprefiles="$newdlprefiles"
  4733. else
  4734. newdlfiles=
  4735. for lib in $dlfiles; do
  4736. case $lib in
  4737. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  4738. *) abs=`pwd`"/$lib" ;;
  4739. esac
  4740. newdlfiles="$newdlfiles $abs"
  4741. done
  4742. dlfiles="$newdlfiles"
  4743. newdlprefiles=
  4744. for lib in $dlprefiles; do
  4745. case $lib in
  4746. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  4747. *) abs=`pwd`"/$lib" ;;
  4748. esac
  4749. newdlprefiles="$newdlprefiles $abs"
  4750. done
  4751. dlprefiles="$newdlprefiles"
  4752. fi
  4753. $rm $output
  4754. # place dlname in correct position for cygwin
  4755. tdlname=$dlname
  4756. case $host,$output,$installed,$module,$dlname in
  4757. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  4758. esac
  4759. $echo > $output "\
  4760. # $outputname - a libtool library file
  4761. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4762. #
  4763. # Please DO NOT delete this file!
  4764. # It is necessary for linking the library.
  4765. # The name that we can dlopen(3).
  4766. dlname='$tdlname'
  4767. # Names of this library.
  4768. library_names='$library_names'
  4769. # The name of the static archive.
  4770. old_library='$old_library'
  4771. # Libraries that this one depends upon.
  4772. dependency_libs='$dependency_libs'
  4773. # Version information for $libname.
  4774. current=$current
  4775. age=$age
  4776. revision=$revision
  4777. # Is this an already installed library?
  4778. installed=$installed
  4779. # Should we warn about portability when linking against -modules?
  4780. shouldnotlink=$module
  4781. # Files to dlopen/dlpreopen
  4782. dlopen='$dlfiles'
  4783. dlpreopen='$dlprefiles'
  4784. # Directory that this library needs to be installed in:
  4785. libdir='$install_libdir'"
  4786. if test "$installed" = no && test "$need_relink" = yes; then
  4787. $echo >> $output "\
  4788. relink_command=\"$relink_command\""
  4789. fi
  4790. done
  4791. fi
  4792. # Do a symbolic link so that the libtool archive can be found in
  4793. # LD_LIBRARY_PATH before the program is installed.
  4794. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  4795. $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  4796. ;;
  4797. esac
  4798. exit $EXIT_SUCCESS
  4799. ;;
  4800. # libtool install mode
  4801. install)
  4802. modename="$modename: install"
  4803. # There may be an optional sh(1) argument at the beginning of
  4804. # install_prog (especially on Windows NT).
  4805. if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  4806. # Allow the use of GNU shtool's install command.
  4807. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
  4808. # Aesthetically quote it.
  4809. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  4810. case $arg in
  4811. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  4812. arg="\"$arg\""
  4813. ;;
  4814. esac
  4815. install_prog="$arg "
  4816. arg="$1"
  4817. shift
  4818. else
  4819. install_prog=
  4820. arg="$nonopt"
  4821. fi
  4822. # The real first argument should be the name of the installation program.
  4823. # Aesthetically quote it.
  4824. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  4825. case $arg in
  4826. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  4827. arg="\"$arg\""
  4828. ;;
  4829. esac
  4830. install_prog="$install_prog$arg"
  4831. # We need to accept at least all the BSD install flags.
  4832. dest=
  4833. files=
  4834. opts=
  4835. prev=
  4836. install_type=
  4837. isdir=no
  4838. stripme=
  4839. for arg
  4840. do
  4841. if test -n "$dest"; then
  4842. files="$files $dest"
  4843. dest="$arg"
  4844. continue
  4845. fi
  4846. case $arg in
  4847. -d) isdir=yes ;;
  4848. -f) prev="-f" ;;
  4849. -g) prev="-g" ;;
  4850. -m) prev="-m" ;;
  4851. -o) prev="-o" ;;
  4852. -s)
  4853. stripme=" -s"
  4854. continue
  4855. ;;
  4856. -*) ;;
  4857. *)
  4858. # If the previous option needed an argument, then skip it.
  4859. if test -n "$prev"; then
  4860. prev=
  4861. else
  4862. dest="$arg"
  4863. continue
  4864. fi
  4865. ;;
  4866. esac
  4867. # Aesthetically quote the argument.
  4868. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  4869. case $arg in
  4870. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  4871. arg="\"$arg\""
  4872. ;;
  4873. esac
  4874. install_prog="$install_prog $arg"
  4875. done
  4876. if test -z "$install_prog"; then
  4877. $echo "$modename: you must specify an install program" 1>&2
  4878. $echo "$help" 1>&2
  4879. exit $EXIT_FAILURE
  4880. fi
  4881. if test -n "$prev"; then
  4882. $echo "$modename: the \`$prev' option requires an argument" 1>&2
  4883. $echo "$help" 1>&2
  4884. exit $EXIT_FAILURE
  4885. fi
  4886. if test -z "$files"; then
  4887. if test -z "$dest"; then
  4888. $echo "$modename: no file or destination specified" 1>&2
  4889. else
  4890. $echo "$modename: you must specify a destination" 1>&2
  4891. fi
  4892. $echo "$help" 1>&2
  4893. exit $EXIT_FAILURE
  4894. fi
  4895. # Strip any trailing slash from the destination.
  4896. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  4897. # Check to see that the destination is a directory.
  4898. test -d "$dest" && isdir=yes
  4899. if test "$isdir" = yes; then
  4900. destdir="$dest"
  4901. destname=
  4902. else
  4903. destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  4904. test "X$destdir" = "X$dest" && destdir=.
  4905. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  4906. # Not a directory, so check to see that there is only one file specified.
  4907. set dummy $files
  4908. if test "$#" -gt 2; then
  4909. $echo "$modename: \`$dest' is not a directory" 1>&2
  4910. $echo "$help" 1>&2
  4911. exit $EXIT_FAILURE
  4912. fi
  4913. fi
  4914. case $destdir in
  4915. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4916. *)
  4917. for file in $files; do
  4918. case $file in
  4919. *.lo) ;;
  4920. *)
  4921. $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  4922. $echo "$help" 1>&2
  4923. exit $EXIT_FAILURE
  4924. ;;
  4925. esac
  4926. done
  4927. ;;
  4928. esac
  4929. # This variable tells wrapper scripts just to set variables rather
  4930. # than running their programs.
  4931. libtool_install_magic="$magic"
  4932. staticlibs=
  4933. future_libdirs=
  4934. current_libdirs=
  4935. for file in $files; do
  4936. # Do each installation.
  4937. case $file in
  4938. *.$libext)
  4939. # Do the static libraries later.
  4940. staticlibs="$staticlibs $file"
  4941. ;;
  4942. *.la)
  4943. # Check to see that this really is a libtool archive.
  4944. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  4945. else
  4946. $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  4947. $echo "$help" 1>&2
  4948. exit $EXIT_FAILURE
  4949. fi
  4950. library_names=
  4951. old_library=
  4952. relink_command=
  4953. # If there is no directory component, then add one.
  4954. case $file in
  4955. */* | *\\*) . $file ;;
  4956. *) . ./$file ;;
  4957. esac
  4958. # Add the libdir to current_libdirs if it is the destination.
  4959. if test "X$destdir" = "X$libdir"; then
  4960. case "$current_libdirs " in
  4961. *" $libdir "*) ;;
  4962. *) current_libdirs="$current_libdirs $libdir" ;;
  4963. esac
  4964. else
  4965. # Note the libdir as a future libdir.
  4966. case "$future_libdirs " in
  4967. *" $libdir "*) ;;
  4968. *) future_libdirs="$future_libdirs $libdir" ;;
  4969. esac
  4970. fi
  4971. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
  4972. test "X$dir" = "X$file/" && dir=
  4973. dir="$dir$objdir"
  4974. if test -n "$relink_command"; then
  4975. # Determine the prefix the user has applied to our future dir.
  4976. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
  4977. # Don't allow the user to place us outside of our expected
  4978. # location b/c this prevents finding dependent libraries that
  4979. # are installed to the same prefix.
  4980. # At present, this check doesn't affect windows .dll's that
  4981. # are installed into $libdir/../bin (currently, that works fine)
  4982. # but it's something to keep an eye on.
  4983. if test "$inst_prefix_dir" = "$destdir"; then
  4984. $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
  4985. exit $EXIT_FAILURE
  4986. fi
  4987. if test -n "$inst_prefix_dir"; then
  4988. # Stick the inst_prefix_dir data into the link command.
  4989. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  4990. else
  4991. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  4992. fi
  4993. $echo "$modename: warning: relinking \`$file'" 1>&2
  4994. $show "$relink_command"
  4995. if $run eval "$relink_command"; then :
  4996. else
  4997. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  4998. exit $EXIT_FAILURE
  4999. fi
  5000. fi
  5001. # See the names of the shared library.
  5002. set dummy $library_names
  5003. if test -n "$2"; then
  5004. realname="$2"
  5005. shift
  5006. shift
  5007. srcname="$realname"
  5008. test -n "$relink_command" && srcname="$realname"T
  5009. # Install the shared library and build the symlinks.
  5010. $show "$install_prog $dir/$srcname $destdir/$realname"
  5011. $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  5012. if test -n "$stripme" && test -n "$striplib"; then
  5013. $show "$striplib $destdir/$realname"
  5014. $run eval "$striplib $destdir/$realname" || exit $?
  5015. fi
  5016. if test "$#" -gt 0; then
  5017. # Delete the old symlinks, and create new ones.
  5018. for linkname
  5019. do
  5020. if test "$linkname" != "$realname"; then
  5021. $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  5022. $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  5023. fi
  5024. done
  5025. fi
  5026. # Do each command in the postinstall commands.
  5027. lib="$destdir/$realname"
  5028. cmds=$postinstall_cmds
  5029. save_ifs="$IFS"; IFS='~'
  5030. for cmd in $cmds; do
  5031. IFS="$save_ifs"
  5032. eval cmd=\"$cmd\"
  5033. $show "$cmd"
  5034. $run eval "$cmd" || exit $?
  5035. done
  5036. IFS="$save_ifs"
  5037. fi
  5038. # Install the pseudo-library for information purposes.
  5039. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5040. instname="$dir/$name"i
  5041. $show "$install_prog $instname $destdir/$name"
  5042. $run eval "$install_prog $instname $destdir/$name" || exit $?
  5043. # Maybe install the static library, too.
  5044. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  5045. ;;
  5046. *.lo)
  5047. # Install (i.e. copy) a libtool object.
  5048. # Figure out destination file name, if it wasn't already specified.
  5049. if test -n "$destname"; then
  5050. destfile="$destdir/$destname"
  5051. else
  5052. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5053. destfile="$destdir/$destfile"
  5054. fi
  5055. # Deduce the name of the destination old-style object file.
  5056. case $destfile in
  5057. *.lo)
  5058. staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  5059. ;;
  5060. *.$objext)
  5061. staticdest="$destfile"
  5062. destfile=
  5063. ;;
  5064. *)
  5065. $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  5066. $echo "$help" 1>&2
  5067. exit $EXIT_FAILURE
  5068. ;;
  5069. esac
  5070. # Install the libtool object if requested.
  5071. if test -n "$destfile"; then
  5072. $show "$install_prog $file $destfile"
  5073. $run eval "$install_prog $file $destfile" || exit $?
  5074. fi
  5075. # Install the old object if enabled.
  5076. if test "$build_old_libs" = yes; then
  5077. # Deduce the name of the old-style object file.
  5078. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  5079. $show "$install_prog $staticobj $staticdest"
  5080. $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  5081. fi
  5082. exit $EXIT_SUCCESS
  5083. ;;
  5084. *)
  5085. # Figure out destination file name, if it wasn't already specified.
  5086. if test -n "$destname"; then
  5087. destfile="$destdir/$destname"
  5088. else
  5089. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5090. destfile="$destdir/$destfile"
  5091. fi
  5092. # If the file is missing, and there is a .exe on the end, strip it
  5093. # because it is most likely a libtool script we actually want to
  5094. # install
  5095. stripped_ext=""
  5096. case $file in
  5097. *.exe)
  5098. if test ! -f "$file"; then
  5099. file=`$echo $file|${SED} 's,.exe$,,'`
  5100. stripped_ext=".exe"
  5101. fi
  5102. ;;
  5103. esac
  5104. # Do a test to see if this is really a libtool program.
  5105. case $host in
  5106. *cygwin*|*mingw*)
  5107. wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
  5108. ;;
  5109. *)
  5110. wrapper=$file
  5111. ;;
  5112. esac
  5113. if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
  5114. notinst_deplibs=
  5115. relink_command=
  5116. # To insure that "foo" is sourced, and not "foo.exe",
  5117. # finese the cygwin/MSYS system by explicitly sourcing "foo."
  5118. # which disallows the automatic-append-.exe behavior.
  5119. case $build in
  5120. *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  5121. *) wrapperdot=${wrapper} ;;
  5122. esac
  5123. # If there is no directory component, then add one.
  5124. case $file in
  5125. */* | *\\*) . ${wrapperdot} ;;
  5126. *) . ./${wrapperdot} ;;
  5127. esac
  5128. # Check the variables that should have been set.
  5129. if test -z "$notinst_deplibs"; then
  5130. $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  5131. exit $EXIT_FAILURE
  5132. fi
  5133. finalize=yes
  5134. for lib in $notinst_deplibs; do
  5135. # Check to see that each library is installed.
  5136. libdir=
  5137. if test -f "$lib"; then
  5138. # If there is no directory component, then add one.
  5139. case $lib in
  5140. */* | *\\*) . $lib ;;
  5141. *) . ./$lib ;;
  5142. esac
  5143. fi
  5144. libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  5145. if test -n "$libdir" && test ! -f "$libfile"; then
  5146. $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  5147. finalize=no
  5148. fi
  5149. done
  5150. relink_command=
  5151. # To insure that "foo" is sourced, and not "foo.exe",
  5152. # finese the cygwin/MSYS system by explicitly sourcing "foo."
  5153. # which disallows the automatic-append-.exe behavior.
  5154. case $build in
  5155. *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  5156. *) wrapperdot=${wrapper} ;;
  5157. esac
  5158. # If there is no directory component, then add one.
  5159. case $file in
  5160. */* | *\\*) . ${wrapperdot} ;;
  5161. *) . ./${wrapperdot} ;;
  5162. esac
  5163. outputname=
  5164. if test "$fast_install" = no && test -n "$relink_command"; then
  5165. if test "$finalize" = yes && test -z "$run"; then
  5166. tmpdir="/tmp"
  5167. test -n "$TMPDIR" && tmpdir="$TMPDIR"
  5168. tmpdir="$tmpdir/libtool-$$"
  5169. save_umask=`umask`
  5170. umask 0077
  5171. if $mkdir "$tmpdir"; then
  5172. umask $save_umask
  5173. else
  5174. umask $save_umask
  5175. $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  5176. continue
  5177. fi
  5178. file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  5179. outputname="$tmpdir/$file"
  5180. # Replace the output file specification.
  5181. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  5182. $show "$relink_command"
  5183. if $run eval "$relink_command"; then :
  5184. else
  5185. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  5186. ${rm}r "$tmpdir"
  5187. continue
  5188. fi
  5189. file="$outputname"
  5190. else
  5191. $echo "$modename: warning: cannot relink \`$file'" 1>&2
  5192. fi
  5193. else
  5194. # Install the binary that we compiled earlier.
  5195. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  5196. fi
  5197. fi
  5198. # remove .exe since cygwin /usr/bin/install will append another
  5199. # one anyways
  5200. case $install_prog,$host in
  5201. */usr/bin/install*,*cygwin*)
  5202. case $file:$destfile in
  5203. *.exe:*.exe)
  5204. # this is ok
  5205. ;;
  5206. *.exe:*)
  5207. destfile=$destfile.exe
  5208. ;;
  5209. *:*.exe)
  5210. destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
  5211. ;;
  5212. esac
  5213. ;;
  5214. esac
  5215. $show "$install_prog$stripme $file $destfile"
  5216. $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  5217. test -n "$outputname" && ${rm}r "$tmpdir"
  5218. ;;
  5219. esac
  5220. done
  5221. for file in $staticlibs; do
  5222. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5223. # Set up the ranlib parameters.
  5224. oldlib="$destdir/$name"
  5225. $show "$install_prog $file $oldlib"
  5226. $run eval "$install_prog \$file \$oldlib" || exit $?
  5227. if test -n "$stripme" && test -n "$old_striplib"; then
  5228. $show "$old_striplib $oldlib"
  5229. $run eval "$old_striplib $oldlib" || exit $?
  5230. fi
  5231. # Do each command in the postinstall commands.
  5232. cmds=$old_postinstall_cmds
  5233. save_ifs="$IFS"; IFS='~'
  5234. for cmd in $cmds; do
  5235. IFS="$save_ifs"
  5236. eval cmd=\"$cmd\"
  5237. $show "$cmd"
  5238. $run eval "$cmd" || exit $?
  5239. done
  5240. IFS="$save_ifs"
  5241. done
  5242. if test -n "$future_libdirs"; then
  5243. $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  5244. fi
  5245. if test -n "$current_libdirs"; then
  5246. # Maybe just do a dry run.
  5247. test -n "$run" && current_libdirs=" -n$current_libdirs"
  5248. exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  5249. else
  5250. exit $EXIT_SUCCESS
  5251. fi
  5252. ;;
  5253. # libtool finish mode
  5254. finish)
  5255. modename="$modename: finish"
  5256. libdirs="$nonopt"
  5257. admincmds=
  5258. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  5259. for dir
  5260. do
  5261. libdirs="$libdirs $dir"
  5262. done
  5263. for libdir in $libdirs; do
  5264. if test -n "$finish_cmds"; then
  5265. # Do each command in the finish commands.
  5266. cmds=$finish_cmds
  5267. save_ifs="$IFS"; IFS='~'
  5268. for cmd in $cmds; do
  5269. IFS="$save_ifs"
  5270. eval cmd=\"$cmd\"
  5271. $show "$cmd"
  5272. $run eval "$cmd" || admincmds="$admincmds
  5273. $cmd"
  5274. done
  5275. IFS="$save_ifs"
  5276. fi
  5277. if test -n "$finish_eval"; then
  5278. # Do the single finish_eval.
  5279. eval cmds=\"$finish_eval\"
  5280. $run eval "$cmds" || admincmds="$admincmds
  5281. $cmds"
  5282. fi
  5283. done
  5284. fi
  5285. # Exit here if they wanted silent mode.
  5286. test "$show" = : && exit $EXIT_SUCCESS
  5287. $echo "----------------------------------------------------------------------"
  5288. $echo "Libraries have been installed in:"
  5289. for libdir in $libdirs; do
  5290. $echo " $libdir"
  5291. done
  5292. $echo
  5293. $echo "If you ever happen to want to link against installed libraries"
  5294. $echo "in a given directory, LIBDIR, you must either use libtool, and"
  5295. $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  5296. $echo "flag during linking and do at least one of the following:"
  5297. if test -n "$shlibpath_var"; then
  5298. $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
  5299. $echo " during execution"
  5300. fi
  5301. if test -n "$runpath_var"; then
  5302. $echo " - add LIBDIR to the \`$runpath_var' environment variable"
  5303. $echo " during linking"
  5304. fi
  5305. if test -n "$hardcode_libdir_flag_spec"; then
  5306. libdir=LIBDIR
  5307. eval flag=\"$hardcode_libdir_flag_spec\"
  5308. $echo " - use the \`$flag' linker flag"
  5309. fi
  5310. if test -n "$admincmds"; then
  5311. $echo " - have your system administrator run these commands:$admincmds"
  5312. fi
  5313. if test -f /etc/ld.so.conf; then
  5314. $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  5315. fi
  5316. $echo
  5317. $echo "See any operating system documentation about shared libraries for"
  5318. $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  5319. $echo "----------------------------------------------------------------------"
  5320. exit $EXIT_SUCCESS
  5321. ;;
  5322. # libtool execute mode
  5323. execute)
  5324. modename="$modename: execute"
  5325. # The first argument is the command name.
  5326. cmd="$nonopt"
  5327. if test -z "$cmd"; then
  5328. $echo "$modename: you must specify a COMMAND" 1>&2
  5329. $echo "$help"
  5330. exit $EXIT_FAILURE
  5331. fi
  5332. # Handle -dlopen flags immediately.
  5333. for file in $execute_dlfiles; do
  5334. if test ! -f "$file"; then
  5335. $echo "$modename: \`$file' is not a file" 1>&2
  5336. $echo "$help" 1>&2
  5337. exit $EXIT_FAILURE
  5338. fi
  5339. dir=
  5340. case $file in
  5341. *.la)
  5342. # Check to see that this really is a libtool archive.
  5343. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  5344. else
  5345. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5346. $echo "$help" 1>&2
  5347. exit $EXIT_FAILURE
  5348. fi
  5349. # Read the libtool library.
  5350. dlname=
  5351. library_names=
  5352. # If there is no directory component, then add one.
  5353. case $file in
  5354. */* | *\\*) . $file ;;
  5355. *) . ./$file ;;
  5356. esac
  5357. # Skip this library if it cannot be dlopened.
  5358. if test -z "$dlname"; then
  5359. # Warn if it was a shared library.
  5360. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  5361. continue
  5362. fi
  5363. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5364. test "X$dir" = "X$file" && dir=.
  5365. if test -f "$dir/$objdir/$dlname"; then
  5366. dir="$dir/$objdir"
  5367. else
  5368. $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  5369. exit $EXIT_FAILURE
  5370. fi
  5371. ;;
  5372. *.lo)
  5373. # Just add the directory containing the .lo file.
  5374. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5375. test "X$dir" = "X$file" && dir=.
  5376. ;;
  5377. *)
  5378. $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  5379. continue
  5380. ;;
  5381. esac
  5382. # Get the absolute pathname.
  5383. absdir=`cd "$dir" && pwd`
  5384. test -n "$absdir" && dir="$absdir"
  5385. # Now add the directory to shlibpath_var.
  5386. if eval "test -z \"\$$shlibpath_var\""; then
  5387. eval "$shlibpath_var=\"\$dir\""
  5388. else
  5389. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  5390. fi
  5391. done
  5392. # This variable tells wrapper scripts just to set shlibpath_var
  5393. # rather than running their programs.
  5394. libtool_execute_magic="$magic"
  5395. # Check if any of the arguments is a wrapper script.
  5396. args=
  5397. for file
  5398. do
  5399. case $file in
  5400. -*) ;;
  5401. *)
  5402. # Do a test to see if this is really a libtool program.
  5403. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5404. # If there is no directory component, then add one.
  5405. case $file in
  5406. */* | *\\*) . $file ;;
  5407. *) . ./$file ;;
  5408. esac
  5409. # Transform arg to wrapped name.
  5410. file="$progdir/$program"
  5411. fi
  5412. ;;
  5413. esac
  5414. # Quote arguments (to preserve shell metacharacters).
  5415. file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  5416. args="$args \"$file\""
  5417. done
  5418. if test -z "$run"; then
  5419. if test -n "$shlibpath_var"; then
  5420. # Export the shlibpath_var.
  5421. eval "export $shlibpath_var"
  5422. fi
  5423. # Restore saved environment variables
  5424. if test "${save_LC_ALL+set}" = set; then
  5425. LC_ALL="$save_LC_ALL"; export LC_ALL
  5426. fi
  5427. if test "${save_LANG+set}" = set; then
  5428. LANG="$save_LANG"; export LANG
  5429. fi
  5430. # Now prepare to actually exec the command.
  5431. exec_cmd="\$cmd$args"
  5432. else
  5433. # Display what would be done.
  5434. if test -n "$shlibpath_var"; then
  5435. eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  5436. $echo "export $shlibpath_var"
  5437. fi
  5438. $echo "$cmd$args"
  5439. exit $EXIT_SUCCESS
  5440. fi
  5441. ;;
  5442. # libtool clean and uninstall mode
  5443. clean | uninstall)
  5444. modename="$modename: $mode"
  5445. rm="$nonopt"
  5446. files=
  5447. rmforce=
  5448. exit_status=0
  5449. # This variable tells wrapper scripts just to set variables rather
  5450. # than running their programs.
  5451. libtool_install_magic="$magic"
  5452. for arg
  5453. do
  5454. case $arg in
  5455. -f) rm="$rm $arg"; rmforce=yes ;;
  5456. -*) rm="$rm $arg" ;;
  5457. *) files="$files $arg" ;;
  5458. esac
  5459. done
  5460. if test -z "$rm"; then
  5461. $echo "$modename: you must specify an RM program" 1>&2
  5462. $echo "$help" 1>&2
  5463. exit $EXIT_FAILURE
  5464. fi
  5465. rmdirs=
  5466. origobjdir="$objdir"
  5467. for file in $files; do
  5468. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5469. if test "X$dir" = "X$file"; then
  5470. dir=.
  5471. objdir="$origobjdir"
  5472. else
  5473. objdir="$dir/$origobjdir"
  5474. fi
  5475. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5476. test "$mode" = uninstall && objdir="$dir"
  5477. # Remember objdir for removal later, being careful to avoid duplicates
  5478. if test "$mode" = clean; then
  5479. case " $rmdirs " in
  5480. *" $objdir "*) ;;
  5481. *) rmdirs="$rmdirs $objdir" ;;
  5482. esac
  5483. fi
  5484. # Don't error if the file doesn't exist and rm -f was used.
  5485. if (test -L "$file") >/dev/null 2>&1 \
  5486. || (test -h "$file") >/dev/null 2>&1 \
  5487. || test -f "$file"; then
  5488. :
  5489. elif test -d "$file"; then
  5490. exit_status=1
  5491. continue
  5492. elif test "$rmforce" = yes; then
  5493. continue
  5494. fi
  5495. rmfiles="$file"
  5496. case $name in
  5497. *.la)
  5498. # Possibly a libtool archive, so verify it.
  5499. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5500. . $dir/$name
  5501. # Delete the libtool libraries and symlinks.
  5502. for n in $library_names; do
  5503. rmfiles="$rmfiles $objdir/$n"
  5504. done
  5505. test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  5506. test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  5507. if test "$mode" = uninstall; then
  5508. if test -n "$library_names"; then
  5509. # Do each command in the postuninstall commands.
  5510. cmds=$postuninstall_cmds
  5511. save_ifs="$IFS"; IFS='~'
  5512. for cmd in $cmds; do
  5513. IFS="$save_ifs"
  5514. eval cmd=\"$cmd\"
  5515. $show "$cmd"
  5516. $run eval "$cmd"
  5517. if test "$?" -ne 0 && test "$rmforce" != yes; then
  5518. exit_status=1
  5519. fi
  5520. done
  5521. IFS="$save_ifs"
  5522. fi
  5523. if test -n "$old_library"; then
  5524. # Do each command in the old_postuninstall commands.
  5525. cmds=$old_postuninstall_cmds
  5526. save_ifs="$IFS"; IFS='~'
  5527. for cmd in $cmds; do
  5528. IFS="$save_ifs"
  5529. eval cmd=\"$cmd\"
  5530. $show "$cmd"
  5531. $run eval "$cmd"
  5532. if test "$?" -ne 0 && test "$rmforce" != yes; then
  5533. exit_status=1
  5534. fi
  5535. done
  5536. IFS="$save_ifs"
  5537. fi
  5538. # FIXME: should reinstall the best remaining shared library.
  5539. fi
  5540. fi
  5541. ;;
  5542. *.lo)
  5543. # Possibly a libtool object, so verify it.
  5544. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5545. # Read the .lo file
  5546. . $dir/$name
  5547. # Add PIC object to the list of files to remove.
  5548. if test -n "$pic_object" \
  5549. && test "$pic_object" != none; then
  5550. rmfiles="$rmfiles $dir/$pic_object"
  5551. fi
  5552. # Add non-PIC object to the list of files to remove.
  5553. if test -n "$non_pic_object" \
  5554. && test "$non_pic_object" != none; then
  5555. rmfiles="$rmfiles $dir/$non_pic_object"
  5556. fi
  5557. fi
  5558. ;;
  5559. *)
  5560. if test "$mode" = clean ; then
  5561. noexename=$name
  5562. case $file in
  5563. *.exe)
  5564. file=`$echo $file|${SED} 's,.exe$,,'`
  5565. noexename=`$echo $name|${SED} 's,.exe$,,'`
  5566. # $file with .exe has already been added to rmfiles,
  5567. # add $file without .exe
  5568. rmfiles="$rmfiles $file"
  5569. ;;
  5570. esac
  5571. # Do a test to see if this is a libtool program.
  5572. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5573. relink_command=
  5574. . $dir/$noexename
  5575. # note $name still contains .exe if it was in $file originally
  5576. # as does the version of $file that was added into $rmfiles
  5577. rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  5578. if test "$fast_install" = yes && test -n "$relink_command"; then
  5579. rmfiles="$rmfiles $objdir/lt-$name"
  5580. fi
  5581. if test "X$noexename" != "X$name" ; then
  5582. rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  5583. fi
  5584. fi
  5585. fi
  5586. ;;
  5587. esac
  5588. $show "$rm $rmfiles"
  5589. $run $rm $rmfiles || exit_status=1
  5590. done
  5591. objdir="$origobjdir"
  5592. # Try to remove the ${objdir}s in the directories where we deleted files
  5593. for dir in $rmdirs; do
  5594. if test -d "$dir"; then
  5595. $show "rmdir $dir"
  5596. $run rmdir $dir >/dev/null 2>&1
  5597. fi
  5598. done
  5599. exit $exit_status
  5600. ;;
  5601. "")
  5602. $echo "$modename: you must specify a MODE" 1>&2
  5603. $echo "$generic_help" 1>&2
  5604. exit $EXIT_FAILURE
  5605. ;;
  5606. esac
  5607. if test -z "$exec_cmd"; then
  5608. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  5609. $echo "$generic_help" 1>&2
  5610. exit $EXIT_FAILURE
  5611. fi
  5612. fi # test -z "$show_help"
  5613. if test -n "$exec_cmd"; then
  5614. eval exec $exec_cmd
  5615. exit $EXIT_FAILURE
  5616. fi
  5617. # We need to display help for each of the modes.
  5618. case $mode in
  5619. "") $echo \
  5620. "Usage: $modename [OPTION]... [MODE-ARG]...
  5621. Provide generalized library-building support services.
  5622. --config show all configuration variables
  5623. --debug enable verbose shell tracing
  5624. -n, --dry-run display commands without modifying any files
  5625. --features display basic configuration information and exit
  5626. --finish same as \`--mode=finish'
  5627. --help display this help message and exit
  5628. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
  5629. --quiet same as \`--silent'
  5630. --silent don't print informational messages
  5631. --tag=TAG use configuration variables from tag TAG
  5632. --version print version information
  5633. MODE must be one of the following:
  5634. clean remove files from the build directory
  5635. compile compile a source file into a libtool object
  5636. execute automatically set library path, then run a program
  5637. finish complete the installation of libtool libraries
  5638. install install libraries or executables
  5639. link create a library or an executable
  5640. uninstall remove libraries from an installed directory
  5641. MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
  5642. a more detailed description of MODE.
  5643. Report bugs to <bug-libtool@gnu.org>."
  5644. exit $EXIT_SUCCESS
  5645. ;;
  5646. clean)
  5647. $echo \
  5648. "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  5649. Remove files from the build directory.
  5650. RM is the name of the program to use to delete files associated with each FILE
  5651. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  5652. to RM.
  5653. If FILE is a libtool library, object or program, all the files associated
  5654. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  5655. ;;
  5656. compile)
  5657. $echo \
  5658. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  5659. Compile a source file into a libtool library object.
  5660. This mode accepts the following additional options:
  5661. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  5662. -prefer-pic try to building PIC objects only
  5663. -prefer-non-pic try to building non-PIC objects only
  5664. -static always build a \`.o' file suitable for static linking
  5665. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  5666. from the given SOURCEFILE.
  5667. The output file name is determined by removing the directory component from
  5668. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  5669. library object suffix, \`.lo'."
  5670. ;;
  5671. execute)
  5672. $echo \
  5673. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  5674. Automatically set library path, then run a program.
  5675. This mode accepts the following additional options:
  5676. -dlopen FILE add the directory containing FILE to the library path
  5677. This mode sets the library path environment variable according to \`-dlopen'
  5678. flags.
  5679. If any of the ARGS are libtool executable wrappers, then they are translated
  5680. into their corresponding uninstalled binary, and any of their required library
  5681. directories are added to the library path.
  5682. Then, COMMAND is executed, with ARGS as arguments."
  5683. ;;
  5684. finish)
  5685. $echo \
  5686. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  5687. Complete the installation of libtool libraries.
  5688. Each LIBDIR is a directory that contains libtool libraries.
  5689. The commands that this mode executes may require superuser privileges. Use
  5690. the \`--dry-run' option if you just want to see what would be executed."
  5691. ;;
  5692. install)
  5693. $echo \
  5694. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  5695. Install executables or libraries.
  5696. INSTALL-COMMAND is the installation command. The first component should be
  5697. either the \`install' or \`cp' program.
  5698. The rest of the components are interpreted as arguments to that command (only
  5699. BSD-compatible install options are recognized)."
  5700. ;;
  5701. link)
  5702. $echo \
  5703. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  5704. Link object files or libraries together to form another library, or to
  5705. create an executable program.
  5706. LINK-COMMAND is a command using the C compiler that you would use to create
  5707. a program from several object files.
  5708. The following components of LINK-COMMAND are treated specially:
  5709. -all-static do not do any dynamic linking at all
  5710. -avoid-version do not add a version suffix if possible
  5711. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  5712. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  5713. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  5714. -export-symbols SYMFILE
  5715. try to export only the symbols listed in SYMFILE
  5716. -export-symbols-regex REGEX
  5717. try to export only the symbols matching REGEX
  5718. -LLIBDIR search LIBDIR for required installed libraries
  5719. -lNAME OUTPUT-FILE requires the installed library libNAME
  5720. -module build a library that can dlopened
  5721. -no-fast-install disable the fast-install mode
  5722. -no-install link a not-installable executable
  5723. -no-undefined declare that a library does not refer to external symbols
  5724. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  5725. -objectlist FILE Use a list of object files found in FILE to specify objects
  5726. -precious-files-regex REGEX
  5727. don't remove output files matching REGEX
  5728. -release RELEASE specify package release information
  5729. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  5730. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  5731. -static do not do any dynamic linking of libtool libraries
  5732. -version-info CURRENT[:REVISION[:AGE]]
  5733. specify library version info [each variable defaults to 0]
  5734. All other options (arguments beginning with \`-') are ignored.
  5735. Every other argument is treated as a filename. Files ending in \`.la' are
  5736. treated as uninstalled libtool libraries, other files are standard or library
  5737. object files.
  5738. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  5739. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  5740. required, except when creating a convenience library.
  5741. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  5742. using \`ar' and \`ranlib', or on Windows using \`lib'.
  5743. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  5744. is created, otherwise an executable program is created."
  5745. ;;
  5746. uninstall)
  5747. $echo \
  5748. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  5749. Remove libraries from an installation directory.
  5750. RM is the name of the program to use to delete files associated with each FILE
  5751. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  5752. to RM.
  5753. If FILE is a libtool library, all the files associated with it are deleted.
  5754. Otherwise, only FILE itself is deleted using RM."
  5755. ;;
  5756. *)
  5757. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  5758. $echo "$help" 1>&2
  5759. exit $EXIT_FAILURE
  5760. ;;
  5761. esac
  5762. $echo
  5763. $echo "Try \`$modename --help' for more information about other modes."
  5764. exit $EXIT_SUCCESS
  5765. # The TAGs below are defined such that we never get into a situation
  5766. # in which we disable both kinds of libraries. Given conflicting
  5767. # choices, we go for a static library, that is the most portable,
  5768. # since we can't tell whether shared libraries were disabled because
  5769. # the user asked for that or because the platform doesn't support
  5770. # them. This is particularly important on AIX, because we don't
  5771. # support having both static and shared libraries enabled at the same
  5772. # time on that platform, so we default to a shared-only configuration.
  5773. # If a disable-shared tag is given, we'll fallback to a static-only
  5774. # configuration. But we'll never go from static-only to shared-only.
  5775. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  5776. build_libtool_libs=no
  5777. build_old_libs=yes
  5778. # ### END LIBTOOL TAG CONFIG: disable-shared
  5779. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  5780. build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
  5781. # ### END LIBTOOL TAG CONFIG: disable-static
  5782. # Local Variables:
  5783. # mode:shell-script
  5784. # sh-indentation:2
  5785. # End: