PageRenderTime 2599ms CodeModel.GetById 1ms RepoModel.GetById 5ms app.codeStats 1ms

/recipes/binutils/binutils-2.20.1/libtool-2.4-update.patch

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