Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6399 lines
178 KiB

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