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.

11140 lines
316 KiB

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