PageRenderTime 81ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 2ms

/ltmain.sh

https://bitbucket.org/mike_php_net/libmysqludf
Shell | 9655 lines | 7809 code | 649 blank | 1197 comment | 841 complexity | fddd00ca15b3cc3caa3b3f6d367a2daf MD5 | raw file
Possible License(s): BSD-2-Clause

Large files files are truncated, but you can click here to view the full file

  1. # libtool (GNU libtool) 2.4.2
  2. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  3. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
  4. # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
  5. # This is free software; see the source for copying conditions. There is NO
  6. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  7. # GNU Libtool is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # As a special exception to the GNU General Public License,
  13. # if you distribute this file as part of a program or library that
  14. # is built using GNU Libtool, you may include this file under the
  15. # same distribution terms that you use for the rest of that program.
  16. #
  17. # GNU Libtool is distributed in the hope that it will be useful, but
  18. # WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. # General Public License for more details.
  21. #
  22. # You should have received a copy of the GNU General Public License
  23. # along with GNU Libtool; see the file COPYING. If not, a copy
  24. # can be downloaded from http://www.gnu.org/licenses/gpl.html,
  25. # or obtained by writing to the Free Software Foundation, Inc.,
  26. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  27. # Usage: $progname [OPTION]... [MODE-ARG]...
  28. #
  29. # Provide generalized library-building support services.
  30. #
  31. # --config show all configuration variables
  32. # --debug enable verbose shell tracing
  33. # -n, --dry-run display commands without modifying any files
  34. # --features display basic configuration information and exit
  35. # --mode=MODE use operation mode MODE
  36. # --preserve-dup-deps don't remove duplicate dependency libraries
  37. # --quiet, --silent don't print informational messages
  38. # --no-quiet, --no-silent
  39. # print informational messages (default)
  40. # --no-warn don't display warning messages
  41. # --tag=TAG use configuration variables from tag TAG
  42. # -v, --verbose print more informational messages than default
  43. # --no-verbose don't print the extra informational messages
  44. # --version print version information
  45. # -h, --help, --help-all print short, long, or detailed help message
  46. #
  47. # MODE must be one of the following:
  48. #
  49. # clean remove files from the build directory
  50. # compile compile a source file into a libtool object
  51. # execute automatically set library path, then run a program
  52. # finish complete the installation of libtool libraries
  53. # install install libraries or executables
  54. # link create a library or an executable
  55. # uninstall remove libraries from an installed directory
  56. #
  57. # MODE-ARGS vary depending on the MODE. When passed as first option,
  58. # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
  59. # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
  60. #
  61. # When reporting a bug, please describe a test case to reproduce it and
  62. # include the following information:
  63. #
  64. # host-triplet: $host
  65. # shell: $SHELL
  66. # compiler: $LTCC
  67. # compiler flags: $LTCFLAGS
  68. # linker: $LD (gnu? $with_gnu_ld)
  69. # $progname: (GNU libtool) 2.4.2
  70. # automake: $automake_version
  71. # autoconf: $autoconf_version
  72. #
  73. # Report bugs to <bug-libtool@gnu.org>.
  74. # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
  75. # General help using GNU software: <http://www.gnu.org/gethelp/>.
  76. PROGRAM=libtool
  77. PACKAGE=libtool
  78. VERSION=2.4.2
  79. TIMESTAMP=""
  80. package_revision=1.3337
  81. # Be Bourne compatible
  82. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  83. emulate sh
  84. NULLCMD=:
  85. # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  86. # is contrary to our usage. Disable this feature.
  87. alias -g '${1+"$@"}'='"$@"'
  88. setopt NO_GLOB_SUBST
  89. else
  90. case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
  91. fi
  92. BIN_SH=xpg4; export BIN_SH # for Tru64
  93. DUALCASE=1; export DUALCASE # for MKS sh
  94. # A function that is used when there is no print builtin or printf.
  95. func_fallback_echo ()
  96. {
  97. eval 'cat <<_LTECHO_EOF
  98. $1
  99. _LTECHO_EOF'
  100. }
  101. # NLS nuisances: We save the old values to restore during execute mode.
  102. lt_user_locale=
  103. lt_safe_locale=
  104. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  105. do
  106. eval "if test \"\${$lt_var+set}\" = set; then
  107. save_$lt_var=\$$lt_var
  108. $lt_var=C
  109. export $lt_var
  110. lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
  111. lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
  112. fi"
  113. done
  114. LC_ALL=C
  115. LANGUAGE=C
  116. export LANGUAGE LC_ALL
  117. $lt_unset CDPATH
  118. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  119. # is ksh but when the shell is invoked as "sh" and the current value of
  120. # the _XPG environment variable is not equal to 1 (one), the special
  121. # positional parameter $0, within a function call, is the name of the
  122. # function.
  123. progpath="$0"
  124. : ${CP="cp -f"}
  125. test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
  126. : ${MAKE="make"}
  127. : ${MKDIR="mkdir"}
  128. : ${MV="mv -f"}
  129. : ${RM="rm -f"}
  130. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  131. : ${Xsed="$SED -e 1s/^X//"}
  132. # Global variables:
  133. EXIT_SUCCESS=0
  134. EXIT_FAILURE=1
  135. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  136. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  137. exit_status=$EXIT_SUCCESS
  138. # Make sure IFS has a sensible default
  139. lt_nl='
  140. '
  141. IFS=" $lt_nl"
  142. dirname="s,/[^/]*$,,"
  143. basename="s,^.*/,,"
  144. # func_dirname file append nondir_replacement
  145. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  146. # otherwise set result to NONDIR_REPLACEMENT.
  147. func_dirname ()
  148. {
  149. func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
  150. if test "X$func_dirname_result" = "X${1}"; then
  151. func_dirname_result="${3}"
  152. else
  153. func_dirname_result="$func_dirname_result${2}"
  154. fi
  155. } # func_dirname may be replaced by extended shell implementation
  156. # func_basename file
  157. func_basename ()
  158. {
  159. func_basename_result=`$ECHO "${1}" | $SED "$basename"`
  160. } # func_basename may be replaced by extended shell implementation
  161. # func_dirname_and_basename file append nondir_replacement
  162. # perform func_basename and func_dirname in a single function
  163. # call:
  164. # dirname: Compute the dirname of FILE. If nonempty,
  165. # add APPEND to the result, otherwise set result
  166. # to NONDIR_REPLACEMENT.
  167. # value returned in "$func_dirname_result"
  168. # basename: Compute filename of FILE.
  169. # value retuned in "$func_basename_result"
  170. # Implementation must be kept synchronized with func_dirname
  171. # and func_basename. For efficiency, we do not delegate to
  172. # those functions but instead duplicate the functionality here.
  173. func_dirname_and_basename ()
  174. {
  175. # Extract subdirectory from the argument.
  176. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
  177. if test "X$func_dirname_result" = "X${1}"; then
  178. func_dirname_result="${3}"
  179. else
  180. func_dirname_result="$func_dirname_result${2}"
  181. fi
  182. func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
  183. } # func_dirname_and_basename may be replaced by extended shell implementation
  184. # func_stripname prefix suffix name
  185. # strip PREFIX and SUFFIX off of NAME.
  186. # PREFIX and SUFFIX must not contain globbing or regex special
  187. # characters, hashes, percent signs, but SUFFIX may contain a leading
  188. # dot (in which case that matches only a dot).
  189. # func_strip_suffix prefix name
  190. func_stripname ()
  191. {
  192. case ${2} in
  193. .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
  194. *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
  195. esac
  196. } # func_stripname may be replaced by extended shell implementation
  197. # These SED scripts presuppose an absolute path with a trailing slash.
  198. pathcar='s,^/\([^/]*\).*$,\1,'
  199. pathcdr='s,^/[^/]*,,'
  200. removedotparts=':dotsl
  201. s@/\./@/@g
  202. t dotsl
  203. s,/\.$,/,'
  204. collapseslashes='s@/\{1,\}@/@g'
  205. finalslash='s,/*$,/,'
  206. # func_normal_abspath PATH
  207. # Remove doubled-up and trailing slashes, "." path components,
  208. # and cancel out any ".." path components in PATH after making
  209. # it an absolute path.
  210. # value returned in "$func_normal_abspath_result"
  211. func_normal_abspath ()
  212. {
  213. # Start from root dir and reassemble the path.
  214. func_normal_abspath_result=
  215. func_normal_abspath_tpath=$1
  216. func_normal_abspath_altnamespace=
  217. case $func_normal_abspath_tpath in
  218. "")
  219. # Empty path, that just means $cwd.
  220. func_stripname '' '/' "`pwd`"
  221. func_normal_abspath_result=$func_stripname_result
  222. return
  223. ;;
  224. # The next three entries are used to spot a run of precisely
  225. # two leading slashes without using negated character classes;
  226. # we take advantage of case's first-match behaviour.
  227. ///*)
  228. # Unusual form of absolute path, do nothing.
  229. ;;
  230. //*)
  231. # Not necessarily an ordinary path; POSIX reserves leading '//'
  232. # and for example Cygwin uses it to access remote file shares
  233. # over CIFS/SMB, so we conserve a leading double slash if found.
  234. func_normal_abspath_altnamespace=/
  235. ;;
  236. /*)
  237. # Absolute path, do nothing.
  238. ;;
  239. *)
  240. # Relative path, prepend $cwd.
  241. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  242. ;;
  243. esac
  244. # Cancel out all the simple stuff to save iterations. We also want
  245. # the path to end with a slash for ease of parsing, so make sure
  246. # there is one (and only one) here.
  247. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  248. -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
  249. while :; do
  250. # Processed it all yet?
  251. if test "$func_normal_abspath_tpath" = / ; then
  252. # If we ascended to the root using ".." the result may be empty now.
  253. if test -z "$func_normal_abspath_result" ; then
  254. func_normal_abspath_result=/
  255. fi
  256. break
  257. fi
  258. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  259. -e "$pathcar"`
  260. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  261. -e "$pathcdr"`
  262. # Figure out what to do with it
  263. case $func_normal_abspath_tcomponent in
  264. "")
  265. # Trailing empty path component, ignore it.
  266. ;;
  267. ..)
  268. # Parent dir; strip last assembled component from result.
  269. func_dirname "$func_normal_abspath_result"
  270. func_normal_abspath_result=$func_dirname_result
  271. ;;
  272. *)
  273. # Actual path component, append it.
  274. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
  275. ;;
  276. esac
  277. done
  278. # Restore leading double-slash if one was found on entry.
  279. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  280. }
  281. # func_relative_path SRCDIR DSTDIR
  282. # generates a relative path from SRCDIR to DSTDIR, with a trailing
  283. # slash if non-empty, suitable for immediately appending a filename
  284. # without needing to append a separator.
  285. # value returned in "$func_relative_path_result"
  286. func_relative_path ()
  287. {
  288. func_relative_path_result=
  289. func_normal_abspath "$1"
  290. func_relative_path_tlibdir=$func_normal_abspath_result
  291. func_normal_abspath "$2"
  292. func_relative_path_tbindir=$func_normal_abspath_result
  293. # Ascend the tree starting from libdir
  294. while :; do
  295. # check if we have found a prefix of bindir
  296. case $func_relative_path_tbindir in
  297. $func_relative_path_tlibdir)
  298. # found an exact match
  299. func_relative_path_tcancelled=
  300. break
  301. ;;
  302. $func_relative_path_tlibdir*)
  303. # found a matching prefix
  304. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  305. func_relative_path_tcancelled=$func_stripname_result
  306. if test -z "$func_relative_path_result"; then
  307. func_relative_path_result=.
  308. fi
  309. break
  310. ;;
  311. *)
  312. func_dirname $func_relative_path_tlibdir
  313. func_relative_path_tlibdir=${func_dirname_result}
  314. if test "x$func_relative_path_tlibdir" = x ; then
  315. # Have to descend all the way to the root!
  316. func_relative_path_result=../$func_relative_path_result
  317. func_relative_path_tcancelled=$func_relative_path_tbindir
  318. break
  319. fi
  320. func_relative_path_result=../$func_relative_path_result
  321. ;;
  322. esac
  323. done
  324. # Now calculate path; take care to avoid doubling-up slashes.
  325. func_stripname '' '/' "$func_relative_path_result"
  326. func_relative_path_result=$func_stripname_result
  327. func_stripname '/' '/' "$func_relative_path_tcancelled"
  328. if test "x$func_stripname_result" != x ; then
  329. func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
  330. fi
  331. # Normalisation. If bindir is libdir, return empty string,
  332. # else relative path ending with a slash; either way, target
  333. # file name can be directly appended.
  334. if test ! -z "$func_relative_path_result"; then
  335. func_stripname './' '' "$func_relative_path_result/"
  336. func_relative_path_result=$func_stripname_result
  337. fi
  338. }
  339. # The name of this program:
  340. func_dirname_and_basename "$progpath"
  341. progname=$func_basename_result
  342. # Make sure we have an absolute path for reexecution:
  343. case $progpath in
  344. [\\/]*|[A-Za-z]:\\*) ;;
  345. *[\\/]*)
  346. progdir=$func_dirname_result
  347. progdir=`cd "$progdir" && pwd`
  348. progpath="$progdir/$progname"
  349. ;;
  350. *)
  351. save_IFS="$IFS"
  352. IFS=${PATH_SEPARATOR-:}
  353. for progdir in $PATH; do
  354. IFS="$save_IFS"
  355. test -x "$progdir/$progname" && break
  356. done
  357. IFS="$save_IFS"
  358. test -n "$progdir" || progdir=`pwd`
  359. progpath="$progdir/$progname"
  360. ;;
  361. esac
  362. # Sed substitution that helps us do robust quoting. It backslashifies
  363. # metacharacters that are still active within double-quoted strings.
  364. Xsed="${SED}"' -e 1s/^X//'
  365. sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
  366. # Same as above, but do not quote variable references.
  367. double_quote_subst='s/\(["`\\]\)/\\\1/g'
  368. # Sed substitution that turns a string into a regex matching for the
  369. # string literally.
  370. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
  371. # Sed substitution that converts a w32 file name or path
  372. # which contains forward slashes, into one that contains
  373. # (escaped) backslashes. A very naive implementation.
  374. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  375. # Re-`\' parameter expansions in output of double_quote_subst that were
  376. # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
  377. # in input to double_quote_subst, that '$' was protected from expansion.
  378. # Since each input `\' is now two `\'s, look for any number of runs of
  379. # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
  380. bs='\\'
  381. bs2='\\\\'
  382. bs4='\\\\\\\\'
  383. dollar='\$'
  384. sed_double_backslash="\
  385. s/$bs4/&\\
  386. /g
  387. s/^$bs2$dollar/$bs&/
  388. s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
  389. s/\n//g"
  390. # Standard options:
  391. opt_dry_run=false
  392. opt_help=false
  393. opt_quiet=false
  394. opt_verbose=false
  395. opt_warning=:
  396. # func_echo arg...
  397. # Echo program name prefixed message, along with the current mode
  398. # name if it has been set yet.
  399. func_echo ()
  400. {
  401. $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
  402. }
  403. # func_verbose arg...
  404. # Echo program name prefixed message in verbose mode only.
  405. func_verbose ()
  406. {
  407. $opt_verbose && func_echo ${1+"$@"}
  408. # A bug in bash halts the script if the last line of a function
  409. # fails when set -e is in force, so we need another command to
  410. # work around that:
  411. :
  412. }
  413. # func_echo_all arg...
  414. # Invoke $ECHO with all args, space-separated.
  415. func_echo_all ()
  416. {
  417. $ECHO "$*"
  418. }
  419. # func_error arg...
  420. # Echo program name prefixed message to standard error.
  421. func_error ()
  422. {
  423. $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
  424. }
  425. # func_warning arg...
  426. # Echo program name prefixed warning message to standard error.
  427. func_warning ()
  428. {
  429. $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
  430. # bash bug again:
  431. :
  432. }
  433. # func_fatal_error arg...
  434. # Echo program name prefixed message to standard error, and exit.
  435. func_fatal_error ()
  436. {
  437. func_error ${1+"$@"}
  438. exit $EXIT_FAILURE
  439. }
  440. # func_fatal_help arg...
  441. # Echo program name prefixed message to standard error, followed by
  442. # a help hint, and exit.
  443. func_fatal_help ()
  444. {
  445. func_error ${1+"$@"}
  446. func_fatal_error "$help"
  447. }
  448. help="Try \`$progname --help' for more information." ## default
  449. # func_grep expression filename
  450. # Check whether EXPRESSION matches any line of FILENAME, without output.
  451. func_grep ()
  452. {
  453. $GREP "$1" "$2" >/dev/null 2>&1
  454. }
  455. # func_mkdir_p directory-path
  456. # Make sure the entire path to DIRECTORY-PATH is available.
  457. func_mkdir_p ()
  458. {
  459. my_directory_path="$1"
  460. my_dir_list=
  461. if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
  462. # Protect directory names starting with `-'
  463. case $my_directory_path in
  464. -*) my_directory_path="./$my_directory_path" ;;
  465. esac
  466. # While some portion of DIR does not yet exist...
  467. while test ! -d "$my_directory_path"; do
  468. # ...make a list in topmost first order. Use a colon delimited
  469. # list incase some portion of path contains whitespace.
  470. my_dir_list="$my_directory_path:$my_dir_list"
  471. # If the last portion added has no slash in it, the list is done
  472. case $my_directory_path in */*) ;; *) break ;; esac
  473. # ...otherwise throw away the child directory and loop
  474. my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
  475. done
  476. my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
  477. save_mkdir_p_IFS="$IFS"; IFS=':'
  478. for my_dir in $my_dir_list; do
  479. IFS="$save_mkdir_p_IFS"
  480. # mkdir can fail with a `File exist' error if two processes
  481. # try to create one of the directories concurrently. Don't
  482. # stop in that case!
  483. $MKDIR "$my_dir" 2>/dev/null || :
  484. done
  485. IFS="$save_mkdir_p_IFS"
  486. # Bail out if we (or some other process) failed to create a directory.
  487. test -d "$my_directory_path" || \
  488. func_fatal_error "Failed to create \`$1'"
  489. fi
  490. }
  491. # func_mktempdir [string]
  492. # Make a temporary directory that won't clash with other running
  493. # libtool processes, and avoids race conditions if possible. If
  494. # given, STRING is the basename for that directory.
  495. func_mktempdir ()
  496. {
  497. my_template="${TMPDIR-/tmp}/${1-$progname}"
  498. if test "$opt_dry_run" = ":"; then
  499. # Return a directory name, but don't create it in dry-run mode
  500. my_tmpdir="${my_template}-$$"
  501. else
  502. # If mktemp works, use that first and foremost
  503. my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
  504. if test ! -d "$my_tmpdir"; then
  505. # Failing that, at least try and use $RANDOM to avoid a race
  506. my_tmpdir="${my_template}-${RANDOM-0}$$"
  507. save_mktempdir_umask=`umask`
  508. umask 0077
  509. $MKDIR "$my_tmpdir"
  510. umask $save_mktempdir_umask
  511. fi
  512. # If we're not in dry-run mode, bomb out on failure
  513. test -d "$my_tmpdir" || \
  514. func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
  515. fi
  516. $ECHO "$my_tmpdir"
  517. }
  518. # func_quote_for_eval arg
  519. # Aesthetically quote ARG to be evaled later.
  520. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
  521. # is double-quoted, suitable for a subsequent eval, whereas
  522. # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
  523. # which are still active within double quotes backslashified.
  524. func_quote_for_eval ()
  525. {
  526. case $1 in
  527. *[\\\`\"\$]*)
  528. func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
  529. *)
  530. func_quote_for_eval_unquoted_result="$1" ;;
  531. esac
  532. case $func_quote_for_eval_unquoted_result in
  533. # Double-quote args containing shell metacharacters to delay
  534. # word splitting, command substitution and and variable
  535. # expansion for a subsequent eval.
  536. # Many Bourne shells cannot handle close brackets correctly
  537. # in scan sets, so we specify it separately.
  538. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  539. func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
  540. ;;
  541. *)
  542. func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
  543. esac
  544. }
  545. # func_quote_for_expand arg
  546. # Aesthetically quote ARG to be evaled later; same as above,
  547. # but do not quote variable references.
  548. func_quote_for_expand ()
  549. {
  550. case $1 in
  551. *[\\\`\"]*)
  552. my_arg=`$ECHO "$1" | $SED \
  553. -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
  554. *)
  555. my_arg="$1" ;;
  556. esac
  557. case $my_arg in
  558. # Double-quote args containing shell metacharacters to delay
  559. # word splitting and command substitution for a subsequent eval.
  560. # Many Bourne shells cannot handle close brackets correctly
  561. # in scan sets, so we specify it separately.
  562. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  563. my_arg="\"$my_arg\""
  564. ;;
  565. esac
  566. func_quote_for_expand_result="$my_arg"
  567. }
  568. # func_show_eval cmd [fail_exp]
  569. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  570. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  571. # is given, then evaluate it.
  572. func_show_eval ()
  573. {
  574. my_cmd="$1"
  575. my_fail_exp="${2-:}"
  576. ${opt_silent-false} || {
  577. func_quote_for_expand "$my_cmd"
  578. eval "func_echo $func_quote_for_expand_result"
  579. }
  580. if ${opt_dry_run-false}; then :; else
  581. eval "$my_cmd"
  582. my_status=$?
  583. if test "$my_status" -eq 0; then :; else
  584. eval "(exit $my_status); $my_fail_exp"
  585. fi
  586. fi
  587. }
  588. # func_show_eval_locale cmd [fail_exp]
  589. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  590. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  591. # is given, then evaluate it. Use the saved locale for evaluation.
  592. func_show_eval_locale ()
  593. {
  594. my_cmd="$1"
  595. my_fail_exp="${2-:}"
  596. ${opt_silent-false} || {
  597. func_quote_for_expand "$my_cmd"
  598. eval "func_echo $func_quote_for_expand_result"
  599. }
  600. if ${opt_dry_run-false}; then :; else
  601. eval "$lt_user_locale
  602. $my_cmd"
  603. my_status=$?
  604. eval "$lt_safe_locale"
  605. if test "$my_status" -eq 0; then :; else
  606. eval "(exit $my_status); $my_fail_exp"
  607. fi
  608. fi
  609. }
  610. # func_tr_sh
  611. # Turn $1 into a string suitable for a shell variable name.
  612. # Result is stored in $func_tr_sh_result. All characters
  613. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  614. # if $1 begins with a digit, a '_' is prepended as well.
  615. func_tr_sh ()
  616. {
  617. case $1 in
  618. [0-9]* | *[!a-zA-Z0-9_]*)
  619. func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
  620. ;;
  621. * )
  622. func_tr_sh_result=$1
  623. ;;
  624. esac
  625. }
  626. # func_version
  627. # Echo version message to standard output and exit.
  628. func_version ()
  629. {
  630. $opt_debug
  631. $SED -n '/(C)/!b go
  632. :more
  633. /\./!{
  634. N
  635. s/\n# / /
  636. b more
  637. }
  638. :go
  639. /^# '$PROGRAM' (GNU /,/# warranty; / {
  640. s/^# //
  641. s/^# *$//
  642. s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
  643. p
  644. }' < "$progpath"
  645. exit $?
  646. }
  647. # func_usage
  648. # Echo short help message to standard output and exit.
  649. func_usage ()
  650. {
  651. $opt_debug
  652. $SED -n '/^# Usage:/,/^# *.*--help/ {
  653. s/^# //
  654. s/^# *$//
  655. s/\$progname/'$progname'/
  656. p
  657. }' < "$progpath"
  658. echo
  659. $ECHO "run \`$progname --help | more' for full usage"
  660. exit $?
  661. }
  662. # func_help [NOEXIT]
  663. # Echo long help message to standard output and exit,
  664. # unless 'noexit' is passed as argument.
  665. func_help ()
  666. {
  667. $opt_debug
  668. $SED -n '/^# Usage:/,/# Report bugs to/ {
  669. :print
  670. s/^# //
  671. s/^# *$//
  672. s*\$progname*'$progname'*
  673. s*\$host*'"$host"'*
  674. s*\$SHELL*'"$SHELL"'*
  675. s*\$LTCC*'"$LTCC"'*
  676. s*\$LTCFLAGS*'"$LTCFLAGS"'*
  677. s*\$LD*'"$LD"'*
  678. s/\$with_gnu_ld/'"$with_gnu_ld"'/
  679. s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
  680. s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
  681. p
  682. d
  683. }
  684. /^# .* home page:/b print
  685. /^# General help using/b print
  686. ' < "$progpath"
  687. ret=$?
  688. if test -z "$1"; then
  689. exit $ret
  690. fi
  691. }
  692. # func_missing_arg argname
  693. # Echo program name prefixed message to standard error and set global
  694. # exit_cmd.
  695. func_missing_arg ()
  696. {
  697. $opt_debug
  698. func_error "missing argument for $1."
  699. exit_cmd=exit
  700. }
  701. # func_split_short_opt shortopt
  702. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  703. # variables after splitting SHORTOPT after the 2nd character.
  704. func_split_short_opt ()
  705. {
  706. my_sed_short_opt='1s/^\(..\).*$/\1/;q'
  707. my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
  708. func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
  709. func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
  710. } # func_split_short_opt may be replaced by extended shell implementation
  711. # func_split_long_opt longopt
  712. # Set func_split_long_opt_name and func_split_long_opt_arg shell
  713. # variables after splitting LONGOPT at the `=' sign.
  714. func_split_long_opt ()
  715. {
  716. my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
  717. my_sed_long_arg='1s/^--[^=]*=//'
  718. func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
  719. func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
  720. } # func_split_long_opt may be replaced by extended shell implementation
  721. exit_cmd=:
  722. magic="%%%MAGIC variable%%%"
  723. magic_exe="%%%MAGIC EXE variable%%%"
  724. # Global variables.
  725. nonopt=
  726. preserve_args=
  727. lo2o="s/\\.lo\$/.${objext}/"
  728. o2lo="s/\\.${objext}\$/.lo/"
  729. extracted_archives=
  730. extracted_serial=0
  731. # If this variable is set in any of the actions, the command in it
  732. # will be execed at the end. This prevents here-documents from being
  733. # left over by shells.
  734. exec_cmd=
  735. # func_append var value
  736. # Append VALUE to the end of shell variable VAR.
  737. func_append ()
  738. {
  739. eval "${1}=\$${1}\${2}"
  740. } # func_append may be replaced by extended shell implementation
  741. # func_append_quoted var value
  742. # Quote VALUE and append to the end of shell variable VAR, separated
  743. # by a space.
  744. func_append_quoted ()
  745. {
  746. func_quote_for_eval "${2}"
  747. eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
  748. } # func_append_quoted may be replaced by extended shell implementation
  749. # func_arith arithmetic-term...
  750. func_arith ()
  751. {
  752. func_arith_result=`expr "${@}"`
  753. } # func_arith may be replaced by extended shell implementation
  754. # func_len string
  755. # STRING may not start with a hyphen.
  756. func_len ()
  757. {
  758. func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
  759. } # func_len may be replaced by extended shell implementation
  760. # func_lo2o object
  761. func_lo2o ()
  762. {
  763. func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
  764. } # func_lo2o may be replaced by extended shell implementation
  765. # func_xform libobj-or-source
  766. func_xform ()
  767. {
  768. func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
  769. } # func_xform may be replaced by extended shell implementation
  770. # func_fatal_configuration arg...
  771. # Echo program name prefixed message to standard error, followed by
  772. # a configuration failure hint, and exit.
  773. func_fatal_configuration ()
  774. {
  775. func_error ${1+"$@"}
  776. func_error "See the $PACKAGE documentation for more information."
  777. func_fatal_error "Fatal configuration error."
  778. }
  779. # func_config
  780. # Display the configuration for all the tags in this script.
  781. func_config ()
  782. {
  783. re_begincf='^# ### BEGIN LIBTOOL'
  784. re_endcf='^# ### END LIBTOOL'
  785. # Default configuration.
  786. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  787. # Now print the configurations for the tags.
  788. for tagname in $taglist; do
  789. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  790. done
  791. exit $?
  792. }
  793. # func_features
  794. # Display the features supported by this script.
  795. func_features ()
  796. {
  797. echo "host: $host"
  798. if test "$build_libtool_libs" = yes; then
  799. echo "enable shared libraries"
  800. else
  801. echo "disable shared libraries"
  802. fi
  803. if test "$build_old_libs" = yes; then
  804. echo "enable static libraries"
  805. else
  806. echo "disable static libraries"
  807. fi
  808. exit $?
  809. }
  810. # func_enable_tag tagname
  811. # Verify that TAGNAME is valid, and either flag an error and exit, or
  812. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  813. # variable here.
  814. func_enable_tag ()
  815. {
  816. # Global variable:
  817. tagname="$1"
  818. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  819. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  820. sed_extractcf="/$re_begincf/,/$re_endcf/p"
  821. # Validate tagname.
  822. case $tagname in
  823. *[!-_A-Za-z0-9,/]*)
  824. func_fatal_error "invalid tag name: $tagname"
  825. ;;
  826. esac
  827. # Don't test for the "default" C tag, as we know it's
  828. # there but not specially marked.
  829. case $tagname in
  830. CC) ;;
  831. *)
  832. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  833. taglist="$taglist $tagname"
  834. # Evaluate the configuration. Be careful to quote the path
  835. # and the sed script, to avoid splitting on whitespace, but
  836. # also don't use non-portable quotes within backquotes within
  837. # quotes we have to do it in 2 steps:
  838. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  839. eval "$extractedcf"
  840. else
  841. func_error "ignoring unknown tag $tagname"
  842. fi
  843. ;;
  844. esac
  845. }
  846. # func_check_version_match
  847. # Ensure that we are using m4 macros, and libtool script from the same
  848. # release of libtool.
  849. func_check_version_match ()
  850. {
  851. if test "$package_revision" != "$macro_revision"; then
  852. if test "$VERSION" != "$macro_version"; then
  853. if test -z "$macro_version"; then
  854. cat >&2 <<_LT_EOF
  855. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  856. $progname: definition of this LT_INIT comes from an older release.
  857. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  858. $progname: and run autoconf again.
  859. _LT_EOF
  860. else
  861. cat >&2 <<_LT_EOF
  862. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  863. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  864. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  865. $progname: and run autoconf again.
  866. _LT_EOF
  867. fi
  868. else
  869. cat >&2 <<_LT_EOF
  870. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  871. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  872. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  873. $progname: of $PACKAGE $VERSION and run autoconf again.
  874. _LT_EOF
  875. fi
  876. exit $EXIT_MISMATCH
  877. fi
  878. }
  879. # Shorthand for --mode=foo, only valid as the first argument
  880. case $1 in
  881. clean|clea|cle|cl)
  882. shift; set dummy --mode clean ${1+"$@"}; shift
  883. ;;
  884. compile|compil|compi|comp|com|co|c)
  885. shift; set dummy --mode compile ${1+"$@"}; shift
  886. ;;
  887. execute|execut|execu|exec|exe|ex|e)
  888. shift; set dummy --mode execute ${1+"$@"}; shift
  889. ;;
  890. finish|finis|fini|fin|fi|f)
  891. shift; set dummy --mode finish ${1+"$@"}; shift
  892. ;;
  893. install|instal|insta|inst|ins|in|i)
  894. shift; set dummy --mode install ${1+"$@"}; shift
  895. ;;
  896. link|lin|li|l)
  897. shift; set dummy --mode link ${1+"$@"}; shift
  898. ;;
  899. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  900. shift; set dummy --mode uninstall ${1+"$@"}; shift
  901. ;;
  902. esac
  903. # Option defaults:
  904. opt_debug=:
  905. opt_dry_run=false
  906. opt_config=false
  907. opt_preserve_dup_deps=false
  908. opt_features=false
  909. opt_finish=false
  910. opt_help=false
  911. opt_help_all=false
  912. opt_silent=:
  913. opt_warning=:
  914. opt_verbose=:
  915. opt_silent=false
  916. opt_verbose=false
  917. # Parse options once, thoroughly. This comes as soon as possible in the
  918. # script to make things like `--version' happen as quickly as we can.
  919. {
  920. # this just eases exit handling
  921. while test $# -gt 0; do
  922. opt="$1"
  923. shift
  924. case $opt in
  925. --debug|-x) opt_debug='set -x'
  926. func_echo "enabling shell trace mode"
  927. $opt_debug
  928. ;;
  929. --dry-run|--dryrun|-n)
  930. opt_dry_run=:
  931. ;;
  932. --config)
  933. opt_config=:
  934. func_config
  935. ;;
  936. --dlopen|-dlopen)
  937. optarg="$1"
  938. opt_dlopen="${opt_dlopen+$opt_dlopen
  939. }$optarg"
  940. shift
  941. ;;
  942. --preserve-dup-deps)
  943. opt_preserve_dup_deps=:
  944. ;;
  945. --features)
  946. opt_features=:
  947. func_features
  948. ;;
  949. --finish)
  950. opt_finish=:
  951. set dummy --mode finish ${1+"$@"}; shift
  952. ;;
  953. --help)
  954. opt_help=:
  955. ;;
  956. --help-all)
  957. opt_help_all=:
  958. opt_help=': help-all'
  959. ;;
  960. --mode)
  961. test $# = 0 && func_missing_arg $opt && break
  962. optarg="$1"
  963. opt_mode="$optarg"
  964. case $optarg in
  965. # Valid mode arguments:
  966. clean|compile|execute|finish|install|link|relink|uninstall) ;;
  967. # Catch anything else as an error
  968. *) func_error "invalid argument for $opt"
  969. exit_cmd=exit
  970. break
  971. ;;
  972. esac
  973. shift
  974. ;;
  975. --no-silent|--no-quiet)
  976. opt_silent=false
  977. func_append preserve_args " $opt"
  978. ;;
  979. --no-warning|--no-warn)
  980. opt_warning=false
  981. func_append preserve_args " $opt"
  982. ;;
  983. --no-verbose)
  984. opt_verbose=false
  985. func_append preserve_args " $opt"
  986. ;;
  987. --silent|--quiet)
  988. opt_silent=:
  989. func_append preserve_args " $opt"
  990. opt_verbose=false
  991. ;;
  992. --verbose|-v)
  993. opt_verbose=:
  994. func_append preserve_args " $opt"
  995. opt_silent=false
  996. ;;
  997. --tag)
  998. test $# = 0 && func_missing_arg $opt && break
  999. optarg="$1"
  1000. opt_tag="$optarg"
  1001. func_append preserve_args " $opt $optarg"
  1002. func_enable_tag "$optarg"
  1003. shift
  1004. ;;
  1005. -\?|-h) func_usage ;;
  1006. --help) func_help ;;
  1007. --version) func_version ;;
  1008. # Separate optargs to long options:
  1009. --*=*)
  1010. func_split_long_opt "$opt"
  1011. set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
  1012. shift
  1013. ;;
  1014. # Separate non-argument short options:
  1015. -\?*|-h*|-n*|-v*)
  1016. func_split_short_opt "$opt"
  1017. set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
  1018. shift
  1019. ;;
  1020. --) break ;;
  1021. -*) func_fatal_help "unrecognized option \`$opt'" ;;
  1022. *) set dummy "$opt" ${1+"$@"}; shift; break ;;
  1023. esac
  1024. done
  1025. # Validate options:
  1026. # save first non-option argument
  1027. if test "$#" -gt 0; then
  1028. nonopt="$opt"
  1029. shift
  1030. fi
  1031. # preserve --debug
  1032. test "$opt_debug" = : || func_append preserve_args " --debug"
  1033. case $host in
  1034. *cygwin* | *mingw* | *pw32* | *cegcc*)
  1035. # don't eliminate duplications in $postdeps and $predeps
  1036. opt_duplicate_compiler_generated_deps=:
  1037. ;;
  1038. *)
  1039. opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  1040. ;;
  1041. esac
  1042. $opt_help || {
  1043. # Sanity checks first:
  1044. func_check_version_match
  1045. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  1046. func_fatal_configuration "not configured to build any kind of library"
  1047. fi
  1048. # Darwin sucks
  1049. eval std_shrext=\"$shrext_cmds\"
  1050. # Only execute mode is allowed to have -dlopen flags.
  1051. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
  1052. func_error "unrecognized option \`-dlopen'"
  1053. $ECHO "$help" 1>&2
  1054. exit $EXIT_FAILURE
  1055. fi
  1056. # Change the help message to a mode-specific one.
  1057. generic_help="$help"
  1058. help="Try \`$progname --help --mode=$opt_mode' for more information."
  1059. }
  1060. # Bail if the options were screwed
  1061. $exit_cmd $EXIT_FAILURE
  1062. }
  1063. ## ----------- ##
  1064. ## Main. ##
  1065. ## ----------- ##
  1066. # func_lalib_p file
  1067. # True iff FILE is a libtool `.la' library or `.lo' object file.
  1068. # This function is only a basic sanity check; it will hardly flush out
  1069. # determined imposters.
  1070. func_lalib_p ()
  1071. {
  1072. test -f "$1" &&
  1073. $SED -e 4q "$1" 2>/dev/null \
  1074. | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  1075. }
  1076. # func_lalib_unsafe_p file
  1077. # True iff FILE is a libtool `.la' library or `.lo' object file.
  1078. # This function implements the same check as func_lalib_p without
  1079. # resorting to external programs. To this end, it redirects stdin and
  1080. # closes it afterwards, without saving the original file descriptor.
  1081. # As a safety measure, use it only where a negative result would be
  1082. # fatal anyway. Works if `file' does not exist.
  1083. func_lalib_unsafe_p ()
  1084. {
  1085. lalib_p=no
  1086. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  1087. for lalib_p_l in 1 2 3 4
  1088. do
  1089. read lalib_p_line
  1090. case "$lalib_p_line" in
  1091. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  1092. esac
  1093. done
  1094. exec 0<&5 5<&-
  1095. fi
  1096. test "$lalib_p" = yes
  1097. }
  1098. # func_ltwrapper_script_p file
  1099. # True iff FILE is a libtool wrapper script
  1100. # This function is only a basic sanity check; it will hardly flush out
  1101. # determined imposters.
  1102. func_ltwrapper_script_p ()
  1103. {
  1104. func_lalib_p "$1"
  1105. }
  1106. # func_ltwrapper_executable_p file
  1107. # True iff FILE is a libtool wrapper executable
  1108. # This function is only a basic sanity check; it will hardly flush out
  1109. # determined imposters.
  1110. func_ltwrapper_executable_p ()
  1111. {
  1112. func_ltwrapper_exec_suffix=
  1113. case $1 in
  1114. *.exe) ;;
  1115. *) func_ltwrapper_exec_suffix=.exe ;;
  1116. esac
  1117. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  1118. }
  1119. # func_ltwrapper_scriptname file
  1120. # Assumes file is an ltwrapper_executable
  1121. # uses $file to determine the appropriate filename for a
  1122. # temporary ltwrapper_script.
  1123. func_ltwrapper_scriptname ()
  1124. {
  1125. func_dirname_and_basename "$1" "" "."
  1126. func_stripname '' '.exe' "$func_basename_result"
  1127. func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
  1128. }
  1129. # func_ltwrapper_p file
  1130. # True iff FILE is a libtool wrapper script or wrapper executable
  1131. # This function is only a basic sanity check; it will hardly flush out
  1132. # determined imposters.
  1133. func_ltwrapper_p ()
  1134. {
  1135. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  1136. }
  1137. # func_execute_cmds commands fail_cmd
  1138. # Execute tilde-delimited COMMANDS.
  1139. # If FAIL_CMD is given, eval that upon failure.
  1140. # FAIL_CMD may read-access the current command in variable CMD!
  1141. func_execute_cmds ()
  1142. {
  1143. $opt_debug
  1144. save_ifs=$IFS; IFS='~'
  1145. for cmd in $1; do
  1146. IFS=$save_ifs
  1147. eval cmd=\"$cmd\"
  1148. func_show_eval "$cmd" "${2-:}"
  1149. done
  1150. IFS=$save_ifs
  1151. }
  1152. # func_source file
  1153. # Source FILE, adding directory component if necessary.
  1154. # Note that it is not necessary on cygwin/mingw to append a dot to
  1155. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  1156. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  1157. # `FILE.' does not work on cygwin managed mounts.
  1158. func_source ()
  1159. {
  1160. $opt_debug
  1161. case $1 in
  1162. */* | *\\*) . "$1" ;;
  1163. *) . "./$1" ;;
  1164. esac
  1165. }
  1166. # func_resolve_sysroot PATH
  1167. # Replace a leading = in PATH with a sysroot. Store the result into
  1168. # func_resolve_sysroot_result
  1169. func_resolve_sysroot ()
  1170. {
  1171. func_resolve_sysroot_result=$1
  1172. case $func_resolve_sysroot_result in
  1173. =*)
  1174. func_stripname '=' '' "$func_resolve_sysroot_result"
  1175. func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  1176. ;;
  1177. esac
  1178. }
  1179. # func_replace_sysroot PATH
  1180. # If PATH begins with the sysroot, replace it with = and
  1181. # store the result into func_replace_sysroot_result.
  1182. func_replace_sysroot ()
  1183. {
  1184. case "$lt_sysroot:$1" in
  1185. ?*:"$lt_sysroot"*)
  1186. func_stripname "$lt_sysroot" '' "$1"
  1187. func_replace_sysroot_result="=$func_stripname_result"
  1188. ;;
  1189. *)
  1190. # Including no sysroot.
  1191. func_replace_sysroot_result=$1
  1192. ;;
  1193. esac
  1194. }
  1195. # func_infer_tag arg
  1196. # Infer tagged configuration to use if any are available and
  1197. # if one wasn't chosen via the "--tag" command line option.
  1198. # Only attempt this if the compiler in the base compile
  1199. # command doesn't match the default compiler.
  1200. # arg is usually of the form 'gcc ...'
  1201. func_infer_tag ()
  1202. {
  1203. $opt_debug
  1204. if test -n "$available_tags" && test -z "$tagname"; then
  1205. CC_quoted=
  1206. for arg in $CC; do
  1207. func_append_quoted CC_quoted "$arg"
  1208. done
  1209. CC_expanded=`func_echo_all $CC`
  1210. CC_quoted_expanded=`func_echo_all $CC_quoted`
  1211. case $@ in
  1212. # Blanks in the command may have been stripped by the calling shell,
  1213. # but not from the CC environment variable when configure was run.
  1214. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  1215. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  1216. # Blanks at the start of $base_compile will cause this to fail
  1217. # if we don't check for them as well.
  1218. *)
  1219. for z in $available_tags; do
  1220. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  1221. # Evaluate the configuration.
  1222. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  1223. CC_quoted=
  1224. for arg in $CC; do
  1225. # Double-quote args containing other shell metacharacters.
  1226. func_append_quoted CC_quoted "$arg"
  1227. done
  1228. CC_expanded=`func_echo_all $CC`
  1229. CC_quoted_expanded=`func_echo_all $CC_quoted`
  1230. case "$@ " in
  1231. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  1232. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  1233. # The compiler in the base compile command matches
  1234. # the one in the tagged configuration.
  1235. # Assume this is the tagged configuration we want.
  1236. tagname=$z
  1237. break
  1238. ;;
  1239. esac
  1240. fi
  1241. done
  1242. # If $tagname still isn't set, then no tagged configuration
  1243. # was found and let the user know that the "--tag" command
  1244. # line option must be used.
  1245. if test -z "$tagname"; then
  1246. func_echo "unable to infer tagged configuration"
  1247. func_fatal_error "specify a tag with \`--tag'"
  1248. # else
  1249. # func_verbose "using $tagname tagged configuration"
  1250. fi
  1251. ;;
  1252. esac
  1253. fi
  1254. }
  1255. # func_write_libtool_object output_name pic_name nonpic_name
  1256. # Create a libtool object file (analogous to a ".la" file),
  1257. # but don't create it if we're doing a dry run.
  1258. func_write_libtool_object ()
  1259. {
  1260. write_libobj=${1}
  1261. if test "$build_libtool_libs" = yes; then
  1262. write_lobj=\'${2}\'
  1263. else
  1264. write_lobj=none
  1265. fi
  1266. if test "$build_old_libs" = yes; then
  1267. write_oldobj=\'${3}\'
  1268. else
  1269. write_oldobj=none
  1270. fi
  1271. $opt_dry_run || {
  1272. cat >${write_libobj}T <<EOF
  1273. # $write_libobj - a libtool object file
  1274. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  1275. #
  1276. # Please DO NOT delete this file!
  1277. # It is necessary for linking the library.
  1278. # Name of the PIC object.
  1279. pic_object=$write_lobj
  1280. # Name of the non-PIC object
  1281. non_pic_object=$write_oldobj
  1282. EOF
  1283. $MV "${write_libobj}T" "${write_libobj}"
  1284. }
  1285. }
  1286. ##################################################
  1287. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  1288. ##################################################
  1289. # func_convert_core_file_wine_to_w32 ARG
  1290. # Helper function used by file name conversion functions when $build is *nix,
  1291. # and $host is mingw, cygwin, or some other w32 environment. Relies on a
  1292. # correctly configured wine environment available, with the winepath program
  1293. # in $build's $PATH.
  1294. #
  1295. # ARG is the $build file name to be converted to w32 format.
  1296. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  1297. # be empty on error (or when ARG is empty)
  1298. func_convert_core_file_wine_to_w32 ()
  1299. {
  1300. $opt_debug
  1301. func_convert_core_file_wine_to_w32_result="$1"
  1302. if test -n "$1"; then
  1303. # Unfortunately, winepath does not exit with a non-zero error code, so we
  1304. # are forced to check the contents of stdout. On the other hand, if the
  1305. # command is not found, the shell will set an exit code of 127 and print
  1306. # *an error message* to stdout. So we must check for both error code of
  1307. # zero AND non-empty stdout, which explains the odd construction:
  1308. func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  1309. if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
  1310. func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  1311. $SED -e "$lt_sed_naive_backslashify"`
  1312. else
  1313. func_convert_core_file_wine_to_w32_result=
  1314. fi
  1315. fi
  1316. }
  1317. # end: func_convert_core_file_wine_to_w32
  1318. # func_convert_core_path_wine_to_w32 ARG
  1319. # Helper function used by path conversion functions when $build is *nix, and
  1320. # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
  1321. # configured wine environment available, with the winepath program in $build's
  1322. # $PATH. Assumes ARG has no leading or trailing path separator characters.
  1323. #
  1324. # ARG is path to be converted from $build format to win32.
  1325. # Result is available in $func_convert_core_path_wine_to_w32_result.
  1326. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  1327. # are convertible, then the result may be empty.
  1328. func_convert_core_path_wine_to_w32 ()
  1329. {
  1330. $opt_debug
  1331. # unfortunately, winepath doesn't convert paths, only file names
  1332. func_convert_core_path_wine_to_w32_result=""
  1333. if test -n "$1"; then
  1334. oldIFS=$IFS
  1335. IFS=:
  1336. for func_convert_core_path_wine_to_w32_f in $1; do
  1337. IFS=$oldIFS
  1338. func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  1339. if test -n "$func_convert_core_file_wine_to_w32_result" ; then
  1340. if test -z "$func_convert_core_path_wine_to_w32_result"; then
  1341. func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
  1342. else
  1343. func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  1344. fi
  1345. fi
  1346. done
  1347. IFS=$oldIFS
  1348. fi
  1349. }
  1350. # end: func_convert_core_path_wine_to_w32
  1351. # func_cygpath ARGS...
  1352. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  1353. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  1354. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  1355. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  1356. # file name or path is assumed to be in w32 format, as previously converted
  1357. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  1358. # or path in func_cygpath_result (input file name or path is assumed to be in
  1359. # Cygwin format). Returns an empty string on error.
  1360. #
  1361. # ARGS are passed to cygpath, with the last one being the file name or path to
  1362. # be converted.
  1363. #
  1364. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  1365. # environment variable; do not put it in $PATH.
  1366. func_cygpath ()
  1367. {
  1368. $opt_debug
  1369. if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  1370. func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  1371. if test "$?" -ne 0; then
  1372. # on failure, ensure result is empty
  1373. func_cygpath_result=
  1374. fi
  1375. else
  1376. func_cygpath_result=
  1377. func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
  1378. fi
  1379. }
  1380. #end: func_cygpath
  1381. # func_convert_core_msys_to_w32 ARG
  1382. # Convert file name or path ARG from MSYS format to w32 format. Return
  1383. # result in func_convert_core_msys_to_w32_result.
  1384. func_convert_core_msys_to_w32 ()
  1385. {
  1386. $opt_debug
  1387. # awkward: cmd appends spaces to result
  1388. func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  1389. $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
  1390. }
  1391. #end: func_convert_core_msys_to_w32
  1392. # func_convert_file_check ARG1 ARG2
  1393. # Verify that ARG1 (a file name in $build format) was converted to $host
  1394. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  1395. # func_to_host_file_result to ARG1).
  1396. func_convert_file_check ()
  1397. {
  1398. $opt_debug
  1399. if test -z "$2" && test -n "$1" ; then
  1400. func_error "Could not determine host file name corresponding to"
  1401. func_error " \`$1'"
  1402. func_error "Continuing, but uninstalled executables may not work."
  1403. # Fallback:
  1404. func_to_host_file_result="$1"
  1405. fi
  1406. }
  1407. # end func_convert_file_check
  1408. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  1409. # Verify that FROM_PATH (a path in $build format) was converted to $host
  1410. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  1411. # func_to_host_file_result to a simplistic fallback value (see below).
  1412. func_convert_path_check ()
  1413. {
  1414. $opt_debug
  1415. if test -z "$4" && test -n "$3"; then
  1416. func_error "Could not determine the host path corresponding to"
  1417. func_error " \`$3'"
  1418. func_error "Continuing, but uninstalled executables may not work."
  1419. # Fallback. This is a deliberately simplistic "conversion" and
  1420. # should not be "improved". See libtool.info.
  1421. if test "x$1" != "x$2"; then
  1422. lt_replace_pathsep_chars="s|$1|$2|g"
  1423. func_to_host_path_result=`echo "$3" |
  1424. $SED -e "$lt_replace_pathsep_chars"`
  1425. else
  1426. func_to_host_path_result="$3"
  1427. fi
  1428. fi
  1429. }
  1430. # end func_convert_path_check
  1431. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  1432. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  1433. # and appending REPL if ORIG matches BACKPAT.
  1434. func_convert_path_front_back_pathsep ()
  1435. {
  1436. $opt_debug
  1437. case $4 in
  1438. $1 ) func_to_host_path_result="$3$func_to_host_path_result"
  1439. ;;
  1440. esac
  1441. case $4 in
  1442. $2 ) func_append func_to_host_path_result "$3"
  1443. ;;
  1444. esac
  1445. }
  1446. # end func_convert_path_front_back_pathsep
  1447. ##################################################
  1448. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  1449. ##################################################
  1450. # invoked via `$to_host_file_cmd ARG'
  1451. #
  1452. # In each case, ARG is the path to be converted from $build to $host format.
  1453. # Result will be available in $func_to_host_file_result.
  1454. # func_to_host_file ARG
  1455. # Converts the file name ARG from $build format to $host format. Return result
  1456. # in func_to_host_file_result.
  1457. func_to_host_file ()
  1458. {
  1459. $opt_debug
  1460. $to_host_file_cmd "$1"
  1461. }
  1462. # end func_to_host_file
  1463. # func_to_tool_file ARG LAZY
  1464. # converts the file name ARG from $build format to toolchain format. Return
  1465. # result in func_to_tool_file_result. If the conversion in use is listed
  1466. # in (the comma separated) LAZY, no conversion takes place.
  1467. func_to_tool_file ()
  1468. {
  1469. $opt_debug
  1470. case ,$2, in
  1471. *,"$to_tool_file_cmd",*)
  1472. func_to_tool_file_result=$1
  1473. ;;
  1474. *)
  1475. $to_tool_f…

Large files files are truncated, but you can click here to view the full file