PageRenderTime 88ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 1ms

/contrib/ntp/sntp/ltmain.sh

https://bitbucket.org/freebsd/freebsd-head/
Shell | 6863 lines | 5830 code | 441 blank | 592 comment | 684 complexity | 70cf70a682442a6f827513ae73c18622 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, BSD-3-Clause, LGPL-2.0, LGPL-2.1, BSD-2-Clause, 0BSD, JSON, AGPL-1.0, GPL-2.0
  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun configure.
  3. #
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
  5. # Free Software Foundation, Inc.
  6. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. # General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  21. #
  22. # As a special exception to the GNU General Public License, if you
  23. # distribute this file as part of a program that contains a
  24. # configuration script generated by Autoconf, you may include it under
  25. # the same distribution terms that you use for the rest of that program.
  26. basename="s,^.*/,,g"
  27. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  28. # is ksh but when the shell is invoked as "sh" and the current value of
  29. # the _XPG environment variable is not equal to 1 (one), the special
  30. # positional parameter $0, within a function call, is the name of the
  31. # function.
  32. progpath="$0"
  33. # The name of this program:
  34. progname=`echo "$progpath" | $SED $basename`
  35. modename="$progname"
  36. # Global variables:
  37. EXIT_SUCCESS=0
  38. EXIT_FAILURE=1
  39. PROGRAM=ltmain.sh
  40. PACKAGE=libtool
  41. VERSION=1.5.22
  42. TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
  43. # See if we are running on zsh, and set the options which allow our
  44. # commands through without removal of \ escapes.
  45. if test -n "${ZSH_VERSION+set}" ; then
  46. setopt NO_GLOB_SUBST
  47. fi
  48. # Check that we have a working $echo.
  49. if test "X$1" = X--no-reexec; then
  50. # Discard the --no-reexec flag, and continue.
  51. shift
  52. elif test "X$1" = X--fallback-echo; then
  53. # Avoid inline document here, it may be left over
  54. :
  55. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  56. # Yippee, $echo works!
  57. :
  58. else
  59. # Restart under the correct shell, and then maybe $echo will work.
  60. exec $SHELL "$progpath" --no-reexec ${1+"$@"}
  61. fi
  62. if test "X$1" = X--fallback-echo; then
  63. # used as fallback echo
  64. shift
  65. cat <<EOF
  66. $*
  67. EOF
  68. exit $EXIT_SUCCESS
  69. fi
  70. default_mode=
  71. help="Try \`$progname --help' for more information."
  72. magic="%%%MAGIC variable%%%"
  73. mkdir="mkdir"
  74. mv="mv -f"
  75. rm="rm -f"
  76. # Sed substitution that helps us do robust quoting. It backslashifies
  77. # metacharacters that are still active within double-quoted strings.
  78. Xsed="${SED}"' -e 1s/^X//'
  79. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  80. # test EBCDIC or ASCII
  81. case `echo X|tr X '\101'` in
  82. A) # ASCII based system
  83. # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
  84. SP2NL='tr \040 \012'
  85. NL2SP='tr \015\012 \040\040'
  86. ;;
  87. *) # EBCDIC based system
  88. SP2NL='tr \100 \n'
  89. NL2SP='tr \r\n \100\100'
  90. ;;
  91. esac
  92. # NLS nuisances.
  93. # Only set LANG and LC_ALL to C if already set.
  94. # These must not be set unconditionally because not all systems understand
  95. # e.g. LANG=C (notably SCO).
  96. # We save the old values to restore during execute mode.
  97. if test "${LC_ALL+set}" = set; then
  98. save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  99. fi
  100. if test "${LANG+set}" = set; then
  101. save_LANG="$LANG"; LANG=C; export LANG
  102. fi
  103. # Make sure IFS has a sensible default
  104. lt_nl='
  105. '
  106. IFS=" $lt_nl"
  107. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  108. $echo "$modename: not configured to build any kind of library" 1>&2
  109. $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  110. exit $EXIT_FAILURE
  111. fi
  112. # Global variables.
  113. mode=$default_mode
  114. nonopt=
  115. prev=
  116. prevopt=
  117. run=
  118. show="$echo"
  119. show_help=
  120. execute_dlfiles=
  121. duplicate_deps=no
  122. preserve_args=
  123. lo2o="s/\\.lo\$/.${objext}/"
  124. o2lo="s/\\.${objext}\$/.lo/"
  125. #####################################
  126. # Shell function definitions:
  127. # This seems to be the best place for them
  128. # func_mktempdir [string]
  129. # Make a temporary directory that won't clash with other running
  130. # libtool processes, and avoids race conditions if possible. If
  131. # given, STRING is the basename for that directory.
  132. func_mktempdir ()
  133. {
  134. my_template="${TMPDIR-/tmp}/${1-$progname}"
  135. if test "$run" = ":"; then
  136. # Return a directory name, but don't create it in dry-run mode
  137. my_tmpdir="${my_template}-$$"
  138. else
  139. # If mktemp works, use that first and foremost
  140. my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
  141. if test ! -d "$my_tmpdir"; then
  142. # Failing that, at least try and use $RANDOM to avoid a race
  143. my_tmpdir="${my_template}-${RANDOM-0}$$"
  144. save_mktempdir_umask=`umask`
  145. umask 0077
  146. $mkdir "$my_tmpdir"
  147. umask $save_mktempdir_umask
  148. fi
  149. # If we're not in dry-run mode, bomb out on failure
  150. test -d "$my_tmpdir" || {
  151. $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
  152. exit $EXIT_FAILURE
  153. }
  154. fi
  155. $echo "X$my_tmpdir" | $Xsed
  156. }
  157. # func_win32_libid arg
  158. # return the library type of file 'arg'
  159. #
  160. # Need a lot of goo to handle *both* DLLs and import libs
  161. # Has to be a shell function in order to 'eat' the argument
  162. # that is supplied when $file_magic_command is called.
  163. func_win32_libid ()
  164. {
  165. win32_libid_type="unknown"
  166. win32_fileres=`file -L $1 2>/dev/null`
  167. case $win32_fileres in
  168. *ar\ archive\ import\ library*) # definitely import
  169. win32_libid_type="x86 archive import"
  170. ;;
  171. *ar\ archive*) # could be an import, or static
  172. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
  173. $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
  174. win32_nmres=`eval $NM -f posix -A $1 | \
  175. $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
  176. case $win32_nmres in
  177. import*) win32_libid_type="x86 archive import";;
  178. *) win32_libid_type="x86 archive static";;
  179. esac
  180. fi
  181. ;;
  182. *DLL*)
  183. win32_libid_type="x86 DLL"
  184. ;;
  185. *executable*) # but shell scripts are "executable" too...
  186. case $win32_fileres in
  187. *MS\ Windows\ PE\ Intel*)
  188. win32_libid_type="x86 DLL"
  189. ;;
  190. esac
  191. ;;
  192. esac
  193. $echo $win32_libid_type
  194. }
  195. # func_infer_tag arg
  196. # Infer tagged configuration to use if any are available and
  197. # if one wasn't chosen via the "--tag" command line option.
  198. # Only attempt this if the compiler in the base compile
  199. # command doesn't match the default compiler.
  200. # arg is usually of the form 'gcc ...'
  201. func_infer_tag ()
  202. {
  203. if test -n "$available_tags" && test -z "$tagname"; then
  204. CC_quoted=
  205. for arg in $CC; do
  206. case $arg in
  207. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  208. arg="\"$arg\""
  209. ;;
  210. esac
  211. CC_quoted="$CC_quoted $arg"
  212. done
  213. case $@ in
  214. # Blanks in the command may have been stripped by the calling shell,
  215. # but not from the CC environment variable when configure was run.
  216. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
  217. # Blanks at the start of $base_compile will cause this to fail
  218. # if we don't check for them as well.
  219. *)
  220. for z in $available_tags; do
  221. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  222. # Evaluate the configuration.
  223. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  224. CC_quoted=
  225. for arg in $CC; do
  226. # Double-quote args containing other shell metacharacters.
  227. case $arg in
  228. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  229. arg="\"$arg\""
  230. ;;
  231. esac
  232. CC_quoted="$CC_quoted $arg"
  233. done
  234. case "$@ " in
  235. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
  236. # The compiler in the base compile command matches
  237. # the one in the tagged configuration.
  238. # Assume this is the tagged configuration we want.
  239. tagname=$z
  240. break
  241. ;;
  242. esac
  243. fi
  244. done
  245. # If $tagname still isn't set, then no tagged configuration
  246. # was found and let the user know that the "--tag" command
  247. # line option must be used.
  248. if test -z "$tagname"; then
  249. $echo "$modename: unable to infer tagged configuration"
  250. $echo "$modename: specify a tag with \`--tag'" 1>&2
  251. exit $EXIT_FAILURE
  252. # else
  253. # $echo "$modename: using $tagname tagged configuration"
  254. fi
  255. ;;
  256. esac
  257. fi
  258. }
  259. # func_extract_an_archive dir oldlib
  260. func_extract_an_archive ()
  261. {
  262. f_ex_an_ar_dir="$1"; shift
  263. f_ex_an_ar_oldlib="$1"
  264. $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
  265. $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
  266. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  267. :
  268. else
  269. $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
  270. exit $EXIT_FAILURE
  271. fi
  272. }
  273. # func_extract_archives gentop oldlib ...
  274. func_extract_archives ()
  275. {
  276. my_gentop="$1"; shift
  277. my_oldlibs=${1+"$@"}
  278. my_oldobjs=""
  279. my_xlib=""
  280. my_xabs=""
  281. my_xdir=""
  282. my_status=""
  283. $show "${rm}r $my_gentop"
  284. $run ${rm}r "$my_gentop"
  285. $show "$mkdir $my_gentop"
  286. $run $mkdir "$my_gentop"
  287. my_status=$?
  288. if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
  289. exit $my_status
  290. fi
  291. for my_xlib in $my_oldlibs; do
  292. # Extract the objects.
  293. case $my_xlib in
  294. [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
  295. *) my_xabs=`pwd`"/$my_xlib" ;;
  296. esac
  297. my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
  298. my_xdir="$my_gentop/$my_xlib"
  299. $show "${rm}r $my_xdir"
  300. $run ${rm}r "$my_xdir"
  301. $show "$mkdir $my_xdir"
  302. $run $mkdir "$my_xdir"
  303. exit_status=$?
  304. if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
  305. exit $exit_status
  306. fi
  307. case $host in
  308. *-darwin*)
  309. $show "Extracting $my_xabs"
  310. # Do not bother doing anything if just a dry run
  311. if test -z "$run"; then
  312. darwin_orig_dir=`pwd`
  313. cd $my_xdir || exit $?
  314. darwin_archive=$my_xabs
  315. darwin_curdir=`pwd`
  316. darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
  317. darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
  318. if test -n "$darwin_arches"; then
  319. darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
  320. darwin_arch=
  321. $show "$darwin_base_archive has multiple architectures $darwin_arches"
  322. for darwin_arch in $darwin_arches ; do
  323. mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  324. lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  325. cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  326. func_extract_an_archive "`pwd`" "${darwin_base_archive}"
  327. cd "$darwin_curdir"
  328. $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
  329. done # $darwin_arches
  330. ## Okay now we have a bunch of thin objects, gotta fatten them up :)
  331. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
  332. darwin_file=
  333. darwin_files=
  334. for darwin_file in $darwin_filelist; do
  335. darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
  336. lipo -create -output "$darwin_file" $darwin_files
  337. done # $darwin_filelist
  338. ${rm}r unfat-$$
  339. cd "$darwin_orig_dir"
  340. else
  341. cd "$darwin_orig_dir"
  342. func_extract_an_archive "$my_xdir" "$my_xabs"
  343. fi # $darwin_arches
  344. fi # $run
  345. ;;
  346. *)
  347. func_extract_an_archive "$my_xdir" "$my_xabs"
  348. ;;
  349. esac
  350. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  351. done
  352. func_extract_archives_result="$my_oldobjs"
  353. }
  354. # End of Shell function definitions
  355. #####################################
  356. # Darwin sucks
  357. eval std_shrext=\"$shrext_cmds\"
  358. disable_libs=no
  359. # Parse our command line options once, thoroughly.
  360. while test "$#" -gt 0
  361. do
  362. arg="$1"
  363. shift
  364. case $arg in
  365. -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  366. *) optarg= ;;
  367. esac
  368. # If the previous option needs an argument, assign it.
  369. if test -n "$prev"; then
  370. case $prev in
  371. execute_dlfiles)
  372. execute_dlfiles="$execute_dlfiles $arg"
  373. ;;
  374. tag)
  375. tagname="$arg"
  376. preserve_args="${preserve_args}=$arg"
  377. # Check whether tagname contains only valid characters
  378. case $tagname in
  379. *[!-_A-Za-z0-9,/]*)
  380. $echo "$progname: invalid tag name: $tagname" 1>&2
  381. exit $EXIT_FAILURE
  382. ;;
  383. esac
  384. case $tagname in
  385. CC)
  386. # Don't test for the "default" C tag, as we know, it's there, but
  387. # not specially marked.
  388. ;;
  389. *)
  390. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
  391. taglist="$taglist $tagname"
  392. # Evaluate the configuration.
  393. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
  394. else
  395. $echo "$progname: ignoring unknown tag $tagname" 1>&2
  396. fi
  397. ;;
  398. esac
  399. ;;
  400. *)
  401. eval "$prev=\$arg"
  402. ;;
  403. esac
  404. prev=
  405. prevopt=
  406. continue
  407. fi
  408. # Have we seen a non-optional argument yet?
  409. case $arg in
  410. --help)
  411. show_help=yes
  412. ;;
  413. --version)
  414. $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  415. $echo
  416. $echo "Copyright (C) 2005 Free Software Foundation, Inc."
  417. $echo "This is free software; see the source for copying conditions. There is NO"
  418. $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  419. exit $?
  420. ;;
  421. --config)
  422. ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
  423. # Now print the configurations for the tags.
  424. for tagname in $taglist; do
  425. ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
  426. done
  427. exit $?
  428. ;;
  429. --debug)
  430. $echo "$progname: enabling shell trace mode"
  431. set -x
  432. preserve_args="$preserve_args $arg"
  433. ;;
  434. --dry-run | -n)
  435. run=:
  436. ;;
  437. --features)
  438. $echo "host: $host"
  439. if test "$build_libtool_libs" = yes; then
  440. $echo "enable shared libraries"
  441. else
  442. $echo "disable shared libraries"
  443. fi
  444. if test "$build_old_libs" = yes; then
  445. $echo "enable static libraries"
  446. else
  447. $echo "disable static libraries"
  448. fi
  449. exit $?
  450. ;;
  451. --finish) mode="finish" ;;
  452. --mode) prevopt="--mode" prev=mode ;;
  453. --mode=*) mode="$optarg" ;;
  454. --preserve-dup-deps) duplicate_deps="yes" ;;
  455. --quiet | --silent)
  456. show=:
  457. preserve_args="$preserve_args $arg"
  458. ;;
  459. --tag)
  460. prevopt="--tag"
  461. prev=tag
  462. preserve_args="$preserve_args --tag"
  463. ;;
  464. --tag=*)
  465. set tag "$optarg" ${1+"$@"}
  466. shift
  467. prev=tag
  468. preserve_args="$preserve_args --tag"
  469. ;;
  470. -dlopen)
  471. prevopt="-dlopen"
  472. prev=execute_dlfiles
  473. ;;
  474. -*)
  475. $echo "$modename: unrecognized option \`$arg'" 1>&2
  476. $echo "$help" 1>&2
  477. exit $EXIT_FAILURE
  478. ;;
  479. *)
  480. nonopt="$arg"
  481. break
  482. ;;
  483. esac
  484. done
  485. if test -n "$prevopt"; then
  486. $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  487. $echo "$help" 1>&2
  488. exit $EXIT_FAILURE
  489. fi
  490. case $disable_libs in
  491. no)
  492. ;;
  493. shared)
  494. build_libtool_libs=no
  495. build_old_libs=yes
  496. ;;
  497. static)
  498. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  499. ;;
  500. esac
  501. # If this variable is set in any of the actions, the command in it
  502. # will be execed at the end. This prevents here-documents from being
  503. # left over by shells.
  504. exec_cmd=
  505. if test -z "$show_help"; then
  506. # Infer the operation mode.
  507. if test -z "$mode"; then
  508. $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
  509. $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
  510. case $nonopt in
  511. *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
  512. mode=link
  513. for arg
  514. do
  515. case $arg in
  516. -c)
  517. mode=compile
  518. break
  519. ;;
  520. esac
  521. done
  522. ;;
  523. *db | *dbx | *strace | *truss)
  524. mode=execute
  525. ;;
  526. *install*|cp|mv)
  527. mode=install
  528. ;;
  529. *rm)
  530. mode=uninstall
  531. ;;
  532. *)
  533. # If we have no mode, but dlfiles were specified, then do execute mode.
  534. test -n "$execute_dlfiles" && mode=execute
  535. # Just use the default operation mode.
  536. if test -z "$mode"; then
  537. if test -n "$nonopt"; then
  538. $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  539. else
  540. $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  541. fi
  542. fi
  543. ;;
  544. esac
  545. fi
  546. # Only execute mode is allowed to have -dlopen flags.
  547. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  548. $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  549. $echo "$help" 1>&2
  550. exit $EXIT_FAILURE
  551. fi
  552. # Change the help message to a mode-specific one.
  553. generic_help="$help"
  554. help="Try \`$modename --help --mode=$mode' for more information."
  555. # These modes are in order of execution frequency so that they run quickly.
  556. case $mode in
  557. # libtool compile mode
  558. compile)
  559. modename="$modename: compile"
  560. # Get the compilation command and the source file.
  561. base_compile=
  562. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  563. suppress_opt=yes
  564. suppress_output=
  565. arg_mode=normal
  566. libobj=
  567. later=
  568. for arg
  569. do
  570. case $arg_mode in
  571. arg )
  572. # do not "continue". Instead, add this to base_compile
  573. lastarg="$arg"
  574. arg_mode=normal
  575. ;;
  576. target )
  577. libobj="$arg"
  578. arg_mode=normal
  579. continue
  580. ;;
  581. normal )
  582. # Accept any command-line options.
  583. case $arg in
  584. -o)
  585. if test -n "$libobj" ; then
  586. $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  587. exit $EXIT_FAILURE
  588. fi
  589. arg_mode=target
  590. continue
  591. ;;
  592. -static | -prefer-pic | -prefer-non-pic)
  593. later="$later $arg"
  594. continue
  595. ;;
  596. -no-suppress)
  597. suppress_opt=no
  598. continue
  599. ;;
  600. -Xcompiler)
  601. arg_mode=arg # the next one goes into the "base_compile" arg list
  602. continue # The current "srcfile" will either be retained or
  603. ;; # replaced later. I would guess that would be a bug.
  604. -Wc,*)
  605. args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
  606. lastarg=
  607. save_ifs="$IFS"; IFS=','
  608. for arg in $args; do
  609. IFS="$save_ifs"
  610. # Double-quote args containing other shell metacharacters.
  611. # Many Bourne shells cannot handle close brackets correctly
  612. # in scan sets, so we specify it separately.
  613. case $arg in
  614. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  615. arg="\"$arg\""
  616. ;;
  617. esac
  618. lastarg="$lastarg $arg"
  619. done
  620. IFS="$save_ifs"
  621. lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
  622. # Add the arguments to base_compile.
  623. base_compile="$base_compile $lastarg"
  624. continue
  625. ;;
  626. * )
  627. # Accept the current argument as the source file.
  628. # The previous "srcfile" becomes the current argument.
  629. #
  630. lastarg="$srcfile"
  631. srcfile="$arg"
  632. ;;
  633. esac # case $arg
  634. ;;
  635. esac # case $arg_mode
  636. # Aesthetically quote the previous argument.
  637. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  638. case $lastarg in
  639. # Double-quote args containing other shell metacharacters.
  640. # Many Bourne shells cannot handle close brackets correctly
  641. # in scan sets, and some SunOS ksh mistreat backslash-escaping
  642. # in scan sets (worked around with variable expansion),
  643. # and furthermore cannot handle '|' '&' '(' ')' in scan sets
  644. # at all, so we specify them separately.
  645. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  646. lastarg="\"$lastarg\""
  647. ;;
  648. esac
  649. base_compile="$base_compile $lastarg"
  650. done # for arg
  651. case $arg_mode in
  652. arg)
  653. $echo "$modename: you must specify an argument for -Xcompile"
  654. exit $EXIT_FAILURE
  655. ;;
  656. target)
  657. $echo "$modename: you must specify a target with \`-o'" 1>&2
  658. exit $EXIT_FAILURE
  659. ;;
  660. *)
  661. # Get the name of the library object.
  662. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  663. ;;
  664. esac
  665. # Recognize several different file suffixes.
  666. # If the user specifies -o file.o, it is replaced with file.lo
  667. xform='[cCFSifmso]'
  668. case $libobj in
  669. *.ada) xform=ada ;;
  670. *.adb) xform=adb ;;
  671. *.ads) xform=ads ;;
  672. *.asm) xform=asm ;;
  673. *.c++) xform=c++ ;;
  674. *.cc) xform=cc ;;
  675. *.ii) xform=ii ;;
  676. *.class) xform=class ;;
  677. *.cpp) xform=cpp ;;
  678. *.cxx) xform=cxx ;;
  679. *.f90) xform=f90 ;;
  680. *.for) xform=for ;;
  681. *.java) xform=java ;;
  682. esac
  683. libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  684. case $libobj in
  685. *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  686. *)
  687. $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  688. exit $EXIT_FAILURE
  689. ;;
  690. esac
  691. func_infer_tag $base_compile
  692. for arg in $later; do
  693. case $arg in
  694. -static)
  695. build_old_libs=yes
  696. continue
  697. ;;
  698. -prefer-pic)
  699. pic_mode=yes
  700. continue
  701. ;;
  702. -prefer-non-pic)
  703. pic_mode=no
  704. continue
  705. ;;
  706. esac
  707. done
  708. qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
  709. case $qlibobj in
  710. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  711. qlibobj="\"$qlibobj\"" ;;
  712. esac
  713. test "X$libobj" != "X$qlibobj" \
  714. && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
  715. && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
  716. objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  717. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  718. if test "X$xdir" = "X$obj"; then
  719. xdir=
  720. else
  721. xdir=$xdir/
  722. fi
  723. lobj=${xdir}$objdir/$objname
  724. if test -z "$base_compile"; then
  725. $echo "$modename: you must specify a compilation command" 1>&2
  726. $echo "$help" 1>&2
  727. exit $EXIT_FAILURE
  728. fi
  729. # Delete any leftover library objects.
  730. if test "$build_old_libs" = yes; then
  731. removelist="$obj $lobj $libobj ${libobj}T"
  732. else
  733. removelist="$lobj $libobj ${libobj}T"
  734. fi
  735. $run $rm $removelist
  736. trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  737. # On Cygwin there's no "real" PIC flag so we must build both object types
  738. case $host_os in
  739. cygwin* | mingw* | pw32* | os2*)
  740. pic_mode=default
  741. ;;
  742. esac
  743. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  744. # non-PIC code in shared libraries is not supported
  745. pic_mode=default
  746. fi
  747. # Calculate the filename of the output object if compiler does
  748. # not support -o with -c
  749. if test "$compiler_c_o" = no; then
  750. output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  751. lockfile="$output_obj.lock"
  752. removelist="$removelist $output_obj $lockfile"
  753. trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  754. else
  755. output_obj=
  756. need_locks=no
  757. lockfile=
  758. fi
  759. # Lock this critical section if it is needed
  760. # We use this script file to make the link, it avoids creating a new file
  761. if test "$need_locks" = yes; then
  762. until $run ln "$progpath" "$lockfile" 2>/dev/null; do
  763. $show "Waiting for $lockfile to be removed"
  764. sleep 2
  765. done
  766. elif test "$need_locks" = warn; then
  767. if test -f "$lockfile"; then
  768. $echo "\
  769. *** ERROR, $lockfile exists and contains:
  770. `cat $lockfile 2>/dev/null`
  771. This indicates that another process is trying to use the same
  772. temporary object file, and libtool could not work around it because
  773. your compiler does not support \`-c' and \`-o' together. If you
  774. repeat this compilation, it may succeed, by chance, but you had better
  775. avoid parallel builds (make -j) in this platform, or get a better
  776. compiler."
  777. $run $rm $removelist
  778. exit $EXIT_FAILURE
  779. fi
  780. $echo "$srcfile" > "$lockfile"
  781. fi
  782. if test -n "$fix_srcfile_path"; then
  783. eval srcfile=\"$fix_srcfile_path\"
  784. fi
  785. qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
  786. case $qsrcfile in
  787. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  788. qsrcfile="\"$qsrcfile\"" ;;
  789. esac
  790. $run $rm "$libobj" "${libobj}T"
  791. # Create a libtool object file (analogous to a ".la" file),
  792. # but don't create it if we're doing a dry run.
  793. test -z "$run" && cat > ${libobj}T <<EOF
  794. # $libobj - a libtool object file
  795. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  796. #
  797. # Please DO NOT delete this file!
  798. # It is necessary for linking the library.
  799. # Name of the PIC object.
  800. EOF
  801. # Only build a PIC object if we are building libtool libraries.
  802. if test "$build_libtool_libs" = yes; then
  803. # Without this assignment, base_compile gets emptied.
  804. fbsd_hideous_sh_bug=$base_compile
  805. if test "$pic_mode" != no; then
  806. command="$base_compile $qsrcfile $pic_flag"
  807. else
  808. # Don't build PIC code
  809. command="$base_compile $qsrcfile"
  810. fi
  811. if test ! -d "${xdir}$objdir"; then
  812. $show "$mkdir ${xdir}$objdir"
  813. $run $mkdir ${xdir}$objdir
  814. exit_status=$?
  815. if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
  816. exit $exit_status
  817. fi
  818. fi
  819. if test -z "$output_obj"; then
  820. # Place PIC objects in $objdir
  821. command="$command -o $lobj"
  822. fi
  823. $run $rm "$lobj" "$output_obj"
  824. $show "$command"
  825. if $run eval "$command"; then :
  826. else
  827. test -n "$output_obj" && $run $rm $removelist
  828. exit $EXIT_FAILURE
  829. fi
  830. if test "$need_locks" = warn &&
  831. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  832. $echo "\
  833. *** ERROR, $lockfile contains:
  834. `cat $lockfile 2>/dev/null`
  835. but it should contain:
  836. $srcfile
  837. This indicates that another process is trying to use the same
  838. temporary object file, and libtool could not work around it because
  839. your compiler does not support \`-c' and \`-o' together. If you
  840. repeat this compilation, it may succeed, by chance, but you had better
  841. avoid parallel builds (make -j) in this platform, or get a better
  842. compiler."
  843. $run $rm $removelist
  844. exit $EXIT_FAILURE
  845. fi
  846. # Just move the object if needed, then go on to compile the next one
  847. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  848. $show "$mv $output_obj $lobj"
  849. if $run $mv $output_obj $lobj; then :
  850. else
  851. error=$?
  852. $run $rm $removelist
  853. exit $error
  854. fi
  855. fi
  856. # Append the name of the PIC object to the libtool object file.
  857. test -z "$run" && cat >> ${libobj}T <<EOF
  858. pic_object='$objdir/$objname'
  859. EOF
  860. # Allow error messages only from the first compilation.
  861. if test "$suppress_opt" = yes; then
  862. suppress_output=' >/dev/null 2>&1'
  863. fi
  864. else
  865. # No PIC object so indicate it doesn't exist in the libtool
  866. # object file.
  867. test -z "$run" && cat >> ${libobj}T <<EOF
  868. pic_object=none
  869. EOF
  870. fi
  871. # Only build a position-dependent object if we build old libraries.
  872. if test "$build_old_libs" = yes; then
  873. if test "$pic_mode" != yes; then
  874. # Don't build PIC code
  875. command="$base_compile $qsrcfile"
  876. else
  877. command="$base_compile $qsrcfile $pic_flag"
  878. fi
  879. if test "$compiler_c_o" = yes; then
  880. command="$command -o $obj"
  881. fi
  882. # Suppress compiler output if we already did a PIC compilation.
  883. command="$command$suppress_output"
  884. $run $rm "$obj" "$output_obj"
  885. $show "$command"
  886. if $run eval "$command"; then :
  887. else
  888. $run $rm $removelist
  889. exit $EXIT_FAILURE
  890. fi
  891. if test "$need_locks" = warn &&
  892. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  893. $echo "\
  894. *** ERROR, $lockfile contains:
  895. `cat $lockfile 2>/dev/null`
  896. but it should contain:
  897. $srcfile
  898. This indicates that another process is trying to use the same
  899. temporary object file, and libtool could not work around it because
  900. your compiler does not support \`-c' and \`-o' together. If you
  901. repeat this compilation, it may succeed, by chance, but you had better
  902. avoid parallel builds (make -j) in this platform, or get a better
  903. compiler."
  904. $run $rm $removelist
  905. exit $EXIT_FAILURE
  906. fi
  907. # Just move the object if needed
  908. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  909. $show "$mv $output_obj $obj"
  910. if $run $mv $output_obj $obj; then :
  911. else
  912. error=$?
  913. $run $rm $removelist
  914. exit $error
  915. fi
  916. fi
  917. # Append the name of the non-PIC object the libtool object file.
  918. # Only append if the libtool object file exists.
  919. test -z "$run" && cat >> ${libobj}T <<EOF
  920. # Name of the non-PIC object.
  921. non_pic_object='$objname'
  922. EOF
  923. else
  924. # Append the name of the non-PIC object the libtool object file.
  925. # Only append if the libtool object file exists.
  926. test -z "$run" && cat >> ${libobj}T <<EOF
  927. # Name of the non-PIC object.
  928. non_pic_object=none
  929. EOF
  930. fi
  931. $run $mv "${libobj}T" "${libobj}"
  932. # Unlock the critical section if it was locked
  933. if test "$need_locks" != no; then
  934. $run $rm "$lockfile"
  935. fi
  936. exit $EXIT_SUCCESS
  937. ;;
  938. # libtool link mode
  939. link | relink)
  940. modename="$modename: link"
  941. case $host in
  942. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  943. # It is impossible to link a dll without this setting, and
  944. # we shouldn't force the makefile maintainer to figure out
  945. # which system we are compiling for in order to pass an extra
  946. # flag for every libtool invocation.
  947. # allow_undefined=no
  948. # FIXME: Unfortunately, there are problems with the above when trying
  949. # to make a dll which has undefined symbols, in which case not
  950. # even a static library is built. For now, we need to specify
  951. # -no-undefined on the libtool link line when we can be certain
  952. # that all symbols are satisfied, otherwise we get a static library.
  953. allow_undefined=yes
  954. ;;
  955. *)
  956. allow_undefined=yes
  957. ;;
  958. esac
  959. libtool_args="$nonopt"
  960. base_compile="$nonopt $@"
  961. compile_command="$nonopt"
  962. finalize_command="$nonopt"
  963. compile_rpath=
  964. finalize_rpath=
  965. compile_shlibpath=
  966. finalize_shlibpath=
  967. convenience=
  968. old_convenience=
  969. deplibs=
  970. old_deplibs=
  971. compiler_flags=
  972. linker_flags=
  973. dllsearchpath=
  974. lib_search_path=`pwd`
  975. inst_prefix_dir=
  976. avoid_version=no
  977. dlfiles=
  978. dlprefiles=
  979. dlself=no
  980. export_dynamic=no
  981. export_symbols=
  982. export_symbols_regex=
  983. generated=
  984. libobjs=
  985. ltlibs=
  986. module=no
  987. no_install=no
  988. objs=
  989. non_pic_objects=
  990. notinst_path= # paths that contain not-installed libtool libraries
  991. precious_files_regex=
  992. prefer_static_libs=no
  993. preload=no
  994. prev=
  995. prevarg=
  996. release=
  997. rpath=
  998. xrpath=
  999. perm_rpath=
  1000. temp_rpath=
  1001. thread_safe=no
  1002. vinfo=
  1003. vinfo_number=no
  1004. func_infer_tag $base_compile
  1005. # We need to know -static, to get the right output filenames.
  1006. for arg
  1007. do
  1008. case $arg in
  1009. -all-static | -static)
  1010. if test "X$arg" = "X-all-static"; then
  1011. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  1012. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  1013. fi
  1014. if test -n "$link_static_flag"; then
  1015. dlopen_self=$dlopen_self_static
  1016. fi
  1017. prefer_static_libs=yes
  1018. else
  1019. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1020. dlopen_self=$dlopen_self_static
  1021. fi
  1022. prefer_static_libs=built
  1023. fi
  1024. build_libtool_libs=no
  1025. build_old_libs=yes
  1026. break
  1027. ;;
  1028. esac
  1029. done
  1030. # See if our shared archives depend on static archives.
  1031. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  1032. # Go through the arguments, transforming them on the way.
  1033. while test "$#" -gt 0; do
  1034. arg="$1"
  1035. shift
  1036. case $arg in
  1037. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1038. qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  1039. ;;
  1040. *) qarg=$arg ;;
  1041. esac
  1042. libtool_args="$libtool_args $qarg"
  1043. # If the previous option needs an argument, assign it.
  1044. if test -n "$prev"; then
  1045. case $prev in
  1046. output)
  1047. compile_command="$compile_command @OUTPUT@"
  1048. finalize_command="$finalize_command @OUTPUT@"
  1049. ;;
  1050. esac
  1051. case $prev in
  1052. dlfiles|dlprefiles)
  1053. if test "$preload" = no; then
  1054. # Add the symbol object into the linking commands.
  1055. compile_command="$compile_command @SYMFILE@"
  1056. finalize_command="$finalize_command @SYMFILE@"
  1057. preload=yes
  1058. fi
  1059. case $arg in
  1060. *.la | *.lo) ;; # We handle these cases below.
  1061. force)
  1062. if test "$dlself" = no; then
  1063. dlself=needless
  1064. export_dynamic=yes
  1065. fi
  1066. prev=
  1067. continue
  1068. ;;
  1069. self)
  1070. if test "$prev" = dlprefiles; then
  1071. dlself=yes
  1072. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  1073. dlself=yes
  1074. else
  1075. dlself=needless
  1076. export_dynamic=yes
  1077. fi
  1078. prev=
  1079. continue
  1080. ;;
  1081. *)
  1082. if test "$prev" = dlfiles; then
  1083. dlfiles="$dlfiles $arg"
  1084. else
  1085. dlprefiles="$dlprefiles $arg"
  1086. fi
  1087. prev=
  1088. continue
  1089. ;;
  1090. esac
  1091. ;;
  1092. expsyms)
  1093. export_symbols="$arg"
  1094. if test ! -f "$arg"; then
  1095. $echo "$modename: symbol file \`$arg' does not exist"
  1096. exit $EXIT_FAILURE
  1097. fi
  1098. prev=
  1099. continue
  1100. ;;
  1101. expsyms_regex)
  1102. export_symbols_regex="$arg"
  1103. prev=
  1104. continue
  1105. ;;
  1106. inst_prefix)
  1107. inst_prefix_dir="$arg"
  1108. prev=
  1109. continue
  1110. ;;
  1111. precious_regex)
  1112. precious_files_regex="$arg"
  1113. prev=
  1114. continue
  1115. ;;
  1116. release)
  1117. release="-$arg"
  1118. prev=
  1119. continue
  1120. ;;
  1121. objectlist)
  1122. if test -f "$arg"; then
  1123. save_arg=$arg
  1124. moreargs=
  1125. for fil in `cat $save_arg`
  1126. do
  1127. # moreargs="$moreargs $fil"
  1128. arg=$fil
  1129. # A libtool-controlled object.
  1130. # Check to see that this really is a libtool object.
  1131. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1132. pic_object=
  1133. non_pic_object=
  1134. # Read the .lo file
  1135. # If there is no directory component, then add one.
  1136. case $arg in
  1137. */* | *\\*) . $arg ;;
  1138. *) . ./$arg ;;
  1139. esac
  1140. if test -z "$pic_object" || \
  1141. test -z "$non_pic_object" ||
  1142. test "$pic_object" = none && \
  1143. test "$non_pic_object" = none; then
  1144. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1145. exit $EXIT_FAILURE
  1146. fi
  1147. # Extract subdirectory from the argument.
  1148. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1149. if test "X$xdir" = "X$arg"; then
  1150. xdir=
  1151. else
  1152. xdir="$xdir/"
  1153. fi
  1154. if test "$pic_object" != none; then
  1155. # Prepend the subdirectory the object is found in.
  1156. pic_object="$xdir$pic_object"
  1157. if test "$prev" = dlfiles; then
  1158. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1159. dlfiles="$dlfiles $pic_object"
  1160. prev=
  1161. continue
  1162. else
  1163. # If libtool objects are unsupported, then we need to preload.
  1164. prev=dlprefiles
  1165. fi
  1166. fi
  1167. # CHECK ME: I think I busted this. -Ossama
  1168. if test "$prev" = dlprefiles; then
  1169. # Preload the old-style object.
  1170. dlprefiles="$dlprefiles $pic_object"
  1171. prev=
  1172. fi
  1173. # A PIC object.
  1174. libobjs="$libobjs $pic_object"
  1175. arg="$pic_object"
  1176. fi
  1177. # Non-PIC object.
  1178. if test "$non_pic_object" != none; then
  1179. # Prepend the subdirectory the object is found in.
  1180. non_pic_object="$xdir$non_pic_object"
  1181. # A standard non-PIC object
  1182. non_pic_objects="$non_pic_objects $non_pic_object"
  1183. if test -z "$pic_object" || test "$pic_object" = none ; then
  1184. arg="$non_pic_object"
  1185. fi
  1186. else
  1187. # If the PIC object exists, use it instead.
  1188. # $xdir was prepended to $pic_object above.
  1189. non_pic_object="$pic_object"
  1190. non_pic_objects="$non_pic_objects $non_pic_object"
  1191. fi
  1192. else
  1193. # Only an error if not doing a dry-run.
  1194. if test -z "$run"; then
  1195. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1196. exit $EXIT_FAILURE
  1197. else
  1198. # Dry-run case.
  1199. # Extract subdirectory from the argument.
  1200. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1201. if test "X$xdir" = "X$arg"; then
  1202. xdir=
  1203. else
  1204. xdir="$xdir/"
  1205. fi
  1206. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1207. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1208. libobjs="$libobjs $pic_object"
  1209. non_pic_objects="$non_pic_objects $non_pic_object"
  1210. fi
  1211. fi
  1212. done
  1213. else
  1214. $echo "$modename: link input file \`$save_arg' does not exist"
  1215. exit $EXIT_FAILURE
  1216. fi
  1217. arg=$save_arg
  1218. prev=
  1219. continue
  1220. ;;
  1221. rpath | xrpath)
  1222. # We need an absolute path.
  1223. case $arg in
  1224. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1225. *)
  1226. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1227. exit $EXIT_FAILURE
  1228. ;;
  1229. esac
  1230. if test "$prev" = rpath; then
  1231. case "$rpath " in
  1232. *" $arg "*) ;;
  1233. *) rpath="$rpath $arg" ;;
  1234. esac
  1235. else
  1236. case "$xrpath " in
  1237. *" $arg "*) ;;
  1238. *) xrpath="$xrpath $arg" ;;
  1239. esac
  1240. fi
  1241. prev=
  1242. continue
  1243. ;;
  1244. xcompiler)
  1245. compiler_flags="$compiler_flags $qarg"
  1246. prev=
  1247. compile_command="$compile_command $qarg"
  1248. finalize_command="$finalize_command $qarg"
  1249. continue
  1250. ;;
  1251. xlinker)
  1252. linker_flags="$linker_flags $qarg"
  1253. compiler_flags="$compiler_flags $wl$qarg"
  1254. prev=
  1255. compile_command="$compile_command $wl$qarg"
  1256. finalize_command="$finalize_command $wl$qarg"
  1257. continue
  1258. ;;
  1259. xcclinker)
  1260. linker_flags="$linker_flags $qarg"
  1261. compiler_flags="$compiler_flags $qarg"
  1262. prev=
  1263. compile_command="$compile_command $qarg"
  1264. finalize_command="$finalize_command $qarg"
  1265. continue
  1266. ;;
  1267. shrext)
  1268. shrext_cmds="$arg"
  1269. prev=
  1270. continue
  1271. ;;
  1272. darwin_framework|darwin_framework_skip)
  1273. test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
  1274. compile_command="$compile_command $arg"
  1275. finalize_command="$finalize_command $arg"
  1276. prev=
  1277. continue
  1278. ;;
  1279. *)
  1280. eval "$prev=\"\$arg\""
  1281. prev=
  1282. continue
  1283. ;;
  1284. esac
  1285. fi # test -n "$prev"
  1286. prevarg="$arg"
  1287. case $arg in
  1288. -all-static)
  1289. if test -n "$link_static_flag"; then
  1290. compile_command="$compile_command $link_static_flag"
  1291. finalize_command="$finalize_command $link_static_flag"
  1292. fi
  1293. continue
  1294. ;;
  1295. -allow-undefined)
  1296. # FIXME: remove this flag sometime in the future.
  1297. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1298. continue
  1299. ;;
  1300. -avoid-version)
  1301. avoid_version=yes
  1302. continue
  1303. ;;
  1304. -dlopen)
  1305. prev=dlfiles
  1306. continue
  1307. ;;
  1308. -dlpreopen)
  1309. prev=dlprefiles
  1310. continue
  1311. ;;
  1312. -export-dynamic)
  1313. export_dynamic=yes
  1314. continue
  1315. ;;
  1316. -export-symbols | -export-symbols-regex)
  1317. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1318. $echo "$modename: more than one -exported-symbols argument is not allowed"
  1319. exit $EXIT_FAILURE
  1320. fi
  1321. if test "X$arg" = "X-export-symbols"; then
  1322. prev=expsyms
  1323. else
  1324. prev=expsyms_regex
  1325. fi
  1326. continue
  1327. ;;
  1328. -framework|-arch|-isysroot)
  1329. case " $CC " in
  1330. *" ${arg} ${1} "* | *" ${arg} ${1} "*)
  1331. prev=darwin_framework_skip ;;
  1332. *) compiler_flags="$compiler_flags $arg"
  1333. prev=darwin_framework ;;
  1334. esac
  1335. compile_command="$compile_command $arg"
  1336. finalize_command="$finalize_command $arg"
  1337. continue
  1338. ;;
  1339. -inst-prefix-dir)
  1340. prev=inst_prefix
  1341. continue
  1342. ;;
  1343. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1344. # so, if we see these flags be careful not to treat them like -L
  1345. -L[A-Z][A-Z]*:*)
  1346. case $with_gcc/$host in
  1347. no/*-*-irix* | /*-*-irix*)
  1348. compile_command="$compile_command $arg"
  1349. finalize_command="$finalize_command $arg"
  1350. ;;
  1351. esac
  1352. continue
  1353. ;;
  1354. -L*)
  1355. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1356. # We need an absolute path.
  1357. case $dir in
  1358. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1359. *)
  1360. absdir=`cd "$dir" && pwd`
  1361. if test -z "$absdir"; then
  1362. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1363. absdir="$dir"
  1364. notinst_path="$notinst_path $dir"
  1365. fi
  1366. dir="$absdir"
  1367. ;;
  1368. esac
  1369. case "$deplibs " in
  1370. *" -L$dir "*) ;;
  1371. *)
  1372. deplibs="$deplibs -L$dir"
  1373. lib_search_path="$lib_search_path $dir"
  1374. ;;
  1375. esac
  1376. case $host in
  1377. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1378. testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
  1379. case :$dllsearchpath: in
  1380. *":$dir:"*) ;;
  1381. *) dllsearchpath="$dllsearchpath:$dir";;
  1382. esac
  1383. case :$dllsearchpath: in
  1384. *":$testbindir:"*) ;;
  1385. *) dllsearchpath="$dllsearchpath:$testbindir";;
  1386. esac
  1387. ;;
  1388. esac
  1389. continue
  1390. ;;
  1391. -l*)
  1392. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1393. case $host in
  1394. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
  1395. # These systems don't actually have a C or math library (as such)
  1396. continue
  1397. ;;
  1398. *-*-os2*)
  1399. # These systems don't actually have a C library (as such)
  1400. test "X$arg" = "X-lc" && continue
  1401. ;;
  1402. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  1403. # Do not include libc due to us having libc/libc_r.
  1404. test "X$arg" = "X-lc" && continue
  1405. ;;
  1406. *-*-rhapsody* | *-*-darwin1.[012])
  1407. # Rhapsody C and math libraries are in the System framework
  1408. deplibs="$deplibs -framework System"
  1409. continue
  1410. ;;
  1411. *-*-sco3.2v5* | *-*-sco5v6*)
  1412. # Causes problems with __ctype
  1413. test "X$arg" = "X-lc" && continue
  1414. ;;
  1415. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  1416. # Compiler inserts libc in the correct place for threads to work
  1417. test "X$arg" = "X-lc" && continue
  1418. ;;
  1419. esac
  1420. elif test "X$arg" = "X-lc_r"; then
  1421. case $host in
  1422. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  1423. # Do not include libc_r directly, use -pthread flag.
  1424. continue
  1425. ;;
  1426. esac
  1427. fi
  1428. deplibs="$deplibs $arg"
  1429. continue
  1430. ;;
  1431. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  1432. # classes, name mangling, and exception handling.
  1433. -model)
  1434. compile_command="$compile_command $arg"
  1435. compiler_flags="$compiler_flags $arg"
  1436. finalize_command="$finalize_command $arg"
  1437. prev=xcompiler
  1438. continue
  1439. ;;
  1440. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1441. compiler_flags="$compiler_flags $arg"
  1442. compile_command="$compile_command $arg"
  1443. finalize_command="$finalize_command $arg"
  1444. continue
  1445. ;;
  1446. -module)
  1447. module=yes
  1448. continue
  1449. ;;
  1450. # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
  1451. # -r[0-9][0-9]* specifies the processor on the SGI compiler
  1452. # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
  1453. # +DA*, +DD* enable 64-bit mode on the HP compiler
  1454. # -q* pass through compiler args for the IBM compiler
  1455. # -m* pass through architecture-specific compiler args for GCC
  1456. # -m*, -t[45]*, -txscale* pass through architecture-specific
  1457. # compiler args for GCC
  1458. # -pg pass through profiling flag for GCC
  1459. # @file GCC response files
  1460. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
  1461. -t[45]*|-txscale*|@*)
  1462. # Unknown arguments in both finalize_command and compile_command need
  1463. # to be aesthetically quoted because they are evaled later.
  1464. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1465. case $arg in
  1466. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1467. arg="\"$arg\""
  1468. ;;
  1469. esac
  1470. compile_command="$compile_command $arg"
  1471. finalize_command="$finalize_command $arg"
  1472. compiler_flags="$compiler_flags $arg"
  1473. continue
  1474. ;;
  1475. -shrext)
  1476. prev=shrext
  1477. continue
  1478. ;;
  1479. -no-fast-install)
  1480. fast_install=no
  1481. continue
  1482. ;;
  1483. -no-install)
  1484. case $host in
  1485. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1486. # The PATH hackery in wrapper scripts is required on Windows
  1487. # in order for the loader to find any dlls it needs.
  1488. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1489. $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1490. fast_install=no
  1491. ;;
  1492. *) no_install=yes ;;
  1493. esac
  1494. continue
  1495. ;;
  1496. -no-undefined)
  1497. allow_undefined=no
  1498. continue
  1499. ;;
  1500. -objectlist)
  1501. prev=objectlist
  1502. continue
  1503. ;;
  1504. -o) prev=output ;;
  1505. -precious-files-regex)
  1506. prev=precious_regex
  1507. continue
  1508. ;;
  1509. -release)
  1510. prev=release
  1511. continue
  1512. ;;
  1513. -rpath)
  1514. prev=rpath
  1515. continue
  1516. ;;
  1517. -R)
  1518. prev=xrpath
  1519. continue
  1520. ;;
  1521. -R*)
  1522. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1523. # We need an absolute path.
  1524. case $dir in
  1525. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1526. *)
  1527. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1528. exit $EXIT_FAILURE
  1529. ;;
  1530. esac
  1531. case "$xrpath " in
  1532. *" $dir "*) ;;
  1533. *) xrpath="$xrpath $dir" ;;
  1534. esac
  1535. continue
  1536. ;;
  1537. -static)
  1538. # The effects of -static are defined in a previous loop.
  1539. # We used to do the same as -all-static on platforms that
  1540. # didn't have a PIC flag, but the assumption that the effects
  1541. # would be equivalent was wrong. It would break on at least
  1542. # Digital Unix and AIX.
  1543. continue
  1544. ;;
  1545. -thread-safe)
  1546. thread_safe=yes
  1547. continue
  1548. ;;
  1549. -version-info)
  1550. prev=vinfo
  1551. continue
  1552. ;;
  1553. -version-number)
  1554. prev=vinfo
  1555. vinfo_number=yes
  1556. continue
  1557. ;;
  1558. -Wc,*)
  1559. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1560. arg=
  1561. save_ifs="$IFS"; IFS=','
  1562. for flag in $args; do
  1563. IFS="$save_ifs"
  1564. case $flag in
  1565. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1566. flag="\"$flag\""
  1567. ;;
  1568. esac
  1569. arg="$arg $wl$flag"
  1570. compiler_flags="$compiler_flags $flag"
  1571. done
  1572. IFS="$save_ifs"
  1573. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1574. ;;
  1575. -Wl,*)
  1576. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1577. arg=
  1578. save_ifs="$IFS"; IFS=','
  1579. for flag in $args; do
  1580. IFS="$save_ifs"
  1581. case $flag in
  1582. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1583. flag="\"$flag\""
  1584. ;;
  1585. esac
  1586. arg="$arg $wl$flag"
  1587. compiler_flags="$compiler_flags $wl$flag"
  1588. linker_flags="$linker_flags $flag"
  1589. done
  1590. IFS="$save_ifs"
  1591. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1592. ;;
  1593. -Xcompiler)
  1594. prev=xcompiler
  1595. continue
  1596. ;;
  1597. -Xlinker)
  1598. prev=xlinker
  1599. continue
  1600. ;;
  1601. -XCClinker)
  1602. prev=xcclinker
  1603. continue
  1604. ;;
  1605. # Some other compiler flag.
  1606. -* | +*)
  1607. # Unknown arguments in both finalize_command and compile_command need
  1608. # to be aesthetically quoted because they are evaled later.
  1609. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1610. case $arg in
  1611. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1612. arg="\"$arg\""
  1613. ;;
  1614. esac
  1615. ;;
  1616. *.$objext)
  1617. # A standard object.
  1618. objs="$objs $arg"
  1619. ;;
  1620. *.lo)
  1621. # A libtool-controlled object.
  1622. # Check to see that this really is a libtool object.
  1623. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1624. pic_object=
  1625. non_pic_object=
  1626. # Read the .lo file
  1627. # If there is no directory component, then add one.
  1628. case $arg in
  1629. */* | *\\*) . $arg ;;
  1630. *) . ./$arg ;;
  1631. esac
  1632. if test -z "$pic_object" || \
  1633. test -z "$non_pic_object" ||
  1634. test "$pic_object" = none && \
  1635. test "$non_pic_object" = none; then
  1636. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1637. exit $EXIT_FAILURE
  1638. fi
  1639. # Extract subdirectory from the argument.
  1640. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1641. if test "X$xdir" = "X$arg"; then
  1642. xdir=
  1643. else
  1644. xdir="$xdir/"
  1645. fi
  1646. if test "$pic_object" != none; then
  1647. # Prepend the subdirectory the object is found in.
  1648. pic_object="$xdir$pic_object"
  1649. if test "$prev" = dlfiles; then
  1650. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1651. dlfiles="$dlfiles $pic_object"
  1652. prev=
  1653. continue
  1654. else
  1655. # If libtool objects are unsupported, then we need to preload.
  1656. prev=dlprefiles
  1657. fi
  1658. fi
  1659. # CHECK ME: I think I busted this. -Ossama
  1660. if test "$prev" = dlprefiles; then
  1661. # Preload the old-style object.
  1662. dlprefiles="$dlprefiles $pic_object"
  1663. prev=
  1664. fi
  1665. # A PIC object.
  1666. libobjs="$libobjs $pic_object"
  1667. arg="$pic_object"
  1668. fi
  1669. # Non-PIC object.
  1670. if test "$non_pic_object" != none; then
  1671. # Prepend the subdirectory the object is found in.
  1672. non_pic_object="$xdir$non_pic_object"
  1673. # A standard non-PIC object
  1674. non_pic_objects="$non_pic_objects $non_pic_object"
  1675. if test -z "$pic_object" || test "$pic_object" = none ; then
  1676. arg="$non_pic_object"
  1677. fi
  1678. else
  1679. # If the PIC object exists, use it instead.
  1680. # $xdir was prepended to $pic_object above.
  1681. non_pic_object="$pic_object"
  1682. non_pic_objects="$non_pic_objects $non_pic_object"
  1683. fi
  1684. else
  1685. # Only an error if not doing a dry-run.
  1686. if test -z "$run"; then
  1687. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1688. exit $EXIT_FAILURE
  1689. else
  1690. # Dry-run case.
  1691. # Extract subdirectory from the argument.
  1692. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1693. if test "X$xdir" = "X$arg"; then
  1694. xdir=
  1695. else
  1696. xdir="$xdir/"
  1697. fi
  1698. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1699. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1700. libobjs="$libobjs $pic_object"
  1701. non_pic_objects="$non_pic_objects $non_pic_object"
  1702. fi
  1703. fi
  1704. ;;
  1705. *.$libext)
  1706. # An archive.
  1707. deplibs="$deplibs $arg"
  1708. old_deplibs="$old_deplibs $arg"
  1709. continue
  1710. ;;
  1711. *.la)
  1712. # A libtool-controlled library.
  1713. if test "$prev" = dlfiles; then
  1714. # This library was specified with -dlopen.
  1715. dlfiles="$dlfiles $arg"
  1716. prev=
  1717. elif test "$prev" = dlprefiles; then
  1718. # The library was specified with -dlpreopen.
  1719. dlprefiles="$dlprefiles $arg"
  1720. prev=
  1721. else
  1722. deplibs="$deplibs $arg"
  1723. fi
  1724. continue
  1725. ;;
  1726. # Some other compiler argument.
  1727. *)
  1728. # Unknown arguments in both finalize_command and compile_command need
  1729. # to be aesthetically quoted because they are evaled later.
  1730. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1731. case $arg in
  1732. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1733. arg="\"$arg\""
  1734. ;;
  1735. esac
  1736. ;;
  1737. esac # arg
  1738. # Now actually substitute the argument into the commands.
  1739. if test -n "$arg"; then
  1740. compile_command="$compile_command $arg"
  1741. finalize_command="$finalize_command $arg"
  1742. fi
  1743. done # argument parsing loop
  1744. if test -n "$prev"; then
  1745. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1746. $echo "$help" 1>&2
  1747. exit $EXIT_FAILURE
  1748. fi
  1749. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1750. eval arg=\"$export_dynamic_flag_spec\"
  1751. compile_command="$compile_command $arg"
  1752. finalize_command="$finalize_command $arg"
  1753. fi
  1754. oldlibs=
  1755. # calculate the name of the file, without its directory
  1756. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1757. libobjs_save="$libobjs"
  1758. if test -n "$shlibpath_var"; then
  1759. # get the directories listed in $shlibpath_var
  1760. eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1761. else
  1762. shlib_search_path=
  1763. fi
  1764. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1765. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1766. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1767. if test "X$output_objdir" = "X$output"; then
  1768. output_objdir="$objdir"
  1769. else
  1770. output_objdir="$output_objdir/$objdir"
  1771. fi
  1772. # Create the object directory.
  1773. if test ! -d "$output_objdir"; then
  1774. $show "$mkdir $output_objdir"
  1775. $run $mkdir $output_objdir
  1776. exit_status=$?
  1777. if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
  1778. exit $exit_status
  1779. fi
  1780. fi
  1781. # Determine the type of output
  1782. case $output in
  1783. "")
  1784. $echo "$modename: you must specify an output file" 1>&2
  1785. $echo "$help" 1>&2
  1786. exit $EXIT_FAILURE
  1787. ;;
  1788. *.$libext) linkmode=oldlib ;;
  1789. *.lo | *.$objext) linkmode=obj ;;
  1790. *.la) linkmode=lib ;;
  1791. *) linkmode=prog ;; # Anything else should be a program.
  1792. esac
  1793. case $host in
  1794. *cygwin* | *mingw* | *pw32*)
  1795. # don't eliminate duplications in $postdeps and $predeps
  1796. duplicate_compiler_generated_deps=yes
  1797. ;;
  1798. *)
  1799. duplicate_compiler_generated_deps=$duplicate_deps
  1800. ;;
  1801. esac
  1802. specialdeplibs=
  1803. libs=
  1804. # Find all interdependent deplibs by searching for libraries
  1805. # that are linked more than once (e.g. -la -lb -la)
  1806. for deplib in $deplibs; do
  1807. if test "X$duplicate_deps" = "Xyes" ; then
  1808. case "$libs " in
  1809. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1810. esac
  1811. fi
  1812. libs="$libs $deplib"
  1813. done
  1814. if test "$linkmode" = lib; then
  1815. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1816. # Compute libraries that are listed more than once in $predeps
  1817. # $postdeps and mark them as special (i.e., whose duplicates are
  1818. # not to be eliminated).
  1819. pre_post_deps=
  1820. if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1821. for pre_post_dep in $predeps $postdeps; do
  1822. case "$pre_post_deps " in
  1823. *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1824. esac
  1825. pre_post_deps="$pre_post_deps $pre_post_dep"
  1826. done
  1827. fi
  1828. pre_post_deps=
  1829. fi
  1830. deplibs=
  1831. newdependency_libs=
  1832. newlib_search_path=
  1833. need_relink=no # whether we're linking any uninstalled libtool libraries
  1834. notinst_deplibs= # not-installed libtool libraries
  1835. case $linkmode in
  1836. lib)
  1837. passes="conv link"
  1838. for file in $dlfiles $dlprefiles; do
  1839. case $file in
  1840. *.la) ;;
  1841. *)
  1842. $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1843. exit $EXIT_FAILURE
  1844. ;;
  1845. esac
  1846. done
  1847. ;;
  1848. prog)
  1849. compile_deplibs=
  1850. finalize_deplibs=
  1851. alldeplibs=no
  1852. newdlfiles=
  1853. newdlprefiles=
  1854. passes="conv scan dlopen dlpreopen link"
  1855. ;;
  1856. *) passes="conv"
  1857. ;;
  1858. esac
  1859. for pass in $passes; do
  1860. if test "$linkmode,$pass" = "lib,link" ||
  1861. test "$linkmode,$pass" = "prog,scan"; then
  1862. libs="$deplibs"
  1863. deplibs=
  1864. fi
  1865. if test "$linkmode" = prog; then
  1866. case $pass in
  1867. dlopen) libs="$dlfiles" ;;
  1868. dlpreopen) libs="$dlprefiles" ;;
  1869. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1870. esac
  1871. fi
  1872. if test "$pass" = dlopen; then
  1873. # Collect dlpreopened libraries
  1874. save_deplibs="$deplibs"
  1875. deplibs=
  1876. fi
  1877. for deplib in $libs; do
  1878. lib=
  1879. found=no
  1880. case $deplib in
  1881. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1882. if test "$linkmode,$pass" = "prog,link"; then
  1883. compile_deplibs="$deplib $compile_deplibs"
  1884. finalize_deplibs="$deplib $finalize_deplibs"
  1885. else
  1886. compiler_flags="$compiler_flags $deplib"
  1887. fi
  1888. continue
  1889. ;;
  1890. -l*)
  1891. if test "$linkmode" != lib && test "$linkmode" != prog; then
  1892. $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1893. continue
  1894. fi
  1895. name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1896. for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1897. for search_ext in .la $std_shrext .so .a; do
  1898. # Search the libtool library
  1899. lib="$searchdir/lib${name}${search_ext}"
  1900. if test -f "$lib"; then
  1901. if test "$search_ext" = ".la"; then
  1902. found=yes
  1903. else
  1904. found=no
  1905. fi
  1906. break 2
  1907. fi
  1908. done
  1909. done
  1910. if test "$found" != yes; then
  1911. # deplib doesn't seem to be a libtool library
  1912. if test "$linkmode,$pass" = "prog,link"; then
  1913. compile_deplibs="$deplib $compile_deplibs"
  1914. finalize_deplibs="$deplib $finalize_deplibs"
  1915. else
  1916. deplibs="$deplib $deplibs"
  1917. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1918. fi
  1919. continue
  1920. else # deplib is a libtool library
  1921. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1922. # We need to do some special things here, and not later.
  1923. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1924. case " $predeps $postdeps " in
  1925. *" $deplib "*)
  1926. if (${SED} -e '2q' $lib |
  1927. grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1928. library_names=
  1929. old_library=
  1930. case $lib in
  1931. */* | *\\*) . $lib ;;
  1932. *) . ./$lib ;;
  1933. esac
  1934. for l in $old_library $library_names; do
  1935. ll="$l"
  1936. done
  1937. if test "X$ll" = "X$old_library" ; then # only static version available
  1938. found=no
  1939. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1940. test "X$ladir" = "X$lib" && ladir="."
  1941. lib=$ladir/$old_library
  1942. if test "$linkmode,$pass" = "prog,link"; then
  1943. compile_deplibs="$deplib $compile_deplibs"
  1944. finalize_deplibs="$deplib $finalize_deplibs"
  1945. else
  1946. deplibs="$deplib $deplibs"
  1947. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1948. fi
  1949. continue
  1950. fi
  1951. fi
  1952. ;;
  1953. *) ;;
  1954. esac
  1955. fi
  1956. fi
  1957. ;; # -l
  1958. -L*)
  1959. case $linkmode in
  1960. lib)
  1961. deplibs="$deplib $deplibs"
  1962. test "$pass" = conv && continue
  1963. newdependency_libs="$deplib $newdependency_libs"
  1964. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1965. ;;
  1966. prog)
  1967. if test "$pass" = conv; then
  1968. deplibs="$deplib $deplibs"
  1969. continue
  1970. fi
  1971. if test "$pass" = scan; then
  1972. deplibs="$deplib $deplibs"
  1973. else
  1974. compile_deplibs="$deplib $compile_deplibs"
  1975. finalize_deplibs="$deplib $finalize_deplibs"
  1976. fi
  1977. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1978. ;;
  1979. *)
  1980. $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1981. ;;
  1982. esac # linkmode
  1983. continue
  1984. ;; # -L
  1985. -R*)
  1986. if test "$pass" = link; then
  1987. dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1988. # Make sure the xrpath contains only unique directories.
  1989. case "$xrpath " in
  1990. *" $dir "*) ;;
  1991. *) xrpath="$xrpath $dir" ;;
  1992. esac
  1993. fi
  1994. deplibs="$deplib $deplibs"
  1995. continue
  1996. ;;
  1997. *.la) lib="$deplib" ;;
  1998. *.$libext)
  1999. if test "$pass" = conv; then
  2000. deplibs="$deplib $deplibs"
  2001. continue
  2002. fi
  2003. case $linkmode in
  2004. lib)
  2005. valid_a_lib=no
  2006. case $deplibs_check_method in
  2007. match_pattern*)
  2008. set dummy $deplibs_check_method
  2009. match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  2010. if eval $echo \"$deplib\" 2>/dev/null \
  2011. | $SED 10q \
  2012. | $EGREP "$match_pattern_regex" > /dev/null; then
  2013. valid_a_lib=yes
  2014. fi
  2015. ;;
  2016. pass_all)
  2017. valid_a_lib=yes
  2018. ;;
  2019. esac
  2020. if test "$valid_a_lib" != yes; then
  2021. $echo
  2022. $echo "*** Warning: Trying to link with static lib archive $deplib."
  2023. $echo "*** I have the capability to make that library automatically link in when"
  2024. $echo "*** you link to this library. But I can only do this if you have a"
  2025. $echo "*** shared version of the library, which you do not appear to have"
  2026. $echo "*** because the file extensions .$libext of this argument makes me believe"
  2027. $echo "*** that it is just a static archive that I should not used here."
  2028. else
  2029. $echo
  2030. $echo "*** Warning: Linking the shared library $output against the"
  2031. $echo "*** static library $deplib is not portable!"
  2032. deplibs="$deplib $deplibs"
  2033. fi
  2034. continue
  2035. ;;
  2036. prog)
  2037. if test "$pass" != link; then
  2038. deplibs="$deplib $deplibs"
  2039. else
  2040. compile_deplibs="$deplib $compile_deplibs"
  2041. finalize_deplibs="$deplib $finalize_deplibs"
  2042. fi
  2043. continue
  2044. ;;
  2045. esac # linkmode
  2046. ;; # *.$libext
  2047. *.lo | *.$objext)
  2048. if test "$pass" = conv; then
  2049. deplibs="$deplib $deplibs"
  2050. elif test "$linkmode" = prog; then
  2051. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  2052. # If there is no dlopen support or we're linking statically,
  2053. # we need to preload.
  2054. newdlprefiles="$newdlprefiles $deplib"
  2055. compile_deplibs="$deplib $compile_deplibs"
  2056. finalize_deplibs="$deplib $finalize_deplibs"
  2057. else
  2058. newdlfiles="$newdlfiles $deplib"
  2059. fi
  2060. fi
  2061. continue
  2062. ;;
  2063. %DEPLIBS%)
  2064. alldeplibs=yes
  2065. continue
  2066. ;;
  2067. esac # case $deplib
  2068. if test "$found" = yes || test -f "$lib"; then :
  2069. else
  2070. $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
  2071. exit $EXIT_FAILURE
  2072. fi
  2073. # Check to see that this really is a libtool archive.
  2074. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  2075. else
  2076. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  2077. exit $EXIT_FAILURE
  2078. fi
  2079. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  2080. test "X$ladir" = "X$lib" && ladir="."
  2081. dlname=
  2082. dlopen=
  2083. dlpreopen=
  2084. libdir=
  2085. library_names=
  2086. old_library=
  2087. # If the library was installed with an old release of libtool,
  2088. # it will not redefine variables installed, or shouldnotlink
  2089. installed=yes
  2090. shouldnotlink=no
  2091. avoidtemprpath=
  2092. # Read the .la file
  2093. case $lib in
  2094. */* | *\\*) . $lib ;;
  2095. *) . ./$lib ;;
  2096. esac
  2097. if test "$linkmode,$pass" = "lib,link" ||
  2098. test "$linkmode,$pass" = "prog,scan" ||
  2099. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  2100. test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  2101. test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  2102. fi
  2103. if test "$pass" = conv; then
  2104. # Only check for convenience libraries
  2105. deplibs="$lib $deplibs"
  2106. if test -z "$libdir"; then
  2107. if test -z "$old_library"; then
  2108. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  2109. exit $EXIT_FAILURE
  2110. fi
  2111. # It is a libtool convenience library, so add in its objects.
  2112. convenience="$convenience $ladir/$objdir/$old_library"
  2113. old_convenience="$old_convenience $ladir/$objdir/$old_library"
  2114. tmp_libs=
  2115. for deplib in $dependency_libs; do
  2116. deplibs="$deplib $deplibs"
  2117. if test "X$duplicate_deps" = "Xyes" ; then
  2118. case "$tmp_libs " in
  2119. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2120. esac
  2121. fi
  2122. tmp_libs="$tmp_libs $deplib"
  2123. done
  2124. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  2125. $echo "$modename: \`$lib' is not a convenience library" 1>&2
  2126. exit $EXIT_FAILURE
  2127. fi
  2128. continue
  2129. fi # $pass = conv
  2130. # Get the name of the library we link against.
  2131. linklib=
  2132. for l in $old_library $library_names; do
  2133. linklib="$l"
  2134. done
  2135. if test -z "$linklib"; then
  2136. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  2137. exit $EXIT_FAILURE
  2138. fi
  2139. # This library was specified with -dlopen.
  2140. if test "$pass" = dlopen; then
  2141. if test -z "$libdir"; then
  2142. $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  2143. exit $EXIT_FAILURE
  2144. fi
  2145. if test -z "$dlname" ||
  2146. test "$dlopen_support" != yes ||
  2147. test "$build_libtool_libs" = no; then
  2148. # If there is no dlname, no dlopen support or we're linking
  2149. # statically, we need to preload. We also need to preload any
  2150. # dependent libraries so libltdl's deplib preloader doesn't
  2151. # bomb out in the load deplibs phase.
  2152. dlprefiles="$dlprefiles $lib $dependency_libs"
  2153. else
  2154. newdlfiles="$newdlfiles $lib"
  2155. fi
  2156. continue
  2157. fi # $pass = dlopen
  2158. # We need an absolute path.
  2159. case $ladir in
  2160. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  2161. *)
  2162. abs_ladir=`cd "$ladir" && pwd`
  2163. if test -z "$abs_ladir"; then
  2164. $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  2165. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  2166. abs_ladir="$ladir"
  2167. fi
  2168. ;;
  2169. esac
  2170. laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  2171. # Find the relevant object directory and library name.
  2172. if test "X$installed" = Xyes; then
  2173. if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2174. $echo "$modename: warning: library \`$lib' was moved." 1>&2
  2175. dir="$ladir"
  2176. absdir="$abs_ladir"
  2177. libdir="$abs_ladir"
  2178. else
  2179. dir="$libdir"
  2180. absdir="$libdir"
  2181. fi
  2182. test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
  2183. else
  2184. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2185. dir="$ladir"
  2186. absdir="$abs_ladir"
  2187. # Remove this search path later
  2188. notinst_path="$notinst_path $abs_ladir"
  2189. else
  2190. dir="$ladir/$objdir"
  2191. absdir="$abs_ladir/$objdir"
  2192. # Remove this search path later
  2193. notinst_path="$notinst_path $abs_ladir"
  2194. fi
  2195. fi # $installed = yes
  2196. name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  2197. # This library was specified with -dlpreopen.
  2198. if test "$pass" = dlpreopen; then
  2199. if test -z "$libdir"; then
  2200. $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  2201. exit $EXIT_FAILURE
  2202. fi
  2203. # Prefer using a static library (so that no silly _DYNAMIC symbols
  2204. # are required to link).
  2205. if test -n "$old_library"; then
  2206. newdlprefiles="$newdlprefiles $dir/$old_library"
  2207. # Otherwise, use the dlname, so that lt_dlopen finds it.
  2208. elif test -n "$dlname"; then
  2209. newdlprefiles="$newdlprefiles $dir/$dlname"
  2210. else
  2211. newdlprefiles="$newdlprefiles $dir/$linklib"
  2212. fi
  2213. fi # $pass = dlpreopen
  2214. if test -z "$libdir"; then
  2215. # Link the convenience library
  2216. if test "$linkmode" = lib; then
  2217. deplibs="$dir/$old_library $deplibs"
  2218. elif test "$linkmode,$pass" = "prog,link"; then
  2219. compile_deplibs="$dir/$old_library $compile_deplibs"
  2220. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  2221. else
  2222. deplibs="$lib $deplibs" # used for prog,scan pass
  2223. fi
  2224. continue
  2225. fi
  2226. if test "$linkmode" = prog && test "$pass" != link; then
  2227. newlib_search_path="$newlib_search_path $ladir"
  2228. deplibs="$lib $deplibs"
  2229. linkalldeplibs=no
  2230. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  2231. test "$build_libtool_libs" = no; then
  2232. linkalldeplibs=yes
  2233. fi
  2234. tmp_libs=
  2235. for deplib in $dependency_libs; do
  2236. case $deplib in
  2237. -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  2238. esac
  2239. # Need to link against all dependency_libs?
  2240. if test "$linkalldeplibs" = yes; then
  2241. deplibs="$deplib $deplibs"
  2242. else
  2243. # Need to hardcode shared library paths
  2244. # or/and link against static libraries
  2245. newdependency_libs="$deplib $newdependency_libs"
  2246. fi
  2247. if test "X$duplicate_deps" = "Xyes" ; then
  2248. case "$tmp_libs " in
  2249. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2250. esac
  2251. fi
  2252. tmp_libs="$tmp_libs $deplib"
  2253. done # for deplib
  2254. continue
  2255. fi # $linkmode = prog...
  2256. if test "$linkmode,$pass" = "prog,link"; then
  2257. if test -n "$library_names" &&
  2258. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2259. # We need to hardcode the library path
  2260. if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  2261. # Make sure the rpath contains only unique directories.
  2262. case "$temp_rpath " in
  2263. *" $dir "*) ;;
  2264. *" $absdir "*) ;;
  2265. *) temp_rpath="$temp_rpath $absdir" ;;
  2266. esac
  2267. fi
  2268. # Hardcode the library path.
  2269. # Skip directories that are in the system default run-time
  2270. # search path.
  2271. case " $sys_lib_dlsearch_path " in
  2272. *" $absdir "*) ;;
  2273. *)
  2274. case "$compile_rpath " in
  2275. *" $absdir "*) ;;
  2276. *) compile_rpath="$compile_rpath $absdir"
  2277. esac
  2278. ;;
  2279. esac
  2280. case " $sys_lib_dlsearch_path " in
  2281. *" $libdir "*) ;;
  2282. *)
  2283. case "$finalize_rpath " in
  2284. *" $libdir "*) ;;
  2285. *) finalize_rpath="$finalize_rpath $libdir"
  2286. esac
  2287. ;;
  2288. esac
  2289. fi # $linkmode,$pass = prog,link...
  2290. if test "$alldeplibs" = yes &&
  2291. { test "$deplibs_check_method" = pass_all ||
  2292. { test "$build_libtool_libs" = yes &&
  2293. test -n "$library_names"; }; }; then
  2294. # We only need to search for static libraries
  2295. continue
  2296. fi
  2297. fi
  2298. link_static=no # Whether the deplib will be linked statically
  2299. use_static_libs=$prefer_static_libs
  2300. if test "$use_static_libs" = built && test "$installed" = yes ; then
  2301. use_static_libs=no
  2302. fi
  2303. if test -n "$library_names" &&
  2304. { test "$use_static_libs" = no || test -z "$old_library"; }; then
  2305. if test "$installed" = no; then
  2306. notinst_deplibs="$notinst_deplibs $lib"
  2307. need_relink=yes
  2308. fi
  2309. # This is a shared library
  2310. # Warn about portability, can't link against -module's on
  2311. # some systems (darwin)
  2312. if test "$shouldnotlink" = yes && test "$pass" = link ; then
  2313. $echo
  2314. if test "$linkmode" = prog; then
  2315. $echo "*** Warning: Linking the executable $output against the loadable module"
  2316. else
  2317. $echo "*** Warning: Linking the shared library $output against the loadable module"
  2318. fi
  2319. $echo "*** $linklib is not portable!"
  2320. fi
  2321. if test "$linkmode" = lib &&
  2322. test "$hardcode_into_libs" = yes; then
  2323. # Hardcode the library path.
  2324. # Skip directories that are in the system default run-time
  2325. # search path.
  2326. case " $sys_lib_dlsearch_path " in
  2327. *" $absdir "*) ;;
  2328. *)
  2329. case "$compile_rpath " in
  2330. *" $absdir "*) ;;
  2331. *) compile_rpath="$compile_rpath $absdir"
  2332. esac
  2333. ;;
  2334. esac
  2335. case " $sys_lib_dlsearch_path " in
  2336. *" $libdir "*) ;;
  2337. *)
  2338. case "$finalize_rpath " in
  2339. *" $libdir "*) ;;
  2340. *) finalize_rpath="$finalize_rpath $libdir"
  2341. esac
  2342. ;;
  2343. esac
  2344. fi
  2345. if test -n "$old_archive_from_expsyms_cmds"; then
  2346. # figure out the soname
  2347. set dummy $library_names
  2348. realname="$2"
  2349. shift; shift
  2350. libname=`eval \\$echo \"$libname_spec\"`
  2351. # use dlname if we got it. it's perfectly good, no?
  2352. if test -n "$dlname"; then
  2353. soname="$dlname"
  2354. elif test -n "$soname_spec"; then
  2355. # bleh windows
  2356. case $host in
  2357. *cygwin* | mingw*)
  2358. major=`expr $current - $age`
  2359. versuffix="-$major"
  2360. ;;
  2361. esac
  2362. eval soname=\"$soname_spec\"
  2363. else
  2364. soname="$realname"
  2365. fi
  2366. # Make a new name for the extract_expsyms_cmds to use
  2367. soroot="$soname"
  2368. soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  2369. newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  2370. # If the library has no export list, then create one now
  2371. if test -f "$output_objdir/$soname-def"; then :
  2372. else
  2373. $show "extracting exported symbol list from \`$soname'"
  2374. save_ifs="$IFS"; IFS='~'
  2375. cmds=$extract_expsyms_cmds
  2376. for cmd in $cmds; do
  2377. IFS="$save_ifs"
  2378. eval cmd=\"$cmd\"
  2379. $show "$cmd"
  2380. $run eval "$cmd" || exit $?
  2381. done
  2382. IFS="$save_ifs"
  2383. fi
  2384. # Create $newlib
  2385. if test -f "$output_objdir/$newlib"; then :; else
  2386. $show "generating import library for \`$soname'"
  2387. save_ifs="$IFS"; IFS='~'
  2388. cmds=$old_archive_from_expsyms_cmds
  2389. for cmd in $cmds; do
  2390. IFS="$save_ifs"
  2391. eval cmd=\"$cmd\"
  2392. $show "$cmd"
  2393. $run eval "$cmd" || exit $?
  2394. done
  2395. IFS="$save_ifs"
  2396. fi
  2397. # make sure the library variables are pointing to the new library
  2398. dir=$output_objdir
  2399. linklib=$newlib
  2400. fi # test -n "$old_archive_from_expsyms_cmds"
  2401. if test "$linkmode" = prog || test "$mode" != relink; then
  2402. add_shlibpath=
  2403. add_dir=
  2404. add=
  2405. lib_linked=yes
  2406. case $hardcode_action in
  2407. immediate | unsupported)
  2408. if test "$hardcode_direct" = no; then
  2409. add="$dir/$linklib"
  2410. case $host in
  2411. *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
  2412. *-*-sysv4*uw2*) add_dir="-L$dir" ;;
  2413. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  2414. *-*-unixware7*) add_dir="-L$dir" ;;
  2415. *-*-darwin* )
  2416. # if the lib is a module then we can not link against
  2417. # it, someone is ignoring the new warnings I added
  2418. if /usr/bin/file -L $add 2> /dev/null |
  2419. $EGREP ": [^:]* bundle" >/dev/null ; then
  2420. $echo "** Warning, lib $linklib is a module, not a shared library"
  2421. if test -z "$old_library" ; then
  2422. $echo
  2423. $echo "** And there doesn't seem to be a static archive available"
  2424. $echo "** The link will probably fail, sorry"
  2425. else
  2426. add="$dir/$old_library"
  2427. fi
  2428. fi
  2429. esac
  2430. elif test "$hardcode_minus_L" = no; then
  2431. case $host in
  2432. *-*-sunos*) add_shlibpath="$dir" ;;
  2433. esac
  2434. add_dir="-L$dir"
  2435. add="-l$name"
  2436. elif test "$hardcode_shlibpath_var" = no; then
  2437. add_shlibpath="$dir"
  2438. add="-l$name"
  2439. else
  2440. lib_linked=no
  2441. fi
  2442. ;;
  2443. relink)
  2444. if test "$hardcode_direct" = yes; then
  2445. add="$dir/$linklib"
  2446. elif test "$hardcode_minus_L" = yes; then
  2447. add_dir="-L$dir"
  2448. # Try looking first in the location we're being installed to.
  2449. if test -n "$inst_prefix_dir"; then
  2450. case $libdir in
  2451. [\\/]*)
  2452. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2453. ;;
  2454. esac
  2455. fi
  2456. add="-l$name"
  2457. elif test "$hardcode_shlibpath_var" = yes; then
  2458. add_shlibpath="$dir"
  2459. add="-l$name"
  2460. else
  2461. lib_linked=no
  2462. fi
  2463. ;;
  2464. *) lib_linked=no ;;
  2465. esac
  2466. if test "$lib_linked" != yes; then
  2467. $echo "$modename: configuration error: unsupported hardcode properties"
  2468. exit $EXIT_FAILURE
  2469. fi
  2470. if test -n "$add_shlibpath"; then
  2471. case :$compile_shlibpath: in
  2472. *":$add_shlibpath:"*) ;;
  2473. *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  2474. esac
  2475. fi
  2476. if test "$linkmode" = prog; then
  2477. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  2478. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  2479. else
  2480. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2481. test -n "$add" && deplibs="$add $deplibs"
  2482. if test "$hardcode_direct" != yes && \
  2483. test "$hardcode_minus_L" != yes && \
  2484. test "$hardcode_shlibpath_var" = yes; then
  2485. case :$finalize_shlibpath: in
  2486. *":$libdir:"*) ;;
  2487. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2488. esac
  2489. fi
  2490. fi
  2491. fi
  2492. if test "$linkmode" = prog || test "$mode" = relink; then
  2493. add_shlibpath=
  2494. add_dir=
  2495. add=
  2496. # Finalize command for both is simple: just hardcode it.
  2497. if test "$hardcode_direct" = yes; then
  2498. add="$libdir/$linklib"
  2499. elif test "$hardcode_minus_L" = yes; then
  2500. add_dir="-L$libdir"
  2501. add="-l$name"
  2502. elif test "$hardcode_shlibpath_var" = yes; then
  2503. case :$finalize_shlibpath: in
  2504. *":$libdir:"*) ;;
  2505. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2506. esac
  2507. add="-l$name"
  2508. elif test "$hardcode_automatic" = yes; then
  2509. if test -n "$inst_prefix_dir" &&
  2510. test -f "$inst_prefix_dir$libdir/$linklib" ; then
  2511. add="$inst_prefix_dir$libdir/$linklib"
  2512. else
  2513. add="$libdir/$linklib"
  2514. fi
  2515. else
  2516. # We cannot seem to hardcode it, guess we'll fake it.
  2517. add_dir="-L$libdir"
  2518. # Try looking first in the location we're being installed to.
  2519. if test -n "$inst_prefix_dir"; then
  2520. case $libdir in
  2521. [\\/]*)
  2522. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2523. ;;
  2524. esac
  2525. fi
  2526. add="-l$name"
  2527. fi
  2528. if test "$linkmode" = prog; then
  2529. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  2530. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  2531. else
  2532. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2533. test -n "$add" && deplibs="$add $deplibs"
  2534. fi
  2535. fi
  2536. elif test "$linkmode" = prog; then
  2537. # Here we assume that one of hardcode_direct or hardcode_minus_L
  2538. # is not unsupported. This is valid on all known static and
  2539. # shared platforms.
  2540. if test "$hardcode_direct" != unsupported; then
  2541. test -n "$old_library" && linklib="$old_library"
  2542. compile_deplibs="$dir/$linklib $compile_deplibs"
  2543. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  2544. else
  2545. compile_deplibs="-l$name -L$dir $compile_deplibs"
  2546. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  2547. fi
  2548. elif test "$build_libtool_libs" = yes; then
  2549. # Not a shared library
  2550. if test "$deplibs_check_method" != pass_all; then
  2551. # We're trying link a shared library against a static one
  2552. # but the system doesn't support it.
  2553. # Just print a warning and add the library to dependency_libs so
  2554. # that the program can be linked against the static library.
  2555. $echo
  2556. $echo "*** Warning: This system can not link to static lib archive $lib."
  2557. $echo "*** I have the capability to make that library automatically link in when"
  2558. $echo "*** you link to this library. But I can only do this if you have a"
  2559. $echo "*** shared version of the library, which you do not appear to have."
  2560. if test "$module" = yes; then
  2561. $echo "*** But as you try to build a module library, libtool will still create "
  2562. $echo "*** a static module, that should work as long as the dlopening application"
  2563. $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  2564. if test -z "$global_symbol_pipe"; then
  2565. $echo
  2566. $echo "*** However, this would only work if libtool was able to extract symbol"
  2567. $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2568. $echo "*** not find such a program. So, this module is probably useless."
  2569. $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2570. fi
  2571. if test "$build_old_libs" = no; then
  2572. build_libtool_libs=module
  2573. build_old_libs=yes
  2574. else
  2575. build_libtool_libs=no
  2576. fi
  2577. fi
  2578. else
  2579. deplibs="$dir/$old_library $deplibs"
  2580. link_static=yes
  2581. fi
  2582. fi # link shared/static library?
  2583. if test "$linkmode" = lib; then
  2584. if test -n "$dependency_libs" &&
  2585. { test "$hardcode_into_libs" != yes ||
  2586. test "$build_old_libs" = yes ||
  2587. test "$link_static" = yes; }; then
  2588. # Extract -R from dependency_libs
  2589. temp_deplibs=
  2590. for libdir in $dependency_libs; do
  2591. case $libdir in
  2592. -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  2593. case " $xrpath " in
  2594. *" $temp_xrpath "*) ;;
  2595. *) xrpath="$xrpath $temp_xrpath";;
  2596. esac;;
  2597. *) temp_deplibs="$temp_deplibs $libdir";;
  2598. esac
  2599. done
  2600. dependency_libs="$temp_deplibs"
  2601. fi
  2602. newlib_search_path="$newlib_search_path $absdir"
  2603. # Link against this library
  2604. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  2605. # ... and its dependency_libs
  2606. tmp_libs=
  2607. for deplib in $dependency_libs; do
  2608. newdependency_libs="$deplib $newdependency_libs"
  2609. if test "X$duplicate_deps" = "Xyes" ; then
  2610. case "$tmp_libs " in
  2611. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2612. esac
  2613. fi
  2614. tmp_libs="$tmp_libs $deplib"
  2615. done
  2616. if test "$link_all_deplibs" != no; then
  2617. # Add the search paths of all dependency libraries
  2618. for deplib in $dependency_libs; do
  2619. case $deplib in
  2620. -L*) path="$deplib" ;;
  2621. *.la)
  2622. dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  2623. test "X$dir" = "X$deplib" && dir="."
  2624. # We need an absolute path.
  2625. case $dir in
  2626. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  2627. *)
  2628. absdir=`cd "$dir" && pwd`
  2629. if test -z "$absdir"; then
  2630. $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  2631. absdir="$dir"
  2632. fi
  2633. ;;
  2634. esac
  2635. if grep "^installed=no" $deplib > /dev/null; then
  2636. path="$absdir/$objdir"
  2637. else
  2638. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  2639. if test -z "$libdir"; then
  2640. $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  2641. exit $EXIT_FAILURE
  2642. fi
  2643. if test "$absdir" != "$libdir"; then
  2644. $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  2645. fi
  2646. path="$absdir"
  2647. fi
  2648. depdepl=
  2649. case $host in
  2650. *-*-darwin*)
  2651. # we do not want to link against static libs,
  2652. # but need to link against shared
  2653. eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  2654. if test -n "$deplibrary_names" ; then
  2655. for tmp in $deplibrary_names ; do
  2656. depdepl=$tmp
  2657. done
  2658. if test -f "$path/$depdepl" ; then
  2659. depdepl="$path/$depdepl"
  2660. fi
  2661. # do not add paths which are already there
  2662. case " $newlib_search_path " in
  2663. *" $path "*) ;;
  2664. *) newlib_search_path="$newlib_search_path $path";;
  2665. esac
  2666. fi
  2667. path=""
  2668. ;;
  2669. *)
  2670. path="-L$path"
  2671. ;;
  2672. esac
  2673. ;;
  2674. -l*)
  2675. case $host in
  2676. *-*-darwin*)
  2677. # Again, we only want to link against shared libraries
  2678. eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  2679. for tmp in $newlib_search_path ; do
  2680. if test -f "$tmp/lib$tmp_libs.dylib" ; then
  2681. eval depdepl="$tmp/lib$tmp_libs.dylib"
  2682. break
  2683. fi
  2684. done
  2685. path=""
  2686. ;;
  2687. *) continue ;;
  2688. esac
  2689. ;;
  2690. *) continue ;;
  2691. esac
  2692. case " $deplibs " in
  2693. *" $path "*) ;;
  2694. *) deplibs="$path $deplibs" ;;
  2695. esac
  2696. case " $deplibs " in
  2697. *" $depdepl "*) ;;
  2698. *) deplibs="$depdepl $deplibs" ;;
  2699. esac
  2700. done
  2701. fi # link_all_deplibs != no
  2702. fi # linkmode = lib
  2703. done # for deplib in $libs
  2704. dependency_libs="$newdependency_libs"
  2705. if test "$pass" = dlpreopen; then
  2706. # Link the dlpreopened libraries before other libraries
  2707. for deplib in $save_deplibs; do
  2708. deplibs="$deplib $deplibs"
  2709. done
  2710. fi
  2711. if test "$pass" != dlopen; then
  2712. if test "$pass" != conv; then
  2713. # Make sure lib_search_path contains only unique directories.
  2714. lib_search_path=
  2715. for dir in $newlib_search_path; do
  2716. case "$lib_search_path " in
  2717. *" $dir "*) ;;
  2718. *) lib_search_path="$lib_search_path $dir" ;;
  2719. esac
  2720. done
  2721. newlib_search_path=
  2722. fi
  2723. if test "$linkmode,$pass" != "prog,link"; then
  2724. vars="deplibs"
  2725. else
  2726. vars="compile_deplibs finalize_deplibs"
  2727. fi
  2728. for var in $vars dependency_libs; do
  2729. # Add libraries to $var in reverse order
  2730. eval tmp_libs=\"\$$var\"
  2731. new_libs=
  2732. for deplib in $tmp_libs; do
  2733. # FIXME: Pedantically, this is the right thing to do, so
  2734. # that some nasty dependency loop isn't accidentally
  2735. # broken:
  2736. #new_libs="$deplib $new_libs"
  2737. # Pragmatically, this seems to cause very few problems in
  2738. # practice:
  2739. case $deplib in
  2740. -L*) new_libs="$deplib $new_libs" ;;
  2741. -R*) ;;
  2742. *)
  2743. # And here is the reason: when a library appears more
  2744. # than once as an explicit dependence of a library, or
  2745. # is implicitly linked in more than once by the
  2746. # compiler, it is considered special, and multiple
  2747. # occurrences thereof are not removed. Compare this
  2748. # with having the same library being listed as a
  2749. # dependency of multiple other libraries: in this case,
  2750. # we know (pedantically, we assume) the library does not
  2751. # need to be listed more than once, so we keep only the
  2752. # last copy. This is not always right, but it is rare
  2753. # enough that we require users that really mean to play
  2754. # such unportable linking tricks to link the library
  2755. # using -Wl,-lname, so that libtool does not consider it
  2756. # for duplicate removal.
  2757. case " $specialdeplibs " in
  2758. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  2759. *)
  2760. case " $new_libs " in
  2761. *" $deplib "*) ;;
  2762. *) new_libs="$deplib $new_libs" ;;
  2763. esac
  2764. ;;
  2765. esac
  2766. ;;
  2767. esac
  2768. done
  2769. tmp_libs=
  2770. for deplib in $new_libs; do
  2771. case $deplib in
  2772. -L*)
  2773. case " $tmp_libs " in
  2774. *" $deplib "*) ;;
  2775. *) tmp_libs="$tmp_libs $deplib" ;;
  2776. esac
  2777. ;;
  2778. *) tmp_libs="$tmp_libs $deplib" ;;
  2779. esac
  2780. done
  2781. eval $var=\"$tmp_libs\"
  2782. done # for var
  2783. fi
  2784. # Last step: remove runtime libs from dependency_libs
  2785. # (they stay in deplibs)
  2786. tmp_libs=
  2787. for i in $dependency_libs ; do
  2788. case " $predeps $postdeps $compiler_lib_search_path " in
  2789. *" $i "*)
  2790. i=""
  2791. ;;
  2792. esac
  2793. if test -n "$i" ; then
  2794. tmp_libs="$tmp_libs $i"
  2795. fi
  2796. done
  2797. dependency_libs=$tmp_libs
  2798. done # for pass
  2799. if test "$linkmode" = prog; then
  2800. dlfiles="$newdlfiles"
  2801. dlprefiles="$newdlprefiles"
  2802. fi
  2803. case $linkmode in
  2804. oldlib)
  2805. if test -n "$deplibs"; then
  2806. $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  2807. fi
  2808. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2809. $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  2810. fi
  2811. if test -n "$rpath"; then
  2812. $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  2813. fi
  2814. if test -n "$xrpath"; then
  2815. $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  2816. fi
  2817. if test -n "$vinfo"; then
  2818. $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
  2819. fi
  2820. if test -n "$release"; then
  2821. $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  2822. fi
  2823. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  2824. $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  2825. fi
  2826. # Now set the variables for building old libraries.
  2827. build_libtool_libs=no
  2828. oldlibs="$output"
  2829. objs="$objs$old_deplibs"
  2830. ;;
  2831. lib)
  2832. # Make sure we only generate libraries of the form `libNAME.la'.
  2833. case $outputname in
  2834. lib*)
  2835. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  2836. eval shared_ext=\"$shrext_cmds\"
  2837. eval libname=\"$libname_spec\"
  2838. ;;
  2839. *)
  2840. if test "$module" = no; then
  2841. $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  2842. $echo "$help" 1>&2
  2843. exit $EXIT_FAILURE
  2844. fi
  2845. if test "$need_lib_prefix" != no; then
  2846. # Add the "lib" prefix for modules if required
  2847. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  2848. eval shared_ext=\"$shrext_cmds\"
  2849. eval libname=\"$libname_spec\"
  2850. else
  2851. libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  2852. fi
  2853. ;;
  2854. esac
  2855. if test -n "$objs"; then
  2856. if test "$deplibs_check_method" != pass_all; then
  2857. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  2858. exit $EXIT_FAILURE
  2859. else
  2860. $echo
  2861. $echo "*** Warning: Linking the shared library $output against the non-libtool"
  2862. $echo "*** objects $objs is not portable!"
  2863. libobjs="$libobjs $objs"
  2864. fi
  2865. fi
  2866. if test "$dlself" != no; then
  2867. $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  2868. fi
  2869. set dummy $rpath
  2870. if test "$#" -gt 2; then
  2871. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  2872. fi
  2873. install_libdir="$2"
  2874. oldlibs=
  2875. if test -z "$rpath"; then
  2876. if test "$build_libtool_libs" = yes; then
  2877. # Building a libtool convenience library.
  2878. # Some compilers have problems with a `.al' extension so
  2879. # convenience libraries should have the same extension an
  2880. # archive normally would.
  2881. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  2882. build_libtool_libs=convenience
  2883. build_old_libs=yes
  2884. fi
  2885. if test -n "$vinfo"; then
  2886. $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
  2887. fi
  2888. if test -n "$release"; then
  2889. $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  2890. fi
  2891. else
  2892. # Parse the version information argument.
  2893. save_ifs="$IFS"; IFS=':'
  2894. set dummy $vinfo 0 0 0
  2895. IFS="$save_ifs"
  2896. if test -n "$8"; then
  2897. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  2898. $echo "$help" 1>&2
  2899. exit $EXIT_FAILURE
  2900. fi
  2901. # convert absolute version numbers to libtool ages
  2902. # this retains compatibility with .la files and attempts
  2903. # to make the code below a bit more comprehensible
  2904. case $vinfo_number in
  2905. yes)
  2906. number_major="$2"
  2907. number_minor="$3"
  2908. number_revision="$4"
  2909. #
  2910. # There are really only two kinds -- those that
  2911. # use the current revision as the major version
  2912. # and those that subtract age and use age as
  2913. # a minor version. But, then there is irix
  2914. # which has an extra 1 added just for fun
  2915. #
  2916. case $version_type in
  2917. darwin|linux|osf|windows)
  2918. current=`expr $number_major + $number_minor`
  2919. age="$number_minor"
  2920. revision="$number_revision"
  2921. ;;
  2922. freebsd-aout|freebsd-elf|sunos)
  2923. current="$number_major"
  2924. revision="$number_minor"
  2925. age="0"
  2926. ;;
  2927. irix|nonstopux)
  2928. current=`expr $number_major + $number_minor - 1`
  2929. age="$number_minor"
  2930. revision="$number_minor"
  2931. ;;
  2932. esac
  2933. ;;
  2934. no)
  2935. current="$2"
  2936. revision="$3"
  2937. age="$4"
  2938. ;;
  2939. esac
  2940. # Check that each of the things are valid numbers.
  2941. case $current in
  2942. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  2943. *)
  2944. $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
  2945. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2946. exit $EXIT_FAILURE
  2947. ;;
  2948. esac
  2949. case $revision in
  2950. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  2951. *)
  2952. $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
  2953. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2954. exit $EXIT_FAILURE
  2955. ;;
  2956. esac
  2957. case $age in
  2958. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  2959. *)
  2960. $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
  2961. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2962. exit $EXIT_FAILURE
  2963. ;;
  2964. esac
  2965. if test "$age" -gt "$current"; then
  2966. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  2967. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2968. exit $EXIT_FAILURE
  2969. fi
  2970. # Calculate the version variables.
  2971. major=
  2972. versuffix=
  2973. verstring=
  2974. case $version_type in
  2975. none) ;;
  2976. darwin)
  2977. # Like Linux, but with the current version available in
  2978. # verstring for coding it into the library header
  2979. major=.`expr $current - $age`
  2980. versuffix="$major.$age.$revision"
  2981. # Darwin ld doesn't like 0 for these options...
  2982. minor_current=`expr $current + 1`
  2983. verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  2984. ;;
  2985. freebsd-aout)
  2986. major=".$current"
  2987. versuffix=".$current.$revision";
  2988. ;;
  2989. freebsd-elf)
  2990. major=".$current"
  2991. versuffix=".$current";
  2992. ;;
  2993. irix | nonstopux)
  2994. major=`expr $current - $age + 1`
  2995. case $version_type in
  2996. nonstopux) verstring_prefix=nonstopux ;;
  2997. *) verstring_prefix=sgi ;;
  2998. esac
  2999. verstring="$verstring_prefix$major.$revision"
  3000. # Add in all the interfaces that we are compatible with.
  3001. loop=$revision
  3002. while test "$loop" -ne 0; do
  3003. iface=`expr $revision - $loop`
  3004. loop=`expr $loop - 1`
  3005. verstring="$verstring_prefix$major.$iface:$verstring"
  3006. done
  3007. # Before this point, $major must not contain `.'.
  3008. major=.$major
  3009. versuffix="$major.$revision"
  3010. ;;
  3011. linux)
  3012. major=.`expr $current - $age`
  3013. versuffix="$major.$age.$revision"
  3014. ;;
  3015. osf)
  3016. major=.`expr $current - $age`
  3017. versuffix=".$current.$age.$revision"
  3018. verstring="$current.$age.$revision"
  3019. # Add in all the interfaces that we are compatible with.
  3020. loop=$age
  3021. while test "$loop" -ne 0; do
  3022. iface=`expr $current - $loop`
  3023. loop=`expr $loop - 1`
  3024. verstring="$verstring:${iface}.0"
  3025. done
  3026. # Make executables depend on our current version.
  3027. verstring="$verstring:${current}.0"
  3028. ;;
  3029. sunos)
  3030. major=".$current"
  3031. versuffix=".$current.$revision"
  3032. ;;
  3033. windows)
  3034. # Use '-' rather than '.', since we only want one
  3035. # extension on DOS 8.3 filesystems.
  3036. major=`expr $current - $age`
  3037. versuffix="-$major"
  3038. ;;
  3039. *)
  3040. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  3041. $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  3042. exit $EXIT_FAILURE
  3043. ;;
  3044. esac
  3045. # Clear the version info if we defaulted, and they specified a release.
  3046. if test -z "$vinfo" && test -n "$release"; then
  3047. major=
  3048. case $version_type in
  3049. darwin)
  3050. # we can't check for "0.0" in archive_cmds due to quoting
  3051. # problems, so we reset it completely
  3052. verstring=
  3053. ;;
  3054. *)
  3055. verstring="0.0"
  3056. ;;
  3057. esac
  3058. if test "$need_version" = no; then
  3059. versuffix=
  3060. else
  3061. versuffix=".0.0"
  3062. fi
  3063. fi
  3064. # Remove version info from name if versioning should be avoided
  3065. if test "$avoid_version" = yes && test "$need_version" = no; then
  3066. major=
  3067. versuffix=
  3068. verstring=""
  3069. fi
  3070. # Check to see if the archive will have undefined symbols.
  3071. if test "$allow_undefined" = yes; then
  3072. if test "$allow_undefined_flag" = unsupported; then
  3073. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  3074. build_libtool_libs=no
  3075. build_old_libs=yes
  3076. fi
  3077. else
  3078. # Don't allow undefined symbols.
  3079. allow_undefined_flag="$no_undefined_flag"
  3080. fi
  3081. fi
  3082. if test "$mode" != relink; then
  3083. # Remove our outputs, but don't remove object files since they
  3084. # may have been created when compiling PIC objects.
  3085. removelist=
  3086. tempremovelist=`$echo "$output_objdir/*"`
  3087. for p in $tempremovelist; do
  3088. case $p in
  3089. *.$objext)
  3090. ;;
  3091. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  3092. if test "X$precious_files_regex" != "X"; then
  3093. if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  3094. then
  3095. continue
  3096. fi
  3097. fi
  3098. removelist="$removelist $p"
  3099. ;;
  3100. *) ;;
  3101. esac
  3102. done
  3103. if test -n "$removelist"; then
  3104. $show "${rm}r $removelist"
  3105. $run ${rm}r $removelist
  3106. fi
  3107. fi
  3108. # Now set the variables for building old libraries.
  3109. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  3110. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  3111. # Transform .lo files to .o files.
  3112. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  3113. fi
  3114. # Eliminate all temporary directories.
  3115. for path in $notinst_path; do
  3116. lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
  3117. deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
  3118. dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
  3119. done
  3120. if test -n "$xrpath"; then
  3121. # If the user specified any rpath flags, then add them.
  3122. temp_xrpath=
  3123. for libdir in $xrpath; do
  3124. temp_xrpath="$temp_xrpath -R$libdir"
  3125. case "$finalize_rpath " in
  3126. *" $libdir "*) ;;
  3127. *) finalize_rpath="$finalize_rpath $libdir" ;;
  3128. esac
  3129. done
  3130. if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  3131. dependency_libs="$temp_xrpath $dependency_libs"
  3132. fi
  3133. fi
  3134. # Make sure dlfiles contains only unique files that won't be dlpreopened
  3135. old_dlfiles="$dlfiles"
  3136. dlfiles=
  3137. for lib in $old_dlfiles; do
  3138. case " $dlprefiles $dlfiles " in
  3139. *" $lib "*) ;;
  3140. *) dlfiles="$dlfiles $lib" ;;
  3141. esac
  3142. done
  3143. # Make sure dlprefiles contains only unique files
  3144. old_dlprefiles="$dlprefiles"
  3145. dlprefiles=
  3146. for lib in $old_dlprefiles; do
  3147. case "$dlprefiles " in
  3148. *" $lib "*) ;;
  3149. *) dlprefiles="$dlprefiles $lib" ;;
  3150. esac
  3151. done
  3152. if test "$build_libtool_libs" = yes; then
  3153. if test -n "$rpath"; then
  3154. case $host in
  3155. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  3156. # these systems don't actually have a c library (as such)!
  3157. ;;
  3158. *-*-rhapsody* | *-*-darwin1.[012])
  3159. # Rhapsody C library is in the System framework
  3160. deplibs="$deplibs -framework System"
  3161. ;;
  3162. *-*-netbsd*)
  3163. # Don't link with libc until the a.out ld.so is fixed.
  3164. ;;
  3165. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  3166. # Do not include libc due to us having libc/libc_r.
  3167. ;;
  3168. *-*-sco3.2v5* | *-*-sco5v6*)
  3169. # Causes problems with __ctype
  3170. ;;
  3171. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  3172. # Compiler inserts libc in the correct place for threads to work
  3173. ;;
  3174. *)
  3175. # Add libc to deplibs on all other systems if necessary.
  3176. if test "$build_libtool_need_lc" = "yes"; then
  3177. deplibs="$deplibs -lc"
  3178. fi
  3179. ;;
  3180. esac
  3181. fi
  3182. # Transform deplibs into only deplibs that can be linked in shared.
  3183. name_save=$name
  3184. libname_save=$libname
  3185. release_save=$release
  3186. versuffix_save=$versuffix
  3187. major_save=$major
  3188. # I'm not sure if I'm treating the release correctly. I think
  3189. # release should show up in the -l (ie -lgmp5) so we don't want to
  3190. # add it in twice. Is that correct?
  3191. release=""
  3192. versuffix=""
  3193. major=""
  3194. newdeplibs=
  3195. droppeddeps=no
  3196. case $deplibs_check_method in
  3197. pass_all)
  3198. # Don't check for shared/static. Everything works.
  3199. # This might be a little naive. We might want to check
  3200. # whether the library exists or not. But this is on
  3201. # osf3 & osf4 and I'm not really sure... Just
  3202. # implementing what was already the behavior.
  3203. newdeplibs=$deplibs
  3204. ;;
  3205. test_compile)
  3206. # This code stresses the "libraries are programs" paradigm to its
  3207. # limits. Maybe even breaks it. We compile a program, linking it
  3208. # against the deplibs as a proxy for the library. Then we can check
  3209. # whether they linked in statically or dynamically with ldd.
  3210. $rm conftest.c
  3211. cat > conftest.c <<EOF
  3212. int main() { return 0; }
  3213. EOF
  3214. $rm conftest
  3215. $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
  3216. if test "$?" -eq 0 ; then
  3217. ldd_output=`ldd conftest`
  3218. for i in $deplibs; do
  3219. name=`expr $i : '-l\(.*\)'`
  3220. # If $name is empty we are operating on a -L argument.
  3221. if test "$name" != "" && test "$name" -ne "0"; then
  3222. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3223. case " $predeps $postdeps " in
  3224. *" $i "*)
  3225. newdeplibs="$newdeplibs $i"
  3226. i=""
  3227. ;;
  3228. esac
  3229. fi
  3230. if test -n "$i" ; then
  3231. libname=`eval \\$echo \"$libname_spec\"`
  3232. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3233. set dummy $deplib_matches
  3234. deplib_match=$2
  3235. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3236. newdeplibs="$newdeplibs $i"
  3237. else
  3238. droppeddeps=yes
  3239. $echo
  3240. $echo "*** Warning: dynamic linker does not accept needed library $i."
  3241. $echo "*** I have the capability to make that library automatically link in when"
  3242. $echo "*** you link to this library. But I can only do this if you have a"
  3243. $echo "*** shared version of the library, which I believe you do not have"
  3244. $echo "*** because a test_compile did reveal that the linker did not use it for"
  3245. $echo "*** its dynamic dependency list that programs get resolved with at runtime."
  3246. fi
  3247. fi
  3248. else
  3249. newdeplibs="$newdeplibs $i"
  3250. fi
  3251. done
  3252. else
  3253. # Error occurred in the first compile. Let's try to salvage
  3254. # the situation: Compile a separate program for each library.
  3255. for i in $deplibs; do
  3256. name=`expr $i : '-l\(.*\)'`
  3257. # If $name is empty we are operating on a -L argument.
  3258. if test "$name" != "" && test "$name" != "0"; then
  3259. $rm conftest
  3260. $LTCC $LTCFLAGS -o conftest conftest.c $i
  3261. # Did it work?
  3262. if test "$?" -eq 0 ; then
  3263. ldd_output=`ldd conftest`
  3264. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3265. case " $predeps $postdeps " in
  3266. *" $i "*)
  3267. newdeplibs="$newdeplibs $i"
  3268. i=""
  3269. ;;
  3270. esac
  3271. fi
  3272. if test -n "$i" ; then
  3273. libname=`eval \\$echo \"$libname_spec\"`
  3274. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3275. set dummy $deplib_matches
  3276. deplib_match=$2
  3277. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3278. newdeplibs="$newdeplibs $i"
  3279. else
  3280. droppeddeps=yes
  3281. $echo
  3282. $echo "*** Warning: dynamic linker does not accept needed library $i."
  3283. $echo "*** I have the capability to make that library automatically link in when"
  3284. $echo "*** you link to this library. But I can only do this if you have a"
  3285. $echo "*** shared version of the library, which you do not appear to have"
  3286. $echo "*** because a test_compile did reveal that the linker did not use this one"
  3287. $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  3288. fi
  3289. fi
  3290. else
  3291. droppeddeps=yes
  3292. $echo
  3293. $echo "*** Warning! Library $i is needed by this library but I was not able to"
  3294. $echo "*** make it link in! You will probably need to install it or some"
  3295. $echo "*** library that it depends on before this library will be fully"
  3296. $echo "*** functional. Installing it before continuing would be even better."
  3297. fi
  3298. else
  3299. newdeplibs="$newdeplibs $i"
  3300. fi
  3301. done
  3302. fi
  3303. ;;
  3304. file_magic*)
  3305. set dummy $deplibs_check_method
  3306. file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3307. for a_deplib in $deplibs; do
  3308. name=`expr $a_deplib : '-l\(.*\)'`
  3309. # If $name is empty we are operating on a -L argument.
  3310. if test "$name" != "" && test "$name" != "0"; then
  3311. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3312. case " $predeps $postdeps " in
  3313. *" $a_deplib "*)
  3314. newdeplibs="$newdeplibs $a_deplib"
  3315. a_deplib=""
  3316. ;;
  3317. esac
  3318. fi
  3319. if test -n "$a_deplib" ; then
  3320. libname=`eval \\$echo \"$libname_spec\"`
  3321. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3322. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3323. for potent_lib in $potential_libs; do
  3324. # Follow soft links.
  3325. if ls -lLd "$potent_lib" 2>/dev/null \
  3326. | grep " -> " >/dev/null; then
  3327. continue
  3328. fi
  3329. # The statement above tries to avoid entering an
  3330. # endless loop below, in case of cyclic links.
  3331. # We might still enter an endless loop, since a link
  3332. # loop can be closed while we follow links,
  3333. # but so what?
  3334. potlib="$potent_lib"
  3335. while test -h "$potlib" 2>/dev/null; do
  3336. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  3337. case $potliblink in
  3338. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  3339. *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  3340. esac
  3341. done
  3342. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  3343. | ${SED} 10q \
  3344. | $EGREP "$file_magic_regex" > /dev/null; then
  3345. newdeplibs="$newdeplibs $a_deplib"
  3346. a_deplib=""
  3347. break 2
  3348. fi
  3349. done
  3350. done
  3351. fi
  3352. if test -n "$a_deplib" ; then
  3353. droppeddeps=yes
  3354. $echo
  3355. $echo "*** Warning: linker path does not have real file for library $a_deplib."
  3356. $echo "*** I have the capability to make that library automatically link in when"
  3357. $echo "*** you link to this library. But I can only do this if you have a"
  3358. $echo "*** shared version of the library, which you do not appear to have"
  3359. $echo "*** because I did check the linker path looking for a file starting"
  3360. if test -z "$potlib" ; then
  3361. $echo "*** with $libname but no candidates were found. (...for file magic test)"
  3362. else
  3363. $echo "*** with $libname and none of the candidates passed a file format test"
  3364. $echo "*** using a file magic. Last file checked: $potlib"
  3365. fi
  3366. fi
  3367. else
  3368. # Add a -L argument.
  3369. newdeplibs="$newdeplibs $a_deplib"
  3370. fi
  3371. done # Gone through all deplibs.
  3372. ;;
  3373. match_pattern*)
  3374. set dummy $deplibs_check_method
  3375. match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3376. for a_deplib in $deplibs; do
  3377. name=`expr $a_deplib : '-l\(.*\)'`
  3378. # If $name is empty we are operating on a -L argument.
  3379. if test -n "$name" && test "$name" != "0"; then
  3380. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3381. case " $predeps $postdeps " in
  3382. *" $a_deplib "*)
  3383. newdeplibs="$newdeplibs $a_deplib"
  3384. a_deplib=""
  3385. ;;
  3386. esac
  3387. fi
  3388. if test -n "$a_deplib" ; then
  3389. libname=`eval \\$echo \"$libname_spec\"`
  3390. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3391. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3392. for potent_lib in $potential_libs; do
  3393. potlib="$potent_lib" # see symlink-check above in file_magic test
  3394. if eval $echo \"$potent_lib\" 2>/dev/null \
  3395. | ${SED} 10q \
  3396. | $EGREP "$match_pattern_regex" > /dev/null; then
  3397. newdeplibs="$newdeplibs $a_deplib"
  3398. a_deplib=""
  3399. break 2
  3400. fi
  3401. done
  3402. done
  3403. fi
  3404. if test -n "$a_deplib" ; then
  3405. droppeddeps=yes
  3406. $echo
  3407. $echo "*** Warning: linker path does not have real file for library $a_deplib."
  3408. $echo "*** I have the capability to make that library automatically link in when"
  3409. $echo "*** you link to this library. But I can only do this if you have a"
  3410. $echo "*** shared version of the library, which you do not appear to have"
  3411. $echo "*** because I did check the linker path looking for a file starting"
  3412. if test -z "$potlib" ; then
  3413. $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  3414. else
  3415. $echo "*** with $libname and none of the candidates passed a file format test"
  3416. $echo "*** using a regex pattern. Last file checked: $potlib"
  3417. fi
  3418. fi
  3419. else
  3420. # Add a -L argument.
  3421. newdeplibs="$newdeplibs $a_deplib"
  3422. fi
  3423. done # Gone through all deplibs.
  3424. ;;
  3425. none | unknown | *)
  3426. newdeplibs=""
  3427. tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  3428. -e 's/ -[LR][^ ]*//g'`
  3429. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3430. for i in $predeps $postdeps ; do
  3431. # can't use Xsed below, because $i might contain '/'
  3432. tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
  3433. done
  3434. fi
  3435. if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
  3436. | grep . >/dev/null; then
  3437. $echo
  3438. if test "X$deplibs_check_method" = "Xnone"; then
  3439. $echo "*** Warning: inter-library dependencies are not supported in this platform."
  3440. else
  3441. $echo "*** Warning: inter-library dependencies are not known to be supported."
  3442. fi
  3443. $echo "*** All declared inter-library dependencies are being dropped."
  3444. droppeddeps=yes
  3445. fi
  3446. ;;
  3447. esac
  3448. versuffix=$versuffix_save
  3449. major=$major_save
  3450. release=$release_save
  3451. libname=$libname_save
  3452. name=$name_save
  3453. case $host in
  3454. *-*-rhapsody* | *-*-darwin1.[012])
  3455. # On Rhapsody replace the C library is the System framework
  3456. newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3457. ;;
  3458. esac
  3459. if test "$droppeddeps" = yes; then
  3460. if test "$module" = yes; then
  3461. $echo
  3462. $echo "*** Warning: libtool could not satisfy all declared inter-library"
  3463. $echo "*** dependencies of module $libname. Therefore, libtool will create"
  3464. $echo "*** a static module, that should work as long as the dlopening"
  3465. $echo "*** application is linked with the -dlopen flag."
  3466. if test -z "$global_symbol_pipe"; then
  3467. $echo
  3468. $echo "*** However, this would only work if libtool was able to extract symbol"
  3469. $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  3470. $echo "*** not find such a program. So, this module is probably useless."
  3471. $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  3472. fi
  3473. if test "$build_old_libs" = no; then
  3474. oldlibs="$output_objdir/$libname.$libext"
  3475. build_libtool_libs=module
  3476. build_old_libs=yes
  3477. else
  3478. build_libtool_libs=no
  3479. fi
  3480. else
  3481. $echo "*** The inter-library dependencies that have been dropped here will be"
  3482. $echo "*** automatically added whenever a program is linked with this library"
  3483. $echo "*** or is declared to -dlopen it."
  3484. if test "$allow_undefined" = no; then
  3485. $echo
  3486. $echo "*** Since this library must not contain undefined symbols,"
  3487. $echo "*** because either the platform does not support them or"
  3488. $echo "*** it was explicitly requested with -no-undefined,"
  3489. $echo "*** libtool will only create a static version of it."
  3490. if test "$build_old_libs" = no; then
  3491. oldlibs="$output_objdir/$libname.$libext"
  3492. build_libtool_libs=module
  3493. build_old_libs=yes
  3494. else
  3495. build_libtool_libs=no
  3496. fi
  3497. fi
  3498. fi
  3499. fi
  3500. # Done checking deplibs!
  3501. deplibs=$newdeplibs
  3502. fi
  3503. # move library search paths that coincide with paths to not yet
  3504. # installed libraries to the beginning of the library search list
  3505. new_libs=
  3506. for path in $notinst_path; do
  3507. case " $new_libs " in
  3508. *" -L$path/$objdir "*) ;;
  3509. *)
  3510. case " $deplibs " in
  3511. *" -L$path/$objdir "*)
  3512. new_libs="$new_libs -L$path/$objdir" ;;
  3513. esac
  3514. ;;
  3515. esac
  3516. done
  3517. for deplib in $deplibs; do
  3518. case $deplib in
  3519. -L*)
  3520. case " $new_libs " in
  3521. *" $deplib "*) ;;
  3522. *) new_libs="$new_libs $deplib" ;;
  3523. esac
  3524. ;;
  3525. *) new_libs="$new_libs $deplib" ;;
  3526. esac
  3527. done
  3528. deplibs="$new_libs"
  3529. # All the library-specific variables (install_libdir is set above).
  3530. library_names=
  3531. old_library=
  3532. dlname=
  3533. # Test again, we may have decided not to build it any more
  3534. if test "$build_libtool_libs" = yes; then
  3535. if test "$hardcode_into_libs" = yes; then
  3536. # Hardcode the library paths
  3537. hardcode_libdirs=
  3538. dep_rpath=
  3539. rpath="$finalize_rpath"
  3540. test "$mode" != relink && rpath="$compile_rpath$rpath"
  3541. for libdir in $rpath; do
  3542. if test -n "$hardcode_libdir_flag_spec"; then
  3543. if test -n "$hardcode_libdir_separator"; then
  3544. if test -z "$hardcode_libdirs"; then
  3545. hardcode_libdirs="$libdir"
  3546. else
  3547. # Just accumulate the unique libdirs.
  3548. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3549. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3550. ;;
  3551. *)
  3552. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3553. ;;
  3554. esac
  3555. fi
  3556. else
  3557. eval flag=\"$hardcode_libdir_flag_spec\"
  3558. dep_rpath="$dep_rpath $flag"
  3559. fi
  3560. elif test -n "$runpath_var"; then
  3561. case "$perm_rpath " in
  3562. *" $libdir "*) ;;
  3563. *) perm_rpath="$perm_rpath $libdir" ;;
  3564. esac
  3565. fi
  3566. done
  3567. # Substitute the hardcoded libdirs into the rpath.
  3568. if test -n "$hardcode_libdir_separator" &&
  3569. test -n "$hardcode_libdirs"; then
  3570. libdir="$hardcode_libdirs"
  3571. if test -n "$hardcode_libdir_flag_spec_ld"; then
  3572. eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  3573. else
  3574. eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  3575. fi
  3576. fi
  3577. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  3578. # We should set the runpath_var.
  3579. rpath=
  3580. for dir in $perm_rpath; do
  3581. rpath="$rpath$dir:"
  3582. done
  3583. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  3584. fi
  3585. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  3586. fi
  3587. shlibpath="$finalize_shlibpath"
  3588. test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  3589. if test -n "$shlibpath"; then
  3590. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  3591. fi
  3592. # Get the real and link names of the library.
  3593. eval shared_ext=\"$shrext_cmds\"
  3594. eval library_names=\"$library_names_spec\"
  3595. set dummy $library_names
  3596. realname="$2"
  3597. shift; shift
  3598. if test -n "$soname_spec"; then
  3599. eval soname=\"$soname_spec\"
  3600. else
  3601. soname="$realname"
  3602. fi
  3603. if test -z "$dlname"; then
  3604. dlname=$soname
  3605. fi
  3606. lib="$output_objdir/$realname"
  3607. linknames=
  3608. for link
  3609. do
  3610. linknames="$linknames $link"
  3611. done
  3612. # Use standard objects if they are pic
  3613. test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3614. # Prepare the list of exported symbols
  3615. if test -z "$export_symbols"; then
  3616. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  3617. $show "generating symbol list for \`$libname.la'"
  3618. export_symbols="$output_objdir/$libname.exp"
  3619. $run $rm $export_symbols
  3620. cmds=$export_symbols_cmds
  3621. save_ifs="$IFS"; IFS='~'
  3622. for cmd in $cmds; do
  3623. IFS="$save_ifs"
  3624. eval cmd=\"$cmd\"
  3625. if len=`expr "X$cmd" : ".*"` &&
  3626. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3627. $show "$cmd"
  3628. $run eval "$cmd" || exit $?
  3629. skipped_export=false
  3630. else
  3631. # The command line is too long to execute in one step.
  3632. $show "using reloadable object file for export list..."
  3633. skipped_export=:
  3634. # Break out early, otherwise skipped_export may be
  3635. # set to false by a later but shorter cmd.
  3636. break
  3637. fi
  3638. done
  3639. IFS="$save_ifs"
  3640. if test -n "$export_symbols_regex"; then
  3641. $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  3642. $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  3643. $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  3644. $run eval '$mv "${export_symbols}T" "$export_symbols"'
  3645. fi
  3646. fi
  3647. fi
  3648. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  3649. $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  3650. fi
  3651. tmp_deplibs=
  3652. for test_deplib in $deplibs; do
  3653. case " $convenience " in
  3654. *" $test_deplib "*) ;;
  3655. *)
  3656. tmp_deplibs="$tmp_deplibs $test_deplib"
  3657. ;;
  3658. esac
  3659. done
  3660. deplibs="$tmp_deplibs"
  3661. if test -n "$convenience"; then
  3662. if test -n "$whole_archive_flag_spec"; then
  3663. save_libobjs=$libobjs
  3664. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  3665. else
  3666. gentop="$output_objdir/${outputname}x"
  3667. generated="$generated $gentop"
  3668. func_extract_archives $gentop $convenience
  3669. libobjs="$libobjs $func_extract_archives_result"
  3670. fi
  3671. fi
  3672. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  3673. eval flag=\"$thread_safe_flag_spec\"
  3674. linker_flags="$linker_flags $flag"
  3675. fi
  3676. # Make a backup of the uninstalled library when relinking
  3677. if test "$mode" = relink; then
  3678. $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  3679. fi
  3680. # Do each of the archive commands.
  3681. if test "$module" = yes && test -n "$module_cmds" ; then
  3682. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  3683. eval test_cmds=\"$module_expsym_cmds\"
  3684. cmds=$module_expsym_cmds
  3685. else
  3686. eval test_cmds=\"$module_cmds\"
  3687. cmds=$module_cmds
  3688. fi
  3689. else
  3690. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  3691. eval test_cmds=\"$archive_expsym_cmds\"
  3692. cmds=$archive_expsym_cmds
  3693. else
  3694. eval test_cmds=\"$archive_cmds\"
  3695. cmds=$archive_cmds
  3696. fi
  3697. fi
  3698. if test "X$skipped_export" != "X:" &&
  3699. len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  3700. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3701. :
  3702. else
  3703. # The command line is too long to link in one step, link piecewise.
  3704. $echo "creating reloadable object files..."
  3705. # Save the value of $output and $libobjs because we want to
  3706. # use them later. If we have whole_archive_flag_spec, we
  3707. # want to use save_libobjs as it was before
  3708. # whole_archive_flag_spec was expanded, because we can't
  3709. # assume the linker understands whole_archive_flag_spec.
  3710. # This may have to be revisited, in case too many
  3711. # convenience libraries get linked in and end up exceeding
  3712. # the spec.
  3713. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  3714. save_libobjs=$libobjs
  3715. fi
  3716. save_output=$output
  3717. output_la=`$echo "X$output" | $Xsed -e "$basename"`
  3718. # Clear the reloadable object creation command queue and
  3719. # initialize k to one.
  3720. test_cmds=
  3721. concat_cmds=
  3722. objlist=
  3723. delfiles=
  3724. last_robj=
  3725. k=1
  3726. output=$output_objdir/$output_la-${k}.$objext
  3727. # Loop over the list of objects to be linked.
  3728. for obj in $save_libobjs
  3729. do
  3730. eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  3731. if test "X$objlist" = X ||
  3732. { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  3733. test "$len" -le "$max_cmd_len"; }; then
  3734. objlist="$objlist $obj"
  3735. else
  3736. # The command $test_cmds is almost too long, add a
  3737. # command to the queue.
  3738. if test "$k" -eq 1 ; then
  3739. # The first file doesn't have a previous command to add.
  3740. eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  3741. else
  3742. # All subsequent reloadable object files will link in
  3743. # the last one created.
  3744. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  3745. fi
  3746. last_robj=$output_objdir/$output_la-${k}.$objext
  3747. k=`expr $k + 1`
  3748. output=$output_objdir/$output_la-${k}.$objext
  3749. objlist=$obj
  3750. len=1
  3751. fi
  3752. done
  3753. # Handle the remaining objects by creating one last
  3754. # reloadable object file. All subsequent reloadable object
  3755. # files will link in the last one created.
  3756. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  3757. eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  3758. if ${skipped_export-false}; then
  3759. $show "generating symbol list for \`$libname.la'"
  3760. export_symbols="$output_objdir/$libname.exp"
  3761. $run $rm $export_symbols
  3762. libobjs=$output
  3763. # Append the command to create the export file.
  3764. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  3765. fi
  3766. # Set up a command to remove the reloadable object files
  3767. # after they are used.
  3768. i=0
  3769. while test "$i" -lt "$k"
  3770. do
  3771. i=`expr $i + 1`
  3772. delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
  3773. done
  3774. $echo "creating a temporary reloadable object file: $output"
  3775. # Loop through the commands generated above and execute them.
  3776. save_ifs="$IFS"; IFS='~'
  3777. for cmd in $concat_cmds; do
  3778. IFS="$save_ifs"
  3779. $show "$cmd"
  3780. $run eval "$cmd" || exit $?
  3781. done
  3782. IFS="$save_ifs"
  3783. libobjs=$output
  3784. # Restore the value of output.
  3785. output=$save_output
  3786. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  3787. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  3788. fi
  3789. # Expand the library linking commands again to reset the
  3790. # value of $libobjs for piecewise linking.
  3791. # Do each of the archive commands.
  3792. if test "$module" = yes && test -n "$module_cmds" ; then
  3793. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  3794. cmds=$module_expsym_cmds
  3795. else
  3796. cmds=$module_cmds
  3797. fi
  3798. else
  3799. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  3800. cmds=$archive_expsym_cmds
  3801. else
  3802. cmds=$archive_cmds
  3803. fi
  3804. fi
  3805. # Append the command to remove the reloadable object files
  3806. # to the just-reset $cmds.
  3807. eval cmds=\"\$cmds~\$rm $delfiles\"
  3808. fi
  3809. save_ifs="$IFS"; IFS='~'
  3810. for cmd in $cmds; do
  3811. IFS="$save_ifs"
  3812. eval cmd=\"$cmd\"
  3813. $show "$cmd"
  3814. $run eval "$cmd" || {
  3815. lt_exit=$?
  3816. # Restore the uninstalled library and exit
  3817. if test "$mode" = relink; then
  3818. $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  3819. fi
  3820. exit $lt_exit
  3821. }
  3822. done
  3823. IFS="$save_ifs"
  3824. # Restore the uninstalled library and exit
  3825. if test "$mode" = relink; then
  3826. $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  3827. if test -n "$convenience"; then
  3828. if test -z "$whole_archive_flag_spec"; then
  3829. $show "${rm}r $gentop"
  3830. $run ${rm}r "$gentop"
  3831. fi
  3832. fi
  3833. exit $EXIT_SUCCESS
  3834. fi
  3835. # Create links to the real library.
  3836. for linkname in $linknames; do
  3837. if test "$realname" != "$linkname"; then
  3838. $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  3839. $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  3840. fi
  3841. done
  3842. # If -module or -export-dynamic was specified, set the dlname.
  3843. if test "$module" = yes || test "$export_dynamic" = yes; then
  3844. # On all known operating systems, these are identical.
  3845. dlname="$soname"
  3846. fi
  3847. fi
  3848. ;;
  3849. obj)
  3850. if test -n "$deplibs"; then
  3851. $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  3852. fi
  3853. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3854. $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  3855. fi
  3856. if test -n "$rpath"; then
  3857. $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  3858. fi
  3859. if test -n "$xrpath"; then
  3860. $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  3861. fi
  3862. if test -n "$vinfo"; then
  3863. $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  3864. fi
  3865. if test -n "$release"; then
  3866. $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  3867. fi
  3868. case $output in
  3869. *.lo)
  3870. if test -n "$objs$old_deplibs"; then
  3871. $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  3872. exit $EXIT_FAILURE
  3873. fi
  3874. libobj="$output"
  3875. obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  3876. ;;
  3877. *)
  3878. libobj=
  3879. obj="$output"
  3880. ;;
  3881. esac
  3882. # Delete the old objects.
  3883. $run $rm $obj $libobj
  3884. # Objects from convenience libraries. This assumes
  3885. # single-version convenience libraries. Whenever we create
  3886. # different ones for PIC/non-PIC, this we'll have to duplicate
  3887. # the extraction.
  3888. reload_conv_objs=
  3889. gentop=
  3890. # reload_cmds runs $LD directly, so let us get rid of
  3891. # -Wl from whole_archive_flag_spec
  3892. wl=
  3893. if test -n "$convenience"; then
  3894. if test -n "$whole_archive_flag_spec"; then
  3895. eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  3896. else
  3897. gentop="$output_objdir/${obj}x"
  3898. generated="$generated $gentop"
  3899. func_extract_archives $gentop $convenience
  3900. reload_conv_objs="$reload_objs $func_extract_archives_result"
  3901. fi
  3902. fi
  3903. # Create the old-style object.
  3904. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  3905. output="$obj"
  3906. cmds=$reload_cmds
  3907. save_ifs="$IFS"; IFS='~'
  3908. for cmd in $cmds; do
  3909. IFS="$save_ifs"
  3910. eval cmd=\"$cmd\"
  3911. $show "$cmd"
  3912. $run eval "$cmd" || exit $?
  3913. done
  3914. IFS="$save_ifs"
  3915. # Exit if we aren't doing a library object file.
  3916. if test -z "$libobj"; then
  3917. if test -n "$gentop"; then
  3918. $show "${rm}r $gentop"
  3919. $run ${rm}r $gentop
  3920. fi
  3921. exit $EXIT_SUCCESS
  3922. fi
  3923. if test "$build_libtool_libs" != yes; then
  3924. if test -n "$gentop"; then
  3925. $show "${rm}r $gentop"
  3926. $run ${rm}r $gentop
  3927. fi
  3928. # Create an invalid libtool object if no PIC, so that we don't
  3929. # accidentally link it into a program.
  3930. # $show "echo timestamp > $libobj"
  3931. # $run eval "echo timestamp > $libobj" || exit $?
  3932. exit $EXIT_SUCCESS
  3933. fi
  3934. if test -n "$pic_flag" || test "$pic_mode" != default; then
  3935. # Only do commands if we really have different PIC objects.
  3936. reload_objs="$libobjs $reload_conv_objs"
  3937. output="$libobj"
  3938. cmds=$reload_cmds
  3939. save_ifs="$IFS"; IFS='~'
  3940. for cmd in $cmds; do
  3941. IFS="$save_ifs"
  3942. eval cmd=\"$cmd\"
  3943. $show "$cmd"
  3944. $run eval "$cmd" || exit $?
  3945. done
  3946. IFS="$save_ifs"
  3947. fi
  3948. if test -n "$gentop"; then
  3949. $show "${rm}r $gentop"
  3950. $run ${rm}r $gentop
  3951. fi
  3952. exit $EXIT_SUCCESS
  3953. ;;
  3954. prog)
  3955. case $host in
  3956. *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  3957. esac
  3958. if test -n "$vinfo"; then
  3959. $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  3960. fi
  3961. if test -n "$release"; then
  3962. $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  3963. fi
  3964. if test "$preload" = yes; then
  3965. if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  3966. test "$dlopen_self_static" = unknown; then
  3967. $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  3968. fi
  3969. fi
  3970. case $host in
  3971. *-*-rhapsody* | *-*-darwin1.[012])
  3972. # On Rhapsody replace the C library is the System framework
  3973. compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3974. finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3975. ;;
  3976. esac
  3977. case $host in
  3978. *darwin*)
  3979. # Don't allow lazy linking, it breaks C++ global constructors
  3980. if test "$tagname" = CXX ; then
  3981. compile_command="$compile_command ${wl}-bind_at_load"
  3982. finalize_command="$finalize_command ${wl}-bind_at_load"
  3983. fi
  3984. ;;
  3985. esac
  3986. # move library search paths that coincide with paths to not yet
  3987. # installed libraries to the beginning of the library search list
  3988. new_libs=
  3989. for path in $notinst_path; do
  3990. case " $new_libs " in
  3991. *" -L$path/$objdir "*) ;;
  3992. *)
  3993. case " $compile_deplibs " in
  3994. *" -L$path/$objdir "*)
  3995. new_libs="$new_libs -L$path/$objdir" ;;
  3996. esac
  3997. ;;
  3998. esac
  3999. done
  4000. for deplib in $compile_deplibs; do
  4001. case $deplib in
  4002. -L*)
  4003. case " $new_libs " in
  4004. *" $deplib "*) ;;
  4005. *) new_libs="$new_libs $deplib" ;;
  4006. esac
  4007. ;;
  4008. *) new_libs="$new_libs $deplib" ;;
  4009. esac
  4010. done
  4011. compile_deplibs="$new_libs"
  4012. compile_command="$compile_command $compile_deplibs"
  4013. finalize_command="$finalize_command $finalize_deplibs"
  4014. if test -n "$rpath$xrpath"; then
  4015. # If the user specified any rpath flags, then add them.
  4016. for libdir in $rpath $xrpath; do
  4017. # This is the magic to use -rpath.
  4018. case "$finalize_rpath " in
  4019. *" $libdir "*) ;;
  4020. *) finalize_rpath="$finalize_rpath $libdir" ;;
  4021. esac
  4022. done
  4023. fi
  4024. # Now hardcode the library paths
  4025. rpath=
  4026. hardcode_libdirs=
  4027. for libdir in $compile_rpath $finalize_rpath; do
  4028. if test -n "$hardcode_libdir_flag_spec"; then
  4029. if test -n "$hardcode_libdir_separator"; then
  4030. if test -z "$hardcode_libdirs"; then
  4031. hardcode_libdirs="$libdir"
  4032. else
  4033. # Just accumulate the unique libdirs.
  4034. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  4035. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  4036. ;;
  4037. *)
  4038. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  4039. ;;
  4040. esac
  4041. fi
  4042. else
  4043. eval flag=\"$hardcode_libdir_flag_spec\"
  4044. rpath="$rpath $flag"
  4045. fi
  4046. elif test -n "$runpath_var"; then
  4047. case "$perm_rpath " in
  4048. *" $libdir "*) ;;
  4049. *) perm_rpath="$perm_rpath $libdir" ;;
  4050. esac
  4051. fi
  4052. case $host in
  4053. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  4054. testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
  4055. case :$dllsearchpath: in
  4056. *":$libdir:"*) ;;
  4057. *) dllsearchpath="$dllsearchpath:$libdir";;
  4058. esac
  4059. case :$dllsearchpath: in
  4060. *":$testbindir:"*) ;;
  4061. *) dllsearchpath="$dllsearchpath:$testbindir";;
  4062. esac
  4063. ;;
  4064. esac
  4065. done
  4066. # Substitute the hardcoded libdirs into the rpath.
  4067. if test -n "$hardcode_libdir_separator" &&
  4068. test -n "$hardcode_libdirs"; then
  4069. libdir="$hardcode_libdirs"
  4070. eval rpath=\" $hardcode_libdir_flag_spec\"
  4071. fi
  4072. compile_rpath="$rpath"
  4073. rpath=
  4074. hardcode_libdirs=
  4075. for libdir in $finalize_rpath; do
  4076. if test -n "$hardcode_libdir_flag_spec"; then
  4077. if test -n "$hardcode_libdir_separator"; then
  4078. if test -z "$hardcode_libdirs"; then
  4079. hardcode_libdirs="$libdir"
  4080. else
  4081. # Just accumulate the unique libdirs.
  4082. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  4083. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  4084. ;;
  4085. *)
  4086. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  4087. ;;
  4088. esac
  4089. fi
  4090. else
  4091. eval flag=\"$hardcode_libdir_flag_spec\"
  4092. rpath="$rpath $flag"
  4093. fi
  4094. elif test -n "$runpath_var"; then
  4095. case "$finalize_perm_rpath " in
  4096. *" $libdir "*) ;;
  4097. *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  4098. esac
  4099. fi
  4100. done
  4101. # Substitute the hardcoded libdirs into the rpath.
  4102. if test -n "$hardcode_libdir_separator" &&
  4103. test -n "$hardcode_libdirs"; then
  4104. libdir="$hardcode_libdirs"
  4105. eval rpath=\" $hardcode_libdir_flag_spec\"
  4106. fi
  4107. finalize_rpath="$rpath"
  4108. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  4109. # Transform all the library objects into standard objects.
  4110. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4111. finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4112. fi
  4113. dlsyms=
  4114. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  4115. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4116. dlsyms="${outputname}S.c"
  4117. else
  4118. $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  4119. fi
  4120. fi
  4121. if test -n "$dlsyms"; then
  4122. case $dlsyms in
  4123. "") ;;
  4124. *.c)
  4125. # Discover the nlist of each of the dlfiles.
  4126. nlist="$output_objdir/${outputname}.nm"
  4127. $show "$rm $nlist ${nlist}S ${nlist}T"
  4128. $run $rm "$nlist" "${nlist}S" "${nlist}T"
  4129. # Parse the name list into a source file.
  4130. $show "creating $output_objdir/$dlsyms"
  4131. test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  4132. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  4133. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  4134. #ifdef __cplusplus
  4135. extern \"C\" {
  4136. #endif
  4137. /* Prevent the only kind of declaration conflicts we can make. */
  4138. #define lt_preloaded_symbols some_other_symbol
  4139. /* External symbol declarations for the compiler. */\
  4140. "
  4141. if test "$dlself" = yes; then
  4142. $show "generating symbol list for \`$output'"
  4143. test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  4144. # Add our own program objects to the symbol list.
  4145. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4146. for arg in $progfiles; do
  4147. $show "extracting global C symbols from \`$arg'"
  4148. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  4149. done
  4150. if test -n "$exclude_expsyms"; then
  4151. $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4152. $run eval '$mv "$nlist"T "$nlist"'
  4153. fi
  4154. if test -n "$export_symbols_regex"; then
  4155. $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4156. $run eval '$mv "$nlist"T "$nlist"'
  4157. fi
  4158. # Prepare the list of exported symbols
  4159. if test -z "$export_symbols"; then
  4160. export_symbols="$output_objdir/$outputname.exp"
  4161. $run $rm $export_symbols
  4162. $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4163. case $host in
  4164. *cygwin* | *mingw* )
  4165. $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4166. $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4167. ;;
  4168. esac
  4169. else
  4170. $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4171. $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4172. $run eval 'mv "$nlist"T "$nlist"'
  4173. case $host in
  4174. *cygwin* | *mingw* )
  4175. $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4176. $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4177. ;;
  4178. esac
  4179. fi
  4180. fi
  4181. for arg in $dlprefiles; do
  4182. $show "extracting global C symbols from \`$arg'"
  4183. name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
  4184. $run eval '$echo ": $name " >> "$nlist"'
  4185. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  4186. done
  4187. if test -z "$run"; then
  4188. # Make sure we have at least an empty file.
  4189. test -f "$nlist" || : > "$nlist"
  4190. if test -n "$exclude_expsyms"; then
  4191. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4192. $mv "$nlist"T "$nlist"
  4193. fi
  4194. # Try sorting and uniquifying the output.
  4195. if grep -v "^: " < "$nlist" |
  4196. if sort -k 3 </dev/null >/dev/null 2>&1; then
  4197. sort -k 3
  4198. else
  4199. sort +2
  4200. fi |
  4201. uniq > "$nlist"S; then
  4202. :
  4203. else
  4204. grep -v "^: " < "$nlist" > "$nlist"S
  4205. fi
  4206. if test -f "$nlist"S; then
  4207. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  4208. else
  4209. $echo '/* NONE */' >> "$output_objdir/$dlsyms"
  4210. fi
  4211. $echo >> "$output_objdir/$dlsyms" "\
  4212. #undef lt_preloaded_symbols
  4213. #if defined (__STDC__) && __STDC__
  4214. # define lt_ptr void *
  4215. #else
  4216. # define lt_ptr char *
  4217. # define const
  4218. #endif
  4219. /* The mapping between symbol names and symbols. */
  4220. "
  4221. case $host in
  4222. *cygwin* | *mingw* )
  4223. $echo >> "$output_objdir/$dlsyms" "\
  4224. /* DATA imports from DLLs on WIN32 can't be const, because
  4225. runtime relocations are performed -- see ld's documentation
  4226. on pseudo-relocs */
  4227. struct {
  4228. "
  4229. ;;
  4230. * )
  4231. $echo >> "$output_objdir/$dlsyms" "\
  4232. const struct {
  4233. "
  4234. ;;
  4235. esac
  4236. $echo >> "$output_objdir/$dlsyms" "\
  4237. const char *name;
  4238. lt_ptr address;
  4239. }
  4240. lt_preloaded_symbols[] =
  4241. {\
  4242. "
  4243. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
  4244. $echo >> "$output_objdir/$dlsyms" "\
  4245. {0, (lt_ptr) 0}
  4246. };
  4247. /* This works around a problem in FreeBSD linker */
  4248. #ifdef FREEBSD_WORKAROUND
  4249. static const void *lt_preloaded_setup() {
  4250. return lt_preloaded_symbols;
  4251. }
  4252. #endif
  4253. #ifdef __cplusplus
  4254. }
  4255. #endif\
  4256. "
  4257. fi
  4258. pic_flag_for_symtable=
  4259. case $host in
  4260. # compiling the symbol table file with pic_flag works around
  4261. # a FreeBSD bug that causes programs to crash when -lm is
  4262. # linked before any other PIC object. But we must not use
  4263. # pic_flag when linking with -static. The problem exists in
  4264. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4265. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4266. case "$compile_command " in
  4267. *" -static "*) ;;
  4268. *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
  4269. esac;;
  4270. *-*-hpux*)
  4271. case "$compile_command " in
  4272. *" -static "*) ;;
  4273. *) pic_flag_for_symtable=" $pic_flag";;
  4274. esac
  4275. esac
  4276. # Now compile the dynamic symbol file.
  4277. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  4278. $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  4279. # Clean up the generated files.
  4280. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  4281. $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  4282. # Transform the symbol file into the correct name.
  4283. case $host in
  4284. *cygwin* | *mingw* )
  4285. if test -f "$output_objdir/${outputname}.def" ; then
  4286. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
  4287. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
  4288. else
  4289. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4290. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4291. fi
  4292. ;;
  4293. * )
  4294. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4295. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4296. ;;
  4297. esac
  4298. ;;
  4299. *)
  4300. $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  4301. exit $EXIT_FAILURE
  4302. ;;
  4303. esac
  4304. else
  4305. # We keep going just in case the user didn't refer to
  4306. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4307. # really was required.
  4308. # Nullify the symbol file.
  4309. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  4310. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  4311. fi
  4312. if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  4313. # Replace the output file specification.
  4314. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4315. link_command="$compile_command$compile_rpath"
  4316. # We have no uninstalled library dependencies, so finalize right now.
  4317. $show "$link_command"
  4318. $run eval "$link_command"
  4319. exit_status=$?
  4320. # Delete the generated files.
  4321. if test -n "$dlsyms"; then
  4322. $show "$rm $output_objdir/${outputname}S.${objext}"
  4323. $run $rm "$output_objdir/${outputname}S.${objext}"
  4324. fi
  4325. exit $exit_status
  4326. fi
  4327. if test -n "$shlibpath_var"; then
  4328. # We should set the shlibpath_var
  4329. rpath=
  4330. for dir in $temp_rpath; do
  4331. case $dir in
  4332. [\\/]* | [A-Za-z]:[\\/]*)
  4333. # Absolute path.
  4334. rpath="$rpath$dir:"
  4335. ;;
  4336. *)
  4337. # Relative path: add a thisdir entry.
  4338. rpath="$rpath\$thisdir/$dir:"
  4339. ;;
  4340. esac
  4341. done
  4342. temp_rpath="$rpath"
  4343. fi
  4344. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  4345. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  4346. fi
  4347. if test -n "$finalize_shlibpath"; then
  4348. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  4349. fi
  4350. compile_var=
  4351. finalize_var=
  4352. if test -n "$runpath_var"; then
  4353. if test -n "$perm_rpath"; then
  4354. # We should set the runpath_var.
  4355. rpath=
  4356. for dir in $perm_rpath; do
  4357. rpath="$rpath$dir:"
  4358. done
  4359. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4360. fi
  4361. if test -n "$finalize_perm_rpath"; then
  4362. # We should set the runpath_var.
  4363. rpath=
  4364. for dir in $finalize_perm_rpath; do
  4365. rpath="$rpath$dir:"
  4366. done
  4367. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4368. fi
  4369. fi
  4370. if test "$no_install" = yes; then
  4371. # We don't need to create a wrapper script.
  4372. link_command="$compile_var$compile_command$compile_rpath"
  4373. # Replace the output file specification.
  4374. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4375. # Delete the old output file.
  4376. $run $rm $output
  4377. # Link the executable and exit
  4378. $show "$link_command"
  4379. $run eval "$link_command" || exit $?
  4380. exit $EXIT_SUCCESS
  4381. fi
  4382. if test "$hardcode_action" = relink; then
  4383. # Fast installation is not supported
  4384. link_command="$compile_var$compile_command$compile_rpath"
  4385. relink_command="$finalize_var$finalize_command$finalize_rpath"
  4386. $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  4387. $echo "$modename: \`$output' will be relinked during installation" 1>&2
  4388. else
  4389. if test "$fast_install" != no; then
  4390. link_command="$finalize_var$compile_command$finalize_rpath"
  4391. if test "$fast_install" = yes; then
  4392. relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  4393. else
  4394. # fast_install is set to needless
  4395. relink_command=
  4396. fi
  4397. else
  4398. link_command="$compile_var$compile_command$compile_rpath"
  4399. relink_command="$finalize_var$finalize_command$finalize_rpath"
  4400. fi
  4401. fi
  4402. # Replace the output file specification.
  4403. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  4404. # Delete the old output files.
  4405. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  4406. $show "$link_command"
  4407. $run eval "$link_command" || exit $?
  4408. # Now create the wrapper script.
  4409. $show "creating $output"
  4410. # Quote the relink command for shipping.
  4411. if test -n "$relink_command"; then
  4412. # Preserve any variables that may affect compiler behavior
  4413. for var in $variables_saved_for_relink; do
  4414. if eval test -z \"\${$var+set}\"; then
  4415. relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  4416. elif eval var_value=\$$var; test -z "$var_value"; then
  4417. relink_command="$var=; export $var; $relink_command"
  4418. else
  4419. var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  4420. relink_command="$var=\"$var_value\"; export $var; $relink_command"
  4421. fi
  4422. done
  4423. relink_command="(cd `pwd`; $relink_command)"
  4424. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  4425. fi
  4426. # Quote $echo for shipping.
  4427. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
  4428. case $progpath in
  4429. [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
  4430. *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
  4431. esac
  4432. qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  4433. else
  4434. qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  4435. fi
  4436. # Only actually do things if our run command is non-null.
  4437. if test -z "$run"; then
  4438. # win32 will think the script is a binary if it has
  4439. # a .exe suffix, so we strip it off here.
  4440. case $output in
  4441. *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
  4442. esac
  4443. # test for cygwin because mv fails w/o .exe extensions
  4444. case $host in
  4445. *cygwin*)
  4446. exeext=.exe
  4447. outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
  4448. *) exeext= ;;
  4449. esac
  4450. case $host in
  4451. *cygwin* | *mingw* )
  4452. output_name=`basename $output`
  4453. output_path=`dirname $output`
  4454. cwrappersource="$output_path/$objdir/lt-$output_name.c"
  4455. cwrapper="$output_path/$output_name.exe"
  4456. $rm $cwrappersource $cwrapper
  4457. trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  4458. cat > $cwrappersource <<EOF
  4459. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  4460. Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4461. The $output program cannot be directly executed until all the libtool
  4462. libraries that it depends on are installed.
  4463. This wrapper executable should never be moved out of the build directory.
  4464. If it is, it will not operate correctly.
  4465. Currently, it simply execs the wrapper *script* "/bin/sh $output",
  4466. but could eventually absorb all of the scripts functionality and
  4467. exec $objdir/$outputname directly.
  4468. */
  4469. EOF
  4470. cat >> $cwrappersource<<"EOF"
  4471. #include <stdio.h>
  4472. #include <stdlib.h>
  4473. #include <unistd.h>
  4474. #include <malloc.h>
  4475. #include <stdarg.h>
  4476. #include <assert.h>
  4477. #include <string.h>
  4478. #include <ctype.h>
  4479. #include <sys/stat.h>
  4480. #if defined(PATH_MAX)
  4481. # define LT_PATHMAX PATH_MAX
  4482. #elif defined(MAXPATHLEN)
  4483. # define LT_PATHMAX MAXPATHLEN
  4484. #else
  4485. # define LT_PATHMAX 1024
  4486. #endif
  4487. #ifndef DIR_SEPARATOR
  4488. # define DIR_SEPARATOR '/'
  4489. # define PATH_SEPARATOR ':'
  4490. #endif
  4491. #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  4492. defined (__OS2__)
  4493. # define HAVE_DOS_BASED_FILE_SYSTEM
  4494. # ifndef DIR_SEPARATOR_2
  4495. # define DIR_SEPARATOR_2 '\\'
  4496. # endif
  4497. # ifndef PATH_SEPARATOR_2
  4498. # define PATH_SEPARATOR_2 ';'
  4499. # endif
  4500. #endif
  4501. #ifndef DIR_SEPARATOR_2
  4502. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  4503. #else /* DIR_SEPARATOR_2 */
  4504. # define IS_DIR_SEPARATOR(ch) \
  4505. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  4506. #endif /* DIR_SEPARATOR_2 */
  4507. #ifndef PATH_SEPARATOR_2
  4508. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  4509. #else /* PATH_SEPARATOR_2 */
  4510. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  4511. #endif /* PATH_SEPARATOR_2 */
  4512. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  4513. #define XFREE(stale) do { \
  4514. if (stale) { free ((void *) stale); stale = 0; } \
  4515. } while (0)
  4516. /* -DDEBUG is fairly common in CFLAGS. */
  4517. #undef DEBUG
  4518. #if defined DEBUGWRAPPER
  4519. # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
  4520. #else
  4521. # define DEBUG(format, ...)
  4522. #endif
  4523. const char *program_name = NULL;
  4524. void * xmalloc (size_t num);
  4525. char * xstrdup (const char *string);
  4526. const char * base_name (const char *name);
  4527. char * find_executable(const char *wrapper);
  4528. int check_executable(const char *path);
  4529. char * strendzap(char *str, const char *pat);
  4530. void lt_fatal (const char *message, ...);
  4531. int
  4532. main (int argc, char *argv[])
  4533. {
  4534. char **newargz;
  4535. int i;
  4536. program_name = (char *) xstrdup (base_name (argv[0]));
  4537. DEBUG("(main) argv[0] : %s\n",argv[0]);
  4538. DEBUG("(main) program_name : %s\n",program_name);
  4539. newargz = XMALLOC(char *, argc+2);
  4540. EOF
  4541. cat >> $cwrappersource <<EOF
  4542. newargz[0] = (char *) xstrdup("$SHELL");
  4543. EOF
  4544. cat >> $cwrappersource <<"EOF"
  4545. newargz[1] = find_executable(argv[0]);
  4546. if (newargz[1] == NULL)
  4547. lt_fatal("Couldn't find %s", argv[0]);
  4548. DEBUG("(main) found exe at : %s\n",newargz[1]);
  4549. /* we know the script has the same name, without the .exe */
  4550. /* so make sure newargz[1] doesn't end in .exe */
  4551. strendzap(newargz[1],".exe");
  4552. for (i = 1; i < argc; i++)
  4553. newargz[i+1] = xstrdup(argv[i]);
  4554. newargz[argc+1] = NULL;
  4555. for (i=0; i<argc+1; i++)
  4556. {
  4557. DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
  4558. ;
  4559. }
  4560. EOF
  4561. case $host_os in
  4562. mingw*)
  4563. cat >> $cwrappersource <<EOF
  4564. execv("$SHELL",(char const **)newargz);
  4565. EOF
  4566. ;;
  4567. *)
  4568. cat >> $cwrappersource <<EOF
  4569. execv("$SHELL",newargz);
  4570. EOF
  4571. ;;
  4572. esac
  4573. cat >> $cwrappersource <<"EOF"
  4574. return 127;
  4575. }
  4576. void *
  4577. xmalloc (size_t num)
  4578. {
  4579. void * p = (void *) malloc (num);
  4580. if (!p)
  4581. lt_fatal ("Memory exhausted");
  4582. return p;
  4583. }
  4584. char *
  4585. xstrdup (const char *string)
  4586. {
  4587. return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
  4588. ;
  4589. }
  4590. const char *
  4591. base_name (const char *name)
  4592. {
  4593. const char *base;
  4594. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4595. /* Skip over the disk name in MSDOS pathnames. */
  4596. if (isalpha ((unsigned char)name[0]) && name[1] == ':')
  4597. name += 2;
  4598. #endif
  4599. for (base = name; *name; name++)
  4600. if (IS_DIR_SEPARATOR (*name))
  4601. base = name + 1;
  4602. return base;
  4603. }
  4604. int
  4605. check_executable(const char * path)
  4606. {
  4607. struct stat st;
  4608. DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
  4609. if ((!path) || (!*path))
  4610. return 0;
  4611. if ((stat (path, &st) >= 0) &&
  4612. (
  4613. /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
  4614. #if defined (S_IXOTH)
  4615. ((st.st_mode & S_IXOTH) == S_IXOTH) ||
  4616. #endif
  4617. #if defined (S_IXGRP)
  4618. ((st.st_mode & S_IXGRP) == S_IXGRP) ||
  4619. #endif
  4620. ((st.st_mode & S_IXUSR) == S_IXUSR))
  4621. )
  4622. return 1;
  4623. else
  4624. return 0;
  4625. }
  4626. /* Searches for the full path of the wrapper. Returns
  4627. newly allocated full path name if found, NULL otherwise */
  4628. char *
  4629. find_executable (const char* wrapper)
  4630. {
  4631. int has_slash = 0;
  4632. const char* p;
  4633. const char* p_next;
  4634. /* static buffer for getcwd */
  4635. char tmp[LT_PATHMAX + 1];
  4636. int tmp_len;
  4637. char* concat_name;
  4638. DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
  4639. if ((wrapper == NULL) || (*wrapper == '\0'))
  4640. return NULL;
  4641. /* Absolute path? */
  4642. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4643. if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
  4644. {
  4645. concat_name = xstrdup (wrapper);
  4646. if (check_executable(concat_name))
  4647. return concat_name;
  4648. XFREE(concat_name);
  4649. }
  4650. else
  4651. {
  4652. #endif
  4653. if (IS_DIR_SEPARATOR (wrapper[0]))
  4654. {
  4655. concat_name = xstrdup (wrapper);
  4656. if (check_executable(concat_name))
  4657. return concat_name;
  4658. XFREE(concat_name);
  4659. }
  4660. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4661. }
  4662. #endif
  4663. for (p = wrapper; *p; p++)
  4664. if (*p == '/')
  4665. {
  4666. has_slash = 1;
  4667. break;
  4668. }
  4669. if (!has_slash)
  4670. {
  4671. /* no slashes; search PATH */
  4672. const char* path = getenv ("PATH");
  4673. if (path != NULL)
  4674. {
  4675. for (p = path; *p; p = p_next)
  4676. {
  4677. const char* q;
  4678. size_t p_len;
  4679. for (q = p; *q; q++)
  4680. if (IS_PATH_SEPARATOR(*q))
  4681. break;
  4682. p_len = q - p;
  4683. p_next = (*q == '\0' ? q : q + 1);
  4684. if (p_len == 0)
  4685. {
  4686. /* empty path: current directory */
  4687. if (getcwd (tmp, LT_PATHMAX) == NULL)
  4688. lt_fatal ("getcwd failed");
  4689. tmp_len = strlen(tmp);
  4690. concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  4691. memcpy (concat_name, tmp, tmp_len);
  4692. concat_name[tmp_len] = '/';
  4693. strcpy (concat_name + tmp_len + 1, wrapper);
  4694. }
  4695. else
  4696. {
  4697. concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
  4698. memcpy (concat_name, p, p_len);
  4699. concat_name[p_len] = '/';
  4700. strcpy (concat_name + p_len + 1, wrapper);
  4701. }
  4702. if (check_executable(concat_name))
  4703. return concat_name;
  4704. XFREE(concat_name);
  4705. }
  4706. }
  4707. /* not found in PATH; assume curdir */
  4708. }
  4709. /* Relative path | not found in path: prepend cwd */
  4710. if (getcwd (tmp, LT_PATHMAX) == NULL)
  4711. lt_fatal ("getcwd failed");
  4712. tmp_len = strlen(tmp);
  4713. concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  4714. memcpy (concat_name, tmp, tmp_len);
  4715. concat_name[tmp_len] = '/';
  4716. strcpy (concat_name + tmp_len + 1, wrapper);
  4717. if (check_executable(concat_name))
  4718. return concat_name;
  4719. XFREE(concat_name);
  4720. return NULL;
  4721. }
  4722. char *
  4723. strendzap(char *str, const char *pat)
  4724. {
  4725. size_t len, patlen;
  4726. assert(str != NULL);
  4727. assert(pat != NULL);
  4728. len = strlen(str);
  4729. patlen = strlen(pat);
  4730. if (patlen <= len)
  4731. {
  4732. str += len - patlen;
  4733. if (strcmp(str, pat) == 0)
  4734. *str = '\0';
  4735. }
  4736. return str;
  4737. }
  4738. static void
  4739. lt_error_core (int exit_status, const char * mode,
  4740. const char * message, va_list ap)
  4741. {
  4742. fprintf (stderr, "%s: %s: ", program_name, mode);
  4743. vfprintf (stderr, message, ap);
  4744. fprintf (stderr, ".\n");
  4745. if (exit_status >= 0)
  4746. exit (exit_status);
  4747. }
  4748. void
  4749. lt_fatal (const char *message, ...)
  4750. {
  4751. va_list ap;
  4752. va_start (ap, message);
  4753. lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  4754. va_end (ap);
  4755. }
  4756. EOF
  4757. # we should really use a build-platform specific compiler
  4758. # here, but OTOH, the wrappers (shell script and this C one)
  4759. # are only useful if you want to execute the "real" binary.
  4760. # Since the "real" binary is built for $host, then this
  4761. # wrapper might as well be built for $host, too.
  4762. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
  4763. ;;
  4764. esac
  4765. $rm $output
  4766. trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  4767. $echo > $output "\
  4768. #! $SHELL
  4769. # $output - temporary wrapper script for $objdir/$outputname
  4770. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4771. #
  4772. # The $output program cannot be directly executed until all the libtool
  4773. # libraries that it depends on are installed.
  4774. #
  4775. # This wrapper script should never be moved out of the build directory.
  4776. # If it is, it will not operate correctly.
  4777. # Sed substitution that helps us do robust quoting. It backslashifies
  4778. # metacharacters that are still active within double-quoted strings.
  4779. Xsed='${SED} -e 1s/^X//'
  4780. sed_quote_subst='$sed_quote_subst'
  4781. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4782. # if CDPATH is set.
  4783. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4784. relink_command=\"$relink_command\"
  4785. # This environment variable determines our operation mode.
  4786. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4787. # install mode needs the following variable:
  4788. notinst_deplibs='$notinst_deplibs'
  4789. else
  4790. # When we are sourced in execute mode, \$file and \$echo are already set.
  4791. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4792. echo=\"$qecho\"
  4793. file=\"\$0\"
  4794. # Make sure echo works.
  4795. if test \"X\$1\" = X--no-reexec; then
  4796. # Discard the --no-reexec flag, and continue.
  4797. shift
  4798. elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  4799. # Yippee, \$echo works!
  4800. :
  4801. else
  4802. # Restart under the correct shell, and then maybe \$echo will work.
  4803. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  4804. fi
  4805. fi\
  4806. "
  4807. $echo >> $output "\
  4808. # Find the directory that this script lives in.
  4809. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  4810. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4811. # Follow symbolic links until we get to the real thisdir.
  4812. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  4813. while test -n \"\$file\"; do
  4814. destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  4815. # If there was a directory component, then change thisdir.
  4816. if test \"x\$destdir\" != \"x\$file\"; then
  4817. case \"\$destdir\" in
  4818. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4819. *) thisdir=\"\$thisdir/\$destdir\" ;;
  4820. esac
  4821. fi
  4822. file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  4823. file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  4824. done
  4825. # Try to get the absolute directory name.
  4826. absdir=\`cd \"\$thisdir\" && pwd\`
  4827. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4828. "
  4829. if test "$fast_install" = yes; then
  4830. $echo >> $output "\
  4831. program=lt-'$outputname'$exeext
  4832. progdir=\"\$thisdir/$objdir\"
  4833. if test ! -f \"\$progdir/\$program\" || \\
  4834. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  4835. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  4836. file=\"\$\$-\$program\"
  4837. if test ! -d \"\$progdir\"; then
  4838. $mkdir \"\$progdir\"
  4839. else
  4840. $rm \"\$progdir/\$file\"
  4841. fi"
  4842. $echo >> $output "\
  4843. # relink executable if necessary
  4844. if test -n \"\$relink_command\"; then
  4845. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  4846. else
  4847. $echo \"\$relink_command_output\" >&2
  4848. $rm \"\$progdir/\$file\"
  4849. exit $EXIT_FAILURE
  4850. fi
  4851. fi
  4852. $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  4853. { $rm \"\$progdir/\$program\";
  4854. $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  4855. $rm \"\$progdir/\$file\"
  4856. fi"
  4857. else
  4858. $echo >> $output "\
  4859. program='$outputname'
  4860. progdir=\"\$thisdir/$objdir\"
  4861. "
  4862. fi
  4863. $echo >> $output "\
  4864. if test -f \"\$progdir/\$program\"; then"
  4865. # Export our shlibpath_var if we have one.
  4866. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  4867. $echo >> $output "\
  4868. # Add our own library path to $shlibpath_var
  4869. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  4870. # Some systems cannot cope with colon-terminated $shlibpath_var
  4871. # The second colon is a workaround for a bug in BeOS R4 sed
  4872. $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  4873. export $shlibpath_var
  4874. "
  4875. fi
  4876. # fixup the dll searchpath if we need to.
  4877. if test -n "$dllsearchpath"; then
  4878. $echo >> $output "\
  4879. # Add the dll search path components to the executable PATH
  4880. PATH=$dllsearchpath:\$PATH
  4881. "
  4882. fi
  4883. $echo >> $output "\
  4884. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4885. # Run the actual program with our arguments.
  4886. "
  4887. case $host in
  4888. # Backslashes separate directories on plain windows
  4889. *-*-mingw | *-*-os2*)
  4890. $echo >> $output "\
  4891. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  4892. "
  4893. ;;
  4894. *)
  4895. $echo >> $output "\
  4896. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  4897. "
  4898. ;;
  4899. esac
  4900. $echo >> $output "\
  4901. \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  4902. exit $EXIT_FAILURE
  4903. fi
  4904. else
  4905. # The program doesn't exist.
  4906. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  4907. \$echo \"This script is just a wrapper for \$program.\" 1>&2
  4908. $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  4909. exit $EXIT_FAILURE
  4910. fi
  4911. fi\
  4912. "
  4913. chmod +x $output
  4914. fi
  4915. exit $EXIT_SUCCESS
  4916. ;;
  4917. esac
  4918. # See if we need to build an old-fashioned archive.
  4919. for oldlib in $oldlibs; do
  4920. if test "$build_libtool_libs" = convenience; then
  4921. oldobjs="$libobjs_save"
  4922. addlibs="$convenience"
  4923. build_libtool_libs=no
  4924. else
  4925. if test "$build_libtool_libs" = module; then
  4926. oldobjs="$libobjs_save"
  4927. build_libtool_libs=no
  4928. else
  4929. oldobjs="$old_deplibs $non_pic_objects"
  4930. fi
  4931. addlibs="$old_convenience"
  4932. fi
  4933. if test -n "$addlibs"; then
  4934. gentop="$output_objdir/${outputname}x"
  4935. generated="$generated $gentop"
  4936. func_extract_archives $gentop $addlibs
  4937. oldobjs="$oldobjs $func_extract_archives_result"
  4938. fi
  4939. # Do each command in the archive commands.
  4940. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  4941. cmds=$old_archive_from_new_cmds
  4942. else
  4943. # POSIX demands no paths to be encoded in archives. We have
  4944. # to avoid creating archives with duplicate basenames if we
  4945. # might have to extract them afterwards, e.g., when creating a
  4946. # static archive out of a convenience library, or when linking
  4947. # the entirety of a libtool archive into another (currently
  4948. # not supported by libtool).
  4949. if (for obj in $oldobjs
  4950. do
  4951. $echo "X$obj" | $Xsed -e 's%^.*/%%'
  4952. done | sort | sort -uc >/dev/null 2>&1); then
  4953. :
  4954. else
  4955. $echo "copying selected object files to avoid basename conflicts..."
  4956. if test -z "$gentop"; then
  4957. gentop="$output_objdir/${outputname}x"
  4958. generated="$generated $gentop"
  4959. $show "${rm}r $gentop"
  4960. $run ${rm}r "$gentop"
  4961. $show "$mkdir $gentop"
  4962. $run $mkdir "$gentop"
  4963. exit_status=$?
  4964. if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
  4965. exit $exit_status
  4966. fi
  4967. fi
  4968. save_oldobjs=$oldobjs
  4969. oldobjs=
  4970. counter=1
  4971. for obj in $save_oldobjs
  4972. do
  4973. objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  4974. case " $oldobjs " in
  4975. " ") oldobjs=$obj ;;
  4976. *[\ /]"$objbase "*)
  4977. while :; do
  4978. # Make sure we don't pick an alternate name that also
  4979. # overlaps.
  4980. newobj=lt$counter-$objbase
  4981. counter=`expr $counter + 1`
  4982. case " $oldobjs " in
  4983. *[\ /]"$newobj "*) ;;
  4984. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  4985. esac
  4986. done
  4987. $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  4988. $run ln "$obj" "$gentop/$newobj" ||
  4989. $run cp "$obj" "$gentop/$newobj"
  4990. oldobjs="$oldobjs $gentop/$newobj"
  4991. ;;
  4992. *) oldobjs="$oldobjs $obj" ;;
  4993. esac
  4994. done
  4995. fi
  4996. eval cmds=\"$old_archive_cmds\"
  4997. if len=`expr "X$cmds" : ".*"` &&
  4998. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  4999. cmds=$old_archive_cmds
  5000. else
  5001. # the command line is too long to link in one step, link in parts
  5002. $echo "using piecewise archive linking..."
  5003. save_RANLIB=$RANLIB
  5004. RANLIB=:
  5005. objlist=
  5006. concat_cmds=
  5007. save_oldobjs=$oldobjs
  5008. # Is there a better way of finding the last object in the list?
  5009. for obj in $save_oldobjs
  5010. do
  5011. last_oldobj=$obj
  5012. done
  5013. for obj in $save_oldobjs
  5014. do
  5015. oldobjs="$objlist $obj"
  5016. objlist="$objlist $obj"
  5017. eval test_cmds=\"$old_archive_cmds\"
  5018. if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  5019. test "$len" -le "$max_cmd_len"; then
  5020. :
  5021. else
  5022. # the above command should be used before it gets too long
  5023. oldobjs=$objlist
  5024. if test "$obj" = "$last_oldobj" ; then
  5025. RANLIB=$save_RANLIB
  5026. fi
  5027. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  5028. eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  5029. objlist=
  5030. fi
  5031. done
  5032. RANLIB=$save_RANLIB
  5033. oldobjs=$objlist
  5034. if test "X$oldobjs" = "X" ; then
  5035. eval cmds=\"\$concat_cmds\"
  5036. else
  5037. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  5038. fi
  5039. fi
  5040. fi
  5041. save_ifs="$IFS"; IFS='~'
  5042. for cmd in $cmds; do
  5043. eval cmd=\"$cmd\"
  5044. IFS="$save_ifs"
  5045. $show "$cmd"
  5046. $run eval "$cmd" || exit $?
  5047. done
  5048. IFS="$save_ifs"
  5049. done
  5050. if test -n "$generated"; then
  5051. $show "${rm}r$generated"
  5052. $run ${rm}r$generated
  5053. fi
  5054. # Now create the libtool archive.
  5055. case $output in
  5056. *.la)
  5057. old_library=
  5058. test "$build_old_libs" = yes && old_library="$libname.$libext"
  5059. $show "creating $output"
  5060. # Preserve any variables that may affect compiler behavior
  5061. for var in $variables_saved_for_relink; do
  5062. if eval test -z \"\${$var+set}\"; then
  5063. relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  5064. elif eval var_value=\$$var; test -z "$var_value"; then
  5065. relink_command="$var=; export $var; $relink_command"
  5066. else
  5067. var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  5068. relink_command="$var=\"$var_value\"; export $var; $relink_command"
  5069. fi
  5070. done
  5071. # Quote the link command for shipping.
  5072. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  5073. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  5074. if test "$hardcode_automatic" = yes ; then
  5075. relink_command=
  5076. fi
  5077. # Only create the output if not a dry run.
  5078. if test -z "$run"; then
  5079. for installed in no yes; do
  5080. if test "$installed" = yes; then
  5081. if test -z "$install_libdir"; then
  5082. break
  5083. fi
  5084. output="$output_objdir/$outputname"i
  5085. # Replace all uninstalled libtool libraries with the installed ones
  5086. newdependency_libs=
  5087. for deplib in $dependency_libs; do
  5088. case $deplib in
  5089. *.la)
  5090. name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  5091. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  5092. if test -z "$libdir"; then
  5093. $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  5094. exit $EXIT_FAILURE
  5095. fi
  5096. newdependency_libs="$newdependency_libs $libdir/$name"
  5097. ;;
  5098. *) newdependency_libs="$newdependency_libs $deplib" ;;
  5099. esac
  5100. done
  5101. dependency_libs="$newdependency_libs"
  5102. newdlfiles=
  5103. for lib in $dlfiles; do
  5104. name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  5105. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  5106. if test -z "$libdir"; then
  5107. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5108. exit $EXIT_FAILURE
  5109. fi
  5110. newdlfiles="$newdlfiles $libdir/$name"
  5111. done
  5112. dlfiles="$newdlfiles"
  5113. newdlprefiles=
  5114. for lib in $dlprefiles; do
  5115. name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  5116. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  5117. if test -z "$libdir"; then
  5118. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5119. exit $EXIT_FAILURE
  5120. fi
  5121. newdlprefiles="$newdlprefiles $libdir/$name"
  5122. done
  5123. dlprefiles="$newdlprefiles"
  5124. else
  5125. newdlfiles=
  5126. for lib in $dlfiles; do
  5127. case $lib in
  5128. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  5129. *) abs=`pwd`"/$lib" ;;
  5130. esac
  5131. newdlfiles="$newdlfiles $abs"
  5132. done
  5133. dlfiles="$newdlfiles"
  5134. newdlprefiles=
  5135. for lib in $dlprefiles; do
  5136. case $lib in
  5137. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  5138. *) abs=`pwd`"/$lib" ;;
  5139. esac
  5140. newdlprefiles="$newdlprefiles $abs"
  5141. done
  5142. dlprefiles="$newdlprefiles"
  5143. fi
  5144. $rm $output
  5145. # place dlname in correct position for cygwin
  5146. tdlname=$dlname
  5147. case $host,$output,$installed,$module,$dlname in
  5148. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  5149. esac
  5150. $echo > $output "\
  5151. # $outputname - a libtool library file
  5152. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  5153. #
  5154. # Please DO NOT delete this file!
  5155. # It is necessary for linking the library.
  5156. # The name that we can dlopen(3).
  5157. dlname='$tdlname'
  5158. # Names of this library.
  5159. library_names='$library_names'
  5160. # The name of the static archive.
  5161. old_library='$old_library'
  5162. # Libraries that this one depends upon.
  5163. dependency_libs='$dependency_libs'
  5164. # Version information for $libname.
  5165. current=$current
  5166. age=$age
  5167. revision=$revision
  5168. # Is this an already installed library?
  5169. installed=$installed
  5170. # Should we warn about portability when linking against -modules?
  5171. shouldnotlink=$module
  5172. # Files to dlopen/dlpreopen
  5173. dlopen='$dlfiles'
  5174. dlpreopen='$dlprefiles'
  5175. # Directory that this library needs to be installed in:
  5176. libdir='$install_libdir'"
  5177. if test "$installed" = no && test "$need_relink" = yes; then
  5178. $echo >> $output "\
  5179. relink_command=\"$relink_command\""
  5180. fi
  5181. done
  5182. fi
  5183. # Do a symbolic link so that the libtool archive can be found in
  5184. # LD_LIBRARY_PATH before the program is installed.
  5185. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  5186. $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  5187. ;;
  5188. esac
  5189. exit $EXIT_SUCCESS
  5190. ;;
  5191. # libtool install mode
  5192. install)
  5193. modename="$modename: install"
  5194. # There may be an optional sh(1) argument at the beginning of
  5195. # install_prog (especially on Windows NT).
  5196. if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  5197. # Allow the use of GNU shtool's install command.
  5198. $echo "X$nonopt" | grep shtool > /dev/null; then
  5199. # Aesthetically quote it.
  5200. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  5201. case $arg in
  5202. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  5203. arg="\"$arg\""
  5204. ;;
  5205. esac
  5206. install_prog="$arg "
  5207. arg="$1"
  5208. shift
  5209. else
  5210. install_prog=
  5211. arg=$nonopt
  5212. fi
  5213. # The real first argument should be the name of the installation program.
  5214. # Aesthetically quote it.
  5215. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  5216. case $arg in
  5217. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  5218. arg="\"$arg\""
  5219. ;;
  5220. esac
  5221. install_prog="$install_prog$arg"
  5222. # We need to accept at least all the BSD install flags.
  5223. dest=
  5224. files=
  5225. opts=
  5226. prev=
  5227. install_type=
  5228. isdir=no
  5229. stripme=
  5230. for arg
  5231. do
  5232. if test -n "$dest"; then
  5233. files="$files $dest"
  5234. dest=$arg
  5235. continue
  5236. fi
  5237. case $arg in
  5238. -d) isdir=yes ;;
  5239. -f)
  5240. case " $install_prog " in
  5241. *[\\\ /]cp\ *) ;;
  5242. *) prev=$arg ;;
  5243. esac
  5244. ;;
  5245. -g | -m | -o) prev=$arg ;;
  5246. -s)
  5247. stripme=" -s"
  5248. continue
  5249. ;;
  5250. -*)
  5251. ;;
  5252. *)
  5253. # If the previous option needed an argument, then skip it.
  5254. if test -n "$prev"; then
  5255. prev=
  5256. else
  5257. dest=$arg
  5258. continue
  5259. fi
  5260. ;;
  5261. esac
  5262. # Aesthetically quote the argument.
  5263. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  5264. case $arg in
  5265. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  5266. arg="\"$arg\""
  5267. ;;
  5268. esac
  5269. install_prog="$install_prog $arg"
  5270. done
  5271. if test -z "$install_prog"; then
  5272. $echo "$modename: you must specify an install program" 1>&2
  5273. $echo "$help" 1>&2
  5274. exit $EXIT_FAILURE
  5275. fi
  5276. if test -n "$prev"; then
  5277. $echo "$modename: the \`$prev' option requires an argument" 1>&2
  5278. $echo "$help" 1>&2
  5279. exit $EXIT_FAILURE
  5280. fi
  5281. if test -z "$files"; then
  5282. if test -z "$dest"; then
  5283. $echo "$modename: no file or destination specified" 1>&2
  5284. else
  5285. $echo "$modename: you must specify a destination" 1>&2
  5286. fi
  5287. $echo "$help" 1>&2
  5288. exit $EXIT_FAILURE
  5289. fi
  5290. # Strip any trailing slash from the destination.
  5291. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  5292. # Check to see that the destination is a directory.
  5293. test -d "$dest" && isdir=yes
  5294. if test "$isdir" = yes; then
  5295. destdir="$dest"
  5296. destname=
  5297. else
  5298. destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  5299. test "X$destdir" = "X$dest" && destdir=.
  5300. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  5301. # Not a directory, so check to see that there is only one file specified.
  5302. set dummy $files
  5303. if test "$#" -gt 2; then
  5304. $echo "$modename: \`$dest' is not a directory" 1>&2
  5305. $echo "$help" 1>&2
  5306. exit $EXIT_FAILURE
  5307. fi
  5308. fi
  5309. case $destdir in
  5310. [\\/]* | [A-Za-z]:[\\/]*) ;;
  5311. *)
  5312. for file in $files; do
  5313. case $file in
  5314. *.lo) ;;
  5315. *)
  5316. $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  5317. $echo "$help" 1>&2
  5318. exit $EXIT_FAILURE
  5319. ;;
  5320. esac
  5321. done
  5322. ;;
  5323. esac
  5324. # This variable tells wrapper scripts just to set variables rather
  5325. # than running their programs.
  5326. libtool_install_magic="$magic"
  5327. staticlibs=
  5328. future_libdirs=
  5329. current_libdirs=
  5330. for file in $files; do
  5331. # Do each installation.
  5332. case $file in
  5333. *.$libext)
  5334. # Do the static libraries later.
  5335. staticlibs="$staticlibs $file"
  5336. ;;
  5337. *.la)
  5338. # Check to see that this really is a libtool archive.
  5339. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  5340. else
  5341. $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  5342. $echo "$help" 1>&2
  5343. exit $EXIT_FAILURE
  5344. fi
  5345. library_names=
  5346. old_library=
  5347. relink_command=
  5348. # If there is no directory component, then add one.
  5349. case $file in
  5350. */* | *\\*) . $file ;;
  5351. *) . ./$file ;;
  5352. esac
  5353. # Add the libdir to current_libdirs if it is the destination.
  5354. if test "X$destdir" = "X$libdir"; then
  5355. case "$current_libdirs " in
  5356. *" $libdir "*) ;;
  5357. *) current_libdirs="$current_libdirs $libdir" ;;
  5358. esac
  5359. else
  5360. # Note the libdir as a future libdir.
  5361. case "$future_libdirs " in
  5362. *" $libdir "*) ;;
  5363. *) future_libdirs="$future_libdirs $libdir" ;;
  5364. esac
  5365. fi
  5366. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
  5367. test "X$dir" = "X$file/" && dir=
  5368. dir="$dir$objdir"
  5369. if test -n "$relink_command"; then
  5370. # Determine the prefix the user has applied to our future dir.
  5371. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
  5372. # Don't allow the user to place us outside of our expected
  5373. # location b/c this prevents finding dependent libraries that
  5374. # are installed to the same prefix.
  5375. # At present, this check doesn't affect windows .dll's that
  5376. # are installed into $libdir/../bin (currently, that works fine)
  5377. # but it's something to keep an eye on.
  5378. if test "$inst_prefix_dir" = "$destdir"; then
  5379. $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
  5380. exit $EXIT_FAILURE
  5381. fi
  5382. if test -n "$inst_prefix_dir"; then
  5383. # Stick the inst_prefix_dir data into the link command.
  5384. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  5385. else
  5386. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  5387. fi
  5388. $echo "$modename: warning: relinking \`$file'" 1>&2
  5389. $show "$relink_command"
  5390. if $run eval "$relink_command"; then :
  5391. else
  5392. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  5393. exit $EXIT_FAILURE
  5394. fi
  5395. fi
  5396. # See the names of the shared library.
  5397. set dummy $library_names
  5398. if test -n "$2"; then
  5399. realname="$2"
  5400. shift
  5401. shift
  5402. srcname="$realname"
  5403. test -n "$relink_command" && srcname="$realname"T
  5404. # Install the shared library and build the symlinks.
  5405. $show "$install_prog $dir/$srcname $destdir/$realname"
  5406. $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  5407. if test -n "$stripme" && test -n "$striplib"; then
  5408. $show "$striplib $destdir/$realname"
  5409. $run eval "$striplib $destdir/$realname" || exit $?
  5410. fi
  5411. if test "$#" -gt 0; then
  5412. # Delete the old symlinks, and create new ones.
  5413. # Try `ln -sf' first, because the `ln' binary might depend on
  5414. # the symlink we replace! Solaris /bin/ln does not understand -f,
  5415. # so we also need to try rm && ln -s.
  5416. for linkname
  5417. do
  5418. if test "$linkname" != "$realname"; then
  5419. $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
  5420. $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
  5421. fi
  5422. done
  5423. fi
  5424. # Do each command in the postinstall commands.
  5425. lib="$destdir/$realname"
  5426. cmds=$postinstall_cmds
  5427. save_ifs="$IFS"; IFS='~'
  5428. for cmd in $cmds; do
  5429. IFS="$save_ifs"
  5430. eval cmd=\"$cmd\"
  5431. $show "$cmd"
  5432. $run eval "$cmd" || {
  5433. lt_exit=$?
  5434. # Restore the uninstalled library and exit
  5435. if test "$mode" = relink; then
  5436. $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  5437. fi
  5438. exit $lt_exit
  5439. }
  5440. done
  5441. IFS="$save_ifs"
  5442. fi
  5443. # Install the pseudo-library for information purposes.
  5444. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5445. instname="$dir/$name"i
  5446. $show "$install_prog $instname $destdir/$name"
  5447. $run eval "$install_prog $instname $destdir/$name" || exit $?
  5448. # Maybe install the static library, too.
  5449. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  5450. ;;
  5451. *.lo)
  5452. # Install (i.e. copy) a libtool object.
  5453. # Figure out destination file name, if it wasn't already specified.
  5454. if test -n "$destname"; then
  5455. destfile="$destdir/$destname"
  5456. else
  5457. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5458. destfile="$destdir/$destfile"
  5459. fi
  5460. # Deduce the name of the destination old-style object file.
  5461. case $destfile in
  5462. *.lo)
  5463. staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  5464. ;;
  5465. *.$objext)
  5466. staticdest="$destfile"
  5467. destfile=
  5468. ;;
  5469. *)
  5470. $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  5471. $echo "$help" 1>&2
  5472. exit $EXIT_FAILURE
  5473. ;;
  5474. esac
  5475. # Install the libtool object if requested.
  5476. if test -n "$destfile"; then
  5477. $show "$install_prog $file $destfile"
  5478. $run eval "$install_prog $file $destfile" || exit $?
  5479. fi
  5480. # Install the old object if enabled.
  5481. if test "$build_old_libs" = yes; then
  5482. # Deduce the name of the old-style object file.
  5483. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  5484. $show "$install_prog $staticobj $staticdest"
  5485. $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  5486. fi
  5487. exit $EXIT_SUCCESS
  5488. ;;
  5489. *)
  5490. # Figure out destination file name, if it wasn't already specified.
  5491. if test -n "$destname"; then
  5492. destfile="$destdir/$destname"
  5493. else
  5494. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5495. destfile="$destdir/$destfile"
  5496. fi
  5497. # If the file is missing, and there is a .exe on the end, strip it
  5498. # because it is most likely a libtool script we actually want to
  5499. # install
  5500. stripped_ext=""
  5501. case $file in
  5502. *.exe)
  5503. if test ! -f "$file"; then
  5504. file=`$echo $file|${SED} 's,.exe$,,'`
  5505. stripped_ext=".exe"
  5506. fi
  5507. ;;
  5508. esac
  5509. # Do a test to see if this is really a libtool program.
  5510. case $host in
  5511. *cygwin*|*mingw*)
  5512. wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
  5513. ;;
  5514. *)
  5515. wrapper=$file
  5516. ;;
  5517. esac
  5518. if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
  5519. notinst_deplibs=
  5520. relink_command=
  5521. # Note that it is not necessary on cygwin/mingw to append a dot to
  5522. # foo even if both foo and FILE.exe exist: automatic-append-.exe
  5523. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  5524. # `FILE.' does not work on cygwin managed mounts.
  5525. #
  5526. # If there is no directory component, then add one.
  5527. case $wrapper in
  5528. */* | *\\*) . ${wrapper} ;;
  5529. *) . ./${wrapper} ;;
  5530. esac
  5531. # Check the variables that should have been set.
  5532. if test -z "$notinst_deplibs"; then
  5533. $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  5534. exit $EXIT_FAILURE
  5535. fi
  5536. finalize=yes
  5537. for lib in $notinst_deplibs; do
  5538. # Check to see that each library is installed.
  5539. libdir=
  5540. if test -f "$lib"; then
  5541. # If there is no directory component, then add one.
  5542. case $lib in
  5543. */* | *\\*) . $lib ;;
  5544. *) . ./$lib ;;
  5545. esac
  5546. fi
  5547. libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  5548. if test -n "$libdir" && test ! -f "$libfile"; then
  5549. $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  5550. finalize=no
  5551. fi
  5552. done
  5553. relink_command=
  5554. # Note that it is not necessary on cygwin/mingw to append a dot to
  5555. # foo even if both foo and FILE.exe exist: automatic-append-.exe
  5556. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  5557. # `FILE.' does not work on cygwin managed mounts.
  5558. #
  5559. # If there is no directory component, then add one.
  5560. case $wrapper in
  5561. */* | *\\*) . ${wrapper} ;;
  5562. *) . ./${wrapper} ;;
  5563. esac
  5564. outputname=
  5565. if test "$fast_install" = no && test -n "$relink_command"; then
  5566. if test "$finalize" = yes && test -z "$run"; then
  5567. tmpdir=`func_mktempdir`
  5568. file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  5569. outputname="$tmpdir/$file"
  5570. # Replace the output file specification.
  5571. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  5572. $show "$relink_command"
  5573. if $run eval "$relink_command"; then :
  5574. else
  5575. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  5576. ${rm}r "$tmpdir"
  5577. continue
  5578. fi
  5579. file="$outputname"
  5580. else
  5581. $echo "$modename: warning: cannot relink \`$file'" 1>&2
  5582. fi
  5583. else
  5584. # Install the binary that we compiled earlier.
  5585. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  5586. fi
  5587. fi
  5588. # remove .exe since cygwin /usr/bin/install will append another
  5589. # one anyway
  5590. case $install_prog,$host in
  5591. */usr/bin/install*,*cygwin*)
  5592. case $file:$destfile in
  5593. *.exe:*.exe)
  5594. # this is ok
  5595. ;;
  5596. *.exe:*)
  5597. destfile=$destfile.exe
  5598. ;;
  5599. *:*.exe)
  5600. destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
  5601. ;;
  5602. esac
  5603. ;;
  5604. esac
  5605. $show "$install_prog$stripme $file $destfile"
  5606. $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  5607. test -n "$outputname" && ${rm}r "$tmpdir"
  5608. ;;
  5609. esac
  5610. done
  5611. for file in $staticlibs; do
  5612. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5613. # Set up the ranlib parameters.
  5614. oldlib="$destdir/$name"
  5615. $show "$install_prog $file $oldlib"
  5616. $run eval "$install_prog \$file \$oldlib" || exit $?
  5617. if test -n "$stripme" && test -n "$old_striplib"; then
  5618. $show "$old_striplib $oldlib"
  5619. $run eval "$old_striplib $oldlib" || exit $?
  5620. fi
  5621. # Do each command in the postinstall commands.
  5622. cmds=$old_postinstall_cmds
  5623. save_ifs="$IFS"; IFS='~'
  5624. for cmd in $cmds; do
  5625. IFS="$save_ifs"
  5626. eval cmd=\"$cmd\"
  5627. $show "$cmd"
  5628. $run eval "$cmd" || exit $?
  5629. done
  5630. IFS="$save_ifs"
  5631. done
  5632. if test -n "$future_libdirs"; then
  5633. $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  5634. fi
  5635. if test -n "$current_libdirs"; then
  5636. # Maybe just do a dry run.
  5637. test -n "$run" && current_libdirs=" -n$current_libdirs"
  5638. exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  5639. else
  5640. exit $EXIT_SUCCESS
  5641. fi
  5642. ;;
  5643. # libtool finish mode
  5644. finish)
  5645. modename="$modename: finish"
  5646. libdirs="$nonopt"
  5647. admincmds=
  5648. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  5649. for dir
  5650. do
  5651. libdirs="$libdirs $dir"
  5652. done
  5653. for libdir in $libdirs; do
  5654. if test -n "$finish_cmds"; then
  5655. # Do each command in the finish commands.
  5656. cmds=$finish_cmds
  5657. save_ifs="$IFS"; IFS='~'
  5658. for cmd in $cmds; do
  5659. IFS="$save_ifs"
  5660. eval cmd=\"$cmd\"
  5661. $show "$cmd"
  5662. $run eval "$cmd" || admincmds="$admincmds
  5663. $cmd"
  5664. done
  5665. IFS="$save_ifs"
  5666. fi
  5667. if test -n "$finish_eval"; then
  5668. # Do the single finish_eval.
  5669. eval cmds=\"$finish_eval\"
  5670. $run eval "$cmds" || admincmds="$admincmds
  5671. $cmds"
  5672. fi
  5673. done
  5674. fi
  5675. # Exit here if they wanted silent mode.
  5676. test "$show" = : && exit $EXIT_SUCCESS
  5677. $echo "X----------------------------------------------------------------------" | $Xsed
  5678. $echo "Libraries have been installed in:"
  5679. for libdir in $libdirs; do
  5680. $echo " $libdir"
  5681. done
  5682. $echo
  5683. $echo "If you ever happen to want to link against installed libraries"
  5684. $echo "in a given directory, LIBDIR, you must either use libtool, and"
  5685. $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  5686. $echo "flag during linking and do at least one of the following:"
  5687. if test -n "$shlibpath_var"; then
  5688. $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
  5689. $echo " during execution"
  5690. fi
  5691. if test -n "$runpath_var"; then
  5692. $echo " - add LIBDIR to the \`$runpath_var' environment variable"
  5693. $echo " during linking"
  5694. fi
  5695. if test -n "$hardcode_libdir_flag_spec"; then
  5696. libdir=LIBDIR
  5697. eval flag=\"$hardcode_libdir_flag_spec\"
  5698. $echo " - use the \`$flag' linker flag"
  5699. fi
  5700. if test -n "$admincmds"; then
  5701. $echo " - have your system administrator run these commands:$admincmds"
  5702. fi
  5703. if test -f /etc/ld.so.conf; then
  5704. $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  5705. fi
  5706. $echo
  5707. $echo "See any operating system documentation about shared libraries for"
  5708. $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  5709. $echo "X----------------------------------------------------------------------" | $Xsed
  5710. exit $EXIT_SUCCESS
  5711. ;;
  5712. # libtool execute mode
  5713. execute)
  5714. modename="$modename: execute"
  5715. # The first argument is the command name.
  5716. cmd="$nonopt"
  5717. if test -z "$cmd"; then
  5718. $echo "$modename: you must specify a COMMAND" 1>&2
  5719. $echo "$help"
  5720. exit $EXIT_FAILURE
  5721. fi
  5722. # Handle -dlopen flags immediately.
  5723. for file in $execute_dlfiles; do
  5724. if test ! -f "$file"; then
  5725. $echo "$modename: \`$file' is not a file" 1>&2
  5726. $echo "$help" 1>&2
  5727. exit $EXIT_FAILURE
  5728. fi
  5729. dir=
  5730. case $file in
  5731. *.la)
  5732. # Check to see that this really is a libtool archive.
  5733. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  5734. else
  5735. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5736. $echo "$help" 1>&2
  5737. exit $EXIT_FAILURE
  5738. fi
  5739. # Read the libtool library.
  5740. dlname=
  5741. library_names=
  5742. # If there is no directory component, then add one.
  5743. case $file in
  5744. */* | *\\*) . $file ;;
  5745. *) . ./$file ;;
  5746. esac
  5747. # Skip this library if it cannot be dlopened.
  5748. if test -z "$dlname"; then
  5749. # Warn if it was a shared library.
  5750. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  5751. continue
  5752. fi
  5753. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5754. test "X$dir" = "X$file" && dir=.
  5755. if test -f "$dir/$objdir/$dlname"; then
  5756. dir="$dir/$objdir"
  5757. else
  5758. $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  5759. exit $EXIT_FAILURE
  5760. fi
  5761. ;;
  5762. *.lo)
  5763. # Just add the directory containing the .lo file.
  5764. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5765. test "X$dir" = "X$file" && dir=.
  5766. ;;
  5767. *)
  5768. $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  5769. continue
  5770. ;;
  5771. esac
  5772. # Get the absolute pathname.
  5773. absdir=`cd "$dir" && pwd`
  5774. test -n "$absdir" && dir="$absdir"
  5775. # Now add the directory to shlibpath_var.
  5776. if eval "test -z \"\$$shlibpath_var\""; then
  5777. eval "$shlibpath_var=\"\$dir\""
  5778. else
  5779. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  5780. fi
  5781. done
  5782. # This variable tells wrapper scripts just to set shlibpath_var
  5783. # rather than running their programs.
  5784. libtool_execute_magic="$magic"
  5785. # Check if any of the arguments is a wrapper script.
  5786. args=
  5787. for file
  5788. do
  5789. case $file in
  5790. -*) ;;
  5791. *)
  5792. # Do a test to see if this is really a libtool program.
  5793. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5794. # If there is no directory component, then add one.
  5795. case $file in
  5796. */* | *\\*) . $file ;;
  5797. *) . ./$file ;;
  5798. esac
  5799. # Transform arg to wrapped name.
  5800. file="$progdir/$program"
  5801. fi
  5802. ;;
  5803. esac
  5804. # Quote arguments (to preserve shell metacharacters).
  5805. file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  5806. args="$args \"$file\""
  5807. done
  5808. if test -z "$run"; then
  5809. if test -n "$shlibpath_var"; then
  5810. # Export the shlibpath_var.
  5811. eval "export $shlibpath_var"
  5812. fi
  5813. # Restore saved environment variables
  5814. if test "${save_LC_ALL+set}" = set; then
  5815. LC_ALL="$save_LC_ALL"; export LC_ALL
  5816. fi
  5817. if test "${save_LANG+set}" = set; then
  5818. LANG="$save_LANG"; export LANG
  5819. fi
  5820. # Now prepare to actually exec the command.
  5821. exec_cmd="\$cmd$args"
  5822. else
  5823. # Display what would be done.
  5824. if test -n "$shlibpath_var"; then
  5825. eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  5826. $echo "export $shlibpath_var"
  5827. fi
  5828. $echo "$cmd$args"
  5829. exit $EXIT_SUCCESS
  5830. fi
  5831. ;;
  5832. # libtool clean and uninstall mode
  5833. clean | uninstall)
  5834. modename="$modename: $mode"
  5835. rm="$nonopt"
  5836. files=
  5837. rmforce=
  5838. exit_status=0
  5839. # This variable tells wrapper scripts just to set variables rather
  5840. # than running their programs.
  5841. libtool_install_magic="$magic"
  5842. for arg
  5843. do
  5844. case $arg in
  5845. -f) rm="$rm $arg"; rmforce=yes ;;
  5846. -*) rm="$rm $arg" ;;
  5847. *) files="$files $arg" ;;
  5848. esac
  5849. done
  5850. if test -z "$rm"; then
  5851. $echo "$modename: you must specify an RM program" 1>&2
  5852. $echo "$help" 1>&2
  5853. exit $EXIT_FAILURE
  5854. fi
  5855. rmdirs=
  5856. origobjdir="$objdir"
  5857. for file in $files; do
  5858. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5859. if test "X$dir" = "X$file"; then
  5860. dir=.
  5861. objdir="$origobjdir"
  5862. else
  5863. objdir="$dir/$origobjdir"
  5864. fi
  5865. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5866. test "$mode" = uninstall && objdir="$dir"
  5867. # Remember objdir for removal later, being careful to avoid duplicates
  5868. if test "$mode" = clean; then
  5869. case " $rmdirs " in
  5870. *" $objdir "*) ;;
  5871. *) rmdirs="$rmdirs $objdir" ;;
  5872. esac
  5873. fi
  5874. # Don't error if the file doesn't exist and rm -f was used.
  5875. if (test -L "$file") >/dev/null 2>&1 \
  5876. || (test -h "$file") >/dev/null 2>&1 \
  5877. || test -f "$file"; then
  5878. :
  5879. elif test -d "$file"; then
  5880. exit_status=1
  5881. continue
  5882. elif test "$rmforce" = yes; then
  5883. continue
  5884. fi
  5885. rmfiles="$file"
  5886. case $name in
  5887. *.la)
  5888. # Possibly a libtool archive, so verify it.
  5889. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5890. . $dir/$name
  5891. # Delete the libtool libraries and symlinks.
  5892. for n in $library_names; do
  5893. rmfiles="$rmfiles $objdir/$n"
  5894. done
  5895. test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  5896. case "$mode" in
  5897. clean)
  5898. case " $library_names " in
  5899. # " " in the beginning catches empty $dlname
  5900. *" $dlname "*) ;;
  5901. *) rmfiles="$rmfiles $objdir/$dlname" ;;
  5902. esac
  5903. test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  5904. ;;
  5905. uninstall)
  5906. if test -n "$library_names"; then
  5907. # Do each command in the postuninstall commands.
  5908. cmds=$postuninstall_cmds
  5909. save_ifs="$IFS"; IFS='~'
  5910. for cmd in $cmds; do
  5911. IFS="$save_ifs"
  5912. eval cmd=\"$cmd\"
  5913. $show "$cmd"
  5914. $run eval "$cmd"
  5915. if test "$?" -ne 0 && test "$rmforce" != yes; then
  5916. exit_status=1
  5917. fi
  5918. done
  5919. IFS="$save_ifs"
  5920. fi
  5921. if test -n "$old_library"; then
  5922. # Do each command in the old_postuninstall commands.
  5923. cmds=$old_postuninstall_cmds
  5924. save_ifs="$IFS"; IFS='~'
  5925. for cmd in $cmds; do
  5926. IFS="$save_ifs"
  5927. eval cmd=\"$cmd\"
  5928. $show "$cmd"
  5929. $run eval "$cmd"
  5930. if test "$?" -ne 0 && test "$rmforce" != yes; then
  5931. exit_status=1
  5932. fi
  5933. done
  5934. IFS="$save_ifs"
  5935. fi
  5936. # FIXME: should reinstall the best remaining shared library.
  5937. ;;
  5938. esac
  5939. fi
  5940. ;;
  5941. *.lo)
  5942. # Possibly a libtool object, so verify it.
  5943. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5944. # Read the .lo file
  5945. . $dir/$name
  5946. # Add PIC object to the list of files to remove.
  5947. if test -n "$pic_object" \
  5948. && test "$pic_object" != none; then
  5949. rmfiles="$rmfiles $dir/$pic_object"
  5950. fi
  5951. # Add non-PIC object to the list of files to remove.
  5952. if test -n "$non_pic_object" \
  5953. && test "$non_pic_object" != none; then
  5954. rmfiles="$rmfiles $dir/$non_pic_object"
  5955. fi
  5956. fi
  5957. ;;
  5958. *)
  5959. if test "$mode" = clean ; then
  5960. noexename=$name
  5961. case $file in
  5962. *.exe)
  5963. file=`$echo $file|${SED} 's,.exe$,,'`
  5964. noexename=`$echo $name|${SED} 's,.exe$,,'`
  5965. # $file with .exe has already been added to rmfiles,
  5966. # add $file without .exe
  5967. rmfiles="$rmfiles $file"
  5968. ;;
  5969. esac
  5970. # Do a test to see if this is a libtool program.
  5971. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5972. relink_command=
  5973. . $dir/$noexename
  5974. # note $name still contains .exe if it was in $file originally
  5975. # as does the version of $file that was added into $rmfiles
  5976. rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  5977. if test "$fast_install" = yes && test -n "$relink_command"; then
  5978. rmfiles="$rmfiles $objdir/lt-$name"
  5979. fi
  5980. if test "X$noexename" != "X$name" ; then
  5981. rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  5982. fi
  5983. fi
  5984. fi
  5985. ;;
  5986. esac
  5987. $show "$rm $rmfiles"
  5988. $run $rm $rmfiles || exit_status=1
  5989. done
  5990. objdir="$origobjdir"
  5991. # Try to remove the ${objdir}s in the directories where we deleted files
  5992. for dir in $rmdirs; do
  5993. if test -d "$dir"; then
  5994. $show "rmdir $dir"
  5995. $run rmdir $dir >/dev/null 2>&1
  5996. fi
  5997. done
  5998. exit $exit_status
  5999. ;;
  6000. "")
  6001. $echo "$modename: you must specify a MODE" 1>&2
  6002. $echo "$generic_help" 1>&2
  6003. exit $EXIT_FAILURE
  6004. ;;
  6005. esac
  6006. if test -z "$exec_cmd"; then
  6007. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  6008. $echo "$generic_help" 1>&2
  6009. exit $EXIT_FAILURE
  6010. fi
  6011. fi # test -z "$show_help"
  6012. if test -n "$exec_cmd"; then
  6013. eval exec $exec_cmd
  6014. exit $EXIT_FAILURE
  6015. fi
  6016. # We need to display help for each of the modes.
  6017. case $mode in
  6018. "") $echo \
  6019. "Usage: $modename [OPTION]... [MODE-ARG]...
  6020. Provide generalized library-building support services.
  6021. --config show all configuration variables
  6022. --debug enable verbose shell tracing
  6023. -n, --dry-run display commands without modifying any files
  6024. --features display basic configuration information and exit
  6025. --finish same as \`--mode=finish'
  6026. --help display this help message and exit
  6027. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
  6028. --quiet same as \`--silent'
  6029. --silent don't print informational messages
  6030. --tag=TAG use configuration variables from tag TAG
  6031. --version print version information
  6032. MODE must be one of the following:
  6033. clean remove files from the build directory
  6034. compile compile a source file into a libtool object
  6035. execute automatically set library path, then run a program
  6036. finish complete the installation of libtool libraries
  6037. install install libraries or executables
  6038. link create a library or an executable
  6039. uninstall remove libraries from an installed directory
  6040. MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
  6041. a more detailed description of MODE.
  6042. Report bugs to <bug-libtool@gnu.org>."
  6043. exit $EXIT_SUCCESS
  6044. ;;
  6045. clean)
  6046. $echo \
  6047. "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  6048. Remove files from the build directory.
  6049. RM is the name of the program to use to delete files associated with each FILE
  6050. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  6051. to RM.
  6052. If FILE is a libtool library, object or program, all the files associated
  6053. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  6054. ;;
  6055. compile)
  6056. $echo \
  6057. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  6058. Compile a source file into a libtool library object.
  6059. This mode accepts the following additional options:
  6060. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  6061. -prefer-pic try to building PIC objects only
  6062. -prefer-non-pic try to building non-PIC objects only
  6063. -static always build a \`.o' file suitable for static linking
  6064. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  6065. from the given SOURCEFILE.
  6066. The output file name is determined by removing the directory component from
  6067. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  6068. library object suffix, \`.lo'."
  6069. ;;
  6070. execute)
  6071. $echo \
  6072. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  6073. Automatically set library path, then run a program.
  6074. This mode accepts the following additional options:
  6075. -dlopen FILE add the directory containing FILE to the library path
  6076. This mode sets the library path environment variable according to \`-dlopen'
  6077. flags.
  6078. If any of the ARGS are libtool executable wrappers, then they are translated
  6079. into their corresponding uninstalled binary, and any of their required library
  6080. directories are added to the library path.
  6081. Then, COMMAND is executed, with ARGS as arguments."
  6082. ;;
  6083. finish)
  6084. $echo \
  6085. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  6086. Complete the installation of libtool libraries.
  6087. Each LIBDIR is a directory that contains libtool libraries.
  6088. The commands that this mode executes may require superuser privileges. Use
  6089. the \`--dry-run' option if you just want to see what would be executed."
  6090. ;;
  6091. install)
  6092. $echo \
  6093. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  6094. Install executables or libraries.
  6095. INSTALL-COMMAND is the installation command. The first component should be
  6096. either the \`install' or \`cp' program.
  6097. The rest of the components are interpreted as arguments to that command (only
  6098. BSD-compatible install options are recognized)."
  6099. ;;
  6100. link)
  6101. $echo \
  6102. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  6103. Link object files or libraries together to form another library, or to
  6104. create an executable program.
  6105. LINK-COMMAND is a command using the C compiler that you would use to create
  6106. a program from several object files.
  6107. The following components of LINK-COMMAND are treated specially:
  6108. -all-static do not do any dynamic linking at all
  6109. -avoid-version do not add a version suffix if possible
  6110. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  6111. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  6112. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  6113. -export-symbols SYMFILE
  6114. try to export only the symbols listed in SYMFILE
  6115. -export-symbols-regex REGEX
  6116. try to export only the symbols matching REGEX
  6117. -LLIBDIR search LIBDIR for required installed libraries
  6118. -lNAME OUTPUT-FILE requires the installed library libNAME
  6119. -module build a library that can dlopened
  6120. -no-fast-install disable the fast-install mode
  6121. -no-install link a not-installable executable
  6122. -no-undefined declare that a library does not refer to external symbols
  6123. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  6124. -objectlist FILE Use a list of object files found in FILE to specify objects
  6125. -precious-files-regex REGEX
  6126. don't remove output files matching REGEX
  6127. -release RELEASE specify package release information
  6128. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  6129. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  6130. -static do not do any dynamic linking of libtool libraries
  6131. -version-info CURRENT[:REVISION[:AGE]]
  6132. specify library version info [each variable defaults to 0]
  6133. All other options (arguments beginning with \`-') are ignored.
  6134. Every other argument is treated as a filename. Files ending in \`.la' are
  6135. treated as uninstalled libtool libraries, other files are standard or library
  6136. object files.
  6137. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  6138. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  6139. required, except when creating a convenience library.
  6140. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  6141. using \`ar' and \`ranlib', or on Windows using \`lib'.
  6142. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  6143. is created, otherwise an executable program is created."
  6144. ;;
  6145. uninstall)
  6146. $echo \
  6147. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  6148. Remove libraries from an installation directory.
  6149. RM is the name of the program to use to delete files associated with each FILE
  6150. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  6151. to RM.
  6152. If FILE is a libtool library, all the files associated with it are deleted.
  6153. Otherwise, only FILE itself is deleted using RM."
  6154. ;;
  6155. *)
  6156. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  6157. $echo "$help" 1>&2
  6158. exit $EXIT_FAILURE
  6159. ;;
  6160. esac
  6161. $echo
  6162. $echo "Try \`$modename --help' for more information about other modes."
  6163. exit $?
  6164. # The TAGs below are defined such that we never get into a situation
  6165. # in which we disable both kinds of libraries. Given conflicting
  6166. # choices, we go for a static library, that is the most portable,
  6167. # since we can't tell whether shared libraries were disabled because
  6168. # the user asked for that or because the platform doesn't support
  6169. # them. This is particularly important on AIX, because we don't
  6170. # support having both static and shared libraries enabled at the same
  6171. # time on that platform, so we default to a shared-only configuration.
  6172. # If a disable-shared tag is given, we'll fallback to a static-only
  6173. # configuration. But we'll never go from static-only to shared-only.
  6174. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  6175. disable_libs=shared
  6176. # ### END LIBTOOL TAG CONFIG: disable-shared
  6177. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  6178. disable_libs=static
  6179. # ### END LIBTOOL TAG CONFIG: disable-static
  6180. # Local Variables:
  6181. # mode:shell-script
  6182. # sh-indentation:2
  6183. # End: