PageRenderTime 98ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/ltmain.sh

https://bitbucket.org/libusbandroid/libusb-compat-android
Shell | 8461 lines | 6920 code | 603 blank | 938 comment | 841 complexity | e5b9f87326dbd639e117a7aa1e7e1606 MD5 | raw file
Possible License(s): LGPL-2.1
  1. # Generated from ltmain.m4sh.
  2. # ltmain.sh (GNU libtool) 2.2.6
  3. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
  5. # This is free software; see the source for copying conditions. There is NO
  6. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  7. # GNU Libtool is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # As a special exception to the GNU General Public License,
  13. # if you distribute this file as part of a program or library that
  14. # is built using GNU Libtool, you may include this file under the
  15. # same distribution terms that you use for the rest of that program.
  16. #
  17. # GNU Libtool is distributed in the hope that it will be useful, but
  18. # WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. # General Public License for more details.
  21. #
  22. # You should have received a copy of the GNU General Public License
  23. # along with GNU Libtool; see the file COPYING. If not, a copy
  24. # can be downloaded from http://www.gnu.org/licenses/gpl.html,
  25. # or obtained by writing to the Free Software Foundation, Inc.,
  26. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  27. # Usage: $progname [OPTION]... [MODE-ARG]...
  28. #
  29. # Provide generalized library-building support services.
  30. #
  31. # --config show all configuration variables
  32. # --debug enable verbose shell tracing
  33. # -n, --dry-run display commands without modifying any files
  34. # --features display basic configuration information and exit
  35. # --mode=MODE use operation mode MODE
  36. # --preserve-dup-deps don't remove duplicate dependency libraries
  37. # --quiet, --silent don't print informational messages
  38. # --tag=TAG use configuration variables from tag TAG
  39. # -v, --verbose print informational messages (default)
  40. # --version print version information
  41. # -h, --help print short or long help message
  42. #
  43. # MODE must be one of the following:
  44. #
  45. # clean remove files from the build directory
  46. # compile compile a source file into a libtool object
  47. # execute automatically set library path, then run a program
  48. # finish complete the installation of libtool libraries
  49. # install install libraries or executables
  50. # link create a library or an executable
  51. # uninstall remove libraries from an installed directory
  52. #
  53. # MODE-ARGS vary depending on the MODE.
  54. # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
  55. #
  56. # When reporting a bug, please describe a test case to reproduce it and
  57. # include the following information:
  58. #
  59. # host-triplet: $host
  60. # shell: $SHELL
  61. # compiler: $LTCC
  62. # compiler flags: $LTCFLAGS
  63. # linker: $LD (gnu? $with_gnu_ld)
  64. # $progname: (GNU libtool) 2.2.6
  65. # automake: $automake_version
  66. # autoconf: $autoconf_version
  67. #
  68. # Report bugs to <bug-libtool@gnu.org>.
  69. PROGRAM=ltmain.sh
  70. PACKAGE=libtool
  71. VERSION=2.2.6
  72. TIMESTAMP=""
  73. package_revision=1.3012
  74. # Be Bourne compatible
  75. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  76. emulate sh
  77. NULLCMD=:
  78. # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  79. # is contrary to our usage. Disable this feature.
  80. alias -g '${1+"$@"}'='"$@"'
  81. setopt NO_GLOB_SUBST
  82. else
  83. case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
  84. fi
  85. BIN_SH=xpg4; export BIN_SH # for Tru64
  86. DUALCASE=1; export DUALCASE # for MKS sh
  87. # NLS nuisances: We save the old values to restore during execute mode.
  88. # Only set LANG and LC_ALL to C if already set.
  89. # These must not be set unconditionally because not all systems understand
  90. # e.g. LANG=C (notably SCO).
  91. lt_user_locale=
  92. lt_safe_locale=
  93. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  94. do
  95. eval "if test \"\${$lt_var+set}\" = set; then
  96. save_$lt_var=\$$lt_var
  97. $lt_var=C
  98. export $lt_var
  99. lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
  100. lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
  101. fi"
  102. done
  103. $lt_unset CDPATH
  104. : ${CP="cp -f"}
  105. : ${ECHO="echo"}
  106. : ${EGREP="/usr/bin/grep -E"}
  107. : ${FGREP="/usr/bin/grep -F"}
  108. : ${GREP="/usr/bin/grep"}
  109. : ${LN_S="ln -s"}
  110. : ${MAKE="make"}
  111. : ${MKDIR="mkdir"}
  112. : ${MV="mv -f"}
  113. : ${RM="rm -f"}
  114. : ${SED="/opt/local/bin/gsed"}
  115. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  116. : ${Xsed="$SED -e 1s/^X//"}
  117. # Global variables:
  118. EXIT_SUCCESS=0
  119. EXIT_FAILURE=1
  120. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  121. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  122. exit_status=$EXIT_SUCCESS
  123. # Make sure IFS has a sensible default
  124. lt_nl='
  125. '
  126. IFS=" $lt_nl"
  127. dirname="s,/[^/]*$,,"
  128. basename="s,^.*/,,"
  129. # func_dirname_and_basename file append nondir_replacement
  130. # perform func_basename and func_dirname in a single function
  131. # call:
  132. # dirname: Compute the dirname of FILE. If nonempty,
  133. # add APPEND to the result, otherwise set result
  134. # to NONDIR_REPLACEMENT.
  135. # value returned in "$func_dirname_result"
  136. # basename: Compute filename of FILE.
  137. # value retuned in "$func_basename_result"
  138. # Implementation must be kept synchronized with func_dirname
  139. # and func_basename. For efficiency, we do not delegate to
  140. # those functions but instead duplicate the functionality here.
  141. func_dirname_and_basename ()
  142. {
  143. # Extract subdirectory from the argument.
  144. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
  145. if test "X$func_dirname_result" = "X${1}"; then
  146. func_dirname_result="${3}"
  147. else
  148. func_dirname_result="$func_dirname_result${2}"
  149. fi
  150. func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
  151. }
  152. # Generated shell functions inserted here.
  153. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  154. # is ksh but when the shell is invoked as "sh" and the current value of
  155. # the _XPG environment variable is not equal to 1 (one), the special
  156. # positional parameter $0, within a function call, is the name of the
  157. # function.
  158. progpath="$0"
  159. # The name of this program:
  160. # In the unlikely event $progname began with a '-', it would play havoc with
  161. # func_echo (imagine progname=-n), so we prepend ./ in that case:
  162. func_dirname_and_basename "$progpath"
  163. progname=$func_basename_result
  164. case $progname in
  165. -*) progname=./$progname ;;
  166. esac
  167. # Make sure we have an absolute path for reexecution:
  168. case $progpath in
  169. [\\/]*|[A-Za-z]:\\*) ;;
  170. *[\\/]*)
  171. progdir=$func_dirname_result
  172. progdir=`cd "$progdir" && pwd`
  173. progpath="$progdir/$progname"
  174. ;;
  175. *)
  176. save_IFS="$IFS"
  177. IFS=:
  178. for progdir in $PATH; do
  179. IFS="$save_IFS"
  180. test -x "$progdir/$progname" && break
  181. done
  182. IFS="$save_IFS"
  183. test -n "$progdir" || progdir=`pwd`
  184. progpath="$progdir/$progname"
  185. ;;
  186. esac
  187. # Sed substitution that helps us do robust quoting. It backslashifies
  188. # metacharacters that are still active within double-quoted strings.
  189. Xsed="${SED}"' -e 1s/^X//'
  190. sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
  191. # Same as above, but do not quote variable references.
  192. double_quote_subst='s/\(["`\\]\)/\\\1/g'
  193. # Re-`\' parameter expansions in output of double_quote_subst that were
  194. # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
  195. # in input to double_quote_subst, that '$' was protected from expansion.
  196. # Since each input `\' is now two `\'s, look for any number of runs of
  197. # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
  198. bs='\\'
  199. bs2='\\\\'
  200. bs4='\\\\\\\\'
  201. dollar='\$'
  202. sed_double_backslash="\
  203. s/$bs4/&\\
  204. /g
  205. s/^$bs2$dollar/$bs&/
  206. s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
  207. s/\n//g"
  208. # Standard options:
  209. opt_dry_run=false
  210. opt_help=false
  211. opt_quiet=false
  212. opt_verbose=false
  213. opt_warning=:
  214. # func_echo arg...
  215. # Echo program name prefixed message, along with the current mode
  216. # name if it has been set yet.
  217. func_echo ()
  218. {
  219. $ECHO "$progname${mode+: }$mode: $*"
  220. }
  221. # func_verbose arg...
  222. # Echo program name prefixed message in verbose mode only.
  223. func_verbose ()
  224. {
  225. $opt_verbose && func_echo ${1+"$@"}
  226. # A bug in bash halts the script if the last line of a function
  227. # fails when set -e is in force, so we need another command to
  228. # work around that:
  229. :
  230. }
  231. # func_error arg...
  232. # Echo program name prefixed message to standard error.
  233. func_error ()
  234. {
  235. $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
  236. }
  237. # func_warning arg...
  238. # Echo program name prefixed warning message to standard error.
  239. func_warning ()
  240. {
  241. $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
  242. # bash bug again:
  243. :
  244. }
  245. # func_fatal_error arg...
  246. # Echo program name prefixed message to standard error, and exit.
  247. func_fatal_error ()
  248. {
  249. func_error ${1+"$@"}
  250. exit $EXIT_FAILURE
  251. }
  252. # func_fatal_help arg...
  253. # Echo program name prefixed message to standard error, followed by
  254. # a help hint, and exit.
  255. func_fatal_help ()
  256. {
  257. func_error ${1+"$@"}
  258. func_fatal_error "$help"
  259. }
  260. help="Try \`$progname --help' for more information." ## default
  261. # func_grep expression filename
  262. # Check whether EXPRESSION matches any line of FILENAME, without output.
  263. func_grep ()
  264. {
  265. $GREP "$1" "$2" >/dev/null 2>&1
  266. }
  267. # func_mkdir_p directory-path
  268. # Make sure the entire path to DIRECTORY-PATH is available.
  269. func_mkdir_p ()
  270. {
  271. my_directory_path="$1"
  272. my_dir_list=
  273. if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
  274. # Protect directory names starting with `-'
  275. case $my_directory_path in
  276. -*) my_directory_path="./$my_directory_path" ;;
  277. esac
  278. # While some portion of DIR does not yet exist...
  279. while test ! -d "$my_directory_path"; do
  280. # ...make a list in topmost first order. Use a colon delimited
  281. # list incase some portion of path contains whitespace.
  282. my_dir_list="$my_directory_path:$my_dir_list"
  283. # If the last portion added has no slash in it, the list is done
  284. case $my_directory_path in */*) ;; *) break ;; esac
  285. # ...otherwise throw away the child directory and loop
  286. my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
  287. done
  288. my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
  289. save_mkdir_p_IFS="$IFS"; IFS=':'
  290. for my_dir in $my_dir_list; do
  291. IFS="$save_mkdir_p_IFS"
  292. # mkdir can fail with a `File exist' error if two processes
  293. # try to create one of the directories concurrently. Don't
  294. # stop in that case!
  295. $MKDIR "$my_dir" 2>/dev/null || :
  296. done
  297. IFS="$save_mkdir_p_IFS"
  298. # Bail out if we (or some other process) failed to create a directory.
  299. test -d "$my_directory_path" || \
  300. func_fatal_error "Failed to create \`$1'"
  301. fi
  302. }
  303. # func_mktempdir [string]
  304. # Make a temporary directory that won't clash with other running
  305. # libtool processes, and avoids race conditions if possible. If
  306. # given, STRING is the basename for that directory.
  307. func_mktempdir ()
  308. {
  309. my_template="${TMPDIR-/tmp}/${1-$progname}"
  310. if test "$opt_dry_run" = ":"; then
  311. # Return a directory name, but don't create it in dry-run mode
  312. my_tmpdir="${my_template}-$$"
  313. else
  314. # If mktemp works, use that first and foremost
  315. my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
  316. if test ! -d "$my_tmpdir"; then
  317. # Failing that, at least try and use $RANDOM to avoid a race
  318. my_tmpdir="${my_template}-${RANDOM-0}$$"
  319. save_mktempdir_umask=`umask`
  320. umask 0077
  321. $MKDIR "$my_tmpdir"
  322. umask $save_mktempdir_umask
  323. fi
  324. # If we're not in dry-run mode, bomb out on failure
  325. test -d "$my_tmpdir" || \
  326. func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
  327. fi
  328. $ECHO "X$my_tmpdir" | $Xsed
  329. }
  330. # func_quote_for_eval arg
  331. # Aesthetically quote ARG to be evaled later.
  332. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
  333. # is double-quoted, suitable for a subsequent eval, whereas
  334. # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
  335. # which are still active within double quotes backslashified.
  336. func_quote_for_eval ()
  337. {
  338. case $1 in
  339. *[\\\`\"\$]*)
  340. func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
  341. *)
  342. func_quote_for_eval_unquoted_result="$1" ;;
  343. esac
  344. case $func_quote_for_eval_unquoted_result in
  345. # Double-quote args containing shell metacharacters to delay
  346. # word splitting, command substitution and and variable
  347. # expansion for a subsequent eval.
  348. # Many Bourne shells cannot handle close brackets correctly
  349. # in scan sets, so we specify it separately.
  350. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  351. func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
  352. ;;
  353. *)
  354. func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
  355. esac
  356. }
  357. # func_quote_for_expand arg
  358. # Aesthetically quote ARG to be evaled later; same as above,
  359. # but do not quote variable references.
  360. func_quote_for_expand ()
  361. {
  362. case $1 in
  363. *[\\\`\"]*)
  364. my_arg=`$ECHO "X$1" | $Xsed \
  365. -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
  366. *)
  367. my_arg="$1" ;;
  368. esac
  369. case $my_arg in
  370. # Double-quote args containing shell metacharacters to delay
  371. # word splitting and command substitution for a subsequent eval.
  372. # Many Bourne shells cannot handle close brackets correctly
  373. # in scan sets, so we specify it separately.
  374. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  375. my_arg="\"$my_arg\""
  376. ;;
  377. esac
  378. func_quote_for_expand_result="$my_arg"
  379. }
  380. # func_show_eval cmd [fail_exp]
  381. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  382. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  383. # is given, then evaluate it.
  384. func_show_eval ()
  385. {
  386. my_cmd="$1"
  387. my_fail_exp="${2-:}"
  388. ${opt_silent-false} || {
  389. func_quote_for_expand "$my_cmd"
  390. eval "func_echo $func_quote_for_expand_result"
  391. }
  392. if ${opt_dry_run-false}; then :; else
  393. eval "$my_cmd"
  394. my_status=$?
  395. if test "$my_status" -eq 0; then :; else
  396. eval "(exit $my_status); $my_fail_exp"
  397. fi
  398. fi
  399. }
  400. # func_show_eval_locale cmd [fail_exp]
  401. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  402. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  403. # is given, then evaluate it. Use the saved locale for evaluation.
  404. func_show_eval_locale ()
  405. {
  406. my_cmd="$1"
  407. my_fail_exp="${2-:}"
  408. ${opt_silent-false} || {
  409. func_quote_for_expand "$my_cmd"
  410. eval "func_echo $func_quote_for_expand_result"
  411. }
  412. if ${opt_dry_run-false}; then :; else
  413. eval "$lt_user_locale
  414. $my_cmd"
  415. my_status=$?
  416. eval "$lt_safe_locale"
  417. if test "$my_status" -eq 0; then :; else
  418. eval "(exit $my_status); $my_fail_exp"
  419. fi
  420. fi
  421. }
  422. # func_version
  423. # Echo version message to standard output and exit.
  424. func_version ()
  425. {
  426. $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
  427. s/^# //
  428. s/^# *$//
  429. s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
  430. p
  431. }' < "$progpath"
  432. exit $?
  433. }
  434. # func_usage
  435. # Echo short help message to standard output and exit.
  436. func_usage ()
  437. {
  438. $SED -n '/^# Usage:/,/# -h/ {
  439. s/^# //
  440. s/^# *$//
  441. s/\$progname/'$progname'/
  442. p
  443. }' < "$progpath"
  444. $ECHO
  445. $ECHO "run \`$progname --help | more' for full usage"
  446. exit $?
  447. }
  448. # func_help
  449. # Echo long help message to standard output and exit.
  450. func_help ()
  451. {
  452. $SED -n '/^# Usage:/,/# Report bugs to/ {
  453. s/^# //
  454. s/^# *$//
  455. s*\$progname*'$progname'*
  456. s*\$host*'"$host"'*
  457. s*\$SHELL*'"$SHELL"'*
  458. s*\$LTCC*'"$LTCC"'*
  459. s*\$LTCFLAGS*'"$LTCFLAGS"'*
  460. s*\$LD*'"$LD"'*
  461. s/\$with_gnu_ld/'"$with_gnu_ld"'/
  462. s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
  463. s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
  464. p
  465. }' < "$progpath"
  466. exit $?
  467. }
  468. # func_missing_arg argname
  469. # Echo program name prefixed message to standard error and set global
  470. # exit_cmd.
  471. func_missing_arg ()
  472. {
  473. func_error "missing argument for $1"
  474. exit_cmd=exit
  475. }
  476. exit_cmd=:
  477. # Check that we have a working $ECHO.
  478. if test "X$1" = X--no-reexec; then
  479. # Discard the --no-reexec flag, and continue.
  480. shift
  481. elif test "X$1" = X--fallback-echo; then
  482. # Avoid inline document here, it may be left over
  483. :
  484. elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
  485. # Yippee, $ECHO works!
  486. :
  487. else
  488. # Restart under the correct shell, and then maybe $ECHO will work.
  489. exec $SHELL "$progpath" --no-reexec ${1+"$@"}
  490. fi
  491. # Same for EGREP, and just to be sure, do LTCC as well
  492. if test "x$EGREP" = x ; then
  493. EGREP=egrep
  494. fi
  495. if test "x$LTCC" = x ; then
  496. LTCC=${CC-gcc}
  497. fi
  498. if test "X$1" = X--fallback-echo; then
  499. # used as fallback echo
  500. shift
  501. cat <<EOF
  502. $*
  503. EOF
  504. exit $EXIT_SUCCESS
  505. fi
  506. magic="%%%MAGIC variable%%%"
  507. magic_exe="%%%MAGIC EXE variable%%%"
  508. # Global variables.
  509. # $mode is unset
  510. nonopt=
  511. execute_dlfiles=
  512. preserve_args=
  513. lo2o="s/\\.lo\$/.${objext}/"
  514. o2lo="s/\\.${objext}\$/.lo/"
  515. extracted_archives=
  516. extracted_serial=0
  517. opt_dry_run=false
  518. opt_duplicate_deps=false
  519. opt_silent=false
  520. opt_debug=:
  521. # If this variable is set in any of the actions, the command in it
  522. # will be execed at the end. This prevents here-documents from being
  523. # left over by shells.
  524. exec_cmd=
  525. # func_fatal_configuration arg...
  526. # Echo program name prefixed message to standard error, followed by
  527. # a configuration failure hint, and exit.
  528. func_fatal_configuration ()
  529. {
  530. func_error ${1+"$@"}
  531. func_error "See the $PACKAGE documentation for more information."
  532. func_fatal_error "Fatal configuration error."
  533. }
  534. # func_config
  535. # Display the configuration for all the tags in this script.
  536. func_config ()
  537. {
  538. re_begincf='^# ### BEGIN LIBTOOL'
  539. re_endcf='^# ### END LIBTOOL'
  540. # Default configuration.
  541. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  542. # Now print the configurations for the tags.
  543. for tagname in $taglist; do
  544. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  545. done
  546. exit $?
  547. }
  548. # func_features
  549. # Display the features supported by this script.
  550. func_features ()
  551. {
  552. $ECHO "host: $host"
  553. if test "$build_libtool_libs" = yes; then
  554. $ECHO "enable shared libraries"
  555. else
  556. $ECHO "disable shared libraries"
  557. fi
  558. if test "$build_old_libs" = yes; then
  559. $ECHO "enable static libraries"
  560. else
  561. $ECHO "disable static libraries"
  562. fi
  563. exit $?
  564. }
  565. # func_enable_tag tagname
  566. # Verify that TAGNAME is valid, and either flag an error and exit, or
  567. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  568. # variable here.
  569. func_enable_tag ()
  570. {
  571. # Global variable:
  572. tagname="$1"
  573. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  574. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  575. sed_extractcf="/$re_begincf/,/$re_endcf/p"
  576. # Validate tagname.
  577. case $tagname in
  578. *[!-_A-Za-z0-9,/]*)
  579. func_fatal_error "invalid tag name: $tagname"
  580. ;;
  581. esac
  582. # Don't test for the "default" C tag, as we know it's
  583. # there but not specially marked.
  584. case $tagname in
  585. CC) ;;
  586. *)
  587. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  588. taglist="$taglist $tagname"
  589. # Evaluate the configuration. Be careful to quote the path
  590. # and the sed script, to avoid splitting on whitespace, but
  591. # also don't use non-portable quotes within backquotes within
  592. # quotes we have to do it in 2 steps:
  593. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  594. eval "$extractedcf"
  595. else
  596. func_error "ignoring unknown tag $tagname"
  597. fi
  598. ;;
  599. esac
  600. }
  601. # Parse options once, thoroughly. This comes as soon as possible in
  602. # the script to make things like `libtool --version' happen quickly.
  603. {
  604. # Shorthand for --mode=foo, only valid as the first argument
  605. case $1 in
  606. clean|clea|cle|cl)
  607. shift; set dummy --mode clean ${1+"$@"}; shift
  608. ;;
  609. compile|compil|compi|comp|com|co|c)
  610. shift; set dummy --mode compile ${1+"$@"}; shift
  611. ;;
  612. execute|execut|execu|exec|exe|ex|e)
  613. shift; set dummy --mode execute ${1+"$@"}; shift
  614. ;;
  615. finish|finis|fini|fin|fi|f)
  616. shift; set dummy --mode finish ${1+"$@"}; shift
  617. ;;
  618. install|instal|insta|inst|ins|in|i)
  619. shift; set dummy --mode install ${1+"$@"}; shift
  620. ;;
  621. link|lin|li|l)
  622. shift; set dummy --mode link ${1+"$@"}; shift
  623. ;;
  624. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  625. shift; set dummy --mode uninstall ${1+"$@"}; shift
  626. ;;
  627. esac
  628. # Parse non-mode specific arguments:
  629. while test "$#" -gt 0; do
  630. opt="$1"
  631. shift
  632. case $opt in
  633. --config) func_config ;;
  634. --debug) preserve_args="$preserve_args $opt"
  635. func_echo "enabling shell trace mode"
  636. opt_debug='set -x'
  637. $opt_debug
  638. ;;
  639. -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
  640. execute_dlfiles="$execute_dlfiles $1"
  641. shift
  642. ;;
  643. --dry-run | -n) opt_dry_run=: ;;
  644. --features) func_features ;;
  645. --finish) mode="finish" ;;
  646. --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
  647. case $1 in
  648. # Valid mode arguments:
  649. clean) ;;
  650. compile) ;;
  651. execute) ;;
  652. finish) ;;
  653. install) ;;
  654. link) ;;
  655. relink) ;;
  656. uninstall) ;;
  657. # Catch anything else as an error
  658. *) func_error "invalid argument for $opt"
  659. exit_cmd=exit
  660. break
  661. ;;
  662. esac
  663. mode="$1"
  664. shift
  665. ;;
  666. --preserve-dup-deps)
  667. opt_duplicate_deps=: ;;
  668. --quiet|--silent) preserve_args="$preserve_args $opt"
  669. opt_silent=:
  670. ;;
  671. --verbose| -v) preserve_args="$preserve_args $opt"
  672. opt_silent=false
  673. ;;
  674. --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
  675. preserve_args="$preserve_args $opt $1"
  676. func_enable_tag "$1" # tagname is set here
  677. shift
  678. ;;
  679. # Separate optargs to long options:
  680. -dlopen=*|--mode=*|--tag=*)
  681. func_opt_split "$opt"
  682. set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
  683. shift
  684. ;;
  685. -\?|-h) func_usage ;;
  686. --help) opt_help=: ;;
  687. --version) func_version ;;
  688. -*) func_fatal_help "unrecognized option \`$opt'" ;;
  689. *) nonopt="$opt"
  690. break
  691. ;;
  692. esac
  693. done
  694. case $host in
  695. *cygwin* | *mingw* | *pw32* | *cegcc*)
  696. # don't eliminate duplications in $postdeps and $predeps
  697. opt_duplicate_compiler_generated_deps=:
  698. ;;
  699. *)
  700. opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
  701. ;;
  702. esac
  703. # Having warned about all mis-specified options, bail out if
  704. # anything was wrong.
  705. $exit_cmd $EXIT_FAILURE
  706. }
  707. # func_check_version_match
  708. # Ensure that we are using m4 macros, and libtool script from the same
  709. # release of libtool.
  710. func_check_version_match ()
  711. {
  712. if test "$package_revision" != "$macro_revision"; then
  713. if test "$VERSION" != "$macro_version"; then
  714. if test -z "$macro_version"; then
  715. cat >&2 <<_LT_EOF
  716. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  717. $progname: definition of this LT_INIT comes from an older release.
  718. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  719. $progname: and run autoconf again.
  720. _LT_EOF
  721. else
  722. cat >&2 <<_LT_EOF
  723. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  724. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  725. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  726. $progname: and run autoconf again.
  727. _LT_EOF
  728. fi
  729. else
  730. cat >&2 <<_LT_EOF
  731. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  732. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  733. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  734. $progname: of $PACKAGE $VERSION and run autoconf again.
  735. _LT_EOF
  736. fi
  737. exit $EXIT_MISMATCH
  738. fi
  739. }
  740. ## ----------- ##
  741. ## Main. ##
  742. ## ----------- ##
  743. $opt_help || {
  744. # Sanity checks first:
  745. func_check_version_match
  746. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  747. func_fatal_configuration "not configured to build any kind of library"
  748. fi
  749. test -z "$mode" && func_fatal_error "error: you must specify a MODE."
  750. # Darwin sucks
  751. eval std_shrext=\"$shrext_cmds\"
  752. # Only execute mode is allowed to have -dlopen flags.
  753. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  754. func_error "unrecognized option \`-dlopen'"
  755. $ECHO "$help" 1>&2
  756. exit $EXIT_FAILURE
  757. fi
  758. # Change the help message to a mode-specific one.
  759. generic_help="$help"
  760. help="Try \`$progname --help --mode=$mode' for more information."
  761. }
  762. # func_lalib_p file
  763. # True iff FILE is a libtool `.la' library or `.lo' object file.
  764. # This function is only a basic sanity check; it will hardly flush out
  765. # determined imposters.
  766. func_lalib_p ()
  767. {
  768. test -f "$1" &&
  769. $SED -e 4q "$1" 2>/dev/null \
  770. | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  771. }
  772. # func_lalib_unsafe_p file
  773. # True iff FILE is a libtool `.la' library or `.lo' object file.
  774. # This function implements the same check as func_lalib_p without
  775. # resorting to external programs. To this end, it redirects stdin and
  776. # closes it afterwards, without saving the original file descriptor.
  777. # As a safety measure, use it only where a negative result would be
  778. # fatal anyway. Works if `file' does not exist.
  779. func_lalib_unsafe_p ()
  780. {
  781. lalib_p=no
  782. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  783. for lalib_p_l in 1 2 3 4
  784. do
  785. read lalib_p_line
  786. case "$lalib_p_line" in
  787. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  788. esac
  789. done
  790. exec 0<&5 5<&-
  791. fi
  792. test "$lalib_p" = yes
  793. }
  794. # func_ltwrapper_script_p file
  795. # True iff FILE is a libtool wrapper script
  796. # This function is only a basic sanity check; it will hardly flush out
  797. # determined imposters.
  798. func_ltwrapper_script_p ()
  799. {
  800. func_lalib_p "$1"
  801. }
  802. # func_ltwrapper_executable_p file
  803. # True iff FILE is a libtool wrapper executable
  804. # This function is only a basic sanity check; it will hardly flush out
  805. # determined imposters.
  806. func_ltwrapper_executable_p ()
  807. {
  808. func_ltwrapper_exec_suffix=
  809. case $1 in
  810. *.exe) ;;
  811. *) func_ltwrapper_exec_suffix=.exe ;;
  812. esac
  813. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  814. }
  815. # func_ltwrapper_scriptname file
  816. # Assumes file is an ltwrapper_executable
  817. # uses $file to determine the appropriate filename for a
  818. # temporary ltwrapper_script.
  819. func_ltwrapper_scriptname ()
  820. {
  821. func_ltwrapper_scriptname_result=""
  822. if func_ltwrapper_executable_p "$1"; then
  823. func_dirname_and_basename "$1" "" "."
  824. func_stripname '' '.exe' "$func_basename_result"
  825. func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
  826. fi
  827. }
  828. # func_ltwrapper_p file
  829. # True iff FILE is a libtool wrapper script or wrapper executable
  830. # This function is only a basic sanity check; it will hardly flush out
  831. # determined imposters.
  832. func_ltwrapper_p ()
  833. {
  834. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  835. }
  836. # func_execute_cmds commands fail_cmd
  837. # Execute tilde-delimited COMMANDS.
  838. # If FAIL_CMD is given, eval that upon failure.
  839. # FAIL_CMD may read-access the current command in variable CMD!
  840. func_execute_cmds ()
  841. {
  842. $opt_debug
  843. save_ifs=$IFS; IFS='~'
  844. for cmd in $1; do
  845. IFS=$save_ifs
  846. eval cmd=\"$cmd\"
  847. func_show_eval "$cmd" "${2-:}"
  848. done
  849. IFS=$save_ifs
  850. }
  851. # func_source file
  852. # Source FILE, adding directory component if necessary.
  853. # Note that it is not necessary on cygwin/mingw to append a dot to
  854. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  855. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  856. # `FILE.' does not work on cygwin managed mounts.
  857. func_source ()
  858. {
  859. $opt_debug
  860. case $1 in
  861. */* | *\\*) . "$1" ;;
  862. *) . "./$1" ;;
  863. esac
  864. }
  865. # func_infer_tag arg
  866. # Infer tagged configuration to use if any are available and
  867. # if one wasn't chosen via the "--tag" command line option.
  868. # Only attempt this if the compiler in the base compile
  869. # command doesn't match the default compiler.
  870. # arg is usually of the form 'gcc ...'
  871. func_infer_tag ()
  872. {
  873. $opt_debug
  874. if test -n "$available_tags" && test -z "$tagname"; then
  875. CC_quoted=
  876. for arg in $CC; do
  877. func_quote_for_eval "$arg"
  878. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  879. done
  880. case $@ in
  881. # Blanks in the command may have been stripped by the calling shell,
  882. # but not from the CC environment variable when configure was run.
  883. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
  884. # Blanks at the start of $base_compile will cause this to fail
  885. # if we don't check for them as well.
  886. *)
  887. for z in $available_tags; do
  888. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  889. # Evaluate the configuration.
  890. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  891. CC_quoted=
  892. for arg in $CC; do
  893. # Double-quote args containing other shell metacharacters.
  894. func_quote_for_eval "$arg"
  895. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  896. done
  897. case "$@ " in
  898. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
  899. # The compiler in the base compile command matches
  900. # the one in the tagged configuration.
  901. # Assume this is the tagged configuration we want.
  902. tagname=$z
  903. break
  904. ;;
  905. esac
  906. fi
  907. done
  908. # If $tagname still isn't set, then no tagged configuration
  909. # was found and let the user know that the "--tag" command
  910. # line option must be used.
  911. if test -z "$tagname"; then
  912. func_echo "unable to infer tagged configuration"
  913. func_fatal_error "specify a tag with \`--tag'"
  914. # else
  915. # func_verbose "using $tagname tagged configuration"
  916. fi
  917. ;;
  918. esac
  919. fi
  920. }
  921. # func_write_libtool_object output_name pic_name nonpic_name
  922. # Create a libtool object file (analogous to a ".la" file),
  923. # but don't create it if we're doing a dry run.
  924. func_write_libtool_object ()
  925. {
  926. write_libobj=${1}
  927. if test "$build_libtool_libs" = yes; then
  928. write_lobj=\'${2}\'
  929. else
  930. write_lobj=none
  931. fi
  932. if test "$build_old_libs" = yes; then
  933. write_oldobj=\'${3}\'
  934. else
  935. write_oldobj=none
  936. fi
  937. $opt_dry_run || {
  938. cat >${write_libobj}T <<EOF
  939. # $write_libobj - a libtool object file
  940. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  941. #
  942. # Please DO NOT delete this file!
  943. # It is necessary for linking the library.
  944. # Name of the PIC object.
  945. pic_object=$write_lobj
  946. # Name of the non-PIC object
  947. non_pic_object=$write_oldobj
  948. EOF
  949. $MV "${write_libobj}T" "${write_libobj}"
  950. }
  951. }
  952. # func_mode_compile arg...
  953. func_mode_compile ()
  954. {
  955. $opt_debug
  956. # Get the compilation command and the source file.
  957. base_compile=
  958. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  959. suppress_opt=yes
  960. suppress_output=
  961. arg_mode=normal
  962. libobj=
  963. later=
  964. pie_flag=
  965. for arg
  966. do
  967. case $arg_mode in
  968. arg )
  969. # do not "continue". Instead, add this to base_compile
  970. lastarg="$arg"
  971. arg_mode=normal
  972. ;;
  973. target )
  974. libobj="$arg"
  975. arg_mode=normal
  976. continue
  977. ;;
  978. normal )
  979. # Accept any command-line options.
  980. case $arg in
  981. -o)
  982. test -n "$libobj" && \
  983. func_fatal_error "you cannot specify \`-o' more than once"
  984. arg_mode=target
  985. continue
  986. ;;
  987. -pie | -fpie | -fPIE)
  988. pie_flag="$pie_flag $arg"
  989. continue
  990. ;;
  991. -shared | -static | -prefer-pic | -prefer-non-pic)
  992. later="$later $arg"
  993. continue
  994. ;;
  995. -no-suppress)
  996. suppress_opt=no
  997. continue
  998. ;;
  999. -Xcompiler)
  1000. arg_mode=arg # the next one goes into the "base_compile" arg list
  1001. continue # The current "srcfile" will either be retained or
  1002. ;; # replaced later. I would guess that would be a bug.
  1003. -Wc,*)
  1004. func_stripname '-Wc,' '' "$arg"
  1005. args=$func_stripname_result
  1006. lastarg=
  1007. save_ifs="$IFS"; IFS=','
  1008. for arg in $args; do
  1009. IFS="$save_ifs"
  1010. func_quote_for_eval "$arg"
  1011. lastarg="$lastarg $func_quote_for_eval_result"
  1012. done
  1013. IFS="$save_ifs"
  1014. func_stripname ' ' '' "$lastarg"
  1015. lastarg=$func_stripname_result
  1016. # Add the arguments to base_compile.
  1017. base_compile="$base_compile $lastarg"
  1018. continue
  1019. ;;
  1020. *)
  1021. # Accept the current argument as the source file.
  1022. # The previous "srcfile" becomes the current argument.
  1023. #
  1024. lastarg="$srcfile"
  1025. srcfile="$arg"
  1026. ;;
  1027. esac # case $arg
  1028. ;;
  1029. esac # case $arg_mode
  1030. # Aesthetically quote the previous argument.
  1031. func_quote_for_eval "$lastarg"
  1032. base_compile="$base_compile $func_quote_for_eval_result"
  1033. done # for arg
  1034. case $arg_mode in
  1035. arg)
  1036. func_fatal_error "you must specify an argument for -Xcompile"
  1037. ;;
  1038. target)
  1039. func_fatal_error "you must specify a target with \`-o'"
  1040. ;;
  1041. *)
  1042. # Get the name of the library object.
  1043. test -z "$libobj" && {
  1044. func_basename "$srcfile"
  1045. libobj="$func_basename_result"
  1046. }
  1047. ;;
  1048. esac
  1049. # Recognize several different file suffixes.
  1050. # If the user specifies -o file.o, it is replaced with file.lo
  1051. case $libobj in
  1052. *.[cCFSifmso] | \
  1053. *.ada | *.adb | *.ads | *.asm | \
  1054. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  1055. *.[fF][09]? | *.for | *.java | *.obj | *.sx)
  1056. func_xform "$libobj"
  1057. libobj=$func_xform_result
  1058. ;;
  1059. esac
  1060. case $libobj in
  1061. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  1062. *)
  1063. func_fatal_error "cannot determine name of library object from \`$libobj'"
  1064. ;;
  1065. esac
  1066. func_infer_tag $base_compile
  1067. for arg in $later; do
  1068. case $arg in
  1069. -shared)
  1070. test "$build_libtool_libs" != yes && \
  1071. func_fatal_configuration "can not build a shared library"
  1072. build_old_libs=no
  1073. continue
  1074. ;;
  1075. -static)
  1076. build_libtool_libs=no
  1077. build_old_libs=yes
  1078. continue
  1079. ;;
  1080. -prefer-pic)
  1081. pic_mode=yes
  1082. continue
  1083. ;;
  1084. -prefer-non-pic)
  1085. pic_mode=no
  1086. continue
  1087. ;;
  1088. esac
  1089. done
  1090. func_quote_for_eval "$libobj"
  1091. test "X$libobj" != "X$func_quote_for_eval_result" \
  1092. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  1093. && func_warning "libobj name \`$libobj' may not contain shell special characters."
  1094. func_dirname_and_basename "$obj" "/" ""
  1095. objname="$func_basename_result"
  1096. xdir="$func_dirname_result"
  1097. lobj=${xdir}$objdir/$objname
  1098. test -z "$base_compile" && \
  1099. func_fatal_help "you must specify a compilation command"
  1100. # Delete any leftover library objects.
  1101. if test "$build_old_libs" = yes; then
  1102. removelist="$obj $lobj $libobj ${libobj}T"
  1103. else
  1104. removelist="$lobj $libobj ${libobj}T"
  1105. fi
  1106. # On Cygwin there's no "real" PIC flag so we must build both object types
  1107. case $host_os in
  1108. cygwin* | mingw* | pw32* | os2* | cegcc*)
  1109. pic_mode=default
  1110. ;;
  1111. esac
  1112. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  1113. # non-PIC code in shared libraries is not supported
  1114. pic_mode=default
  1115. fi
  1116. # Calculate the filename of the output object if compiler does
  1117. # not support -o with -c
  1118. if test "$compiler_c_o" = no; then
  1119. output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  1120. lockfile="$output_obj.lock"
  1121. else
  1122. output_obj=
  1123. need_locks=no
  1124. lockfile=
  1125. fi
  1126. # Lock this critical section if it is needed
  1127. # We use this script file to make the link, it avoids creating a new file
  1128. if test "$need_locks" = yes; then
  1129. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  1130. func_echo "Waiting for $lockfile to be removed"
  1131. sleep 2
  1132. done
  1133. elif test "$need_locks" = warn; then
  1134. if test -f "$lockfile"; then
  1135. $ECHO "\
  1136. *** ERROR, $lockfile exists and contains:
  1137. `cat $lockfile 2>/dev/null`
  1138. This indicates that another process is trying to use the same
  1139. temporary object file, and libtool could not work around it because
  1140. your compiler does not support \`-c' and \`-o' together. If you
  1141. repeat this compilation, it may succeed, by chance, but you had better
  1142. avoid parallel builds (make -j) in this platform, or get a better
  1143. compiler."
  1144. $opt_dry_run || $RM $removelist
  1145. exit $EXIT_FAILURE
  1146. fi
  1147. removelist="$removelist $output_obj"
  1148. $ECHO "$srcfile" > "$lockfile"
  1149. fi
  1150. $opt_dry_run || $RM $removelist
  1151. removelist="$removelist $lockfile"
  1152. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  1153. if test -n "$fix_srcfile_path"; then
  1154. eval srcfile=\"$fix_srcfile_path\"
  1155. fi
  1156. func_quote_for_eval "$srcfile"
  1157. qsrcfile=$func_quote_for_eval_result
  1158. # Only build a PIC object if we are building libtool libraries.
  1159. if test "$build_libtool_libs" = yes; then
  1160. # Without this assignment, base_compile gets emptied.
  1161. fbsd_hideous_sh_bug=$base_compile
  1162. if test "$pic_mode" != no; then
  1163. command="$base_compile $qsrcfile $pic_flag"
  1164. else
  1165. # Don't build PIC code
  1166. command="$base_compile $qsrcfile"
  1167. fi
  1168. func_mkdir_p "$xdir$objdir"
  1169. if test -z "$output_obj"; then
  1170. # Place PIC objects in $objdir
  1171. command="$command -o $lobj"
  1172. fi
  1173. func_show_eval_locale "$command" \
  1174. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  1175. if test "$need_locks" = warn &&
  1176. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1177. $ECHO "\
  1178. *** ERROR, $lockfile contains:
  1179. `cat $lockfile 2>/dev/null`
  1180. but it should contain:
  1181. $srcfile
  1182. This indicates that another process is trying to use the same
  1183. temporary object file, and libtool could not work around it because
  1184. your compiler does not support \`-c' and \`-o' together. If you
  1185. repeat this compilation, it may succeed, by chance, but you had better
  1186. avoid parallel builds (make -j) in this platform, or get a better
  1187. compiler."
  1188. $opt_dry_run || $RM $removelist
  1189. exit $EXIT_FAILURE
  1190. fi
  1191. # Just move the object if needed, then go on to compile the next one
  1192. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  1193. func_show_eval '$MV "$output_obj" "$lobj"' \
  1194. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1195. fi
  1196. # Allow error messages only from the first compilation.
  1197. if test "$suppress_opt" = yes; then
  1198. suppress_output=' >/dev/null 2>&1'
  1199. fi
  1200. fi
  1201. # Only build a position-dependent object if we build old libraries.
  1202. if test "$build_old_libs" = yes; then
  1203. if test "$pic_mode" != yes; then
  1204. # Don't build PIC code
  1205. command="$base_compile $qsrcfile$pie_flag"
  1206. else
  1207. command="$base_compile $qsrcfile $pic_flag"
  1208. fi
  1209. if test "$compiler_c_o" = yes; then
  1210. command="$command -o $obj"
  1211. fi
  1212. # Suppress compiler output if we already did a PIC compilation.
  1213. command="$command$suppress_output"
  1214. func_show_eval_locale "$command" \
  1215. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  1216. if test "$need_locks" = warn &&
  1217. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1218. $ECHO "\
  1219. *** ERROR, $lockfile contains:
  1220. `cat $lockfile 2>/dev/null`
  1221. but it should contain:
  1222. $srcfile
  1223. This indicates that another process is trying to use the same
  1224. temporary object file, and libtool could not work around it because
  1225. your compiler does not support \`-c' and \`-o' together. If you
  1226. repeat this compilation, it may succeed, by chance, but you had better
  1227. avoid parallel builds (make -j) in this platform, or get a better
  1228. compiler."
  1229. $opt_dry_run || $RM $removelist
  1230. exit $EXIT_FAILURE
  1231. fi
  1232. # Just move the object if needed
  1233. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  1234. func_show_eval '$MV "$output_obj" "$obj"' \
  1235. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1236. fi
  1237. fi
  1238. $opt_dry_run || {
  1239. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  1240. # Unlock the critical section if it was locked
  1241. if test "$need_locks" != no; then
  1242. removelist=$lockfile
  1243. $RM "$lockfile"
  1244. fi
  1245. }
  1246. exit $EXIT_SUCCESS
  1247. }
  1248. $opt_help || {
  1249. test "$mode" = compile && func_mode_compile ${1+"$@"}
  1250. }
  1251. func_mode_help ()
  1252. {
  1253. # We need to display help for each of the modes.
  1254. case $mode in
  1255. "")
  1256. # Generic help is extracted from the usage comments
  1257. # at the start of this file.
  1258. func_help
  1259. ;;
  1260. clean)
  1261. $ECHO \
  1262. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1263. Remove files from the build directory.
  1264. RM is the name of the program to use to delete files associated with each FILE
  1265. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1266. to RM.
  1267. If FILE is a libtool library, object or program, all the files associated
  1268. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1269. ;;
  1270. compile)
  1271. $ECHO \
  1272. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1273. Compile a source file into a libtool library object.
  1274. This mode accepts the following additional options:
  1275. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  1276. -no-suppress do not suppress compiler output for multiple passes
  1277. -prefer-pic try to building PIC objects only
  1278. -prefer-non-pic try to building non-PIC objects only
  1279. -shared do not build a \`.o' file suitable for static linking
  1280. -static only build a \`.o' file suitable for static linking
  1281. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1282. from the given SOURCEFILE.
  1283. The output file name is determined by removing the directory component from
  1284. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  1285. library object suffix, \`.lo'."
  1286. ;;
  1287. execute)
  1288. $ECHO \
  1289. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  1290. Automatically set library path, then run a program.
  1291. This mode accepts the following additional options:
  1292. -dlopen FILE add the directory containing FILE to the library path
  1293. This mode sets the library path environment variable according to \`-dlopen'
  1294. flags.
  1295. If any of the ARGS are libtool executable wrappers, then they are translated
  1296. into their corresponding uninstalled binary, and any of their required library
  1297. directories are added to the library path.
  1298. Then, COMMAND is executed, with ARGS as arguments."
  1299. ;;
  1300. finish)
  1301. $ECHO \
  1302. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  1303. Complete the installation of libtool libraries.
  1304. Each LIBDIR is a directory that contains libtool libraries.
  1305. The commands that this mode executes may require superuser privileges. Use
  1306. the \`--dry-run' option if you just want to see what would be executed."
  1307. ;;
  1308. install)
  1309. $ECHO \
  1310. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  1311. Install executables or libraries.
  1312. INSTALL-COMMAND is the installation command. The first component should be
  1313. either the \`install' or \`cp' program.
  1314. The following components of INSTALL-COMMAND are treated specially:
  1315. -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  1316. The rest of the components are interpreted as arguments to that command (only
  1317. BSD-compatible install options are recognized)."
  1318. ;;
  1319. link)
  1320. $ECHO \
  1321. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  1322. Link object files or libraries together to form another library, or to
  1323. create an executable program.
  1324. LINK-COMMAND is a command using the C compiler that you would use to create
  1325. a program from several object files.
  1326. The following components of LINK-COMMAND are treated specially:
  1327. -all-static do not do any dynamic linking at all
  1328. -avoid-version do not add a version suffix if possible
  1329. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  1330. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  1331. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  1332. -export-symbols SYMFILE
  1333. try to export only the symbols listed in SYMFILE
  1334. -export-symbols-regex REGEX
  1335. try to export only the symbols matching REGEX
  1336. -LLIBDIR search LIBDIR for required installed libraries
  1337. -lNAME OUTPUT-FILE requires the installed library libNAME
  1338. -module build a library that can dlopened
  1339. -no-fast-install disable the fast-install mode
  1340. -no-install link a not-installable executable
  1341. -no-undefined declare that a library does not refer to external symbols
  1342. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  1343. -objectlist FILE Use a list of object files found in FILE to specify objects
  1344. -precious-files-regex REGEX
  1345. don't remove output files matching REGEX
  1346. -release RELEASE specify package release information
  1347. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  1348. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  1349. -shared only do dynamic linking of libtool libraries
  1350. -shrext SUFFIX override the standard shared library file extension
  1351. -static do not do any dynamic linking of uninstalled libtool libraries
  1352. -static-libtool-libs
  1353. do not do any dynamic linking of libtool libraries
  1354. -version-info CURRENT[:REVISION[:AGE]]
  1355. specify library version info [each variable defaults to 0]
  1356. -weak LIBNAME declare that the target provides the LIBNAME interface
  1357. All other options (arguments beginning with \`-') are ignored.
  1358. Every other argument is treated as a filename. Files ending in \`.la' are
  1359. treated as uninstalled libtool libraries, other files are standard or library
  1360. object files.
  1361. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  1362. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  1363. required, except when creating a convenience library.
  1364. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  1365. using \`ar' and \`ranlib', or on Windows using \`lib'.
  1366. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  1367. is created, otherwise an executable program is created."
  1368. ;;
  1369. uninstall)
  1370. $ECHO \
  1371. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  1372. Remove libraries from an installation directory.
  1373. RM is the name of the program to use to delete files associated with each FILE
  1374. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1375. to RM.
  1376. If FILE is a libtool library, all the files associated with it are deleted.
  1377. Otherwise, only FILE itself is deleted using RM."
  1378. ;;
  1379. *)
  1380. func_fatal_help "invalid operation mode \`$mode'"
  1381. ;;
  1382. esac
  1383. $ECHO
  1384. $ECHO "Try \`$progname --help' for more information about other modes."
  1385. exit $?
  1386. }
  1387. # Now that we've collected a possible --mode arg, show help if necessary
  1388. $opt_help && func_mode_help
  1389. # func_mode_execute arg...
  1390. func_mode_execute ()
  1391. {
  1392. $opt_debug
  1393. # The first argument is the command name.
  1394. cmd="$nonopt"
  1395. test -z "$cmd" && \
  1396. func_fatal_help "you must specify a COMMAND"
  1397. # Handle -dlopen flags immediately.
  1398. for file in $execute_dlfiles; do
  1399. test -f "$file" \
  1400. || func_fatal_help "\`$file' is not a file"
  1401. dir=
  1402. case $file in
  1403. *.la)
  1404. # Check to see that this really is a libtool archive.
  1405. func_lalib_unsafe_p "$file" \
  1406. || func_fatal_help "\`$lib' is not a valid libtool archive"
  1407. # Read the libtool library.
  1408. dlname=
  1409. library_names=
  1410. func_source "$file"
  1411. # Skip this library if it cannot be dlopened.
  1412. if test -z "$dlname"; then
  1413. # Warn if it was a shared library.
  1414. test -n "$library_names" && \
  1415. func_warning "\`$file' was not linked with \`-export-dynamic'"
  1416. continue
  1417. fi
  1418. func_dirname "$file" "" "."
  1419. dir="$func_dirname_result"
  1420. if test -f "$dir/$objdir/$dlname"; then
  1421. dir="$dir/$objdir"
  1422. else
  1423. if test ! -f "$dir/$dlname"; then
  1424. func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
  1425. fi
  1426. fi
  1427. ;;
  1428. *.lo)
  1429. # Just add the directory containing the .lo file.
  1430. func_dirname "$file" "" "."
  1431. dir="$func_dirname_result"
  1432. ;;
  1433. *)
  1434. func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
  1435. continue
  1436. ;;
  1437. esac
  1438. # Get the absolute pathname.
  1439. absdir=`cd "$dir" && pwd`
  1440. test -n "$absdir" && dir="$absdir"
  1441. # Now add the directory to shlibpath_var.
  1442. if eval "test -z \"\$$shlibpath_var\""; then
  1443. eval "$shlibpath_var=\"\$dir\""
  1444. else
  1445. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  1446. fi
  1447. done
  1448. # This variable tells wrapper scripts just to set shlibpath_var
  1449. # rather than running their programs.
  1450. libtool_execute_magic="$magic"
  1451. # Check if any of the arguments is a wrapper script.
  1452. args=
  1453. for file
  1454. do
  1455. case $file in
  1456. -*) ;;
  1457. *)
  1458. # Do a test to see if this is really a libtool program.
  1459. if func_ltwrapper_script_p "$file"; then
  1460. func_source "$file"
  1461. # Transform arg to wrapped name.
  1462. file="$progdir/$program"
  1463. elif func_ltwrapper_executable_p "$file"; then
  1464. func_ltwrapper_scriptname "$file"
  1465. func_source "$func_ltwrapper_scriptname_result"
  1466. # Transform arg to wrapped name.
  1467. file="$progdir/$program"
  1468. fi
  1469. ;;
  1470. esac
  1471. # Quote arguments (to preserve shell metacharacters).
  1472. func_quote_for_eval "$file"
  1473. args="$args $func_quote_for_eval_result"
  1474. done
  1475. if test "X$opt_dry_run" = Xfalse; then
  1476. if test -n "$shlibpath_var"; then
  1477. # Export the shlibpath_var.
  1478. eval "export $shlibpath_var"
  1479. fi
  1480. # Restore saved environment variables
  1481. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  1482. do
  1483. eval "if test \"\${save_$lt_var+set}\" = set; then
  1484. $lt_var=\$save_$lt_var; export $lt_var
  1485. else
  1486. $lt_unset $lt_var
  1487. fi"
  1488. done
  1489. # Now prepare to actually exec the command.
  1490. exec_cmd="\$cmd$args"
  1491. else
  1492. # Display what would be done.
  1493. if test -n "$shlibpath_var"; then
  1494. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  1495. $ECHO "export $shlibpath_var"
  1496. fi
  1497. $ECHO "$cmd$args"
  1498. exit $EXIT_SUCCESS
  1499. fi
  1500. }
  1501. test "$mode" = execute && func_mode_execute ${1+"$@"}
  1502. # func_mode_finish arg...
  1503. func_mode_finish ()
  1504. {
  1505. $opt_debug
  1506. libdirs="$nonopt"
  1507. admincmds=
  1508. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  1509. for dir
  1510. do
  1511. libdirs="$libdirs $dir"
  1512. done
  1513. for libdir in $libdirs; do
  1514. if test -n "$finish_cmds"; then
  1515. # Do each command in the finish commands.
  1516. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  1517. '"$cmd"'"'
  1518. fi
  1519. if test -n "$finish_eval"; then
  1520. # Do the single finish_eval.
  1521. eval cmds=\"$finish_eval\"
  1522. $opt_dry_run || eval "$cmds" || admincmds="$admincmds
  1523. $cmds"
  1524. fi
  1525. done
  1526. fi
  1527. # Exit here if they wanted silent mode.
  1528. $opt_silent && exit $EXIT_SUCCESS
  1529. $ECHO "X----------------------------------------------------------------------" | $Xsed
  1530. $ECHO "Libraries have been installed in:"
  1531. for libdir in $libdirs; do
  1532. $ECHO " $libdir"
  1533. done
  1534. $ECHO
  1535. $ECHO "If you ever happen to want to link against installed libraries"
  1536. $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
  1537. $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
  1538. $ECHO "flag during linking and do at least one of the following:"
  1539. if test -n "$shlibpath_var"; then
  1540. $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
  1541. $ECHO " during execution"
  1542. fi
  1543. if test -n "$runpath_var"; then
  1544. $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
  1545. $ECHO " during linking"
  1546. fi
  1547. if test -n "$hardcode_libdir_flag_spec"; then
  1548. libdir=LIBDIR
  1549. eval flag=\"$hardcode_libdir_flag_spec\"
  1550. $ECHO " - use the \`$flag' linker flag"
  1551. fi
  1552. if test -n "$admincmds"; then
  1553. $ECHO " - have your system administrator run these commands:$admincmds"
  1554. fi
  1555. if test -f /etc/ld.so.conf; then
  1556. $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1557. fi
  1558. $ECHO
  1559. $ECHO "See any operating system documentation about shared libraries for"
  1560. case $host in
  1561. solaris2.[6789]|solaris2.1[0-9])
  1562. $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  1563. $ECHO "pages."
  1564. ;;
  1565. *)
  1566. $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
  1567. ;;
  1568. esac
  1569. $ECHO "X----------------------------------------------------------------------" | $Xsed
  1570. exit $EXIT_SUCCESS
  1571. }
  1572. test "$mode" = finish && func_mode_finish ${1+"$@"}
  1573. # func_mode_install arg...
  1574. func_mode_install ()
  1575. {
  1576. $opt_debug
  1577. # There may be an optional sh(1) argument at the beginning of
  1578. # install_prog (especially on Windows NT).
  1579. if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  1580. # Allow the use of GNU shtool's install command.
  1581. $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
  1582. # Aesthetically quote it.
  1583. func_quote_for_eval "$nonopt"
  1584. install_prog="$func_quote_for_eval_result "
  1585. arg=$1
  1586. shift
  1587. else
  1588. install_prog=
  1589. arg=$nonopt
  1590. fi
  1591. # The real first argument should be the name of the installation program.
  1592. # Aesthetically quote it.
  1593. func_quote_for_eval "$arg"
  1594. install_prog="$install_prog$func_quote_for_eval_result"
  1595. # We need to accept at least all the BSD install flags.
  1596. dest=
  1597. files=
  1598. opts=
  1599. prev=
  1600. install_type=
  1601. isdir=no
  1602. stripme=
  1603. for arg
  1604. do
  1605. if test -n "$dest"; then
  1606. files="$files $dest"
  1607. dest=$arg
  1608. continue
  1609. fi
  1610. case $arg in
  1611. -d) isdir=yes ;;
  1612. -f)
  1613. case " $install_prog " in
  1614. *[\\\ /]cp\ *) ;;
  1615. *) prev=$arg ;;
  1616. esac
  1617. ;;
  1618. -g | -m | -o)
  1619. prev=$arg
  1620. ;;
  1621. -s)
  1622. stripme=" -s"
  1623. continue
  1624. ;;
  1625. -*)
  1626. ;;
  1627. *)
  1628. # If the previous option needed an argument, then skip it.
  1629. if test -n "$prev"; then
  1630. prev=
  1631. else
  1632. dest=$arg
  1633. continue
  1634. fi
  1635. ;;
  1636. esac
  1637. # Aesthetically quote the argument.
  1638. func_quote_for_eval "$arg"
  1639. install_prog="$install_prog $func_quote_for_eval_result"
  1640. done
  1641. test -z "$install_prog" && \
  1642. func_fatal_help "you must specify an install program"
  1643. test -n "$prev" && \
  1644. func_fatal_help "the \`$prev' option requires an argument"
  1645. if test -z "$files"; then
  1646. if test -z "$dest"; then
  1647. func_fatal_help "no file or destination specified"
  1648. else
  1649. func_fatal_help "you must specify a destination"
  1650. fi
  1651. fi
  1652. # Strip any trailing slash from the destination.
  1653. func_stripname '' '/' "$dest"
  1654. dest=$func_stripname_result
  1655. # Check to see that the destination is a directory.
  1656. test -d "$dest" && isdir=yes
  1657. if test "$isdir" = yes; then
  1658. destdir="$dest"
  1659. destname=
  1660. else
  1661. func_dirname_and_basename "$dest" "" "."
  1662. destdir="$func_dirname_result"
  1663. destname="$func_basename_result"
  1664. # Not a directory, so check to see that there is only one file specified.
  1665. set dummy $files; shift
  1666. test "$#" -gt 1 && \
  1667. func_fatal_help "\`$dest' is not a directory"
  1668. fi
  1669. case $destdir in
  1670. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1671. *)
  1672. for file in $files; do
  1673. case $file in
  1674. *.lo) ;;
  1675. *)
  1676. func_fatal_help "\`$destdir' must be an absolute directory name"
  1677. ;;
  1678. esac
  1679. done
  1680. ;;
  1681. esac
  1682. # This variable tells wrapper scripts just to set variables rather
  1683. # than running their programs.
  1684. libtool_install_magic="$magic"
  1685. staticlibs=
  1686. future_libdirs=
  1687. current_libdirs=
  1688. for file in $files; do
  1689. # Do each installation.
  1690. case $file in
  1691. *.$libext)
  1692. # Do the static libraries later.
  1693. staticlibs="$staticlibs $file"
  1694. ;;
  1695. *.la)
  1696. # Check to see that this really is a libtool archive.
  1697. func_lalib_unsafe_p "$file" \
  1698. || func_fatal_help "\`$file' is not a valid libtool archive"
  1699. library_names=
  1700. old_library=
  1701. relink_command=
  1702. func_source "$file"
  1703. # Add the libdir to current_libdirs if it is the destination.
  1704. if test "X$destdir" = "X$libdir"; then
  1705. case "$current_libdirs " in
  1706. *" $libdir "*) ;;
  1707. *) current_libdirs="$current_libdirs $libdir" ;;
  1708. esac
  1709. else
  1710. # Note the libdir as a future libdir.
  1711. case "$future_libdirs " in
  1712. *" $libdir "*) ;;
  1713. *) future_libdirs="$future_libdirs $libdir" ;;
  1714. esac
  1715. fi
  1716. func_dirname "$file" "/" ""
  1717. dir="$func_dirname_result"
  1718. dir="$dir$objdir"
  1719. if test -n "$relink_command"; then
  1720. # Determine the prefix the user has applied to our future dir.
  1721. inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
  1722. # Don't allow the user to place us outside of our expected
  1723. # location b/c this prevents finding dependent libraries that
  1724. # are installed to the same prefix.
  1725. # At present, this check doesn't affect windows .dll's that
  1726. # are installed into $libdir/../bin (currently, that works fine)
  1727. # but it's something to keep an eye on.
  1728. test "$inst_prefix_dir" = "$destdir" && \
  1729. func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
  1730. if test -n "$inst_prefix_dir"; then
  1731. # Stick the inst_prefix_dir data into the link command.
  1732. relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  1733. else
  1734. relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
  1735. fi
  1736. func_warning "relinking \`$file'"
  1737. func_show_eval "$relink_command" \
  1738. 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
  1739. fi
  1740. # See the names of the shared library.
  1741. set dummy $library_names; shift
  1742. if test -n "$1"; then
  1743. realname="$1"
  1744. shift
  1745. srcname="$realname"
  1746. test -n "$relink_command" && srcname="$realname"T
  1747. # Install the shared library and build the symlinks.
  1748. func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
  1749. 'exit $?'
  1750. tstripme="$stripme"
  1751. case $host_os in
  1752. cygwin* | mingw* | pw32* | cegcc*)
  1753. case $realname in
  1754. *.dll.a)
  1755. tstripme=""
  1756. ;;
  1757. esac
  1758. ;;
  1759. esac
  1760. if test -n "$tstripme" && test -n "$striplib"; then
  1761. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  1762. fi
  1763. if test "$#" -gt 0; then
  1764. # Delete the old symlinks, and create new ones.
  1765. # Try `ln -sf' first, because the `ln' binary might depend on
  1766. # the symlink we replace! Solaris /bin/ln does not understand -f,
  1767. # so we also need to try rm && ln -s.
  1768. for linkname
  1769. do
  1770. test "$linkname" != "$realname" \
  1771. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  1772. done
  1773. fi
  1774. # Do each command in the postinstall commands.
  1775. lib="$destdir/$realname"
  1776. func_execute_cmds "$postinstall_cmds" 'exit $?'
  1777. fi
  1778. # Install the pseudo-library for information purposes.
  1779. func_basename "$file"
  1780. name="$func_basename_result"
  1781. instname="$dir/$name"i
  1782. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  1783. # Maybe install the static library, too.
  1784. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  1785. ;;
  1786. *.lo)
  1787. # Install (i.e. copy) a libtool object.
  1788. # Figure out destination file name, if it wasn't already specified.
  1789. if test -n "$destname"; then
  1790. destfile="$destdir/$destname"
  1791. else
  1792. func_basename "$file"
  1793. destfile="$func_basename_result"
  1794. destfile="$destdir/$destfile"
  1795. fi
  1796. # Deduce the name of the destination old-style object file.
  1797. case $destfile in
  1798. *.lo)
  1799. func_lo2o "$destfile"
  1800. staticdest=$func_lo2o_result
  1801. ;;
  1802. *.$objext)
  1803. staticdest="$destfile"
  1804. destfile=
  1805. ;;
  1806. *)
  1807. func_fatal_help "cannot copy a libtool object to \`$destfile'"
  1808. ;;
  1809. esac
  1810. # Install the libtool object if requested.
  1811. test -n "$destfile" && \
  1812. func_show_eval "$install_prog $file $destfile" 'exit $?'
  1813. # Install the old object if enabled.
  1814. if test "$build_old_libs" = yes; then
  1815. # Deduce the name of the old-style object file.
  1816. func_lo2o "$file"
  1817. staticobj=$func_lo2o_result
  1818. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  1819. fi
  1820. exit $EXIT_SUCCESS
  1821. ;;
  1822. *)
  1823. # Figure out destination file name, if it wasn't already specified.
  1824. if test -n "$destname"; then
  1825. destfile="$destdir/$destname"
  1826. else
  1827. func_basename "$file"
  1828. destfile="$func_basename_result"
  1829. destfile="$destdir/$destfile"
  1830. fi
  1831. # If the file is missing, and there is a .exe on the end, strip it
  1832. # because it is most likely a libtool script we actually want to
  1833. # install
  1834. stripped_ext=""
  1835. case $file in
  1836. *.exe)
  1837. if test ! -f "$file"; then
  1838. func_stripname '' '.exe' "$file"
  1839. file=$func_stripname_result
  1840. stripped_ext=".exe"
  1841. fi
  1842. ;;
  1843. esac
  1844. # Do a test to see if this is really a libtool program.
  1845. case $host in
  1846. *cygwin* | *mingw*)
  1847. if func_ltwrapper_executable_p "$file"; then
  1848. func_ltwrapper_scriptname "$file"
  1849. wrapper=$func_ltwrapper_scriptname_result
  1850. else
  1851. func_stripname '' '.exe' "$file"
  1852. wrapper=$func_stripname_result
  1853. fi
  1854. ;;
  1855. *)
  1856. wrapper=$file
  1857. ;;
  1858. esac
  1859. if func_ltwrapper_script_p "$wrapper"; then
  1860. notinst_deplibs=
  1861. relink_command=
  1862. func_source "$wrapper"
  1863. # Check the variables that should have been set.
  1864. test -z "$generated_by_libtool_version" && \
  1865. func_fatal_error "invalid libtool wrapper script \`$wrapper'"
  1866. finalize=yes
  1867. for lib in $notinst_deplibs; do
  1868. # Check to see that each library is installed.
  1869. libdir=
  1870. if test -f "$lib"; then
  1871. func_source "$lib"
  1872. fi
  1873. libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  1874. if test -n "$libdir" && test ! -f "$libfile"; then
  1875. func_warning "\`$lib' has not been installed in \`$libdir'"
  1876. finalize=no
  1877. fi
  1878. done
  1879. relink_command=
  1880. func_source "$wrapper"
  1881. outputname=
  1882. if test "$fast_install" = no && test -n "$relink_command"; then
  1883. $opt_dry_run || {
  1884. if test "$finalize" = yes; then
  1885. tmpdir=`func_mktempdir`
  1886. func_basename "$file$stripped_ext"
  1887. file="$func_basename_result"
  1888. outputname="$tmpdir/$file"
  1889. # Replace the output file specification.
  1890. relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  1891. $opt_silent || {
  1892. func_quote_for_expand "$relink_command"
  1893. eval "func_echo $func_quote_for_expand_result"
  1894. }
  1895. if eval "$relink_command"; then :
  1896. else
  1897. func_error "error: relink \`$file' with the above command before installing it"
  1898. $opt_dry_run || ${RM}r "$tmpdir"
  1899. continue
  1900. fi
  1901. file="$outputname"
  1902. else
  1903. func_warning "cannot relink \`$file'"
  1904. fi
  1905. }
  1906. else
  1907. # Install the binary that we compiled earlier.
  1908. file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1909. fi
  1910. fi
  1911. # remove .exe since cygwin /usr/bin/install will append another
  1912. # one anyway
  1913. case $install_prog,$host in
  1914. */usr/bin/install*,*cygwin*)
  1915. case $file:$destfile in
  1916. *.exe:*.exe)
  1917. # this is ok
  1918. ;;
  1919. *.exe:*)
  1920. destfile=$destfile.exe
  1921. ;;
  1922. *:*.exe)
  1923. func_stripname '' '.exe' "$destfile"
  1924. destfile=$func_stripname_result
  1925. ;;
  1926. esac
  1927. ;;
  1928. esac
  1929. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  1930. $opt_dry_run || if test -n "$outputname"; then
  1931. ${RM}r "$tmpdir"
  1932. fi
  1933. ;;
  1934. esac
  1935. done
  1936. for file in $staticlibs; do
  1937. func_basename "$file"
  1938. name="$func_basename_result"
  1939. # Set up the ranlib parameters.
  1940. oldlib="$destdir/$name"
  1941. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  1942. if test -n "$stripme" && test -n "$old_striplib"; then
  1943. func_show_eval "$old_striplib $oldlib" 'exit $?'
  1944. fi
  1945. # Do each command in the postinstall commands.
  1946. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  1947. done
  1948. test -n "$future_libdirs" && \
  1949. func_warning "remember to run \`$progname --finish$future_libdirs'"
  1950. if test -n "$current_libdirs"; then
  1951. # Maybe just do a dry run.
  1952. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  1953. exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  1954. else
  1955. exit $EXIT_SUCCESS
  1956. fi
  1957. }
  1958. test "$mode" = install && func_mode_install ${1+"$@"}
  1959. # func_generate_dlsyms outputname originator pic_p
  1960. # Extract symbols from dlprefiles and create ${outputname}S.o with
  1961. # a dlpreopen symbol table.
  1962. func_generate_dlsyms ()
  1963. {
  1964. $opt_debug
  1965. my_outputname="$1"
  1966. my_originator="$2"
  1967. my_pic_p="${3-no}"
  1968. my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
  1969. my_dlsyms=
  1970. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1971. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  1972. my_dlsyms="${my_outputname}S.c"
  1973. else
  1974. func_error "not configured to extract global symbols from dlpreopened files"
  1975. fi
  1976. fi
  1977. if test -n "$my_dlsyms"; then
  1978. case $my_dlsyms in
  1979. "") ;;
  1980. *.c)
  1981. # Discover the nlist of each of the dlfiles.
  1982. nlist="$output_objdir/${my_outputname}.nm"
  1983. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  1984. # Parse the name list into a source file.
  1985. func_verbose "creating $output_objdir/$my_dlsyms"
  1986. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  1987. /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
  1988. /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
  1989. #ifdef __cplusplus
  1990. extern \"C\" {
  1991. #endif
  1992. /* External symbol declarations for the compiler. */\
  1993. "
  1994. if test "$dlself" = yes; then
  1995. func_verbose "generating symbol list for \`$output'"
  1996. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  1997. # Add our own program objects to the symbol list.
  1998. progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1999. for progfile in $progfiles; do
  2000. func_verbose "extracting global C symbols from \`$progfile'"
  2001. $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
  2002. done
  2003. if test -n "$exclude_expsyms"; then
  2004. $opt_dry_run || {
  2005. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2006. eval '$MV "$nlist"T "$nlist"'
  2007. }
  2008. fi
  2009. if test -n "$export_symbols_regex"; then
  2010. $opt_dry_run || {
  2011. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2012. eval '$MV "$nlist"T "$nlist"'
  2013. }
  2014. fi
  2015. # Prepare the list of exported symbols
  2016. if test -z "$export_symbols"; then
  2017. export_symbols="$output_objdir/$outputname.exp"
  2018. $opt_dry_run || {
  2019. $RM $export_symbols
  2020. eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2021. case $host in
  2022. *cygwin* | *mingw* | *cegcc* )
  2023. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  2024. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  2025. ;;
  2026. esac
  2027. }
  2028. else
  2029. $opt_dry_run || {
  2030. eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  2031. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  2032. eval '$MV "$nlist"T "$nlist"'
  2033. case $host in
  2034. *cygwin | *mingw* | *cegcc* )
  2035. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  2036. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  2037. ;;
  2038. esac
  2039. }
  2040. fi
  2041. fi
  2042. for dlprefile in $dlprefiles; do
  2043. func_verbose "extracting global C symbols from \`$dlprefile'"
  2044. func_basename "$dlprefile"
  2045. name="$func_basename_result"
  2046. $opt_dry_run || {
  2047. eval '$ECHO ": $name " >> "$nlist"'
  2048. eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  2049. }
  2050. done
  2051. $opt_dry_run || {
  2052. # Make sure we have at least an empty file.
  2053. test -f "$nlist" || : > "$nlist"
  2054. if test -n "$exclude_expsyms"; then
  2055. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2056. $MV "$nlist"T "$nlist"
  2057. fi
  2058. # Try sorting and uniquifying the output.
  2059. if $GREP -v "^: " < "$nlist" |
  2060. if sort -k 3 </dev/null >/dev/null 2>&1; then
  2061. sort -k 3
  2062. else
  2063. sort +2
  2064. fi |
  2065. uniq > "$nlist"S; then
  2066. :
  2067. else
  2068. $GREP -v "^: " < "$nlist" > "$nlist"S
  2069. fi
  2070. if test -f "$nlist"S; then
  2071. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  2072. else
  2073. $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
  2074. fi
  2075. $ECHO >> "$output_objdir/$my_dlsyms" "\
  2076. /* The mapping between symbol names and symbols. */
  2077. typedef struct {
  2078. const char *name;
  2079. void *address;
  2080. } lt_dlsymlist;
  2081. "
  2082. case $host in
  2083. *cygwin* | *mingw* | *cegcc* )
  2084. $ECHO >> "$output_objdir/$my_dlsyms" "\
  2085. /* DATA imports from DLLs on WIN32 con't be const, because
  2086. runtime relocations are performed -- see ld's documentation
  2087. on pseudo-relocs. */"
  2088. lt_dlsym_const= ;;
  2089. *osf5*)
  2090. echo >> "$output_objdir/$my_dlsyms" "\
  2091. /* This system does not cope well with relocations in const data */"
  2092. lt_dlsym_const= ;;
  2093. *)
  2094. lt_dlsym_const=const ;;
  2095. esac
  2096. $ECHO >> "$output_objdir/$my_dlsyms" "\
  2097. extern $lt_dlsym_const lt_dlsymlist
  2098. lt_${my_prefix}_LTX_preloaded_symbols[];
  2099. $lt_dlsym_const lt_dlsymlist
  2100. lt_${my_prefix}_LTX_preloaded_symbols[] =
  2101. {\
  2102. { \"$my_originator\", (void *) 0 },"
  2103. case $need_lib_prefix in
  2104. no)
  2105. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  2106. ;;
  2107. *)
  2108. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  2109. ;;
  2110. esac
  2111. $ECHO >> "$output_objdir/$my_dlsyms" "\
  2112. {0, (void *) 0}
  2113. };
  2114. /* This works around a problem in FreeBSD linker */
  2115. #ifdef FREEBSD_WORKAROUND
  2116. static const void *lt_preloaded_setup() {
  2117. return lt_${my_prefix}_LTX_preloaded_symbols;
  2118. }
  2119. #endif
  2120. #ifdef __cplusplus
  2121. }
  2122. #endif\
  2123. "
  2124. } # !$opt_dry_run
  2125. pic_flag_for_symtable=
  2126. case "$compile_command " in
  2127. *" -static "*) ;;
  2128. *)
  2129. case $host in
  2130. # compiling the symbol table file with pic_flag works around
  2131. # a FreeBSD bug that causes programs to crash when -lm is
  2132. # linked before any other PIC object. But we must not use
  2133. # pic_flag when linking with -static. The problem exists in
  2134. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2135. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  2136. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  2137. *-*-hpux*)
  2138. pic_flag_for_symtable=" $pic_flag" ;;
  2139. *)
  2140. if test "X$my_pic_p" != Xno; then
  2141. pic_flag_for_symtable=" $pic_flag"
  2142. fi
  2143. ;;
  2144. esac
  2145. ;;
  2146. esac
  2147. symtab_cflags=
  2148. for arg in $LTCFLAGS; do
  2149. case $arg in
  2150. -pie | -fpie | -fPIE) ;;
  2151. *) symtab_cflags="$symtab_cflags $arg" ;;
  2152. esac
  2153. done
  2154. # Now compile the dynamic symbol file.
  2155. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  2156. # Clean up the generated files.
  2157. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
  2158. # Transform the symbol file into the correct name.
  2159. symfileobj="$output_objdir/${my_outputname}S.$objext"
  2160. case $host in
  2161. *cygwin* | *mingw* | *cegcc* )
  2162. if test -f "$output_objdir/$my_outputname.def"; then
  2163. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  2164. finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  2165. else
  2166. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  2167. finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  2168. fi
  2169. ;;
  2170. *)
  2171. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  2172. finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  2173. ;;
  2174. esac
  2175. ;;
  2176. *)
  2177. func_fatal_error "unknown suffix for \`$my_dlsyms'"
  2178. ;;
  2179. esac
  2180. else
  2181. # We keep going just in case the user didn't refer to
  2182. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  2183. # really was required.
  2184. # Nullify the symbol file.
  2185. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2186. finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2187. fi
  2188. }
  2189. # func_win32_libid arg
  2190. # return the library type of file 'arg'
  2191. #
  2192. # Need a lot of goo to handle *both* DLLs and import libs
  2193. # Has to be a shell function in order to 'eat' the argument
  2194. # that is supplied when $file_magic_command is called.
  2195. func_win32_libid ()
  2196. {
  2197. $opt_debug
  2198. win32_libid_type="unknown"
  2199. win32_fileres=`file -L $1 2>/dev/null`
  2200. case $win32_fileres in
  2201. *ar\ archive\ import\ library*) # definitely import
  2202. win32_libid_type="x86 archive import"
  2203. ;;
  2204. *ar\ archive*) # could be an import, or static
  2205. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  2206. $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
  2207. win32_nmres=`eval $NM -f posix -A $1 |
  2208. $SED -n -e '
  2209. 1,100{
  2210. / I /{
  2211. s,.*,import,
  2212. p
  2213. q
  2214. }
  2215. }'`
  2216. case $win32_nmres in
  2217. import*) win32_libid_type="x86 archive import";;
  2218. *) win32_libid_type="x86 archive static";;
  2219. esac
  2220. fi
  2221. ;;
  2222. *DLL*)
  2223. win32_libid_type="x86 DLL"
  2224. ;;
  2225. *executable*) # but shell scripts are "executable" too...
  2226. case $win32_fileres in
  2227. *MS\ Windows\ PE\ Intel*)
  2228. win32_libid_type="x86 DLL"
  2229. ;;
  2230. esac
  2231. ;;
  2232. esac
  2233. $ECHO "$win32_libid_type"
  2234. }
  2235. # func_extract_an_archive dir oldlib
  2236. func_extract_an_archive ()
  2237. {
  2238. $opt_debug
  2239. f_ex_an_ar_dir="$1"; shift
  2240. f_ex_an_ar_oldlib="$1"
  2241. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
  2242. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  2243. :
  2244. else
  2245. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  2246. fi
  2247. }
  2248. # func_extract_archives gentop oldlib ...
  2249. func_extract_archives ()
  2250. {
  2251. $opt_debug
  2252. my_gentop="$1"; shift
  2253. my_oldlibs=${1+"$@"}
  2254. my_oldobjs=""
  2255. my_xlib=""
  2256. my_xabs=""
  2257. my_xdir=""
  2258. for my_xlib in $my_oldlibs; do
  2259. # Extract the objects.
  2260. case $my_xlib in
  2261. [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
  2262. *) my_xabs=`pwd`"/$my_xlib" ;;
  2263. esac
  2264. func_basename "$my_xlib"
  2265. my_xlib="$func_basename_result"
  2266. my_xlib_u=$my_xlib
  2267. while :; do
  2268. case " $extracted_archives " in
  2269. *" $my_xlib_u "*)
  2270. func_arith $extracted_serial + 1
  2271. extracted_serial=$func_arith_result
  2272. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  2273. *) break ;;
  2274. esac
  2275. done
  2276. extracted_archives="$extracted_archives $my_xlib_u"
  2277. my_xdir="$my_gentop/$my_xlib_u"
  2278. func_mkdir_p "$my_xdir"
  2279. case $host in
  2280. *-darwin*)
  2281. func_verbose "Extracting $my_xabs"
  2282. # Do not bother doing anything if just a dry run
  2283. $opt_dry_run || {
  2284. darwin_orig_dir=`pwd`
  2285. cd $my_xdir || exit $?
  2286. darwin_archive=$my_xabs
  2287. darwin_curdir=`pwd`
  2288. darwin_base_archive=`basename "$darwin_archive"`
  2289. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  2290. if test -n "$darwin_arches"; then
  2291. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  2292. darwin_arch=
  2293. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  2294. for darwin_arch in $darwin_arches ; do
  2295. func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  2296. $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  2297. cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  2298. func_extract_an_archive "`pwd`" "${darwin_base_archive}"
  2299. cd "$darwin_curdir"
  2300. $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
  2301. done # $darwin_arches
  2302. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  2303. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
  2304. darwin_file=
  2305. darwin_files=
  2306. for darwin_file in $darwin_filelist; do
  2307. darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
  2308. $LIPO -create -output "$darwin_file" $darwin_files
  2309. done # $darwin_filelist
  2310. $RM -rf unfat-$$
  2311. cd "$darwin_orig_dir"
  2312. else
  2313. cd $darwin_orig_dir
  2314. func_extract_an_archive "$my_xdir" "$my_xabs"
  2315. fi # $darwin_arches
  2316. } # !$opt_dry_run
  2317. ;;
  2318. *)
  2319. func_extract_an_archive "$my_xdir" "$my_xabs"
  2320. ;;
  2321. esac
  2322. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  2323. done
  2324. func_extract_archives_result="$my_oldobjs"
  2325. }
  2326. # func_emit_wrapper_part1 [arg=no]
  2327. #
  2328. # Emit the first part of a libtool wrapper script on stdout.
  2329. # For more information, see the description associated with
  2330. # func_emit_wrapper(), below.
  2331. func_emit_wrapper_part1 ()
  2332. {
  2333. func_emit_wrapper_part1_arg1=no
  2334. if test -n "$1" ; then
  2335. func_emit_wrapper_part1_arg1=$1
  2336. fi
  2337. $ECHO "\
  2338. #! $SHELL
  2339. # $output - temporary wrapper script for $objdir/$outputname
  2340. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  2341. #
  2342. # The $output program cannot be directly executed until all the libtool
  2343. # libraries that it depends on are installed.
  2344. #
  2345. # This wrapper script should never be moved out of the build directory.
  2346. # If it is, it will not operate correctly.
  2347. # Sed substitution that helps us do robust quoting. It backslashifies
  2348. # metacharacters that are still active within double-quoted strings.
  2349. Xsed='${SED} -e 1s/^X//'
  2350. sed_quote_subst='$sed_quote_subst'
  2351. # Be Bourne compatible
  2352. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  2353. emulate sh
  2354. NULLCMD=:
  2355. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  2356. # is contrary to our usage. Disable this feature.
  2357. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  2358. setopt NO_GLOB_SUBST
  2359. else
  2360. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  2361. fi
  2362. BIN_SH=xpg4; export BIN_SH # for Tru64
  2363. DUALCASE=1; export DUALCASE # for MKS sh
  2364. # The HP-UX ksh and POSIX shell print the target directory to stdout
  2365. # if CDPATH is set.
  2366. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  2367. relink_command=\"$relink_command\"
  2368. # This environment variable determines our operation mode.
  2369. if test \"\$libtool_install_magic\" = \"$magic\"; then
  2370. # install mode needs the following variables:
  2371. generated_by_libtool_version='$macro_version'
  2372. notinst_deplibs='$notinst_deplibs'
  2373. else
  2374. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  2375. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2376. ECHO=\"$qecho\"
  2377. file=\"\$0\"
  2378. # Make sure echo works.
  2379. if test \"X\$1\" = X--no-reexec; then
  2380. # Discard the --no-reexec flag, and continue.
  2381. shift
  2382. elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
  2383. # Yippee, \$ECHO works!
  2384. :
  2385. else
  2386. # Restart under the correct shell, and then maybe \$ECHO will work.
  2387. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2388. fi
  2389. fi\
  2390. "
  2391. $ECHO "\
  2392. # Find the directory that this script lives in.
  2393. thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2394. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2395. # Follow symbolic links until we get to the real thisdir.
  2396. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  2397. while test -n \"\$file\"; do
  2398. destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2399. # If there was a directory component, then change thisdir.
  2400. if test \"x\$destdir\" != \"x\$file\"; then
  2401. case \"\$destdir\" in
  2402. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  2403. *) thisdir=\"\$thisdir/\$destdir\" ;;
  2404. esac
  2405. fi
  2406. file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2407. file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  2408. done
  2409. "
  2410. }
  2411. # end: func_emit_wrapper_part1
  2412. # func_emit_wrapper_part2 [arg=no]
  2413. #
  2414. # Emit the second part of a libtool wrapper script on stdout.
  2415. # For more information, see the description associated with
  2416. # func_emit_wrapper(), below.
  2417. func_emit_wrapper_part2 ()
  2418. {
  2419. func_emit_wrapper_part2_arg1=no
  2420. if test -n "$1" ; then
  2421. func_emit_wrapper_part2_arg1=$1
  2422. fi
  2423. $ECHO "\
  2424. # Usually 'no', except on cygwin/mingw when embedded into
  2425. # the cwrapper.
  2426. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
  2427. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  2428. # special case for '.'
  2429. if test \"\$thisdir\" = \".\"; then
  2430. thisdir=\`pwd\`
  2431. fi
  2432. # remove .libs from thisdir
  2433. case \"\$thisdir\" in
  2434. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
  2435. $objdir ) thisdir=. ;;
  2436. esac
  2437. fi
  2438. # Try to get the absolute directory name.
  2439. absdir=\`cd \"\$thisdir\" && pwd\`
  2440. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2441. "
  2442. if test "$fast_install" = yes; then
  2443. $ECHO "\
  2444. program=lt-'$outputname'$exeext
  2445. progdir=\"\$thisdir/$objdir\"
  2446. if test ! -f \"\$progdir/\$program\" ||
  2447. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  2448. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2449. file=\"\$\$-\$program\"
  2450. if test ! -d \"\$progdir\"; then
  2451. $MKDIR \"\$progdir\"
  2452. else
  2453. $RM \"\$progdir/\$file\"
  2454. fi"
  2455. $ECHO "\
  2456. # relink executable if necessary
  2457. if test -n \"\$relink_command\"; then
  2458. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  2459. else
  2460. $ECHO \"\$relink_command_output\" >&2
  2461. $RM \"\$progdir/\$file\"
  2462. exit 1
  2463. fi
  2464. fi
  2465. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2466. { $RM \"\$progdir/\$program\";
  2467. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2468. $RM \"\$progdir/\$file\"
  2469. fi"
  2470. else
  2471. $ECHO "\
  2472. program='$outputname'
  2473. progdir=\"\$thisdir/$objdir\"
  2474. "
  2475. fi
  2476. $ECHO "\
  2477. if test -f \"\$progdir/\$program\"; then"
  2478. # Export our shlibpath_var if we have one.
  2479. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2480. $ECHO "\
  2481. # Add our own library path to $shlibpath_var
  2482. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2483. # Some systems cannot cope with colon-terminated $shlibpath_var
  2484. # The second colon is a workaround for a bug in BeOS R4 sed
  2485. $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2486. export $shlibpath_var
  2487. "
  2488. fi
  2489. # fixup the dll searchpath if we need to.
  2490. if test -n "$dllsearchpath"; then
  2491. $ECHO "\
  2492. # Add the dll search path components to the executable PATH
  2493. PATH=$dllsearchpath:\$PATH
  2494. "
  2495. fi
  2496. $ECHO "\
  2497. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2498. # Run the actual program with our arguments.
  2499. "
  2500. case $host in
  2501. # Backslashes separate directories on plain windows
  2502. *-*-mingw | *-*-os2* | *-cegcc*)
  2503. $ECHO "\
  2504. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  2505. "
  2506. ;;
  2507. *)
  2508. $ECHO "\
  2509. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  2510. "
  2511. ;;
  2512. esac
  2513. $ECHO "\
  2514. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  2515. exit 1
  2516. fi
  2517. else
  2518. # The program doesn't exist.
  2519. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  2520. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  2521. $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  2522. exit 1
  2523. fi
  2524. fi\
  2525. "
  2526. }
  2527. # end: func_emit_wrapper_part2
  2528. # func_emit_wrapper [arg=no]
  2529. #
  2530. # Emit a libtool wrapper script on stdout.
  2531. # Don't directly open a file because we may want to
  2532. # incorporate the script contents within a cygwin/mingw
  2533. # wrapper executable. Must ONLY be called from within
  2534. # func_mode_link because it depends on a number of variables
  2535. # set therein.
  2536. #
  2537. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  2538. # variable will take. If 'yes', then the emitted script
  2539. # will assume that the directory in which it is stored is
  2540. # the $objdir directory. This is a cygwin/mingw-specific
  2541. # behavior.
  2542. func_emit_wrapper ()
  2543. {
  2544. func_emit_wrapper_arg1=no
  2545. if test -n "$1" ; then
  2546. func_emit_wrapper_arg1=$1
  2547. fi
  2548. # split this up so that func_emit_cwrapperexe_src
  2549. # can call each part independently.
  2550. func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
  2551. func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
  2552. }
  2553. # func_to_host_path arg
  2554. #
  2555. # Convert paths to host format when used with build tools.
  2556. # Intended for use with "native" mingw (where libtool itself
  2557. # is running under the msys shell), or in the following cross-
  2558. # build environments:
  2559. # $build $host
  2560. # mingw (msys) mingw [e.g. native]
  2561. # cygwin mingw
  2562. # *nix + wine mingw
  2563. # where wine is equipped with the `winepath' executable.
  2564. # In the native mingw case, the (msys) shell automatically
  2565. # converts paths for any non-msys applications it launches,
  2566. # but that facility isn't available from inside the cwrapper.
  2567. # Similar accommodations are necessary for $host mingw and
  2568. # $build cygwin. Calling this function does no harm for other
  2569. # $host/$build combinations not listed above.
  2570. #
  2571. # ARG is the path (on $build) that should be converted to
  2572. # the proper representation for $host. The result is stored
  2573. # in $func_to_host_path_result.
  2574. func_to_host_path ()
  2575. {
  2576. func_to_host_path_result="$1"
  2577. if test -n "$1" ; then
  2578. case $host in
  2579. *mingw* )
  2580. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  2581. case $build in
  2582. *mingw* ) # actually, msys
  2583. # awkward: cmd appends spaces to result
  2584. lt_sed_strip_trailing_spaces="s/[ ]*\$//"
  2585. func_to_host_path_tmp1=`( cmd //c echo "$1" |\
  2586. $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
  2587. func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  2588. $SED -e "$lt_sed_naive_backslashify"`
  2589. ;;
  2590. *cygwin* )
  2591. func_to_host_path_tmp1=`cygpath -w "$1"`
  2592. func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  2593. $SED -e "$lt_sed_naive_backslashify"`
  2594. ;;
  2595. * )
  2596. # Unfortunately, winepath does not exit with a non-zero
  2597. # error code, so we are forced to check the contents of
  2598. # stdout. On the other hand, if the command is not
  2599. # found, the shell will set an exit code of 127 and print
  2600. # *an error message* to stdout. So we must check for both
  2601. # error code of zero AND non-empty stdout, which explains
  2602. # the odd construction:
  2603. func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
  2604. if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
  2605. func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  2606. $SED -e "$lt_sed_naive_backslashify"`
  2607. else
  2608. # Allow warning below.
  2609. func_to_host_path_result=""
  2610. fi
  2611. ;;
  2612. esac
  2613. if test -z "$func_to_host_path_result" ; then
  2614. func_error "Could not determine host path corresponding to"
  2615. func_error " '$1'"
  2616. func_error "Continuing, but uninstalled executables may not work."
  2617. # Fallback:
  2618. func_to_host_path_result="$1"
  2619. fi
  2620. ;;
  2621. esac
  2622. fi
  2623. }
  2624. # end: func_to_host_path
  2625. # func_to_host_pathlist arg
  2626. #
  2627. # Convert pathlists to host format when used with build tools.
  2628. # See func_to_host_path(), above. This function supports the
  2629. # following $build/$host combinations (but does no harm for
  2630. # combinations not listed here):
  2631. # $build $host
  2632. # mingw (msys) mingw [e.g. native]
  2633. # cygwin mingw
  2634. # *nix + wine mingw
  2635. #
  2636. # Path separators are also converted from $build format to
  2637. # $host format. If ARG begins or ends with a path separator
  2638. # character, it is preserved (but converted to $host format)
  2639. # on output.
  2640. #
  2641. # ARG is a pathlist (on $build) that should be converted to
  2642. # the proper representation on $host. The result is stored
  2643. # in $func_to_host_pathlist_result.
  2644. func_to_host_pathlist ()
  2645. {
  2646. func_to_host_pathlist_result="$1"
  2647. if test -n "$1" ; then
  2648. case $host in
  2649. *mingw* )
  2650. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  2651. # Remove leading and trailing path separator characters from
  2652. # ARG. msys behavior is inconsistent here, cygpath turns them
  2653. # into '.;' and ';.', and winepath ignores them completely.
  2654. func_to_host_pathlist_tmp2="$1"
  2655. # Once set for this call, this variable should not be
  2656. # reassigned. It is used in tha fallback case.
  2657. func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
  2658. $SED -e 's|^:*||' -e 's|:*$||'`
  2659. case $build in
  2660. *mingw* ) # Actually, msys.
  2661. # Awkward: cmd appends spaces to result.
  2662. lt_sed_strip_trailing_spaces="s/[ ]*\$//"
  2663. func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
  2664. $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
  2665. func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
  2666. $SED -e "$lt_sed_naive_backslashify"`
  2667. ;;
  2668. *cygwin* )
  2669. func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
  2670. func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
  2671. $SED -e "$lt_sed_naive_backslashify"`
  2672. ;;
  2673. * )
  2674. # unfortunately, winepath doesn't convert pathlists
  2675. func_to_host_pathlist_result=""
  2676. func_to_host_pathlist_oldIFS=$IFS
  2677. IFS=:
  2678. for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
  2679. IFS=$func_to_host_pathlist_oldIFS
  2680. if test -n "$func_to_host_pathlist_f" ; then
  2681. func_to_host_path "$func_to_host_pathlist_f"
  2682. if test -n "$func_to_host_path_result" ; then
  2683. if test -z "$func_to_host_pathlist_result" ; then
  2684. func_to_host_pathlist_result="$func_to_host_path_result"
  2685. else
  2686. func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
  2687. fi
  2688. fi
  2689. fi
  2690. IFS=:
  2691. done
  2692. IFS=$func_to_host_pathlist_oldIFS
  2693. ;;
  2694. esac
  2695. if test -z "$func_to_host_pathlist_result" ; then
  2696. func_error "Could not determine the host path(s) corresponding to"
  2697. func_error " '$1'"
  2698. func_error "Continuing, but uninstalled executables may not work."
  2699. # Fallback. This may break if $1 contains DOS-style drive
  2700. # specifications. The fix is not to complicate the expression
  2701. # below, but for the user to provide a working wine installation
  2702. # with winepath so that path translation in the cross-to-mingw
  2703. # case works properly.
  2704. lt_replace_pathsep_nix_to_dos="s|:|;|g"
  2705. func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
  2706. $SED -e "$lt_replace_pathsep_nix_to_dos"`
  2707. fi
  2708. # Now, add the leading and trailing path separators back
  2709. case "$1" in
  2710. :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
  2711. ;;
  2712. esac
  2713. case "$1" in
  2714. *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
  2715. ;;
  2716. esac
  2717. ;;
  2718. esac
  2719. fi
  2720. }
  2721. # end: func_to_host_pathlist
  2722. # func_emit_cwrapperexe_src
  2723. # emit the source code for a wrapper executable on stdout
  2724. # Must ONLY be called from within func_mode_link because
  2725. # it depends on a number of variable set therein.
  2726. func_emit_cwrapperexe_src ()
  2727. {
  2728. cat <<EOF
  2729. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  2730. Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  2731. The $output program cannot be directly executed until all the libtool
  2732. libraries that it depends on are installed.
  2733. This wrapper executable should never be moved out of the build directory.
  2734. If it is, it will not operate correctly.
  2735. Currently, it simply execs the wrapper *script* "$SHELL $output",
  2736. but could eventually absorb all of the scripts functionality and
  2737. exec $objdir/$outputname directly.
  2738. */
  2739. EOF
  2740. cat <<"EOF"
  2741. #include <stdio.h>
  2742. #include <stdlib.h>
  2743. #ifdef _MSC_VER
  2744. # include <direct.h>
  2745. # include <process.h>
  2746. # include <io.h>
  2747. # define setmode _setmode
  2748. #else
  2749. # include <unistd.h>
  2750. # include <stdint.h>
  2751. # ifdef __CYGWIN__
  2752. # include <io.h>
  2753. # define HAVE_SETENV
  2754. # ifdef __STRICT_ANSI__
  2755. char *realpath (const char *, char *);
  2756. int putenv (char *);
  2757. int setenv (const char *, const char *, int);
  2758. # endif
  2759. # endif
  2760. #endif
  2761. #include <malloc.h>
  2762. #include <stdarg.h>
  2763. #include <assert.h>
  2764. #include <string.h>
  2765. #include <ctype.h>
  2766. #include <errno.h>
  2767. #include <fcntl.h>
  2768. #include <sys/stat.h>
  2769. #if defined(PATH_MAX)
  2770. # define LT_PATHMAX PATH_MAX
  2771. #elif defined(MAXPATHLEN)
  2772. # define LT_PATHMAX MAXPATHLEN
  2773. #else
  2774. # define LT_PATHMAX 1024
  2775. #endif
  2776. #ifndef S_IXOTH
  2777. # define S_IXOTH 0
  2778. #endif
  2779. #ifndef S_IXGRP
  2780. # define S_IXGRP 0
  2781. #endif
  2782. #ifdef _MSC_VER
  2783. # define S_IXUSR _S_IEXEC
  2784. # define stat _stat
  2785. # ifndef _INTPTR_T_DEFINED
  2786. # define intptr_t int
  2787. # endif
  2788. #endif
  2789. #ifndef DIR_SEPARATOR
  2790. # define DIR_SEPARATOR '/'
  2791. # define PATH_SEPARATOR ':'
  2792. #endif
  2793. #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  2794. defined (__OS2__)
  2795. # define HAVE_DOS_BASED_FILE_SYSTEM
  2796. # define FOPEN_WB "wb"
  2797. # ifndef DIR_SEPARATOR_2
  2798. # define DIR_SEPARATOR_2 '\\'
  2799. # endif
  2800. # ifndef PATH_SEPARATOR_2
  2801. # define PATH_SEPARATOR_2 ';'
  2802. # endif
  2803. #endif
  2804. #ifndef DIR_SEPARATOR_2
  2805. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  2806. #else /* DIR_SEPARATOR_2 */
  2807. # define IS_DIR_SEPARATOR(ch) \
  2808. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  2809. #endif /* DIR_SEPARATOR_2 */
  2810. #ifndef PATH_SEPARATOR_2
  2811. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  2812. #else /* PATH_SEPARATOR_2 */
  2813. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  2814. #endif /* PATH_SEPARATOR_2 */
  2815. #ifdef __CYGWIN__
  2816. # define FOPEN_WB "wb"
  2817. #endif
  2818. #ifndef FOPEN_WB
  2819. # define FOPEN_WB "w"
  2820. #endif
  2821. #ifndef _O_BINARY
  2822. # define _O_BINARY 0
  2823. #endif
  2824. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  2825. #define XFREE(stale) do { \
  2826. if (stale) { free ((void *) stale); stale = 0; } \
  2827. } while (0)
  2828. #undef LTWRAPPER_DEBUGPRINTF
  2829. #if defined DEBUGWRAPPER
  2830. # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
  2831. static void
  2832. ltwrapper_debugprintf (const char *fmt, ...)
  2833. {
  2834. va_list args;
  2835. va_start (args, fmt);
  2836. (void) vfprintf (stderr, fmt, args);
  2837. va_end (args);
  2838. }
  2839. #else
  2840. # define LTWRAPPER_DEBUGPRINTF(args)
  2841. #endif
  2842. const char *program_name = NULL;
  2843. void *xmalloc (size_t num);
  2844. char *xstrdup (const char *string);
  2845. const char *base_name (const char *name);
  2846. char *find_executable (const char *wrapper);
  2847. char *chase_symlinks (const char *pathspec);
  2848. int make_executable (const char *path);
  2849. int check_executable (const char *path);
  2850. char *strendzap (char *str, const char *pat);
  2851. void lt_fatal (const char *message, ...);
  2852. void lt_setenv (const char *name, const char *value);
  2853. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  2854. void lt_opt_process_env_set (const char *arg);
  2855. void lt_opt_process_env_prepend (const char *arg);
  2856. void lt_opt_process_env_append (const char *arg);
  2857. int lt_split_name_value (const char *arg, char** name, char** value);
  2858. void lt_update_exe_path (const char *name, const char *value);
  2859. void lt_update_lib_path (const char *name, const char *value);
  2860. static const char *script_text_part1 =
  2861. EOF
  2862. func_emit_wrapper_part1 yes |
  2863. $SED -e 's/\([\\"]\)/\\\1/g' \
  2864. -e 's/^/ "/' -e 's/$/\\n"/'
  2865. echo ";"
  2866. cat <<EOF
  2867. static const char *script_text_part2 =
  2868. EOF
  2869. func_emit_wrapper_part2 yes |
  2870. $SED -e 's/\([\\"]\)/\\\1/g' \
  2871. -e 's/^/ "/' -e 's/$/\\n"/'
  2872. echo ";"
  2873. cat <<EOF
  2874. const char * MAGIC_EXE = "$magic_exe";
  2875. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  2876. EOF
  2877. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2878. func_to_host_pathlist "$temp_rpath"
  2879. cat <<EOF
  2880. const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
  2881. EOF
  2882. else
  2883. cat <<"EOF"
  2884. const char * LIB_PATH_VALUE = "";
  2885. EOF
  2886. fi
  2887. if test -n "$dllsearchpath"; then
  2888. func_to_host_pathlist "$dllsearchpath:"
  2889. cat <<EOF
  2890. const char * EXE_PATH_VARNAME = "PATH";
  2891. const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
  2892. EOF
  2893. else
  2894. cat <<"EOF"
  2895. const char * EXE_PATH_VARNAME = "";
  2896. const char * EXE_PATH_VALUE = "";
  2897. EOF
  2898. fi
  2899. if test "$fast_install" = yes; then
  2900. cat <<EOF
  2901. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  2902. EOF
  2903. else
  2904. cat <<EOF
  2905. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  2906. EOF
  2907. fi
  2908. cat <<"EOF"
  2909. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  2910. #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
  2911. static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
  2912. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  2913. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  2914. static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
  2915. static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
  2916. /* argument is putenv-style "foo=bar", value of foo is set to bar */
  2917. static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
  2918. static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
  2919. /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
  2920. static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
  2921. static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
  2922. /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
  2923. int
  2924. main (int argc, char *argv[])
  2925. {
  2926. char **newargz;
  2927. int newargc;
  2928. char *tmp_pathspec;
  2929. char *actual_cwrapper_path;
  2930. char *actual_cwrapper_name;
  2931. char *target_name;
  2932. char *lt_argv_zero;
  2933. intptr_t rval = 127;
  2934. int i;
  2935. program_name = (char *) xstrdup (base_name (argv[0]));
  2936. LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
  2937. LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
  2938. /* very simple arg parsing; don't want to rely on getopt */
  2939. for (i = 1; i < argc; i++)
  2940. {
  2941. if (strcmp (argv[i], dumpscript_opt) == 0)
  2942. {
  2943. EOF
  2944. case "$host" in
  2945. *mingw* | *cygwin* )
  2946. # make stdout use "unix" line endings
  2947. echo " setmode(1,_O_BINARY);"
  2948. ;;
  2949. esac
  2950. cat <<"EOF"
  2951. printf ("%s", script_text_part1);
  2952. printf ("%s", script_text_part2);
  2953. return 0;
  2954. }
  2955. }
  2956. newargz = XMALLOC (char *, argc + 1);
  2957. tmp_pathspec = find_executable (argv[0]);
  2958. if (tmp_pathspec == NULL)
  2959. lt_fatal ("Couldn't find %s", argv[0]);
  2960. LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
  2961. tmp_pathspec));
  2962. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  2963. LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
  2964. actual_cwrapper_path));
  2965. XFREE (tmp_pathspec);
  2966. actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
  2967. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  2968. /* wrapper name transforms */
  2969. strendzap (actual_cwrapper_name, ".exe");
  2970. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  2971. XFREE (actual_cwrapper_name);
  2972. actual_cwrapper_name = tmp_pathspec;
  2973. tmp_pathspec = 0;
  2974. /* target_name transforms -- use actual target program name; might have lt- prefix */
  2975. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  2976. strendzap (target_name, ".exe");
  2977. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  2978. XFREE (target_name);
  2979. target_name = tmp_pathspec;
  2980. tmp_pathspec = 0;
  2981. LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
  2982. target_name));
  2983. EOF
  2984. cat <<EOF
  2985. newargz[0] =
  2986. XMALLOC (char, (strlen (actual_cwrapper_path) +
  2987. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  2988. strcpy (newargz[0], actual_cwrapper_path);
  2989. strcat (newargz[0], "$objdir");
  2990. strcat (newargz[0], "/");
  2991. EOF
  2992. cat <<"EOF"
  2993. /* stop here, and copy so we don't have to do this twice */
  2994. tmp_pathspec = xstrdup (newargz[0]);
  2995. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  2996. strcat (newargz[0], actual_cwrapper_name);
  2997. /* DO want the lt- prefix here if it exists, so use target_name */
  2998. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  2999. XFREE (tmp_pathspec);
  3000. tmp_pathspec = NULL;
  3001. EOF
  3002. case $host_os in
  3003. mingw*)
  3004. cat <<"EOF"
  3005. {
  3006. char* p;
  3007. while ((p = strchr (newargz[0], '\\')) != NULL)
  3008. {
  3009. *p = '/';
  3010. }
  3011. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  3012. {
  3013. *p = '/';
  3014. }
  3015. }
  3016. EOF
  3017. ;;
  3018. esac
  3019. cat <<"EOF"
  3020. XFREE (target_name);
  3021. XFREE (actual_cwrapper_path);
  3022. XFREE (actual_cwrapper_name);
  3023. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  3024. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  3025. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  3026. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  3027. newargc=0;
  3028. for (i = 1; i < argc; i++)
  3029. {
  3030. if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
  3031. {
  3032. if (argv[i][env_set_opt_len] == '=')
  3033. {
  3034. const char *p = argv[i] + env_set_opt_len + 1;
  3035. lt_opt_process_env_set (p);
  3036. }
  3037. else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
  3038. {
  3039. lt_opt_process_env_set (argv[++i]); /* don't copy */
  3040. }
  3041. else
  3042. lt_fatal ("%s missing required argument", env_set_opt);
  3043. continue;
  3044. }
  3045. if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
  3046. {
  3047. if (argv[i][env_prepend_opt_len] == '=')
  3048. {
  3049. const char *p = argv[i] + env_prepend_opt_len + 1;
  3050. lt_opt_process_env_prepend (p);
  3051. }
  3052. else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
  3053. {
  3054. lt_opt_process_env_prepend (argv[++i]); /* don't copy */
  3055. }
  3056. else
  3057. lt_fatal ("%s missing required argument", env_prepend_opt);
  3058. continue;
  3059. }
  3060. if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
  3061. {
  3062. if (argv[i][env_append_opt_len] == '=')
  3063. {
  3064. const char *p = argv[i] + env_append_opt_len + 1;
  3065. lt_opt_process_env_append (p);
  3066. }
  3067. else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
  3068. {
  3069. lt_opt_process_env_append (argv[++i]); /* don't copy */
  3070. }
  3071. else
  3072. lt_fatal ("%s missing required argument", env_append_opt);
  3073. continue;
  3074. }
  3075. if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
  3076. {
  3077. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  3078. namespace, but it is not one of the ones we know about and
  3079. have already dealt with, above (inluding dump-script), then
  3080. report an error. Otherwise, targets might begin to believe
  3081. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  3082. namespace. The first time any user complains about this, we'll
  3083. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  3084. or a configure.ac-settable value.
  3085. */
  3086. lt_fatal ("Unrecognized option in %s namespace: '%s'",
  3087. ltwrapper_option_prefix, argv[i]);
  3088. }
  3089. /* otherwise ... */
  3090. newargz[++newargc] = xstrdup (argv[i]);
  3091. }
  3092. newargz[++newargc] = NULL;
  3093. LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
  3094. for (i = 0; i < newargc; i++)
  3095. {
  3096. LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
  3097. }
  3098. EOF
  3099. case $host_os in
  3100. mingw*)
  3101. cat <<"EOF"
  3102. /* execv doesn't actually work on mingw as expected on unix */
  3103. rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  3104. if (rval == -1)
  3105. {
  3106. /* failed to start process */
  3107. LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
  3108. return 127;
  3109. }
  3110. return rval;
  3111. EOF
  3112. ;;
  3113. *)
  3114. cat <<"EOF"
  3115. execv (lt_argv_zero, newargz);
  3116. return rval; /* =127, but avoids unused variable warning */
  3117. EOF
  3118. ;;
  3119. esac
  3120. cat <<"EOF"
  3121. }
  3122. void *
  3123. xmalloc (size_t num)
  3124. {
  3125. void *p = (void *) malloc (num);
  3126. if (!p)
  3127. lt_fatal ("Memory exhausted");
  3128. return p;
  3129. }
  3130. char *
  3131. xstrdup (const char *string)
  3132. {
  3133. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  3134. string) : NULL;
  3135. }
  3136. const char *
  3137. base_name (const char *name)
  3138. {
  3139. const char *base;
  3140. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3141. /* Skip over the disk name in MSDOS pathnames. */
  3142. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  3143. name += 2;
  3144. #endif
  3145. for (base = name; *name; name++)
  3146. if (IS_DIR_SEPARATOR (*name))
  3147. base = name + 1;
  3148. return base;
  3149. }
  3150. int
  3151. check_executable (const char *path)
  3152. {
  3153. struct stat st;
  3154. LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
  3155. path ? (*path ? path : "EMPTY!") : "NULL!"));
  3156. if ((!path) || (!*path))
  3157. return 0;
  3158. if ((stat (path, &st) >= 0)
  3159. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  3160. return 1;
  3161. else
  3162. return 0;
  3163. }
  3164. int
  3165. make_executable (const char *path)
  3166. {
  3167. int rval = 0;
  3168. struct stat st;
  3169. LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
  3170. path ? (*path ? path : "EMPTY!") : "NULL!"));
  3171. if ((!path) || (!*path))
  3172. return 0;
  3173. if (stat (path, &st) >= 0)
  3174. {
  3175. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  3176. }
  3177. return rval;
  3178. }
  3179. /* Searches for the full path of the wrapper. Returns
  3180. newly allocated full path name if found, NULL otherwise
  3181. Does not chase symlinks, even on platforms that support them.
  3182. */
  3183. char *
  3184. find_executable (const char *wrapper)
  3185. {
  3186. int has_slash = 0;
  3187. const char *p;
  3188. const char *p_next;
  3189. /* static buffer for getcwd */
  3190. char tmp[LT_PATHMAX + 1];
  3191. int tmp_len;
  3192. char *concat_name;
  3193. LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
  3194. wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
  3195. if ((wrapper == NULL) || (*wrapper == '\0'))
  3196. return NULL;
  3197. /* Absolute path? */
  3198. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3199. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  3200. {
  3201. concat_name = xstrdup (wrapper);
  3202. if (check_executable (concat_name))
  3203. return concat_name;
  3204. XFREE (concat_name);
  3205. }
  3206. else
  3207. {
  3208. #endif
  3209. if (IS_DIR_SEPARATOR (wrapper[0]))
  3210. {
  3211. concat_name = xstrdup (wrapper);
  3212. if (check_executable (concat_name))
  3213. return concat_name;
  3214. XFREE (concat_name);
  3215. }
  3216. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3217. }
  3218. #endif
  3219. for (p = wrapper; *p; p++)
  3220. if (*p == '/')
  3221. {
  3222. has_slash = 1;
  3223. break;
  3224. }
  3225. if (!has_slash)
  3226. {
  3227. /* no slashes; search PATH */
  3228. const char *path = getenv ("PATH");
  3229. if (path != NULL)
  3230. {
  3231. for (p = path; *p; p = p_next)
  3232. {
  3233. const char *q;
  3234. size_t p_len;
  3235. for (q = p; *q; q++)
  3236. if (IS_PATH_SEPARATOR (*q))
  3237. break;
  3238. p_len = q - p;
  3239. p_next = (*q == '\0' ? q : q + 1);
  3240. if (p_len == 0)
  3241. {
  3242. /* empty path: current directory */
  3243. if (getcwd (tmp, LT_PATHMAX) == NULL)
  3244. lt_fatal ("getcwd failed");
  3245. tmp_len = strlen (tmp);
  3246. concat_name =
  3247. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  3248. memcpy (concat_name, tmp, tmp_len);
  3249. concat_name[tmp_len] = '/';
  3250. strcpy (concat_name + tmp_len + 1, wrapper);
  3251. }
  3252. else
  3253. {
  3254. concat_name =
  3255. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  3256. memcpy (concat_name, p, p_len);
  3257. concat_name[p_len] = '/';
  3258. strcpy (concat_name + p_len + 1, wrapper);
  3259. }
  3260. if (check_executable (concat_name))
  3261. return concat_name;
  3262. XFREE (concat_name);
  3263. }
  3264. }
  3265. /* not found in PATH; assume curdir */
  3266. }
  3267. /* Relative path | not found in path: prepend cwd */
  3268. if (getcwd (tmp, LT_PATHMAX) == NULL)
  3269. lt_fatal ("getcwd failed");
  3270. tmp_len = strlen (tmp);
  3271. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  3272. memcpy (concat_name, tmp, tmp_len);
  3273. concat_name[tmp_len] = '/';
  3274. strcpy (concat_name + tmp_len + 1, wrapper);
  3275. if (check_executable (concat_name))
  3276. return concat_name;
  3277. XFREE (concat_name);
  3278. return NULL;
  3279. }
  3280. char *
  3281. chase_symlinks (const char *pathspec)
  3282. {
  3283. #ifndef S_ISLNK
  3284. return xstrdup (pathspec);
  3285. #else
  3286. char buf[LT_PATHMAX];
  3287. struct stat s;
  3288. char *tmp_pathspec = xstrdup (pathspec);
  3289. char *p;
  3290. int has_symlinks = 0;
  3291. while (strlen (tmp_pathspec) && !has_symlinks)
  3292. {
  3293. LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
  3294. tmp_pathspec));
  3295. if (lstat (tmp_pathspec, &s) == 0)
  3296. {
  3297. if (S_ISLNK (s.st_mode) != 0)
  3298. {
  3299. has_symlinks = 1;
  3300. break;
  3301. }
  3302. /* search backwards for last DIR_SEPARATOR */
  3303. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  3304. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  3305. p--;
  3306. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  3307. {
  3308. /* no more DIR_SEPARATORS left */
  3309. break;
  3310. }
  3311. *p = '\0';
  3312. }
  3313. else
  3314. {
  3315. char *errstr = strerror (errno);
  3316. lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
  3317. }
  3318. }
  3319. XFREE (tmp_pathspec);
  3320. if (!has_symlinks)
  3321. {
  3322. return xstrdup (pathspec);
  3323. }
  3324. tmp_pathspec = realpath (pathspec, buf);
  3325. if (tmp_pathspec == 0)
  3326. {
  3327. lt_fatal ("Could not follow symlinks for %s", pathspec);
  3328. }
  3329. return xstrdup (tmp_pathspec);
  3330. #endif
  3331. }
  3332. char *
  3333. strendzap (char *str, const char *pat)
  3334. {
  3335. size_t len, patlen;
  3336. assert (str != NULL);
  3337. assert (pat != NULL);
  3338. len = strlen (str);
  3339. patlen = strlen (pat);
  3340. if (patlen <= len)
  3341. {
  3342. str += len - patlen;
  3343. if (strcmp (str, pat) == 0)
  3344. *str = '\0';
  3345. }
  3346. return str;
  3347. }
  3348. static void
  3349. lt_error_core (int exit_status, const char *mode,
  3350. const char *message, va_list ap)
  3351. {
  3352. fprintf (stderr, "%s: %s: ", program_name, mode);
  3353. vfprintf (stderr, message, ap);
  3354. fprintf (stderr, ".\n");
  3355. if (exit_status >= 0)
  3356. exit (exit_status);
  3357. }
  3358. void
  3359. lt_fatal (const char *message, ...)
  3360. {
  3361. va_list ap;
  3362. va_start (ap, message);
  3363. lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  3364. va_end (ap);
  3365. }
  3366. void
  3367. lt_setenv (const char *name, const char *value)
  3368. {
  3369. LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
  3370. (name ? name : "<NULL>"),
  3371. (value ? value : "<NULL>")));
  3372. {
  3373. #ifdef HAVE_SETENV
  3374. /* always make a copy, for consistency with !HAVE_SETENV */
  3375. char *str = xstrdup (value);
  3376. setenv (name, str, 1);
  3377. #else
  3378. int len = strlen (name) + 1 + strlen (value) + 1;
  3379. char *str = XMALLOC (char, len);
  3380. sprintf (str, "%s=%s", name, value);
  3381. if (putenv (str) != EXIT_SUCCESS)
  3382. {
  3383. XFREE (str);
  3384. }
  3385. #endif
  3386. }
  3387. }
  3388. char *
  3389. lt_extend_str (const char *orig_value, const char *add, int to_end)
  3390. {
  3391. char *new_value;
  3392. if (orig_value && *orig_value)
  3393. {
  3394. int orig_value_len = strlen (orig_value);
  3395. int add_len = strlen (add);
  3396. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  3397. if (to_end)
  3398. {
  3399. strcpy (new_value, orig_value);
  3400. strcpy (new_value + orig_value_len, add);
  3401. }
  3402. else
  3403. {
  3404. strcpy (new_value, add);
  3405. strcpy (new_value + add_len, orig_value);
  3406. }
  3407. }
  3408. else
  3409. {
  3410. new_value = xstrdup (add);
  3411. }
  3412. return new_value;
  3413. }
  3414. int
  3415. lt_split_name_value (const char *arg, char** name, char** value)
  3416. {
  3417. const char *p;
  3418. int len;
  3419. if (!arg || !*arg)
  3420. return 1;
  3421. p = strchr (arg, (int)'=');
  3422. if (!p)
  3423. return 1;
  3424. *value = xstrdup (++p);
  3425. len = strlen (arg) - strlen (*value);
  3426. *name = XMALLOC (char, len);
  3427. strncpy (*name, arg, len-1);
  3428. (*name)[len - 1] = '\0';
  3429. return 0;
  3430. }
  3431. void
  3432. lt_opt_process_env_set (const char *arg)
  3433. {
  3434. char *name = NULL;
  3435. char *value = NULL;
  3436. if (lt_split_name_value (arg, &name, &value) != 0)
  3437. {
  3438. XFREE (name);
  3439. XFREE (value);
  3440. lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
  3441. }
  3442. lt_setenv (name, value);
  3443. XFREE (name);
  3444. XFREE (value);
  3445. }
  3446. void
  3447. lt_opt_process_env_prepend (const char *arg)
  3448. {
  3449. char *name = NULL;
  3450. char *value = NULL;
  3451. char *new_value = NULL;
  3452. if (lt_split_name_value (arg, &name, &value) != 0)
  3453. {
  3454. XFREE (name);
  3455. XFREE (value);
  3456. lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
  3457. }
  3458. new_value = lt_extend_str (getenv (name), value, 0);
  3459. lt_setenv (name, new_value);
  3460. XFREE (new_value);
  3461. XFREE (name);
  3462. XFREE (value);
  3463. }
  3464. void
  3465. lt_opt_process_env_append (const char *arg)
  3466. {
  3467. char *name = NULL;
  3468. char *value = NULL;
  3469. char *new_value = NULL;
  3470. if (lt_split_name_value (arg, &name, &value) != 0)
  3471. {
  3472. XFREE (name);
  3473. XFREE (value);
  3474. lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
  3475. }
  3476. new_value = lt_extend_str (getenv (name), value, 1);
  3477. lt_setenv (name, new_value);
  3478. XFREE (new_value);
  3479. XFREE (name);
  3480. XFREE (value);
  3481. }
  3482. void
  3483. lt_update_exe_path (const char *name, const char *value)
  3484. {
  3485. LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  3486. (name ? name : "<NULL>"),
  3487. (value ? value : "<NULL>")));
  3488. if (name && *name && value && *value)
  3489. {
  3490. char *new_value = lt_extend_str (getenv (name), value, 0);
  3491. /* some systems can't cope with a ':'-terminated path #' */
  3492. int len = strlen (new_value);
  3493. while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  3494. {
  3495. new_value[len-1] = '\0';
  3496. }
  3497. lt_setenv (name, new_value);
  3498. XFREE (new_value);
  3499. }
  3500. }
  3501. void
  3502. lt_update_lib_path (const char *name, const char *value)
  3503. {
  3504. LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  3505. (name ? name : "<NULL>"),
  3506. (value ? value : "<NULL>")));
  3507. if (name && *name && value && *value)
  3508. {
  3509. char *new_value = lt_extend_str (getenv (name), value, 0);
  3510. lt_setenv (name, new_value);
  3511. XFREE (new_value);
  3512. }
  3513. }
  3514. EOF
  3515. }
  3516. # end: func_emit_cwrapperexe_src
  3517. # func_mode_link arg...
  3518. func_mode_link ()
  3519. {
  3520. $opt_debug
  3521. case $host in
  3522. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  3523. # It is impossible to link a dll without this setting, and
  3524. # we shouldn't force the makefile maintainer to figure out
  3525. # which system we are compiling for in order to pass an extra
  3526. # flag for every libtool invocation.
  3527. # allow_undefined=no
  3528. # FIXME: Unfortunately, there are problems with the above when trying
  3529. # to make a dll which has undefined symbols, in which case not
  3530. # even a static library is built. For now, we need to specify
  3531. # -no-undefined on the libtool link line when we can be certain
  3532. # that all symbols are satisfied, otherwise we get a static library.
  3533. allow_undefined=yes
  3534. ;;
  3535. *)
  3536. allow_undefined=yes
  3537. ;;
  3538. esac
  3539. libtool_args=$nonopt
  3540. base_compile="$nonopt $@"
  3541. compile_command=$nonopt
  3542. finalize_command=$nonopt
  3543. compile_rpath=
  3544. finalize_rpath=
  3545. compile_shlibpath=
  3546. finalize_shlibpath=
  3547. convenience=
  3548. old_convenience=
  3549. deplibs=
  3550. old_deplibs=
  3551. compiler_flags=
  3552. linker_flags=
  3553. dllsearchpath=
  3554. lib_search_path=`pwd`
  3555. inst_prefix_dir=
  3556. new_inherited_linker_flags=
  3557. avoid_version=no
  3558. dlfiles=
  3559. dlprefiles=
  3560. dlself=no
  3561. export_dynamic=no
  3562. export_symbols=
  3563. export_symbols_regex=
  3564. generated=
  3565. libobjs=
  3566. ltlibs=
  3567. module=no
  3568. no_install=no
  3569. objs=
  3570. non_pic_objects=
  3571. precious_files_regex=
  3572. prefer_static_libs=no
  3573. preload=no
  3574. prev=
  3575. prevarg=
  3576. release=
  3577. rpath=
  3578. xrpath=
  3579. perm_rpath=
  3580. temp_rpath=
  3581. thread_safe=no
  3582. vinfo=
  3583. vinfo_number=no
  3584. weak_libs=
  3585. single_module="${wl}-single_module"
  3586. func_infer_tag $base_compile
  3587. # We need to know -static, to get the right output filenames.
  3588. for arg
  3589. do
  3590. case $arg in
  3591. -shared)
  3592. test "$build_libtool_libs" != yes && \
  3593. func_fatal_configuration "can not build a shared library"
  3594. build_old_libs=no
  3595. break
  3596. ;;
  3597. -all-static | -static | -static-libtool-libs)
  3598. case $arg in
  3599. -all-static)
  3600. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  3601. func_warning "complete static linking is impossible in this configuration"
  3602. fi
  3603. if test -n "$link_static_flag"; then
  3604. dlopen_self=$dlopen_self_static
  3605. fi
  3606. prefer_static_libs=yes
  3607. ;;
  3608. -static)
  3609. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  3610. dlopen_self=$dlopen_self_static
  3611. fi
  3612. prefer_static_libs=built
  3613. ;;
  3614. -static-libtool-libs)
  3615. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  3616. dlopen_self=$dlopen_self_static
  3617. fi
  3618. prefer_static_libs=yes
  3619. ;;
  3620. esac
  3621. build_libtool_libs=no
  3622. build_old_libs=yes
  3623. break
  3624. ;;
  3625. esac
  3626. done
  3627. # See if our shared archives depend on static archives.
  3628. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  3629. # Go through the arguments, transforming them on the way.
  3630. while test "$#" -gt 0; do
  3631. arg="$1"
  3632. shift
  3633. func_quote_for_eval "$arg"
  3634. qarg=$func_quote_for_eval_unquoted_result
  3635. func_append libtool_args " $func_quote_for_eval_result"
  3636. # If the previous option needs an argument, assign it.
  3637. if test -n "$prev"; then
  3638. case $prev in
  3639. output)
  3640. func_append compile_command " @OUTPUT@"
  3641. func_append finalize_command " @OUTPUT@"
  3642. ;;
  3643. esac
  3644. case $prev in
  3645. dlfiles|dlprefiles)
  3646. if test "$preload" = no; then
  3647. # Add the symbol object into the linking commands.
  3648. func_append compile_command " @SYMFILE@"
  3649. func_append finalize_command " @SYMFILE@"
  3650. preload=yes
  3651. fi
  3652. case $arg in
  3653. *.la | *.lo) ;; # We handle these cases below.
  3654. force)
  3655. if test "$dlself" = no; then
  3656. dlself=needless
  3657. export_dynamic=yes
  3658. fi
  3659. prev=
  3660. continue
  3661. ;;
  3662. self)
  3663. if test "$prev" = dlprefiles; then
  3664. dlself=yes
  3665. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  3666. dlself=yes
  3667. else
  3668. dlself=needless
  3669. export_dynamic=yes
  3670. fi
  3671. prev=
  3672. continue
  3673. ;;
  3674. *)
  3675. if test "$prev" = dlfiles; then
  3676. dlfiles="$dlfiles $arg"
  3677. else
  3678. dlprefiles="$dlprefiles $arg"
  3679. fi
  3680. prev=
  3681. continue
  3682. ;;
  3683. esac
  3684. ;;
  3685. expsyms)
  3686. export_symbols="$arg"
  3687. test -f "$arg" \
  3688. || func_fatal_error "symbol file \`$arg' does not exist"
  3689. prev=
  3690. continue
  3691. ;;
  3692. expsyms_regex)
  3693. export_symbols_regex="$arg"
  3694. prev=
  3695. continue
  3696. ;;
  3697. framework)
  3698. case $host in
  3699. *-*-darwin*)
  3700. case "$deplibs " in
  3701. *" $qarg.ltframework "*) ;;
  3702. *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
  3703. ;;
  3704. esac
  3705. ;;
  3706. esac
  3707. prev=
  3708. continue
  3709. ;;
  3710. inst_prefix)
  3711. inst_prefix_dir="$arg"
  3712. prev=
  3713. continue
  3714. ;;
  3715. objectlist)
  3716. if test -f "$arg"; then
  3717. save_arg=$arg
  3718. moreargs=
  3719. for fil in `cat "$save_arg"`
  3720. do
  3721. # moreargs="$moreargs $fil"
  3722. arg=$fil
  3723. # A libtool-controlled object.
  3724. # Check to see that this really is a libtool object.
  3725. if func_lalib_unsafe_p "$arg"; then
  3726. pic_object=
  3727. non_pic_object=
  3728. # Read the .lo file
  3729. func_source "$arg"
  3730. if test -z "$pic_object" ||
  3731. test -z "$non_pic_object" ||
  3732. test "$pic_object" = none &&
  3733. test "$non_pic_object" = none; then
  3734. func_fatal_error "cannot find name of object for \`$arg'"
  3735. fi
  3736. # Extract subdirectory from the argument.
  3737. func_dirname "$arg" "/" ""
  3738. xdir="$func_dirname_result"
  3739. if test "$pic_object" != none; then
  3740. # Prepend the subdirectory the object is found in.
  3741. pic_object="$xdir$pic_object"
  3742. if test "$prev" = dlfiles; then
  3743. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  3744. dlfiles="$dlfiles $pic_object"
  3745. prev=
  3746. continue
  3747. else
  3748. # If libtool objects are unsupported, then we need to preload.
  3749. prev=dlprefiles
  3750. fi
  3751. fi
  3752. # CHECK ME: I think I busted this. -Ossama
  3753. if test "$prev" = dlprefiles; then
  3754. # Preload the old-style object.
  3755. dlprefiles="$dlprefiles $pic_object"
  3756. prev=
  3757. fi
  3758. # A PIC object.
  3759. func_append libobjs " $pic_object"
  3760. arg="$pic_object"
  3761. fi
  3762. # Non-PIC object.
  3763. if test "$non_pic_object" != none; then
  3764. # Prepend the subdirectory the object is found in.
  3765. non_pic_object="$xdir$non_pic_object"
  3766. # A standard non-PIC object
  3767. func_append non_pic_objects " $non_pic_object"
  3768. if test -z "$pic_object" || test "$pic_object" = none ; then
  3769. arg="$non_pic_object"
  3770. fi
  3771. else
  3772. # If the PIC object exists, use it instead.
  3773. # $xdir was prepended to $pic_object above.
  3774. non_pic_object="$pic_object"
  3775. func_append non_pic_objects " $non_pic_object"
  3776. fi
  3777. else
  3778. # Only an error if not doing a dry-run.
  3779. if $opt_dry_run; then
  3780. # Extract subdirectory from the argument.
  3781. func_dirname "$arg" "/" ""
  3782. xdir="$func_dirname_result"
  3783. func_lo2o "$arg"
  3784. pic_object=$xdir$objdir/$func_lo2o_result
  3785. non_pic_object=$xdir$func_lo2o_result
  3786. func_append libobjs " $pic_object"
  3787. func_append non_pic_objects " $non_pic_object"
  3788. else
  3789. func_fatal_error "\`$arg' is not a valid libtool object"
  3790. fi
  3791. fi
  3792. done
  3793. else
  3794. func_fatal_error "link input file \`$arg' does not exist"
  3795. fi
  3796. arg=$save_arg
  3797. prev=
  3798. continue
  3799. ;;
  3800. precious_regex)
  3801. precious_files_regex="$arg"
  3802. prev=
  3803. continue
  3804. ;;
  3805. release)
  3806. release="-$arg"
  3807. prev=
  3808. continue
  3809. ;;
  3810. rpath | xrpath)
  3811. # We need an absolute path.
  3812. case $arg in
  3813. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3814. *)
  3815. func_fatal_error "only absolute run-paths are allowed"
  3816. ;;
  3817. esac
  3818. if test "$prev" = rpath; then
  3819. case "$rpath " in
  3820. *" $arg "*) ;;
  3821. *) rpath="$rpath $arg" ;;
  3822. esac
  3823. else
  3824. case "$xrpath " in
  3825. *" $arg "*) ;;
  3826. *) xrpath="$xrpath $arg" ;;
  3827. esac
  3828. fi
  3829. prev=
  3830. continue
  3831. ;;
  3832. shrext)
  3833. shrext_cmds="$arg"
  3834. prev=
  3835. continue
  3836. ;;
  3837. weak)
  3838. weak_libs="$weak_libs $arg"
  3839. prev=
  3840. continue
  3841. ;;
  3842. xcclinker)
  3843. linker_flags="$linker_flags $qarg"
  3844. compiler_flags="$compiler_flags $qarg"
  3845. prev=
  3846. func_append compile_command " $qarg"
  3847. func_append finalize_command " $qarg"
  3848. continue
  3849. ;;
  3850. xcompiler)
  3851. compiler_flags="$compiler_flags $qarg"
  3852. prev=
  3853. func_append compile_command " $qarg"
  3854. func_append finalize_command " $qarg"
  3855. continue
  3856. ;;
  3857. xlinker)
  3858. linker_flags="$linker_flags $qarg"
  3859. compiler_flags="$compiler_flags $wl$qarg"
  3860. prev=
  3861. func_append compile_command " $wl$qarg"
  3862. func_append finalize_command " $wl$qarg"
  3863. continue
  3864. ;;
  3865. *)
  3866. eval "$prev=\"\$arg\""
  3867. prev=
  3868. continue
  3869. ;;
  3870. esac
  3871. fi # test -n "$prev"
  3872. prevarg="$arg"
  3873. case $arg in
  3874. -all-static)
  3875. if test -n "$link_static_flag"; then
  3876. # See comment for -static flag below, for more details.
  3877. func_append compile_command " $link_static_flag"
  3878. func_append finalize_command " $link_static_flag"
  3879. fi
  3880. continue
  3881. ;;
  3882. -allow-undefined)
  3883. # FIXME: remove this flag sometime in the future.
  3884. func_fatal_error "\`-allow-undefined' must not be used because it is the default"
  3885. ;;
  3886. -avoid-version)
  3887. avoid_version=yes
  3888. continue
  3889. ;;
  3890. -dlopen)
  3891. prev=dlfiles
  3892. continue
  3893. ;;
  3894. -dlpreopen)
  3895. prev=dlprefiles
  3896. continue
  3897. ;;
  3898. -export-dynamic)
  3899. export_dynamic=yes
  3900. continue
  3901. ;;
  3902. -export-symbols | -export-symbols-regex)
  3903. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  3904. func_fatal_error "more than one -exported-symbols argument is not allowed"
  3905. fi
  3906. if test "X$arg" = "X-export-symbols"; then
  3907. prev=expsyms
  3908. else
  3909. prev=expsyms_regex
  3910. fi
  3911. continue
  3912. ;;
  3913. -framework)
  3914. prev=framework
  3915. continue
  3916. ;;
  3917. -inst-prefix-dir)
  3918. prev=inst_prefix
  3919. continue
  3920. ;;
  3921. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  3922. # so, if we see these flags be careful not to treat them like -L
  3923. -L[A-Z][A-Z]*:*)
  3924. case $with_gcc/$host in
  3925. no/*-*-irix* | /*-*-irix*)
  3926. func_append compile_command " $arg"
  3927. func_append finalize_command " $arg"
  3928. ;;
  3929. esac
  3930. continue
  3931. ;;
  3932. -L*)
  3933. func_stripname '-L' '' "$arg"
  3934. dir=$func_stripname_result
  3935. if test -z "$dir"; then
  3936. if test "$#" -gt 0; then
  3937. func_fatal_error "require no space between \`-L' and \`$1'"
  3938. else
  3939. func_fatal_error "need path for \`-L' option"
  3940. fi
  3941. fi
  3942. # We need an absolute path.
  3943. case $dir in
  3944. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3945. *)
  3946. absdir=`cd "$dir" && pwd`
  3947. test -z "$absdir" && \
  3948. func_fatal_error "cannot determine absolute directory name of \`$dir'"
  3949. dir="$absdir"
  3950. ;;
  3951. esac
  3952. case "$deplibs " in
  3953. *" -L$dir "*) ;;
  3954. *)
  3955. deplibs="$deplibs -L$dir"
  3956. lib_search_path="$lib_search_path $dir"
  3957. ;;
  3958. esac
  3959. case $host in
  3960. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  3961. testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
  3962. case :$dllsearchpath: in
  3963. *":$dir:"*) ;;
  3964. ::) dllsearchpath=$dir;;
  3965. *) dllsearchpath="$dllsearchpath:$dir";;
  3966. esac
  3967. case :$dllsearchpath: in
  3968. *":$testbindir:"*) ;;
  3969. ::) dllsearchpath=$testbindir;;
  3970. *) dllsearchpath="$dllsearchpath:$testbindir";;
  3971. esac
  3972. ;;
  3973. esac
  3974. continue
  3975. ;;
  3976. -l*)
  3977. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  3978. case $host in
  3979. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
  3980. # These systems don't actually have a C or math library (as such)
  3981. continue
  3982. ;;
  3983. *-*-os2*)
  3984. # These systems don't actually have a C library (as such)
  3985. test "X$arg" = "X-lc" && continue
  3986. ;;
  3987. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  3988. # Do not include libc due to us having libc/libc_r.
  3989. test "X$arg" = "X-lc" && continue
  3990. ;;
  3991. *-*-rhapsody* | *-*-darwin1.[012])
  3992. # Rhapsody C and math libraries are in the System framework
  3993. deplibs="$deplibs System.ltframework"
  3994. continue
  3995. ;;
  3996. *-*-sco3.2v5* | *-*-sco5v6*)
  3997. # Causes problems with __ctype
  3998. test "X$arg" = "X-lc" && continue
  3999. ;;
  4000. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  4001. # Compiler inserts libc in the correct place for threads to work
  4002. test "X$arg" = "X-lc" && continue
  4003. ;;
  4004. esac
  4005. elif test "X$arg" = "X-lc_r"; then
  4006. case $host in
  4007. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4008. # Do not include libc_r directly, use -pthread flag.
  4009. continue
  4010. ;;
  4011. esac
  4012. fi
  4013. deplibs="$deplibs $arg"
  4014. continue
  4015. ;;
  4016. -module)
  4017. module=yes
  4018. continue
  4019. ;;
  4020. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  4021. # classes, name mangling, and exception handling.
  4022. # Darwin uses the -arch flag to determine output architecture.
  4023. -model|-arch|-isysroot)
  4024. compiler_flags="$compiler_flags $arg"
  4025. func_append compile_command " $arg"
  4026. func_append finalize_command " $arg"
  4027. prev=xcompiler
  4028. continue
  4029. ;;
  4030. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  4031. compiler_flags="$compiler_flags $arg"
  4032. func_append compile_command " $arg"
  4033. func_append finalize_command " $arg"
  4034. case "$new_inherited_linker_flags " in
  4035. *" $arg "*) ;;
  4036. * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
  4037. esac
  4038. continue
  4039. ;;
  4040. -multi_module)
  4041. single_module="${wl}-multi_module"
  4042. continue
  4043. ;;
  4044. -no-fast-install)
  4045. fast_install=no
  4046. continue
  4047. ;;
  4048. -no-install)
  4049. case $host in
  4050. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  4051. # The PATH hackery in wrapper scripts is required on Windows
  4052. # and Darwin in order for the loader to find any dlls it needs.
  4053. func_warning "\`-no-install' is ignored for $host"
  4054. func_warning "assuming \`-no-fast-install' instead"
  4055. fast_install=no
  4056. ;;
  4057. *) no_install=yes ;;
  4058. esac
  4059. continue
  4060. ;;
  4061. -no-undefined)
  4062. allow_undefined=no
  4063. continue
  4064. ;;
  4065. -objectlist)
  4066. prev=objectlist
  4067. continue
  4068. ;;
  4069. -o) prev=output ;;
  4070. -precious-files-regex)
  4071. prev=precious_regex
  4072. continue
  4073. ;;
  4074. -release)
  4075. prev=release
  4076. continue
  4077. ;;
  4078. -rpath)
  4079. prev=rpath
  4080. continue
  4081. ;;
  4082. -R)
  4083. prev=xrpath
  4084. continue
  4085. ;;
  4086. -R*)
  4087. func_stripname '-R' '' "$arg"
  4088. dir=$func_stripname_result
  4089. # We need an absolute path.
  4090. case $dir in
  4091. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4092. *)
  4093. func_fatal_error "only absolute run-paths are allowed"
  4094. ;;
  4095. esac
  4096. case "$xrpath " in
  4097. *" $dir "*) ;;
  4098. *) xrpath="$xrpath $dir" ;;
  4099. esac
  4100. continue
  4101. ;;
  4102. -shared)
  4103. # The effects of -shared are defined in a previous loop.
  4104. continue
  4105. ;;
  4106. -shrext)
  4107. prev=shrext
  4108. continue
  4109. ;;
  4110. -static | -static-libtool-libs)
  4111. # The effects of -static are defined in a previous loop.
  4112. # We used to do the same as -all-static on platforms that
  4113. # didn't have a PIC flag, but the assumption that the effects
  4114. # would be equivalent was wrong. It would break on at least
  4115. # Digital Unix and AIX.
  4116. continue
  4117. ;;
  4118. -thread-safe)
  4119. thread_safe=yes
  4120. continue
  4121. ;;
  4122. -version-info)
  4123. prev=vinfo
  4124. continue
  4125. ;;
  4126. -version-number)
  4127. prev=vinfo
  4128. vinfo_number=yes
  4129. continue
  4130. ;;
  4131. -weak)
  4132. prev=weak
  4133. continue
  4134. ;;
  4135. -Wc,*)
  4136. func_stripname '-Wc,' '' "$arg"
  4137. args=$func_stripname_result
  4138. arg=
  4139. save_ifs="$IFS"; IFS=','
  4140. for flag in $args; do
  4141. IFS="$save_ifs"
  4142. func_quote_for_eval "$flag"
  4143. arg="$arg $wl$func_quote_for_eval_result"
  4144. compiler_flags="$compiler_flags $func_quote_for_eval_result"
  4145. done
  4146. IFS="$save_ifs"
  4147. func_stripname ' ' '' "$arg"
  4148. arg=$func_stripname_result
  4149. ;;
  4150. -Wl,*)
  4151. func_stripname '-Wl,' '' "$arg"
  4152. args=$func_stripname_result
  4153. arg=
  4154. save_ifs="$IFS"; IFS=','
  4155. for flag in $args; do
  4156. IFS="$save_ifs"
  4157. func_quote_for_eval "$flag"
  4158. arg="$arg $wl$func_quote_for_eval_result"
  4159. compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
  4160. linker_flags="$linker_flags $func_quote_for_eval_result"
  4161. done
  4162. IFS="$save_ifs"
  4163. func_stripname ' ' '' "$arg"
  4164. arg=$func_stripname_result
  4165. ;;
  4166. -Xcompiler)
  4167. prev=xcompiler
  4168. continue
  4169. ;;
  4170. -Xlinker)
  4171. prev=xlinker
  4172. continue
  4173. ;;
  4174. -XCClinker)
  4175. prev=xcclinker
  4176. continue
  4177. ;;
  4178. # -msg_* for osf cc
  4179. -msg_*)
  4180. func_quote_for_eval "$arg"
  4181. arg="$func_quote_for_eval_result"
  4182. ;;
  4183. # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
  4184. # -r[0-9][0-9]* specifies the processor on the SGI compiler
  4185. # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
  4186. # +DA*, +DD* enable 64-bit mode on the HP compiler
  4187. # -q* pass through compiler args for the IBM compiler
  4188. # -m*, -t[45]*, -txscale* pass through architecture-specific
  4189. # compiler args for GCC
  4190. # -F/path gives path to uninstalled frameworks, gcc on darwin
  4191. # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
  4192. # @file GCC response files
  4193. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  4194. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
  4195. func_quote_for_eval "$arg"
  4196. arg="$func_quote_for_eval_result"
  4197. func_append compile_command " $arg"
  4198. func_append finalize_command " $arg"
  4199. compiler_flags="$compiler_flags $arg"
  4200. continue
  4201. ;;
  4202. # Some other compiler flag.
  4203. -* | +*)
  4204. func_quote_for_eval "$arg"
  4205. arg="$func_quote_for_eval_result"
  4206. ;;
  4207. *.$objext)
  4208. # A standard object.
  4209. objs="$objs $arg"
  4210. ;;
  4211. *.lo)
  4212. # A libtool-controlled object.
  4213. # Check to see that this really is a libtool object.
  4214. if func_lalib_unsafe_p "$arg"; then
  4215. pic_object=
  4216. non_pic_object=
  4217. # Read the .lo file
  4218. func_source "$arg"
  4219. if test -z "$pic_object" ||
  4220. test -z "$non_pic_object" ||
  4221. test "$pic_object" = none &&
  4222. test "$non_pic_object" = none; then
  4223. func_fatal_error "cannot find name of object for \`$arg'"
  4224. fi
  4225. # Extract subdirectory from the argument.
  4226. func_dirname "$arg" "/" ""
  4227. xdir="$func_dirname_result"
  4228. if test "$pic_object" != none; then
  4229. # Prepend the subdirectory the object is found in.
  4230. pic_object="$xdir$pic_object"
  4231. if test "$prev" = dlfiles; then
  4232. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  4233. dlfiles="$dlfiles $pic_object"
  4234. prev=
  4235. continue
  4236. else
  4237. # If libtool objects are unsupported, then we need to preload.
  4238. prev=dlprefiles
  4239. fi
  4240. fi
  4241. # CHECK ME: I think I busted this. -Ossama
  4242. if test "$prev" = dlprefiles; then
  4243. # Preload the old-style object.
  4244. dlprefiles="$dlprefiles $pic_object"
  4245. prev=
  4246. fi
  4247. # A PIC object.
  4248. func_append libobjs " $pic_object"
  4249. arg="$pic_object"
  4250. fi
  4251. # Non-PIC object.
  4252. if test "$non_pic_object" != none; then
  4253. # Prepend the subdirectory the object is found in.
  4254. non_pic_object="$xdir$non_pic_object"
  4255. # A standard non-PIC object
  4256. func_append non_pic_objects " $non_pic_object"
  4257. if test -z "$pic_object" || test "$pic_object" = none ; then
  4258. arg="$non_pic_object"
  4259. fi
  4260. else
  4261. # If the PIC object exists, use it instead.
  4262. # $xdir was prepended to $pic_object above.
  4263. non_pic_object="$pic_object"
  4264. func_append non_pic_objects " $non_pic_object"
  4265. fi
  4266. else
  4267. # Only an error if not doing a dry-run.
  4268. if $opt_dry_run; then
  4269. # Extract subdirectory from the argument.
  4270. func_dirname "$arg" "/" ""
  4271. xdir="$func_dirname_result"
  4272. func_lo2o "$arg"
  4273. pic_object=$xdir$objdir/$func_lo2o_result
  4274. non_pic_object=$xdir$func_lo2o_result
  4275. func_append libobjs " $pic_object"
  4276. func_append non_pic_objects " $non_pic_object"
  4277. else
  4278. func_fatal_error "\`$arg' is not a valid libtool object"
  4279. fi
  4280. fi
  4281. ;;
  4282. *.$libext)
  4283. # An archive.
  4284. deplibs="$deplibs $arg"
  4285. old_deplibs="$old_deplibs $arg"
  4286. continue
  4287. ;;
  4288. *.la)
  4289. # A libtool-controlled library.
  4290. if test "$prev" = dlfiles; then
  4291. # This library was specified with -dlopen.
  4292. dlfiles="$dlfiles $arg"
  4293. prev=
  4294. elif test "$prev" = dlprefiles; then
  4295. # The library was specified with -dlpreopen.
  4296. dlprefiles="$dlprefiles $arg"
  4297. prev=
  4298. else
  4299. deplibs="$deplibs $arg"
  4300. fi
  4301. continue
  4302. ;;
  4303. # Some other compiler argument.
  4304. *)
  4305. # Unknown arguments in both finalize_command and compile_command need
  4306. # to be aesthetically quoted because they are evaled later.
  4307. func_quote_for_eval "$arg"
  4308. arg="$func_quote_for_eval_result"
  4309. ;;
  4310. esac # arg
  4311. # Now actually substitute the argument into the commands.
  4312. if test -n "$arg"; then
  4313. func_append compile_command " $arg"
  4314. func_append finalize_command " $arg"
  4315. fi
  4316. done # argument parsing loop
  4317. test -n "$prev" && \
  4318. func_fatal_help "the \`$prevarg' option requires an argument"
  4319. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  4320. eval arg=\"$export_dynamic_flag_spec\"
  4321. func_append compile_command " $arg"
  4322. func_append finalize_command " $arg"
  4323. fi
  4324. oldlibs=
  4325. # calculate the name of the file, without its directory
  4326. func_basename "$output"
  4327. outputname="$func_basename_result"
  4328. libobjs_save="$libobjs"
  4329. if test -n "$shlibpath_var"; then
  4330. # get the directories listed in $shlibpath_var
  4331. eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  4332. else
  4333. shlib_search_path=
  4334. fi
  4335. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  4336. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  4337. func_dirname "$output" "/" ""
  4338. output_objdir="$func_dirname_result$objdir"
  4339. # Create the object directory.
  4340. func_mkdir_p "$output_objdir"
  4341. # Determine the type of output
  4342. case $output in
  4343. "")
  4344. func_fatal_help "you must specify an output file"
  4345. ;;
  4346. *.$libext) linkmode=oldlib ;;
  4347. *.lo | *.$objext) linkmode=obj ;;
  4348. *.la) linkmode=lib ;;
  4349. *) linkmode=prog ;; # Anything else should be a program.
  4350. esac
  4351. specialdeplibs=
  4352. libs=
  4353. # Find all interdependent deplibs by searching for libraries
  4354. # that are linked more than once (e.g. -la -lb -la)
  4355. for deplib in $deplibs; do
  4356. if $opt_duplicate_deps ; then
  4357. case "$libs " in
  4358. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  4359. esac
  4360. fi
  4361. libs="$libs $deplib"
  4362. done
  4363. if test "$linkmode" = lib; then
  4364. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  4365. # Compute libraries that are listed more than once in $predeps
  4366. # $postdeps and mark them as special (i.e., whose duplicates are
  4367. # not to be eliminated).
  4368. pre_post_deps=
  4369. if $opt_duplicate_compiler_generated_deps; then
  4370. for pre_post_dep in $predeps $postdeps; do
  4371. case "$pre_post_deps " in
  4372. *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  4373. esac
  4374. pre_post_deps="$pre_post_deps $pre_post_dep"
  4375. done
  4376. fi
  4377. pre_post_deps=
  4378. fi
  4379. deplibs=
  4380. newdependency_libs=
  4381. newlib_search_path=
  4382. need_relink=no # whether we're linking any uninstalled libtool libraries
  4383. notinst_deplibs= # not-installed libtool libraries
  4384. notinst_path= # paths that contain not-installed libtool libraries
  4385. case $linkmode in
  4386. lib)
  4387. passes="conv dlpreopen link"
  4388. for file in $dlfiles $dlprefiles; do
  4389. case $file in
  4390. *.la) ;;
  4391. *)
  4392. func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
  4393. ;;
  4394. esac
  4395. done
  4396. ;;
  4397. prog)
  4398. compile_deplibs=
  4399. finalize_deplibs=
  4400. alldeplibs=no
  4401. newdlfiles=
  4402. newdlprefiles=
  4403. passes="conv scan dlopen dlpreopen link"
  4404. ;;
  4405. *) passes="conv"
  4406. ;;
  4407. esac
  4408. for pass in $passes; do
  4409. # The preopen pass in lib mode reverses $deplibs; put it back here
  4410. # so that -L comes before libs that need it for instance...
  4411. if test "$linkmode,$pass" = "lib,link"; then
  4412. ## FIXME: Find the place where the list is rebuilt in the wrong
  4413. ## order, and fix it there properly
  4414. tmp_deplibs=
  4415. for deplib in $deplibs; do
  4416. tmp_deplibs="$deplib $tmp_deplibs"
  4417. done
  4418. deplibs="$tmp_deplibs"
  4419. fi
  4420. if test "$linkmode,$pass" = "lib,link" ||
  4421. test "$linkmode,$pass" = "prog,scan"; then
  4422. libs="$deplibs"
  4423. deplibs=
  4424. fi
  4425. if test "$linkmode" = prog; then
  4426. case $pass in
  4427. dlopen) libs="$dlfiles" ;;
  4428. dlpreopen) libs="$dlprefiles" ;;
  4429. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  4430. esac
  4431. fi
  4432. if test "$linkmode,$pass" = "lib,dlpreopen"; then
  4433. # Collect and forward deplibs of preopened libtool libs
  4434. for lib in $dlprefiles; do
  4435. # Ignore non-libtool-libs
  4436. dependency_libs=
  4437. case $lib in
  4438. *.la) func_source "$lib" ;;
  4439. esac
  4440. # Collect preopened libtool deplibs, except any this library
  4441. # has declared as weak libs
  4442. for deplib in $dependency_libs; do
  4443. deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
  4444. case " $weak_libs " in
  4445. *" $deplib_base "*) ;;
  4446. *) deplibs="$deplibs $deplib" ;;
  4447. esac
  4448. done
  4449. done
  4450. libs="$dlprefiles"
  4451. fi
  4452. if test "$pass" = dlopen; then
  4453. # Collect dlpreopened libraries
  4454. save_deplibs="$deplibs"
  4455. deplibs=
  4456. fi
  4457. for deplib in $libs; do
  4458. lib=
  4459. found=no
  4460. case $deplib in
  4461. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  4462. if test "$linkmode,$pass" = "prog,link"; then
  4463. compile_deplibs="$deplib $compile_deplibs"
  4464. finalize_deplibs="$deplib $finalize_deplibs"
  4465. else
  4466. compiler_flags="$compiler_flags $deplib"
  4467. if test "$linkmode" = lib ; then
  4468. case "$new_inherited_linker_flags " in
  4469. *" $deplib "*) ;;
  4470. * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
  4471. esac
  4472. fi
  4473. fi
  4474. continue
  4475. ;;
  4476. -l*)
  4477. if test "$linkmode" != lib && test "$linkmode" != prog; then
  4478. func_warning "\`-l' is ignored for archives/objects"
  4479. continue
  4480. fi
  4481. func_stripname '-l' '' "$deplib"
  4482. name=$func_stripname_result
  4483. if test "$linkmode" = lib; then
  4484. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  4485. else
  4486. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  4487. fi
  4488. for searchdir in $searchdirs; do
  4489. for search_ext in .la $std_shrext .so .a; do
  4490. # Search the libtool library
  4491. lib="$searchdir/lib${name}${search_ext}"
  4492. if test -f "$lib"; then
  4493. if test "$search_ext" = ".la"; then
  4494. found=yes
  4495. else
  4496. found=no
  4497. fi
  4498. break 2
  4499. fi
  4500. done
  4501. done
  4502. if test "$found" != yes; then
  4503. # deplib doesn't seem to be a libtool library
  4504. if test "$linkmode,$pass" = "prog,link"; then
  4505. compile_deplibs="$deplib $compile_deplibs"
  4506. finalize_deplibs="$deplib $finalize_deplibs"
  4507. else
  4508. deplibs="$deplib $deplibs"
  4509. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  4510. fi
  4511. continue
  4512. else # deplib is a libtool library
  4513. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  4514. # We need to do some special things here, and not later.
  4515. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  4516. case " $predeps $postdeps " in
  4517. *" $deplib "*)
  4518. if func_lalib_p "$lib"; then
  4519. library_names=
  4520. old_library=
  4521. func_source "$lib"
  4522. for l in $old_library $library_names; do
  4523. ll="$l"
  4524. done
  4525. if test "X$ll" = "X$old_library" ; then # only static version available
  4526. found=no
  4527. func_dirname "$lib" "" "."
  4528. ladir="$func_dirname_result"
  4529. lib=$ladir/$old_library
  4530. if test "$linkmode,$pass" = "prog,link"; then
  4531. compile_deplibs="$deplib $compile_deplibs"
  4532. finalize_deplibs="$deplib $finalize_deplibs"
  4533. else
  4534. deplibs="$deplib $deplibs"
  4535. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  4536. fi
  4537. continue
  4538. fi
  4539. fi
  4540. ;;
  4541. *) ;;
  4542. esac
  4543. fi
  4544. fi
  4545. ;; # -l
  4546. *.ltframework)
  4547. if test "$linkmode,$pass" = "prog,link"; then
  4548. compile_deplibs="$deplib $compile_deplibs"
  4549. finalize_deplibs="$deplib $finalize_deplibs"
  4550. else
  4551. deplibs="$deplib $deplibs"
  4552. if test "$linkmode" = lib ; then
  4553. case "$new_inherited_linker_flags " in
  4554. *" $deplib "*) ;;
  4555. * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
  4556. esac
  4557. fi
  4558. fi
  4559. continue
  4560. ;;
  4561. -L*)
  4562. case $linkmode in
  4563. lib)
  4564. deplibs="$deplib $deplibs"
  4565. test "$pass" = conv && continue
  4566. newdependency_libs="$deplib $newdependency_libs"
  4567. func_stripname '-L' '' "$deplib"
  4568. newlib_search_path="$newlib_search_path $func_stripname_result"
  4569. ;;
  4570. prog)
  4571. if test "$pass" = conv; then
  4572. deplibs="$deplib $deplibs"
  4573. continue
  4574. fi
  4575. if test "$pass" = scan; then
  4576. deplibs="$deplib $deplibs"
  4577. else
  4578. compile_deplibs="$deplib $compile_deplibs"
  4579. finalize_deplibs="$deplib $finalize_deplibs"
  4580. fi
  4581. func_stripname '-L' '' "$deplib"
  4582. newlib_search_path="$newlib_search_path $func_stripname_result"
  4583. ;;
  4584. *)
  4585. func_warning "\`-L' is ignored for archives/objects"
  4586. ;;
  4587. esac # linkmode
  4588. continue
  4589. ;; # -L
  4590. -R*)
  4591. if test "$pass" = link; then
  4592. func_stripname '-R' '' "$deplib"
  4593. dir=$func_stripname_result
  4594. # Make sure the xrpath contains only unique directories.
  4595. case "$xrpath " in
  4596. *" $dir "*) ;;
  4597. *) xrpath="$xrpath $dir" ;;
  4598. esac
  4599. fi
  4600. deplibs="$deplib $deplibs"
  4601. continue
  4602. ;;
  4603. *.la) lib="$deplib" ;;
  4604. *.$libext)
  4605. if test "$pass" = conv; then
  4606. deplibs="$deplib $deplibs"
  4607. continue
  4608. fi
  4609. case $linkmode in
  4610. lib)
  4611. # Linking convenience modules into shared libraries is allowed,
  4612. # but linking other static libraries is non-portable.
  4613. case " $dlpreconveniencelibs " in
  4614. *" $deplib "*) ;;
  4615. *)
  4616. valid_a_lib=no
  4617. case $deplibs_check_method in
  4618. match_pattern*)
  4619. set dummy $deplibs_check_method; shift
  4620. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  4621. if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
  4622. | $EGREP "$match_pattern_regex" > /dev/null; then
  4623. valid_a_lib=yes
  4624. fi
  4625. ;;
  4626. pass_all)
  4627. valid_a_lib=yes
  4628. ;;
  4629. esac
  4630. if test "$valid_a_lib" != yes; then
  4631. $ECHO
  4632. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  4633. $ECHO "*** I have the capability to make that library automatically link in when"
  4634. $ECHO "*** you link to this library. But I can only do this if you have a"
  4635. $ECHO "*** shared version of the library, which you do not appear to have"
  4636. $ECHO "*** because the file extensions .$libext of this argument makes me believe"
  4637. $ECHO "*** that it is just a static archive that I should not use here."
  4638. else
  4639. $ECHO
  4640. $ECHO "*** Warning: Linking the shared library $output against the"
  4641. $ECHO "*** static library $deplib is not portable!"
  4642. deplibs="$deplib $deplibs"
  4643. fi
  4644. ;;
  4645. esac
  4646. continue
  4647. ;;
  4648. prog)
  4649. if test "$pass" != link; then
  4650. deplibs="$deplib $deplibs"
  4651. else
  4652. compile_deplibs="$deplib $compile_deplibs"
  4653. finalize_deplibs="$deplib $finalize_deplibs"
  4654. fi
  4655. continue
  4656. ;;
  4657. esac # linkmode
  4658. ;; # *.$libext
  4659. *.lo | *.$objext)
  4660. if test "$pass" = conv; then
  4661. deplibs="$deplib $deplibs"
  4662. elif test "$linkmode" = prog; then
  4663. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  4664. # If there is no dlopen support or we're linking statically,
  4665. # we need to preload.
  4666. newdlprefiles="$newdlprefiles $deplib"
  4667. compile_deplibs="$deplib $compile_deplibs"
  4668. finalize_deplibs="$deplib $finalize_deplibs"
  4669. else
  4670. newdlfiles="$newdlfiles $deplib"
  4671. fi
  4672. fi
  4673. continue
  4674. ;;
  4675. %DEPLIBS%)
  4676. alldeplibs=yes
  4677. continue
  4678. ;;
  4679. esac # case $deplib
  4680. if test "$found" = yes || test -f "$lib"; then :
  4681. else
  4682. func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
  4683. fi
  4684. # Check to see that this really is a libtool archive.
  4685. func_lalib_unsafe_p "$lib" \
  4686. || func_fatal_error "\`$lib' is not a valid libtool archive"
  4687. func_dirname "$lib" "" "."
  4688. ladir="$func_dirname_result"
  4689. dlname=
  4690. dlopen=
  4691. dlpreopen=
  4692. libdir=
  4693. library_names=
  4694. old_library=
  4695. inherited_linker_flags=
  4696. # If the library was installed with an old release of libtool,
  4697. # it will not redefine variables installed, or shouldnotlink
  4698. installed=yes
  4699. shouldnotlink=no
  4700. avoidtemprpath=
  4701. # Read the .la file
  4702. func_source "$lib"
  4703. # Convert "-framework foo" to "foo.ltframework"
  4704. if test -n "$inherited_linker_flags"; then
  4705. tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
  4706. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  4707. case " $new_inherited_linker_flags " in
  4708. *" $tmp_inherited_linker_flag "*) ;;
  4709. *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
  4710. esac
  4711. done
  4712. fi
  4713. dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  4714. if test "$linkmode,$pass" = "lib,link" ||
  4715. test "$linkmode,$pass" = "prog,scan" ||
  4716. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  4717. test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  4718. test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  4719. fi
  4720. if test "$pass" = conv; then
  4721. # Only check for convenience libraries
  4722. deplibs="$lib $deplibs"
  4723. if test -z "$libdir"; then
  4724. if test -z "$old_library"; then
  4725. func_fatal_error "cannot find name of link library for \`$lib'"
  4726. fi
  4727. # It is a libtool convenience library, so add in its objects.
  4728. convenience="$convenience $ladir/$objdir/$old_library"
  4729. old_convenience="$old_convenience $ladir/$objdir/$old_library"
  4730. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  4731. func_fatal_error "\`$lib' is not a convenience library"
  4732. fi
  4733. tmp_libs=
  4734. for deplib in $dependency_libs; do
  4735. deplibs="$deplib $deplibs"
  4736. if $opt_duplicate_deps ; then
  4737. case "$tmp_libs " in
  4738. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  4739. esac
  4740. fi
  4741. tmp_libs="$tmp_libs $deplib"
  4742. done
  4743. continue
  4744. fi # $pass = conv
  4745. # Get the name of the library we link against.
  4746. linklib=
  4747. for l in $old_library $library_names; do
  4748. linklib="$l"
  4749. done
  4750. if test -z "$linklib"; then
  4751. func_fatal_error "cannot find name of link library for \`$lib'"
  4752. fi
  4753. # This library was specified with -dlopen.
  4754. if test "$pass" = dlopen; then
  4755. if test -z "$libdir"; then
  4756. func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
  4757. fi
  4758. if test -z "$dlname" ||
  4759. test "$dlopen_support" != yes ||
  4760. test "$build_libtool_libs" = no; then
  4761. # If there is no dlname, no dlopen support or we're linking
  4762. # statically, we need to preload. We also need to preload any
  4763. # dependent libraries so libltdl's deplib preloader doesn't
  4764. # bomb out in the load deplibs phase.
  4765. dlprefiles="$dlprefiles $lib $dependency_libs"
  4766. else
  4767. newdlfiles="$newdlfiles $lib"
  4768. fi
  4769. continue
  4770. fi # $pass = dlopen
  4771. # We need an absolute path.
  4772. case $ladir in
  4773. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  4774. *)
  4775. abs_ladir=`cd "$ladir" && pwd`
  4776. if test -z "$abs_ladir"; then
  4777. func_warning "cannot determine absolute directory name of \`$ladir'"
  4778. func_warning "passing it literally to the linker, although it might fail"
  4779. abs_ladir="$ladir"
  4780. fi
  4781. ;;
  4782. esac
  4783. func_basename "$lib"
  4784. laname="$func_basename_result"
  4785. # Find the relevant object directory and library name.
  4786. if test "X$installed" = Xyes; then
  4787. if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  4788. func_warning "library \`$lib' was moved."
  4789. dir="$ladir"
  4790. absdir="$abs_ladir"
  4791. libdir="$abs_ladir"
  4792. else
  4793. dir="$libdir"
  4794. absdir="$libdir"
  4795. fi
  4796. test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
  4797. else
  4798. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  4799. dir="$ladir"
  4800. absdir="$abs_ladir"
  4801. # Remove this search path later
  4802. notinst_path="$notinst_path $abs_ladir"
  4803. else
  4804. dir="$ladir/$objdir"
  4805. absdir="$abs_ladir/$objdir"
  4806. # Remove this search path later
  4807. notinst_path="$notinst_path $abs_ladir"
  4808. fi
  4809. fi # $installed = yes
  4810. func_stripname 'lib' '.la' "$laname"
  4811. name=$func_stripname_result
  4812. # This library was specified with -dlpreopen.
  4813. if test "$pass" = dlpreopen; then
  4814. if test -z "$libdir" && test "$linkmode" = prog; then
  4815. func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
  4816. fi
  4817. # Prefer using a static library (so that no silly _DYNAMIC symbols
  4818. # are required to link).
  4819. if test -n "$old_library"; then
  4820. newdlprefiles="$newdlprefiles $dir/$old_library"
  4821. # Keep a list of preopened convenience libraries to check
  4822. # that they are being used correctly in the link pass.
  4823. test -z "$libdir" && \
  4824. dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
  4825. # Otherwise, use the dlname, so that lt_dlopen finds it.
  4826. elif test -n "$dlname"; then
  4827. newdlprefiles="$newdlprefiles $dir/$dlname"
  4828. else
  4829. newdlprefiles="$newdlprefiles $dir/$linklib"
  4830. fi
  4831. fi # $pass = dlpreopen
  4832. if test -z "$libdir"; then
  4833. # Link the convenience library
  4834. if test "$linkmode" = lib; then
  4835. deplibs="$dir/$old_library $deplibs"
  4836. elif test "$linkmode,$pass" = "prog,link"; then
  4837. compile_deplibs="$dir/$old_library $compile_deplibs"
  4838. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  4839. else
  4840. deplibs="$lib $deplibs" # used for prog,scan pass
  4841. fi
  4842. continue
  4843. fi
  4844. if test "$linkmode" = prog && test "$pass" != link; then
  4845. newlib_search_path="$newlib_search_path $ladir"
  4846. deplibs="$lib $deplibs"
  4847. linkalldeplibs=no
  4848. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  4849. test "$build_libtool_libs" = no; then
  4850. linkalldeplibs=yes
  4851. fi
  4852. tmp_libs=
  4853. for deplib in $dependency_libs; do
  4854. case $deplib in
  4855. -L*) func_stripname '-L' '' "$deplib"
  4856. newlib_search_path="$newlib_search_path $func_stripname_result"
  4857. ;;
  4858. esac
  4859. # Need to link against all dependency_libs?
  4860. if test "$linkalldeplibs" = yes; then
  4861. deplibs="$deplib $deplibs"
  4862. else
  4863. # Need to hardcode shared library paths
  4864. # or/and link against static libraries
  4865. newdependency_libs="$deplib $newdependency_libs"
  4866. fi
  4867. if $opt_duplicate_deps ; then
  4868. case "$tmp_libs " in
  4869. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  4870. esac
  4871. fi
  4872. tmp_libs="$tmp_libs $deplib"
  4873. done # for deplib
  4874. continue
  4875. fi # $linkmode = prog...
  4876. if test "$linkmode,$pass" = "prog,link"; then
  4877. if test -n "$library_names" &&
  4878. { { test "$prefer_static_libs" = no ||
  4879. test "$prefer_static_libs,$installed" = "built,yes"; } ||
  4880. test -z "$old_library"; }; then
  4881. # We need to hardcode the library path
  4882. if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  4883. # Make sure the rpath contains only unique directories.
  4884. case "$temp_rpath:" in
  4885. *"$absdir:"*) ;;
  4886. *) temp_rpath="$temp_rpath$absdir:" ;;
  4887. esac
  4888. fi
  4889. # Hardcode the library path.
  4890. # Skip directories that are in the system default run-time
  4891. # search path.
  4892. case " $sys_lib_dlsearch_path " in
  4893. *" $absdir "*) ;;
  4894. *)
  4895. case "$compile_rpath " in
  4896. *" $absdir "*) ;;
  4897. *) compile_rpath="$compile_rpath $absdir"
  4898. esac
  4899. ;;
  4900. esac
  4901. case " $sys_lib_dlsearch_path " in
  4902. *" $libdir "*) ;;
  4903. *)
  4904. case "$finalize_rpath " in
  4905. *" $libdir "*) ;;
  4906. *) finalize_rpath="$finalize_rpath $libdir"
  4907. esac
  4908. ;;
  4909. esac
  4910. fi # $linkmode,$pass = prog,link...
  4911. if test "$alldeplibs" = yes &&
  4912. { test "$deplibs_check_method" = pass_all ||
  4913. { test "$build_libtool_libs" = yes &&
  4914. test -n "$library_names"; }; }; then
  4915. # We only need to search for static libraries
  4916. continue
  4917. fi
  4918. fi
  4919. link_static=no # Whether the deplib will be linked statically
  4920. use_static_libs=$prefer_static_libs
  4921. if test "$use_static_libs" = built && test "$installed" = yes; then
  4922. use_static_libs=no
  4923. fi
  4924. if test -n "$library_names" &&
  4925. { test "$use_static_libs" = no || test -z "$old_library"; }; then
  4926. case $host in
  4927. *cygwin* | *mingw* | *cegcc*)
  4928. # No point in relinking DLLs because paths are not encoded
  4929. notinst_deplibs="$notinst_deplibs $lib"
  4930. need_relink=no
  4931. ;;
  4932. *)
  4933. if test "$installed" = no; then
  4934. notinst_deplibs="$notinst_deplibs $lib"
  4935. need_relink=yes
  4936. fi
  4937. ;;
  4938. esac
  4939. # This is a shared library
  4940. # Warn about portability, can't link against -module's on some
  4941. # systems (darwin). Don't bleat about dlopened modules though!
  4942. dlopenmodule=""
  4943. for dlpremoduletest in $dlprefiles; do
  4944. if test "X$dlpremoduletest" = "X$lib"; then
  4945. dlopenmodule="$dlpremoduletest"
  4946. break
  4947. fi
  4948. done
  4949. if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
  4950. $ECHO
  4951. if test "$linkmode" = prog; then
  4952. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  4953. else
  4954. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  4955. fi
  4956. $ECHO "*** $linklib is not portable!"
  4957. fi
  4958. if test "$linkmode" = lib &&
  4959. test "$hardcode_into_libs" = yes; then
  4960. # Hardcode the library path.
  4961. # Skip directories that are in the system default run-time
  4962. # search path.
  4963. case " $sys_lib_dlsearch_path " in
  4964. *" $absdir "*) ;;
  4965. *)
  4966. case "$compile_rpath " in
  4967. *" $absdir "*) ;;
  4968. *) compile_rpath="$compile_rpath $absdir"
  4969. esac
  4970. ;;
  4971. esac
  4972. case " $sys_lib_dlsearch_path " in
  4973. *" $libdir "*) ;;
  4974. *)
  4975. case "$finalize_rpath " in
  4976. *" $libdir "*) ;;
  4977. *) finalize_rpath="$finalize_rpath $libdir"
  4978. esac
  4979. ;;
  4980. esac
  4981. fi
  4982. if test -n "$old_archive_from_expsyms_cmds"; then
  4983. # figure out the soname
  4984. set dummy $library_names
  4985. shift
  4986. realname="$1"
  4987. shift
  4988. libname=`eval "\\$ECHO \"$libname_spec\""`
  4989. # use dlname if we got it. it's perfectly good, no?
  4990. if test -n "$dlname"; then
  4991. soname="$dlname"
  4992. elif test -n "$soname_spec"; then
  4993. # bleh windows
  4994. case $host in
  4995. *cygwin* | mingw* | *cegcc*)
  4996. func_arith $current - $age
  4997. major=$func_arith_result
  4998. versuffix="-$major"
  4999. ;;
  5000. esac
  5001. eval soname=\"$soname_spec\"
  5002. else
  5003. soname="$realname"
  5004. fi
  5005. # Make a new name for the extract_expsyms_cmds to use
  5006. soroot="$soname"
  5007. func_basename "$soroot"
  5008. soname="$func_basename_result"
  5009. func_stripname 'lib' '.dll' "$soname"
  5010. newlib=libimp-$func_stripname_result.a
  5011. # If the library has no export list, then create one now
  5012. if test -f "$output_objdir/$soname-def"; then :
  5013. else
  5014. func_verbose "extracting exported symbol list from \`$soname'"
  5015. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  5016. fi
  5017. # Create $newlib
  5018. if test -f "$output_objdir/$newlib"; then :; else
  5019. func_verbose "generating import library for \`$soname'"
  5020. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  5021. fi
  5022. # make sure the library variables are pointing to the new library
  5023. dir=$output_objdir
  5024. linklib=$newlib
  5025. fi # test -n "$old_archive_from_expsyms_cmds"
  5026. if test "$linkmode" = prog || test "$mode" != relink; then
  5027. add_shlibpath=
  5028. add_dir=
  5029. add=
  5030. lib_linked=yes
  5031. case $hardcode_action in
  5032. immediate | unsupported)
  5033. if test "$hardcode_direct" = no; then
  5034. add="$dir/$linklib"
  5035. case $host in
  5036. *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
  5037. *-*-sysv4*uw2*) add_dir="-L$dir" ;;
  5038. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  5039. *-*-unixware7*) add_dir="-L$dir" ;;
  5040. *-*-darwin* )
  5041. # if the lib is a (non-dlopened) module then we can not
  5042. # link against it, someone is ignoring the earlier warnings
  5043. if /usr/bin/file -L $add 2> /dev/null |
  5044. $GREP ": [^:]* bundle" >/dev/null ; then
  5045. if test "X$dlopenmodule" != "X$lib"; then
  5046. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  5047. if test -z "$old_library" ; then
  5048. $ECHO
  5049. $ECHO "*** And there doesn't seem to be a static archive available"
  5050. $ECHO "*** The link will probably fail, sorry"
  5051. else
  5052. add="$dir/$old_library"
  5053. fi
  5054. elif test -n "$old_library"; then
  5055. add="$dir/$old_library"
  5056. fi
  5057. fi
  5058. esac
  5059. elif test "$hardcode_minus_L" = no; then
  5060. case $host in
  5061. *-*-sunos*) add_shlibpath="$dir" ;;
  5062. esac
  5063. add_dir="-L$dir"
  5064. add="-l$name"
  5065. elif test "$hardcode_shlibpath_var" = no; then
  5066. add_shlibpath="$dir"
  5067. add="-l$name"
  5068. else
  5069. lib_linked=no
  5070. fi
  5071. ;;
  5072. relink)
  5073. if test "$hardcode_direct" = yes &&
  5074. test "$hardcode_direct_absolute" = no; then
  5075. add="$dir/$linklib"
  5076. elif test "$hardcode_minus_L" = yes; then
  5077. add_dir="-L$dir"
  5078. # Try looking first in the location we're being installed to.
  5079. if test -n "$inst_prefix_dir"; then
  5080. case $libdir in
  5081. [\\/]*)
  5082. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  5083. ;;
  5084. esac
  5085. fi
  5086. add="-l$name"
  5087. elif test "$hardcode_shlibpath_var" = yes; then
  5088. add_shlibpath="$dir"
  5089. add="-l$name"
  5090. else
  5091. lib_linked=no
  5092. fi
  5093. ;;
  5094. *) lib_linked=no ;;
  5095. esac
  5096. if test "$lib_linked" != yes; then
  5097. func_fatal_configuration "unsupported hardcode properties"
  5098. fi
  5099. if test -n "$add_shlibpath"; then
  5100. case :$compile_shlibpath: in
  5101. *":$add_shlibpath:"*) ;;
  5102. *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  5103. esac
  5104. fi
  5105. if test "$linkmode" = prog; then
  5106. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  5107. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  5108. else
  5109. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  5110. test -n "$add" && deplibs="$add $deplibs"
  5111. if test "$hardcode_direct" != yes &&
  5112. test "$hardcode_minus_L" != yes &&
  5113. test "$hardcode_shlibpath_var" = yes; then
  5114. case :$finalize_shlibpath: in
  5115. *":$libdir:"*) ;;
  5116. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  5117. esac
  5118. fi
  5119. fi
  5120. fi
  5121. if test "$linkmode" = prog || test "$mode" = relink; then
  5122. add_shlibpath=
  5123. add_dir=
  5124. add=
  5125. # Finalize command for both is simple: just hardcode it.
  5126. if test "$hardcode_direct" = yes &&
  5127. test "$hardcode_direct_absolute" = no; then
  5128. add="$libdir/$linklib"
  5129. elif test "$hardcode_minus_L" = yes; then
  5130. add_dir="-L$libdir"
  5131. add="-l$name"
  5132. elif test "$hardcode_shlibpath_var" = yes; then
  5133. case :$finalize_shlibpath: in
  5134. *":$libdir:"*) ;;
  5135. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  5136. esac
  5137. add="-l$name"
  5138. elif test "$hardcode_automatic" = yes; then
  5139. if test -n "$inst_prefix_dir" &&
  5140. test -f "$inst_prefix_dir$libdir/$linklib" ; then
  5141. add="$inst_prefix_dir$libdir/$linklib"
  5142. else
  5143. add="$libdir/$linklib"
  5144. fi
  5145. else
  5146. # We cannot seem to hardcode it, guess we'll fake it.
  5147. add_dir="-L$libdir"
  5148. # Try looking first in the location we're being installed to.
  5149. if test -n "$inst_prefix_dir"; then
  5150. case $libdir in
  5151. [\\/]*)
  5152. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  5153. ;;
  5154. esac
  5155. fi
  5156. add="-l$name"
  5157. fi
  5158. if test "$linkmode" = prog; then
  5159. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  5160. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  5161. else
  5162. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  5163. test -n "$add" && deplibs="$add $deplibs"
  5164. fi
  5165. fi
  5166. elif test "$linkmode" = prog; then
  5167. # Here we assume that one of hardcode_direct or hardcode_minus_L
  5168. # is not unsupported. This is valid on all known static and
  5169. # shared platforms.
  5170. if test "$hardcode_direct" != unsupported; then
  5171. test -n "$old_library" && linklib="$old_library"
  5172. compile_deplibs="$dir/$linklib $compile_deplibs"
  5173. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  5174. else
  5175. compile_deplibs="-l$name -L$dir $compile_deplibs"
  5176. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  5177. fi
  5178. elif test "$build_libtool_libs" = yes; then
  5179. # Not a shared library
  5180. if test "$deplibs_check_method" != pass_all; then
  5181. # We're trying link a shared library against a static one
  5182. # but the system doesn't support it.
  5183. # Just print a warning and add the library to dependency_libs so
  5184. # that the program can be linked against the static library.
  5185. $ECHO
  5186. $ECHO "*** Warning: This system can not link to static lib archive $lib."
  5187. $ECHO "*** I have the capability to make that library automatically link in when"
  5188. $ECHO "*** you link to this library. But I can only do this if you have a"
  5189. $ECHO "*** shared version of the library, which you do not appear to have."
  5190. if test "$module" = yes; then
  5191. $ECHO "*** But as you try to build a module library, libtool will still create "
  5192. $ECHO "*** a static module, that should work as long as the dlopening application"
  5193. $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
  5194. if test -z "$global_symbol_pipe"; then
  5195. $ECHO
  5196. $ECHO "*** However, this would only work if libtool was able to extract symbol"
  5197. $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
  5198. $ECHO "*** not find such a program. So, this module is probably useless."
  5199. $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
  5200. fi
  5201. if test "$build_old_libs" = no; then
  5202. build_libtool_libs=module
  5203. build_old_libs=yes
  5204. else
  5205. build_libtool_libs=no
  5206. fi
  5207. fi
  5208. else
  5209. deplibs="$dir/$old_library $deplibs"
  5210. link_static=yes
  5211. fi
  5212. fi # link shared/static library?
  5213. if test "$linkmode" = lib; then
  5214. if test -n "$dependency_libs" &&
  5215. { test "$hardcode_into_libs" != yes ||
  5216. test "$build_old_libs" = yes ||
  5217. test "$link_static" = yes; }; then
  5218. # Extract -R from dependency_libs
  5219. temp_deplibs=
  5220. for libdir in $dependency_libs; do
  5221. case $libdir in
  5222. -R*) func_stripname '-R' '' "$libdir"
  5223. temp_xrpath=$func_stripname_result
  5224. case " $xrpath " in
  5225. *" $temp_xrpath "*) ;;
  5226. *) xrpath="$xrpath $temp_xrpath";;
  5227. esac;;
  5228. *) temp_deplibs="$temp_deplibs $libdir";;
  5229. esac
  5230. done
  5231. dependency_libs="$temp_deplibs"
  5232. fi
  5233. newlib_search_path="$newlib_search_path $absdir"
  5234. # Link against this library
  5235. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  5236. # ... and its dependency_libs
  5237. tmp_libs=
  5238. for deplib in $dependency_libs; do
  5239. newdependency_libs="$deplib $newdependency_libs"
  5240. if $opt_duplicate_deps ; then
  5241. case "$tmp_libs " in
  5242. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  5243. esac
  5244. fi
  5245. tmp_libs="$tmp_libs $deplib"
  5246. done
  5247. if test "$link_all_deplibs" != no; then
  5248. # Add the search paths of all dependency libraries
  5249. for deplib in $dependency_libs; do
  5250. case $deplib in
  5251. -L*) path="$deplib" ;;
  5252. *.la)
  5253. func_dirname "$deplib" "" "."
  5254. dir="$func_dirname_result"
  5255. # We need an absolute path.
  5256. case $dir in
  5257. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  5258. *)
  5259. absdir=`cd "$dir" && pwd`
  5260. if test -z "$absdir"; then
  5261. func_warning "cannot determine absolute directory name of \`$dir'"
  5262. absdir="$dir"
  5263. fi
  5264. ;;
  5265. esac
  5266. if $GREP "^installed=no" $deplib > /dev/null; then
  5267. case $host in
  5268. *-*-darwin*)
  5269. depdepl=
  5270. eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  5271. if test -n "$deplibrary_names" ; then
  5272. for tmp in $deplibrary_names ; do
  5273. depdepl=$tmp
  5274. done
  5275. if test -f "$absdir/$objdir/$depdepl" ; then
  5276. depdepl="$absdir/$objdir/$depdepl"
  5277. darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  5278. if test -z "$darwin_install_name"; then
  5279. darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  5280. fi
  5281. compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
  5282. linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
  5283. path=
  5284. fi
  5285. fi
  5286. ;;
  5287. *)
  5288. path="-L$absdir/$objdir"
  5289. ;;
  5290. esac
  5291. else
  5292. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  5293. test -z "$libdir" && \
  5294. func_fatal_error "\`$deplib' is not a valid libtool archive"
  5295. test "$absdir" != "$libdir" && \
  5296. func_warning "\`$deplib' seems to be moved"
  5297. path="-L$absdir"
  5298. fi
  5299. ;;
  5300. esac
  5301. case " $deplibs " in
  5302. *" $path "*) ;;
  5303. *) deplibs="$path $deplibs" ;;
  5304. esac
  5305. done
  5306. fi # link_all_deplibs != no
  5307. fi # linkmode = lib
  5308. done # for deplib in $libs
  5309. if test "$pass" = link; then
  5310. if test "$linkmode" = "prog"; then
  5311. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  5312. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  5313. else
  5314. compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  5315. fi
  5316. fi
  5317. dependency_libs="$newdependency_libs"
  5318. if test "$pass" = dlpreopen; then
  5319. # Link the dlpreopened libraries before other libraries
  5320. for deplib in $save_deplibs; do
  5321. deplibs="$deplib $deplibs"
  5322. done
  5323. fi
  5324. if test "$pass" != dlopen; then
  5325. if test "$pass" != conv; then
  5326. # Make sure lib_search_path contains only unique directories.
  5327. lib_search_path=
  5328. for dir in $newlib_search_path; do
  5329. case "$lib_search_path " in
  5330. *" $dir "*) ;;
  5331. *) lib_search_path="$lib_search_path $dir" ;;
  5332. esac
  5333. done
  5334. newlib_search_path=
  5335. fi
  5336. if test "$linkmode,$pass" != "prog,link"; then
  5337. vars="deplibs"
  5338. else
  5339. vars="compile_deplibs finalize_deplibs"
  5340. fi
  5341. for var in $vars dependency_libs; do
  5342. # Add libraries to $var in reverse order
  5343. eval tmp_libs=\"\$$var\"
  5344. new_libs=
  5345. for deplib in $tmp_libs; do
  5346. # FIXME: Pedantically, this is the right thing to do, so
  5347. # that some nasty dependency loop isn't accidentally
  5348. # broken:
  5349. #new_libs="$deplib $new_libs"
  5350. # Pragmatically, this seems to cause very few problems in
  5351. # practice:
  5352. case $deplib in
  5353. -L*) new_libs="$deplib $new_libs" ;;
  5354. -R*) ;;
  5355. *)
  5356. # And here is the reason: when a library appears more
  5357. # than once as an explicit dependence of a library, or
  5358. # is implicitly linked in more than once by the
  5359. # compiler, it is considered special, and multiple
  5360. # occurrences thereof are not removed. Compare this
  5361. # with having the same library being listed as a
  5362. # dependency of multiple other libraries: in this case,
  5363. # we know (pedantically, we assume) the library does not
  5364. # need to be listed more than once, so we keep only the
  5365. # last copy. This is not always right, but it is rare
  5366. # enough that we require users that really mean to play
  5367. # such unportable linking tricks to link the library
  5368. # using -Wl,-lname, so that libtool does not consider it
  5369. # for duplicate removal.
  5370. case " $specialdeplibs " in
  5371. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  5372. *)
  5373. case " $new_libs " in
  5374. *" $deplib "*) ;;
  5375. *) new_libs="$deplib $new_libs" ;;
  5376. esac
  5377. ;;
  5378. esac
  5379. ;;
  5380. esac
  5381. done
  5382. tmp_libs=
  5383. for deplib in $new_libs; do
  5384. case $deplib in
  5385. -L*)
  5386. case " $tmp_libs " in
  5387. *" $deplib "*) ;;
  5388. *) tmp_libs="$tmp_libs $deplib" ;;
  5389. esac
  5390. ;;
  5391. *) tmp_libs="$tmp_libs $deplib" ;;
  5392. esac
  5393. done
  5394. eval $var=\"$tmp_libs\"
  5395. done # for var
  5396. fi
  5397. # Last step: remove runtime libs from dependency_libs
  5398. # (they stay in deplibs)
  5399. tmp_libs=
  5400. for i in $dependency_libs ; do
  5401. case " $predeps $postdeps $compiler_lib_search_path " in
  5402. *" $i "*)
  5403. i=""
  5404. ;;
  5405. esac
  5406. if test -n "$i" ; then
  5407. tmp_libs="$tmp_libs $i"
  5408. fi
  5409. done
  5410. dependency_libs=$tmp_libs
  5411. done # for pass
  5412. if test "$linkmode" = prog; then
  5413. dlfiles="$newdlfiles"
  5414. fi
  5415. if test "$linkmode" = prog || test "$linkmode" = lib; then
  5416. dlprefiles="$newdlprefiles"
  5417. fi
  5418. case $linkmode in
  5419. oldlib)
  5420. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  5421. func_warning "\`-dlopen' is ignored for archives"
  5422. fi
  5423. case " $deplibs" in
  5424. *\ -l* | *\ -L*)
  5425. func_warning "\`-l' and \`-L' are ignored for archives" ;;
  5426. esac
  5427. test -n "$rpath" && \
  5428. func_warning "\`-rpath' is ignored for archives"
  5429. test -n "$xrpath" && \
  5430. func_warning "\`-R' is ignored for archives"
  5431. test -n "$vinfo" && \
  5432. func_warning "\`-version-info/-version-number' is ignored for archives"
  5433. test -n "$release" && \
  5434. func_warning "\`-release' is ignored for archives"
  5435. test -n "$export_symbols$export_symbols_regex" && \
  5436. func_warning "\`-export-symbols' is ignored for archives"
  5437. # Now set the variables for building old libraries.
  5438. build_libtool_libs=no
  5439. oldlibs="$output"
  5440. objs="$objs$old_deplibs"
  5441. ;;
  5442. lib)
  5443. # Make sure we only generate libraries of the form `libNAME.la'.
  5444. case $outputname in
  5445. lib*)
  5446. func_stripname 'lib' '.la' "$outputname"
  5447. name=$func_stripname_result
  5448. eval shared_ext=\"$shrext_cmds\"
  5449. eval libname=\"$libname_spec\"
  5450. ;;
  5451. *)
  5452. test "$module" = no && \
  5453. func_fatal_help "libtool library \`$output' must begin with \`lib'"
  5454. if test "$need_lib_prefix" != no; then
  5455. # Add the "lib" prefix for modules if required
  5456. func_stripname '' '.la' "$outputname"
  5457. name=$func_stripname_result
  5458. eval shared_ext=\"$shrext_cmds\"
  5459. eval libname=\"$libname_spec\"
  5460. else
  5461. func_stripname '' '.la' "$outputname"
  5462. libname=$func_stripname_result
  5463. fi
  5464. ;;
  5465. esac
  5466. if test -n "$objs"; then
  5467. if test "$deplibs_check_method" != pass_all; then
  5468. func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
  5469. else
  5470. $ECHO
  5471. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  5472. $ECHO "*** objects $objs is not portable!"
  5473. libobjs="$libobjs $objs"
  5474. fi
  5475. fi
  5476. test "$dlself" != no && \
  5477. func_warning "\`-dlopen self' is ignored for libtool libraries"
  5478. set dummy $rpath
  5479. shift
  5480. test "$#" -gt 1 && \
  5481. func_warning "ignoring multiple \`-rpath's for a libtool library"
  5482. install_libdir="$1"
  5483. oldlibs=
  5484. if test -z "$rpath"; then
  5485. if test "$build_libtool_libs" = yes; then
  5486. # Building a libtool convenience library.
  5487. # Some compilers have problems with a `.al' extension so
  5488. # convenience libraries should have the same extension an
  5489. # archive normally would.
  5490. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  5491. build_libtool_libs=convenience
  5492. build_old_libs=yes
  5493. fi
  5494. test -n "$vinfo" && \
  5495. func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
  5496. test -n "$release" && \
  5497. func_warning "\`-release' is ignored for convenience libraries"
  5498. else
  5499. # Parse the version information argument.
  5500. save_ifs="$IFS"; IFS=':'
  5501. set dummy $vinfo 0 0 0
  5502. shift
  5503. IFS="$save_ifs"
  5504. test -n "$7" && \
  5505. func_fatal_help "too many parameters to \`-version-info'"
  5506. # convert absolute version numbers to libtool ages
  5507. # this retains compatibility with .la files and attempts
  5508. # to make the code below a bit more comprehensible
  5509. case $vinfo_number in
  5510. yes)
  5511. number_major="$1"
  5512. number_minor="$2"
  5513. number_revision="$3"
  5514. #
  5515. # There are really only two kinds -- those that
  5516. # use the current revision as the major version
  5517. # and those that subtract age and use age as
  5518. # a minor version. But, then there is irix
  5519. # which has an extra 1 added just for fun
  5520. #
  5521. case $version_type in
  5522. darwin|linux|osf|windows|none)
  5523. func_arith $number_major + $number_minor
  5524. current=$func_arith_result
  5525. age="$number_minor"
  5526. revision="$number_revision"
  5527. ;;
  5528. freebsd-aout|freebsd-elf|sunos)
  5529. current="$number_major"
  5530. revision="$number_minor"
  5531. age="0"
  5532. ;;
  5533. irix|nonstopux)
  5534. func_arith $number_major + $number_minor
  5535. current=$func_arith_result
  5536. age="$number_minor"
  5537. revision="$number_minor"
  5538. lt_irix_increment=no
  5539. ;;
  5540. esac
  5541. ;;
  5542. no)
  5543. current="$1"
  5544. revision="$2"
  5545. age="$3"
  5546. ;;
  5547. esac
  5548. # Check that each of the things are valid numbers.
  5549. case $current in
  5550. 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]) ;;
  5551. *)
  5552. func_error "CURRENT \`$current' must be a nonnegative integer"
  5553. func_fatal_error "\`$vinfo' is not valid version information"
  5554. ;;
  5555. esac
  5556. case $revision in
  5557. 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]) ;;
  5558. *)
  5559. func_error "REVISION \`$revision' must be a nonnegative integer"
  5560. func_fatal_error "\`$vinfo' is not valid version information"
  5561. ;;
  5562. esac
  5563. case $age in
  5564. 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]) ;;
  5565. *)
  5566. func_error "AGE \`$age' must be a nonnegative integer"
  5567. func_fatal_error "\`$vinfo' is not valid version information"
  5568. ;;
  5569. esac
  5570. if test "$age" -gt "$current"; then
  5571. func_error "AGE \`$age' is greater than the current interface number \`$current'"
  5572. func_fatal_error "\`$vinfo' is not valid version information"
  5573. fi
  5574. # Calculate the version variables.
  5575. major=
  5576. versuffix=
  5577. verstring=
  5578. case $version_type in
  5579. none) ;;
  5580. darwin)
  5581. # Like Linux, but with the current version available in
  5582. # verstring for coding it into the library header
  5583. func_arith $current - $age
  5584. major=.$func_arith_result
  5585. versuffix="$major.$age.$revision"
  5586. # Darwin ld doesn't like 0 for these options...
  5587. func_arith $current + 1
  5588. minor_current=$func_arith_result
  5589. xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  5590. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  5591. ;;
  5592. freebsd-aout)
  5593. major=".$current"
  5594. versuffix=".$current.$revision";
  5595. ;;
  5596. freebsd-elf)
  5597. major=".$current"
  5598. versuffix=".$current"
  5599. ;;
  5600. irix | nonstopux)
  5601. if test "X$lt_irix_increment" = "Xno"; then
  5602. func_arith $current - $age
  5603. else
  5604. func_arith $current - $age + 1
  5605. fi
  5606. major=$func_arith_result
  5607. case $version_type in
  5608. nonstopux) verstring_prefix=nonstopux ;;
  5609. *) verstring_prefix=sgi ;;
  5610. esac
  5611. verstring="$verstring_prefix$major.$revision"
  5612. # Add in all the interfaces that we are compatible with.
  5613. loop=$revision
  5614. while test "$loop" -ne 0; do
  5615. func_arith $revision - $loop
  5616. iface=$func_arith_result
  5617. func_arith $loop - 1
  5618. loop=$func_arith_result
  5619. verstring="$verstring_prefix$major.$iface:$verstring"
  5620. done
  5621. # Before this point, $major must not contain `.'.
  5622. major=.$major
  5623. versuffix="$major.$revision"
  5624. ;;
  5625. linux)
  5626. func_arith $current - $age
  5627. major=.$func_arith_result
  5628. versuffix="$major.$age.$revision"
  5629. ;;
  5630. osf)
  5631. func_arith $current - $age
  5632. major=.$func_arith_result
  5633. versuffix=".$current.$age.$revision"
  5634. verstring="$current.$age.$revision"
  5635. # Add in all the interfaces that we are compatible with.
  5636. loop=$age
  5637. while test "$loop" -ne 0; do
  5638. func_arith $current - $loop
  5639. iface=$func_arith_result
  5640. func_arith $loop - 1
  5641. loop=$func_arith_result
  5642. verstring="$verstring:${iface}.0"
  5643. done
  5644. # Make executables depend on our current version.
  5645. verstring="$verstring:${current}.0"
  5646. ;;
  5647. qnx)
  5648. major=".$current"
  5649. versuffix=".$current"
  5650. ;;
  5651. sunos)
  5652. major=".$current"
  5653. versuffix=".$current.$revision"
  5654. ;;
  5655. windows)
  5656. # Use '-' rather than '.', since we only want one
  5657. # extension on DOS 8.3 filesystems.
  5658. func_arith $current - $age
  5659. major=$func_arith_result
  5660. versuffix="-$major"
  5661. ;;
  5662. *)
  5663. func_fatal_configuration "unknown library version type \`$version_type'"
  5664. ;;
  5665. esac
  5666. # Clear the version info if we defaulted, and they specified a release.
  5667. if test -z "$vinfo" && test -n "$release"; then
  5668. major=
  5669. case $version_type in
  5670. darwin)
  5671. # we can't check for "0.0" in archive_cmds due to quoting
  5672. # problems, so we reset it completely
  5673. verstring=
  5674. ;;
  5675. *)
  5676. verstring="0.0"
  5677. ;;
  5678. esac
  5679. if test "$need_version" = no; then
  5680. versuffix=
  5681. else
  5682. versuffix=".0.0"
  5683. fi
  5684. fi
  5685. # Remove version info from name if versioning should be avoided
  5686. if test "$avoid_version" = yes && test "$need_version" = no; then
  5687. major=
  5688. versuffix=
  5689. verstring=""
  5690. fi
  5691. # Check to see if the archive will have undefined symbols.
  5692. if test "$allow_undefined" = yes; then
  5693. if test "$allow_undefined_flag" = unsupported; then
  5694. func_warning "undefined symbols not allowed in $host shared libraries"
  5695. build_libtool_libs=no
  5696. build_old_libs=yes
  5697. fi
  5698. else
  5699. # Don't allow undefined symbols.
  5700. allow_undefined_flag="$no_undefined_flag"
  5701. fi
  5702. fi
  5703. func_generate_dlsyms "$libname" "$libname" "yes"
  5704. libobjs="$libobjs $symfileobj"
  5705. test "X$libobjs" = "X " && libobjs=
  5706. if test "$mode" != relink; then
  5707. # Remove our outputs, but don't remove object files since they
  5708. # may have been created when compiling PIC objects.
  5709. removelist=
  5710. tempremovelist=`$ECHO "$output_objdir/*"`
  5711. for p in $tempremovelist; do
  5712. case $p in
  5713. *.$objext | *.gcno)
  5714. ;;
  5715. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  5716. if test "X$precious_files_regex" != "X"; then
  5717. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  5718. then
  5719. continue
  5720. fi
  5721. fi
  5722. removelist="$removelist $p"
  5723. ;;
  5724. *) ;;
  5725. esac
  5726. done
  5727. test -n "$removelist" && \
  5728. func_show_eval "${RM}r \$removelist"
  5729. fi
  5730. # Now set the variables for building old libraries.
  5731. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  5732. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  5733. # Transform .lo files to .o files.
  5734. oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  5735. fi
  5736. # Eliminate all temporary directories.
  5737. #for path in $notinst_path; do
  5738. # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
  5739. # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
  5740. # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
  5741. #done
  5742. if test -n "$xrpath"; then
  5743. # If the user specified any rpath flags, then add them.
  5744. temp_xrpath=
  5745. for libdir in $xrpath; do
  5746. temp_xrpath="$temp_xrpath -R$libdir"
  5747. case "$finalize_rpath " in
  5748. *" $libdir "*) ;;
  5749. *) finalize_rpath="$finalize_rpath $libdir" ;;
  5750. esac
  5751. done
  5752. if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  5753. dependency_libs="$temp_xrpath $dependency_libs"
  5754. fi
  5755. fi
  5756. # Make sure dlfiles contains only unique files that won't be dlpreopened
  5757. old_dlfiles="$dlfiles"
  5758. dlfiles=
  5759. for lib in $old_dlfiles; do
  5760. case " $dlprefiles $dlfiles " in
  5761. *" $lib "*) ;;
  5762. *) dlfiles="$dlfiles $lib" ;;
  5763. esac
  5764. done
  5765. # Make sure dlprefiles contains only unique files
  5766. old_dlprefiles="$dlprefiles"
  5767. dlprefiles=
  5768. for lib in $old_dlprefiles; do
  5769. case "$dlprefiles " in
  5770. *" $lib "*) ;;
  5771. *) dlprefiles="$dlprefiles $lib" ;;
  5772. esac
  5773. done
  5774. if test "$build_libtool_libs" = yes; then
  5775. if test -n "$rpath"; then
  5776. case $host in
  5777. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
  5778. # these systems don't actually have a c library (as such)!
  5779. ;;
  5780. *-*-rhapsody* | *-*-darwin1.[012])
  5781. # Rhapsody C library is in the System framework
  5782. deplibs="$deplibs System.ltframework"
  5783. ;;
  5784. *-*-netbsd*)
  5785. # Don't link with libc until the a.out ld.so is fixed.
  5786. ;;
  5787. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  5788. # Do not include libc due to us having libc/libc_r.
  5789. ;;
  5790. *-*-sco3.2v5* | *-*-sco5v6*)
  5791. # Causes problems with __ctype
  5792. ;;
  5793. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  5794. # Compiler inserts libc in the correct place for threads to work
  5795. ;;
  5796. *)
  5797. # Add libc to deplibs on all other systems if necessary.
  5798. if test "$build_libtool_need_lc" = "yes"; then
  5799. deplibs="$deplibs -lc"
  5800. fi
  5801. ;;
  5802. esac
  5803. fi
  5804. # Transform deplibs into only deplibs that can be linked in shared.
  5805. name_save=$name
  5806. libname_save=$libname
  5807. release_save=$release
  5808. versuffix_save=$versuffix
  5809. major_save=$major
  5810. # I'm not sure if I'm treating the release correctly. I think
  5811. # release should show up in the -l (ie -lgmp5) so we don't want to
  5812. # add it in twice. Is that correct?
  5813. release=""
  5814. versuffix=""
  5815. major=""
  5816. newdeplibs=
  5817. droppeddeps=no
  5818. case $deplibs_check_method in
  5819. pass_all)
  5820. # Don't check for shared/static. Everything works.
  5821. # This might be a little naive. We might want to check
  5822. # whether the library exists or not. But this is on
  5823. # osf3 & osf4 and I'm not really sure... Just
  5824. # implementing what was already the behavior.
  5825. newdeplibs=$deplibs
  5826. ;;
  5827. test_compile)
  5828. # This code stresses the "libraries are programs" paradigm to its
  5829. # limits. Maybe even breaks it. We compile a program, linking it
  5830. # against the deplibs as a proxy for the library. Then we can check
  5831. # whether they linked in statically or dynamically with ldd.
  5832. $opt_dry_run || $RM conftest.c
  5833. cat > conftest.c <<EOF
  5834. int main() { return 0; }
  5835. EOF
  5836. $opt_dry_run || $RM conftest
  5837. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  5838. ldd_output=`ldd conftest`
  5839. for i in $deplibs; do
  5840. case $i in
  5841. -l*)
  5842. func_stripname -l '' "$i"
  5843. name=$func_stripname_result
  5844. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  5845. case " $predeps $postdeps " in
  5846. *" $i "*)
  5847. newdeplibs="$newdeplibs $i"
  5848. i=""
  5849. ;;
  5850. esac
  5851. fi
  5852. if test -n "$i" ; then
  5853. libname=`eval "\\$ECHO \"$libname_spec\""`
  5854. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  5855. set dummy $deplib_matches; shift
  5856. deplib_match=$1
  5857. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  5858. newdeplibs="$newdeplibs $i"
  5859. else
  5860. droppeddeps=yes
  5861. $ECHO
  5862. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  5863. $ECHO "*** I have the capability to make that library automatically link in when"
  5864. $ECHO "*** you link to this library. But I can only do this if you have a"
  5865. $ECHO "*** shared version of the library, which I believe you do not have"
  5866. $ECHO "*** because a test_compile did reveal that the linker did not use it for"
  5867. $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
  5868. fi
  5869. fi
  5870. ;;
  5871. *)
  5872. newdeplibs="$newdeplibs $i"
  5873. ;;
  5874. esac
  5875. done
  5876. else
  5877. # Error occurred in the first compile. Let's try to salvage
  5878. # the situation: Compile a separate program for each library.
  5879. for i in $deplibs; do
  5880. case $i in
  5881. -l*)
  5882. func_stripname -l '' "$i"
  5883. name=$func_stripname_result
  5884. $opt_dry_run || $RM conftest
  5885. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  5886. ldd_output=`ldd conftest`
  5887. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  5888. case " $predeps $postdeps " in
  5889. *" $i "*)
  5890. newdeplibs="$newdeplibs $i"
  5891. i=""
  5892. ;;
  5893. esac
  5894. fi
  5895. if test -n "$i" ; then
  5896. libname=`eval "\\$ECHO \"$libname_spec\""`
  5897. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  5898. set dummy $deplib_matches; shift
  5899. deplib_match=$1
  5900. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  5901. newdeplibs="$newdeplibs $i"
  5902. else
  5903. droppeddeps=yes
  5904. $ECHO
  5905. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  5906. $ECHO "*** I have the capability to make that library automatically link in when"
  5907. $ECHO "*** you link to this library. But I can only do this if you have a"
  5908. $ECHO "*** shared version of the library, which you do not appear to have"
  5909. $ECHO "*** because a test_compile did reveal that the linker did not use this one"
  5910. $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
  5911. fi
  5912. fi
  5913. else
  5914. droppeddeps=yes
  5915. $ECHO
  5916. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  5917. $ECHO "*** make it link in! You will probably need to install it or some"
  5918. $ECHO "*** library that it depends on before this library will be fully"
  5919. $ECHO "*** functional. Installing it before continuing would be even better."
  5920. fi
  5921. ;;
  5922. *)
  5923. newdeplibs="$newdeplibs $i"
  5924. ;;
  5925. esac
  5926. done
  5927. fi
  5928. ;;
  5929. file_magic*)
  5930. set dummy $deplibs_check_method; shift
  5931. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  5932. for a_deplib in $deplibs; do
  5933. case $a_deplib in
  5934. -l*)
  5935. func_stripname -l '' "$a_deplib"
  5936. name=$func_stripname_result
  5937. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  5938. case " $predeps $postdeps " in
  5939. *" $a_deplib "*)
  5940. newdeplibs="$newdeplibs $a_deplib"
  5941. a_deplib=""
  5942. ;;
  5943. esac
  5944. fi
  5945. if test -n "$a_deplib" ; then
  5946. libname=`eval "\\$ECHO \"$libname_spec\""`
  5947. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  5948. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  5949. for potent_lib in $potential_libs; do
  5950. # Follow soft links.
  5951. if ls -lLd "$potent_lib" 2>/dev/null |
  5952. $GREP " -> " >/dev/null; then
  5953. continue
  5954. fi
  5955. # The statement above tries to avoid entering an
  5956. # endless loop below, in case of cyclic links.
  5957. # We might still enter an endless loop, since a link
  5958. # loop can be closed while we follow links,
  5959. # but so what?
  5960. potlib="$potent_lib"
  5961. while test -h "$potlib" 2>/dev/null; do
  5962. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  5963. case $potliblink in
  5964. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  5965. *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  5966. esac
  5967. done
  5968. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  5969. $SED -e 10q |
  5970. $EGREP "$file_magic_regex" > /dev/null; then
  5971. newdeplibs="$newdeplibs $a_deplib"
  5972. a_deplib=""
  5973. break 2
  5974. fi
  5975. done
  5976. done
  5977. fi
  5978. if test -n "$a_deplib" ; then
  5979. droppeddeps=yes
  5980. $ECHO
  5981. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  5982. $ECHO "*** I have the capability to make that library automatically link in when"
  5983. $ECHO "*** you link to this library. But I can only do this if you have a"
  5984. $ECHO "*** shared version of the library, which you do not appear to have"
  5985. $ECHO "*** because I did check the linker path looking for a file starting"
  5986. if test -z "$potlib" ; then
  5987. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  5988. else
  5989. $ECHO "*** with $libname and none of the candidates passed a file format test"
  5990. $ECHO "*** using a file magic. Last file checked: $potlib"
  5991. fi
  5992. fi
  5993. ;;
  5994. *)
  5995. # Add a -L argument.
  5996. newdeplibs="$newdeplibs $a_deplib"
  5997. ;;
  5998. esac
  5999. done # Gone through all deplibs.
  6000. ;;
  6001. match_pattern*)
  6002. set dummy $deplibs_check_method; shift
  6003. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6004. for a_deplib in $deplibs; do
  6005. case $a_deplib in
  6006. -l*)
  6007. func_stripname -l '' "$a_deplib"
  6008. name=$func_stripname_result
  6009. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6010. case " $predeps $postdeps " in
  6011. *" $a_deplib "*)
  6012. newdeplibs="$newdeplibs $a_deplib"
  6013. a_deplib=""
  6014. ;;
  6015. esac
  6016. fi
  6017. if test -n "$a_deplib" ; then
  6018. libname=`eval "\\$ECHO \"$libname_spec\""`
  6019. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  6020. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  6021. for potent_lib in $potential_libs; do
  6022. potlib="$potent_lib" # see symlink-check above in file_magic test
  6023. if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
  6024. $EGREP "$match_pattern_regex" > /dev/null; then
  6025. newdeplibs="$newdeplibs $a_deplib"
  6026. a_deplib=""
  6027. break 2
  6028. fi
  6029. done
  6030. done
  6031. fi
  6032. if test -n "$a_deplib" ; then
  6033. droppeddeps=yes
  6034. $ECHO
  6035. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  6036. $ECHO "*** I have the capability to make that library automatically link in when"
  6037. $ECHO "*** you link to this library. But I can only do this if you have a"
  6038. $ECHO "*** shared version of the library, which you do not appear to have"
  6039. $ECHO "*** because I did check the linker path looking for a file starting"
  6040. if test -z "$potlib" ; then
  6041. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  6042. else
  6043. $ECHO "*** with $libname and none of the candidates passed a file format test"
  6044. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  6045. fi
  6046. fi
  6047. ;;
  6048. *)
  6049. # Add a -L argument.
  6050. newdeplibs="$newdeplibs $a_deplib"
  6051. ;;
  6052. esac
  6053. done # Gone through all deplibs.
  6054. ;;
  6055. none | unknown | *)
  6056. newdeplibs=""
  6057. tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
  6058. -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
  6059. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6060. for i in $predeps $postdeps ; do
  6061. # can't use Xsed below, because $i might contain '/'
  6062. tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
  6063. done
  6064. fi
  6065. if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
  6066. $GREP . >/dev/null; then
  6067. $ECHO
  6068. if test "X$deplibs_check_method" = "Xnone"; then
  6069. $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
  6070. else
  6071. $ECHO "*** Warning: inter-library dependencies are not known to be supported."
  6072. fi
  6073. $ECHO "*** All declared inter-library dependencies are being dropped."
  6074. droppeddeps=yes
  6075. fi
  6076. ;;
  6077. esac
  6078. versuffix=$versuffix_save
  6079. major=$major_save
  6080. release=$release_save
  6081. libname=$libname_save
  6082. name=$name_save
  6083. case $host in
  6084. *-*-rhapsody* | *-*-darwin1.[012])
  6085. # On Rhapsody replace the C library with the System framework
  6086. newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  6087. ;;
  6088. esac
  6089. if test "$droppeddeps" = yes; then
  6090. if test "$module" = yes; then
  6091. $ECHO
  6092. $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
  6093. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  6094. $ECHO "*** a static module, that should work as long as the dlopening"
  6095. $ECHO "*** application is linked with the -dlopen flag."
  6096. if test -z "$global_symbol_pipe"; then
  6097. $ECHO
  6098. $ECHO "*** However, this would only work if libtool was able to extract symbol"
  6099. $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
  6100. $ECHO "*** not find such a program. So, this module is probably useless."
  6101. $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
  6102. fi
  6103. if test "$build_old_libs" = no; then
  6104. oldlibs="$output_objdir/$libname.$libext"
  6105. build_libtool_libs=module
  6106. build_old_libs=yes
  6107. else
  6108. build_libtool_libs=no
  6109. fi
  6110. else
  6111. $ECHO "*** The inter-library dependencies that have been dropped here will be"
  6112. $ECHO "*** automatically added whenever a program is linked with this library"
  6113. $ECHO "*** or is declared to -dlopen it."
  6114. if test "$allow_undefined" = no; then
  6115. $ECHO
  6116. $ECHO "*** Since this library must not contain undefined symbols,"
  6117. $ECHO "*** because either the platform does not support them or"
  6118. $ECHO "*** it was explicitly requested with -no-undefined,"
  6119. $ECHO "*** libtool will only create a static version of it."
  6120. if test "$build_old_libs" = no; then
  6121. oldlibs="$output_objdir/$libname.$libext"
  6122. build_libtool_libs=module
  6123. build_old_libs=yes
  6124. else
  6125. build_libtool_libs=no
  6126. fi
  6127. fi
  6128. fi
  6129. fi
  6130. # Done checking deplibs!
  6131. deplibs=$newdeplibs
  6132. fi
  6133. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  6134. case $host in
  6135. *-*-darwin*)
  6136. newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  6137. new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  6138. deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  6139. ;;
  6140. esac
  6141. # move library search paths that coincide with paths to not yet
  6142. # installed libraries to the beginning of the library search list
  6143. new_libs=
  6144. for path in $notinst_path; do
  6145. case " $new_libs " in
  6146. *" -L$path/$objdir "*) ;;
  6147. *)
  6148. case " $deplibs " in
  6149. *" -L$path/$objdir "*)
  6150. new_libs="$new_libs -L$path/$objdir" ;;
  6151. esac
  6152. ;;
  6153. esac
  6154. done
  6155. for deplib in $deplibs; do
  6156. case $deplib in
  6157. -L*)
  6158. case " $new_libs " in
  6159. *" $deplib "*) ;;
  6160. *) new_libs="$new_libs $deplib" ;;
  6161. esac
  6162. ;;
  6163. *) new_libs="$new_libs $deplib" ;;
  6164. esac
  6165. done
  6166. deplibs="$new_libs"
  6167. # All the library-specific variables (install_libdir is set above).
  6168. library_names=
  6169. old_library=
  6170. dlname=
  6171. # Test again, we may have decided not to build it any more
  6172. if test "$build_libtool_libs" = yes; then
  6173. if test "$hardcode_into_libs" = yes; then
  6174. # Hardcode the library paths
  6175. hardcode_libdirs=
  6176. dep_rpath=
  6177. rpath="$finalize_rpath"
  6178. test "$mode" != relink && rpath="$compile_rpath$rpath"
  6179. for libdir in $rpath; do
  6180. if test -n "$hardcode_libdir_flag_spec"; then
  6181. if test -n "$hardcode_libdir_separator"; then
  6182. if test -z "$hardcode_libdirs"; then
  6183. hardcode_libdirs="$libdir"
  6184. else
  6185. # Just accumulate the unique libdirs.
  6186. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  6187. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  6188. ;;
  6189. *)
  6190. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  6191. ;;
  6192. esac
  6193. fi
  6194. else
  6195. eval flag=\"$hardcode_libdir_flag_spec\"
  6196. dep_rpath="$dep_rpath $flag"
  6197. fi
  6198. elif test -n "$runpath_var"; then
  6199. case "$perm_rpath " in
  6200. *" $libdir "*) ;;
  6201. *) perm_rpath="$perm_rpath $libdir" ;;
  6202. esac
  6203. fi
  6204. done
  6205. # Substitute the hardcoded libdirs into the rpath.
  6206. if test -n "$hardcode_libdir_separator" &&
  6207. test -n "$hardcode_libdirs"; then
  6208. libdir="$hardcode_libdirs"
  6209. if test -n "$hardcode_libdir_flag_spec_ld"; then
  6210. eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  6211. else
  6212. eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  6213. fi
  6214. fi
  6215. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  6216. # We should set the runpath_var.
  6217. rpath=
  6218. for dir in $perm_rpath; do
  6219. rpath="$rpath$dir:"
  6220. done
  6221. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  6222. fi
  6223. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  6224. fi
  6225. shlibpath="$finalize_shlibpath"
  6226. test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  6227. if test -n "$shlibpath"; then
  6228. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  6229. fi
  6230. # Get the real and link names of the library.
  6231. eval shared_ext=\"$shrext_cmds\"
  6232. eval library_names=\"$library_names_spec\"
  6233. set dummy $library_names
  6234. shift
  6235. realname="$1"
  6236. shift
  6237. if test -n "$soname_spec"; then
  6238. eval soname=\"$soname_spec\"
  6239. else
  6240. soname="$realname"
  6241. fi
  6242. if test -z "$dlname"; then
  6243. dlname=$soname
  6244. fi
  6245. lib="$output_objdir/$realname"
  6246. linknames=
  6247. for link
  6248. do
  6249. linknames="$linknames $link"
  6250. done
  6251. # Use standard objects if they are pic
  6252. test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  6253. test "X$libobjs" = "X " && libobjs=
  6254. delfiles=
  6255. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6256. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  6257. export_symbols="$output_objdir/$libname.uexp"
  6258. delfiles="$delfiles $export_symbols"
  6259. fi
  6260. orig_export_symbols=
  6261. case $host_os in
  6262. cygwin* | mingw* | cegcc*)
  6263. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  6264. # exporting using user supplied symfile
  6265. if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
  6266. # and it's NOT already a .def file. Must figure out
  6267. # which of the given symbols are data symbols and tag
  6268. # them as such. So, trigger use of export_symbols_cmds.
  6269. # export_symbols gets reassigned inside the "prepare
  6270. # the list of exported symbols" if statement, so the
  6271. # include_expsyms logic still works.
  6272. orig_export_symbols="$export_symbols"
  6273. export_symbols=
  6274. always_export_symbols=yes
  6275. fi
  6276. fi
  6277. ;;
  6278. esac
  6279. # Prepare the list of exported symbols
  6280. if test -z "$export_symbols"; then
  6281. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  6282. func_verbose "generating symbol list for \`$libname.la'"
  6283. export_symbols="$output_objdir/$libname.exp"
  6284. $opt_dry_run || $RM $export_symbols
  6285. cmds=$export_symbols_cmds
  6286. save_ifs="$IFS"; IFS='~'
  6287. for cmd in $cmds; do
  6288. IFS="$save_ifs"
  6289. eval cmd=\"$cmd\"
  6290. func_len " $cmd"
  6291. len=$func_len_result
  6292. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  6293. func_show_eval "$cmd" 'exit $?'
  6294. skipped_export=false
  6295. else
  6296. # The command line is too long to execute in one step.
  6297. func_verbose "using reloadable object file for export list..."
  6298. skipped_export=:
  6299. # Break out early, otherwise skipped_export may be
  6300. # set to false by a later but shorter cmd.
  6301. break
  6302. fi
  6303. done
  6304. IFS="$save_ifs"
  6305. if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
  6306. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  6307. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  6308. fi
  6309. fi
  6310. fi
  6311. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6312. tmp_export_symbols="$export_symbols"
  6313. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  6314. $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
  6315. fi
  6316. if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
  6317. # The given exports_symbols file has to be filtered, so filter it.
  6318. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  6319. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  6320. # 's' commands which not all seds can handle. GNU sed should be fine
  6321. # though. Also, the filter scales superlinearly with the number of
  6322. # global variables. join(1) would be nice here, but unfortunately
  6323. # isn't a blessed tool.
  6324. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  6325. delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
  6326. export_symbols=$output_objdir/$libname.def
  6327. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  6328. fi
  6329. tmp_deplibs=
  6330. for test_deplib in $deplibs; do
  6331. case " $convenience " in
  6332. *" $test_deplib "*) ;;
  6333. *)
  6334. tmp_deplibs="$tmp_deplibs $test_deplib"
  6335. ;;
  6336. esac
  6337. done
  6338. deplibs="$tmp_deplibs"
  6339. if test -n "$convenience"; then
  6340. if test -n "$whole_archive_flag_spec" &&
  6341. test "$compiler_needs_object" = yes &&
  6342. test -z "$libobjs"; then
  6343. # extract the archives, so we have objects to list.
  6344. # TODO: could optimize this to just extract one archive.
  6345. whole_archive_flag_spec=
  6346. fi
  6347. if test -n "$whole_archive_flag_spec"; then
  6348. save_libobjs=$libobjs
  6349. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  6350. test "X$libobjs" = "X " && libobjs=
  6351. else
  6352. gentop="$output_objdir/${outputname}x"
  6353. generated="$generated $gentop"
  6354. func_extract_archives $gentop $convenience
  6355. libobjs="$libobjs $func_extract_archives_result"
  6356. test "X$libobjs" = "X " && libobjs=
  6357. fi
  6358. fi
  6359. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  6360. eval flag=\"$thread_safe_flag_spec\"
  6361. linker_flags="$linker_flags $flag"
  6362. fi
  6363. # Make a backup of the uninstalled library when relinking
  6364. if test "$mode" = relink; then
  6365. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  6366. fi
  6367. # Do each of the archive commands.
  6368. if test "$module" = yes && test -n "$module_cmds" ; then
  6369. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  6370. eval test_cmds=\"$module_expsym_cmds\"
  6371. cmds=$module_expsym_cmds
  6372. else
  6373. eval test_cmds=\"$module_cmds\"
  6374. cmds=$module_cmds
  6375. fi
  6376. else
  6377. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  6378. eval test_cmds=\"$archive_expsym_cmds\"
  6379. cmds=$archive_expsym_cmds
  6380. else
  6381. eval test_cmds=\"$archive_cmds\"
  6382. cmds=$archive_cmds
  6383. fi
  6384. fi
  6385. if test "X$skipped_export" != "X:" &&
  6386. func_len " $test_cmds" &&
  6387. len=$func_len_result &&
  6388. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  6389. :
  6390. else
  6391. # The command line is too long to link in one step, link piecewise
  6392. # or, if using GNU ld and skipped_export is not :, use a linker
  6393. # script.
  6394. # Save the value of $output and $libobjs because we want to
  6395. # use them later. If we have whole_archive_flag_spec, we
  6396. # want to use save_libobjs as it was before
  6397. # whole_archive_flag_spec was expanded, because we can't
  6398. # assume the linker understands whole_archive_flag_spec.
  6399. # This may have to be revisited, in case too many
  6400. # convenience libraries get linked in and end up exceeding
  6401. # the spec.
  6402. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  6403. save_libobjs=$libobjs
  6404. fi
  6405. save_output=$output
  6406. output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
  6407. # Clear the reloadable object creation command queue and
  6408. # initialize k to one.
  6409. test_cmds=
  6410. concat_cmds=
  6411. objlist=
  6412. last_robj=
  6413. k=1
  6414. if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
  6415. output=${output_objdir}/${output_la}.lnkscript
  6416. func_verbose "creating GNU ld script: $output"
  6417. $ECHO 'INPUT (' > $output
  6418. for obj in $save_libobjs
  6419. do
  6420. $ECHO "$obj" >> $output
  6421. done
  6422. $ECHO ')' >> $output
  6423. delfiles="$delfiles $output"
  6424. elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
  6425. output=${output_objdir}/${output_la}.lnk
  6426. func_verbose "creating linker input file list: $output"
  6427. : > $output
  6428. set x $save_libobjs
  6429. shift
  6430. firstobj=
  6431. if test "$compiler_needs_object" = yes; then
  6432. firstobj="$1 "
  6433. shift
  6434. fi
  6435. for obj
  6436. do
  6437. $ECHO "$obj" >> $output
  6438. done
  6439. delfiles="$delfiles $output"
  6440. output=$firstobj\"$file_list_spec$output\"
  6441. else
  6442. if test -n "$save_libobjs"; then
  6443. func_verbose "creating reloadable object files..."
  6444. output=$output_objdir/$output_la-${k}.$objext
  6445. eval test_cmds=\"$reload_cmds\"
  6446. func_len " $test_cmds"
  6447. len0=$func_len_result
  6448. len=$len0
  6449. # Loop over the list of objects to be linked.
  6450. for obj in $save_libobjs
  6451. do
  6452. func_len " $obj"
  6453. func_arith $len + $func_len_result
  6454. len=$func_arith_result
  6455. if test "X$objlist" = X ||
  6456. test "$len" -lt "$max_cmd_len"; then
  6457. func_append objlist " $obj"
  6458. else
  6459. # The command $test_cmds is almost too long, add a
  6460. # command to the queue.
  6461. if test "$k" -eq 1 ; then
  6462. # The first file doesn't have a previous command to add.
  6463. eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  6464. else
  6465. # All subsequent reloadable object files will link in
  6466. # the last one created.
  6467. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
  6468. fi
  6469. last_robj=$output_objdir/$output_la-${k}.$objext
  6470. func_arith $k + 1
  6471. k=$func_arith_result
  6472. output=$output_objdir/$output_la-${k}.$objext
  6473. objlist=$obj
  6474. func_len " $last_robj"
  6475. func_arith $len0 + $func_len_result
  6476. len=$func_arith_result
  6477. fi
  6478. done
  6479. # Handle the remaining objects by creating one last
  6480. # reloadable object file. All subsequent reloadable object
  6481. # files will link in the last one created.
  6482. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  6483. eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  6484. if test -n "$last_robj"; then
  6485. eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
  6486. fi
  6487. delfiles="$delfiles $output"
  6488. else
  6489. output=
  6490. fi
  6491. if ${skipped_export-false}; then
  6492. func_verbose "generating symbol list for \`$libname.la'"
  6493. export_symbols="$output_objdir/$libname.exp"
  6494. $opt_dry_run || $RM $export_symbols
  6495. libobjs=$output
  6496. # Append the command to create the export file.
  6497. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  6498. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  6499. if test -n "$last_robj"; then
  6500. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  6501. fi
  6502. fi
  6503. test -n "$save_libobjs" &&
  6504. func_verbose "creating a temporary reloadable object file: $output"
  6505. # Loop through the commands generated above and execute them.
  6506. save_ifs="$IFS"; IFS='~'
  6507. for cmd in $concat_cmds; do
  6508. IFS="$save_ifs"
  6509. $opt_silent || {
  6510. func_quote_for_expand "$cmd"
  6511. eval "func_echo $func_quote_for_expand_result"
  6512. }
  6513. $opt_dry_run || eval "$cmd" || {
  6514. lt_exit=$?
  6515. # Restore the uninstalled library and exit
  6516. if test "$mode" = relink; then
  6517. ( cd "$output_objdir" && \
  6518. $RM "${realname}T" && \
  6519. $MV "${realname}U" "$realname" )
  6520. fi
  6521. exit $lt_exit
  6522. }
  6523. done
  6524. IFS="$save_ifs"
  6525. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  6526. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  6527. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  6528. fi
  6529. fi
  6530. if ${skipped_export-false}; then
  6531. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6532. tmp_export_symbols="$export_symbols"
  6533. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  6534. $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
  6535. fi
  6536. if test -n "$orig_export_symbols"; then
  6537. # The given exports_symbols file has to be filtered, so filter it.
  6538. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  6539. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  6540. # 's' commands which not all seds can handle. GNU sed should be fine
  6541. # though. Also, the filter scales superlinearly with the number of
  6542. # global variables. join(1) would be nice here, but unfortunately
  6543. # isn't a blessed tool.
  6544. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  6545. delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
  6546. export_symbols=$output_objdir/$libname.def
  6547. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  6548. fi
  6549. fi
  6550. libobjs=$output
  6551. # Restore the value of output.
  6552. output=$save_output
  6553. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  6554. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  6555. test "X$libobjs" = "X " && libobjs=
  6556. fi
  6557. # Expand the library linking commands again to reset the
  6558. # value of $libobjs for piecewise linking.
  6559. # Do each of the archive commands.
  6560. if test "$module" = yes && test -n "$module_cmds" ; then
  6561. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  6562. cmds=$module_expsym_cmds
  6563. else
  6564. cmds=$module_cmds
  6565. fi
  6566. else
  6567. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  6568. cmds=$archive_expsym_cmds
  6569. else
  6570. cmds=$archive_cmds
  6571. fi
  6572. fi
  6573. fi
  6574. if test -n "$delfiles"; then
  6575. # Append the command to remove temporary files to $cmds.
  6576. eval cmds=\"\$cmds~\$RM $delfiles\"
  6577. fi
  6578. # Add any objects from preloaded convenience libraries
  6579. if test -n "$dlprefiles"; then
  6580. gentop="$output_objdir/${outputname}x"
  6581. generated="$generated $gentop"
  6582. func_extract_archives $gentop $dlprefiles
  6583. libobjs="$libobjs $func_extract_archives_result"
  6584. test "X$libobjs" = "X " && libobjs=
  6585. fi
  6586. save_ifs="$IFS"; IFS='~'
  6587. for cmd in $cmds; do
  6588. IFS="$save_ifs"
  6589. eval cmd=\"$cmd\"
  6590. $opt_silent || {
  6591. func_quote_for_expand "$cmd"
  6592. eval "func_echo $func_quote_for_expand_result"
  6593. }
  6594. $opt_dry_run || eval "$cmd" || {
  6595. lt_exit=$?
  6596. # Restore the uninstalled library and exit
  6597. if test "$mode" = relink; then
  6598. ( cd "$output_objdir" && \
  6599. $RM "${realname}T" && \
  6600. $MV "${realname}U" "$realname" )
  6601. fi
  6602. exit $lt_exit
  6603. }
  6604. done
  6605. IFS="$save_ifs"
  6606. # Restore the uninstalled library and exit
  6607. if test "$mode" = relink; then
  6608. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  6609. if test -n "$convenience"; then
  6610. if test -z "$whole_archive_flag_spec"; then
  6611. func_show_eval '${RM}r "$gentop"'
  6612. fi
  6613. fi
  6614. exit $EXIT_SUCCESS
  6615. fi
  6616. # Create links to the real library.
  6617. for linkname in $linknames; do
  6618. if test "$realname" != "$linkname"; then
  6619. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  6620. fi
  6621. done
  6622. # If -module or -export-dynamic was specified, set the dlname.
  6623. if test "$module" = yes || test "$export_dynamic" = yes; then
  6624. # On all known operating systems, these are identical.
  6625. dlname="$soname"
  6626. fi
  6627. fi
  6628. ;;
  6629. obj)
  6630. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  6631. func_warning "\`-dlopen' is ignored for objects"
  6632. fi
  6633. case " $deplibs" in
  6634. *\ -l* | *\ -L*)
  6635. func_warning "\`-l' and \`-L' are ignored for objects" ;;
  6636. esac
  6637. test -n "$rpath" && \
  6638. func_warning "\`-rpath' is ignored for objects"
  6639. test -n "$xrpath" && \
  6640. func_warning "\`-R' is ignored for objects"
  6641. test -n "$vinfo" && \
  6642. func_warning "\`-version-info' is ignored for objects"
  6643. test -n "$release" && \
  6644. func_warning "\`-release' is ignored for objects"
  6645. case $output in
  6646. *.lo)
  6647. test -n "$objs$old_deplibs" && \
  6648. func_fatal_error "cannot build library object \`$output' from non-libtool objects"
  6649. libobj=$output
  6650. func_lo2o "$libobj"
  6651. obj=$func_lo2o_result
  6652. ;;
  6653. *)
  6654. libobj=
  6655. obj="$output"
  6656. ;;
  6657. esac
  6658. # Delete the old objects.
  6659. $opt_dry_run || $RM $obj $libobj
  6660. # Objects from convenience libraries. This assumes
  6661. # single-version convenience libraries. Whenever we create
  6662. # different ones for PIC/non-PIC, this we'll have to duplicate
  6663. # the extraction.
  6664. reload_conv_objs=
  6665. gentop=
  6666. # reload_cmds runs $LD directly, so let us get rid of
  6667. # -Wl from whole_archive_flag_spec and hope we can get by with
  6668. # turning comma into space..
  6669. wl=
  6670. if test -n "$convenience"; then
  6671. if test -n "$whole_archive_flag_spec"; then
  6672. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  6673. reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
  6674. else
  6675. gentop="$output_objdir/${obj}x"
  6676. generated="$generated $gentop"
  6677. func_extract_archives $gentop $convenience
  6678. reload_conv_objs="$reload_objs $func_extract_archives_result"
  6679. fi
  6680. fi
  6681. # Create the old-style object.
  6682. 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
  6683. output="$obj"
  6684. func_execute_cmds "$reload_cmds" 'exit $?'
  6685. # Exit if we aren't doing a library object file.
  6686. if test -z "$libobj"; then
  6687. if test -n "$gentop"; then
  6688. func_show_eval '${RM}r "$gentop"'
  6689. fi
  6690. exit $EXIT_SUCCESS
  6691. fi
  6692. if test "$build_libtool_libs" != yes; then
  6693. if test -n "$gentop"; then
  6694. func_show_eval '${RM}r "$gentop"'
  6695. fi
  6696. # Create an invalid libtool object if no PIC, so that we don't
  6697. # accidentally link it into a program.
  6698. # $show "echo timestamp > $libobj"
  6699. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  6700. exit $EXIT_SUCCESS
  6701. fi
  6702. if test -n "$pic_flag" || test "$pic_mode" != default; then
  6703. # Only do commands if we really have different PIC objects.
  6704. reload_objs="$libobjs $reload_conv_objs"
  6705. output="$libobj"
  6706. func_execute_cmds "$reload_cmds" 'exit $?'
  6707. fi
  6708. if test -n "$gentop"; then
  6709. func_show_eval '${RM}r "$gentop"'
  6710. fi
  6711. exit $EXIT_SUCCESS
  6712. ;;
  6713. prog)
  6714. case $host in
  6715. *cygwin*) func_stripname '' '.exe' "$output"
  6716. output=$func_stripname_result.exe;;
  6717. esac
  6718. test -n "$vinfo" && \
  6719. func_warning "\`-version-info' is ignored for programs"
  6720. test -n "$release" && \
  6721. func_warning "\`-release' is ignored for programs"
  6722. test "$preload" = yes \
  6723. && test "$dlopen_support" = unknown \
  6724. && test "$dlopen_self" = unknown \
  6725. && test "$dlopen_self_static" = unknown && \
  6726. func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
  6727. case $host in
  6728. *-*-rhapsody* | *-*-darwin1.[012])
  6729. # On Rhapsody replace the C library is the System framework
  6730. compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  6731. finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  6732. ;;
  6733. esac
  6734. case $host in
  6735. *-*-darwin*)
  6736. # Don't allow lazy linking, it breaks C++ global constructors
  6737. # But is supposedly fixed on 10.4 or later (yay!).
  6738. if test "$tagname" = CXX ; then
  6739. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  6740. 10.[0123])
  6741. compile_command="$compile_command ${wl}-bind_at_load"
  6742. finalize_command="$finalize_command ${wl}-bind_at_load"
  6743. ;;
  6744. esac
  6745. fi
  6746. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  6747. compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  6748. finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  6749. ;;
  6750. esac
  6751. # move library search paths that coincide with paths to not yet
  6752. # installed libraries to the beginning of the library search list
  6753. new_libs=
  6754. for path in $notinst_path; do
  6755. case " $new_libs " in
  6756. *" -L$path/$objdir "*) ;;
  6757. *)
  6758. case " $compile_deplibs " in
  6759. *" -L$path/$objdir "*)
  6760. new_libs="$new_libs -L$path/$objdir" ;;
  6761. esac
  6762. ;;
  6763. esac
  6764. done
  6765. for deplib in $compile_deplibs; do
  6766. case $deplib in
  6767. -L*)
  6768. case " $new_libs " in
  6769. *" $deplib "*) ;;
  6770. *) new_libs="$new_libs $deplib" ;;
  6771. esac
  6772. ;;
  6773. *) new_libs="$new_libs $deplib" ;;
  6774. esac
  6775. done
  6776. compile_deplibs="$new_libs"
  6777. compile_command="$compile_command $compile_deplibs"
  6778. finalize_command="$finalize_command $finalize_deplibs"
  6779. if test -n "$rpath$xrpath"; then
  6780. # If the user specified any rpath flags, then add them.
  6781. for libdir in $rpath $xrpath; do
  6782. # This is the magic to use -rpath.
  6783. case "$finalize_rpath " in
  6784. *" $libdir "*) ;;
  6785. *) finalize_rpath="$finalize_rpath $libdir" ;;
  6786. esac
  6787. done
  6788. fi
  6789. # Now hardcode the library paths
  6790. rpath=
  6791. hardcode_libdirs=
  6792. for libdir in $compile_rpath $finalize_rpath; do
  6793. if test -n "$hardcode_libdir_flag_spec"; then
  6794. if test -n "$hardcode_libdir_separator"; then
  6795. if test -z "$hardcode_libdirs"; then
  6796. hardcode_libdirs="$libdir"
  6797. else
  6798. # Just accumulate the unique libdirs.
  6799. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  6800. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  6801. ;;
  6802. *)
  6803. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  6804. ;;
  6805. esac
  6806. fi
  6807. else
  6808. eval flag=\"$hardcode_libdir_flag_spec\"
  6809. rpath="$rpath $flag"
  6810. fi
  6811. elif test -n "$runpath_var"; then
  6812. case "$perm_rpath " in
  6813. *" $libdir "*) ;;
  6814. *) perm_rpath="$perm_rpath $libdir" ;;
  6815. esac
  6816. fi
  6817. case $host in
  6818. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6819. testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
  6820. case :$dllsearchpath: in
  6821. *":$libdir:"*) ;;
  6822. ::) dllsearchpath=$libdir;;
  6823. *) dllsearchpath="$dllsearchpath:$libdir";;
  6824. esac
  6825. case :$dllsearchpath: in
  6826. *":$testbindir:"*) ;;
  6827. ::) dllsearchpath=$testbindir;;
  6828. *) dllsearchpath="$dllsearchpath:$testbindir";;
  6829. esac
  6830. ;;
  6831. esac
  6832. done
  6833. # Substitute the hardcoded libdirs into the rpath.
  6834. if test -n "$hardcode_libdir_separator" &&
  6835. test -n "$hardcode_libdirs"; then
  6836. libdir="$hardcode_libdirs"
  6837. eval rpath=\" $hardcode_libdir_flag_spec\"
  6838. fi
  6839. compile_rpath="$rpath"
  6840. rpath=
  6841. hardcode_libdirs=
  6842. for libdir in $finalize_rpath; do
  6843. if test -n "$hardcode_libdir_flag_spec"; then
  6844. if test -n "$hardcode_libdir_separator"; then
  6845. if test -z "$hardcode_libdirs"; then
  6846. hardcode_libdirs="$libdir"
  6847. else
  6848. # Just accumulate the unique libdirs.
  6849. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  6850. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  6851. ;;
  6852. *)
  6853. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  6854. ;;
  6855. esac
  6856. fi
  6857. else
  6858. eval flag=\"$hardcode_libdir_flag_spec\"
  6859. rpath="$rpath $flag"
  6860. fi
  6861. elif test -n "$runpath_var"; then
  6862. case "$finalize_perm_rpath " in
  6863. *" $libdir "*) ;;
  6864. *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  6865. esac
  6866. fi
  6867. done
  6868. # Substitute the hardcoded libdirs into the rpath.
  6869. if test -n "$hardcode_libdir_separator" &&
  6870. test -n "$hardcode_libdirs"; then
  6871. libdir="$hardcode_libdirs"
  6872. eval rpath=\" $hardcode_libdir_flag_spec\"
  6873. fi
  6874. finalize_rpath="$rpath"
  6875. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  6876. # Transform all the library objects into standard objects.
  6877. compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  6878. finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  6879. fi
  6880. func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
  6881. # template prelinking step
  6882. if test -n "$prelink_cmds"; then
  6883. func_execute_cmds "$prelink_cmds" 'exit $?'
  6884. fi
  6885. wrappers_required=yes
  6886. case $host in
  6887. *cygwin* | *mingw* )
  6888. if test "$build_libtool_libs" != yes; then
  6889. wrappers_required=no
  6890. fi
  6891. ;;
  6892. *cegcc)
  6893. # Disable wrappers for cegcc, we are cross compiling anyway.
  6894. wrappers_required=no
  6895. ;;
  6896. *)
  6897. if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  6898. wrappers_required=no
  6899. fi
  6900. ;;
  6901. esac
  6902. if test "$wrappers_required" = no; then
  6903. # Replace the output file specification.
  6904. compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  6905. link_command="$compile_command$compile_rpath"
  6906. # We have no uninstalled library dependencies, so finalize right now.
  6907. exit_status=0
  6908. func_show_eval "$link_command" 'exit_status=$?'
  6909. # Delete the generated files.
  6910. if test -f "$output_objdir/${outputname}S.${objext}"; then
  6911. func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
  6912. fi
  6913. exit $exit_status
  6914. fi
  6915. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  6916. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  6917. fi
  6918. if test -n "$finalize_shlibpath"; then
  6919. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  6920. fi
  6921. compile_var=
  6922. finalize_var=
  6923. if test -n "$runpath_var"; then
  6924. if test -n "$perm_rpath"; then
  6925. # We should set the runpath_var.
  6926. rpath=
  6927. for dir in $perm_rpath; do
  6928. rpath="$rpath$dir:"
  6929. done
  6930. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  6931. fi
  6932. if test -n "$finalize_perm_rpath"; then
  6933. # We should set the runpath_var.
  6934. rpath=
  6935. for dir in $finalize_perm_rpath; do
  6936. rpath="$rpath$dir:"
  6937. done
  6938. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  6939. fi
  6940. fi
  6941. if test "$no_install" = yes; then
  6942. # We don't need to create a wrapper script.
  6943. link_command="$compile_var$compile_command$compile_rpath"
  6944. # Replace the output file specification.
  6945. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  6946. # Delete the old output file.
  6947. $opt_dry_run || $RM $output
  6948. # Link the executable and exit
  6949. func_show_eval "$link_command" 'exit $?'
  6950. exit $EXIT_SUCCESS
  6951. fi
  6952. if test "$hardcode_action" = relink; then
  6953. # Fast installation is not supported
  6954. link_command="$compile_var$compile_command$compile_rpath"
  6955. relink_command="$finalize_var$finalize_command$finalize_rpath"
  6956. func_warning "this platform does not like uninstalled shared libraries"
  6957. func_warning "\`$output' will be relinked during installation"
  6958. else
  6959. if test "$fast_install" != no; then
  6960. link_command="$finalize_var$compile_command$finalize_rpath"
  6961. if test "$fast_install" = yes; then
  6962. relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  6963. else
  6964. # fast_install is set to needless
  6965. relink_command=
  6966. fi
  6967. else
  6968. link_command="$compile_var$compile_command$compile_rpath"
  6969. relink_command="$finalize_var$finalize_command$finalize_rpath"
  6970. fi
  6971. fi
  6972. # Replace the output file specification.
  6973. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  6974. # Delete the old output files.
  6975. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  6976. func_show_eval "$link_command" 'exit $?'
  6977. # Now create the wrapper script.
  6978. func_verbose "creating $output"
  6979. # Quote the relink command for shipping.
  6980. if test -n "$relink_command"; then
  6981. # Preserve any variables that may affect compiler behavior
  6982. for var in $variables_saved_for_relink; do
  6983. if eval test -z \"\${$var+set}\"; then
  6984. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  6985. elif eval var_value=\$$var; test -z "$var_value"; then
  6986. relink_command="$var=; export $var; $relink_command"
  6987. else
  6988. func_quote_for_eval "$var_value"
  6989. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  6990. fi
  6991. done
  6992. relink_command="(cd `pwd`; $relink_command)"
  6993. relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  6994. fi
  6995. # Quote $ECHO for shipping.
  6996. if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
  6997. case $progpath in
  6998. [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
  6999. *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
  7000. esac
  7001. qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
  7002. else
  7003. qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
  7004. fi
  7005. # Only actually do things if not in dry run mode.
  7006. $opt_dry_run || {
  7007. # win32 will think the script is a binary if it has
  7008. # a .exe suffix, so we strip it off here.
  7009. case $output in
  7010. *.exe) func_stripname '' '.exe' "$output"
  7011. output=$func_stripname_result ;;
  7012. esac
  7013. # test for cygwin because mv fails w/o .exe extensions
  7014. case $host in
  7015. *cygwin*)
  7016. exeext=.exe
  7017. func_stripname '' '.exe' "$outputname"
  7018. outputname=$func_stripname_result ;;
  7019. *) exeext= ;;
  7020. esac
  7021. case $host in
  7022. *cygwin* | *mingw* )
  7023. func_dirname_and_basename "$output" "" "."
  7024. output_name=$func_basename_result
  7025. output_path=$func_dirname_result
  7026. cwrappersource="$output_path/$objdir/lt-$output_name.c"
  7027. cwrapper="$output_path/$output_name.exe"
  7028. $RM $cwrappersource $cwrapper
  7029. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  7030. func_emit_cwrapperexe_src > $cwrappersource
  7031. # The wrapper executable is built using the $host compiler,
  7032. # because it contains $host paths and files. If cross-
  7033. # compiling, it, like the target executable, must be
  7034. # executed on the $host or under an emulation environment.
  7035. $opt_dry_run || {
  7036. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  7037. $STRIP $cwrapper
  7038. }
  7039. # Now, create the wrapper script for func_source use:
  7040. func_ltwrapper_scriptname $cwrapper
  7041. $RM $func_ltwrapper_scriptname_result
  7042. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  7043. $opt_dry_run || {
  7044. # note: this script will not be executed, so do not chmod.
  7045. if test "x$build" = "x$host" ; then
  7046. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  7047. else
  7048. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  7049. fi
  7050. }
  7051. ;;
  7052. * )
  7053. $RM $output
  7054. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  7055. func_emit_wrapper no > $output
  7056. chmod +x $output
  7057. ;;
  7058. esac
  7059. }
  7060. exit $EXIT_SUCCESS
  7061. ;;
  7062. esac
  7063. # See if we need to build an old-fashioned archive.
  7064. for oldlib in $oldlibs; do
  7065. if test "$build_libtool_libs" = convenience; then
  7066. oldobjs="$libobjs_save $symfileobj"
  7067. addlibs="$convenience"
  7068. build_libtool_libs=no
  7069. else
  7070. if test "$build_libtool_libs" = module; then
  7071. oldobjs="$libobjs_save"
  7072. build_libtool_libs=no
  7073. else
  7074. oldobjs="$old_deplibs $non_pic_objects"
  7075. if test "$preload" = yes && test -f "$symfileobj"; then
  7076. oldobjs="$oldobjs $symfileobj"
  7077. fi
  7078. fi
  7079. addlibs="$old_convenience"
  7080. fi
  7081. if test -n "$addlibs"; then
  7082. gentop="$output_objdir/${outputname}x"
  7083. generated="$generated $gentop"
  7084. func_extract_archives $gentop $addlibs
  7085. oldobjs="$oldobjs $func_extract_archives_result"
  7086. fi
  7087. # Do each command in the archive commands.
  7088. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  7089. cmds=$old_archive_from_new_cmds
  7090. else
  7091. # Add any objects from preloaded convenience libraries
  7092. if test -n "$dlprefiles"; then
  7093. gentop="$output_objdir/${outputname}x"
  7094. generated="$generated $gentop"
  7095. func_extract_archives $gentop $dlprefiles
  7096. oldobjs="$oldobjs $func_extract_archives_result"
  7097. fi
  7098. # POSIX demands no paths to be encoded in archives. We have
  7099. # to avoid creating archives with duplicate basenames if we
  7100. # might have to extract them afterwards, e.g., when creating a
  7101. # static archive out of a convenience library, or when linking
  7102. # the entirety of a libtool archive into another (currently
  7103. # not supported by libtool).
  7104. if (for obj in $oldobjs
  7105. do
  7106. func_basename "$obj"
  7107. $ECHO "$func_basename_result"
  7108. done | sort | sort -uc >/dev/null 2>&1); then
  7109. :
  7110. else
  7111. $ECHO "copying selected object files to avoid basename conflicts..."
  7112. gentop="$output_objdir/${outputname}x"
  7113. generated="$generated $gentop"
  7114. func_mkdir_p "$gentop"
  7115. save_oldobjs=$oldobjs
  7116. oldobjs=
  7117. counter=1
  7118. for obj in $save_oldobjs
  7119. do
  7120. func_basename "$obj"
  7121. objbase="$func_basename_result"
  7122. case " $oldobjs " in
  7123. " ") oldobjs=$obj ;;
  7124. *[\ /]"$objbase "*)
  7125. while :; do
  7126. # Make sure we don't pick an alternate name that also
  7127. # overlaps.
  7128. newobj=lt$counter-$objbase
  7129. func_arith $counter + 1
  7130. counter=$func_arith_result
  7131. case " $oldobjs " in
  7132. *[\ /]"$newobj "*) ;;
  7133. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  7134. esac
  7135. done
  7136. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  7137. oldobjs="$oldobjs $gentop/$newobj"
  7138. ;;
  7139. *) oldobjs="$oldobjs $obj" ;;
  7140. esac
  7141. done
  7142. fi
  7143. eval cmds=\"$old_archive_cmds\"
  7144. func_len " $cmds"
  7145. len=$func_len_result
  7146. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  7147. cmds=$old_archive_cmds
  7148. else
  7149. # the command line is too long to link in one step, link in parts
  7150. func_verbose "using piecewise archive linking..."
  7151. save_RANLIB=$RANLIB
  7152. RANLIB=:
  7153. objlist=
  7154. concat_cmds=
  7155. save_oldobjs=$oldobjs
  7156. oldobjs=
  7157. # Is there a better way of finding the last object in the list?
  7158. for obj in $save_oldobjs
  7159. do
  7160. last_oldobj=$obj
  7161. done
  7162. eval test_cmds=\"$old_archive_cmds\"
  7163. func_len " $test_cmds"
  7164. len0=$func_len_result
  7165. len=$len0
  7166. for obj in $save_oldobjs
  7167. do
  7168. func_len " $obj"
  7169. func_arith $len + $func_len_result
  7170. len=$func_arith_result
  7171. func_append objlist " $obj"
  7172. if test "$len" -lt "$max_cmd_len"; then
  7173. :
  7174. else
  7175. # the above command should be used before it gets too long
  7176. oldobjs=$objlist
  7177. if test "$obj" = "$last_oldobj" ; then
  7178. RANLIB=$save_RANLIB
  7179. fi
  7180. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  7181. eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  7182. objlist=
  7183. len=$len0
  7184. fi
  7185. done
  7186. RANLIB=$save_RANLIB
  7187. oldobjs=$objlist
  7188. if test "X$oldobjs" = "X" ; then
  7189. eval cmds=\"\$concat_cmds\"
  7190. else
  7191. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  7192. fi
  7193. fi
  7194. fi
  7195. func_execute_cmds "$cmds" 'exit $?'
  7196. done
  7197. test -n "$generated" && \
  7198. func_show_eval "${RM}r$generated"
  7199. # Now create the libtool archive.
  7200. case $output in
  7201. *.la)
  7202. old_library=
  7203. test "$build_old_libs" = yes && old_library="$libname.$libext"
  7204. func_verbose "creating $output"
  7205. # Preserve any variables that may affect compiler behavior
  7206. for var in $variables_saved_for_relink; do
  7207. if eval test -z \"\${$var+set}\"; then
  7208. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  7209. elif eval var_value=\$$var; test -z "$var_value"; then
  7210. relink_command="$var=; export $var; $relink_command"
  7211. else
  7212. func_quote_for_eval "$var_value"
  7213. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  7214. fi
  7215. done
  7216. # Quote the link command for shipping.
  7217. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  7218. relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  7219. if test "$hardcode_automatic" = yes ; then
  7220. relink_command=
  7221. fi
  7222. # Only create the output if not a dry run.
  7223. $opt_dry_run || {
  7224. for installed in no yes; do
  7225. if test "$installed" = yes; then
  7226. if test -z "$install_libdir"; then
  7227. break
  7228. fi
  7229. output="$output_objdir/$outputname"i
  7230. # Replace all uninstalled libtool libraries with the installed ones
  7231. newdependency_libs=
  7232. for deplib in $dependency_libs; do
  7233. case $deplib in
  7234. *.la)
  7235. func_basename "$deplib"
  7236. name="$func_basename_result"
  7237. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7238. test -z "$libdir" && \
  7239. func_fatal_error "\`$deplib' is not a valid libtool archive"
  7240. if test "x$EGREP" = x ; then
  7241. EGREP=egrep
  7242. fi
  7243. # We do not want portage's install root ($D) present. Check only for
  7244. # this if the .la is being installed.
  7245. if test "$installed" = yes && test "$D"; then
  7246. eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
  7247. else
  7248. mynewdependency_lib="$libdir/$name"
  7249. fi
  7250. # Do not add duplicates
  7251. if test "$mynewdependency_lib"; then
  7252. my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
  7253. if test -z "$my_little_ninja_foo_1"; then
  7254. newdependency_libs="$newdependency_libs $mynewdependency_lib"
  7255. fi
  7256. fi
  7257. ;;
  7258. *)
  7259. if test "$installed" = yes; then
  7260. # Rather use S=WORKDIR if our version of portage supports it.
  7261. # This is because some ebuild (gcc) do not use $S as buildroot.
  7262. if test "$PWORKDIR"; then
  7263. S="$PWORKDIR"
  7264. fi
  7265. # We do not want portage's build root ($S) present.
  7266. my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
  7267. # We do not want portage's install root ($D) present.
  7268. my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
  7269. if test -n "$my_little_ninja_foo_2" && test "$S"; then
  7270. mynewdependency_lib=""
  7271. elif test -n "$my_little_ninja_foo_3" && test "$D"; then
  7272. eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
  7273. else
  7274. mynewdependency_lib="$deplib"
  7275. fi
  7276. else
  7277. mynewdependency_lib="$deplib"
  7278. fi
  7279. # Do not add duplicates
  7280. if test "$mynewdependency_lib"; then
  7281. my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
  7282. if test -z "$my_little_ninja_foo_4"; then
  7283. newdependency_libs="$newdependency_libs $mynewdependency_lib"
  7284. fi
  7285. fi
  7286. ;;
  7287. esac
  7288. done
  7289. dependency_libs="$newdependency_libs"
  7290. newdlfiles=
  7291. for lib in $dlfiles; do
  7292. case $lib in
  7293. *.la)
  7294. func_basename "$lib"
  7295. name="$func_basename_result"
  7296. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  7297. test -z "$libdir" && \
  7298. func_fatal_error "\`$lib' is not a valid libtool archive"
  7299. newdlfiles="$newdlfiles $libdir/$name"
  7300. ;;
  7301. *) newdlfiles="$newdlfiles $lib" ;;
  7302. esac
  7303. done
  7304. dlfiles="$newdlfiles"
  7305. newdlprefiles=
  7306. for lib in $dlprefiles; do
  7307. case $lib in
  7308. *.la)
  7309. # Only pass preopened files to the pseudo-archive (for
  7310. # eventual linking with the app. that links it) if we
  7311. # didn't already link the preopened objects directly into
  7312. # the library:
  7313. func_basename "$lib"
  7314. name="$func_basename_result"
  7315. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  7316. test -z "$libdir" && \
  7317. func_fatal_error "\`$lib' is not a valid libtool archive"
  7318. newdlprefiles="$newdlprefiles $libdir/$name"
  7319. ;;
  7320. esac
  7321. done
  7322. dlprefiles="$newdlprefiles"
  7323. else
  7324. newdlfiles=
  7325. for lib in $dlfiles; do
  7326. case $lib in
  7327. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  7328. *) abs=`pwd`"/$lib" ;;
  7329. esac
  7330. newdlfiles="$newdlfiles $abs"
  7331. done
  7332. dlfiles="$newdlfiles"
  7333. newdlprefiles=
  7334. for lib in $dlprefiles; do
  7335. case $lib in
  7336. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  7337. *) abs=`pwd`"/$lib" ;;
  7338. esac
  7339. newdlprefiles="$newdlprefiles $abs"
  7340. done
  7341. dlprefiles="$newdlprefiles"
  7342. fi
  7343. $RM $output
  7344. # place dlname in correct position for cygwin
  7345. tdlname=$dlname
  7346. case $host,$output,$installed,$module,$dlname in
  7347. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  7348. esac
  7349. # Do not add duplicates
  7350. if test "$installed" = yes && test "$D"; then
  7351. install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
  7352. fi
  7353. $ECHO > $output "\
  7354. # $outputname - a libtool library file
  7355. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  7356. #
  7357. # Please DO NOT delete this file!
  7358. # It is necessary for linking the library.
  7359. # The name that we can dlopen(3).
  7360. dlname='$tdlname'
  7361. # Names of this library.
  7362. library_names='$library_names'
  7363. # The name of the static archive.
  7364. old_library='$old_library'
  7365. # Linker flags that can not go in dependency_libs.
  7366. inherited_linker_flags='$new_inherited_linker_flags'
  7367. # Libraries that this one depends upon.
  7368. dependency_libs='$dependency_libs'
  7369. # Names of additional weak libraries provided by this library
  7370. weak_library_names='$weak_libs'
  7371. # Version information for $libname.
  7372. current=$current
  7373. age=$age
  7374. revision=$revision
  7375. # Is this an already installed library?
  7376. installed=$installed
  7377. # Should we warn about portability when linking against -modules?
  7378. shouldnotlink=$module
  7379. # Files to dlopen/dlpreopen
  7380. dlopen='$dlfiles'
  7381. dlpreopen='$dlprefiles'
  7382. # Directory that this library needs to be installed in:
  7383. libdir='$install_libdir'"
  7384. if test "$installed" = no && test "$need_relink" = yes; then
  7385. $ECHO >> $output "\
  7386. relink_command=\"$relink_command\""
  7387. fi
  7388. done
  7389. }
  7390. # Do a symbolic link so that the libtool archive can be found in
  7391. # LD_LIBRARY_PATH before the program is installed.
  7392. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  7393. ;;
  7394. esac
  7395. exit $EXIT_SUCCESS
  7396. }
  7397. { test "$mode" = link || test "$mode" = relink; } &&
  7398. func_mode_link ${1+"$@"}
  7399. # func_mode_uninstall arg...
  7400. func_mode_uninstall ()
  7401. {
  7402. $opt_debug
  7403. RM="$nonopt"
  7404. files=
  7405. rmforce=
  7406. exit_status=0
  7407. # This variable tells wrapper scripts just to set variables rather
  7408. # than running their programs.
  7409. libtool_install_magic="$magic"
  7410. for arg
  7411. do
  7412. case $arg in
  7413. -f) RM="$RM $arg"; rmforce=yes ;;
  7414. -*) RM="$RM $arg" ;;
  7415. *) files="$files $arg" ;;
  7416. esac
  7417. done
  7418. test -z "$RM" && \
  7419. func_fatal_help "you must specify an RM program"
  7420. rmdirs=
  7421. origobjdir="$objdir"
  7422. for file in $files; do
  7423. func_dirname "$file" "" "."
  7424. dir="$func_dirname_result"
  7425. if test "X$dir" = X.; then
  7426. objdir="$origobjdir"
  7427. else
  7428. objdir="$dir/$origobjdir"
  7429. fi
  7430. func_basename "$file"
  7431. name="$func_basename_result"
  7432. test "$mode" = uninstall && objdir="$dir"
  7433. # Remember objdir for removal later, being careful to avoid duplicates
  7434. if test "$mode" = clean; then
  7435. case " $rmdirs " in
  7436. *" $objdir "*) ;;
  7437. *) rmdirs="$rmdirs $objdir" ;;
  7438. esac
  7439. fi
  7440. # Don't error if the file doesn't exist and rm -f was used.
  7441. if { test -L "$file"; } >/dev/null 2>&1 ||
  7442. { test -h "$file"; } >/dev/null 2>&1 ||
  7443. test -f "$file"; then
  7444. :
  7445. elif test -d "$file"; then
  7446. exit_status=1
  7447. continue
  7448. elif test "$rmforce" = yes; then
  7449. continue
  7450. fi
  7451. rmfiles="$file"
  7452. case $name in
  7453. *.la)
  7454. # Possibly a libtool archive, so verify it.
  7455. if func_lalib_p "$file"; then
  7456. func_source $dir/$name
  7457. # Delete the libtool libraries and symlinks.
  7458. for n in $library_names; do
  7459. rmfiles="$rmfiles $objdir/$n"
  7460. done
  7461. test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  7462. case "$mode" in
  7463. clean)
  7464. case " $library_names " in
  7465. # " " in the beginning catches empty $dlname
  7466. *" $dlname "*) ;;
  7467. *) rmfiles="$rmfiles $objdir/$dlname" ;;
  7468. esac
  7469. test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  7470. ;;
  7471. uninstall)
  7472. if test -n "$library_names"; then
  7473. # Do each command in the postuninstall commands.
  7474. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  7475. fi
  7476. if test -n "$old_library"; then
  7477. # Do each command in the old_postuninstall commands.
  7478. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  7479. fi
  7480. # FIXME: should reinstall the best remaining shared library.
  7481. ;;
  7482. esac
  7483. fi
  7484. ;;
  7485. *.lo)
  7486. # Possibly a libtool object, so verify it.
  7487. if func_lalib_p "$file"; then
  7488. # Read the .lo file
  7489. func_source $dir/$name
  7490. # Add PIC object to the list of files to remove.
  7491. if test -n "$pic_object" &&
  7492. test "$pic_object" != none; then
  7493. rmfiles="$rmfiles $dir/$pic_object"
  7494. fi
  7495. # Add non-PIC object to the list of files to remove.
  7496. if test -n "$non_pic_object" &&
  7497. test "$non_pic_object" != none; then
  7498. rmfiles="$rmfiles $dir/$non_pic_object"
  7499. fi
  7500. fi
  7501. ;;
  7502. *)
  7503. if test "$mode" = clean ; then
  7504. noexename=$name
  7505. case $file in
  7506. *.exe)
  7507. func_stripname '' '.exe' "$file"
  7508. file=$func_stripname_result
  7509. func_stripname '' '.exe' "$name"
  7510. noexename=$func_stripname_result
  7511. # $file with .exe has already been added to rmfiles,
  7512. # add $file without .exe
  7513. rmfiles="$rmfiles $file"
  7514. ;;
  7515. esac
  7516. # Do a test to see if this is a libtool program.
  7517. if func_ltwrapper_p "$file"; then
  7518. if func_ltwrapper_executable_p "$file"; then
  7519. func_ltwrapper_scriptname "$file"
  7520. relink_command=
  7521. func_source $func_ltwrapper_scriptname_result
  7522. rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
  7523. else
  7524. relink_command=
  7525. func_source $dir/$noexename
  7526. fi
  7527. # note $name still contains .exe if it was in $file originally
  7528. # as does the version of $file that was added into $rmfiles
  7529. rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  7530. if test "$fast_install" = yes && test -n "$relink_command"; then
  7531. rmfiles="$rmfiles $objdir/lt-$name"
  7532. fi
  7533. if test "X$noexename" != "X$name" ; then
  7534. rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  7535. fi
  7536. fi
  7537. fi
  7538. ;;
  7539. esac
  7540. func_show_eval "$RM $rmfiles" 'exit_status=1'
  7541. done
  7542. objdir="$origobjdir"
  7543. # Try to remove the ${objdir}s in the directories where we deleted files
  7544. for dir in $rmdirs; do
  7545. if test -d "$dir"; then
  7546. func_show_eval "rmdir $dir >/dev/null 2>&1"
  7547. fi
  7548. done
  7549. exit $exit_status
  7550. }
  7551. { test "$mode" = uninstall || test "$mode" = clean; } &&
  7552. func_mode_uninstall ${1+"$@"}
  7553. test -z "$mode" && {
  7554. help="$generic_help"
  7555. func_fatal_help "you must specify a MODE"
  7556. }
  7557. test -z "$exec_cmd" && \
  7558. func_fatal_help "invalid operation mode \`$mode'"
  7559. if test -n "$exec_cmd"; then
  7560. eval exec "$exec_cmd"
  7561. exit $EXIT_FAILURE
  7562. fi
  7563. exit $exit_status
  7564. # The TAGs below are defined such that we never get into a situation
  7565. # in which we disable both kinds of libraries. Given conflicting
  7566. # choices, we go for a static library, that is the most portable,
  7567. # since we can't tell whether shared libraries were disabled because
  7568. # the user asked for that or because the platform doesn't support
  7569. # them. This is particularly important on AIX, because we don't
  7570. # support having both static and shared libraries enabled at the same
  7571. # time on that platform, so we default to a shared-only configuration.
  7572. # If a disable-shared tag is given, we'll fallback to a static-only
  7573. # configuration. But we'll never go from static-only to shared-only.
  7574. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  7575. build_libtool_libs=no
  7576. build_old_libs=yes
  7577. # ### END LIBTOOL TAG CONFIG: disable-shared
  7578. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  7579. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  7580. # ### END LIBTOOL TAG CONFIG: disable-static
  7581. # Local Variables:
  7582. # mode:shell-script
  7583. # sh-indentation:2
  7584. # End:
  7585. # vi:sw=2