PageRenderTime 126ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/trunk/freefem/admin/ltmain.sh

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