PageRenderTime 73ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 2ms

/ltmain.sh

http://github.com/dreamcat4/php-fpm
Shell | 6460 lines | 5493 code | 413 blank | 554 comment | 625 complexity | cf171fa84cef17c837fe32b8945250bf MD5 | raw file

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

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