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

/contrib/bind9/ltmain.sh

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