🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
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.

9648 lines
276 KiB

  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
  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
  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 returned 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 can'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 (including 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. ;;
  4501. *)
  4502. allow_undefined=yes
  4503. ;;
  4504. esac
  4505. libtool_args=$nonopt
  4506. base_compile="$nonopt $@"
  4507. compile_command=$nonopt
  4508. finalize_command=$nonopt
  4509. compile_rpath=
  4510. finalize_rpath=
  4511. compile_shlibpath=
  4512. finalize_shlibpath=
  4513. convenience=
  4514. old_convenience=
  4515. deplibs=
  4516. old_deplibs=
  4517. compiler_flags=
  4518. linker_flags=
  4519. dllsearchpath=
  4520. lib_search_path=`pwd`
  4521. inst_prefix_dir=
  4522. new_inherited_linker_flags=
  4523. avoid_version=no
  4524. bindir=
  4525. dlfiles=
  4526. dlprefiles=
  4527. dlself=no
  4528. export_dynamic=no
  4529. export_symbols=
  4530. export_symbols_regex=
  4531. generated=
  4532. libobjs=
  4533. ltlibs=
  4534. module=no
  4535. no_install=no
  4536. objs=
  4537. non_pic_objects=
  4538. precious_files_regex=
  4539. prefer_static_libs=no
  4540. preload=no
  4541. prev=
  4542. prevarg=
  4543. release=
  4544. rpath=
  4545. xrpath=
  4546. perm_rpath=
  4547. temp_rpath=
  4548. thread_safe=no
  4549. vinfo=
  4550. vinfo_number=no
  4551. weak_libs=
  4552. single_module="${wl}-single_module"
  4553. func_infer_tag $base_compile
  4554. # We need to know -static, to get the right output filenames.
  4555. for arg
  4556. do
  4557. case $arg in
  4558. -shared)
  4559. test "$build_libtool_libs" != yes && \
  4560. func_fatal_configuration "can not build a shared library"
  4561. build_old_libs=no
  4562. break
  4563. ;;
  4564. -all-static | -static | -static-libtool-libs)
  4565. case $arg in
  4566. -all-static)
  4567. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  4568. func_warning "complete static linking is impossible in this configuration"
  4569. fi
  4570. if test -n "$link_static_flag"; then
  4571. dlopen_self=$dlopen_self_static
  4572. fi
  4573. prefer_static_libs=yes
  4574. ;;
  4575. -static)
  4576. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  4577. dlopen_self=$dlopen_self_static
  4578. fi
  4579. prefer_static_libs=built
  4580. ;;
  4581. -static-libtool-libs)
  4582. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  4583. dlopen_self=$dlopen_self_static
  4584. fi
  4585. prefer_static_libs=yes
  4586. ;;
  4587. esac
  4588. build_libtool_libs=no
  4589. build_old_libs=yes
  4590. break
  4591. ;;
  4592. esac
  4593. done
  4594. # See if our shared archives depend on static archives.
  4595. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  4596. # Go through the arguments, transforming them on the way.
  4597. while test "$#" -gt 0; do
  4598. arg="$1"
  4599. shift
  4600. func_quote_for_eval "$arg"
  4601. qarg=$func_quote_for_eval_unquoted_result
  4602. func_append libtool_args " $func_quote_for_eval_result"
  4603. # If the previous option needs an argument, assign it.
  4604. if test -n "$prev"; then
  4605. case $prev in
  4606. output)
  4607. func_append compile_command " @OUTPUT@"
  4608. func_append finalize_command " @OUTPUT@"
  4609. ;;
  4610. esac
  4611. case $prev in
  4612. bindir)
  4613. bindir="$arg"
  4614. prev=
  4615. continue
  4616. ;;
  4617. dlfiles|dlprefiles)
  4618. if test "$preload" = no; then
  4619. # Add the symbol object into the linking commands.
  4620. func_append compile_command " @SYMFILE@"
  4621. func_append finalize_command " @SYMFILE@"
  4622. preload=yes
  4623. fi
  4624. case $arg in
  4625. *.la | *.lo) ;; # We handle these cases below.
  4626. force)
  4627. if test "$dlself" = no; then
  4628. dlself=needless
  4629. export_dynamic=yes
  4630. fi
  4631. prev=
  4632. continue
  4633. ;;
  4634. self)
  4635. if test "$prev" = dlprefiles; then
  4636. dlself=yes
  4637. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  4638. dlself=yes
  4639. else
  4640. dlself=needless
  4641. export_dynamic=yes
  4642. fi
  4643. prev=
  4644. continue
  4645. ;;
  4646. *)
  4647. if test "$prev" = dlfiles; then
  4648. func_append dlfiles " $arg"
  4649. else
  4650. func_append dlprefiles " $arg"
  4651. fi
  4652. prev=
  4653. continue
  4654. ;;
  4655. esac
  4656. ;;
  4657. expsyms)
  4658. export_symbols="$arg"
  4659. test -f "$arg" \
  4660. || func_fatal_error "symbol file \`$arg' does not exist"
  4661. prev=
  4662. continue
  4663. ;;
  4664. expsyms_regex)
  4665. export_symbols_regex="$arg"
  4666. prev=
  4667. continue
  4668. ;;
  4669. framework)
  4670. case $host in
  4671. *-*-darwin*)
  4672. case "$deplibs " in
  4673. *" $qarg.ltframework "*) ;;
  4674. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  4675. ;;
  4676. esac
  4677. ;;
  4678. esac
  4679. prev=
  4680. continue
  4681. ;;
  4682. inst_prefix)
  4683. inst_prefix_dir="$arg"
  4684. prev=
  4685. continue
  4686. ;;
  4687. objectlist)
  4688. if test -f "$arg"; then
  4689. save_arg=$arg
  4690. moreargs=
  4691. for fil in `cat "$save_arg"`
  4692. do
  4693. # func_append moreargs " $fil"
  4694. arg=$fil
  4695. # A libtool-controlled object.
  4696. # Check to see that this really is a libtool object.
  4697. if func_lalib_unsafe_p "$arg"; then
  4698. pic_object=
  4699. non_pic_object=
  4700. # Read the .lo file
  4701. func_source "$arg"
  4702. if test -z "$pic_object" ||
  4703. test -z "$non_pic_object" ||
  4704. test "$pic_object" = none &&
  4705. test "$non_pic_object" = none; then
  4706. func_fatal_error "cannot find name of object for \`$arg'"
  4707. fi
  4708. # Extract subdirectory from the argument.
  4709. func_dirname "$arg" "/" ""
  4710. xdir="$func_dirname_result"
  4711. if test "$pic_object" != none; then
  4712. # Prepend the subdirectory the object is found in.
  4713. pic_object="$xdir$pic_object"
  4714. if test "$prev" = dlfiles; then
  4715. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  4716. func_append dlfiles " $pic_object"
  4717. prev=
  4718. continue
  4719. else
  4720. # If libtool objects are unsupported, then we need to preload.
  4721. prev=dlprefiles
  4722. fi
  4723. fi
  4724. # CHECK ME: I think I busted this. -Ossama
  4725. if test "$prev" = dlprefiles; then
  4726. # Preload the old-style object.
  4727. func_append dlprefiles " $pic_object"
  4728. prev=
  4729. fi
  4730. # A PIC object.
  4731. func_append libobjs " $pic_object"
  4732. arg="$pic_object"
  4733. fi
  4734. # Non-PIC object.
  4735. if test "$non_pic_object" != none; then
  4736. # Prepend the subdirectory the object is found in.
  4737. non_pic_object="$xdir$non_pic_object"
  4738. # A standard non-PIC object
  4739. func_append non_pic_objects " $non_pic_object"
  4740. if test -z "$pic_object" || test "$pic_object" = none ; then
  4741. arg="$non_pic_object"
  4742. fi
  4743. else
  4744. # If the PIC object exists, use it instead.
  4745. # $xdir was prepended to $pic_object above.
  4746. non_pic_object="$pic_object"
  4747. func_append non_pic_objects " $non_pic_object"
  4748. fi
  4749. else
  4750. # Only an error if not doing a dry-run.
  4751. if $opt_dry_run; then
  4752. # Extract subdirectory from the argument.
  4753. func_dirname "$arg" "/" ""
  4754. xdir="$func_dirname_result"
  4755. func_lo2o "$arg"
  4756. pic_object=$xdir$objdir/$func_lo2o_result
  4757. non_pic_object=$xdir$func_lo2o_result
  4758. func_append libobjs " $pic_object"
  4759. func_append non_pic_objects " $non_pic_object"
  4760. else
  4761. func_fatal_error "\`$arg' is not a valid libtool object"
  4762. fi
  4763. fi
  4764. done
  4765. else
  4766. func_fatal_error "link input file \`$arg' does not exist"
  4767. fi
  4768. arg=$save_arg
  4769. prev=
  4770. continue
  4771. ;;
  4772. precious_regex)
  4773. precious_files_regex="$arg"
  4774. prev=
  4775. continue
  4776. ;;
  4777. release)
  4778. release="-$arg"
  4779. prev=
  4780. continue
  4781. ;;
  4782. rpath | xrpath)
  4783. # We need an absolute path.
  4784. case $arg in
  4785. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4786. *)
  4787. func_fatal_error "only absolute run-paths are allowed"
  4788. ;;
  4789. esac
  4790. if test "$prev" = rpath; then
  4791. case "$rpath " in
  4792. *" $arg "*) ;;
  4793. *) func_append rpath " $arg" ;;
  4794. esac
  4795. else
  4796. case "$xrpath " in
  4797. *" $arg "*) ;;
  4798. *) func_append xrpath " $arg" ;;
  4799. esac
  4800. fi
  4801. prev=
  4802. continue
  4803. ;;
  4804. shrext)
  4805. shrext_cmds="$arg"
  4806. prev=
  4807. continue
  4808. ;;
  4809. weak)
  4810. func_append weak_libs " $arg"
  4811. prev=
  4812. continue
  4813. ;;
  4814. xcclinker)
  4815. func_append linker_flags " $qarg"
  4816. func_append compiler_flags " $qarg"
  4817. prev=
  4818. func_append compile_command " $qarg"
  4819. func_append finalize_command " $qarg"
  4820. continue
  4821. ;;
  4822. xcompiler)
  4823. func_append compiler_flags " $qarg"
  4824. prev=
  4825. func_append compile_command " $qarg"
  4826. func_append finalize_command " $qarg"
  4827. continue
  4828. ;;
  4829. xlinker)
  4830. func_append linker_flags " $qarg"
  4831. func_append compiler_flags " $wl$qarg"
  4832. prev=
  4833. func_append compile_command " $wl$qarg"
  4834. func_append finalize_command " $wl$qarg"
  4835. continue
  4836. ;;
  4837. *)
  4838. eval "$prev=\"\$arg\""
  4839. prev=
  4840. continue
  4841. ;;
  4842. esac
  4843. fi # test -n "$prev"
  4844. prevarg="$arg"
  4845. case $arg in
  4846. -all-static)
  4847. if test -n "$link_static_flag"; then
  4848. # See comment for -static flag below, for more details.
  4849. func_append compile_command " $link_static_flag"
  4850. func_append finalize_command " $link_static_flag"
  4851. fi
  4852. continue
  4853. ;;
  4854. -allow-undefined)
  4855. # FIXME: remove this flag sometime in the future.
  4856. func_fatal_error "\`-allow-undefined' must not be used because it is the default"
  4857. ;;
  4858. -avoid-version)
  4859. avoid_version=yes
  4860. continue
  4861. ;;
  4862. -bindir)
  4863. prev=bindir
  4864. continue
  4865. ;;
  4866. -dlopen)
  4867. prev=dlfiles
  4868. continue
  4869. ;;
  4870. -dlpreopen)
  4871. prev=dlprefiles
  4872. continue
  4873. ;;
  4874. -export-dynamic)
  4875. export_dynamic=yes
  4876. continue
  4877. ;;
  4878. -export-symbols | -export-symbols-regex)
  4879. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  4880. func_fatal_error "more than one -exported-symbols argument is not allowed"
  4881. fi
  4882. if test "X$arg" = "X-export-symbols"; then
  4883. prev=expsyms
  4884. else
  4885. prev=expsyms_regex
  4886. fi
  4887. continue
  4888. ;;
  4889. -framework)
  4890. prev=framework
  4891. continue
  4892. ;;
  4893. -inst-prefix-dir)
  4894. prev=inst_prefix
  4895. continue
  4896. ;;
  4897. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  4898. # so, if we see these flags be careful not to treat them like -L
  4899. -L[A-Z][A-Z]*:*)
  4900. case $with_gcc/$host in
  4901. no/*-*-irix* | /*-*-irix*)
  4902. func_append compile_command " $arg"
  4903. func_append finalize_command " $arg"
  4904. ;;
  4905. esac
  4906. continue
  4907. ;;
  4908. -L*)
  4909. func_stripname "-L" '' "$arg"
  4910. if test -z "$func_stripname_result"; then
  4911. if test "$#" -gt 0; then
  4912. func_fatal_error "require no space between \`-L' and \`$1'"
  4913. else
  4914. func_fatal_error "need path for \`-L' option"
  4915. fi
  4916. fi
  4917. func_resolve_sysroot "$func_stripname_result"
  4918. dir=$func_resolve_sysroot_result
  4919. # We need an absolute path.
  4920. case $dir in
  4921. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4922. *)
  4923. absdir=`cd "$dir" && pwd`
  4924. test -z "$absdir" && \
  4925. func_fatal_error "cannot determine absolute directory name of \`$dir'"
  4926. dir="$absdir"
  4927. ;;
  4928. esac
  4929. case "$deplibs " in
  4930. *" -L$dir "* | *" $arg "*)
  4931. # Will only happen for absolute or sysroot arguments
  4932. ;;
  4933. *)
  4934. # Preserve sysroot, but never include relative directories
  4935. case $dir in
  4936. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  4937. *) func_append deplibs " -L$dir" ;;
  4938. esac
  4939. func_append lib_search_path " $dir"
  4940. ;;
  4941. esac
  4942. case $host in
  4943. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  4944. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  4945. case :$dllsearchpath: in
  4946. *":$dir:"*) ;;
  4947. ::) dllsearchpath=$dir;;
  4948. *) func_append dllsearchpath ":$dir";;
  4949. esac
  4950. case :$dllsearchpath: in
  4951. *":$testbindir:"*) ;;
  4952. ::) dllsearchpath=$testbindir;;
  4953. *) func_append dllsearchpath ":$testbindir";;
  4954. esac
  4955. ;;
  4956. esac
  4957. continue
  4958. ;;
  4959. -l*)
  4960. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  4961. case $host in
  4962. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  4963. # These systems don't actually have a C or math library (as such)
  4964. continue
  4965. ;;
  4966. *-*-os2*)
  4967. # These systems don't actually have a C library (as such)
  4968. test "X$arg" = "X-lc" && continue
  4969. ;;
  4970. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4971. # Do not include libc due to us having libc/libc_r.
  4972. test "X$arg" = "X-lc" && continue
  4973. ;;
  4974. *-*-rhapsody* | *-*-darwin1.[012])
  4975. # Rhapsody C and math libraries are in the System framework
  4976. func_append deplibs " System.ltframework"
  4977. continue
  4978. ;;
  4979. *-*-sco3.2v5* | *-*-sco5v6*)
  4980. # Causes problems with __ctype
  4981. test "X$arg" = "X-lc" && continue
  4982. ;;
  4983. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  4984. # Compiler inserts libc in the correct place for threads to work
  4985. test "X$arg" = "X-lc" && continue
  4986. ;;
  4987. esac
  4988. elif test "X$arg" = "X-lc_r"; then
  4989. case $host in
  4990. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4991. # Do not include libc_r directly, use -pthread flag.
  4992. continue
  4993. ;;
  4994. esac
  4995. fi
  4996. func_append deplibs " $arg"
  4997. continue
  4998. ;;
  4999. -module)
  5000. module=yes
  5001. continue
  5002. ;;
  5003. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  5004. # classes, name mangling, and exception handling.
  5005. # Darwin uses the -arch flag to determine output architecture.
  5006. -model|-arch|-isysroot|--sysroot)
  5007. func_append compiler_flags " $arg"
  5008. func_append compile_command " $arg"
  5009. func_append finalize_command " $arg"
  5010. prev=xcompiler
  5011. continue
  5012. ;;
  5013. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  5014. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  5015. func_append compiler_flags " $arg"
  5016. func_append compile_command " $arg"
  5017. func_append finalize_command " $arg"
  5018. case "$new_inherited_linker_flags " in
  5019. *" $arg "*) ;;
  5020. * ) func_append new_inherited_linker_flags " $arg" ;;
  5021. esac
  5022. continue
  5023. ;;
  5024. -multi_module)
  5025. single_module="${wl}-multi_module"
  5026. continue
  5027. ;;
  5028. -no-fast-install)
  5029. fast_install=no
  5030. continue
  5031. ;;
  5032. -no-install)
  5033. case $host in
  5034. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  5035. # The PATH hackery in wrapper scripts is required on Windows
  5036. # and Darwin in order for the loader to find any dlls it needs.
  5037. func_warning "\`-no-install' is ignored for $host"
  5038. func_warning "assuming \`-no-fast-install' instead"
  5039. fast_install=no
  5040. ;;
  5041. *) no_install=yes ;;
  5042. esac
  5043. continue
  5044. ;;
  5045. -no-undefined)
  5046. allow_undefined=no
  5047. continue
  5048. ;;
  5049. -objectlist)
  5050. prev=objectlist
  5051. continue
  5052. ;;
  5053. -o) prev=output ;;
  5054. -precious-files-regex)
  5055. prev=precious_regex
  5056. continue
  5057. ;;
  5058. -release)
  5059. prev=release
  5060. continue
  5061. ;;
  5062. -rpath)
  5063. prev=rpath
  5064. continue
  5065. ;;
  5066. -R)
  5067. prev=xrpath
  5068. continue
  5069. ;;
  5070. -R*)
  5071. func_stripname '-R' '' "$arg"
  5072. dir=$func_stripname_result
  5073. # We need an absolute path.
  5074. case $dir in
  5075. [\\/]* | [A-Za-z]:[\\/]*) ;;
  5076. =*)
  5077. func_stripname '=' '' "$dir"
  5078. dir=$lt_sysroot$func_stripname_result
  5079. ;;
  5080. *)
  5081. func_fatal_error "only absolute run-paths are allowed"
  5082. ;;
  5083. esac
  5084. case "$xrpath " in
  5085. *" $dir "*) ;;
  5086. *) func_append xrpath " $dir" ;;
  5087. esac
  5088. continue
  5089. ;;
  5090. -shared)
  5091. # The effects of -shared are defined in a previous loop.
  5092. continue
  5093. ;;
  5094. -shrext)
  5095. prev=shrext
  5096. continue
  5097. ;;
  5098. -static | -static-libtool-libs)
  5099. # The effects of -static are defined in a previous loop.
  5100. # We used to do the same as -all-static on platforms that
  5101. # didn't have a PIC flag, but the assumption that the effects
  5102. # would be equivalent was wrong. It would break on at least
  5103. # Digital Unix and AIX.
  5104. continue
  5105. ;;
  5106. -thread-safe)
  5107. thread_safe=yes
  5108. continue
  5109. ;;
  5110. -version-info)
  5111. prev=vinfo
  5112. continue
  5113. ;;
  5114. -version-number)
  5115. prev=vinfo
  5116. vinfo_number=yes
  5117. continue
  5118. ;;
  5119. -weak)
  5120. prev=weak
  5121. continue
  5122. ;;
  5123. -Wc,*)
  5124. func_stripname '-Wc,' '' "$arg"
  5125. args=$func_stripname_result
  5126. arg=
  5127. save_ifs="$IFS"; IFS=','
  5128. for flag in $args; do
  5129. IFS="$save_ifs"
  5130. func_quote_for_eval "$flag"
  5131. func_append arg " $func_quote_for_eval_result"
  5132. func_append compiler_flags " $func_quote_for_eval_result"
  5133. done
  5134. IFS="$save_ifs"
  5135. func_stripname ' ' '' "$arg"
  5136. arg=$func_stripname_result
  5137. ;;
  5138. -Wl,*)
  5139. func_stripname '-Wl,' '' "$arg"
  5140. args=$func_stripname_result
  5141. arg=
  5142. save_ifs="$IFS"; IFS=','
  5143. for flag in $args; do
  5144. IFS="$save_ifs"
  5145. func_quote_for_eval "$flag"
  5146. func_append arg " $wl$func_quote_for_eval_result"
  5147. func_append compiler_flags " $wl$func_quote_for_eval_result"
  5148. func_append linker_flags " $func_quote_for_eval_result"
  5149. done
  5150. IFS="$save_ifs"
  5151. func_stripname ' ' '' "$arg"
  5152. arg=$func_stripname_result
  5153. ;;
  5154. -Xcompiler)
  5155. prev=xcompiler
  5156. continue
  5157. ;;
  5158. -Xlinker)
  5159. prev=xlinker
  5160. continue
  5161. ;;
  5162. -XCClinker)
  5163. prev=xcclinker
  5164. continue
  5165. ;;
  5166. # -msg_* for osf cc
  5167. -msg_*)
  5168. func_quote_for_eval "$arg"
  5169. arg="$func_quote_for_eval_result"
  5170. ;;
  5171. # Flags to be passed through unchanged, with rationale:
  5172. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  5173. # -r[0-9][0-9]* specify processor for the SGI compiler
  5174. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  5175. # +DA*, +DD* enable 64-bit mode for the HP compiler
  5176. # -q* compiler args for the IBM compiler
  5177. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  5178. # -F/path path to uninstalled frameworks, gcc on darwin
  5179. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  5180. # @file GCC response files
  5181. # -tp=* Portland pgcc target processor selection
  5182. # --sysroot=* for sysroot support
  5183. # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  5184. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  5185. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  5186. -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
  5187. func_quote_for_eval "$arg"
  5188. arg="$func_quote_for_eval_result"
  5189. func_append compile_command " $arg"
  5190. func_append finalize_command " $arg"
  5191. func_append compiler_flags " $arg"
  5192. continue
  5193. ;;
  5194. # Some other compiler flag.
  5195. -* | +*)
  5196. func_quote_for_eval "$arg"
  5197. arg="$func_quote_for_eval_result"
  5198. ;;
  5199. *.$objext)
  5200. # A standard object.
  5201. func_append objs " $arg"
  5202. ;;
  5203. *.lo)
  5204. # A libtool-controlled object.
  5205. # Check to see that this really is a libtool object.
  5206. if func_lalib_unsafe_p "$arg"; then
  5207. pic_object=
  5208. non_pic_object=
  5209. # Read the .lo file
  5210. func_source "$arg"
  5211. if test -z "$pic_object" ||
  5212. test -z "$non_pic_object" ||
  5213. test "$pic_object" = none &&
  5214. test "$non_pic_object" = none; then
  5215. func_fatal_error "cannot find name of object for \`$arg'"
  5216. fi
  5217. # Extract subdirectory from the argument.
  5218. func_dirname "$arg" "/" ""
  5219. xdir="$func_dirname_result"
  5220. if test "$pic_object" != none; then
  5221. # Prepend the subdirectory the object is found in.
  5222. pic_object="$xdir$pic_object"
  5223. if test "$prev" = dlfiles; then
  5224. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  5225. func_append dlfiles " $pic_object"
  5226. prev=
  5227. continue
  5228. else
  5229. # If libtool objects are unsupported, then we need to preload.
  5230. prev=dlprefiles
  5231. fi
  5232. fi
  5233. # CHECK ME: I think I busted this. -Ossama
  5234. if test "$prev" = dlprefiles; then
  5235. # Preload the old-style object.
  5236. func_append dlprefiles " $pic_object"
  5237. prev=
  5238. fi
  5239. # A PIC object.
  5240. func_append libobjs " $pic_object"
  5241. arg="$pic_object"
  5242. fi
  5243. # Non-PIC object.
  5244. if test "$non_pic_object" != none; then
  5245. # Prepend the subdirectory the object is found in.
  5246. non_pic_object="$xdir$non_pic_object"
  5247. # A standard non-PIC object
  5248. func_append non_pic_objects " $non_pic_object"
  5249. if test -z "$pic_object" || test "$pic_object" = none ; then
  5250. arg="$non_pic_object"
  5251. fi
  5252. else
  5253. # If the PIC object exists, use it instead.
  5254. # $xdir was prepended to $pic_object above.
  5255. non_pic_object="$pic_object"
  5256. func_append non_pic_objects " $non_pic_object"
  5257. fi
  5258. else
  5259. # Only an error if not doing a dry-run.
  5260. if $opt_dry_run; then
  5261. # Extract subdirectory from the argument.
  5262. func_dirname "$arg" "/" ""
  5263. xdir="$func_dirname_result"
  5264. func_lo2o "$arg"
  5265. pic_object=$xdir$objdir/$func_lo2o_result
  5266. non_pic_object=$xdir$func_lo2o_result
  5267. func_append libobjs " $pic_object"
  5268. func_append non_pic_objects " $non_pic_object"
  5269. else
  5270. func_fatal_error "\`$arg' is not a valid libtool object"
  5271. fi
  5272. fi
  5273. ;;
  5274. *.$libext)
  5275. # An archive.
  5276. func_append deplibs " $arg"
  5277. func_append old_deplibs " $arg"
  5278. continue
  5279. ;;
  5280. *.la)
  5281. # A libtool-controlled library.
  5282. func_resolve_sysroot "$arg"
  5283. if test "$prev" = dlfiles; then
  5284. # This library was specified with -dlopen.
  5285. func_append dlfiles " $func_resolve_sysroot_result"
  5286. prev=
  5287. elif test "$prev" = dlprefiles; then
  5288. # The library was specified with -dlpreopen.
  5289. func_append dlprefiles " $func_resolve_sysroot_result"
  5290. prev=
  5291. else
  5292. func_append deplibs " $func_resolve_sysroot_result"
  5293. fi
  5294. continue
  5295. ;;
  5296. # Some other compiler argument.
  5297. *)
  5298. # Unknown arguments in both finalize_command and compile_command need
  5299. # to be aesthetically quoted because they are evaled later.
  5300. func_quote_for_eval "$arg"
  5301. arg="$func_quote_for_eval_result"
  5302. ;;
  5303. esac # arg
  5304. # Now actually substitute the argument into the commands.
  5305. if test -n "$arg"; then
  5306. func_append compile_command " $arg"
  5307. func_append finalize_command " $arg"
  5308. fi
  5309. done # argument parsing loop
  5310. test -n "$prev" && \
  5311. func_fatal_help "the \`$prevarg' option requires an argument"
  5312. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  5313. eval arg=\"$export_dynamic_flag_spec\"
  5314. func_append compile_command " $arg"
  5315. func_append finalize_command " $arg"
  5316. fi
  5317. oldlibs=
  5318. # calculate the name of the file, without its directory
  5319. func_basename "$output"
  5320. outputname="$func_basename_result"
  5321. libobjs_save="$libobjs"
  5322. if test -n "$shlibpath_var"; then
  5323. # get the directories listed in $shlibpath_var
  5324. eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
  5325. else
  5326. shlib_search_path=
  5327. fi
  5328. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  5329. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  5330. func_dirname "$output" "/" ""
  5331. output_objdir="$func_dirname_result$objdir"
  5332. func_to_tool_file "$output_objdir/"
  5333. tool_output_objdir=$func_to_tool_file_result
  5334. # Create the object directory.
  5335. func_mkdir_p "$output_objdir"
  5336. # Determine the type of output
  5337. case $output in
  5338. "")
  5339. func_fatal_help "you must specify an output file"
  5340. ;;
  5341. *.$libext) linkmode=oldlib ;;
  5342. *.lo | *.$objext) linkmode=obj ;;
  5343. *.la) linkmode=lib ;;
  5344. *) linkmode=prog ;; # Anything else should be a program.
  5345. esac
  5346. specialdeplibs=
  5347. libs=
  5348. # Find all interdependent deplibs by searching for libraries
  5349. # that are linked more than once (e.g. -la -lb -la)
  5350. for deplib in $deplibs; do
  5351. if $opt_preserve_dup_deps ; then
  5352. case "$libs " in
  5353. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  5354. esac
  5355. fi
  5356. func_append libs " $deplib"
  5357. done
  5358. if test "$linkmode" = lib; then
  5359. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  5360. # Compute libraries that are listed more than once in $predeps
  5361. # $postdeps and mark them as special (i.e., whose duplicates are
  5362. # not to be eliminated).
  5363. pre_post_deps=
  5364. if $opt_duplicate_compiler_generated_deps; then
  5365. for pre_post_dep in $predeps $postdeps; do
  5366. case "$pre_post_deps " in
  5367. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  5368. esac
  5369. func_append pre_post_deps " $pre_post_dep"
  5370. done
  5371. fi
  5372. pre_post_deps=
  5373. fi
  5374. deplibs=
  5375. newdependency_libs=
  5376. newlib_search_path=
  5377. need_relink=no # whether we're linking any uninstalled libtool libraries
  5378. notinst_deplibs= # not-installed libtool libraries
  5379. notinst_path= # paths that contain not-installed libtool libraries
  5380. case $linkmode in
  5381. lib)
  5382. passes="conv dlpreopen link"
  5383. for file in $dlfiles $dlprefiles; do
  5384. case $file in
  5385. *.la) ;;
  5386. *)
  5387. func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
  5388. ;;
  5389. esac
  5390. done
  5391. ;;
  5392. prog)
  5393. compile_deplibs=
  5394. finalize_deplibs=
  5395. alldeplibs=no
  5396. newdlfiles=
  5397. newdlprefiles=
  5398. passes="conv scan dlopen dlpreopen link"
  5399. ;;
  5400. *) passes="conv"
  5401. ;;
  5402. esac
  5403. for pass in $passes; do
  5404. # The preopen pass in lib mode reverses $deplibs; put it back here
  5405. # so that -L comes before libs that need it for instance...
  5406. if test "$linkmode,$pass" = "lib,link"; then
  5407. ## FIXME: Find the place where the list is rebuilt in the wrong
  5408. ## order, and fix it there properly
  5409. tmp_deplibs=
  5410. for deplib in $deplibs; do
  5411. tmp_deplibs="$deplib $tmp_deplibs"
  5412. done
  5413. deplibs="$tmp_deplibs"
  5414. fi
  5415. if test "$linkmode,$pass" = "lib,link" ||
  5416. test "$linkmode,$pass" = "prog,scan"; then
  5417. libs="$deplibs"
  5418. deplibs=
  5419. fi
  5420. if test "$linkmode" = prog; then
  5421. case $pass in
  5422. dlopen) libs="$dlfiles" ;;
  5423. dlpreopen) libs="$dlprefiles" ;;
  5424. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  5425. esac
  5426. fi
  5427. if test "$linkmode,$pass" = "lib,dlpreopen"; then
  5428. # Collect and forward deplibs of preopened libtool libs
  5429. for lib in $dlprefiles; do
  5430. # Ignore non-libtool-libs
  5431. dependency_libs=
  5432. func_resolve_sysroot "$lib"
  5433. case $lib in
  5434. *.la) func_source "$func_resolve_sysroot_result" ;;
  5435. esac
  5436. # Collect preopened libtool deplibs, except any this library
  5437. # has declared as weak libs
  5438. for deplib in $dependency_libs; do
  5439. func_basename "$deplib"
  5440. deplib_base=$func_basename_result
  5441. case " $weak_libs " in
  5442. *" $deplib_base "*) ;;
  5443. *) func_append deplibs " $deplib" ;;
  5444. esac
  5445. done
  5446. done
  5447. libs="$dlprefiles"
  5448. fi
  5449. if test "$pass" = dlopen; then
  5450. # Collect dlpreopened libraries
  5451. save_deplibs="$deplibs"
  5452. deplibs=
  5453. fi
  5454. for deplib in $libs; do
  5455. lib=
  5456. found=no
  5457. case $deplib in
  5458. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  5459. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  5460. if test "$linkmode,$pass" = "prog,link"; then
  5461. compile_deplibs="$deplib $compile_deplibs"
  5462. finalize_deplibs="$deplib $finalize_deplibs"
  5463. else
  5464. func_append compiler_flags " $deplib"
  5465. if test "$linkmode" = lib ; then
  5466. case "$new_inherited_linker_flags " in
  5467. *" $deplib "*) ;;
  5468. * ) func_append new_inherited_linker_flags " $deplib" ;;
  5469. esac
  5470. fi
  5471. fi
  5472. continue
  5473. ;;
  5474. -l*)
  5475. if test "$linkmode" != lib && test "$linkmode" != prog; then
  5476. func_warning "\`-l' is ignored for archives/objects"
  5477. continue
  5478. fi
  5479. func_stripname '-l' '' "$deplib"
  5480. name=$func_stripname_result
  5481. if test "$linkmode" = lib; then
  5482. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  5483. else
  5484. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  5485. fi
  5486. for searchdir in $searchdirs; do
  5487. for search_ext in .la $std_shrext .so .a; do
  5488. # Search the libtool library
  5489. lib="$searchdir/lib${name}${search_ext}"
  5490. if test -f "$lib"; then
  5491. if test "$search_ext" = ".la"; then
  5492. found=yes
  5493. else
  5494. found=no
  5495. fi
  5496. break 2
  5497. fi
  5498. done
  5499. done
  5500. if test "$found" != yes; then
  5501. # deplib doesn't seem to be a libtool library
  5502. if test "$linkmode,$pass" = "prog,link"; then
  5503. compile_deplibs="$deplib $compile_deplibs"
  5504. finalize_deplibs="$deplib $finalize_deplibs"
  5505. else
  5506. deplibs="$deplib $deplibs"
  5507. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  5508. fi
  5509. continue
  5510. else # deplib is a libtool library
  5511. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  5512. # We need to do some special things here, and not later.
  5513. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  5514. case " $predeps $postdeps " in
  5515. *" $deplib "*)
  5516. if func_lalib_p "$lib"; then
  5517. library_names=
  5518. old_library=
  5519. func_source "$lib"
  5520. for l in $old_library $library_names; do
  5521. ll="$l"
  5522. done
  5523. if test "X$ll" = "X$old_library" ; then # only static version available
  5524. found=no
  5525. func_dirname "$lib" "" "."
  5526. ladir="$func_dirname_result"
  5527. lib=$ladir/$old_library
  5528. if test "$linkmode,$pass" = "prog,link"; then
  5529. compile_deplibs="$deplib $compile_deplibs"
  5530. finalize_deplibs="$deplib $finalize_deplibs"
  5531. else
  5532. deplibs="$deplib $deplibs"
  5533. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  5534. fi
  5535. continue
  5536. fi
  5537. fi
  5538. ;;
  5539. *) ;;
  5540. esac
  5541. fi
  5542. fi
  5543. ;; # -l
  5544. *.ltframework)
  5545. if test "$linkmode,$pass" = "prog,link"; then
  5546. compile_deplibs="$deplib $compile_deplibs"
  5547. finalize_deplibs="$deplib $finalize_deplibs"
  5548. else
  5549. deplibs="$deplib $deplibs"
  5550. if test "$linkmode" = lib ; then
  5551. case "$new_inherited_linker_flags " in
  5552. *" $deplib "*) ;;
  5553. * ) func_append new_inherited_linker_flags " $deplib" ;;
  5554. esac
  5555. fi
  5556. fi
  5557. continue
  5558. ;;
  5559. -L*)
  5560. case $linkmode in
  5561. lib)
  5562. deplibs="$deplib $deplibs"
  5563. test "$pass" = conv && continue
  5564. newdependency_libs="$deplib $newdependency_libs"
  5565. func_stripname '-L' '' "$deplib"
  5566. func_resolve_sysroot "$func_stripname_result"
  5567. func_append newlib_search_path " $func_resolve_sysroot_result"
  5568. ;;
  5569. prog)
  5570. if test "$pass" = conv; then
  5571. deplibs="$deplib $deplibs"
  5572. continue
  5573. fi
  5574. if test "$pass" = scan; then
  5575. deplibs="$deplib $deplibs"
  5576. else
  5577. compile_deplibs="$deplib $compile_deplibs"
  5578. finalize_deplibs="$deplib $finalize_deplibs"
  5579. fi
  5580. func_stripname '-L' '' "$deplib"
  5581. func_resolve_sysroot "$func_stripname_result"
  5582. func_append newlib_search_path " $func_resolve_sysroot_result"
  5583. ;;
  5584. *)
  5585. func_warning "\`-L' is ignored for archives/objects"
  5586. ;;
  5587. esac # linkmode
  5588. continue
  5589. ;; # -L
  5590. -R*)
  5591. if test "$pass" = link; then
  5592. func_stripname '-R' '' "$deplib"
  5593. func_resolve_sysroot "$func_stripname_result"
  5594. dir=$func_resolve_sysroot_result
  5595. # Make sure the xrpath contains only unique directories.
  5596. case "$xrpath " in
  5597. *" $dir "*) ;;
  5598. *) func_append xrpath " $dir" ;;
  5599. esac
  5600. fi
  5601. deplibs="$deplib $deplibs"
  5602. continue
  5603. ;;
  5604. *.la)
  5605. func_resolve_sysroot "$deplib"
  5606. lib=$func_resolve_sysroot_result
  5607. ;;
  5608. *.$libext)
  5609. if test "$pass" = conv; then
  5610. deplibs="$deplib $deplibs"
  5611. continue
  5612. fi
  5613. case $linkmode in
  5614. lib)
  5615. # Linking convenience modules into shared libraries is allowed,
  5616. # but linking other static libraries is non-portable.
  5617. case " $dlpreconveniencelibs " in
  5618. *" $deplib "*) ;;
  5619. *)
  5620. valid_a_lib=no
  5621. case $deplibs_check_method in
  5622. match_pattern*)
  5623. set dummy $deplibs_check_method; shift
  5624. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  5625. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  5626. | $EGREP "$match_pattern_regex" > /dev/null; then
  5627. valid_a_lib=yes
  5628. fi
  5629. ;;
  5630. pass_all)
  5631. valid_a_lib=yes
  5632. ;;
  5633. esac
  5634. if test "$valid_a_lib" != yes; then
  5635. echo
  5636. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  5637. echo "*** I have the capability to make that library automatically link in when"
  5638. echo "*** you link to this library. But I can only do this if you have a"
  5639. echo "*** shared version of the library, which you do not appear to have"
  5640. echo "*** because the file extensions .$libext of this argument makes me believe"
  5641. echo "*** that it is just a static archive that I should not use here."
  5642. else
  5643. echo
  5644. $ECHO "*** Warning: Linking the shared library $output against the"
  5645. $ECHO "*** static library $deplib is not portable!"
  5646. deplibs="$deplib $deplibs"
  5647. fi
  5648. ;;
  5649. esac
  5650. continue
  5651. ;;
  5652. prog)
  5653. if test "$pass" != link; then
  5654. deplibs="$deplib $deplibs"
  5655. else
  5656. compile_deplibs="$deplib $compile_deplibs"
  5657. finalize_deplibs="$deplib $finalize_deplibs"
  5658. fi
  5659. continue
  5660. ;;
  5661. esac # linkmode
  5662. ;; # *.$libext
  5663. *.lo | *.$objext)
  5664. if test "$pass" = conv; then
  5665. deplibs="$deplib $deplibs"
  5666. elif test "$linkmode" = prog; then
  5667. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  5668. # If there is no dlopen support or we're linking statically,
  5669. # we need to preload.
  5670. func_append newdlprefiles " $deplib"
  5671. compile_deplibs="$deplib $compile_deplibs"
  5672. finalize_deplibs="$deplib $finalize_deplibs"
  5673. else
  5674. func_append newdlfiles " $deplib"
  5675. fi
  5676. fi
  5677. continue
  5678. ;;
  5679. %DEPLIBS%)
  5680. alldeplibs=yes
  5681. continue
  5682. ;;
  5683. esac # case $deplib
  5684. if test "$found" = yes || test -f "$lib"; then :
  5685. else
  5686. func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
  5687. fi
  5688. # Check to see that this really is a libtool archive.
  5689. func_lalib_unsafe_p "$lib" \
  5690. || func_fatal_error "\`$lib' is not a valid libtool archive"
  5691. func_dirname "$lib" "" "."
  5692. ladir="$func_dirname_result"
  5693. dlname=
  5694. dlopen=
  5695. dlpreopen=
  5696. libdir=
  5697. library_names=
  5698. old_library=
  5699. inherited_linker_flags=
  5700. # If the library was installed with an old release of libtool,
  5701. # it will not redefine variables installed, or shouldnotlink
  5702. installed=yes
  5703. shouldnotlink=no
  5704. avoidtemprpath=
  5705. # Read the .la file
  5706. func_source "$lib"
  5707. # Convert "-framework foo" to "foo.ltframework"
  5708. if test -n "$inherited_linker_flags"; then
  5709. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  5710. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  5711. case " $new_inherited_linker_flags " in
  5712. *" $tmp_inherited_linker_flag "*) ;;
  5713. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  5714. esac
  5715. done
  5716. fi
  5717. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  5718. if test "$linkmode,$pass" = "lib,link" ||
  5719. test "$linkmode,$pass" = "prog,scan" ||
  5720. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  5721. test -n "$dlopen" && func_append dlfiles " $dlopen"
  5722. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  5723. fi
  5724. if test "$pass" = conv; then
  5725. # Only check for convenience libraries
  5726. deplibs="$lib $deplibs"
  5727. if test -z "$libdir"; then
  5728. if test -z "$old_library"; then
  5729. func_fatal_error "cannot find name of link library for \`$lib'"
  5730. fi
  5731. # It is a libtool convenience library, so add in its objects.
  5732. func_append convenience " $ladir/$objdir/$old_library"
  5733. func_append old_convenience " $ladir/$objdir/$old_library"
  5734. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  5735. func_fatal_error "\`$lib' is not a convenience library"
  5736. fi
  5737. tmp_libs=
  5738. for deplib in $dependency_libs; do
  5739. deplibs="$deplib $deplibs"
  5740. if $opt_preserve_dup_deps ; then
  5741. case "$tmp_libs " in
  5742. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  5743. esac
  5744. fi
  5745. func_append tmp_libs " $deplib"
  5746. done
  5747. continue
  5748. fi # $pass = conv
  5749. # Get the name of the library we link against.
  5750. linklib=
  5751. if test -n "$old_library" &&
  5752. { test "$prefer_static_libs" = yes ||
  5753. test "$prefer_static_libs,$installed" = "built,no"; }; then
  5754. linklib=$old_library
  5755. else
  5756. for l in $old_library $library_names; do
  5757. linklib="$l"
  5758. done
  5759. fi
  5760. if test -z "$linklib"; then
  5761. func_fatal_error "cannot find name of link library for \`$lib'"
  5762. fi
  5763. # This library was specified with -dlopen.
  5764. if test "$pass" = dlopen; then
  5765. if test -z "$libdir"; then
  5766. func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
  5767. fi
  5768. if test -z "$dlname" ||
  5769. test "$dlopen_support" != yes ||
  5770. test "$build_libtool_libs" = no; then
  5771. # If there is no dlname, no dlopen support or we're linking
  5772. # statically, we need to preload. We also need to preload any
  5773. # dependent libraries so libltdl's deplib preloader doesn't
  5774. # bomb out in the load deplibs phase.
  5775. func_append dlprefiles " $lib $dependency_libs"
  5776. else
  5777. func_append newdlfiles " $lib"
  5778. fi
  5779. continue
  5780. fi # $pass = dlopen
  5781. # We need an absolute path.
  5782. case $ladir in
  5783. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  5784. *)
  5785. abs_ladir=`cd "$ladir" && pwd`
  5786. if test -z "$abs_ladir"; then
  5787. func_warning "cannot determine absolute directory name of \`$ladir'"
  5788. func_warning "passing it literally to the linker, although it might fail"
  5789. abs_ladir="$ladir"
  5790. fi
  5791. ;;
  5792. esac
  5793. func_basename "$lib"
  5794. laname="$func_basename_result"
  5795. # Find the relevant object directory and library name.
  5796. if test "X$installed" = Xyes; then
  5797. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  5798. func_warning "library \`$lib' was moved."
  5799. dir="$ladir"
  5800. absdir="$abs_ladir"
  5801. libdir="$abs_ladir"
  5802. else
  5803. dir="$lt_sysroot$libdir"
  5804. absdir="$lt_sysroot$libdir"
  5805. fi
  5806. test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
  5807. else
  5808. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  5809. dir="$ladir"
  5810. absdir="$abs_ladir"
  5811. # Remove this search path later
  5812. func_append notinst_path " $abs_ladir"
  5813. else
  5814. dir="$ladir/$objdir"
  5815. absdir="$abs_ladir/$objdir"
  5816. # Remove this search path later
  5817. func_append notinst_path " $abs_ladir"
  5818. fi
  5819. fi # $installed = yes
  5820. func_stripname 'lib' '.la' "$laname"
  5821. name=$func_stripname_result
  5822. # This library was specified with -dlpreopen.
  5823. if test "$pass" = dlpreopen; then
  5824. if test -z "$libdir" && test "$linkmode" = prog; then
  5825. func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
  5826. fi
  5827. case "$host" in
  5828. # special handling for platforms with PE-DLLs.
  5829. *cygwin* | *mingw* | *cegcc* )
  5830. # Linker will automatically link against shared library if both
  5831. # static and shared are present. Therefore, ensure we extract
  5832. # symbols from the import library if a shared library is present
  5833. # (otherwise, the dlopen module name will be incorrect). We do
  5834. # this by putting the import library name into $newdlprefiles.
  5835. # We recover the dlopen module name by 'saving' the la file
  5836. # name in a special purpose variable, and (later) extracting the
  5837. # dlname from the la file.
  5838. if test -n "$dlname"; then
  5839. func_tr_sh "$dir/$linklib"
  5840. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  5841. func_append newdlprefiles " $dir/$linklib"
  5842. else
  5843. func_append newdlprefiles " $dir/$old_library"
  5844. # Keep a list of preopened convenience libraries to check
  5845. # that they are being used correctly in the link pass.
  5846. test -z "$libdir" && \
  5847. func_append dlpreconveniencelibs " $dir/$old_library"
  5848. fi
  5849. ;;
  5850. * )
  5851. # Prefer using a static library (so that no silly _DYNAMIC symbols
  5852. # are required to link).
  5853. if test -n "$old_library"; then
  5854. func_append newdlprefiles " $dir/$old_library"
  5855. # Keep a list of preopened convenience libraries to check
  5856. # that they are being used correctly in the link pass.
  5857. test -z "$libdir" && \
  5858. func_append dlpreconveniencelibs " $dir/$old_library"
  5859. # Otherwise, use the dlname, so that lt_dlopen finds it.
  5860. elif test -n "$dlname"; then
  5861. func_append newdlprefiles " $dir/$dlname"
  5862. else
  5863. func_append newdlprefiles " $dir/$linklib"
  5864. fi
  5865. ;;
  5866. esac
  5867. fi # $pass = dlpreopen
  5868. if test -z "$libdir"; then
  5869. # Link the convenience library
  5870. if test "$linkmode" = lib; then
  5871. deplibs="$dir/$old_library $deplibs"
  5872. elif test "$linkmode,$pass" = "prog,link"; then
  5873. compile_deplibs="$dir/$old_library $compile_deplibs"
  5874. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  5875. else
  5876. deplibs="$lib $deplibs" # used for prog,scan pass
  5877. fi
  5878. continue
  5879. fi
  5880. if test "$linkmode" = prog && test "$pass" != link; then
  5881. func_append newlib_search_path " $ladir"
  5882. deplibs="$lib $deplibs"
  5883. linkalldeplibs=no
  5884. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  5885. test "$build_libtool_libs" = no; then
  5886. linkalldeplibs=yes
  5887. fi
  5888. tmp_libs=
  5889. for deplib in $dependency_libs; do
  5890. case $deplib in
  5891. -L*) func_stripname '-L' '' "$deplib"
  5892. func_resolve_sysroot "$func_stripname_result"
  5893. func_append newlib_search_path " $func_resolve_sysroot_result"
  5894. ;;
  5895. esac
  5896. # Need to link against all dependency_libs?
  5897. if test "$linkalldeplibs" = yes; then
  5898. deplibs="$deplib $deplibs"
  5899. else
  5900. # Need to hardcode shared library paths
  5901. # or/and link against static libraries
  5902. newdependency_libs="$deplib $newdependency_libs"
  5903. fi
  5904. if $opt_preserve_dup_deps ; then
  5905. case "$tmp_libs " in
  5906. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  5907. esac
  5908. fi
  5909. func_append tmp_libs " $deplib"
  5910. done # for deplib
  5911. continue
  5912. fi # $linkmode = prog...
  5913. if test "$linkmode,$pass" = "prog,link"; then
  5914. if test -n "$library_names" &&
  5915. { { test "$prefer_static_libs" = no ||
  5916. test "$prefer_static_libs,$installed" = "built,yes"; } ||
  5917. test -z "$old_library"; }; then
  5918. # We need to hardcode the library path
  5919. if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  5920. # Make sure the rpath contains only unique directories.
  5921. case "$temp_rpath:" in
  5922. *"$absdir:"*) ;;
  5923. *) func_append temp_rpath "$absdir:" ;;
  5924. esac
  5925. fi
  5926. # Hardcode the library path.
  5927. # Skip directories that are in the system default run-time
  5928. # search path.
  5929. case " $sys_lib_dlsearch_path " in
  5930. *" $absdir "*) ;;
  5931. *)
  5932. case "$compile_rpath " in
  5933. *" $absdir "*) ;;
  5934. *) func_append compile_rpath " $absdir" ;;
  5935. esac
  5936. ;;
  5937. esac
  5938. case " $sys_lib_dlsearch_path " in
  5939. *" $libdir "*) ;;
  5940. *)
  5941. case "$finalize_rpath " in
  5942. *" $libdir "*) ;;
  5943. *) func_append finalize_rpath " $libdir" ;;
  5944. esac
  5945. ;;
  5946. esac
  5947. fi # $linkmode,$pass = prog,link...
  5948. if test "$alldeplibs" = yes &&
  5949. { test "$deplibs_check_method" = pass_all ||
  5950. { test "$build_libtool_libs" = yes &&
  5951. test -n "$library_names"; }; }; then
  5952. # We only need to search for static libraries
  5953. continue
  5954. fi
  5955. fi
  5956. link_static=no # Whether the deplib will be linked statically
  5957. use_static_libs=$prefer_static_libs
  5958. if test "$use_static_libs" = built && test "$installed" = yes; then
  5959. use_static_libs=no
  5960. fi
  5961. if test -n "$library_names" &&
  5962. { test "$use_static_libs" = no || test -z "$old_library"; }; then
  5963. case $host in
  5964. *cygwin* | *mingw* | *cegcc*)
  5965. # No point in relinking DLLs because paths are not encoded
  5966. func_append notinst_deplibs " $lib"
  5967. need_relink=no
  5968. ;;
  5969. *)
  5970. if test "$installed" = no; then
  5971. func_append notinst_deplibs " $lib"
  5972. need_relink=yes
  5973. fi
  5974. ;;
  5975. esac
  5976. # This is a shared library
  5977. # Warn about portability, can't link against -module's on some
  5978. # systems (darwin). Don't bleat about dlopened modules though!
  5979. dlopenmodule=""
  5980. for dlpremoduletest in $dlprefiles; do
  5981. if test "X$dlpremoduletest" = "X$lib"; then
  5982. dlopenmodule="$dlpremoduletest"
  5983. break
  5984. fi
  5985. done
  5986. if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
  5987. echo
  5988. if test "$linkmode" = prog; then
  5989. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  5990. else
  5991. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  5992. fi
  5993. $ECHO "*** $linklib is not portable!"
  5994. fi
  5995. if test "$linkmode" = lib &&
  5996. test "$hardcode_into_libs" = yes; then
  5997. # Hardcode the library path.
  5998. # Skip directories that are in the system default run-time
  5999. # search path.
  6000. case " $sys_lib_dlsearch_path " in
  6001. *" $absdir "*) ;;
  6002. *)
  6003. case "$compile_rpath " in
  6004. *" $absdir "*) ;;
  6005. *) func_append compile_rpath " $absdir" ;;
  6006. esac
  6007. ;;
  6008. esac
  6009. case " $sys_lib_dlsearch_path " in
  6010. *" $libdir "*) ;;
  6011. *)
  6012. case "$finalize_rpath " in
  6013. *" $libdir "*) ;;
  6014. *) func_append finalize_rpath " $libdir" ;;
  6015. esac
  6016. ;;
  6017. esac
  6018. fi
  6019. if test -n "$old_archive_from_expsyms_cmds"; then
  6020. # figure out the soname
  6021. set dummy $library_names
  6022. shift
  6023. realname="$1"
  6024. shift
  6025. libname=`eval "\\$ECHO \"$libname_spec\""`
  6026. # use dlname if we got it. it's perfectly good, no?
  6027. if test -n "$dlname"; then
  6028. soname="$dlname"
  6029. elif test -n "$soname_spec"; then
  6030. # bleh windows
  6031. case $host in
  6032. *cygwin* | mingw* | *cegcc*)
  6033. func_arith $current - $age
  6034. major=$func_arith_result
  6035. versuffix="-$major"
  6036. ;;
  6037. esac
  6038. eval soname=\"$soname_spec\"
  6039. else
  6040. soname="$realname"
  6041. fi
  6042. # Make a new name for the extract_expsyms_cmds to use
  6043. soroot="$soname"
  6044. func_basename "$soroot"
  6045. soname="$func_basename_result"
  6046. func_stripname 'lib' '.dll' "$soname"
  6047. newlib=libimp-$func_stripname_result.a
  6048. # If the library has no export list, then create one now
  6049. if test -f "$output_objdir/$soname-def"; then :
  6050. else
  6051. func_verbose "extracting exported symbol list from \`$soname'"
  6052. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  6053. fi
  6054. # Create $newlib
  6055. if test -f "$output_objdir/$newlib"; then :; else
  6056. func_verbose "generating import library for \`$soname'"
  6057. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  6058. fi
  6059. # make sure the library variables are pointing to the new library
  6060. dir=$output_objdir
  6061. linklib=$newlib
  6062. fi # test -n "$old_archive_from_expsyms_cmds"
  6063. if test "$linkmode" = prog || test "$opt_mode" != relink; then
  6064. add_shlibpath=
  6065. add_dir=
  6066. add=
  6067. lib_linked=yes
  6068. case $hardcode_action in
  6069. immediate | unsupported)
  6070. if test "$hardcode_direct" = no; then
  6071. add="$dir/$linklib"
  6072. case $host in
  6073. *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
  6074. *-*-sysv4*uw2*) add_dir="-L$dir" ;;
  6075. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  6076. *-*-unixware7*) add_dir="-L$dir" ;;
  6077. *-*-darwin* )
  6078. # if the lib is a (non-dlopened) module then we can not
  6079. # link against it, someone is ignoring the earlier warnings
  6080. if /usr/bin/file -L $add 2> /dev/null |
  6081. $GREP ": [^:]* bundle" >/dev/null ; then
  6082. if test "X$dlopenmodule" != "X$lib"; then
  6083. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  6084. if test -z "$old_library" ; then
  6085. echo
  6086. echo "*** And there doesn't seem to be a static archive available"
  6087. echo "*** The link will probably fail, sorry"
  6088. else
  6089. add="$dir/$old_library"
  6090. fi
  6091. elif test -n "$old_library"; then
  6092. add="$dir/$old_library"
  6093. fi
  6094. fi
  6095. esac
  6096. elif test "$hardcode_minus_L" = no; then
  6097. case $host in
  6098. *-*-sunos*) add_shlibpath="$dir" ;;
  6099. esac
  6100. add_dir="-L$dir"
  6101. add="-l$name"
  6102. elif test "$hardcode_shlibpath_var" = no; then
  6103. add_shlibpath="$dir"
  6104. add="-l$name"
  6105. else
  6106. lib_linked=no
  6107. fi
  6108. ;;
  6109. relink)
  6110. if test "$hardcode_direct" = yes &&
  6111. test "$hardcode_direct_absolute" = no; then
  6112. add="$dir/$linklib"
  6113. elif test "$hardcode_minus_L" = yes; then
  6114. add_dir="-L$absdir"
  6115. # Try looking first in the location we're being installed to.
  6116. if test -n "$inst_prefix_dir"; then
  6117. case $libdir in
  6118. [\\/]*)
  6119. func_append add_dir " -L$inst_prefix_dir$libdir"
  6120. ;;
  6121. esac
  6122. fi
  6123. add="-l$name"
  6124. elif test "$hardcode_shlibpath_var" = yes; then
  6125. add_shlibpath="$dir"
  6126. add="-l$name"
  6127. else
  6128. lib_linked=no
  6129. fi
  6130. ;;
  6131. *) lib_linked=no ;;
  6132. esac
  6133. if test "$lib_linked" != yes; then
  6134. func_fatal_configuration "unsupported hardcode properties"
  6135. fi
  6136. if test -n "$add_shlibpath"; then
  6137. case :$compile_shlibpath: in
  6138. *":$add_shlibpath:"*) ;;
  6139. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  6140. esac
  6141. fi
  6142. if test "$linkmode" = prog; then
  6143. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  6144. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  6145. else
  6146. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  6147. test -n "$add" && deplibs="$add $deplibs"
  6148. if test "$hardcode_direct" != yes &&
  6149. test "$hardcode_minus_L" != yes &&
  6150. test "$hardcode_shlibpath_var" = yes; then
  6151. case :$finalize_shlibpath: in
  6152. *":$libdir:"*) ;;
  6153. *) func_append finalize_shlibpath "$libdir:" ;;
  6154. esac
  6155. fi
  6156. fi
  6157. fi
  6158. if test "$linkmode" = prog || test "$opt_mode" = relink; then
  6159. add_shlibpath=
  6160. add_dir=
  6161. add=
  6162. # Finalize command for both is simple: just hardcode it.
  6163. if test "$hardcode_direct" = yes &&
  6164. test "$hardcode_direct_absolute" = no; then
  6165. add="$libdir/$linklib"
  6166. elif test "$hardcode_minus_L" = yes; then
  6167. add_dir="-L$libdir"
  6168. add="-l$name"
  6169. elif test "$hardcode_shlibpath_var" = yes; then
  6170. case :$finalize_shlibpath: in
  6171. *":$libdir:"*) ;;
  6172. *) func_append finalize_shlibpath "$libdir:" ;;
  6173. esac
  6174. add="-l$name"
  6175. elif test "$hardcode_automatic" = yes; then
  6176. if test -n "$inst_prefix_dir" &&
  6177. test -f "$inst_prefix_dir$libdir/$linklib" ; then
  6178. add="$inst_prefix_dir$libdir/$linklib"
  6179. else
  6180. add="$libdir/$linklib"
  6181. fi
  6182. else
  6183. # We cannot seem to hardcode it, guess we'll fake it.
  6184. add_dir="-L$libdir"
  6185. # Try looking first in the location we're being installed to.
  6186. if test -n "$inst_prefix_dir"; then
  6187. case $libdir in
  6188. [\\/]*)
  6189. func_append add_dir " -L$inst_prefix_dir$libdir"
  6190. ;;
  6191. esac
  6192. fi
  6193. add="-l$name"
  6194. fi
  6195. if test "$linkmode" = prog; then
  6196. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  6197. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  6198. else
  6199. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  6200. test -n "$add" && deplibs="$add $deplibs"
  6201. fi
  6202. fi
  6203. elif test "$linkmode" = prog; then
  6204. # Here we assume that one of hardcode_direct or hardcode_minus_L
  6205. # is not unsupported. This is valid on all known static and
  6206. # shared platforms.
  6207. if test "$hardcode_direct" != unsupported; then
  6208. test -n "$old_library" && linklib="$old_library"
  6209. compile_deplibs="$dir/$linklib $compile_deplibs"
  6210. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  6211. else
  6212. compile_deplibs="-l$name -L$dir $compile_deplibs"
  6213. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  6214. fi
  6215. elif test "$build_libtool_libs" = yes; then
  6216. # Not a shared library
  6217. if test "$deplibs_check_method" != pass_all; then
  6218. # We're trying link a shared library against a static one
  6219. # but the system doesn't support it.
  6220. # Just print a warning and add the library to dependency_libs so
  6221. # that the program can be linked against the static library.
  6222. echo
  6223. $ECHO "*** Warning: This system can not link to static lib archive $lib."
  6224. echo "*** I have the capability to make that library automatically link in when"
  6225. echo "*** you link to this library. But I can only do this if you have a"
  6226. echo "*** shared version of the library, which you do not appear to have."
  6227. if test "$module" = yes; then
  6228. echo "*** But as you try to build a module library, libtool will still create "
  6229. echo "*** a static module, that should work as long as the dlopening application"
  6230. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  6231. if test -z "$global_symbol_pipe"; then
  6232. echo
  6233. echo "*** However, this would only work if libtool was able to extract symbol"
  6234. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  6235. echo "*** not find such a program. So, this module is probably useless."
  6236. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  6237. fi
  6238. if test "$build_old_libs" = no; then
  6239. build_libtool_libs=module
  6240. build_old_libs=yes
  6241. else
  6242. build_libtool_libs=no
  6243. fi
  6244. fi
  6245. else
  6246. deplibs="$dir/$old_library $deplibs"
  6247. link_static=yes
  6248. fi
  6249. fi # link shared/static library?
  6250. if test "$linkmode" = lib; then
  6251. if test -n "$dependency_libs" &&
  6252. { test "$hardcode_into_libs" != yes ||
  6253. test "$build_old_libs" = yes ||
  6254. test "$link_static" = yes; }; then
  6255. # Extract -R from dependency_libs
  6256. temp_deplibs=
  6257. for libdir in $dependency_libs; do
  6258. case $libdir in
  6259. -R*) func_stripname '-R' '' "$libdir"
  6260. temp_xrpath=$func_stripname_result
  6261. case " $xrpath " in
  6262. *" $temp_xrpath "*) ;;
  6263. *) func_append xrpath " $temp_xrpath";;
  6264. esac;;
  6265. *) func_append temp_deplibs " $libdir";;
  6266. esac
  6267. done
  6268. dependency_libs="$temp_deplibs"
  6269. fi
  6270. func_append newlib_search_path " $absdir"
  6271. # Link against this library
  6272. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  6273. # ... and its dependency_libs
  6274. tmp_libs=
  6275. for deplib in $dependency_libs; do
  6276. newdependency_libs="$deplib $newdependency_libs"
  6277. case $deplib in
  6278. -L*) func_stripname '-L' '' "$deplib"
  6279. func_resolve_sysroot "$func_stripname_result";;
  6280. *) func_resolve_sysroot "$deplib" ;;
  6281. esac
  6282. if $opt_preserve_dup_deps ; then
  6283. case "$tmp_libs " in
  6284. *" $func_resolve_sysroot_result "*)
  6285. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  6286. esac
  6287. fi
  6288. func_append tmp_libs " $func_resolve_sysroot_result"
  6289. done
  6290. if test "$link_all_deplibs" != no; then
  6291. # Add the search paths of all dependency libraries
  6292. for deplib in $dependency_libs; do
  6293. path=
  6294. case $deplib in
  6295. -L*) path="$deplib" ;;
  6296. *.la)
  6297. func_resolve_sysroot "$deplib"
  6298. deplib=$func_resolve_sysroot_result
  6299. func_dirname "$deplib" "" "."
  6300. dir=$func_dirname_result
  6301. # We need an absolute path.
  6302. case $dir in
  6303. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  6304. *)
  6305. absdir=`cd "$dir" && pwd`
  6306. if test -z "$absdir"; then
  6307. func_warning "cannot determine absolute directory name of \`$dir'"
  6308. absdir="$dir"
  6309. fi
  6310. ;;
  6311. esac
  6312. if $GREP "^installed=no" $deplib > /dev/null; then
  6313. case $host in
  6314. *-*-darwin*)
  6315. depdepl=
  6316. eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  6317. if test -n "$deplibrary_names" ; then
  6318. for tmp in $deplibrary_names ; do
  6319. depdepl=$tmp
  6320. done
  6321. if test -f "$absdir/$objdir/$depdepl" ; then
  6322. depdepl="$absdir/$objdir/$depdepl"
  6323. darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  6324. if test -z "$darwin_install_name"; then
  6325. darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  6326. fi
  6327. func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
  6328. func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
  6329. path=
  6330. fi
  6331. fi
  6332. ;;
  6333. *)
  6334. path="-L$absdir/$objdir"
  6335. ;;
  6336. esac
  6337. else
  6338. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  6339. test -z "$libdir" && \
  6340. func_fatal_error "\`$deplib' is not a valid libtool archive"
  6341. test "$absdir" != "$libdir" && \
  6342. func_warning "\`$deplib' seems to be moved"
  6343. path="-L$absdir"
  6344. fi
  6345. ;;
  6346. esac
  6347. case " $deplibs " in
  6348. *" $path "*) ;;
  6349. *) deplibs="$path $deplibs" ;;
  6350. esac
  6351. done
  6352. fi # link_all_deplibs != no
  6353. fi # linkmode = lib
  6354. done # for deplib in $libs
  6355. if test "$pass" = link; then
  6356. if test "$linkmode" = "prog"; then
  6357. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  6358. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  6359. else
  6360. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  6361. fi
  6362. fi
  6363. dependency_libs="$newdependency_libs"
  6364. if test "$pass" = dlpreopen; then
  6365. # Link the dlpreopened libraries before other libraries
  6366. for deplib in $save_deplibs; do
  6367. deplibs="$deplib $deplibs"
  6368. done
  6369. fi
  6370. if test "$pass" != dlopen; then
  6371. if test "$pass" != conv; then
  6372. # Make sure lib_search_path contains only unique directories.
  6373. lib_search_path=
  6374. for dir in $newlib_search_path; do
  6375. case "$lib_search_path " in
  6376. *" $dir "*) ;;
  6377. *) func_append lib_search_path " $dir" ;;
  6378. esac
  6379. done
  6380. newlib_search_path=
  6381. fi
  6382. if test "$linkmode,$pass" != "prog,link"; then
  6383. vars="deplibs"
  6384. else
  6385. vars="compile_deplibs finalize_deplibs"
  6386. fi
  6387. for var in $vars dependency_libs; do
  6388. # Add libraries to $var in reverse order
  6389. eval tmp_libs=\"\$$var\"
  6390. new_libs=
  6391. for deplib in $tmp_libs; do
  6392. # FIXME: Pedantically, this is the right thing to do, so
  6393. # that some nasty dependency loop isn't accidentally
  6394. # broken:
  6395. #new_libs="$deplib $new_libs"
  6396. # Pragmatically, this seems to cause very few problems in
  6397. # practice:
  6398. case $deplib in
  6399. -L*) new_libs="$deplib $new_libs" ;;
  6400. -R*) ;;
  6401. *)
  6402. # And here is the reason: when a library appears more
  6403. # than once as an explicit dependence of a library, or
  6404. # is implicitly linked in more than once by the
  6405. # compiler, it is considered special, and multiple
  6406. # occurrences thereof are not removed. Compare this
  6407. # with having the same library being listed as a
  6408. # dependency of multiple other libraries: in this case,
  6409. # we know (pedantically, we assume) the library does not
  6410. # need to be listed more than once, so we keep only the
  6411. # last copy. This is not always right, but it is rare
  6412. # enough that we require users that really mean to play
  6413. # such unportable linking tricks to link the library
  6414. # using -Wl,-lname, so that libtool does not consider it
  6415. # for duplicate removal.
  6416. case " $specialdeplibs " in
  6417. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  6418. *)
  6419. case " $new_libs " in
  6420. *" $deplib "*) ;;
  6421. *) new_libs="$deplib $new_libs" ;;
  6422. esac
  6423. ;;
  6424. esac
  6425. ;;
  6426. esac
  6427. done
  6428. tmp_libs=
  6429. for deplib in $new_libs; do
  6430. case $deplib in
  6431. -L*)
  6432. case " $tmp_libs " in
  6433. *" $deplib "*) ;;
  6434. *) func_append tmp_libs " $deplib" ;;
  6435. esac
  6436. ;;
  6437. *) func_append tmp_libs " $deplib" ;;
  6438. esac
  6439. done
  6440. eval $var=\"$tmp_libs\"
  6441. done # for var
  6442. fi
  6443. # Last step: remove runtime libs from dependency_libs
  6444. # (they stay in deplibs)
  6445. tmp_libs=
  6446. for i in $dependency_libs ; do
  6447. case " $predeps $postdeps $compiler_lib_search_path " in
  6448. *" $i "*)
  6449. i=""
  6450. ;;
  6451. esac
  6452. if test -n "$i" ; then
  6453. func_append tmp_libs " $i"
  6454. fi
  6455. done
  6456. dependency_libs=$tmp_libs
  6457. done # for pass
  6458. if test "$linkmode" = prog; then
  6459. dlfiles="$newdlfiles"
  6460. fi
  6461. if test "$linkmode" = prog || test "$linkmode" = lib; then
  6462. dlprefiles="$newdlprefiles"
  6463. fi
  6464. case $linkmode in
  6465. oldlib)
  6466. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  6467. func_warning "\`-dlopen' is ignored for archives"
  6468. fi
  6469. case " $deplibs" in
  6470. *\ -l* | *\ -L*)
  6471. func_warning "\`-l' and \`-L' are ignored for archives" ;;
  6472. esac
  6473. test -n "$rpath" && \
  6474. func_warning "\`-rpath' is ignored for archives"
  6475. test -n "$xrpath" && \
  6476. func_warning "\`-R' is ignored for archives"
  6477. test -n "$vinfo" && \
  6478. func_warning "\`-version-info/-version-number' is ignored for archives"
  6479. test -n "$release" && \
  6480. func_warning "\`-release' is ignored for archives"
  6481. test -n "$export_symbols$export_symbols_regex" && \
  6482. func_warning "\`-export-symbols' is ignored for archives"
  6483. # Now set the variables for building old libraries.
  6484. build_libtool_libs=no
  6485. oldlibs="$output"
  6486. func_append objs "$old_deplibs"
  6487. ;;
  6488. lib)
  6489. # Make sure we only generate libraries of the form `libNAME.la'.
  6490. case $outputname in
  6491. lib*)
  6492. func_stripname 'lib' '.la' "$outputname"
  6493. name=$func_stripname_result
  6494. eval shared_ext=\"$shrext_cmds\"
  6495. eval libname=\"$libname_spec\"
  6496. ;;
  6497. *)
  6498. test "$module" = no && \
  6499. func_fatal_help "libtool library \`$output' must begin with \`lib'"
  6500. if test "$need_lib_prefix" != no; then
  6501. # Add the "lib" prefix for modules if required
  6502. func_stripname '' '.la' "$outputname"
  6503. name=$func_stripname_result
  6504. eval shared_ext=\"$shrext_cmds\"
  6505. eval libname=\"$libname_spec\"
  6506. else
  6507. func_stripname '' '.la' "$outputname"
  6508. libname=$func_stripname_result
  6509. fi
  6510. ;;
  6511. esac
  6512. if test -n "$objs"; then
  6513. if test "$deplibs_check_method" != pass_all; then
  6514. func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
  6515. else
  6516. echo
  6517. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  6518. $ECHO "*** objects $objs is not portable!"
  6519. func_append libobjs " $objs"
  6520. fi
  6521. fi
  6522. test "$dlself" != no && \
  6523. func_warning "\`-dlopen self' is ignored for libtool libraries"
  6524. set dummy $rpath
  6525. shift
  6526. test "$#" -gt 1 && \
  6527. func_warning "ignoring multiple \`-rpath's for a libtool library"
  6528. install_libdir="$1"
  6529. oldlibs=
  6530. if test -z "$rpath"; then
  6531. if test "$build_libtool_libs" = yes; then
  6532. # Building a libtool convenience library.
  6533. # Some compilers have problems with a `.al' extension so
  6534. # convenience libraries should have the same extension an
  6535. # archive normally would.
  6536. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  6537. build_libtool_libs=convenience
  6538. build_old_libs=yes
  6539. fi
  6540. test -n "$vinfo" && \
  6541. func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
  6542. test -n "$release" && \
  6543. func_warning "\`-release' is ignored for convenience libraries"
  6544. else
  6545. # Parse the version information argument.
  6546. save_ifs="$IFS"; IFS=':'
  6547. set dummy $vinfo 0 0 0
  6548. shift
  6549. IFS="$save_ifs"
  6550. test -n "$7" && \
  6551. func_fatal_help "too many parameters to \`-version-info'"
  6552. # convert absolute version numbers to libtool ages
  6553. # this retains compatibility with .la files and attempts
  6554. # to make the code below a bit more comprehensible
  6555. case $vinfo_number in
  6556. yes)
  6557. number_major="$1"
  6558. number_minor="$2"
  6559. number_revision="$3"
  6560. #
  6561. # There are really only two kinds -- those that
  6562. # use the current revision as the major version
  6563. # and those that subtract age and use age as
  6564. # a minor version. But, then there is irix
  6565. # which has an extra 1 added just for fun
  6566. #
  6567. case $version_type in
  6568. # correct linux to gnu/linux during the next big refactor
  6569. darwin|linux|osf|windows|none)
  6570. func_arith $number_major + $number_minor
  6571. current=$func_arith_result
  6572. age="$number_minor"
  6573. revision="$number_revision"
  6574. ;;
  6575. freebsd-aout|freebsd-elf|qnx|sunos)
  6576. current="$number_major"
  6577. revision="$number_minor"
  6578. age="0"
  6579. ;;
  6580. irix|nonstopux)
  6581. func_arith $number_major + $number_minor
  6582. current=$func_arith_result
  6583. age="$number_minor"
  6584. revision="$number_minor"
  6585. lt_irix_increment=no
  6586. ;;
  6587. esac
  6588. ;;
  6589. no)
  6590. current="$1"
  6591. revision="$2"
  6592. age="$3"
  6593. ;;
  6594. esac
  6595. # Check that each of the things are valid numbers.
  6596. case $current in
  6597. 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]) ;;
  6598. *)
  6599. func_error "CURRENT \`$current' must be a nonnegative integer"
  6600. func_fatal_error "\`$vinfo' is not valid version information"
  6601. ;;
  6602. esac
  6603. case $revision in
  6604. 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]) ;;
  6605. *)
  6606. func_error "REVISION \`$revision' must be a nonnegative integer"
  6607. func_fatal_error "\`$vinfo' is not valid version information"
  6608. ;;
  6609. esac
  6610. case $age in
  6611. 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]) ;;
  6612. *)
  6613. func_error "AGE \`$age' must be a nonnegative integer"
  6614. func_fatal_error "\`$vinfo' is not valid version information"
  6615. ;;
  6616. esac
  6617. if test "$age" -gt "$current"; then
  6618. func_error "AGE \`$age' is greater than the current interface number \`$current'"
  6619. func_fatal_error "\`$vinfo' is not valid version information"
  6620. fi
  6621. # Calculate the version variables.
  6622. major=
  6623. versuffix=
  6624. verstring=
  6625. case $version_type in
  6626. none) ;;
  6627. darwin)
  6628. # Like Linux, but with the current version available in
  6629. # verstring for coding it into the library header
  6630. func_arith $current - $age
  6631. major=.$func_arith_result
  6632. versuffix="$major.$age.$revision"
  6633. # Darwin ld doesn't like 0 for these options...
  6634. func_arith $current + 1
  6635. minor_current=$func_arith_result
  6636. xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  6637. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  6638. ;;
  6639. freebsd-aout)
  6640. major=".$current"
  6641. versuffix=".$current.$revision";
  6642. ;;
  6643. freebsd-elf)
  6644. major=".$current"
  6645. versuffix=".$current"
  6646. ;;
  6647. irix | nonstopux)
  6648. if test "X$lt_irix_increment" = "Xno"; then
  6649. func_arith $current - $age
  6650. else
  6651. func_arith $current - $age + 1
  6652. fi
  6653. major=$func_arith_result
  6654. case $version_type in
  6655. nonstopux) verstring_prefix=nonstopux ;;
  6656. *) verstring_prefix=sgi ;;
  6657. esac
  6658. verstring="$verstring_prefix$major.$revision"
  6659. # Add in all the interfaces that we are compatible with.
  6660. loop=$revision
  6661. while test "$loop" -ne 0; do
  6662. func_arith $revision - $loop
  6663. iface=$func_arith_result
  6664. func_arith $loop - 1
  6665. loop=$func_arith_result
  6666. verstring="$verstring_prefix$major.$iface:$verstring"
  6667. done
  6668. # Before this point, $major must not contain `.'.
  6669. major=.$major
  6670. versuffix="$major.$revision"
  6671. ;;
  6672. linux) # correct to gnu/linux during the next big refactor
  6673. func_arith $current - $age
  6674. major=.$func_arith_result
  6675. versuffix="$major.$age.$revision"
  6676. ;;
  6677. osf)
  6678. func_arith $current - $age
  6679. major=.$func_arith_result
  6680. versuffix=".$current.$age.$revision"
  6681. verstring="$current.$age.$revision"
  6682. # Add in all the interfaces that we are compatible with.
  6683. loop=$age
  6684. while test "$loop" -ne 0; do
  6685. func_arith $current - $loop
  6686. iface=$func_arith_result
  6687. func_arith $loop - 1
  6688. loop=$func_arith_result
  6689. verstring="$verstring:${iface}.0"
  6690. done
  6691. # Make executables depend on our current version.
  6692. func_append verstring ":${current}.0"
  6693. ;;
  6694. qnx)
  6695. major=".$current"
  6696. versuffix=".$current"
  6697. ;;
  6698. sunos)
  6699. major=".$current"
  6700. versuffix=".$current.$revision"
  6701. ;;
  6702. windows)
  6703. # Use '-' rather than '.', since we only want one
  6704. # extension on DOS 8.3 filesystems.
  6705. func_arith $current - $age
  6706. major=$func_arith_result
  6707. versuffix="-$major"
  6708. ;;
  6709. *)
  6710. func_fatal_configuration "unknown library version type \`$version_type'"
  6711. ;;
  6712. esac
  6713. # Clear the version info if we defaulted, and they specified a release.
  6714. if test -z "$vinfo" && test -n "$release"; then
  6715. major=
  6716. case $version_type in
  6717. darwin)
  6718. # we can't check for "0.0" in archive_cmds due to quoting
  6719. # problems, so we reset it completely
  6720. verstring=
  6721. ;;
  6722. *)
  6723. verstring="0.0"
  6724. ;;
  6725. esac
  6726. if test "$need_version" = no; then
  6727. versuffix=
  6728. else
  6729. versuffix=".0.0"
  6730. fi
  6731. fi
  6732. # Remove version info from name if versioning should be avoided
  6733. if test "$avoid_version" = yes && test "$need_version" = no; then
  6734. major=
  6735. versuffix=
  6736. verstring=""
  6737. fi
  6738. # Check to see if the archive will have undefined symbols.
  6739. if test "$allow_undefined" = yes; then
  6740. if test "$allow_undefined_flag" = unsupported; then
  6741. func_warning "undefined symbols not allowed in $host shared libraries"
  6742. build_libtool_libs=no
  6743. build_old_libs=yes
  6744. fi
  6745. else
  6746. # Don't allow undefined symbols.
  6747. allow_undefined_flag="$no_undefined_flag"
  6748. fi
  6749. fi
  6750. func_generate_dlsyms "$libname" "$libname" "yes"
  6751. func_append libobjs " $symfileobj"
  6752. test "X$libobjs" = "X " && libobjs=
  6753. if test "$opt_mode" != relink; then
  6754. # Remove our outputs, but don't remove object files since they
  6755. # may have been created when compiling PIC objects.
  6756. removelist=
  6757. tempremovelist=`$ECHO "$output_objdir/*"`
  6758. for p in $tempremovelist; do
  6759. case $p in
  6760. *.$objext | *.gcno)
  6761. ;;
  6762. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  6763. if test "X$precious_files_regex" != "X"; then
  6764. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  6765. then
  6766. continue
  6767. fi
  6768. fi
  6769. func_append removelist " $p"
  6770. ;;
  6771. *) ;;
  6772. esac
  6773. done
  6774. test -n "$removelist" && \
  6775. func_show_eval "${RM}r \$removelist"
  6776. fi
  6777. # Now set the variables for building old libraries.
  6778. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  6779. func_append oldlibs " $output_objdir/$libname.$libext"
  6780. # Transform .lo files to .o files.
  6781. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
  6782. fi
  6783. # Eliminate all temporary directories.
  6784. #for path in $notinst_path; do
  6785. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  6786. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  6787. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  6788. #done
  6789. if test -n "$xrpath"; then
  6790. # If the user specified any rpath flags, then add them.
  6791. temp_xrpath=
  6792. for libdir in $xrpath; do
  6793. func_replace_sysroot "$libdir"
  6794. func_append temp_xrpath " -R$func_replace_sysroot_result"
  6795. case "$finalize_rpath " in
  6796. *" $libdir "*) ;;
  6797. *) func_append finalize_rpath " $libdir" ;;
  6798. esac
  6799. done
  6800. if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  6801. dependency_libs="$temp_xrpath $dependency_libs"
  6802. fi
  6803. fi
  6804. # Make sure dlfiles contains only unique files that won't be dlpreopened
  6805. old_dlfiles="$dlfiles"
  6806. dlfiles=
  6807. for lib in $old_dlfiles; do
  6808. case " $dlprefiles $dlfiles " in
  6809. *" $lib "*) ;;
  6810. *) func_append dlfiles " $lib" ;;
  6811. esac
  6812. done
  6813. # Make sure dlprefiles contains only unique files
  6814. old_dlprefiles="$dlprefiles"
  6815. dlprefiles=
  6816. for lib in $old_dlprefiles; do
  6817. case "$dlprefiles " in
  6818. *" $lib "*) ;;
  6819. *) func_append dlprefiles " $lib" ;;
  6820. esac
  6821. done
  6822. if test "$build_libtool_libs" = yes; then
  6823. if test -n "$rpath"; then
  6824. case $host in
  6825. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6826. # these systems don't actually have a c library (as such)!
  6827. ;;
  6828. *-*-rhapsody* | *-*-darwin1.[012])
  6829. # Rhapsody C library is in the System framework
  6830. func_append deplibs " System.ltframework"
  6831. ;;
  6832. *-*-netbsd*)
  6833. # Don't link with libc until the a.out ld.so is fixed.
  6834. ;;
  6835. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  6836. # Do not include libc due to us having libc/libc_r.
  6837. ;;
  6838. *-*-sco3.2v5* | *-*-sco5v6*)
  6839. # Causes problems with __ctype
  6840. ;;
  6841. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6842. # Compiler inserts libc in the correct place for threads to work
  6843. ;;
  6844. *)
  6845. # Add libc to deplibs on all other systems if necessary.
  6846. if test "$build_libtool_need_lc" = "yes"; then
  6847. func_append deplibs " -lc"
  6848. fi
  6849. ;;
  6850. esac
  6851. fi
  6852. # Transform deplibs into only deplibs that can be linked in shared.
  6853. name_save=$name
  6854. libname_save=$libname
  6855. release_save=$release
  6856. versuffix_save=$versuffix
  6857. major_save=$major
  6858. # I'm not sure if I'm treating the release correctly. I think
  6859. # release should show up in the -l (ie -lgmp5) so we don't want to
  6860. # add it in twice. Is that correct?
  6861. release=""
  6862. versuffix=""
  6863. major=""
  6864. newdeplibs=
  6865. droppeddeps=no
  6866. case $deplibs_check_method in
  6867. pass_all)
  6868. # Don't check for shared/static. Everything works.
  6869. # This might be a little naive. We might want to check
  6870. # whether the library exists or not. But this is on
  6871. # osf3 & osf4 and I'm not really sure... Just
  6872. # implementing what was already the behavior.
  6873. newdeplibs=$deplibs
  6874. ;;
  6875. test_compile)
  6876. # This code stresses the "libraries are programs" paradigm to its
  6877. # limits. Maybe even breaks it. We compile a program, linking it
  6878. # against the deplibs as a proxy for the library. Then we can check
  6879. # whether they linked in statically or dynamically with ldd.
  6880. $opt_dry_run || $RM conftest.c
  6881. cat > conftest.c <<EOF
  6882. int main() { return 0; }
  6883. EOF
  6884. $opt_dry_run || $RM conftest
  6885. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  6886. ldd_output=`ldd conftest`
  6887. for i in $deplibs; do
  6888. case $i in
  6889. -l*)
  6890. func_stripname -l '' "$i"
  6891. name=$func_stripname_result
  6892. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6893. case " $predeps $postdeps " in
  6894. *" $i "*)
  6895. func_append newdeplibs " $i"
  6896. i=""
  6897. ;;
  6898. esac
  6899. fi
  6900. if test -n "$i" ; then
  6901. libname=`eval "\\$ECHO \"$libname_spec\""`
  6902. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  6903. set dummy $deplib_matches; shift
  6904. deplib_match=$1
  6905. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  6906. func_append newdeplibs " $i"
  6907. else
  6908. droppeddeps=yes
  6909. echo
  6910. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  6911. echo "*** I have the capability to make that library automatically link in when"
  6912. echo "*** you link to this library. But I can only do this if you have a"
  6913. echo "*** shared version of the library, which I believe you do not have"
  6914. echo "*** because a test_compile did reveal that the linker did not use it for"
  6915. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  6916. fi
  6917. fi
  6918. ;;
  6919. *)
  6920. func_append newdeplibs " $i"
  6921. ;;
  6922. esac
  6923. done
  6924. else
  6925. # Error occurred in the first compile. Let's try to salvage
  6926. # the situation: Compile a separate program for each library.
  6927. for i in $deplibs; do
  6928. case $i in
  6929. -l*)
  6930. func_stripname -l '' "$i"
  6931. name=$func_stripname_result
  6932. $opt_dry_run || $RM conftest
  6933. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  6934. ldd_output=`ldd conftest`
  6935. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6936. case " $predeps $postdeps " in
  6937. *" $i "*)
  6938. func_append newdeplibs " $i"
  6939. i=""
  6940. ;;
  6941. esac
  6942. fi
  6943. if test -n "$i" ; then
  6944. libname=`eval "\\$ECHO \"$libname_spec\""`
  6945. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  6946. set dummy $deplib_matches; shift
  6947. deplib_match=$1
  6948. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  6949. func_append newdeplibs " $i"
  6950. else
  6951. droppeddeps=yes
  6952. echo
  6953. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  6954. echo "*** I have the capability to make that library automatically link in when"
  6955. echo "*** you link to this library. But I can only do this if you have a"
  6956. echo "*** shared version of the library, which you do not appear to have"
  6957. echo "*** because a test_compile did reveal that the linker did not use this one"
  6958. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  6959. fi
  6960. fi
  6961. else
  6962. droppeddeps=yes
  6963. echo
  6964. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  6965. echo "*** make it link in! You will probably need to install it or some"
  6966. echo "*** library that it depends on before this library will be fully"
  6967. echo "*** functional. Installing it before continuing would be even better."
  6968. fi
  6969. ;;
  6970. *)
  6971. func_append newdeplibs " $i"
  6972. ;;
  6973. esac
  6974. done
  6975. fi
  6976. ;;
  6977. file_magic*)
  6978. set dummy $deplibs_check_method; shift
  6979. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6980. for a_deplib in $deplibs; do
  6981. case $a_deplib in
  6982. -l*)
  6983. func_stripname -l '' "$a_deplib"
  6984. name=$func_stripname_result
  6985. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6986. case " $predeps $postdeps " in
  6987. *" $a_deplib "*)
  6988. func_append newdeplibs " $a_deplib"
  6989. a_deplib=""
  6990. ;;
  6991. esac
  6992. fi
  6993. if test -n "$a_deplib" ; then
  6994. libname=`eval "\\$ECHO \"$libname_spec\""`
  6995. if test -n "$file_magic_glob"; then
  6996. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  6997. else
  6998. libnameglob=$libname
  6999. fi
  7000. test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
  7001. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  7002. if test "$want_nocaseglob" = yes; then
  7003. shopt -s nocaseglob
  7004. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  7005. $nocaseglob
  7006. else
  7007. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  7008. fi
  7009. for potent_lib in $potential_libs; do
  7010. # Follow soft links.
  7011. if ls -lLd "$potent_lib" 2>/dev/null |
  7012. $GREP " -> " >/dev/null; then
  7013. continue
  7014. fi
  7015. # The statement above tries to avoid entering an
  7016. # endless loop below, in case of cyclic links.
  7017. # We might still enter an endless loop, since a link
  7018. # loop can be closed while we follow links,
  7019. # but so what?
  7020. potlib="$potent_lib"
  7021. while test -h "$potlib" 2>/dev/null; do
  7022. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  7023. case $potliblink in
  7024. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  7025. *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
  7026. esac
  7027. done
  7028. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  7029. $SED -e 10q |
  7030. $EGREP "$file_magic_regex" > /dev/null; then
  7031. func_append newdeplibs " $a_deplib"
  7032. a_deplib=""
  7033. break 2
  7034. fi
  7035. done
  7036. done
  7037. fi
  7038. if test -n "$a_deplib" ; then
  7039. droppeddeps=yes
  7040. echo
  7041. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  7042. echo "*** I have the capability to make that library automatically link in when"
  7043. echo "*** you link to this library. But I can only do this if you have a"
  7044. echo "*** shared version of the library, which you do not appear to have"
  7045. echo "*** because I did check the linker path looking for a file starting"
  7046. if test -z "$potlib" ; then
  7047. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  7048. else
  7049. $ECHO "*** with $libname and none of the candidates passed a file format test"
  7050. $ECHO "*** using a file magic. Last file checked: $potlib"
  7051. fi
  7052. fi
  7053. ;;
  7054. *)
  7055. # Add a -L argument.
  7056. func_append newdeplibs " $a_deplib"
  7057. ;;
  7058. esac
  7059. done # Gone through all deplibs.
  7060. ;;
  7061. match_pattern*)
  7062. set dummy $deplibs_check_method; shift
  7063. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7064. for a_deplib in $deplibs; do
  7065. case $a_deplib in
  7066. -l*)
  7067. func_stripname -l '' "$a_deplib"
  7068. name=$func_stripname_result
  7069. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  7070. case " $predeps $postdeps " in
  7071. *" $a_deplib "*)
  7072. func_append newdeplibs " $a_deplib"
  7073. a_deplib=""
  7074. ;;
  7075. esac
  7076. fi
  7077. if test -n "$a_deplib" ; then
  7078. libname=`eval "\\$ECHO \"$libname_spec\""`
  7079. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  7080. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  7081. for potent_lib in $potential_libs; do
  7082. potlib="$potent_lib" # see symlink-check above in file_magic test
  7083. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  7084. $EGREP "$match_pattern_regex" > /dev/null; then
  7085. func_append newdeplibs " $a_deplib"
  7086. a_deplib=""
  7087. break 2
  7088. fi
  7089. done
  7090. done
  7091. fi
  7092. if test -n "$a_deplib" ; then
  7093. droppeddeps=yes
  7094. echo
  7095. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  7096. echo "*** I have the capability to make that library automatically link in when"
  7097. echo "*** you link to this library. But I can only do this if you have a"
  7098. echo "*** shared version of the library, which you do not appear to have"
  7099. echo "*** because I did check the linker path looking for a file starting"
  7100. if test -z "$potlib" ; then
  7101. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  7102. else
  7103. $ECHO "*** with $libname and none of the candidates passed a file format test"
  7104. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  7105. fi
  7106. fi
  7107. ;;
  7108. *)
  7109. # Add a -L argument.
  7110. func_append newdeplibs " $a_deplib"
  7111. ;;
  7112. esac
  7113. done # Gone through all deplibs.
  7114. ;;
  7115. none | unknown | *)
  7116. newdeplibs=""
  7117. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  7118. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  7119. for i in $predeps $postdeps ; do
  7120. # can't use Xsed below, because $i might contain '/'
  7121. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
  7122. done
  7123. fi
  7124. case $tmp_deplibs in
  7125. *[!\ \ ]*)
  7126. echo
  7127. if test "X$deplibs_check_method" = "Xnone"; then
  7128. echo "*** Warning: inter-library dependencies are not supported in this platform."
  7129. else
  7130. echo "*** Warning: inter-library dependencies are not known to be supported."
  7131. fi
  7132. echo "*** All declared inter-library dependencies are being dropped."
  7133. droppeddeps=yes
  7134. ;;
  7135. esac
  7136. ;;
  7137. esac
  7138. versuffix=$versuffix_save
  7139. major=$major_save
  7140. release=$release_save
  7141. libname=$libname_save
  7142. name=$name_save
  7143. case $host in
  7144. *-*-rhapsody* | *-*-darwin1.[012])
  7145. # On Rhapsody replace the C library with the System framework
  7146. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  7147. ;;
  7148. esac
  7149. if test "$droppeddeps" = yes; then
  7150. if test "$module" = yes; then
  7151. echo
  7152. echo "*** Warning: libtool could not satisfy all declared inter-library"
  7153. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  7154. echo "*** a static module, that should work as long as the dlopening"
  7155. echo "*** application is linked with the -dlopen flag."
  7156. if test -z "$global_symbol_pipe"; then
  7157. echo
  7158. echo "*** However, this would only work if libtool was able to extract symbol"
  7159. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  7160. echo "*** not find such a program. So, this module is probably useless."
  7161. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  7162. fi
  7163. if test "$build_old_libs" = no; then
  7164. oldlibs="$output_objdir/$libname.$libext"
  7165. build_libtool_libs=module
  7166. build_old_libs=yes
  7167. else
  7168. build_libtool_libs=no
  7169. fi
  7170. else
  7171. echo "*** The inter-library dependencies that have been dropped here will be"
  7172. echo "*** automatically added whenever a program is linked with this library"
  7173. echo "*** or is declared to -dlopen it."
  7174. if test "$allow_undefined" = no; then
  7175. echo
  7176. echo "*** Since this library must not contain undefined symbols,"
  7177. echo "*** because either the platform does not support them or"
  7178. echo "*** it was explicitly requested with -no-undefined,"
  7179. echo "*** libtool will only create a static version of it."
  7180. if test "$build_old_libs" = no; then
  7181. oldlibs="$output_objdir/$libname.$libext"
  7182. build_libtool_libs=module
  7183. build_old_libs=yes
  7184. else
  7185. build_libtool_libs=no
  7186. fi
  7187. fi
  7188. fi
  7189. fi
  7190. # Done checking deplibs!
  7191. deplibs=$newdeplibs
  7192. fi
  7193. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  7194. case $host in
  7195. *-*-darwin*)
  7196. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7197. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7198. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7199. ;;
  7200. esac
  7201. # move library search paths that coincide with paths to not yet
  7202. # installed libraries to the beginning of the library search list
  7203. new_libs=
  7204. for path in $notinst_path; do
  7205. case " $new_libs " in
  7206. *" -L$path/$objdir "*) ;;
  7207. *)
  7208. case " $deplibs " in
  7209. *" -L$path/$objdir "*)
  7210. func_append new_libs " -L$path/$objdir" ;;
  7211. esac
  7212. ;;
  7213. esac
  7214. done
  7215. for deplib in $deplibs; do
  7216. case $deplib in
  7217. -L*)
  7218. case " $new_libs " in
  7219. *" $deplib "*) ;;
  7220. *) func_append new_libs " $deplib" ;;
  7221. esac
  7222. ;;
  7223. *) func_append new_libs " $deplib" ;;
  7224. esac
  7225. done
  7226. deplibs="$new_libs"
  7227. # All the library-specific variables (install_libdir is set above).
  7228. library_names=
  7229. old_library=
  7230. dlname=
  7231. # Test again, we may have decided not to build it any more
  7232. if test "$build_libtool_libs" = yes; then
  7233. # Remove ${wl} instances when linking with ld.
  7234. # FIXME: should test the right _cmds variable.
  7235. case $archive_cmds in
  7236. *\$LD\ *) wl= ;;
  7237. esac
  7238. if test "$hardcode_into_libs" = yes; then
  7239. # Hardcode the library paths
  7240. hardcode_libdirs=
  7241. dep_rpath=
  7242. rpath="$finalize_rpath"
  7243. test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
  7244. for libdir in $rpath; do
  7245. if test -n "$hardcode_libdir_flag_spec"; then
  7246. if test -n "$hardcode_libdir_separator"; then
  7247. func_replace_sysroot "$libdir"
  7248. libdir=$func_replace_sysroot_result
  7249. if test -z "$hardcode_libdirs"; then
  7250. hardcode_libdirs="$libdir"
  7251. else
  7252. # Just accumulate the unique libdirs.
  7253. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7254. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7255. ;;
  7256. *)
  7257. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  7258. ;;
  7259. esac
  7260. fi
  7261. else
  7262. eval flag=\"$hardcode_libdir_flag_spec\"
  7263. func_append dep_rpath " $flag"
  7264. fi
  7265. elif test -n "$runpath_var"; then
  7266. case "$perm_rpath " in
  7267. *" $libdir "*) ;;
  7268. *) func_append perm_rpath " $libdir" ;;
  7269. esac
  7270. fi
  7271. done
  7272. # Substitute the hardcoded libdirs into the rpath.
  7273. if test -n "$hardcode_libdir_separator" &&
  7274. test -n "$hardcode_libdirs"; then
  7275. libdir="$hardcode_libdirs"
  7276. eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  7277. fi
  7278. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  7279. # We should set the runpath_var.
  7280. rpath=
  7281. for dir in $perm_rpath; do
  7282. func_append rpath "$dir:"
  7283. done
  7284. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  7285. fi
  7286. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  7287. fi
  7288. shlibpath="$finalize_shlibpath"
  7289. test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  7290. if test -n "$shlibpath"; then
  7291. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  7292. fi
  7293. # Get the real and link names of the library.
  7294. eval shared_ext=\"$shrext_cmds\"
  7295. eval library_names=\"$library_names_spec\"
  7296. set dummy $library_names
  7297. shift
  7298. realname="$1"
  7299. shift
  7300. if test -n "$soname_spec"; then
  7301. eval soname=\"$soname_spec\"
  7302. else
  7303. soname="$realname"
  7304. fi
  7305. if test -z "$dlname"; then
  7306. dlname=$soname
  7307. fi
  7308. lib="$output_objdir/$realname"
  7309. linknames=
  7310. for link
  7311. do
  7312. func_append linknames " $link"
  7313. done
  7314. # Use standard objects if they are pic
  7315. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  7316. test "X$libobjs" = "X " && libobjs=
  7317. delfiles=
  7318. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  7319. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  7320. export_symbols="$output_objdir/$libname.uexp"
  7321. func_append delfiles " $export_symbols"
  7322. fi
  7323. orig_export_symbols=
  7324. case $host_os in
  7325. cygwin* | mingw* | cegcc*)
  7326. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  7327. # exporting using user supplied symfile
  7328. if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
  7329. # and it's NOT already a .def file. Must figure out
  7330. # which of the given symbols are data symbols and tag
  7331. # them as such. So, trigger use of export_symbols_cmds.
  7332. # export_symbols gets reassigned inside the "prepare
  7333. # the list of exported symbols" if statement, so the
  7334. # include_expsyms logic still works.
  7335. orig_export_symbols="$export_symbols"
  7336. export_symbols=
  7337. always_export_symbols=yes
  7338. fi
  7339. fi
  7340. ;;
  7341. esac
  7342. # Prepare the list of exported symbols
  7343. if test -z "$export_symbols"; then
  7344. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  7345. func_verbose "generating symbol list for \`$libname.la'"
  7346. export_symbols="$output_objdir/$libname.exp"
  7347. $opt_dry_run || $RM $export_symbols
  7348. cmds=$export_symbols_cmds
  7349. save_ifs="$IFS"; IFS='~'
  7350. for cmd1 in $cmds; do
  7351. IFS="$save_ifs"
  7352. # Take the normal branch if the nm_file_list_spec branch
  7353. # doesn't work or if tool conversion is not needed.
  7354. case $nm_file_list_spec~$to_tool_file_cmd in
  7355. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  7356. try_normal_branch=yes
  7357. eval cmd=\"$cmd1\"
  7358. func_len " $cmd"
  7359. len=$func_len_result
  7360. ;;
  7361. *)
  7362. try_normal_branch=no
  7363. ;;
  7364. esac
  7365. if test "$try_normal_branch" = yes \
  7366. && { test "$len" -lt "$max_cmd_len" \
  7367. || test "$max_cmd_len" -le -1; }
  7368. then
  7369. func_show_eval "$cmd" 'exit $?'
  7370. skipped_export=false
  7371. elif test -n "$nm_file_list_spec"; then
  7372. func_basename "$output"
  7373. output_la=$func_basename_result
  7374. save_libobjs=$libobjs
  7375. save_output=$output
  7376. output=${output_objdir}/${output_la}.nm
  7377. func_to_tool_file "$output"
  7378. libobjs=$nm_file_list_spec$func_to_tool_file_result
  7379. func_append delfiles " $output"
  7380. func_verbose "creating $NM input file list: $output"
  7381. for obj in $save_libobjs; do
  7382. func_to_tool_file "$obj"
  7383. $ECHO "$func_to_tool_file_result"
  7384. done > "$output"
  7385. eval cmd=\"$cmd1\"
  7386. func_show_eval "$cmd" 'exit $?'
  7387. output=$save_output
  7388. libobjs=$save_libobjs
  7389. skipped_export=false
  7390. else
  7391. # The command line is too long to execute in one step.
  7392. func_verbose "using reloadable object file for export list..."
  7393. skipped_export=:
  7394. # Break out early, otherwise skipped_export may be
  7395. # set to false by a later but shorter cmd.
  7396. break
  7397. fi
  7398. done
  7399. IFS="$save_ifs"
  7400. if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
  7401. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  7402. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  7403. fi
  7404. fi
  7405. fi
  7406. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  7407. tmp_export_symbols="$export_symbols"
  7408. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  7409. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  7410. fi
  7411. if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
  7412. # The given exports_symbols file has to be filtered, so filter it.
  7413. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  7414. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  7415. # 's' commands which not all seds can handle. GNU sed should be fine
  7416. # though. Also, the filter scales superlinearly with the number of
  7417. # global variables. join(1) would be nice here, but unfortunately
  7418. # isn't a blessed tool.
  7419. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  7420. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  7421. export_symbols=$output_objdir/$libname.def
  7422. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  7423. fi
  7424. tmp_deplibs=
  7425. for test_deplib in $deplibs; do
  7426. case " $convenience " in
  7427. *" $test_deplib "*) ;;
  7428. *)
  7429. func_append tmp_deplibs " $test_deplib"
  7430. ;;
  7431. esac
  7432. done
  7433. deplibs="$tmp_deplibs"
  7434. if test -n "$convenience"; then
  7435. if test -n "$whole_archive_flag_spec" &&
  7436. test "$compiler_needs_object" = yes &&
  7437. test -z "$libobjs"; then
  7438. # extract the archives, so we have objects to list.
  7439. # TODO: could optimize this to just extract one archive.
  7440. whole_archive_flag_spec=
  7441. fi
  7442. if test -n "$whole_archive_flag_spec"; then
  7443. save_libobjs=$libobjs
  7444. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  7445. test "X$libobjs" = "X " && libobjs=
  7446. else
  7447. gentop="$output_objdir/${outputname}x"
  7448. func_append generated " $gentop"
  7449. func_extract_archives $gentop $convenience
  7450. func_append libobjs " $func_extract_archives_result"
  7451. test "X$libobjs" = "X " && libobjs=
  7452. fi
  7453. fi
  7454. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  7455. eval flag=\"$thread_safe_flag_spec\"
  7456. func_append linker_flags " $flag"
  7457. fi
  7458. # Make a backup of the uninstalled library when relinking
  7459. if test "$opt_mode" = relink; then
  7460. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  7461. fi
  7462. # Do each of the archive commands.
  7463. if test "$module" = yes && test -n "$module_cmds" ; then
  7464. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  7465. eval test_cmds=\"$module_expsym_cmds\"
  7466. cmds=$module_expsym_cmds
  7467. else
  7468. eval test_cmds=\"$module_cmds\"
  7469. cmds=$module_cmds
  7470. fi
  7471. else
  7472. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  7473. eval test_cmds=\"$archive_expsym_cmds\"
  7474. cmds=$archive_expsym_cmds
  7475. else
  7476. eval test_cmds=\"$archive_cmds\"
  7477. cmds=$archive_cmds
  7478. fi
  7479. fi
  7480. if test "X$skipped_export" != "X:" &&
  7481. func_len " $test_cmds" &&
  7482. len=$func_len_result &&
  7483. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  7484. :
  7485. else
  7486. # The command line is too long to link in one step, link piecewise
  7487. # or, if using GNU ld and skipped_export is not :, use a linker
  7488. # script.
  7489. # Save the value of $output and $libobjs because we want to
  7490. # use them later. If we have whole_archive_flag_spec, we
  7491. # want to use save_libobjs as it was before
  7492. # whole_archive_flag_spec was expanded, because we can't
  7493. # assume the linker understands whole_archive_flag_spec.
  7494. # This may have to be revisited, in case too many
  7495. # convenience libraries get linked in and end up exceeding
  7496. # the spec.
  7497. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  7498. save_libobjs=$libobjs
  7499. fi
  7500. save_output=$output
  7501. func_basename "$output"
  7502. output_la=$func_basename_result
  7503. # Clear the reloadable object creation command queue and
  7504. # initialize k to one.
  7505. test_cmds=
  7506. concat_cmds=
  7507. objlist=
  7508. last_robj=
  7509. k=1
  7510. if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
  7511. output=${output_objdir}/${output_la}.lnkscript
  7512. func_verbose "creating GNU ld script: $output"
  7513. echo 'INPUT (' > $output
  7514. for obj in $save_libobjs
  7515. do
  7516. func_to_tool_file "$obj"
  7517. $ECHO "$func_to_tool_file_result" >> $output
  7518. done
  7519. echo ')' >> $output
  7520. func_append delfiles " $output"
  7521. func_to_tool_file "$output"
  7522. output=$func_to_tool_file_result
  7523. elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
  7524. output=${output_objdir}/${output_la}.lnk
  7525. func_verbose "creating linker input file list: $output"
  7526. : > $output
  7527. set x $save_libobjs
  7528. shift
  7529. firstobj=
  7530. if test "$compiler_needs_object" = yes; then
  7531. firstobj="$1 "
  7532. shift
  7533. fi
  7534. for obj
  7535. do
  7536. func_to_tool_file "$obj"
  7537. $ECHO "$func_to_tool_file_result" >> $output
  7538. done
  7539. func_append delfiles " $output"
  7540. func_to_tool_file "$output"
  7541. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  7542. else
  7543. if test -n "$save_libobjs"; then
  7544. func_verbose "creating reloadable object files..."
  7545. output=$output_objdir/$output_la-${k}.$objext
  7546. eval test_cmds=\"$reload_cmds\"
  7547. func_len " $test_cmds"
  7548. len0=$func_len_result
  7549. len=$len0
  7550. # Loop over the list of objects to be linked.
  7551. for obj in $save_libobjs
  7552. do
  7553. func_len " $obj"
  7554. func_arith $len + $func_len_result
  7555. len=$func_arith_result
  7556. if test "X$objlist" = X ||
  7557. test "$len" -lt "$max_cmd_len"; then
  7558. func_append objlist " $obj"
  7559. else
  7560. # The command $test_cmds is almost too long, add a
  7561. # command to the queue.
  7562. if test "$k" -eq 1 ; then
  7563. # The first file doesn't have a previous command to add.
  7564. reload_objs=$objlist
  7565. eval concat_cmds=\"$reload_cmds\"
  7566. else
  7567. # All subsequent reloadable object files will link in
  7568. # the last one created.
  7569. reload_objs="$objlist $last_robj"
  7570. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  7571. fi
  7572. last_robj=$output_objdir/$output_la-${k}.$objext
  7573. func_arith $k + 1
  7574. k=$func_arith_result
  7575. output=$output_objdir/$output_la-${k}.$objext
  7576. objlist=" $obj"
  7577. func_len " $last_robj"
  7578. func_arith $len0 + $func_len_result
  7579. len=$func_arith_result
  7580. fi
  7581. done
  7582. # Handle the remaining objects by creating one last
  7583. # reloadable object file. All subsequent reloadable object
  7584. # files will link in the last one created.
  7585. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  7586. reload_objs="$objlist $last_robj"
  7587. eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
  7588. if test -n "$last_robj"; then
  7589. eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
  7590. fi
  7591. func_append delfiles " $output"
  7592. else
  7593. output=
  7594. fi
  7595. if ${skipped_export-false}; then
  7596. func_verbose "generating symbol list for \`$libname.la'"
  7597. export_symbols="$output_objdir/$libname.exp"
  7598. $opt_dry_run || $RM $export_symbols
  7599. libobjs=$output
  7600. # Append the command to create the export file.
  7601. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  7602. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  7603. if test -n "$last_robj"; then
  7604. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  7605. fi
  7606. fi
  7607. test -n "$save_libobjs" &&
  7608. func_verbose "creating a temporary reloadable object file: $output"
  7609. # Loop through the commands generated above and execute them.
  7610. save_ifs="$IFS"; IFS='~'
  7611. for cmd in $concat_cmds; do
  7612. IFS="$save_ifs"
  7613. $opt_silent || {
  7614. func_quote_for_expand "$cmd"
  7615. eval "func_echo $func_quote_for_expand_result"
  7616. }
  7617. $opt_dry_run || eval "$cmd" || {
  7618. lt_exit=$?
  7619. # Restore the uninstalled library and exit
  7620. if test "$opt_mode" = relink; then
  7621. ( cd "$output_objdir" && \
  7622. $RM "${realname}T" && \
  7623. $MV "${realname}U" "$realname" )
  7624. fi
  7625. exit $lt_exit
  7626. }
  7627. done
  7628. IFS="$save_ifs"
  7629. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  7630. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  7631. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  7632. fi
  7633. fi
  7634. if ${skipped_export-false}; then
  7635. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  7636. tmp_export_symbols="$export_symbols"
  7637. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  7638. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  7639. fi
  7640. if test -n "$orig_export_symbols"; then
  7641. # The given exports_symbols file has to be filtered, so filter it.
  7642. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  7643. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  7644. # 's' commands which not all seds can handle. GNU sed should be fine
  7645. # though. Also, the filter scales superlinearly with the number of
  7646. # global variables. join(1) would be nice here, but unfortunately
  7647. # isn't a blessed tool.
  7648. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  7649. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  7650. export_symbols=$output_objdir/$libname.def
  7651. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  7652. fi
  7653. fi
  7654. libobjs=$output
  7655. # Restore the value of output.
  7656. output=$save_output
  7657. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  7658. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  7659. test "X$libobjs" = "X " && libobjs=
  7660. fi
  7661. # Expand the library linking commands again to reset the
  7662. # value of $libobjs for piecewise linking.
  7663. # Do each of the archive commands.
  7664. if test "$module" = yes && test -n "$module_cmds" ; then
  7665. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  7666. cmds=$module_expsym_cmds
  7667. else
  7668. cmds=$module_cmds
  7669. fi
  7670. else
  7671. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  7672. cmds=$archive_expsym_cmds
  7673. else
  7674. cmds=$archive_cmds
  7675. fi
  7676. fi
  7677. fi
  7678. if test -n "$delfiles"; then
  7679. # Append the command to remove temporary files to $cmds.
  7680. eval cmds=\"\$cmds~\$RM $delfiles\"
  7681. fi
  7682. # Add any objects from preloaded convenience libraries
  7683. if test -n "$dlprefiles"; then
  7684. gentop="$output_objdir/${outputname}x"
  7685. func_append generated " $gentop"
  7686. func_extract_archives $gentop $dlprefiles
  7687. func_append libobjs " $func_extract_archives_result"
  7688. test "X$libobjs" = "X " && libobjs=
  7689. fi
  7690. save_ifs="$IFS"; IFS='~'
  7691. for cmd in $cmds; do
  7692. IFS="$save_ifs"
  7693. eval cmd=\"$cmd\"
  7694. $opt_silent || {
  7695. func_quote_for_expand "$cmd"
  7696. eval "func_echo $func_quote_for_expand_result"
  7697. }
  7698. $opt_dry_run || eval "$cmd" || {
  7699. lt_exit=$?
  7700. # Restore the uninstalled library and exit
  7701. if test "$opt_mode" = relink; then
  7702. ( cd "$output_objdir" && \
  7703. $RM "${realname}T" && \
  7704. $MV "${realname}U" "$realname" )
  7705. fi
  7706. exit $lt_exit
  7707. }
  7708. done
  7709. IFS="$save_ifs"
  7710. # Restore the uninstalled library and exit
  7711. if test "$opt_mode" = relink; then
  7712. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  7713. if test -n "$convenience"; then
  7714. if test -z "$whole_archive_flag_spec"; then
  7715. func_show_eval '${RM}r "$gentop"'
  7716. fi
  7717. fi
  7718. exit $EXIT_SUCCESS
  7719. fi
  7720. # Create links to the real library.
  7721. for linkname in $linknames; do
  7722. if test "$realname" != "$linkname"; then
  7723. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  7724. fi
  7725. done
  7726. # If -module or -export-dynamic was specified, set the dlname.
  7727. if test "$module" = yes || test "$export_dynamic" = yes; then
  7728. # On all known operating systems, these are identical.
  7729. dlname="$soname"
  7730. fi
  7731. fi
  7732. ;;
  7733. obj)
  7734. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  7735. func_warning "\`-dlopen' is ignored for objects"
  7736. fi
  7737. case " $deplibs" in
  7738. *\ -l* | *\ -L*)
  7739. func_warning "\`-l' and \`-L' are ignored for objects" ;;
  7740. esac
  7741. test -n "$rpath" && \
  7742. func_warning "\`-rpath' is ignored for objects"
  7743. test -n "$xrpath" && \
  7744. func_warning "\`-R' is ignored for objects"
  7745. test -n "$vinfo" && \
  7746. func_warning "\`-version-info' is ignored for objects"
  7747. test -n "$release" && \
  7748. func_warning "\`-release' is ignored for objects"
  7749. case $output in
  7750. *.lo)
  7751. test -n "$objs$old_deplibs" && \
  7752. func_fatal_error "cannot build library object \`$output' from non-libtool objects"
  7753. libobj=$output
  7754. func_lo2o "$libobj"
  7755. obj=$func_lo2o_result
  7756. ;;
  7757. *)
  7758. libobj=
  7759. obj="$output"
  7760. ;;
  7761. esac
  7762. # Delete the old objects.
  7763. $opt_dry_run || $RM $obj $libobj
  7764. # Objects from convenience libraries. This assumes
  7765. # single-version convenience libraries. Whenever we create
  7766. # different ones for PIC/non-PIC, this we'll have to duplicate
  7767. # the extraction.
  7768. reload_conv_objs=
  7769. gentop=
  7770. # reload_cmds runs $LD directly, so let us get rid of
  7771. # -Wl from whole_archive_flag_spec and hope we can get by with
  7772. # turning comma into space..
  7773. wl=
  7774. if test -n "$convenience"; then
  7775. if test -n "$whole_archive_flag_spec"; then
  7776. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  7777. reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  7778. else
  7779. gentop="$output_objdir/${obj}x"
  7780. func_append generated " $gentop"
  7781. func_extract_archives $gentop $convenience
  7782. reload_conv_objs="$reload_objs $func_extract_archives_result"
  7783. fi
  7784. fi
  7785. # If we're not building shared, we need to use non_pic_objs
  7786. test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
  7787. # Create the old-style object.
  7788. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  7789. output="$obj"
  7790. func_execute_cmds "$reload_cmds" 'exit $?'
  7791. # Exit if we aren't doing a library object file.
  7792. if test -z "$libobj"; then
  7793. if test -n "$gentop"; then
  7794. func_show_eval '${RM}r "$gentop"'
  7795. fi
  7796. exit $EXIT_SUCCESS
  7797. fi
  7798. if test "$build_libtool_libs" != yes; then
  7799. if test -n "$gentop"; then
  7800. func_show_eval '${RM}r "$gentop"'
  7801. fi
  7802. # Create an invalid libtool object if no PIC, so that we don't
  7803. # accidentally link it into a program.
  7804. # $show "echo timestamp > $libobj"
  7805. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  7806. exit $EXIT_SUCCESS
  7807. fi
  7808. if test -n "$pic_flag" || test "$pic_mode" != default; then
  7809. # Only do commands if we really have different PIC objects.
  7810. reload_objs="$libobjs $reload_conv_objs"
  7811. output="$libobj"
  7812. func_execute_cmds "$reload_cmds" 'exit $?'
  7813. fi
  7814. if test -n "$gentop"; then
  7815. func_show_eval '${RM}r "$gentop"'
  7816. fi
  7817. exit $EXIT_SUCCESS
  7818. ;;
  7819. prog)
  7820. case $host in
  7821. *cygwin*) func_stripname '' '.exe' "$output"
  7822. output=$func_stripname_result.exe;;
  7823. esac
  7824. test -n "$vinfo" && \
  7825. func_warning "\`-version-info' is ignored for programs"
  7826. test -n "$release" && \
  7827. func_warning "\`-release' is ignored for programs"
  7828. test "$preload" = yes \
  7829. && test "$dlopen_support" = unknown \
  7830. && test "$dlopen_self" = unknown \
  7831. && test "$dlopen_self_static" = unknown && \
  7832. func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
  7833. case $host in
  7834. *-*-rhapsody* | *-*-darwin1.[012])
  7835. # On Rhapsody replace the C library is the System framework
  7836. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  7837. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  7838. ;;
  7839. esac
  7840. case $host in
  7841. *-*-darwin*)
  7842. # Don't allow lazy linking, it breaks C++ global constructors
  7843. # But is supposedly fixed on 10.4 or later (yay!).
  7844. if test "$tagname" = CXX ; then
  7845. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  7846. 10.[0123])
  7847. func_append compile_command " ${wl}-bind_at_load"
  7848. func_append finalize_command " ${wl}-bind_at_load"
  7849. ;;
  7850. esac
  7851. fi
  7852. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  7853. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7854. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7855. ;;
  7856. esac
  7857. # move library search paths that coincide with paths to not yet
  7858. # installed libraries to the beginning of the library search list
  7859. new_libs=
  7860. for path in $notinst_path; do
  7861. case " $new_libs " in
  7862. *" -L$path/$objdir "*) ;;
  7863. *)
  7864. case " $compile_deplibs " in
  7865. *" -L$path/$objdir "*)
  7866. func_append new_libs " -L$path/$objdir" ;;
  7867. esac
  7868. ;;
  7869. esac
  7870. done
  7871. for deplib in $compile_deplibs; do
  7872. case $deplib in
  7873. -L*)
  7874. case " $new_libs " in
  7875. *" $deplib "*) ;;
  7876. *) func_append new_libs " $deplib" ;;
  7877. esac
  7878. ;;
  7879. *) func_append new_libs " $deplib" ;;
  7880. esac
  7881. done
  7882. compile_deplibs="$new_libs"
  7883. func_append compile_command " $compile_deplibs"
  7884. func_append finalize_command " $finalize_deplibs"
  7885. if test -n "$rpath$xrpath"; then
  7886. # If the user specified any rpath flags, then add them.
  7887. for libdir in $rpath $xrpath; do
  7888. # This is the magic to use -rpath.
  7889. case "$finalize_rpath " in
  7890. *" $libdir "*) ;;
  7891. *) func_append finalize_rpath " $libdir" ;;
  7892. esac
  7893. done
  7894. fi
  7895. # Now hardcode the library paths
  7896. rpath=
  7897. hardcode_libdirs=
  7898. for libdir in $compile_rpath $finalize_rpath; do
  7899. if test -n "$hardcode_libdir_flag_spec"; then
  7900. if test -n "$hardcode_libdir_separator"; then
  7901. if test -z "$hardcode_libdirs"; then
  7902. hardcode_libdirs="$libdir"
  7903. else
  7904. # Just accumulate the unique libdirs.
  7905. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7906. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7907. ;;
  7908. *)
  7909. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  7910. ;;
  7911. esac
  7912. fi
  7913. else
  7914. eval flag=\"$hardcode_libdir_flag_spec\"
  7915. func_append rpath " $flag"
  7916. fi
  7917. elif test -n "$runpath_var"; then
  7918. case "$perm_rpath " in
  7919. *" $libdir "*) ;;
  7920. *) func_append perm_rpath " $libdir" ;;
  7921. esac
  7922. fi
  7923. case $host in
  7924. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  7925. testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
  7926. case :$dllsearchpath: in
  7927. *":$libdir:"*) ;;
  7928. ::) dllsearchpath=$libdir;;
  7929. *) func_append dllsearchpath ":$libdir";;
  7930. esac
  7931. case :$dllsearchpath: in
  7932. *":$testbindir:"*) ;;
  7933. ::) dllsearchpath=$testbindir;;
  7934. *) func_append dllsearchpath ":$testbindir";;
  7935. esac
  7936. ;;
  7937. esac
  7938. done
  7939. # Substitute the hardcoded libdirs into the rpath.
  7940. if test -n "$hardcode_libdir_separator" &&
  7941. test -n "$hardcode_libdirs"; then
  7942. libdir="$hardcode_libdirs"
  7943. eval rpath=\" $hardcode_libdir_flag_spec\"
  7944. fi
  7945. compile_rpath="$rpath"
  7946. rpath=
  7947. hardcode_libdirs=
  7948. for libdir in $finalize_rpath; do
  7949. if test -n "$hardcode_libdir_flag_spec"; then
  7950. if test -n "$hardcode_libdir_separator"; then
  7951. if test -z "$hardcode_libdirs"; then
  7952. hardcode_libdirs="$libdir"
  7953. else
  7954. # Just accumulate the unique libdirs.
  7955. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7956. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7957. ;;
  7958. *)
  7959. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  7960. ;;
  7961. esac
  7962. fi
  7963. else
  7964. eval flag=\"$hardcode_libdir_flag_spec\"
  7965. func_append rpath " $flag"
  7966. fi
  7967. elif test -n "$runpath_var"; then
  7968. case "$finalize_perm_rpath " in
  7969. *" $libdir "*) ;;
  7970. *) func_append finalize_perm_rpath " $libdir" ;;
  7971. esac
  7972. fi
  7973. done
  7974. # Substitute the hardcoded libdirs into the rpath.
  7975. if test -n "$hardcode_libdir_separator" &&
  7976. test -n "$hardcode_libdirs"; then
  7977. libdir="$hardcode_libdirs"
  7978. eval rpath=\" $hardcode_libdir_flag_spec\"
  7979. fi
  7980. finalize_rpath="$rpath"
  7981. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  7982. # Transform all the library objects into standard objects.
  7983. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  7984. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  7985. fi
  7986. func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
  7987. # template prelinking step
  7988. if test -n "$prelink_cmds"; then
  7989. func_execute_cmds "$prelink_cmds" 'exit $?'
  7990. fi
  7991. wrappers_required=yes
  7992. case $host in
  7993. *cegcc* | *mingw32ce*)
  7994. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  7995. wrappers_required=no
  7996. ;;
  7997. *cygwin* | *mingw* )
  7998. if test "$build_libtool_libs" != yes; then
  7999. wrappers_required=no
  8000. fi
  8001. ;;
  8002. *)
  8003. if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  8004. wrappers_required=no
  8005. fi
  8006. ;;
  8007. esac
  8008. if test "$wrappers_required" = no; then
  8009. # Replace the output file specification.
  8010. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  8011. link_command="$compile_command$compile_rpath"
  8012. # We have no uninstalled library dependencies, so finalize right now.
  8013. exit_status=0
  8014. func_show_eval "$link_command" 'exit_status=$?'
  8015. if test -n "$postlink_cmds"; then
  8016. func_to_tool_file "$output"
  8017. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  8018. func_execute_cmds "$postlink_cmds" 'exit $?'
  8019. fi
  8020. # Delete the generated files.
  8021. if test -f "$output_objdir/${outputname}S.${objext}"; then
  8022. func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
  8023. fi
  8024. exit $exit_status
  8025. fi
  8026. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  8027. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  8028. fi
  8029. if test -n "$finalize_shlibpath"; then
  8030. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  8031. fi
  8032. compile_var=
  8033. finalize_var=
  8034. if test -n "$runpath_var"; then
  8035. if test -n "$perm_rpath"; then
  8036. # We should set the runpath_var.
  8037. rpath=
  8038. for dir in $perm_rpath; do
  8039. func_append rpath "$dir:"
  8040. done
  8041. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  8042. fi
  8043. if test -n "$finalize_perm_rpath"; then
  8044. # We should set the runpath_var.
  8045. rpath=
  8046. for dir in $finalize_perm_rpath; do
  8047. func_append rpath "$dir:"
  8048. done
  8049. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  8050. fi
  8051. fi
  8052. if test "$no_install" = yes; then
  8053. # We don't need to create a wrapper script.
  8054. link_command="$compile_var$compile_command$compile_rpath"
  8055. # Replace the output file specification.
  8056. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  8057. # Delete the old output file.
  8058. $opt_dry_run || $RM $output
  8059. # Link the executable and exit
  8060. func_show_eval "$link_command" 'exit $?'
  8061. if test -n "$postlink_cmds"; then
  8062. func_to_tool_file "$output"
  8063. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  8064. func_execute_cmds "$postlink_cmds" 'exit $?'
  8065. fi
  8066. exit $EXIT_SUCCESS
  8067. fi
  8068. if test "$hardcode_action" = relink; then
  8069. # Fast installation is not supported
  8070. link_command="$compile_var$compile_command$compile_rpath"
  8071. relink_command="$finalize_var$finalize_command$finalize_rpath"
  8072. func_warning "this platform does not like uninstalled shared libraries"
  8073. func_warning "\`$output' will be relinked during installation"
  8074. else
  8075. if test "$fast_install" != no; then
  8076. link_command="$finalize_var$compile_command$finalize_rpath"
  8077. if test "$fast_install" = yes; then
  8078. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  8079. else
  8080. # fast_install is set to needless
  8081. relink_command=
  8082. fi
  8083. else
  8084. link_command="$compile_var$compile_command$compile_rpath"
  8085. relink_command="$finalize_var$finalize_command$finalize_rpath"
  8086. fi
  8087. fi
  8088. # Replace the output file specification.
  8089. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  8090. # Delete the old output files.
  8091. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  8092. func_show_eval "$link_command" 'exit $?'
  8093. if test -n "$postlink_cmds"; then
  8094. func_to_tool_file "$output_objdir/$outputname"
  8095. 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'`
  8096. func_execute_cmds "$postlink_cmds" 'exit $?'
  8097. fi
  8098. # Now create the wrapper script.
  8099. func_verbose "creating $output"
  8100. # Quote the relink command for shipping.
  8101. if test -n "$relink_command"; then
  8102. # Preserve any variables that may affect compiler behavior
  8103. for var in $variables_saved_for_relink; do
  8104. if eval test -z \"\${$var+set}\"; then
  8105. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  8106. elif eval var_value=\$$var; test -z "$var_value"; then
  8107. relink_command="$var=; export $var; $relink_command"
  8108. else
  8109. func_quote_for_eval "$var_value"
  8110. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  8111. fi
  8112. done
  8113. relink_command="(cd `pwd`; $relink_command)"
  8114. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  8115. fi
  8116. # Only actually do things if not in dry run mode.
  8117. $opt_dry_run || {
  8118. # win32 will think the script is a binary if it has
  8119. # a .exe suffix, so we strip it off here.
  8120. case $output in
  8121. *.exe) func_stripname '' '.exe' "$output"
  8122. output=$func_stripname_result ;;
  8123. esac
  8124. # test for cygwin because mv fails w/o .exe extensions
  8125. case $host in
  8126. *cygwin*)
  8127. exeext=.exe
  8128. func_stripname '' '.exe' "$outputname"
  8129. outputname=$func_stripname_result ;;
  8130. *) exeext= ;;
  8131. esac
  8132. case $host in
  8133. *cygwin* | *mingw* )
  8134. func_dirname_and_basename "$output" "" "."
  8135. output_name=$func_basename_result
  8136. output_path=$func_dirname_result
  8137. cwrappersource="$output_path/$objdir/lt-$output_name.c"
  8138. cwrapper="$output_path/$output_name.exe"
  8139. $RM $cwrappersource $cwrapper
  8140. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  8141. func_emit_cwrapperexe_src > $cwrappersource
  8142. # The wrapper executable is built using the $host compiler,
  8143. # because it contains $host paths and files. If cross-
  8144. # compiling, it, like the target executable, must be
  8145. # executed on the $host or under an emulation environment.
  8146. $opt_dry_run || {
  8147. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  8148. $STRIP $cwrapper
  8149. }
  8150. # Now, create the wrapper script for func_source use:
  8151. func_ltwrapper_scriptname $cwrapper
  8152. $RM $func_ltwrapper_scriptname_result
  8153. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  8154. $opt_dry_run || {
  8155. # note: this script will not be executed, so do not chmod.
  8156. if test "x$build" = "x$host" ; then
  8157. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  8158. else
  8159. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  8160. fi
  8161. }
  8162. ;;
  8163. * )
  8164. $RM $output
  8165. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  8166. func_emit_wrapper no > $output
  8167. chmod +x $output
  8168. ;;
  8169. esac
  8170. }
  8171. exit $EXIT_SUCCESS
  8172. ;;
  8173. esac
  8174. # See if we need to build an old-fashioned archive.
  8175. for oldlib in $oldlibs; do
  8176. if test "$build_libtool_libs" = convenience; then
  8177. oldobjs="$libobjs_save $symfileobj"
  8178. addlibs="$convenience"
  8179. build_libtool_libs=no
  8180. else
  8181. if test "$build_libtool_libs" = module; then
  8182. oldobjs="$libobjs_save"
  8183. build_libtool_libs=no
  8184. else
  8185. oldobjs="$old_deplibs $non_pic_objects"
  8186. if test "$preload" = yes && test -f "$symfileobj"; then
  8187. func_append oldobjs " $symfileobj"
  8188. fi
  8189. fi
  8190. addlibs="$old_convenience"
  8191. fi
  8192. if test -n "$addlibs"; then
  8193. gentop="$output_objdir/${outputname}x"
  8194. func_append generated " $gentop"
  8195. func_extract_archives $gentop $addlibs
  8196. func_append oldobjs " $func_extract_archives_result"
  8197. fi
  8198. # Do each command in the archive commands.
  8199. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  8200. cmds=$old_archive_from_new_cmds
  8201. else
  8202. # Add any objects from preloaded convenience libraries
  8203. if test -n "$dlprefiles"; then
  8204. gentop="$output_objdir/${outputname}x"
  8205. func_append generated " $gentop"
  8206. func_extract_archives $gentop $dlprefiles
  8207. func_append oldobjs " $func_extract_archives_result"
  8208. fi
  8209. # POSIX demands no paths to be encoded in archives. We have
  8210. # to avoid creating archives with duplicate basenames if we
  8211. # might have to extract them afterwards, e.g., when creating a
  8212. # static archive out of a convenience library, or when linking
  8213. # the entirety of a libtool archive into another (currently
  8214. # not supported by libtool).
  8215. if (for obj in $oldobjs
  8216. do
  8217. func_basename "$obj"
  8218. $ECHO "$func_basename_result"
  8219. done | sort | sort -uc >/dev/null 2>&1); then
  8220. :
  8221. else
  8222. echo "copying selected object files to avoid basename conflicts..."
  8223. gentop="$output_objdir/${outputname}x"
  8224. func_append generated " $gentop"
  8225. func_mkdir_p "$gentop"
  8226. save_oldobjs=$oldobjs
  8227. oldobjs=
  8228. counter=1
  8229. for obj in $save_oldobjs
  8230. do
  8231. func_basename "$obj"
  8232. objbase="$func_basename_result"
  8233. case " $oldobjs " in
  8234. " ") oldobjs=$obj ;;
  8235. *[\ /]"$objbase "*)
  8236. while :; do
  8237. # Make sure we don't pick an alternate name that also
  8238. # overlaps.
  8239. newobj=lt$counter-$objbase
  8240. func_arith $counter + 1
  8241. counter=$func_arith_result
  8242. case " $oldobjs " in
  8243. *[\ /]"$newobj "*) ;;
  8244. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  8245. esac
  8246. done
  8247. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  8248. func_append oldobjs " $gentop/$newobj"
  8249. ;;
  8250. *) func_append oldobjs " $obj" ;;
  8251. esac
  8252. done
  8253. fi
  8254. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  8255. tool_oldlib=$func_to_tool_file_result
  8256. eval cmds=\"$old_archive_cmds\"
  8257. func_len " $cmds"
  8258. len=$func_len_result
  8259. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  8260. cmds=$old_archive_cmds
  8261. elif test -n "$archiver_list_spec"; then
  8262. func_verbose "using command file archive linking..."
  8263. for obj in $oldobjs
  8264. do
  8265. func_to_tool_file "$obj"
  8266. $ECHO "$func_to_tool_file_result"
  8267. done > $output_objdir/$libname.libcmd
  8268. func_to_tool_file "$output_objdir/$libname.libcmd"
  8269. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  8270. cmds=$old_archive_cmds
  8271. else
  8272. # the command line is too long to link in one step, link in parts
  8273. func_verbose "using piecewise archive linking..."
  8274. save_RANLIB=$RANLIB
  8275. RANLIB=:
  8276. objlist=
  8277. concat_cmds=
  8278. save_oldobjs=$oldobjs
  8279. oldobjs=
  8280. # Is there a better way of finding the last object in the list?
  8281. for obj in $save_oldobjs
  8282. do
  8283. last_oldobj=$obj
  8284. done
  8285. eval test_cmds=\"$old_archive_cmds\"
  8286. func_len " $test_cmds"
  8287. len0=$func_len_result
  8288. len=$len0
  8289. for obj in $save_oldobjs
  8290. do
  8291. func_len " $obj"
  8292. func_arith $len + $func_len_result
  8293. len=$func_arith_result
  8294. func_append objlist " $obj"
  8295. if test "$len" -lt "$max_cmd_len"; then
  8296. :
  8297. else
  8298. # the above command should be used before it gets too long
  8299. oldobjs=$objlist
  8300. if test "$obj" = "$last_oldobj" ; then
  8301. RANLIB=$save_RANLIB
  8302. fi
  8303. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  8304. eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  8305. objlist=
  8306. len=$len0
  8307. fi
  8308. done
  8309. RANLIB=$save_RANLIB
  8310. oldobjs=$objlist
  8311. if test "X$oldobjs" = "X" ; then
  8312. eval cmds=\"\$concat_cmds\"
  8313. else
  8314. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  8315. fi
  8316. fi
  8317. fi
  8318. func_execute_cmds "$cmds" 'exit $?'
  8319. done
  8320. test -n "$generated" && \
  8321. func_show_eval "${RM}r$generated"
  8322. # Now create the libtool archive.
  8323. case $output in
  8324. *.la)
  8325. old_library=
  8326. test "$build_old_libs" = yes && old_library="$libname.$libext"
  8327. func_verbose "creating $output"
  8328. # Preserve any variables that may affect compiler behavior
  8329. for var in $variables_saved_for_relink; do
  8330. if eval test -z \"\${$var+set}\"; then
  8331. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  8332. elif eval var_value=\$$var; test -z "$var_value"; then
  8333. relink_command="$var=; export $var; $relink_command"
  8334. else
  8335. func_quote_for_eval "$var_value"
  8336. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  8337. fi
  8338. done
  8339. # Quote the link command for shipping.
  8340. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  8341. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  8342. if test "$hardcode_automatic" = yes ; then
  8343. relink_command=
  8344. fi
  8345. # Only create the output if not a dry run.
  8346. $opt_dry_run || {
  8347. for installed in no yes; do
  8348. if test "$installed" = yes; then
  8349. if test -z "$install_libdir"; then
  8350. break
  8351. fi
  8352. output="$output_objdir/$outputname"i
  8353. # Replace all uninstalled libtool libraries with the installed ones
  8354. newdependency_libs=
  8355. for deplib in $dependency_libs; do
  8356. case $deplib in
  8357. *.la)
  8358. func_basename "$deplib"
  8359. name="$func_basename_result"
  8360. func_resolve_sysroot "$deplib"
  8361. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  8362. test -z "$libdir" && \
  8363. func_fatal_error "\`$deplib' is not a valid libtool archive"
  8364. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  8365. ;;
  8366. -L*)
  8367. func_stripname -L '' "$deplib"
  8368. func_replace_sysroot "$func_stripname_result"
  8369. func_append newdependency_libs " -L$func_replace_sysroot_result"
  8370. ;;
  8371. -R*)
  8372. func_stripname -R '' "$deplib"
  8373. func_replace_sysroot "$func_stripname_result"
  8374. func_append newdependency_libs " -R$func_replace_sysroot_result"
  8375. ;;
  8376. *) func_append newdependency_libs " $deplib" ;;
  8377. esac
  8378. done
  8379. dependency_libs="$newdependency_libs"
  8380. newdlfiles=
  8381. for lib in $dlfiles; do
  8382. case $lib in
  8383. *.la)
  8384. func_basename "$lib"
  8385. name="$func_basename_result"
  8386. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  8387. test -z "$libdir" && \
  8388. func_fatal_error "\`$lib' is not a valid libtool archive"
  8389. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  8390. ;;
  8391. *) func_append newdlfiles " $lib" ;;
  8392. esac
  8393. done
  8394. dlfiles="$newdlfiles"
  8395. newdlprefiles=
  8396. for lib in $dlprefiles; do
  8397. case $lib in
  8398. *.la)
  8399. # Only pass preopened files to the pseudo-archive (for
  8400. # eventual linking with the app. that links it) if we
  8401. # didn't already link the preopened objects directly into
  8402. # the library:
  8403. func_basename "$lib"
  8404. name="$func_basename_result"
  8405. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  8406. test -z "$libdir" && \
  8407. func_fatal_error "\`$lib' is not a valid libtool archive"
  8408. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  8409. ;;
  8410. esac
  8411. done
  8412. dlprefiles="$newdlprefiles"
  8413. else
  8414. newdlfiles=
  8415. for lib in $dlfiles; do
  8416. case $lib in
  8417. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  8418. *) abs=`pwd`"/$lib" ;;
  8419. esac
  8420. func_append newdlfiles " $abs"
  8421. done
  8422. dlfiles="$newdlfiles"
  8423. newdlprefiles=
  8424. for lib in $dlprefiles; do
  8425. case $lib in
  8426. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  8427. *) abs=`pwd`"/$lib" ;;
  8428. esac
  8429. func_append newdlprefiles " $abs"
  8430. done
  8431. dlprefiles="$newdlprefiles"
  8432. fi
  8433. $RM $output
  8434. # place dlname in correct position for cygwin
  8435. # In fact, it would be nice if we could use this code for all target
  8436. # systems that can't hard-code library paths into their executables
  8437. # and that have no shared library path variable independent of PATH,
  8438. # but it turns out we can't easily determine that from inspecting
  8439. # libtool variables, so we have to hard-code the OSs to which it
  8440. # applies here; at the moment, that means platforms that use the PE
  8441. # object format with DLL files. See the long comment at the top of
  8442. # tests/bindir.at for full details.
  8443. tdlname=$dlname
  8444. case $host,$output,$installed,$module,$dlname in
  8445. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  8446. # If a -bindir argument was supplied, place the dll there.
  8447. if test "x$bindir" != x ;
  8448. then
  8449. func_relative_path "$install_libdir" "$bindir"
  8450. tdlname=$func_relative_path_result$dlname
  8451. else
  8452. # Otherwise fall back on heuristic.
  8453. tdlname=../bin/$dlname
  8454. fi
  8455. ;;
  8456. esac
  8457. $ECHO > $output "\
  8458. # $outputname - a libtool library file
  8459. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  8460. #
  8461. # Please DO NOT delete this file!
  8462. # It is necessary for linking the library.
  8463. # The name that we can dlopen(3).
  8464. dlname='$tdlname'
  8465. # Names of this library.
  8466. library_names='$library_names'
  8467. # The name of the static archive.
  8468. old_library='$old_library'
  8469. # Linker flags that can not go in dependency_libs.
  8470. inherited_linker_flags='$new_inherited_linker_flags'
  8471. # Libraries that this one depends upon.
  8472. dependency_libs='$dependency_libs'
  8473. # Names of additional weak libraries provided by this library
  8474. weak_library_names='$weak_libs'
  8475. # Version information for $libname.
  8476. current=$current
  8477. age=$age
  8478. revision=$revision
  8479. # Is this an already installed library?
  8480. installed=$installed
  8481. # Should we warn about portability when linking against -modules?
  8482. shouldnotlink=$module
  8483. # Files to dlopen/dlpreopen
  8484. dlopen='$dlfiles'
  8485. dlpreopen='$dlprefiles'
  8486. # Directory that this library needs to be installed in:
  8487. libdir='$install_libdir'"
  8488. if test "$installed" = no && test "$need_relink" = yes; then
  8489. $ECHO >> $output "\
  8490. relink_command=\"$relink_command\""
  8491. fi
  8492. done
  8493. }
  8494. # Do a symbolic link so that the libtool archive can be found in
  8495. # LD_LIBRARY_PATH before the program is installed.
  8496. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  8497. ;;
  8498. esac
  8499. exit $EXIT_SUCCESS
  8500. }
  8501. { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
  8502. func_mode_link ${1+"$@"}
  8503. # func_mode_uninstall arg...
  8504. func_mode_uninstall ()
  8505. {
  8506. $opt_debug
  8507. RM="$nonopt"
  8508. files=
  8509. rmforce=
  8510. exit_status=0
  8511. # This variable tells wrapper scripts just to set variables rather
  8512. # than running their programs.
  8513. libtool_install_magic="$magic"
  8514. for arg
  8515. do
  8516. case $arg in
  8517. -f) func_append RM " $arg"; rmforce=yes ;;
  8518. -*) func_append RM " $arg" ;;
  8519. *) func_append files " $arg" ;;
  8520. esac
  8521. done
  8522. test -z "$RM" && \
  8523. func_fatal_help "you must specify an RM program"
  8524. rmdirs=
  8525. for file in $files; do
  8526. func_dirname "$file" "" "."
  8527. dir="$func_dirname_result"
  8528. if test "X$dir" = X.; then
  8529. odir="$objdir"
  8530. else
  8531. odir="$dir/$objdir"
  8532. fi
  8533. func_basename "$file"
  8534. name="$func_basename_result"
  8535. test "$opt_mode" = uninstall && odir="$dir"
  8536. # Remember odir for removal later, being careful to avoid duplicates
  8537. if test "$opt_mode" = clean; then
  8538. case " $rmdirs " in
  8539. *" $odir "*) ;;
  8540. *) func_append rmdirs " $odir" ;;
  8541. esac
  8542. fi
  8543. # Don't error if the file doesn't exist and rm -f was used.
  8544. if { test -L "$file"; } >/dev/null 2>&1 ||
  8545. { test -h "$file"; } >/dev/null 2>&1 ||
  8546. test -f "$file"; then
  8547. :
  8548. elif test -d "$file"; then
  8549. exit_status=1
  8550. continue
  8551. elif test "$rmforce" = yes; then
  8552. continue
  8553. fi
  8554. rmfiles="$file"
  8555. case $name in
  8556. *.la)
  8557. # Possibly a libtool archive, so verify it.
  8558. if func_lalib_p "$file"; then
  8559. func_source $dir/$name
  8560. # Delete the libtool libraries and symlinks.
  8561. for n in $library_names; do
  8562. func_append rmfiles " $odir/$n"
  8563. done
  8564. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  8565. case "$opt_mode" in
  8566. clean)
  8567. case " $library_names " in
  8568. *" $dlname "*) ;;
  8569. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  8570. esac
  8571. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  8572. ;;
  8573. uninstall)
  8574. if test -n "$library_names"; then
  8575. # Do each command in the postuninstall commands.
  8576. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  8577. fi
  8578. if test -n "$old_library"; then
  8579. # Do each command in the old_postuninstall commands.
  8580. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  8581. fi
  8582. # FIXME: should reinstall the best remaining shared library.
  8583. ;;
  8584. esac
  8585. fi
  8586. ;;
  8587. *.lo)
  8588. # Possibly a libtool object, so verify it.
  8589. if func_lalib_p "$file"; then
  8590. # Read the .lo file
  8591. func_source $dir/$name
  8592. # Add PIC object to the list of files to remove.
  8593. if test -n "$pic_object" &&
  8594. test "$pic_object" != none; then
  8595. func_append rmfiles " $dir/$pic_object"
  8596. fi
  8597. # Add non-PIC object to the list of files to remove.
  8598. if test -n "$non_pic_object" &&
  8599. test "$non_pic_object" != none; then
  8600. func_append rmfiles " $dir/$non_pic_object"
  8601. fi
  8602. fi
  8603. ;;
  8604. *)
  8605. if test "$opt_mode" = clean ; then
  8606. noexename=$name
  8607. case $file in
  8608. *.exe)
  8609. func_stripname '' '.exe' "$file"
  8610. file=$func_stripname_result
  8611. func_stripname '' '.exe' "$name"
  8612. noexename=$func_stripname_result
  8613. # $file with .exe has already been added to rmfiles,
  8614. # add $file without .exe
  8615. func_append rmfiles " $file"
  8616. ;;
  8617. esac
  8618. # Do a test to see if this is a libtool program.
  8619. if func_ltwrapper_p "$file"; then
  8620. if func_ltwrapper_executable_p "$file"; then
  8621. func_ltwrapper_scriptname "$file"
  8622. relink_command=
  8623. func_source $func_ltwrapper_scriptname_result
  8624. func_append rmfiles " $func_ltwrapper_scriptname_result"
  8625. else
  8626. relink_command=
  8627. func_source $dir/$noexename
  8628. fi
  8629. # note $name still contains .exe if it was in $file originally
  8630. # as does the version of $file that was added into $rmfiles
  8631. func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
  8632. if test "$fast_install" = yes && test -n "$relink_command"; then
  8633. func_append rmfiles " $odir/lt-$name"
  8634. fi
  8635. if test "X$noexename" != "X$name" ; then
  8636. func_append rmfiles " $odir/lt-${noexename}.c"
  8637. fi
  8638. fi
  8639. fi
  8640. ;;
  8641. esac
  8642. func_show_eval "$RM $rmfiles" 'exit_status=1'
  8643. done
  8644. # Try to remove the ${objdir}s in the directories where we deleted files
  8645. for dir in $rmdirs; do
  8646. if test -d "$dir"; then
  8647. func_show_eval "rmdir $dir >/dev/null 2>&1"
  8648. fi
  8649. done
  8650. exit $exit_status
  8651. }
  8652. { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
  8653. func_mode_uninstall ${1+"$@"}
  8654. test -z "$opt_mode" && {
  8655. help="$generic_help"
  8656. func_fatal_help "you must specify a MODE"
  8657. }
  8658. test -z "$exec_cmd" && \
  8659. func_fatal_help "invalid operation mode \`$opt_mode'"
  8660. if test -n "$exec_cmd"; then
  8661. eval exec "$exec_cmd"
  8662. exit $EXIT_FAILURE
  8663. fi
  8664. exit $exit_status
  8665. # The TAGs below are defined such that we never get into a situation
  8666. # in which we disable both kinds of libraries. Given conflicting
  8667. # choices, we go for a static library, that is the most portable,
  8668. # since we can't tell whether shared libraries were disabled because
  8669. # the user asked for that or because the platform doesn't support
  8670. # them. This is particularly important on AIX, because we don't
  8671. # support having both static and shared libraries enabled at the same
  8672. # time on that platform, so we default to a shared-only configuration.
  8673. # If a disable-shared tag is given, we'll fallback to a static-only
  8674. # configuration. But we'll never go from static-only to shared-only.
  8675. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  8676. build_libtool_libs=no
  8677. build_old_libs=yes
  8678. # ### END LIBTOOL TAG CONFIG: disable-shared
  8679. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  8680. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  8681. # ### END LIBTOOL TAG CONFIG: disable-static
  8682. # Local Variables:
  8683. # mode:shell-script
  8684. # sh-indentation:2
  8685. # End:
  8686. # vi:sw=2