PageRenderTime 60ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/V_30_88/pfe-30/ltmain.sh

#
Shell | 2415 lines | 1934 code | 152 blank | 329 comment | 216 complexity | 25d2170ac9aa02484739c5e7e32da525 MD5 | raw file
Possible License(s): Zlib, LGPL-2.0, AGPL-3.0, LGPL-2.1

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 ltconfig.
  3. #
  4. # Copyright (C) 1996-1999 Free Software Foundation, Inc.
  5. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25. # Check that we have a working $echo.
  26. if test "X$1" = X--no-reexec; then
  27. # Discard the --no-reexec flag, and continue.
  28. shift
  29. elif test "X$1" = X--fallback-echo; then
  30. # Avoid inline document here, it may be left over
  31. :
  32. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  33. # Yippee, $echo works!
  34. :
  35. else
  36. # Restart under the correct shell, and then maybe $echo will work.
  37. exec $SHELL "$0" --no-reexec ${1+"$@"}
  38. fi
  39. if test "X$1" = X--fallback-echo; then
  40. # used as fallback echo
  41. shift
  42. cat <<EOF
  43. $*
  44. EOF
  45. exit 0
  46. fi
  47. # The name of this program.
  48. progname=`$echo "$0" | sed 's%^.*/%%'`
  49. modename="$progname"
  50. # Constants.
  51. PROGRAM=ltmain.sh
  52. PACKAGE=libtool
  53. VERSION=1.3
  54. TIMESTAMP=" (1.385.2.117 1999/04/29 13:07:13)"
  55. default_mode=
  56. help="Try \`$progname --help' for more information."
  57. magic="%%%MAGIC variable%%%"
  58. mkdir="mkdir"
  59. mv="mv -f"
  60. rm="rm -f"
  61. # Sed substitution that helps us do robust quoting. It backslashifies
  62. # metacharacters that are still active within double-quoted strings.
  63. Xsed='sed -e 1s/^X//'
  64. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  65. SP2NL='tr \040 \012'
  66. NL2SP='tr \012 \040'
  67. # NLS nuisances.
  68. # Only set LANG and LC_ALL to C if already set.
  69. # These must not be set unconditionally because not all systems understand
  70. # e.g. LANG=C (notably SCO).
  71. # We save the old values to restore during execute mode.
  72. if test "${LC_ALL+set}" = set; then
  73. save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  74. fi
  75. if test "${LANG+set}" = set; then
  76. save_LANG="$LANG"; LANG=C; export LANG
  77. fi
  78. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  79. echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  80. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  81. exit 1
  82. fi
  83. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  84. echo "$modename: not configured to build any kind of library" 1>&2
  85. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  86. exit 1
  87. fi
  88. # Global variables.
  89. mode=$default_mode
  90. nonopt=
  91. prev=
  92. prevopt=
  93. run=
  94. show="$echo"
  95. show_help=
  96. execute_dlfiles=
  97. lo2o="s/\\.lo\$/.${objext}/"
  98. o2lo="s/\\.${objext}\$/.lo/"
  99. # Parse our command line options once, thoroughly.
  100. while test $# -gt 0
  101. do
  102. arg="$1"
  103. shift
  104. case "$arg" in
  105. -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  106. *) optarg= ;;
  107. esac
  108. # If the previous option needs an argument, assign it.
  109. if test -n "$prev"; then
  110. case "$prev" in
  111. execute_dlfiles)
  112. eval "$prev=\"\$$prev \$arg\""
  113. ;;
  114. *)
  115. eval "$prev=\$arg"
  116. ;;
  117. esac
  118. prev=
  119. prevopt=
  120. continue
  121. fi
  122. # Have we seen a non-optional argument yet?
  123. case "$arg" in
  124. --help)
  125. show_help=yes
  126. ;;
  127. --version)
  128. echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  129. exit 0
  130. ;;
  131. --config)
  132. sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
  133. exit 0
  134. ;;
  135. --debug)
  136. echo "$progname: enabling shell trace mode"
  137. set -x
  138. ;;
  139. --dry-run | -n)
  140. run=:
  141. ;;
  142. --features)
  143. echo "host: $host"
  144. if test "$build_libtool_libs" = yes; then
  145. echo "enable shared libraries"
  146. else
  147. echo "disable shared libraries"
  148. fi
  149. if test "$build_old_libs" = yes; then
  150. echo "enable static libraries"
  151. else
  152. echo "disable static libraries"
  153. fi
  154. exit 0
  155. ;;
  156. --finish) mode="finish" ;;
  157. --mode) prevopt="--mode" prev=mode ;;
  158. --mode=*) mode="$optarg" ;;
  159. --quiet | --silent)
  160. show=:
  161. ;;
  162. -dlopen)
  163. prevopt="-dlopen"
  164. prev=execute_dlfiles
  165. ;;
  166. -*)
  167. $echo "$modename: unrecognized option \`$arg'" 1>&2
  168. $echo "$help" 1>&2
  169. exit 1
  170. ;;
  171. *)
  172. nonopt="$arg"
  173. break
  174. ;;
  175. esac
  176. done
  177. if test -n "$prevopt"; then
  178. $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  179. $echo "$help" 1>&2
  180. exit 1
  181. fi
  182. if test -z "$show_help"; then
  183. # Infer the operation mode.
  184. if test -z "$mode"; then
  185. case "$nonopt" in
  186. *cc | *++ | gcc* | *-gcc*)
  187. mode=link
  188. for arg
  189. do
  190. case "$arg" in
  191. -c)
  192. mode=compile
  193. break
  194. ;;
  195. esac
  196. done
  197. ;;
  198. *db | *dbx | *strace | *truss)
  199. mode=execute
  200. ;;
  201. *install*|cp|mv)
  202. mode=install
  203. ;;
  204. *rm)
  205. mode=uninstall
  206. ;;
  207. *)
  208. # If we have no mode, but dlfiles were specified, then do execute mode.
  209. test -n "$execute_dlfiles" && mode=execute
  210. # Just use the default operation mode.
  211. if test -z "$mode"; then
  212. if test -n "$nonopt"; then
  213. $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  214. else
  215. $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  216. fi
  217. fi
  218. ;;
  219. esac
  220. fi
  221. # Only execute mode is allowed to have -dlopen flags.
  222. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  223. $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  224. $echo "$help" 1>&2
  225. exit 1
  226. fi
  227. # Change the help message to a mode-specific one.
  228. generic_help="$help"
  229. help="Try \`$modename --help --mode=$mode' for more information."
  230. # These modes are in order of execution frequency so that they run quickly.
  231. case "$mode" in
  232. # libtool compile mode
  233. compile)
  234. modename="$modename: compile"
  235. # Get the compilation command and the source file.
  236. base_compile=
  237. lastarg=
  238. srcfile="$nonopt"
  239. suppress_output=
  240. user_target=no
  241. for arg
  242. do
  243. # Accept any command-line options.
  244. case "$arg" in
  245. -o)
  246. if test "$user_target" != "no"; then
  247. $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  248. exit 1
  249. fi
  250. user_target=next
  251. ;;
  252. -static)
  253. build_old_libs=yes
  254. continue
  255. ;;
  256. esac
  257. case "$user_target" in
  258. next)
  259. # The next one is the -o target name
  260. user_target=yes
  261. continue
  262. ;;
  263. yes)
  264. # We got the output file
  265. user_target=set
  266. libobj="$arg"
  267. continue
  268. ;;
  269. esac
  270. # Accept the current argument as the source file.
  271. lastarg="$srcfile"
  272. srcfile="$arg"
  273. # Aesthetically quote the previous argument.
  274. # Backslashify any backslashes, double quotes, and dollar signs.
  275. # These are the only characters that are still specially
  276. # interpreted inside of double-quoted scrings.
  277. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  278. # Double-quote args containing other shell metacharacters.
  279. # Many Bourne shells cannot handle close brackets correctly in scan
  280. # sets, so we specify it separately.
  281. case "$lastarg" in
  282. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  283. lastarg="\"$lastarg\""
  284. ;;
  285. esac
  286. # Add the previous argument to base_compile.
  287. if test -z "$base_compile"; then
  288. base_compile="$lastarg"
  289. else
  290. base_compile="$base_compile $lastarg"
  291. fi
  292. done
  293. case "$user_target" in
  294. set)
  295. ;;
  296. no)
  297. # Get the name of the library object.
  298. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  299. ;;
  300. *)
  301. $echo "$modename: you must specify a target with \`-o'" 1>&2
  302. exit 1
  303. ;;
  304. esac
  305. # Recognize several different file suffixes.
  306. # If the user specifies -o file.o, it is replaced with file.lo
  307. xform='[cCFSfmso]'
  308. case "$libobj" in
  309. *.ada) xform=ada ;;
  310. *.adb) xform=adb ;;
  311. *.ads) xform=ads ;;
  312. *.asm) xform=asm ;;
  313. *.c++) xform=c++ ;;
  314. *.cc) xform=cc ;;
  315. *.cpp) xform=cpp ;;
  316. *.cxx) xform=cxx ;;
  317. *.f90) xform=f90 ;;
  318. *.for) xform=for ;;
  319. esac
  320. libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  321. case "$libobj" in
  322. *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  323. *)
  324. $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  325. exit 1
  326. ;;
  327. esac
  328. if test -z "$base_compile"; then
  329. $echo "$modename: you must specify a compilation command" 1>&2
  330. $echo "$help" 1>&2
  331. exit 1
  332. fi
  333. # Delete any leftover library objects.
  334. if test "$build_old_libs" = yes; then
  335. removelist="$obj $libobj"
  336. else
  337. removelist="$libobj"
  338. fi
  339. $run $rm $removelist
  340. trap "$run $rm $removelist; exit 1" 1 2 15
  341. # Calculate the filename of the output object if compiler does
  342. # not support -o with -c
  343. if test "$compiler_c_o" = no; then
  344. output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
  345. lockfile="$output_obj.lock"
  346. removelist="$removelist $output_obj $lockfile"
  347. trap "$run $rm $removelist; exit 1" 1 2 15
  348. else
  349. need_locks=no
  350. lockfile=
  351. fi
  352. # Lock this critical section if it is needed
  353. # We use this script file to make the link, it avoids creating a new file
  354. if test "$need_locks" = yes; then
  355. until ln "$0" "$lockfile" 2>/dev/null; do
  356. $show "Waiting for $lockfile to be removed"
  357. sleep 2
  358. done
  359. elif test "$need_locks" = warn; then
  360. if test -f "$lockfile"; then
  361. echo "\
  362. *** ERROR, $lockfile exists and contains:
  363. `cat $lockfile 2>/dev/null`
  364. This indicates that another process is trying to use the same
  365. temporary object file, and libtool could not work around it because
  366. your compiler does not support \`-c' and \`-o' together. If you
  367. repeat this compilation, it may succeed, by chance, but you had better
  368. avoid parallel builds (make -j) in this platform, or get a better
  369. compiler."
  370. $run $rm $removelist
  371. exit 1
  372. fi
  373. echo $srcfile > "$lockfile"
  374. fi
  375. if test -n "$fix_srcfile_path"; then
  376. eval srcfile=\"$fix_srcfile_path\"
  377. fi
  378. # Only build a PIC object if we are building libtool libraries.
  379. if test "$build_libtool_libs" = yes; then
  380. # Without this assignment, base_compile gets emptied.
  381. fbsd_hideous_sh_bug=$base_compile
  382. # All platforms use -DPIC, to notify preprocessed assembler code.
  383. command="$base_compile $pic_flag -DPIC $srcfile"
  384. if test "$build_old_libs" = yes; then
  385. lo_libobj="$libobj"
  386. dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  387. if test "X$dir" = "X$libobj"; then
  388. dir="$objdir"
  389. else
  390. dir="$dir/$objdir"
  391. fi
  392. libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  393. if test -d "$dir"; then
  394. $show "$rm $libobj"
  395. $run $rm $libobj
  396. else
  397. $show "$mkdir $dir"
  398. $run $mkdir $dir
  399. status=$?
  400. if test $status -ne 0 && test ! -d $dir; then
  401. exit $status
  402. fi
  403. fi
  404. fi
  405. if test "$compiler_o_lo" = yes; then
  406. output_obj="$libobj"
  407. command="$command -o $output_obj"
  408. elif test "$compiler_c_o" = yes; then
  409. output_obj="$obj"
  410. command="$command -o $output_obj"
  411. fi
  412. $show "$command"
  413. if $run eval "$command"; then :
  414. else
  415. test -n "$output_obj" && $run $rm $removelist
  416. exit 1
  417. fi
  418. if test "$need_locks" = warn &&
  419. test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  420. echo "\
  421. *** ERROR, $lockfile contains:
  422. `cat $lockfile 2>/dev/null`
  423. but it should contain:
  424. $srcfile
  425. This indicates that another process is trying to use the same
  426. temporary object file, and libtool could not work around it because
  427. your compiler does not support \`-c' and \`-o' together. If you
  428. repeat this compilation, it may succeed, by chance, but you had better
  429. avoid parallel builds (make -j) in this platform, or get a better
  430. compiler."
  431. $run $rm $removelist
  432. exit 1
  433. fi
  434. # Just move the object if needed, then go on to compile the next one
  435. if test x"$output_obj" != x"$libobj"; then
  436. $show "$mv $output_obj $libobj"
  437. if $run $mv $output_obj $libobj; then :
  438. else
  439. error=$?
  440. $run $rm $removelist
  441. exit $error
  442. fi
  443. fi
  444. # If we have no pic_flag, then copy the object into place and finish.
  445. if test -z "$pic_flag" && test "$build_old_libs" = yes; then
  446. # Rename the .lo from within objdir to obj
  447. if test -f $obj; then
  448. $show $rm $obj
  449. $run $rm $obj
  450. fi
  451. $show "$mv $libobj $obj"
  452. if $run $mv $libobj $obj; then :
  453. else
  454. error=$?
  455. $run $rm $removelist
  456. exit $error
  457. fi
  458. # Now arrange that obj and lo_libobj become the same file
  459. $show "$LN_S $obj $lo_libobj"
  460. if $run $LN_S $obj $lo_libobj; then
  461. exit 0
  462. else
  463. error=$?
  464. $run $rm $removelist
  465. exit $error
  466. fi
  467. fi
  468. # Allow error messages only from the first compilation.
  469. suppress_output=' >/dev/null 2>&1'
  470. fi
  471. # Only build a position-dependent object if we build old libraries.
  472. if test "$build_old_libs" = yes; then
  473. command="$base_compile $srcfile"
  474. if test "$compiler_c_o" = yes; then
  475. command="$command -o $obj"
  476. output_obj="$obj"
  477. fi
  478. # Suppress compiler output if we already did a PIC compilation.
  479. command="$command$suppress_output"
  480. $show "$command"
  481. if $run eval "$command"; then :
  482. else
  483. $run $rm $removelist
  484. exit 1
  485. fi
  486. if test "$need_locks" = warn &&
  487. test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  488. echo "\
  489. *** ERROR, $lockfile contains:
  490. `cat $lockfile 2>/dev/null`
  491. but it should contain:
  492. $srcfile
  493. This indicates that another process is trying to use the same
  494. temporary object file, and libtool could not work around it because
  495. your compiler does not support \`-c' and \`-o' together. If you
  496. repeat this compilation, it may succeed, by chance, but you had better
  497. avoid parallel builds (make -j) in this platform, or get a better
  498. compiler."
  499. $run $rm $removelist
  500. exit 1
  501. fi
  502. # Just move the object if needed
  503. if test x"$output_obj" != x"$obj"; then
  504. $show "$mv $output_obj $obj"
  505. if $run $mv $output_obj $obj; then :
  506. else
  507. error=$?
  508. $run $rm $removelist
  509. exit $error
  510. fi
  511. fi
  512. # Create an invalid libtool object if no PIC, so that we do not
  513. # accidentally link it into a program.
  514. if test "$build_libtool_libs" != yes; then
  515. $show "echo timestamp > $libobj"
  516. $run eval "echo timestamp > \$libobj" || exit $?
  517. else
  518. # Move the .lo from within objdir
  519. $show "$mv $libobj $lo_libobj"
  520. if $run $mv $libobj $lo_libobj; then :
  521. else
  522. error=$?
  523. $run $rm $removelist
  524. exit $error
  525. fi
  526. fi
  527. fi
  528. # Unlock the critical section if it was locked
  529. if test "$need_locks" != no; then
  530. $rm "$lockfile"
  531. fi
  532. exit 0
  533. ;;
  534. # libtool link mode
  535. link)
  536. modename="$modename: link"
  537. C_compiler="$CC" # save it, to compile generated C sources
  538. CC="$nonopt"
  539. case "$host" in
  540. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  541. # It is impossible to link a dll without this setting, and
  542. # we shouldn't force the makefile maintainer to figure out
  543. # which system we are compiling for in order to pass an extra
  544. # flag for every libtool invokation.
  545. # allow_undefined=no
  546. # FIXME: Unfortunately, there are problems with the above when trying
  547. # to make a dll which has undefined symbols, in which case not
  548. # even a static library is built. For now, we need to specify
  549. # -no-undefined on the libtool link line when we can be certain
  550. # that all symbols are satisfied, otherwise we get a static library.
  551. allow_undefined=yes
  552. # This is a source program that is used to create dlls on Windows
  553. # Don't remove nor modify the starting and closing comments
  554. # /* ltdll.c starts here */
  555. # #define WIN32_LEAN_AND_MEAN
  556. # #include <windows.h>
  557. # #undef WIN32_LEAN_AND_MEAN
  558. # #include <stdio.h>
  559. #
  560. # #ifdef __cplusplus
  561. # extern "C" {
  562. # #endif
  563. # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
  564. # #ifdef __cplusplus
  565. # }
  566. # #endif
  567. #
  568. # #include <cygwin/cygwin_dll.h>
  569. # DECLARE_CYGWIN_DLL( DllMain );
  570. # HINSTANCE __hDllInstance_base;
  571. #
  572. # BOOL APIENTRY
  573. # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
  574. # {
  575. # __hDllInstance_base = hInst;
  576. # return TRUE;
  577. # }
  578. # /* ltdll.c ends here */
  579. # This is a source program that is used to create import libraries
  580. # on Windows for dlls which lack them. Don't remove nor modify the
  581. # starting and closing comments
  582. # /* impgen.c starts here */
  583. # /* Copyright (C) 1999 Free Software Foundation, Inc.
  584. #
  585. # This file is part of GNU libtool.
  586. #
  587. # This program is free software; you can redistribute it and/or modify
  588. # it under the terms of the GNU General Public License as published by
  589. # the Free Software Foundation; either version 2 of the License, or
  590. # (at your option) any later version.
  591. #
  592. # This program is distributed in the hope that it will be useful,
  593. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  594. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  595. # GNU General Public License for more details.
  596. #
  597. # You should have received a copy of the GNU General Public License
  598. # along with this program; if not, write to the Free Software
  599. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  600. # */
  601. #
  602. # #include <stdio.h> /* for printf() */
  603. # #include <unistd.h> /* for open(), lseek(), read() */
  604. # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
  605. # #include <string.h> /* for strdup() */
  606. #
  607. # static unsigned int
  608. # pe_get16 (fd, offset)
  609. # int fd;
  610. # int offset;
  611. # {
  612. # unsigned char b[2];
  613. # lseek (fd, offset, SEEK_SET);
  614. # read (fd, b, 2);
  615. # return b[0] + (b[1]<<8);
  616. # }
  617. #
  618. # static unsigned int
  619. # pe_get32 (fd, offset)
  620. # int fd;
  621. # int offset;
  622. # {
  623. # unsigned char b[4];
  624. # lseek (fd, offset, SEEK_SET);
  625. # read (fd, b, 4);
  626. # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  627. # }
  628. #
  629. # static unsigned int
  630. # pe_as32 (ptr)
  631. # void *ptr;
  632. # {
  633. # unsigned char *b = ptr;
  634. # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  635. # }
  636. #
  637. # int
  638. # main (argc, argv)
  639. # int argc;
  640. # char *argv[];
  641. # {
  642. # int dll;
  643. # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
  644. # unsigned long export_rva, export_size, nsections, secptr, expptr;
  645. # unsigned long name_rvas, nexp;
  646. # unsigned char *expdata, *erva;
  647. # char *filename, *dll_name;
  648. #
  649. # filename = argv[1];
  650. #
  651. # dll = open(filename, O_RDONLY|O_BINARY);
  652. # if (!dll)
  653. # return 1;
  654. #
  655. # dll_name = filename;
  656. #
  657. # for (i=0; filename[i]; i++)
  658. # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
  659. # dll_name = filename + i +1;
  660. #
  661. # pe_header_offset = pe_get32 (dll, 0x3c);
  662. # opthdr_ofs = pe_header_offset + 4 + 20;
  663. # num_entries = pe_get32 (dll, opthdr_ofs + 92);
  664. #
  665. # if (num_entries < 1) /* no exports */
  666. # return 1;
  667. #
  668. # export_rva = pe_get32 (dll, opthdr_ofs + 96);
  669. # export_size = pe_get32 (dll, opthdr_ofs + 100);
  670. # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
  671. # secptr = (pe_header_offset + 4 + 20 +
  672. # pe_get16 (dll, pe_header_offset + 4 + 16));
  673. #
  674. # expptr = 0;
  675. # for (i = 0; i < nsections; i++)
  676. # {
  677. # char sname[8];
  678. # unsigned long secptr1 = secptr + 40 * i;
  679. # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
  680. # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
  681. # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
  682. # lseek(dll, secptr1, SEEK_SET);
  683. # read(dll, sname, 8);
  684. # if (vaddr <= export_rva && vaddr+vsize > export_rva)
  685. # {
  686. # expptr = fptr + (export_rva - vaddr);
  687. # if (export_rva + export_size > vaddr + vsize)
  688. # export_size = vsize - (export_rva - vaddr);
  689. # break;
  690. # }
  691. # }
  692. #
  693. # expdata = (unsigned char*)malloc(export_size);
  694. # lseek (dll, expptr, SEEK_SET);
  695. # read (dll, expdata, export_size);
  696. # erva = expdata - export_rva;
  697. #
  698. # nexp = pe_as32 (expdata+24);
  699. # name_rvas = pe_as32 (expdata+32);
  700. #
  701. # printf ("EXPORTS\n");
  702. # for (i = 0; i<nexp; i++)
  703. # {
  704. # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
  705. # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
  706. # }
  707. #
  708. # return 0;
  709. # }
  710. # /* impgen.c ends here */
  711. ;;
  712. *)
  713. allow_undefined=yes
  714. ;;
  715. esac
  716. compile_command="$CC"
  717. finalize_command="$CC"
  718. compile_rpath=
  719. finalize_rpath=
  720. compile_shlibpath=
  721. finalize_shlibpath=
  722. convenience=
  723. old_convenience=
  724. deplibs=
  725. linkopts=
  726. if test -n "$shlibpath_var"; then
  727. # get the directories listed in $shlibpath_var
  728. eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  729. else
  730. lib_search_path=
  731. fi
  732. # now prepend the system-specific ones
  733. eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
  734. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  735. avoid_version=no
  736. dlfiles=
  737. dlprefiles=
  738. dlself=no
  739. export_dynamic=no
  740. export_symbols=
  741. export_symbols_regex=
  742. generated=
  743. libobjs=
  744. link_against_libtool_libs=
  745. ltlibs=
  746. module=no
  747. objs=
  748. prefer_static_libs=no
  749. preload=no
  750. prev=
  751. prevarg=
  752. release=
  753. rpath=
  754. xrpath=
  755. perm_rpath=
  756. temp_rpath=
  757. thread_safe=no
  758. vinfo=
  759. # We need to know -static, to get the right output filenames.
  760. for arg
  761. do
  762. case "$arg" in
  763. -all-static | -static)
  764. if test "X$arg" = "X-all-static"; then
  765. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  766. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  767. fi
  768. if test -n "$link_static_flag"; then
  769. dlopen_self=$dlopen_self_static
  770. fi
  771. else
  772. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  773. dlopen_self=$dlopen_self_static
  774. fi
  775. fi
  776. build_libtool_libs=no
  777. build_old_libs=yes
  778. prefer_static_libs=yes
  779. break
  780. ;;
  781. esac
  782. done
  783. # See if our shared archives depend on static archives.
  784. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  785. # Go through the arguments, transforming them on the way.
  786. while test $# -gt 0; do
  787. arg="$1"
  788. shift
  789. # If the previous option needs an argument, assign it.
  790. if test -n "$prev"; then
  791. case "$prev" in
  792. output)
  793. compile_command="$compile_command @OUTPUT@"
  794. finalize_command="$finalize_command @OUTPUT@"
  795. ;;
  796. esac
  797. case "$prev" in
  798. dlfiles|dlprefiles)
  799. if test "$preload" = no; then
  800. # Add the symbol object into the linking commands.
  801. compile_command="$compile_command @SYMFILE@"
  802. finalize_command="$finalize_command @SYMFILE@"
  803. preload=yes
  804. fi
  805. case "$arg" in
  806. *.la | *.lo) ;; # We handle these cases below.
  807. self)
  808. if test "$prev" = dlprefiles; then
  809. dlself=yes
  810. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  811. dlself=yes
  812. else
  813. dlself=needless
  814. export_dynamic=yes
  815. fi
  816. prev=
  817. continue
  818. ;;
  819. *)
  820. if test "$prev" = dlfiles; then
  821. dlfiles="$dlfiles $arg"
  822. else
  823. dlprefiles="$dlprefiles $arg"
  824. fi
  825. prev=
  826. ;;
  827. esac
  828. ;;
  829. expsyms)
  830. export_symbols="$arg"
  831. if test ! -f "$arg"; then
  832. $echo "$modename: symbol file \`$arg' does not exist"
  833. exit 1
  834. fi
  835. prev=
  836. continue
  837. ;;
  838. expsyms_regex)
  839. export_symbols_regex="$arg"
  840. prev=
  841. continue
  842. ;;
  843. release)
  844. release="-$arg"
  845. prev=
  846. continue
  847. ;;
  848. rpath | xrpath)
  849. # We need an absolute path.
  850. case "$arg" in
  851. [\\/]* | [A-Za-z]:[\\/]*) ;;
  852. *)
  853. $echo "$modename: only absolute run-paths are allowed" 1>&2
  854. exit 1
  855. ;;
  856. esac
  857. if test "$prev" = rpath; then
  858. case "$rpath " in
  859. *" $arg "*) ;;
  860. *) rpath="$rpath $arg" ;;
  861. esac
  862. else
  863. case "$xrpath " in
  864. *" $arg "*) ;;
  865. *) xrpath="$xrpath $arg" ;;
  866. esac
  867. fi
  868. prev=
  869. continue
  870. ;;
  871. *)
  872. eval "$prev=\"\$arg\""
  873. prev=
  874. continue
  875. ;;
  876. esac
  877. fi
  878. prevarg="$arg"
  879. case "$arg" in
  880. -all-static)
  881. if test -n "$link_static_flag"; then
  882. compile_command="$compile_command $link_static_flag"
  883. finalize_command="$finalize_command $link_static_flag"
  884. fi
  885. continue
  886. ;;
  887. -allow-undefined)
  888. # FIXME: remove this flag sometime in the future.
  889. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  890. continue
  891. ;;
  892. -avoid-version)
  893. avoid_version=yes
  894. continue
  895. ;;
  896. -dlopen)
  897. prev=dlfiles
  898. continue
  899. ;;
  900. -dlpreopen)
  901. prev=dlprefiles
  902. continue
  903. ;;
  904. -export-dynamic)
  905. export_dynamic=yes
  906. continue
  907. ;;
  908. -export-symbols | -export-symbols-regex)
  909. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  910. $echo "$modename: not more than one -exported-symbols argument allowed"
  911. exit 1
  912. fi
  913. if test "X$arg" = "X-export-symbols"; then
  914. prev=expsyms
  915. else
  916. prev=expsyms_regex
  917. fi
  918. continue
  919. ;;
  920. -L*)
  921. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  922. # We need an absolute path.
  923. case "$dir" in
  924. [\\/]* | [A-Za-z]:[\\/]*) ;;
  925. *)
  926. absdir=`cd "$dir" && pwd`
  927. if test -z "$absdir"; then
  928. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  929. exit 1
  930. fi
  931. dir="$absdir"
  932. ;;
  933. esac
  934. case " $deplibs " in
  935. *" $arg "*) ;;
  936. *) deplibs="$deplibs $arg";;
  937. esac
  938. case " $lib_search_path " in
  939. *" $dir "*) ;;
  940. *) lib_search_path="$lib_search_path $dir";;
  941. esac
  942. case "$host" in
  943. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  944. dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  945. case ":$dllsearchpath:" in
  946. ::) dllsearchpath="$dllsearchdir";;
  947. *":$dllsearchdir:"*) ;;
  948. *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  949. esac
  950. ;;
  951. esac
  952. ;;
  953. -l*)
  954. if test "$arg" = "-lc"; then
  955. case "$host" in
  956. *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  957. # These systems don't actually have c library (as such)
  958. continue
  959. ;;
  960. esac
  961. elif test "$arg" = "-lm"; then
  962. case "$host" in
  963. *-*-cygwin* | *-*-beos*)
  964. # These systems don't actually have math library (as such)
  965. continue
  966. ;;
  967. esac
  968. fi
  969. deplibs="$deplibs $arg"
  970. ;;
  971. -module)
  972. module=yes
  973. continue
  974. ;;
  975. -no-undefined)
  976. allow_undefined=no
  977. continue
  978. ;;
  979. -o) prev=output ;;
  980. -release)
  981. prev=release
  982. continue
  983. ;;
  984. -rpath)
  985. prev=rpath
  986. continue
  987. ;;
  988. -R)
  989. prev=xrpath
  990. continue
  991. ;;
  992. -R*)
  993. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  994. # We need an absolute path.
  995. case "$dir" in
  996. [\\/]* | [A-Za-z]:[\\/]*) ;;
  997. *)
  998. $echo "$modename: only absolute run-paths are allowed" 1>&2
  999. exit 1
  1000. ;;
  1001. esac
  1002. case "$xrpath " in
  1003. *" $dir "*) ;;
  1004. *) xrpath="$xrpath $dir" ;;
  1005. esac
  1006. continue
  1007. ;;
  1008. -static)
  1009. # If we have no pic_flag, then this is the same as -all-static.
  1010. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1011. compile_command="$compile_command $link_static_flag"
  1012. finalize_command="$finalize_command $link_static_flag"
  1013. fi
  1014. continue
  1015. ;;
  1016. -thread-safe)
  1017. thread_safe=yes
  1018. continue
  1019. ;;
  1020. -version-info)
  1021. prev=vinfo
  1022. continue
  1023. ;;
  1024. # Some other compiler flag.
  1025. -* | +*)
  1026. # Unknown arguments in both finalize_command and compile_command need
  1027. # to be aesthetically quoted because they are evaled later.
  1028. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1029. case "$arg" in
  1030. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1031. arg="\"$arg\""
  1032. ;;
  1033. esac
  1034. ;;
  1035. *.o | *.obj | *.a | *.lib)
  1036. # A standard object.
  1037. objs="$objs $arg"
  1038. ;;
  1039. *.lo)
  1040. # A library object.
  1041. if test "$prev" = dlfiles; then
  1042. dlfiles="$dlfiles $arg"
  1043. if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1044. prev=
  1045. continue
  1046. else
  1047. # If libtool objects are unsupported, then we need to preload.
  1048. prev=dlprefiles
  1049. fi
  1050. fi
  1051. if test "$prev" = dlprefiles; then
  1052. # Preload the old-style object.
  1053. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1054. prev=
  1055. fi
  1056. libobjs="$libobjs $arg"
  1057. ;;
  1058. *.la)
  1059. # A libtool-controlled library.
  1060. dlname=
  1061. libdir=
  1062. library_names=
  1063. old_library=
  1064. # Check to see that this really is a libtool archive.
  1065. if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1066. else
  1067. $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1068. exit 1
  1069. fi
  1070. # If the library was installed with an old release of libtool,
  1071. # it will not redefine variable installed.
  1072. installed=yes
  1073. # Read the .la file
  1074. # If there is no directory component, then add one.
  1075. case "$arg" in
  1076. */* | *\\*) . $arg ;;
  1077. *) . ./$arg ;;
  1078. esac
  1079. # Get the name of the library we link against.
  1080. linklib=
  1081. for l in $old_library $library_names; do
  1082. linklib="$l"
  1083. done
  1084. if test -z "$linklib"; then
  1085. $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1086. exit 1
  1087. fi
  1088. # Find the relevant object directory and library name.
  1089. name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1090. if test "X$installed" = Xyes; then
  1091. dir="$libdir"
  1092. else
  1093. dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1094. if test "X$dir" = "X$arg"; then
  1095. dir="$objdir"
  1096. else
  1097. dir="$dir/$objdir"
  1098. fi
  1099. fi
  1100. if test -n "$dependency_libs"; then
  1101. # Extract -R from dependency_libs
  1102. temp_deplibs=
  1103. for deplib in $dependency_libs; do
  1104. case "$deplib" in
  1105. -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1106. case " $rpath $xrpath " in
  1107. *" $temp_xrpath "*) ;;
  1108. *) xrpath="$xrpath $temp_xrpath";;
  1109. esac;;
  1110. -L*) case "$compile_command $temp_deplibs " in
  1111. *" $deplib "*) ;;
  1112. *) temp_deplibs="$temp_deplibs $deplib";;
  1113. esac;;
  1114. *) temp_deplibs="$temp_deplibs $deplib";;
  1115. esac
  1116. done
  1117. dependency_libs="$temp_deplibs"
  1118. fi
  1119. if test -z "$libdir"; then
  1120. # It is a libtool convenience library, so add in its objects.
  1121. convenience="$convenience $dir/$old_library"
  1122. old_convenience="$old_convenience $dir/$old_library"
  1123. deplibs="$deplibs$dependency_libs"
  1124. compile_command="$compile_command $dir/$old_library$dependency_libs"
  1125. finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1126. continue
  1127. fi
  1128. # This library was specified with -dlopen.
  1129. if test "$prev" = dlfiles; then
  1130. dlfiles="$dlfiles $arg"
  1131. if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1132. # If there is no dlname, no dlopen support or we're linking statically,
  1133. # we need to preload.
  1134. prev=dlprefiles
  1135. else
  1136. # We should not create a dependency on this library, but we
  1137. # may need any libraries it requires.
  1138. compile_command="$compile_command$dependency_libs"
  1139. finalize_command="$finalize_command$dependency_libs"
  1140. prev=
  1141. continue
  1142. fi
  1143. fi
  1144. # The library was specified with -dlpreopen.
  1145. if test "$prev" = dlprefiles; then
  1146. # Prefer using a static library (so that no silly _DYNAMIC symbols
  1147. # are required to link).
  1148. if test -n "$old_library"; then
  1149. dlprefiles="$dlprefiles $dir/$old_library"
  1150. else
  1151. dlprefiles="$dlprefiles $dir/$linklib"
  1152. fi
  1153. prev=
  1154. fi
  1155. if test -n "$library_names" &&
  1156. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1157. link_against_libtool_libs="$link_against_libtool_libs $arg"
  1158. if test -n "$shlibpath_var"; then
  1159. # Make sure the rpath contains only unique directories.
  1160. case "$temp_rpath " in
  1161. *" $dir "*) ;;
  1162. *) temp_rpath="$temp_rpath $dir" ;;
  1163. esac
  1164. fi
  1165. # We need an absolute path.
  1166. case "$dir" in
  1167. [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1168. *)
  1169. absdir=`cd "$dir" && pwd`
  1170. if test -z "$absdir"; then
  1171. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1172. exit 1
  1173. fi
  1174. ;;
  1175. esac
  1176. # This is the magic to use -rpath.
  1177. # Skip directories that are in the system default run-time
  1178. # search path, unless they have been requested with -R.
  1179. case " $sys_lib_dlsearch_path " in
  1180. *" $absdir "*) ;;
  1181. *)
  1182. case "$compile_rpath " in
  1183. *" $absdir "*) ;;
  1184. *) compile_rpath="$compile_rpath $absdir"
  1185. esac
  1186. ;;
  1187. esac
  1188. case " $sys_lib_dlsearch_path " in
  1189. *" $libdir "*) ;;
  1190. *)
  1191. case "$finalize_rpath " in
  1192. *" $libdir "*) ;;
  1193. *) finalize_rpath="$finalize_rpath $libdir"
  1194. esac
  1195. ;;
  1196. esac
  1197. lib_linked=yes
  1198. case "$hardcode_action" in
  1199. immediate | unsupported)
  1200. if test "$hardcode_direct" = no; then
  1201. compile_command="$compile_command $dir/$linklib"
  1202. deplibs="$deplibs $dir/$linklib"
  1203. case "$host" in
  1204. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1205. dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1206. if test -n "$dllsearchpath"; then
  1207. dllsearchpath="$dllsearchpath:$dllsearchdir"
  1208. else
  1209. dllsearchpath="$dllsearchdir"
  1210. fi
  1211. ;;
  1212. esac
  1213. elif test "$hardcode_minus_L" = no; then
  1214. case "$host" in
  1215. *-*-sunos*)
  1216. compile_shlibpath="$compile_shlibpath$dir:"
  1217. ;;
  1218. esac
  1219. case "$compile_command " in
  1220. *" -L$dir "*) ;;
  1221. *) compile_command="$compile_command -L$dir";;
  1222. esac
  1223. compile_command="$compile_command -l$name"
  1224. deplibs="$deplibs -L$dir -l$name"
  1225. elif test "$hardcode_shlibpath_var" = no; then
  1226. case ":$compile_shlibpath:" in
  1227. *":$dir:"*) ;;
  1228. *) compile_shlibpath="$compile_shlibpath$dir:";;
  1229. esac
  1230. compile_command="$compile_command -l$name"
  1231. deplibs="$deplibs -l$name"
  1232. else
  1233. lib_linked=no
  1234. fi
  1235. ;;
  1236. relink)
  1237. if test "$hardcode_direct" = yes; then
  1238. compile_command="$compile_command $absdir/$linklib"
  1239. deplibs="$deplibs $absdir/$linklib"
  1240. elif test "$hardcode_minus_L" = yes; then
  1241. case "$compile_command " in
  1242. *" -L$absdir "*) ;;
  1243. *) compile_command="$compile_command -L$absdir";;
  1244. esac
  1245. compile_command="$compile_command -l$name"
  1246. deplibs="$deplibs -L$absdir -l$name"
  1247. elif test "$hardcode_shlibpath_var" = yes; then
  1248. case ":$compile_shlibpath:" in
  1249. *":$absdir:"*) ;;
  1250. *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1251. esac
  1252. compile_command="$compile_command -l$name"
  1253. deplibs="$deplibs -l$name"
  1254. else
  1255. lib_linked=no
  1256. fi
  1257. ;;
  1258. *)
  1259. lib_linked=no
  1260. ;;
  1261. esac
  1262. if test "$lib_linked" != yes; then
  1263. $echo "$modename: configuration error: unsupported hardcode properties"
  1264. exit 1
  1265. fi
  1266. # Finalize command for both is simple: just hardcode it.
  1267. if test "$hardcode_direct" = yes; then
  1268. finalize_command="$finalize_command $libdir/$linklib"
  1269. elif test "$hardcode_minus_L" = yes; then
  1270. case "$finalize_command " in
  1271. *" -L$libdir "*) ;;
  1272. *) finalize_command="$finalize_command -L$libdir";;
  1273. esac
  1274. finalize_command="$finalize_command -l$name"
  1275. elif test "$hardcode_shlibpath_var" = yes; then
  1276. case ":$finalize_shlibpath:" in
  1277. *":$libdir:"*) ;;
  1278. *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1279. esac
  1280. finalize_command="$finalize_command -l$name"
  1281. else
  1282. # We cannot seem to hardcode it, guess we'll fake it.
  1283. case "$finalize_command " in
  1284. *" -L$dir "*) ;;
  1285. *) finalize_command="$finalize_command -L$libdir";;
  1286. esac
  1287. finalize_command="$finalize_command -l$name"
  1288. fi
  1289. else
  1290. # Transform directly to old archives if we don't build new libraries.
  1291. if test -n "$pic_flag" && test -z "$old_library"; then
  1292. $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1293. exit 1
  1294. fi
  1295. # Here we assume that one of hardcode_direct or hardcode_minus_L
  1296. # is not unsupported. This is valid on all known static and
  1297. # shared platforms.
  1298. if test "$hardcode_direct" != unsupported; then
  1299. test -n "$old_library" && linklib="$old_library"
  1300. compile_command="$compile_command $dir/$linklib"
  1301. finalize_command="$finalize_command $dir/$linklib"
  1302. else
  1303. case "$compile_command " in
  1304. *" -L$dir "*) ;;
  1305. *) compile_command="$compile_command -L$dir";;
  1306. esac
  1307. compile_command="$compile_command -l$name"
  1308. case "$finalize_command " in
  1309. *" -L$dir "*) ;;
  1310. *) finalize_command="$finalize_command -L$dir";;
  1311. esac
  1312. finalize_command="$finalize_command -l$name"
  1313. fi
  1314. fi
  1315. # Add in any libraries that this one depends upon.
  1316. compile_command="$compile_command$dependency_libs"
  1317. finalize_command="$finalize_command$dependency_libs"
  1318. continue
  1319. ;;
  1320. # Some other compiler argument.
  1321. *)
  1322. # Unknown arguments in both finalize_command and compile_command need
  1323. # to be aesthetically quoted because they are evaled later.
  1324. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1325. case "$arg" in
  1326. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1327. arg="\"$arg\""
  1328. ;;
  1329. esac
  1330. ;;
  1331. esac
  1332. # Now actually substitute the argument into the commands.
  1333. if test -n "$arg"; then
  1334. compile_command="$compile_command $arg"
  1335. finalize_command="$finalize_command $arg"
  1336. fi
  1337. done
  1338. if test -n "$prev"; then
  1339. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1340. $echo "$help" 1>&2
  1341. exit 1
  1342. fi
  1343. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1344. eval arg=\"$export_dynamic_flag_spec\"
  1345. compile_command="$compile_command $arg"
  1346. finalize_command="$finalize_command $arg"
  1347. fi
  1348. oldlibs=
  1349. # calculate the name of the file, without its directory
  1350. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1351. libobjs_save="$libobjs"
  1352. case "$output" in
  1353. "")
  1354. $echo "$modename: you must specify an output file" 1>&2
  1355. $echo "$help" 1>&2
  1356. exit 1
  1357. ;;
  1358. *.a | *.lib)
  1359. if test -n "$link_against_libtool_libs"; then
  1360. $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1361. exit 1
  1362. fi
  1363. if test -n "$deplibs"; then
  1364. $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1365. fi
  1366. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1367. $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1368. fi
  1369. if test -n "$rpath"; then
  1370. $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1371. fi
  1372. if test -n "$xrpath"; then
  1373. $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1374. fi
  1375. if test -n "$vinfo"; then
  1376. $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1377. fi
  1378. if test -n "$release"; then
  1379. $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1380. fi
  1381. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1382. $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1383. fi
  1384. # Now set the variables for building old libraries.
  1385. build_libtool_libs=no
  1386. oldlibs="$output"
  1387. ;;
  1388. *.la)
  1389. # Make sure we only generate libraries of the form `libNAME.la'.
  1390. case "$outputname" in
  1391. lib*)
  1392. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1393. eval libname=\"$libname_spec\"
  1394. ;;
  1395. *)
  1396. if test "$module" = no; then
  1397. $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1398. $echo "$help" 1>&2
  1399. exit 1
  1400. fi
  1401. if test "$need_lib_prefix" != no; then
  1402. # Add the "lib" prefix for modules if required
  1403. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1404. eval libname=\"$libname_spec\"
  1405. else
  1406. libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1407. fi
  1408. ;;
  1409. esac
  1410. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1411. if test "X$output_objdir" = "X$output"; then
  1412. output_objdir="$objdir"
  1413. else
  1414. output_objdir="$output_objdir/$objdir"
  1415. fi
  1416. if test -n "$objs"; then
  1417. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1418. exit 1
  1419. fi
  1420. # How the heck are we supposed to write a wrapper for a shared library?
  1421. if test -n "$link_against_libtool_libs"; then
  1422. $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1423. exit 1
  1424. fi
  1425. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1426. $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1427. fi
  1428. set dummy $rpath
  1429. if test $# -gt 2; then
  1430. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1431. fi
  1432. install_libdir="$2"
  1433. oldlibs=
  1434. if test -z "$rpath"; then
  1435. if test "$build_libtool_libs" = yes; then
  1436. # Building a libtool convenience library.
  1437. libext=al
  1438. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1439. build_libtool_libs=convenience
  1440. build_old_libs=yes
  1441. fi
  1442. dependency_libs="$deplibs"
  1443. if test -n "$vinfo"; then
  1444. $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1445. fi
  1446. if test -n "$release"; then
  1447. $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1448. fi
  1449. else
  1450. # Parse the version information argument.
  1451. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
  1452. set dummy $vinfo 0 0 0
  1453. IFS="$save_ifs"
  1454. if test -n "$8"; then
  1455. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1456. $echo "$help" 1>&2
  1457. exit 1
  1458. fi
  1459. current="$2"
  1460. revision="$3"
  1461. age="$4"
  1462. # Check that each of the things are valid numbers.
  1463. case "$current" in
  1464. 0 | [1-9] | [1-9][0-9]*) ;;
  1465. *)
  1466. $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1467. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1468. exit 1
  1469. ;;
  1470. esac
  1471. case "$revision" in
  1472. 0 | [1-9] | [1-9][0-9]*) ;;
  1473. *)
  1474. $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1475. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1476. exit 1
  1477. ;;
  1478. esac
  1479. case "$age" in
  1480. 0 | [1-9] | [1-9][0-9]*) ;;
  1481. *)
  1482. $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1483. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1484. exit 1
  1485. ;;
  1486. esac
  1487. if test $age -gt $current; then
  1488. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1489. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1490. exit 1
  1491. fi
  1492. # Calculate the version variables.
  1493. major=
  1494. versuffix=
  1495. verstring=
  1496. case "$version_type" in
  1497. none) ;;
  1498. irix)
  1499. major=`expr $current - $age + 1`
  1500. versuffix="$major.$revision"
  1501. verstring="sgi$major.$revision"
  1502. # Add in all the interfaces that we are compatible with.
  1503. loop=$revision
  1504. while test $loop != 0; do
  1505. iface=`expr $revision - $loop`
  1506. loop=`expr $loop - 1`
  1507. verstring="sgi$major.$iface:$verstring"
  1508. done
  1509. ;;
  1510. linux)
  1511. major=.`expr $current - $age`
  1512. versuffix="$major.$age.$revision"
  1513. ;;
  1514. osf)
  1515. major=`expr $current - $age`
  1516. versuffix=".$current.$age.$revision"
  1517. verstring="$current.$age.$revision"
  1518. # Add in all the interfaces that we are compatible with.
  1519. loop=$age
  1520. while test $loop != 0; do
  1521. iface=`expr $current - $loop`
  1522. loop=`expr $loop - 1`
  1523. verstring="$verstring:${iface}.0"
  1524. done
  1525. # Make executables depend on our current version.
  1526. verstring="$verstring:${current}.0"
  1527. ;;
  1528. sunos)
  1529. major=".$current"
  1530. versuffix=".$current.$revision"
  1531. ;;
  1532. freebsd-aout)
  1533. major=".$current"
  1534. versuffix=".$current.$revision";
  1535. ;;
  1536. freebsd-elf)
  1537. major=".$current"
  1538. versuffix=".$current";
  1539. ;;
  1540. windows)
  1541. # Like Linux, but with '-' rather than '.', since we only
  1542. # want one extension on Windows 95.
  1543. major=`expr $current - $age`
  1544. versuffix="-$major-$age-$revision"
  1545. ;;
  1546. *)
  1547. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1548. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  1549. exit 1
  1550. ;;
  1551. esac
  1552. # Clear the version info if we defaulted, and they specified a release.
  1553. if test -z "$vinfo" && test -n "$release"; then
  1554. major=
  1555. verstring="0.0"
  1556. if test "$need_version" = no; then
  1557. versuffix=
  1558. else
  1559. versuffix=".0.0"
  1560. fi
  1561. fi
  1562. # Remove version info from name if versioning should be avoided
  1563. if test "$avoid_version" = yes && test "$need_version" = no; then
  1564. major=
  1565. versuffix=
  1566. verstring=""
  1567. fi
  1568. # Check to see if the archive will have undefined symbols.
  1569. if test "$allow_undefined" = yes; then
  1570. if test "$allow_undefined_flag" = unsupported; then
  1571. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1572. build_libtool_libs=no
  1573. build_old_libs=yes
  1574. fi
  1575. else
  1576. # Don't allow undefined symbols.
  1577. allow_undefined_flag="$no_undefined_flag"
  1578. fi
  1579. dependency_libs="$deplibs"
  1580. case "$host" in
  1581. *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1582. # these systems don't actually have a c library (as such)!
  1583. ;;
  1584. *)
  1585. # Add libc to deplibs on all other systems.
  1586. deplibs="$deplibs -lc"
  1587. ;;
  1588. esac
  1589. fi
  1590. # Create the output directory, or remove our outputs if we need to.
  1591. if test -d $output_objdir; then
  1592. $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1593. $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1594. else
  1595. $show "$mkdir $output_objdir"
  1596. $run $mkdir $output_objdir
  1597. status=$?
  1598. if test $status -ne 0 && test ! -d $output_objdir; then
  1599. exit $status
  1600. fi
  1601. fi
  1602. # Now set the variables for building old libraries.
  1603. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1604. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1605. # Transform .lo files to .o files.
  1606. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1607. fi
  1608. if test "$build_libtool_libs" = yes; then
  1609. # Transform deplibs into only deplibs that can be linked in shared.
  1610. name_save=$name
  1611. libname_save=$libname
  1612. release_save=$release
  1613. versuffix_save=$versuffix
  1614. major_save=$major
  1615. # I'm not sure if I'm treating the release correctly. I think
  1616. # release should show up in the -l (ie -lgmp5) so we don't want to
  1617. # add it in twice. Is that correct?
  1618. release=""
  1619. versuffix=""
  1620. major=""
  1621. newdeplibs=
  1622. droppeddeps=no
  1623. case "$deplibs_check_method" in
  1624. pass_all)
  1625. # Don't check for shared/static. Everything works.
  1626. # This might be a little naive. We might want to check
  1627. # whether the library exists or not. But this is on
  1628. # osf3 & osf4 and I'm not really sure... Just
  1629. # implementing what was already the behaviour.
  1630. newdeplibs=$deplibs
  1631. ;;
  1632. test_compile)
  1633. # This code stresses the "libraries are programs" paradigm to its
  1634. # limits. Maybe even breaks it. We compile a program, linking it
  1635. # against the deplibs as a proxy for the library. Then we can check
  1636. # whether they linked in statically or dynamically with ldd.
  1637. $rm conftest.c
  1638. cat > conftest.c <<EOF
  1639. int main() { return 0; }
  1640. EOF
  1641. $rm conftest
  1642. $C_compiler -o conftest conftest.c $deplibs
  1643. if test $? -eq 0 ; then
  1644. ldd_output=`ldd conftest`
  1645. for i in $deplibs; do
  1646. name="`expr $i : '-l\(.*\)'`"
  1647. # If $name is empty we are operating on a -L argument.
  1648. if test "$name" != "" ; then
  1649. libname=`eval \\$echo \"$libname_spec\"`
  1650. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1651. set dummy $deplib_matches
  1652. deplib_match=$2
  1653. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1654. newdeplibs="$newdeplibs $i"
  1655. else
  1656. droppeddeps=yes
  1657. echo
  1658. echo "*** Warning: This library needs some functionality provided by $i."
  1659. echo "*** I have the capability to make that library automatically link in when"
  1660. echo "*** you link to this library. But I can only do this if you have a"
  1661. echo "*** shared version of the library, which you do not appear to have."
  1662. fi
  1663. else
  1664. newdeplibs="$newdeplibs $i"
  1665. fi
  1666. done
  1667. else
  1668. # Error occured in the first compile. Let's try to salvage the situation:
  1669. # Compile a seperate program for each library.
  1670. for i in $deplibs; do
  1671. name="`expr $i : '-l\(.*\)'`"
  1672. # If $name is empty we are operating on a -L argument.
  1673. if test "$name" != "" ; then
  1674. $rm conftest
  1675. $C_compiler -o conftest conftest.c $i
  1676. # Did it work?
  1677. if test $? -eq 0 ; then
  1678. ldd_output=`ldd conftest`
  1679. libname=`eval \\$echo \"$libname_spec\"`
  1680. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1681. set dummy $deplib_matches
  1682. deplib_match=$2
  1683. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1684. newdeplibs="$newdeplibs $i"
  1685. else
  1686. droppeddeps=yes
  1687. echo
  1688. echo "*** Warning: This library needs some functionality provided by $i."
  1689. echo "*** I have the capability to make that library automatically link in when"
  1690. echo "*** you link to this library. But I can only do this if you have a"
  1691. echo "*** shared version of the library, which you do not appear to have."
  1692. fi
  1693. else
  1694. droppeddeps=yes
  1695. echo
  1696. echo "*** Warning! Library $i is needed by this library but I was not able to"
  1697. echo "*** make it link in! You will probably need to install it or some"
  1698. echo "*** library that it depends on before this library will be fully"
  1699. echo "*** functional. Installing it before continuing would be even better."
  1700. fi
  1701. else
  1702. newdeplibs="$newdeplibs $i"
  1703. fi
  1704. done
  1705. fi
  1706. ;;
  1707. file_magic*)
  1708. set dummy $deplibs_check_method
  1709. file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1710. for a_deplib in $deplibs; do
  1711. name="`expr $a_deplib : '-l\(.*\)'`"
  1712. # If $name is empty we are operating on a -L argument.
  1713. if test "$name" != "" ; then
  1714. libname=`eval \\$echo \"$libname_spec\"`
  1715. for i in $lib_search_path; do
  1716. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`

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