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

/config/ltmain.sh

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