PageRenderTime 57ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/trunk/src/common/INet/libntlm-0.4.2/build-aux/ltmain.sh

#
Shell | 2281 lines | 1760 code | 216 blank | 305 comment | 168 complexity | a51b53de0952894343228fe3e5a700b7 MD5 | raw file
Possible License(s): LGPL-2.1, Unlicense

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

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