You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9661 lines
277 KiB

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