You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6496 lines
181 KiB

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