PageRenderTime 99ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/libtool

http://github.com/fizx/parsley
Shell | 8890 lines | 7043 code | 726 blank | 1121 comment | 833 complexity | 49bf31347fbe76c3a8350a685f6d89eb MD5 | raw file
  1. #! /bin/sh
  2. # libtool - Provide generalized library-building support services.
  3. # Generated automatically by config.status (parsleyc) 1.0
  4. # Libtool was configured on host Eugenes-MacBook-Air-2.local:
  5. # NOTE: Changes made to this file will be lost: look at ltmain.sh.
  6. #
  7. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
  8. # 2006, 2007, 2008 Free Software Foundation, Inc.
  9. # Written by Gordon Matzigkeit, 1996
  10. #
  11. # This file is part of GNU Libtool.
  12. #
  13. # GNU Libtool is free software; you can redistribute it and/or
  14. # modify it under the terms of the GNU General Public License as
  15. # published by the Free Software Foundation; either version 2 of
  16. # the License, or (at your option) any later version.
  17. #
  18. # As a special exception to the GNU General Public License,
  19. # if you distribute this file as part of a program or library that
  20. # is built using GNU Libtool, you may include this file under the
  21. # same distribution terms that you use for the rest of that program.
  22. #
  23. # GNU Libtool is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. # GNU General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU General Public License
  29. # along with GNU Libtool; see the file COPYING. If not, a copy
  30. # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
  31. # obtained by writing to the Free Software Foundation, Inc.,
  32. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  33. # The names of the tagged configurations supported by this script.
  34. available_tags=""
  35. # ### BEGIN LIBTOOL CONFIG
  36. # Which release of libtool.m4 was used?
  37. macro_version=2.2.6
  38. macro_revision=1.3012
  39. # Whether or not to build shared libraries.
  40. build_libtool_libs=yes
  41. # Whether or not to build static libraries.
  42. build_old_libs=yes
  43. # What type of objects to build.
  44. pic_mode=default
  45. # Whether or not to optimize for fast installation.
  46. fast_install=needless
  47. # The host system.
  48. host_alias=
  49. host=i386-apple-darwin12.4.0
  50. host_os=darwin12.4.0
  51. # The build system.
  52. build_alias=
  53. build=i386-apple-darwin12.4.0
  54. build_os=darwin12.4.0
  55. # A sed program that does not truncate output.
  56. SED="/usr/bin/sed"
  57. # Sed that helps us avoid accidentally triggering echo(1) options like -n.
  58. Xsed="$SED -e 1s/^X//"
  59. # A grep program that handles long lines.
  60. GREP="/usr/bin/grep"
  61. # An ERE matcher.
  62. EGREP="/usr/bin/grep -E"
  63. # A literal string matcher.
  64. FGREP="/usr/bin/grep -F"
  65. # A BSD- or MS-compatible name lister.
  66. NM="/usr/bin/nm"
  67. # Whether we need soft or hard links.
  68. LN_S="ln -s"
  69. # What is the maximum length of a command?
  70. max_cmd_len=196608
  71. # Object file suffix (normally "o").
  72. objext=o
  73. # Executable file suffix (normally "").
  74. exeext=
  75. # whether the shell understands "unset".
  76. lt_unset=unset
  77. # turn spaces into newlines.
  78. SP2NL="tr \\040 \\012"
  79. # turn newlines into spaces.
  80. NL2SP="tr \\015\\012 \\040\\040"
  81. # How to create reloadable object files.
  82. reload_flag=" -r"
  83. reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs"
  84. # An object symbol dumper.
  85. OBJDUMP="false"
  86. # Method to check whether dependent libraries are shared objects.
  87. deplibs_check_method="pass_all"
  88. # Command to use when deplibs_check_method == "file_magic".
  89. file_magic_cmd="\$MAGIC_CMD"
  90. # The archiver.
  91. AR="ar"
  92. AR_FLAGS="cru"
  93. # A symbol stripping program.
  94. STRIP="strip"
  95. # Commands used to install an old-style archive.
  96. RANLIB="ranlib"
  97. old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
  98. old_postuninstall_cmds=""
  99. # A C compiler.
  100. LTCC="gcc -std=gnu99"
  101. # LTCC compiler flags.
  102. LTCFLAGS="-g -O2"
  103. # Take the output of nm and produce a listing of raw symbols and C names.
  104. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p'"
  105. # Transform the output of nm in a proper C declaration.
  106. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[BCDEGRST]* .* \\(.*\\)\$/extern char \\1;/p'"
  107. # Transform the output of nm in a C name address pair.
  108. global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
  109. # Transform the output of nm in a C name address pair when lib prefix is needed.
  110. global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
  111. # The name of the directory that contains temporary libtool files.
  112. objdir=.libs
  113. # Shell to use when invoking shell scripts.
  114. SHELL="/bin/sh"
  115. # An echo program that does not interpret backslashes.
  116. ECHO="/bin/echo"
  117. # Used to examine libraries when file_magic_cmd begins with "file".
  118. MAGIC_CMD=file
  119. # Must we lock files when doing compilation?
  120. need_locks="no"
  121. # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
  122. DSYMUTIL="dsymutil"
  123. # Tool to change global to local symbols on Mac OS X.
  124. NMEDIT="nmedit"
  125. # Tool to manipulate fat objects and archives on Mac OS X.
  126. LIPO="lipo"
  127. # ldd/readelf like tool for Mach-O binaries on Mac OS X.
  128. OTOOL="otool"
  129. # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
  130. OTOOL64=":"
  131. # Old archive suffix (normally "a").
  132. libext=a
  133. # Shared library suffix (normally ".so").
  134. shrext_cmds="\`test .\$module = .yes && echo .so || echo .dylib\`"
  135. # The commands to extract the exported symbol list from a shared archive.
  136. extract_expsyms_cmds=""
  137. # Variables whose values should be saved in libtool wrapper scripts and
  138. # restored at link time.
  139. variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
  140. # Do we need the "lib" prefix for modules?
  141. need_lib_prefix=no
  142. # Do we need a version for libraries?
  143. need_version=no
  144. # Library versioning type.
  145. version_type=darwin
  146. # Shared library runtime path variable.
  147. runpath_var=
  148. # Shared library path variable.
  149. shlibpath_var=DYLD_LIBRARY_PATH
  150. # Is shlibpath searched before the hard-coded library search path?
  151. shlibpath_overrides_runpath=yes
  152. # Format of library name prefix.
  153. libname_spec="lib\$name"
  154. # List of archive names. First name is the real one, the rest are links.
  155. # The last name is the one that the linker finds with -lNAME
  156. library_names_spec="\${libname}\${release}\${major}\$shared_ext \${libname}\$shared_ext"
  157. # The coded name of the library, if different from the real name.
  158. soname_spec="\${libname}\${release}\${major}\$shared_ext"
  159. # Command to use after installation of a shared archive.
  160. postinstall_cmds=""
  161. # Command to use after uninstallation of a shared archive.
  162. postuninstall_cmds=""
  163. # Commands used to finish a libtool library installation in a directory.
  164. finish_cmds=""
  165. # As "finish_cmds", except a single script fragment to be evaled but
  166. # not shown.
  167. finish_eval=""
  168. # Whether we should hardcode library paths into libraries.
  169. hardcode_into_libs=no
  170. # Compile-time system search path for libraries.
  171. sys_lib_search_path_spec="/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 /usr/lib /usr/llvm-gcc-4.2/lib/gcc /usr/llvm-gcc-4.2/lib /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib /usr/local/lib"
  172. # Run-time system search path for libraries.
  173. sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib"
  174. # Whether dlopen is supported.
  175. dlopen_support=unknown
  176. # Whether dlopen of programs is supported.
  177. dlopen_self=unknown
  178. # Whether dlopen of statically linked programs is supported.
  179. dlopen_self_static=unknown
  180. # Commands to strip libraries.
  181. old_striplib="strip -S"
  182. striplib="strip -x"
  183. # The linker used to build libraries.
  184. LD="/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld"
  185. # Commands used to build an old-style archive.
  186. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
  187. # A language specific compiler.
  188. CC="gcc -std=gnu99"
  189. # Is the compiler the GNU compiler?
  190. with_gcc=yes
  191. # Compiler flag to turn off builtin functions.
  192. no_builtin_flag=" -fno-builtin"
  193. # How to pass a linker flag through the compiler.
  194. wl="-Wl,"
  195. # Additional compiler flags for building library objects.
  196. pic_flag=" -fno-common -DPIC"
  197. # Compiler flag to prevent dynamic linking.
  198. link_static_flag=""
  199. # Does compiler simultaneously support -c and -o options?
  200. compiler_c_o="yes"
  201. # Whether or not to add -lc for building shared libraries.
  202. build_libtool_need_lc=no
  203. # Whether or not to disallow shared libs when runtime libs are static.
  204. allow_libtool_libs_with_static_runtimes=no
  205. # Compiler flag to allow reflexive dlopens.
  206. export_dynamic_flag_spec=""
  207. # Compiler flag to generate shared objects directly from archives.
  208. whole_archive_flag_spec=""
  209. # Whether the compiler copes with passing no objects directly.
  210. compiler_needs_object="no"
  211. # Create an old-style archive from a shared archive.
  212. old_archive_from_new_cmds=""
  213. # Create a temporary old-style archive to link instead of a shared archive.
  214. old_archive_from_expsyms_cmds=""
  215. # Commands used to build a shared archive.
  216. archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ~\$DSYMUTIL \$lib || :"
  217. archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym~\$DSYMUTIL \$lib || :"
  218. # Commands used to build a loadable module if different from building
  219. # a shared archive.
  220. module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags~\$DSYMUTIL \$lib || :"
  221. module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym~\$DSYMUTIL \$lib || :"
  222. # Whether we are building with GNU ld or not.
  223. with_gnu_ld="no"
  224. # Flag that allows shared libraries with undefined symbols to be built.
  225. allow_undefined_flag="\${wl}-undefined \${wl}dynamic_lookup"
  226. # Flag that enforces no undefined symbols.
  227. no_undefined_flag=""
  228. # Flag to hardcode $libdir into a binary during linking.
  229. # This must work even if $libdir does not exist
  230. hardcode_libdir_flag_spec=""
  231. # If ld is used when linking, flag to hardcode $libdir into a binary
  232. # during linking. This must work even if $libdir does not exist.
  233. hardcode_libdir_flag_spec_ld=""
  234. # Whether we need a single "-rpath" flag with a separated argument.
  235. hardcode_libdir_separator=""
  236. # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
  237. # DIR into the resulting binary.
  238. hardcode_direct=no
  239. # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
  240. # DIR into the resulting binary and the resulting library dependency is
  241. # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
  242. # library is relocated.
  243. hardcode_direct_absolute=no
  244. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  245. # into the resulting binary.
  246. hardcode_minus_L=no
  247. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  248. # into the resulting binary.
  249. hardcode_shlibpath_var=unsupported
  250. # Set to "yes" if building a shared library automatically hardcodes DIR
  251. # into the library and all subsequent libraries and executables linked
  252. # against it.
  253. hardcode_automatic=yes
  254. # Set to yes if linker adds runtime paths of dependent libraries
  255. # to runtime path list.
  256. inherit_rpath=no
  257. # Whether libtool must link a program against all its dependency libraries.
  258. link_all_deplibs=yes
  259. # Fix the shell variable $srcfile for the compiler.
  260. fix_srcfile_path=""
  261. # Set to "yes" if exported symbols are required.
  262. always_export_symbols=no
  263. # The commands to list exported symbols.
  264. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
  265. # Symbols that should not be listed in the preloaded symbols.
  266. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
  267. # Symbols that must always be exported.
  268. include_expsyms=""
  269. # Commands necessary for linking programs (against libraries) with templates.
  270. prelink_cmds=""
  271. # Specify filename containing input files.
  272. file_list_spec=""
  273. # How to hardcode a shared library path into an executable.
  274. hardcode_action=immediate
  275. # ### END LIBTOOL CONFIG
  276. # Generated from ltmain.m4sh.
  277. # ltmain.sh (GNU libtool) 2.2.6
  278. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  279. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
  280. # This is free software; see the source for copying conditions. There is NO
  281. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  282. # GNU Libtool is free software; you can redistribute it and/or modify
  283. # it under the terms of the GNU General Public License as published by
  284. # the Free Software Foundation; either version 2 of the License, or
  285. # (at your option) any later version.
  286. #
  287. # As a special exception to the GNU General Public License,
  288. # if you distribute this file as part of a program or library that
  289. # is built using GNU Libtool, you may include this file under the
  290. # same distribution terms that you use for the rest of that program.
  291. #
  292. # GNU Libtool is distributed in the hope that it will be useful, but
  293. # WITHOUT ANY WARRANTY; without even the implied warranty of
  294. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  295. # General Public License for more details.
  296. #
  297. # You should have received a copy of the GNU General Public License
  298. # along with GNU Libtool; see the file COPYING. If not, a copy
  299. # can be downloaded from http://www.gnu.org/licenses/gpl.html,
  300. # or obtained by writing to the Free Software Foundation, Inc.,
  301. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  302. # Usage: $progname [OPTION]... [MODE-ARG]...
  303. #
  304. # Provide generalized library-building support services.
  305. #
  306. # --config show all configuration variables
  307. # --debug enable verbose shell tracing
  308. # -n, --dry-run display commands without modifying any files
  309. # --features display basic configuration information and exit
  310. # --mode=MODE use operation mode MODE
  311. # --preserve-dup-deps don't remove duplicate dependency libraries
  312. # --quiet, --silent don't print informational messages
  313. # --tag=TAG use configuration variables from tag TAG
  314. # -v, --verbose print informational messages (default)
  315. # --version print version information
  316. # -h, --help print short or long help message
  317. #
  318. # MODE must be one of the following:
  319. #
  320. # clean remove files from the build directory
  321. # compile compile a source file into a libtool object
  322. # execute automatically set library path, then run a program
  323. # finish complete the installation of libtool libraries
  324. # install install libraries or executables
  325. # link create a library or an executable
  326. # uninstall remove libraries from an installed directory
  327. #
  328. # MODE-ARGS vary depending on the MODE.
  329. # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
  330. #
  331. # When reporting a bug, please describe a test case to reproduce it and
  332. # include the following information:
  333. #
  334. # host-triplet: $host
  335. # shell: $SHELL
  336. # compiler: $LTCC
  337. # compiler flags: $LTCFLAGS
  338. # linker: $LD (gnu? $with_gnu_ld)
  339. # $progname: (GNU libtool) 2.2.6
  340. # automake: $automake_version
  341. # autoconf: $autoconf_version
  342. #
  343. # Report bugs to <bug-libtool@gnu.org>.
  344. PROGRAM=ltmain.sh
  345. PACKAGE=libtool
  346. VERSION=2.2.6
  347. TIMESTAMP=""
  348. package_revision=1.3012
  349. # Be Bourne compatible
  350. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  351. emulate sh
  352. NULLCMD=:
  353. # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  354. # is contrary to our usage. Disable this feature.
  355. alias -g '${1+"$@"}'='"$@"'
  356. setopt NO_GLOB_SUBST
  357. else
  358. case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
  359. fi
  360. BIN_SH=xpg4; export BIN_SH # for Tru64
  361. DUALCASE=1; export DUALCASE # for MKS sh
  362. # NLS nuisances: We save the old values to restore during execute mode.
  363. # Only set LANG and LC_ALL to C if already set.
  364. # These must not be set unconditionally because not all systems understand
  365. # e.g. LANG=C (notably SCO).
  366. lt_user_locale=
  367. lt_safe_locale=
  368. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  369. do
  370. eval "if test \"\${$lt_var+set}\" = set; then
  371. save_$lt_var=\$$lt_var
  372. $lt_var=C
  373. export $lt_var
  374. lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
  375. lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
  376. fi"
  377. done
  378. $lt_unset CDPATH
  379. : ${CP="cp -f"}
  380. : ${ECHO="echo"}
  381. : ${EGREP="/usr/bin/grep -E"}
  382. : ${FGREP="/usr/bin/grep -F"}
  383. : ${GREP="/usr/bin/grep"}
  384. : ${LN_S="ln -s"}
  385. : ${MAKE="make"}
  386. : ${MKDIR="mkdir"}
  387. : ${MV="mv -f"}
  388. : ${RM="rm -f"}
  389. : ${SED="/opt/local/bin/gsed"}
  390. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  391. : ${Xsed="$SED -e 1s/^X//"}
  392. # Global variables:
  393. EXIT_SUCCESS=0
  394. EXIT_FAILURE=1
  395. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  396. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  397. exit_status=$EXIT_SUCCESS
  398. # Make sure IFS has a sensible default
  399. lt_nl='
  400. '
  401. IFS=" $lt_nl"
  402. dirname="s,/[^/]*$,,"
  403. basename="s,^.*/,,"
  404. # func_dirname_and_basename file append nondir_replacement
  405. # perform func_basename and func_dirname in a single function
  406. # call:
  407. # dirname: Compute the dirname of FILE. If nonempty,
  408. # add APPEND to the result, otherwise set result
  409. # to NONDIR_REPLACEMENT.
  410. # value returned in "$func_dirname_result"
  411. # basename: Compute filename of FILE.
  412. # value retuned in "$func_basename_result"
  413. # Implementation must be kept synchronized with func_dirname
  414. # and func_basename. For efficiency, we do not delegate to
  415. # those functions but instead duplicate the functionality here.
  416. func_dirname_and_basename ()
  417. {
  418. # Extract subdirectory from the argument.
  419. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
  420. if test "X$func_dirname_result" = "X${1}"; then
  421. func_dirname_result="${3}"
  422. else
  423. func_dirname_result="$func_dirname_result${2}"
  424. fi
  425. func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
  426. }
  427. # Generated shell functions inserted here.
  428. # func_dirname file append nondir_replacement
  429. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  430. # otherwise set result to NONDIR_REPLACEMENT.
  431. func_dirname ()
  432. {
  433. case ${1} in
  434. */*) func_dirname_result="${1%/*}${2}" ;;
  435. * ) func_dirname_result="${3}" ;;
  436. esac
  437. }
  438. # func_basename file
  439. func_basename ()
  440. {
  441. func_basename_result="${1##*/}"
  442. }
  443. # func_dirname_and_basename file append nondir_replacement
  444. # perform func_basename and func_dirname in a single function
  445. # call:
  446. # dirname: Compute the dirname of FILE. If nonempty,
  447. # add APPEND to the result, otherwise set result
  448. # to NONDIR_REPLACEMENT.
  449. # value returned in "$func_dirname_result"
  450. # basename: Compute filename of FILE.
  451. # value retuned in "$func_basename_result"
  452. # Implementation must be kept synchronized with func_dirname
  453. # and func_basename. For efficiency, we do not delegate to
  454. # those functions but instead duplicate the functionality here.
  455. func_dirname_and_basename ()
  456. {
  457. case ${1} in
  458. */*) func_dirname_result="${1%/*}${2}" ;;
  459. * ) func_dirname_result="${3}" ;;
  460. esac
  461. func_basename_result="${1##*/}"
  462. }
  463. # func_stripname prefix suffix name
  464. # strip PREFIX and SUFFIX off of NAME.
  465. # PREFIX and SUFFIX must not contain globbing or regex special
  466. # characters, hashes, percent signs, but SUFFIX may contain a leading
  467. # dot (in which case that matches only a dot).
  468. func_stripname ()
  469. {
  470. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  471. # positional parameters, so assign one to ordinary parameter first.
  472. func_stripname_result=${3}
  473. func_stripname_result=${func_stripname_result#"${1}"}
  474. func_stripname_result=${func_stripname_result%"${2}"}
  475. }
  476. # func_opt_split
  477. func_opt_split ()
  478. {
  479. func_opt_split_opt=${1%%=*}
  480. func_opt_split_arg=${1#*=}
  481. }
  482. # func_lo2o object
  483. func_lo2o ()
  484. {
  485. case ${1} in
  486. *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
  487. *) func_lo2o_result=${1} ;;
  488. esac
  489. }
  490. # func_xform libobj-or-source
  491. func_xform ()
  492. {
  493. func_xform_result=${1%.*}.lo
  494. }
  495. # func_arith arithmetic-term...
  496. func_arith ()
  497. {
  498. func_arith_result=$(( $* ))
  499. }
  500. # func_len string
  501. # STRING may not start with a hyphen.
  502. func_len ()
  503. {
  504. func_len_result=${#1}
  505. }
  506. # func_append var value
  507. # Append VALUE to the end of shell variable VAR.
  508. func_append ()
  509. {
  510. eval "$1+=\$2"
  511. }
  512. # Generated shell functions inserted here.
  513. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  514. # is ksh but when the shell is invoked as "sh" and the current value of
  515. # the _XPG environment variable is not equal to 1 (one), the special
  516. # positional parameter $0, within a function call, is the name of the
  517. # function.
  518. progpath="$0"
  519. # The name of this program:
  520. # In the unlikely event $progname began with a '-', it would play havoc with
  521. # func_echo (imagine progname=-n), so we prepend ./ in that case:
  522. func_dirname_and_basename "$progpath"
  523. progname=$func_basename_result
  524. case $progname in
  525. -*) progname=./$progname ;;
  526. esac
  527. # Make sure we have an absolute path for reexecution:
  528. case $progpath in
  529. [\\/]*|[A-Za-z]:\\*) ;;
  530. *[\\/]*)
  531. progdir=$func_dirname_result
  532. progdir=`cd "$progdir" && pwd`
  533. progpath="$progdir/$progname"
  534. ;;
  535. *)
  536. save_IFS="$IFS"
  537. IFS=:
  538. for progdir in $PATH; do
  539. IFS="$save_IFS"
  540. test -x "$progdir/$progname" && break
  541. done
  542. IFS="$save_IFS"
  543. test -n "$progdir" || progdir=`pwd`
  544. progpath="$progdir/$progname"
  545. ;;
  546. esac
  547. # Sed substitution that helps us do robust quoting. It backslashifies
  548. # metacharacters that are still active within double-quoted strings.
  549. Xsed="${SED}"' -e 1s/^X//'
  550. sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
  551. # Same as above, but do not quote variable references.
  552. double_quote_subst='s/\(["`\\]\)/\\\1/g'
  553. # Re-`\' parameter expansions in output of double_quote_subst that were
  554. # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
  555. # in input to double_quote_subst, that '$' was protected from expansion.
  556. # Since each input `\' is now two `\'s, look for any number of runs of
  557. # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
  558. bs='\\'
  559. bs2='\\\\'
  560. bs4='\\\\\\\\'
  561. dollar='\$'
  562. sed_double_backslash="\
  563. s/$bs4/&\\
  564. /g
  565. s/^$bs2$dollar/$bs&/
  566. s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
  567. s/\n//g"
  568. # Standard options:
  569. opt_dry_run=false
  570. opt_help=false
  571. opt_quiet=false
  572. opt_verbose=false
  573. opt_warning=:
  574. # func_echo arg...
  575. # Echo program name prefixed message, along with the current mode
  576. # name if it has been set yet.
  577. func_echo ()
  578. {
  579. $ECHO "$progname${mode+: }$mode: $*"
  580. }
  581. # func_verbose arg...
  582. # Echo program name prefixed message in verbose mode only.
  583. func_verbose ()
  584. {
  585. $opt_verbose && func_echo ${1+"$@"}
  586. # A bug in bash halts the script if the last line of a function
  587. # fails when set -e is in force, so we need another command to
  588. # work around that:
  589. :
  590. }
  591. # func_error arg...
  592. # Echo program name prefixed message to standard error.
  593. func_error ()
  594. {
  595. $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
  596. }
  597. # func_warning arg...
  598. # Echo program name prefixed warning message to standard error.
  599. func_warning ()
  600. {
  601. $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
  602. # bash bug again:
  603. :
  604. }
  605. # func_fatal_error arg...
  606. # Echo program name prefixed message to standard error, and exit.
  607. func_fatal_error ()
  608. {
  609. func_error ${1+"$@"}
  610. exit $EXIT_FAILURE
  611. }
  612. # func_fatal_help arg...
  613. # Echo program name prefixed message to standard error, followed by
  614. # a help hint, and exit.
  615. func_fatal_help ()
  616. {
  617. func_error ${1+"$@"}
  618. func_fatal_error "$help"
  619. }
  620. help="Try \`$progname --help' for more information." ## default
  621. # func_grep expression filename
  622. # Check whether EXPRESSION matches any line of FILENAME, without output.
  623. func_grep ()
  624. {
  625. $GREP "$1" "$2" >/dev/null 2>&1
  626. }
  627. # func_mkdir_p directory-path
  628. # Make sure the entire path to DIRECTORY-PATH is available.
  629. func_mkdir_p ()
  630. {
  631. my_directory_path="$1"
  632. my_dir_list=
  633. if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
  634. # Protect directory names starting with `-'
  635. case $my_directory_path in
  636. -*) my_directory_path="./$my_directory_path" ;;
  637. esac
  638. # While some portion of DIR does not yet exist...
  639. while test ! -d "$my_directory_path"; do
  640. # ...make a list in topmost first order. Use a colon delimited
  641. # list incase some portion of path contains whitespace.
  642. my_dir_list="$my_directory_path:$my_dir_list"
  643. # If the last portion added has no slash in it, the list is done
  644. case $my_directory_path in */*) ;; *) break ;; esac
  645. # ...otherwise throw away the child directory and loop
  646. my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
  647. done
  648. my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
  649. save_mkdir_p_IFS="$IFS"; IFS=':'
  650. for my_dir in $my_dir_list; do
  651. IFS="$save_mkdir_p_IFS"
  652. # mkdir can fail with a `File exist' error if two processes
  653. # try to create one of the directories concurrently. Don't
  654. # stop in that case!
  655. $MKDIR "$my_dir" 2>/dev/null || :
  656. done
  657. IFS="$save_mkdir_p_IFS"
  658. # Bail out if we (or some other process) failed to create a directory.
  659. test -d "$my_directory_path" || \
  660. func_fatal_error "Failed to create \`$1'"
  661. fi
  662. }
  663. # func_mktempdir [string]
  664. # Make a temporary directory that won't clash with other running
  665. # libtool processes, and avoids race conditions if possible. If
  666. # given, STRING is the basename for that directory.
  667. func_mktempdir ()
  668. {
  669. my_template="${TMPDIR-/tmp}/${1-$progname}"
  670. if test "$opt_dry_run" = ":"; then
  671. # Return a directory name, but don't create it in dry-run mode
  672. my_tmpdir="${my_template}-$$"
  673. else
  674. # If mktemp works, use that first and foremost
  675. my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
  676. if test ! -d "$my_tmpdir"; then
  677. # Failing that, at least try and use $RANDOM to avoid a race
  678. my_tmpdir="${my_template}-${RANDOM-0}$$"
  679. save_mktempdir_umask=`umask`
  680. umask 0077
  681. $MKDIR "$my_tmpdir"
  682. umask $save_mktempdir_umask
  683. fi
  684. # If we're not in dry-run mode, bomb out on failure
  685. test -d "$my_tmpdir" || \
  686. func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
  687. fi
  688. $ECHO "X$my_tmpdir" | $Xsed
  689. }
  690. # func_quote_for_eval arg
  691. # Aesthetically quote ARG to be evaled later.
  692. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
  693. # is double-quoted, suitable for a subsequent eval, whereas
  694. # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
  695. # which are still active within double quotes backslashified.
  696. func_quote_for_eval ()
  697. {
  698. case $1 in
  699. *[\\\`\"\$]*)
  700. func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
  701. *)
  702. func_quote_for_eval_unquoted_result="$1" ;;
  703. esac
  704. case $func_quote_for_eval_unquoted_result in
  705. # Double-quote args containing shell metacharacters to delay
  706. # word splitting, command substitution and and variable
  707. # expansion for a subsequent eval.
  708. # Many Bourne shells cannot handle close brackets correctly
  709. # in scan sets, so we specify it separately.
  710. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  711. func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
  712. ;;
  713. *)
  714. func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
  715. esac
  716. }
  717. # func_quote_for_expand arg
  718. # Aesthetically quote ARG to be evaled later; same as above,
  719. # but do not quote variable references.
  720. func_quote_for_expand ()
  721. {
  722. case $1 in
  723. *[\\\`\"]*)
  724. my_arg=`$ECHO "X$1" | $Xsed \
  725. -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
  726. *)
  727. my_arg="$1" ;;
  728. esac
  729. case $my_arg in
  730. # Double-quote args containing shell metacharacters to delay
  731. # word splitting and command substitution for a subsequent eval.
  732. # Many Bourne shells cannot handle close brackets correctly
  733. # in scan sets, so we specify it separately.
  734. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  735. my_arg="\"$my_arg\""
  736. ;;
  737. esac
  738. func_quote_for_expand_result="$my_arg"
  739. }
  740. # func_show_eval cmd [fail_exp]
  741. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  742. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  743. # is given, then evaluate it.
  744. func_show_eval ()
  745. {
  746. my_cmd="$1"
  747. my_fail_exp="${2-:}"
  748. ${opt_silent-false} || {
  749. func_quote_for_expand "$my_cmd"
  750. eval "func_echo $func_quote_for_expand_result"
  751. }
  752. if ${opt_dry_run-false}; then :; else
  753. eval "$my_cmd"
  754. my_status=$?
  755. if test "$my_status" -eq 0; then :; else
  756. eval "(exit $my_status); $my_fail_exp"
  757. fi
  758. fi
  759. }
  760. # func_show_eval_locale cmd [fail_exp]
  761. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  762. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  763. # is given, then evaluate it. Use the saved locale for evaluation.
  764. func_show_eval_locale ()
  765. {
  766. my_cmd="$1"
  767. my_fail_exp="${2-:}"
  768. ${opt_silent-false} || {
  769. func_quote_for_expand "$my_cmd"
  770. eval "func_echo $func_quote_for_expand_result"
  771. }
  772. if ${opt_dry_run-false}; then :; else
  773. eval "$lt_user_locale
  774. $my_cmd"
  775. my_status=$?
  776. eval "$lt_safe_locale"
  777. if test "$my_status" -eq 0; then :; else
  778. eval "(exit $my_status); $my_fail_exp"
  779. fi
  780. fi
  781. }
  782. # func_version
  783. # Echo version message to standard output and exit.
  784. func_version ()
  785. {
  786. $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
  787. s/^# //
  788. s/^# *$//
  789. s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
  790. p
  791. }' < "$progpath"
  792. exit $?
  793. }
  794. # func_usage
  795. # Echo short help message to standard output and exit.
  796. func_usage ()
  797. {
  798. $SED -n '/^# Usage:/,/# -h/ {
  799. s/^# //
  800. s/^# *$//
  801. s/\$progname/'$progname'/
  802. p
  803. }' < "$progpath"
  804. $ECHO
  805. $ECHO "run \`$progname --help | more' for full usage"
  806. exit $?
  807. }
  808. # func_help
  809. # Echo long help message to standard output and exit.
  810. func_help ()
  811. {
  812. $SED -n '/^# Usage:/,/# Report bugs to/ {
  813. s/^# //
  814. s/^# *$//
  815. s*\$progname*'$progname'*
  816. s*\$host*'"$host"'*
  817. s*\$SHELL*'"$SHELL"'*
  818. s*\$LTCC*'"$LTCC"'*
  819. s*\$LTCFLAGS*'"$LTCFLAGS"'*
  820. s*\$LD*'"$LD"'*
  821. s/\$with_gnu_ld/'"$with_gnu_ld"'/
  822. s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
  823. s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
  824. p
  825. }' < "$progpath"
  826. exit $?
  827. }
  828. # func_missing_arg argname
  829. # Echo program name prefixed message to standard error and set global
  830. # exit_cmd.
  831. func_missing_arg ()
  832. {
  833. func_error "missing argument for $1"
  834. exit_cmd=exit
  835. }
  836. exit_cmd=:
  837. # Check that we have a working $ECHO.
  838. if test "X$1" = X--no-reexec; then
  839. # Discard the --no-reexec flag, and continue.
  840. shift
  841. elif test "X$1" = X--fallback-echo; then
  842. # Avoid inline document here, it may be left over
  843. :
  844. elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
  845. # Yippee, $ECHO works!
  846. :
  847. else
  848. # Restart under the correct shell, and then maybe $ECHO will work.
  849. exec $SHELL "$progpath" --no-reexec ${1+"$@"}
  850. fi
  851. if test "X$1" = X--fallback-echo; then
  852. # used as fallback echo
  853. shift
  854. cat <<EOF
  855. $*
  856. EOF
  857. exit $EXIT_SUCCESS
  858. fi
  859. magic="%%%MAGIC variable%%%"
  860. magic_exe="%%%MAGIC EXE variable%%%"
  861. # Global variables.
  862. # $mode is unset
  863. nonopt=
  864. execute_dlfiles=
  865. preserve_args=
  866. lo2o="s/\\.lo\$/.${objext}/"
  867. o2lo="s/\\.${objext}\$/.lo/"
  868. extracted_archives=
  869. extracted_serial=0
  870. opt_dry_run=false
  871. opt_duplicate_deps=false
  872. opt_silent=false
  873. opt_debug=:
  874. # If this variable is set in any of the actions, the command in it
  875. # will be execed at the end. This prevents here-documents from being
  876. # left over by shells.
  877. exec_cmd=
  878. # func_fatal_configuration arg...
  879. # Echo program name prefixed message to standard error, followed by
  880. # a configuration failure hint, and exit.
  881. func_fatal_configuration ()
  882. {
  883. func_error ${1+"$@"}
  884. func_error "See the $PACKAGE documentation for more information."
  885. func_fatal_error "Fatal configuration error."
  886. }
  887. # func_config
  888. # Display the configuration for all the tags in this script.
  889. func_config ()
  890. {
  891. re_begincf='^# ### BEGIN LIBTOOL'
  892. re_endcf='^# ### END LIBTOOL'
  893. # Default configuration.
  894. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  895. # Now print the configurations for the tags.
  896. for tagname in $taglist; do
  897. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  898. done
  899. exit $?
  900. }
  901. # func_features
  902. # Display the features supported by this script.
  903. func_features ()
  904. {
  905. $ECHO "host: $host"
  906. if test "$build_libtool_libs" = yes; then
  907. $ECHO "enable shared libraries"
  908. else
  909. $ECHO "disable shared libraries"
  910. fi
  911. if test "$build_old_libs" = yes; then
  912. $ECHO "enable static libraries"
  913. else
  914. $ECHO "disable static libraries"
  915. fi
  916. exit $?
  917. }
  918. # func_enable_tag tagname
  919. # Verify that TAGNAME is valid, and either flag an error and exit, or
  920. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  921. # variable here.
  922. func_enable_tag ()
  923. {
  924. # Global variable:
  925. tagname="$1"
  926. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  927. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  928. sed_extractcf="/$re_begincf/,/$re_endcf/p"
  929. # Validate tagname.
  930. case $tagname in
  931. *[!-_A-Za-z0-9,/]*)
  932. func_fatal_error "invalid tag name: $tagname"
  933. ;;
  934. esac
  935. # Don't test for the "default" C tag, as we know it's
  936. # there but not specially marked.
  937. case $tagname in
  938. CC) ;;
  939. *)
  940. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  941. taglist="$taglist $tagname"
  942. # Evaluate the configuration. Be careful to quote the path
  943. # and the sed script, to avoid splitting on whitespace, but
  944. # also don't use non-portable quotes within backquotes within
  945. # quotes we have to do it in 2 steps:
  946. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  947. eval "$extractedcf"
  948. else
  949. func_error "ignoring unknown tag $tagname"
  950. fi
  951. ;;
  952. esac
  953. }
  954. # Parse options once, thoroughly. This comes as soon as possible in
  955. # the script to make things like `libtool --version' happen quickly.
  956. {
  957. # Shorthand for --mode=foo, only valid as the first argument
  958. case $1 in
  959. clean|clea|cle|cl)
  960. shift; set dummy --mode clean ${1+"$@"}; shift
  961. ;;
  962. compile|compil|compi|comp|com|co|c)
  963. shift; set dummy --mode compile ${1+"$@"}; shift
  964. ;;
  965. execute|execut|execu|exec|exe|ex|e)
  966. shift; set dummy --mode execute ${1+"$@"}; shift
  967. ;;
  968. finish|finis|fini|fin|fi|f)
  969. shift; set dummy --mode finish ${1+"$@"}; shift
  970. ;;
  971. install|instal|insta|inst|ins|in|i)
  972. shift; set dummy --mode install ${1+"$@"}; shift
  973. ;;
  974. link|lin|li|l)
  975. shift; set dummy --mode link ${1+"$@"}; shift
  976. ;;
  977. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  978. shift; set dummy --mode uninstall ${1+"$@"}; shift
  979. ;;
  980. esac
  981. # Parse non-mode specific arguments:
  982. while test "$#" -gt 0; do
  983. opt="$1"
  984. shift
  985. case $opt in
  986. --config) func_config ;;
  987. --debug) preserve_args="$preserve_args $opt"
  988. func_echo "enabling shell trace mode"
  989. opt_debug='set -x'
  990. $opt_debug
  991. ;;
  992. -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
  993. execute_dlfiles="$execute_dlfiles $1"
  994. shift
  995. ;;
  996. --dry-run | -n) opt_dry_run=: ;;
  997. --features) func_features ;;
  998. --finish) mode="finish" ;;
  999. --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
  1000. case $1 in
  1001. # Valid mode arguments:
  1002. clean) ;;
  1003. compile) ;;
  1004. execute) ;;
  1005. finish) ;;
  1006. install) ;;
  1007. link) ;;
  1008. relink) ;;
  1009. uninstall) ;;
  1010. # Catch anything else as an error
  1011. *) func_error "invalid argument for $opt"
  1012. exit_cmd=exit
  1013. break
  1014. ;;
  1015. esac
  1016. mode="$1"
  1017. shift
  1018. ;;
  1019. --preserve-dup-deps)
  1020. opt_duplicate_deps=: ;;
  1021. --quiet|--silent) preserve_args="$preserve_args $opt"
  1022. opt_silent=:
  1023. ;;
  1024. --verbose| -v) preserve_args="$preserve_args $opt"
  1025. opt_silent=false
  1026. ;;
  1027. --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
  1028. preserve_args="$preserve_args $opt $1"
  1029. func_enable_tag "$1" # tagname is set here
  1030. shift
  1031. ;;
  1032. # Separate optargs to long options:
  1033. -dlopen=*|--mode=*|--tag=*)
  1034. func_opt_split "$opt"
  1035. set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
  1036. shift
  1037. ;;
  1038. -\?|-h) func_usage ;;
  1039. --help) opt_help=: ;;
  1040. --version) func_version ;;
  1041. -*) func_fatal_help "unrecognized option \`$opt'" ;;
  1042. *) nonopt="$opt"
  1043. break
  1044. ;;
  1045. esac
  1046. done
  1047. case $host in
  1048. *cygwin* | *mingw* | *pw32* | *cegcc*)
  1049. # don't eliminate duplications in $postdeps and $predeps
  1050. opt_duplicate_compiler_generated_deps=:
  1051. ;;
  1052. *)
  1053. opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
  1054. ;;
  1055. esac
  1056. # Having warned about all mis-specified options, bail out if
  1057. # anything was wrong.
  1058. $exit_cmd $EXIT_FAILURE
  1059. }
  1060. # func_check_version_match
  1061. # Ensure that we are using m4 macros, and libtool script from the same
  1062. # release of libtool.
  1063. func_check_version_match ()
  1064. {
  1065. if test "$package_revision" != "$macro_revision"; then
  1066. if test "$VERSION" != "$macro_version"; then
  1067. if test -z "$macro_version"; then
  1068. cat >&2 <<_LT_EOF
  1069. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  1070. $progname: definition of this LT_INIT comes from an older release.
  1071. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  1072. $progname: and run autoconf again.
  1073. _LT_EOF
  1074. else
  1075. cat >&2 <<_LT_EOF
  1076. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  1077. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  1078. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  1079. $progname: and run autoconf again.
  1080. _LT_EOF
  1081. fi
  1082. else
  1083. cat >&2 <<_LT_EOF
  1084. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  1085. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  1086. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  1087. $progname: of $PACKAGE $VERSION and run autoconf again.
  1088. _LT_EOF
  1089. fi
  1090. exit $EXIT_MISMATCH
  1091. fi
  1092. }
  1093. ## ----------- ##
  1094. ## Main. ##
  1095. ## ----------- ##
  1096. $opt_help || {
  1097. # Sanity checks first:
  1098. func_check_version_match
  1099. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  1100. func_fatal_configuration "not configured to build any kind of library"
  1101. fi
  1102. test -z "$mode" && func_fatal_error "error: you must specify a MODE."
  1103. # Darwin sucks
  1104. eval std_shrext=\"$shrext_cmds\"
  1105. # Only execute mode is allowed to have -dlopen flags.
  1106. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  1107. func_error "unrecognized option \`-dlopen'"
  1108. $ECHO "$help" 1>&2
  1109. exit $EXIT_FAILURE
  1110. fi
  1111. # Change the help message to a mode-specific one.
  1112. generic_help="$help"
  1113. help="Try \`$progname --help --mode=$mode' for more information."
  1114. }
  1115. # func_lalib_p file
  1116. # True iff FILE is a libtool `.la' library or `.lo' object file.
  1117. # This function is only a basic sanity check; it will hardly flush out
  1118. # determined imposters.
  1119. func_lalib_p ()
  1120. {
  1121. test -f "$1" &&
  1122. $SED -e 4q "$1" 2>/dev/null \
  1123. | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  1124. }
  1125. # func_lalib_unsafe_p file
  1126. # True iff FILE is a libtool `.la' library or `.lo' object file.
  1127. # This function implements the same check as func_lalib_p without
  1128. # resorting to external programs. To this end, it redirects stdin and
  1129. # closes it afterwards, without saving the original file descriptor.
  1130. # As a safety measure, use it only where a negative result would be
  1131. # fatal anyway. Works if `file' does not exist.
  1132. func_lalib_unsafe_p ()
  1133. {
  1134. lalib_p=no
  1135. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  1136. for lalib_p_l in 1 2 3 4
  1137. do
  1138. read lalib_p_line
  1139. case "$lalib_p_line" in
  1140. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  1141. esac
  1142. done
  1143. exec 0<&5 5<&-
  1144. fi
  1145. test "$lalib_p" = yes
  1146. }
  1147. # func_ltwrapper_script_p file
  1148. # True iff FILE is a libtool wrapper script
  1149. # This function is only a basic sanity check; it will hardly flush out
  1150. # determined imposters.
  1151. func_ltwrapper_script_p ()
  1152. {
  1153. func_lalib_p "$1"
  1154. }
  1155. # func_ltwrapper_executable_p file
  1156. # True iff FILE is a libtool wrapper executable
  1157. # This function is only a basic sanity check; it will hardly flush out
  1158. # determined imposters.
  1159. func_ltwrapper_executable_p ()
  1160. {
  1161. func_ltwrapper_exec_suffix=
  1162. case $1 in
  1163. *.exe) ;;
  1164. *) func_ltwrapper_exec_suffix=.exe ;;
  1165. esac
  1166. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  1167. }
  1168. # func_ltwrapper_scriptname file
  1169. # Assumes file is an ltwrapper_executable
  1170. # uses $file to determine the appropriate filename for a
  1171. # temporary ltwrapper_script.
  1172. func_ltwrapper_scriptname ()
  1173. {
  1174. func_ltwrapper_scriptname_result=""
  1175. if func_ltwrapper_executable_p "$1"; then
  1176. func_dirname_and_basename "$1" "" "."
  1177. func_stripname '' '.exe' "$func_basename_result"
  1178. func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
  1179. fi
  1180. }
  1181. # func_ltwrapper_p file
  1182. # True iff FILE is a libtool wrapper script or wrapper executable
  1183. # This function is only a basic sanity check; it will hardly flush out
  1184. # determined imposters.
  1185. func_ltwrapper_p ()
  1186. {
  1187. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  1188. }
  1189. # func_execute_cmds commands fail_cmd
  1190. # Execute tilde-delimited COMMANDS.
  1191. # If FAIL_CMD is given, eval that upon failure.
  1192. # FAIL_CMD may read-access the current command in variable CMD!
  1193. func_execute_cmds ()
  1194. {
  1195. $opt_debug
  1196. save_ifs=$IFS; IFS='~'
  1197. for cmd in $1; do
  1198. IFS=$save_ifs
  1199. eval cmd=\"$cmd\"
  1200. func_show_eval "$cmd" "${2-:}"
  1201. done
  1202. IFS=$save_ifs
  1203. }
  1204. # func_source file
  1205. # Source FILE, adding directory component if necessary.
  1206. # Note that it is not necessary on cygwin/mingw to append a dot to
  1207. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  1208. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  1209. # `FILE.' does not work on cygwin managed mounts.
  1210. func_source ()
  1211. {
  1212. $opt_debug
  1213. case $1 in
  1214. */* | *\\*) . "$1" ;;
  1215. *) . "./$1" ;;
  1216. esac
  1217. }
  1218. # func_infer_tag arg
  1219. # Infer tagged configuration to use if any are available and
  1220. # if one wasn't chosen via the "--tag" command line option.
  1221. # Only attempt this if the compiler in the base compile
  1222. # command doesn't match the default compiler.
  1223. # arg is usually of the form 'gcc ...'
  1224. func_infer_tag ()
  1225. {
  1226. $opt_debug
  1227. if test -n "$available_tags" && test -z "$tagname"; then
  1228. CC_quoted=
  1229. for arg in $CC; do
  1230. func_quote_for_eval "$arg"
  1231. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  1232. done
  1233. case $@ in
  1234. # Blanks in the command may have been stripped by the calling shell,
  1235. # but not from the CC environment variable when configure was run.
  1236. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
  1237. # Blanks at the start of $base_compile will cause this to fail
  1238. # if we don't check for them as well.
  1239. *)
  1240. for z in $available_tags; do
  1241. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  1242. # Evaluate the configuration.
  1243. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  1244. CC_quoted=
  1245. for arg in $CC; do
  1246. # Double-quote args containing other shell metacharacters.
  1247. func_quote_for_eval "$arg"
  1248. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  1249. done
  1250. case "$@ " in
  1251. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
  1252. # The compiler in the base compile command matches
  1253. # the one in the tagged configuration.
  1254. # Assume this is the tagged configuration we want.
  1255. tagname=$z
  1256. break
  1257. ;;
  1258. esac
  1259. fi
  1260. done
  1261. # If $tagname still isn't set, then no tagged configuration
  1262. # was found and let the user know that the "--tag" command
  1263. # line option must be used.
  1264. if test -z "$tagname"; then
  1265. func_echo "unable to infer tagged configuration"
  1266. func_fatal_error "specify a tag with \`--tag'"
  1267. # else
  1268. # func_verbose "using $tagname tagged configuration"
  1269. fi
  1270. ;;
  1271. esac
  1272. fi
  1273. }
  1274. # func_write_libtool_object output_name pic_name nonpic_name
  1275. # Create a libtool object file (analogous to a ".la" file),
  1276. # but don't create it if we're doing a dry run.
  1277. func_write_libtool_object ()
  1278. {
  1279. write_libobj=${1}
  1280. if test "$build_libtool_libs" = yes; then
  1281. write_lobj=\'${2}\'
  1282. else
  1283. write_lobj=none
  1284. fi
  1285. if test "$build_old_libs" = yes; then
  1286. write_oldobj=\'${3}\'
  1287. else
  1288. write_oldobj=none
  1289. fi
  1290. $opt_dry_run || {
  1291. cat >${write_libobj}T <<EOF
  1292. # $write_libobj - a libtool object file
  1293. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  1294. #
  1295. # Please DO NOT delete this file!
  1296. # It is necessary for linking the library.
  1297. # Name of the PIC object.
  1298. pic_object=$write_lobj
  1299. # Name of the non-PIC object
  1300. non_pic_object=$write_oldobj
  1301. EOF
  1302. $MV "${write_libobj}T" "${write_libobj}"
  1303. }
  1304. }
  1305. # func_mode_compile arg...
  1306. func_mode_compile ()
  1307. {
  1308. $opt_debug
  1309. # Get the compilation command and the source file.
  1310. base_compile=
  1311. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  1312. suppress_opt=yes
  1313. suppress_output=
  1314. arg_mode=normal
  1315. libobj=
  1316. later=
  1317. pie_flag=
  1318. for arg
  1319. do
  1320. case $arg_mode in
  1321. arg )
  1322. # do not "continue". Instead, add this to base_compile
  1323. lastarg="$arg"
  1324. arg_mode=normal
  1325. ;;
  1326. target )
  1327. libobj="$arg"
  1328. arg_mode=normal
  1329. continue
  1330. ;;
  1331. normal )
  1332. # Accept any command-line options.
  1333. case $arg in
  1334. -o)
  1335. test -n "$libobj" && \
  1336. func_fatal_error "you cannot specify \`-o' more than once"
  1337. arg_mode=target
  1338. continue
  1339. ;;
  1340. -pie | -fpie | -fPIE)
  1341. pie_flag="$pie_flag $arg"
  1342. continue
  1343. ;;
  1344. -shared | -static | -prefer-pic | -prefer-non-pic)
  1345. later="$later $arg"
  1346. continue
  1347. ;;
  1348. -no-suppress)
  1349. suppress_opt=no
  1350. continue
  1351. ;;
  1352. -Xcompiler)
  1353. arg_mode=arg # the next one goes into the "base_compile" arg list
  1354. continue # The current "srcfile" will either be retained or
  1355. ;; # replaced later. I would guess that would be a bug.
  1356. -Wc,*)
  1357. func_stripname '-Wc,' '' "$arg"
  1358. args=$func_stripname_result
  1359. lastarg=
  1360. save_ifs="$IFS"; IFS=','
  1361. for arg in $args; do
  1362. IFS="$save_ifs"
  1363. func_quote_for_eval "$arg"
  1364. lastarg="$lastarg $func_quote_for_eval_result"
  1365. done
  1366. IFS="$save_ifs"
  1367. func_stripname ' ' '' "$lastarg"
  1368. lastarg=$func_stripname_result
  1369. # Add the arguments to base_compile.
  1370. base_compile="$base_compile $lastarg"
  1371. continue
  1372. ;;
  1373. *)
  1374. # Accept the current argument as the source file.
  1375. # The previous "srcfile" becomes the current argument.
  1376. #
  1377. lastarg="$srcfile"
  1378. srcfile="$arg"
  1379. ;;
  1380. esac # case $arg
  1381. ;;
  1382. esac # case $arg_mode
  1383. # Aesthetically quote the previous argument.
  1384. func_quote_for_eval "$lastarg"
  1385. base_compile="$base_compile $func_quote_for_eval_result"
  1386. done # for arg
  1387. case $arg_mode in
  1388. arg)
  1389. func_fatal_error "you must specify an argument for -Xcompile"
  1390. ;;
  1391. target)
  1392. func_fatal_error "you must specify a target with \`-o'"
  1393. ;;
  1394. *)
  1395. # Get the name of the library object.
  1396. test -z "$libobj" && {
  1397. func_basename "$srcfile"
  1398. libobj="$func_basename_result"
  1399. }
  1400. ;;
  1401. esac
  1402. # Recognize several different file suffixes.
  1403. # If the user specifies -o file.o, it is replaced with file.lo
  1404. case $libobj in
  1405. *.[cCFSifmso] | \
  1406. *.ada | *.adb | *.ads | *.asm | \
  1407. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  1408. *.[fF][09]? | *.for | *.java | *.obj | *.sx)
  1409. func_xform "$libobj"
  1410. libobj=$func_xform_result
  1411. ;;
  1412. esac
  1413. case $libobj in
  1414. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  1415. *)
  1416. func_fatal_error "cannot determine name of library object from \`$libobj'"
  1417. ;;
  1418. esac
  1419. func_infer_tag $base_compile
  1420. for arg in $later; do
  1421. case $arg in
  1422. -shared)
  1423. test "$build_libtool_libs" != yes && \
  1424. func_fatal_configuration "can not build a shared library"
  1425. build_old_libs=no
  1426. continue
  1427. ;;
  1428. -static)
  1429. build_libtool_libs=no
  1430. build_old_libs=yes
  1431. continue
  1432. ;;
  1433. -prefer-pic)
  1434. pic_mode=yes
  1435. continue
  1436. ;;
  1437. -prefer-non-pic)
  1438. pic_mode=no
  1439. continue
  1440. ;;
  1441. esac
  1442. done
  1443. func_quote_for_eval "$libobj"
  1444. test "X$libobj" != "X$func_quote_for_eval_result" \
  1445. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  1446. && func_warning "libobj name \`$libobj' may not contain shell special characters."
  1447. func_dirname_and_basename "$obj" "/" ""
  1448. objname="$func_basename_result"
  1449. xdir="$func_dirname_result"
  1450. lobj=${xdir}$objdir/$objname
  1451. test -z "$base_compile" && \
  1452. func_fatal_help "you must specify a compilation command"
  1453. # Delete any leftover library objects.
  1454. if test "$build_old_libs" = yes; then
  1455. removelist="$obj $lobj $libobj ${libobj}T"
  1456. else
  1457. removelist="$lobj $libobj ${libobj}T"
  1458. fi
  1459. # On Cygwin there's no "real" PIC flag so we must build both object types
  1460. case $host_os in
  1461. cygwin* | mingw* | pw32* | os2* | cegcc*)
  1462. pic_mode=default
  1463. ;;
  1464. esac
  1465. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  1466. # non-PIC code in shared libraries is not supported
  1467. pic_mode=default
  1468. fi
  1469. # Calculate the filename of the output object if compiler does
  1470. # not support -o with -c
  1471. if test "$compiler_c_o" = no; then
  1472. output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  1473. lockfile="$output_obj.lock"
  1474. else
  1475. output_obj=
  1476. need_locks=no
  1477. lockfile=
  1478. fi
  1479. # Lock this critical section if it is needed
  1480. # We use this script file to make the link, it avoids creating a new file
  1481. if test "$need_locks" = yes; then
  1482. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  1483. func_echo "Waiting for $lockfile to be removed"
  1484. sleep 2
  1485. done
  1486. elif test "$need_locks" = warn; then
  1487. if test -f "$lockfile"; then
  1488. $ECHO "\
  1489. *** ERROR, $lockfile exists and contains:
  1490. `cat $lockfile 2>/dev/null`
  1491. This indicates that another process is trying to use the same
  1492. temporary object file, and libtool could not work around it because
  1493. your compiler does not support \`-c' and \`-o' together. If you
  1494. repeat this compilation, it may succeed, by chance, but you had better
  1495. avoid parallel builds (make -j) in this platform, or get a better
  1496. compiler."
  1497. $opt_dry_run || $RM $removelist
  1498. exit $EXIT_FAILURE
  1499. fi
  1500. removelist="$removelist $output_obj"
  1501. $ECHO "$srcfile" > "$lockfile"
  1502. fi
  1503. $opt_dry_run || $RM $removelist
  1504. removelist="$removelist $lockfile"
  1505. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  1506. if test -n "$fix_srcfile_path"; then
  1507. eval srcfile=\"$fix_srcfile_path\"
  1508. fi
  1509. func_quote_for_eval "$srcfile"
  1510. qsrcfile=$func_quote_for_eval_result
  1511. # Only build a PIC object if we are building libtool libraries.
  1512. if test "$build_libtool_libs" = yes; then
  1513. # Without this assignment, base_compile gets emptied.
  1514. fbsd_hideous_sh_bug=$base_compile
  1515. if test "$pic_mode" != no; then
  1516. command="$base_compile $qsrcfile $pic_flag"
  1517. else
  1518. # Don't build PIC code
  1519. command="$base_compile $qsrcfile"
  1520. fi
  1521. func_mkdir_p "$xdir$objdir"
  1522. if test -z "$output_obj"; then
  1523. # Place PIC objects in $objdir
  1524. command="$command -o $lobj"
  1525. fi
  1526. func_show_eval_locale "$command" \
  1527. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  1528. if test "$need_locks" = warn &&
  1529. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1530. $ECHO "\
  1531. *** ERROR, $lockfile contains:
  1532. `cat $lockfile 2>/dev/null`
  1533. but it should contain:
  1534. $srcfile
  1535. This indicates that another process is trying to use the same
  1536. temporary object file, and libtool could not work around it because
  1537. your compiler does not support \`-c' and \`-o' together. If you
  1538. repeat this compilation, it may succeed, by chance, but you had better
  1539. avoid parallel builds (make -j) in this platform, or get a better
  1540. compiler."
  1541. $opt_dry_run || $RM $removelist
  1542. exit $EXIT_FAILURE
  1543. fi
  1544. # Just move the object if needed, then go on to compile the next one
  1545. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  1546. func_show_eval '$MV "$output_obj" "$lobj"' \
  1547. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1548. fi
  1549. # Allow error messages only from the first compilation.
  1550. if test "$suppress_opt" = yes; then
  1551. suppress_output=' >/dev/null 2>&1'
  1552. fi
  1553. fi
  1554. # Only build a position-dependent object if we build old libraries.
  1555. if test "$build_old_libs" = yes; then
  1556. if test "$pic_mode" != yes; then
  1557. # Don't build PIC code
  1558. command="$base_compile $qsrcfile$pie_flag"
  1559. else
  1560. command="$base_compile $qsrcfile $pic_flag"
  1561. fi
  1562. if test "$compiler_c_o" = yes; then
  1563. command="$command -o $obj"
  1564. fi
  1565. # Suppress compiler output if we already did a PIC compilation.
  1566. command="$command$suppress_output"
  1567. func_show_eval_locale "$command" \
  1568. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  1569. if test "$need_locks" = warn &&
  1570. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1571. $ECHO "\
  1572. *** ERROR, $lockfile contains:
  1573. `cat $lockfile 2>/dev/null`
  1574. but it should contain:
  1575. $srcfile
  1576. This indicates that another process is trying to use the same
  1577. temporary object file, and libtool could not work around it because
  1578. your compiler does not support \`-c' and \`-o' together. If you
  1579. repeat this compilation, it may succeed, by chance, but you had better
  1580. avoid parallel builds (make -j) in this platform, or get a better
  1581. compiler."
  1582. $opt_dry_run || $RM $removelist
  1583. exit $EXIT_FAILURE
  1584. fi
  1585. # Just move the object if needed
  1586. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  1587. func_show_eval '$MV "$output_obj" "$obj"' \
  1588. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1589. fi
  1590. fi
  1591. $opt_dry_run || {
  1592. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  1593. # Unlock the critical section if it was locked
  1594. if test "$need_locks" != no; then
  1595. removelist=$lockfile
  1596. $RM "$lockfile"
  1597. fi
  1598. }
  1599. exit $EXIT_SUCCESS
  1600. }
  1601. $opt_help || {
  1602. test "$mode" = compile && func_mode_compile ${1+"$@"}
  1603. }
  1604. func_mode_help ()
  1605. {
  1606. # We need to display help for each of the modes.
  1607. case $mode in
  1608. "")
  1609. # Generic help is extracted from the usage comments
  1610. # at the start of this file.
  1611. func_help
  1612. ;;
  1613. clean)
  1614. $ECHO \
  1615. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1616. Remove files from the build directory.
  1617. RM is the name of the program to use to delete files associated with each FILE
  1618. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1619. to RM.
  1620. If FILE is a libtool library, object or program, all the files associated
  1621. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1622. ;;
  1623. compile)
  1624. $ECHO \
  1625. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1626. Compile a source file into a libtool library object.
  1627. This mode accepts the following additional options:
  1628. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  1629. -no-suppress do not suppress compiler output for multiple passes
  1630. -prefer-pic try to building PIC objects only
  1631. -prefer-non-pic try to building non-PIC objects only
  1632. -shared do not build a \`.o' file suitable for static linking
  1633. -static only build a \`.o' file suitable for static linking
  1634. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1635. from the given SOURCEFILE.
  1636. The output file name is determined by removing the directory component from
  1637. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  1638. library object suffix, \`.lo'."
  1639. ;;
  1640. execute)
  1641. $ECHO \
  1642. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  1643. Automatically set library path, then run a program.
  1644. This mode accepts the following additional options:
  1645. -dlopen FILE add the directory containing FILE to the library path
  1646. This mode sets the library path environment variable according to \`-dlopen'
  1647. flags.
  1648. If any of the ARGS are libtool executable wrappers, then they are translated
  1649. into their corresponding uninstalled binary, and any of their required library
  1650. directories are added to the library path.
  1651. Then, COMMAND is executed, with ARGS as arguments."
  1652. ;;
  1653. finish)
  1654. $ECHO \
  1655. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  1656. Complete the installation of libtool libraries.
  1657. Each LIBDIR is a directory that contains libtool libraries.
  1658. The commands that this mode executes may require superuser privileges. Use
  1659. the \`--dry-run' option if you just want to see what would be executed."
  1660. ;;
  1661. install)
  1662. $ECHO \
  1663. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  1664. Install executables or libraries.
  1665. INSTALL-COMMAND is the installation command. The first component should be
  1666. either the \`install' or \`cp' program.
  1667. The following components of INSTALL-COMMAND are treated specially:
  1668. -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  1669. The rest of the components are interpreted as arguments to that command (only
  1670. BSD-compatible install options are recognized)."
  1671. ;;
  1672. link)
  1673. $ECHO \
  1674. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  1675. Link object files or libraries together to form another library, or to
  1676. create an executable program.
  1677. LINK-COMMAND is a command using the C compiler that you would use to create
  1678. a program from several object files.
  1679. The following components of LINK-COMMAND are treated specially:
  1680. -all-static do not do any dynamic linking at all
  1681. -avoid-version do not add a version suffix if possible
  1682. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  1683. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  1684. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  1685. -export-symbols SYMFILE
  1686. try to export only the symbols listed in SYMFILE
  1687. -export-symbols-regex REGEX
  1688. try to export only the symbols matching REGEX
  1689. -LLIBDIR search LIBDIR for required installed libraries
  1690. -lNAME OUTPUT-FILE requires the installed library libNAME
  1691. -module build a library that can dlopened
  1692. -no-fast-install disable the fast-install mode
  1693. -no-install link a not-installable executable
  1694. -no-undefined declare that a library does not refer to external symbols
  1695. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  1696. -objectlist FILE Use a list of object files found in FILE to specify objects
  1697. -precious-files-regex REGEX
  1698. don't remove output files matching REGEX
  1699. -release RELEASE specify package release information
  1700. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  1701. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  1702. -shared only do dynamic linking of libtool libraries
  1703. -shrext SUFFIX override the standard shared library file extension
  1704. -static do not do any dynamic linking of uninstalled libtool libraries
  1705. -static-libtool-libs
  1706. do not do any dynamic linking of libtool libraries
  1707. -version-info CURRENT[:REVISION[:AGE]]
  1708. specify library version info [each variable defaults to 0]
  1709. -weak LIBNAME declare that the target provides the LIBNAME interface
  1710. All other options (arguments beginning with \`-') are ignored.
  1711. Every other argument is treated as a filename. Files ending in \`.la' are
  1712. treated as uninstalled libtool libraries, other files are standard or library
  1713. object files.
  1714. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  1715. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  1716. required, except when creating a convenience library.
  1717. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  1718. using \`ar' and \`ranlib', or on Windows using \`lib'.
  1719. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  1720. is created, otherwise an executable program is created."
  1721. ;;
  1722. uninstall)
  1723. $ECHO \
  1724. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  1725. Remove libraries from an installation directory.
  1726. RM is the name of the program to use to delete files associated with each FILE
  1727. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1728. to RM.
  1729. If FILE is a libtool library, all the files associated with it are deleted.
  1730. Otherwise, only FILE itself is deleted using RM."
  1731. ;;
  1732. *)
  1733. func_fatal_help "invalid operation mode \`$mode'"
  1734. ;;
  1735. esac
  1736. $ECHO
  1737. $ECHO "Try \`$progname --help' for more information about other modes."
  1738. exit $?
  1739. }
  1740. # Now that we've collected a possible --mode arg, show help if necessary
  1741. $opt_help && func_mode_help
  1742. # func_mode_execute arg...
  1743. func_mode_execute ()
  1744. {
  1745. $opt_debug
  1746. # The first argument is the command name.
  1747. cmd="$nonopt"
  1748. test -z "$cmd" && \
  1749. func_fatal_help "you must specify a COMMAND"
  1750. # Handle -dlopen flags immediately.
  1751. for file in $execute_dlfiles; do
  1752. test -f "$file" \
  1753. || func_fatal_help "\`$file' is not a file"
  1754. dir=
  1755. case $file in
  1756. *.la)
  1757. # Check to see that this really is a libtool archive.
  1758. func_lalib_unsafe_p "$file" \
  1759. || func_fatal_help "\`$lib' is not a valid libtool archive"
  1760. # Read the libtool library.
  1761. dlname=
  1762. library_names=
  1763. func_source "$file"
  1764. # Skip this library if it cannot be dlopened.
  1765. if test -z "$dlname"; then
  1766. # Warn if it was a shared library.
  1767. test -n "$library_names" && \
  1768. func_warning "\`$file' was not linked with \`-export-dynamic'"
  1769. continue
  1770. fi
  1771. func_dirname "$file" "" "."
  1772. dir="$func_dirname_result"
  1773. if test -f "$dir/$objdir/$dlname"; then
  1774. dir="$dir/$objdir"
  1775. else
  1776. if test ! -f "$dir/$dlname"; then
  1777. func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
  1778. fi
  1779. fi
  1780. ;;
  1781. *.lo)
  1782. # Just add the directory containing the .lo file.
  1783. func_dirname "$file" "" "."
  1784. dir="$func_dirname_result"
  1785. ;;
  1786. *)
  1787. func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
  1788. continue
  1789. ;;
  1790. esac
  1791. # Get the absolute pathname.
  1792. absdir=`cd "$dir" && pwd`
  1793. test -n "$absdir" && dir="$absdir"
  1794. # Now add the directory to shlibpath_var.
  1795. if eval "test -z \"\$$shlibpath_var\""; then
  1796. eval "$shlibpath_var=\"\$dir\""
  1797. else
  1798. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  1799. fi
  1800. done
  1801. # This variable tells wrapper scripts just to set shlibpath_var
  1802. # rather than running their programs.
  1803. libtool_execute_magic="$magic"
  1804. # Check if any of the arguments is a wrapper script.
  1805. args=
  1806. for file
  1807. do
  1808. case $file in
  1809. -*) ;;
  1810. *)
  1811. # Do a test to see if this is really a libtool program.
  1812. if func_ltwrapper_script_p "$file"; then
  1813. func_source "$file"
  1814. # Transform arg to wrapped name.
  1815. file="$progdir/$program"
  1816. elif func_ltwrapper_executable_p "$file"; then
  1817. func_ltwrapper_scriptname "$file"
  1818. func_source "$func_ltwrapper_scriptname_result"
  1819. # Transform arg to wrapped name.
  1820. file="$progdir/$program"
  1821. fi
  1822. ;;
  1823. esac
  1824. # Quote arguments (to preserve shell metacharacters).
  1825. func_quote_for_eval "$file"
  1826. args="$args $func_quote_for_eval_result"
  1827. done
  1828. if test "X$opt_dry_run" = Xfalse; then
  1829. if test -n "$shlibpath_var"; then
  1830. # Export the shlibpath_var.
  1831. eval "export $shlibpath_var"
  1832. fi
  1833. # Restore saved environment variables
  1834. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  1835. do
  1836. eval "if test \"\${save_$lt_var+set}\" = set; then
  1837. $lt_var=\$save_$lt_var; export $lt_var
  1838. else
  1839. $lt_unset $lt_var
  1840. fi"
  1841. done
  1842. # Now prepare to actually exec the command.
  1843. exec_cmd="\$cmd$args"
  1844. else
  1845. # Display what would be done.
  1846. if test -n "$shlibpath_var"; then
  1847. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  1848. $ECHO "export $shlibpath_var"
  1849. fi
  1850. $ECHO "$cmd$args"
  1851. exit $EXIT_SUCCESS
  1852. fi
  1853. }
  1854. test "$mode" = execute && func_mode_execute ${1+"$@"}
  1855. # func_mode_finish arg...
  1856. func_mode_finish ()
  1857. {
  1858. $opt_debug
  1859. libdirs="$nonopt"
  1860. admincmds=
  1861. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  1862. for dir
  1863. do
  1864. libdirs="$libdirs $dir"
  1865. done
  1866. for libdir in $libdirs; do
  1867. if test -n "$finish_cmds"; then
  1868. # Do each command in the finish commands.
  1869. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  1870. '"$cmd"'"'
  1871. fi
  1872. if test -n "$finish_eval"; then
  1873. # Do the single finish_eval.
  1874. eval cmds=\"$finish_eval\"
  1875. $opt_dry_run || eval "$cmds" || admincmds="$admincmds
  1876. $cmds"
  1877. fi
  1878. done
  1879. fi
  1880. # Exit here if they wanted silent mode.
  1881. $opt_silent && exit $EXIT_SUCCESS
  1882. $ECHO "X----------------------------------------------------------------------" | $Xsed
  1883. $ECHO "Libraries have been installed in:"
  1884. for libdir in $libdirs; do
  1885. $ECHO " $libdir"
  1886. done
  1887. $ECHO
  1888. $ECHO "If you ever happen to want to link against installed libraries"
  1889. $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
  1890. $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
  1891. $ECHO "flag during linking and do at least one of the following:"
  1892. if test -n "$shlibpath_var"; then
  1893. $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
  1894. $ECHO " during execution"
  1895. fi
  1896. if test -n "$runpath_var"; then
  1897. $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
  1898. $ECHO " during linking"
  1899. fi
  1900. if test -n "$hardcode_libdir_flag_spec"; then
  1901. libdir=LIBDIR
  1902. eval flag=\"$hardcode_libdir_flag_spec\"
  1903. $ECHO " - use the \`$flag' linker flag"
  1904. fi
  1905. if test -n "$admincmds"; then
  1906. $ECHO " - have your system administrator run these commands:$admincmds"
  1907. fi
  1908. if test -f /etc/ld.so.conf; then
  1909. $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1910. fi
  1911. $ECHO
  1912. $ECHO "See any operating system documentation about shared libraries for"
  1913. case $host in
  1914. solaris2.[6789]|solaris2.1[0-9])
  1915. $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  1916. $ECHO "pages."
  1917. ;;
  1918. *)
  1919. $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
  1920. ;;
  1921. esac
  1922. $ECHO "X----------------------------------------------------------------------" | $Xsed
  1923. exit $EXIT_SUCCESS
  1924. }
  1925. test "$mode" = finish && func_mode_finish ${1+"$@"}
  1926. # func_mode_install arg...
  1927. func_mode_install ()
  1928. {
  1929. $opt_debug
  1930. # There may be an optional sh(1) argument at the beginning of
  1931. # install_prog (especially on Windows NT).
  1932. if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  1933. # Allow the use of GNU shtool's install command.
  1934. $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
  1935. # Aesthetically quote it.
  1936. func_quote_for_eval "$nonopt"
  1937. install_prog="$func_quote_for_eval_result "
  1938. arg=$1
  1939. shift
  1940. else
  1941. install_prog=
  1942. arg=$nonopt
  1943. fi
  1944. # The real first argument should be the name of the installation program.
  1945. # Aesthetically quote it.
  1946. func_quote_for_eval "$arg"
  1947. install_prog="$install_prog$func_quote_for_eval_result"
  1948. # We need to accept at least all the BSD install flags.
  1949. dest=
  1950. files=
  1951. opts=
  1952. prev=
  1953. install_type=
  1954. isdir=no
  1955. stripme=
  1956. for arg
  1957. do
  1958. if test -n "$dest"; then
  1959. files="$files $dest"
  1960. dest=$arg
  1961. continue
  1962. fi
  1963. case $arg in
  1964. -d) isdir=yes ;;
  1965. -f)
  1966. case " $install_prog " in
  1967. *[\\\ /]cp\ *) ;;
  1968. *) prev=$arg ;;
  1969. esac
  1970. ;;
  1971. -g | -m | -o)
  1972. prev=$arg
  1973. ;;
  1974. -s)
  1975. stripme=" -s"
  1976. continue
  1977. ;;
  1978. -*)
  1979. ;;
  1980. *)
  1981. # If the previous option needed an argument, then skip it.
  1982. if test -n "$prev"; then
  1983. prev=
  1984. else
  1985. dest=$arg
  1986. continue
  1987. fi
  1988. ;;
  1989. esac
  1990. # Aesthetically quote the argument.
  1991. func_quote_for_eval "$arg"
  1992. install_prog="$install_prog $func_quote_for_eval_result"
  1993. done
  1994. test -z "$install_prog" && \
  1995. func_fatal_help "you must specify an install program"
  1996. test -n "$prev" && \
  1997. func_fatal_help "the \`$prev' option requires an argument"
  1998. if test -z "$files"; then
  1999. if test -z "$dest"; then
  2000. func_fatal_help "no file or destination specified"
  2001. else
  2002. func_fatal_help "you must specify a destination"
  2003. fi
  2004. fi
  2005. # Strip any trailing slash from the destination.
  2006. func_stripname '' '/' "$dest"
  2007. dest=$func_stripname_result
  2008. # Check to see that the destination is a directory.
  2009. test -d "$dest" && isdir=yes
  2010. if test "$isdir" = yes; then
  2011. destdir="$dest"
  2012. destname=
  2013. else
  2014. func_dirname_and_basename "$dest" "" "."
  2015. destdir="$func_dirname_result"
  2016. destname="$func_basename_result"
  2017. # Not a directory, so check to see that there is only one file specified.
  2018. set dummy $files; shift
  2019. test "$#" -gt 1 && \
  2020. func_fatal_help "\`$dest' is not a directory"
  2021. fi
  2022. case $destdir in
  2023. [\\/]* | [A-Za-z]:[\\/]*) ;;
  2024. *)
  2025. for file in $files; do
  2026. case $file in
  2027. *.lo) ;;
  2028. *)
  2029. func_fatal_help "\`$destdir' must be an absolute directory name"
  2030. ;;
  2031. esac
  2032. done
  2033. ;;
  2034. esac
  2035. # This variable tells wrapper scripts just to set variables rather
  2036. # than running their programs.
  2037. libtool_install_magic="$magic"
  2038. staticlibs=
  2039. future_libdirs=
  2040. current_libdirs=
  2041. for file in $files; do
  2042. # Do each installation.
  2043. case $file in
  2044. *.$libext)
  2045. # Do the static libraries later.
  2046. staticlibs="$staticlibs $file"
  2047. ;;
  2048. *.la)
  2049. # Check to see that this really is a libtool archive.
  2050. func_lalib_unsafe_p "$file" \
  2051. || func_fatal_help "\`$file' is not a valid libtool archive"
  2052. library_names=
  2053. old_library=
  2054. relink_command=
  2055. func_source "$file"
  2056. # Add the libdir to current_libdirs if it is the destination.
  2057. if test "X$destdir" = "X$libdir"; then
  2058. case "$current_libdirs " in
  2059. *" $libdir "*) ;;
  2060. *) current_libdirs="$current_libdirs $libdir" ;;
  2061. esac
  2062. else
  2063. # Note the libdir as a future libdir.
  2064. case "$future_libdirs " in
  2065. *" $libdir "*) ;;
  2066. *) future_libdirs="$future_libdirs $libdir" ;;
  2067. esac
  2068. fi
  2069. func_dirname "$file" "/" ""
  2070. dir="$func_dirname_result"
  2071. dir="$dir$objdir"
  2072. if test -n "$relink_command"; then
  2073. # Determine the prefix the user has applied to our future dir.
  2074. inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
  2075. # Don't allow the user to place us outside of our expected
  2076. # location b/c this prevents finding dependent libraries that
  2077. # are installed to the same prefix.
  2078. # At present, this check doesn't affect windows .dll's that
  2079. # are installed into $libdir/../bin (currently, that works fine)
  2080. # but it's something to keep an eye on.
  2081. test "$inst_prefix_dir" = "$destdir" && \
  2082. func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
  2083. if test -n "$inst_prefix_dir"; then
  2084. # Stick the inst_prefix_dir data into the link command.
  2085. relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  2086. else
  2087. relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
  2088. fi
  2089. func_warning "relinking \`$file'"
  2090. func_show_eval "$relink_command" \
  2091. 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
  2092. fi
  2093. # See the names of the shared library.
  2094. set dummy $library_names; shift
  2095. if test -n "$1"; then
  2096. realname="$1"
  2097. shift
  2098. srcname="$realname"
  2099. test -n "$relink_command" && srcname="$realname"T
  2100. # Install the shared library and build the symlinks.
  2101. func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
  2102. 'exit $?'
  2103. tstripme="$stripme"
  2104. case $host_os in
  2105. cygwin* | mingw* | pw32* | cegcc*)
  2106. case $realname in
  2107. *.dll.a)
  2108. tstripme=""
  2109. ;;
  2110. esac
  2111. ;;
  2112. esac
  2113. if test -n "$tstripme" && test -n "$striplib"; then
  2114. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  2115. fi
  2116. if test "$#" -gt 0; then
  2117. # Delete the old symlinks, and create new ones.
  2118. # Try `ln -sf' first, because the `ln' binary might depend on
  2119. # the symlink we replace! Solaris /bin/ln does not understand -f,
  2120. # so we also need to try rm && ln -s.
  2121. for linkname
  2122. do
  2123. test "$linkname" != "$realname" \
  2124. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  2125. done
  2126. fi
  2127. # Do each command in the postinstall commands.
  2128. lib="$destdir/$realname"
  2129. func_execute_cmds "$postinstall_cmds" 'exit $?'
  2130. fi
  2131. # Install the pseudo-library for information purposes.
  2132. func_basename "$file"
  2133. name="$func_basename_result"
  2134. instname="$dir/$name"i
  2135. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  2136. # Maybe install the static library, too.
  2137. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  2138. ;;
  2139. *.lo)
  2140. # Install (i.e. copy) a libtool object.
  2141. # Figure out destination file name, if it wasn't already specified.
  2142. if test -n "$destname"; then
  2143. destfile="$destdir/$destname"
  2144. else
  2145. func_basename "$file"
  2146. destfile="$func_basename_result"
  2147. destfile="$destdir/$destfile"
  2148. fi
  2149. # Deduce the name of the destination old-style object file.
  2150. case $destfile in
  2151. *.lo)
  2152. func_lo2o "$destfile"
  2153. staticdest=$func_lo2o_result
  2154. ;;
  2155. *.$objext)
  2156. staticdest="$destfile"
  2157. destfile=
  2158. ;;
  2159. *)
  2160. func_fatal_help "cannot copy a libtool object to \`$destfile'"
  2161. ;;
  2162. esac
  2163. # Install the libtool object if requested.
  2164. test -n "$destfile" && \
  2165. func_show_eval "$install_prog $file $destfile" 'exit $?'
  2166. # Install the old object if enabled.
  2167. if test "$build_old_libs" = yes; then
  2168. # Deduce the name of the old-style object file.
  2169. func_lo2o "$file"
  2170. staticobj=$func_lo2o_result
  2171. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  2172. fi
  2173. exit $EXIT_SUCCESS
  2174. ;;
  2175. *)
  2176. # Figure out destination file name, if it wasn't already specified.
  2177. if test -n "$destname"; then
  2178. destfile="$destdir/$destname"
  2179. else
  2180. func_basename "$file"
  2181. destfile="$func_basename_result"
  2182. destfile="$destdir/$destfile"
  2183. fi
  2184. # If the file is missing, and there is a .exe on the end, strip it
  2185. # because it is most likely a libtool script we actually want to
  2186. # install
  2187. stripped_ext=""
  2188. case $file in
  2189. *.exe)
  2190. if test ! -f "$file"; then
  2191. func_stripname '' '.exe' "$file"
  2192. file=$func_stripname_result
  2193. stripped_ext=".exe"
  2194. fi
  2195. ;;
  2196. esac
  2197. # Do a test to see if this is really a libtool program.
  2198. case $host in
  2199. *cygwin* | *mingw*)
  2200. if func_ltwrapper_executable_p "$file"; then
  2201. func_ltwrapper_scriptname "$file"
  2202. wrapper=$func_ltwrapper_scriptname_result
  2203. else
  2204. func_stripname '' '.exe' "$file"
  2205. wrapper=$func_stripname_result
  2206. fi
  2207. ;;
  2208. *)
  2209. wrapper=$file
  2210. ;;
  2211. esac
  2212. if func_ltwrapper_script_p "$wrapper"; then
  2213. notinst_deplibs=
  2214. relink_command=
  2215. func_source "$wrapper"
  2216. # Check the variables that should have been set.
  2217. test -z "$generated_by_libtool_version" && \
  2218. func_fatal_error "invalid libtool wrapper script \`$wrapper'"
  2219. finalize=yes
  2220. for lib in $notinst_deplibs; do
  2221. # Check to see that each library is installed.
  2222. libdir=
  2223. if test -f "$lib"; then
  2224. func_source "$lib"
  2225. fi
  2226. libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  2227. if test -n "$libdir" && test ! -f "$libfile"; then
  2228. func_warning "\`$lib' has not been installed in \`$libdir'"
  2229. finalize=no
  2230. fi
  2231. done
  2232. relink_command=
  2233. func_source "$wrapper"
  2234. outputname=
  2235. if test "$fast_install" = no && test -n "$relink_command"; then
  2236. $opt_dry_run || {
  2237. if test "$finalize" = yes; then
  2238. tmpdir=`func_mktempdir`
  2239. func_basename "$file$stripped_ext"
  2240. file="$func_basename_result"
  2241. outputname="$tmpdir/$file"
  2242. # Replace the output file specification.
  2243. relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  2244. $opt_silent || {
  2245. func_quote_for_expand "$relink_command"
  2246. eval "func_echo $func_quote_for_expand_result"
  2247. }
  2248. if eval "$relink_command"; then :
  2249. else
  2250. func_error "error: relink \`$file' with the above command before installing it"
  2251. $opt_dry_run || ${RM}r "$tmpdir"
  2252. continue
  2253. fi
  2254. file="$outputname"
  2255. else
  2256. func_warning "cannot relink \`$file'"
  2257. fi
  2258. }
  2259. else
  2260. # Install the binary that we compiled earlier.
  2261. file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  2262. fi
  2263. fi
  2264. # remove .exe since cygwin /usr/bin/install will append another
  2265. # one anyway
  2266. case $install_prog,$host in
  2267. */usr/bin/install*,*cygwin*)
  2268. case $file:$destfile in
  2269. *.exe:*.exe)
  2270. # this is ok
  2271. ;;
  2272. *.exe:*)
  2273. destfile=$destfile.exe
  2274. ;;
  2275. *:*.exe)
  2276. func_stripname '' '.exe' "$destfile"
  2277. destfile=$func_stripname_result
  2278. ;;
  2279. esac
  2280. ;;
  2281. esac
  2282. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  2283. $opt_dry_run || if test -n "$outputname"; then
  2284. ${RM}r "$tmpdir"
  2285. fi
  2286. ;;
  2287. esac
  2288. done
  2289. for file in $staticlibs; do
  2290. func_basename "$file"
  2291. name="$func_basename_result"
  2292. # Set up the ranlib parameters.
  2293. oldlib="$destdir/$name"
  2294. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  2295. if test -n "$stripme" && test -n "$old_striplib"; then
  2296. func_show_eval "$old_striplib $oldlib" 'exit $?'
  2297. fi
  2298. # Do each command in the postinstall commands.
  2299. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  2300. done
  2301. test -n "$future_libdirs" && \
  2302. func_warning "remember to run \`$progname --finish$future_libdirs'"
  2303. if test -n "$current_libdirs"; then
  2304. # Maybe just do a dry run.
  2305. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  2306. exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  2307. else
  2308. exit $EXIT_SUCCESS
  2309. fi
  2310. }
  2311. test "$mode" = install && func_mode_install ${1+"$@"}
  2312. # func_generate_dlsyms outputname originator pic_p
  2313. # Extract symbols from dlprefiles and create ${outputname}S.o with
  2314. # a dlpreopen symbol table.
  2315. func_generate_dlsyms ()
  2316. {
  2317. $opt_debug
  2318. my_outputname="$1"
  2319. my_originator="$2"
  2320. my_pic_p="${3-no}"
  2321. my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
  2322. my_dlsyms=
  2323. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2324. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2325. my_dlsyms="${my_outputname}S.c"
  2326. else
  2327. func_error "not configured to extract global symbols from dlpreopened files"
  2328. fi
  2329. fi
  2330. if test -n "$my_dlsyms"; then
  2331. case $my_dlsyms in
  2332. "") ;;
  2333. *.c)
  2334. # Discover the nlist of each of the dlfiles.
  2335. nlist="$output_objdir/${my_outputname}.nm"
  2336. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  2337. # Parse the name list into a source file.
  2338. func_verbose "creating $output_objdir/$my_dlsyms"
  2339. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  2340. /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
  2341. /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
  2342. #ifdef __cplusplus
  2343. extern \"C\" {
  2344. #endif
  2345. /* External symbol declarations for the compiler. */\
  2346. "
  2347. if test "$dlself" = yes; then
  2348. func_verbose "generating symbol list for \`$output'"
  2349. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  2350. # Add our own program objects to the symbol list.
  2351. progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2352. for progfile in $progfiles; do
  2353. func_verbose "extracting global C symbols from \`$progfile'"
  2354. $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
  2355. done
  2356. if test -n "$exclude_expsyms"; then
  2357. $opt_dry_run || {
  2358. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2359. eval '$MV "$nlist"T "$nlist"'
  2360. }
  2361. fi
  2362. if test -n "$export_symbols_regex"; then
  2363. $opt_dry_run || {
  2364. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2365. eval '$MV "$nlist"T "$nlist"'
  2366. }
  2367. fi
  2368. # Prepare the list of exported symbols
  2369. if test -z "$export_symbols"; then
  2370. export_symbols="$output_objdir/$outputname.exp"
  2371. $opt_dry_run || {
  2372. $RM $export_symbols
  2373. eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2374. case $host in
  2375. *cygwin* | *mingw* | *cegcc* )
  2376. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  2377. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  2378. ;;
  2379. esac
  2380. }
  2381. else
  2382. $opt_dry_run || {
  2383. eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  2384. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  2385. eval '$MV "$nlist"T "$nlist"'
  2386. case $host in
  2387. *cygwin | *mingw* | *cegcc* )
  2388. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  2389. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  2390. ;;
  2391. esac
  2392. }
  2393. fi
  2394. fi
  2395. for dlprefile in $dlprefiles; do
  2396. func_verbose "extracting global C symbols from \`$dlprefile'"
  2397. func_basename "$dlprefile"
  2398. name="$func_basename_result"
  2399. $opt_dry_run || {
  2400. eval '$ECHO ": $name " >> "$nlist"'
  2401. eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  2402. }
  2403. done
  2404. $opt_dry_run || {
  2405. # Make sure we have at least an empty file.
  2406. test -f "$nlist" || : > "$nlist"
  2407. if test -n "$exclude_expsyms"; then
  2408. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2409. $MV "$nlist"T "$nlist"
  2410. fi
  2411. # Try sorting and uniquifying the output.
  2412. if $GREP -v "^: " < "$nlist" |
  2413. if sort -k 3 </dev/null >/dev/null 2>&1; then
  2414. sort -k 3
  2415. else
  2416. sort +2
  2417. fi |
  2418. uniq > "$nlist"S; then
  2419. :
  2420. else
  2421. $GREP -v "^: " < "$nlist" > "$nlist"S
  2422. fi
  2423. if test -f "$nlist"S; then
  2424. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  2425. else
  2426. $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
  2427. fi
  2428. $ECHO >> "$output_objdir/$my_dlsyms" "\
  2429. /* The mapping between symbol names and symbols. */
  2430. typedef struct {
  2431. const char *name;
  2432. void *address;
  2433. } lt_dlsymlist;
  2434. "
  2435. case $host in
  2436. *cygwin* | *mingw* | *cegcc* )
  2437. $ECHO >> "$output_objdir/$my_dlsyms" "\
  2438. /* DATA imports from DLLs on WIN32 con't be const, because
  2439. runtime relocations are performed -- see ld's documentation
  2440. on pseudo-relocs. */"
  2441. lt_dlsym_const= ;;
  2442. *osf5*)
  2443. echo >> "$output_objdir/$my_dlsyms" "\
  2444. /* This system does not cope well with relocations in const data */"
  2445. lt_dlsym_const= ;;
  2446. *)
  2447. lt_dlsym_const=const ;;
  2448. esac
  2449. $ECHO >> "$output_objdir/$my_dlsyms" "\
  2450. extern $lt_dlsym_const lt_dlsymlist
  2451. lt_${my_prefix}_LTX_preloaded_symbols[];
  2452. $lt_dlsym_const lt_dlsymlist
  2453. lt_${my_prefix}_LTX_preloaded_symbols[] =
  2454. {\
  2455. { \"$my_originator\", (void *) 0 },"
  2456. case $need_lib_prefix in
  2457. no)
  2458. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  2459. ;;
  2460. *)
  2461. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  2462. ;;
  2463. esac
  2464. $ECHO >> "$output_objdir/$my_dlsyms" "\
  2465. {0, (void *) 0}
  2466. };
  2467. /* This works around a problem in FreeBSD linker */
  2468. #ifdef FREEBSD_WORKAROUND
  2469. static const void *lt_preloaded_setup() {
  2470. return lt_${my_prefix}_LTX_preloaded_symbols;
  2471. }
  2472. #endif
  2473. #ifdef __cplusplus
  2474. }
  2475. #endif\
  2476. "
  2477. } # !$opt_dry_run
  2478. pic_flag_for_symtable=
  2479. case "$compile_command " in
  2480. *" -static "*) ;;
  2481. *)
  2482. case $host in
  2483. # compiling the symbol table file with pic_flag works around
  2484. # a FreeBSD bug that causes programs to crash when -lm is
  2485. # linked before any other PIC object. But we must not use
  2486. # pic_flag when linking with -static. The problem exists in
  2487. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2488. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  2489. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  2490. *-*-hpux*)
  2491. pic_flag_for_symtable=" $pic_flag" ;;
  2492. *)
  2493. if test "X$my_pic_p" != Xno; then
  2494. pic_flag_for_symtable=" $pic_flag"
  2495. fi
  2496. ;;
  2497. esac
  2498. ;;
  2499. esac
  2500. symtab_cflags=
  2501. for arg in $LTCFLAGS; do
  2502. case $arg in
  2503. -pie | -fpie | -fPIE) ;;
  2504. *) symtab_cflags="$symtab_cflags $arg" ;;
  2505. esac
  2506. done
  2507. # Now compile the dynamic symbol file.
  2508. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  2509. # Clean up the generated files.
  2510. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
  2511. # Transform the symbol file into the correct name.
  2512. symfileobj="$output_objdir/${my_outputname}S.$objext"
  2513. case $host in
  2514. *cygwin* | *mingw* | *cegcc* )
  2515. if test -f "$output_objdir/$my_outputname.def"; then
  2516. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  2517. finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  2518. else
  2519. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  2520. finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  2521. fi
  2522. ;;
  2523. *)
  2524. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  2525. finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  2526. ;;
  2527. esac
  2528. ;;
  2529. *)
  2530. func_fatal_error "unknown suffix for \`$my_dlsyms'"
  2531. ;;
  2532. esac
  2533. else
  2534. # We keep going just in case the user didn't refer to
  2535. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  2536. # really was required.
  2537. # Nullify the symbol file.
  2538. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2539. finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2540. fi
  2541. }
  2542. # func_win32_libid arg
  2543. # return the library type of file 'arg'
  2544. #
  2545. # Need a lot of goo to handle *both* DLLs and import libs
  2546. # Has to be a shell function in order to 'eat' the argument
  2547. # that is supplied when $file_magic_command is called.
  2548. func_win32_libid ()
  2549. {
  2550. $opt_debug
  2551. win32_libid_type="unknown"
  2552. win32_fileres=`file -L $1 2>/dev/null`
  2553. case $win32_fileres in
  2554. *ar\ archive\ import\ library*) # definitely import
  2555. win32_libid_type="x86 archive import"
  2556. ;;
  2557. *ar\ archive*) # could be an import, or static
  2558. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  2559. $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
  2560. win32_nmres=`eval $NM -f posix -A $1 |
  2561. $SED -n -e '
  2562. 1,100{
  2563. / I /{
  2564. s,.*,import,
  2565. p
  2566. q
  2567. }
  2568. }'`
  2569. case $win32_nmres in
  2570. import*) win32_libid_type="x86 archive import";;
  2571. *) win32_libid_type="x86 archive static";;
  2572. esac
  2573. fi
  2574. ;;
  2575. *DLL*)
  2576. win32_libid_type="x86 DLL"
  2577. ;;
  2578. *executable*) # but shell scripts are "executable" too...
  2579. case $win32_fileres in
  2580. *MS\ Windows\ PE\ Intel*)
  2581. win32_libid_type="x86 DLL"
  2582. ;;
  2583. esac
  2584. ;;
  2585. esac
  2586. $ECHO "$win32_libid_type"
  2587. }
  2588. # func_extract_an_archive dir oldlib
  2589. func_extract_an_archive ()
  2590. {
  2591. $opt_debug
  2592. f_ex_an_ar_dir="$1"; shift
  2593. f_ex_an_ar_oldlib="$1"
  2594. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
  2595. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  2596. :
  2597. else
  2598. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  2599. fi
  2600. }
  2601. # func_extract_archives gentop oldlib ...
  2602. func_extract_archives ()
  2603. {
  2604. $opt_debug
  2605. my_gentop="$1"; shift
  2606. my_oldlibs=${1+"$@"}
  2607. my_oldobjs=""
  2608. my_xlib=""
  2609. my_xabs=""
  2610. my_xdir=""
  2611. for my_xlib in $my_oldlibs; do
  2612. # Extract the objects.
  2613. case $my_xlib in
  2614. [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
  2615. *) my_xabs=`pwd`"/$my_xlib" ;;
  2616. esac
  2617. func_basename "$my_xlib"
  2618. my_xlib="$func_basename_result"
  2619. my_xlib_u=$my_xlib
  2620. while :; do
  2621. case " $extracted_archives " in
  2622. *" $my_xlib_u "*)
  2623. func_arith $extracted_serial + 1
  2624. extracted_serial=$func_arith_result
  2625. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  2626. *) break ;;
  2627. esac
  2628. done
  2629. extracted_archives="$extracted_archives $my_xlib_u"
  2630. my_xdir="$my_gentop/$my_xlib_u"
  2631. func_mkdir_p "$my_xdir"
  2632. case $host in
  2633. *-darwin*)
  2634. func_verbose "Extracting $my_xabs"
  2635. # Do not bother doing anything if just a dry run
  2636. $opt_dry_run || {
  2637. darwin_orig_dir=`pwd`
  2638. cd $my_xdir || exit $?
  2639. darwin_archive=$my_xabs
  2640. darwin_curdir=`pwd`
  2641. darwin_base_archive=`basename "$darwin_archive"`
  2642. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  2643. if test -n "$darwin_arches"; then
  2644. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  2645. darwin_arch=
  2646. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  2647. for darwin_arch in $darwin_arches ; do
  2648. func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  2649. $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  2650. cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  2651. func_extract_an_archive "`pwd`" "${darwin_base_archive}"
  2652. cd "$darwin_curdir"
  2653. $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
  2654. done # $darwin_arches
  2655. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  2656. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
  2657. darwin_file=
  2658. darwin_files=
  2659. for darwin_file in $darwin_filelist; do
  2660. darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
  2661. $LIPO -create -output "$darwin_file" $darwin_files
  2662. done # $darwin_filelist
  2663. $RM -rf unfat-$$
  2664. cd "$darwin_orig_dir"
  2665. else
  2666. cd $darwin_orig_dir
  2667. func_extract_an_archive "$my_xdir" "$my_xabs"
  2668. fi # $darwin_arches
  2669. } # !$opt_dry_run
  2670. ;;
  2671. *)
  2672. func_extract_an_archive "$my_xdir" "$my_xabs"
  2673. ;;
  2674. esac
  2675. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  2676. done
  2677. func_extract_archives_result="$my_oldobjs"
  2678. }
  2679. # func_emit_wrapper_part1 [arg=no]
  2680. #
  2681. # Emit the first part of a libtool wrapper script on stdout.
  2682. # For more information, see the description associated with
  2683. # func_emit_wrapper(), below.
  2684. func_emit_wrapper_part1 ()
  2685. {
  2686. func_emit_wrapper_part1_arg1=no
  2687. if test -n "$1" ; then
  2688. func_emit_wrapper_part1_arg1=$1
  2689. fi
  2690. $ECHO "\
  2691. #! $SHELL
  2692. # $output - temporary wrapper script for $objdir/$outputname
  2693. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  2694. #
  2695. # The $output program cannot be directly executed until all the libtool
  2696. # libraries that it depends on are installed.
  2697. #
  2698. # This wrapper script should never be moved out of the build directory.
  2699. # If it is, it will not operate correctly.
  2700. # Sed substitution that helps us do robust quoting. It backslashifies
  2701. # metacharacters that are still active within double-quoted strings.
  2702. Xsed='${SED} -e 1s/^X//'
  2703. sed_quote_subst='$sed_quote_subst'
  2704. # Be Bourne compatible
  2705. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  2706. emulate sh
  2707. NULLCMD=:
  2708. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  2709. # is contrary to our usage. Disable this feature.
  2710. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  2711. setopt NO_GLOB_SUBST
  2712. else
  2713. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  2714. fi
  2715. BIN_SH=xpg4; export BIN_SH # for Tru64
  2716. DUALCASE=1; export DUALCASE # for MKS sh
  2717. # The HP-UX ksh and POSIX shell print the target directory to stdout
  2718. # if CDPATH is set.
  2719. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  2720. relink_command=\"$relink_command\"
  2721. # This environment variable determines our operation mode.
  2722. if test \"\$libtool_install_magic\" = \"$magic\"; then
  2723. # install mode needs the following variables:
  2724. generated_by_libtool_version='$macro_version'
  2725. notinst_deplibs='$notinst_deplibs'
  2726. else
  2727. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  2728. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2729. ECHO=\"$qecho\"
  2730. file=\"\$0\"
  2731. # Make sure echo works.
  2732. if test \"X\$1\" = X--no-reexec; then
  2733. # Discard the --no-reexec flag, and continue.
  2734. shift
  2735. elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
  2736. # Yippee, \$ECHO works!
  2737. :
  2738. else
  2739. # Restart under the correct shell, and then maybe \$ECHO will work.
  2740. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2741. fi
  2742. fi\
  2743. "
  2744. $ECHO "\
  2745. # Find the directory that this script lives in.
  2746. thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2747. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2748. # Follow symbolic links until we get to the real thisdir.
  2749. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  2750. while test -n \"\$file\"; do
  2751. destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2752. # If there was a directory component, then change thisdir.
  2753. if test \"x\$destdir\" != \"x\$file\"; then
  2754. case \"\$destdir\" in
  2755. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  2756. *) thisdir=\"\$thisdir/\$destdir\" ;;
  2757. esac
  2758. fi
  2759. file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2760. file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  2761. done
  2762. "
  2763. }
  2764. # end: func_emit_wrapper_part1
  2765. # func_emit_wrapper_part2 [arg=no]
  2766. #
  2767. # Emit the second part of a libtool wrapper script on stdout.
  2768. # For more information, see the description associated with
  2769. # func_emit_wrapper(), below.
  2770. func_emit_wrapper_part2 ()
  2771. {
  2772. func_emit_wrapper_part2_arg1=no
  2773. if test -n "$1" ; then
  2774. func_emit_wrapper_part2_arg1=$1
  2775. fi
  2776. $ECHO "\
  2777. # Usually 'no', except on cygwin/mingw when embedded into
  2778. # the cwrapper.
  2779. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
  2780. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  2781. # special case for '.'
  2782. if test \"\$thisdir\" = \".\"; then
  2783. thisdir=\`pwd\`
  2784. fi
  2785. # remove .libs from thisdir
  2786. case \"\$thisdir\" in
  2787. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
  2788. $objdir ) thisdir=. ;;
  2789. esac
  2790. fi
  2791. # Try to get the absolute directory name.
  2792. absdir=\`cd \"\$thisdir\" && pwd\`
  2793. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2794. "
  2795. if test "$fast_install" = yes; then
  2796. $ECHO "\
  2797. program=lt-'$outputname'$exeext
  2798. progdir=\"\$thisdir/$objdir\"
  2799. if test ! -f \"\$progdir/\$program\" ||
  2800. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  2801. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2802. file=\"\$\$-\$program\"
  2803. if test ! -d \"\$progdir\"; then
  2804. $MKDIR \"\$progdir\"
  2805. else
  2806. $RM \"\$progdir/\$file\"
  2807. fi"
  2808. $ECHO "\
  2809. # relink executable if necessary
  2810. if test -n \"\$relink_command\"; then
  2811. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  2812. else
  2813. $ECHO \"\$relink_command_output\" >&2
  2814. $RM \"\$progdir/\$file\"
  2815. exit 1
  2816. fi
  2817. fi
  2818. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2819. { $RM \"\$progdir/\$program\";
  2820. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2821. $RM \"\$progdir/\$file\"
  2822. fi"
  2823. else
  2824. $ECHO "\
  2825. program='$outputname'
  2826. progdir=\"\$thisdir/$objdir\"
  2827. "
  2828. fi
  2829. $ECHO "\
  2830. if test -f \"\$progdir/\$program\"; then"
  2831. # Export our shlibpath_var if we have one.
  2832. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2833. $ECHO "\
  2834. # Add our own library path to $shlibpath_var
  2835. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2836. # Some systems cannot cope with colon-terminated $shlibpath_var
  2837. # The second colon is a workaround for a bug in BeOS R4 sed
  2838. $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2839. export $shlibpath_var
  2840. "
  2841. fi
  2842. # fixup the dll searchpath if we need to.
  2843. if test -n "$dllsearchpath"; then
  2844. $ECHO "\
  2845. # Add the dll search path components to the executable PATH
  2846. PATH=$dllsearchpath:\$PATH
  2847. "
  2848. fi
  2849. $ECHO "\
  2850. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2851. # Run the actual program with our arguments.
  2852. "
  2853. case $host in
  2854. # Backslashes separate directories on plain windows
  2855. *-*-mingw | *-*-os2* | *-cegcc*)
  2856. $ECHO "\
  2857. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  2858. "
  2859. ;;
  2860. *)
  2861. $ECHO "\
  2862. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  2863. "
  2864. ;;
  2865. esac
  2866. $ECHO "\
  2867. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  2868. exit 1
  2869. fi
  2870. else
  2871. # The program doesn't exist.
  2872. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  2873. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  2874. $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  2875. exit 1
  2876. fi
  2877. fi\
  2878. "
  2879. }
  2880. # end: func_emit_wrapper_part2
  2881. # func_emit_wrapper [arg=no]
  2882. #
  2883. # Emit a libtool wrapper script on stdout.
  2884. # Don't directly open a file because we may want to
  2885. # incorporate the script contents within a cygwin/mingw
  2886. # wrapper executable. Must ONLY be called from within
  2887. # func_mode_link because it depends on a number of variables
  2888. # set therein.
  2889. #
  2890. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  2891. # variable will take. If 'yes', then the emitted script
  2892. # will assume that the directory in which it is stored is
  2893. # the $objdir directory. This is a cygwin/mingw-specific
  2894. # behavior.
  2895. func_emit_wrapper ()
  2896. {
  2897. func_emit_wrapper_arg1=no
  2898. if test -n "$1" ; then
  2899. func_emit_wrapper_arg1=$1
  2900. fi
  2901. # split this up so that func_emit_cwrapperexe_src
  2902. # can call each part independently.
  2903. func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
  2904. func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
  2905. }
  2906. # func_to_host_path arg
  2907. #
  2908. # Convert paths to host format when used with build tools.
  2909. # Intended for use with "native" mingw (where libtool itself
  2910. # is running under the msys shell), or in the following cross-
  2911. # build environments:
  2912. # $build $host
  2913. # mingw (msys) mingw [e.g. native]
  2914. # cygwin mingw
  2915. # *nix + wine mingw
  2916. # where wine is equipped with the `winepath' executable.
  2917. # In the native mingw case, the (msys) shell automatically
  2918. # converts paths for any non-msys applications it launches,
  2919. # but that facility isn't available from inside the cwrapper.
  2920. # Similar accommodations are necessary for $host mingw and
  2921. # $build cygwin. Calling this function does no harm for other
  2922. # $host/$build combinations not listed above.
  2923. #
  2924. # ARG is the path (on $build) that should be converted to
  2925. # the proper representation for $host. The result is stored
  2926. # in $func_to_host_path_result.
  2927. func_to_host_path ()
  2928. {
  2929. func_to_host_path_result="$1"
  2930. if test -n "$1" ; then
  2931. case $host in
  2932. *mingw* )
  2933. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  2934. case $build in
  2935. *mingw* ) # actually, msys
  2936. # awkward: cmd appends spaces to result
  2937. lt_sed_strip_trailing_spaces="s/[ ]*\$//"
  2938. func_to_host_path_tmp1=`( cmd //c echo "$1" |\
  2939. $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
  2940. func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  2941. $SED -e "$lt_sed_naive_backslashify"`
  2942. ;;
  2943. *cygwin* )
  2944. func_to_host_path_tmp1=`cygpath -w "$1"`
  2945. func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  2946. $SED -e "$lt_sed_naive_backslashify"`
  2947. ;;
  2948. * )
  2949. # Unfortunately, winepath does not exit with a non-zero
  2950. # error code, so we are forced to check the contents of
  2951. # stdout. On the other hand, if the command is not
  2952. # found, the shell will set an exit code of 127 and print
  2953. # *an error message* to stdout. So we must check for both
  2954. # error code of zero AND non-empty stdout, which explains
  2955. # the odd construction:
  2956. func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
  2957. if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
  2958. func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  2959. $SED -e "$lt_sed_naive_backslashify"`
  2960. else
  2961. # Allow warning below.
  2962. func_to_host_path_result=""
  2963. fi
  2964. ;;
  2965. esac
  2966. if test -z "$func_to_host_path_result" ; then
  2967. func_error "Could not determine host path corresponding to"
  2968. func_error " '$1'"
  2969. func_error "Continuing, but uninstalled executables may not work."
  2970. # Fallback:
  2971. func_to_host_path_result="$1"
  2972. fi
  2973. ;;
  2974. esac
  2975. fi
  2976. }
  2977. # end: func_to_host_path
  2978. # func_to_host_pathlist arg
  2979. #
  2980. # Convert pathlists to host format when used with build tools.
  2981. # See func_to_host_path(), above. This function supports the
  2982. # following $build/$host combinations (but does no harm for
  2983. # combinations not listed here):
  2984. # $build $host
  2985. # mingw (msys) mingw [e.g. native]
  2986. # cygwin mingw
  2987. # *nix + wine mingw
  2988. #
  2989. # Path separators are also converted from $build format to
  2990. # $host format. If ARG begins or ends with a path separator
  2991. # character, it is preserved (but converted to $host format)
  2992. # on output.
  2993. #
  2994. # ARG is a pathlist (on $build) that should be converted to
  2995. # the proper representation on $host. The result is stored
  2996. # in $func_to_host_pathlist_result.
  2997. func_to_host_pathlist ()
  2998. {
  2999. func_to_host_pathlist_result="$1"
  3000. if test -n "$1" ; then
  3001. case $host in
  3002. *mingw* )
  3003. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  3004. # Remove leading and trailing path separator characters from
  3005. # ARG. msys behavior is inconsistent here, cygpath turns them
  3006. # into '.;' and ';.', and winepath ignores them completely.
  3007. func_to_host_pathlist_tmp2="$1"
  3008. # Once set for this call, this variable should not be
  3009. # reassigned. It is used in tha fallback case.
  3010. func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
  3011. $SED -e 's|^:*||' -e 's|:*$||'`
  3012. case $build in
  3013. *mingw* ) # Actually, msys.
  3014. # Awkward: cmd appends spaces to result.
  3015. lt_sed_strip_trailing_spaces="s/[ ]*\$//"
  3016. func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
  3017. $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
  3018. func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
  3019. $SED -e "$lt_sed_naive_backslashify"`
  3020. ;;
  3021. *cygwin* )
  3022. func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
  3023. func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
  3024. $SED -e "$lt_sed_naive_backslashify"`
  3025. ;;
  3026. * )
  3027. # unfortunately, winepath doesn't convert pathlists
  3028. func_to_host_pathlist_result=""
  3029. func_to_host_pathlist_oldIFS=$IFS
  3030. IFS=:
  3031. for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
  3032. IFS=$func_to_host_pathlist_oldIFS
  3033. if test -n "$func_to_host_pathlist_f" ; then
  3034. func_to_host_path "$func_to_host_pathlist_f"
  3035. if test -n "$func_to_host_path_result" ; then
  3036. if test -z "$func_to_host_pathlist_result" ; then
  3037. func_to_host_pathlist_result="$func_to_host_path_result"
  3038. else
  3039. func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
  3040. fi
  3041. fi
  3042. fi
  3043. IFS=:
  3044. done
  3045. IFS=$func_to_host_pathlist_oldIFS
  3046. ;;
  3047. esac
  3048. if test -z "$func_to_host_pathlist_result" ; then
  3049. func_error "Could not determine the host path(s) corresponding to"
  3050. func_error " '$1'"
  3051. func_error "Continuing, but uninstalled executables may not work."
  3052. # Fallback. This may break if $1 contains DOS-style drive
  3053. # specifications. The fix is not to complicate the expression
  3054. # below, but for the user to provide a working wine installation
  3055. # with winepath so that path translation in the cross-to-mingw
  3056. # case works properly.
  3057. lt_replace_pathsep_nix_to_dos="s|:|;|g"
  3058. func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
  3059. $SED -e "$lt_replace_pathsep_nix_to_dos"`
  3060. fi
  3061. # Now, add the leading and trailing path separators back
  3062. case "$1" in
  3063. :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
  3064. ;;
  3065. esac
  3066. case "$1" in
  3067. *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
  3068. ;;
  3069. esac
  3070. ;;
  3071. esac
  3072. fi
  3073. }
  3074. # end: func_to_host_pathlist
  3075. # func_emit_cwrapperexe_src
  3076. # emit the source code for a wrapper executable on stdout
  3077. # Must ONLY be called from within func_mode_link because
  3078. # it depends on a number of variable set therein.
  3079. func_emit_cwrapperexe_src ()
  3080. {
  3081. cat <<EOF
  3082. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  3083. Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  3084. The $output program cannot be directly executed until all the libtool
  3085. libraries that it depends on are installed.
  3086. This wrapper executable should never be moved out of the build directory.
  3087. If it is, it will not operate correctly.
  3088. Currently, it simply execs the wrapper *script* "$SHELL $output",
  3089. but could eventually absorb all of the scripts functionality and
  3090. exec $objdir/$outputname directly.
  3091. */
  3092. EOF
  3093. cat <<"EOF"
  3094. #include <stdio.h>
  3095. #include <stdlib.h>
  3096. #ifdef _MSC_VER
  3097. # include <direct.h>
  3098. # include <process.h>
  3099. # include <io.h>
  3100. # define setmode _setmode
  3101. #else
  3102. # include <unistd.h>
  3103. # include <stdint.h>
  3104. # ifdef __CYGWIN__
  3105. # include <io.h>
  3106. # define HAVE_SETENV
  3107. # ifdef __STRICT_ANSI__
  3108. char *realpath (const char *, char *);
  3109. int putenv (char *);
  3110. int setenv (const char *, const char *, int);
  3111. # endif
  3112. # endif
  3113. #endif
  3114. #include <malloc.h>
  3115. #include <stdarg.h>
  3116. #include <assert.h>
  3117. #include <string.h>
  3118. #include <ctype.h>
  3119. #include <errno.h>
  3120. #include <fcntl.h>
  3121. #include <sys/stat.h>
  3122. #if defined(PATH_MAX)
  3123. # define LT_PATHMAX PATH_MAX
  3124. #elif defined(MAXPATHLEN)
  3125. # define LT_PATHMAX MAXPATHLEN
  3126. #else
  3127. # define LT_PATHMAX 1024
  3128. #endif
  3129. #ifndef S_IXOTH
  3130. # define S_IXOTH 0
  3131. #endif
  3132. #ifndef S_IXGRP
  3133. # define S_IXGRP 0
  3134. #endif
  3135. #ifdef _MSC_VER
  3136. # define S_IXUSR _S_IEXEC
  3137. # define stat _stat
  3138. # ifndef _INTPTR_T_DEFINED
  3139. # define intptr_t int
  3140. # endif
  3141. #endif
  3142. #ifndef DIR_SEPARATOR
  3143. # define DIR_SEPARATOR '/'
  3144. # define PATH_SEPARATOR ':'
  3145. #endif
  3146. #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  3147. defined (__OS2__)
  3148. # define HAVE_DOS_BASED_FILE_SYSTEM
  3149. # define FOPEN_WB "wb"
  3150. # ifndef DIR_SEPARATOR_2
  3151. # define DIR_SEPARATOR_2 '\\'
  3152. # endif
  3153. # ifndef PATH_SEPARATOR_2
  3154. # define PATH_SEPARATOR_2 ';'
  3155. # endif
  3156. #endif
  3157. #ifndef DIR_SEPARATOR_2
  3158. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  3159. #else /* DIR_SEPARATOR_2 */
  3160. # define IS_DIR_SEPARATOR(ch) \
  3161. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  3162. #endif /* DIR_SEPARATOR_2 */
  3163. #ifndef PATH_SEPARATOR_2
  3164. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  3165. #else /* PATH_SEPARATOR_2 */
  3166. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  3167. #endif /* PATH_SEPARATOR_2 */
  3168. #ifdef __CYGWIN__
  3169. # define FOPEN_WB "wb"
  3170. #endif
  3171. #ifndef FOPEN_WB
  3172. # define FOPEN_WB "w"
  3173. #endif
  3174. #ifndef _O_BINARY
  3175. # define _O_BINARY 0
  3176. #endif
  3177. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  3178. #define XFREE(stale) do { \
  3179. if (stale) { free ((void *) stale); stale = 0; } \
  3180. } while (0)
  3181. #undef LTWRAPPER_DEBUGPRINTF
  3182. #if defined DEBUGWRAPPER
  3183. # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
  3184. static void
  3185. ltwrapper_debugprintf (const char *fmt, ...)
  3186. {
  3187. va_list args;
  3188. va_start (args, fmt);
  3189. (void) vfprintf (stderr, fmt, args);
  3190. va_end (args);
  3191. }
  3192. #else
  3193. # define LTWRAPPER_DEBUGPRINTF(args)
  3194. #endif
  3195. const char *program_name = NULL;
  3196. void *xmalloc (size_t num);
  3197. char *xstrdup (const char *string);
  3198. const char *base_name (const char *name);
  3199. char *find_executable (const char *wrapper);
  3200. char *chase_symlinks (const char *pathspec);
  3201. int make_executable (const char *path);
  3202. int check_executable (const char *path);
  3203. char *strendzap (char *str, const char *pat);
  3204. void lt_fatal (const char *message, ...);
  3205. void lt_setenv (const char *name, const char *value);
  3206. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  3207. void lt_opt_process_env_set (const char *arg);
  3208. void lt_opt_process_env_prepend (const char *arg);
  3209. void lt_opt_process_env_append (const char *arg);
  3210. int lt_split_name_value (const char *arg, char** name, char** value);
  3211. void lt_update_exe_path (const char *name, const char *value);
  3212. void lt_update_lib_path (const char *name, const char *value);
  3213. static const char *script_text_part1 =
  3214. EOF
  3215. func_emit_wrapper_part1 yes |
  3216. $SED -e 's/\([\\"]\)/\\\1/g' \
  3217. -e 's/^/ "/' -e 's/$/\\n"/'
  3218. echo ";"
  3219. cat <<EOF
  3220. static const char *script_text_part2 =
  3221. EOF
  3222. func_emit_wrapper_part2 yes |
  3223. $SED -e 's/\([\\"]\)/\\\1/g' \
  3224. -e 's/^/ "/' -e 's/$/\\n"/'
  3225. echo ";"
  3226. cat <<EOF
  3227. const char * MAGIC_EXE = "$magic_exe";
  3228. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  3229. EOF
  3230. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  3231. func_to_host_pathlist "$temp_rpath"
  3232. cat <<EOF
  3233. const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
  3234. EOF
  3235. else
  3236. cat <<"EOF"
  3237. const char * LIB_PATH_VALUE = "";
  3238. EOF
  3239. fi
  3240. if test -n "$dllsearchpath"; then
  3241. func_to_host_pathlist "$dllsearchpath:"
  3242. cat <<EOF
  3243. const char * EXE_PATH_VARNAME = "PATH";
  3244. const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
  3245. EOF
  3246. else
  3247. cat <<"EOF"
  3248. const char * EXE_PATH_VARNAME = "";
  3249. const char * EXE_PATH_VALUE = "";
  3250. EOF
  3251. fi
  3252. if test "$fast_install" = yes; then
  3253. cat <<EOF
  3254. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  3255. EOF
  3256. else
  3257. cat <<EOF
  3258. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  3259. EOF
  3260. fi
  3261. cat <<"EOF"
  3262. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  3263. #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
  3264. static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
  3265. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  3266. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  3267. static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
  3268. static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
  3269. /* argument is putenv-style "foo=bar", value of foo is set to bar */
  3270. static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
  3271. static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
  3272. /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
  3273. static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
  3274. static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
  3275. /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
  3276. int
  3277. main (int argc, char *argv[])
  3278. {
  3279. char **newargz;
  3280. int newargc;
  3281. char *tmp_pathspec;
  3282. char *actual_cwrapper_path;
  3283. char *actual_cwrapper_name;
  3284. char *target_name;
  3285. char *lt_argv_zero;
  3286. intptr_t rval = 127;
  3287. int i;
  3288. program_name = (char *) xstrdup (base_name (argv[0]));
  3289. LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
  3290. LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
  3291. /* very simple arg parsing; don't want to rely on getopt */
  3292. for (i = 1; i < argc; i++)
  3293. {
  3294. if (strcmp (argv[i], dumpscript_opt) == 0)
  3295. {
  3296. EOF
  3297. case "$host" in
  3298. *mingw* | *cygwin* )
  3299. # make stdout use "unix" line endings
  3300. echo " setmode(1,_O_BINARY);"
  3301. ;;
  3302. esac
  3303. cat <<"EOF"
  3304. printf ("%s", script_text_part1);
  3305. printf ("%s", script_text_part2);
  3306. return 0;
  3307. }
  3308. }
  3309. newargz = XMALLOC (char *, argc + 1);
  3310. tmp_pathspec = find_executable (argv[0]);
  3311. if (tmp_pathspec == NULL)
  3312. lt_fatal ("Couldn't find %s", argv[0]);
  3313. LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
  3314. tmp_pathspec));
  3315. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  3316. LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
  3317. actual_cwrapper_path));
  3318. XFREE (tmp_pathspec);
  3319. actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
  3320. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  3321. /* wrapper name transforms */
  3322. strendzap (actual_cwrapper_name, ".exe");
  3323. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  3324. XFREE (actual_cwrapper_name);
  3325. actual_cwrapper_name = tmp_pathspec;
  3326. tmp_pathspec = 0;
  3327. /* target_name transforms -- use actual target program name; might have lt- prefix */
  3328. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  3329. strendzap (target_name, ".exe");
  3330. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  3331. XFREE (target_name);
  3332. target_name = tmp_pathspec;
  3333. tmp_pathspec = 0;
  3334. LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
  3335. target_name));
  3336. EOF
  3337. cat <<EOF
  3338. newargz[0] =
  3339. XMALLOC (char, (strlen (actual_cwrapper_path) +
  3340. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  3341. strcpy (newargz[0], actual_cwrapper_path);
  3342. strcat (newargz[0], "$objdir");
  3343. strcat (newargz[0], "/");
  3344. EOF
  3345. cat <<"EOF"
  3346. /* stop here, and copy so we don't have to do this twice */
  3347. tmp_pathspec = xstrdup (newargz[0]);
  3348. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  3349. strcat (newargz[0], actual_cwrapper_name);
  3350. /* DO want the lt- prefix here if it exists, so use target_name */
  3351. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  3352. XFREE (tmp_pathspec);
  3353. tmp_pathspec = NULL;
  3354. EOF
  3355. case $host_os in
  3356. mingw*)
  3357. cat <<"EOF"
  3358. {
  3359. char* p;
  3360. while ((p = strchr (newargz[0], '\\')) != NULL)
  3361. {
  3362. *p = '/';
  3363. }
  3364. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  3365. {
  3366. *p = '/';
  3367. }
  3368. }
  3369. EOF
  3370. ;;
  3371. esac
  3372. cat <<"EOF"
  3373. XFREE (target_name);
  3374. XFREE (actual_cwrapper_path);
  3375. XFREE (actual_cwrapper_name);
  3376. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  3377. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  3378. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  3379. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  3380. newargc=0;
  3381. for (i = 1; i < argc; i++)
  3382. {
  3383. if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
  3384. {
  3385. if (argv[i][env_set_opt_len] == '=')
  3386. {
  3387. const char *p = argv[i] + env_set_opt_len + 1;
  3388. lt_opt_process_env_set (p);
  3389. }
  3390. else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
  3391. {
  3392. lt_opt_process_env_set (argv[++i]); /* don't copy */
  3393. }
  3394. else
  3395. lt_fatal ("%s missing required argument", env_set_opt);
  3396. continue;
  3397. }
  3398. if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
  3399. {
  3400. if (argv[i][env_prepend_opt_len] == '=')
  3401. {
  3402. const char *p = argv[i] + env_prepend_opt_len + 1;
  3403. lt_opt_process_env_prepend (p);
  3404. }
  3405. else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
  3406. {
  3407. lt_opt_process_env_prepend (argv[++i]); /* don't copy */
  3408. }
  3409. else
  3410. lt_fatal ("%s missing required argument", env_prepend_opt);
  3411. continue;
  3412. }
  3413. if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
  3414. {
  3415. if (argv[i][env_append_opt_len] == '=')
  3416. {
  3417. const char *p = argv[i] + env_append_opt_len + 1;
  3418. lt_opt_process_env_append (p);
  3419. }
  3420. else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
  3421. {
  3422. lt_opt_process_env_append (argv[++i]); /* don't copy */
  3423. }
  3424. else
  3425. lt_fatal ("%s missing required argument", env_append_opt);
  3426. continue;
  3427. }
  3428. if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
  3429. {
  3430. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  3431. namespace, but it is not one of the ones we know about and
  3432. have already dealt with, above (inluding dump-script), then
  3433. report an error. Otherwise, targets might begin to believe
  3434. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  3435. namespace. The first time any user complains about this, we'll
  3436. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  3437. or a configure.ac-settable value.
  3438. */
  3439. lt_fatal ("Unrecognized option in %s namespace: '%s'",
  3440. ltwrapper_option_prefix, argv[i]);
  3441. }
  3442. /* otherwise ... */
  3443. newargz[++newargc] = xstrdup (argv[i]);
  3444. }
  3445. newargz[++newargc] = NULL;
  3446. LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
  3447. for (i = 0; i < newargc; i++)
  3448. {
  3449. LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
  3450. }
  3451. EOF
  3452. case $host_os in
  3453. mingw*)
  3454. cat <<"EOF"
  3455. /* execv doesn't actually work on mingw as expected on unix */
  3456. rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  3457. if (rval == -1)
  3458. {
  3459. /* failed to start process */
  3460. LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
  3461. return 127;
  3462. }
  3463. return rval;
  3464. EOF
  3465. ;;
  3466. *)
  3467. cat <<"EOF"
  3468. execv (lt_argv_zero, newargz);
  3469. return rval; /* =127, but avoids unused variable warning */
  3470. EOF
  3471. ;;
  3472. esac
  3473. cat <<"EOF"
  3474. }
  3475. void *
  3476. xmalloc (size_t num)
  3477. {
  3478. void *p = (void *) malloc (num);
  3479. if (!p)
  3480. lt_fatal ("Memory exhausted");
  3481. return p;
  3482. }
  3483. char *
  3484. xstrdup (const char *string)
  3485. {
  3486. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  3487. string) : NULL;
  3488. }
  3489. const char *
  3490. base_name (const char *name)
  3491. {
  3492. const char *base;
  3493. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3494. /* Skip over the disk name in MSDOS pathnames. */
  3495. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  3496. name += 2;
  3497. #endif
  3498. for (base = name; *name; name++)
  3499. if (IS_DIR_SEPARATOR (*name))
  3500. base = name + 1;
  3501. return base;
  3502. }
  3503. int
  3504. check_executable (const char *path)
  3505. {
  3506. struct stat st;
  3507. LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
  3508. path ? (*path ? path : "EMPTY!") : "NULL!"));
  3509. if ((!path) || (!*path))
  3510. return 0;
  3511. if ((stat (path, &st) >= 0)
  3512. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  3513. return 1;
  3514. else
  3515. return 0;
  3516. }
  3517. int
  3518. make_executable (const char *path)
  3519. {
  3520. int rval = 0;
  3521. struct stat st;
  3522. LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
  3523. path ? (*path ? path : "EMPTY!") : "NULL!"));
  3524. if ((!path) || (!*path))
  3525. return 0;
  3526. if (stat (path, &st) >= 0)
  3527. {
  3528. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  3529. }
  3530. return rval;
  3531. }
  3532. /* Searches for the full path of the wrapper. Returns
  3533. newly allocated full path name if found, NULL otherwise
  3534. Does not chase symlinks, even on platforms that support them.
  3535. */
  3536. char *
  3537. find_executable (const char *wrapper)
  3538. {
  3539. int has_slash = 0;
  3540. const char *p;
  3541. const char *p_next;
  3542. /* static buffer for getcwd */
  3543. char tmp[LT_PATHMAX + 1];
  3544. int tmp_len;
  3545. char *concat_name;
  3546. LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
  3547. wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
  3548. if ((wrapper == NULL) || (*wrapper == '\0'))
  3549. return NULL;
  3550. /* Absolute path? */
  3551. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3552. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  3553. {
  3554. concat_name = xstrdup (wrapper);
  3555. if (check_executable (concat_name))
  3556. return concat_name;
  3557. XFREE (concat_name);
  3558. }
  3559. else
  3560. {
  3561. #endif
  3562. if (IS_DIR_SEPARATOR (wrapper[0]))
  3563. {
  3564. concat_name = xstrdup (wrapper);
  3565. if (check_executable (concat_name))
  3566. return concat_name;
  3567. XFREE (concat_name);
  3568. }
  3569. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3570. }
  3571. #endif
  3572. for (p = wrapper; *p; p++)
  3573. if (*p == '/')
  3574. {
  3575. has_slash = 1;
  3576. break;
  3577. }
  3578. if (!has_slash)
  3579. {
  3580. /* no slashes; search PATH */
  3581. const char *path = getenv ("PATH");
  3582. if (path != NULL)
  3583. {
  3584. for (p = path; *p; p = p_next)
  3585. {
  3586. const char *q;
  3587. size_t p_len;
  3588. for (q = p; *q; q++)
  3589. if (IS_PATH_SEPARATOR (*q))
  3590. break;
  3591. p_len = q - p;
  3592. p_next = (*q == '\0' ? q : q + 1);
  3593. if (p_len == 0)
  3594. {
  3595. /* empty path: current directory */
  3596. if (getcwd (tmp, LT_PATHMAX) == NULL)
  3597. lt_fatal ("getcwd failed");
  3598. tmp_len = strlen (tmp);
  3599. concat_name =
  3600. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  3601. memcpy (concat_name, tmp, tmp_len);
  3602. concat_name[tmp_len] = '/';
  3603. strcpy (concat_name + tmp_len + 1, wrapper);
  3604. }
  3605. else
  3606. {
  3607. concat_name =
  3608. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  3609. memcpy (concat_name, p, p_len);
  3610. concat_name[p_len] = '/';
  3611. strcpy (concat_name + p_len + 1, wrapper);
  3612. }
  3613. if (check_executable (concat_name))
  3614. return concat_name;
  3615. XFREE (concat_name);
  3616. }
  3617. }
  3618. /* not found in PATH; assume curdir */
  3619. }
  3620. /* Relative path | not found in path: prepend cwd */
  3621. if (getcwd (tmp, LT_PATHMAX) == NULL)
  3622. lt_fatal ("getcwd failed");
  3623. tmp_len = strlen (tmp);
  3624. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  3625. memcpy (concat_name, tmp, tmp_len);
  3626. concat_name[tmp_len] = '/';
  3627. strcpy (concat_name + tmp_len + 1, wrapper);
  3628. if (check_executable (concat_name))
  3629. return concat_name;
  3630. XFREE (concat_name);
  3631. return NULL;
  3632. }
  3633. char *
  3634. chase_symlinks (const char *pathspec)
  3635. {
  3636. #ifndef S_ISLNK
  3637. return xstrdup (pathspec);
  3638. #else
  3639. char buf[LT_PATHMAX];
  3640. struct stat s;
  3641. char *tmp_pathspec = xstrdup (pathspec);
  3642. char *p;
  3643. int has_symlinks = 0;
  3644. while (strlen (tmp_pathspec) && !has_symlinks)
  3645. {
  3646. LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
  3647. tmp_pathspec));
  3648. if (lstat (tmp_pathspec, &s) == 0)
  3649. {
  3650. if (S_ISLNK (s.st_mode) != 0)
  3651. {
  3652. has_symlinks = 1;
  3653. break;
  3654. }
  3655. /* search backwards for last DIR_SEPARATOR */
  3656. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  3657. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  3658. p--;
  3659. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  3660. {
  3661. /* no more DIR_SEPARATORS left */
  3662. break;
  3663. }
  3664. *p = '\0';
  3665. }
  3666. else
  3667. {
  3668. char *errstr = strerror (errno);
  3669. lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
  3670. }
  3671. }
  3672. XFREE (tmp_pathspec);
  3673. if (!has_symlinks)
  3674. {
  3675. return xstrdup (pathspec);
  3676. }
  3677. tmp_pathspec = realpath (pathspec, buf);
  3678. if (tmp_pathspec == 0)
  3679. {
  3680. lt_fatal ("Could not follow symlinks for %s", pathspec);
  3681. }
  3682. return xstrdup (tmp_pathspec);
  3683. #endif
  3684. }
  3685. char *
  3686. strendzap (char *str, const char *pat)
  3687. {
  3688. size_t len, patlen;
  3689. assert (str != NULL);
  3690. assert (pat != NULL);
  3691. len = strlen (str);
  3692. patlen = strlen (pat);
  3693. if (patlen <= len)
  3694. {
  3695. str += len - patlen;
  3696. if (strcmp (str, pat) == 0)
  3697. *str = '\0';
  3698. }
  3699. return str;
  3700. }
  3701. static void
  3702. lt_error_core (int exit_status, const char *mode,
  3703. const char *message, va_list ap)
  3704. {
  3705. fprintf (stderr, "%s: %s: ", program_name, mode);
  3706. vfprintf (stderr, message, ap);
  3707. fprintf (stderr, ".\n");
  3708. if (exit_status >= 0)
  3709. exit (exit_status);
  3710. }
  3711. void
  3712. lt_fatal (const char *message, ...)
  3713. {
  3714. va_list ap;
  3715. va_start (ap, message);
  3716. lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  3717. va_end (ap);
  3718. }
  3719. void
  3720. lt_setenv (const char *name, const char *value)
  3721. {
  3722. LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
  3723. (name ? name : "<NULL>"),
  3724. (value ? value : "<NULL>")));
  3725. {
  3726. #ifdef HAVE_SETENV
  3727. /* always make a copy, for consistency with !HAVE_SETENV */
  3728. char *str = xstrdup (value);
  3729. setenv (name, str, 1);
  3730. #else
  3731. int len = strlen (name) + 1 + strlen (value) + 1;
  3732. char *str = XMALLOC (char, len);
  3733. sprintf (str, "%s=%s", name, value);
  3734. if (putenv (str) != EXIT_SUCCESS)
  3735. {
  3736. XFREE (str);
  3737. }
  3738. #endif
  3739. }
  3740. }
  3741. char *
  3742. lt_extend_str (const char *orig_value, const char *add, int to_end)
  3743. {
  3744. char *new_value;
  3745. if (orig_value && *orig_value)
  3746. {
  3747. int orig_value_len = strlen (orig_value);
  3748. int add_len = strlen (add);
  3749. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  3750. if (to_end)
  3751. {
  3752. strcpy (new_value, orig_value);
  3753. strcpy (new_value + orig_value_len, add);
  3754. }
  3755. else
  3756. {
  3757. strcpy (new_value, add);
  3758. strcpy (new_value + add_len, orig_value);
  3759. }
  3760. }
  3761. else
  3762. {
  3763. new_value = xstrdup (add);
  3764. }
  3765. return new_value;
  3766. }
  3767. int
  3768. lt_split_name_value (const char *arg, char** name, char** value)
  3769. {
  3770. const char *p;
  3771. int len;
  3772. if (!arg || !*arg)
  3773. return 1;
  3774. p = strchr (arg, (int)'=');
  3775. if (!p)
  3776. return 1;
  3777. *value = xstrdup (++p);
  3778. len = strlen (arg) - strlen (*value);
  3779. *name = XMALLOC (char, len);
  3780. strncpy (*name, arg, len-1);
  3781. (*name)[len - 1] = '\0';
  3782. return 0;
  3783. }
  3784. void
  3785. lt_opt_process_env_set (const char *arg)
  3786. {
  3787. char *name = NULL;
  3788. char *value = NULL;
  3789. if (lt_split_name_value (arg, &name, &value) != 0)
  3790. {
  3791. XFREE (name);
  3792. XFREE (value);
  3793. lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
  3794. }
  3795. lt_setenv (name, value);
  3796. XFREE (name);
  3797. XFREE (value);
  3798. }
  3799. void
  3800. lt_opt_process_env_prepend (const char *arg)
  3801. {
  3802. char *name = NULL;
  3803. char *value = NULL;
  3804. char *new_value = NULL;
  3805. if (lt_split_name_value (arg, &name, &value) != 0)
  3806. {
  3807. XFREE (name);
  3808. XFREE (value);
  3809. lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
  3810. }
  3811. new_value = lt_extend_str (getenv (name), value, 0);
  3812. lt_setenv (name, new_value);
  3813. XFREE (new_value);
  3814. XFREE (name);
  3815. XFREE (value);
  3816. }
  3817. void
  3818. lt_opt_process_env_append (const char *arg)
  3819. {
  3820. char *name = NULL;
  3821. char *value = NULL;
  3822. char *new_value = NULL;
  3823. if (lt_split_name_value (arg, &name, &value) != 0)
  3824. {
  3825. XFREE (name);
  3826. XFREE (value);
  3827. lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
  3828. }
  3829. new_value = lt_extend_str (getenv (name), value, 1);
  3830. lt_setenv (name, new_value);
  3831. XFREE (new_value);
  3832. XFREE (name);
  3833. XFREE (value);
  3834. }
  3835. void
  3836. lt_update_exe_path (const char *name, const char *value)
  3837. {
  3838. LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  3839. (name ? name : "<NULL>"),
  3840. (value ? value : "<NULL>")));
  3841. if (name && *name && value && *value)
  3842. {
  3843. char *new_value = lt_extend_str (getenv (name), value, 0);
  3844. /* some systems can't cope with a ':'-terminated path #' */
  3845. int len = strlen (new_value);
  3846. while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  3847. {
  3848. new_value[len-1] = '\0';
  3849. }
  3850. lt_setenv (name, new_value);
  3851. XFREE (new_value);
  3852. }
  3853. }
  3854. void
  3855. lt_update_lib_path (const char *name, const char *value)
  3856. {
  3857. LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  3858. (name ? name : "<NULL>"),
  3859. (value ? value : "<NULL>")));
  3860. if (name && *name && value && *value)
  3861. {
  3862. char *new_value = lt_extend_str (getenv (name), value, 0);
  3863. lt_setenv (name, new_value);
  3864. XFREE (new_value);
  3865. }
  3866. }
  3867. EOF
  3868. }
  3869. # end: func_emit_cwrapperexe_src
  3870. # func_mode_link arg...
  3871. func_mode_link ()
  3872. {
  3873. $opt_debug
  3874. case $host in
  3875. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  3876. # It is impossible to link a dll without this setting, and
  3877. # we shouldn't force the makefile maintainer to figure out
  3878. # which system we are compiling for in order to pass an extra
  3879. # flag for every libtool invocation.
  3880. # allow_undefined=no
  3881. # FIXME: Unfortunately, there are problems with the above when trying
  3882. # to make a dll which has undefined symbols, in which case not
  3883. # even a static library is built. For now, we need to specify
  3884. # -no-undefined on the libtool link line when we can be certain
  3885. # that all symbols are satisfied, otherwise we get a static library.
  3886. allow_undefined=yes
  3887. ;;
  3888. *)
  3889. allow_undefined=yes
  3890. ;;
  3891. esac
  3892. libtool_args=$nonopt
  3893. base_compile="$nonopt $@"
  3894. compile_command=$nonopt
  3895. finalize_command=$nonopt
  3896. compile_rpath=
  3897. finalize_rpath=
  3898. compile_shlibpath=
  3899. finalize_shlibpath=
  3900. convenience=
  3901. old_convenience=
  3902. deplibs=
  3903. old_deplibs=
  3904. compiler_flags=
  3905. linker_flags=
  3906. dllsearchpath=
  3907. lib_search_path=`pwd`
  3908. inst_prefix_dir=
  3909. new_inherited_linker_flags=
  3910. avoid_version=no
  3911. dlfiles=
  3912. dlprefiles=
  3913. dlself=no
  3914. export_dynamic=no
  3915. export_symbols=
  3916. export_symbols_regex=
  3917. generated=
  3918. libobjs=
  3919. ltlibs=
  3920. module=no
  3921. no_install=no
  3922. objs=
  3923. non_pic_objects=
  3924. precious_files_regex=
  3925. prefer_static_libs=no
  3926. preload=no
  3927. prev=
  3928. prevarg=
  3929. release=
  3930. rpath=
  3931. xrpath=
  3932. perm_rpath=
  3933. temp_rpath=
  3934. thread_safe=no
  3935. vinfo=
  3936. vinfo_number=no
  3937. weak_libs=
  3938. single_module="${wl}-single_module"
  3939. func_infer_tag $base_compile
  3940. # We need to know -static, to get the right output filenames.
  3941. for arg
  3942. do
  3943. case $arg in
  3944. -shared)
  3945. test "$build_libtool_libs" != yes && \
  3946. func_fatal_configuration "can not build a shared library"
  3947. build_old_libs=no
  3948. break
  3949. ;;
  3950. -all-static | -static | -static-libtool-libs)
  3951. case $arg in
  3952. -all-static)
  3953. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  3954. func_warning "complete static linking is impossible in this configuration"
  3955. fi
  3956. if test -n "$link_static_flag"; then
  3957. dlopen_self=$dlopen_self_static
  3958. fi
  3959. prefer_static_libs=yes
  3960. ;;
  3961. -static)
  3962. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  3963. dlopen_self=$dlopen_self_static
  3964. fi
  3965. prefer_static_libs=built
  3966. ;;
  3967. -static-libtool-libs)
  3968. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  3969. dlopen_self=$dlopen_self_static
  3970. fi
  3971. prefer_static_libs=yes
  3972. ;;
  3973. esac
  3974. build_libtool_libs=no
  3975. build_old_libs=yes
  3976. break
  3977. ;;
  3978. esac
  3979. done
  3980. # See if our shared archives depend on static archives.
  3981. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  3982. # Go through the arguments, transforming them on the way.
  3983. while test "$#" -gt 0; do
  3984. arg="$1"
  3985. shift
  3986. func_quote_for_eval "$arg"
  3987. qarg=$func_quote_for_eval_unquoted_result
  3988. func_append libtool_args " $func_quote_for_eval_result"
  3989. # If the previous option needs an argument, assign it.
  3990. if test -n "$prev"; then
  3991. case $prev in
  3992. output)
  3993. func_append compile_command " @OUTPUT@"
  3994. func_append finalize_command " @OUTPUT@"
  3995. ;;
  3996. esac
  3997. case $prev in
  3998. dlfiles|dlprefiles)
  3999. if test "$preload" = no; then
  4000. # Add the symbol object into the linking commands.
  4001. func_append compile_command " @SYMFILE@"
  4002. func_append finalize_command " @SYMFILE@"
  4003. preload=yes
  4004. fi
  4005. case $arg in
  4006. *.la | *.lo) ;; # We handle these cases below.
  4007. force)
  4008. if test "$dlself" = no; then
  4009. dlself=needless
  4010. export_dynamic=yes
  4011. fi
  4012. prev=
  4013. continue
  4014. ;;
  4015. self)
  4016. if test "$prev" = dlprefiles; then
  4017. dlself=yes
  4018. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  4019. dlself=yes
  4020. else
  4021. dlself=needless
  4022. export_dynamic=yes
  4023. fi
  4024. prev=
  4025. continue
  4026. ;;
  4027. *)
  4028. if test "$prev" = dlfiles; then
  4029. dlfiles="$dlfiles $arg"
  4030. else
  4031. dlprefiles="$dlprefiles $arg"
  4032. fi
  4033. prev=
  4034. continue
  4035. ;;
  4036. esac
  4037. ;;
  4038. expsyms)
  4039. export_symbols="$arg"
  4040. test -f "$arg" \
  4041. || func_fatal_error "symbol file \`$arg' does not exist"
  4042. prev=
  4043. continue
  4044. ;;
  4045. expsyms_regex)
  4046. export_symbols_regex="$arg"
  4047. prev=
  4048. continue
  4049. ;;
  4050. framework)
  4051. case $host in
  4052. *-*-darwin*)
  4053. case "$deplibs " in
  4054. *" $qarg.ltframework "*) ;;
  4055. *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
  4056. ;;
  4057. esac
  4058. ;;
  4059. esac
  4060. prev=
  4061. continue
  4062. ;;
  4063. inst_prefix)
  4064. inst_prefix_dir="$arg"
  4065. prev=
  4066. continue
  4067. ;;
  4068. objectlist)
  4069. if test -f "$arg"; then
  4070. save_arg=$arg
  4071. moreargs=
  4072. for fil in `cat "$save_arg"`
  4073. do
  4074. # moreargs="$moreargs $fil"
  4075. arg=$fil
  4076. # A libtool-controlled object.
  4077. # Check to see that this really is a libtool object.
  4078. if func_lalib_unsafe_p "$arg"; then
  4079. pic_object=
  4080. non_pic_object=
  4081. # Read the .lo file
  4082. func_source "$arg"
  4083. if test -z "$pic_object" ||
  4084. test -z "$non_pic_object" ||
  4085. test "$pic_object" = none &&
  4086. test "$non_pic_object" = none; then
  4087. func_fatal_error "cannot find name of object for \`$arg'"
  4088. fi
  4089. # Extract subdirectory from the argument.
  4090. func_dirname "$arg" "/" ""
  4091. xdir="$func_dirname_result"
  4092. if test "$pic_object" != none; then
  4093. # Prepend the subdirectory the object is found in.
  4094. pic_object="$xdir$pic_object"
  4095. if test "$prev" = dlfiles; then
  4096. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  4097. dlfiles="$dlfiles $pic_object"
  4098. prev=
  4099. continue
  4100. else
  4101. # If libtool objects are unsupported, then we need to preload.
  4102. prev=dlprefiles
  4103. fi
  4104. fi
  4105. # CHECK ME: I think I busted this. -Ossama
  4106. if test "$prev" = dlprefiles; then
  4107. # Preload the old-style object.
  4108. dlprefiles="$dlprefiles $pic_object"
  4109. prev=
  4110. fi
  4111. # A PIC object.
  4112. func_append libobjs " $pic_object"
  4113. arg="$pic_object"
  4114. fi
  4115. # Non-PIC object.
  4116. if test "$non_pic_object" != none; then
  4117. # Prepend the subdirectory the object is found in.
  4118. non_pic_object="$xdir$non_pic_object"
  4119. # A standard non-PIC object
  4120. func_append non_pic_objects " $non_pic_object"
  4121. if test -z "$pic_object" || test "$pic_object" = none ; then
  4122. arg="$non_pic_object"
  4123. fi
  4124. else
  4125. # If the PIC object exists, use it instead.
  4126. # $xdir was prepended to $pic_object above.
  4127. non_pic_object="$pic_object"
  4128. func_append non_pic_objects " $non_pic_object"
  4129. fi
  4130. else
  4131. # Only an error if not doing a dry-run.
  4132. if $opt_dry_run; then
  4133. # Extract subdirectory from the argument.
  4134. func_dirname "$arg" "/" ""
  4135. xdir="$func_dirname_result"
  4136. func_lo2o "$arg"
  4137. pic_object=$xdir$objdir/$func_lo2o_result
  4138. non_pic_object=$xdir$func_lo2o_result
  4139. func_append libobjs " $pic_object"
  4140. func_append non_pic_objects " $non_pic_object"
  4141. else
  4142. func_fatal_error "\`$arg' is not a valid libtool object"
  4143. fi
  4144. fi
  4145. done
  4146. else
  4147. func_fatal_error "link input file \`$arg' does not exist"
  4148. fi
  4149. arg=$save_arg
  4150. prev=
  4151. continue
  4152. ;;
  4153. precious_regex)
  4154. precious_files_regex="$arg"
  4155. prev=
  4156. continue
  4157. ;;
  4158. release)
  4159. release="-$arg"
  4160. prev=
  4161. continue
  4162. ;;
  4163. rpath | xrpath)
  4164. # We need an absolute path.
  4165. case $arg in
  4166. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4167. *)
  4168. func_fatal_error "only absolute run-paths are allowed"
  4169. ;;
  4170. esac
  4171. if test "$prev" = rpath; then
  4172. case "$rpath " in
  4173. *" $arg "*) ;;
  4174. *) rpath="$rpath $arg" ;;
  4175. esac
  4176. else
  4177. case "$xrpath " in
  4178. *" $arg "*) ;;
  4179. *) xrpath="$xrpath $arg" ;;
  4180. esac
  4181. fi
  4182. prev=
  4183. continue
  4184. ;;
  4185. shrext)
  4186. shrext_cmds="$arg"
  4187. prev=
  4188. continue
  4189. ;;
  4190. weak)
  4191. weak_libs="$weak_libs $arg"
  4192. prev=
  4193. continue
  4194. ;;
  4195. xcclinker)
  4196. linker_flags="$linker_flags $qarg"
  4197. compiler_flags="$compiler_flags $qarg"
  4198. prev=
  4199. func_append compile_command " $qarg"
  4200. func_append finalize_command " $qarg"
  4201. continue
  4202. ;;
  4203. xcompiler)
  4204. compiler_flags="$compiler_flags $qarg"
  4205. prev=
  4206. func_append compile_command " $qarg"
  4207. func_append finalize_command " $qarg"
  4208. continue
  4209. ;;
  4210. xlinker)
  4211. linker_flags="$linker_flags $qarg"
  4212. compiler_flags="$compiler_flags $wl$qarg"
  4213. prev=
  4214. func_append compile_command " $wl$qarg"
  4215. func_append finalize_command " $wl$qarg"
  4216. continue
  4217. ;;
  4218. *)
  4219. eval "$prev=\"\$arg\""
  4220. prev=
  4221. continue
  4222. ;;
  4223. esac
  4224. fi # test -n "$prev"
  4225. prevarg="$arg"
  4226. case $arg in
  4227. -all-static)
  4228. if test -n "$link_static_flag"; then
  4229. # See comment for -static flag below, for more details.
  4230. func_append compile_command " $link_static_flag"
  4231. func_append finalize_command " $link_static_flag"
  4232. fi
  4233. continue
  4234. ;;
  4235. -allow-undefined)
  4236. # FIXME: remove this flag sometime in the future.
  4237. func_fatal_error "\`-allow-undefined' must not be used because it is the default"
  4238. ;;
  4239. -avoid-version)
  4240. avoid_version=yes
  4241. continue
  4242. ;;
  4243. -dlopen)
  4244. prev=dlfiles
  4245. continue
  4246. ;;
  4247. -dlpreopen)
  4248. prev=dlprefiles
  4249. continue
  4250. ;;
  4251. -export-dynamic)
  4252. export_dynamic=yes
  4253. continue
  4254. ;;
  4255. -export-symbols | -export-symbols-regex)
  4256. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  4257. func_fatal_error "more than one -exported-symbols argument is not allowed"
  4258. fi
  4259. if test "X$arg" = "X-export-symbols"; then
  4260. prev=expsyms
  4261. else
  4262. prev=expsyms_regex
  4263. fi
  4264. continue
  4265. ;;
  4266. -framework)
  4267. prev=framework
  4268. continue
  4269. ;;
  4270. -inst-prefix-dir)
  4271. prev=inst_prefix
  4272. continue
  4273. ;;
  4274. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  4275. # so, if we see these flags be careful not to treat them like -L
  4276. -L[A-Z][A-Z]*:*)
  4277. case $with_gcc/$host in
  4278. no/*-*-irix* | /*-*-irix*)
  4279. func_append compile_command " $arg"
  4280. func_append finalize_command " $arg"
  4281. ;;
  4282. esac
  4283. continue
  4284. ;;
  4285. -L*)
  4286. func_stripname '-L' '' "$arg"
  4287. dir=$func_stripname_result
  4288. if test -z "$dir"; then
  4289. if test "$#" -gt 0; then
  4290. func_fatal_error "require no space between \`-L' and \`$1'"
  4291. else
  4292. func_fatal_error "need path for \`-L' option"
  4293. fi
  4294. fi
  4295. # We need an absolute path.
  4296. case $dir in
  4297. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4298. *)
  4299. absdir=`cd "$dir" && pwd`
  4300. test -z "$absdir" && \
  4301. func_fatal_error "cannot determine absolute directory name of \`$dir'"
  4302. dir="$absdir"
  4303. ;;
  4304. esac
  4305. case "$deplibs " in
  4306. *" -L$dir "*) ;;
  4307. *)
  4308. deplibs="$deplibs -L$dir"
  4309. lib_search_path="$lib_search_path $dir"
  4310. ;;
  4311. esac
  4312. case $host in
  4313. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  4314. testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
  4315. case :$dllsearchpath: in
  4316. *":$dir:"*) ;;
  4317. ::) dllsearchpath=$dir;;
  4318. *) dllsearchpath="$dllsearchpath:$dir";;
  4319. esac
  4320. case :$dllsearchpath: in
  4321. *":$testbindir:"*) ;;
  4322. ::) dllsearchpath=$testbindir;;
  4323. *) dllsearchpath="$dllsearchpath:$testbindir";;
  4324. esac
  4325. ;;
  4326. esac
  4327. continue
  4328. ;;
  4329. -l*)
  4330. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  4331. case $host in
  4332. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
  4333. # These systems don't actually have a C or math library (as such)
  4334. continue
  4335. ;;
  4336. *-*-os2*)
  4337. # These systems don't actually have a C library (as such)
  4338. test "X$arg" = "X-lc" && continue
  4339. ;;
  4340. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4341. # Do not include libc due to us having libc/libc_r.
  4342. test "X$arg" = "X-lc" && continue
  4343. ;;
  4344. *-*-rhapsody* | *-*-darwin1.[012])
  4345. # Rhapsody C and math libraries are in the System framework
  4346. deplibs="$deplibs System.ltframework"
  4347. continue
  4348. ;;
  4349. *-*-sco3.2v5* | *-*-sco5v6*)
  4350. # Causes problems with __ctype
  4351. test "X$arg" = "X-lc" && continue
  4352. ;;
  4353. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  4354. # Compiler inserts libc in the correct place for threads to work
  4355. test "X$arg" = "X-lc" && continue
  4356. ;;
  4357. esac
  4358. elif test "X$arg" = "X-lc_r"; then
  4359. case $host in
  4360. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4361. # Do not include libc_r directly, use -pthread flag.
  4362. continue
  4363. ;;
  4364. esac
  4365. fi
  4366. deplibs="$deplibs $arg"
  4367. continue
  4368. ;;
  4369. -module)
  4370. module=yes
  4371. continue
  4372. ;;
  4373. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  4374. # classes, name mangling, and exception handling.
  4375. # Darwin uses the -arch flag to determine output architecture.
  4376. -model|-arch|-isysroot)
  4377. compiler_flags="$compiler_flags $arg"
  4378. func_append compile_command " $arg"
  4379. func_append finalize_command " $arg"
  4380. prev=xcompiler
  4381. continue
  4382. ;;
  4383. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  4384. compiler_flags="$compiler_flags $arg"
  4385. func_append compile_command " $arg"
  4386. func_append finalize_command " $arg"
  4387. case "$new_inherited_linker_flags " in
  4388. *" $arg "*) ;;
  4389. * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
  4390. esac
  4391. continue
  4392. ;;
  4393. -multi_module)
  4394. single_module="${wl}-multi_module"
  4395. continue
  4396. ;;
  4397. -no-fast-install)
  4398. fast_install=no
  4399. continue
  4400. ;;
  4401. -no-install)
  4402. case $host in
  4403. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  4404. # The PATH hackery in wrapper scripts is required on Windows
  4405. # and Darwin in order for the loader to find any dlls it needs.
  4406. func_warning "\`-no-install' is ignored for $host"
  4407. func_warning "assuming \`-no-fast-install' instead"
  4408. fast_install=no
  4409. ;;
  4410. *) no_install=yes ;;
  4411. esac
  4412. continue
  4413. ;;
  4414. -no-undefined)
  4415. allow_undefined=no
  4416. continue
  4417. ;;
  4418. -objectlist)
  4419. prev=objectlist
  4420. continue
  4421. ;;
  4422. -o) prev=output ;;
  4423. -precious-files-regex)
  4424. prev=precious_regex
  4425. continue
  4426. ;;
  4427. -release)
  4428. prev=release
  4429. continue
  4430. ;;
  4431. -rpath)
  4432. prev=rpath
  4433. continue
  4434. ;;
  4435. -R)
  4436. prev=xrpath
  4437. continue
  4438. ;;
  4439. -R*)
  4440. func_stripname '-R' '' "$arg"
  4441. dir=$func_stripname_result
  4442. # We need an absolute path.
  4443. case $dir in
  4444. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4445. *)
  4446. func_fatal_error "only absolute run-paths are allowed"
  4447. ;;
  4448. esac
  4449. case "$xrpath " in
  4450. *" $dir "*) ;;
  4451. *) xrpath="$xrpath $dir" ;;
  4452. esac
  4453. continue
  4454. ;;
  4455. -shared)
  4456. # The effects of -shared are defined in a previous loop.
  4457. continue
  4458. ;;
  4459. -shrext)
  4460. prev=shrext
  4461. continue
  4462. ;;
  4463. -static | -static-libtool-libs)
  4464. # The effects of -static are defined in a previous loop.
  4465. # We used to do the same as -all-static on platforms that
  4466. # didn't have a PIC flag, but the assumption that the effects
  4467. # would be equivalent was wrong. It would break on at least
  4468. # Digital Unix and AIX.
  4469. continue
  4470. ;;
  4471. -thread-safe)
  4472. thread_safe=yes
  4473. continue
  4474. ;;
  4475. -version-info)
  4476. prev=vinfo
  4477. continue
  4478. ;;
  4479. -version-number)
  4480. prev=vinfo
  4481. vinfo_number=yes
  4482. continue
  4483. ;;
  4484. -weak)
  4485. prev=weak
  4486. continue
  4487. ;;
  4488. -Wc,*)
  4489. func_stripname '-Wc,' '' "$arg"
  4490. args=$func_stripname_result
  4491. arg=
  4492. save_ifs="$IFS"; IFS=','
  4493. for flag in $args; do
  4494. IFS="$save_ifs"
  4495. func_quote_for_eval "$flag"
  4496. arg="$arg $wl$func_quote_for_eval_result"
  4497. compiler_flags="$compiler_flags $func_quote_for_eval_result"
  4498. done
  4499. IFS="$save_ifs"
  4500. func_stripname ' ' '' "$arg"
  4501. arg=$func_stripname_result
  4502. ;;
  4503. -Wl,*)
  4504. func_stripname '-Wl,' '' "$arg"
  4505. args=$func_stripname_result
  4506. arg=
  4507. save_ifs="$IFS"; IFS=','
  4508. for flag in $args; do
  4509. IFS="$save_ifs"
  4510. func_quote_for_eval "$flag"
  4511. arg="$arg $wl$func_quote_for_eval_result"
  4512. compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
  4513. linker_flags="$linker_flags $func_quote_for_eval_result"
  4514. done
  4515. IFS="$save_ifs"
  4516. func_stripname ' ' '' "$arg"
  4517. arg=$func_stripname_result
  4518. ;;
  4519. -Xcompiler)
  4520. prev=xcompiler
  4521. continue
  4522. ;;
  4523. -Xlinker)
  4524. prev=xlinker
  4525. continue
  4526. ;;
  4527. -XCClinker)
  4528. prev=xcclinker
  4529. continue
  4530. ;;
  4531. # -msg_* for osf cc
  4532. -msg_*)
  4533. func_quote_for_eval "$arg"
  4534. arg="$func_quote_for_eval_result"
  4535. ;;
  4536. # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
  4537. # -r[0-9][0-9]* specifies the processor on the SGI compiler
  4538. # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
  4539. # +DA*, +DD* enable 64-bit mode on the HP compiler
  4540. # -q* pass through compiler args for the IBM compiler
  4541. # -m*, -t[45]*, -txscale* pass through architecture-specific
  4542. # compiler args for GCC
  4543. # -F/path gives path to uninstalled frameworks, gcc on darwin
  4544. # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
  4545. # @file GCC response files
  4546. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  4547. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
  4548. func_quote_for_eval "$arg"
  4549. arg="$func_quote_for_eval_result"
  4550. func_append compile_command " $arg"
  4551. func_append finalize_command " $arg"
  4552. compiler_flags="$compiler_flags $arg"
  4553. continue
  4554. ;;
  4555. # Some other compiler flag.
  4556. -* | +*)
  4557. func_quote_for_eval "$arg"
  4558. arg="$func_quote_for_eval_result"
  4559. ;;
  4560. *.$objext)
  4561. # A standard object.
  4562. objs="$objs $arg"
  4563. ;;
  4564. *.lo)
  4565. # A libtool-controlled object.
  4566. # Check to see that this really is a libtool object.
  4567. if func_lalib_unsafe_p "$arg"; then
  4568. pic_object=
  4569. non_pic_object=
  4570. # Read the .lo file
  4571. func_source "$arg"
  4572. if test -z "$pic_object" ||
  4573. test -z "$non_pic_object" ||
  4574. test "$pic_object" = none &&
  4575. test "$non_pic_object" = none; then
  4576. func_fatal_error "cannot find name of object for \`$arg'"
  4577. fi
  4578. # Extract subdirectory from the argument.
  4579. func_dirname "$arg" "/" ""
  4580. xdir="$func_dirname_result"
  4581. if test "$pic_object" != none; then
  4582. # Prepend the subdirectory the object is found in.
  4583. pic_object="$xdir$pic_object"
  4584. if test "$prev" = dlfiles; then
  4585. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  4586. dlfiles="$dlfiles $pic_object"
  4587. prev=
  4588. continue
  4589. else
  4590. # If libtool objects are unsupported, then we need to preload.
  4591. prev=dlprefiles
  4592. fi
  4593. fi
  4594. # CHECK ME: I think I busted this. -Ossama
  4595. if test "$prev" = dlprefiles; then
  4596. # Preload the old-style object.
  4597. dlprefiles="$dlprefiles $pic_object"
  4598. prev=
  4599. fi
  4600. # A PIC object.
  4601. func_append libobjs " $pic_object"
  4602. arg="$pic_object"
  4603. fi
  4604. # Non-PIC object.
  4605. if test "$non_pic_object" != none; then
  4606. # Prepend the subdirectory the object is found in.
  4607. non_pic_object="$xdir$non_pic_object"
  4608. # A standard non-PIC object
  4609. func_append non_pic_objects " $non_pic_object"
  4610. if test -z "$pic_object" || test "$pic_object" = none ; then
  4611. arg="$non_pic_object"
  4612. fi
  4613. else
  4614. # If the PIC object exists, use it instead.
  4615. # $xdir was prepended to $pic_object above.
  4616. non_pic_object="$pic_object"
  4617. func_append non_pic_objects " $non_pic_object"
  4618. fi
  4619. else
  4620. # Only an error if not doing a dry-run.
  4621. if $opt_dry_run; then
  4622. # Extract subdirectory from the argument.
  4623. func_dirname "$arg" "/" ""
  4624. xdir="$func_dirname_result"
  4625. func_lo2o "$arg"
  4626. pic_object=$xdir$objdir/$func_lo2o_result
  4627. non_pic_object=$xdir$func_lo2o_result
  4628. func_append libobjs " $pic_object"
  4629. func_append non_pic_objects " $non_pic_object"
  4630. else
  4631. func_fatal_error "\`$arg' is not a valid libtool object"
  4632. fi
  4633. fi
  4634. ;;
  4635. *.$libext)
  4636. # An archive.
  4637. deplibs="$deplibs $arg"
  4638. old_deplibs="$old_deplibs $arg"
  4639. continue
  4640. ;;
  4641. *.la)
  4642. # A libtool-controlled library.
  4643. if test "$prev" = dlfiles; then
  4644. # This library was specified with -dlopen.
  4645. dlfiles="$dlfiles $arg"
  4646. prev=
  4647. elif test "$prev" = dlprefiles; then
  4648. # The library was specified with -dlpreopen.
  4649. dlprefiles="$dlprefiles $arg"
  4650. prev=
  4651. else
  4652. deplibs="$deplibs $arg"
  4653. fi
  4654. continue
  4655. ;;
  4656. # Some other compiler argument.
  4657. *)
  4658. # Unknown arguments in both finalize_command and compile_command need
  4659. # to be aesthetically quoted because they are evaled later.
  4660. func_quote_for_eval "$arg"
  4661. arg="$func_quote_for_eval_result"
  4662. ;;
  4663. esac # arg
  4664. # Now actually substitute the argument into the commands.
  4665. if test -n "$arg"; then
  4666. func_append compile_command " $arg"
  4667. func_append finalize_command " $arg"
  4668. fi
  4669. done # argument parsing loop
  4670. test -n "$prev" && \
  4671. func_fatal_help "the \`$prevarg' option requires an argument"
  4672. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  4673. eval arg=\"$export_dynamic_flag_spec\"
  4674. func_append compile_command " $arg"
  4675. func_append finalize_command " $arg"
  4676. fi
  4677. oldlibs=
  4678. # calculate the name of the file, without its directory
  4679. func_basename "$output"
  4680. outputname="$func_basename_result"
  4681. libobjs_save="$libobjs"
  4682. if test -n "$shlibpath_var"; then
  4683. # get the directories listed in $shlibpath_var
  4684. eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  4685. else
  4686. shlib_search_path=
  4687. fi
  4688. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  4689. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  4690. func_dirname "$output" "/" ""
  4691. output_objdir="$func_dirname_result$objdir"
  4692. # Create the object directory.
  4693. func_mkdir_p "$output_objdir"
  4694. # Determine the type of output
  4695. case $output in
  4696. "")
  4697. func_fatal_help "you must specify an output file"
  4698. ;;
  4699. *.$libext) linkmode=oldlib ;;
  4700. *.lo | *.$objext) linkmode=obj ;;
  4701. *.la) linkmode=lib ;;
  4702. *) linkmode=prog ;; # Anything else should be a program.
  4703. esac
  4704. specialdeplibs=
  4705. libs=
  4706. # Find all interdependent deplibs by searching for libraries
  4707. # that are linked more than once (e.g. -la -lb -la)
  4708. for deplib in $deplibs; do
  4709. if $opt_duplicate_deps ; then
  4710. case "$libs " in
  4711. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  4712. esac
  4713. fi
  4714. libs="$libs $deplib"
  4715. done
  4716. if test "$linkmode" = lib; then
  4717. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  4718. # Compute libraries that are listed more than once in $predeps
  4719. # $postdeps and mark them as special (i.e., whose duplicates are
  4720. # not to be eliminated).
  4721. pre_post_deps=
  4722. if $opt_duplicate_compiler_generated_deps; then
  4723. for pre_post_dep in $predeps $postdeps; do
  4724. case "$pre_post_deps " in
  4725. *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  4726. esac
  4727. pre_post_deps="$pre_post_deps $pre_post_dep"
  4728. done
  4729. fi
  4730. pre_post_deps=
  4731. fi
  4732. deplibs=
  4733. newdependency_libs=
  4734. newlib_search_path=
  4735. need_relink=no # whether we're linking any uninstalled libtool libraries
  4736. notinst_deplibs= # not-installed libtool libraries
  4737. notinst_path= # paths that contain not-installed libtool libraries
  4738. case $linkmode in
  4739. lib)
  4740. passes="conv dlpreopen link"
  4741. for file in $dlfiles $dlprefiles; do
  4742. case $file in
  4743. *.la) ;;
  4744. *)
  4745. func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
  4746. ;;
  4747. esac
  4748. done
  4749. ;;
  4750. prog)
  4751. compile_deplibs=
  4752. finalize_deplibs=
  4753. alldeplibs=no
  4754. newdlfiles=
  4755. newdlprefiles=
  4756. passes="conv scan dlopen dlpreopen link"
  4757. ;;
  4758. *) passes="conv"
  4759. ;;
  4760. esac
  4761. for pass in $passes; do
  4762. # The preopen pass in lib mode reverses $deplibs; put it back here
  4763. # so that -L comes before libs that need it for instance...
  4764. if test "$linkmode,$pass" = "lib,link"; then
  4765. ## FIXME: Find the place where the list is rebuilt in the wrong
  4766. ## order, and fix it there properly
  4767. tmp_deplibs=
  4768. for deplib in $deplibs; do
  4769. tmp_deplibs="$deplib $tmp_deplibs"
  4770. done
  4771. deplibs="$tmp_deplibs"
  4772. fi
  4773. if test "$linkmode,$pass" = "lib,link" ||
  4774. test "$linkmode,$pass" = "prog,scan"; then
  4775. libs="$deplibs"
  4776. deplibs=
  4777. fi
  4778. if test "$linkmode" = prog; then
  4779. case $pass in
  4780. dlopen) libs="$dlfiles" ;;
  4781. dlpreopen) libs="$dlprefiles" ;;
  4782. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  4783. esac
  4784. fi
  4785. if test "$linkmode,$pass" = "lib,dlpreopen"; then
  4786. # Collect and forward deplibs of preopened libtool libs
  4787. for lib in $dlprefiles; do
  4788. # Ignore non-libtool-libs
  4789. dependency_libs=
  4790. case $lib in
  4791. *.la) func_source "$lib" ;;
  4792. esac
  4793. # Collect preopened libtool deplibs, except any this library
  4794. # has declared as weak libs
  4795. for deplib in $dependency_libs; do
  4796. deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
  4797. case " $weak_libs " in
  4798. *" $deplib_base "*) ;;
  4799. *) deplibs="$deplibs $deplib" ;;
  4800. esac
  4801. done
  4802. done
  4803. libs="$dlprefiles"
  4804. fi
  4805. if test "$pass" = dlopen; then
  4806. # Collect dlpreopened libraries
  4807. save_deplibs="$deplibs"
  4808. deplibs=
  4809. fi
  4810. for deplib in $libs; do
  4811. lib=
  4812. found=no
  4813. case $deplib in
  4814. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  4815. if test "$linkmode,$pass" = "prog,link"; then
  4816. compile_deplibs="$deplib $compile_deplibs"
  4817. finalize_deplibs="$deplib $finalize_deplibs"
  4818. else
  4819. compiler_flags="$compiler_flags $deplib"
  4820. if test "$linkmode" = lib ; then
  4821. case "$new_inherited_linker_flags " in
  4822. *" $deplib "*) ;;
  4823. * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
  4824. esac
  4825. fi
  4826. fi
  4827. continue
  4828. ;;
  4829. -l*)
  4830. if test "$linkmode" != lib && test "$linkmode" != prog; then
  4831. func_warning "\`-l' is ignored for archives/objects"
  4832. continue
  4833. fi
  4834. func_stripname '-l' '' "$deplib"
  4835. name=$func_stripname_result
  4836. if test "$linkmode" = lib; then
  4837. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  4838. else
  4839. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  4840. fi
  4841. for searchdir in $searchdirs; do
  4842. for search_ext in .la $std_shrext .so .a; do
  4843. # Search the libtool library
  4844. lib="$searchdir/lib${name}${search_ext}"
  4845. if test -f "$lib"; then
  4846. if test "$search_ext" = ".la"; then
  4847. found=yes
  4848. else
  4849. found=no
  4850. fi
  4851. break 2
  4852. fi
  4853. done
  4854. done
  4855. if test "$found" != yes; then
  4856. # deplib doesn't seem to be a libtool library
  4857. if test "$linkmode,$pass" = "prog,link"; then
  4858. compile_deplibs="$deplib $compile_deplibs"
  4859. finalize_deplibs="$deplib $finalize_deplibs"
  4860. else
  4861. deplibs="$deplib $deplibs"
  4862. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  4863. fi
  4864. continue
  4865. else # deplib is a libtool library
  4866. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  4867. # We need to do some special things here, and not later.
  4868. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  4869. case " $predeps $postdeps " in
  4870. *" $deplib "*)
  4871. if func_lalib_p "$lib"; then
  4872. library_names=
  4873. old_library=
  4874. func_source "$lib"
  4875. for l in $old_library $library_names; do
  4876. ll="$l"
  4877. done
  4878. if test "X$ll" = "X$old_library" ; then # only static version available
  4879. found=no
  4880. func_dirname "$lib" "" "."
  4881. ladir="$func_dirname_result"
  4882. lib=$ladir/$old_library
  4883. if test "$linkmode,$pass" = "prog,link"; then
  4884. compile_deplibs="$deplib $compile_deplibs"
  4885. finalize_deplibs="$deplib $finalize_deplibs"
  4886. else
  4887. deplibs="$deplib $deplibs"
  4888. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  4889. fi
  4890. continue
  4891. fi
  4892. fi
  4893. ;;
  4894. *) ;;
  4895. esac
  4896. fi
  4897. fi
  4898. ;; # -l
  4899. *.ltframework)
  4900. if test "$linkmode,$pass" = "prog,link"; then
  4901. compile_deplibs="$deplib $compile_deplibs"
  4902. finalize_deplibs="$deplib $finalize_deplibs"
  4903. else
  4904. deplibs="$deplib $deplibs"
  4905. if test "$linkmode" = lib ; then
  4906. case "$new_inherited_linker_flags " in
  4907. *" $deplib "*) ;;
  4908. * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
  4909. esac
  4910. fi
  4911. fi
  4912. continue
  4913. ;;
  4914. -L*)
  4915. case $linkmode in
  4916. lib)
  4917. deplibs="$deplib $deplibs"
  4918. test "$pass" = conv && continue
  4919. newdependency_libs="$deplib $newdependency_libs"
  4920. func_stripname '-L' '' "$deplib"
  4921. newlib_search_path="$newlib_search_path $func_stripname_result"
  4922. ;;
  4923. prog)
  4924. if test "$pass" = conv; then
  4925. deplibs="$deplib $deplibs"
  4926. continue
  4927. fi
  4928. if test "$pass" = scan; then
  4929. deplibs="$deplib $deplibs"
  4930. else
  4931. compile_deplibs="$deplib $compile_deplibs"
  4932. finalize_deplibs="$deplib $finalize_deplibs"
  4933. fi
  4934. func_stripname '-L' '' "$deplib"
  4935. newlib_search_path="$newlib_search_path $func_stripname_result"
  4936. ;;
  4937. *)
  4938. func_warning "\`-L' is ignored for archives/objects"
  4939. ;;
  4940. esac # linkmode
  4941. continue
  4942. ;; # -L
  4943. -R*)
  4944. if test "$pass" = link; then
  4945. func_stripname '-R' '' "$deplib"
  4946. dir=$func_stripname_result
  4947. # Make sure the xrpath contains only unique directories.
  4948. case "$xrpath " in
  4949. *" $dir "*) ;;
  4950. *) xrpath="$xrpath $dir" ;;
  4951. esac
  4952. fi
  4953. deplibs="$deplib $deplibs"
  4954. continue
  4955. ;;
  4956. *.la) lib="$deplib" ;;
  4957. *.$libext)
  4958. if test "$pass" = conv; then
  4959. deplibs="$deplib $deplibs"
  4960. continue
  4961. fi
  4962. case $linkmode in
  4963. lib)
  4964. # Linking convenience modules into shared libraries is allowed,
  4965. # but linking other static libraries is non-portable.
  4966. case " $dlpreconveniencelibs " in
  4967. *" $deplib "*) ;;
  4968. *)
  4969. valid_a_lib=no
  4970. case $deplibs_check_method in
  4971. match_pattern*)
  4972. set dummy $deplibs_check_method; shift
  4973. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  4974. if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
  4975. | $EGREP "$match_pattern_regex" > /dev/null; then
  4976. valid_a_lib=yes
  4977. fi
  4978. ;;
  4979. pass_all)
  4980. valid_a_lib=yes
  4981. ;;
  4982. esac
  4983. if test "$valid_a_lib" != yes; then
  4984. $ECHO
  4985. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  4986. $ECHO "*** I have the capability to make that library automatically link in when"
  4987. $ECHO "*** you link to this library. But I can only do this if you have a"
  4988. $ECHO "*** shared version of the library, which you do not appear to have"
  4989. $ECHO "*** because the file extensions .$libext of this argument makes me believe"
  4990. $ECHO "*** that it is just a static archive that I should not use here."
  4991. else
  4992. $ECHO
  4993. $ECHO "*** Warning: Linking the shared library $output against the"
  4994. $ECHO "*** static library $deplib is not portable!"
  4995. deplibs="$deplib $deplibs"
  4996. fi
  4997. ;;
  4998. esac
  4999. continue
  5000. ;;
  5001. prog)
  5002. if test "$pass" != link; then
  5003. deplibs="$deplib $deplibs"
  5004. else
  5005. compile_deplibs="$deplib $compile_deplibs"
  5006. finalize_deplibs="$deplib $finalize_deplibs"
  5007. fi
  5008. continue
  5009. ;;
  5010. esac # linkmode
  5011. ;; # *.$libext
  5012. *.lo | *.$objext)
  5013. if test "$pass" = conv; then
  5014. deplibs="$deplib $deplibs"
  5015. elif test "$linkmode" = prog; then
  5016. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  5017. # If there is no dlopen support or we're linking statically,
  5018. # we need to preload.
  5019. newdlprefiles="$newdlprefiles $deplib"
  5020. compile_deplibs="$deplib $compile_deplibs"
  5021. finalize_deplibs="$deplib $finalize_deplibs"
  5022. else
  5023. newdlfiles="$newdlfiles $deplib"
  5024. fi
  5025. fi
  5026. continue
  5027. ;;
  5028. %DEPLIBS%)
  5029. alldeplibs=yes
  5030. continue
  5031. ;;
  5032. esac # case $deplib
  5033. if test "$found" = yes || test -f "$lib"; then :
  5034. else
  5035. func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
  5036. fi
  5037. # Check to see that this really is a libtool archive.
  5038. func_lalib_unsafe_p "$lib" \
  5039. || func_fatal_error "\`$lib' is not a valid libtool archive"
  5040. func_dirname "$lib" "" "."
  5041. ladir="$func_dirname_result"
  5042. dlname=
  5043. dlopen=
  5044. dlpreopen=
  5045. libdir=
  5046. library_names=
  5047. old_library=
  5048. inherited_linker_flags=
  5049. # If the library was installed with an old release of libtool,
  5050. # it will not redefine variables installed, or shouldnotlink
  5051. installed=yes
  5052. shouldnotlink=no
  5053. avoidtemprpath=
  5054. # Read the .la file
  5055. func_source "$lib"
  5056. # Convert "-framework foo" to "foo.ltframework"
  5057. if test -n "$inherited_linker_flags"; then
  5058. tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
  5059. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  5060. case " $new_inherited_linker_flags " in
  5061. *" $tmp_inherited_linker_flag "*) ;;
  5062. *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
  5063. esac
  5064. done
  5065. fi
  5066. dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  5067. if test "$linkmode,$pass" = "lib,link" ||
  5068. test "$linkmode,$pass" = "prog,scan" ||
  5069. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  5070. test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  5071. test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  5072. fi
  5073. if test "$pass" = conv; then
  5074. # Only check for convenience libraries
  5075. deplibs="$lib $deplibs"
  5076. if test -z "$libdir"; then
  5077. if test -z "$old_library"; then
  5078. func_fatal_error "cannot find name of link library for \`$lib'"
  5079. fi
  5080. # It is a libtool convenience library, so add in its objects.
  5081. convenience="$convenience $ladir/$objdir/$old_library"
  5082. old_convenience="$old_convenience $ladir/$objdir/$old_library"
  5083. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  5084. func_fatal_error "\`$lib' is not a convenience library"
  5085. fi
  5086. tmp_libs=
  5087. for deplib in $dependency_libs; do
  5088. deplibs="$deplib $deplibs"
  5089. if $opt_duplicate_deps ; then
  5090. case "$tmp_libs " in
  5091. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  5092. esac
  5093. fi
  5094. tmp_libs="$tmp_libs $deplib"
  5095. done
  5096. continue
  5097. fi # $pass = conv
  5098. # Get the name of the library we link against.
  5099. linklib=
  5100. for l in $old_library $library_names; do
  5101. linklib="$l"
  5102. done
  5103. if test -z "$linklib"; then
  5104. func_fatal_error "cannot find name of link library for \`$lib'"
  5105. fi
  5106. # This library was specified with -dlopen.
  5107. if test "$pass" = dlopen; then
  5108. if test -z "$libdir"; then
  5109. func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
  5110. fi
  5111. if test -z "$dlname" ||
  5112. test "$dlopen_support" != yes ||
  5113. test "$build_libtool_libs" = no; then
  5114. # If there is no dlname, no dlopen support or we're linking
  5115. # statically, we need to preload. We also need to preload any
  5116. # dependent libraries so libltdl's deplib preloader doesn't
  5117. # bomb out in the load deplibs phase.
  5118. dlprefiles="$dlprefiles $lib $dependency_libs"
  5119. else
  5120. newdlfiles="$newdlfiles $lib"
  5121. fi
  5122. continue
  5123. fi # $pass = dlopen
  5124. # We need an absolute path.
  5125. case $ladir in
  5126. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  5127. *)
  5128. abs_ladir=`cd "$ladir" && pwd`
  5129. if test -z "$abs_ladir"; then
  5130. func_warning "cannot determine absolute directory name of \`$ladir'"
  5131. func_warning "passing it literally to the linker, although it might fail"
  5132. abs_ladir="$ladir"
  5133. fi
  5134. ;;
  5135. esac
  5136. func_basename "$lib"
  5137. laname="$func_basename_result"
  5138. # Find the relevant object directory and library name.
  5139. if test "X$installed" = Xyes; then
  5140. if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  5141. func_warning "library \`$lib' was moved."
  5142. dir="$ladir"
  5143. absdir="$abs_ladir"
  5144. libdir="$abs_ladir"
  5145. else
  5146. dir="$libdir"
  5147. absdir="$libdir"
  5148. fi
  5149. test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
  5150. else
  5151. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  5152. dir="$ladir"
  5153. absdir="$abs_ladir"
  5154. # Remove this search path later
  5155. notinst_path="$notinst_path $abs_ladir"
  5156. else
  5157. dir="$ladir/$objdir"
  5158. absdir="$abs_ladir/$objdir"
  5159. # Remove this search path later
  5160. notinst_path="$notinst_path $abs_ladir"
  5161. fi
  5162. fi # $installed = yes
  5163. func_stripname 'lib' '.la' "$laname"
  5164. name=$func_stripname_result
  5165. # This library was specified with -dlpreopen.
  5166. if test "$pass" = dlpreopen; then
  5167. if test -z "$libdir" && test "$linkmode" = prog; then
  5168. func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
  5169. fi
  5170. # Prefer using a static library (so that no silly _DYNAMIC symbols
  5171. # are required to link).
  5172. if test -n "$old_library"; then
  5173. newdlprefiles="$newdlprefiles $dir/$old_library"
  5174. # Keep a list of preopened convenience libraries to check
  5175. # that they are being used correctly in the link pass.
  5176. test -z "$libdir" && \
  5177. dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
  5178. # Otherwise, use the dlname, so that lt_dlopen finds it.
  5179. elif test -n "$dlname"; then
  5180. newdlprefiles="$newdlprefiles $dir/$dlname"
  5181. else
  5182. newdlprefiles="$newdlprefiles $dir/$linklib"
  5183. fi
  5184. fi # $pass = dlpreopen
  5185. if test -z "$libdir"; then
  5186. # Link the convenience library
  5187. if test "$linkmode" = lib; then
  5188. deplibs="$dir/$old_library $deplibs"
  5189. elif test "$linkmode,$pass" = "prog,link"; then
  5190. compile_deplibs="$dir/$old_library $compile_deplibs"
  5191. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  5192. else
  5193. deplibs="$lib $deplibs" # used for prog,scan pass
  5194. fi
  5195. continue
  5196. fi
  5197. if test "$linkmode" = prog && test "$pass" != link; then
  5198. newlib_search_path="$newlib_search_path $ladir"
  5199. deplibs="$lib $deplibs"
  5200. linkalldeplibs=no
  5201. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  5202. test "$build_libtool_libs" = no; then
  5203. linkalldeplibs=yes
  5204. fi
  5205. tmp_libs=
  5206. for deplib in $dependency_libs; do
  5207. case $deplib in
  5208. -L*) func_stripname '-L' '' "$deplib"
  5209. newlib_search_path="$newlib_search_path $func_stripname_result"
  5210. ;;
  5211. esac
  5212. # Need to link against all dependency_libs?
  5213. if test "$linkalldeplibs" = yes; then
  5214. deplibs="$deplib $deplibs"
  5215. else
  5216. # Need to hardcode shared library paths
  5217. # or/and link against static libraries
  5218. newdependency_libs="$deplib $newdependency_libs"
  5219. fi
  5220. if $opt_duplicate_deps ; then
  5221. case "$tmp_libs " in
  5222. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  5223. esac
  5224. fi
  5225. tmp_libs="$tmp_libs $deplib"
  5226. done # for deplib
  5227. continue
  5228. fi # $linkmode = prog...
  5229. if test "$linkmode,$pass" = "prog,link"; then
  5230. if test -n "$library_names" &&
  5231. { { test "$prefer_static_libs" = no ||
  5232. test "$prefer_static_libs,$installed" = "built,yes"; } ||
  5233. test -z "$old_library"; }; then
  5234. # We need to hardcode the library path
  5235. if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  5236. # Make sure the rpath contains only unique directories.
  5237. case "$temp_rpath:" in
  5238. *"$absdir:"*) ;;
  5239. *) temp_rpath="$temp_rpath$absdir:" ;;
  5240. esac
  5241. fi
  5242. # Hardcode the library path.
  5243. # Skip directories that are in the system default run-time
  5244. # search path.
  5245. case " $sys_lib_dlsearch_path " in
  5246. *" $absdir "*) ;;
  5247. *)
  5248. case "$compile_rpath " in
  5249. *" $absdir "*) ;;
  5250. *) compile_rpath="$compile_rpath $absdir"
  5251. esac
  5252. ;;
  5253. esac
  5254. case " $sys_lib_dlsearch_path " in
  5255. *" $libdir "*) ;;
  5256. *)
  5257. case "$finalize_rpath " in
  5258. *" $libdir "*) ;;
  5259. *) finalize_rpath="$finalize_rpath $libdir"
  5260. esac
  5261. ;;
  5262. esac
  5263. fi # $linkmode,$pass = prog,link...
  5264. if test "$alldeplibs" = yes &&
  5265. { test "$deplibs_check_method" = pass_all ||
  5266. { test "$build_libtool_libs" = yes &&
  5267. test -n "$library_names"; }; }; then
  5268. # We only need to search for static libraries
  5269. continue
  5270. fi
  5271. fi
  5272. link_static=no # Whether the deplib will be linked statically
  5273. use_static_libs=$prefer_static_libs
  5274. if test "$use_static_libs" = built && test "$installed" = yes; then
  5275. use_static_libs=no
  5276. fi
  5277. if test -n "$library_names" &&
  5278. { test "$use_static_libs" = no || test -z "$old_library"; }; then
  5279. case $host in
  5280. *cygwin* | *mingw* | *cegcc*)
  5281. # No point in relinking DLLs because paths are not encoded
  5282. notinst_deplibs="$notinst_deplibs $lib"
  5283. need_relink=no
  5284. ;;
  5285. *)
  5286. if test "$installed" = no; then
  5287. notinst_deplibs="$notinst_deplibs $lib"
  5288. need_relink=yes
  5289. fi
  5290. ;;
  5291. esac
  5292. # This is a shared library
  5293. # Warn about portability, can't link against -module's on some
  5294. # systems (darwin). Don't bleat about dlopened modules though!
  5295. dlopenmodule=""
  5296. for dlpremoduletest in $dlprefiles; do
  5297. if test "X$dlpremoduletest" = "X$lib"; then
  5298. dlopenmodule="$dlpremoduletest"
  5299. break
  5300. fi
  5301. done
  5302. if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
  5303. $ECHO
  5304. if test "$linkmode" = prog; then
  5305. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  5306. else
  5307. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  5308. fi
  5309. $ECHO "*** $linklib is not portable!"
  5310. fi
  5311. if test "$linkmode" = lib &&
  5312. test "$hardcode_into_libs" = yes; then
  5313. # Hardcode the library path.
  5314. # Skip directories that are in the system default run-time
  5315. # search path.
  5316. case " $sys_lib_dlsearch_path " in
  5317. *" $absdir "*) ;;
  5318. *)
  5319. case "$compile_rpath " in
  5320. *" $absdir "*) ;;
  5321. *) compile_rpath="$compile_rpath $absdir"
  5322. esac
  5323. ;;
  5324. esac
  5325. case " $sys_lib_dlsearch_path " in
  5326. *" $libdir "*) ;;
  5327. *)
  5328. case "$finalize_rpath " in
  5329. *" $libdir "*) ;;
  5330. *) finalize_rpath="$finalize_rpath $libdir"
  5331. esac
  5332. ;;
  5333. esac
  5334. fi
  5335. if test -n "$old_archive_from_expsyms_cmds"; then
  5336. # figure out the soname
  5337. set dummy $library_names
  5338. shift
  5339. realname="$1"
  5340. shift
  5341. libname=`eval "\\$ECHO \"$libname_spec\""`
  5342. # use dlname if we got it. it's perfectly good, no?
  5343. if test -n "$dlname"; then
  5344. soname="$dlname"
  5345. elif test -n "$soname_spec"; then
  5346. # bleh windows
  5347. case $host in
  5348. *cygwin* | mingw* | *cegcc*)
  5349. func_arith $current - $age
  5350. major=$func_arith_result
  5351. versuffix="-$major"
  5352. ;;
  5353. esac
  5354. eval soname=\"$soname_spec\"
  5355. else
  5356. soname="$realname"
  5357. fi
  5358. # Make a new name for the extract_expsyms_cmds to use
  5359. soroot="$soname"
  5360. func_basename "$soroot"
  5361. soname="$func_basename_result"
  5362. func_stripname 'lib' '.dll' "$soname"
  5363. newlib=libimp-$func_stripname_result.a
  5364. # If the library has no export list, then create one now
  5365. if test -f "$output_objdir/$soname-def"; then :
  5366. else
  5367. func_verbose "extracting exported symbol list from \`$soname'"
  5368. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  5369. fi
  5370. # Create $newlib
  5371. if test -f "$output_objdir/$newlib"; then :; else
  5372. func_verbose "generating import library for \`$soname'"
  5373. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  5374. fi
  5375. # make sure the library variables are pointing to the new library
  5376. dir=$output_objdir
  5377. linklib=$newlib
  5378. fi # test -n "$old_archive_from_expsyms_cmds"
  5379. if test "$linkmode" = prog || test "$mode" != relink; then
  5380. add_shlibpath=
  5381. add_dir=
  5382. add=
  5383. lib_linked=yes
  5384. case $hardcode_action in
  5385. immediate | unsupported)
  5386. if test "$hardcode_direct" = no; then
  5387. add="$dir/$linklib"
  5388. case $host in
  5389. *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
  5390. *-*-sysv4*uw2*) add_dir="-L$dir" ;;
  5391. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  5392. *-*-unixware7*) add_dir="-L$dir" ;;
  5393. *-*-darwin* )
  5394. # if the lib is a (non-dlopened) module then we can not
  5395. # link against it, someone is ignoring the earlier warnings
  5396. if /usr/bin/file -L $add 2> /dev/null |
  5397. $GREP ": [^:]* bundle" >/dev/null ; then
  5398. if test "X$dlopenmodule" != "X$lib"; then
  5399. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  5400. if test -z "$old_library" ; then
  5401. $ECHO
  5402. $ECHO "*** And there doesn't seem to be a static archive available"
  5403. $ECHO "*** The link will probably fail, sorry"
  5404. else
  5405. add="$dir/$old_library"
  5406. fi
  5407. elif test -n "$old_library"; then
  5408. add="$dir/$old_library"
  5409. fi
  5410. fi
  5411. esac
  5412. elif test "$hardcode_minus_L" = no; then
  5413. case $host in
  5414. *-*-sunos*) add_shlibpath="$dir" ;;
  5415. esac
  5416. add_dir="-L$dir"
  5417. add="-l$name"
  5418. elif test "$hardcode_shlibpath_var" = no; then
  5419. add_shlibpath="$dir"
  5420. add="-l$name"
  5421. else
  5422. lib_linked=no
  5423. fi
  5424. ;;
  5425. relink)
  5426. if test "$hardcode_direct" = yes &&
  5427. test "$hardcode_direct_absolute" = no; then
  5428. add="$dir/$linklib"
  5429. elif test "$hardcode_minus_L" = yes; then
  5430. add_dir="-L$dir"
  5431. # Try looking first in the location we're being installed to.
  5432. if test -n "$inst_prefix_dir"; then
  5433. case $libdir in
  5434. [\\/]*)
  5435. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  5436. ;;
  5437. esac
  5438. fi
  5439. add="-l$name"
  5440. elif test "$hardcode_shlibpath_var" = yes; then
  5441. add_shlibpath="$dir"
  5442. add="-l$name"
  5443. else
  5444. lib_linked=no
  5445. fi
  5446. ;;
  5447. *) lib_linked=no ;;
  5448. esac
  5449. if test "$lib_linked" != yes; then
  5450. func_fatal_configuration "unsupported hardcode properties"
  5451. fi
  5452. if test -n "$add_shlibpath"; then
  5453. case :$compile_shlibpath: in
  5454. *":$add_shlibpath:"*) ;;
  5455. *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  5456. esac
  5457. fi
  5458. if test "$linkmode" = prog; then
  5459. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  5460. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  5461. else
  5462. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  5463. test -n "$add" && deplibs="$add $deplibs"
  5464. if test "$hardcode_direct" != yes &&
  5465. test "$hardcode_minus_L" != yes &&
  5466. test "$hardcode_shlibpath_var" = yes; then
  5467. case :$finalize_shlibpath: in
  5468. *":$libdir:"*) ;;
  5469. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  5470. esac
  5471. fi
  5472. fi
  5473. fi
  5474. if test "$linkmode" = prog || test "$mode" = relink; then
  5475. add_shlibpath=
  5476. add_dir=
  5477. add=
  5478. # Finalize command for both is simple: just hardcode it.
  5479. if test "$hardcode_direct" = yes &&
  5480. test "$hardcode_direct_absolute" = no; then
  5481. add="$libdir/$linklib"
  5482. elif test "$hardcode_minus_L" = yes; then
  5483. add_dir="-L$libdir"
  5484. add="-l$name"
  5485. elif test "$hardcode_shlibpath_var" = yes; then
  5486. case :$finalize_shlibpath: in
  5487. *":$libdir:"*) ;;
  5488. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  5489. esac
  5490. add="-l$name"
  5491. elif test "$hardcode_automatic" = yes; then
  5492. if test -n "$inst_prefix_dir" &&
  5493. test -f "$inst_prefix_dir$libdir/$linklib" ; then
  5494. add="$inst_prefix_dir$libdir/$linklib"
  5495. else
  5496. add="$libdir/$linklib"
  5497. fi
  5498. else
  5499. # We cannot seem to hardcode it, guess we'll fake it.
  5500. add_dir="-L$libdir"
  5501. # Try looking first in the location we're being installed to.
  5502. if test -n "$inst_prefix_dir"; then
  5503. case $libdir in
  5504. [\\/]*)
  5505. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  5506. ;;
  5507. esac
  5508. fi
  5509. add="-l$name"
  5510. fi
  5511. if test "$linkmode" = prog; then
  5512. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  5513. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  5514. else
  5515. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  5516. test -n "$add" && deplibs="$add $deplibs"
  5517. fi
  5518. fi
  5519. elif test "$linkmode" = prog; then
  5520. # Here we assume that one of hardcode_direct or hardcode_minus_L
  5521. # is not unsupported. This is valid on all known static and
  5522. # shared platforms.
  5523. if test "$hardcode_direct" != unsupported; then
  5524. test -n "$old_library" && linklib="$old_library"
  5525. compile_deplibs="$dir/$linklib $compile_deplibs"
  5526. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  5527. else
  5528. compile_deplibs="-l$name -L$dir $compile_deplibs"
  5529. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  5530. fi
  5531. elif test "$build_libtool_libs" = yes; then
  5532. # Not a shared library
  5533. if test "$deplibs_check_method" != pass_all; then
  5534. # We're trying link a shared library against a static one
  5535. # but the system doesn't support it.
  5536. # Just print a warning and add the library to dependency_libs so
  5537. # that the program can be linked against the static library.
  5538. $ECHO
  5539. $ECHO "*** Warning: This system can not link to static lib archive $lib."
  5540. $ECHO "*** I have the capability to make that library automatically link in when"
  5541. $ECHO "*** you link to this library. But I can only do this if you have a"
  5542. $ECHO "*** shared version of the library, which you do not appear to have."
  5543. if test "$module" = yes; then
  5544. $ECHO "*** But as you try to build a module library, libtool will still create "
  5545. $ECHO "*** a static module, that should work as long as the dlopening application"
  5546. $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
  5547. if test -z "$global_symbol_pipe"; then
  5548. $ECHO
  5549. $ECHO "*** However, this would only work if libtool was able to extract symbol"
  5550. $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
  5551. $ECHO "*** not find such a program. So, this module is probably useless."
  5552. $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
  5553. fi
  5554. if test "$build_old_libs" = no; then
  5555. build_libtool_libs=module
  5556. build_old_libs=yes
  5557. else
  5558. build_libtool_libs=no
  5559. fi
  5560. fi
  5561. else
  5562. deplibs="$dir/$old_library $deplibs"
  5563. link_static=yes
  5564. fi
  5565. fi # link shared/static library?
  5566. if test "$linkmode" = lib; then
  5567. if test -n "$dependency_libs" &&
  5568. { test "$hardcode_into_libs" != yes ||
  5569. test "$build_old_libs" = yes ||
  5570. test "$link_static" = yes; }; then
  5571. # Extract -R from dependency_libs
  5572. temp_deplibs=
  5573. for libdir in $dependency_libs; do
  5574. case $libdir in
  5575. -R*) func_stripname '-R' '' "$libdir"
  5576. temp_xrpath=$func_stripname_result
  5577. case " $xrpath " in
  5578. *" $temp_xrpath "*) ;;
  5579. *) xrpath="$xrpath $temp_xrpath";;
  5580. esac;;
  5581. *) temp_deplibs="$temp_deplibs $libdir";;
  5582. esac
  5583. done
  5584. dependency_libs="$temp_deplibs"
  5585. fi
  5586. newlib_search_path="$newlib_search_path $absdir"
  5587. # Link against this library
  5588. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  5589. # ... and its dependency_libs
  5590. tmp_libs=
  5591. for deplib in $dependency_libs; do
  5592. newdependency_libs="$deplib $newdependency_libs"
  5593. if $opt_duplicate_deps ; then
  5594. case "$tmp_libs " in
  5595. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  5596. esac
  5597. fi
  5598. tmp_libs="$tmp_libs $deplib"
  5599. done
  5600. if test "$link_all_deplibs" != no; then
  5601. # Add the search paths of all dependency libraries
  5602. for deplib in $dependency_libs; do
  5603. case $deplib in
  5604. -L*) path="$deplib" ;;
  5605. *.la)
  5606. func_dirname "$deplib" "" "."
  5607. dir="$func_dirname_result"
  5608. # We need an absolute path.
  5609. case $dir in
  5610. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  5611. *)
  5612. absdir=`cd "$dir" && pwd`
  5613. if test -z "$absdir"; then
  5614. func_warning "cannot determine absolute directory name of \`$dir'"
  5615. absdir="$dir"
  5616. fi
  5617. ;;
  5618. esac
  5619. if $GREP "^installed=no" $deplib > /dev/null; then
  5620. case $host in
  5621. *-*-darwin*)
  5622. depdepl=
  5623. eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  5624. if test -n "$deplibrary_names" ; then
  5625. for tmp in $deplibrary_names ; do
  5626. depdepl=$tmp
  5627. done
  5628. if test -f "$absdir/$objdir/$depdepl" ; then
  5629. depdepl="$absdir/$objdir/$depdepl"
  5630. darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  5631. if test -z "$darwin_install_name"; then
  5632. darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  5633. fi
  5634. compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
  5635. linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
  5636. path=
  5637. fi
  5638. fi
  5639. ;;
  5640. *)
  5641. path="-L$absdir/$objdir"
  5642. ;;
  5643. esac
  5644. else
  5645. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  5646. test -z "$libdir" && \
  5647. func_fatal_error "\`$deplib' is not a valid libtool archive"
  5648. test "$absdir" != "$libdir" && \
  5649. func_warning "\`$deplib' seems to be moved"
  5650. path="-L$absdir"
  5651. fi
  5652. ;;
  5653. esac
  5654. case " $deplibs " in
  5655. *" $path "*) ;;
  5656. *) deplibs="$path $deplibs" ;;
  5657. esac
  5658. done
  5659. fi # link_all_deplibs != no
  5660. fi # linkmode = lib
  5661. done # for deplib in $libs
  5662. if test "$pass" = link; then
  5663. if test "$linkmode" = "prog"; then
  5664. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  5665. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  5666. else
  5667. compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  5668. fi
  5669. fi
  5670. dependency_libs="$newdependency_libs"
  5671. if test "$pass" = dlpreopen; then
  5672. # Link the dlpreopened libraries before other libraries
  5673. for deplib in $save_deplibs; do
  5674. deplibs="$deplib $deplibs"
  5675. done
  5676. fi
  5677. if test "$pass" != dlopen; then
  5678. if test "$pass" != conv; then
  5679. # Make sure lib_search_path contains only unique directories.
  5680. lib_search_path=
  5681. for dir in $newlib_search_path; do
  5682. case "$lib_search_path " in
  5683. *" $dir "*) ;;
  5684. *) lib_search_path="$lib_search_path $dir" ;;
  5685. esac
  5686. done
  5687. newlib_search_path=
  5688. fi
  5689. if test "$linkmode,$pass" != "prog,link"; then
  5690. vars="deplibs"
  5691. else
  5692. vars="compile_deplibs finalize_deplibs"
  5693. fi
  5694. for var in $vars dependency_libs; do
  5695. # Add libraries to $var in reverse order
  5696. eval tmp_libs=\"\$$var\"
  5697. new_libs=
  5698. for deplib in $tmp_libs; do
  5699. # FIXME: Pedantically, this is the right thing to do, so
  5700. # that some nasty dependency loop isn't accidentally
  5701. # broken:
  5702. #new_libs="$deplib $new_libs"
  5703. # Pragmatically, this seems to cause very few problems in
  5704. # practice:
  5705. case $deplib in
  5706. -L*) new_libs="$deplib $new_libs" ;;
  5707. -R*) ;;
  5708. *)
  5709. # And here is the reason: when a library appears more
  5710. # than once as an explicit dependence of a library, or
  5711. # is implicitly linked in more than once by the
  5712. # compiler, it is considered special, and multiple
  5713. # occurrences thereof are not removed. Compare this
  5714. # with having the same library being listed as a
  5715. # dependency of multiple other libraries: in this case,
  5716. # we know (pedantically, we assume) the library does not
  5717. # need to be listed more than once, so we keep only the
  5718. # last copy. This is not always right, but it is rare
  5719. # enough that we require users that really mean to play
  5720. # such unportable linking tricks to link the library
  5721. # using -Wl,-lname, so that libtool does not consider it
  5722. # for duplicate removal.
  5723. case " $specialdeplibs " in
  5724. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  5725. *)
  5726. case " $new_libs " in
  5727. *" $deplib "*) ;;
  5728. *) new_libs="$deplib $new_libs" ;;
  5729. esac
  5730. ;;
  5731. esac
  5732. ;;
  5733. esac
  5734. done
  5735. tmp_libs=
  5736. for deplib in $new_libs; do
  5737. case $deplib in
  5738. -L*)
  5739. case " $tmp_libs " in
  5740. *" $deplib "*) ;;
  5741. *) tmp_libs="$tmp_libs $deplib" ;;
  5742. esac
  5743. ;;
  5744. *) tmp_libs="$tmp_libs $deplib" ;;
  5745. esac
  5746. done
  5747. eval $var=\"$tmp_libs\"
  5748. done # for var
  5749. fi
  5750. # Last step: remove runtime libs from dependency_libs
  5751. # (they stay in deplibs)
  5752. tmp_libs=
  5753. for i in $dependency_libs ; do
  5754. case " $predeps $postdeps $compiler_lib_search_path " in
  5755. *" $i "*)
  5756. i=""
  5757. ;;
  5758. esac
  5759. if test -n "$i" ; then
  5760. tmp_libs="$tmp_libs $i"
  5761. fi
  5762. done
  5763. dependency_libs=$tmp_libs
  5764. done # for pass
  5765. if test "$linkmode" = prog; then
  5766. dlfiles="$newdlfiles"
  5767. fi
  5768. if test "$linkmode" = prog || test "$linkmode" = lib; then
  5769. dlprefiles="$newdlprefiles"
  5770. fi
  5771. case $linkmode in
  5772. oldlib)
  5773. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  5774. func_warning "\`-dlopen' is ignored for archives"
  5775. fi
  5776. case " $deplibs" in
  5777. *\ -l* | *\ -L*)
  5778. func_warning "\`-l' and \`-L' are ignored for archives" ;;
  5779. esac
  5780. test -n "$rpath" && \
  5781. func_warning "\`-rpath' is ignored for archives"
  5782. test -n "$xrpath" && \
  5783. func_warning "\`-R' is ignored for archives"
  5784. test -n "$vinfo" && \
  5785. func_warning "\`-version-info/-version-number' is ignored for archives"
  5786. test -n "$release" && \
  5787. func_warning "\`-release' is ignored for archives"
  5788. test -n "$export_symbols$export_symbols_regex" && \
  5789. func_warning "\`-export-symbols' is ignored for archives"
  5790. # Now set the variables for building old libraries.
  5791. build_libtool_libs=no
  5792. oldlibs="$output"
  5793. objs="$objs$old_deplibs"
  5794. ;;
  5795. lib)
  5796. # Make sure we only generate libraries of the form `libNAME.la'.
  5797. case $outputname in
  5798. lib*)
  5799. func_stripname 'lib' '.la' "$outputname"
  5800. name=$func_stripname_result
  5801. eval shared_ext=\"$shrext_cmds\"
  5802. eval libname=\"$libname_spec\"
  5803. ;;
  5804. *)
  5805. test "$module" = no && \
  5806. func_fatal_help "libtool library \`$output' must begin with \`lib'"
  5807. if test "$need_lib_prefix" != no; then
  5808. # Add the "lib" prefix for modules if required
  5809. func_stripname '' '.la' "$outputname"
  5810. name=$func_stripname_result
  5811. eval shared_ext=\"$shrext_cmds\"
  5812. eval libname=\"$libname_spec\"
  5813. else
  5814. func_stripname '' '.la' "$outputname"
  5815. libname=$func_stripname_result
  5816. fi
  5817. ;;
  5818. esac
  5819. if test -n "$objs"; then
  5820. if test "$deplibs_check_method" != pass_all; then
  5821. func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
  5822. else
  5823. $ECHO
  5824. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  5825. $ECHO "*** objects $objs is not portable!"
  5826. libobjs="$libobjs $objs"
  5827. fi
  5828. fi
  5829. test "$dlself" != no && \
  5830. func_warning "\`-dlopen self' is ignored for libtool libraries"
  5831. set dummy $rpath
  5832. shift
  5833. test "$#" -gt 1 && \
  5834. func_warning "ignoring multiple \`-rpath's for a libtool library"
  5835. install_libdir="$1"
  5836. oldlibs=
  5837. if test -z "$rpath"; then
  5838. if test "$build_libtool_libs" = yes; then
  5839. # Building a libtool convenience library.
  5840. # Some compilers have problems with a `.al' extension so
  5841. # convenience libraries should have the same extension an
  5842. # archive normally would.
  5843. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  5844. build_libtool_libs=convenience
  5845. build_old_libs=yes
  5846. fi
  5847. test -n "$vinfo" && \
  5848. func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
  5849. test -n "$release" && \
  5850. func_warning "\`-release' is ignored for convenience libraries"
  5851. else
  5852. # Parse the version information argument.
  5853. save_ifs="$IFS"; IFS=':'
  5854. set dummy $vinfo 0 0 0
  5855. shift
  5856. IFS="$save_ifs"
  5857. test -n "$7" && \
  5858. func_fatal_help "too many parameters to \`-version-info'"
  5859. # convert absolute version numbers to libtool ages
  5860. # this retains compatibility with .la files and attempts
  5861. # to make the code below a bit more comprehensible
  5862. case $vinfo_number in
  5863. yes)
  5864. number_major="$1"
  5865. number_minor="$2"
  5866. number_revision="$3"
  5867. #
  5868. # There are really only two kinds -- those that
  5869. # use the current revision as the major version
  5870. # and those that subtract age and use age as
  5871. # a minor version. But, then there is irix
  5872. # which has an extra 1 added just for fun
  5873. #
  5874. case $version_type in
  5875. darwin|linux|osf|windows|none)
  5876. func_arith $number_major + $number_minor
  5877. current=$func_arith_result
  5878. age="$number_minor"
  5879. revision="$number_revision"
  5880. ;;
  5881. freebsd-aout|freebsd-elf|sunos)
  5882. current="$number_major"
  5883. revision="$number_minor"
  5884. age="0"
  5885. ;;
  5886. irix|nonstopux)
  5887. func_arith $number_major + $number_minor
  5888. current=$func_arith_result
  5889. age="$number_minor"
  5890. revision="$number_minor"
  5891. lt_irix_increment=no
  5892. ;;
  5893. esac
  5894. ;;
  5895. no)
  5896. current="$1"
  5897. revision="$2"
  5898. age="$3"
  5899. ;;
  5900. esac
  5901. # Check that each of the things are valid numbers.
  5902. case $current in
  5903. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  5904. *)
  5905. func_error "CURRENT \`$current' must be a nonnegative integer"
  5906. func_fatal_error "\`$vinfo' is not valid version information"
  5907. ;;
  5908. esac
  5909. case $revision in
  5910. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  5911. *)
  5912. func_error "REVISION \`$revision' must be a nonnegative integer"
  5913. func_fatal_error "\`$vinfo' is not valid version information"
  5914. ;;
  5915. esac
  5916. case $age in
  5917. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  5918. *)
  5919. func_error "AGE \`$age' must be a nonnegative integer"
  5920. func_fatal_error "\`$vinfo' is not valid version information"
  5921. ;;
  5922. esac
  5923. if test "$age" -gt "$current"; then
  5924. func_error "AGE \`$age' is greater than the current interface number \`$current'"
  5925. func_fatal_error "\`$vinfo' is not valid version information"
  5926. fi
  5927. # Calculate the version variables.
  5928. major=
  5929. versuffix=
  5930. verstring=
  5931. case $version_type in
  5932. none) ;;
  5933. darwin)
  5934. # Like Linux, but with the current version available in
  5935. # verstring for coding it into the library header
  5936. func_arith $current - $age
  5937. major=.$func_arith_result
  5938. versuffix="$major.$age.$revision"
  5939. # Darwin ld doesn't like 0 for these options...
  5940. func_arith $current + 1
  5941. minor_current=$func_arith_result
  5942. xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  5943. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  5944. ;;
  5945. freebsd-aout)
  5946. major=".$current"
  5947. versuffix=".$current.$revision";
  5948. ;;
  5949. freebsd-elf)
  5950. major=".$current"
  5951. versuffix=".$current"
  5952. ;;
  5953. irix | nonstopux)
  5954. if test "X$lt_irix_increment" = "Xno"; then
  5955. func_arith $current - $age
  5956. else
  5957. func_arith $current - $age + 1
  5958. fi
  5959. major=$func_arith_result
  5960. case $version_type in
  5961. nonstopux) verstring_prefix=nonstopux ;;
  5962. *) verstring_prefix=sgi ;;
  5963. esac
  5964. verstring="$verstring_prefix$major.$revision"
  5965. # Add in all the interfaces that we are compatible with.
  5966. loop=$revision
  5967. while test "$loop" -ne 0; do
  5968. func_arith $revision - $loop
  5969. iface=$func_arith_result
  5970. func_arith $loop - 1
  5971. loop=$func_arith_result
  5972. verstring="$verstring_prefix$major.$iface:$verstring"
  5973. done
  5974. # Before this point, $major must not contain `.'.
  5975. major=.$major
  5976. versuffix="$major.$revision"
  5977. ;;
  5978. linux)
  5979. func_arith $current - $age
  5980. major=.$func_arith_result
  5981. versuffix="$major.$age.$revision"
  5982. ;;
  5983. osf)
  5984. func_arith $current - $age
  5985. major=.$func_arith_result
  5986. versuffix=".$current.$age.$revision"
  5987. verstring="$current.$age.$revision"
  5988. # Add in all the interfaces that we are compatible with.
  5989. loop=$age
  5990. while test "$loop" -ne 0; do
  5991. func_arith $current - $loop
  5992. iface=$func_arith_result
  5993. func_arith $loop - 1
  5994. loop=$func_arith_result
  5995. verstring="$verstring:${iface}.0"
  5996. done
  5997. # Make executables depend on our current version.
  5998. verstring="$verstring:${current}.0"
  5999. ;;
  6000. qnx)
  6001. major=".$current"
  6002. versuffix=".$current"
  6003. ;;
  6004. sunos)
  6005. major=".$current"
  6006. versuffix=".$current.$revision"
  6007. ;;
  6008. windows)
  6009. # Use '-' rather than '.', since we only want one
  6010. # extension on DOS 8.3 filesystems.
  6011. func_arith $current - $age
  6012. major=$func_arith_result
  6013. versuffix="-$major"
  6014. ;;
  6015. *)
  6016. func_fatal_configuration "unknown library version type \`$version_type'"
  6017. ;;
  6018. esac
  6019. # Clear the version info if we defaulted, and they specified a release.
  6020. if test -z "$vinfo" && test -n "$release"; then
  6021. major=
  6022. case $version_type in
  6023. darwin)
  6024. # we can't check for "0.0" in archive_cmds due to quoting
  6025. # problems, so we reset it completely
  6026. verstring=
  6027. ;;
  6028. *)
  6029. verstring="0.0"
  6030. ;;
  6031. esac
  6032. if test "$need_version" = no; then
  6033. versuffix=
  6034. else
  6035. versuffix=".0.0"
  6036. fi
  6037. fi
  6038. # Remove version info from name if versioning should be avoided
  6039. if test "$avoid_version" = yes && test "$need_version" = no; then
  6040. major=
  6041. versuffix=
  6042. verstring=""
  6043. fi
  6044. # Check to see if the archive will have undefined symbols.
  6045. if test "$allow_undefined" = yes; then
  6046. if test "$allow_undefined_flag" = unsupported; then
  6047. func_warning "undefined symbols not allowed in $host shared libraries"
  6048. build_libtool_libs=no
  6049. build_old_libs=yes
  6050. fi
  6051. else
  6052. # Don't allow undefined symbols.
  6053. allow_undefined_flag="$no_undefined_flag"
  6054. fi
  6055. fi
  6056. func_generate_dlsyms "$libname" "$libname" "yes"
  6057. libobjs="$libobjs $symfileobj"
  6058. test "X$libobjs" = "X " && libobjs=
  6059. if test "$mode" != relink; then
  6060. # Remove our outputs, but don't remove object files since they
  6061. # may have been created when compiling PIC objects.
  6062. removelist=
  6063. tempremovelist=`$ECHO "$output_objdir/*"`
  6064. for p in $tempremovelist; do
  6065. case $p in
  6066. *.$objext | *.gcno)
  6067. ;;
  6068. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  6069. if test "X$precious_files_regex" != "X"; then
  6070. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  6071. then
  6072. continue
  6073. fi
  6074. fi
  6075. removelist="$removelist $p"
  6076. ;;
  6077. *) ;;
  6078. esac
  6079. done
  6080. test -n "$removelist" && \
  6081. func_show_eval "${RM}r \$removelist"
  6082. fi
  6083. # Now set the variables for building old libraries.
  6084. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  6085. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  6086. # Transform .lo files to .o files.
  6087. oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  6088. fi
  6089. # Eliminate all temporary directories.
  6090. #for path in $notinst_path; do
  6091. # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
  6092. # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
  6093. # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
  6094. #done
  6095. if test -n "$xrpath"; then
  6096. # If the user specified any rpath flags, then add them.
  6097. temp_xrpath=
  6098. for libdir in $xrpath; do
  6099. temp_xrpath="$temp_xrpath -R$libdir"
  6100. case "$finalize_rpath " in
  6101. *" $libdir "*) ;;
  6102. *) finalize_rpath="$finalize_rpath $libdir" ;;
  6103. esac
  6104. done
  6105. if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  6106. dependency_libs="$temp_xrpath $dependency_libs"
  6107. fi
  6108. fi
  6109. # Make sure dlfiles contains only unique files that won't be dlpreopened
  6110. old_dlfiles="$dlfiles"
  6111. dlfiles=
  6112. for lib in $old_dlfiles; do
  6113. case " $dlprefiles $dlfiles " in
  6114. *" $lib "*) ;;
  6115. *) dlfiles="$dlfiles $lib" ;;
  6116. esac
  6117. done
  6118. # Make sure dlprefiles contains only unique files
  6119. old_dlprefiles="$dlprefiles"
  6120. dlprefiles=
  6121. for lib in $old_dlprefiles; do
  6122. case "$dlprefiles " in
  6123. *" $lib "*) ;;
  6124. *) dlprefiles="$dlprefiles $lib" ;;
  6125. esac
  6126. done
  6127. if test "$build_libtool_libs" = yes; then
  6128. if test -n "$rpath"; then
  6129. case $host in
  6130. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
  6131. # these systems don't actually have a c library (as such)!
  6132. ;;
  6133. *-*-rhapsody* | *-*-darwin1.[012])
  6134. # Rhapsody C library is in the System framework
  6135. deplibs="$deplibs System.ltframework"
  6136. ;;
  6137. *-*-netbsd*)
  6138. # Don't link with libc until the a.out ld.so is fixed.
  6139. ;;
  6140. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  6141. # Do not include libc due to us having libc/libc_r.
  6142. ;;
  6143. *-*-sco3.2v5* | *-*-sco5v6*)
  6144. # Causes problems with __ctype
  6145. ;;
  6146. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6147. # Compiler inserts libc in the correct place for threads to work
  6148. ;;
  6149. *)
  6150. # Add libc to deplibs on all other systems if necessary.
  6151. if test "$build_libtool_need_lc" = "yes"; then
  6152. deplibs="$deplibs -lc"
  6153. fi
  6154. ;;
  6155. esac
  6156. fi
  6157. # Transform deplibs into only deplibs that can be linked in shared.
  6158. name_save=$name
  6159. libname_save=$libname
  6160. release_save=$release
  6161. versuffix_save=$versuffix
  6162. major_save=$major
  6163. # I'm not sure if I'm treating the release correctly. I think
  6164. # release should show up in the -l (ie -lgmp5) so we don't want to
  6165. # add it in twice. Is that correct?
  6166. release=""
  6167. versuffix=""
  6168. major=""
  6169. newdeplibs=
  6170. droppeddeps=no
  6171. case $deplibs_check_method in
  6172. pass_all)
  6173. # Don't check for shared/static. Everything works.
  6174. # This might be a little naive. We might want to check
  6175. # whether the library exists or not. But this is on
  6176. # osf3 & osf4 and I'm not really sure... Just
  6177. # implementing what was already the behavior.
  6178. newdeplibs=$deplibs
  6179. ;;
  6180. test_compile)
  6181. # This code stresses the "libraries are programs" paradigm to its
  6182. # limits. Maybe even breaks it. We compile a program, linking it
  6183. # against the deplibs as a proxy for the library. Then we can check
  6184. # whether they linked in statically or dynamically with ldd.
  6185. $opt_dry_run || $RM conftest.c
  6186. cat > conftest.c <<EOF
  6187. int main() { return 0; }
  6188. EOF
  6189. $opt_dry_run || $RM conftest
  6190. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  6191. ldd_output=`ldd conftest`
  6192. for i in $deplibs; do
  6193. case $i in
  6194. -l*)
  6195. func_stripname -l '' "$i"
  6196. name=$func_stripname_result
  6197. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6198. case " $predeps $postdeps " in
  6199. *" $i "*)
  6200. newdeplibs="$newdeplibs $i"
  6201. i=""
  6202. ;;
  6203. esac
  6204. fi
  6205. if test -n "$i" ; then
  6206. libname=`eval "\\$ECHO \"$libname_spec\""`
  6207. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  6208. set dummy $deplib_matches; shift
  6209. deplib_match=$1
  6210. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  6211. newdeplibs="$newdeplibs $i"
  6212. else
  6213. droppeddeps=yes
  6214. $ECHO
  6215. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  6216. $ECHO "*** I have the capability to make that library automatically link in when"
  6217. $ECHO "*** you link to this library. But I can only do this if you have a"
  6218. $ECHO "*** shared version of the library, which I believe you do not have"
  6219. $ECHO "*** because a test_compile did reveal that the linker did not use it for"
  6220. $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
  6221. fi
  6222. fi
  6223. ;;
  6224. *)
  6225. newdeplibs="$newdeplibs $i"
  6226. ;;
  6227. esac
  6228. done
  6229. else
  6230. # Error occurred in the first compile. Let's try to salvage
  6231. # the situation: Compile a separate program for each library.
  6232. for i in $deplibs; do
  6233. case $i in
  6234. -l*)
  6235. func_stripname -l '' "$i"
  6236. name=$func_stripname_result
  6237. $opt_dry_run || $RM conftest
  6238. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  6239. ldd_output=`ldd conftest`
  6240. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6241. case " $predeps $postdeps " in
  6242. *" $i "*)
  6243. newdeplibs="$newdeplibs $i"
  6244. i=""
  6245. ;;
  6246. esac
  6247. fi
  6248. if test -n "$i" ; then
  6249. libname=`eval "\\$ECHO \"$libname_spec\""`
  6250. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  6251. set dummy $deplib_matches; shift
  6252. deplib_match=$1
  6253. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  6254. newdeplibs="$newdeplibs $i"
  6255. else
  6256. droppeddeps=yes
  6257. $ECHO
  6258. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  6259. $ECHO "*** I have the capability to make that library automatically link in when"
  6260. $ECHO "*** you link to this library. But I can only do this if you have a"
  6261. $ECHO "*** shared version of the library, which you do not appear to have"
  6262. $ECHO "*** because a test_compile did reveal that the linker did not use this one"
  6263. $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
  6264. fi
  6265. fi
  6266. else
  6267. droppeddeps=yes
  6268. $ECHO
  6269. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  6270. $ECHO "*** make it link in! You will probably need to install it or some"
  6271. $ECHO "*** library that it depends on before this library will be fully"
  6272. $ECHO "*** functional. Installing it before continuing would be even better."
  6273. fi
  6274. ;;
  6275. *)
  6276. newdeplibs="$newdeplibs $i"
  6277. ;;
  6278. esac
  6279. done
  6280. fi
  6281. ;;
  6282. file_magic*)
  6283. set dummy $deplibs_check_method; shift
  6284. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6285. for a_deplib in $deplibs; do
  6286. case $a_deplib in
  6287. -l*)
  6288. func_stripname -l '' "$a_deplib"
  6289. name=$func_stripname_result
  6290. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6291. case " $predeps $postdeps " in
  6292. *" $a_deplib "*)
  6293. newdeplibs="$newdeplibs $a_deplib"
  6294. a_deplib=""
  6295. ;;
  6296. esac
  6297. fi
  6298. if test -n "$a_deplib" ; then
  6299. libname=`eval "\\$ECHO \"$libname_spec\""`
  6300. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  6301. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  6302. for potent_lib in $potential_libs; do
  6303. # Follow soft links.
  6304. if ls -lLd "$potent_lib" 2>/dev/null |
  6305. $GREP " -> " >/dev/null; then
  6306. continue
  6307. fi
  6308. # The statement above tries to avoid entering an
  6309. # endless loop below, in case of cyclic links.
  6310. # We might still enter an endless loop, since a link
  6311. # loop can be closed while we follow links,
  6312. # but so what?
  6313. potlib="$potent_lib"
  6314. while test -h "$potlib" 2>/dev/null; do
  6315. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  6316. case $potliblink in
  6317. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  6318. *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  6319. esac
  6320. done
  6321. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  6322. $SED -e 10q |
  6323. $EGREP "$file_magic_regex" > /dev/null; then
  6324. newdeplibs="$newdeplibs $a_deplib"
  6325. a_deplib=""
  6326. break 2
  6327. fi
  6328. done
  6329. done
  6330. fi
  6331. if test -n "$a_deplib" ; then
  6332. droppeddeps=yes
  6333. $ECHO
  6334. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  6335. $ECHO "*** I have the capability to make that library automatically link in when"
  6336. $ECHO "*** you link to this library. But I can only do this if you have a"
  6337. $ECHO "*** shared version of the library, which you do not appear to have"
  6338. $ECHO "*** because I did check the linker path looking for a file starting"
  6339. if test -z "$potlib" ; then
  6340. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  6341. else
  6342. $ECHO "*** with $libname and none of the candidates passed a file format test"
  6343. $ECHO "*** using a file magic. Last file checked: $potlib"
  6344. fi
  6345. fi
  6346. ;;
  6347. *)
  6348. # Add a -L argument.
  6349. newdeplibs="$newdeplibs $a_deplib"
  6350. ;;
  6351. esac
  6352. done # Gone through all deplibs.
  6353. ;;
  6354. match_pattern*)
  6355. set dummy $deplibs_check_method; shift
  6356. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6357. for a_deplib in $deplibs; do
  6358. case $a_deplib in
  6359. -l*)
  6360. func_stripname -l '' "$a_deplib"
  6361. name=$func_stripname_result
  6362. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6363. case " $predeps $postdeps " in
  6364. *" $a_deplib "*)
  6365. newdeplibs="$newdeplibs $a_deplib"
  6366. a_deplib=""
  6367. ;;
  6368. esac
  6369. fi
  6370. if test -n "$a_deplib" ; then
  6371. libname=`eval "\\$ECHO \"$libname_spec\""`
  6372. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  6373. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  6374. for potent_lib in $potential_libs; do
  6375. potlib="$potent_lib" # see symlink-check above in file_magic test
  6376. if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
  6377. $EGREP "$match_pattern_regex" > /dev/null; then
  6378. newdeplibs="$newdeplibs $a_deplib"
  6379. a_deplib=""
  6380. break 2
  6381. fi
  6382. done
  6383. done
  6384. fi
  6385. if test -n "$a_deplib" ; then
  6386. droppeddeps=yes
  6387. $ECHO
  6388. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  6389. $ECHO "*** I have the capability to make that library automatically link in when"
  6390. $ECHO "*** you link to this library. But I can only do this if you have a"
  6391. $ECHO "*** shared version of the library, which you do not appear to have"
  6392. $ECHO "*** because I did check the linker path looking for a file starting"
  6393. if test -z "$potlib" ; then
  6394. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  6395. else
  6396. $ECHO "*** with $libname and none of the candidates passed a file format test"
  6397. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  6398. fi
  6399. fi
  6400. ;;
  6401. *)
  6402. # Add a -L argument.
  6403. newdeplibs="$newdeplibs $a_deplib"
  6404. ;;
  6405. esac
  6406. done # Gone through all deplibs.
  6407. ;;
  6408. none | unknown | *)
  6409. newdeplibs=""
  6410. tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
  6411. -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
  6412. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6413. for i in $predeps $postdeps ; do
  6414. # can't use Xsed below, because $i might contain '/'
  6415. tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
  6416. done
  6417. fi
  6418. if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
  6419. $GREP . >/dev/null; then
  6420. $ECHO
  6421. if test "X$deplibs_check_method" = "Xnone"; then
  6422. $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
  6423. else
  6424. $ECHO "*** Warning: inter-library dependencies are not known to be supported."
  6425. fi
  6426. $ECHO "*** All declared inter-library dependencies are being dropped."
  6427. droppeddeps=yes
  6428. fi
  6429. ;;
  6430. esac
  6431. versuffix=$versuffix_save
  6432. major=$major_save
  6433. release=$release_save
  6434. libname=$libname_save
  6435. name=$name_save
  6436. case $host in
  6437. *-*-rhapsody* | *-*-darwin1.[012])
  6438. # On Rhapsody replace the C library with the System framework
  6439. newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  6440. ;;
  6441. esac
  6442. if test "$droppeddeps" = yes; then
  6443. if test "$module" = yes; then
  6444. $ECHO
  6445. $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
  6446. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  6447. $ECHO "*** a static module, that should work as long as the dlopening"
  6448. $ECHO "*** application is linked with the -dlopen flag."
  6449. if test -z "$global_symbol_pipe"; then
  6450. $ECHO
  6451. $ECHO "*** However, this would only work if libtool was able to extract symbol"
  6452. $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
  6453. $ECHO "*** not find such a program. So, this module is probably useless."
  6454. $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
  6455. fi
  6456. if test "$build_old_libs" = no; then
  6457. oldlibs="$output_objdir/$libname.$libext"
  6458. build_libtool_libs=module
  6459. build_old_libs=yes
  6460. else
  6461. build_libtool_libs=no
  6462. fi
  6463. else
  6464. $ECHO "*** The inter-library dependencies that have been dropped here will be"
  6465. $ECHO "*** automatically added whenever a program is linked with this library"
  6466. $ECHO "*** or is declared to -dlopen it."
  6467. if test "$allow_undefined" = no; then
  6468. $ECHO
  6469. $ECHO "*** Since this library must not contain undefined symbols,"
  6470. $ECHO "*** because either the platform does not support them or"
  6471. $ECHO "*** it was explicitly requested with -no-undefined,"
  6472. $ECHO "*** libtool will only create a static version of it."
  6473. if test "$build_old_libs" = no; then
  6474. oldlibs="$output_objdir/$libname.$libext"
  6475. build_libtool_libs=module
  6476. build_old_libs=yes
  6477. else
  6478. build_libtool_libs=no
  6479. fi
  6480. fi
  6481. fi
  6482. fi
  6483. # Done checking deplibs!
  6484. deplibs=$newdeplibs
  6485. fi
  6486. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  6487. case $host in
  6488. *-*-darwin*)
  6489. newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  6490. new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  6491. deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  6492. ;;
  6493. esac
  6494. # move library search paths that coincide with paths to not yet
  6495. # installed libraries to the beginning of the library search list
  6496. new_libs=
  6497. for path in $notinst_path; do
  6498. case " $new_libs " in
  6499. *" -L$path/$objdir "*) ;;
  6500. *)
  6501. case " $deplibs " in
  6502. *" -L$path/$objdir "*)
  6503. new_libs="$new_libs -L$path/$objdir" ;;
  6504. esac
  6505. ;;
  6506. esac
  6507. done
  6508. for deplib in $deplibs; do
  6509. case $deplib in
  6510. -L*)
  6511. case " $new_libs " in
  6512. *" $deplib "*) ;;
  6513. *) new_libs="$new_libs $deplib" ;;
  6514. esac
  6515. ;;
  6516. *) new_libs="$new_libs $deplib" ;;
  6517. esac
  6518. done
  6519. deplibs="$new_libs"
  6520. # All the library-specific variables (install_libdir is set above).
  6521. library_names=
  6522. old_library=
  6523. dlname=
  6524. # Test again, we may have decided not to build it any more
  6525. if test "$build_libtool_libs" = yes; then
  6526. if test "$hardcode_into_libs" = yes; then
  6527. # Hardcode the library paths
  6528. hardcode_libdirs=
  6529. dep_rpath=
  6530. rpath="$finalize_rpath"
  6531. test "$mode" != relink && rpath="$compile_rpath$rpath"
  6532. for libdir in $rpath; do
  6533. if test -n "$hardcode_libdir_flag_spec"; then
  6534. if test -n "$hardcode_libdir_separator"; then
  6535. if test -z "$hardcode_libdirs"; then
  6536. hardcode_libdirs="$libdir"
  6537. else
  6538. # Just accumulate the unique libdirs.
  6539. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  6540. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  6541. ;;
  6542. *)
  6543. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  6544. ;;
  6545. esac
  6546. fi
  6547. else
  6548. eval flag=\"$hardcode_libdir_flag_spec\"
  6549. dep_rpath="$dep_rpath $flag"
  6550. fi
  6551. elif test -n "$runpath_var"; then
  6552. case "$perm_rpath " in
  6553. *" $libdir "*) ;;
  6554. *) perm_rpath="$perm_rpath $libdir" ;;
  6555. esac
  6556. fi
  6557. done
  6558. # Substitute the hardcoded libdirs into the rpath.
  6559. if test -n "$hardcode_libdir_separator" &&
  6560. test -n "$hardcode_libdirs"; then
  6561. libdir="$hardcode_libdirs"
  6562. if test -n "$hardcode_libdir_flag_spec_ld"; then
  6563. eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  6564. else
  6565. eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  6566. fi
  6567. fi
  6568. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  6569. # We should set the runpath_var.
  6570. rpath=
  6571. for dir in $perm_rpath; do
  6572. rpath="$rpath$dir:"
  6573. done
  6574. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  6575. fi
  6576. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  6577. fi
  6578. shlibpath="$finalize_shlibpath"
  6579. test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  6580. if test -n "$shlibpath"; then
  6581. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  6582. fi
  6583. # Get the real and link names of the library.
  6584. eval shared_ext=\"$shrext_cmds\"
  6585. eval library_names=\"$library_names_spec\"
  6586. set dummy $library_names
  6587. shift
  6588. realname="$1"
  6589. shift
  6590. if test -n "$soname_spec"; then
  6591. eval soname=\"$soname_spec\"
  6592. else
  6593. soname="$realname"
  6594. fi
  6595. if test -z "$dlname"; then
  6596. dlname=$soname
  6597. fi
  6598. lib="$output_objdir/$realname"
  6599. linknames=
  6600. for link
  6601. do
  6602. linknames="$linknames $link"
  6603. done
  6604. # Use standard objects if they are pic
  6605. test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  6606. test "X$libobjs" = "X " && libobjs=
  6607. delfiles=
  6608. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6609. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  6610. export_symbols="$output_objdir/$libname.uexp"
  6611. delfiles="$delfiles $export_symbols"
  6612. fi
  6613. orig_export_symbols=
  6614. case $host_os in
  6615. cygwin* | mingw* | cegcc*)
  6616. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  6617. # exporting using user supplied symfile
  6618. if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
  6619. # and it's NOT already a .def file. Must figure out
  6620. # which of the given symbols are data symbols and tag
  6621. # them as such. So, trigger use of export_symbols_cmds.
  6622. # export_symbols gets reassigned inside the "prepare
  6623. # the list of exported symbols" if statement, so the
  6624. # include_expsyms logic still works.
  6625. orig_export_symbols="$export_symbols"
  6626. export_symbols=
  6627. always_export_symbols=yes
  6628. fi
  6629. fi
  6630. ;;
  6631. esac
  6632. # Prepare the list of exported symbols
  6633. if test -z "$export_symbols"; then
  6634. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  6635. func_verbose "generating symbol list for \`$libname.la'"
  6636. export_symbols="$output_objdir/$libname.exp"
  6637. $opt_dry_run || $RM $export_symbols
  6638. cmds=$export_symbols_cmds
  6639. save_ifs="$IFS"; IFS='~'
  6640. for cmd in $cmds; do
  6641. IFS="$save_ifs"
  6642. eval cmd=\"$cmd\"
  6643. func_len " $cmd"
  6644. len=$func_len_result
  6645. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  6646. func_show_eval "$cmd" 'exit $?'
  6647. skipped_export=false
  6648. else
  6649. # The command line is too long to execute in one step.
  6650. func_verbose "using reloadable object file for export list..."
  6651. skipped_export=:
  6652. # Break out early, otherwise skipped_export may be
  6653. # set to false by a later but shorter cmd.
  6654. break
  6655. fi
  6656. done
  6657. IFS="$save_ifs"
  6658. if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
  6659. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  6660. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  6661. fi
  6662. fi
  6663. fi
  6664. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6665. tmp_export_symbols="$export_symbols"
  6666. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  6667. $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
  6668. fi
  6669. if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
  6670. # The given exports_symbols file has to be filtered, so filter it.
  6671. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  6672. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  6673. # 's' commands which not all seds can handle. GNU sed should be fine
  6674. # though. Also, the filter scales superlinearly with the number of
  6675. # global variables. join(1) would be nice here, but unfortunately
  6676. # isn't a blessed tool.
  6677. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  6678. delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
  6679. export_symbols=$output_objdir/$libname.def
  6680. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  6681. fi
  6682. tmp_deplibs=
  6683. for test_deplib in $deplibs; do
  6684. case " $convenience " in
  6685. *" $test_deplib "*) ;;
  6686. *)
  6687. tmp_deplibs="$tmp_deplibs $test_deplib"
  6688. ;;
  6689. esac
  6690. done
  6691. deplibs="$tmp_deplibs"
  6692. if test -n "$convenience"; then
  6693. if test -n "$whole_archive_flag_spec" &&
  6694. test "$compiler_needs_object" = yes &&
  6695. test -z "$libobjs"; then
  6696. # extract the archives, so we have objects to list.
  6697. # TODO: could optimize this to just extract one archive.
  6698. whole_archive_flag_spec=
  6699. fi
  6700. if test -n "$whole_archive_flag_spec"; then
  6701. save_libobjs=$libobjs
  6702. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  6703. test "X$libobjs" = "X " && libobjs=
  6704. else
  6705. gentop="$output_objdir/${outputname}x"
  6706. generated="$generated $gentop"
  6707. func_extract_archives $gentop $convenience
  6708. libobjs="$libobjs $func_extract_archives_result"
  6709. test "X$libobjs" = "X " && libobjs=
  6710. fi
  6711. fi
  6712. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  6713. eval flag=\"$thread_safe_flag_spec\"
  6714. linker_flags="$linker_flags $flag"
  6715. fi
  6716. # Make a backup of the uninstalled library when relinking
  6717. if test "$mode" = relink; then
  6718. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  6719. fi
  6720. # Do each of the archive commands.
  6721. if test "$module" = yes && test -n "$module_cmds" ; then
  6722. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  6723. eval test_cmds=\"$module_expsym_cmds\"
  6724. cmds=$module_expsym_cmds
  6725. else
  6726. eval test_cmds=\"$module_cmds\"
  6727. cmds=$module_cmds
  6728. fi
  6729. else
  6730. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  6731. eval test_cmds=\"$archive_expsym_cmds\"
  6732. cmds=$archive_expsym_cmds
  6733. else
  6734. eval test_cmds=\"$archive_cmds\"
  6735. cmds=$archive_cmds
  6736. fi
  6737. fi
  6738. if test "X$skipped_export" != "X:" &&
  6739. func_len " $test_cmds" &&
  6740. len=$func_len_result &&
  6741. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  6742. :
  6743. else
  6744. # The command line is too long to link in one step, link piecewise
  6745. # or, if using GNU ld and skipped_export is not :, use a linker
  6746. # script.
  6747. # Save the value of $output and $libobjs because we want to
  6748. # use them later. If we have whole_archive_flag_spec, we
  6749. # want to use save_libobjs as it was before
  6750. # whole_archive_flag_spec was expanded, because we can't
  6751. # assume the linker understands whole_archive_flag_spec.
  6752. # This may have to be revisited, in case too many
  6753. # convenience libraries get linked in and end up exceeding
  6754. # the spec.
  6755. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  6756. save_libobjs=$libobjs
  6757. fi
  6758. save_output=$output
  6759. output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
  6760. # Clear the reloadable object creation command queue and
  6761. # initialize k to one.
  6762. test_cmds=
  6763. concat_cmds=
  6764. objlist=
  6765. last_robj=
  6766. k=1
  6767. if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
  6768. output=${output_objdir}/${output_la}.lnkscript
  6769. func_verbose "creating GNU ld script: $output"
  6770. $ECHO 'INPUT (' > $output
  6771. for obj in $save_libobjs
  6772. do
  6773. $ECHO "$obj" >> $output
  6774. done
  6775. $ECHO ')' >> $output
  6776. delfiles="$delfiles $output"
  6777. elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
  6778. output=${output_objdir}/${output_la}.lnk
  6779. func_verbose "creating linker input file list: $output"
  6780. : > $output
  6781. set x $save_libobjs
  6782. shift
  6783. firstobj=
  6784. if test "$compiler_needs_object" = yes; then
  6785. firstobj="$1 "
  6786. shift
  6787. fi
  6788. for obj
  6789. do
  6790. $ECHO "$obj" >> $output
  6791. done
  6792. delfiles="$delfiles $output"
  6793. output=$firstobj\"$file_list_spec$output\"
  6794. else
  6795. if test -n "$save_libobjs"; then
  6796. func_verbose "creating reloadable object files..."
  6797. output=$output_objdir/$output_la-${k}.$objext
  6798. eval test_cmds=\"$reload_cmds\"
  6799. func_len " $test_cmds"
  6800. len0=$func_len_result
  6801. len=$len0
  6802. # Loop over the list of objects to be linked.
  6803. for obj in $save_libobjs
  6804. do
  6805. func_len " $obj"
  6806. func_arith $len + $func_len_result
  6807. len=$func_arith_result
  6808. if test "X$objlist" = X ||
  6809. test "$len" -lt "$max_cmd_len"; then
  6810. func_append objlist " $obj"
  6811. else
  6812. # The command $test_cmds is almost too long, add a
  6813. # command to the queue.
  6814. if test "$k" -eq 1 ; then
  6815. # The first file doesn't have a previous command to add.
  6816. eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  6817. else
  6818. # All subsequent reloadable object files will link in
  6819. # the last one created.
  6820. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
  6821. fi
  6822. last_robj=$output_objdir/$output_la-${k}.$objext
  6823. func_arith $k + 1
  6824. k=$func_arith_result
  6825. output=$output_objdir/$output_la-${k}.$objext
  6826. objlist=$obj
  6827. func_len " $last_robj"
  6828. func_arith $len0 + $func_len_result
  6829. len=$func_arith_result
  6830. fi
  6831. done
  6832. # Handle the remaining objects by creating one last
  6833. # reloadable object file. All subsequent reloadable object
  6834. # files will link in the last one created.
  6835. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  6836. eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  6837. if test -n "$last_robj"; then
  6838. eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
  6839. fi
  6840. delfiles="$delfiles $output"
  6841. else
  6842. output=
  6843. fi
  6844. if ${skipped_export-false}; then
  6845. func_verbose "generating symbol list for \`$libname.la'"
  6846. export_symbols="$output_objdir/$libname.exp"
  6847. $opt_dry_run || $RM $export_symbols
  6848. libobjs=$output
  6849. # Append the command to create the export file.
  6850. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  6851. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  6852. if test -n "$last_robj"; then
  6853. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  6854. fi
  6855. fi
  6856. test -n "$save_libobjs" &&
  6857. func_verbose "creating a temporary reloadable object file: $output"
  6858. # Loop through the commands generated above and execute them.
  6859. save_ifs="$IFS"; IFS='~'
  6860. for cmd in $concat_cmds; do
  6861. IFS="$save_ifs"
  6862. $opt_silent || {
  6863. func_quote_for_expand "$cmd"
  6864. eval "func_echo $func_quote_for_expand_result"
  6865. }
  6866. $opt_dry_run || eval "$cmd" || {
  6867. lt_exit=$?
  6868. # Restore the uninstalled library and exit
  6869. if test "$mode" = relink; then
  6870. ( cd "$output_objdir" && \
  6871. $RM "${realname}T" && \
  6872. $MV "${realname}U" "$realname" )
  6873. fi
  6874. exit $lt_exit
  6875. }
  6876. done
  6877. IFS="$save_ifs"
  6878. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  6879. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  6880. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  6881. fi
  6882. fi
  6883. if ${skipped_export-false}; then
  6884. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6885. tmp_export_symbols="$export_symbols"
  6886. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  6887. $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
  6888. fi
  6889. if test -n "$orig_export_symbols"; then
  6890. # The given exports_symbols file has to be filtered, so filter it.
  6891. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  6892. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  6893. # 's' commands which not all seds can handle. GNU sed should be fine
  6894. # though. Also, the filter scales superlinearly with the number of
  6895. # global variables. join(1) would be nice here, but unfortunately
  6896. # isn't a blessed tool.
  6897. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  6898. delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
  6899. export_symbols=$output_objdir/$libname.def
  6900. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  6901. fi
  6902. fi
  6903. libobjs=$output
  6904. # Restore the value of output.
  6905. output=$save_output
  6906. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  6907. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  6908. test "X$libobjs" = "X " && libobjs=
  6909. fi
  6910. # Expand the library linking commands again to reset the
  6911. # value of $libobjs for piecewise linking.
  6912. # Do each of the archive commands.
  6913. if test "$module" = yes && test -n "$module_cmds" ; then
  6914. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  6915. cmds=$module_expsym_cmds
  6916. else
  6917. cmds=$module_cmds
  6918. fi
  6919. else
  6920. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  6921. cmds=$archive_expsym_cmds
  6922. else
  6923. cmds=$archive_cmds
  6924. fi
  6925. fi
  6926. fi
  6927. if test -n "$delfiles"; then
  6928. # Append the command to remove temporary files to $cmds.
  6929. eval cmds=\"\$cmds~\$RM $delfiles\"
  6930. fi
  6931. # Add any objects from preloaded convenience libraries
  6932. if test -n "$dlprefiles"; then
  6933. gentop="$output_objdir/${outputname}x"
  6934. generated="$generated $gentop"
  6935. func_extract_archives $gentop $dlprefiles
  6936. libobjs="$libobjs $func_extract_archives_result"
  6937. test "X$libobjs" = "X " && libobjs=
  6938. fi
  6939. save_ifs="$IFS"; IFS='~'
  6940. for cmd in $cmds; do
  6941. IFS="$save_ifs"
  6942. eval cmd=\"$cmd\"
  6943. $opt_silent || {
  6944. func_quote_for_expand "$cmd"
  6945. eval "func_echo $func_quote_for_expand_result"
  6946. }
  6947. $opt_dry_run || eval "$cmd" || {
  6948. lt_exit=$?
  6949. # Restore the uninstalled library and exit
  6950. if test "$mode" = relink; then
  6951. ( cd "$output_objdir" && \
  6952. $RM "${realname}T" && \
  6953. $MV "${realname}U" "$realname" )
  6954. fi
  6955. exit $lt_exit
  6956. }
  6957. done
  6958. IFS="$save_ifs"
  6959. # Restore the uninstalled library and exit
  6960. if test "$mode" = relink; then
  6961. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  6962. if test -n "$convenience"; then
  6963. if test -z "$whole_archive_flag_spec"; then
  6964. func_show_eval '${RM}r "$gentop"'
  6965. fi
  6966. fi
  6967. exit $EXIT_SUCCESS
  6968. fi
  6969. # Create links to the real library.
  6970. for linkname in $linknames; do
  6971. if test "$realname" != "$linkname"; then
  6972. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  6973. fi
  6974. done
  6975. # If -module or -export-dynamic was specified, set the dlname.
  6976. if test "$module" = yes || test "$export_dynamic" = yes; then
  6977. # On all known operating systems, these are identical.
  6978. dlname="$soname"
  6979. fi
  6980. fi
  6981. ;;
  6982. obj)
  6983. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  6984. func_warning "\`-dlopen' is ignored for objects"
  6985. fi
  6986. case " $deplibs" in
  6987. *\ -l* | *\ -L*)
  6988. func_warning "\`-l' and \`-L' are ignored for objects" ;;
  6989. esac
  6990. test -n "$rpath" && \
  6991. func_warning "\`-rpath' is ignored for objects"
  6992. test -n "$xrpath" && \
  6993. func_warning "\`-R' is ignored for objects"
  6994. test -n "$vinfo" && \
  6995. func_warning "\`-version-info' is ignored for objects"
  6996. test -n "$release" && \
  6997. func_warning "\`-release' is ignored for objects"
  6998. case $output in
  6999. *.lo)
  7000. test -n "$objs$old_deplibs" && \
  7001. func_fatal_error "cannot build library object \`$output' from non-libtool objects"
  7002. libobj=$output
  7003. func_lo2o "$libobj"
  7004. obj=$func_lo2o_result
  7005. ;;
  7006. *)
  7007. libobj=
  7008. obj="$output"
  7009. ;;
  7010. esac
  7011. # Delete the old objects.
  7012. $opt_dry_run || $RM $obj $libobj
  7013. # Objects from convenience libraries. This assumes
  7014. # single-version convenience libraries. Whenever we create
  7015. # different ones for PIC/non-PIC, this we'll have to duplicate
  7016. # the extraction.
  7017. reload_conv_objs=
  7018. gentop=
  7019. # reload_cmds runs $LD directly, so let us get rid of
  7020. # -Wl from whole_archive_flag_spec and hope we can get by with
  7021. # turning comma into space..
  7022. wl=
  7023. if test -n "$convenience"; then
  7024. if test -n "$whole_archive_flag_spec"; then
  7025. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  7026. reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
  7027. else
  7028. gentop="$output_objdir/${obj}x"
  7029. generated="$generated $gentop"
  7030. func_extract_archives $gentop $convenience
  7031. reload_conv_objs="$reload_objs $func_extract_archives_result"
  7032. fi
  7033. fi
  7034. # Create the old-style object.
  7035. reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  7036. output="$obj"
  7037. func_execute_cmds "$reload_cmds" 'exit $?'
  7038. # Exit if we aren't doing a library object file.
  7039. if test -z "$libobj"; then
  7040. if test -n "$gentop"; then
  7041. func_show_eval '${RM}r "$gentop"'
  7042. fi
  7043. exit $EXIT_SUCCESS
  7044. fi
  7045. if test "$build_libtool_libs" != yes; then
  7046. if test -n "$gentop"; then
  7047. func_show_eval '${RM}r "$gentop"'
  7048. fi
  7049. # Create an invalid libtool object if no PIC, so that we don't
  7050. # accidentally link it into a program.
  7051. # $show "echo timestamp > $libobj"
  7052. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  7053. exit $EXIT_SUCCESS
  7054. fi
  7055. if test -n "$pic_flag" || test "$pic_mode" != default; then
  7056. # Only do commands if we really have different PIC objects.
  7057. reload_objs="$libobjs $reload_conv_objs"
  7058. output="$libobj"
  7059. func_execute_cmds "$reload_cmds" 'exit $?'
  7060. fi
  7061. if test -n "$gentop"; then
  7062. func_show_eval '${RM}r "$gentop"'
  7063. fi
  7064. exit $EXIT_SUCCESS
  7065. ;;
  7066. prog)
  7067. case $host in
  7068. *cygwin*) func_stripname '' '.exe' "$output"
  7069. output=$func_stripname_result.exe;;
  7070. esac
  7071. test -n "$vinfo" && \
  7072. func_warning "\`-version-info' is ignored for programs"
  7073. test -n "$release" && \
  7074. func_warning "\`-release' is ignored for programs"
  7075. test "$preload" = yes \
  7076. && test "$dlopen_support" = unknown \
  7077. && test "$dlopen_self" = unknown \
  7078. && test "$dlopen_self_static" = unknown && \
  7079. func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
  7080. case $host in
  7081. *-*-rhapsody* | *-*-darwin1.[012])
  7082. # On Rhapsody replace the C library is the System framework
  7083. compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  7084. finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  7085. ;;
  7086. esac
  7087. case $host in
  7088. *-*-darwin*)
  7089. # Don't allow lazy linking, it breaks C++ global constructors
  7090. # But is supposedly fixed on 10.4 or later (yay!).
  7091. if test "$tagname" = CXX ; then
  7092. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  7093. 10.[0123])
  7094. compile_command="$compile_command ${wl}-bind_at_load"
  7095. finalize_command="$finalize_command ${wl}-bind_at_load"
  7096. ;;
  7097. esac
  7098. fi
  7099. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  7100. compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  7101. finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  7102. ;;
  7103. esac
  7104. # move library search paths that coincide with paths to not yet
  7105. # installed libraries to the beginning of the library search list
  7106. new_libs=
  7107. for path in $notinst_path; do
  7108. case " $new_libs " in
  7109. *" -L$path/$objdir "*) ;;
  7110. *)
  7111. case " $compile_deplibs " in
  7112. *" -L$path/$objdir "*)
  7113. new_libs="$new_libs -L$path/$objdir" ;;
  7114. esac
  7115. ;;
  7116. esac
  7117. done
  7118. for deplib in $compile_deplibs; do
  7119. case $deplib in
  7120. -L*)
  7121. case " $new_libs " in
  7122. *" $deplib "*) ;;
  7123. *) new_libs="$new_libs $deplib" ;;
  7124. esac
  7125. ;;
  7126. *) new_libs="$new_libs $deplib" ;;
  7127. esac
  7128. done
  7129. compile_deplibs="$new_libs"
  7130. compile_command="$compile_command $compile_deplibs"
  7131. finalize_command="$finalize_command $finalize_deplibs"
  7132. if test -n "$rpath$xrpath"; then
  7133. # If the user specified any rpath flags, then add them.
  7134. for libdir in $rpath $xrpath; do
  7135. # This is the magic to use -rpath.
  7136. case "$finalize_rpath " in
  7137. *" $libdir "*) ;;
  7138. *) finalize_rpath="$finalize_rpath $libdir" ;;
  7139. esac
  7140. done
  7141. fi
  7142. # Now hardcode the library paths
  7143. rpath=
  7144. hardcode_libdirs=
  7145. for libdir in $compile_rpath $finalize_rpath; do
  7146. if test -n "$hardcode_libdir_flag_spec"; then
  7147. if test -n "$hardcode_libdir_separator"; then
  7148. if test -z "$hardcode_libdirs"; then
  7149. hardcode_libdirs="$libdir"
  7150. else
  7151. # Just accumulate the unique libdirs.
  7152. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7153. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7154. ;;
  7155. *)
  7156. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  7157. ;;
  7158. esac
  7159. fi
  7160. else
  7161. eval flag=\"$hardcode_libdir_flag_spec\"
  7162. rpath="$rpath $flag"
  7163. fi
  7164. elif test -n "$runpath_var"; then
  7165. case "$perm_rpath " in
  7166. *" $libdir "*) ;;
  7167. *) perm_rpath="$perm_rpath $libdir" ;;
  7168. esac
  7169. fi
  7170. case $host in
  7171. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  7172. testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
  7173. case :$dllsearchpath: in
  7174. *":$libdir:"*) ;;
  7175. ::) dllsearchpath=$libdir;;
  7176. *) dllsearchpath="$dllsearchpath:$libdir";;
  7177. esac
  7178. case :$dllsearchpath: in
  7179. *":$testbindir:"*) ;;
  7180. ::) dllsearchpath=$testbindir;;
  7181. *) dllsearchpath="$dllsearchpath:$testbindir";;
  7182. esac
  7183. ;;
  7184. esac
  7185. done
  7186. # Substitute the hardcoded libdirs into the rpath.
  7187. if test -n "$hardcode_libdir_separator" &&
  7188. test -n "$hardcode_libdirs"; then
  7189. libdir="$hardcode_libdirs"
  7190. eval rpath=\" $hardcode_libdir_flag_spec\"
  7191. fi
  7192. compile_rpath="$rpath"
  7193. rpath=
  7194. hardcode_libdirs=
  7195. for libdir in $finalize_rpath; do
  7196. if test -n "$hardcode_libdir_flag_spec"; then
  7197. if test -n "$hardcode_libdir_separator"; then
  7198. if test -z "$hardcode_libdirs"; then
  7199. hardcode_libdirs="$libdir"
  7200. else
  7201. # Just accumulate the unique libdirs.
  7202. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7203. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7204. ;;
  7205. *)
  7206. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  7207. ;;
  7208. esac
  7209. fi
  7210. else
  7211. eval flag=\"$hardcode_libdir_flag_spec\"
  7212. rpath="$rpath $flag"
  7213. fi
  7214. elif test -n "$runpath_var"; then
  7215. case "$finalize_perm_rpath " in
  7216. *" $libdir "*) ;;
  7217. *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  7218. esac
  7219. fi
  7220. done
  7221. # Substitute the hardcoded libdirs into the rpath.
  7222. if test -n "$hardcode_libdir_separator" &&
  7223. test -n "$hardcode_libdirs"; then
  7224. libdir="$hardcode_libdirs"
  7225. eval rpath=\" $hardcode_libdir_flag_spec\"
  7226. fi
  7227. finalize_rpath="$rpath"
  7228. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  7229. # Transform all the library objects into standard objects.
  7230. compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  7231. finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  7232. fi
  7233. func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
  7234. # template prelinking step
  7235. if test -n "$prelink_cmds"; then
  7236. func_execute_cmds "$prelink_cmds" 'exit $?'
  7237. fi
  7238. wrappers_required=yes
  7239. case $host in
  7240. *cygwin* | *mingw* )
  7241. if test "$build_libtool_libs" != yes; then
  7242. wrappers_required=no
  7243. fi
  7244. ;;
  7245. *cegcc)
  7246. # Disable wrappers for cegcc, we are cross compiling anyway.
  7247. wrappers_required=no
  7248. ;;
  7249. *)
  7250. if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  7251. wrappers_required=no
  7252. fi
  7253. ;;
  7254. esac
  7255. if test "$wrappers_required" = no; then
  7256. # Replace the output file specification.
  7257. compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  7258. link_command="$compile_command$compile_rpath"
  7259. # We have no uninstalled library dependencies, so finalize right now.
  7260. exit_status=0
  7261. func_show_eval "$link_command" 'exit_status=$?'
  7262. # Delete the generated files.
  7263. if test -f "$output_objdir/${outputname}S.${objext}"; then
  7264. func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
  7265. fi
  7266. exit $exit_status
  7267. fi
  7268. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  7269. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  7270. fi
  7271. if test -n "$finalize_shlibpath"; then
  7272. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  7273. fi
  7274. compile_var=
  7275. finalize_var=
  7276. if test -n "$runpath_var"; then
  7277. if test -n "$perm_rpath"; then
  7278. # We should set the runpath_var.
  7279. rpath=
  7280. for dir in $perm_rpath; do
  7281. rpath="$rpath$dir:"
  7282. done
  7283. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  7284. fi
  7285. if test -n "$finalize_perm_rpath"; then
  7286. # We should set the runpath_var.
  7287. rpath=
  7288. for dir in $finalize_perm_rpath; do
  7289. rpath="$rpath$dir:"
  7290. done
  7291. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  7292. fi
  7293. fi
  7294. if test "$no_install" = yes; then
  7295. # We don't need to create a wrapper script.
  7296. link_command="$compile_var$compile_command$compile_rpath"
  7297. # Replace the output file specification.
  7298. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  7299. # Delete the old output file.
  7300. $opt_dry_run || $RM $output
  7301. # Link the executable and exit
  7302. func_show_eval "$link_command" 'exit $?'
  7303. exit $EXIT_SUCCESS
  7304. fi
  7305. if test "$hardcode_action" = relink; then
  7306. # Fast installation is not supported
  7307. link_command="$compile_var$compile_command$compile_rpath"
  7308. relink_command="$finalize_var$finalize_command$finalize_rpath"
  7309. func_warning "this platform does not like uninstalled shared libraries"
  7310. func_warning "\`$output' will be relinked during installation"
  7311. else
  7312. if test "$fast_install" != no; then
  7313. link_command="$finalize_var$compile_command$finalize_rpath"
  7314. if test "$fast_install" = yes; then
  7315. relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  7316. else
  7317. # fast_install is set to needless
  7318. relink_command=
  7319. fi
  7320. else
  7321. link_command="$compile_var$compile_command$compile_rpath"
  7322. relink_command="$finalize_var$finalize_command$finalize_rpath"
  7323. fi
  7324. fi
  7325. # Replace the output file specification.
  7326. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  7327. # Delete the old output files.
  7328. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  7329. func_show_eval "$link_command" 'exit $?'
  7330. # Now create the wrapper script.
  7331. func_verbose "creating $output"
  7332. # Quote the relink command for shipping.
  7333. if test -n "$relink_command"; then
  7334. # Preserve any variables that may affect compiler behavior
  7335. for var in $variables_saved_for_relink; do
  7336. if eval test -z \"\${$var+set}\"; then
  7337. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  7338. elif eval var_value=\$$var; test -z "$var_value"; then
  7339. relink_command="$var=; export $var; $relink_command"
  7340. else
  7341. func_quote_for_eval "$var_value"
  7342. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  7343. fi
  7344. done
  7345. relink_command="(cd `pwd`; $relink_command)"
  7346. relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  7347. fi
  7348. # Quote $ECHO for shipping.
  7349. if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
  7350. case $progpath in
  7351. [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
  7352. *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
  7353. esac
  7354. qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
  7355. else
  7356. qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
  7357. fi
  7358. # Only actually do things if not in dry run mode.
  7359. $opt_dry_run || {
  7360. # win32 will think the script is a binary if it has
  7361. # a .exe suffix, so we strip it off here.
  7362. case $output in
  7363. *.exe) func_stripname '' '.exe' "$output"
  7364. output=$func_stripname_result ;;
  7365. esac
  7366. # test for cygwin because mv fails w/o .exe extensions
  7367. case $host in
  7368. *cygwin*)
  7369. exeext=.exe
  7370. func_stripname '' '.exe' "$outputname"
  7371. outputname=$func_stripname_result ;;
  7372. *) exeext= ;;
  7373. esac
  7374. case $host in
  7375. *cygwin* | *mingw* )
  7376. func_dirname_and_basename "$output" "" "."
  7377. output_name=$func_basename_result
  7378. output_path=$func_dirname_result
  7379. cwrappersource="$output_path/$objdir/lt-$output_name.c"
  7380. cwrapper="$output_path/$output_name.exe"
  7381. $RM $cwrappersource $cwrapper
  7382. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  7383. func_emit_cwrapperexe_src > $cwrappersource
  7384. # The wrapper executable is built using the $host compiler,
  7385. # because it contains $host paths and files. If cross-
  7386. # compiling, it, like the target executable, must be
  7387. # executed on the $host or under an emulation environment.
  7388. $opt_dry_run || {
  7389. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  7390. $STRIP $cwrapper
  7391. }
  7392. # Now, create the wrapper script for func_source use:
  7393. func_ltwrapper_scriptname $cwrapper
  7394. $RM $func_ltwrapper_scriptname_result
  7395. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  7396. $opt_dry_run || {
  7397. # note: this script will not be executed, so do not chmod.
  7398. if test "x$build" = "x$host" ; then
  7399. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  7400. else
  7401. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  7402. fi
  7403. }
  7404. ;;
  7405. * )
  7406. $RM $output
  7407. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  7408. func_emit_wrapper no > $output
  7409. chmod +x $output
  7410. ;;
  7411. esac
  7412. }
  7413. exit $EXIT_SUCCESS
  7414. ;;
  7415. esac
  7416. # See if we need to build an old-fashioned archive.
  7417. for oldlib in $oldlibs; do
  7418. if test "$build_libtool_libs" = convenience; then
  7419. oldobjs="$libobjs_save $symfileobj"
  7420. addlibs="$convenience"
  7421. build_libtool_libs=no
  7422. else
  7423. if test "$build_libtool_libs" = module; then
  7424. oldobjs="$libobjs_save"
  7425. build_libtool_libs=no
  7426. else
  7427. oldobjs="$old_deplibs $non_pic_objects"
  7428. if test "$preload" = yes && test -f "$symfileobj"; then
  7429. oldobjs="$oldobjs $symfileobj"
  7430. fi
  7431. fi
  7432. addlibs="$old_convenience"
  7433. fi
  7434. if test -n "$addlibs"; then
  7435. gentop="$output_objdir/${outputname}x"
  7436. generated="$generated $gentop"
  7437. func_extract_archives $gentop $addlibs
  7438. oldobjs="$oldobjs $func_extract_archives_result"
  7439. fi
  7440. # Do each command in the archive commands.
  7441. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  7442. cmds=$old_archive_from_new_cmds
  7443. else
  7444. # Add any objects from preloaded convenience libraries
  7445. if test -n "$dlprefiles"; then
  7446. gentop="$output_objdir/${outputname}x"
  7447. generated="$generated $gentop"
  7448. func_extract_archives $gentop $dlprefiles
  7449. oldobjs="$oldobjs $func_extract_archives_result"
  7450. fi
  7451. # POSIX demands no paths to be encoded in archives. We have
  7452. # to avoid creating archives with duplicate basenames if we
  7453. # might have to extract them afterwards, e.g., when creating a
  7454. # static archive out of a convenience library, or when linking
  7455. # the entirety of a libtool archive into another (currently
  7456. # not supported by libtool).
  7457. if (for obj in $oldobjs
  7458. do
  7459. func_basename "$obj"
  7460. $ECHO "$func_basename_result"
  7461. done | sort | sort -uc >/dev/null 2>&1); then
  7462. :
  7463. else
  7464. $ECHO "copying selected object files to avoid basename conflicts..."
  7465. gentop="$output_objdir/${outputname}x"
  7466. generated="$generated $gentop"
  7467. func_mkdir_p "$gentop"
  7468. save_oldobjs=$oldobjs
  7469. oldobjs=
  7470. counter=1
  7471. for obj in $save_oldobjs
  7472. do
  7473. func_basename "$obj"
  7474. objbase="$func_basename_result"
  7475. case " $oldobjs " in
  7476. " ") oldobjs=$obj ;;
  7477. *[\ /]"$objbase "*)
  7478. while :; do
  7479. # Make sure we don't pick an alternate name that also
  7480. # overlaps.
  7481. newobj=lt$counter-$objbase
  7482. func_arith $counter + 1
  7483. counter=$func_arith_result
  7484. case " $oldobjs " in
  7485. *[\ /]"$newobj "*) ;;
  7486. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  7487. esac
  7488. done
  7489. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  7490. oldobjs="$oldobjs $gentop/$newobj"
  7491. ;;
  7492. *) oldobjs="$oldobjs $obj" ;;
  7493. esac
  7494. done
  7495. fi
  7496. eval cmds=\"$old_archive_cmds\"
  7497. func_len " $cmds"
  7498. len=$func_len_result
  7499. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  7500. cmds=$old_archive_cmds
  7501. else
  7502. # the command line is too long to link in one step, link in parts
  7503. func_verbose "using piecewise archive linking..."
  7504. save_RANLIB=$RANLIB
  7505. RANLIB=:
  7506. objlist=
  7507. concat_cmds=
  7508. save_oldobjs=$oldobjs
  7509. oldobjs=
  7510. # Is there a better way of finding the last object in the list?
  7511. for obj in $save_oldobjs
  7512. do
  7513. last_oldobj=$obj
  7514. done
  7515. eval test_cmds=\"$old_archive_cmds\"
  7516. func_len " $test_cmds"
  7517. len0=$func_len_result
  7518. len=$len0
  7519. for obj in $save_oldobjs
  7520. do
  7521. func_len " $obj"
  7522. func_arith $len + $func_len_result
  7523. len=$func_arith_result
  7524. func_append objlist " $obj"
  7525. if test "$len" -lt "$max_cmd_len"; then
  7526. :
  7527. else
  7528. # the above command should be used before it gets too long
  7529. oldobjs=$objlist
  7530. if test "$obj" = "$last_oldobj" ; then
  7531. RANLIB=$save_RANLIB
  7532. fi
  7533. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  7534. eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  7535. objlist=
  7536. len=$len0
  7537. fi
  7538. done
  7539. RANLIB=$save_RANLIB
  7540. oldobjs=$objlist
  7541. if test "X$oldobjs" = "X" ; then
  7542. eval cmds=\"\$concat_cmds\"
  7543. else
  7544. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  7545. fi
  7546. fi
  7547. fi
  7548. func_execute_cmds "$cmds" 'exit $?'
  7549. done
  7550. test -n "$generated" && \
  7551. func_show_eval "${RM}r$generated"
  7552. # Now create the libtool archive.
  7553. case $output in
  7554. *.la)
  7555. old_library=
  7556. test "$build_old_libs" = yes && old_library="$libname.$libext"
  7557. func_verbose "creating $output"
  7558. # Preserve any variables that may affect compiler behavior
  7559. for var in $variables_saved_for_relink; do
  7560. if eval test -z \"\${$var+set}\"; then
  7561. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  7562. elif eval var_value=\$$var; test -z "$var_value"; then
  7563. relink_command="$var=; export $var; $relink_command"
  7564. else
  7565. func_quote_for_eval "$var_value"
  7566. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  7567. fi
  7568. done
  7569. # Quote the link command for shipping.
  7570. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  7571. relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  7572. if test "$hardcode_automatic" = yes ; then
  7573. relink_command=
  7574. fi
  7575. # Only create the output if not a dry run.
  7576. $opt_dry_run || {
  7577. for installed in no yes; do
  7578. if test "$installed" = yes; then
  7579. if test -z "$install_libdir"; then
  7580. break
  7581. fi
  7582. output="$output_objdir/$outputname"i
  7583. # Replace all uninstalled libtool libraries with the installed ones
  7584. newdependency_libs=
  7585. for deplib in $dependency_libs; do
  7586. case $deplib in
  7587. *.la)
  7588. func_basename "$deplib"
  7589. name="$func_basename_result"
  7590. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7591. test -z "$libdir" && \
  7592. func_fatal_error "\`$deplib' is not a valid libtool archive"
  7593. newdependency_libs="$newdependency_libs $libdir/$name"
  7594. ;;
  7595. *) newdependency_libs="$newdependency_libs $deplib" ;;
  7596. esac
  7597. done
  7598. dependency_libs="$newdependency_libs"
  7599. newdlfiles=
  7600. for lib in $dlfiles; do
  7601. case $lib in
  7602. *.la)
  7603. func_basename "$lib"
  7604. name="$func_basename_result"
  7605. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  7606. test -z "$libdir" && \
  7607. func_fatal_error "\`$lib' is not a valid libtool archive"
  7608. newdlfiles="$newdlfiles $libdir/$name"
  7609. ;;
  7610. *) newdlfiles="$newdlfiles $lib" ;;
  7611. esac
  7612. done
  7613. dlfiles="$newdlfiles"
  7614. newdlprefiles=
  7615. for lib in $dlprefiles; do
  7616. case $lib in
  7617. *.la)
  7618. # Only pass preopened files to the pseudo-archive (for
  7619. # eventual linking with the app. that links it) if we
  7620. # didn't already link the preopened objects directly into
  7621. # the library:
  7622. func_basename "$lib"
  7623. name="$func_basename_result"
  7624. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  7625. test -z "$libdir" && \
  7626. func_fatal_error "\`$lib' is not a valid libtool archive"
  7627. newdlprefiles="$newdlprefiles $libdir/$name"
  7628. ;;
  7629. esac
  7630. done
  7631. dlprefiles="$newdlprefiles"
  7632. else
  7633. newdlfiles=
  7634. for lib in $dlfiles; do
  7635. case $lib in
  7636. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  7637. *) abs=`pwd`"/$lib" ;;
  7638. esac
  7639. newdlfiles="$newdlfiles $abs"
  7640. done
  7641. dlfiles="$newdlfiles"
  7642. newdlprefiles=
  7643. for lib in $dlprefiles; do
  7644. case $lib in
  7645. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  7646. *) abs=`pwd`"/$lib" ;;
  7647. esac
  7648. newdlprefiles="$newdlprefiles $abs"
  7649. done
  7650. dlprefiles="$newdlprefiles"
  7651. fi
  7652. $RM $output
  7653. # place dlname in correct position for cygwin
  7654. tdlname=$dlname
  7655. case $host,$output,$installed,$module,$dlname in
  7656. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  7657. esac
  7658. $ECHO > $output "\
  7659. # $outputname - a libtool library file
  7660. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  7661. #
  7662. # Please DO NOT delete this file!
  7663. # It is necessary for linking the library.
  7664. # The name that we can dlopen(3).
  7665. dlname='$tdlname'
  7666. # Names of this library.
  7667. library_names='$library_names'
  7668. # The name of the static archive.
  7669. old_library='$old_library'
  7670. # Linker flags that can not go in dependency_libs.
  7671. inherited_linker_flags='$new_inherited_linker_flags'
  7672. # Libraries that this one depends upon.
  7673. dependency_libs='$dependency_libs'
  7674. # Names of additional weak libraries provided by this library
  7675. weak_library_names='$weak_libs'
  7676. # Version information for $libname.
  7677. current=$current
  7678. age=$age
  7679. revision=$revision
  7680. # Is this an already installed library?
  7681. installed=$installed
  7682. # Should we warn about portability when linking against -modules?
  7683. shouldnotlink=$module
  7684. # Files to dlopen/dlpreopen
  7685. dlopen='$dlfiles'
  7686. dlpreopen='$dlprefiles'
  7687. # Directory that this library needs to be installed in:
  7688. libdir='$install_libdir'"
  7689. if test "$installed" = no && test "$need_relink" = yes; then
  7690. $ECHO >> $output "\
  7691. relink_command=\"$relink_command\""
  7692. fi
  7693. done
  7694. }
  7695. # Do a symbolic link so that the libtool archive can be found in
  7696. # LD_LIBRARY_PATH before the program is installed.
  7697. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  7698. ;;
  7699. esac
  7700. exit $EXIT_SUCCESS
  7701. }
  7702. { test "$mode" = link || test "$mode" = relink; } &&
  7703. func_mode_link ${1+"$@"}
  7704. # func_mode_uninstall arg...
  7705. func_mode_uninstall ()
  7706. {
  7707. $opt_debug
  7708. RM="$nonopt"
  7709. files=
  7710. rmforce=
  7711. exit_status=0
  7712. # This variable tells wrapper scripts just to set variables rather
  7713. # than running their programs.
  7714. libtool_install_magic="$magic"
  7715. for arg
  7716. do
  7717. case $arg in
  7718. -f) RM="$RM $arg"; rmforce=yes ;;
  7719. -*) RM="$RM $arg" ;;
  7720. *) files="$files $arg" ;;
  7721. esac
  7722. done
  7723. test -z "$RM" && \
  7724. func_fatal_help "you must specify an RM program"
  7725. rmdirs=
  7726. origobjdir="$objdir"
  7727. for file in $files; do
  7728. func_dirname "$file" "" "."
  7729. dir="$func_dirname_result"
  7730. if test "X$dir" = X.; then
  7731. objdir="$origobjdir"
  7732. else
  7733. objdir="$dir/$origobjdir"
  7734. fi
  7735. func_basename "$file"
  7736. name="$func_basename_result"
  7737. test "$mode" = uninstall && objdir="$dir"
  7738. # Remember objdir for removal later, being careful to avoid duplicates
  7739. if test "$mode" = clean; then
  7740. case " $rmdirs " in
  7741. *" $objdir "*) ;;
  7742. *) rmdirs="$rmdirs $objdir" ;;
  7743. esac
  7744. fi
  7745. # Don't error if the file doesn't exist and rm -f was used.
  7746. if { test -L "$file"; } >/dev/null 2>&1 ||
  7747. { test -h "$file"; } >/dev/null 2>&1 ||
  7748. test -f "$file"; then
  7749. :
  7750. elif test -d "$file"; then
  7751. exit_status=1
  7752. continue
  7753. elif test "$rmforce" = yes; then
  7754. continue
  7755. fi
  7756. rmfiles="$file"
  7757. case $name in
  7758. *.la)
  7759. # Possibly a libtool archive, so verify it.
  7760. if func_lalib_p "$file"; then
  7761. func_source $dir/$name
  7762. # Delete the libtool libraries and symlinks.
  7763. for n in $library_names; do
  7764. rmfiles="$rmfiles $objdir/$n"
  7765. done
  7766. test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  7767. case "$mode" in
  7768. clean)
  7769. case " $library_names " in
  7770. # " " in the beginning catches empty $dlname
  7771. *" $dlname "*) ;;
  7772. *) rmfiles="$rmfiles $objdir/$dlname" ;;
  7773. esac
  7774. test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  7775. ;;
  7776. uninstall)
  7777. if test -n "$library_names"; then
  7778. # Do each command in the postuninstall commands.
  7779. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  7780. fi
  7781. if test -n "$old_library"; then
  7782. # Do each command in the old_postuninstall commands.
  7783. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  7784. fi
  7785. # FIXME: should reinstall the best remaining shared library.
  7786. ;;
  7787. esac
  7788. fi
  7789. ;;
  7790. *.lo)
  7791. # Possibly a libtool object, so verify it.
  7792. if func_lalib_p "$file"; then
  7793. # Read the .lo file
  7794. func_source $dir/$name
  7795. # Add PIC object to the list of files to remove.
  7796. if test -n "$pic_object" &&
  7797. test "$pic_object" != none; then
  7798. rmfiles="$rmfiles $dir/$pic_object"
  7799. fi
  7800. # Add non-PIC object to the list of files to remove.
  7801. if test -n "$non_pic_object" &&
  7802. test "$non_pic_object" != none; then
  7803. rmfiles="$rmfiles $dir/$non_pic_object"
  7804. fi
  7805. fi
  7806. ;;
  7807. *)
  7808. if test "$mode" = clean ; then
  7809. noexename=$name
  7810. case $file in
  7811. *.exe)
  7812. func_stripname '' '.exe' "$file"
  7813. file=$func_stripname_result
  7814. func_stripname '' '.exe' "$name"
  7815. noexename=$func_stripname_result
  7816. # $file with .exe has already been added to rmfiles,
  7817. # add $file without .exe
  7818. rmfiles="$rmfiles $file"
  7819. ;;
  7820. esac
  7821. # Do a test to see if this is a libtool program.
  7822. if func_ltwrapper_p "$file"; then
  7823. if func_ltwrapper_executable_p "$file"; then
  7824. func_ltwrapper_scriptname "$file"
  7825. relink_command=
  7826. func_source $func_ltwrapper_scriptname_result
  7827. rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
  7828. else
  7829. relink_command=
  7830. func_source $dir/$noexename
  7831. fi
  7832. # note $name still contains .exe if it was in $file originally
  7833. # as does the version of $file that was added into $rmfiles
  7834. rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  7835. if test "$fast_install" = yes && test -n "$relink_command"; then
  7836. rmfiles="$rmfiles $objdir/lt-$name"
  7837. fi
  7838. if test "X$noexename" != "X$name" ; then
  7839. rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  7840. fi
  7841. fi
  7842. fi
  7843. ;;
  7844. esac
  7845. func_show_eval "$RM $rmfiles" 'exit_status=1'
  7846. done
  7847. objdir="$origobjdir"
  7848. # Try to remove the ${objdir}s in the directories where we deleted files
  7849. for dir in $rmdirs; do
  7850. if test -d "$dir"; then
  7851. func_show_eval "rmdir $dir >/dev/null 2>&1"
  7852. fi
  7853. done
  7854. exit $exit_status
  7855. }
  7856. { test "$mode" = uninstall || test "$mode" = clean; } &&
  7857. func_mode_uninstall ${1+"$@"}
  7858. test -z "$mode" && {
  7859. help="$generic_help"
  7860. func_fatal_help "you must specify a MODE"
  7861. }
  7862. test -z "$exec_cmd" && \
  7863. func_fatal_help "invalid operation mode \`$mode'"
  7864. if test -n "$exec_cmd"; then
  7865. eval exec "$exec_cmd"
  7866. exit $EXIT_FAILURE
  7867. fi
  7868. exit $exit_status
  7869. # The TAGs below are defined such that we never get into a situation
  7870. # in which we disable both kinds of libraries. Given conflicting
  7871. # choices, we go for a static library, that is the most portable,
  7872. # since we can't tell whether shared libraries were disabled because
  7873. # the user asked for that or because the platform doesn't support
  7874. # them. This is particularly important on AIX, because we don't
  7875. # support having both static and shared libraries enabled at the same
  7876. # time on that platform, so we default to a shared-only configuration.
  7877. # If a disable-shared tag is given, we'll fallback to a static-only
  7878. # configuration. But we'll never go from static-only to shared-only.
  7879. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  7880. build_libtool_libs=no
  7881. build_old_libs=yes
  7882. # ### END LIBTOOL TAG CONFIG: disable-shared
  7883. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  7884. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  7885. # ### END LIBTOOL TAG CONFIG: disable-static
  7886. # Local Variables:
  7887. # mode:shell-script
  7888. # sh-indentation:2
  7889. # End:
  7890. # vi:sw=2