PageRenderTime 71ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/lib/libsidplay2/libsidplay/unix/ltmain.sh

http://github.com/xbmc/xbmc
Shell | 6422 lines | 5468 code | 407 blank | 547 comment | 656 complexity | e112867921e7d6f38281b55b50fa5133 MD5 | raw file
Possible License(s): GPL-3.0, CC-BY-SA-3.0, LGPL-2.0, 0BSD, Unlicense, GPL-2.0, AGPL-1.0, BSD-3-Clause, LGPL-2.1, LGPL-3.0

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

  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
  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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.6
  42. TIMESTAMP=" (1.1220.2.94 2004/04/10 16:27:27)"
  43. # Check that we have a working $echo.
  44. if test "X$1" = X--no-reexec; then
  45. # Discard the --no-reexec flag, and continue.
  46. shift
  47. elif test "X$1" = X--fallback-echo; then
  48. # Avoid inline document here, it may be left over
  49. :
  50. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  51. # Yippee, $echo works!
  52. :
  53. else
  54. # Restart under the correct shell, and then maybe $echo will work.
  55. exec $SHELL "$progpath" --no-reexec ${1+"$@"}
  56. fi
  57. if test "X$1" = X--fallback-echo; then
  58. # used as fallback echo
  59. shift
  60. cat <<EOF
  61. $*
  62. EOF
  63. exit $EXIT_SUCCESS
  64. fi
  65. default_mode=
  66. help="Try \`$progname --help' for more information."
  67. magic="%%%MAGIC variable%%%"
  68. mkdir="mkdir"
  69. mv="mv -f"
  70. rm="rm -f"
  71. # Sed substitution that helps us do robust quoting. It backslashifies
  72. # metacharacters that are still active within double-quoted strings.
  73. Xsed="${SED}"' -e 1s/^X//'
  74. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  75. # test EBCDIC or ASCII
  76. case `echo A|tr A '\301'` in
  77. A) # EBCDIC based system
  78. SP2NL="tr '\100' '\n'"
  79. NL2SP="tr '\r\n' '\100\100'"
  80. ;;
  81. *) # Assume ASCII based system
  82. SP2NL="tr '\040' '\012'"
  83. NL2SP="tr '\015\012' '\040\040'"
  84. ;;
  85. esac
  86. # NLS nuisances.
  87. # Only set LANG and LC_ALL to C if already set.
  88. # These must not be set unconditionally because not all systems understand
  89. # e.g. LANG=C (notably SCO).
  90. # We save the old values to restore during execute mode.
  91. if test "${LC_ALL+set}" = set; then
  92. save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  93. fi
  94. if test "${LANG+set}" = set; then
  95. save_LANG="$LANG"; LANG=C; export LANG
  96. fi
  97. # Make sure IFS has a sensible default
  98. : ${IFS="
  99. "}
  100. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  101. $echo "$modename: not configured to build any kind of library" 1>&2
  102. $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  103. exit $EXIT_FAILURE
  104. fi
  105. # Global variables.
  106. mode=$default_mode
  107. nonopt=
  108. prev=
  109. prevopt=
  110. run=
  111. show="$echo"
  112. show_help=
  113. execute_dlfiles=
  114. lo2o="s/\\.lo\$/.${objext}/"
  115. o2lo="s/\\.${objext}\$/.lo/"
  116. #####################################
  117. # Shell function definitions:
  118. # This seems to be the best place for them
  119. # func_win32_libid arg
  120. # return the library type of file 'arg'
  121. #
  122. # Need a lot of goo to handle *both* DLLs and import libs
  123. # Has to be a shell function in order to 'eat' the argument
  124. # that is supplied when $file_magic_command is called.
  125. func_win32_libid () {
  126. win32_libid_type="unknown"
  127. win32_fileres=`file -L $1 2>/dev/null`
  128. case $win32_fileres in
  129. *ar\ archive\ import\ library*) # definitely import
  130. win32_libid_type="x86 archive import"
  131. ;;
  132. *ar\ archive*) # could be an import, or static
  133. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
  134. $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
  135. win32_nmres=`eval $NM -f posix -A $1 | \
  136. sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
  137. if test "X$win32_nmres" = "Ximport" ; then
  138. win32_libid_type="x86 archive import"
  139. else
  140. win32_libid_type="x86 archive static"
  141. fi
  142. fi
  143. ;;
  144. *DLL*)
  145. win32_libid_type="x86 DLL"
  146. ;;
  147. *executable*) # but shell scripts are "executable" too...
  148. case $win32_fileres in
  149. *MS\ Windows\ PE\ Intel*)
  150. win32_libid_type="x86 DLL"
  151. ;;
  152. esac
  153. ;;
  154. esac
  155. $echo $win32_libid_type
  156. }
  157. # func_infer_tag arg
  158. # Infer tagged configuration to use if any are available and
  159. # if one wasn't chosen via the "--tag" command line option.
  160. # Only attempt this if the compiler in the base compile
  161. # command doesn't match the default compiler.
  162. # arg is usually of the form 'gcc ...'
  163. func_infer_tag () {
  164. if test -n "$available_tags" && test -z "$tagname"; then
  165. CC_quoted=
  166. for arg in $CC; do
  167. case $arg in
  168. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  169. arg="\"$arg\""
  170. ;;
  171. esac
  172. CC_quoted="$CC_quoted $arg"
  173. done
  174. case $@ in
  175. # Blanks in the command may have been stripped by the calling shell,
  176. # but not from the CC environment variable when configure was run.
  177. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
  178. # Blanks at the start of $base_compile will cause this to fail
  179. # if we don't check for them as well.
  180. *)
  181. for z in $available_tags; do
  182. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  183. # Evaluate the configuration.
  184. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  185. CC_quoted=
  186. for arg in $CC; do
  187. # Double-quote args containing other shell metacharacters.
  188. case $arg in
  189. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  190. arg="\"$arg\""
  191. ;;
  192. esac
  193. CC_quoted="$CC_quoted $arg"
  194. done
  195. case "$@ " in
  196. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
  197. # The compiler in the base compile command matches
  198. # the one in the tagged configuration.
  199. # Assume this is the tagged configuration we want.
  200. tagname=$z
  201. break
  202. ;;
  203. esac
  204. fi
  205. done
  206. # If $tagname still isn't set, then no tagged configuration
  207. # was found and let the user know that the "--tag" command
  208. # line option must be used.
  209. if test -z "$tagname"; then
  210. $echo "$modename: unable to infer tagged configuration"
  211. $echo "$modename: specify a tag with \`--tag'" 1>&2
  212. exit $EXIT_FAILURE
  213. # else
  214. # $echo "$modename: using $tagname tagged configuration"
  215. fi
  216. ;;
  217. esac
  218. fi
  219. }
  220. # End of Shell function definitions
  221. #####################################
  222. # Darwin sucks
  223. eval std_shrext=\"$shrext_cmds\"
  224. # Parse our command line options once, thoroughly.
  225. while test "$#" -gt 0
  226. do
  227. arg="$1"
  228. shift
  229. case $arg in
  230. -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  231. *) optarg= ;;
  232. esac
  233. # If the previous option needs an argument, assign it.
  234. if test -n "$prev"; then
  235. case $prev in
  236. execute_dlfiles)
  237. execute_dlfiles="$execute_dlfiles $arg"
  238. ;;
  239. tag)
  240. tagname="$arg"
  241. preserve_args="${preserve_args}=$arg"
  242. # Check whether tagname contains only valid characters
  243. case $tagname in
  244. *[!-_A-Za-z0-9,/]*)
  245. $echo "$progname: invalid tag name: $tagname" 1>&2
  246. exit $EXIT_FAILURE
  247. ;;
  248. esac
  249. case $tagname in
  250. CC)
  251. # Don't test for the "default" C tag, as we know, it's there, but
  252. # not specially marked.
  253. ;;
  254. *)
  255. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
  256. taglist="$taglist $tagname"
  257. # Evaluate the configuration.
  258. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
  259. else
  260. $echo "$progname: ignoring unknown tag $tagname" 1>&2
  261. fi
  262. ;;
  263. esac
  264. ;;
  265. *)
  266. eval "$prev=\$arg"
  267. ;;
  268. esac
  269. prev=
  270. prevopt=
  271. continue
  272. fi
  273. # Have we seen a non-optional argument yet?
  274. case $arg in
  275. --help)
  276. show_help=yes
  277. ;;
  278. --version)
  279. $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  280. $echo
  281. $echo "Copyright (C) 2003 Free Software Foundation, Inc."
  282. $echo "This is free software; see the source for copying conditions. There is NO"
  283. $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  284. exit $EXIT_SUCCESS
  285. ;;
  286. --config)
  287. ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
  288. # Now print the configurations for the tags.
  289. for tagname in $taglist; do
  290. ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
  291. done
  292. exit $EXIT_SUCCESS
  293. ;;
  294. --debug)
  295. $echo "$progname: enabling shell trace mode"
  296. set -x
  297. preserve_args="$preserve_args $arg"
  298. ;;
  299. --dry-run | -n)
  300. run=:
  301. ;;
  302. --features)
  303. $echo "host: $host"
  304. if test "$build_libtool_libs" = yes; then
  305. $echo "enable shared libraries"
  306. else
  307. $echo "disable shared libraries"
  308. fi
  309. if test "$build_old_libs" = yes; then
  310. $echo "enable static libraries"
  311. else
  312. $echo "disable static libraries"
  313. fi
  314. exit $EXIT_SUCCESS
  315. ;;
  316. --finish) mode="finish" ;;
  317. --mode) prevopt="--mode" prev=mode ;;
  318. --mode=*) mode="$optarg" ;;
  319. --preserve-dup-deps) duplicate_deps="yes" ;;
  320. --quiet | --silent)
  321. show=:
  322. preserve_args="$preserve_args $arg"
  323. ;;
  324. --tag) prevopt="--tag" prev=tag ;;
  325. --tag=*)
  326. set tag "$optarg" ${1+"$@"}
  327. shift
  328. prev=tag
  329. preserve_args="$preserve_args --tag"
  330. ;;
  331. -dlopen)
  332. prevopt="-dlopen"
  333. prev=execute_dlfiles
  334. ;;
  335. -*)
  336. $echo "$modename: unrecognized option \`$arg'" 1>&2
  337. $echo "$help" 1>&2
  338. exit $EXIT_FAILURE
  339. ;;
  340. *)
  341. nonopt="$arg"
  342. break
  343. ;;
  344. esac
  345. done
  346. if test -n "$prevopt"; then
  347. $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  348. $echo "$help" 1>&2
  349. exit $EXIT_FAILURE
  350. fi
  351. # If this variable is set in any of the actions, the command in it
  352. # will be execed at the end. This prevents here-documents from being
  353. # left over by shells.
  354. exec_cmd=
  355. if test -z "$show_help"; then
  356. # Infer the operation mode.
  357. if test -z "$mode"; then
  358. $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
  359. $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
  360. case $nonopt in
  361. *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
  362. mode=link
  363. for arg
  364. do
  365. case $arg in
  366. -c)
  367. mode=compile
  368. break
  369. ;;
  370. esac
  371. done
  372. ;;
  373. *db | *dbx | *strace | *truss)
  374. mode=execute
  375. ;;
  376. *install*|cp|mv)
  377. mode=install
  378. ;;
  379. *rm)
  380. mode=uninstall
  381. ;;
  382. *)
  383. # If we have no mode, but dlfiles were specified, then do execute mode.
  384. test -n "$execute_dlfiles" && mode=execute
  385. # Just use the default operation mode.
  386. if test -z "$mode"; then
  387. if test -n "$nonopt"; then
  388. $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  389. else
  390. $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  391. fi
  392. fi
  393. ;;
  394. esac
  395. fi
  396. # Only execute mode is allowed to have -dlopen flags.
  397. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  398. $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  399. $echo "$help" 1>&2
  400. exit $EXIT_FAILURE
  401. fi
  402. # Change the help message to a mode-specific one.
  403. generic_help="$help"
  404. help="Try \`$modename --help --mode=$mode' for more information."
  405. # These modes are in order of execution frequency so that they run quickly.
  406. case $mode in
  407. # libtool compile mode
  408. compile)
  409. modename="$modename: compile"
  410. # Get the compilation command and the source file.
  411. base_compile=
  412. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  413. suppress_opt=yes
  414. suppress_output=
  415. arg_mode=normal
  416. libobj=
  417. later=
  418. for arg
  419. do
  420. case "$arg_mode" in
  421. arg )
  422. # do not "continue". Instead, add this to base_compile
  423. lastarg="$arg"
  424. arg_mode=normal
  425. ;;
  426. target )
  427. libobj="$arg"
  428. arg_mode=normal
  429. continue
  430. ;;
  431. normal )
  432. # Accept any command-line options.
  433. case $arg in
  434. -o)
  435. if test -n "$libobj" ; then
  436. $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  437. exit $EXIT_FAILURE
  438. fi
  439. arg_mode=target
  440. continue
  441. ;;
  442. -static | -prefer-pic | -prefer-non-pic)
  443. later="$later $arg"
  444. continue
  445. ;;
  446. -no-suppress)
  447. suppress_opt=no
  448. continue
  449. ;;
  450. -Xcompiler)
  451. arg_mode=arg # the next one goes into the "base_compile" arg list
  452. continue # The current "srcfile" will either be retained or
  453. ;; # replaced later. I would guess that would be a bug.
  454. -Wc,*)
  455. args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
  456. lastarg=
  457. save_ifs="$IFS"; IFS=','
  458. for arg in $args; do
  459. IFS="$save_ifs"
  460. # Double-quote args containing other shell metacharacters.
  461. # Many Bourne shells cannot handle close brackets correctly
  462. # in scan sets, so we specify it separately.
  463. case $arg in
  464. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  465. arg="\"$arg\""
  466. ;;
  467. esac
  468. lastarg="$lastarg $arg"
  469. done
  470. IFS="$save_ifs"
  471. lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
  472. # Add the arguments to base_compile.
  473. base_compile="$base_compile $lastarg"
  474. continue
  475. ;;
  476. * )
  477. # Accept the current argument as the source file.
  478. # The previous "srcfile" becomes the current argument.
  479. #
  480. lastarg="$srcfile"
  481. srcfile="$arg"
  482. ;;
  483. esac # case $arg
  484. ;;
  485. esac # case $arg_mode
  486. # Aesthetically quote the previous argument.
  487. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  488. case $lastarg in
  489. # Double-quote args containing other shell metacharacters.
  490. # Many Bourne shells cannot handle close brackets correctly
  491. # in scan sets, so we specify it separately.
  492. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  493. lastarg="\"$lastarg\""
  494. ;;
  495. esac
  496. base_compile="$base_compile $lastarg"
  497. done # for arg
  498. case $arg_mode in
  499. arg)
  500. $echo "$modename: you must specify an argument for -Xcompile"
  501. exit $EXIT_FAILURE
  502. ;;
  503. target)
  504. $echo "$modename: you must specify a target with \`-o'" 1>&2
  505. exit $EXIT_FAILURE
  506. ;;
  507. *)
  508. # Get the name of the library object.
  509. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  510. ;;
  511. esac
  512. # Recognize several different file suffixes.
  513. # If the user specifies -o file.o, it is replaced with file.lo
  514. xform='[cCFSifmso]'
  515. case $libobj in
  516. *.ada) xform=ada ;;
  517. *.adb) xform=adb ;;
  518. *.ads) xform=ads ;;
  519. *.asm) xform=asm ;;
  520. *.c++) xform=c++ ;;
  521. *.cc) xform=cc ;;
  522. *.ii) xform=ii ;;
  523. *.class) xform=class ;;
  524. *.cpp) xform=cpp ;;
  525. *.cxx) xform=cxx ;;
  526. *.f90) xform=f90 ;;
  527. *.for) xform=for ;;
  528. *.java) xform=java ;;
  529. esac
  530. libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  531. case $libobj in
  532. *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  533. *)
  534. $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  535. exit $EXIT_FAILURE
  536. ;;
  537. esac
  538. func_infer_tag $base_compile
  539. for arg in $later; do
  540. case $arg in
  541. -static)
  542. build_old_libs=yes
  543. continue
  544. ;;
  545. -prefer-pic)
  546. pic_mode=yes
  547. continue
  548. ;;
  549. -prefer-non-pic)
  550. pic_mode=no
  551. continue
  552. ;;
  553. esac
  554. done
  555. objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  556. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  557. if test "X$xdir" = "X$obj"; then
  558. xdir=
  559. else
  560. xdir=$xdir/
  561. fi
  562. lobj=${xdir}$objdir/$objname
  563. if test -z "$base_compile"; then
  564. $echo "$modename: you must specify a compilation command" 1>&2
  565. $echo "$help" 1>&2
  566. exit $EXIT_FAILURE
  567. fi
  568. # Delete any leftover library objects.
  569. if test "$build_old_libs" = yes; then
  570. removelist="$obj $lobj $libobj ${libobj}T"
  571. else
  572. removelist="$lobj $libobj ${libobj}T"
  573. fi
  574. $run $rm $removelist
  575. trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  576. # On Cygwin there's no "real" PIC flag so we must build both object types
  577. case $host_os in
  578. cygwin* | mingw* | pw32* | os2*)
  579. pic_mode=default
  580. ;;
  581. esac
  582. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  583. # non-PIC code in shared libraries is not supported
  584. pic_mode=default
  585. fi
  586. # Calculate the filename of the output object if compiler does
  587. # not support -o with -c
  588. if test "$compiler_c_o" = no; then
  589. output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  590. lockfile="$output_obj.lock"
  591. removelist="$removelist $output_obj $lockfile"
  592. trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  593. else
  594. output_obj=
  595. need_locks=no
  596. lockfile=
  597. fi
  598. # Lock this critical section if it is needed
  599. # We use this script file to make the link, it avoids creating a new file
  600. if test "$need_locks" = yes; then
  601. until $run ln "$progpath" "$lockfile" 2>/dev/null; do
  602. $show "Waiting for $lockfile to be removed"
  603. sleep 2
  604. done
  605. elif test "$need_locks" = warn; then
  606. if test -f "$lockfile"; then
  607. $echo "\
  608. *** ERROR, $lockfile exists and contains:
  609. `cat $lockfile 2>/dev/null`
  610. This indicates that another process is trying to use the same
  611. temporary object file, and libtool could not work around it because
  612. your compiler does not support \`-c' and \`-o' together. If you
  613. repeat this compilation, it may succeed, by chance, but you had better
  614. avoid parallel builds (make -j) in this platform, or get a better
  615. compiler."
  616. $run $rm $removelist
  617. exit $EXIT_FAILURE
  618. fi
  619. $echo $srcfile > "$lockfile"
  620. fi
  621. if test -n "$fix_srcfile_path"; then
  622. eval srcfile=\"$fix_srcfile_path\"
  623. fi
  624. $run $rm "$libobj" "${libobj}T"
  625. # Create a libtool object file (analogous to a ".la" file),
  626. # but don't create it if we're doing a dry run.
  627. test -z "$run" && cat > ${libobj}T <<EOF
  628. # $libobj - a libtool object file
  629. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  630. #
  631. # Please DO NOT delete this file!
  632. # It is necessary for linking the library.
  633. # Name of the PIC object.
  634. EOF
  635. # Only build a PIC object if we are building libtool libraries.
  636. if test "$build_libtool_libs" = yes; then
  637. # Without this assignment, base_compile gets emptied.
  638. fbsd_hideous_sh_bug=$base_compile
  639. if test "$pic_mode" != no; then
  640. command="$base_compile $srcfile $pic_flag"
  641. else
  642. # Don't build PIC code
  643. command="$base_compile $srcfile"
  644. fi
  645. if test ! -d "${xdir}$objdir"; then
  646. $show "$mkdir ${xdir}$objdir"
  647. $run $mkdir ${xdir}$objdir
  648. status=$?
  649. if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
  650. exit $status
  651. fi
  652. fi
  653. if test -z "$output_obj"; then
  654. # Place PIC objects in $objdir
  655. command="$command -o $lobj"
  656. fi
  657. $run $rm "$lobj" "$output_obj"
  658. $show "$command"
  659. if $run eval "$command"; then :
  660. else
  661. test -n "$output_obj" && $run $rm $removelist
  662. exit $EXIT_FAILURE
  663. fi
  664. if test "$need_locks" = warn &&
  665. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  666. $echo "\
  667. *** ERROR, $lockfile contains:
  668. `cat $lockfile 2>/dev/null`
  669. but it should contain:
  670. $srcfile
  671. This indicates that another process is trying to use the same
  672. temporary object file, and libtool could not work around it because
  673. your compiler does not support \`-c' and \`-o' together. If you
  674. repeat this compilation, it may succeed, by chance, but you had better
  675. avoid parallel builds (make -j) in this platform, or get a better
  676. compiler."
  677. $run $rm $removelist
  678. exit $EXIT_FAILURE
  679. fi
  680. # Just move the object if needed, then go on to compile the next one
  681. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  682. $show "$mv $output_obj $lobj"
  683. if $run $mv $output_obj $lobj; then :
  684. else
  685. error=$?
  686. $run $rm $removelist
  687. exit $error
  688. fi
  689. fi
  690. # Append the name of the PIC object to the libtool object file.
  691. test -z "$run" && cat >> ${libobj}T <<EOF
  692. pic_object='$objdir/$objname'
  693. EOF
  694. # Allow error messages only from the first compilation.
  695. if test "$suppress_opt" = yes; then
  696. suppress_output=' >/dev/null 2>&1'
  697. fi
  698. else
  699. # No PIC object so indicate it doesn't exist in the libtool
  700. # object file.
  701. test -z "$run" && cat >> ${libobj}T <<EOF
  702. pic_object=none
  703. EOF
  704. fi
  705. # Only build a position-dependent object if we build old libraries.
  706. if test "$build_old_libs" = yes; then
  707. if test "$pic_mode" != yes; then
  708. # Don't build PIC code
  709. command="$base_compile $srcfile"
  710. else
  711. command="$base_compile $srcfile $pic_flag"
  712. fi
  713. if test "$compiler_c_o" = yes; then
  714. command="$command -o $obj"
  715. fi
  716. # Suppress compiler output if we already did a PIC compilation.
  717. command="$command$suppress_output"
  718. $run $rm "$obj" "$output_obj"
  719. $show "$command"
  720. if $run eval "$command"; then :
  721. else
  722. $run $rm $removelist
  723. exit $EXIT_FAILURE
  724. fi
  725. if test "$need_locks" = warn &&
  726. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  727. $echo "\
  728. *** ERROR, $lockfile contains:
  729. `cat $lockfile 2>/dev/null`
  730. but it should contain:
  731. $srcfile
  732. This indicates that another process is trying to use the same
  733. temporary object file, and libtool could not work around it because
  734. your compiler does not support \`-c' and \`-o' together. If you
  735. repeat this compilation, it may succeed, by chance, but you had better
  736. avoid parallel builds (make -j) in this platform, or get a better
  737. compiler."
  738. $run $rm $removelist
  739. exit $EXIT_FAILURE
  740. fi
  741. # Just move the object if needed
  742. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  743. $show "$mv $output_obj $obj"
  744. if $run $mv $output_obj $obj; then :
  745. else
  746. error=$?
  747. $run $rm $removelist
  748. exit $error
  749. fi
  750. fi
  751. # Append the name of the non-PIC object the libtool object file.
  752. # Only append if the libtool object file exists.
  753. test -z "$run" && cat >> ${libobj}T <<EOF
  754. # Name of the non-PIC object.
  755. non_pic_object='$objname'
  756. EOF
  757. else
  758. # Append the name of the non-PIC object the libtool object file.
  759. # Only append if the libtool object file exists.
  760. test -z "$run" && cat >> ${libobj}T <<EOF
  761. # Name of the non-PIC object.
  762. non_pic_object=none
  763. EOF
  764. fi
  765. $run $mv "${libobj}T" "${libobj}"
  766. # Unlock the critical section if it was locked
  767. if test "$need_locks" != no; then
  768. $run $rm "$lockfile"
  769. fi
  770. exit $EXIT_SUCCESS
  771. ;;
  772. # libtool link mode
  773. link | relink)
  774. modename="$modename: link"
  775. case $host in
  776. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  777. # It is impossible to link a dll without this setting, and
  778. # we shouldn't force the makefile maintainer to figure out
  779. # which system we are compiling for in order to pass an extra
  780. # flag for every libtool invocation.
  781. # allow_undefined=no
  782. # FIXME: Unfortunately, there are problems with the above when trying
  783. # to make a dll which has undefined symbols, in which case not
  784. # even a static library is built. For now, we need to specify
  785. # -no-undefined on the libtool link line when we can be certain
  786. # that all symbols are satisfied, otherwise we get a static library.
  787. allow_undefined=yes
  788. ;;
  789. *)
  790. allow_undefined=yes
  791. ;;
  792. esac
  793. libtool_args="$nonopt"
  794. base_compile="$nonopt $@"
  795. compile_command="$nonopt"
  796. finalize_command="$nonopt"
  797. compile_rpath=
  798. finalize_rpath=
  799. compile_shlibpath=
  800. finalize_shlibpath=
  801. convenience=
  802. old_convenience=
  803. deplibs=
  804. old_deplibs=
  805. compiler_flags=
  806. linker_flags=
  807. dllsearchpath=
  808. lib_search_path=`pwd`
  809. inst_prefix_dir=
  810. avoid_version=no
  811. dlfiles=
  812. dlprefiles=
  813. dlself=no
  814. export_dynamic=no
  815. export_symbols=
  816. export_symbols_regex=
  817. generated=
  818. libobjs=
  819. ltlibs=
  820. module=no
  821. no_install=no
  822. objs=
  823. non_pic_objects=
  824. precious_files_regex=
  825. prefer_static_libs=no
  826. preload=no
  827. prev=
  828. prevarg=
  829. release=
  830. rpath=
  831. xrpath=
  832. perm_rpath=
  833. temp_rpath=
  834. thread_safe=no
  835. vinfo=
  836. vinfo_number=no
  837. func_infer_tag $base_compile
  838. # We need to know -static, to get the right output filenames.
  839. for arg
  840. do
  841. case $arg in
  842. -all-static | -static)
  843. if test "X$arg" = "X-all-static"; then
  844. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  845. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  846. fi
  847. if test -n "$link_static_flag"; then
  848. dlopen_self=$dlopen_self_static
  849. fi
  850. else
  851. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  852. dlopen_self=$dlopen_self_static
  853. fi
  854. fi
  855. build_libtool_libs=no
  856. build_old_libs=yes
  857. prefer_static_libs=yes
  858. break
  859. ;;
  860. esac
  861. done
  862. # See if our shared archives depend on static archives.
  863. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  864. # Go through the arguments, transforming them on the way.
  865. while test "$#" -gt 0; do
  866. arg="$1"
  867. shift
  868. case $arg in
  869. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  870. qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  871. ;;
  872. *) qarg=$arg ;;
  873. esac
  874. libtool_args="$libtool_args $qarg"
  875. # If the previous option needs an argument, assign it.
  876. if test -n "$prev"; then
  877. case $prev in
  878. output)
  879. compile_command="$compile_command @OUTPUT@"
  880. finalize_command="$finalize_command @OUTPUT@"
  881. ;;
  882. esac
  883. case $prev in
  884. dlfiles|dlprefiles)
  885. if test "$preload" = no; then
  886. # Add the symbol object into the linking commands.
  887. compile_command="$compile_command @SYMFILE@"
  888. finalize_command="$finalize_command @SYMFILE@"
  889. preload=yes
  890. fi
  891. case $arg in
  892. *.la | *.lo) ;; # We handle these cases below.
  893. force)
  894. if test "$dlself" = no; then
  895. dlself=needless
  896. export_dynamic=yes
  897. fi
  898. prev=
  899. continue
  900. ;;
  901. self)
  902. if test "$prev" = dlprefiles; then
  903. dlself=yes
  904. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  905. dlself=yes
  906. else
  907. dlself=needless
  908. export_dynamic=yes
  909. fi
  910. prev=
  911. continue
  912. ;;
  913. *)
  914. if test "$prev" = dlfiles; then
  915. dlfiles="$dlfiles $arg"
  916. else
  917. dlprefiles="$dlprefiles $arg"
  918. fi
  919. prev=
  920. continue
  921. ;;
  922. esac
  923. ;;
  924. expsyms)
  925. export_symbols="$arg"
  926. if test ! -f "$arg"; then
  927. $echo "$modename: symbol file \`$arg' does not exist"
  928. exit $EXIT_FAILURE
  929. fi
  930. prev=
  931. continue
  932. ;;
  933. expsyms_regex)
  934. export_symbols_regex="$arg"
  935. prev=
  936. continue
  937. ;;
  938. inst_prefix)
  939. inst_prefix_dir="$arg"
  940. prev=
  941. continue
  942. ;;
  943. precious_regex)
  944. precious_files_regex="$arg"
  945. prev=
  946. continue
  947. ;;
  948. release)
  949. release="-$arg"
  950. prev=
  951. continue
  952. ;;
  953. objectlist)
  954. if test -f "$arg"; then
  955. save_arg=$arg
  956. moreargs=
  957. for fil in `cat $save_arg`
  958. do
  959. # moreargs="$moreargs $fil"
  960. arg=$fil
  961. # A libtool-controlled object.
  962. # Check to see that this really is a libtool object.
  963. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  964. pic_object=
  965. non_pic_object=
  966. # Read the .lo file
  967. # If there is no directory component, then add one.
  968. case $arg in
  969. */* | *\\*) . $arg ;;
  970. *) . ./$arg ;;
  971. esac
  972. if test -z "$pic_object" || \
  973. test -z "$non_pic_object" ||
  974. test "$pic_object" = none && \
  975. test "$non_pic_object" = none; then
  976. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  977. exit $EXIT_FAILURE
  978. fi
  979. # Extract subdirectory from the argument.
  980. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  981. if test "X$xdir" = "X$arg"; then
  982. xdir=
  983. else
  984. xdir="$xdir/"
  985. fi
  986. if test "$pic_object" != none; then
  987. # Prepend the subdirectory the object is found in.
  988. pic_object="$xdir$pic_object"
  989. if test "$prev" = dlfiles; then
  990. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  991. dlfiles="$dlfiles $pic_object"
  992. prev=
  993. continue
  994. else
  995. # If libtool objects are unsupported, then we need to preload.
  996. prev=dlprefiles
  997. fi
  998. fi
  999. # CHECK ME: I think I busted this. -Ossama
  1000. if test "$prev" = dlprefiles; then
  1001. # Preload the old-style object.
  1002. dlprefiles="$dlprefiles $pic_object"
  1003. prev=
  1004. fi
  1005. # A PIC object.
  1006. libobjs="$libobjs $pic_object"
  1007. arg="$pic_object"
  1008. fi
  1009. # Non-PIC object.
  1010. if test "$non_pic_object" != none; then
  1011. # Prepend the subdirectory the object is found in.
  1012. non_pic_object="$xdir$non_pic_object"
  1013. # A standard non-PIC object
  1014. non_pic_objects="$non_pic_objects $non_pic_object"
  1015. if test -z "$pic_object" || test "$pic_object" = none ; then
  1016. arg="$non_pic_object"
  1017. fi
  1018. fi
  1019. else
  1020. # Only an error if not doing a dry-run.
  1021. if test -z "$run"; then
  1022. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1023. exit $EXIT_FAILURE
  1024. else
  1025. # Dry-run case.
  1026. # Extract subdirectory from the argument.
  1027. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1028. if test "X$xdir" = "X$arg"; then
  1029. xdir=
  1030. else
  1031. xdir="$xdir/"
  1032. fi
  1033. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1034. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1035. libobjs="$libobjs $pic_object"
  1036. non_pic_objects="$non_pic_objects $non_pic_object"
  1037. fi
  1038. fi
  1039. done
  1040. else
  1041. $echo "$modename: link input file \`$save_arg' does not exist"
  1042. exit $EXIT_FAILURE
  1043. fi
  1044. arg=$save_arg
  1045. prev=
  1046. continue
  1047. ;;
  1048. rpath | xrpath)
  1049. # We need an absolute path.
  1050. case $arg in
  1051. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1052. *)
  1053. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1054. exit $EXIT_FAILURE
  1055. ;;
  1056. esac
  1057. if test "$prev" = rpath; then
  1058. case "$rpath " in
  1059. *" $arg "*) ;;
  1060. *) rpath="$rpath $arg" ;;
  1061. esac
  1062. else
  1063. case "$xrpath " in
  1064. *" $arg "*) ;;
  1065. *) xrpath="$xrpath $arg" ;;
  1066. esac
  1067. fi
  1068. prev=
  1069. continue
  1070. ;;
  1071. xcompiler)
  1072. compiler_flags="$compiler_flags $qarg"
  1073. prev=
  1074. compile_command="$compile_command $qarg"
  1075. finalize_command="$finalize_command $qarg"
  1076. continue
  1077. ;;
  1078. xlinker)
  1079. linker_flags="$linker_flags $qarg"
  1080. compiler_flags="$compiler_flags $wl$qarg"
  1081. prev=
  1082. compile_command="$compile_command $wl$qarg"
  1083. finalize_command="$finalize_command $wl$qarg"
  1084. continue
  1085. ;;
  1086. xcclinker)
  1087. linker_flags="$linker_flags $qarg"
  1088. compiler_flags="$compiler_flags $qarg"
  1089. prev=
  1090. compile_command="$compile_command $qarg"
  1091. finalize_command="$finalize_command $qarg"
  1092. continue
  1093. ;;
  1094. shrext)
  1095. shrext_cmds="$arg"
  1096. prev=
  1097. continue
  1098. ;;
  1099. *)
  1100. eval "$prev=\"\$arg\""
  1101. prev=
  1102. continue
  1103. ;;
  1104. esac
  1105. fi # test -n "$prev"
  1106. prevarg="$arg"
  1107. case $arg in
  1108. -all-static)
  1109. if test -n "$link_static_flag"; then
  1110. compile_command="$compile_command $link_static_flag"
  1111. finalize_command="$finalize_command $link_static_flag"
  1112. fi
  1113. continue
  1114. ;;
  1115. -allow-undefined)
  1116. # FIXME: remove this flag sometime in the future.
  1117. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1118. continue
  1119. ;;
  1120. -avoid-version)
  1121. avoid_version=yes
  1122. continue
  1123. ;;
  1124. -dlopen)
  1125. prev=dlfiles
  1126. continue
  1127. ;;
  1128. -dlpreopen)
  1129. prev=dlprefiles
  1130. continue
  1131. ;;
  1132. -export-dynamic)
  1133. export_dynamic=yes
  1134. continue
  1135. ;;
  1136. -export-symbols | -export-symbols-regex)
  1137. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1138. $echo "$modename: more than one -exported-symbols argument is not allowed"
  1139. exit $EXIT_FAILURE
  1140. fi
  1141. if test "X$arg" = "X-export-symbols"; then
  1142. prev=expsyms
  1143. else
  1144. prev=expsyms_regex
  1145. fi
  1146. continue
  1147. ;;
  1148. -inst-prefix-dir)
  1149. prev=inst_prefix
  1150. continue
  1151. ;;
  1152. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1153. # so, if we see these flags be careful not to treat them like -L
  1154. -L[A-Z][A-Z]*:*)
  1155. case $with_gcc/$host in
  1156. no/*-*-irix* | /*-*-irix*)
  1157. compile_command="$compile_command $arg"
  1158. finalize_command="$finalize_command $arg"
  1159. ;;
  1160. esac
  1161. continue
  1162. ;;
  1163. -L*)
  1164. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1165. # We need an absolute path.
  1166. case $dir in
  1167. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1168. *)
  1169. absdir=`cd "$dir" && pwd`
  1170. if test -z "$absdir"; then
  1171. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1172. exit $EXIT_FAILURE
  1173. fi
  1174. dir="$absdir"
  1175. ;;
  1176. esac
  1177. case "$deplibs " in
  1178. *" -L$dir "*) ;;
  1179. *)
  1180. deplibs="$deplibs -L$dir"
  1181. lib_search_path="$lib_search_path $dir"
  1182. ;;
  1183. esac
  1184. case $host in
  1185. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1186. case :$dllsearchpath: in
  1187. *":$dir:"*) ;;
  1188. *) dllsearchpath="$dllsearchpath:$dir";;
  1189. esac
  1190. ;;
  1191. esac
  1192. continue
  1193. ;;
  1194. -l*)
  1195. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1196. case $host in
  1197. *-*-cygwin* | *-*-pw32* | *-*-beos*)
  1198. # These systems don't actually have a C or math library (as such)
  1199. continue
  1200. ;;
  1201. *-*-mingw* | *-*-os2*)
  1202. # These systems don't actually have a C library (as such)
  1203. test "X$arg" = "X-lc" && continue
  1204. ;;
  1205. *-*-openbsd* | *-*-freebsd*)
  1206. # Do not include libc due to us having libc/libc_r.
  1207. test "X$arg" = "X-lc" && continue
  1208. ;;
  1209. *-*-rhapsody* | *-*-darwin1.[012])
  1210. # Rhapsody C and math libraries are in the System framework
  1211. deplibs="$deplibs -framework System"
  1212. continue
  1213. esac
  1214. elif test "X$arg" = "X-lc_r"; then
  1215. case $host in
  1216. *-*-openbsd* | *-*-freebsd*)
  1217. # Do not include libc_r directly, use -pthread flag.
  1218. continue
  1219. ;;
  1220. esac
  1221. fi
  1222. deplibs="$deplibs $arg"
  1223. continue
  1224. ;;
  1225. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1226. deplibs="$deplibs $arg"
  1227. continue
  1228. ;;
  1229. -module)
  1230. module=yes
  1231. continue
  1232. ;;
  1233. # gcc -m* arguments should be passed to the linker via $compiler_flags
  1234. # in order to pass architecture information to the linker
  1235. # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
  1236. # but this is not reliable with gcc because gcc may use -mfoo to
  1237. # select a different linker, different libraries, etc, while
  1238. # -Wl,-mfoo simply passes -mfoo to the linker.
  1239. -m*)
  1240. # Unknown arguments in both finalize_command and compile_command need
  1241. # to be aesthetically quoted because they are evaled later.
  1242. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1243. case $arg in
  1244. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1245. arg="\"$arg\""
  1246. ;;
  1247. esac
  1248. compile_command="$compile_command $arg"
  1249. finalize_command="$finalize_command $arg"
  1250. if test "$with_gcc" = "yes" ; then
  1251. compiler_flags="$compiler_flags $arg"
  1252. fi
  1253. continue
  1254. ;;
  1255. -shrext)
  1256. prev=shrext
  1257. continue
  1258. ;;
  1259. -no-fast-install)
  1260. fast_install=no
  1261. continue
  1262. ;;
  1263. -no-install)
  1264. case $host in
  1265. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1266. # The PATH hackery in wrapper scripts is required on Windows
  1267. # in order for the loader to find any dlls it needs.
  1268. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1269. $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1270. fast_install=no
  1271. ;;
  1272. *) no_install=yes ;;
  1273. esac
  1274. continue
  1275. ;;
  1276. -no-undefined)
  1277. allow_undefined=no
  1278. continue
  1279. ;;
  1280. -objectlist)
  1281. prev=objectlist
  1282. continue
  1283. ;;
  1284. -o) prev=output ;;
  1285. -precious-files-regex)
  1286. prev=precious_regex
  1287. continue
  1288. ;;
  1289. -release)
  1290. prev=release
  1291. continue
  1292. ;;
  1293. -rpath)
  1294. prev=rpath
  1295. continue
  1296. ;;
  1297. -R)
  1298. prev=xrpath
  1299. continue
  1300. ;;
  1301. -R*)
  1302. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1303. # We need an absolute path.
  1304. case $dir in
  1305. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1306. *)
  1307. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1308. exit $EXIT_FAILURE
  1309. ;;
  1310. esac
  1311. case "$xrpath " in
  1312. *" $dir "*) ;;
  1313. *) xrpath="$xrpath $dir" ;;
  1314. esac
  1315. continue
  1316. ;;
  1317. -static)
  1318. # The effects of -static are defined in a previous loop.
  1319. # We used to do the same as -all-static on platforms that
  1320. # didn't have a PIC flag, but the assumption that the effects
  1321. # would be equivalent was wrong. It would break on at least
  1322. # Digital Unix and AIX.
  1323. continue
  1324. ;;
  1325. -thread-safe)
  1326. thread_safe=yes
  1327. continue
  1328. ;;
  1329. -version-info)
  1330. prev=vinfo
  1331. continue
  1332. ;;
  1333. -version-number)
  1334. prev=vinfo
  1335. vinfo_number=yes
  1336. continue
  1337. ;;
  1338. -Wc,*)
  1339. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1340. arg=
  1341. save_ifs="$IFS"; IFS=','
  1342. for flag in $args; do
  1343. IFS="$save_ifs"
  1344. case $flag in
  1345. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1346. flag="\"$flag\""
  1347. ;;
  1348. esac
  1349. arg="$arg $wl$flag"
  1350. compiler_flags="$compiler_flags $flag"
  1351. done
  1352. IFS="$save_ifs"
  1353. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1354. ;;
  1355. -Wl,*)
  1356. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1357. arg=
  1358. save_ifs="$IFS"; IFS=','
  1359. for flag in $args; do
  1360. IFS="$save_ifs"
  1361. case $flag in
  1362. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1363. flag="\"$flag\""
  1364. ;;
  1365. esac
  1366. arg="$arg $wl$flag"
  1367. compiler_flags="$compiler_flags $wl$flag"
  1368. linker_flags="$linker_flags $flag"
  1369. done
  1370. IFS="$save_ifs"
  1371. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1372. ;;
  1373. -Xcompiler)
  1374. prev=xcompiler
  1375. continue
  1376. ;;
  1377. -Xlinker)
  1378. prev=xlinker
  1379. continue
  1380. ;;
  1381. -XCClinker)
  1382. prev=xcclinker
  1383. continue
  1384. ;;
  1385. # Some other compiler flag.
  1386. -* | +*)
  1387. # Unknown arguments in both finalize_command and compile_command need
  1388. # to be aesthetically quoted because they are evaled later.
  1389. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1390. case $arg in
  1391. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1392. arg="\"$arg\""
  1393. ;;
  1394. esac
  1395. ;;
  1396. *.$objext)
  1397. # A standard object.
  1398. objs="$objs $arg"
  1399. ;;
  1400. *.lo)
  1401. # A libtool-controlled object.
  1402. # Check to see that this really is a libtool object.
  1403. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1404. pic_object=
  1405. non_pic_object=
  1406. # Read the .lo file
  1407. # If there is no directory component, then add one.
  1408. case $arg in
  1409. */* | *\\*) . $arg ;;
  1410. *) . ./$arg ;;
  1411. esac
  1412. if test -z "$pic_object" || \
  1413. test -z "$non_pic_object" ||
  1414. test "$pic_object" = none && \
  1415. test "$non_pic_object" = none; then
  1416. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1417. exit $EXIT_FAILURE
  1418. fi
  1419. # Extract subdirectory from the argument.
  1420. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1421. if test "X$xdir" = "X$arg"; then
  1422. xdir=
  1423. else
  1424. xdir="$xdir/"
  1425. fi
  1426. if test "$pic_object" != none; then
  1427. # Prepend the subdirectory the object is found in.
  1428. pic_object="$xdir$pic_object"
  1429. if test "$prev" = dlfiles; then
  1430. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1431. dlfiles="$dlfiles $pic_object"
  1432. prev=
  1433. continue
  1434. else
  1435. # If libtool objects are unsupported, then we need to preload.
  1436. prev=dlprefiles
  1437. fi
  1438. fi
  1439. # CHECK ME: I think I busted this. -Ossama
  1440. if test "$prev" = dlprefiles; then
  1441. # Preload the old-style object.
  1442. dlprefiles="$dlprefiles $pic_object"
  1443. prev=
  1444. fi
  1445. # A PIC object.
  1446. libobjs="$libobjs $pic_object"
  1447. arg="$pic_object"
  1448. fi
  1449. # Non-PIC object.
  1450. if test "$non_pic_object" != none; then
  1451. # Prepend the subdirectory the object is found in.
  1452. non_pic_object="$xdir$non_pic_object"
  1453. # A standard non-PIC object
  1454. non_pic_objects="$non_pic_objects $non_pic_object"
  1455. if test -z "$pic_object" || test "$pic_object" = none ; then
  1456. arg="$non_pic_object"
  1457. fi
  1458. fi
  1459. else
  1460. # Only an error if not doing a dry-run.
  1461. if test -z "$run"; then
  1462. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1463. exit $EXIT_FAILURE
  1464. else
  1465. # Dry-run case.
  1466. # Extract subdirectory from the argument.
  1467. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1468. if test "X$xdir" = "X$arg"; then
  1469. xdir=
  1470. else
  1471. xdir="$xdir/"
  1472. fi
  1473. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1474. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1475. libobjs="$libobjs $pic_object"
  1476. non_pic_objects="$non_pic_objects $non_pic_object"
  1477. fi
  1478. fi
  1479. ;;
  1480. *.$libext)
  1481. # An archive.
  1482. deplibs="$deplibs $arg"
  1483. old_deplibs="$old_deplibs $arg"
  1484. continue
  1485. ;;
  1486. *.la)
  1487. # A libtool-controlled library.
  1488. if test "$prev" = dlfiles; then
  1489. # This library was specified with -dlopen.
  1490. dlfiles="$dlfiles $arg"
  1491. prev=
  1492. elif test "$prev" = dlprefiles; then
  1493. # The library was specified with -dlpreopen.
  1494. dlprefiles="$dlprefiles $arg"
  1495. prev=
  1496. else
  1497. deplibs="$deplibs $arg"
  1498. fi
  1499. continue
  1500. ;;
  1501. # Some other compiler argument.
  1502. *)
  1503. # Unknown arguments in both finalize_command and compile_command need
  1504. # to be aesthetically quoted because they are evaled later.
  1505. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1506. case $arg in
  1507. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1508. arg="\"$arg\""
  1509. ;;
  1510. esac
  1511. ;;
  1512. esac # arg
  1513. # Now actually substitute the argument into the commands.
  1514. if test -n "$arg"; then
  1515. compile_command="$compile_command $arg"
  1516. finalize_command="$finalize_command $arg"
  1517. fi
  1518. done # argument parsing loop
  1519. if test -n "$prev"; then
  1520. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1521. $echo "$help" 1>&2
  1522. exit $EXIT_FAILURE
  1523. fi
  1524. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1525. eval arg=\"$export_dynamic_flag_spec\"
  1526. compile_command="$compile_command $arg"
  1527. finalize_command="$finalize_command $arg"
  1528. fi
  1529. oldlibs=
  1530. # calculate the name of the file, without its directory
  1531. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1532. libobjs_save="$libobjs"
  1533. if test -n "$shlibpath_var"; then
  1534. # get the directories listed in $shlibpath_var
  1535. eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1536. else
  1537. shlib_search_path=
  1538. fi
  1539. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1540. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1541. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1542. if test "X$output_objdir" = "X$output"; then
  1543. output_objdir="$objdir"
  1544. else
  1545. output_objdir="$output_objdir/$objdir"
  1546. fi
  1547. # Create the object directory.
  1548. if test ! -d "$output_objdir"; then
  1549. $show "$mkdir $output_objdir"
  1550. $run $mkdir $output_objdir
  1551. status=$?
  1552. if test "$status" -ne 0 && test ! -d "$output_objdir"; then
  1553. exit $status
  1554. fi
  1555. fi
  1556. # Determine the type of output
  1557. case $output in
  1558. "")
  1559. $echo "$modename: you must specify an output file" 1>&2
  1560. $echo "$help" 1>&2
  1561. exit $EXIT_FAILURE
  1562. ;;
  1563. *.$libext) linkmode=oldlib ;;
  1564. *.lo | *.$objext) linkmode=obj ;;
  1565. *.la) linkmode=lib ;;
  1566. *) linkmode=prog ;; # Anything else should be a program.
  1567. esac
  1568. case $host in
  1569. *cygwin* | *mingw* | *pw32*)
  1570. # don't eliminate duplications in $postdeps and $predeps
  1571. duplicate_compiler_generated_deps=yes
  1572. ;;
  1573. *)
  1574. duplicate_compiler_generated_deps=$duplicate_deps
  1575. ;;
  1576. esac
  1577. specialdeplibs=
  1578. libs=
  1579. # Find all interdependent deplibs by searching for libraries
  1580. # that are linked more than once (e.g. -la -lb -la)
  1581. for deplib in $deplibs; do
  1582. if test "X$duplicate_deps" = "Xyes" ; then
  1583. case "$libs " in
  1584. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1585. esac
  1586. fi
  1587. libs="$libs $deplib"
  1588. done
  1589. if test "$linkmode" = lib; then
  1590. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1591. # Compute libraries that are listed more than once in $predeps
  1592. # $postdeps and mark them as special (i.e., whose duplicates are
  1593. # not to be eliminated).
  1594. pre_post_deps=
  1595. if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1596. for pre_post_dep in $predeps $postdeps; do
  1597. case "$pre_post_deps " in
  1598. *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1599. esac
  1600. pre_post_deps="$pre_post_deps $pre_post_dep"
  1601. done
  1602. fi
  1603. pre_post_deps=
  1604. fi
  1605. deplibs=
  1606. newdependency_libs=
  1607. newlib_search_path=
  1608. need_relink=no # whether we're linking any uninstalled libtool libraries
  1609. notinst_deplibs= # not-installed libtool libraries
  1610. notinst_path= # paths that contain not-installed libtool libraries
  1611. case $linkmode in
  1612. lib)
  1613. passes="conv link"
  1614. for file in $dlfiles $dlprefiles; do
  1615. case $file in
  1616. *.la) ;;
  1617. *)
  1618. $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1619. exit $EXIT_FAILURE
  1620. ;;
  1621. esac
  1622. done
  1623. ;;
  1624. prog)
  1625. compile_deplibs=
  1626. finalize_deplibs=
  1627. alldeplibs=no
  1628. newdlfiles=
  1629. newdlprefiles=
  1630. passes="conv scan dlopen dlpreopen link"
  1631. ;;
  1632. *) passes="conv"
  1633. ;;
  1634. esac
  1635. for pass in $passes; do
  1636. if test "$linkmode,$pass" = "lib,link" ||
  1637. test "$linkmode,$pass" = "prog,scan"; then
  1638. libs="$deplibs"
  1639. deplibs=
  1640. fi
  1641. if test "$linkmode" = prog; then
  1642. case $pass in
  1643. dlopen) libs="$dlfiles" ;;
  1644. dlpreopen) libs="$dlprefiles" ;;
  1645. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1646. esac
  1647. fi
  1648. if test "$pass" = dlopen; then
  1649. # Collect dlpreopened libraries
  1650. save_deplibs="$deplibs"
  1651. deplibs=
  1652. fi
  1653. for deplib in $libs; do
  1654. lib=
  1655. found=no
  1656. case $deplib in
  1657. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1658. if test "$linkmode,$pass" = "prog,link"; then
  1659. compile_deplibs="$deplib $compile_deplibs"
  1660. finalize_deplibs="$deplib $finalize_deplibs"
  1661. else
  1662. deplibs="$deplib $deplibs"
  1663. fi
  1664. continue
  1665. ;;
  1666. -l*)
  1667. if test "$linkmode" != lib && test "$linkmode" != prog; then
  1668. $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1669. continue
  1670. fi
  1671. if test "$pass" = conv; then
  1672. deplibs="$deplib $deplibs"
  1673. continue
  1674. fi
  1675. name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1676. for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1677. for search_ext in .la $std_shrext .so .a; do
  1678. # Search the libtool library
  1679. lib="$searchdir/lib${name}${search_ext}"
  1680. if test -f "$lib"; then
  1681. if test "$search_ext" = ".la"; then
  1682. found=yes
  1683. else
  1684. found=no
  1685. fi
  1686. break 2
  1687. fi
  1688. done
  1689. done
  1690. if test "$found" != yes; then
  1691. # deplib doesn't seem to be a libtool library
  1692. if test "$linkmode,$pass" = "prog,link"; then
  1693. compile_deplibs="$deplib $compile_deplibs"
  1694. finalize_deplibs="$deplib $finalize_deplibs"
  1695. else
  1696. deplibs="$deplib $deplibs"
  1697. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1698. fi
  1699. continue
  1700. else # deplib is a libtool library
  1701. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1702. # We need to do some special things here, and not later.
  1703. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1704. case " $predeps $postdeps " in
  1705. *" $deplib "*)
  1706. if (${SED} -e '2q' $lib |
  1707. grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1708. library_names=
  1709. old_library=
  1710. case $lib in
  1711. */* | *\\*) . $lib ;;
  1712. *) . ./$lib ;;
  1713. esac
  1714. for l in $old_library $library_names; do
  1715. ll="$l"
  1716. done
  1717. if test "X$ll" = "X$old_library" ; then # only static version available
  1718. found=no
  1719. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1720. test "X$ladir" = "X$lib" && ladir="."
  1721. lib=$ladir/$old_library
  1722. if test "$linkmode,$pass" = "prog,link"; then
  1723. compile_deplibs="$deplib $compile_deplibs"
  1724. finalize_deplibs="$deplib $finalize_deplibs"
  1725. else
  1726. deplibs="$deplib $deplibs"
  1727. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1728. fi
  1729. continue
  1730. fi
  1731. fi
  1732. ;;
  1733. *) ;;
  1734. esac
  1735. fi
  1736. fi
  1737. ;; # -l
  1738. -L*)
  1739. case $linkmode in
  1740. lib)
  1741. deplibs="$deplib $deplibs"
  1742. test "$pass" = conv && continue
  1743. newdependency_libs="$deplib $newdependency_libs"
  1744. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1745. ;;
  1746. prog)
  1747. if test "$pass" = conv; then
  1748. deplibs="$deplib $deplibs"
  1749. continue
  1750. fi
  1751. if test "$pass" = scan; then
  1752. deplibs="$deplib $deplibs"
  1753. else
  1754. compile_deplibs="$deplib $compile_deplibs"
  1755. finalize_deplibs="$deplib $finalize_deplibs"
  1756. fi
  1757. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1758. ;;
  1759. *)
  1760. $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1761. ;;
  1762. esac # linkmode
  1763. continue
  1764. ;; # -L
  1765. -R*)
  1766. if test "$pass" = link; then
  1767. dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1768. # Make sure the xrpath…

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