PageRenderTime 64ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/autoconf/ltmain.sh

#
Shell | 2474 lines | 2126 code | 145 blank | 203 comment | 167 complexity | 97f4d59834eba8e3338ca1691d95657d MD5 | raw file
  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 <gord@gnu.ai.mit.edu>, 1996
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. # General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. #
  22. # As a special exception to the GNU General Public License, if you
  23. # distribute this file as part of a program that contains a
  24. # configuration script generated by Autoconf, you may include it under
  25. # the same distribution terms that you use for the rest of that program.
  26. # Check that we have a working $echo.
  27. if test "X$1" = X--no-reexec; then
  28. # Discard the --no-reexec flag, and continue.
  29. shift
  30. elif test "X$1" = X--fallback-echo; then
  31. # Avoid inline document here, it may be left over
  32. :
  33. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  34. # Yippee, $echo works!
  35. :
  36. else
  37. # Restart under the correct shell, and then maybe $echo will work.
  38. exec $SHELL "$0" --no-reexec ${1+"$@"}
  39. fi
  40. if test "X$1" = X--fallback-echo; then
  41. # used as fallback echo
  42. shift
  43. cat <<EOF
  44. $*
  45. EOF
  46. exit 0
  47. fi
  48. # The name of this program.
  49. progname=`$echo "$0" | ${SED} 's%^.*/%%'`
  50. modename="$progname"
  51. # Constants.
  52. PROGRAM=ltmain.sh
  53. PACKAGE=libtool
  54. VERSION=1.5.2
  55. TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)"
  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* | *CC)
  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. tagname=CC
  471. ;;
  472. # Blanks at the start of $base_compile will cause this to fail
  473. # if we don't check for them as well.
  474. *)
  475. base_compiler=`$echo $base_compile | awk '{ print $1 }'`
  476. case $base_compiler in
  477. *cc)
  478. tagname=CC
  479. ;;
  480. *++)
  481. tagname=CXX
  482. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
  483. ;;
  484. esac
  485. ;;
  486. esac
  487. fi
  488. if test -n "$available_tags" && test -z "$tagname"; then
  489. for z in $available_tags; do
  490. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
  491. # Evaluate the configuration.
  492. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
  493. case "$base_compile " in
  494. "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
  495. # The compiler in the base compile command matches
  496. # the one in the tagged configuration.
  497. # Assume this is the tagged configuration we want.
  498. tagname=$z
  499. break
  500. ;;
  501. esac
  502. fi
  503. done
  504. # If $tagname still isn't set, then no tagged configuration
  505. # was found and let the user know that the "--tag" command
  506. # line option must be used.
  507. if test -z "$tagname"; then
  508. $echo "$modename: unable to infer tagged configuration"
  509. $echo "$modename: specify a tag with \`--tag'" 1>&2
  510. exit 1
  511. # else
  512. # $echo "$modename: using $tagname tagged configuration"
  513. fi
  514. fi
  515. for arg in $later; do
  516. case $arg in
  517. -static)
  518. build_old_libs=yes
  519. continue
  520. ;;
  521. -prefer-pic)
  522. pic_mode=yes
  523. continue
  524. ;;
  525. -prefer-non-pic)
  526. pic_mode=no
  527. continue
  528. ;;
  529. esac
  530. done
  531. objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  532. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  533. if test "X$xdir" = "X$obj"; then
  534. xdir=
  535. else
  536. xdir=$xdir/
  537. fi
  538. lobj=${xdir}$objdir/$objname
  539. if test -z "$base_compile"; then
  540. $echo "$modename: you must specify a compilation command" 1>&2
  541. $echo "$help" 1>&2
  542. exit 1
  543. fi
  544. # Delete any leftover library objects.
  545. if test "$build_old_libs" = yes; then
  546. removelist="$obj $lobj $libobj ${libobj}T"
  547. else
  548. removelist="$lobj $libobj ${libobj}T"
  549. fi
  550. $run $rm $removelist
  551. trap "$run $rm $removelist; exit 1" 1 2 15
  552. # On Cygwin there's no "real" PIC flag so we must build both object types
  553. case $host_os in
  554. cygwin* | mingw* | pw32* | os2*)
  555. pic_mode=default
  556. ;;
  557. esac
  558. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  559. # non-PIC code in shared libraries is not supported
  560. pic_mode=default
  561. fi
  562. # Calculate the filename of the output object if compiler does
  563. # not support -o with -c
  564. if test "$compiler_c_o" = no; then
  565. output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  566. lockfile="$output_obj.lock"
  567. removelist="$removelist $output_obj $lockfile"
  568. trap "$run $rm $removelist; exit 1" 1 2 15
  569. else
  570. output_obj=
  571. need_locks=no
  572. lockfile=
  573. fi
  574. # Lock this critical section if it is needed
  575. # We use this script file to make the link, it avoids creating a new file
  576. if test "$need_locks" = yes; then
  577. until $run ln "$0" "$lockfile" 2>/dev/null; do
  578. $show "Waiting for $lockfile to be removed"
  579. sleep 2
  580. done
  581. elif test "$need_locks" = warn; then
  582. if test -f "$lockfile"; then
  583. $echo "\
  584. *** ERROR, $lockfile exists and contains:
  585. `cat $lockfile 2>/dev/null`
  586. This indicates that another process is trying to use the same
  587. temporary object file, and libtool could not work around it because
  588. your compiler does not support \`-c' and \`-o' together. If you
  589. repeat this compilation, it may succeed, by chance, but you had better
  590. avoid parallel builds (make -j) in this platform, or get a better
  591. compiler."
  592. $run $rm $removelist
  593. exit 1
  594. fi
  595. $echo $srcfile > "$lockfile"
  596. fi
  597. if test -n "$fix_srcfile_path"; then
  598. eval srcfile=\"$fix_srcfile_path\"
  599. fi
  600. $run $rm "$libobj" "${libobj}T"
  601. # Create a libtool object file (analogous to a ".la" file),
  602. # but don't create it if we're doing a dry run.
  603. test -z "$run" && cat > ${libobj}T <<EOF
  604. # $libobj - a libtool object file
  605. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  606. #
  607. # Please DO NOT delete this file!
  608. # It is necessary for linking the library.
  609. # Name of the PIC object.
  610. EOF
  611. # Only build a PIC object if we are building libtool libraries.
  612. if test "$build_libtool_libs" = yes; then
  613. # Without this assignment, base_compile gets emptied.
  614. fbsd_hideous_sh_bug=$base_compile
  615. if test "$pic_mode" != no; then
  616. command="$base_compile $srcfile $pic_flag"
  617. else
  618. # Don't build PIC code
  619. command="$base_compile $srcfile"
  620. fi
  621. if test ! -d "${xdir}$objdir"; then
  622. $show "$mkdir ${xdir}$objdir"
  623. $run $mkdir ${xdir}$objdir
  624. status=$?
  625. if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
  626. exit $status
  627. fi
  628. fi
  629. if test -z "$output_obj"; then
  630. # Place PIC objects in $objdir
  631. command="$command -o $lobj"
  632. fi
  633. $run $rm "$lobj" "$output_obj"
  634. $show "$command"
  635. if $run eval "$command"; then :
  636. else
  637. test -n "$output_obj" && $run $rm $removelist
  638. exit 1
  639. fi
  640. if test "$need_locks" = warn &&
  641. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  642. $echo "\
  643. *** ERROR, $lockfile contains:
  644. `cat $lockfile 2>/dev/null`
  645. but it should contain:
  646. $srcfile
  647. This indicates that another process is trying to use the same
  648. temporary object file, and libtool could not work around it because
  649. your compiler does not support \`-c' and \`-o' together. If you
  650. repeat this compilation, it may succeed, by chance, but you had better
  651. avoid parallel builds (make -j) in this platform, or get a better
  652. compiler."
  653. $run $rm $removelist
  654. exit 1
  655. fi
  656. # Just move the object if needed, then go on to compile the next one
  657. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  658. $show "$mv $output_obj $lobj"
  659. if $run $mv $output_obj $lobj; then :
  660. else
  661. error=$?
  662. $run $rm $removelist
  663. exit $error
  664. fi
  665. fi
  666. # Append the name of the PIC object to the libtool object file.
  667. test -z "$run" && cat >> ${libobj}T <<EOF
  668. pic_object='$objdir/$objname'
  669. EOF
  670. # Allow error messages only from the first compilation.
  671. if test "$suppress_opt" = yes; then
  672. suppress_output=' >/dev/null 2>&1'
  673. fi
  674. else
  675. # No PIC object so indicate it doesn't exist in the libtool
  676. # object file.
  677. test -z "$run" && cat >> ${libobj}T <<EOF
  678. pic_object=none
  679. EOF
  680. fi
  681. # Only build a position-dependent object if we build old libraries.
  682. if test "$build_old_libs" = yes; then
  683. if test "$pic_mode" != yes; then
  684. # Don't build PIC code
  685. command="$base_compile $srcfile"
  686. else
  687. command="$base_compile $srcfile $pic_flag"
  688. fi
  689. if test "$compiler_c_o" = yes; then
  690. command="$command -o $obj"
  691. fi
  692. # Suppress compiler output if we already did a PIC compilation.
  693. command="$command$suppress_output"
  694. $run $rm "$obj" "$output_obj"
  695. $show "$command"
  696. if $run eval "$command"; then :
  697. else
  698. $run $rm $removelist
  699. exit 1
  700. fi
  701. if test "$need_locks" = warn &&
  702. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  703. $echo "\
  704. *** ERROR, $lockfile contains:
  705. `cat $lockfile 2>/dev/null`
  706. but it should contain:
  707. $srcfile
  708. This indicates that another process is trying to use the same
  709. temporary object file, and libtool could not work around it because
  710. your compiler does not support \`-c' and \`-o' together. If you
  711. repeat this compilation, it may succeed, by chance, but you had better
  712. avoid parallel builds (make -j) in this platform, or get a better
  713. compiler."
  714. $run $rm $removelist
  715. exit 1
  716. fi
  717. # Just move the object if needed
  718. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  719. $show "$mv $output_obj $obj"
  720. if $run $mv $output_obj $obj; then :
  721. else
  722. error=$?
  723. $run $rm $removelist
  724. exit $error
  725. fi
  726. fi
  727. # Append the name of the non-PIC object the libtool object file.
  728. # Only append if the libtool object file exists.
  729. test -z "$run" && cat >> ${libobj}T <<EOF
  730. # Name of the non-PIC object.
  731. non_pic_object='$objname'
  732. EOF
  733. else
  734. # Append the name of the non-PIC object the libtool object file.
  735. # Only append if the libtool object file exists.
  736. test -z "$run" && cat >> ${libobj}T <<EOF
  737. # Name of the non-PIC object.
  738. non_pic_object=none
  739. EOF
  740. fi
  741. $run $mv "${libobj}T" "${libobj}"
  742. # Unlock the critical section if it was locked
  743. if test "$need_locks" != no; then
  744. $run $rm "$lockfile"
  745. fi
  746. exit 0
  747. ;;
  748. # libtool link mode
  749. link | relink)
  750. modename="$modename: link"
  751. case $host in
  752. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  753. # It is impossible to link a dll without this setting, and
  754. # we shouldn't force the makefile maintainer to figure out
  755. # which system we are compiling for in order to pass an extra
  756. # flag for every libtool invocation.
  757. # allow_undefined=no
  758. # FIXME: Unfortunately, there are problems with the above when trying
  759. # to make a dll which has undefined symbols, in which case not
  760. # even a static library is built. For now, we need to specify
  761. # -no-undefined on the libtool link line when we can be certain
  762. # that all symbols are satisfied, otherwise we get a static library.
  763. allow_undefined=yes
  764. ;;
  765. *)
  766. allow_undefined=yes
  767. ;;
  768. esac
  769. libtool_args="$nonopt"
  770. base_compile="$nonopt $@"
  771. compile_command="$nonopt"
  772. finalize_command="$nonopt"
  773. compile_rpath=
  774. finalize_rpath=
  775. compile_shlibpath=
  776. finalize_shlibpath=
  777. convenience=
  778. old_convenience=
  779. deplibs=
  780. old_deplibs=
  781. compiler_flags=
  782. linker_flags=
  783. dllsearchpath=
  784. lib_search_path=`pwd`
  785. inst_prefix_dir=
  786. avoid_version=no
  787. dlfiles=
  788. dlprefiles=
  789. dlself=no
  790. export_dynamic=no
  791. export_symbols=
  792. export_symbols_regex=
  793. generated=
  794. libobjs=
  795. ltlibs=
  796. module=no
  797. no_install=no
  798. objs=
  799. non_pic_objects=
  800. precious_files_regex=
  801. prefer_static_libs=no
  802. preload=no
  803. prev=
  804. prevarg=
  805. release=
  806. rpath=
  807. xrpath=
  808. perm_rpath=
  809. temp_rpath=
  810. thread_safe=no
  811. vinfo=
  812. vinfo_number=no
  813. # Infer tagged configuration to use if any are available and
  814. # if one wasn't chosen via the "--tag" command line option.
  815. # Only attempt this if the compiler in the base link
  816. # command doesn't match the default compiler.
  817. if test -n "$available_tags" && test -z "$tagname"; then
  818. case $base_compile in
  819. # Blanks in the command may have been stripped by the calling shell,
  820. # but not from the CC environment variable when configure was run.
  821. "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
  822. tagname=CC
  823. ;;
  824. # Blanks at the start of $base_compile will cause this to fail
  825. # if we don't check for them as well.
  826. *)
  827. base_compiler=`$echo $base_compile | awk '{ print $1 }'`
  828. case $base_compiler in
  829. *cc)
  830. tagname=CC
  831. ;;
  832. *++)
  833. tagname=CXX
  834. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
  835. ;;
  836. esac
  837. ;;
  838. esac
  839. fi
  840. if test -n "$available_tags" && test -z "$tagname"; then
  841. for z in $available_tags; do
  842. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
  843. # Evaluate the configuration.
  844. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
  845. case $base_compile in
  846. "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
  847. # The compiler in $compile_command matches
  848. # the one in the tagged configuration.
  849. # Assume this is the tagged configuration we want.
  850. tagname=$z
  851. break
  852. ;;
  853. esac
  854. fi
  855. done
  856. # If $tagname still isn't set, then no tagged configuration
  857. # was found and let the user know that the "--tag" command
  858. # line option must be used.
  859. if test -z "$tagname"; then
  860. $echo "$modename: unable to infer tagged configuration"
  861. $echo "$modename: specify a tag with \`--tag'" 1>&2
  862. exit 1
  863. # else
  864. # $echo "$modename: using $tagname tagged configuration"
  865. fi
  866. fi
  867. # We need to know -static, to get the right output filenames.
  868. for arg
  869. do
  870. case $arg in
  871. -all-static | -static)
  872. if test "X$arg" = "X-all-static"; then
  873. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  874. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  875. fi
  876. if test -n "$link_static_flag"; then
  877. dlopen_self=$dlopen_self_static
  878. fi
  879. else
  880. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  881. dlopen_self=$dlopen_self_static
  882. fi
  883. fi
  884. build_libtool_libs=no
  885. build_old_libs=yes
  886. prefer_static_libs=yes
  887. break
  888. ;;
  889. esac
  890. done
  891. # See if our shared archives depend on static archives.
  892. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  893. # Go through the arguments, transforming them on the way.
  894. while test "$#" -gt 0; do
  895. arg="$1"
  896. shift
  897. case $arg in
  898. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  899. qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  900. ;;
  901. *) qarg=$arg ;;
  902. esac
  903. libtool_args="$libtool_args $qarg"
  904. # If the previous option needs an argument, assign it.
  905. if test -n "$prev"; then
  906. case $prev in
  907. output)
  908. compile_command="$compile_command @OUTPUT@"
  909. finalize_command="$finalize_command @OUTPUT@"
  910. ;;
  911. esac
  912. case $prev in
  913. dlfiles|dlprefiles)
  914. if test "$preload" = no; then
  915. # Add the symbol object into the linking commands.
  916. compile_command="$compile_command @SYMFILE@"
  917. finalize_command="$finalize_command @SYMFILE@"
  918. preload=yes
  919. fi
  920. case $arg in
  921. *.la | *.lo) ;; # We handle these cases below.
  922. force)
  923. if test "$dlself" = no; then
  924. dlself=needless
  925. export_dynamic=yes
  926. fi
  927. prev=
  928. continue
  929. ;;
  930. self)
  931. if test "$prev" = dlprefiles; then
  932. dlself=yes
  933. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  934. dlself=yes
  935. else
  936. dlself=needless
  937. export_dynamic=yes
  938. fi
  939. prev=
  940. continue
  941. ;;
  942. *)
  943. if test "$prev" = dlfiles; then
  944. dlfiles="$dlfiles $arg"
  945. else
  946. dlprefiles="$dlprefiles $arg"
  947. fi
  948. prev=
  949. continue
  950. ;;
  951. esac
  952. ;;
  953. expsyms)
  954. export_symbols="$arg"
  955. if test ! -f "$arg"; then
  956. $echo "$modename: symbol file \`$arg' does not exist"
  957. exit 1
  958. fi
  959. prev=
  960. continue
  961. ;;
  962. expsyms_regex)
  963. export_symbols_regex="$arg"
  964. prev=
  965. continue
  966. ;;
  967. inst_prefix)
  968. inst_prefix_dir="$arg"
  969. prev=
  970. continue
  971. ;;
  972. precious_regex)
  973. precious_files_regex="$arg"
  974. prev=
  975. continue
  976. ;;
  977. release)
  978. release="-$arg"
  979. prev=
  980. continue
  981. ;;
  982. objectlist)
  983. if test -f "$arg"; then
  984. save_arg=$arg
  985. moreargs=
  986. for fil in `cat $save_arg`
  987. do
  988. # moreargs="$moreargs $fil"
  989. arg=$fil
  990. # A libtool-controlled object.
  991. # Check to see that this really is a libtool object.
  992. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  993. pic_object=
  994. non_pic_object=
  995. # Read the .lo file
  996. # If there is no directory component, then add one.
  997. case $arg in
  998. */* | *\\*) . $arg ;;
  999. *) . ./$arg ;;
  1000. esac
  1001. if test -z "$pic_object" || \
  1002. test -z "$non_pic_object" ||
  1003. test "$pic_object" = none && \
  1004. test "$non_pic_object" = none; then
  1005. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1006. exit 1
  1007. fi
  1008. # Extract subdirectory from the argument.
  1009. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1010. if test "X$xdir" = "X$arg"; then
  1011. xdir=
  1012. else
  1013. xdir="$xdir/"
  1014. fi
  1015. if test "$pic_object" != none; then
  1016. # Prepend the subdirectory the object is found in.
  1017. pic_object="$xdir$pic_object"
  1018. if test "$prev" = dlfiles; then
  1019. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1020. dlfiles="$dlfiles $pic_object"
  1021. prev=
  1022. continue
  1023. else
  1024. # If libtool objects are unsupported, then we need to preload.
  1025. prev=dlprefiles
  1026. fi
  1027. fi
  1028. # CHECK ME: I think I busted this. -Ossama
  1029. if test "$prev" = dlprefiles; then
  1030. # Preload the old-style object.
  1031. dlprefiles="$dlprefiles $pic_object"
  1032. prev=
  1033. fi
  1034. # A PIC object.
  1035. libobjs="$libobjs $pic_object"
  1036. arg="$pic_object"
  1037. fi
  1038. # Non-PIC object.
  1039. if test "$non_pic_object" != none; then
  1040. # Prepend the subdirectory the object is found in.
  1041. non_pic_object="$xdir$non_pic_object"
  1042. # A standard non-PIC object
  1043. non_pic_objects="$non_pic_objects $non_pic_object"
  1044. if test -z "$pic_object" || test "$pic_object" = none ; then
  1045. arg="$non_pic_object"
  1046. fi
  1047. fi
  1048. else
  1049. # Only an error if not doing a dry-run.
  1050. if test -z "$run"; then
  1051. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1052. exit 1
  1053. else
  1054. # Dry-run case.
  1055. # Extract subdirectory from the argument.
  1056. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1057. if test "X$xdir" = "X$arg"; then
  1058. xdir=
  1059. else
  1060. xdir="$xdir/"
  1061. fi
  1062. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1063. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1064. libobjs="$libobjs $pic_object"
  1065. non_pic_objects="$non_pic_objects $non_pic_object"
  1066. fi
  1067. fi
  1068. done
  1069. else
  1070. $echo "$modename: link input file \`$save_arg' does not exist"
  1071. exit 1
  1072. fi
  1073. arg=$save_arg
  1074. prev=
  1075. continue
  1076. ;;
  1077. rpath | xrpath)
  1078. # We need an absolute path.
  1079. case $arg in
  1080. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1081. *)
  1082. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1083. exit 1
  1084. ;;
  1085. esac
  1086. # Canonicalise the pathname
  1087. tmp=""
  1088. while test "$arg" != "$tmp"
  1089. do
  1090. tmp=$arg
  1091. arg=`$echo "X$arg" | $Xsed -e 's%[^/.][^/.]*/\.\.%%g' -e 's%/\./%/%g' -e 's%//*%/%g' -e 's%/$%%g'`
  1092. done
  1093. if test "$prev" = rpath; then
  1094. case "$rpath " in
  1095. *" $arg "*) ;;
  1096. *) rpath="$rpath $arg" ;;
  1097. esac
  1098. else
  1099. case "$xrpath " in
  1100. *" $arg "*) ;;
  1101. *) xrpath="$xrpath $arg" ;;
  1102. esac
  1103. fi
  1104. prev=
  1105. continue
  1106. ;;
  1107. xcompiler)
  1108. compiler_flags="$compiler_flags $qarg"
  1109. prev=
  1110. compile_command="$compile_command $qarg"
  1111. finalize_command="$finalize_command $qarg"
  1112. continue
  1113. ;;
  1114. xlinker)
  1115. linker_flags="$linker_flags $qarg"
  1116. compiler_flags="$compiler_flags $wl$qarg"
  1117. prev=
  1118. compile_command="$compile_command $wl$qarg"
  1119. finalize_command="$finalize_command $wl$qarg"
  1120. continue
  1121. ;;
  1122. xcclinker)
  1123. linker_flags="$linker_flags $qarg"
  1124. compiler_flags="$compiler_flags $qarg"
  1125. prev=
  1126. compile_command="$compile_command $qarg"
  1127. finalize_command="$finalize_command $qarg"
  1128. continue
  1129. ;;
  1130. *)
  1131. eval "$prev=\"\$arg\""
  1132. prev=
  1133. continue
  1134. ;;
  1135. esac
  1136. fi # test -n "$prev"
  1137. prevarg="$arg"
  1138. case $arg in
  1139. -all-static)
  1140. if test -n "$link_static_flag"; then
  1141. compile_command="$compile_command $link_static_flag"
  1142. finalize_command="$finalize_command $link_static_flag"
  1143. fi
  1144. continue
  1145. ;;
  1146. -allow-undefined)
  1147. # FIXME: remove this flag sometime in the future.
  1148. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1149. continue
  1150. ;;
  1151. -avoid-version)
  1152. avoid_version=yes
  1153. continue
  1154. ;;
  1155. -dlopen)
  1156. prev=dlfiles
  1157. continue
  1158. ;;
  1159. -dlpreopen)
  1160. prev=dlprefiles
  1161. continue
  1162. ;;
  1163. -export-dynamic)
  1164. export_dynamic=yes
  1165. continue
  1166. ;;
  1167. -export-symbols | -export-symbols-regex)
  1168. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1169. $echo "$modename: more than one -exported-symbols argument is not allowed"
  1170. exit 1
  1171. fi
  1172. if test "X$arg" = "X-export-symbols"; then
  1173. prev=expsyms
  1174. else
  1175. prev=expsyms_regex
  1176. fi
  1177. continue
  1178. ;;
  1179. -inst-prefix-dir)
  1180. prev=inst_prefix
  1181. continue
  1182. ;;
  1183. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1184. # so, if we see these flags be careful not to treat them like -L
  1185. -L[A-Z][A-Z]*:*)
  1186. case $with_gcc/$host in
  1187. no/*-*-irix* | /*-*-irix*)
  1188. compile_command="$compile_command $arg"
  1189. finalize_command="$finalize_command $arg"
  1190. ;;
  1191. esac
  1192. continue
  1193. ;;
  1194. -L*)
  1195. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1196. # We need an absolute path.
  1197. case $dir in
  1198. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1199. *)
  1200. absdir=`cd "$dir" && pwd`
  1201. if test -z "$absdir"; then
  1202. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1203. exit 1
  1204. fi
  1205. dir="$absdir"
  1206. ;;
  1207. esac
  1208. case "$deplibs " in
  1209. *" -L$dir "*) ;;
  1210. *)
  1211. deplibs="$deplibs -L$dir"
  1212. lib_search_path="$lib_search_path $dir"
  1213. ;;
  1214. esac
  1215. case $host in
  1216. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1217. case :$dllsearchpath: in
  1218. *":$dir:"*) ;;
  1219. *) dllsearchpath="$dllsearchpath:$dir";;
  1220. esac
  1221. ;;
  1222. esac
  1223. continue
  1224. ;;
  1225. -l*)
  1226. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1227. case $host in
  1228. *-*-cygwin* | *-*-pw32* | *-*-beos*)
  1229. # These systems don't actually have a C or math library (as such)
  1230. continue
  1231. ;;
  1232. *-*-mingw* | *-*-os2*)
  1233. # These systems don't actually have a C library (as such)
  1234. test "X$arg" = "X-lc" && continue
  1235. ;;
  1236. *-*-openbsd* | *-*-freebsd*)
  1237. # Do not include libc due to us having libc/libc_r.
  1238. test "X$arg" = "X-lc" && continue
  1239. ;;
  1240. *-*-rhapsody* | *-*-darwin1.[012])
  1241. # Rhapsody C and math libraries are in the System framework
  1242. deplibs="$deplibs -framework System"
  1243. continue
  1244. esac
  1245. elif test "X$arg" = "X-lc_r"; then
  1246. case $host in
  1247. *-*-openbsd* | *-*-freebsd*)
  1248. # Do not include libc_r directly, use -pthread flag.
  1249. continue
  1250. ;;
  1251. esac
  1252. fi
  1253. deplibs="$deplibs $arg"
  1254. continue
  1255. ;;
  1256. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1257. deplibs="$deplibs $arg"
  1258. continue
  1259. ;;
  1260. -module)
  1261. module=yes
  1262. continue
  1263. ;;
  1264. # gcc -m* arguments should be passed to the linker via $compiler_flags
  1265. # in order to pass architecture information to the linker
  1266. # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
  1267. # but this is not reliable with gcc because gcc may use -mfoo to
  1268. # select a different linker, different libraries, etc, while
  1269. # -Wl,-mfoo simply passes -mfoo to the linker.
  1270. -m*)
  1271. # Unknown arguments in both finalize_command and compile_command need
  1272. # to be aesthetically quoted because they are evaled later.
  1273. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1274. case $arg in
  1275. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1276. arg="\"$arg\""
  1277. ;;
  1278. esac
  1279. compile_command="$compile_command $arg"
  1280. finalize_command="$finalize_command $arg"
  1281. if test "$with_gcc" = "yes" ; then
  1282. compiler_flags="$compiler_flags $arg"
  1283. fi
  1284. continue
  1285. ;;
  1286. -shrext)
  1287. prev=shrext
  1288. continue
  1289. ;;
  1290. -no-fast-install)
  1291. fast_install=no
  1292. continue
  1293. ;;
  1294. -no-install)
  1295. case $host in
  1296. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1297. # The PATH hackery in wrapper scripts is required on Windows
  1298. # in order for the loader to find any dlls it needs.
  1299. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1300. $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1301. fast_install=no
  1302. ;;
  1303. *) no_install=yes ;;
  1304. esac
  1305. continue
  1306. ;;
  1307. -no-undefined)
  1308. allow_undefined=no
  1309. continue
  1310. ;;
  1311. -objectlist)
  1312. prev=objectlist
  1313. continue
  1314. ;;
  1315. -o) prev=output ;;
  1316. -precious-files-regex)
  1317. prev=precious_regex
  1318. continue
  1319. ;;
  1320. -release)
  1321. prev=release
  1322. continue
  1323. ;;
  1324. -rpath)
  1325. prev=rpath
  1326. continue
  1327. ;;
  1328. -R)
  1329. prev=xrpath
  1330. continue
  1331. ;;
  1332. -R*)
  1333. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1334. # We need an absolute path.
  1335. case $dir in
  1336. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1337. *)
  1338. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1339. exit 1
  1340. ;;
  1341. esac
  1342. case "$xrpath " in
  1343. *" $dir "*) ;;
  1344. *) xrpath="$xrpath $dir" ;;
  1345. esac
  1346. continue
  1347. ;;
  1348. -static)
  1349. # The effects of -static are defined in a previous loop.
  1350. # We used to do the same as -all-static on platforms that
  1351. # didn't have a PIC flag, but the assumption that the effects
  1352. # would be equivalent was wrong. It would break on at least
  1353. # Digital Unix and AIX.
  1354. continue
  1355. ;;
  1356. -thread-safe)
  1357. thread_safe=yes
  1358. continue
  1359. ;;
  1360. -version-info)
  1361. prev=vinfo
  1362. continue
  1363. ;;
  1364. -version-number)
  1365. prev=vinfo
  1366. vinfo_number=yes
  1367. continue
  1368. ;;
  1369. -Wc,*)
  1370. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1371. arg=
  1372. save_ifs="$IFS"; IFS=','
  1373. for flag in $args; do
  1374. IFS="$save_ifs"
  1375. case $flag in
  1376. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1377. flag="\"$flag\""
  1378. ;;
  1379. esac
  1380. arg="$arg $wl$flag"
  1381. compiler_flags="$compiler_flags $flag"
  1382. done
  1383. IFS="$save_ifs"
  1384. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1385. ;;
  1386. -Wl,*)
  1387. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1388. arg=
  1389. save_ifs="$IFS"; IFS=','
  1390. for flag in $args; do
  1391. IFS="$save_ifs"
  1392. case $flag in
  1393. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1394. flag="\"$flag\""
  1395. ;;
  1396. esac
  1397. arg="$arg $wl$flag"
  1398. compiler_flags="$compiler_flags $wl$flag"
  1399. linker_flags="$linker_flags $flag"
  1400. done
  1401. IFS="$save_ifs"
  1402. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1403. ;;
  1404. -Xcompiler)
  1405. prev=xcompiler
  1406. continue
  1407. ;;
  1408. -Xlinker)
  1409. prev=xlinker
  1410. continue
  1411. ;;
  1412. -XCClinker)
  1413. prev=xcclinker
  1414. continue
  1415. ;;
  1416. # Some other compiler flag.
  1417. -* | +*)
  1418. # Unknown arguments in both finalize_command and compile_command need
  1419. # to be aesthetically quoted because they are evaled later.
  1420. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1421. case $arg in
  1422. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1423. arg="\"$arg\""
  1424. ;;
  1425. esac
  1426. ;;
  1427. *.$objext)
  1428. # A standard object.
  1429. objs="$objs $arg"
  1430. ;;
  1431. *.lo)
  1432. # A libtool-controlled object.
  1433. # Check to see that this really is a libtool object.
  1434. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1435. pic_object=
  1436. non_pic_object=
  1437. # Read the .lo file
  1438. # If there is no directory component, then add one.
  1439. case $arg in
  1440. */* | *\\*) . $arg ;;
  1441. *) . ./$arg ;;
  1442. esac
  1443. if test -z "$pic_object" || \
  1444. test -z "$non_pic_object" ||
  1445. test "$pic_object" = none && \
  1446. test "$non_pic_object" = none; then
  1447. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1448. exit 1
  1449. fi
  1450. # Extract subdirectory from the argument.
  1451. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1452. if test "X$xdir" = "X$arg"; then
  1453. xdir=
  1454. else
  1455. xdir="$xdir/"
  1456. fi
  1457. if test "$pic_object" != none; then
  1458. # Prepend the subdirectory the object is found in.
  1459. pic_object="$xdir$pic_object"
  1460. if test "$prev" = dlfiles; then
  1461. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1462. dlfiles="$dlfiles $pic_object"
  1463. prev=
  1464. continue
  1465. else
  1466. # If libtool objects are unsupported, then we need to preload.
  1467. prev=dlprefiles
  1468. fi
  1469. fi
  1470. # CHECK ME: I think I busted this. -Ossama
  1471. if test "$prev" = dlprefiles; then
  1472. # Preload the old-style object.
  1473. dlprefiles="$dlprefiles $pic_object"
  1474. prev=
  1475. fi
  1476. # A PIC object.
  1477. libobjs="$libobjs $pic_object"
  1478. arg="$pic_object"
  1479. fi
  1480. # Non-PIC object.
  1481. if test "$non_pic_object" != none; then
  1482. # Prepend the subdirectory the object is found in.
  1483. non_pic_object="$xdir$non_pic_object"
  1484. # A standard non-PIC object
  1485. non_pic_objects="$non_pic_objects $non_pic_object"
  1486. if test -z "$pic_object" || test "$pic_object" = none ; then
  1487. arg="$non_pic_object"
  1488. fi
  1489. fi
  1490. else
  1491. # Only an error if not doing a dry-run.
  1492. if test -z "$run"; then
  1493. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1494. exit 1
  1495. else
  1496. # Dry-run case.
  1497. # Extract subdirectory from the argument.
  1498. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1499. if test "X$xdir" = "X$arg"; then
  1500. xdir=
  1501. else
  1502. xdir="$xdir/"
  1503. fi
  1504. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1505. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1506. libobjs="$libobjs $pic_object"
  1507. non_pic_objects="$non_pic_objects $non_pic_object"
  1508. fi
  1509. fi
  1510. ;;
  1511. *.$libext)
  1512. # An archive.
  1513. deplibs="$deplibs $arg"
  1514. old_deplibs="$old_deplibs $arg"
  1515. continue
  1516. ;;
  1517. *.la)
  1518. # A libtool-controlled library.
  1519. if test "$prev" = dlfiles; then
  1520. # This library was specified with -dlopen.
  1521. dlfiles="$dlfiles $arg"
  1522. prev=
  1523. elif test "$prev" = dlprefiles; then
  1524. # The library was specified with -dlpreopen.
  1525. dlprefiles="$dlprefiles $arg"
  1526. prev=
  1527. else
  1528. deplibs="$deplibs $arg"
  1529. fi
  1530. continue
  1531. ;;
  1532. # Some other compiler argument.
  1533. *)
  1534. # Unknown arguments in both finalize_command and compile_command need
  1535. # to be aesthetically quoted because they are evaled later.
  1536. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1537. case $arg in
  1538. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1539. arg="\"$arg\""
  1540. ;;
  1541. esac
  1542. ;;
  1543. esac # arg
  1544. # Now actually substitute the argument into the commands.
  1545. if test -n "$arg"; then
  1546. compile_command="$compile_command $arg"
  1547. finalize_command="$finalize_command $arg"
  1548. fi
  1549. done # argument parsing loop
  1550. if test -n "$prev"; then
  1551. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1552. $echo "$help" 1>&2
  1553. exit 1
  1554. fi
  1555. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1556. eval arg=\"$export_dynamic_flag_spec\"
  1557. compile_command="$compile_command $arg"
  1558. finalize_command="$finalize_command $arg"
  1559. fi
  1560. oldlibs=
  1561. # calculate the name of the file, without its directory
  1562. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1563. libobjs_save="$libobjs"
  1564. if test -n "$shlibpath_var"; then
  1565. # get the directories listed in $shlibpath_var
  1566. eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1567. else
  1568. shlib_search_path=
  1569. fi
  1570. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1571. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1572. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1573. if test "X$output_objdir" = "X$output"; then
  1574. output_objdir="$objdir"
  1575. else
  1576. output_objdir="$output_objdir/$objdir"
  1577. fi
  1578. # Create the object directory.
  1579. if test ! -d "$output_objdir"; then
  1580. $show "$mkdir $output_objdir"
  1581. $run $mkdir $output_objdir
  1582. status=$?
  1583. if test "$status" -ne 0 && test ! -d "$output_objdir"; then
  1584. exit $status
  1585. fi
  1586. fi
  1587. # Determine the type of output
  1588. case $output in
  1589. "")
  1590. $echo "$modename: you must specify an output file" 1>&2
  1591. $echo "$help" 1>&2
  1592. exit 1
  1593. ;;
  1594. *.$libext) linkmode=oldlib ;;
  1595. *.lo | *.$objext) linkmode=obj ;;
  1596. *.la) linkmode=lib ;;
  1597. *) linkmode=prog ;; # Anything else should be a program.
  1598. esac
  1599. case $host in
  1600. *cygwin* | *mingw* | *pw32*)
  1601. # don't eliminate duplcations in $postdeps and $predeps
  1602. duplicate_compiler_generated_deps=yes
  1603. ;;
  1604. *)
  1605. duplicate_compiler_generated_deps=$duplicate_deps
  1606. ;;
  1607. esac
  1608. specialdeplibs=
  1609. libs=
  1610. # Find all interdependent deplibs by searching for libraries
  1611. # that are linked more than once (e.g. -la -lb -la)
  1612. for deplib in $deplibs; do
  1613. if test "X$duplicate_deps" = "Xyes" ; then
  1614. case "$libs " in
  1615. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1616. esac
  1617. fi
  1618. libs="$libs $deplib"
  1619. done
  1620. if test "$linkmode" = lib; then
  1621. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1622. # Compute libraries that are listed more than once in $predeps
  1623. # $postdeps and mark them as special (i.e., whose duplicates are
  1624. # not to be eliminated).
  1625. pre_post_deps=
  1626. if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1627. for pre_post_dep in $predeps $postdeps; do
  1628. case "$pre_post_deps " in
  1629. *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1630. esac
  1631. pre_post_deps="$pre_post_deps $pre_post_dep"
  1632. done
  1633. fi
  1634. pre_post_deps=
  1635. fi
  1636. deplibs=
  1637. newdependency_libs=
  1638. newlib_search_path=
  1639. need_relink=no # whether we're linking any uninstalled libtool libraries
  1640. notinst_deplibs= # not-installed libtool libraries
  1641. notinst_path= # paths that contain not-installed libtool libraries
  1642. case $linkmode in
  1643. lib)
  1644. passes="conv link"
  1645. for file in $dlfiles $dlprefiles; do
  1646. case $file in
  1647. *.la) ;;
  1648. *)
  1649. $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1650. exit 1
  1651. ;;
  1652. esac
  1653. done
  1654. ;;
  1655. prog)
  1656. compile_deplibs=
  1657. finalize_deplibs=
  1658. alldeplibs=no
  1659. newdlfiles=
  1660. newdlprefiles=
  1661. passes="conv scan dlopen dlpreopen link"
  1662. ;;
  1663. *) passes="conv"
  1664. ;;
  1665. esac
  1666. for pass in $passes; do
  1667. if test "$linkmode,$pass" = "lib,link" ||
  1668. test "$linkmode,$pass" = "prog,scan"; then
  1669. libs="$deplibs"
  1670. deplibs=
  1671. fi
  1672. if test "$linkmode" = prog; then
  1673. case $pass in
  1674. dlopen) libs="$dlfiles" ;;
  1675. dlpreopen) libs="$dlprefiles" ;;
  1676. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1677. esac
  1678. fi
  1679. if test "$pass" = dlopen; then
  1680. # Collect dlpreopened libraries
  1681. save_deplibs="$deplibs"
  1682. deplibs=
  1683. fi
  1684. for deplib in $libs; do
  1685. lib=
  1686. found=no
  1687. case $deplib in
  1688. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1689. if test "$linkmode,$pass" = "prog,link"; then
  1690. compile_deplibs="$deplib $compile_deplibs"
  1691. finalize_deplibs="$deplib $finalize_deplibs"
  1692. else
  1693. deplibs="$deplib $deplibs"
  1694. fi
  1695. continue
  1696. ;;
  1697. -l*)
  1698. if test "$linkmode" != lib && test "$linkmode" != prog; then
  1699. $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1700. continue
  1701. fi
  1702. if test "$pass" = conv; then
  1703. deplibs="$deplib $deplibs"
  1704. continue
  1705. fi
  1706. name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1707. for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1708. for search_ext in .la $shrext .so .a; do
  1709. # Search the libtool library
  1710. lib="$searchdir/lib${name}${search_ext}"
  1711. if test -f "$lib"; then
  1712. if test "$search_ext" = ".la"; then
  1713. found=yes
  1714. else
  1715. found=no
  1716. fi
  1717. break 2
  1718. fi
  1719. done
  1720. done
  1721. if test "$found" != yes; then
  1722. # deplib doesn't seem to be a libtool library
  1723. if test "$linkmode,$pass" = "prog,link"; then
  1724. compile_deplibs="$deplib $compile_deplibs"
  1725. finalize_deplibs="$deplib $finalize_deplibs"
  1726. else
  1727. deplibs="$deplib $deplibs"
  1728. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1729. fi
  1730. continue
  1731. else # deplib is a libtool library
  1732. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1733. # We need to do some special things here, and not later.
  1734. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1735. case " $predeps $postdeps " in
  1736. *" $deplib "*)
  1737. if (${SED} -e '2q' $lib |
  1738. grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1739. library_names=
  1740. old_library=
  1741. case $lib in
  1742. */* | *\\*) . $lib ;;
  1743. *) . ./$lib ;;
  1744. esac
  1745. for l in $old_library $library_names; do
  1746. ll="$l"
  1747. done
  1748. if test "X$ll" = "X$old_library" ; then # only static version available
  1749. found=no
  1750. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1751. test "X$ladir" = "X$lib" && ladir="."
  1752. lib=$ladir/$old_library
  1753. if test "$linkmode,$pass" = "prog,link"; then
  1754. compile_deplibs="$deplib $compile_deplibs"
  1755. finalize_deplibs="$deplib $finalize_deplibs"
  1756. else
  1757. deplibs="$deplib $deplibs"
  1758. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1759. fi
  1760. continue
  1761. fi
  1762. fi
  1763. ;;
  1764. *) ;;
  1765. esac
  1766. fi
  1767. fi
  1768. ;; # -l
  1769. -L*)
  1770. case $linkmode in
  1771. lib)
  1772. deplibs="$deplib $deplibs"
  1773. test "$pass" = conv && continue
  1774. newdependency_libs="$deplib $newdependency_libs"
  1775. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1776. ;;
  1777. prog)
  1778. if test "$pass" = conv; then
  1779. deplibs="$deplib $deplibs"
  1780. continue
  1781. fi
  1782. if test "$pass" = scan; then
  1783. deplibs="$deplib $deplibs"
  1784. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1785. else
  1786. compile_deplibs="$deplib $compile_deplibs"
  1787. finalize_deplibs="$deplib $finalize_deplibs"
  1788. fi
  1789. ;;
  1790. *)
  1791. $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1792. ;;
  1793. esac # linkmode
  1794. continue
  1795. ;; # -L
  1796. -R*)
  1797. if test "$pass" = link; then
  1798. dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1799. # Make sure the xrpath contains only unique directories.
  1800. case "$xrpath " in
  1801. *" $dir "*) ;;
  1802. *) xrpath="$xrpath $dir" ;;
  1803. esac
  1804. fi
  1805. deplibs="$deplib $deplibs"
  1806. continue
  1807. ;;
  1808. *.la) lib="$deplib" ;;
  1809. *.$libext)
  1810. if test "$pass" = conv; then
  1811. deplibs="$deplib $deplibs"
  1812. continue
  1813. fi
  1814. case $linkmode in
  1815. lib)
  1816. if test "$deplibs_check_method" != pass_all; then
  1817. $echo
  1818. $echo "*** Warning: Trying to link with static lib archive $deplib."
  1819. $echo "*** I have the capability to make that library automatically link in when"
  1820. $echo "*** you link to this library. But I can only do this if you have a"
  1821. $echo "*** shared version of the library, which you do not appear to have"
  1822. $echo "*** because the file extensions .$libext of this argument makes me believe"
  1823. $echo "*** that it is just a static archive that I should not used here."
  1824. else
  1825. $echo
  1826. $echo "*** Warning: Linking the shared library $output against the"
  1827. $echo "*** static library $deplib is not portable!"
  1828. deplibs="$deplib $deplibs"
  1829. fi
  1830. continue
  1831. ;;
  1832. prog)
  1833. if test "$pass" != link; then
  1834. deplibs="$deplib $deplibs"
  1835. else
  1836. compile_deplibs="$deplib $compile_deplibs"
  1837. finalize_deplibs="$deplib $finalize_deplibs"
  1838. fi
  1839. continue
  1840. ;;
  1841. esac # linkmode
  1842. ;; # *.$libext
  1843. *.lo | *.$objext)
  1844. if test "$pass" = conv; then
  1845. deplibs="$deplib $deplibs"
  1846. elif test "$linkmode" = prog; then
  1847. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1848. # If there is no dlopen support or we're linking statically,
  1849. # we need to preload.
  1850. newdlprefiles="$newdlprefiles $deplib"
  1851. compile_deplibs="$deplib $compile_deplibs"
  1852. finalize_deplibs="$deplib $finalize_deplibs"
  1853. else
  1854. newdlfiles="$newdlfiles $deplib"
  1855. fi
  1856. fi
  1857. continue
  1858. ;;
  1859. %DEPLIBS%)
  1860. alldeplibs=yes
  1861. continue
  1862. ;;
  1863. esac # case $deplib
  1864. if test "$found" = yes || test -f "$lib"; then :
  1865. else
  1866. $echo "$modename: cannot find the library \`$lib'" 1>&2
  1867. exit 1
  1868. fi
  1869. # Check to see that this really is a libtool archive.
  1870. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1871. else
  1872. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1873. exit 1
  1874. fi
  1875. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1876. test "X$ladir" = "X$lib" && ladir="."
  1877. dlname=
  1878. dlopen=
  1879. dlpreopen=
  1880. libdir=
  1881. library_names=
  1882. old_library=
  1883. # If the library was installed with an old release of libtool,
  1884. # it will not redefine variables installed, or shouldnotlink
  1885. installed=yes
  1886. shouldnotlink=no
  1887. # Read the .la file
  1888. case $lib in
  1889. */* | *\\*) . $lib ;;
  1890. *) . ./$lib ;;
  1891. esac
  1892. if test "$linkmode,$pass" = "lib,link" ||
  1893. test "$linkmode,$pass" = "prog,scan" ||
  1894. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  1895. test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  1896. test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  1897. fi
  1898. if test "$pass" = conv; then
  1899. # Only check for convenience libraries
  1900. deplibs="$lib $deplibs"
  1901. if test -z "$libdir"; then
  1902. if test -z "$old_library"; then
  1903. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1904. exit 1
  1905. fi
  1906. # It is a libtool convenience library, so add in its objects.
  1907. convenience="$convenience $ladir/$objdir/$old_library"
  1908. old_convenience="$old_convenience $ladir/$objdir/$old_library"
  1909. tmp_libs=
  1910. for deplib in $dependency_libs; do
  1911. deplibs="$deplib $deplibs"
  1912. if test "X$duplicate_deps" = "Xyes" ; then
  1913. case "$tmp_libs " in
  1914. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1915. esac
  1916. fi
  1917. tmp_libs="$tmp_libs $deplib"
  1918. done
  1919. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  1920. $echo "$modename: \`$lib' is not a convenience library" 1>&2
  1921. exit 1
  1922. fi
  1923. continue
  1924. fi # $pass = conv
  1925. # Get the name of the library we link against.
  1926. linklib=
  1927. for l in $old_library $library_names; do
  1928. linklib="$l"
  1929. done
  1930. if test -z "$linklib"; then
  1931. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1932. exit 1
  1933. fi
  1934. # This library was specified with -dlopen.
  1935. if test "$pass" = dlopen; then
  1936. if test -z "$libdir"; then
  1937. $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  1938. exit 1
  1939. fi
  1940. if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1941. # If there is no dlname, no dlopen support or we're linking
  1942. # statically, we need to preload. We also need to preload any
  1943. # dependent libraries so libltdl's deplib preloader doesn't
  1944. # bomb out in the load deplibs phase.
  1945. dlprefiles="$dlprefiles $lib $dependency_libs"
  1946. else
  1947. newdlfiles="$newdlfiles $lib"
  1948. fi
  1949. continue
  1950. fi # $pass = dlopen
  1951. # We need an absolute path.
  1952. case $ladir in
  1953. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  1954. *)
  1955. abs_ladir=`cd "$ladir" && pwd`
  1956. if test -z "$abs_ladir"; then
  1957. $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  1958. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1959. abs_ladir="$ladir"
  1960. fi
  1961. ;;
  1962. esac
  1963. laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1964. # Find the relevant object directory and library name.
  1965. if test "X$installed" = Xyes; then
  1966. if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1967. $echo "$modename: warning: library \`$lib' was moved." 1>&2
  1968. dir="$ladir"
  1969. absdir="$abs_ladir"
  1970. libdir="$abs_ladir"
  1971. else
  1972. dir="$libdir"
  1973. absdir="$libdir"
  1974. fi
  1975. else
  1976. dir="$ladir/$objdir"
  1977. absdir="$abs_ladir/$objdir"
  1978. # Remove this search path later
  1979. notinst_path="$notinst_path $abs_ladir"
  1980. fi # $installed = yes
  1981. name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1982. # This library was specified with -dlpreopen.
  1983. if test "$pass" = dlpreopen; then
  1984. if test -z "$libdir"; then
  1985. $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  1986. exit 1
  1987. fi
  1988. # Prefer using a static library (so that no silly _DYNAMIC symbols
  1989. # are required to link).
  1990. if test -n "$old_library"; then
  1991. newdlprefiles="$newdlprefiles $dir/$old_library"
  1992. # Otherwise, use the dlname, so that lt_dlopen finds it.
  1993. elif test -n "$dlname"; then
  1994. newdlprefiles="$newdlprefiles $dir/$dlname"
  1995. else
  1996. newdlprefiles="$newdlprefiles $dir/$linklib"
  1997. fi
  1998. fi # $pass = dlpreopen
  1999. if test -z "$libdir"; then
  2000. # Link the convenience library
  2001. if test "$linkmode" = lib; then
  2002. deplibs="$dir/$old_library $deplibs"
  2003. elif test "$linkmode,$pass" = "prog,link"; then
  2004. compile_deplibs="$dir/$old_library $compile_deplibs"
  2005. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  2006. else
  2007. deplibs="$lib $deplibs" # used for prog,scan pass
  2008. fi
  2009. continue
  2010. fi
  2011. if test "$linkmode" = prog && test "$pass" != link; then
  2012. newlib_search_path="$newlib_search_path $ladir"
  2013. deplibs="$lib $deplibs"
  2014. linkalldeplibs=no
  2015. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  2016. test "$build_libtool_libs" = no; then
  2017. linkalldeplibs=yes
  2018. fi
  2019. tmp_libs=
  2020. for deplib in $dependency_libs; do
  2021. case $deplib in
  2022. -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  2023. esac
  2024. # Need to link against all dependency_libs?
  2025. if test "$linkalldeplibs" = yes; then
  2026. deplibs="$deplib $deplibs"
  2027. else
  2028. # Need to hardcode shared library paths
  2029. # or/and link against static libraries
  2030. newdependency_libs="$deplib $newdependency_libs"
  2031. fi
  2032. if test "X$duplicate_deps" = "Xyes" ; then
  2033. case "$tmp_libs " in
  2034. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2035. esac
  2036. fi
  2037. tmp_libs="$tmp_libs $deplib"
  2038. done # for deplib
  2039. continue
  2040. fi # $linkmode = prog...
  2041. if test "$linkmode,$pass" = "prog,link"; then
  2042. if test -n "$library_names" &&
  2043. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2044. # We need to hardcode the library path
  2045. if test -n "$shlibpath_var"; then
  2046. # Make sure the rpath contains only unique directories.
  2047. case "$temp_rpath " in
  2048. *" $dir "*) ;;
  2049. *" $absdir "*) ;;
  2050. *) temp_rpath="$temp_rpath $dir" ;;
  2051. esac
  2052. fi
  2053. # Hardcode the library path.
  2054. # Skip directories that are in the system default run-time
  2055. # search path.
  2056. case " $sys_lib_dlsearch_path " in
  2057. *" $absdir "*) ;;
  2058. *)
  2059. case "$compile_rpath " in
  2060. *" $absdir "*) ;;
  2061. *) compile_rpath="$compile_rpath $absdir"
  2062. esac
  2063. ;;
  2064. esac
  2065. case " $sys_lib_dlsearch_path " in
  2066. *" $libdir "*) ;;
  2067. *)
  2068. case "$finalize_rpath " in
  2069. *" $libdir "*) ;;
  2070. *) finalize_rpath="$finalize_rpath $libdir"
  2071. esac
  2072. ;;
  2073. esac
  2074. fi # $linkmode,$pass = prog,link...
  2075. if test "$alldeplibs" = yes &&
  2076. { test "$deplibs_check_method" = pass_all ||
  2077. { test "$build_libtool_libs" = yes &&
  2078. test -n "$library_names"; }; }; then
  2079. # We only need to search for static libraries
  2080. continue
  2081. fi
  2082. fi
  2083. link_static=no # Whether the deplib will be linked statically
  2084. if test -n "$library_names" &&
  2085. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2086. if test "$installed" = no; then
  2087. notinst_deplibs="$notinst_deplibs $lib"
  2088. need_relink=yes
  2089. fi
  2090. # This is a shared library
  2091. # Warn about portability, can't link against -module's on some systems (darwin)
  2092. if test "$shouldnotlink" = yes && test "$pass" = link ; then
  2093. $echo
  2094. if test "$linkmode" = prog; then
  2095. $echo "*** Warning: Linking the executable $output against the loadable module"
  2096. else
  2097. $echo "*** Warning: Linking the shared library $output against the loadable module"
  2098. fi
  2099. $echo "*** $linklib is not portable!"
  2100. fi
  2101. if test "$linkmode" = lib &&
  2102. test "$hardcode_into_libs" = yes; then
  2103. # Hardcode the library path.
  2104. # Skip directories that are in the system default run-time
  2105. # search path.
  2106. case " $sys_lib_dlsearch_path " in
  2107. *" $absdir "*) ;;
  2108. *)
  2109. case "$compile_rpath " in
  2110. *" $absdir "*) ;;
  2111. *) compile_rpath="$compile_rpath $absdir"
  2112. esac
  2113. ;;
  2114. esac
  2115. case " $sys_lib_dlsearch_path " in
  2116. *" $libdir "*) ;;
  2117. *)
  2118. case "$finalize_rpath " in
  2119. *" $libdir "*) ;;
  2120. *) finalize_rpath="$finalize_rpath $libdir"
  2121. esac
  2122. ;;
  2123. esac
  2124. fi
  2125. if test -n "$old_archive_from_expsyms_cmds"; then
  2126. # figure out the soname
  2127. set dummy $library_names
  2128. realname="$2"
  2129. shift; shift
  2130. libname=`eval \\$echo \"$libname_spec\"`
  2131. # use dlname if we got it. it's perfectly good, no?
  2132. if test -n "$dlname"; then
  2133. soname="$dlname"
  2134. elif test -n "$soname_spec"; then
  2135. # bleh windows
  2136. case $host in
  2137. *cygwin* | mingw*)
  2138. major=`expr $current - $age`
  2139. versuffix="-$major"
  2140. ;;
  2141. esac
  2142. eval soname=\"$soname_spec\"
  2143. else
  2144. soname="$realname"
  2145. fi
  2146. # Make a new name for the extract_expsyms_cmds to use
  2147. soroot="$soname"
  2148. soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  2149. newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  2150. # If the library has no export list, then create one now
  2151. if test -f "$output_objdir/$soname-def"; then :
  2152. else
  2153. $show "extracting exported symbol list from \`$soname'"
  2154. save_ifs="$IFS"; IFS='~'
  2155. cmds=$extract_expsyms_cmds
  2156. for cmd in $cmds; do
  2157. IFS="$save_ifs"
  2158. eval cmd=\"$cmd\"
  2159. $show "$cmd"
  2160. $run eval "$cmd" || exit $?
  2161. done
  2162. IFS="$save_ifs"
  2163. fi
  2164. # Create $newlib
  2165. if test -f "$output_objdir/$newlib"; then :; else
  2166. $show "generating import library for \`$soname'"
  2167. save_ifs="$IFS"; IFS='~'
  2168. cmds=$old_archive_from_expsyms_cmds
  2169. for cmd in $cmds; do
  2170. IFS="$save_ifs"
  2171. eval cmd=\"$cmd\"
  2172. $show "$cmd"
  2173. $run eval "$cmd" || exit $?
  2174. done
  2175. IFS="$save_ifs"
  2176. fi
  2177. # make sure the library variables are pointing to the new library
  2178. dir=$output_objdir
  2179. linklib=$newlib
  2180. fi # test -n "$old_archive_from_expsyms_cmds"
  2181. if test "$linkmode" = prog || test "$mode" != relink; then
  2182. add_shlibpath=
  2183. add_dir=
  2184. add=
  2185. lib_linked=yes
  2186. case $hardcode_action in
  2187. immediate | unsupported)
  2188. if test "$hardcode_direct" = no; then
  2189. add="$dir/$linklib"
  2190. case $host in
  2191. *-*-sco3.2v5* ) add_dir="-L$dir" ;;
  2192. *-*-darwin* )
  2193. # if the lib is a module then we can not link against it, someone
  2194. # is ignoring the new warnings I added
  2195. if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
  2196. $echo "** Warning, lib $linklib is a module, not a shared library"
  2197. if test -z "$old_library" ; then
  2198. $echo
  2199. $echo "** And there doesn't seem to be a static archive available"
  2200. $echo "** The link will probably fail, sorry"
  2201. else
  2202. add="$dir/$old_library"
  2203. fi
  2204. fi
  2205. esac
  2206. elif test "$hardcode_minus_L" = no; then
  2207. case $host in
  2208. *-*-sunos*) add_shlibpath="$dir" ;;
  2209. esac
  2210. add_dir="-L$dir"
  2211. add="-l$name"
  2212. elif test "$hardcode_shlibpath_var" = no; then
  2213. add_shlibpath="$dir"
  2214. add="-l$name"
  2215. else
  2216. lib_linked=no
  2217. fi
  2218. ;;
  2219. relink)
  2220. if test "$hardcode_direct" = yes; then
  2221. add="$dir/$linklib"
  2222. elif test "$hardcode_minus_L" = yes; then
  2223. add_dir="-L$dir"
  2224. # Try looking first in the location we're being installed to.
  2225. if test -n "$inst_prefix_dir"; then
  2226. case "$libdir" in
  2227. [\\/]*)
  2228. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2229. ;;
  2230. esac
  2231. fi
  2232. add="-l$name"
  2233. elif test "$hardcode_shlibpath_var" = yes; then
  2234. add_shlibpath="$dir"
  2235. add="-l$name"
  2236. else
  2237. lib_linked=no
  2238. fi
  2239. ;;
  2240. *) lib_linked=no ;;
  2241. esac
  2242. if test "$lib_linked" != yes; then
  2243. $echo "$modename: configuration error: unsupported hardcode properties"
  2244. exit 1
  2245. fi
  2246. if test -n "$add_shlibpath"; then
  2247. case :$compile_shlibpath: in
  2248. *":$add_shlibpath:"*) ;;
  2249. *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  2250. esac
  2251. fi
  2252. if test "$linkmode" = prog; then
  2253. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  2254. test -n "$add" && compile_deplibs="$add $compile_deplibs"