PageRenderTime 55ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/S3_4_COMPILE_IN_LINUX_VC_CYGWIN/sphinx3/ltmain.sh

#
Shell | 2449 lines | 2087 code | 147 blank | 215 comment | 201 complexity | 77fa9950dd108b6a4ad5a6463e5611e9 MD5 | raw file
Possible License(s): Apache-2.0, CC-BY-SA-3.0, BSD-3-Clause, LGPL-2.0, BSD-3-Clause-No-Nuclear-License-2014

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

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