PageRenderTime 51ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/ltmain.sh

#
Shell | 2306 lines | 1757 code | 226 blank | 323 comment | 180 complexity | 0cfa0edd599b3ec14976d6306ea2ef18 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0

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.6b
  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.6b Debian-2.2.6b-2ubuntu1
  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.6b Debian-2.2.6b-2ubuntu1"
  72. TIMESTAMP=""
  73. package_revision=1.3017
  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="/bin/grep -E"}
  107. : ${FGREP="/bin/grep -F"}
  108. : ${GREP="/bin/grep"}
  109. : ${LN_S="ln -s"}
  110. : ${MAKE="make"}
  111. : ${MKDIR="mkdir"}
  112. : ${MV="mv -f"}
  113. : ${RM="rm -f"}
  114. : ${SED="/bin/sed"}
  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. if test "X$1" = X--fallback-echo; then
  492. # used as fallback echo
  493. shift
  494. cat <<EOF
  495. $*
  496. EOF
  497. exit $EXIT_SUCCESS
  498. fi
  499. magic="%%%MAGIC variable%%%"
  500. magic_exe="%%%MAGIC EXE variable%%%"
  501. # Global variables.
  502. # $mode is unset
  503. nonopt=
  504. execute_dlfiles=
  505. preserve_args=
  506. lo2o="s/\\.lo\$/.${objext}/"
  507. o2lo="s/\\.${objext}\$/.lo/"
  508. extracted_archives=
  509. extracted_serial=0
  510. opt_dry_run=false
  511. opt_duplicate_deps=false
  512. opt_silent=false
  513. opt_debug=:
  514. # If this variable is set in any of the actions, the command in it
  515. # will be execed at the end. This prevents here-documents from being
  516. # left over by shells.
  517. exec_cmd=
  518. # func_fatal_configuration arg...
  519. # Echo program name prefixed message to standard error, followed by
  520. # a configuration failure hint, and exit.
  521. func_fatal_configuration ()
  522. {
  523. func_error ${1+"$@"}
  524. func_error "See the $PACKAGE documentation for more information."
  525. func_fatal_error "Fatal configuration error."
  526. }
  527. # func_config
  528. # Display the configuration for all the tags in this script.
  529. func_config ()
  530. {
  531. re_begincf='^# ### BEGIN LIBTOOL'
  532. re_endcf='^# ### END LIBTOOL'
  533. # Default configuration.
  534. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  535. # Now print the configurations for the tags.
  536. for tagname in $taglist; do
  537. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  538. done
  539. exit $?
  540. }
  541. # func_features
  542. # Display the features supported by this script.
  543. func_features ()
  544. {
  545. $ECHO "host: $host"
  546. if test "$build_libtool_libs" = yes; then
  547. $ECHO "enable shared libraries"
  548. else
  549. $ECHO "disable shared libraries"
  550. fi
  551. if test "$build_old_libs" = yes; then
  552. $ECHO "enable static libraries"
  553. else
  554. $ECHO "disable static libraries"
  555. fi
  556. exit $?
  557. }
  558. # func_enable_tag tagname
  559. # Verify that TAGNAME is valid, and either flag an error and exit, or
  560. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  561. # variable here.
  562. func_enable_tag ()
  563. {
  564. # Global variable:
  565. tagname="$1"
  566. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  567. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  568. sed_extractcf="/$re_begincf/,/$re_endcf/p"
  569. # Validate tagname.
  570. case $tagname in
  571. *[!-_A-Za-z0-9,/]*)
  572. func_fatal_error "invalid tag name: $tagname"
  573. ;;
  574. esac
  575. # Don't test for the "default" C tag, as we know it's
  576. # there but not specially marked.
  577. case $tagname in
  578. CC) ;;
  579. *)
  580. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  581. taglist="$taglist $tagname"
  582. # Evaluate the configuration. Be careful to quote the path
  583. # and the sed script, to avoid splitting on whitespace, but
  584. # also don't use non-portable quotes within backquotes within
  585. # quotes we have to do it in 2 steps:
  586. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  587. eval "$extractedcf"
  588. else
  589. func_error "ignoring unknown tag $tagname"
  590. fi
  591. ;;
  592. esac
  593. }
  594. # Parse options once, thoroughly. This comes as soon as possible in
  595. # the script to make things like `libtool --version' happen quickly.
  596. {
  597. # Shorthand for --mode=foo, only valid as the first argument
  598. case $1 in
  599. clean|clea|cle|cl)
  600. shift; set dummy --mode clean ${1+"$@"}; shift
  601. ;;
  602. compile|compil|compi|comp|com|co|c)
  603. shift; set dummy --mode compile ${1+"$@"}; shift
  604. ;;
  605. execute|execut|execu|exec|exe|ex|e)
  606. shift; set dummy --mode execute ${1+"$@"}; shift
  607. ;;
  608. finish|finis|fini|fin|fi|f)
  609. shift; set dummy --mode finish ${1+"$@"}; shift
  610. ;;
  611. install|instal|insta|inst|ins|in|i)
  612. shift; set dummy --mode install ${1+"$@"}; shift
  613. ;;
  614. link|lin|li|l)
  615. shift; set dummy --mode link ${1+"$@"}; shift
  616. ;;
  617. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  618. shift; set dummy --mode uninstall ${1+"$@"}; shift
  619. ;;
  620. esac
  621. # Parse non-mode specific arguments:
  622. while test "$#" -gt 0; do
  623. opt="$1"
  624. shift
  625. case $opt in
  626. --config) func_config ;;
  627. --debug) preserve_args="$preserve_args $opt"
  628. func_echo "enabling shell trace mode"
  629. opt_debug='set -x'
  630. $opt_debug
  631. ;;
  632. -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
  633. execute_dlfiles="$execute_dlfiles $1"
  634. shift
  635. ;;
  636. --dry-run | -n) opt_dry_run=: ;;
  637. --features) func_features ;;
  638. --finish) mode="finish" ;;
  639. --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
  640. case $1 in
  641. # Valid mode arguments:
  642. clean) ;;
  643. compile) ;;
  644. execute) ;;
  645. finish) ;;
  646. install) ;;
  647. link) ;;
  648. relink) ;;
  649. uninstall) ;;
  650. # Catch anything else as an error
  651. *) func_error "invalid argument for $opt"
  652. exit_cmd=exit
  653. break
  654. ;;
  655. esac
  656. mode="$1"
  657. shift
  658. ;;
  659. --preserve-dup-deps)
  660. opt_duplicate_deps=: ;;
  661. --quiet|--silent) preserve_args="$preserve_args $opt"
  662. opt_silent=:
  663. ;;
  664. --verbose| -v) preserve_args="$preserve_args $opt"
  665. opt_silent=false
  666. ;;
  667. --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
  668. preserve_args="$preserve_args $opt $1"
  669. func_enable_tag "$1" # tagname is set here
  670. shift
  671. ;;
  672. # Separate optargs to long options:
  673. -dlopen=*|--mode=*|--tag=*)
  674. func_opt_split "$opt"
  675. set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
  676. shift
  677. ;;
  678. -\?|-h) func_usage ;;
  679. --help) opt_help=: ;;
  680. --version) func_version ;;
  681. -*) func_fatal_help "unrecognized option \`$opt'" ;;
  682. *) nonopt="$opt"
  683. break
  684. ;;
  685. esac
  686. done
  687. case $host in
  688. *cygwin* | *mingw* | *pw32* | *cegcc*)
  689. # don't eliminate duplications in $postdeps and $predeps
  690. opt_duplicate_compiler_generated_deps=:
  691. ;;
  692. *)
  693. opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
  694. ;;
  695. esac
  696. # Having warned about all mis-specified options, bail out if
  697. # anything was wrong.
  698. $exit_cmd $EXIT_FAILURE
  699. }
  700. # func_check_version_match
  701. # Ensure that we are using m4 macros, and libtool script from the same
  702. # release of libtool.
  703. func_check_version_match ()
  704. {
  705. if test "$package_revision" != "$macro_revision"; then
  706. if test "$VERSION" != "$macro_version"; then
  707. if test -z "$macro_version"; then
  708. cat >&2 <<_LT_EOF
  709. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  710. $progname: definition of this LT_INIT comes from an older release.
  711. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  712. $progname: and run autoconf again.
  713. _LT_EOF
  714. else
  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 $PACKAGE $macro_version.
  718. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  719. $progname: and run autoconf again.
  720. _LT_EOF
  721. fi
  722. else
  723. cat >&2 <<_LT_EOF
  724. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  725. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  726. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  727. $progname: of $PACKAGE $VERSION and run autoconf again.
  728. _LT_EOF
  729. fi
  730. exit $EXIT_MISMATCH
  731. fi
  732. }
  733. ## ----------- ##
  734. ## Main. ##
  735. ## ----------- ##
  736. $opt_help || {
  737. # Sanity checks first:
  738. func_check_version_match
  739. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  740. func_fatal_configuration "not configured to build any kind of library"
  741. fi
  742. test -z "$mode" && func_fatal_error "error: you must specify a MODE."
  743. # Darwin sucks
  744. eval std_shrext=\"$shrext_cmds\"
  745. # Only execute mode is allowed to have -dlopen flags.
  746. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  747. func_error "unrecognized option \`-dlopen'"
  748. $ECHO "$help" 1>&2
  749. exit $EXIT_FAILURE
  750. fi
  751. # Change the help message to a mode-specific one.
  752. generic_help="$help"
  753. help="Try \`$progname --help --mode=$mode' for more information."
  754. }
  755. # func_lalib_p file
  756. # True iff FILE is a libtool `.la' library or `.lo' object file.
  757. # This function is only a basic sanity check; it will hardly flush out
  758. # determined imposters.
  759. func_lalib_p ()
  760. {
  761. test -f "$1" &&
  762. $SED -e 4q "$1" 2>/dev/null \
  763. | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  764. }
  765. # func_lalib_unsafe_p file
  766. # True iff FILE is a libtool `.la' library or `.lo' object file.
  767. # This function implements the same check as func_lalib_p without
  768. # resorting to external programs. To this end, it redirects stdin and
  769. # closes it afterwards, without saving the original file descriptor.
  770. # As a safety measure, use it only where a negative result would be
  771. # fatal anyway. Works if `file' does not exist.
  772. func_lalib_unsafe_p ()
  773. {
  774. lalib_p=no
  775. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  776. for lalib_p_l in 1 2 3 4
  777. do
  778. read lalib_p_line
  779. case "$lalib_p_line" in
  780. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  781. esac
  782. done
  783. exec 0<&5 5<&-
  784. fi
  785. test "$lalib_p" = yes
  786. }
  787. # func_ltwrapper_script_p file
  788. # True iff FILE is a libtool wrapper script
  789. # This function is only a basic sanity check; it will hardly flush out
  790. # determined imposters.
  791. func_ltwrapper_script_p ()
  792. {
  793. func_lalib_p "$1"
  794. }
  795. # func_ltwrapper_executable_p file
  796. # True iff FILE is a libtool wrapper executable
  797. # This function is only a basic sanity check; it will hardly flush out
  798. # determined imposters.
  799. func_ltwrapper_executable_p ()
  800. {
  801. func_ltwrapper_exec_suffix=
  802. case $1 in
  803. *.exe) ;;
  804. *) func_ltwrapper_exec_suffix=.exe ;;
  805. esac
  806. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  807. }
  808. # func_ltwrapper_scriptname file
  809. # Assumes file is an ltwrapper_executable
  810. # uses $file to determine the appropriate filename for a
  811. # temporary ltwrapper_script.
  812. func_ltwrapper_scriptname ()
  813. {
  814. func_ltwrapper_scriptname_result=""
  815. if func_ltwrapper_executable_p "$1"; then
  816. func_dirname_and_basename "$1" "" "."
  817. func_stripname '' '.exe' "$func_basename_result"
  818. func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
  819. fi
  820. }
  821. # func_ltwrapper_p file
  822. # True iff FILE is a libtool wrapper script or wrapper executable
  823. # This function is only a basic sanity check; it will hardly flush out
  824. # determined imposters.
  825. func_ltwrapper_p ()
  826. {
  827. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  828. }
  829. # func_execute_cmds commands fail_cmd
  830. # Execute tilde-delimited COMMANDS.
  831. # If FAIL_CMD is given, eval that upon failure.
  832. # FAIL_CMD may read-access the current command in variable CMD!
  833. func_execute_cmds ()
  834. {
  835. $opt_debug
  836. save_ifs=$IFS; IFS='~'
  837. for cmd in $1; do
  838. IFS=$save_ifs
  839. eval cmd=\"$cmd\"
  840. func_show_eval "$cmd" "${2-:}"
  841. done
  842. IFS=$save_ifs
  843. }
  844. # func_source file
  845. # Source FILE, adding directory component if necessary.
  846. # Note that it is not necessary on cygwin/mingw to append a dot to
  847. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  848. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  849. # `FILE.' does not work on cygwin managed mounts.
  850. func_source ()
  851. {
  852. $opt_debug
  853. case $1 in
  854. */* | *\\*) . "$1" ;;
  855. *) . "./$1" ;;
  856. esac
  857. }
  858. # func_infer_tag arg
  859. # Infer tagged configuration to use if any are available and
  860. # if one wasn't chosen via the "--tag" command line option.
  861. # Only attempt this if the compiler in the base compile
  862. # command doesn't match the default compiler.
  863. # arg is usually of the form 'gcc ...'
  864. func_infer_tag ()
  865. {
  866. $opt_debug
  867. if test -n "$available_tags" && test -z "$tagname"; then
  868. CC_quoted=
  869. for arg in $CC; do
  870. func_quote_for_eval "$arg"
  871. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  872. done
  873. case $@ in
  874. # Blanks in the command may have been stripped by the calling shell,
  875. # but not from the CC environment variable when configure was run.
  876. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
  877. # Blanks at the start of $base_compile will cause this to fail
  878. # if we don't check for them as well.
  879. *)
  880. for z in $available_tags; do
  881. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  882. # Evaluate the configuration.
  883. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  884. CC_quoted=
  885. for arg in $CC; do
  886. # Double-quote args containing other shell metacharacters.
  887. func_quote_for_eval "$arg"
  888. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  889. done
  890. case "$@ " in
  891. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
  892. # The compiler in the base compile command matches
  893. # the one in the tagged configuration.
  894. # Assume this is the tagged configuration we want.
  895. tagname=$z
  896. break
  897. ;;
  898. esac
  899. fi
  900. done
  901. # If $tagname still isn't set, then no tagged configuration
  902. # was found and let the user know that the "--tag" command
  903. # line option must be used.
  904. if test -z "$tagname"; then
  905. func_echo "unable to infer tagged configuration"
  906. func_fatal_error "specify a tag with \`--tag'"
  907. # else
  908. # func_verbose "using $tagname tagged configuration"
  909. fi
  910. ;;
  911. esac
  912. fi
  913. }
  914. # func_write_libtool_object output_name pic_name nonpic_name
  915. # Create a libtool object file (analogous to a ".la" file),
  916. # but don't create it if we're doing a dry run.
  917. func_write_libtool_object ()
  918. {
  919. write_libobj=${1}
  920. if test "$build_libtool_libs" = yes; then
  921. write_lobj=\'${2}\'
  922. else
  923. write_lobj=none
  924. fi
  925. if test "$build_old_libs" = yes; then
  926. write_oldobj=\'${3}\'
  927. else
  928. write_oldobj=none
  929. fi
  930. $opt_dry_run || {
  931. cat >${write_libobj}T <<EOF
  932. # $write_libobj - a libtool object file
  933. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  934. #
  935. # Please DO NOT delete this file!
  936. # It is necessary for linking the library.
  937. # Name of the PIC object.
  938. pic_object=$write_lobj
  939. # Name of the non-PIC object
  940. non_pic_object=$write_oldobj
  941. EOF
  942. $MV "${write_libobj}T" "${write_libobj}"
  943. }
  944. }
  945. # func_mode_compile arg...
  946. func_mode_compile ()
  947. {
  948. $opt_debug
  949. # Get the compilation command and the source file.
  950. base_compile=
  951. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  952. suppress_opt=yes
  953. suppress_output=
  954. arg_mode=normal
  955. libobj=
  956. later=
  957. pie_flag=
  958. for arg
  959. do
  960. case $arg_mode in
  961. arg )
  962. # do not "continue". Instead, add this to base_compile
  963. lastarg="$arg"
  964. arg_mode=normal
  965. ;;
  966. target )
  967. libobj="$arg"
  968. arg_mode=normal
  969. continue
  970. ;;
  971. normal )
  972. # Accept any command-line options.
  973. case $arg in
  974. -o)
  975. test -n "$libobj" && \
  976. func_fatal_error "you cannot specify \`-o' more than once"
  977. arg_mode=target
  978. continue
  979. ;;
  980. -pie | -fpie | -fPIE)
  981. pie_flag="$pie_flag $arg"
  982. continue
  983. ;;
  984. -shared | -static | -prefer-pic | -prefer-non-pic)
  985. later="$later $arg"
  986. continue
  987. ;;
  988. -no-suppress)
  989. suppress_opt=no
  990. continue
  991. ;;
  992. -Xcompiler)
  993. arg_mode=arg # the next one goes into the "base_compile" arg list
  994. continue # The current "srcfile" will either be retained or
  995. ;; # replaced later. I would guess that would be a bug.
  996. -Wc,*)
  997. func_stripname '-Wc,' '' "$arg"
  998. args=$func_stripname_result
  999. lastarg=
  1000. save_ifs="$IFS"; IFS=','
  1001. for arg in $args; do
  1002. IFS="$save_ifs"
  1003. func_quote_for_eval "$arg"
  1004. lastarg="$lastarg $func_quote_for_eval_result"
  1005. done
  1006. IFS="$save_ifs"
  1007. func_stripname ' ' '' "$lastarg"
  1008. lastarg=$func_stripname_result
  1009. # Add the arguments to base_compile.
  1010. base_compile="$base_compile $lastarg"
  1011. continue
  1012. ;;
  1013. *)
  1014. # Accept the current argument as the source file.
  1015. # The previous "srcfile" becomes the current argument.
  1016. #
  1017. lastarg="$srcfile"
  1018. srcfile="$arg"
  1019. ;;
  1020. esac # case $arg
  1021. ;;
  1022. esac # case $arg_mode
  1023. # Aesthetically quote the previous argument.
  1024. func_quote_for_eval "$lastarg"
  1025. base_compile="$base_compile $func_quote_for_eval_result"
  1026. done # for arg
  1027. case $arg_mode in
  1028. arg)
  1029. func_fatal_error "you must specify an argument for -Xcompile"
  1030. ;;
  1031. target)
  1032. func_fatal_error "you must specify a target with \`-o'"
  1033. ;;
  1034. *)
  1035. # Get the name of the library object.
  1036. test -z "$libobj" && {
  1037. func_basename "$srcfile"
  1038. libobj="$func_basename_result"
  1039. }
  1040. ;;
  1041. esac
  1042. # Recognize several different file suffixes.
  1043. # If the user specifies -o file.o, it is replaced with file.lo
  1044. case $libobj in
  1045. *.[cCFSifmso] | \
  1046. *.ada | *.adb | *.ads | *.asm | \
  1047. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  1048. *.[fF][09]? | *.for | *.java | *.obj | *.sx)
  1049. func_xform "$libobj"
  1050. libobj=$func_xform_result
  1051. ;;
  1052. esac
  1053. case $libobj in
  1054. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  1055. *)
  1056. func_fatal_error "cannot determine name of library object from \`$libobj'"
  1057. ;;
  1058. esac
  1059. func_infer_tag $base_compile
  1060. for arg in $later; do
  1061. case $arg in
  1062. -shared)
  1063. test "$build_libtool_libs" != yes && \
  1064. func_fatal_configuration "can not build a shared library"
  1065. build_old_libs=no
  1066. continue
  1067. ;;
  1068. -static)
  1069. build_libtool_libs=no
  1070. build_old_libs=yes
  1071. continue
  1072. ;;
  1073. -prefer-pic)
  1074. pic_mode=yes
  1075. continue
  1076. ;;
  1077. -prefer-non-pic)
  1078. pic_mode=no
  1079. continue
  1080. ;;
  1081. esac
  1082. done
  1083. func_quote_for_eval "$libobj"
  1084. test "X$libobj" != "X$func_quote_for_eval_result" \
  1085. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  1086. && func_warning "libobj name \`$libobj' may not contain shell special characters."
  1087. func_dirname_and_basename "$obj" "/" ""
  1088. objname="$func_basename_result"
  1089. xdir="$func_dirname_result"
  1090. lobj=${xdir}$objdir/$objname
  1091. test -z "$base_compile" && \
  1092. func_fatal_help "you must specify a compilation command"
  1093. # Delete any leftover library objects.
  1094. if test "$build_old_libs" = yes; then
  1095. removelist="$obj $lobj $libobj ${libobj}T"
  1096. else
  1097. removelist="$lobj $libobj ${libobj}T"
  1098. fi
  1099. # On Cygwin there's no "real" PIC flag so we must build both object types
  1100. case $host_os in
  1101. cygwin* | mingw* | pw32* | os2* | cegcc*)
  1102. pic_mode=default
  1103. ;;
  1104. esac
  1105. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  1106. # non-PIC code in shared libraries is not supported
  1107. pic_mode=default
  1108. fi
  1109. # Calculate the filename of the output object if compiler does
  1110. # not support -o with -c
  1111. if test "$compiler_c_o" = no; then
  1112. output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  1113. lockfile="$output_obj.lock"
  1114. else
  1115. output_obj=
  1116. need_locks=no
  1117. lockfile=
  1118. fi
  1119. # Lock this critical section if it is needed
  1120. # We use this script file to make the link, it avoids creating a new file
  1121. if test "$need_locks" = yes; then
  1122. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  1123. func_echo "Waiting for $lockfile to be removed"
  1124. sleep 2
  1125. done
  1126. elif test "$need_locks" = warn; then
  1127. if test -f "$lockfile"; then
  1128. $ECHO "\
  1129. *** ERROR, $lockfile exists and contains:
  1130. `cat $lockfile 2>/dev/null`
  1131. This indicates that another process is trying to use the same
  1132. temporary object file, and libtool could not work around it because
  1133. your compiler does not support \`-c' and \`-o' together. If you
  1134. repeat this compilation, it may succeed, by chance, but you had better
  1135. avoid parallel builds (make -j) in this platform, or get a better
  1136. compiler."
  1137. $opt_dry_run || $RM $removelist
  1138. exit $EXIT_FAILURE
  1139. fi
  1140. removelist="$removelist $output_obj"
  1141. $ECHO "$srcfile" > "$lockfile"
  1142. fi
  1143. $opt_dry_run || $RM $removelist
  1144. removelist="$removelist $lockfile"
  1145. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  1146. if test -n "$fix_srcfile_path"; then
  1147. eval srcfile=\"$fix_srcfile_path\"
  1148. fi
  1149. func_quote_for_eval "$srcfile"
  1150. qsrcfile=$func_quote_for_eval_result
  1151. # Only build a PIC object if we are building libtool libraries.
  1152. if test "$build_libtool_libs" = yes; then
  1153. # Without this assignment, base_compile gets emptied.
  1154. fbsd_hideous_sh_bug=$base_compile
  1155. if test "$pic_mode" != no; then
  1156. command="$base_compile $qsrcfile $pic_flag"
  1157. else
  1158. # Don't build PIC code
  1159. command="$base_compile $qsrcfile"
  1160. fi
  1161. func_mkdir_p "$xdir$objdir"
  1162. if test -z "$output_obj"; then
  1163. # Place PIC objects in $objdir
  1164. command="$command -o $lobj"
  1165. fi
  1166. func_show_eval_locale "$command" \
  1167. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  1168. if test "$need_locks" = warn &&
  1169. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1170. $ECHO "\
  1171. *** ERROR, $lockfile contains:
  1172. `cat $lockfile 2>/dev/null`
  1173. but it should contain:
  1174. $srcfile
  1175. This indicates that another process is trying to use the same
  1176. temporary object file, and libtool could not work around it because
  1177. your compiler does not support \`-c' and \`-o' together. If you
  1178. repeat this compilation, it may succeed, by chance, but you had better
  1179. avoid parallel builds (make -j) in this platform, or get a better
  1180. compiler."
  1181. $opt_dry_run || $RM $removelist
  1182. exit $EXIT_FAILURE
  1183. fi
  1184. # Just move the object if needed, then go on to compile the next one
  1185. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  1186. func_show_eval '$MV "$output_obj" "$lobj"' \
  1187. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1188. fi
  1189. # Allow error messages only from the first compilation.
  1190. if test "$suppress_opt" = yes; then
  1191. suppress_output=' >/dev/null 2>&1'
  1192. fi
  1193. fi
  1194. # Only build a position-dependent object if we build old libraries.
  1195. if test "$build_old_libs" = yes; then
  1196. if test "$pic_mode" != yes; then
  1197. # Don't build PIC code
  1198. command="$base_compile $qsrcfile$pie_flag"
  1199. else
  1200. command="$base_compile $qsrcfile $pic_flag"
  1201. fi
  1202. if test "$compiler_c_o" = yes; then
  1203. command="$command -o $obj"
  1204. fi
  1205. # Suppress compiler output if we already did a PIC compilation.
  1206. command="$command$suppress_output"
  1207. func_show_eval_locale "$command" \
  1208. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  1209. if test "$need_locks" = warn &&
  1210. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1211. $ECHO "\
  1212. *** ERROR, $lockfile contains:
  1213. `cat $lockfile 2>/dev/null`
  1214. but it should contain:
  1215. $srcfile
  1216. This indicates that another process is trying to use the same
  1217. temporary object file, and libtool could not work around it because
  1218. your compiler does not support \`-c' and \`-o' together. If you
  1219. repeat this compilation, it may succeed, by chance, but you had better
  1220. avoid parallel builds (make -j) in this platform, or get a better
  1221. compiler."
  1222. $opt_dry_run || $RM $removelist
  1223. exit $EXIT_FAILURE
  1224. fi
  1225. # Just move the object if needed
  1226. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  1227. func_show_eval '$MV "$output_obj" "$obj"' \
  1228. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1229. fi
  1230. fi
  1231. $opt_dry_run || {
  1232. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  1233. # Unlock the critical section if it was locked
  1234. if test "$need_locks" != no; then
  1235. removelist=$lockfile
  1236. $RM "$lockfile"
  1237. fi
  1238. }
  1239. exit $EXIT_SUCCESS
  1240. }
  1241. $opt_help || {
  1242. test "$mode" = compile && func_mode_compile ${1+"$@"}
  1243. }
  1244. func_mode_help ()
  1245. {
  1246. # We need to display help for each of the modes.
  1247. case $mode in
  1248. "")
  1249. # Generic help is extracted from the usage comments
  1250. # at the start of this file.
  1251. func_help
  1252. ;;
  1253. clean)
  1254. $ECHO \
  1255. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1256. Remove files from the build directory.
  1257. RM is the name of the program to use to delete files associated with each FILE
  1258. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1259. to RM.
  1260. If FILE is a libtool library, object or program, all the files associated
  1261. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1262. ;;
  1263. compile)
  1264. $ECHO \
  1265. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1266. Compile a source file into a libtool library object.
  1267. This mode accepts the following additional options:
  1268. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  1269. -no-suppress do not suppress compiler output for multiple passes
  1270. -prefer-pic try to building PIC objects only
  1271. -prefer-non-pic try to building non-PIC objects only
  1272. -shared do not build a \`.o' file suitable for static linking
  1273. -static only build a \`.o' file suitable for static linking
  1274. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1275. from the given SOURCEFILE.
  1276. The output file name is determined by removing the directory component from
  1277. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  1278. library object suffix, \`.lo'."
  1279. ;;
  1280. execute)
  1281. $ECHO \
  1282. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  1283. Automatically set library path, then run a program.
  1284. This mode accepts the following additional options:
  1285. -dlopen FILE add the directory containing FILE to the library path
  1286. This mode sets the library path environment variable according to \`-dlopen'
  1287. flags.
  1288. If any of the ARGS are libtool executable wrappers, then they are translated
  1289. into their corresponding uninstalled binary, and any of their required library
  1290. directories are added to the library path.
  1291. Then, COMMAND is executed, with ARGS as arguments."
  1292. ;;
  1293. finish)
  1294. $ECHO \
  1295. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  1296. Complete the installation of libtool libraries.
  1297. Each LIBDIR is a directory that contains libtool libraries.
  1298. The commands that this mode executes may require superuser privileges. Use
  1299. the \`--dry-run' option if you just want to see what would be executed."
  1300. ;;
  1301. install)
  1302. $ECHO \
  1303. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  1304. Install executables or libraries.
  1305. INSTALL-COMMAND is the installation command. The first component should be
  1306. either the \`install' or \`cp' program.
  1307. The following components of INSTALL-COMMAND are treated specially:
  1308. -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  1309. The rest of the components are interpreted as arguments to that command (only
  1310. BSD-compatible install options are recognized)."
  1311. ;;
  1312. link)
  1313. $ECHO \
  1314. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  1315. Link object files or libraries together to form another library, or to
  1316. create an executable program.
  1317. LINK-COMMAND is a command using the C compiler that you would use to create
  1318. a program from several object files.
  1319. The following components of LINK-COMMAND are treated specially:
  1320. -all-static do not do any dynamic linking at all
  1321. -avoid-version do not add a version suffix if possible
  1322. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  1323. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  1324. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  1325. -export-symbols SYMFILE
  1326. try to export only the symbols listed in SYMFILE
  1327. -export-symbols-regex REGEX
  1328. try to export only the symbols matching REGEX
  1329. -LLIBDIR search LIBDIR for required installed libraries
  1330. -lNAME OUTPUT-FILE requires the installed library libNAME
  1331. -module build a library that can dlopened
  1332. -no-fast-install disable the fast-install mode
  1333. -no-install link a not-installable executable
  1334. -no-undefined declare that a library does not refer to external symbols
  1335. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  1336. -objectlist FILE Use a list of object files found in FILE to specify objects
  1337. -precious-files-regex REGEX
  1338. don't remove output files matching REGEX
  1339. -release RELEASE specify package release information
  1340. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  1341. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  1342. -shared only do dynamic linking of libtool libraries
  1343. -shrext SUFFIX override the standard shared library file extension
  1344. -static do not do any dynamic linking of uninstalled libtool libraries
  1345. -static-libtool-libs
  1346. do not do any dynamic linking of libtool libraries
  1347. -version-info CURRENT[:REVISION[:AGE]]
  1348. specify library version info [each variable defaults to 0]
  1349. -weak LIBNAME declare that the target provides the LIBNAME interface
  1350. All other options (arguments beginning with \`-') are ignored.
  1351. Every other argument is treated as a filename. Files ending in \`.la' are
  1352. treated as uninstalled libtool libraries, other files are standard or library
  1353. object files.
  1354. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  1355. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  1356. required, except when creating a convenience library.
  1357. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  1358. using \`ar' and \`ranlib', or on Windows using \`lib'.
  1359. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  1360. is created, otherwise an executable program is created."
  1361. ;;
  1362. uninstall)
  1363. $ECHO \
  1364. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  1365. Remove libraries from an installation directory.
  1366. RM is the name of the program to use to delete files associated with each FILE
  1367. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1368. to RM.
  1369. If FILE is a libtool library, all the files associated with it are deleted.
  1370. Otherwise, only FILE itself is deleted using RM."
  1371. ;;
  1372. *)
  1373. func_fatal_help "invalid operation mode \`$mode'"
  1374. ;;
  1375. esac
  1376. $ECHO
  1377. $ECHO "Try \`$progname --help' for more information about other modes."
  1378. exit $?
  1379. }
  1380. # Now that we've collected a possible --mode arg, show help if necessary
  1381. $opt_help && func_mode_help
  1382. # func_mode_execute arg...
  1383. func_mode_execute ()
  1384. {
  1385. $opt_debug
  1386. # The first argument is the command name.
  1387. cmd="$nonopt"
  1388. test -z "$cmd" && \
  1389. func_fatal_help "you must specify a COMMAND"
  1390. # Handle -dlopen flags immediately.
  1391. for file in $execute_dlfiles; do
  1392. test -f "$file" \
  1393. || func_fatal_help "\`$file' is not a file"
  1394. dir=
  1395. case $file in
  1396. *.la)
  1397. # Check to see that this really is a libtool archive.
  1398. func_lalib_unsafe_p "$file" \
  1399. || func_fatal_help "\`$lib' is not a valid libtool archive"
  1400. # Read the libtool library.
  1401. dlname=
  1402. library_names=
  1403. func_source "$file"
  1404. # Skip this library if it cannot be dlopened.
  1405. if test -z "$dlname"; then
  1406. # Warn if it was a shared library.
  1407. test -n "$library_names" && \
  1408. func_warning "\`$file' was not linked with \`-export-dynamic'"
  1409. continue
  1410. fi
  1411. func_dirname "$file" "" "."
  1412. dir="$func_dirname_result"
  1413. if test -f "$dir/$objdir/$dlname"; then
  1414. dir="$dir/$objdir"
  1415. else
  1416. if test ! -f "$dir/$dlname"; then
  1417. func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
  1418. fi
  1419. fi
  1420. ;;
  1421. *.lo)
  1422. # Just add the directory containing the .lo file.
  1423. func_dirname "$file" "" "."
  1424. dir="$func_dirname_result"
  1425. ;;
  1426. *)
  1427. func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
  1428. continue
  1429. ;;
  1430. esac
  1431. # Get the absolute pathname.
  1432. absdir=`cd "$dir" && pwd`
  1433. test -n "$absdir" && dir="$absdir"
  1434. # Now add the directory to shlibpath_var.
  1435. if eval "test -z \"\$$shlibpath_var\""; then
  1436. eval "$shlibpath_var=\"\$dir\""
  1437. else
  1438. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  1439. fi
  1440. done
  1441. # This variable tells wrapper scripts just to set shlibpath_var
  1442. # rather than running their programs.
  1443. libtool_execute_magic="$magic"
  1444. # Check if any of the arguments is a wrapper script.
  1445. args=
  1446. for file
  1447. do
  1448. case $file in
  1449. -*) ;;
  1450. *)
  1451. # Do a test to see if this is really a libtool program.
  1452. if func_ltwrapper_script_p "$file"; then
  1453. func_source "$file"
  1454. # Transform arg to wrapped name.
  1455. file="$progdir/$program"
  1456. elif func_ltwrapper_executable_p "$file"; then
  1457. func_ltwrapper_scriptname "$file"
  1458. func_source "$func_ltwrapper_scriptname_result"
  1459. # Transform arg to wrapped name.
  1460. file="$progdir/$program"
  1461. fi
  1462. ;;
  1463. esac
  1464. # Quote arguments (to preserve shell metacharacters).
  1465. func_quote_for_eval "$file"
  1466. args="$args $func_quote_for_eval_result"

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