PageRenderTime 70ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/dev-20000131/FreeSpeech/vflow/ltmain.sh

#
Shell | 2427 lines | 1937 code | 151 blank | 339 comment | 215 complexity | da6f0e42be3baea908d47005c30813bd MD5 | raw file
Possible License(s): LGPL-2.0, GPL-2.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.3
  54. TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)"
  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 \015\012 \040\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. $run $rm "$output_obj"
  413. $show "$command"
  414. if $run eval "$command"; then :
  415. else
  416. test -n "$output_obj" && $run $rm $removelist
  417. exit 1
  418. fi
  419. if test "$need_locks" = warn &&
  420. test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  421. echo "\
  422. *** ERROR, $lockfile contains:
  423. `cat $lockfile 2>/dev/null`
  424. but it should contain:
  425. $srcfile
  426. This indicates that another process is trying to use the same
  427. temporary object file, and libtool could not work around it because
  428. your compiler does not support \`-c' and \`-o' together. If you
  429. repeat this compilation, it may succeed, by chance, but you had better
  430. avoid parallel builds (make -j) in this platform, or get a better
  431. compiler."
  432. $run $rm $removelist
  433. exit 1
  434. fi
  435. # Just move the object if needed, then go on to compile the next one
  436. if test x"$output_obj" != x"$libobj"; then
  437. $show "$mv $output_obj $libobj"
  438. if $run $mv $output_obj $libobj; then :
  439. else
  440. error=$?
  441. $run $rm $removelist
  442. exit $error
  443. fi
  444. fi
  445. # If we have no pic_flag, then copy the object into place and finish.
  446. if test -z "$pic_flag" && test "$build_old_libs" = yes; then
  447. # Rename the .lo from within objdir to obj
  448. if test -f $obj; then
  449. $show $rm $obj
  450. $run $rm $obj
  451. fi
  452. $show "$mv $libobj $obj"
  453. if $run $mv $libobj $obj; then :
  454. else
  455. error=$?
  456. $run $rm $removelist
  457. exit $error
  458. fi
  459. # Now arrange that obj and lo_libobj become the same file
  460. $show "$LN_S $obj $lo_libobj"
  461. if $run $LN_S $obj $lo_libobj; then
  462. exit 0
  463. else
  464. error=$?
  465. $run $rm $removelist
  466. exit $error
  467. fi
  468. fi
  469. # Allow error messages only from the first compilation.
  470. suppress_output=' >/dev/null 2>&1'
  471. fi
  472. # Only build a position-dependent object if we build old libraries.
  473. if test "$build_old_libs" = yes; then
  474. command="$base_compile $srcfile"
  475. if test "$compiler_c_o" = yes; then
  476. command="$command -o $obj"
  477. output_obj="$obj"
  478. fi
  479. # Suppress compiler output if we already did a PIC compilation.
  480. command="$command$suppress_output"
  481. $run $rm "$output_obj"
  482. $show "$command"
  483. if $run eval "$command"; then :
  484. else
  485. $run $rm $removelist
  486. exit 1
  487. fi
  488. if test "$need_locks" = warn &&
  489. test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  490. echo "\
  491. *** ERROR, $lockfile contains:
  492. `cat $lockfile 2>/dev/null`
  493. but it should contain:
  494. $srcfile
  495. This indicates that another process is trying to use the same
  496. temporary object file, and libtool could not work around it because
  497. your compiler does not support \`-c' and \`-o' together. If you
  498. repeat this compilation, it may succeed, by chance, but you had better
  499. avoid parallel builds (make -j) in this platform, or get a better
  500. compiler."
  501. $run $rm $removelist
  502. exit 1
  503. fi
  504. # Just move the object if needed
  505. if test x"$output_obj" != x"$obj"; then
  506. $show "$mv $output_obj $obj"
  507. if $run $mv $output_obj $obj; then :
  508. else
  509. error=$?
  510. $run $rm $removelist
  511. exit $error
  512. fi
  513. fi
  514. # Create an invalid libtool object if no PIC, so that we do not
  515. # accidentally link it into a program.
  516. if test "$build_libtool_libs" != yes; then
  517. $show "echo timestamp > $libobj"
  518. $run eval "echo timestamp > \$libobj" || exit $?
  519. else
  520. # Move the .lo from within objdir
  521. $show "$mv $libobj $lo_libobj"
  522. if $run $mv $libobj $lo_libobj; then :
  523. else
  524. error=$?
  525. $run $rm $removelist
  526. exit $error
  527. fi
  528. fi
  529. fi
  530. # Unlock the critical section if it was locked
  531. if test "$need_locks" != no; then
  532. $rm "$lockfile"
  533. fi
  534. exit 0
  535. ;;
  536. # libtool link mode
  537. link)
  538. modename="$modename: link"
  539. C_compiler="$CC" # save it, to compile generated C sources
  540. CC="$nonopt"
  541. case "$host" in
  542. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  543. # It is impossible to link a dll without this setting, and
  544. # we shouldn't force the makefile maintainer to figure out
  545. # which system we are compiling for in order to pass an extra
  546. # flag for every libtool invokation.
  547. # allow_undefined=no
  548. # FIXME: Unfortunately, there are problems with the above when trying
  549. # to make a dll which has undefined symbols, in which case not
  550. # even a static library is built. For now, we need to specify
  551. # -no-undefined on the libtool link line when we can be certain
  552. # that all symbols are satisfied, otherwise we get a static library.
  553. allow_undefined=yes
  554. # This is a source program that is used to create dlls on Windows
  555. # Don't remove nor modify the starting and closing comments
  556. # /* ltdll.c starts here */
  557. # #define WIN32_LEAN_AND_MEAN
  558. # #include <windows.h>
  559. # #undef WIN32_LEAN_AND_MEAN
  560. # #include <stdio.h>
  561. #
  562. # #ifndef __CYGWIN__
  563. # # ifdef __CYGWIN32__
  564. # # define __CYGWIN__ __CYGWIN32__
  565. # # endif
  566. # #endif
  567. #
  568. # #ifdef __cplusplus
  569. # extern "C" {
  570. # #endif
  571. # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
  572. # #ifdef __cplusplus
  573. # }
  574. # #endif
  575. #
  576. # #ifdef __CYGWIN__
  577. # #include <cygwin/cygwin_dll.h>
  578. # DECLARE_CYGWIN_DLL( DllMain );
  579. # #endif
  580. # HINSTANCE __hDllInstance_base;
  581. #
  582. # BOOL APIENTRY
  583. # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
  584. # {
  585. # __hDllInstance_base = hInst;
  586. # return TRUE;
  587. # }
  588. # /* ltdll.c ends here */
  589. # This is a source program that is used to create import libraries
  590. # on Windows for dlls which lack them. Don't remove nor modify the
  591. # starting and closing comments
  592. # /* impgen.c starts here */
  593. # /* Copyright (C) 1999 Free Software Foundation, Inc.
  594. #
  595. # This file is part of GNU libtool.
  596. #
  597. # This program is free software; you can redistribute it and/or modify
  598. # it under the terms of the GNU General Public License as published by
  599. # the Free Software Foundation; either version 2 of the License, or
  600. # (at your option) any later version.
  601. #
  602. # This program is distributed in the hope that it will be useful,
  603. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  604. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  605. # GNU General Public License for more details.
  606. #
  607. # You should have received a copy of the GNU General Public License
  608. # along with this program; if not, write to the Free Software
  609. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  610. # */
  611. #
  612. # #include <stdio.h> /* for printf() */
  613. # #include <unistd.h> /* for open(), lseek(), read() */
  614. # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
  615. # #include <string.h> /* for strdup() */
  616. #
  617. # static unsigned int
  618. # pe_get16 (fd, offset)
  619. # int fd;
  620. # int offset;
  621. # {
  622. # unsigned char b[2];
  623. # lseek (fd, offset, SEEK_SET);
  624. # read (fd, b, 2);
  625. # return b[0] + (b[1]<<8);
  626. # }
  627. #
  628. # static unsigned int
  629. # pe_get32 (fd, offset)
  630. # int fd;
  631. # int offset;
  632. # {
  633. # unsigned char b[4];
  634. # lseek (fd, offset, SEEK_SET);
  635. # read (fd, b, 4);
  636. # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  637. # }
  638. #
  639. # static unsigned int
  640. # pe_as32 (ptr)
  641. # void *ptr;
  642. # {
  643. # unsigned char *b = ptr;
  644. # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  645. # }
  646. #
  647. # int
  648. # main (argc, argv)
  649. # int argc;
  650. # char *argv[];
  651. # {
  652. # int dll;
  653. # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
  654. # unsigned long export_rva, export_size, nsections, secptr, expptr;
  655. # unsigned long name_rvas, nexp;
  656. # unsigned char *expdata, *erva;
  657. # char *filename, *dll_name;
  658. #
  659. # filename = argv[1];
  660. #
  661. # dll = open(filename, O_RDONLY|O_BINARY);
  662. # if (!dll)
  663. # return 1;
  664. #
  665. # dll_name = filename;
  666. #
  667. # for (i=0; filename[i]; i++)
  668. # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
  669. # dll_name = filename + i +1;
  670. #
  671. # pe_header_offset = pe_get32 (dll, 0x3c);
  672. # opthdr_ofs = pe_header_offset + 4 + 20;
  673. # num_entries = pe_get32 (dll, opthdr_ofs + 92);
  674. #
  675. # if (num_entries < 1) /* no exports */
  676. # return 1;
  677. #
  678. # export_rva = pe_get32 (dll, opthdr_ofs + 96);
  679. # export_size = pe_get32 (dll, opthdr_ofs + 100);
  680. # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
  681. # secptr = (pe_header_offset + 4 + 20 +
  682. # pe_get16 (dll, pe_header_offset + 4 + 16));
  683. #
  684. # expptr = 0;
  685. # for (i = 0; i < nsections; i++)
  686. # {
  687. # char sname[8];
  688. # unsigned long secptr1 = secptr + 40 * i;
  689. # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
  690. # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
  691. # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
  692. # lseek(dll, secptr1, SEEK_SET);
  693. # read(dll, sname, 8);
  694. # if (vaddr <= export_rva && vaddr+vsize > export_rva)
  695. # {
  696. # expptr = fptr + (export_rva - vaddr);
  697. # if (export_rva + export_size > vaddr + vsize)
  698. # export_size = vsize - (export_rva - vaddr);
  699. # break;
  700. # }
  701. # }
  702. #
  703. # expdata = (unsigned char*)malloc(export_size);
  704. # lseek (dll, expptr, SEEK_SET);
  705. # read (dll, expdata, export_size);
  706. # erva = expdata - export_rva;
  707. #
  708. # nexp = pe_as32 (expdata+24);
  709. # name_rvas = pe_as32 (expdata+32);
  710. #
  711. # printf ("EXPORTS\n");
  712. # for (i = 0; i<nexp; i++)
  713. # {
  714. # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
  715. # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
  716. # }
  717. #
  718. # return 0;
  719. # }
  720. # /* impgen.c ends here */
  721. ;;
  722. *)
  723. allow_undefined=yes
  724. ;;
  725. esac
  726. compile_command="$CC"
  727. finalize_command="$CC"
  728. compile_rpath=
  729. finalize_rpath=
  730. compile_shlibpath=
  731. finalize_shlibpath=
  732. convenience=
  733. old_convenience=
  734. deplibs=
  735. linkopts=
  736. if test -n "$shlibpath_var"; then
  737. # get the directories listed in $shlibpath_var
  738. eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  739. else
  740. lib_search_path=
  741. fi
  742. # now prepend the system-specific ones
  743. eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
  744. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  745. avoid_version=no
  746. dlfiles=
  747. dlprefiles=
  748. dlself=no
  749. export_dynamic=no
  750. export_symbols=
  751. export_symbols_regex=
  752. generated=
  753. libobjs=
  754. link_against_libtool_libs=
  755. ltlibs=
  756. module=no
  757. objs=
  758. prefer_static_libs=no
  759. preload=no
  760. prev=
  761. prevarg=
  762. release=
  763. rpath=
  764. xrpath=
  765. perm_rpath=
  766. temp_rpath=
  767. thread_safe=no
  768. vinfo=
  769. # We need to know -static, to get the right output filenames.
  770. for arg
  771. do
  772. case "$arg" in
  773. -all-static | -static)
  774. if test "X$arg" = "X-all-static"; then
  775. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  776. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  777. fi
  778. if test -n "$link_static_flag"; then
  779. dlopen_self=$dlopen_self_static
  780. fi
  781. else
  782. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  783. dlopen_self=$dlopen_self_static
  784. fi
  785. fi
  786. build_libtool_libs=no
  787. build_old_libs=yes
  788. prefer_static_libs=yes
  789. break
  790. ;;
  791. esac
  792. done
  793. # See if our shared archives depend on static archives.
  794. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  795. # Go through the arguments, transforming them on the way.
  796. while test $# -gt 0; do
  797. arg="$1"
  798. shift
  799. # If the previous option needs an argument, assign it.
  800. if test -n "$prev"; then
  801. case "$prev" in
  802. output)
  803. compile_command="$compile_command @OUTPUT@"
  804. finalize_command="$finalize_command @OUTPUT@"
  805. ;;
  806. esac
  807. case "$prev" in
  808. dlfiles|dlprefiles)
  809. if test "$preload" = no; then
  810. # Add the symbol object into the linking commands.
  811. compile_command="$compile_command @SYMFILE@"
  812. finalize_command="$finalize_command @SYMFILE@"
  813. preload=yes
  814. fi
  815. case "$arg" in
  816. *.la | *.lo) ;; # We handle these cases below.
  817. force)
  818. if test "$dlself" = no; then
  819. dlself=needless
  820. export_dynamic=yes
  821. fi
  822. prev=
  823. continue
  824. ;;
  825. self)
  826. if test "$prev" = dlprefiles; then
  827. dlself=yes
  828. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  829. dlself=yes
  830. else
  831. dlself=needless
  832. export_dynamic=yes
  833. fi
  834. prev=
  835. continue
  836. ;;
  837. *)
  838. if test "$prev" = dlfiles; then
  839. dlfiles="$dlfiles $arg"
  840. else
  841. dlprefiles="$dlprefiles $arg"
  842. fi
  843. prev=
  844. ;;
  845. esac
  846. ;;
  847. expsyms)
  848. export_symbols="$arg"
  849. if test ! -f "$arg"; then
  850. $echo "$modename: symbol file \`$arg' does not exist"
  851. exit 1
  852. fi
  853. prev=
  854. continue
  855. ;;
  856. expsyms_regex)
  857. export_symbols_regex="$arg"
  858. prev=
  859. continue
  860. ;;
  861. release)
  862. release="-$arg"
  863. prev=
  864. continue
  865. ;;
  866. rpath | xrpath)
  867. # We need an absolute path.
  868. case "$arg" in
  869. [\\/]* | [A-Za-z]:[\\/]*) ;;
  870. *)
  871. $echo "$modename: only absolute run-paths are allowed" 1>&2
  872. exit 1
  873. ;;
  874. esac
  875. if test "$prev" = rpath; then
  876. case "$rpath " in
  877. *" $arg "*) ;;
  878. *) rpath="$rpath $arg" ;;
  879. esac
  880. else
  881. case "$xrpath " in
  882. *" $arg "*) ;;
  883. *) xrpath="$xrpath $arg" ;;
  884. esac
  885. fi
  886. prev=
  887. continue
  888. ;;
  889. *)
  890. eval "$prev=\"\$arg\""
  891. prev=
  892. continue
  893. ;;
  894. esac
  895. fi
  896. prevarg="$arg"
  897. case "$arg" in
  898. -all-static)
  899. if test -n "$link_static_flag"; then
  900. compile_command="$compile_command $link_static_flag"
  901. finalize_command="$finalize_command $link_static_flag"
  902. fi
  903. continue
  904. ;;
  905. -allow-undefined)
  906. # FIXME: remove this flag sometime in the future.
  907. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  908. continue
  909. ;;
  910. -avoid-version)
  911. avoid_version=yes
  912. continue
  913. ;;
  914. -dlopen)
  915. prev=dlfiles
  916. continue
  917. ;;
  918. -dlpreopen)
  919. prev=dlprefiles
  920. continue
  921. ;;
  922. -export-dynamic)
  923. export_dynamic=yes
  924. continue
  925. ;;
  926. -export-symbols | -export-symbols-regex)
  927. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  928. $echo "$modename: not more than one -exported-symbols argument allowed"
  929. exit 1
  930. fi
  931. if test "X$arg" = "X-export-symbols"; then
  932. prev=expsyms
  933. else
  934. prev=expsyms_regex
  935. fi
  936. continue
  937. ;;
  938. -L*)
  939. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  940. # We need an absolute path.
  941. case "$dir" in
  942. [\\/]* | [A-Za-z]:[\\/]*) ;;
  943. *)
  944. absdir=`cd "$dir" && pwd`
  945. if test -z "$absdir"; then
  946. $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  947. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  948. absdir="$dir"
  949. fi
  950. dir="$absdir"
  951. ;;
  952. esac
  953. case " $deplibs " in
  954. *" $arg "*) ;;
  955. *) deplibs="$deplibs $arg";;
  956. esac
  957. case " $lib_search_path " in
  958. *" $dir "*) ;;
  959. *) lib_search_path="$lib_search_path $dir";;
  960. esac
  961. case "$host" in
  962. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  963. dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  964. case ":$dllsearchpath:" in
  965. ::) dllsearchpath="$dllsearchdir";;
  966. *":$dllsearchdir:"*) ;;
  967. *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  968. esac
  969. ;;
  970. esac
  971. ;;
  972. -l*)
  973. if test "$arg" = "-lc"; then
  974. case "$host" in
  975. *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  976. # These systems don't actually have c library (as such)
  977. continue
  978. ;;
  979. esac
  980. elif test "$arg" = "-lm"; then
  981. case "$host" in
  982. *-*-cygwin* | *-*-beos*)
  983. # These systems don't actually have math library (as such)
  984. continue
  985. ;;
  986. esac
  987. fi
  988. deplibs="$deplibs $arg"
  989. ;;
  990. -module)
  991. module=yes
  992. continue
  993. ;;
  994. -no-undefined)
  995. allow_undefined=no
  996. continue
  997. ;;
  998. -o) prev=output ;;
  999. -release)
  1000. prev=release
  1001. continue
  1002. ;;
  1003. -rpath)
  1004. prev=rpath
  1005. continue
  1006. ;;
  1007. -R)
  1008. prev=xrpath
  1009. continue
  1010. ;;
  1011. -R*)
  1012. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1013. # We need an absolute path.
  1014. case "$dir" in
  1015. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1016. *)
  1017. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1018. exit 1
  1019. ;;
  1020. esac
  1021. case "$xrpath " in
  1022. *" $dir "*) ;;
  1023. *) xrpath="$xrpath $dir" ;;
  1024. esac
  1025. continue
  1026. ;;
  1027. -static)
  1028. # If we have no pic_flag, then this is the same as -all-static.
  1029. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1030. compile_command="$compile_command $link_static_flag"
  1031. finalize_command="$finalize_command $link_static_flag"
  1032. fi
  1033. continue
  1034. ;;
  1035. -thread-safe)
  1036. thread_safe=yes
  1037. continue
  1038. ;;
  1039. -version-info)
  1040. prev=vinfo
  1041. continue
  1042. ;;
  1043. # Some other compiler flag.
  1044. -* | +*)
  1045. # Unknown arguments in both finalize_command and compile_command need
  1046. # to be aesthetically quoted because they are evaled later.
  1047. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1048. case "$arg" in
  1049. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1050. arg="\"$arg\""
  1051. ;;
  1052. esac
  1053. ;;
  1054. *.o | *.obj | *.a | *.lib)
  1055. # A standard object.
  1056. objs="$objs $arg"
  1057. ;;
  1058. *.lo)
  1059. # A library object.
  1060. if test "$prev" = dlfiles; then
  1061. dlfiles="$dlfiles $arg"
  1062. if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1063. prev=
  1064. continue
  1065. else
  1066. # If libtool objects are unsupported, then we need to preload.
  1067. prev=dlprefiles
  1068. fi
  1069. fi
  1070. if test "$prev" = dlprefiles; then
  1071. # Preload the old-style object.
  1072. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1073. prev=
  1074. fi
  1075. libobjs="$libobjs $arg"
  1076. ;;
  1077. *.la)
  1078. # A libtool-controlled library.
  1079. dlname=
  1080. libdir=
  1081. library_names=
  1082. old_library=
  1083. # Check to see that this really is a libtool archive.
  1084. if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1085. else
  1086. $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1087. exit 1
  1088. fi
  1089. # If the library was installed with an old release of libtool,
  1090. # it will not redefine variable installed.
  1091. installed=yes
  1092. # Read the .la file
  1093. # If there is no directory component, then add one.
  1094. case "$arg" in
  1095. */* | *\\*) . $arg ;;
  1096. *) . ./$arg ;;
  1097. esac
  1098. # Get the name of the library we link against.
  1099. linklib=
  1100. for l in $old_library $library_names; do
  1101. linklib="$l"
  1102. done
  1103. if test -z "$linklib"; then
  1104. $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1105. exit 1
  1106. fi
  1107. # Find the relevant object directory and library name.
  1108. name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1109. if test "X$installed" = Xyes; then
  1110. dir="$libdir"
  1111. else
  1112. dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1113. if test "X$dir" = "X$arg"; then
  1114. dir="$objdir"
  1115. else
  1116. dir="$dir/$objdir"
  1117. fi
  1118. fi
  1119. if test -n "$dependency_libs"; then
  1120. # Extract -R and -L from dependency_libs
  1121. temp_deplibs=
  1122. for deplib in $dependency_libs; do
  1123. case "$deplib" in
  1124. -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1125. case " $rpath $xrpath " in
  1126. *" $temp_xrpath "*) ;;
  1127. *) xrpath="$xrpath $temp_xrpath";;
  1128. esac;;
  1129. -L*) case "$compile_command $temp_deplibs " in
  1130. *" $deplib "*) ;;
  1131. *) temp_deplibs="$temp_deplibs $deplib";;
  1132. esac
  1133. temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1134. case " $lib_search_path " in
  1135. *" $temp_dir "*) ;;
  1136. *) lib_search_path="$lib_search_path $temp_dir";;
  1137. esac
  1138. ;;
  1139. *) temp_deplibs="$temp_deplibs $deplib";;
  1140. esac
  1141. done
  1142. dependency_libs="$temp_deplibs"
  1143. fi
  1144. if test -z "$libdir"; then
  1145. # It is a libtool convenience library, so add in its objects.
  1146. convenience="$convenience $dir/$old_library"
  1147. old_convenience="$old_convenience $dir/$old_library"
  1148. deplibs="$deplibs$dependency_libs"
  1149. compile_command="$compile_command $dir/$old_library$dependency_libs"
  1150. finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1151. continue
  1152. fi
  1153. # This library was specified with -dlopen.
  1154. if test "$prev" = dlfiles; then
  1155. dlfiles="$dlfiles $arg"
  1156. if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1157. # If there is no dlname, no dlopen support or we're linking statically,
  1158. # we need to preload.
  1159. prev=dlprefiles
  1160. else
  1161. # We should not create a dependency on this library, but we
  1162. # may need any libraries it requires.
  1163. compile_command="$compile_command$dependency_libs"
  1164. finalize_command="$finalize_command$dependency_libs"
  1165. prev=
  1166. continue
  1167. fi
  1168. fi
  1169. # The library was specified with -dlpreopen.
  1170. if test "$prev" = dlprefiles; then
  1171. # Prefer using a static library (so that no silly _DYNAMIC symbols
  1172. # are required to link).
  1173. if test -n "$old_library"; then
  1174. dlprefiles="$dlprefiles $dir/$old_library"
  1175. else
  1176. dlprefiles="$dlprefiles $dir/$linklib"
  1177. fi
  1178. prev=
  1179. fi
  1180. if test -n "$library_names" &&
  1181. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1182. link_against_libtool_libs="$link_against_libtool_libs $arg"
  1183. if test -n "$shlibpath_var"; then
  1184. # Make sure the rpath contains only unique directories.
  1185. case "$temp_rpath " in
  1186. *" $dir "*) ;;
  1187. *) temp_rpath="$temp_rpath $dir" ;;
  1188. esac
  1189. fi
  1190. # We need an absolute path.
  1191. case "$dir" in
  1192. [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1193. *)
  1194. absdir=`cd "$dir" && pwd`
  1195. if test -z "$absdir"; then
  1196. $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1197. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1198. absdir="$dir"
  1199. fi
  1200. ;;
  1201. esac
  1202. # This is the magic to use -rpath.
  1203. # Skip directories that are in the system default run-time
  1204. # search path, unless they have been requested with -R.
  1205. case " $sys_lib_dlsearch_path " in
  1206. *" $absdir "*) ;;
  1207. *)
  1208. case "$compile_rpath " in
  1209. *" $absdir "*) ;;
  1210. *) compile_rpath="$compile_rpath $absdir"
  1211. esac
  1212. ;;
  1213. esac
  1214. case " $sys_lib_dlsearch_path " in
  1215. *" $libdir "*) ;;
  1216. *)
  1217. case "$finalize_rpath " in
  1218. *" $libdir "*) ;;
  1219. *) finalize_rpath="$finalize_rpath $libdir"
  1220. esac
  1221. ;;
  1222. esac
  1223. lib_linked=yes
  1224. case "$hardcode_action" in
  1225. immediate | unsupported)
  1226. if test "$hardcode_direct" = no; then
  1227. compile_command="$compile_command $dir/$linklib"
  1228. deplibs="$deplibs $dir/$linklib"
  1229. case "$host" in
  1230. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1231. dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1232. if test -n "$dllsearchpath"; then
  1233. dllsearchpath="$dllsearchpath:$dllsearchdir"
  1234. else
  1235. dllsearchpath="$dllsearchdir"
  1236. fi
  1237. ;;
  1238. esac
  1239. elif test "$hardcode_minus_L" = no; then
  1240. case "$host" in
  1241. *-*-sunos*)
  1242. compile_shlibpath="$compile_shlibpath$dir:"
  1243. ;;
  1244. esac
  1245. case "$compile_command " in
  1246. *" -L$dir "*) ;;
  1247. *) compile_command="$compile_command -L$dir";;
  1248. esac
  1249. compile_command="$compile_command -l$name"
  1250. deplibs="$deplibs -L$dir -l$name"
  1251. elif test "$hardcode_shlibpath_var" = no; then
  1252. case ":$compile_shlibpath:" in
  1253. *":$dir:"*) ;;
  1254. *) compile_shlibpath="$compile_shlibpath$dir:";;
  1255. esac
  1256. compile_command="$compile_command -l$name"
  1257. deplibs="$deplibs -l$name"
  1258. else
  1259. lib_linked=no
  1260. fi
  1261. ;;
  1262. relink)
  1263. if test "$hardcode_direct" = yes; then
  1264. compile_command="$compile_command $absdir/$linklib"
  1265. deplibs="$deplibs $absdir/$linklib"
  1266. elif test "$hardcode_minus_L" = yes; then
  1267. case "$compile_command " in
  1268. *" -L$absdir "*) ;;
  1269. *) compile_command="$compile_command -L$absdir";;
  1270. esac
  1271. compile_command="$compile_command -l$name"
  1272. deplibs="$deplibs -L$absdir -l$name"
  1273. elif test "$hardcode_shlibpath_var" = yes; then
  1274. case ":$compile_shlibpath:" in
  1275. *":$absdir:"*) ;;
  1276. *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1277. esac
  1278. compile_command="$compile_command -l$name"
  1279. deplibs="$deplibs -l$name"
  1280. else
  1281. lib_linked=no
  1282. fi
  1283. ;;
  1284. *)
  1285. lib_linked=no
  1286. ;;
  1287. esac
  1288. if test "$lib_linked" != yes; then
  1289. $echo "$modename: configuration error: unsupported hardcode properties"
  1290. exit 1
  1291. fi
  1292. # Finalize command for both is simple: just hardcode it.
  1293. if test "$hardcode_direct" = yes; then
  1294. finalize_command="$finalize_command $libdir/$linklib"
  1295. elif test "$hardcode_minus_L" = yes; then
  1296. case "$finalize_command " in
  1297. *" -L$libdir "*) ;;
  1298. *) finalize_command="$finalize_command -L$libdir";;
  1299. esac
  1300. finalize_command="$finalize_command -l$name"
  1301. elif test "$hardcode_shlibpath_var" = yes; then
  1302. case ":$finalize_shlibpath:" in
  1303. *":$libdir:"*) ;;
  1304. *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1305. esac
  1306. finalize_command="$finalize_command -l$name"
  1307. else
  1308. # We cannot seem to hardcode it, guess we'll fake it.
  1309. case "$finalize_command " in
  1310. *" -L$dir "*) ;;
  1311. *) finalize_command="$finalize_command -L$libdir";;
  1312. esac
  1313. finalize_command="$finalize_command -l$name"
  1314. fi
  1315. else
  1316. # Transform directly to old archives if we don't build new libraries.
  1317. if test -n "$pic_flag" && test -z "$old_library"; then
  1318. $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1319. exit 1
  1320. fi
  1321. # Here we assume that one of hardcode_direct or hardcode_minus_L
  1322. # is not unsupported. This is valid on all known static and
  1323. # shared platforms.
  1324. if test "$hardcode_direct" != unsupported; then
  1325. test -n "$old_library" && linklib="$old_library"
  1326. compile_command="$compile_command $dir/$linklib"
  1327. finalize_command="$finalize_command $dir/$linklib"
  1328. else
  1329. case "$compile_command " in
  1330. *" -L$dir "*) ;;
  1331. *) compile_command="$compile_command -L$dir";;
  1332. esac
  1333. compile_command="$compile_command -l$name"
  1334. case "$finalize_command " in
  1335. *" -L$dir "*) ;;
  1336. *) finalize_command="$finalize_command -L$dir";;
  1337. esac
  1338. finalize_command="$finalize_command -l$name"
  1339. fi
  1340. fi
  1341. # Add in any libraries that this one depends upon.
  1342. compile_command="$compile_command$dependency_libs"
  1343. finalize_command="$finalize_command$dependency_libs"
  1344. continue
  1345. ;;
  1346. # Some other compiler argument.
  1347. *)
  1348. # Unknown arguments in both finalize_command and compile_command need
  1349. # to be aesthetically quoted because they are evaled later.
  1350. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1351. case "$arg" in
  1352. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1353. arg="\"$arg\""
  1354. ;;
  1355. esac
  1356. ;;
  1357. esac
  1358. # Now actually substitute the argument into the commands.
  1359. if test -n "$arg"; then
  1360. compile_command="$compile_command $arg"
  1361. finalize_command="$finalize_command $arg"
  1362. fi
  1363. done
  1364. if test -n "$prev"; then
  1365. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1366. $echo "$help" 1>&2
  1367. exit 1
  1368. fi
  1369. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1370. eval arg=\"$export_dynamic_flag_spec\"
  1371. compile_command="$compile_command $arg"
  1372. finalize_command="$finalize_command $arg"
  1373. fi
  1374. oldlibs=
  1375. # calculate the name of the file, without its directory
  1376. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1377. libobjs_save="$libobjs"
  1378. case "$output" in
  1379. "")
  1380. $echo "$modename: you must specify an output file" 1>&2
  1381. $echo "$help" 1>&2
  1382. exit 1
  1383. ;;
  1384. *.a | *.lib)
  1385. if test -n "$link_against_libtool_libs"; then
  1386. $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1387. exit 1
  1388. fi
  1389. if test -n "$deplibs"; then
  1390. $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1391. fi
  1392. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1393. $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1394. fi
  1395. if test -n "$rpath"; then
  1396. $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1397. fi
  1398. if test -n "$xrpath"; then
  1399. $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1400. fi
  1401. if test -n "$vinfo"; then
  1402. $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1403. fi
  1404. if test -n "$release"; then
  1405. $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1406. fi
  1407. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1408. $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1409. fi
  1410. # Now set the variables for building old libraries.
  1411. build_libtool_libs=no
  1412. oldlibs="$output"
  1413. ;;
  1414. *.la)
  1415. # Make sure we only generate libraries of the form `libNAME.la'.
  1416. case "$outputname" in
  1417. lib*)
  1418. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1419. eval libname=\"$libname_spec\"
  1420. ;;
  1421. *)
  1422. if test "$module" = no; then
  1423. $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1424. $echo "$help" 1>&2
  1425. exit 1
  1426. fi
  1427. if test "$need_lib_prefix" != no; then
  1428. # Add the "lib" prefix for modules if required
  1429. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1430. eval libname=\"$libname_spec\"
  1431. else
  1432. libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1433. fi
  1434. ;;
  1435. esac
  1436. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1437. if test "X$output_objdir" = "X$output"; then
  1438. output_objdir="$objdir"
  1439. else
  1440. output_objdir="$output_objdir/$objdir"
  1441. fi
  1442. if test -n "$objs"; then
  1443. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1444. exit 1
  1445. fi
  1446. # How the heck are we supposed to write a wrapper for a shared library?
  1447. if test -n "$link_against_libtool_libs"; then
  1448. $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1449. exit 1
  1450. fi
  1451. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1452. $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1453. fi
  1454. set dummy $rpath
  1455. if test $# -gt 2; then
  1456. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1457. fi
  1458. install_libdir="$2"
  1459. oldlibs=
  1460. if test -z "$rpath"; then
  1461. if test "$build_libtool_libs" = yes; then
  1462. # Building a libtool convenience library.
  1463. libext=al
  1464. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1465. build_libtool_libs=convenience
  1466. build_old_libs=yes
  1467. fi
  1468. dependency_libs="$deplibs"
  1469. if test -n "$vinfo"; then
  1470. $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1471. fi
  1472. if test -n "$release"; then
  1473. $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1474. fi
  1475. else
  1476. # Parse the version information argument.
  1477. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
  1478. set dummy $vinfo 0 0 0
  1479. IFS="$save_ifs"
  1480. if test -n "$8"; then
  1481. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1482. $echo "$help" 1>&2
  1483. exit 1
  1484. fi
  1485. current="$2"
  1486. revision="$3"
  1487. age="$4"
  1488. # Check that each of the things are valid numbers.
  1489. case "$current" in
  1490. 0 | [1-9] | [1-9][0-9]*) ;;
  1491. *)
  1492. $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1493. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1494. exit 1
  1495. ;;
  1496. esac
  1497. case "$revision" in
  1498. 0 | [1-9] | [1-9][0-9]*) ;;
  1499. *)
  1500. $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1501. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1502. exit 1
  1503. ;;
  1504. esac
  1505. case "$age" in
  1506. 0 | [1-9] | [1-9][0-9]*) ;;
  1507. *)
  1508. $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1509. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1510. exit 1
  1511. ;;
  1512. esac
  1513. if test $age -gt $current; then
  1514. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1515. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1516. exit 1
  1517. fi
  1518. # Calculate the version variables.
  1519. major=
  1520. versuffix=
  1521. verstring=
  1522. case "$version_type" in
  1523. none) ;;
  1524. irix)
  1525. major=`expr $current - $age + 1`
  1526. versuffix="$major.$revision"
  1527. verstring="sgi$major.$revision"
  1528. # Add in all the interfaces that we are compatible with.
  1529. loop=$revision
  1530. while test $loop != 0; do
  1531. iface=`expr $revision - $loop`
  1532. loop=`expr $loop - 1`
  1533. verstring="sgi$major.$iface:$verstring"
  1534. done
  1535. ;;
  1536. linux)
  1537. major=.`expr $current - $age`
  1538. versuffix="$major.$age.$revision"
  1539. ;;
  1540. osf)
  1541. major=`expr $current - $age`
  1542. versuffix=".$current.$age.$revision"
  1543. verstring="$current.$age.$revision"
  1544. # Add in all the interfaces that we are compatible with.
  1545. loop=$age
  1546. while test $loop != 0; do
  1547. iface=`expr $current - $loop`
  1548. loop=`expr $loop - 1`
  1549. verstring="$verstring:${iface}.0"
  1550. done
  1551. # Make executables depend on our current version.
  1552. verstring="$verstring:${current}.0"
  1553. ;;
  1554. sunos)
  1555. major=".$current"
  1556. versuffix=".$current.$revision"
  1557. ;;
  1558. freebsd-aout)
  1559. major=".$current"
  1560. versuffix=".$current.$revision";
  1561. ;;
  1562. freebsd-elf)
  1563. major=".$current"
  1564. versuffix=".$current";
  1565. ;;
  1566. windows)
  1567. # Like Linux, but with '-' rather than '.', since we only
  1568. # want one extension on Windows 95.
  1569. major=`expr $current - $age`
  1570. versuffix="-$major-$age-$revision"
  1571. ;;
  1572. *)
  1573. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1574. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  1575. exit 1
  1576. ;;
  1577. esac
  1578. # Clear the version info if we defaulted, and they specified a release.
  1579. if test -z "$vinfo" && test -n "$release"; then
  1580. major=
  1581. verstring="0.0"
  1582. if test "$need_version" = no; then
  1583. versuffix=
  1584. else
  1585. versuffix=".0.0"
  1586. fi
  1587. fi
  1588. # Remove version info from name if versioning should be avoided
  1589. if test "$avoid_version" = yes && test "$need_version" = no; then
  1590. major=
  1591. versuffix=
  1592. verstring=""
  1593. fi
  1594. # Check to see if the archive will have undefined symbols.
  1595. if test "$allow_undefined" = yes; then
  1596. if test "$allow_undefined_flag" = unsupported; then
  1597. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1598. build_libtool_libs=no
  1599. build_old_libs=yes
  1600. fi
  1601. else
  1602. # Don't allow undefined symbols.
  1603. allow_undefined_flag="$no_undefined_flag"
  1604. fi
  1605. dependency_libs="$deplibs"
  1606. case "$host" in
  1607. *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1608. # these systems don't actually have a c library (as such)!
  1609. ;;
  1610. *)
  1611. # Add libc to deplibs on all other systems.
  1612. deplibs="$deplibs -lc"
  1613. ;;
  1614. esac
  1615. fi
  1616. # Create the output directory, or remove our outputs if we need to.
  1617. if test -d $output_objdir; then
  1618. $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1619. $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1620. else
  1621. $show "$mkdir $output_objdir"
  1622. $run $mkdir $output_objdir
  1623. status=$?
  1624. if test $status -ne 0 && test ! -d $output_objdir; then
  1625. exit $status
  1626. fi
  1627. fi
  1628. # Now set the variables for building old libraries.
  1629. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1630. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1631. # Transform .lo files to .o files.
  1632. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1633. fi
  1634. if test "$build_libtool_libs" = yes; then
  1635. # Transform deplibs into only deplibs that can be linked in shared.
  1636. name_save=$name
  1637. libname_save=$libname
  1638. release_save=$release
  1639. versuffix_save=$versuffix
  1640. major_save=$major
  1641. # I'm not sure if I'm treating the release correctly. I think
  1642. # release should show up in the -l (ie -lgmp5) so we don't want to
  1643. # add it in twice. Is that correct?
  1644. release=""
  1645. versuffix=""
  1646. major=""
  1647. newdeplibs=
  1648. droppeddeps=no
  1649. case "$deplibs_check_method" in
  1650. pass_all)
  1651. # Don't check for shared/static. Everything works.
  1652. # This might be a little naive. We might want to check
  1653. # whether the library exists or not. But this is on
  1654. # osf3 & osf4 and I'm not really sure... Just
  1655. # implementing what was already the behaviour.
  1656. newdeplibs=$deplibs
  1657. ;;
  1658. test_compile)
  1659. # This code stresses the "libraries are programs" paradigm to its
  1660. # limits. Maybe even breaks it. We compile a program, linking it
  1661. # against the deplibs as a proxy for the library. Then we can check
  1662. # whether they linked in statically or dynamically with ldd.
  1663. $rm conftest.c
  1664. cat > conftest.c <<EOF
  1665. int main() { return 0; }
  1666. EOF
  1667. $rm conftest
  1668. $C_compiler -o conftest conftest.c $deplibs
  1669. if test $? -eq 0 ; then
  1670. ldd_output=`ldd conftest`
  1671. for i in $deplibs; do
  1672. name="`expr $i : '-l\(.*\)'`"
  1673. # If $name is empty we are operating on a -L argument.
  1674. if test "$name" != "" ; then
  1675. libname=`eval \\$echo \"$libname_spec\"`
  1676. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1677. set dummy $deplib_matches
  1678. deplib_match=$2
  1679. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1680. newdeplibs="$newdeplibs $i"
  1681. else
  1682. droppeddeps=yes
  1683. echo
  1684. echo "*** Warning: This library needs some functionality provided by $i."
  1685. echo "*** I have the capability to make that library automatically link in when"
  1686. echo "*** you link to this library. But I can only do this if you have a"
  1687. echo "*** shared version of the library, which you do not appear to have."
  1688. fi
  1689. else
  1690. newdeplibs="$newdeplibs $i"
  1691. fi
  1692. done
  1693. else
  1694. # Error occured in the first compile. Let's try to salvage the situation:
  1695. # Compile a seperate program for each library.
  1696. for i in $deplibs; do
  1697. name="`expr $i : '-l\(.*\)'`"
  1698. # If $name is empty we are operating on a -L argument.
  1699. if test "$name" != "" ; then
  1700. $rm conftest
  1701. $C_compiler -o conftest conftest.c $i
  1702. # Did it work?
  1703. if test $? -eq 0 ; then
  1704. ldd_output=`ldd conftest`
  1705. libname=`eval \\$echo \"$libname_spec\"`
  1706. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1707. set dummy $deplib_matches
  1708. deplib_match=$2
  1709. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1710. newdeplibs="$newdeplibs $i"
  1711. else
  1712. droppeddeps=yes
  1713. echo
  1714. echo "*** Warning: This library needs some functionality provided by $i."
  1715. echo "*** I have the capability to make that library automatically link in when"
  1716. echo "*** you link to this library. But I can only do this if you have a"
  1717. echo "*** shared version of the library, which you do not appear to have."
  1718. fi
  1719. else
  1720. droppeddeps=yes
  1721. echo
  1722. echo "*** Warning! Library $i is needed by this library but I was not able to"
  1723. echo "*** makā€¦

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