PageRenderTime 89ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/Unittests/googletest/build-aux/ltmain.sh

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