PageRenderTime 69ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 2ms

/ltmain.sh

https://bitbucket.org/libusbandroid/libusb-compat-android
Shell | 8461 lines | 6920 code | 603 blank | 938 comment | 841 complexity | e5b9f87326dbd639e117a7aa1e7e1606 MD5 | raw file
Possible License(s): LGPL-2.1

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

  1. # Generated from ltmain.m4sh.
  2. # ltmain.sh (GNU libtool) 2.2.6
  3. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 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. # --tag=TAG use configuration variables from tag TAG
  39. # -v, --verbose print informational messages (default)
  40. # --version print version information
  41. # -h, --help print short or long help message
  42. #
  43. # MODE must be one of the following:
  44. #
  45. # clean remove files from the build directory
  46. # compile compile a source file into a libtool object
  47. # execute automatically set library path, then run a program
  48. # finish complete the installation of libtool libraries
  49. # install install libraries or executables
  50. # link create a library or an executable
  51. # uninstall remove libraries from an installed directory
  52. #
  53. # MODE-ARGS vary depending on the MODE.
  54. # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
  55. #
  56. # When reporting a bug, please describe a test case to reproduce it and
  57. # include the following information:
  58. #
  59. # host-triplet: $host
  60. # shell: $SHELL
  61. # compiler: $LTCC
  62. # compiler flags: $LTCFLAGS
  63. # linker: $LD (gnu? $with_gnu_ld)
  64. # $progname: (GNU libtool) 2.2.6
  65. # automake: $automake_version
  66. # autoconf: $autoconf_version
  67. #
  68. # Report bugs to <bug-libtool@gnu.org>.
  69. PROGRAM=ltmain.sh
  70. PACKAGE=libtool
  71. VERSION=2.2.6
  72. TIMESTAMP=""
  73. package_revision=1.3012
  74. # Be Bourne compatible
  75. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  76. emulate sh
  77. NULLCMD=:
  78. # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  79. # is contrary to our usage. Disable this feature.
  80. alias -g '${1+"$@"}'='"$@"'
  81. setopt NO_GLOB_SUBST
  82. else
  83. case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
  84. fi
  85. BIN_SH=xpg4; export BIN_SH # for Tru64
  86. DUALCASE=1; export DUALCASE # for MKS sh
  87. # NLS nuisances: We save the old values to restore during execute mode.
  88. # Only set LANG and LC_ALL to C if already set.
  89. # These must not be set unconditionally because not all systems understand
  90. # e.g. LANG=C (notably SCO).
  91. lt_user_locale=
  92. lt_safe_locale=
  93. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  94. do
  95. eval "if test \"\${$lt_var+set}\" = set; then
  96. save_$lt_var=\$$lt_var
  97. $lt_var=C
  98. export $lt_var
  99. lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
  100. lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
  101. fi"
  102. done
  103. $lt_unset CDPATH
  104. : ${CP="cp -f"}
  105. : ${ECHO="echo"}
  106. : ${EGREP="/usr/bin/grep -E"}
  107. : ${FGREP="/usr/bin/grep -F"}
  108. : ${GREP="/usr/bin/grep"}
  109. : ${LN_S="ln -s"}
  110. : ${MAKE="make"}
  111. : ${MKDIR="mkdir"}
  112. : ${MV="mv -f"}
  113. : ${RM="rm -f"}
  114. : ${SED="/opt/local/bin/gsed"}
  115. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  116. : ${Xsed="$SED -e 1s/^X//"}
  117. # Global variables:
  118. EXIT_SUCCESS=0
  119. EXIT_FAILURE=1
  120. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  121. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  122. exit_status=$EXIT_SUCCESS
  123. # Make sure IFS has a sensible default
  124. lt_nl='
  125. '
  126. IFS=" $lt_nl"
  127. dirname="s,/[^/]*$,,"
  128. basename="s,^.*/,,"
  129. # func_dirname_and_basename file append nondir_replacement
  130. # perform func_basename and func_dirname in a single function
  131. # call:
  132. # dirname: Compute the dirname of FILE. If nonempty,
  133. # add APPEND to the result, otherwise set result
  134. # to NONDIR_REPLACEMENT.
  135. # value returned in "$func_dirname_result"
  136. # basename: Compute filename of FILE.
  137. # value retuned in "$func_basename_result"
  138. # Implementation must be kept synchronized with func_dirname
  139. # and func_basename. For efficiency, we do not delegate to
  140. # those functions but instead duplicate the functionality here.
  141. func_dirname_and_basename ()
  142. {
  143. # Extract subdirectory from the argument.
  144. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
  145. if test "X$func_dirname_result" = "X${1}"; then
  146. func_dirname_result="${3}"
  147. else
  148. func_dirname_result="$func_dirname_result${2}"
  149. fi
  150. func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
  151. }
  152. # Generated shell functions inserted here.
  153. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  154. # is ksh but when the shell is invoked as "sh" and the current value of
  155. # the _XPG environment variable is not equal to 1 (one), the special
  156. # positional parameter $0, within a function call, is the name of the
  157. # function.
  158. progpath="$0"
  159. # The name of this program:
  160. # In the unlikely event $progname began with a '-', it would play havoc with
  161. # func_echo (imagine progname=-n), so we prepend ./ in that case:
  162. func_dirname_and_basename "$progpath"
  163. progname=$func_basename_result
  164. case $progname in
  165. -*) progname=./$progname ;;
  166. esac
  167. # Make sure we have an absolute path for reexecution:
  168. case $progpath in
  169. [\\/]*|[A-Za-z]:\\*) ;;
  170. *[\\/]*)
  171. progdir=$func_dirname_result
  172. progdir=`cd "$progdir" && pwd`
  173. progpath="$progdir/$progname"
  174. ;;
  175. *)
  176. save_IFS="$IFS"
  177. IFS=:
  178. for progdir in $PATH; do
  179. IFS="$save_IFS"
  180. test -x "$progdir/$progname" && break
  181. done
  182. IFS="$save_IFS"
  183. test -n "$progdir" || progdir=`pwd`
  184. progpath="$progdir/$progname"
  185. ;;
  186. esac
  187. # Sed substitution that helps us do robust quoting. It backslashifies
  188. # metacharacters that are still active within double-quoted strings.
  189. Xsed="${SED}"' -e 1s/^X//'
  190. sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
  191. # Same as above, but do not quote variable references.
  192. double_quote_subst='s/\(["`\\]\)/\\\1/g'
  193. # Re-`\' parameter expansions in output of double_quote_subst that were
  194. # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
  195. # in input to double_quote_subst, that '$' was protected from expansion.
  196. # Since each input `\' is now two `\'s, look for any number of runs of
  197. # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
  198. bs='\\'
  199. bs2='\\\\'
  200. bs4='\\\\\\\\'
  201. dollar='\$'
  202. sed_double_backslash="\
  203. s/$bs4/&\\
  204. /g
  205. s/^$bs2$dollar/$bs&/
  206. s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
  207. s/\n//g"
  208. # Standard options:
  209. opt_dry_run=false
  210. opt_help=false
  211. opt_quiet=false
  212. opt_verbose=false
  213. opt_warning=:
  214. # func_echo arg...
  215. # Echo program name prefixed message, along with the current mode
  216. # name if it has been set yet.
  217. func_echo ()
  218. {
  219. $ECHO "$progname${mode+: }$mode: $*"
  220. }
  221. # func_verbose arg...
  222. # Echo program name prefixed message in verbose mode only.
  223. func_verbose ()
  224. {
  225. $opt_verbose && func_echo ${1+"$@"}
  226. # A bug in bash halts the script if the last line of a function
  227. # fails when set -e is in force, so we need another command to
  228. # work around that:
  229. :
  230. }
  231. # func_error arg...
  232. # Echo program name prefixed message to standard error.
  233. func_error ()
  234. {
  235. $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
  236. }
  237. # func_warning arg...
  238. # Echo program name prefixed warning message to standard error.
  239. func_warning ()
  240. {
  241. $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
  242. # bash bug again:
  243. :
  244. }
  245. # func_fatal_error arg...
  246. # Echo program name prefixed message to standard error, and exit.
  247. func_fatal_error ()
  248. {
  249. func_error ${1+"$@"}
  250. exit $EXIT_FAILURE
  251. }
  252. # func_fatal_help arg...
  253. # Echo program name prefixed message to standard error, followed by
  254. # a help hint, and exit.
  255. func_fatal_help ()
  256. {
  257. func_error ${1+"$@"}
  258. func_fatal_error "$help"
  259. }
  260. help="Try \`$progname --help' for more information." ## default
  261. # func_grep expression filename
  262. # Check whether EXPRESSION matches any line of FILENAME, without output.
  263. func_grep ()
  264. {
  265. $GREP "$1" "$2" >/dev/null 2>&1
  266. }
  267. # func_mkdir_p directory-path
  268. # Make sure the entire path to DIRECTORY-PATH is available.
  269. func_mkdir_p ()
  270. {
  271. my_directory_path="$1"
  272. my_dir_list=
  273. if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
  274. # Protect directory names starting with `-'
  275. case $my_directory_path in
  276. -*) my_directory_path="./$my_directory_path" ;;
  277. esac
  278. # While some portion of DIR does not yet exist...
  279. while test ! -d "$my_directory_path"; do
  280. # ...make a list in topmost first order. Use a colon delimited
  281. # list incase some portion of path contains whitespace.
  282. my_dir_list="$my_directory_path:$my_dir_list"
  283. # If the last portion added has no slash in it, the list is done
  284. case $my_directory_path in */*) ;; *) break ;; esac
  285. # ...otherwise throw away the child directory and loop
  286. my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
  287. done
  288. my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
  289. save_mkdir_p_IFS="$IFS"; IFS=':'
  290. for my_dir in $my_dir_list; do
  291. IFS="$save_mkdir_p_IFS"
  292. # mkdir can fail with a `File exist' error if two processes
  293. # try to create one of the directories concurrently. Don't
  294. # stop in that case!
  295. $MKDIR "$my_dir" 2>/dev/null || :
  296. done
  297. IFS="$save_mkdir_p_IFS"
  298. # Bail out if we (or some other process) failed to create a directory.
  299. test -d "$my_directory_path" || \
  300. func_fatal_error "Failed to create \`$1'"
  301. fi
  302. }
  303. # func_mktempdir [string]
  304. # Make a temporary directory that won't clash with other running
  305. # libtool processes, and avoids race conditions if possible. If
  306. # given, STRING is the basename for that directory.
  307. func_mktempdir ()
  308. {
  309. my_template="${TMPDIR-/tmp}/${1-$progname}"
  310. if test "$opt_dry_run" = ":"; then
  311. # Return a directory name, but don't create it in dry-run mode
  312. my_tmpdir="${my_template}-$$"
  313. else
  314. # If mktemp works, use that first and foremost
  315. my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
  316. if test ! -d "$my_tmpdir"; then
  317. # Failing that, at least try and use $RANDOM to avoid a race
  318. my_tmpdir="${my_template}-${RANDOM-0}$$"
  319. save_mktempdir_umask=`umask`
  320. umask 0077
  321. $MKDIR "$my_tmpdir"
  322. umask $save_mktempdir_umask
  323. fi
  324. # If we're not in dry-run mode, bomb out on failure
  325. test -d "$my_tmpdir" || \
  326. func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
  327. fi
  328. $ECHO "X$my_tmpdir" | $Xsed
  329. }
  330. # func_quote_for_eval arg
  331. # Aesthetically quote ARG to be evaled later.
  332. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
  333. # is double-quoted, suitable for a subsequent eval, whereas
  334. # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
  335. # which are still active within double quotes backslashified.
  336. func_quote_for_eval ()
  337. {
  338. case $1 in
  339. *[\\\`\"\$]*)
  340. func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
  341. *)
  342. func_quote_for_eval_unquoted_result="$1" ;;
  343. esac
  344. case $func_quote_for_eval_unquoted_result in
  345. # Double-quote args containing shell metacharacters to delay
  346. # word splitting, command substitution and and variable
  347. # expansion for a subsequent eval.
  348. # Many Bourne shells cannot handle close brackets correctly
  349. # in scan sets, so we specify it separately.
  350. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  351. func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
  352. ;;
  353. *)
  354. func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
  355. esac
  356. }
  357. # func_quote_for_expand arg
  358. # Aesthetically quote ARG to be evaled later; same as above,
  359. # but do not quote variable references.
  360. func_quote_for_expand ()
  361. {
  362. case $1 in
  363. *[\\\`\"]*)
  364. my_arg=`$ECHO "X$1" | $Xsed \
  365. -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
  366. *)
  367. my_arg="$1" ;;
  368. esac
  369. case $my_arg in
  370. # Double-quote args containing shell metacharacters to delay
  371. # word splitting and command substitution for a subsequent eval.
  372. # Many Bourne shells cannot handle close brackets correctly
  373. # in scan sets, so we specify it separately.
  374. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  375. my_arg="\"$my_arg\""
  376. ;;
  377. esac
  378. func_quote_for_expand_result="$my_arg"
  379. }
  380. # func_show_eval cmd [fail_exp]
  381. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  382. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  383. # is given, then evaluate it.
  384. func_show_eval ()
  385. {
  386. my_cmd="$1"
  387. my_fail_exp="${2-:}"
  388. ${opt_silent-false} || {
  389. func_quote_for_expand "$my_cmd"
  390. eval "func_echo $func_quote_for_expand_result"
  391. }
  392. if ${opt_dry_run-false}; then :; else
  393. eval "$my_cmd"
  394. my_status=$?
  395. if test "$my_status" -eq 0; then :; else
  396. eval "(exit $my_status); $my_fail_exp"
  397. fi
  398. fi
  399. }
  400. # func_show_eval_locale cmd [fail_exp]
  401. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  402. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  403. # is given, then evaluate it. Use the saved locale for evaluation.
  404. func_show_eval_locale ()
  405. {
  406. my_cmd="$1"
  407. my_fail_exp="${2-:}"
  408. ${opt_silent-false} || {
  409. func_quote_for_expand "$my_cmd"
  410. eval "func_echo $func_quote_for_expand_result"
  411. }
  412. if ${opt_dry_run-false}; then :; else
  413. eval "$lt_user_locale
  414. $my_cmd"
  415. my_status=$?
  416. eval "$lt_safe_locale"
  417. if test "$my_status" -eq 0; then :; else
  418. eval "(exit $my_status); $my_fail_exp"
  419. fi
  420. fi
  421. }
  422. # func_version
  423. # Echo version message to standard output and exit.
  424. func_version ()
  425. {
  426. $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
  427. s/^# //
  428. s/^# *$//
  429. s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
  430. p
  431. }' < "$progpath"
  432. exit $?
  433. }
  434. # func_usage
  435. # Echo short help message to standard output and exit.
  436. func_usage ()
  437. {
  438. $SED -n '/^# Usage:/,/# -h/ {
  439. s/^# //
  440. s/^# *$//
  441. s/\$progname/'$progname'/
  442. p
  443. }' < "$progpath"
  444. $ECHO
  445. $ECHO "run \`$progname --help | more' for full usage"
  446. exit $?
  447. }
  448. # func_help
  449. # Echo long help message to standard output and exit.
  450. func_help ()
  451. {
  452. $SED -n '/^# Usage:/,/# Report bugs to/ {
  453. s/^# //
  454. s/^# *$//
  455. s*\$progname*'$progname'*
  456. s*\$host*'"$host"'*
  457. s*\$SHELL*'"$SHELL"'*
  458. s*\$LTCC*'"$LTCC"'*
  459. s*\$LTCFLAGS*'"$LTCFLAGS"'*
  460. s*\$LD*'"$LD"'*
  461. s/\$with_gnu_ld/'"$with_gnu_ld"'/
  462. s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
  463. s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
  464. p
  465. }' < "$progpath"
  466. exit $?
  467. }
  468. # func_missing_arg argname
  469. # Echo program name prefixed message to standard error and set global
  470. # exit_cmd.
  471. func_missing_arg ()
  472. {
  473. func_error "missing argument for $1"
  474. exit_cmd=exit
  475. }
  476. exit_cmd=:
  477. # Check that we have a working $ECHO.
  478. if test "X$1" = X--no-reexec; then
  479. # Discard the --no-reexec flag, and continue.
  480. shift
  481. elif test "X$1" = X--fallback-echo; then
  482. # Avoid inline document here, it may be left over
  483. :
  484. elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
  485. # Yippee, $ECHO works!
  486. :
  487. else
  488. # Restart under the correct shell, and then maybe $ECHO will work.
  489. exec $SHELL "$progpath" --no-reexec ${1+"$@"}
  490. fi
  491. # Same for EGREP, and just to be sure, do LTCC as well
  492. if test "x$EGREP" = x ; then
  493. EGREP=egrep
  494. fi
  495. if test "x$LTCC" = x ; then
  496. LTCC=${CC-gcc}
  497. fi
  498. if test "X$1" = X--fallback-echo; then
  499. # used as fallback echo
  500. shift
  501. cat <<EOF
  502. $*
  503. EOF
  504. exit $EXIT_SUCCESS
  505. fi
  506. magic="%%%MAGIC variable%%%"
  507. magic_exe="%%%MAGIC EXE variable%%%"
  508. # Global variables.
  509. # $mode is unset
  510. nonopt=
  511. execute_dlfiles=
  512. preserve_args=
  513. lo2o="s/\\.lo\$/.${objext}/"
  514. o2lo="s/\\.${objext}\$/.lo/"
  515. extracted_archives=
  516. extracted_serial=0
  517. opt_dry_run=false
  518. opt_duplicate_deps=false
  519. opt_silent=false
  520. opt_debug=:
  521. # If this variable is set in any of the actions, the command in it
  522. # will be execed at the end. This prevents here-documents from being
  523. # left over by shells.
  524. exec_cmd=
  525. # func_fatal_configuration arg...
  526. # Echo program name prefixed message to standard error, followed by
  527. # a configuration failure hint, and exit.
  528. func_fatal_configuration ()
  529. {
  530. func_error ${1+"$@"}
  531. func_error "See the $PACKAGE documentation for more information."
  532. func_fatal_error "Fatal configuration error."
  533. }
  534. # func_config
  535. # Display the configuration for all the tags in this script.
  536. func_config ()
  537. {
  538. re_begincf='^# ### BEGIN LIBTOOL'
  539. re_endcf='^# ### END LIBTOOL'
  540. # Default configuration.
  541. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  542. # Now print the configurations for the tags.
  543. for tagname in $taglist; do
  544. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  545. done
  546. exit $?
  547. }
  548. # func_features
  549. # Display the features supported by this script.
  550. func_features ()
  551. {
  552. $ECHO "host: $host"
  553. if test "$build_libtool_libs" = yes; then
  554. $ECHO "enable shared libraries"
  555. else
  556. $ECHO "disable shared libraries"
  557. fi
  558. if test "$build_old_libs" = yes; then
  559. $ECHO "enable static libraries"
  560. else
  561. $ECHO "disable static libraries"
  562. fi
  563. exit $?
  564. }
  565. # func_enable_tag tagname
  566. # Verify that TAGNAME is valid, and either flag an error and exit, or
  567. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  568. # variable here.
  569. func_enable_tag ()
  570. {
  571. # Global variable:
  572. tagname="$1"
  573. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  574. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  575. sed_extractcf="/$re_begincf/,/$re_endcf/p"
  576. # Validate tagname.
  577. case $tagname in
  578. *[!-_A-Za-z0-9,/]*)
  579. func_fatal_error "invalid tag name: $tagname"
  580. ;;
  581. esac
  582. # Don't test for the "default" C tag, as we know it's
  583. # there but not specially marked.
  584. case $tagname in
  585. CC) ;;
  586. *)
  587. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  588. taglist="$taglist $tagname"
  589. # Evaluate the configuration. Be careful to quote the path
  590. # and the sed script, to avoid splitting on whitespace, but
  591. # also don't use non-portable quotes within backquotes within
  592. # quotes we have to do it in 2 steps:
  593. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  594. eval "$extractedcf"
  595. else
  596. func_error "ignoring unknown tag $tagname"
  597. fi
  598. ;;
  599. esac
  600. }
  601. # Parse options once, thoroughly. This comes as soon as possible in
  602. # the script to make things like `libtool --version' happen quickly.
  603. {
  604. # Shorthand for --mode=foo, only valid as the first argument
  605. case $1 in
  606. clean|clea|cle|cl)
  607. shift; set dummy --mode clean ${1+"$@"}; shift
  608. ;;
  609. compile|compil|compi|comp|com|co|c)
  610. shift; set dummy --mode compile ${1+"$@"}; shift
  611. ;;
  612. execute|execut|execu|exec|exe|ex|e)
  613. shift; set dummy --mode execute ${1+"$@"}; shift
  614. ;;
  615. finish|finis|fini|fin|fi|f)
  616. shift; set dummy --mode finish ${1+"$@"}; shift
  617. ;;
  618. install|instal|insta|inst|ins|in|i)
  619. shift; set dummy --mode install ${1+"$@"}; shift
  620. ;;
  621. link|lin|li|l)
  622. shift; set dummy --mode link ${1+"$@"}; shift
  623. ;;
  624. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  625. shift; set dummy --mode uninstall ${1+"$@"}; shift
  626. ;;
  627. esac
  628. # Parse non-mode specific arguments:
  629. while test "$#" -gt 0; do
  630. opt="$1"
  631. shift
  632. case $opt in
  633. --config) func_config ;;
  634. --debug) preserve_args="$preserve_args $opt"
  635. func_echo "enabling shell trace mode"
  636. opt_debug='set -x'
  637. $opt_debug
  638. ;;
  639. -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
  640. execute_dlfiles="$execute_dlfiles $1"
  641. shift
  642. ;;
  643. --dry-run | -n) opt_dry_run=: ;;
  644. --features) func_features ;;
  645. --finish) mode="finish" ;;
  646. --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
  647. case $1 in
  648. # Valid mode arguments:
  649. clean) ;;
  650. compile) ;;
  651. execute) ;;
  652. finish) ;;
  653. install) ;;
  654. link) ;;
  655. relink) ;;
  656. uninstall) ;;
  657. # Catch anything else as an error
  658. *) func_error "invalid argument for $opt"
  659. exit_cmd=exit
  660. break
  661. ;;
  662. esac
  663. mode="$1"
  664. shift
  665. ;;
  666. --preserve-dup-deps)
  667. opt_duplicate_deps=: ;;
  668. --quiet|--silent) preserve_args="$preserve_args $opt"
  669. opt_silent=:
  670. ;;
  671. --verbose| -v) preserve_args="$preserve_args $opt"
  672. opt_silent=false
  673. ;;
  674. --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
  675. preserve_args="$preserve_args $opt $1"
  676. func_enable_tag "$1" # tagname is set here
  677. shift
  678. ;;
  679. # Separate optargs to long options:
  680. -dlopen=*|--mode=*|--tag=*)
  681. func_opt_split "$opt"
  682. set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
  683. shift
  684. ;;
  685. -\?|-h) func_usage ;;
  686. --help) opt_help=: ;;
  687. --version) func_version ;;
  688. -*) func_fatal_help "unrecognized option \`$opt'" ;;
  689. *) nonopt="$opt"
  690. break
  691. ;;
  692. esac
  693. done
  694. case $host in
  695. *cygwin* | *mingw* | *pw32* | *cegcc*)
  696. # don't eliminate duplications in $postdeps and $predeps
  697. opt_duplicate_compiler_generated_deps=:
  698. ;;
  699. *)
  700. opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
  701. ;;
  702. esac
  703. # Having warned about all mis-specified options, bail out if
  704. # anything was wrong.
  705. $exit_cmd $EXIT_FAILURE
  706. }
  707. # func_check_version_match
  708. # Ensure that we are using m4 macros, and libtool script from the same
  709. # release of libtool.
  710. func_check_version_match ()
  711. {
  712. if test "$package_revision" != "$macro_revision"; then
  713. if test "$VERSION" != "$macro_version"; then
  714. if test -z "$macro_version"; then
  715. cat >&2 <<_LT_EOF
  716. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  717. $progname: definition of this LT_INIT comes from an older release.
  718. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  719. $progname: and run autoconf again.
  720. _LT_EOF
  721. else
  722. cat >&2 <<_LT_EOF
  723. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  724. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  725. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  726. $progname: and run autoconf again.
  727. _LT_EOF
  728. fi
  729. else
  730. cat >&2 <<_LT_EOF
  731. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  732. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  733. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  734. $progname: of $PACKAGE $VERSION and run autoconf again.
  735. _LT_EOF
  736. fi
  737. exit $EXIT_MISMATCH
  738. fi
  739. }
  740. ## ----------- ##
  741. ## Main. ##
  742. ## ----------- ##
  743. $opt_help || {
  744. # Sanity checks first:
  745. func_check_version_match
  746. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  747. func_fatal_configuration "not configured to build any kind of library"
  748. fi
  749. test -z "$mode" && func_fatal_error "error: you must specify a MODE."
  750. # Darwin sucks
  751. eval std_shrext=\"$shrext_cmds\"
  752. # Only execute mode is allowed to have -dlopen flags.
  753. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  754. func_error "unrecognized option \`-dlopen'"
  755. $ECHO "$help" 1>&2
  756. exit $EXIT_FAILURE
  757. fi
  758. # Change the help message to a mode-specific one.
  759. generic_help="$help"
  760. help="Try \`$progname --help --mode=$mode' for more information."
  761. }
  762. # func_lalib_p file
  763. # True iff FILE is a libtool `.la' library or `.lo' object file.
  764. # This function is only a basic sanity check; it will hardly flush out
  765. # determined imposters.
  766. func_lalib_p ()
  767. {
  768. test -f "$1" &&
  769. $SED -e 4q "$1" 2>/dev/null \
  770. | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  771. }
  772. # func_lalib_unsafe_p file
  773. # True iff FILE is a libtool `.la' library or `.lo' object file.
  774. # This function implements the same check as func_lalib_p without
  775. # resorting to external programs. To this end, it redirects stdin and
  776. # closes it afterwards, without saving the original file descriptor.
  777. # As a safety measure, use it only where a negative result would be
  778. # fatal anyway. Works if `file' does not exist.
  779. func_lalib_unsafe_p ()
  780. {
  781. lalib_p=no
  782. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  783. for lalib_p_l in 1 2 3 4
  784. do
  785. read lalib_p_line
  786. case "$lalib_p_line" in
  787. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  788. esac
  789. done
  790. exec 0<&5 5<&-
  791. fi
  792. test "$lalib_p" = yes
  793. }
  794. # func_ltwrapper_script_p file
  795. # True iff FILE is a libtool wrapper script
  796. # This function is only a basic sanity check; it will hardly flush out
  797. # determined imposters.
  798. func_ltwrapper_script_p ()
  799. {
  800. func_lalib_p "$1"
  801. }
  802. # func_ltwrapper_executable_p file
  803. # True iff FILE is a libtool wrapper executable
  804. # This function is only a basic sanity check; it will hardly flush out
  805. # determined imposters.
  806. func_ltwrapper_executable_p ()
  807. {
  808. func_ltwrapper_exec_suffix=
  809. case $1 in
  810. *.exe) ;;
  811. *) func_ltwrapper_exec_suffix=.exe ;;
  812. esac
  813. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  814. }
  815. # func_ltwrapper_scriptname file
  816. # Assumes file is an ltwrapper_executable
  817. # uses $file to determine the appropriate filename for a
  818. # temporary ltwrapper_script.
  819. func_ltwrapper_scriptname ()
  820. {
  821. func_ltwrapper_scriptname_result=""
  822. if func_ltwrapper_executable_p "$1"; then
  823. func_dirname_and_basename "$1" "" "."
  824. func_stripname '' '.exe' "$func_basename_result"
  825. func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
  826. fi
  827. }
  828. # func_ltwrapper_p file
  829. # True iff FILE is a libtool wrapper script or wrapper executable
  830. # This function is only a basic sanity check; it will hardly flush out
  831. # determined imposters.
  832. func_ltwrapper_p ()
  833. {
  834. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  835. }
  836. # func_execute_cmds commands fail_cmd
  837. # Execute tilde-delimited COMMANDS.
  838. # If FAIL_CMD is given, eval that upon failure.
  839. # FAIL_CMD may read-access the current command in variable CMD!
  840. func_execute_cmds ()
  841. {
  842. $opt_debug
  843. save_ifs=$IFS; IFS='~'
  844. for cmd in $1; do
  845. IFS=$save_ifs
  846. eval cmd=\"$cmd\"
  847. func_show_eval "$cmd" "${2-:}"
  848. done
  849. IFS=$save_ifs
  850. }
  851. # func_source file
  852. # Source FILE, adding directory component if necessary.
  853. # Note that it is not necessary on cygwin/mingw to append a dot to
  854. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  855. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  856. # `FILE.' does not work on cygwin managed mounts.
  857. func_source ()
  858. {
  859. $opt_debug
  860. case $1 in
  861. */* | *\\*) . "$1" ;;
  862. *) . "./$1" ;;
  863. esac
  864. }
  865. # func_infer_tag arg
  866. # Infer tagged configuration to use if any are available and
  867. # if one wasn't chosen via the "--tag" command line option.
  868. # Only attempt this if the compiler in the base compile
  869. # command doesn't match the default compiler.
  870. # arg is usually of the form 'gcc ...'
  871. func_infer_tag ()
  872. {
  873. $opt_debug
  874. if test -n "$available_tags" && test -z "$tagname"; then
  875. CC_quoted=
  876. for arg in $CC; do
  877. func_quote_for_eval "$arg"
  878. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  879. done
  880. case $@ in
  881. # Blanks in the command may have been stripped by the calling shell,
  882. # but not from the CC environment variable when configure was run.
  883. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
  884. # Blanks at the start of $base_compile will cause this to fail
  885. # if we don't check for them as well.
  886. *)
  887. for z in $available_tags; do
  888. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  889. # Evaluate the configuration.
  890. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  891. CC_quoted=
  892. for arg in $CC; do
  893. # Double-quote args containing other shell metacharacters.
  894. func_quote_for_eval "$arg"
  895. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  896. done
  897. case "$@ " in
  898. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
  899. # The compiler in the base compile command matches
  900. # the one in the tagged configuration.
  901. # Assume this is the tagged configuration we want.
  902. tagname=$z
  903. break
  904. ;;
  905. esac
  906. fi
  907. done
  908. # If $tagname still isn't set, then no tagged configuration
  909. # was found and let the user know that the "--tag" command
  910. # line option must be used.
  911. if test -z "$tagname"; then
  912. func_echo "unable to infer tagged configuration"
  913. func_fatal_error "specify a tag with \`--tag'"
  914. # else
  915. # func_verbose "using $tagname tagged configuration"
  916. fi
  917. ;;
  918. esac
  919. fi
  920. }
  921. # func_write_libtool_object output_name pic_name nonpic_name
  922. # Create a libtool object file (analogous to a ".la" file),
  923. # but don't create it if we're doing a dry run.
  924. func_write_libtool_object ()
  925. {
  926. write_libobj=${1}
  927. if test "$build_libtool_libs" = yes; then
  928. write_lobj=\'${2}\'
  929. else
  930. write_lobj=none
  931. fi
  932. if test "$build_old_libs" = yes; then
  933. write_oldobj=\'${3}\'
  934. else
  935. write_oldobj=none
  936. fi
  937. $opt_dry_run || {
  938. cat >${write_libobj}T <<EOF
  939. # $write_libobj - a libtool object file
  940. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  941. #
  942. # Please DO NOT delete this file!
  943. # It is necessary for linking the library.
  944. # Name of the PIC object.
  945. pic_object=$write_lobj
  946. # Name of the non-PIC object
  947. non_pic_object=$write_oldobj
  948. EOF
  949. $MV "${write_libobj}T" "${write_libobj}"
  950. }
  951. }
  952. # func_mode_compile arg...
  953. func_mode_compile ()
  954. {
  955. $opt_debug
  956. # Get the compilation command and the source file.
  957. base_compile=
  958. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  959. suppress_opt=yes
  960. suppress_output=
  961. arg_mode=normal
  962. libobj=
  963. later=
  964. pie_flag=
  965. for arg
  966. do
  967. case $arg_mode in
  968. arg )
  969. # do not "continue". Instead, add this to base_compile
  970. lastarg="$arg"
  971. arg_mode=normal
  972. ;;
  973. target )
  974. libobj="$arg"
  975. arg_mode=normal
  976. continue
  977. ;;
  978. normal )
  979. # Accept any command-line options.
  980. case $arg in
  981. -o)
  982. test -n "$libobj" && \
  983. func_fatal_error "you cannot specify \`-o' more than once"
  984. arg_mode=target
  985. continue
  986. ;;
  987. -pie | -fpie | -fPIE)
  988. pie_flag="$pie_flag $arg"
  989. continue
  990. ;;
  991. -shared | -static | -prefer-pic | -prefer-non-pic)
  992. later="$later $arg"
  993. continue
  994. ;;
  995. -no-suppress)
  996. suppress_opt=no
  997. continue
  998. ;;
  999. -Xcompiler)
  1000. arg_mode=arg # the next one goes into the "base_compile" arg list
  1001. continue # The current "srcfile" will either be retained or
  1002. ;; # replaced later. I would guess that would be a bug.
  1003. -Wc,*)
  1004. func_stripname '-Wc,' '' "$arg"
  1005. args=$func_stripname_result
  1006. lastarg=
  1007. save_ifs="$IFS"; IFS=','
  1008. for arg in $args; do
  1009. IFS="$save_ifs"
  1010. func_quote_for_eval "$arg"
  1011. lastarg="$lastarg $func_quote_for_eval_result"
  1012. done
  1013. IFS="$save_ifs"
  1014. func_stripname ' ' '' "$lastarg"
  1015. lastarg=$func_stripname_result
  1016. # Add the arguments to base_compile.
  1017. base_compile="$base_compile $lastarg"
  1018. continue
  1019. ;;
  1020. *)
  1021. # Accept the current argument as the source file.
  1022. # The previous "srcfile" becomes the current argument.
  1023. #
  1024. lastarg="$srcfile"
  1025. srcfile="$arg"
  1026. ;;
  1027. esac # case $arg
  1028. ;;
  1029. esac # case $arg_mode
  1030. # Aesthetically quote the previous argument.
  1031. func_quote_for_eval "$lastarg"
  1032. base_compile="$base_compile $func_quote_for_eval_result"
  1033. done # for arg
  1034. case $arg_mode in
  1035. arg)
  1036. func_fatal_error "you must specify an argument for -Xcompile"
  1037. ;;
  1038. target)
  1039. func_fatal_error "you must specify a target with \`-o'"
  1040. ;;
  1041. *)
  1042. # Get the name of the library object.
  1043. test -z "$libobj" && {
  1044. func_basename "$srcfile"
  1045. libobj="$func_basename_result"
  1046. }
  1047. ;;
  1048. esac
  1049. # Recognize several different file suffixes.
  1050. # If the user specifies -o file.o, it is replaced with file.lo
  1051. case $libobj in
  1052. *.[cCFSifmso] | \
  1053. *.ada | *.adb | *.ads | *.asm | \
  1054. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  1055. *.[fF][09]? | *.for | *.java | *.obj | *.sx)
  1056. func_xform "$libobj"
  1057. libobj=$func_xform_result
  1058. ;;
  1059. esac
  1060. case $libobj in
  1061. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  1062. *)
  1063. func_fatal_error "cannot determine name of library object from \`$libobj'"
  1064. ;;
  1065. esac
  1066. func_infer_tag $base_compile
  1067. for arg in $later; do
  1068. case $arg in
  1069. -shared)
  1070. test "$build_libtool_libs" != yes && \
  1071. func_fatal_configuration "can not build a shared library"
  1072. build_old_libs=no
  1073. continue
  1074. ;;
  1075. -static)
  1076. build_libtool_libs=no
  1077. build_old_libs=yes
  1078. continue
  1079. ;;
  1080. -prefer-pic)
  1081. pic_mode=yes
  1082. continue
  1083. ;;
  1084. -prefer-non-pic)
  1085. pic_mode=no
  1086. continue
  1087. ;;
  1088. esac
  1089. done
  1090. func_quote_for_eval "$libobj"
  1091. test "X$libobj" != "X$func_quote_for_eval_result" \
  1092. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  1093. && func_warning "libobj name \`$libobj' may not contain shell special characters."
  1094. func_dirname_and_basename "$obj" "/" ""
  1095. objname="$func_basename_result"
  1096. xdir="$func_dirname_result"
  1097. lobj=${xdir}$objdir/$objname
  1098. test -z "$base_compile" && \
  1099. func_fatal_help "you must specify a compilation command"
  1100. # Delete any leftover library objects.
  1101. if test "$build_old_libs" = yes; then
  1102. removelist="$obj $lobj $libobj ${libobj}T"
  1103. else
  1104. removelist="$lobj $libobj ${libobj}T"
  1105. fi
  1106. # On Cygwin there's no "real" PIC flag so we must build both object types
  1107. case $host_os in
  1108. cygwin* | mingw* | pw32* | os2* | cegcc*)
  1109. pic_mode=default
  1110. ;;
  1111. esac
  1112. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  1113. # non-PIC code in shared libraries is not supported
  1114. pic_mode=default
  1115. fi
  1116. # Calculate the filename of the output object if compiler does
  1117. # not support -o with -c
  1118. if test "$compiler_c_o" = no; then
  1119. output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  1120. lockfile="$output_obj.lock"
  1121. else
  1122. output_obj=
  1123. need_locks=no
  1124. lockfile=
  1125. fi
  1126. # Lock this critical section if it is needed
  1127. # We use this script file to make the link, it avoids creating a new file
  1128. if test "$need_locks" = yes; then
  1129. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  1130. func_echo "Waiting for $lockfile to be removed"
  1131. sleep 2
  1132. done
  1133. elif test "$need_locks" = warn; then
  1134. if test -f "$lockfile"; then
  1135. $ECHO "\
  1136. *** ERROR, $lockfile exists and contains:
  1137. `cat $lockfile 2>/dev/null`
  1138. This indicates that another process is trying to use the same
  1139. temporary object file, and libtool could not work around it because
  1140. your compiler does not support \`-c' and \`-o' together. If you
  1141. repeat this compilation, it may succeed, by chance, but you had better
  1142. avoid parallel builds (make -j) in this platform, or get a better
  1143. compiler."
  1144. $opt_dry_run || $RM $removelist
  1145. exit $EXIT_FAILURE
  1146. fi
  1147. removelist="$removelist $output_obj"
  1148. $ECHO "$srcfile" > "$lockfile"
  1149. fi
  1150. $opt_dry_run || $RM $removelist
  1151. removelist="$removelist $lockfile"
  1152. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  1153. if test -n "$fix_srcfile_path"; then
  1154. eval srcfile=\"$fix_srcfile_path\"
  1155. fi
  1156. func_quote_for_eval "$srcfile"
  1157. qsrcfile=$func_quote_for_eval_result
  1158. # Only build a PIC object if we are building libtool libraries.
  1159. if test "$build_libtool_libs" = yes; then
  1160. # Without this assignment, base_compile gets emptied.
  1161. fbsd_hideous_sh_bug=$base_compile
  1162. if test "$pic_mode" != no; then
  1163. command="$base_compile $qsrcfile $pic_flag"
  1164. else
  1165. # Don't build PIC code
  1166. command="$base_compile $qsrcfile"
  1167. fi
  1168. func_mkdir_p "$xdir$objdir"
  1169. if test -z "$output_obj"; then
  1170. # Place PIC objects in $objdir
  1171. command="$command -o $lobj"
  1172. fi
  1173. func_show_eval_locale "$command" \
  1174. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  1175. if test "$need_locks" = warn &&
  1176. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1177. $ECHO "\
  1178. *** ERROR, $lockfile contains:
  1179. `cat $lockfile 2>/dev/null`
  1180. but it should contain:
  1181. $srcfile
  1182. This indicates that another process is trying to use the same
  1183. temporary object file, and libtool could not work around it because
  1184. your compiler does not support \`-c' and \`-o' together. If you
  1185. repeat this compilation, it may succeed, by chance, but you had better
  1186. avoid parallel builds (make -j) in this platform, or get a better
  1187. compiler."
  1188. $opt_dry_run || $RM $removelist
  1189. exit $EXIT_FAILURE
  1190. fi
  1191. # Just move the object if needed, then go on to compile the next one
  1192. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  1193. func_show_eval '$MV "$output_obj" "$lobj"' \
  1194. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1195. fi
  1196. # Allow error messages only from the first compilation.
  1197. if test "$suppress_opt" = yes; then
  1198. suppress_output=' >/dev/null 2>&1'
  1199. fi
  1200. fi
  1201. # Only build a position-dependent object if we build old libraries.
  1202. if test "$build_old_libs" = yes; then
  1203. if test "$pic_mode" != yes; then
  1204. # Don't build PIC code
  1205. command="$base_compile $qsrcfile$pie_flag"
  1206. else
  1207. command="$base_compile $qsrcfile $pic_flag"
  1208. fi
  1209. if test "$compiler_c_o" = yes; then
  1210. command="$command -o $obj"
  1211. fi
  1212. # Suppress compiler output if we already did a PIC compilation.
  1213. command="$command$suppress_output"
  1214. func_show_eval_locale "$command" \
  1215. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  1216. if test "$need_locks" = warn &&
  1217. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1218. $ECHO "\
  1219. *** ERROR, $lockfile contains:
  1220. `cat $lockfile 2>/dev/null`
  1221. but it should contain:
  1222. $srcfile
  1223. This indicates that another process is trying to use the same
  1224. temporary object file, and libtool could not work around it because
  1225. your compiler does not support \`-c' and \`-o' together. If you
  1226. repeat this compilation, it may succeed, by chance, but you had better
  1227. avoid parallel builds (make -j) in this platform, or get a better
  1228. compiler."
  1229. $opt_dry_run || $RM $removelist
  1230. exit $EXIT_FAILURE
  1231. fi
  1232. # Just move the object if needed
  1233. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  1234. func_show_eval '$MV "$output_obj" "$obj"' \
  1235. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1236. fi
  1237. fi
  1238. $opt_dry_run || {
  1239. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  1240. # Unlock the critical section if it was locked
  1241. if test "$need_locks" != no; then
  1242. removelist=$lockfile
  1243. $RM "$lockfile"
  1244. fi
  1245. }
  1246. exit $EXIT_SUCCESS
  1247. }
  1248. $opt_help || {
  1249. test "$mode" = compile && func_mode_compile ${1+"$@"}
  1250. }
  1251. func_mode_help ()
  1252. {
  1253. # We need to display help for each of the modes.
  1254. case $mode in
  1255. "")
  1256. # Generic help is extracted from the usage comments
  1257. # at the start of this file.
  1258. func_help
  1259. ;;
  1260. clean)
  1261. $ECHO \
  1262. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1263. Remove files from the build directory.
  1264. RM is the name of the program to use to delete files associated with each FILE
  1265. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1266. to RM.
  1267. If FILE is a libtool library, object or program, all the files associated
  1268. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1269. ;;
  1270. compile)
  1271. $ECHO \
  1272. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1273. Compile a source file into a libtool library object.
  1274. This mode accepts the following additional options:
  1275. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  1276. -no-suppress do not suppress compiler output for multiple passes
  1277. -prefer-pic try to building PIC objects only
  1278. -prefer-non-pic try to building non-PIC objects only
  1279. -shared do not build a \`.o' file suitable for static linking
  1280. -static only build a \`.o' file suitable for static linking
  1281. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1282. from the given SOURCEFILE.
  1283. The output file name is determined by removing the directory component from
  1284. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  1285. library object suffix, \`.lo'."
  1286. ;;
  1287. execute)
  1288. $ECHO \
  1289. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  1290. Automatically set library path, then run a program.
  1291. This mode accepts the following additional options:
  1292. -dlopen FILE add the directory containing FILE to the library path
  1293. This mode sets the library path environment variable according to \`-dlopen'
  1294. flags.
  1295. If any of the ARGS are libtool executable wrappers, then they are translated
  1296. into their corresponding uninstalled binary, and any of their required library
  1297. directories are added to the library path.
  1298. Then, COMMAND is executed, with ARGS as arguments."
  1299. ;;
  1300. finish)
  1301. $ECHO \
  1302. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  1303. Complete the installation of libtool libraries.
  1304. Each LIBDIR is a directory that contains libtool libraries.
  1305. The commands that this mode executes may require superuser privileges. Use
  1306. the \`--dry-run' option if you just want to see what would be executed."
  1307. ;;
  1308. install)
  1309. $ECHO \
  1310. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  1311. Install executables or libraries.
  1312. INSTALL-COMMAND is the installation command. The first component should be
  1313. either the \`install' or \`cp' program.
  1314. The following components of INSTALL-COMMAND are treated specially:
  1315. -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  1316. The rest of the components are interpreted as arguments to that command (only
  1317. BSD-compatible install options are recognized)."
  1318. ;;
  1319. link)
  1320. $ECHO \
  1321. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  1322. Link object files or libraries together to form another library, or to
  1323. create an executable program.
  1324. LINK-COMMAND is a command using the C compiler that you would use to create
  1325. a program from several object files.
  1326. The following components of LINK-COMMAND are treated specially:
  1327. -all-static do not do any dynamic linking at all
  1328. -avoid-version do not add a version suffix if possible
  1329. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  1330. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  1331. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  1332. -export-symbols SYMFILE
  1333. try to export only the symbols listed in SYMFILE
  1334. -export-symbols-regex REGEX
  1335. try to export only the symbols matching REGEX
  1336. -LLIBDIR search LIBDIR for required installed libraries
  1337. -lNAME OUTPUT-FILE requires the installed library libNAME
  1338. -module build a library that can dlopened
  1339. -no-fast-install disable the fast-install mode
  1340. -no-install link a not-installable executable
  1341. -no-undefined declare that a library does not refer to external symbols
  1342. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  1343. -objectlist FILE Use a list of object files found in FILE to specify objects
  1344. -precious-files-regex REGEX
  1345. don't remove output files matching REGEX
  1346. -release RELEASE specify package release information
  1347. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  1348. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  1349. -shared only do dynamic linking of libtool libraries
  1350. -shrext SUFFIX override the standard shared library file extension
  1351. -static do not do any dynamic linking of uninstalled libtool libraries
  1352. -static-libtool-libs
  1353. do not do any dynamic linking of libtool libraries
  1354. -version-info CURRENT[:REVISION[:AGE]]
  1355. specify library version info [each variable defaults to 0]
  1356. -weak LIBNAME declare that the target provides the LIBNAME interface
  1357. All other options (arguments beginning with \`-') are ignored.
  1358. Every other argument is treated as a filename. Files ending in \`.la' are
  1359. treated as uninstalled libtool libraries, other files are standard or library
  1360. object files.
  1361. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  1362. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  1363. required, except when creating a convenience library.
  1364. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  1365. using \`ar' and \`ranlib', or on Windows using \`lib'.
  1366. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  1367. is created, otherwise an executable program is created."
  1368. ;;
  1369. uninstall)
  1370. $ECHO \
  1371. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  1372. Remove libraries from an installation directory.
  1373. RM is the name of the program to use to delete files associated with each FILE
  1374. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1375. to RM.
  1376. If FILE is a libtool library, all the files associated with it are deleted.
  1377. Otherwise, only FILE itself is deleted using RM."
  1378. ;;
  1379. *)
  1380. func_fatal_help "invalid operation mode \`$mode'"
  1381. ;;
  1382. esac
  1383. $ECHO
  1384. $ECHO "Try \`$progname --help' for more information about other modes."
  1385. exit $?
  1386. }
  1387. # Now that we've collected a possible --mode arg, show help if necessary
  1388. $opt_help && func_mode_help
  1389. # func_mode_execute arg...
  1390. func_mode_execute ()
  1391. {
  1392. $opt_debug
  1393. # The first argument is the command name.
  1394. cmd="$nonopt"
  1395. test -z "$cmd" && \
  1396. func_fatal_help "you must specify a COMMAND"
  1397. # Handle -dlopen flags immediately.
  1398. for file in $execute_dlfiles; do
  1399. test -f "$file" \
  1400. || func_fatal_help "\`$file' is not a file"
  1401. dir=
  1402. case $file in
  1403. *.la)
  1404. # Check to see that this really is a libtool archive.
  1405. func_lalib_unsafe_p "$file" \
  1406. || func_fatal_help "\`$lib' is not a valid libtool archive"
  1407. # Read the libtool library.
  1408. dlname=
  1409. library_names=
  1410. func_source "$file"
  1411. # Skip this library if it cannot be dlopened.
  1412. if test -z "$dlname"; then
  1413. # Warn if it was a shared library.
  1414. test -n "$library_names" && \
  1415. func_warning "\`$file' was not linked with \`-export-dynamic'"
  1416. continue
  1417. fi
  1418. func_dirname "$file" "" "."
  1419. dir="$func_dirname_result"
  1420. if test -f "$dir/$objdir/$dlname"; then
  1421. dir="$dir/$objdir"
  1422. else
  1423. if test ! -f "$dir/$dlname"; then
  1424. func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
  1425. fi
  1426. fi
  1427. ;;
  1428. *.lo)
  1429. # Just add the directory containing the .lo file.
  1430. func_dirname "$file" "" "."
  1431. dir="$func_dirname_result"
  1432. ;;
  1433. *)
  1434. func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
  1435. continue
  1436. ;;
  1437. esac
  1438. # Get the absolute pathname.
  1439. absdir=`cd "$dir" && pwd`
  1440. test -n "$absdir" && dir="$absdir"
  1441. # Now add the directory to shlibpath_var.
  1442. if eval "test -z \"\$$shlibpath_var\""; then
  1443. eval "$shlibpath_var=\"\$dir\""
  1444. else
  1445. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  1446. fi
  1447. done
  1448. # This variable tells wrapper scripts just to set shlibpath_var
  1449. # rather than running their programs.
  1450. libtool_execute_magic="$magic"
  1451. # Check if any of the arguments is a wrapper script.
  1452. args=
  1453. for file
  1454. do
  1455. case $file in
  1456. -*) ;;
  1457. *)
  1458. # Do a test to see if this is really a libtool program.
  1459. if func_ltwrapper_script_p "$file"; then
  1460. func_source "$file"
  1461. # Transform arg to wrapped name.
  1462. file="$progdir/$program"
  1463. elif func_ltwrapper_executable_p "$file"; then
  1464. func_ltwrapper_scriptname "$file"
  1465. func_source "$func_ltwrapper_scriptname_result"
  1466. # Transform arg to wrapped name.
  1467. file="$progdir/$program"
  1468. fi
  1469. ;;
  1470. esac
  1471. # Quote arg

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