🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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