You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11797 lines
337 KiB

  1. #! /bin/sh
  2. # Generated automatically by config.status (xerces-c) 3.1.2
  3. # Libtool was configured on host perseus.informatik.rwth-aachen.de:
  4. # NOTE: Changes made to this file will be lost: look at ltmain.sh.
  5. # Provide generalized library-building support services.
  6. # Written by Gordon Matzigkeit, 1996
  7. # Copyright (C) 2014 Free Software Foundation, Inc.
  8. # This is free software; see the source for copying conditions. There is NO
  9. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. # GNU Libtool is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of of the License, or
  13. # (at your option) any later version.
  14. #
  15. # As a special exception to the GNU General Public License, if you
  16. # distribute this file as part of a program or library that is built
  17. # using GNU Libtool, you may include this file under the same
  18. # distribution terms that you use for the rest of that program.
  19. #
  20. # GNU Libtool is distributed in the hope that it will be useful, but
  21. # WITHOUT ANY WARRANTY; without even the implied warranty of
  22. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. # GNU General Public License for more details.
  24. #
  25. # You should have received a copy of the GNU General Public License
  26. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  27. # The names of the tagged configurations supported by this script.
  28. available_tags='CXX '
  29. # Configured defaults for sys_lib_dlsearch_path munging.
  30. : ${LT_SYS_LIBRARY_PATH=""}
  31. # ### BEGIN LIBTOOL CONFIG
  32. # Assembler program.
  33. AS="as"
  34. # DLL creation program.
  35. DLLTOOL="dlltool"
  36. # Object dumper program.
  37. OBJDUMP="objdump"
  38. # Which release of libtool.m4 was used?
  39. macro_version=2.4.5
  40. macro_revision=2.4.5
  41. # Whether or not to build shared libraries.
  42. build_libtool_libs=yes
  43. # Whether or not to build static libraries.
  44. build_old_libs=yes
  45. # What type of objects to build.
  46. pic_mode=default
  47. # Whether or not to optimize for fast installation.
  48. fast_install=needless
  49. # Shared archive member basename,for filename based shared library versioning on AIX.
  50. shared_archive_member_spec=
  51. # Shell to use when invoking shell scripts.
  52. SHELL="/bin/sh"
  53. # An echo program that protects backslashes.
  54. ECHO="printf %s\\n"
  55. # The PATH separator for the build system.
  56. PATH_SEPARATOR=":"
  57. # The host system.
  58. host_alias=
  59. host=x86_64-apple-darwin14.5.0
  60. host_os=darwin14.5.0
  61. # The build system.
  62. build_alias=
  63. build=x86_64-apple-darwin14.5.0
  64. build_os=darwin14.5.0
  65. # A sed program that does not truncate output.
  66. SED="/usr/bin/sed"
  67. # Sed that helps us avoid accidentally triggering echo(1) options like -n.
  68. Xsed="$SED -e 1s/^X//"
  69. # A grep program that handles long lines.
  70. GREP="/usr/bin/grep"
  71. # An ERE matcher.
  72. EGREP="/usr/bin/grep -E"
  73. # A literal string matcher.
  74. FGREP="/usr/bin/grep -F"
  75. # A BSD- or MS-compatible name lister.
  76. NM="/usr/bin/nm"
  77. # Whether we need soft or hard links.
  78. LN_S="ln -s"
  79. # What is the maximum length of a command?
  80. max_cmd_len=196608
  81. # Object file suffix (normally "o").
  82. objext=o
  83. # Executable file suffix (normally "").
  84. exeext=
  85. # whether the shell understands "unset".
  86. lt_unset=unset
  87. # turn spaces into newlines.
  88. SP2NL="tr \\040 \\012"
  89. # turn newlines into spaces.
  90. NL2SP="tr \\015\\012 \\040\\040"
  91. # convert $build file names to $host format.
  92. to_host_file_cmd=func_convert_file_noop
  93. # convert $build files to toolchain format.
  94. to_tool_file_cmd=func_convert_file_noop
  95. # Method to check whether dependent libraries are shared objects.
  96. deplibs_check_method="pass_all"
  97. # Command to use when deplibs_check_method = "file_magic".
  98. file_magic_cmd="\$MAGIC_CMD"
  99. # How to find potential files when deplibs_check_method = "file_magic".
  100. file_magic_glob=""
  101. # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
  102. want_nocaseglob="no"
  103. # Command to associate shared and link libraries.
  104. sharedlib_from_linklib_cmd="printf %s\\n"
  105. # The archiver.
  106. AR="ar"
  107. # Flags to create an archive.
  108. AR_FLAGS="cru"
  109. # How to feed a file listing to the archiver.
  110. archiver_list_spec=""
  111. # A symbol stripping program.
  112. STRIP="strip"
  113. # Commands used to install an old-style archive.
  114. RANLIB="ranlib"
  115. old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
  116. old_postuninstall_cmds=""
  117. # Whether to use a lock for old archive extraction.
  118. lock_old_archive_extraction=yes
  119. # A C compiler.
  120. LTCC="gcc"
  121. # LTCC compiler flags.
  122. LTCFLAGS="-g -O2"
  123. # Take the output of nm and produce a listing of raw symbols and C names.
  124. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p' | sed '/ __gnu_lto/d'"
  125. # Transform the output of nm in a proper C declaration.
  126. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[BCDEGRST][BCDEGRST]* .* \\(.*\\)\$/extern char \\1;/p'"
  127. # Transform the output of nm into a list of symbols to manually relocate.
  128. global_symbol_to_import=""
  129. # Transform the output of nm in a C name address pair.
  130. global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[BCDEGRST][BCDEGRST]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
  131. # Transform the output of nm in a C name address pair when lib prefix is needed.
  132. global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[BCDEGRST][BCDEGRST]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[BCDEGRST][BCDEGRST]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'"
  133. # The name lister interface.
  134. nm_interface="BSD nm"
  135. # Specify filename containing input files for $NM.
  136. nm_file_list_spec=""
  137. # The root where to search for dependent libraries,and where our libraries should be installed.
  138. lt_sysroot=
  139. # Command to truncate a binary pipe.
  140. lt_truncate_bin="/bin/dd bs=4096 count=1"
  141. # The name of the directory that contains temporary libtool files.
  142. objdir=.libs
  143. # Used to examine libraries when file_magic_cmd begins with "file".
  144. MAGIC_CMD=file
  145. # Must we lock files when doing compilation?
  146. need_locks="no"
  147. # Manifest tool.
  148. MANIFEST_TOOL=":"
  149. # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
  150. DSYMUTIL="dsymutil"
  151. # Tool to change global to local symbols on Mac OS X.
  152. NMEDIT="nmedit"
  153. # Tool to manipulate fat objects and archives on Mac OS X.
  154. LIPO="lipo"
  155. # ldd/readelf like tool for Mach-O binaries on Mac OS X.
  156. OTOOL="otool"
  157. # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
  158. OTOOL64=":"
  159. # Old archive suffix (normally "a").
  160. libext=a
  161. # Shared library suffix (normally ".so").
  162. shrext_cmds="\`test .\$module = .yes && echo .so || echo .dylib\`"
  163. # The commands to extract the exported symbol list from a shared archive.
  164. extract_expsyms_cmds=""
  165. # Variables whose values should be saved in libtool wrapper scripts and
  166. # restored at link time.
  167. variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
  168. # Do we need the "lib" prefix for modules?
  169. need_lib_prefix=no
  170. # Do we need a version for libraries?
  171. need_version=no
  172. # Library versioning type.
  173. version_type=darwin
  174. # Shared library runtime path variable.
  175. runpath_var=
  176. # Shared library path variable.
  177. shlibpath_var=DYLD_LIBRARY_PATH
  178. # Is shlibpath searched before the hard-coded library search path?
  179. shlibpath_overrides_runpath=yes
  180. # Format of library name prefix.
  181. libname_spec="lib\$name"
  182. # List of archive names. First name is the real one, the rest are links.
  183. # The last name is the one that the linker finds with -lNAME
  184. library_names_spec="\$libname\$release\$major\$shared_ext \$libname\$shared_ext"
  185. # The coded name of the library, if different from the real name.
  186. soname_spec="\$libname\$release\$major\$shared_ext"
  187. # Permission mode override for installation of shared libraries.
  188. install_override_mode=""
  189. # Command to use after installation of a shared archive.
  190. postinstall_cmds=""
  191. # Command to use after uninstallation of a shared archive.
  192. postuninstall_cmds=""
  193. # Commands used to finish a libtool library installation in a directory.
  194. finish_cmds=""
  195. # As "finish_cmds", except a single script fragment to be evaled but
  196. # not shown.
  197. finish_eval=""
  198. # Whether we should hardcode library paths into libraries.
  199. hardcode_into_libs=no
  200. # Compile-time system search path for libraries.
  201. sys_lib_search_path_spec="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/7.0.0 /usr/local/lib"
  202. # Run-time system search path for libraries.
  203. sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib"
  204. # Whether dlopen is supported.
  205. dlopen_support=unknown
  206. # Whether dlopen of programs is supported.
  207. dlopen_self=unknown
  208. # Whether dlopen of statically linked programs is supported.
  209. dlopen_self_static=unknown
  210. # Commands to strip libraries.
  211. old_striplib="strip -S"
  212. striplib="strip -x"
  213. # The linker used to build libraries.
  214. LD="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
  215. # How to create reloadable object files.
  216. reload_flag=" -r"
  217. reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \$wl-r -o \$output\$reload_objs"
  218. # Commands used to build an old-style archive.
  219. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  220. # A language specific compiler.
  221. CC="gcc"
  222. # Is the compiler the GNU compiler?
  223. with_gcc=yes
  224. # Compiler flag to turn off builtin functions.
  225. no_builtin_flag=" -fno-builtin -fno-rtti -fno-exceptions"
  226. # Additional compiler flags for building library objects.
  227. pic_flag=" -fno-common -DPIC"
  228. # How to pass a linker flag through the compiler.
  229. wl="-Wl,"
  230. # Compiler flag to prevent dynamic linking.
  231. link_static_flag=""
  232. # Does compiler simultaneously support -c and -o options?
  233. compiler_c_o="yes"
  234. # Whether or not to add -lc for building shared libraries.
  235. build_libtool_need_lc=no
  236. # Whether or not to disallow shared libs when runtime libs are static.
  237. allow_libtool_libs_with_static_runtimes=no
  238. # Compiler flag to allow reflexive dlopens.
  239. export_dynamic_flag_spec=""
  240. # Compiler flag to generate shared objects directly from archives.
  241. whole_archive_flag_spec="\`for conv in \$convenience\\\"\\\"; do test -n \\\"\$conv\\\" && new_convenience=\\\"\$new_convenience \$wl-force_load,\$conv\\\"; done; func_echo_all \\\"\$new_convenience\\\"\`"
  242. # Whether the compiler copes with passing no objects directly.
  243. compiler_needs_object="no"
  244. # Create an old-style archive from a shared archive.
  245. old_archive_from_new_cmds=""
  246. # Create a temporary old-style archive to link instead of a shared archive.
  247. old_archive_from_expsyms_cmds=""
  248. # Commands used to build a shared archive.
  249. archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module"
  250. 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 \$single_module \$wl-exported_symbols_list,\$output_objdir/\$libname-symbols.expsym"
  251. # Commands used to build a loadable module if different from building
  252. # a shared archive.
  253. module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags"
  254. 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"
  255. # Whether we are building with GNU ld or not.
  256. with_gnu_ld="no"
  257. # Flag that allows shared libraries with undefined symbols to be built.
  258. allow_undefined_flag="\$wl-undefined \${wl}dynamic_lookup"
  259. # Flag that enforces no undefined symbols.
  260. no_undefined_flag=""
  261. # Flag to hardcode $libdir into a binary during linking.
  262. # This must work even if $libdir does not exist
  263. hardcode_libdir_flag_spec=""
  264. # Whether we need a single "-rpath" flag with a separated argument.
  265. hardcode_libdir_separator=""
  266. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  267. # DIR into the resulting binary.
  268. hardcode_direct=no
  269. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  270. # DIR into the resulting binary and the resulting library dependency is
  271. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  272. # library is relocated.
  273. hardcode_direct_absolute=no
  274. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  275. # into the resulting binary.
  276. hardcode_minus_L=no
  277. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  278. # into the resulting binary.
  279. hardcode_shlibpath_var=unsupported
  280. # Set to "yes" if building a shared library automatically hardcodes DIR
  281. # into the library and all subsequent libraries and executables linked
  282. # against it.
  283. hardcode_automatic=yes
  284. # Set to yes if linker adds runtime paths of dependent libraries
  285. # to runtime path list.
  286. inherit_rpath=no
  287. # Whether libtool must link a program against all its dependency libraries.
  288. link_all_deplibs=yes
  289. # Set to "yes" if exported symbols are required.
  290. always_export_symbols=no
  291. # The commands to list exported symbols.
  292. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
  293. # Symbols that should not be listed in the preloaded symbols.
  294. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
  295. # Symbols that must always be exported.
  296. include_expsyms=""
  297. # Commands necessary for linking programs (against libraries) with templates.
  298. prelink_cmds=""
  299. # Commands necessary for finishing linking programs.
  300. postlink_cmds=""
  301. # Specify filename containing input files.
  302. file_list_spec=""
  303. # How to hardcode a shared library path into an executable.
  304. hardcode_action=immediate
  305. # The directories searched by this compiler when creating a shared library.
  306. compiler_lib_search_dirs=""
  307. # Dependencies to place before and after the objects being linked to
  308. # create a shared library.
  309. predep_objects=""
  310. postdep_objects=""
  311. predeps=""
  312. postdeps=""
  313. # The library search path used internally by the compiler when linking
  314. # a shared library.
  315. compiler_lib_search_path=""
  316. # ### END LIBTOOL CONFIG
  317. ## -------------------------------------- ##
  318. ## Shell functions shared with configure. ##
  319. ## -------------------------------------- ##
  320. # func_munge_path_list VARIABLE PATH
  321. # -----------------------------------
  322. # VARIABLE is name of variable containing _space_ separated list of
  323. # directories to be munged by the contents of PATH, which is string
  324. # having a format:
  325. # "DIR[:DIR]:"
  326. # string "DIR[ DIR]" will be prepended to VARIABLE
  327. # ":DIR[:DIR]"
  328. # string "DIR[ DIR]" will be appended to VARIABLE
  329. # "DIRP[:DIRP]::[DIRA:]DIRA"
  330. # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
  331. # "DIRA[ DIRA]" will be appended to VARIABLE
  332. # "DIR[:DIR]"
  333. # VARIABLE will be replaced by "DIR[ DIR]"
  334. func_munge_path_list ()
  335. {
  336. case x$2 in
  337. x)
  338. ;;
  339. *:)
  340. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \S|@1\"
  341. ;;
  342. x:*)
  343. eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
  344. ;;
  345. *::*)
  346. eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
  347. eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
  348. ;;
  349. *)
  350. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
  351. ;;
  352. esac
  353. }
  354. # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
  355. func_cc_basename ()
  356. {
  357. for cc_temp in $*""; do
  358. case $cc_temp in
  359. compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
  360. distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
  361. \-*) ;;
  362. *) break;;
  363. esac
  364. done
  365. func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
  366. }
  367. #! /bin/sh
  368. ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
  369. ## by inline-source v2014-01-03.01
  370. # libtool (GNU libtool) 2.4.5
  371. # Provide generalized library-building support services.
  372. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  373. # Copyright (C) 1996-2015 Free Software Foundation, Inc.
  374. # This is free software; see the source for copying conditions. There is NO
  375. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  376. # GNU Libtool is free software; you can redistribute it and/or modify
  377. # it under the terms of the GNU General Public License as published by
  378. # the Free Software Foundation; either version 2 of the License, or
  379. # (at your option) any later version.
  380. #
  381. # As a special exception to the GNU General Public License,
  382. # if you distribute this file as part of a program or library that
  383. # is built using GNU Libtool, you may include this file under the
  384. # same distribution terms that you use for the rest of that program.
  385. #
  386. # GNU Libtool is distributed in the hope that it will be useful, but
  387. # WITHOUT ANY WARRANTY; without even the implied warranty of
  388. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  389. # General Public License for more details.
  390. #
  391. # You should have received a copy of the GNU General Public License
  392. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  393. PROGRAM=libtool
  394. PACKAGE=libtool
  395. VERSION=2.4.5
  396. package_revision=2.4.5
  397. ## ------ ##
  398. ## Usage. ##
  399. ## ------ ##
  400. # Run './libtool --help' for help with using this script from the
  401. # command line.
  402. ## ------------------------------- ##
  403. ## User overridable command paths. ##
  404. ## ------------------------------- ##
  405. # After configure completes, it has a better idea of some of the
  406. # shell tools we need than the defaults used by the functions shared
  407. # with bootstrap, so set those here where they can still be over-
  408. # ridden by the user, but otherwise take precedence.
  409. : ${AUTOCONF="autoconf"}
  410. : ${AUTOMAKE="automake"}
  411. ## -------------------------- ##
  412. ## Source external libraries. ##
  413. ## -------------------------- ##
  414. # Much of our low-level functionality needs to be sourced from external
  415. # libraries, which are installed to $pkgauxdir.
  416. # Set a version string for this script.
  417. scriptversion=2014-01-03.01; # UTC
  418. # General shell script boiler plate, and helper functions.
  419. # Written by Gary V. Vaughan, 2004
  420. # Copyright (C) 2004-2015 Free Software Foundation, Inc.
  421. # This is free software; see the source for copying conditions. There is NO
  422. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  423. # This program is free software; you can redistribute it and/or modify
  424. # it under the terms of the GNU General Public License as published by
  425. # the Free Software Foundation; either version 3 of the License, or
  426. # (at your option) any later version.
  427. # As a special exception to the GNU General Public License, if you distribute
  428. # this file as part of a program or library that is built using GNU Libtool,
  429. # you may include this file under the same distribution terms that you use
  430. # for the rest of that program.
  431. # This program is distributed in the hope that it will be useful,
  432. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  433. # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
  434. # General Public License for more details.
  435. # You should have received a copy of the GNU General Public License
  436. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  437. # Please report bugs or propose patches to gary@gnu.org.
  438. ## ------ ##
  439. ## Usage. ##
  440. ## ------ ##
  441. # Evaluate this file near the top of your script to gain access to
  442. # the functions and variables defined here:
  443. #
  444. # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  445. #
  446. # If you need to override any of the default environment variable
  447. # settings, do that before evaluating this file.
  448. ## -------------------- ##
  449. ## Shell normalisation. ##
  450. ## -------------------- ##
  451. # Some shells need a little help to be as Bourne compatible as possible.
  452. # Before doing anything else, make sure all that help has been provided!
  453. DUALCASE=1; export DUALCASE # for MKS sh
  454. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  455. emulate sh
  456. NULLCMD=:
  457. # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  458. # is contrary to our usage. Disable this feature.
  459. alias -g '${1+"$@"}'='"$@"'
  460. setopt NO_GLOB_SUBST
  461. else
  462. case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  463. fi
  464. # NLS nuisances: We save the old values in case they are required later.
  465. _G_user_locale=
  466. _G_safe_locale=
  467. for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  468. do
  469. eval "if test set = \"\${$_G_var+set}\"; then
  470. save_$_G_var=\$$_G_var
  471. $_G_var=C
  472. export $_G_var
  473. _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  474. _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  475. fi"
  476. done
  477. # CDPATH.
  478. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  479. # Make sure IFS has a sensible default
  480. sp=' '
  481. nl='
  482. '
  483. IFS="$sp $nl"
  484. # There are apparently some retarded systems that use ';' as a PATH separator!
  485. if test "${PATH_SEPARATOR+set}" != set; then
  486. PATH_SEPARATOR=:
  487. (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  488. (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  489. PATH_SEPARATOR=';'
  490. }
  491. fi
  492. ## ------------------------- ##
  493. ## Locate command utilities. ##
  494. ## ------------------------- ##
  495. # func_executable_p FILE
  496. # ----------------------
  497. # Check that FILE is an executable regular file.
  498. func_executable_p ()
  499. {
  500. test -f "$1" && test -x "$1"
  501. }
  502. # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  503. # --------------------------------------------
  504. # Search for either a program that responds to --version with output
  505. # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  506. # trying all the directories in PATH with each of the elements of
  507. # PROGS_LIST.
  508. #
  509. # CHECK_FUNC should accept the path to a candidate program, and
  510. # set $func_check_prog_result if it truncates its output less than
  511. # $_G_path_prog_max characters.
  512. func_path_progs ()
  513. {
  514. _G_progs_list=$1
  515. _G_check_func=$2
  516. _G_PATH=${3-"$PATH"}
  517. _G_path_prog_max=0
  518. _G_path_prog_found=false
  519. _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  520. for _G_dir in $_G_PATH; do
  521. IFS=$_G_save_IFS
  522. test -z "$_G_dir" && _G_dir=.
  523. for _G_prog_name in $_G_progs_list; do
  524. for _exeext in '' .EXE; do
  525. _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  526. func_executable_p "$_G_path_prog" || continue
  527. case `"$_G_path_prog" --version 2>&1` in
  528. *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  529. *) $_G_check_func $_G_path_prog
  530. func_path_progs_result=$func_check_prog_result
  531. ;;
  532. esac
  533. $_G_path_prog_found && break 3
  534. done
  535. done
  536. done
  537. IFS=$_G_save_IFS
  538. test -z "$func_path_progs_result" && {
  539. echo "no acceptable sed could be found in \$PATH" >&2
  540. exit 1
  541. }
  542. }
  543. # We want to be able to use the functions in this file before configure
  544. # has figured out where the best binaries are kept, which means we have
  545. # to search for them ourselves - except when the results are already set
  546. # where we skip the searches.
  547. # Unless the user overrides by setting SED, search the path for either GNU
  548. # sed, or the sed that truncates its output the least.
  549. test -z "$SED" && {
  550. _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  551. for _G_i in 1 2 3 4 5 6 7; do
  552. _G_sed_script=$_G_sed_script$nl$_G_sed_script
  553. done
  554. echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  555. _G_sed_script=
  556. func_check_prog_sed ()
  557. {
  558. _G_path_prog=$1
  559. _G_count=0
  560. printf 0123456789 >conftest.in
  561. while :
  562. do
  563. cat conftest.in conftest.in >conftest.tmp
  564. mv conftest.tmp conftest.in
  565. cp conftest.in conftest.nl
  566. echo '' >> conftest.nl
  567. "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  568. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  569. _G_count=`expr $_G_count + 1`
  570. if test "$_G_count" -gt "$_G_path_prog_max"; then
  571. # Best one so far, save it but keep looking for a better one
  572. func_check_prog_result=$_G_path_prog
  573. _G_path_prog_max=$_G_count
  574. fi
  575. # 10*(2^10) chars as input seems more than enough
  576. test 10 -lt "$_G_count" && break
  577. done
  578. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  579. }
  580. func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
  581. rm -f conftest.sed
  582. SED=$func_path_progs_result
  583. }
  584. # Unless the user overrides by setting GREP, search the path for either GNU
  585. # grep, or the grep that truncates its output the least.
  586. test -z "$GREP" && {
  587. func_check_prog_grep ()
  588. {
  589. _G_path_prog=$1
  590. _G_count=0
  591. _G_path_prog_max=0
  592. printf 0123456789 >conftest.in
  593. while :
  594. do
  595. cat conftest.in conftest.in >conftest.tmp
  596. mv conftest.tmp conftest.in
  597. cp conftest.in conftest.nl
  598. echo 'GREP' >> conftest.nl
  599. "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  600. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  601. _G_count=`expr $_G_count + 1`
  602. if test "$_G_count" -gt "$_G_path_prog_max"; then
  603. # Best one so far, save it but keep looking for a better one
  604. func_check_prog_result=$_G_path_prog
  605. _G_path_prog_max=$_G_count
  606. fi
  607. # 10*(2^10) chars as input seems more than enough
  608. test 10 -lt "$_G_count" && break
  609. done
  610. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  611. }
  612. func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
  613. GREP=$func_path_progs_result
  614. }
  615. ## ------------------------------- ##
  616. ## User overridable command paths. ##
  617. ## ------------------------------- ##
  618. # All uppercase variable names are used for environment variables. These
  619. # variables can be overridden by the user before calling a script that
  620. # uses them if a suitable command of that name is not already available
  621. # in the command search PATH.
  622. : ${CP="cp -f"}
  623. : ${ECHO="printf %s\n"}
  624. : ${EGREP="$GREP -E"}
  625. : ${FGREP="$GREP -F"}
  626. : ${LN_S="ln -s"}
  627. : ${MAKE="make"}
  628. : ${MKDIR="mkdir"}
  629. : ${MV="mv -f"}
  630. : ${RM="rm -f"}
  631. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  632. ## -------------------- ##
  633. ## Useful sed snippets. ##
  634. ## -------------------- ##
  635. sed_dirname='s|/[^/]*$||'
  636. sed_basename='s|^.*/||'
  637. # Sed substitution that helps us do robust quoting. It backslashifies
  638. # metacharacters that are still active within double-quoted strings.
  639. sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  640. # Same as above, but do not quote variable references.
  641. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  642. # Sed substitution that turns a string into a regex matching for the
  643. # string literally.
  644. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  645. # Sed substitution that converts a w32 file name or path
  646. # that contains forward slashes, into one that contains
  647. # (escaped) backslashes. A very naive implementation.
  648. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  649. # Re-'\' parameter expansions in output of sed_double_quote_subst that
  650. # were '\'-ed in input to the same. If an odd number of '\' preceded a
  651. # '$' in input to sed_double_quote_subst, that '$' was protected from
  652. # expansion. Since each input '\' is now two '\'s, look for any number
  653. # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
  654. _G_bs='\\'
  655. _G_bs2='\\\\'
  656. _G_bs4='\\\\\\\\'
  657. _G_dollar='\$'
  658. sed_double_backslash="\
  659. s/$_G_bs4/&\\
  660. /g
  661. s/^$_G_bs2$_G_dollar/$_G_bs&/
  662. s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  663. s/\n//g"
  664. ## ----------------- ##
  665. ## Global variables. ##
  666. ## ----------------- ##
  667. # Except for the global variables explicitly listed below, the following
  668. # functions in the '^func_' namespace, and the '^require_' namespace
  669. # variables initialised in the 'Resource management' section, sourcing
  670. # this file will not pollute your global namespace with anything
  671. # else. There's no portable way to scope variables in Bourne shell
  672. # though, so actually running these functions will sometimes place
  673. # results into a variable named after the function, and often use
  674. # temporary variables in the '^_G_' namespace. If you are careful to
  675. # avoid using those namespaces casually in your sourcing script, things
  676. # should continue to work as you expect. And, of course, you can freely
  677. # overwrite any of the functions or variables defined here before
  678. # calling anything to customize them.
  679. EXIT_SUCCESS=0
  680. EXIT_FAILURE=1
  681. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  682. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  683. # Allow overriding, eg assuming that you follow the convention of
  684. # putting '$debug_cmd' at the start of all your functions, you can get
  685. # bash to show function call trace with:
  686. #
  687. # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  688. debug_cmd=${debug_cmd-":"}
  689. exit_cmd=:
  690. # By convention, finish your script with:
  691. #
  692. # exit $exit_status
  693. #
  694. # so that you can set exit_status to non-zero if you want to indicate
  695. # something went wrong during execution without actually bailing out at
  696. # the point of failure.
  697. exit_status=$EXIT_SUCCESS
  698. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  699. # is ksh but when the shell is invoked as "sh" and the current value of
  700. # the _XPG environment variable is not equal to 1 (one), the special
  701. # positional parameter $0, within a function call, is the name of the
  702. # function.
  703. progpath=$0
  704. # The name of this program.
  705. progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  706. # Make sure we have an absolute progpath for reexecution:
  707. case $progpath in
  708. [\\/]*|[A-Za-z]:\\*) ;;
  709. *[\\/]*)
  710. progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  711. progdir=`cd "$progdir" && pwd`
  712. progpath=$progdir/$progname
  713. ;;
  714. *)
  715. _G_IFS=$IFS
  716. IFS=${PATH_SEPARATOR-:}
  717. for progdir in $PATH; do
  718. IFS=$_G_IFS
  719. test -x "$progdir/$progname" && break
  720. done
  721. IFS=$_G_IFS
  722. test -n "$progdir" || progdir=`pwd`
  723. progpath=$progdir/$progname
  724. ;;
  725. esac
  726. ## ----------------- ##
  727. ## Standard options. ##
  728. ## ----------------- ##
  729. # The following options affect the operation of the functions defined
  730. # below, and should be set appropriately depending on run-time para-
  731. # meters passed on the command line.
  732. opt_dry_run=false
  733. opt_quiet=false
  734. opt_verbose=false
  735. # Categories 'all' and 'none' are always available. Append any others
  736. # you will pass as the first argument to func_warning from your own
  737. # code.
  738. warning_categories=
  739. # By default, display warnings according to 'opt_warning_types'. Set
  740. # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
  741. # treat the next displayed warning as a fatal error.
  742. warning_func=func_warn_and_continue
  743. # Set to 'all' to display all warnings, 'none' to suppress all
  744. # warnings, or a space delimited list of some subset of
  745. # 'warning_categories' to display only the listed warnings.
  746. opt_warning_types=all
  747. ## -------------------- ##
  748. ## Resource management. ##
  749. ## -------------------- ##
  750. # This section contains definitions for functions that each ensure a
  751. # particular resource (a file, or a non-empty configuration variable for
  752. # example) is available, and if appropriate to extract default values
  753. # from pertinent package files. Call them using their associated
  754. # 'require_*' variable to ensure that they are executed, at most, once.
  755. #
  756. # It's entirely deliberate that calling these functions can set
  757. # variables that don't obey the namespace limitations obeyed by the rest
  758. # of this file, in order that that they be as useful as possible to
  759. # callers.
  760. # require_term_colors
  761. # -------------------
  762. # Allow display of bold text on terminals that support it.
  763. require_term_colors=func_require_term_colors
  764. func_require_term_colors ()
  765. {
  766. $debug_cmd
  767. test -t 1 && {
  768. # COLORTERM and USE_ANSI_COLORS environment variables take
  769. # precedence, because most terminfo databases neglect to describe
  770. # whether color sequences are supported.
  771. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  772. if test 1 = "$USE_ANSI_COLORS"; then
  773. # Standard ANSI escape sequences
  774. tc_reset=''
  775. tc_bold=''; tc_standout=''
  776. tc_red=''; tc_green=''
  777. tc_blue=''; tc_cyan=''
  778. else
  779. # Otherwise trust the terminfo database after all.
  780. test -n "`tput sgr0 2>/dev/null`" && {
  781. tc_reset=`tput sgr0`
  782. test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
  783. tc_standout=$tc_bold
  784. test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
  785. test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
  786. test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
  787. test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
  788. test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
  789. }
  790. fi
  791. }
  792. require_term_colors=:
  793. }
  794. ## ----------------- ##
  795. ## Function library. ##
  796. ## ----------------- ##
  797. # This section contains a variety of useful functions to call in your
  798. # scripts. Take note of the portable wrappers for features provided by
  799. # some modern shells, which will fall back to slower equivalents on
  800. # less featureful shells.
  801. # func_append VAR VALUE
  802. # ---------------------
  803. # Append VALUE onto the existing contents of VAR.
  804. # We should try to minimise forks, especially on Windows where they are
  805. # unreasonably slow, so skip the feature probes when bash or zsh are
  806. # being used:
  807. if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
  808. : ${_G_HAVE_ARITH_OP="yes"}
  809. : ${_G_HAVE_XSI_OPS="yes"}
  810. # The += operator was introduced in bash 3.1
  811. case $BASH_VERSION in
  812. [12].* | 3.0 | 3.0*) ;;
  813. *)
  814. : ${_G_HAVE_PLUSEQ_OP="yes"}
  815. ;;
  816. esac
  817. fi
  818. # _G_HAVE_PLUSEQ_OP
  819. # Can be empty, in which case the shell is probed, "yes" if += is
  820. # useable or anything else if it does not work.
  821. test -z "$_G_HAVE_PLUSEQ_OP" \
  822. && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
  823. && _G_HAVE_PLUSEQ_OP=yes
  824. if test yes = "$_G_HAVE_PLUSEQ_OP"
  825. then
  826. # This is an XSI compatible shell, allowing a faster implementation...
  827. eval 'func_append ()
  828. {
  829. $debug_cmd
  830. eval "$1+=\$2"
  831. }'
  832. else
  833. # ...otherwise fall back to using expr, which is often a shell builtin.
  834. func_append ()
  835. {
  836. $debug_cmd
  837. eval "$1=\$$1\$2"
  838. }
  839. fi
  840. # func_append_quoted VAR VALUE
  841. # ----------------------------
  842. # Quote VALUE and append to the end of shell variable VAR, separated
  843. # by a space.
  844. if test yes = "$_G_HAVE_PLUSEQ_OP"; then
  845. eval 'func_append_quoted ()
  846. {
  847. $debug_cmd
  848. func_quote_for_eval "$2"
  849. eval "$1+=\\ \$func_quote_for_eval_result"
  850. }'
  851. else
  852. func_append_quoted ()
  853. {
  854. $debug_cmd
  855. func_quote_for_eval "$2"
  856. eval "$1=\$$1\\ \$func_quote_for_eval_result"
  857. }
  858. fi
  859. # func_append_uniq VAR VALUE
  860. # --------------------------
  861. # Append unique VALUE onto the existing contents of VAR, assuming
  862. # entries are delimited by the first character of VALUE. For example:
  863. #
  864. # func_append_uniq options " --another-option option-argument"
  865. #
  866. # will only append to $options if " --another-option option-argument "
  867. # is not already present somewhere in $options already (note spaces at
  868. # each end implied by leading space in second argument).
  869. func_append_uniq ()
  870. {
  871. $debug_cmd
  872. eval _G_current_value='`$ECHO $'$1'`'
  873. _G_delim=`expr "$2" : '\(.\)'`
  874. case $_G_delim$_G_current_value$_G_delim in
  875. *"$2$_G_delim"*) ;;
  876. *) func_append "$@" ;;
  877. esac
  878. }
  879. # func_arith TERM...
  880. # ------------------
  881. # Set func_arith_result to the result of evaluating TERMs.
  882. test -z "$_G_HAVE_ARITH_OP" \
  883. && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
  884. && _G_HAVE_ARITH_OP=yes
  885. if test yes = "$_G_HAVE_ARITH_OP"; then
  886. eval 'func_arith ()
  887. {
  888. $debug_cmd
  889. func_arith_result=$(( $* ))
  890. }'
  891. else
  892. func_arith ()
  893. {
  894. $debug_cmd
  895. func_arith_result=`expr "$@"`
  896. }
  897. fi
  898. # func_basename FILE
  899. # ------------------
  900. # Set func_basename_result to FILE with everything up to and including
  901. # the last / stripped.
  902. if test yes = "$_G_HAVE_XSI_OPS"; then
  903. # If this shell supports suffix pattern removal, then use it to avoid
  904. # forking. Hide the definitions single quotes in case the shell chokes
  905. # on unsupported syntax...
  906. _b='func_basename_result=${1##*/}'
  907. _d='case $1 in
  908. */*) func_dirname_result=${1%/*}$2 ;;
  909. * ) func_dirname_result=$3 ;;
  910. esac'
  911. else
  912. # ...otherwise fall back to using sed.
  913. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
  914. _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
  915. if test "X$func_dirname_result" = "X$1"; then
  916. func_dirname_result=$3
  917. else
  918. func_append func_dirname_result "$2"
  919. fi'
  920. fi
  921. eval 'func_basename ()
  922. {
  923. $debug_cmd
  924. '"$_b"'
  925. }'
  926. # func_dirname FILE APPEND NONDIR_REPLACEMENT
  927. # -------------------------------------------
  928. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  929. # otherwise set result to NONDIR_REPLACEMENT.
  930. eval 'func_dirname ()
  931. {
  932. $debug_cmd
  933. '"$_d"'
  934. }'
  935. # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
  936. # --------------------------------------------------------
  937. # Perform func_basename and func_dirname in a single function
  938. # call:
  939. # dirname: Compute the dirname of FILE. If nonempty,
  940. # add APPEND to the result, otherwise set result
  941. # to NONDIR_REPLACEMENT.
  942. # value returned in "$func_dirname_result"
  943. # basename: Compute filename of FILE.
  944. # value retuned in "$func_basename_result"
  945. # For efficiency, we do not delegate to the functions above but instead
  946. # duplicate the functionality here.
  947. eval 'func_dirname_and_basename ()
  948. {
  949. $debug_cmd
  950. '"$_b"'
  951. '"$_d"'
  952. }'
  953. # func_echo ARG...
  954. # ----------------
  955. # Echo program name prefixed message.
  956. func_echo ()
  957. {
  958. $debug_cmd
  959. _G_message=$*
  960. func_echo_IFS=$IFS
  961. IFS=$nl
  962. for _G_line in $_G_message; do
  963. IFS=$func_echo_IFS
  964. $ECHO "$progname: $_G_line"
  965. done
  966. IFS=$func_echo_IFS
  967. }
  968. # func_echo_all ARG...
  969. # --------------------
  970. # Invoke $ECHO with all args, space-separated.
  971. func_echo_all ()
  972. {
  973. $ECHO "$*"
  974. }
  975. # func_echo_infix_1 INFIX ARG...
  976. # ------------------------------
  977. # Echo program name, followed by INFIX on the first line, with any
  978. # additional lines not showing INFIX.
  979. func_echo_infix_1 ()
  980. {
  981. $debug_cmd
  982. $require_term_colors
  983. _G_infix=$1; shift
  984. _G_indent=$_G_infix
  985. _G_prefix="$progname: $_G_infix: "
  986. _G_message=$*
  987. # Strip color escape sequences before counting printable length
  988. for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
  989. do
  990. test -n "$_G_tc" && {
  991. _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
  992. _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
  993. }
  994. done
  995. _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
  996. func_echo_infix_1_IFS=$IFS
  997. IFS=$nl
  998. for _G_line in $_G_message; do
  999. IFS=$func_echo_infix_1_IFS
  1000. $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
  1001. _G_prefix=$_G_indent
  1002. done
  1003. IFS=$func_echo_infix_1_IFS
  1004. }
  1005. # func_error ARG...
  1006. # -----------------
  1007. # Echo program name prefixed message to standard error.
  1008. func_error ()
  1009. {
  1010. $debug_cmd
  1011. $require_term_colors
  1012. func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
  1013. }
  1014. # func_fatal_error ARG...
  1015. # -----------------------
  1016. # Echo program name prefixed message to standard error, and exit.
  1017. func_fatal_error ()
  1018. {
  1019. $debug_cmd
  1020. func_error "$*"
  1021. exit $EXIT_FAILURE
  1022. }
  1023. # func_grep EXPRESSION FILENAME
  1024. # -----------------------------
  1025. # Check whether EXPRESSION matches any line of FILENAME, without output.
  1026. func_grep ()
  1027. {
  1028. $debug_cmd
  1029. $GREP "$1" "$2" >/dev/null 2>&1
  1030. }
  1031. # func_len STRING
  1032. # ---------------
  1033. # Set func_len_result to the length of STRING. STRING may not
  1034. # start with a hyphen.
  1035. test -z "$_G_HAVE_XSI_OPS" \
  1036. && (eval 'x=a/b/c;
  1037. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1038. && _G_HAVE_XSI_OPS=yes
  1039. if test yes = "$_G_HAVE_XSI_OPS"; then
  1040. eval 'func_len ()
  1041. {
  1042. $debug_cmd
  1043. func_len_result=${#1}
  1044. }'
  1045. else
  1046. func_len ()
  1047. {
  1048. $debug_cmd
  1049. func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
  1050. }
  1051. fi
  1052. # func_mkdir_p DIRECTORY-PATH
  1053. # ---------------------------
  1054. # Make sure the entire path to DIRECTORY-PATH is available.
  1055. func_mkdir_p ()
  1056. {
  1057. $debug_cmd
  1058. _G_directory_path=$1
  1059. _G_dir_list=
  1060. if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
  1061. # Protect directory names starting with '-'
  1062. case $_G_directory_path in
  1063. -*) _G_directory_path=./$_G_directory_path ;;
  1064. esac
  1065. # While some portion of DIR does not yet exist...
  1066. while test ! -d "$_G_directory_path"; do
  1067. # ...make a list in topmost first order. Use a colon delimited
  1068. # list incase some portion of path contains whitespace.
  1069. _G_dir_list=$_G_directory_path:$_G_dir_list
  1070. # If the last portion added has no slash in it, the list is done
  1071. case $_G_directory_path in */*) ;; *) break ;; esac
  1072. # ...otherwise throw away the child directory and loop
  1073. _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
  1074. done
  1075. _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
  1076. func_mkdir_p_IFS=$IFS; IFS=:
  1077. for _G_dir in $_G_dir_list; do
  1078. IFS=$func_mkdir_p_IFS
  1079. # mkdir can fail with a 'File exist' error if two processes
  1080. # try to create one of the directories concurrently. Don't
  1081. # stop in that case!
  1082. $MKDIR "$_G_dir" 2>/dev/null || :
  1083. done
  1084. IFS=$func_mkdir_p_IFS
  1085. # Bail out if we (or some other process) failed to create a directory.
  1086. test -d "$_G_directory_path" || \
  1087. func_fatal_error "Failed to create '$1'"
  1088. fi
  1089. }
  1090. # func_mktempdir [BASENAME]
  1091. # -------------------------
  1092. # Make a temporary directory that won't clash with other running
  1093. # libtool processes, and avoids race conditions if possible. If
  1094. # given, BASENAME is the basename for that directory.
  1095. func_mktempdir ()
  1096. {
  1097. $debug_cmd
  1098. _G_template=${TMPDIR-/tmp}/${1-$progname}
  1099. if test : = "$opt_dry_run"; then
  1100. # Return a directory name, but don't create it in dry-run mode
  1101. _G_tmpdir=$_G_template-$$
  1102. else
  1103. # If mktemp works, use that first and foremost
  1104. _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
  1105. if test ! -d "$_G_tmpdir"; then
  1106. # Failing that, at least try and use $RANDOM to avoid a race
  1107. _G_tmpdir=$_G_template-${RANDOM-0}$$
  1108. func_mktempdir_umask=`umask`
  1109. umask 0077
  1110. $MKDIR "$_G_tmpdir"
  1111. umask $func_mktempdir_umask
  1112. fi
  1113. # If we're not in dry-run mode, bomb out on failure
  1114. test -d "$_G_tmpdir" || \
  1115. func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
  1116. fi
  1117. $ECHO "$_G_tmpdir"
  1118. }
  1119. # func_normal_abspath PATH
  1120. # ------------------------
  1121. # Remove doubled-up and trailing slashes, "." path components,
  1122. # and cancel out any ".." path components in PATH after making
  1123. # it an absolute path.
  1124. func_normal_abspath ()
  1125. {
  1126. $debug_cmd
  1127. # These SED scripts presuppose an absolute path with a trailing slash.
  1128. _G_pathcar='s|^/\([^/]*\).*$|\1|'
  1129. _G_pathcdr='s|^/[^/]*||'
  1130. _G_removedotparts=':dotsl
  1131. s|/\./|/|g
  1132. t dotsl
  1133. s|/\.$|/|'
  1134. _G_collapseslashes='s|/\{1,\}|/|g'
  1135. _G_finalslash='s|/*$|/|'
  1136. # Start from root dir and reassemble the path.
  1137. func_normal_abspath_result=
  1138. func_normal_abspath_tpath=$1
  1139. func_normal_abspath_altnamespace=
  1140. case $func_normal_abspath_tpath in
  1141. "")
  1142. # Empty path, that just means $cwd.
  1143. func_stripname '' '/' "`pwd`"
  1144. func_normal_abspath_result=$func_stripname_result
  1145. return
  1146. ;;
  1147. # The next three entries are used to spot a run of precisely
  1148. # two leading slashes without using negated character classes;
  1149. # we take advantage of case's first-match behaviour.
  1150. ///*)
  1151. # Unusual form of absolute path, do nothing.
  1152. ;;
  1153. //*)
  1154. # Not necessarily an ordinary path; POSIX reserves leading '//'
  1155. # and for example Cygwin uses it to access remote file shares
  1156. # over CIFS/SMB, so we conserve a leading double slash if found.
  1157. func_normal_abspath_altnamespace=/
  1158. ;;
  1159. /*)
  1160. # Absolute path, do nothing.
  1161. ;;
  1162. *)
  1163. # Relative path, prepend $cwd.
  1164. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  1165. ;;
  1166. esac
  1167. # Cancel out all the simple stuff to save iterations. We also want
  1168. # the path to end with a slash for ease of parsing, so make sure
  1169. # there is one (and only one) here.
  1170. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1171. -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
  1172. while :; do
  1173. # Processed it all yet?
  1174. if test / = "$func_normal_abspath_tpath"; then
  1175. # If we ascended to the root using ".." the result may be empty now.
  1176. if test -z "$func_normal_abspath_result"; then
  1177. func_normal_abspath_result=/
  1178. fi
  1179. break
  1180. fi
  1181. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1182. -e "$_G_pathcar"`
  1183. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1184. -e "$_G_pathcdr"`
  1185. # Figure out what to do with it
  1186. case $func_normal_abspath_tcomponent in
  1187. "")
  1188. # Trailing empty path component, ignore it.
  1189. ;;
  1190. ..)
  1191. # Parent dir; strip last assembled component from result.
  1192. func_dirname "$func_normal_abspath_result"
  1193. func_normal_abspath_result=$func_dirname_result
  1194. ;;
  1195. *)
  1196. # Actual path component, append it.
  1197. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
  1198. ;;
  1199. esac
  1200. done
  1201. # Restore leading double-slash if one was found on entry.
  1202. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  1203. }
  1204. # func_notquiet ARG...
  1205. # --------------------
  1206. # Echo program name prefixed message only when not in quiet mode.
  1207. func_notquiet ()
  1208. {
  1209. $debug_cmd
  1210. $opt_quiet || func_echo ${1+"$@"}
  1211. # A bug in bash halts the script if the last line of a function
  1212. # fails when set -e is in force, so we need another command to
  1213. # work around that:
  1214. :
  1215. }
  1216. # func_relative_path SRCDIR DSTDIR
  1217. # --------------------------------
  1218. # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
  1219. func_relative_path ()
  1220. {
  1221. $debug_cmd
  1222. func_relative_path_result=
  1223. func_normal_abspath "$1"
  1224. func_relative_path_tlibdir=$func_normal_abspath_result
  1225. func_normal_abspath "$2"
  1226. func_relative_path_tbindir=$func_normal_abspath_result
  1227. # Ascend the tree starting from libdir
  1228. while :; do
  1229. # check if we have found a prefix of bindir
  1230. case $func_relative_path_tbindir in
  1231. $func_relative_path_tlibdir)
  1232. # found an exact match
  1233. func_relative_path_tcancelled=
  1234. break
  1235. ;;
  1236. $func_relative_path_tlibdir*)
  1237. # found a matching prefix
  1238. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  1239. func_relative_path_tcancelled=$func_stripname_result
  1240. if test -z "$func_relative_path_result"; then
  1241. func_relative_path_result=.
  1242. fi
  1243. break
  1244. ;;
  1245. *)
  1246. func_dirname $func_relative_path_tlibdir
  1247. func_relative_path_tlibdir=$func_dirname_result
  1248. if test -z "$func_relative_path_tlibdir"; then
  1249. # Have to descend all the way to the root!
  1250. func_relative_path_result=../$func_relative_path_result
  1251. func_relative_path_tcancelled=$func_relative_path_tbindir
  1252. break
  1253. fi
  1254. func_relative_path_result=../$func_relative_path_result
  1255. ;;
  1256. esac
  1257. done
  1258. # Now calculate path; take care to avoid doubling-up slashes.
  1259. func_stripname '' '/' "$func_relative_path_result"
  1260. func_relative_path_result=$func_stripname_result
  1261. func_stripname '/' '/' "$func_relative_path_tcancelled"
  1262. if test -n "$func_stripname_result"; then
  1263. func_append func_relative_path_result "/$func_stripname_result"
  1264. fi
  1265. # Normalisation. If bindir is libdir, return '.' else relative path.
  1266. if test -n "$func_relative_path_result"; then
  1267. func_stripname './' '' "$func_relative_path_result"
  1268. func_relative_path_result=$func_stripname_result
  1269. fi
  1270. test -n "$func_relative_path_result" || func_relative_path_result=.
  1271. :
  1272. }
  1273. # func_quote_for_eval ARG...
  1274. # --------------------------
  1275. # Aesthetically quote ARGs to be evaled later.
  1276. # This function returns two values:
  1277. # i) func_quote_for_eval_result
  1278. # double-quoted, suitable for a subsequent eval
  1279. # ii) func_quote_for_eval_unquoted_result
  1280. # has all characters that are still active within double
  1281. # quotes backslashified.
  1282. func_quote_for_eval ()
  1283. {
  1284. $debug_cmd
  1285. func_quote_for_eval_unquoted_result=
  1286. func_quote_for_eval_result=
  1287. while test 0 -lt $#; do
  1288. case $1 in
  1289. *[\\\`\"\$]*)
  1290. _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
  1291. *)
  1292. _G_unquoted_arg=$1 ;;
  1293. esac
  1294. if test -n "$func_quote_for_eval_unquoted_result"; then
  1295. func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
  1296. else
  1297. func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
  1298. fi
  1299. case $_G_unquoted_arg in
  1300. # Double-quote args containing shell metacharacters to delay
  1301. # word splitting, command substitution and variable expansion
  1302. # for a subsequent eval.
  1303. # Many Bourne shells cannot handle close brackets correctly
  1304. # in scan sets, so we specify it separately.
  1305. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1306. _G_quoted_arg=\"$_G_unquoted_arg\"
  1307. ;;
  1308. *)
  1309. _G_quoted_arg=$_G_unquoted_arg
  1310. ;;
  1311. esac
  1312. if test -n "$func_quote_for_eval_result"; then
  1313. func_append func_quote_for_eval_result " $_G_quoted_arg"
  1314. else
  1315. func_append func_quote_for_eval_result "$_G_quoted_arg"
  1316. fi
  1317. shift
  1318. done
  1319. }
  1320. # func_quote_for_expand ARG
  1321. # -------------------------
  1322. # Aesthetically quote ARG to be evaled later; same as above,
  1323. # but do not quote variable references.
  1324. func_quote_for_expand ()
  1325. {
  1326. $debug_cmd
  1327. case $1 in
  1328. *[\\\`\"]*)
  1329. _G_arg=`$ECHO "$1" | $SED \
  1330. -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
  1331. *)
  1332. _G_arg=$1 ;;
  1333. esac
  1334. case $_G_arg in
  1335. # Double-quote args containing shell metacharacters to delay
  1336. # word splitting and command substitution for a subsequent eval.
  1337. # Many Bourne shells cannot handle close brackets correctly
  1338. # in scan sets, so we specify it separately.
  1339. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1340. _G_arg=\"$_G_arg\"
  1341. ;;
  1342. esac
  1343. func_quote_for_expand_result=$_G_arg
  1344. }
  1345. # func_stripname PREFIX SUFFIX NAME
  1346. # ---------------------------------
  1347. # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
  1348. # PREFIX and SUFFIX must not contain globbing or regex special
  1349. # characters, hashes, percent signs, but SUFFIX may contain a leading
  1350. # dot (in which case that matches only a dot).
  1351. if test yes = "$_G_HAVE_XSI_OPS"; then
  1352. eval 'func_stripname ()
  1353. {
  1354. $debug_cmd
  1355. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  1356. # positional parameters, so assign one to ordinary variable first.
  1357. func_stripname_result=$3
  1358. func_stripname_result=${func_stripname_result#"$1"}
  1359. func_stripname_result=${func_stripname_result%"$2"}
  1360. }'
  1361. else
  1362. func_stripname ()
  1363. {
  1364. $debug_cmd
  1365. case $2 in
  1366. .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
  1367. *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
  1368. esac
  1369. }
  1370. fi
  1371. # func_show_eval CMD [FAIL_EXP]
  1372. # -----------------------------
  1373. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1374. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1375. # is given, then evaluate it.
  1376. func_show_eval ()
  1377. {
  1378. $debug_cmd
  1379. _G_cmd=$1
  1380. _G_fail_exp=${2-':'}
  1381. func_quote_for_expand "$_G_cmd"
  1382. eval "func_notquiet $func_quote_for_expand_result"
  1383. $opt_dry_run || {
  1384. eval "$_G_cmd"
  1385. _G_status=$?
  1386. if test 0 -ne "$_G_status"; then
  1387. eval "(exit $_G_status); $_G_fail_exp"
  1388. fi
  1389. }
  1390. }
  1391. # func_show_eval_locale CMD [FAIL_EXP]
  1392. # ------------------------------------
  1393. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1394. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1395. # is given, then evaluate it. Use the saved locale for evaluation.
  1396. func_show_eval_locale ()
  1397. {
  1398. $debug_cmd
  1399. _G_cmd=$1
  1400. _G_fail_exp=${2-':'}
  1401. $opt_quiet || {
  1402. func_quote_for_expand "$_G_cmd"
  1403. eval "func_echo $func_quote_for_expand_result"
  1404. }
  1405. $opt_dry_run || {
  1406. eval "$_G_user_locale
  1407. $_G_cmd"
  1408. _G_status=$?
  1409. eval "$_G_safe_locale"
  1410. if test 0 -ne "$_G_status"; then
  1411. eval "(exit $_G_status); $_G_fail_exp"
  1412. fi
  1413. }
  1414. }
  1415. # func_tr_sh
  1416. # ----------
  1417. # Turn $1 into a string suitable for a shell variable name.
  1418. # Result is stored in $func_tr_sh_result. All characters
  1419. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1420. # if $1 begins with a digit, a '_' is prepended as well.
  1421. func_tr_sh ()
  1422. {
  1423. $debug_cmd
  1424. case $1 in
  1425. [0-9]* | *[!a-zA-Z0-9_]*)
  1426. func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
  1427. ;;
  1428. * )
  1429. func_tr_sh_result=$1
  1430. ;;
  1431. esac
  1432. }
  1433. # func_verbose ARG...
  1434. # -------------------
  1435. # Echo program name prefixed message in verbose mode only.
  1436. func_verbose ()
  1437. {
  1438. $debug_cmd
  1439. $opt_verbose && func_echo "$*"
  1440. :
  1441. }
  1442. # func_warn_and_continue ARG...
  1443. # -----------------------------
  1444. # Echo program name prefixed warning message to standard error.
  1445. func_warn_and_continue ()
  1446. {
  1447. $debug_cmd
  1448. $require_term_colors
  1449. func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
  1450. }
  1451. # func_warning CATEGORY ARG...
  1452. # ----------------------------
  1453. # Echo program name prefixed warning message to standard error. Warning
  1454. # messages can be filtered according to CATEGORY, where this function
  1455. # elides messages where CATEGORY is not listed in the global variable
  1456. # 'opt_warning_types'.
  1457. func_warning ()
  1458. {
  1459. $debug_cmd
  1460. # CATEGORY must be in the warning_categories list!
  1461. case " $warning_categories " in
  1462. *" $1 "*) ;;
  1463. *) func_internal_error "invalid warning category '$1'" ;;
  1464. esac
  1465. _G_category=$1
  1466. shift
  1467. case " $opt_warning_types " in
  1468. *" $_G_category "*) $warning_func ${1+"$@"} ;;
  1469. esac
  1470. }
  1471. # func_sort_ver VER1 VER2
  1472. # -----------------------
  1473. # 'sort -V' is not generally available.
  1474. # Note this deviates from the version comparison in automake
  1475. # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
  1476. # but this should suffice as we won't be specifying old
  1477. # version formats or redundant trailing .0 in bootstrap.conf.
  1478. # If we did want full compatibility then we should probably
  1479. # use m4_version_compare from autoconf.
  1480. func_sort_ver ()
  1481. {
  1482. $debug_cmd
  1483. printf '%s\n%s\n' "$1" "$2" \
  1484. | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
  1485. }
  1486. # func_lt_ver PREV CURR
  1487. # ---------------------
  1488. # Return true if PREV and CURR are in the correct order according to
  1489. # func_sort_ver, otherwise false. Use it like this:
  1490. #
  1491. # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
  1492. func_lt_ver ()
  1493. {
  1494. $debug_cmd
  1495. test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
  1496. }
  1497. # Local variables:
  1498. # mode: shell-script
  1499. # sh-indentation: 2
  1500. # eval: (add-hook 'before-save-hook 'time-stamp)
  1501. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1502. # time-stamp-time-zone: "UTC"
  1503. # End:
  1504. #! /bin/sh
  1505. # Set a version string for this script.
  1506. scriptversion=2014-01-07.03; # UTC
  1507. # A portable, pluggable option parser for Bourne shell.
  1508. # Written by Gary V. Vaughan, 2010
  1509. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  1510. # This is free software; see the source for copying conditions. There is NO
  1511. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1512. # This program is free software: you can redistribute it and/or modify
  1513. # it under the terms of the GNU General Public License as published by
  1514. # the Free Software Foundation, either version 3 of the License, or
  1515. # (at your option) any later version.
  1516. # This program is distributed in the hope that it will be useful,
  1517. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  1518. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1519. # GNU General Public License for more details.
  1520. # You should have received a copy of the GNU General Public License
  1521. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  1522. # Please report bugs or propose patches to gary@gnu.org.
  1523. ## ------ ##
  1524. ## Usage. ##
  1525. ## ------ ##
  1526. # This file is a library for parsing options in your shell scripts along
  1527. # with assorted other useful supporting features that you can make use
  1528. # of too.
  1529. #
  1530. # For the simplest scripts you might need only:
  1531. #
  1532. # #!/bin/sh
  1533. # . relative/path/to/funclib.sh
  1534. # . relative/path/to/options-parser
  1535. # scriptversion=1.0
  1536. # func_options ${1+"$@"}
  1537. # eval set dummy "$func_options_result"; shift
  1538. # ...rest of your script...
  1539. #
  1540. # In order for the '--version' option to work, you will need to have a
  1541. # suitably formatted comment like the one at the top of this file
  1542. # starting with '# Written by ' and ending with '# warranty; '.
  1543. #
  1544. # For '-h' and '--help' to work, you will also need a one line
  1545. # description of your script's purpose in a comment directly above the
  1546. # '# Written by ' line, like the one at the top of this file.
  1547. #
  1548. # The default options also support '--debug', which will turn on shell
  1549. # execution tracing (see the comment above debug_cmd below for another
  1550. # use), and '--verbose' and the func_verbose function to allow your script
  1551. # to display verbose messages only when your user has specified
  1552. # '--verbose'.
  1553. #
  1554. # After sourcing this file, you can plug processing for additional
  1555. # options by amending the variables from the 'Configuration' section
  1556. # below, and following the instructions in the 'Option parsing'
  1557. # section further down.
  1558. ## -------------- ##
  1559. ## Configuration. ##
  1560. ## -------------- ##
  1561. # You should override these variables in your script after sourcing this
  1562. # file so that they reflect the customisations you have added to the
  1563. # option parser.
  1564. # The usage line for option parsing errors and the start of '-h' and
  1565. # '--help' output messages. You can embed shell variables for delayed
  1566. # expansion at the time the message is displayed, but you will need to
  1567. # quote other shell meta-characters carefully to prevent them being
  1568. # expanded when the contents are evaled.
  1569. usage='$progpath [OPTION]...'
  1570. # Short help message in response to '-h' and '--help'. Add to this or
  1571. # override it after sourcing this library to reflect the full set of
  1572. # options your script accepts.
  1573. usage_message="\
  1574. --debug enable verbose shell tracing
  1575. -W, --warnings=CATEGORY
  1576. report the warnings falling in CATEGORY [all]
  1577. -v, --verbose verbosely report processing
  1578. --version print version information and exit
  1579. -h, --help print short or long help message and exit
  1580. "
  1581. # Additional text appended to 'usage_message' in response to '--help'.
  1582. long_help_message="
  1583. Warning categories include:
  1584. 'all' show all warnings
  1585. 'none' turn off all the warnings
  1586. 'error' warnings are treated as fatal errors"
  1587. # Help message printed before fatal option parsing errors.
  1588. fatal_help="Try '\$progname --help' for more information."
  1589. ## ------------------------- ##
  1590. ## Hook function management. ##
  1591. ## ------------------------- ##
  1592. # This section contains functions for adding, removing, and running hooks
  1593. # to the main code. A hook is just a named list of of function, that can
  1594. # be run in order later on.
  1595. # func_hookable FUNC_NAME
  1596. # -----------------------
  1597. # Declare that FUNC_NAME will run hooks added with
  1598. # 'func_add_hook FUNC_NAME ...'.
  1599. func_hookable ()
  1600. {
  1601. $debug_cmd
  1602. func_append hookable_fns " $1"
  1603. }
  1604. # func_add_hook FUNC_NAME HOOK_FUNC
  1605. # ---------------------------------
  1606. # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
  1607. # first have been declared "hookable" by a call to 'func_hookable'.
  1608. func_add_hook ()
  1609. {
  1610. $debug_cmd
  1611. case " $hookable_fns " in
  1612. *" $1 "*) ;;
  1613. *) func_fatal_error "'$1' does not accept hook functions." ;;
  1614. esac
  1615. eval func_append ${1}_hooks '" $2"'
  1616. }
  1617. # func_remove_hook FUNC_NAME HOOK_FUNC
  1618. # ------------------------------------
  1619. # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
  1620. func_remove_hook ()
  1621. {
  1622. $debug_cmd
  1623. eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
  1624. }
  1625. # func_run_hooks FUNC_NAME [ARG]...
  1626. # ---------------------------------
  1627. # Run all hook functions registered to FUNC_NAME.
  1628. # It is assumed that the list of hook functions contains nothing more
  1629. # than a whitespace-delimited list of legal shell function names, and
  1630. # no effort is wasted trying to catch shell meta-characters or preserve
  1631. # whitespace.
  1632. func_run_hooks ()
  1633. {
  1634. $debug_cmd
  1635. case " $hookable_fns " in
  1636. *" $1 "*) ;;
  1637. *) func_fatal_error "'$1' does not support hook funcions.n" ;;
  1638. esac
  1639. eval _G_hook_fns=\$$1_hooks; shift
  1640. for _G_hook in $_G_hook_fns; do
  1641. eval $_G_hook '"$@"'
  1642. # store returned options list back into positional
  1643. # parameters for next 'cmd' execution.
  1644. eval _G_hook_result=\$${_G_hook}_result
  1645. eval set dummy "$_G_hook_result"; shift
  1646. done
  1647. func_quote_for_eval ${1+"$@"}
  1648. func_run_hooks_result=$func_quote_for_eval_result
  1649. }
  1650. ## --------------- ##
  1651. ## Option parsing. ##
  1652. ## --------------- ##
  1653. # In order to add your own option parsing hooks, you must accept the
  1654. # full positional parameter list in your hook function, remove any
  1655. # options that you action, and then pass back the remaining unprocessed
  1656. # options in '<hooked_function_name>_result', escaped suitably for
  1657. # 'eval'. Like this:
  1658. #
  1659. # my_options_prep ()
  1660. # {
  1661. # $debug_cmd
  1662. #
  1663. # # Extend the existing usage message.
  1664. # usage_message=$usage_message'
  1665. # -s, --silent don'\''t print informational messages
  1666. # '
  1667. #
  1668. # func_quote_for_eval ${1+"$@"}
  1669. # my_options_prep_result=$func_quote_for_eval_result
  1670. # }
  1671. # func_add_hook func_options_prep my_options_prep
  1672. #
  1673. #
  1674. # my_silent_option ()
  1675. # {
  1676. # $debug_cmd
  1677. #
  1678. # # Note that for efficiency, we parse as many options as we can
  1679. # # recognise in a loop before passing the remainder back to the
  1680. # # caller on the first unrecognised argument we encounter.
  1681. # while test $# -gt 0; do
  1682. # opt=$1; shift
  1683. # case $opt in
  1684. # --silent|-s) opt_silent=: ;;
  1685. # # Separate non-argument short options:
  1686. # -s*) func_split_short_opt "$_G_opt"
  1687. # set dummy "$func_split_short_opt_name" \
  1688. # "-$func_split_short_opt_arg" ${1+"$@"}
  1689. # shift
  1690. # ;;
  1691. # *) set dummy "$_G_opt" "$*"; shift; break ;;
  1692. # esac
  1693. # done
  1694. #
  1695. # func_quote_for_eval ${1+"$@"}
  1696. # my_silent_option_result=$func_quote_for_eval_result
  1697. # }
  1698. # func_add_hook func_parse_options my_silent_option
  1699. #
  1700. #
  1701. # my_option_validation ()
  1702. # {
  1703. # $debug_cmd
  1704. #
  1705. # $opt_silent && $opt_verbose && func_fatal_help "\
  1706. # '--silent' and '--verbose' options are mutually exclusive."
  1707. #
  1708. # func_quote_for_eval ${1+"$@"}
  1709. # my_option_validation_result=$func_quote_for_eval_result
  1710. # }
  1711. # func_add_hook func_validate_options my_option_validation
  1712. #
  1713. # You'll alse need to manually amend $usage_message to reflect the extra
  1714. # options you parse. It's preferable to append if you can, so that
  1715. # multiple option parsing hooks can be added safely.
  1716. # func_options [ARG]...
  1717. # ---------------------
  1718. # All the functions called inside func_options are hookable. See the
  1719. # individual implementations for details.
  1720. func_hookable func_options
  1721. func_options ()
  1722. {
  1723. $debug_cmd
  1724. func_options_prep ${1+"$@"}
  1725. eval func_parse_options \
  1726. ${func_options_prep_result+"$func_options_prep_result"}
  1727. eval func_validate_options \
  1728. ${func_parse_options_result+"$func_parse_options_result"}
  1729. eval func_run_hooks func_options \
  1730. ${func_validate_options_result+"$func_validate_options_result"}
  1731. # save modified positional parameters for caller
  1732. func_options_result=$func_run_hooks_result
  1733. }
  1734. # func_options_prep [ARG]...
  1735. # --------------------------
  1736. # All initialisations required before starting the option parse loop.
  1737. # Note that when calling hook functions, we pass through the list of
  1738. # positional parameters. If a hook function modifies that list, and
  1739. # needs to propogate that back to rest of this script, then the complete
  1740. # modified list must be put in 'func_run_hooks_result' before
  1741. # returning.
  1742. func_hookable func_options_prep
  1743. func_options_prep ()
  1744. {
  1745. $debug_cmd
  1746. # Option defaults:
  1747. opt_verbose=false
  1748. opt_warning_types=
  1749. func_run_hooks func_options_prep ${1+"$@"}
  1750. # save modified positional parameters for caller
  1751. func_options_prep_result=$func_run_hooks_result
  1752. }
  1753. # func_parse_options [ARG]...
  1754. # ---------------------------
  1755. # The main option parsing loop.
  1756. func_hookable func_parse_options
  1757. func_parse_options ()
  1758. {
  1759. $debug_cmd
  1760. func_parse_options_result=
  1761. # this just eases exit handling
  1762. while test $# -gt 0; do
  1763. # Defer to hook functions for initial option parsing, so they
  1764. # get priority in the event of reusing an option name.
  1765. func_run_hooks func_parse_options ${1+"$@"}
  1766. # Adjust func_parse_options positional parameters to match
  1767. eval set dummy "$func_run_hooks_result"; shift
  1768. # Break out of the loop if we already parsed every option.
  1769. test $# -gt 0 || break
  1770. _G_opt=$1
  1771. shift
  1772. case $_G_opt in
  1773. --debug|-x) debug_cmd='set -x'
  1774. func_echo "enabling shell trace mode"
  1775. $debug_cmd
  1776. ;;
  1777. --no-warnings|--no-warning|--no-warn)
  1778. set dummy --warnings none ${1+"$@"}
  1779. shift
  1780. ;;
  1781. --warnings|--warning|-W)
  1782. test $# = 0 && func_missing_arg $_G_opt && break
  1783. case " $warning_categories $1" in
  1784. *" $1 "*)
  1785. # trailing space prevents matching last $1 above
  1786. func_append_uniq opt_warning_types " $1"
  1787. ;;
  1788. *all)
  1789. opt_warning_types=$warning_categories
  1790. ;;
  1791. *none)
  1792. opt_warning_types=none
  1793. warning_func=:
  1794. ;;
  1795. *error)
  1796. opt_warning_types=$warning_categories
  1797. warning_func=func_fatal_error
  1798. ;;
  1799. *)
  1800. func_fatal_error \
  1801. "unsupported warning category: '$1'"
  1802. ;;
  1803. esac
  1804. shift
  1805. ;;
  1806. --verbose|-v) opt_verbose=: ;;
  1807. --version) func_version ;;
  1808. -\?|-h) func_usage ;;
  1809. --help) func_help ;;
  1810. # Separate optargs to long options (plugins may need this):
  1811. --*=*) func_split_equals "$_G_opt"
  1812. set dummy "$func_split_equals_lhs" \
  1813. "$func_split_equals_rhs" ${1+"$@"}
  1814. shift
  1815. ;;
  1816. # Separate optargs to short options:
  1817. -W*)
  1818. func_split_short_opt "$_G_opt"
  1819. set dummy "$func_split_short_opt_name" \
  1820. "$func_split_short_opt_arg" ${1+"$@"}
  1821. shift
  1822. ;;
  1823. # Separate non-argument short options:
  1824. -\?*|-h*|-v*|-x*)
  1825. func_split_short_opt "$_G_opt"
  1826. set dummy "$func_split_short_opt_name" \
  1827. "-$func_split_short_opt_arg" ${1+"$@"}
  1828. shift
  1829. ;;
  1830. --) break ;;
  1831. -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
  1832. *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  1833. esac
  1834. done
  1835. # save modified positional parameters for caller
  1836. func_quote_for_eval ${1+"$@"}
  1837. func_parse_options_result=$func_quote_for_eval_result
  1838. }
  1839. # func_validate_options [ARG]...
  1840. # ------------------------------
  1841. # Perform any sanity checks on option settings and/or unconsumed
  1842. # arguments.
  1843. func_hookable func_validate_options
  1844. func_validate_options ()
  1845. {
  1846. $debug_cmd
  1847. # Display all warnings if -W was not given.
  1848. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
  1849. func_run_hooks func_validate_options ${1+"$@"}
  1850. # Bail if the options were screwed!
  1851. $exit_cmd $EXIT_FAILURE
  1852. # save modified positional parameters for caller
  1853. func_validate_options_result=$func_run_hooks_result
  1854. }
  1855. ## ----------------- ##
  1856. ## Helper functions. ##
  1857. ## ----------------- ##
  1858. # This section contains the helper functions used by the rest of the
  1859. # hookable option parser framework in ascii-betical order.
  1860. # func_fatal_help ARG...
  1861. # ----------------------
  1862. # Echo program name prefixed message to standard error, followed by
  1863. # a help hint, and exit.
  1864. func_fatal_help ()
  1865. {
  1866. $debug_cmd
  1867. eval \$ECHO \""Usage: $usage"\"
  1868. eval \$ECHO \""$fatal_help"\"
  1869. func_error ${1+"$@"}
  1870. exit $EXIT_FAILURE
  1871. }
  1872. # func_help
  1873. # ---------
  1874. # Echo long help message to standard output and exit.
  1875. func_help ()
  1876. {
  1877. $debug_cmd
  1878. func_usage_message
  1879. $ECHO "$long_help_message"
  1880. exit 0
  1881. }
  1882. # func_missing_arg ARGNAME
  1883. # ------------------------
  1884. # Echo program name prefixed message to standard error and set global
  1885. # exit_cmd.
  1886. func_missing_arg ()
  1887. {
  1888. $debug_cmd
  1889. func_error "Missing argument for '$1'."
  1890. exit_cmd=exit
  1891. }
  1892. # func_split_equals STRING
  1893. # ------------------------
  1894. # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
  1895. # splitting STRING at the '=' sign.
  1896. test -z "$_G_HAVE_XSI_OPS" \
  1897. && (eval 'x=a/b/c;
  1898. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1899. && _G_HAVE_XSI_OPS=yes
  1900. if test yes = "$_G_HAVE_XSI_OPS"
  1901. then
  1902. # This is an XSI compatible shell, allowing a faster implementation...
  1903. eval 'func_split_equals ()
  1904. {
  1905. $debug_cmd
  1906. func_split_equals_lhs=${1%%=*}
  1907. func_split_equals_rhs=${1#*=}
  1908. test "x$func_split_equals_lhs" = "x$1" \
  1909. && func_split_equals_rhs=
  1910. }'
  1911. else
  1912. # ...otherwise fall back to using expr, which is often a shell builtin.
  1913. func_split_equals ()
  1914. {
  1915. $debug_cmd
  1916. func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
  1917. func_split_equals_rhs=
  1918. test "x$func_split_equals_lhs" = "x$1" \
  1919. || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
  1920. }
  1921. fi #func_split_equals
  1922. # func_split_short_opt SHORTOPT
  1923. # -----------------------------
  1924. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  1925. # variables after splitting SHORTOPT after the 2nd character.
  1926. if test yes = "$_G_HAVE_XSI_OPS"
  1927. then
  1928. # This is an XSI compatible shell, allowing a faster implementation...
  1929. eval 'func_split_short_opt ()
  1930. {
  1931. $debug_cmd
  1932. func_split_short_opt_arg=${1#??}
  1933. func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  1934. }'
  1935. else
  1936. # ...otherwise fall back to using expr, which is often a shell builtin.
  1937. func_split_short_opt ()
  1938. {
  1939. $debug_cmd
  1940. func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
  1941. func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
  1942. }
  1943. fi #func_split_short_opt
  1944. # func_usage
  1945. # ----------
  1946. # Echo short help message to standard output and exit.
  1947. func_usage ()
  1948. {
  1949. $debug_cmd
  1950. func_usage_message
  1951. $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
  1952. exit 0
  1953. }
  1954. # func_usage_message
  1955. # ------------------
  1956. # Echo short help message to standard output.
  1957. func_usage_message ()
  1958. {
  1959. $debug_cmd
  1960. eval \$ECHO \""Usage: $usage"\"
  1961. echo
  1962. $SED -n 's|^# ||
  1963. /^Written by/{
  1964. x;p;x
  1965. }
  1966. h
  1967. /^Written by/q' < "$progpath"
  1968. echo
  1969. eval \$ECHO \""$usage_message"\"
  1970. }
  1971. # func_version
  1972. # ------------
  1973. # Echo version message to standard output and exit.
  1974. func_version ()
  1975. {
  1976. $debug_cmd
  1977. printf '%s\n' "$progname $scriptversion"
  1978. $SED -n '
  1979. /(C)/!b go
  1980. :more
  1981. /\./!{
  1982. N
  1983. s|\n# | |
  1984. b more
  1985. }
  1986. :go
  1987. /^# Written by /,/# warranty; / {
  1988. s|^# ||
  1989. s|^# *$||
  1990. s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
  1991. p
  1992. }
  1993. /^# Written by / {
  1994. s|^# ||
  1995. p
  1996. }
  1997. /^warranty; /q' < "$progpath"
  1998. exit $?
  1999. }
  2000. # Local variables:
  2001. # mode: shell-script
  2002. # sh-indentation: 2
  2003. # eval: (add-hook 'before-save-hook 'time-stamp)
  2004. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  2005. # time-stamp-time-zone: "UTC"
  2006. # End:
  2007. # Set a version string.
  2008. scriptversion='(GNU libtool) 2.4.5'
  2009. # func_echo ARG...
  2010. # ----------------
  2011. # Libtool also displays the current mode in messages, so override
  2012. # funclib.sh func_echo with this custom definition.
  2013. func_echo ()
  2014. {
  2015. $debug_cmd
  2016. _G_message=$*
  2017. func_echo_IFS=$IFS
  2018. IFS=$nl
  2019. for _G_line in $_G_message; do
  2020. IFS=$func_echo_IFS
  2021. $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
  2022. done
  2023. IFS=$func_echo_IFS
  2024. }
  2025. # func_warning ARG...
  2026. # -------------------
  2027. # Libtool warnings are not categorized, so override funclib.sh
  2028. # func_warning with this simpler definition.
  2029. func_warning ()
  2030. {
  2031. $debug_cmd
  2032. $warning_func ${1+"$@"}
  2033. }
  2034. ## ---------------- ##
  2035. ## Options parsing. ##
  2036. ## ---------------- ##
  2037. # Hook in the functions to make sure our own options are parsed during
  2038. # the option parsing loop.
  2039. usage='$progpath [OPTION]... [MODE-ARG]...'
  2040. # Short help message in response to '-h'.
  2041. usage_message="Options:
  2042. --config show all configuration variables
  2043. --debug enable verbose shell tracing
  2044. -n, --dry-run display commands without modifying any files
  2045. --features display basic configuration information and exit
  2046. --mode=MODE use operation mode MODE
  2047. --no-warnings equivalent to '-Wnone'
  2048. --preserve-dup-deps don't remove duplicate dependency libraries
  2049. --quiet, --silent don't print informational messages
  2050. --tag=TAG use configuration variables from tag TAG
  2051. -v, --verbose print more informational messages than default
  2052. --version print version information
  2053. -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
  2054. -h, --help, --help-all print short, long, or detailed help message
  2055. "
  2056. # Additional text appended to 'usage_message' in response to '--help'.
  2057. long_help_message=$long_help_message"
  2058. MODE must be one of the following:
  2059. clean remove files from the build directory
  2060. compile compile a source file into a libtool object
  2061. execute automatically set library path, then run a program
  2062. finish complete the installation of libtool libraries
  2063. install install libraries or executables
  2064. link create a library or an executable
  2065. uninstall remove libraries from an installed directory
  2066. MODE-ARGS vary depending on the MODE. When passed as first option,
  2067. '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
  2068. Try '$progname --help --mode=MODE' for a more detailed description of MODE.
  2069. When reporting a bug, please describe a test case to reproduce it and
  2070. include the following information:
  2071. host-triplet: $host
  2072. shell: $SHELL
  2073. compiler: $LTCC
  2074. compiler flags: $LTCFLAGS
  2075. linker: $LD (gnu? $with_gnu_ld)
  2076. version: $progname (GNU libtool) 2.4.5
  2077. automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
  2078. autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
  2079. Report bugs to <bug-libtool@gnu.org>.
  2080. GNU libtool home page: <http://www.gnu.org/software/libtool/>.
  2081. General help using GNU software: <http://www.gnu.org/gethelp/>."
  2082. # func_lo2o OBJECT-NAME
  2083. # ---------------------
  2084. # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
  2085. # object suffix.
  2086. lo2o=s/\\.lo\$/.$objext/
  2087. o2lo=s/\\.$objext\$/.lo/
  2088. if test yes = "$_G_HAVE_XSI_OPS"; then
  2089. eval 'func_lo2o ()
  2090. {
  2091. case $1 in
  2092. *.lo) func_lo2o_result=${1%.lo}.$objext ;;
  2093. * ) func_lo2o_result=$1 ;;
  2094. esac
  2095. }'
  2096. # func_xform LIBOBJ-OR-SOURCE
  2097. # ---------------------------
  2098. # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
  2099. # suffix to a '.lo' libtool-object suffix.
  2100. eval 'func_xform ()
  2101. {
  2102. func_xform_result=${1%.*}.lo
  2103. }'
  2104. else
  2105. # ...otherwise fall back to using sed.
  2106. func_lo2o ()
  2107. {
  2108. func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
  2109. }
  2110. func_xform ()
  2111. {
  2112. func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
  2113. }
  2114. fi
  2115. # func_fatal_configuration ARG...
  2116. # -------------------------------
  2117. # Echo program name prefixed message to standard error, followed by
  2118. # a configuration failure hint, and exit.
  2119. func_fatal_configuration ()
  2120. {
  2121. func__fatal_error ${1+"$@"} \
  2122. "See the $PACKAGE documentation for more information." \
  2123. "Fatal configuration error."
  2124. }
  2125. # func_config
  2126. # -----------
  2127. # Display the configuration for all the tags in this script.
  2128. func_config ()
  2129. {
  2130. re_begincf='^# ### BEGIN LIBTOOL'
  2131. re_endcf='^# ### END LIBTOOL'
  2132. # Default configuration.
  2133. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  2134. # Now print the configurations for the tags.
  2135. for tagname in $taglist; do
  2136. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  2137. done
  2138. exit $?
  2139. }
  2140. # func_features
  2141. # -------------
  2142. # Display the features supported by this script.
  2143. func_features ()
  2144. {
  2145. echo "host: $host"
  2146. if test yes = "$build_libtool_libs"; then
  2147. echo "enable shared libraries"
  2148. else
  2149. echo "disable shared libraries"
  2150. fi
  2151. if test yes = "$build_old_libs"; then
  2152. echo "enable static libraries"
  2153. else
  2154. echo "disable static libraries"
  2155. fi
  2156. exit $?
  2157. }
  2158. # func_enable_tag TAGNAME
  2159. # -----------------------
  2160. # Verify that TAGNAME is valid, and either flag an error and exit, or
  2161. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  2162. # variable here.
  2163. func_enable_tag ()
  2164. {
  2165. # Global variable:
  2166. tagname=$1
  2167. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  2168. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  2169. sed_extractcf=/$re_begincf/,/$re_endcf/p
  2170. # Validate tagname.
  2171. case $tagname in
  2172. *[!-_A-Za-z0-9,/]*)
  2173. func_fatal_error "invalid tag name: $tagname"
  2174. ;;
  2175. esac
  2176. # Don't test for the "default" C tag, as we know it's
  2177. # there but not specially marked.
  2178. case $tagname in
  2179. CC) ;;
  2180. *)
  2181. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  2182. taglist="$taglist $tagname"
  2183. # Evaluate the configuration. Be careful to quote the path
  2184. # and the sed script, to avoid splitting on whitespace, but
  2185. # also don't use non-portable quotes within backquotes within
  2186. # quotes we have to do it in 2 steps:
  2187. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  2188. eval "$extractedcf"
  2189. else
  2190. func_error "ignoring unknown tag $tagname"
  2191. fi
  2192. ;;
  2193. esac
  2194. }
  2195. # func_check_version_match
  2196. # ------------------------
  2197. # Ensure that we are using m4 macros, and libtool script from the same
  2198. # release of libtool.
  2199. func_check_version_match ()
  2200. {
  2201. if test "$package_revision" != "$macro_revision"; then
  2202. if test "$VERSION" != "$macro_version"; then
  2203. if test -z "$macro_version"; then
  2204. cat >&2 <<_LT_EOF
  2205. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2206. $progname: definition of this LT_INIT comes from an older release.
  2207. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2208. $progname: and run autoconf again.
  2209. _LT_EOF
  2210. else
  2211. cat >&2 <<_LT_EOF
  2212. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2213. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  2214. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2215. $progname: and run autoconf again.
  2216. _LT_EOF
  2217. fi
  2218. else
  2219. cat >&2 <<_LT_EOF
  2220. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  2221. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  2222. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  2223. $progname: of $PACKAGE $VERSION and run autoconf again.
  2224. _LT_EOF
  2225. fi
  2226. exit $EXIT_MISMATCH
  2227. fi
  2228. }
  2229. # libtool_options_prep [ARG]...
  2230. # -----------------------------
  2231. # Preparation for options parsed by libtool.
  2232. libtool_options_prep ()
  2233. {
  2234. $debug_mode
  2235. # Option defaults:
  2236. opt_config=false
  2237. opt_dlopen=
  2238. opt_dry_run=false
  2239. opt_help=false
  2240. opt_mode=
  2241. opt_preserve_dup_deps=false
  2242. opt_quiet=false
  2243. nonopt=
  2244. preserve_args=
  2245. # Shorthand for --mode=foo, only valid as the first argument
  2246. case $1 in
  2247. clean|clea|cle|cl)
  2248. shift; set dummy --mode clean ${1+"$@"}; shift
  2249. ;;
  2250. compile|compil|compi|comp|com|co|c)
  2251. shift; set dummy --mode compile ${1+"$@"}; shift
  2252. ;;
  2253. execute|execut|execu|exec|exe|ex|e)
  2254. shift; set dummy --mode execute ${1+"$@"}; shift
  2255. ;;
  2256. finish|finis|fini|fin|fi|f)
  2257. shift; set dummy --mode finish ${1+"$@"}; shift
  2258. ;;
  2259. install|instal|insta|inst|ins|in|i)
  2260. shift; set dummy --mode install ${1+"$@"}; shift
  2261. ;;
  2262. link|lin|li|l)
  2263. shift; set dummy --mode link ${1+"$@"}; shift
  2264. ;;
  2265. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  2266. shift; set dummy --mode uninstall ${1+"$@"}; shift
  2267. ;;
  2268. esac
  2269. # Pass back the list of options.
  2270. func_quote_for_eval ${1+"$@"}
  2271. libtool_options_prep_result=$func_quote_for_eval_result
  2272. }
  2273. func_add_hook func_options_prep libtool_options_prep
  2274. # libtool_parse_options [ARG]...
  2275. # ---------------------------------
  2276. # Provide handling for libtool specific options.
  2277. libtool_parse_options ()
  2278. {
  2279. $debug_cmd
  2280. # Perform our own loop to consume as many options as possible in
  2281. # each iteration.
  2282. while test $# -gt 0; do
  2283. _G_opt=$1
  2284. shift
  2285. case $_G_opt in
  2286. --dry-run|--dryrun|-n)
  2287. opt_dry_run=:
  2288. ;;
  2289. --config) func_config ;;
  2290. --dlopen|-dlopen)
  2291. opt_dlopen="${opt_dlopen+$opt_dlopen
  2292. }$1"
  2293. shift
  2294. ;;
  2295. --preserve-dup-deps)
  2296. opt_preserve_dup_deps=: ;;
  2297. --features) func_features ;;
  2298. --finish) set dummy --mode finish ${1+"$@"}; shift ;;
  2299. --help) opt_help=: ;;
  2300. --help-all) opt_help=': help-all' ;;
  2301. --mode) test $# = 0 && func_missing_arg $_G_opt && break
  2302. opt_mode=$1
  2303. case $1 in
  2304. # Valid mode arguments:
  2305. clean|compile|execute|finish|install|link|relink|uninstall) ;;
  2306. # Catch anything else as an error
  2307. *) func_error "invalid argument for $_G_opt"
  2308. exit_cmd=exit
  2309. break
  2310. ;;
  2311. esac
  2312. shift
  2313. ;;
  2314. --no-silent|--no-quiet)
  2315. opt_quiet=false
  2316. func_append preserve_args " $_G_opt"
  2317. ;;
  2318. --no-warnings|--no-warning|--no-warn)
  2319. opt_warning=false
  2320. func_append preserve_args " $_G_opt"
  2321. ;;
  2322. --no-verbose)
  2323. opt_verbose=false
  2324. func_append preserve_args " $_G_opt"
  2325. ;;
  2326. --silent|--quiet)
  2327. opt_quiet=:
  2328. opt_verbose=false
  2329. func_append preserve_args " $_G_opt"
  2330. ;;
  2331. --tag) test $# = 0 && func_missing_arg $_G_opt && break
  2332. opt_tag=$1
  2333. func_append preserve_args " $_G_opt $1"
  2334. func_enable_tag "$1"
  2335. shift
  2336. ;;
  2337. --verbose|-v) opt_quiet=false
  2338. opt_verbose=:
  2339. func_append preserve_args " $_G_opt"
  2340. ;;
  2341. # An option not handled by this hook function:
  2342. *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  2343. esac
  2344. done
  2345. # save modified positional parameters for caller
  2346. func_quote_for_eval ${1+"$@"}
  2347. libtool_parse_options_result=$func_quote_for_eval_result
  2348. }
  2349. func_add_hook func_parse_options libtool_parse_options
  2350. # libtool_validate_options [ARG]...
  2351. # ---------------------------------
  2352. # Perform any sanity checks on option settings and/or unconsumed
  2353. # arguments.
  2354. libtool_validate_options ()
  2355. {
  2356. # save first non-option argument
  2357. if test 0 -lt $#; then
  2358. nonopt=$1
  2359. shift
  2360. fi
  2361. # preserve --debug
  2362. test : = "$debug_cmd" || func_append preserve_args " --debug"
  2363. case $host in
  2364. # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
  2365. # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
  2366. *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
  2367. # don't eliminate duplications in $postdeps and $predeps
  2368. opt_duplicate_compiler_generated_deps=:
  2369. ;;
  2370. *)
  2371. opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  2372. ;;
  2373. esac
  2374. $opt_help || {
  2375. # Sanity checks first:
  2376. func_check_version_match
  2377. test yes != "$build_libtool_libs" \
  2378. && test yes != "$build_old_libs" \
  2379. && func_fatal_configuration "not configured to build any kind of library"
  2380. # Darwin sucks
  2381. eval std_shrext=\"$shrext_cmds\"
  2382. # Only execute mode is allowed to have -dlopen flags.
  2383. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
  2384. func_error "unrecognized option '-dlopen'"
  2385. $ECHO "$help" 1>&2
  2386. exit $EXIT_FAILURE
  2387. fi
  2388. # Change the help message to a mode-specific one.
  2389. generic_help=$help
  2390. help="Try '$progname --help --mode=$opt_mode' for more information."
  2391. }
  2392. # Pass back the unparsed argument list
  2393. func_quote_for_eval ${1+"$@"}
  2394. libtool_validate_options_result=$func_quote_for_eval_result
  2395. }
  2396. func_add_hook func_validate_options libtool_validate_options
  2397. # Process options as early as possible so that --help and --version
  2398. # can return quickly.
  2399. func_options ${1+"$@"}
  2400. eval set dummy "$func_options_result"; shift
  2401. ## ----------- ##
  2402. ## Main. ##
  2403. ## ----------- ##
  2404. magic='%%%MAGIC variable%%%'
  2405. magic_exe='%%%MAGIC EXE variable%%%'
  2406. # Global variables.
  2407. extracted_archives=
  2408. extracted_serial=0
  2409. # If this variable is set in any of the actions, the command in it
  2410. # will be execed at the end. This prevents here-documents from being
  2411. # left over by shells.
  2412. exec_cmd=
  2413. # A function that is used when there is no print builtin or printf.
  2414. func_fallback_echo ()
  2415. {
  2416. eval 'cat <<_LTECHO_EOF
  2417. $1
  2418. _LTECHO_EOF'
  2419. }
  2420. # func_generated_by_libtool
  2421. # True iff stdin has been generated by Libtool. This function is only
  2422. # a basic sanity check; it will hardly flush out determined imposters.
  2423. func_generated_by_libtool_p ()
  2424. {
  2425. $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  2426. }
  2427. # func_lalib_p file
  2428. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2429. # This function is only a basic sanity check; it will hardly flush out
  2430. # determined imposters.
  2431. func_lalib_p ()
  2432. {
  2433. test -f "$1" &&
  2434. $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
  2435. }
  2436. # func_lalib_unsafe_p file
  2437. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2438. # This function implements the same check as func_lalib_p without
  2439. # resorting to external programs. To this end, it redirects stdin and
  2440. # closes it afterwards, without saving the original file descriptor.
  2441. # As a safety measure, use it only where a negative result would be
  2442. # fatal anyway. Works if 'file' does not exist.
  2443. func_lalib_unsafe_p ()
  2444. {
  2445. lalib_p=no
  2446. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  2447. for lalib_p_l in 1 2 3 4
  2448. do
  2449. read lalib_p_line
  2450. case $lalib_p_line in
  2451. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  2452. esac
  2453. done
  2454. exec 0<&5 5<&-
  2455. fi
  2456. test yes = "$lalib_p"
  2457. }
  2458. # func_ltwrapper_script_p file
  2459. # True iff FILE is a libtool wrapper script
  2460. # This function is only a basic sanity check; it will hardly flush out
  2461. # determined imposters.
  2462. func_ltwrapper_script_p ()
  2463. {
  2464. test -f "$1" &&
  2465. $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
  2466. }
  2467. # func_ltwrapper_executable_p file
  2468. # True iff FILE is a libtool wrapper executable
  2469. # This function is only a basic sanity check; it will hardly flush out
  2470. # determined imposters.
  2471. func_ltwrapper_executable_p ()
  2472. {
  2473. func_ltwrapper_exec_suffix=
  2474. case $1 in
  2475. *.exe) ;;
  2476. *) func_ltwrapper_exec_suffix=.exe ;;
  2477. esac
  2478. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  2479. }
  2480. # func_ltwrapper_scriptname file
  2481. # Assumes file is an ltwrapper_executable
  2482. # uses $file to determine the appropriate filename for a
  2483. # temporary ltwrapper_script.
  2484. func_ltwrapper_scriptname ()
  2485. {
  2486. func_dirname_and_basename "$1" "" "."
  2487. func_stripname '' '.exe' "$func_basename_result"
  2488. func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
  2489. }
  2490. # func_ltwrapper_p file
  2491. # True iff FILE is a libtool wrapper script or wrapper executable
  2492. # This function is only a basic sanity check; it will hardly flush out
  2493. # determined imposters.
  2494. func_ltwrapper_p ()
  2495. {
  2496. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  2497. }
  2498. # func_execute_cmds commands fail_cmd
  2499. # Execute tilde-delimited COMMANDS.
  2500. # If FAIL_CMD is given, eval that upon failure.
  2501. # FAIL_CMD may read-access the current command in variable CMD!
  2502. func_execute_cmds ()
  2503. {
  2504. $debug_cmd
  2505. save_ifs=$IFS; IFS='~'
  2506. for cmd in $1; do
  2507. IFS=$sp$nl
  2508. eval cmd=\"$cmd\"
  2509. IFS=$save_ifs
  2510. func_show_eval "$cmd" "${2-:}"
  2511. done
  2512. IFS=$save_ifs
  2513. }
  2514. # func_source file
  2515. # Source FILE, adding directory component if necessary.
  2516. # Note that it is not necessary on cygwin/mingw to append a dot to
  2517. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  2518. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  2519. # 'FILE.' does not work on cygwin managed mounts.
  2520. func_source ()
  2521. {
  2522. $debug_cmd
  2523. case $1 in
  2524. */* | *\\*) . "$1" ;;
  2525. *) . "./$1" ;;
  2526. esac
  2527. }
  2528. # func_resolve_sysroot PATH
  2529. # Replace a leading = in PATH with a sysroot. Store the result into
  2530. # func_resolve_sysroot_result
  2531. func_resolve_sysroot ()
  2532. {
  2533. func_resolve_sysroot_result=$1
  2534. case $func_resolve_sysroot_result in
  2535. =*)
  2536. func_stripname '=' '' "$func_resolve_sysroot_result"
  2537. func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  2538. ;;
  2539. esac
  2540. }
  2541. # func_replace_sysroot PATH
  2542. # If PATH begins with the sysroot, replace it with = and
  2543. # store the result into func_replace_sysroot_result.
  2544. func_replace_sysroot ()
  2545. {
  2546. case $lt_sysroot:$1 in
  2547. ?*:"$lt_sysroot"*)
  2548. func_stripname "$lt_sysroot" '' "$1"
  2549. func_replace_sysroot_result='='$func_stripname_result
  2550. ;;
  2551. *)
  2552. # Including no sysroot.
  2553. func_replace_sysroot_result=$1
  2554. ;;
  2555. esac
  2556. }
  2557. # func_infer_tag arg
  2558. # Infer tagged configuration to use if any are available and
  2559. # if one wasn't chosen via the "--tag" command line option.
  2560. # Only attempt this if the compiler in the base compile
  2561. # command doesn't match the default compiler.
  2562. # arg is usually of the form 'gcc ...'
  2563. func_infer_tag ()
  2564. {
  2565. $debug_cmd
  2566. if test -n "$available_tags" && test -z "$tagname"; then
  2567. CC_quoted=
  2568. for arg in $CC; do
  2569. func_append_quoted CC_quoted "$arg"
  2570. done
  2571. CC_expanded=`func_echo_all $CC`
  2572. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2573. case $@ in
  2574. # Blanks in the command may have been stripped by the calling shell,
  2575. # but not from the CC environment variable when configure was run.
  2576. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2577. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  2578. # Blanks at the start of $base_compile will cause this to fail
  2579. # if we don't check for them as well.
  2580. *)
  2581. for z in $available_tags; do
  2582. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  2583. # Evaluate the configuration.
  2584. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  2585. CC_quoted=
  2586. for arg in $CC; do
  2587. # Double-quote args containing other shell metacharacters.
  2588. func_append_quoted CC_quoted "$arg"
  2589. done
  2590. CC_expanded=`func_echo_all $CC`
  2591. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2592. case "$@ " in
  2593. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2594. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  2595. # The compiler in the base compile command matches
  2596. # the one in the tagged configuration.
  2597. # Assume this is the tagged configuration we want.
  2598. tagname=$z
  2599. break
  2600. ;;
  2601. esac
  2602. fi
  2603. done
  2604. # If $tagname still isn't set, then no tagged configuration
  2605. # was found and let the user know that the "--tag" command
  2606. # line option must be used.
  2607. if test -z "$tagname"; then
  2608. func_echo "unable to infer tagged configuration"
  2609. func_fatal_error "specify a tag with '--tag'"
  2610. # else
  2611. # func_verbose "using $tagname tagged configuration"
  2612. fi
  2613. ;;
  2614. esac
  2615. fi
  2616. }
  2617. # func_write_libtool_object output_name pic_name nonpic_name
  2618. # Create a libtool object file (analogous to a ".la" file),
  2619. # but don't create it if we're doing a dry run.
  2620. func_write_libtool_object ()
  2621. {
  2622. write_libobj=$1
  2623. if test yes = "$build_libtool_libs"; then
  2624. write_lobj=\'$2\'
  2625. else
  2626. write_lobj=none
  2627. fi
  2628. if test yes = "$build_old_libs"; then
  2629. write_oldobj=\'$3\'
  2630. else
  2631. write_oldobj=none
  2632. fi
  2633. $opt_dry_run || {
  2634. cat >${write_libobj}T <<EOF
  2635. # $write_libobj - a libtool object file
  2636. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  2637. #
  2638. # Please DO NOT delete this file!
  2639. # It is necessary for linking the library.
  2640. # Name of the PIC object.
  2641. pic_object=$write_lobj
  2642. # Name of the non-PIC object
  2643. non_pic_object=$write_oldobj
  2644. EOF
  2645. $MV "${write_libobj}T" "$write_libobj"
  2646. }
  2647. }
  2648. ##################################################
  2649. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  2650. ##################################################
  2651. # func_convert_core_file_wine_to_w32 ARG
  2652. # Helper function used by file name conversion functions when $build is *nix,
  2653. # and $host is mingw, cygwin, or some other w32 environment. Relies on a
  2654. # correctly configured wine environment available, with the winepath program
  2655. # in $build's $PATH.
  2656. #
  2657. # ARG is the $build file name to be converted to w32 format.
  2658. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  2659. # be empty on error (or when ARG is empty)
  2660. func_convert_core_file_wine_to_w32 ()
  2661. {
  2662. $debug_cmd
  2663. func_convert_core_file_wine_to_w32_result=$1
  2664. if test -n "$1"; then
  2665. # Unfortunately, winepath does not exit with a non-zero error code, so we
  2666. # are forced to check the contents of stdout. On the other hand, if the
  2667. # command is not found, the shell will set an exit code of 127 and print
  2668. # *an error message* to stdout. So we must check for both error code of
  2669. # zero AND non-empty stdout, which explains the odd construction:
  2670. func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  2671. if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
  2672. func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  2673. $SED -e "$sed_naive_backslashify"`
  2674. else
  2675. func_convert_core_file_wine_to_w32_result=
  2676. fi
  2677. fi
  2678. }
  2679. # end: func_convert_core_file_wine_to_w32
  2680. # func_convert_core_path_wine_to_w32 ARG
  2681. # Helper function used by path conversion functions when $build is *nix, and
  2682. # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
  2683. # configured wine environment available, with the winepath program in $build's
  2684. # $PATH. Assumes ARG has no leading or trailing path separator characters.
  2685. #
  2686. # ARG is path to be converted from $build format to win32.
  2687. # Result is available in $func_convert_core_path_wine_to_w32_result.
  2688. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  2689. # are convertible, then the result may be empty.
  2690. func_convert_core_path_wine_to_w32 ()
  2691. {
  2692. $debug_cmd
  2693. # unfortunately, winepath doesn't convert paths, only file names
  2694. func_convert_core_path_wine_to_w32_result=
  2695. if test -n "$1"; then
  2696. oldIFS=$IFS
  2697. IFS=:
  2698. for func_convert_core_path_wine_to_w32_f in $1; do
  2699. IFS=$oldIFS
  2700. func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  2701. if test -n "$func_convert_core_file_wine_to_w32_result"; then
  2702. if test -z "$func_convert_core_path_wine_to_w32_result"; then
  2703. func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
  2704. else
  2705. func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  2706. fi
  2707. fi
  2708. done
  2709. IFS=$oldIFS
  2710. fi
  2711. }
  2712. # end: func_convert_core_path_wine_to_w32
  2713. # func_cygpath ARGS...
  2714. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  2715. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  2716. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  2717. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  2718. # file name or path is assumed to be in w32 format, as previously converted
  2719. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  2720. # or path in func_cygpath_result (input file name or path is assumed to be in
  2721. # Cygwin format). Returns an empty string on error.
  2722. #
  2723. # ARGS are passed to cygpath, with the last one being the file name or path to
  2724. # be converted.
  2725. #
  2726. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  2727. # environment variable; do not put it in $PATH.
  2728. func_cygpath ()
  2729. {
  2730. $debug_cmd
  2731. if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  2732. func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  2733. if test "$?" -ne 0; then
  2734. # on failure, ensure result is empty
  2735. func_cygpath_result=
  2736. fi
  2737. else
  2738. func_cygpath_result=
  2739. func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
  2740. fi
  2741. }
  2742. #end: func_cygpath
  2743. # func_convert_core_msys_to_w32 ARG
  2744. # Convert file name or path ARG from MSYS format to w32 format. Return
  2745. # result in func_convert_core_msys_to_w32_result.
  2746. func_convert_core_msys_to_w32 ()
  2747. {
  2748. $debug_cmd
  2749. # awkward: cmd appends spaces to result
  2750. func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2751. $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
  2752. }
  2753. #end: func_convert_core_msys_to_w32
  2754. # func_convert_file_check ARG1 ARG2
  2755. # Verify that ARG1 (a file name in $build format) was converted to $host
  2756. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  2757. # func_to_host_file_result to ARG1).
  2758. func_convert_file_check ()
  2759. {
  2760. $debug_cmd
  2761. if test -z "$2" && test -n "$1"; then
  2762. func_error "Could not determine host file name corresponding to"
  2763. func_error " '$1'"
  2764. func_error "Continuing, but uninstalled executables may not work."
  2765. # Fallback:
  2766. func_to_host_file_result=$1
  2767. fi
  2768. }
  2769. # end func_convert_file_check
  2770. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  2771. # Verify that FROM_PATH (a path in $build format) was converted to $host
  2772. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  2773. # func_to_host_file_result to a simplistic fallback value (see below).
  2774. func_convert_path_check ()
  2775. {
  2776. $debug_cmd
  2777. if test -z "$4" && test -n "$3"; then
  2778. func_error "Could not determine the host path corresponding to"
  2779. func_error " '$3'"
  2780. func_error "Continuing, but uninstalled executables may not work."
  2781. # Fallback. This is a deliberately simplistic "conversion" and
  2782. # should not be "improved". See libtool.info.
  2783. if test "x$1" != "x$2"; then
  2784. lt_replace_pathsep_chars="s|$1|$2|g"
  2785. func_to_host_path_result=`echo "$3" |
  2786. $SED -e "$lt_replace_pathsep_chars"`
  2787. else
  2788. func_to_host_path_result=$3
  2789. fi
  2790. fi
  2791. }
  2792. # end func_convert_path_check
  2793. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  2794. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  2795. # and appending REPL if ORIG matches BACKPAT.
  2796. func_convert_path_front_back_pathsep ()
  2797. {
  2798. $debug_cmd
  2799. case $4 in
  2800. $1 ) func_to_host_path_result=$3$func_to_host_path_result
  2801. ;;
  2802. esac
  2803. case $4 in
  2804. $2 ) func_append func_to_host_path_result "$3"
  2805. ;;
  2806. esac
  2807. }
  2808. # end func_convert_path_front_back_pathsep
  2809. ##################################################
  2810. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  2811. ##################################################
  2812. # invoked via '$to_host_file_cmd ARG'
  2813. #
  2814. # In each case, ARG is the path to be converted from $build to $host format.
  2815. # Result will be available in $func_to_host_file_result.
  2816. # func_to_host_file ARG
  2817. # Converts the file name ARG from $build format to $host format. Return result
  2818. # in func_to_host_file_result.
  2819. func_to_host_file ()
  2820. {
  2821. $debug_cmd
  2822. $to_host_file_cmd "$1"
  2823. }
  2824. # end func_to_host_file
  2825. # func_to_tool_file ARG LAZY
  2826. # converts the file name ARG from $build format to toolchain format. Return
  2827. # result in func_to_tool_file_result. If the conversion in use is listed
  2828. # in (the comma separated) LAZY, no conversion takes place.
  2829. func_to_tool_file ()
  2830. {
  2831. $debug_cmd
  2832. case ,$2, in
  2833. *,"$to_tool_file_cmd",*)
  2834. func_to_tool_file_result=$1
  2835. ;;
  2836. *)
  2837. $to_tool_file_cmd "$1"
  2838. func_to_tool_file_result=$func_to_host_file_result
  2839. ;;
  2840. esac
  2841. }
  2842. # end func_to_tool_file
  2843. # func_convert_file_noop ARG
  2844. # Copy ARG to func_to_host_file_result.
  2845. func_convert_file_noop ()
  2846. {
  2847. func_to_host_file_result=$1
  2848. }
  2849. # end func_convert_file_noop
  2850. # func_convert_file_msys_to_w32 ARG
  2851. # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2852. # conversion to w32 is not available inside the cwrapper. Returns result in
  2853. # func_to_host_file_result.
  2854. func_convert_file_msys_to_w32 ()
  2855. {
  2856. $debug_cmd
  2857. func_to_host_file_result=$1
  2858. if test -n "$1"; then
  2859. func_convert_core_msys_to_w32 "$1"
  2860. func_to_host_file_result=$func_convert_core_msys_to_w32_result
  2861. fi
  2862. func_convert_file_check "$1" "$func_to_host_file_result"
  2863. }
  2864. # end func_convert_file_msys_to_w32
  2865. # func_convert_file_cygwin_to_w32 ARG
  2866. # Convert file name ARG from Cygwin to w32 format. Returns result in
  2867. # func_to_host_file_result.
  2868. func_convert_file_cygwin_to_w32 ()
  2869. {
  2870. $debug_cmd
  2871. func_to_host_file_result=$1
  2872. if test -n "$1"; then
  2873. # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
  2874. # LT_CYGPATH in this case.
  2875. func_to_host_file_result=`cygpath -m "$1"`
  2876. fi
  2877. func_convert_file_check "$1" "$func_to_host_file_result"
  2878. }
  2879. # end func_convert_file_cygwin_to_w32
  2880. # func_convert_file_nix_to_w32 ARG
  2881. # Convert file name ARG from *nix to w32 format. Requires a wine environment
  2882. # and a working winepath. Returns result in func_to_host_file_result.
  2883. func_convert_file_nix_to_w32 ()
  2884. {
  2885. $debug_cmd
  2886. func_to_host_file_result=$1
  2887. if test -n "$1"; then
  2888. func_convert_core_file_wine_to_w32 "$1"
  2889. func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
  2890. fi
  2891. func_convert_file_check "$1" "$func_to_host_file_result"
  2892. }
  2893. # end func_convert_file_nix_to_w32
  2894. # func_convert_file_msys_to_cygwin ARG
  2895. # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  2896. # Returns result in func_to_host_file_result.
  2897. func_convert_file_msys_to_cygwin ()
  2898. {
  2899. $debug_cmd
  2900. func_to_host_file_result=$1
  2901. if test -n "$1"; then
  2902. func_convert_core_msys_to_w32 "$1"
  2903. func_cygpath -u "$func_convert_core_msys_to_w32_result"
  2904. func_to_host_file_result=$func_cygpath_result
  2905. fi
  2906. func_convert_file_check "$1" "$func_to_host_file_result"
  2907. }
  2908. # end func_convert_file_msys_to_cygwin
  2909. # func_convert_file_nix_to_cygwin ARG
  2910. # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
  2911. # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
  2912. # in func_to_host_file_result.
  2913. func_convert_file_nix_to_cygwin ()
  2914. {
  2915. $debug_cmd
  2916. func_to_host_file_result=$1
  2917. if test -n "$1"; then
  2918. # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
  2919. func_convert_core_file_wine_to_w32 "$1"
  2920. func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
  2921. func_to_host_file_result=$func_cygpath_result
  2922. fi
  2923. func_convert_file_check "$1" "$func_to_host_file_result"
  2924. }
  2925. # end func_convert_file_nix_to_cygwin
  2926. #############################################
  2927. # $build to $host PATH CONVERSION FUNCTIONS #
  2928. #############################################
  2929. # invoked via '$to_host_path_cmd ARG'
  2930. #
  2931. # In each case, ARG is the path to be converted from $build to $host format.
  2932. # The result will be available in $func_to_host_path_result.
  2933. #
  2934. # Path separators are also converted from $build format to $host format. If
  2935. # ARG begins or ends with a path separator character, it is preserved (but
  2936. # converted to $host format) on output.
  2937. #
  2938. # All path conversion functions are named using the following convention:
  2939. # file name conversion function : func_convert_file_X_to_Y ()
  2940. # path conversion function : func_convert_path_X_to_Y ()
  2941. # where, for any given $build/$host combination the 'X_to_Y' value is the
  2942. # same. If conversion functions are added for new $build/$host combinations,
  2943. # the two new functions must follow this pattern, or func_init_to_host_path_cmd
  2944. # will break.
  2945. # func_init_to_host_path_cmd
  2946. # Ensures that function "pointer" variable $to_host_path_cmd is set to the
  2947. # appropriate value, based on the value of $to_host_file_cmd.
  2948. to_host_path_cmd=
  2949. func_init_to_host_path_cmd ()
  2950. {
  2951. $debug_cmd
  2952. if test -z "$to_host_path_cmd"; then
  2953. func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
  2954. to_host_path_cmd=func_convert_path_$func_stripname_result
  2955. fi
  2956. }
  2957. # func_to_host_path ARG
  2958. # Converts the path ARG from $build format to $host format. Return result
  2959. # in func_to_host_path_result.
  2960. func_to_host_path ()
  2961. {
  2962. $debug_cmd
  2963. func_init_to_host_path_cmd
  2964. $to_host_path_cmd "$1"
  2965. }
  2966. # end func_to_host_path
  2967. # func_convert_path_noop ARG
  2968. # Copy ARG to func_to_host_path_result.
  2969. func_convert_path_noop ()
  2970. {
  2971. func_to_host_path_result=$1
  2972. }
  2973. # end func_convert_path_noop
  2974. # func_convert_path_msys_to_w32 ARG
  2975. # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2976. # conversion to w32 is not available inside the cwrapper. Returns result in
  2977. # func_to_host_path_result.
  2978. func_convert_path_msys_to_w32 ()
  2979. {
  2980. $debug_cmd
  2981. func_to_host_path_result=$1
  2982. if test -n "$1"; then
  2983. # Remove leading and trailing path separator characters from ARG. MSYS
  2984. # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
  2985. # and winepath ignores them completely.
  2986. func_stripname : : "$1"
  2987. func_to_host_path_tmp1=$func_stripname_result
  2988. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  2989. func_to_host_path_result=$func_convert_core_msys_to_w32_result
  2990. func_convert_path_check : ";" \
  2991. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2992. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2993. fi
  2994. }
  2995. # end func_convert_path_msys_to_w32
  2996. # func_convert_path_cygwin_to_w32 ARG
  2997. # Convert path ARG from Cygwin to w32 format. Returns result in
  2998. # func_to_host_file_result.
  2999. func_convert_path_cygwin_to_w32 ()
  3000. {
  3001. $debug_cmd
  3002. func_to_host_path_result=$1
  3003. if test -n "$1"; then
  3004. # See func_convert_path_msys_to_w32:
  3005. func_stripname : : "$1"
  3006. func_to_host_path_tmp1=$func_stripname_result
  3007. func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
  3008. func_convert_path_check : ";" \
  3009. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3010. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3011. fi
  3012. }
  3013. # end func_convert_path_cygwin_to_w32
  3014. # func_convert_path_nix_to_w32 ARG
  3015. # Convert path ARG from *nix to w32 format. Requires a wine environment and
  3016. # a working winepath. Returns result in func_to_host_file_result.
  3017. func_convert_path_nix_to_w32 ()
  3018. {
  3019. $debug_cmd
  3020. func_to_host_path_result=$1
  3021. if test -n "$1"; then
  3022. # See func_convert_path_msys_to_w32:
  3023. func_stripname : : "$1"
  3024. func_to_host_path_tmp1=$func_stripname_result
  3025. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3026. func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
  3027. func_convert_path_check : ";" \
  3028. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3029. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3030. fi
  3031. }
  3032. # end func_convert_path_nix_to_w32
  3033. # func_convert_path_msys_to_cygwin ARG
  3034. # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  3035. # Returns result in func_to_host_file_result.
  3036. func_convert_path_msys_to_cygwin ()
  3037. {
  3038. $debug_cmd
  3039. func_to_host_path_result=$1
  3040. if test -n "$1"; then
  3041. # See func_convert_path_msys_to_w32:
  3042. func_stripname : : "$1"
  3043. func_to_host_path_tmp1=$func_stripname_result
  3044. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3045. func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
  3046. func_to_host_path_result=$func_cygpath_result
  3047. func_convert_path_check : : \
  3048. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3049. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3050. fi
  3051. }
  3052. # end func_convert_path_msys_to_cygwin
  3053. # func_convert_path_nix_to_cygwin ARG
  3054. # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
  3055. # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
  3056. # func_to_host_file_result.
  3057. func_convert_path_nix_to_cygwin ()
  3058. {
  3059. $debug_cmd
  3060. func_to_host_path_result=$1
  3061. if test -n "$1"; then
  3062. # Remove leading and trailing path separator characters from
  3063. # ARG. msys behavior is inconsistent here, cygpath turns them
  3064. # into '.;' and ';.', and winepath ignores them completely.
  3065. func_stripname : : "$1"
  3066. func_to_host_path_tmp1=$func_stripname_result
  3067. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3068. func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
  3069. func_to_host_path_result=$func_cygpath_result
  3070. func_convert_path_check : : \
  3071. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3072. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3073. fi
  3074. }
  3075. # end func_convert_path_nix_to_cygwin
  3076. # func_dll_def_p FILE
  3077. # True iff FILE is a Windows DLL '.def' file.
  3078. # Keep in sync with _LT_DLL_DEF_P in libtool.m4
  3079. func_dll_def_p ()
  3080. {
  3081. $debug_cmd
  3082. func_dll_def_p_tmp=`$SED -n \
  3083. -e 's/^[ ]*//' \
  3084. -e '/^\(;.*\)*$/d' \
  3085. -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
  3086. -e q \
  3087. "$1"`
  3088. test DEF = "$func_dll_def_p_tmp"
  3089. }
  3090. # func_mode_compile arg...
  3091. func_mode_compile ()
  3092. {
  3093. $debug_cmd
  3094. # Get the compilation command and the source file.
  3095. base_compile=
  3096. srcfile=$nonopt # always keep a non-empty value in "srcfile"
  3097. suppress_opt=yes
  3098. suppress_output=
  3099. arg_mode=normal
  3100. libobj=
  3101. later=
  3102. pie_flag=
  3103. for arg
  3104. do
  3105. case $arg_mode in
  3106. arg )
  3107. # do not "continue". Instead, add this to base_compile
  3108. lastarg=$arg
  3109. arg_mode=normal
  3110. ;;
  3111. target )
  3112. libobj=$arg
  3113. arg_mode=normal
  3114. continue
  3115. ;;
  3116. normal )
  3117. # Accept any command-line options.
  3118. case $arg in
  3119. -o)
  3120. test -n "$libobj" && \
  3121. func_fatal_error "you cannot specify '-o' more than once"
  3122. arg_mode=target
  3123. continue
  3124. ;;
  3125. -pie | -fpie | -fPIE)
  3126. func_append pie_flag " $arg"
  3127. continue
  3128. ;;
  3129. -shared | -static | -prefer-pic | -prefer-non-pic)
  3130. func_append later " $arg"
  3131. continue
  3132. ;;
  3133. -no-suppress)
  3134. suppress_opt=no
  3135. continue
  3136. ;;
  3137. -Xcompiler)
  3138. arg_mode=arg # the next one goes into the "base_compile" arg list
  3139. continue # The current "srcfile" will either be retained or
  3140. ;; # replaced later. I would guess that would be a bug.
  3141. -Wc,*)
  3142. func_stripname '-Wc,' '' "$arg"
  3143. args=$func_stripname_result
  3144. lastarg=
  3145. save_ifs=$IFS; IFS=,
  3146. for arg in $args; do
  3147. IFS=$save_ifs
  3148. func_append_quoted lastarg "$arg"
  3149. done
  3150. IFS=$save_ifs
  3151. func_stripname ' ' '' "$lastarg"
  3152. lastarg=$func_stripname_result
  3153. # Add the arguments to base_compile.
  3154. func_append base_compile " $lastarg"
  3155. continue
  3156. ;;
  3157. *)
  3158. # Accept the current argument as the source file.
  3159. # The previous "srcfile" becomes the current argument.
  3160. #
  3161. lastarg=$srcfile
  3162. srcfile=$arg
  3163. ;;
  3164. esac # case $arg
  3165. ;;
  3166. esac # case $arg_mode
  3167. # Aesthetically quote the previous argument.
  3168. func_append_quoted base_compile "$lastarg"
  3169. done # for arg
  3170. case $arg_mode in
  3171. arg)
  3172. func_fatal_error "you must specify an argument for -Xcompile"
  3173. ;;
  3174. target)
  3175. func_fatal_error "you must specify a target with '-o'"
  3176. ;;
  3177. *)
  3178. # Get the name of the library object.
  3179. test -z "$libobj" && {
  3180. func_basename "$srcfile"
  3181. libobj=$func_basename_result
  3182. }
  3183. ;;
  3184. esac
  3185. # Recognize several different file suffixes.
  3186. # If the user specifies -o file.o, it is replaced with file.lo
  3187. case $libobj in
  3188. *.[cCFSifmso] | \
  3189. *.ada | *.adb | *.ads | *.asm | \
  3190. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  3191. *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
  3192. func_xform "$libobj"
  3193. libobj=$func_xform_result
  3194. ;;
  3195. esac
  3196. case $libobj in
  3197. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  3198. *)
  3199. func_fatal_error "cannot determine name of library object from '$libobj'"
  3200. ;;
  3201. esac
  3202. func_infer_tag $base_compile
  3203. for arg in $later; do
  3204. case $arg in
  3205. -shared)
  3206. test yes = "$build_libtool_libs" \
  3207. || func_fatal_configuration "cannot build a shared library"
  3208. build_old_libs=no
  3209. continue
  3210. ;;
  3211. -static)
  3212. build_libtool_libs=no
  3213. build_old_libs=yes
  3214. continue
  3215. ;;
  3216. -prefer-pic)
  3217. pic_mode=yes
  3218. continue
  3219. ;;
  3220. -prefer-non-pic)
  3221. pic_mode=no
  3222. continue
  3223. ;;
  3224. esac
  3225. done
  3226. func_quote_for_eval "$libobj"
  3227. test "X$libobj" != "X$func_quote_for_eval_result" \
  3228. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  3229. && func_warning "libobj name '$libobj' may not contain shell special characters."
  3230. func_dirname_and_basename "$obj" "/" ""
  3231. objname=$func_basename_result
  3232. xdir=$func_dirname_result
  3233. lobj=$xdir$objdir/$objname
  3234. test -z "$base_compile" && \
  3235. func_fatal_help "you must specify a compilation command"
  3236. # Delete any leftover library objects.
  3237. if test yes = "$build_old_libs"; then
  3238. removelist="$obj $lobj $libobj ${libobj}T"
  3239. else
  3240. removelist="$lobj $libobj ${libobj}T"
  3241. fi
  3242. # On Cygwin there's no "real" PIC flag so we must build both object types
  3243. case $host_os in
  3244. cygwin* | mingw* | pw32* | os2* | cegcc*)
  3245. pic_mode=default
  3246. ;;
  3247. esac
  3248. if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
  3249. # non-PIC code in shared libraries is not supported
  3250. pic_mode=default
  3251. fi
  3252. # Calculate the filename of the output object if compiler does
  3253. # not support -o with -c
  3254. if test no = "$compiler_c_o"; then
  3255. output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
  3256. lockfile=$output_obj.lock
  3257. else
  3258. output_obj=
  3259. need_locks=no
  3260. lockfile=
  3261. fi
  3262. # Lock this critical section if it is needed
  3263. # We use this script file to make the link, it avoids creating a new file
  3264. if test yes = "$need_locks"; then
  3265. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  3266. func_echo "Waiting for $lockfile to be removed"
  3267. sleep 2
  3268. done
  3269. elif test warn = "$need_locks"; then
  3270. if test -f "$lockfile"; then
  3271. $ECHO "\
  3272. *** ERROR, $lockfile exists and contains:
  3273. `cat $lockfile 2>/dev/null`
  3274. This indicates that another process is trying to use the same
  3275. temporary object file, and libtool could not work around it because
  3276. your compiler does not support '-c' and '-o' together. If you
  3277. repeat this compilation, it may succeed, by chance, but you had better
  3278. avoid parallel builds (make -j) in this platform, or get a better
  3279. compiler."
  3280. $opt_dry_run || $RM $removelist
  3281. exit $EXIT_FAILURE
  3282. fi
  3283. func_append removelist " $output_obj"
  3284. $ECHO "$srcfile" > "$lockfile"
  3285. fi
  3286. $opt_dry_run || $RM $removelist
  3287. func_append removelist " $lockfile"
  3288. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  3289. func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
  3290. srcfile=$func_to_tool_file_result
  3291. func_quote_for_eval "$srcfile"
  3292. qsrcfile=$func_quote_for_eval_result
  3293. # Only build a PIC object if we are building libtool libraries.
  3294. if test yes = "$build_libtool_libs"; then
  3295. # Without this assignment, base_compile gets emptied.
  3296. fbsd_hideous_sh_bug=$base_compile
  3297. if test no != "$pic_mode"; then
  3298. command="$base_compile $qsrcfile $pic_flag"
  3299. else
  3300. # Don't build PIC code
  3301. command="$base_compile $qsrcfile"
  3302. fi
  3303. func_mkdir_p "$xdir$objdir"
  3304. if test -z "$output_obj"; then
  3305. # Place PIC objects in $objdir
  3306. func_append command " -o $lobj"
  3307. fi
  3308. func_show_eval_locale "$command" \
  3309. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  3310. if test warn = "$need_locks" &&
  3311. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3312. $ECHO "\
  3313. *** ERROR, $lockfile contains:
  3314. `cat $lockfile 2>/dev/null`
  3315. but it should contain:
  3316. $srcfile
  3317. This indicates that another process is trying to use the same
  3318. temporary object file, and libtool could not work around it because
  3319. your compiler does not support '-c' and '-o' together. If you
  3320. repeat this compilation, it may succeed, by chance, but you had better
  3321. avoid parallel builds (make -j) in this platform, or get a better
  3322. compiler."
  3323. $opt_dry_run || $RM $removelist
  3324. exit $EXIT_FAILURE
  3325. fi
  3326. # Just move the object if needed, then go on to compile the next one
  3327. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  3328. func_show_eval '$MV "$output_obj" "$lobj"' \
  3329. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3330. fi
  3331. # Allow error messages only from the first compilation.
  3332. if test yes = "$suppress_opt"; then
  3333. suppress_output=' >/dev/null 2>&1'
  3334. fi
  3335. fi
  3336. # Only build a position-dependent object if we build old libraries.
  3337. if test yes = "$build_old_libs"; then
  3338. if test yes != "$pic_mode"; then
  3339. # Don't build PIC code
  3340. command="$base_compile $qsrcfile$pie_flag"
  3341. else
  3342. command="$base_compile $qsrcfile $pic_flag"
  3343. fi
  3344. if test yes = "$compiler_c_o"; then
  3345. func_append command " -o $obj"
  3346. fi
  3347. # Suppress compiler output if we already did a PIC compilation.
  3348. func_append command "$suppress_output"
  3349. func_show_eval_locale "$command" \
  3350. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  3351. if test warn = "$need_locks" &&
  3352. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3353. $ECHO "\
  3354. *** ERROR, $lockfile contains:
  3355. `cat $lockfile 2>/dev/null`
  3356. but it should contain:
  3357. $srcfile
  3358. This indicates that another process is trying to use the same
  3359. temporary object file, and libtool could not work around it because
  3360. your compiler does not support '-c' and '-o' together. If you
  3361. repeat this compilation, it may succeed, by chance, but you had better
  3362. avoid parallel builds (make -j) in this platform, or get a better
  3363. compiler."
  3364. $opt_dry_run || $RM $removelist
  3365. exit $EXIT_FAILURE
  3366. fi
  3367. # Just move the object if needed
  3368. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  3369. func_show_eval '$MV "$output_obj" "$obj"' \
  3370. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3371. fi
  3372. fi
  3373. $opt_dry_run || {
  3374. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  3375. # Unlock the critical section if it was locked
  3376. if test no != "$need_locks"; then
  3377. removelist=$lockfile
  3378. $RM "$lockfile"
  3379. fi
  3380. }
  3381. exit $EXIT_SUCCESS
  3382. }
  3383. $opt_help || {
  3384. test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
  3385. }
  3386. func_mode_help ()
  3387. {
  3388. # We need to display help for each of the modes.
  3389. case $opt_mode in
  3390. "")
  3391. # Generic help is extracted from the usage comments
  3392. # at the start of this file.
  3393. func_help
  3394. ;;
  3395. clean)
  3396. $ECHO \
  3397. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  3398. Remove files from the build directory.
  3399. RM is the name of the program to use to delete files associated with each FILE
  3400. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3401. to RM.
  3402. If FILE is a libtool library, object or program, all the files associated
  3403. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  3404. ;;
  3405. compile)
  3406. $ECHO \
  3407. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3408. Compile a source file into a libtool library object.
  3409. This mode accepts the following additional options:
  3410. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  3411. -no-suppress do not suppress compiler output for multiple passes
  3412. -prefer-pic try to build PIC objects only
  3413. -prefer-non-pic try to build non-PIC objects only
  3414. -shared do not build a '.o' file suitable for static linking
  3415. -static only build a '.o' file suitable for static linking
  3416. -Wc,FLAG pass FLAG directly to the compiler
  3417. COMPILE-COMMAND is a command to be used in creating a 'standard' object file
  3418. from the given SOURCEFILE.
  3419. The output file name is determined by removing the directory component from
  3420. SOURCEFILE, then substituting the C source code suffix '.c' with the
  3421. library object suffix, '.lo'."
  3422. ;;
  3423. execute)
  3424. $ECHO \
  3425. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  3426. Automatically set library path, then run a program.
  3427. This mode accepts the following additional options:
  3428. -dlopen FILE add the directory containing FILE to the library path
  3429. This mode sets the library path environment variable according to '-dlopen'
  3430. flags.
  3431. If any of the ARGS are libtool executable wrappers, then they are translated
  3432. into their corresponding uninstalled binary, and any of their required library
  3433. directories are added to the library path.
  3434. Then, COMMAND is executed, with ARGS as arguments."
  3435. ;;
  3436. finish)
  3437. $ECHO \
  3438. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  3439. Complete the installation of libtool libraries.
  3440. Each LIBDIR is a directory that contains libtool libraries.
  3441. The commands that this mode executes may require superuser privileges. Use
  3442. the '--dry-run' option if you just want to see what would be executed."
  3443. ;;
  3444. install)
  3445. $ECHO \
  3446. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  3447. Install executables or libraries.
  3448. INSTALL-COMMAND is the installation command. The first component should be
  3449. either the 'install' or 'cp' program.
  3450. The following components of INSTALL-COMMAND are treated specially:
  3451. -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  3452. The rest of the components are interpreted as arguments to that command (only
  3453. BSD-compatible install options are recognized)."
  3454. ;;
  3455. link)
  3456. $ECHO \
  3457. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  3458. Link object files or libraries together to form another library, or to
  3459. create an executable program.
  3460. LINK-COMMAND is a command using the C compiler that you would use to create
  3461. a program from several object files.
  3462. The following components of LINK-COMMAND are treated specially:
  3463. -all-static do not do any dynamic linking at all
  3464. -avoid-version do not add a version suffix if possible
  3465. -bindir BINDIR specify path to binaries directory (for systems where
  3466. libraries must be found in the PATH setting at runtime)
  3467. -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
  3468. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  3469. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3470. -export-symbols SYMFILE
  3471. try to export only the symbols listed in SYMFILE
  3472. -export-symbols-regex REGEX
  3473. try to export only the symbols matching REGEX
  3474. -LLIBDIR search LIBDIR for required installed libraries
  3475. -lNAME OUTPUT-FILE requires the installed library libNAME
  3476. -module build a library that can dlopened
  3477. -no-fast-install disable the fast-install mode
  3478. -no-install link a not-installable executable
  3479. -no-undefined declare that a library does not refer to external symbols
  3480. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  3481. -objectlist FILE use a list of object files found in FILE to specify objects
  3482. -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
  3483. -precious-files-regex REGEX
  3484. don't remove output files matching REGEX
  3485. -release RELEASE specify package release information
  3486. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  3487. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  3488. -shared only do dynamic linking of libtool libraries
  3489. -shrext SUFFIX override the standard shared library file extension
  3490. -static do not do any dynamic linking of uninstalled libtool libraries
  3491. -static-libtool-libs
  3492. do not do any dynamic linking of libtool libraries
  3493. -version-info CURRENT[:REVISION[:AGE]]
  3494. specify library version info [each variable defaults to 0]
  3495. -weak LIBNAME declare that the target provides the LIBNAME interface
  3496. -Wc,FLAG
  3497. -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
  3498. -Wl,FLAG
  3499. -Xlinker FLAG pass linker-specific FLAG directly to the linker
  3500. -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
  3501. All other options (arguments beginning with '-') are ignored.
  3502. Every other argument is treated as a filename. Files ending in '.la' are
  3503. treated as uninstalled libtool libraries, other files are standard or library
  3504. object files.
  3505. If the OUTPUT-FILE ends in '.la', then a libtool library is created,
  3506. only library objects ('.lo' files) may be specified, and '-rpath' is
  3507. required, except when creating a convenience library.
  3508. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
  3509. using 'ar' and 'ranlib', or on Windows using 'lib'.
  3510. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
  3511. is created, otherwise an executable program is created."
  3512. ;;
  3513. uninstall)
  3514. $ECHO \
  3515. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3516. Remove libraries from an installation directory.
  3517. RM is the name of the program to use to delete files associated with each FILE
  3518. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3519. to RM.
  3520. If FILE is a libtool library, all the files associated with it are deleted.
  3521. Otherwise, only FILE itself is deleted using RM."
  3522. ;;
  3523. *)
  3524. func_fatal_help "invalid operation mode '$opt_mode'"
  3525. ;;
  3526. esac
  3527. echo
  3528. $ECHO "Try '$progname --help' for more information about other modes."
  3529. }
  3530. # Now that we've collected a possible --mode arg, show help if necessary
  3531. if $opt_help; then
  3532. if test : = "$opt_help"; then
  3533. func_mode_help
  3534. else
  3535. {
  3536. func_help noexit
  3537. for opt_mode in compile link execute install finish uninstall clean; do
  3538. func_mode_help
  3539. done
  3540. } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
  3541. {
  3542. func_help noexit
  3543. for opt_mode in compile link execute install finish uninstall clean; do
  3544. echo
  3545. func_mode_help
  3546. done
  3547. } |
  3548. $SED '1d
  3549. /^When reporting/,/^Report/{
  3550. H
  3551. d
  3552. }
  3553. $x
  3554. /information about other modes/d
  3555. /more detailed .*MODE/d
  3556. s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  3557. fi
  3558. exit $?
  3559. fi
  3560. # func_mode_execute arg...
  3561. func_mode_execute ()
  3562. {
  3563. $debug_cmd
  3564. # The first argument is the command name.
  3565. cmd=$nonopt
  3566. test -z "$cmd" && \
  3567. func_fatal_help "you must specify a COMMAND"
  3568. # Handle -dlopen flags immediately.
  3569. for file in $opt_dlopen; do
  3570. test -f "$file" \
  3571. || func_fatal_help "'$file' is not a file"
  3572. dir=
  3573. case $file in
  3574. *.la)
  3575. func_resolve_sysroot "$file"
  3576. file=$func_resolve_sysroot_result
  3577. # Check to see that this really is a libtool archive.
  3578. func_lalib_unsafe_p "$file" \
  3579. || func_fatal_help "'$lib' is not a valid libtool archive"
  3580. # Read the libtool library.
  3581. dlname=
  3582. library_names=
  3583. func_source "$file"
  3584. # Skip this library if it cannot be dlopened.
  3585. if test -z "$dlname"; then
  3586. # Warn if it was a shared library.
  3587. test -n "$library_names" && \
  3588. func_warning "'$file' was not linked with '-export-dynamic'"
  3589. continue
  3590. fi
  3591. func_dirname "$file" "" "."
  3592. dir=$func_dirname_result
  3593. if test -f "$dir/$objdir/$dlname"; then
  3594. func_append dir "/$objdir"
  3595. else
  3596. if test ! -f "$dir/$dlname"; then
  3597. func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
  3598. fi
  3599. fi
  3600. ;;
  3601. *.lo)
  3602. # Just add the directory containing the .lo file.
  3603. func_dirname "$file" "" "."
  3604. dir=$func_dirname_result
  3605. ;;
  3606. *)
  3607. func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
  3608. continue
  3609. ;;
  3610. esac
  3611. # Get the absolute pathname.
  3612. absdir=`cd "$dir" && pwd`
  3613. test -n "$absdir" && dir=$absdir
  3614. # Now add the directory to shlibpath_var.
  3615. if eval "test -z \"\$$shlibpath_var\""; then
  3616. eval "$shlibpath_var=\"\$dir\""
  3617. else
  3618. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3619. fi
  3620. done
  3621. # This variable tells wrapper scripts just to set shlibpath_var
  3622. # rather than running their programs.
  3623. libtool_execute_magic=$magic
  3624. # Check if any of the arguments is a wrapper script.
  3625. args=
  3626. for file
  3627. do
  3628. case $file in
  3629. -* | *.la | *.lo ) ;;
  3630. *)
  3631. # Do a test to see if this is really a libtool program.
  3632. if func_ltwrapper_script_p "$file"; then
  3633. func_source "$file"
  3634. # Transform arg to wrapped name.
  3635. file=$progdir/$program
  3636. elif func_ltwrapper_executable_p "$file"; then
  3637. func_ltwrapper_scriptname "$file"
  3638. func_source "$func_ltwrapper_scriptname_result"
  3639. # Transform arg to wrapped name.
  3640. file=$progdir/$program
  3641. fi
  3642. ;;
  3643. esac
  3644. # Quote arguments (to preserve shell metacharacters).
  3645. func_append_quoted args "$file"
  3646. done
  3647. if $opt_dry_run; then
  3648. # Display what would be done.
  3649. if test -n "$shlibpath_var"; then
  3650. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  3651. echo "export $shlibpath_var"
  3652. fi
  3653. $ECHO "$cmd$args"
  3654. exit $EXIT_SUCCESS
  3655. else
  3656. if test -n "$shlibpath_var"; then
  3657. # Export the shlibpath_var.
  3658. eval "export $shlibpath_var"
  3659. fi
  3660. # Restore saved environment variables
  3661. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  3662. do
  3663. eval "if test \"\${save_$lt_var+set}\" = set; then
  3664. $lt_var=\$save_$lt_var; export $lt_var
  3665. else
  3666. $lt_unset $lt_var
  3667. fi"
  3668. done
  3669. # Now prepare to actually exec the command.
  3670. exec_cmd=\$cmd$args
  3671. fi
  3672. }
  3673. test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
  3674. # func_mode_finish arg...
  3675. func_mode_finish ()
  3676. {
  3677. $debug_cmd
  3678. libs=
  3679. libdirs=
  3680. admincmds=
  3681. for opt in "$nonopt" ${1+"$@"}
  3682. do
  3683. if test -d "$opt"; then
  3684. func_append libdirs " $opt"
  3685. elif test -f "$opt"; then
  3686. if func_lalib_unsafe_p "$opt"; then
  3687. func_append libs " $opt"
  3688. else
  3689. func_warning "'$opt' is not a valid libtool archive"
  3690. fi
  3691. else
  3692. func_fatal_error "invalid argument '$opt'"
  3693. fi
  3694. done
  3695. if test -n "$libs"; then
  3696. if test -n "$lt_sysroot"; then
  3697. sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
  3698. sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
  3699. else
  3700. sysroot_cmd=
  3701. fi
  3702. # Remove sysroot references
  3703. if $opt_dry_run; then
  3704. for lib in $libs; do
  3705. echo "removing references to $lt_sysroot and '=' prefixes from $lib"
  3706. done
  3707. else
  3708. tmpdir=`func_mktempdir`
  3709. for lib in $libs; do
  3710. $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
  3711. > $tmpdir/tmp-la
  3712. mv -f $tmpdir/tmp-la $lib
  3713. done
  3714. ${RM}r "$tmpdir"
  3715. fi
  3716. fi
  3717. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3718. for libdir in $libdirs; do
  3719. if test -n "$finish_cmds"; then
  3720. # Do each command in the finish commands.
  3721. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  3722. '"$cmd"'"'
  3723. fi
  3724. if test -n "$finish_eval"; then
  3725. # Do the single finish_eval.
  3726. eval cmds=\"$finish_eval\"
  3727. $opt_dry_run || eval "$cmds" || func_append admincmds "
  3728. $cmds"
  3729. fi
  3730. done
  3731. fi
  3732. # Exit here if they wanted silent mode.
  3733. $opt_quiet && exit $EXIT_SUCCESS
  3734. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3735. echo "----------------------------------------------------------------------"
  3736. echo "Libraries have been installed in:"
  3737. for libdir in $libdirs; do
  3738. $ECHO " $libdir"
  3739. done
  3740. echo
  3741. echo "If you ever happen to want to link against installed libraries"
  3742. echo "in a given directory, LIBDIR, you must either use libtool, and"
  3743. echo "specify the full pathname of the library, or use the '-LLIBDIR'"
  3744. echo "flag during linking and do at least one of the following:"
  3745. if test -n "$shlibpath_var"; then
  3746. echo " - add LIBDIR to the '$shlibpath_var' environment variable"
  3747. echo " during execution"
  3748. fi
  3749. if test -n "$runpath_var"; then
  3750. echo " - add LIBDIR to the '$runpath_var' environment variable"
  3751. echo " during linking"
  3752. fi
  3753. if test -n "$hardcode_libdir_flag_spec"; then
  3754. libdir=LIBDIR
  3755. eval flag=\"$hardcode_libdir_flag_spec\"
  3756. $ECHO " - use the '$flag' linker flag"
  3757. fi
  3758. if test -n "$admincmds"; then
  3759. $ECHO " - have your system administrator run these commands:$admincmds"
  3760. fi
  3761. if test -f /etc/ld.so.conf; then
  3762. echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
  3763. fi
  3764. echo
  3765. echo "See any operating system documentation about shared libraries for"
  3766. case $host in
  3767. solaris2.[6789]|solaris2.1[0-9])
  3768. echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  3769. echo "pages."
  3770. ;;
  3771. *)
  3772. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3773. ;;
  3774. esac
  3775. echo "----------------------------------------------------------------------"
  3776. fi
  3777. exit $EXIT_SUCCESS
  3778. }
  3779. test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
  3780. # func_mode_install arg...
  3781. func_mode_install ()
  3782. {
  3783. $debug_cmd
  3784. # There may be an optional sh(1) argument at the beginning of
  3785. # install_prog (especially on Windows NT).
  3786. if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
  3787. # Allow the use of GNU shtool's install command.
  3788. case $nonopt in *shtool*) :;; *) false;; esac
  3789. then
  3790. # Aesthetically quote it.
  3791. func_quote_for_eval "$nonopt"
  3792. install_prog="$func_quote_for_eval_result "
  3793. arg=$1
  3794. shift
  3795. else
  3796. install_prog=
  3797. arg=$nonopt
  3798. fi
  3799. # The real first argument should be the name of the installation program.
  3800. # Aesthetically quote it.
  3801. func_quote_for_eval "$arg"
  3802. func_append install_prog "$func_quote_for_eval_result"
  3803. install_shared_prog=$install_prog
  3804. case " $install_prog " in
  3805. *[\\\ /]cp\ *) install_cp=: ;;
  3806. *) install_cp=false ;;
  3807. esac
  3808. # We need to accept at least all the BSD install flags.
  3809. dest=
  3810. files=
  3811. opts=
  3812. prev=
  3813. install_type=
  3814. isdir=false
  3815. stripme=
  3816. no_mode=:
  3817. for arg
  3818. do
  3819. arg2=
  3820. if test -n "$dest"; then
  3821. func_append files " $dest"
  3822. dest=$arg
  3823. continue
  3824. fi
  3825. case $arg in
  3826. -d) isdir=: ;;
  3827. -f)
  3828. if $install_cp; then :; else
  3829. prev=$arg
  3830. fi
  3831. ;;
  3832. -g | -m | -o)
  3833. prev=$arg
  3834. ;;
  3835. -s)
  3836. stripme=" -s"
  3837. continue
  3838. ;;
  3839. -*)
  3840. ;;
  3841. *)
  3842. # If the previous option needed an argument, then skip it.
  3843. if test -n "$prev"; then
  3844. if test X-m = "X$prev" && test -n "$install_override_mode"; then
  3845. arg2=$install_override_mode
  3846. no_mode=false
  3847. fi
  3848. prev=
  3849. else
  3850. dest=$arg
  3851. continue
  3852. fi
  3853. ;;
  3854. esac
  3855. # Aesthetically quote the argument.
  3856. func_quote_for_eval "$arg"
  3857. func_append install_prog " $func_quote_for_eval_result"
  3858. if test -n "$arg2"; then
  3859. func_quote_for_eval "$arg2"
  3860. fi
  3861. func_append install_shared_prog " $func_quote_for_eval_result"
  3862. done
  3863. test -z "$install_prog" && \
  3864. func_fatal_help "you must specify an install program"
  3865. test -n "$prev" && \
  3866. func_fatal_help "the '$prev' option requires an argument"
  3867. if test -n "$install_override_mode" && $no_mode; then
  3868. if $install_cp; then :; else
  3869. func_quote_for_eval "$install_override_mode"
  3870. func_append install_shared_prog " -m $func_quote_for_eval_result"
  3871. fi
  3872. fi
  3873. if test -z "$files"; then
  3874. if test -z "$dest"; then
  3875. func_fatal_help "no file or destination specified"
  3876. else
  3877. func_fatal_help "you must specify a destination"
  3878. fi
  3879. fi
  3880. # Strip any trailing slash from the destination.
  3881. func_stripname '' '/' "$dest"
  3882. dest=$func_stripname_result
  3883. # Check to see that the destination is a directory.
  3884. test -d "$dest" && isdir=:
  3885. if $isdir; then
  3886. destdir=$dest
  3887. destname=
  3888. else
  3889. func_dirname_and_basename "$dest" "" "."
  3890. destdir=$func_dirname_result
  3891. destname=$func_basename_result
  3892. # Not a directory, so check to see that there is only one file specified.
  3893. set dummy $files; shift
  3894. test "$#" -gt 1 && \
  3895. func_fatal_help "'$dest' is not a directory"
  3896. fi
  3897. case $destdir in
  3898. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3899. *)
  3900. for file in $files; do
  3901. case $file in
  3902. *.lo) ;;
  3903. *)
  3904. func_fatal_help "'$destdir' must be an absolute directory name"
  3905. ;;
  3906. esac
  3907. done
  3908. ;;
  3909. esac
  3910. # This variable tells wrapper scripts just to set variables rather
  3911. # than running their programs.
  3912. libtool_install_magic=$magic
  3913. staticlibs=
  3914. future_libdirs=
  3915. current_libdirs=
  3916. for file in $files; do
  3917. # Do each installation.
  3918. case $file in
  3919. *.$libext)
  3920. # Do the static libraries later.
  3921. func_append staticlibs " $file"
  3922. ;;
  3923. *.la)
  3924. func_resolve_sysroot "$file"
  3925. file=$func_resolve_sysroot_result
  3926. # Check to see that this really is a libtool archive.
  3927. func_lalib_unsafe_p "$file" \
  3928. || func_fatal_help "'$file' is not a valid libtool archive"
  3929. library_names=
  3930. old_library=
  3931. relink_command=
  3932. func_source "$file"
  3933. # Add the libdir to current_libdirs if it is the destination.
  3934. if test "X$destdir" = "X$libdir"; then
  3935. case "$current_libdirs " in
  3936. *" $libdir "*) ;;
  3937. *) func_append current_libdirs " $libdir" ;;
  3938. esac
  3939. else
  3940. # Note the libdir as a future libdir.
  3941. case "$future_libdirs " in
  3942. *" $libdir "*) ;;
  3943. *) func_append future_libdirs " $libdir" ;;
  3944. esac
  3945. fi
  3946. func_dirname "$file" "/" ""
  3947. dir=$func_dirname_result
  3948. func_append dir "$objdir"
  3949. if test -n "$relink_command"; then
  3950. # Determine the prefix the user has applied to our future dir.
  3951. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  3952. # Don't allow the user to place us outside of our expected
  3953. # location b/c this prevents finding dependent libraries that
  3954. # are installed to the same prefix.
  3955. # At present, this check doesn't affect windows .dll's that
  3956. # are installed into $libdir/../bin (currently, that works fine)
  3957. # but it's something to keep an eye on.
  3958. test "$inst_prefix_dir" = "$destdir" && \
  3959. func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
  3960. if test -n "$inst_prefix_dir"; then
  3961. # Stick the inst_prefix_dir data into the link command.
  3962. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  3963. else
  3964. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  3965. fi
  3966. func_warning "relinking '$file'"
  3967. func_show_eval "$relink_command" \
  3968. 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
  3969. fi
  3970. # See the names of the shared library.
  3971. set dummy $library_names; shift
  3972. if test -n "$1"; then
  3973. realname=$1
  3974. shift
  3975. srcname=$realname
  3976. test -n "$relink_command" && srcname=${realname}T
  3977. # Install the shared library and build the symlinks.
  3978. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  3979. 'exit $?'
  3980. tstripme=$stripme
  3981. case $host_os in
  3982. cygwin* | mingw* | pw32* | cegcc*)
  3983. case $realname in
  3984. *.dll.a)
  3985. tstripme=
  3986. ;;
  3987. esac
  3988. ;;
  3989. os2*)
  3990. case $realname in
  3991. *_dll.a)
  3992. tstripme=
  3993. ;;
  3994. esac
  3995. ;;
  3996. esac
  3997. if test -n "$tstripme" && test -n "$striplib"; then
  3998. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  3999. fi
  4000. if test "$#" -gt 0; then
  4001. # Delete the old symlinks, and create new ones.
  4002. # Try 'ln -sf' first, because the 'ln' binary might depend on
  4003. # the symlink we replace! Solaris /bin/ln does not understand -f,
  4004. # so we also need to try rm && ln -s.
  4005. for linkname
  4006. do
  4007. test "$linkname" != "$realname" \
  4008. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  4009. done
  4010. fi
  4011. # Do each command in the postinstall commands.
  4012. lib=$destdir/$realname
  4013. func_execute_cmds "$postinstall_cmds" 'exit $?'
  4014. fi
  4015. # Install the pseudo-library for information purposes.
  4016. func_basename "$file"
  4017. name=$func_basename_result
  4018. instname=$dir/${name}i
  4019. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  4020. # Maybe install the static library, too.
  4021. test -n "$old_library" && func_append staticlibs " $dir/$old_library"
  4022. ;;
  4023. *.lo)
  4024. # Install (i.e. copy) a libtool object.
  4025. # Figure out destination file name, if it wasn't already specified.
  4026. if test -n "$destname"; then
  4027. destfile=$destdir/$destname
  4028. else
  4029. func_basename "$file"
  4030. destfile=$func_basename_result
  4031. destfile=$destdir/$destfile
  4032. fi
  4033. # Deduce the name of the destination old-style object file.
  4034. case $destfile in
  4035. *.lo)
  4036. func_lo2o "$destfile"
  4037. staticdest=$func_lo2o_result
  4038. ;;
  4039. *.$objext)
  4040. staticdest=$destfile
  4041. destfile=
  4042. ;;
  4043. *)
  4044. func_fatal_help "cannot copy a libtool object to '$destfile'"
  4045. ;;
  4046. esac
  4047. # Install the libtool object if requested.
  4048. test -n "$destfile" && \
  4049. func_show_eval "$install_prog $file $destfile" 'exit $?'
  4050. # Install the old object if enabled.
  4051. if test yes = "$build_old_libs"; then
  4052. # Deduce the name of the old-style object file.
  4053. func_lo2o "$file"
  4054. staticobj=$func_lo2o_result
  4055. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  4056. fi
  4057. exit $EXIT_SUCCESS
  4058. ;;
  4059. *)
  4060. # Figure out destination file name, if it wasn't already specified.
  4061. if test -n "$destname"; then
  4062. destfile=$destdir/$destname
  4063. else
  4064. func_basename "$file"
  4065. destfile=$func_basename_result
  4066. destfile=$destdir/$destfile
  4067. fi
  4068. # If the file is missing, and there is a .exe on the end, strip it
  4069. # because it is most likely a libtool script we actually want to
  4070. # install
  4071. stripped_ext=
  4072. case $file in
  4073. *.exe)
  4074. if test ! -f "$file"; then
  4075. func_stripname '' '.exe' "$file"
  4076. file=$func_stripname_result
  4077. stripped_ext=.exe
  4078. fi
  4079. ;;
  4080. esac
  4081. # Do a test to see if this is really a libtool program.
  4082. case $host in
  4083. *cygwin* | *mingw*)
  4084. if func_ltwrapper_executable_p "$file"; then
  4085. func_ltwrapper_scriptname "$file"
  4086. wrapper=$func_ltwrapper_scriptname_result
  4087. else
  4088. func_stripname '' '.exe' "$file"
  4089. wrapper=$func_stripname_result
  4090. fi
  4091. ;;
  4092. *)
  4093. wrapper=$file
  4094. ;;
  4095. esac
  4096. if func_ltwrapper_script_p "$wrapper"; then
  4097. notinst_deplibs=
  4098. relink_command=
  4099. func_source "$wrapper"
  4100. # Check the variables that should have been set.
  4101. test -z "$generated_by_libtool_version" && \
  4102. func_fatal_error "invalid libtool wrapper script '$wrapper'"
  4103. finalize=:
  4104. for lib in $notinst_deplibs; do
  4105. # Check to see that each library is installed.
  4106. libdir=
  4107. if test -f "$lib"; then
  4108. func_source "$lib"
  4109. fi
  4110. libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
  4111. if test -n "$libdir" && test ! -f "$libfile"; then
  4112. func_warning "'$lib' has not been installed in '$libdir'"
  4113. finalize=false
  4114. fi
  4115. done
  4116. relink_command=
  4117. func_source "$wrapper"
  4118. outputname=
  4119. if test no = "$fast_install" && test -n "$relink_command"; then
  4120. $opt_dry_run || {
  4121. if $finalize; then
  4122. tmpdir=`func_mktempdir`
  4123. func_basename "$file$stripped_ext"
  4124. file=$func_basename_result
  4125. outputname=$tmpdir/$file
  4126. # Replace the output file specification.
  4127. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  4128. $opt_quiet || {
  4129. func_quote_for_expand "$relink_command"
  4130. eval "func_echo $func_quote_for_expand_result"
  4131. }
  4132. if eval "$relink_command"; then :
  4133. else
  4134. func_error "error: relink '$file' with the above command before installing it"
  4135. $opt_dry_run || ${RM}r "$tmpdir"
  4136. continue
  4137. fi
  4138. file=$outputname
  4139. else
  4140. func_warning "cannot relink '$file'"
  4141. fi
  4142. }
  4143. else
  4144. # Install the binary that we compiled earlier.
  4145. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  4146. fi
  4147. fi
  4148. # remove .exe since cygwin /usr/bin/install will append another
  4149. # one anyway
  4150. case $install_prog,$host in
  4151. */usr/bin/install*,*cygwin*)
  4152. case $file:$destfile in
  4153. *.exe:*.exe)
  4154. # this is ok
  4155. ;;
  4156. *.exe:*)
  4157. destfile=$destfile.exe
  4158. ;;
  4159. *:*.exe)
  4160. func_stripname '' '.exe' "$destfile"
  4161. destfile=$func_stripname_result
  4162. ;;
  4163. esac
  4164. ;;
  4165. esac
  4166. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  4167. $opt_dry_run || if test -n "$outputname"; then
  4168. ${RM}r "$tmpdir"
  4169. fi
  4170. ;;
  4171. esac
  4172. done
  4173. for file in $staticlibs; do
  4174. func_basename "$file"
  4175. name=$func_basename_result
  4176. # Set up the ranlib parameters.
  4177. oldlib=$destdir/$name
  4178. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  4179. tool_oldlib=$func_to_tool_file_result
  4180. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  4181. if test -n "$stripme" && test -n "$old_striplib"; then
  4182. func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  4183. fi
  4184. # Do each command in the postinstall commands.
  4185. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  4186. done
  4187. test -n "$future_libdirs" && \
  4188. func_warning "remember to run '$progname --finish$future_libdirs'"
  4189. if test -n "$current_libdirs"; then
  4190. # Maybe just do a dry run.
  4191. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  4192. exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
  4193. else
  4194. exit $EXIT_SUCCESS
  4195. fi
  4196. }
  4197. test install = "$opt_mode" && func_mode_install ${1+"$@"}
  4198. # func_generate_dlsyms outputname originator pic_p
  4199. # Extract symbols from dlprefiles and create ${outputname}S.o with
  4200. # a dlpreopen symbol table.
  4201. func_generate_dlsyms ()
  4202. {
  4203. $debug_cmd
  4204. my_outputname=$1
  4205. my_originator=$2
  4206. my_pic_p=${3-false}
  4207. my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
  4208. my_dlsyms=
  4209. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  4210. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4211. my_dlsyms=${my_outputname}S.c
  4212. else
  4213. func_error "not configured to extract global symbols from dlpreopened files"
  4214. fi
  4215. fi
  4216. if test -n "$my_dlsyms"; then
  4217. case $my_dlsyms in
  4218. "") ;;
  4219. *.c)
  4220. # Discover the nlist of each of the dlfiles.
  4221. nlist=$output_objdir/$my_outputname.nm
  4222. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  4223. # Parse the name list into a source file.
  4224. func_verbose "creating $output_objdir/$my_dlsyms"
  4225. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  4226. /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
  4227. /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
  4228. #ifdef __cplusplus
  4229. extern \"C\" {
  4230. #endif
  4231. #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  4232. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  4233. #endif
  4234. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
  4235. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  4236. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  4237. relocations are performed -- see ld's documentation on pseudo-relocs. */
  4238. # define LT_DLSYM_CONST
  4239. #elif defined __osf__
  4240. /* This system does not cope well with relocations in const data. */
  4241. # define LT_DLSYM_CONST
  4242. #else
  4243. # define LT_DLSYM_CONST const
  4244. #endif
  4245. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  4246. /* External symbol declarations for the compiler. */\
  4247. "
  4248. if test yes = "$dlself"; then
  4249. func_verbose "generating symbol list for '$output'"
  4250. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  4251. # Add our own program objects to the symbol list.
  4252. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  4253. for progfile in $progfiles; do
  4254. func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  4255. func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
  4256. $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  4257. done
  4258. if test -n "$exclude_expsyms"; then
  4259. $opt_dry_run || {
  4260. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4261. eval '$MV "$nlist"T "$nlist"'
  4262. }
  4263. fi
  4264. if test -n "$export_symbols_regex"; then
  4265. $opt_dry_run || {
  4266. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4267. eval '$MV "$nlist"T "$nlist"'
  4268. }
  4269. fi
  4270. # Prepare the list of exported symbols
  4271. if test -z "$export_symbols"; then
  4272. export_symbols=$output_objdir/$outputname.exp
  4273. $opt_dry_run || {
  4274. $RM $export_symbols
  4275. eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4276. case $host in
  4277. *cygwin* | *mingw* | *cegcc* )
  4278. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4279. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4280. ;;
  4281. esac
  4282. }
  4283. else
  4284. $opt_dry_run || {
  4285. eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4286. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4287. eval '$MV "$nlist"T "$nlist"'
  4288. case $host in
  4289. *cygwin* | *mingw* | *cegcc* )
  4290. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4291. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4292. ;;
  4293. esac
  4294. }
  4295. fi
  4296. fi
  4297. for dlprefile in $dlprefiles; do
  4298. func_verbose "extracting global C symbols from '$dlprefile'"
  4299. func_basename "$dlprefile"
  4300. name=$func_basename_result
  4301. case $host in
  4302. *cygwin* | *mingw* | *cegcc* )
  4303. # if an import library, we need to obtain dlname
  4304. if func_win32_import_lib_p "$dlprefile"; then
  4305. func_tr_sh "$dlprefile"
  4306. eval "curr_lafile=\$libfile_$func_tr_sh_result"
  4307. dlprefile_dlbasename=
  4308. if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  4309. # Use subshell, to avoid clobbering current variable values
  4310. dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  4311. if test -n "$dlprefile_dlname"; then
  4312. func_basename "$dlprefile_dlname"
  4313. dlprefile_dlbasename=$func_basename_result
  4314. else
  4315. # no lafile. user explicitly requested -dlpreopen <import library>.
  4316. $sharedlib_from_linklib_cmd "$dlprefile"
  4317. dlprefile_dlbasename=$sharedlib_from_linklib_result
  4318. fi
  4319. fi
  4320. $opt_dry_run || {
  4321. if test -n "$dlprefile_dlbasename"; then
  4322. eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  4323. else
  4324. func_warning "Could not compute DLL name from $name"
  4325. eval '$ECHO ": $name " >> "$nlist"'
  4326. fi
  4327. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4328. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4329. $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  4330. }
  4331. else # not an import lib
  4332. $opt_dry_run || {
  4333. eval '$ECHO ": $name " >> "$nlist"'
  4334. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4335. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4336. }
  4337. fi
  4338. ;;
  4339. *)
  4340. $opt_dry_run || {
  4341. eval '$ECHO ": $name " >> "$nlist"'
  4342. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4343. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4344. }
  4345. ;;
  4346. esac
  4347. done
  4348. $opt_dry_run || {
  4349. # Make sure we have at least an empty file.
  4350. test -f "$nlist" || : > "$nlist"
  4351. if test -n "$exclude_expsyms"; then
  4352. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4353. $MV "$nlist"T "$nlist"
  4354. fi
  4355. # Try sorting and uniquifying the output.
  4356. if $GREP -v "^: " < "$nlist" |
  4357. if sort -k 3 </dev/null >/dev/null 2>&1; then
  4358. sort -k 3
  4359. else
  4360. sort +2
  4361. fi |
  4362. uniq > "$nlist"S; then
  4363. :
  4364. else
  4365. $GREP -v "^: " < "$nlist" > "$nlist"S
  4366. fi
  4367. if test -f "$nlist"S; then
  4368. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  4369. else
  4370. echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  4371. fi
  4372. func_show_eval '$RM "${nlist}I"'
  4373. if test -n "$global_symbol_to_import"; then
  4374. eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
  4375. fi
  4376. echo >> "$output_objdir/$my_dlsyms" "\
  4377. /* The mapping between symbol names and symbols. */
  4378. typedef struct {
  4379. const char *name;
  4380. void *address;
  4381. } lt_dlsymlist;
  4382. extern LT_DLSYM_CONST lt_dlsymlist
  4383. lt_${my_prefix}_LTX_preloaded_symbols[];\
  4384. "
  4385. if test -s "$nlist"I; then
  4386. echo >> "$output_objdir/$my_dlsyms" "\
  4387. static void lt_syminit(void)
  4388. {
  4389. LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
  4390. for (; symbol->name; ++symbol)
  4391. {"
  4392. $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
  4393. echo >> "$output_objdir/$my_dlsyms" "\
  4394. }
  4395. }"
  4396. fi
  4397. echo >> "$output_objdir/$my_dlsyms" "\
  4398. LT_DLSYM_CONST lt_dlsymlist
  4399. lt_${my_prefix}_LTX_preloaded_symbols[] =
  4400. { {\"$my_originator\", (void *) 0},"
  4401. if test -s "$nlist"I; then
  4402. echo >> "$output_objdir/$my_dlsyms" "\
  4403. {\"@INIT@\", (void *) &lt_syminit},"
  4404. fi
  4405. case $need_lib_prefix in
  4406. no)
  4407. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4408. ;;
  4409. *)
  4410. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4411. ;;
  4412. esac
  4413. echo >> "$output_objdir/$my_dlsyms" "\
  4414. {0, (void *) 0}
  4415. };
  4416. /* This works around a problem in FreeBSD linker */
  4417. #ifdef FREEBSD_WORKAROUND
  4418. static const void *lt_preloaded_setup() {
  4419. return lt_${my_prefix}_LTX_preloaded_symbols;
  4420. }
  4421. #endif
  4422. #ifdef __cplusplus
  4423. }
  4424. #endif\
  4425. "
  4426. } # !$opt_dry_run
  4427. pic_flag_for_symtable=
  4428. case "$compile_command " in
  4429. *" -static "*) ;;
  4430. *)
  4431. case $host in
  4432. # compiling the symbol table file with pic_flag works around
  4433. # a FreeBSD bug that causes programs to crash when -lm is
  4434. # linked before any other PIC object. But we must not use
  4435. # pic_flag when linking with -static. The problem exists in
  4436. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4437. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4438. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  4439. *-*-hpux*)
  4440. pic_flag_for_symtable=" $pic_flag" ;;
  4441. *)
  4442. $my_pic_p && pic_flag_for_symtable=" $pic_flag"
  4443. ;;
  4444. esac
  4445. ;;
  4446. esac
  4447. symtab_cflags=
  4448. for arg in $LTCFLAGS; do
  4449. case $arg in
  4450. -pie | -fpie | -fPIE) ;;
  4451. *) func_append symtab_cflags " $arg" ;;
  4452. esac
  4453. done
  4454. # Now compile the dynamic symbol file.
  4455. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  4456. # Clean up the generated files.
  4457. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
  4458. # Transform the symbol file into the correct name.
  4459. symfileobj=$output_objdir/${my_outputname}S.$objext
  4460. case $host in
  4461. *cygwin* | *mingw* | *cegcc* )
  4462. if test -f "$output_objdir/$my_outputname.def"; then
  4463. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4464. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4465. else
  4466. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4467. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4468. fi
  4469. ;;
  4470. *)
  4471. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4472. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4473. ;;
  4474. esac
  4475. ;;
  4476. *)
  4477. func_fatal_error "unknown suffix for '$my_dlsyms'"
  4478. ;;
  4479. esac
  4480. else
  4481. # We keep going just in case the user didn't refer to
  4482. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4483. # really was required.
  4484. # Nullify the symbol file.
  4485. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  4486. finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  4487. fi
  4488. }
  4489. # func_cygming_gnu_implib_p ARG
  4490. # This predicate returns with zero status (TRUE) if
  4491. # ARG is a GNU/binutils-style import library. Returns
  4492. # with nonzero status (FALSE) otherwise.
  4493. func_cygming_gnu_implib_p ()
  4494. {
  4495. $debug_cmd
  4496. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4497. func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
  4498. test -n "$func_cygming_gnu_implib_tmp"
  4499. }
  4500. # func_cygming_ms_implib_p ARG
  4501. # This predicate returns with zero status (TRUE) if
  4502. # ARG is an MS-style import library. Returns
  4503. # with nonzero status (FALSE) otherwise.
  4504. func_cygming_ms_implib_p ()
  4505. {
  4506. $debug_cmd
  4507. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4508. func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4509. test -n "$func_cygming_ms_implib_tmp"
  4510. }
  4511. # func_win32_libid arg
  4512. # return the library type of file 'arg'
  4513. #
  4514. # Need a lot of goo to handle *both* DLLs and import libs
  4515. # Has to be a shell function in order to 'eat' the argument
  4516. # that is supplied when $file_magic_command is called.
  4517. # Despite the name, also deal with 64 bit binaries.
  4518. func_win32_libid ()
  4519. {
  4520. $debug_cmd
  4521. win32_libid_type=unknown
  4522. win32_fileres=`file -L $1 2>/dev/null`
  4523. case $win32_fileres in
  4524. *ar\ archive\ import\ library*) # definitely import
  4525. win32_libid_type="x86 archive import"
  4526. ;;
  4527. *ar\ archive*) # could be an import, or static
  4528. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  4529. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  4530. $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  4531. case $nm_interface in
  4532. "MS dumpbin")
  4533. if func_cygming_ms_implib_p "$1" ||
  4534. func_cygming_gnu_implib_p "$1"
  4535. then
  4536. win32_nmres=import
  4537. else
  4538. win32_nmres=
  4539. fi
  4540. ;;
  4541. *)
  4542. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4543. win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  4544. $SED -n -e '
  4545. 1,100{
  4546. / I /{
  4547. s|.*|import|
  4548. p
  4549. q
  4550. }
  4551. }'`
  4552. ;;
  4553. esac
  4554. case $win32_nmres in
  4555. import*) win32_libid_type="x86 archive import";;
  4556. *) win32_libid_type="x86 archive static";;
  4557. esac
  4558. fi
  4559. ;;
  4560. *DLL*)
  4561. win32_libid_type="x86 DLL"
  4562. ;;
  4563. *executable*) # but shell scripts are "executable" too...
  4564. case $win32_fileres in
  4565. *MS\ Windows\ PE\ Intel*)
  4566. win32_libid_type="x86 DLL"
  4567. ;;
  4568. esac
  4569. ;;
  4570. esac
  4571. $ECHO "$win32_libid_type"
  4572. }
  4573. # func_cygming_dll_for_implib ARG
  4574. #
  4575. # Platform-specific function to extract the
  4576. # name of the DLL associated with the specified
  4577. # import library ARG.
  4578. # Invoked by eval'ing the libtool variable
  4579. # $sharedlib_from_linklib_cmd
  4580. # Result is available in the variable
  4581. # $sharedlib_from_linklib_result
  4582. func_cygming_dll_for_implib ()
  4583. {
  4584. $debug_cmd
  4585. sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4586. }
  4587. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4588. #
  4589. # The is the core of a fallback implementation of a
  4590. # platform-specific function to extract the name of the
  4591. # DLL associated with the specified import library LIBNAME.
  4592. #
  4593. # SECTION_NAME is either .idata$6 or .idata$7, depending
  4594. # on the platform and compiler that created the implib.
  4595. #
  4596. # Echos the name of the DLL associated with the
  4597. # specified import library.
  4598. func_cygming_dll_for_implib_fallback_core ()
  4599. {
  4600. $debug_cmd
  4601. match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  4602. $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  4603. $SED '/^Contents of section '"$match_literal"':/{
  4604. # Place marker at beginning of archive member dllname section
  4605. s/.*/====MARK====/
  4606. p
  4607. d
  4608. }
  4609. # These lines can sometimes be longer than 43 characters, but
  4610. # are always uninteresting
  4611. /:[ ]*file format pe[i]\{,1\}-/d
  4612. /^In archive [^:]*:/d
  4613. # Ensure marker is printed
  4614. /^====MARK====/p
  4615. # Remove all lines with less than 43 characters
  4616. /^.\{43\}/!d
  4617. # From remaining lines, remove first 43 characters
  4618. s/^.\{43\}//' |
  4619. $SED -n '
  4620. # Join marker and all lines until next marker into a single line
  4621. /^====MARK====/ b para
  4622. H
  4623. $ b para
  4624. b
  4625. :para
  4626. x
  4627. s/\n//g
  4628. # Remove the marker
  4629. s/^====MARK====//
  4630. # Remove trailing dots and whitespace
  4631. s/[\. \t]*$//
  4632. # Print
  4633. /./p' |
  4634. # we now have a list, one entry per line, of the stringified
  4635. # contents of the appropriate section of all members of the
  4636. # archive that possess that section. Heuristic: eliminate
  4637. # all those that have a first or second character that is
  4638. # a '.' (that is, objdump's representation of an unprintable
  4639. # character.) This should work for all archives with less than
  4640. # 0x302f exports -- but will fail for DLLs whose name actually
  4641. # begins with a literal '.' or a single character followed by
  4642. # a '.'.
  4643. #
  4644. # Of those that remain, print the first one.
  4645. $SED -e '/^\./d;/^.\./d;q'
  4646. }
  4647. # func_cygming_dll_for_implib_fallback ARG
  4648. # Platform-specific function to extract the
  4649. # name of the DLL associated with the specified
  4650. # import library ARG.
  4651. #
  4652. # This fallback implementation is for use when $DLLTOOL
  4653. # does not support the --identify-strict option.
  4654. # Invoked by eval'ing the libtool variable
  4655. # $sharedlib_from_linklib_cmd
  4656. # Result is available in the variable
  4657. # $sharedlib_from_linklib_result
  4658. func_cygming_dll_for_implib_fallback ()
  4659. {
  4660. $debug_cmd
  4661. if func_cygming_gnu_implib_p "$1"; then
  4662. # binutils import library
  4663. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  4664. elif func_cygming_ms_implib_p "$1"; then
  4665. # ms-generated import library
  4666. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  4667. else
  4668. # unknown
  4669. sharedlib_from_linklib_result=
  4670. fi
  4671. }
  4672. # func_extract_an_archive dir oldlib
  4673. func_extract_an_archive ()
  4674. {
  4675. $debug_cmd
  4676. f_ex_an_ar_dir=$1; shift
  4677. f_ex_an_ar_oldlib=$1
  4678. if test yes = "$lock_old_archive_extraction"; then
  4679. lockfile=$f_ex_an_ar_oldlib.lock
  4680. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  4681. func_echo "Waiting for $lockfile to be removed"
  4682. sleep 2
  4683. done
  4684. fi
  4685. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  4686. 'stat=$?; rm -f "$lockfile"; exit $stat'
  4687. if test yes = "$lock_old_archive_extraction"; then
  4688. $opt_dry_run || rm -f "$lockfile"
  4689. fi
  4690. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  4691. :
  4692. else
  4693. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  4694. fi
  4695. }
  4696. # func_extract_archives gentop oldlib ...
  4697. func_extract_archives ()
  4698. {
  4699. $debug_cmd
  4700. my_gentop=$1; shift
  4701. my_oldlibs=${1+"$@"}
  4702. my_oldobjs=
  4703. my_xlib=
  4704. my_xabs=
  4705. my_xdir=
  4706. for my_xlib in $my_oldlibs; do
  4707. # Extract the objects.
  4708. case $my_xlib in
  4709. [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
  4710. *) my_xabs=`pwd`"/$my_xlib" ;;
  4711. esac
  4712. func_basename "$my_xlib"
  4713. my_xlib=$func_basename_result
  4714. my_xlib_u=$my_xlib
  4715. while :; do
  4716. case " $extracted_archives " in
  4717. *" $my_xlib_u "*)
  4718. func_arith $extracted_serial + 1
  4719. extracted_serial=$func_arith_result
  4720. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  4721. *) break ;;
  4722. esac
  4723. done
  4724. extracted_archives="$extracted_archives $my_xlib_u"
  4725. my_xdir=$my_gentop/$my_xlib_u
  4726. func_mkdir_p "$my_xdir"
  4727. case $host in
  4728. *-darwin*)
  4729. func_verbose "Extracting $my_xabs"
  4730. # Do not bother doing anything if just a dry run
  4731. $opt_dry_run || {
  4732. darwin_orig_dir=`pwd`
  4733. cd $my_xdir || exit $?
  4734. darwin_archive=$my_xabs
  4735. darwin_curdir=`pwd`
  4736. func_basename "$darwin_archive"
  4737. darwin_base_archive=$func_basename_result
  4738. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  4739. if test -n "$darwin_arches"; then
  4740. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  4741. darwin_arch=
  4742. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  4743. for darwin_arch in $darwin_arches; do
  4744. func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
  4745. $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
  4746. cd "unfat-$$/$darwin_base_archive-$darwin_arch"
  4747. func_extract_an_archive "`pwd`" "$darwin_base_archive"
  4748. cd "$darwin_curdir"
  4749. $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
  4750. done # $darwin_arches
  4751. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  4752. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
  4753. darwin_file=
  4754. darwin_files=
  4755. for darwin_file in $darwin_filelist; do
  4756. darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  4757. $LIPO -create -output "$darwin_file" $darwin_files
  4758. done # $darwin_filelist
  4759. $RM -rf unfat-$$
  4760. cd "$darwin_orig_dir"
  4761. else
  4762. cd $darwin_orig_dir
  4763. func_extract_an_archive "$my_xdir" "$my_xabs"
  4764. fi # $darwin_arches
  4765. } # !$opt_dry_run
  4766. ;;
  4767. *)
  4768. func_extract_an_archive "$my_xdir" "$my_xabs"
  4769. ;;
  4770. esac
  4771. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  4772. done
  4773. func_extract_archives_result=$my_oldobjs
  4774. }
  4775. # func_emit_wrapper [arg=no]
  4776. #
  4777. # Emit a libtool wrapper script on stdout.
  4778. # Don't directly open a file because we may want to
  4779. # incorporate the script contents within a cygwin/mingw
  4780. # wrapper executable. Must ONLY be called from within
  4781. # func_mode_link because it depends on a number of variables
  4782. # set therein.
  4783. #
  4784. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  4785. # variable will take. If 'yes', then the emitted script
  4786. # will assume that the directory where it is stored is
  4787. # the $objdir directory. This is a cygwin/mingw-specific
  4788. # behavior.
  4789. func_emit_wrapper ()
  4790. {
  4791. func_emit_wrapper_arg1=${1-no}
  4792. $ECHO "\
  4793. #! $SHELL
  4794. # $output - temporary wrapper script for $objdir/$outputname
  4795. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  4796. #
  4797. # The $output program cannot be directly executed until all the libtool
  4798. # libraries that it depends on are installed.
  4799. #
  4800. # This wrapper script should never be moved out of the build directory.
  4801. # If it is, it will not operate correctly.
  4802. # Sed substitution that helps us do robust quoting. It backslashifies
  4803. # metacharacters that are still active within double-quoted strings.
  4804. sed_quote_subst='$sed_quote_subst'
  4805. # Be Bourne compatible
  4806. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  4807. emulate sh
  4808. NULLCMD=:
  4809. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  4810. # is contrary to our usage. Disable this feature.
  4811. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  4812. setopt NO_GLOB_SUBST
  4813. else
  4814. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  4815. fi
  4816. BIN_SH=xpg4; export BIN_SH # for Tru64
  4817. DUALCASE=1; export DUALCASE # for MKS sh
  4818. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4819. # if CDPATH is set.
  4820. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4821. relink_command=\"$relink_command\"
  4822. # This environment variable determines our operation mode.
  4823. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4824. # install mode needs the following variables:
  4825. generated_by_libtool_version='$macro_version'
  4826. notinst_deplibs='$notinst_deplibs'
  4827. else
  4828. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  4829. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4830. file=\"\$0\""
  4831. qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
  4832. $ECHO "\
  4833. # A function that is used when there is no print builtin or printf.
  4834. func_fallback_echo ()
  4835. {
  4836. eval 'cat <<_LTECHO_EOF
  4837. \$1
  4838. _LTECHO_EOF'
  4839. }
  4840. ECHO=\"$qECHO\"
  4841. fi
  4842. # Very basic option parsing. These options are (a) specific to
  4843. # the libtool wrapper, (b) are identical between the wrapper
  4844. # /script/ and the wrapper /executable/ that is used only on
  4845. # windows platforms, and (c) all begin with the string "--lt-"
  4846. # (application programs are unlikely to have options that match
  4847. # this pattern).
  4848. #
  4849. # There are only two supported options: --lt-debug and
  4850. # --lt-dump-script. There is, deliberately, no --lt-help.
  4851. #
  4852. # The first argument to this parsing function should be the
  4853. # script's $0 value, followed by "$@".
  4854. lt_option_debug=
  4855. func_parse_lt_options ()
  4856. {
  4857. lt_script_arg0=\$0
  4858. shift
  4859. for lt_opt
  4860. do
  4861. case \"\$lt_opt\" in
  4862. --lt-debug) lt_option_debug=1 ;;
  4863. --lt-dump-script)
  4864. lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  4865. test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  4866. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  4867. cat \"\$lt_dump_D/\$lt_dump_F\"
  4868. exit 0
  4869. ;;
  4870. --lt-*)
  4871. \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  4872. exit 1
  4873. ;;
  4874. esac
  4875. done
  4876. # Print the debug banner immediately:
  4877. if test -n \"\$lt_option_debug\"; then
  4878. echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
  4879. fi
  4880. }
  4881. # Used when --lt-debug. Prints its arguments to stdout
  4882. # (redirection is the responsibility of the caller)
  4883. func_lt_dump_args ()
  4884. {
  4885. lt_dump_args_N=1;
  4886. for lt_arg
  4887. do
  4888. \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
  4889. lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  4890. done
  4891. }
  4892. # Core function for launching the target application
  4893. func_exec_program_core ()
  4894. {
  4895. "
  4896. case $host in
  4897. # Backslashes separate directories on plain windows
  4898. *-*-mingw | *-*-os2* | *-cegcc*)
  4899. $ECHO "\
  4900. if test -n \"\$lt_option_debug\"; then
  4901. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
  4902. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4903. fi
  4904. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  4905. "
  4906. ;;
  4907. *)
  4908. $ECHO "\
  4909. if test -n \"\$lt_option_debug\"; then
  4910. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
  4911. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4912. fi
  4913. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  4914. "
  4915. ;;
  4916. esac
  4917. $ECHO "\
  4918. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  4919. exit 1
  4920. }
  4921. # A function to encapsulate launching the target application
  4922. # Strips options in the --lt-* namespace from \$@ and
  4923. # launches target application with the remaining arguments.
  4924. func_exec_program ()
  4925. {
  4926. case \" \$* \" in
  4927. *\\ --lt-*)
  4928. for lt_wr_arg
  4929. do
  4930. case \$lt_wr_arg in
  4931. --lt-*) ;;
  4932. *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  4933. esac
  4934. shift
  4935. done ;;
  4936. esac
  4937. func_exec_program_core \${1+\"\$@\"}
  4938. }
  4939. # Parse options
  4940. func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  4941. # Find the directory that this script lives in.
  4942. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  4943. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4944. # Follow symbolic links until we get to the real thisdir.
  4945. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  4946. while test -n \"\$file\"; do
  4947. destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  4948. # If there was a directory component, then change thisdir.
  4949. if test \"x\$destdir\" != \"x\$file\"; then
  4950. case \"\$destdir\" in
  4951. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4952. *) thisdir=\"\$thisdir/\$destdir\" ;;
  4953. esac
  4954. fi
  4955. file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  4956. file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  4957. done
  4958. # Usually 'no', except on cygwin/mingw when embedded into
  4959. # the cwrapper.
  4960. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  4961. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  4962. # special case for '.'
  4963. if test \"\$thisdir\" = \".\"; then
  4964. thisdir=\`pwd\`
  4965. fi
  4966. # remove .libs from thisdir
  4967. case \"\$thisdir\" in
  4968. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  4969. $objdir ) thisdir=. ;;
  4970. esac
  4971. fi
  4972. # Try to get the absolute directory name.
  4973. absdir=\`cd \"\$thisdir\" && pwd\`
  4974. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4975. "
  4976. if test yes = "$fast_install"; then
  4977. $ECHO "\
  4978. program=lt-'$outputname'$exeext
  4979. progdir=\"\$thisdir/$objdir\"
  4980. if test ! -f \"\$progdir/\$program\" ||
  4981. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
  4982. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  4983. file=\"\$\$-\$program\"
  4984. if test ! -d \"\$progdir\"; then
  4985. $MKDIR \"\$progdir\"
  4986. else
  4987. $RM \"\$progdir/\$file\"
  4988. fi"
  4989. $ECHO "\
  4990. # relink executable if necessary
  4991. if test -n \"\$relink_command\"; then
  4992. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  4993. else
  4994. \$ECHO \"\$relink_command_output\" >&2
  4995. $RM \"\$progdir/\$file\"
  4996. exit 1
  4997. fi
  4998. fi
  4999. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  5000. { $RM \"\$progdir/\$program\";
  5001. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  5002. $RM \"\$progdir/\$file\"
  5003. fi"
  5004. else
  5005. $ECHO "\
  5006. program='$outputname'
  5007. progdir=\"\$thisdir/$objdir\"
  5008. "
  5009. fi
  5010. $ECHO "\
  5011. if test -f \"\$progdir/\$program\"; then"
  5012. # fixup the dll searchpath if we need to.
  5013. #
  5014. # Fix the DLL searchpath if we need to. Do this before prepending
  5015. # to shlibpath, because on Windows, both are PATH and uninstalled
  5016. # libraries must come first.
  5017. if test -n "$dllsearchpath"; then
  5018. $ECHO "\
  5019. # Add the dll search path components to the executable PATH
  5020. PATH=$dllsearchpath:\$PATH
  5021. "
  5022. fi
  5023. # Export our shlibpath_var if we have one.
  5024. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5025. $ECHO "\
  5026. # Add our own library path to $shlibpath_var
  5027. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  5028. # Some systems cannot cope with colon-terminated $shlibpath_var
  5029. # The second colon is a workaround for a bug in BeOS R4 sed
  5030. $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  5031. export $shlibpath_var
  5032. "
  5033. fi
  5034. $ECHO "\
  5035. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5036. # Run the actual program with our arguments.
  5037. func_exec_program \${1+\"\$@\"}
  5038. fi
  5039. else
  5040. # The program doesn't exist.
  5041. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
  5042. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  5043. \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  5044. exit 1
  5045. fi
  5046. fi\
  5047. "
  5048. }
  5049. # func_emit_cwrapperexe_src
  5050. # emit the source code for a wrapper executable on stdout
  5051. # Must ONLY be called from within func_mode_link because
  5052. # it depends on a number of variable set therein.
  5053. func_emit_cwrapperexe_src ()
  5054. {
  5055. cat <<EOF
  5056. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  5057. Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  5058. The $output program cannot be directly executed until all the libtool
  5059. libraries that it depends on are installed.
  5060. This wrapper executable should never be moved out of the build directory.
  5061. If it is, it will not operate correctly.
  5062. */
  5063. EOF
  5064. cat <<"EOF"
  5065. #ifdef _MSC_VER
  5066. # define _CRT_SECURE_NO_DEPRECATE 1
  5067. #endif
  5068. #include <stdio.h>
  5069. #include <stdlib.h>
  5070. #ifdef _MSC_VER
  5071. # include <direct.h>
  5072. # include <process.h>
  5073. # include <io.h>
  5074. #else
  5075. # include <unistd.h>
  5076. # include <stdint.h>
  5077. # ifdef __CYGWIN__
  5078. # include <io.h>
  5079. # endif
  5080. #endif
  5081. #include <malloc.h>
  5082. #include <stdarg.h>
  5083. #include <assert.h>
  5084. #include <string.h>
  5085. #include <ctype.h>
  5086. #include <errno.h>
  5087. #include <fcntl.h>
  5088. #include <sys/stat.h>
  5089. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  5090. /* declarations of non-ANSI functions */
  5091. #if defined __MINGW32__
  5092. # ifdef __STRICT_ANSI__
  5093. int _putenv (const char *);
  5094. # endif
  5095. #elif defined __CYGWIN__
  5096. # ifdef __STRICT_ANSI__
  5097. char *realpath (const char *, char *);
  5098. int putenv (char *);
  5099. int setenv (const char *, const char *, int);
  5100. # endif
  5101. /* #elif defined other_platform || defined ... */
  5102. #endif
  5103. /* portability defines, excluding path handling macros */
  5104. #if defined _MSC_VER
  5105. # define setmode _setmode
  5106. # define stat _stat
  5107. # define chmod _chmod
  5108. # define getcwd _getcwd
  5109. # define putenv _putenv
  5110. # define S_IXUSR _S_IEXEC
  5111. #elif defined __MINGW32__
  5112. # define setmode _setmode
  5113. # define stat _stat
  5114. # define chmod _chmod
  5115. # define getcwd _getcwd
  5116. # define putenv _putenv
  5117. #elif defined __CYGWIN__
  5118. # define HAVE_SETENV
  5119. # define FOPEN_WB "wb"
  5120. /* #elif defined other platforms ... */
  5121. #endif
  5122. #if defined PATH_MAX
  5123. # define LT_PATHMAX PATH_MAX
  5124. #elif defined MAXPATHLEN
  5125. # define LT_PATHMAX MAXPATHLEN
  5126. #else
  5127. # define LT_PATHMAX 1024
  5128. #endif
  5129. #ifndef S_IXOTH
  5130. # define S_IXOTH 0
  5131. #endif
  5132. #ifndef S_IXGRP
  5133. # define S_IXGRP 0
  5134. #endif
  5135. /* path handling portability macros */
  5136. #ifndef DIR_SEPARATOR
  5137. # define DIR_SEPARATOR '/'
  5138. # define PATH_SEPARATOR ':'
  5139. #endif
  5140. #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
  5141. defined __OS2__
  5142. # define HAVE_DOS_BASED_FILE_SYSTEM
  5143. # define FOPEN_WB "wb"
  5144. # ifndef DIR_SEPARATOR_2
  5145. # define DIR_SEPARATOR_2 '\\'
  5146. # endif
  5147. # ifndef PATH_SEPARATOR_2
  5148. # define PATH_SEPARATOR_2 ';'
  5149. # endif
  5150. #endif
  5151. #ifndef DIR_SEPARATOR_2
  5152. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  5153. #else /* DIR_SEPARATOR_2 */
  5154. # define IS_DIR_SEPARATOR(ch) \
  5155. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  5156. #endif /* DIR_SEPARATOR_2 */
  5157. #ifndef PATH_SEPARATOR_2
  5158. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  5159. #else /* PATH_SEPARATOR_2 */
  5160. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  5161. #endif /* PATH_SEPARATOR_2 */
  5162. #ifndef FOPEN_WB
  5163. # define FOPEN_WB "w"
  5164. #endif
  5165. #ifndef _O_BINARY
  5166. # define _O_BINARY 0
  5167. #endif
  5168. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  5169. #define XFREE(stale) do { \
  5170. if (stale) { free (stale); stale = 0; } \
  5171. } while (0)
  5172. #if defined LT_DEBUGWRAPPER
  5173. static int lt_debug = 1;
  5174. #else
  5175. static int lt_debug = 0;
  5176. #endif
  5177. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  5178. void *xmalloc (size_t num);
  5179. char *xstrdup (const char *string);
  5180. const char *base_name (const char *name);
  5181. char *find_executable (const char *wrapper);
  5182. char *chase_symlinks (const char *pathspec);
  5183. int make_executable (const char *path);
  5184. int check_executable (const char *path);
  5185. char *strendzap (char *str, const char *pat);
  5186. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  5187. void lt_fatal (const char *file, int line, const char *message, ...);
  5188. static const char *nonnull (const char *s);
  5189. static const char *nonempty (const char *s);
  5190. void lt_setenv (const char *name, const char *value);
  5191. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  5192. void lt_update_exe_path (const char *name, const char *value);
  5193. void lt_update_lib_path (const char *name, const char *value);
  5194. char **prepare_spawn (char **argv);
  5195. void lt_dump_script (FILE *f);
  5196. EOF
  5197. cat <<EOF
  5198. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  5199. # define externally_visible volatile
  5200. #else
  5201. # define externally_visible __attribute__((externally_visible)) volatile
  5202. #endif
  5203. externally_visible const char * MAGIC_EXE = "$magic_exe";
  5204. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  5205. EOF
  5206. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5207. func_to_host_path "$temp_rpath"
  5208. cat <<EOF
  5209. const char * LIB_PATH_VALUE = "$func_to_host_path_result";
  5210. EOF
  5211. else
  5212. cat <<"EOF"
  5213. const char * LIB_PATH_VALUE = "";
  5214. EOF
  5215. fi
  5216. if test -n "$dllsearchpath"; then
  5217. func_to_host_path "$dllsearchpath:"
  5218. cat <<EOF
  5219. const char * EXE_PATH_VARNAME = "PATH";
  5220. const char * EXE_PATH_VALUE = "$func_to_host_path_result";
  5221. EOF
  5222. else
  5223. cat <<"EOF"
  5224. const char * EXE_PATH_VARNAME = "";
  5225. const char * EXE_PATH_VALUE = "";
  5226. EOF
  5227. fi
  5228. if test yes = "$fast_install"; then
  5229. cat <<EOF
  5230. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  5231. EOF
  5232. else
  5233. cat <<EOF
  5234. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  5235. EOF
  5236. fi
  5237. cat <<"EOF"
  5238. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  5239. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  5240. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  5241. static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
  5242. int
  5243. main (int argc, char *argv[])
  5244. {
  5245. char **newargz;
  5246. int newargc;
  5247. char *tmp_pathspec;
  5248. char *actual_cwrapper_path;
  5249. char *actual_cwrapper_name;
  5250. char *target_name;
  5251. char *lt_argv_zero;
  5252. int rval = 127;
  5253. int i;
  5254. program_name = (char *) xstrdup (base_name (argv[0]));
  5255. newargz = XMALLOC (char *, (size_t) argc + 1);
  5256. /* very simple arg parsing; don't want to rely on getopt
  5257. * also, copy all non cwrapper options to newargz, except
  5258. * argz[0], which is handled differently
  5259. */
  5260. newargc=0;
  5261. for (i = 1; i < argc; i++)
  5262. {
  5263. if (STREQ (argv[i], dumpscript_opt))
  5264. {
  5265. EOF
  5266. case $host in
  5267. *mingw* | *cygwin* )
  5268. # make stdout use "unix" line endings
  5269. echo " setmode(1,_O_BINARY);"
  5270. ;;
  5271. esac
  5272. cat <<"EOF"
  5273. lt_dump_script (stdout);
  5274. return 0;
  5275. }
  5276. if (STREQ (argv[i], debug_opt))
  5277. {
  5278. lt_debug = 1;
  5279. continue;
  5280. }
  5281. if (STREQ (argv[i], ltwrapper_option_prefix))
  5282. {
  5283. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  5284. namespace, but it is not one of the ones we know about and
  5285. have already dealt with, above (inluding dump-script), then
  5286. report an error. Otherwise, targets might begin to believe
  5287. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  5288. namespace. The first time any user complains about this, we'll
  5289. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  5290. or a configure.ac-settable value.
  5291. */
  5292. lt_fatal (__FILE__, __LINE__,
  5293. "unrecognized %s option: '%s'",
  5294. ltwrapper_option_prefix, argv[i]);
  5295. }
  5296. /* otherwise ... */
  5297. newargz[++newargc] = xstrdup (argv[i]);
  5298. }
  5299. newargz[++newargc] = NULL;
  5300. EOF
  5301. cat <<EOF
  5302. /* The GNU banner must be the first non-error debug message */
  5303. lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
  5304. EOF
  5305. cat <<"EOF"
  5306. lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  5307. lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  5308. tmp_pathspec = find_executable (argv[0]);
  5309. if (tmp_pathspec == NULL)
  5310. lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  5311. lt_debugprintf (__FILE__, __LINE__,
  5312. "(main) found exe (before symlink chase) at: %s\n",
  5313. tmp_pathspec);
  5314. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  5315. lt_debugprintf (__FILE__, __LINE__,
  5316. "(main) found exe (after symlink chase) at: %s\n",
  5317. actual_cwrapper_path);
  5318. XFREE (tmp_pathspec);
  5319. actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  5320. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  5321. /* wrapper name transforms */
  5322. strendzap (actual_cwrapper_name, ".exe");
  5323. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  5324. XFREE (actual_cwrapper_name);
  5325. actual_cwrapper_name = tmp_pathspec;
  5326. tmp_pathspec = 0;
  5327. /* target_name transforms -- use actual target program name; might have lt- prefix */
  5328. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  5329. strendzap (target_name, ".exe");
  5330. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  5331. XFREE (target_name);
  5332. target_name = tmp_pathspec;
  5333. tmp_pathspec = 0;
  5334. lt_debugprintf (__FILE__, __LINE__,
  5335. "(main) libtool target name: %s\n",
  5336. target_name);
  5337. EOF
  5338. cat <<EOF
  5339. newargz[0] =
  5340. XMALLOC (char, (strlen (actual_cwrapper_path) +
  5341. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  5342. strcpy (newargz[0], actual_cwrapper_path);
  5343. strcat (newargz[0], "$objdir");
  5344. strcat (newargz[0], "/");
  5345. EOF
  5346. cat <<"EOF"
  5347. /* stop here, and copy so we don't have to do this twice */
  5348. tmp_pathspec = xstrdup (newargz[0]);
  5349. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  5350. strcat (newargz[0], actual_cwrapper_name);
  5351. /* DO want the lt- prefix here if it exists, so use target_name */
  5352. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  5353. XFREE (tmp_pathspec);
  5354. tmp_pathspec = NULL;
  5355. EOF
  5356. case $host_os in
  5357. mingw*)
  5358. cat <<"EOF"
  5359. {
  5360. char* p;
  5361. while ((p = strchr (newargz[0], '\\')) != NULL)
  5362. {
  5363. *p = '/';
  5364. }
  5365. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  5366. {
  5367. *p = '/';
  5368. }
  5369. }
  5370. EOF
  5371. ;;
  5372. esac
  5373. cat <<"EOF"
  5374. XFREE (target_name);
  5375. XFREE (actual_cwrapper_path);
  5376. XFREE (actual_cwrapper_name);
  5377. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  5378. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  5379. /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
  5380. be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  5381. because on Windows, both *_VARNAMEs are PATH but uninstalled
  5382. libraries must come first. */
  5383. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  5384. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  5385. lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  5386. nonnull (lt_argv_zero));
  5387. for (i = 0; i < newargc; i++)
  5388. {
  5389. lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  5390. i, nonnull (newargz[i]));
  5391. }
  5392. EOF
  5393. case $host_os in
  5394. mingw*)
  5395. cat <<"EOF"
  5396. /* execv doesn't actually work on mingw as expected on unix */
  5397. newargz = prepare_spawn (newargz);
  5398. rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  5399. if (rval == -1)
  5400. {
  5401. /* failed to start process */
  5402. lt_debugprintf (__FILE__, __LINE__,
  5403. "(main) failed to launch target \"%s\": %s\n",
  5404. lt_argv_zero, nonnull (strerror (errno)));
  5405. return 127;
  5406. }
  5407. return rval;
  5408. EOF
  5409. ;;
  5410. *)
  5411. cat <<"EOF"
  5412. execv (lt_argv_zero, newargz);
  5413. return rval; /* =127, but avoids unused variable warning */
  5414. EOF
  5415. ;;
  5416. esac
  5417. cat <<"EOF"
  5418. }
  5419. void *
  5420. xmalloc (size_t num)
  5421. {
  5422. void *p = (void *) malloc (num);
  5423. if (!p)
  5424. lt_fatal (__FILE__, __LINE__, "memory exhausted");
  5425. return p;
  5426. }
  5427. char *
  5428. xstrdup (const char *string)
  5429. {
  5430. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5431. string) : NULL;
  5432. }
  5433. const char *
  5434. base_name (const char *name)
  5435. {
  5436. const char *base;
  5437. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5438. /* Skip over the disk name in MSDOS pathnames. */
  5439. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5440. name += 2;
  5441. #endif
  5442. for (base = name; *name; name++)
  5443. if (IS_DIR_SEPARATOR (*name))
  5444. base = name + 1;
  5445. return base;
  5446. }
  5447. int
  5448. check_executable (const char *path)
  5449. {
  5450. struct stat st;
  5451. lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5452. nonempty (path));
  5453. if ((!path) || (!*path))
  5454. return 0;
  5455. if ((stat (path, &st) >= 0)
  5456. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5457. return 1;
  5458. else
  5459. return 0;
  5460. }
  5461. int
  5462. make_executable (const char *path)
  5463. {
  5464. int rval = 0;
  5465. struct stat st;
  5466. lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5467. nonempty (path));
  5468. if ((!path) || (!*path))
  5469. return 0;
  5470. if (stat (path, &st) >= 0)
  5471. {
  5472. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5473. }
  5474. return rval;
  5475. }
  5476. /* Searches for the full path of the wrapper. Returns
  5477. newly allocated full path name if found, NULL otherwise
  5478. Does not chase symlinks, even on platforms that support them.
  5479. */
  5480. char *
  5481. find_executable (const char *wrapper)
  5482. {
  5483. int has_slash = 0;
  5484. const char *p;
  5485. const char *p_next;
  5486. /* static buffer for getcwd */
  5487. char tmp[LT_PATHMAX + 1];
  5488. size_t tmp_len;
  5489. char *concat_name;
  5490. lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  5491. nonempty (wrapper));
  5492. if ((wrapper == NULL) || (*wrapper == '\0'))
  5493. return NULL;
  5494. /* Absolute path? */
  5495. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5496. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  5497. {
  5498. concat_name = xstrdup (wrapper);
  5499. if (check_executable (concat_name))
  5500. return concat_name;
  5501. XFREE (concat_name);
  5502. }
  5503. else
  5504. {
  5505. #endif
  5506. if (IS_DIR_SEPARATOR (wrapper[0]))
  5507. {
  5508. concat_name = xstrdup (wrapper);
  5509. if (check_executable (concat_name))
  5510. return concat_name;
  5511. XFREE (concat_name);
  5512. }
  5513. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5514. }
  5515. #endif
  5516. for (p = wrapper; *p; p++)
  5517. if (*p == '/')
  5518. {
  5519. has_slash = 1;
  5520. break;
  5521. }
  5522. if (!has_slash)
  5523. {
  5524. /* no slashes; search PATH */
  5525. const char *path = getenv ("PATH");
  5526. if (path != NULL)
  5527. {
  5528. for (p = path; *p; p = p_next)
  5529. {
  5530. const char *q;
  5531. size_t p_len;
  5532. for (q = p; *q; q++)
  5533. if (IS_PATH_SEPARATOR (*q))
  5534. break;
  5535. p_len = (size_t) (q - p);
  5536. p_next = (*q == '\0' ? q : q + 1);
  5537. if (p_len == 0)
  5538. {
  5539. /* empty path: current directory */
  5540. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5541. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5542. nonnull (strerror (errno)));
  5543. tmp_len = strlen (tmp);
  5544. concat_name =
  5545. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5546. memcpy (concat_name, tmp, tmp_len);
  5547. concat_name[tmp_len] = '/';
  5548. strcpy (concat_name + tmp_len + 1, wrapper);
  5549. }
  5550. else
  5551. {
  5552. concat_name =
  5553. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  5554. memcpy (concat_name, p, p_len);
  5555. concat_name[p_len] = '/';
  5556. strcpy (concat_name + p_len + 1, wrapper);
  5557. }
  5558. if (check_executable (concat_name))
  5559. return concat_name;
  5560. XFREE (concat_name);
  5561. }
  5562. }
  5563. /* not found in PATH; assume curdir */
  5564. }
  5565. /* Relative path | not found in path: prepend cwd */
  5566. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5567. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5568. nonnull (strerror (errno)));
  5569. tmp_len = strlen (tmp);
  5570. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5571. memcpy (concat_name, tmp, tmp_len);
  5572. concat_name[tmp_len] = '/';
  5573. strcpy (concat_name + tmp_len + 1, wrapper);
  5574. if (check_executable (concat_name))
  5575. return concat_name;
  5576. XFREE (concat_name);
  5577. return NULL;
  5578. }
  5579. char *
  5580. chase_symlinks (const char *pathspec)
  5581. {
  5582. #ifndef S_ISLNK
  5583. return xstrdup (pathspec);
  5584. #else
  5585. char buf[LT_PATHMAX];
  5586. struct stat s;
  5587. char *tmp_pathspec = xstrdup (pathspec);
  5588. char *p;
  5589. int has_symlinks = 0;
  5590. while (strlen (tmp_pathspec) && !has_symlinks)
  5591. {
  5592. lt_debugprintf (__FILE__, __LINE__,
  5593. "checking path component for symlinks: %s\n",
  5594. tmp_pathspec);
  5595. if (lstat (tmp_pathspec, &s) == 0)
  5596. {
  5597. if (S_ISLNK (s.st_mode) != 0)
  5598. {
  5599. has_symlinks = 1;
  5600. break;
  5601. }
  5602. /* search backwards for last DIR_SEPARATOR */
  5603. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  5604. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5605. p--;
  5606. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5607. {
  5608. /* no more DIR_SEPARATORS left */
  5609. break;
  5610. }
  5611. *p = '\0';
  5612. }
  5613. else
  5614. {
  5615. lt_fatal (__FILE__, __LINE__,
  5616. "error accessing file \"%s\": %s",
  5617. tmp_pathspec, nonnull (strerror (errno)));
  5618. }
  5619. }
  5620. XFREE (tmp_pathspec);
  5621. if (!has_symlinks)
  5622. {
  5623. return xstrdup (pathspec);
  5624. }
  5625. tmp_pathspec = realpath (pathspec, buf);
  5626. if (tmp_pathspec == 0)
  5627. {
  5628. lt_fatal (__FILE__, __LINE__,
  5629. "could not follow symlinks for %s", pathspec);
  5630. }
  5631. return xstrdup (tmp_pathspec);
  5632. #endif
  5633. }
  5634. char *
  5635. strendzap (char *str, const char *pat)
  5636. {
  5637. size_t len, patlen;
  5638. assert (str != NULL);
  5639. assert (pat != NULL);
  5640. len = strlen (str);
  5641. patlen = strlen (pat);
  5642. if (patlen <= len)
  5643. {
  5644. str += len - patlen;
  5645. if (STREQ (str, pat))
  5646. *str = '\0';
  5647. }
  5648. return str;
  5649. }
  5650. void
  5651. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  5652. {
  5653. va_list args;
  5654. if (lt_debug)
  5655. {
  5656. (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  5657. va_start (args, fmt);
  5658. (void) vfprintf (stderr, fmt, args);
  5659. va_end (args);
  5660. }
  5661. }
  5662. static void
  5663. lt_error_core (int exit_status, const char *file,
  5664. int line, const char *mode,
  5665. const char *message, va_list ap)
  5666. {
  5667. fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  5668. vfprintf (stderr, message, ap);
  5669. fprintf (stderr, ".\n");
  5670. if (exit_status >= 0)
  5671. exit (exit_status);
  5672. }
  5673. void
  5674. lt_fatal (const char *file, int line, const char *message, ...)
  5675. {
  5676. va_list ap;
  5677. va_start (ap, message);
  5678. lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  5679. va_end (ap);
  5680. }
  5681. static const char *
  5682. nonnull (const char *s)
  5683. {
  5684. return s ? s : "(null)";
  5685. }
  5686. static const char *
  5687. nonempty (const char *s)
  5688. {
  5689. return (s && !*s) ? "(empty)" : nonnull (s);
  5690. }
  5691. void
  5692. lt_setenv (const char *name, const char *value)
  5693. {
  5694. lt_debugprintf (__FILE__, __LINE__,
  5695. "(lt_setenv) setting '%s' to '%s'\n",
  5696. nonnull (name), nonnull (value));
  5697. {
  5698. #ifdef HAVE_SETENV
  5699. /* always make a copy, for consistency with !HAVE_SETENV */
  5700. char *str = xstrdup (value);
  5701. setenv (name, str, 1);
  5702. #else
  5703. size_t len = strlen (name) + 1 + strlen (value) + 1;
  5704. char *str = XMALLOC (char, len);
  5705. sprintf (str, "%s=%s", name, value);
  5706. if (putenv (str) != EXIT_SUCCESS)
  5707. {
  5708. XFREE (str);
  5709. }
  5710. #endif
  5711. }
  5712. }
  5713. char *
  5714. lt_extend_str (const char *orig_value, const char *add, int to_end)
  5715. {
  5716. char *new_value;
  5717. if (orig_value && *orig_value)
  5718. {
  5719. size_t orig_value_len = strlen (orig_value);
  5720. size_t add_len = strlen (add);
  5721. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  5722. if (to_end)
  5723. {
  5724. strcpy (new_value, orig_value);
  5725. strcpy (new_value + orig_value_len, add);
  5726. }
  5727. else
  5728. {
  5729. strcpy (new_value, add);
  5730. strcpy (new_value + add_len, orig_value);
  5731. }
  5732. }
  5733. else
  5734. {
  5735. new_value = xstrdup (add);
  5736. }
  5737. return new_value;
  5738. }
  5739. void
  5740. lt_update_exe_path (const char *name, const char *value)
  5741. {
  5742. lt_debugprintf (__FILE__, __LINE__,
  5743. "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  5744. nonnull (name), nonnull (value));
  5745. if (name && *name && value && *value)
  5746. {
  5747. char *new_value = lt_extend_str (getenv (name), value, 0);
  5748. /* some systems can't cope with a ':'-terminated path #' */
  5749. size_t len = strlen (new_value);
  5750. while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  5751. {
  5752. new_value[--len] = '\0';
  5753. }
  5754. lt_setenv (name, new_value);
  5755. XFREE (new_value);
  5756. }
  5757. }
  5758. void
  5759. lt_update_lib_path (const char *name, const char *value)
  5760. {
  5761. lt_debugprintf (__FILE__, __LINE__,
  5762. "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  5763. nonnull (name), nonnull (value));
  5764. if (name && *name && value && *value)
  5765. {
  5766. char *new_value = lt_extend_str (getenv (name), value, 0);
  5767. lt_setenv (name, new_value);
  5768. XFREE (new_value);
  5769. }
  5770. }
  5771. EOF
  5772. case $host_os in
  5773. mingw*)
  5774. cat <<"EOF"
  5775. /* Prepares an argument vector before calling spawn().
  5776. Note that spawn() does not by itself call the command interpreter
  5777. (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  5778. ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  5779. GetVersionEx(&v);
  5780. v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  5781. }) ? "cmd.exe" : "command.com").
  5782. Instead it simply concatenates the arguments, separated by ' ', and calls
  5783. CreateProcess(). We must quote the arguments since Win32 CreateProcess()
  5784. interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  5785. special way:
  5786. - Space and tab are interpreted as delimiters. They are not treated as
  5787. delimiters if they are surrounded by double quotes: "...".
  5788. - Unescaped double quotes are removed from the input. Their only effect is
  5789. that within double quotes, space and tab are treated like normal
  5790. characters.
  5791. - Backslashes not followed by double quotes are not special.
  5792. - But 2*n+1 backslashes followed by a double quote become
  5793. n backslashes followed by a double quote (n >= 0):
  5794. \" -> "
  5795. \\\" -> \"
  5796. \\\\\" -> \\"
  5797. */
  5798. #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
  5799. #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
  5800. char **
  5801. prepare_spawn (char **argv)
  5802. {
  5803. size_t argc;
  5804. char **new_argv;
  5805. size_t i;
  5806. /* Count number of arguments. */
  5807. for (argc = 0; argv[argc] != NULL; argc++)
  5808. ;
  5809. /* Allocate new argument vector. */
  5810. new_argv = XMALLOC (char *, argc + 1);
  5811. /* Put quoted arguments into the new argument vector. */
  5812. for (i = 0; i < argc; i++)
  5813. {
  5814. const char *string = argv[i];
  5815. if (string[0] == '\0')
  5816. new_argv[i] = xstrdup ("\"\"");
  5817. else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  5818. {
  5819. int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  5820. size_t length;
  5821. unsigned int backslashes;
  5822. const char *s;
  5823. char *quoted_string;
  5824. char *p;
  5825. length = 0;
  5826. backslashes = 0;
  5827. if (quote_around)
  5828. length++;
  5829. for (s = string; *s != '\0'; s++)
  5830. {
  5831. char c = *s;
  5832. if (c == '"')
  5833. length += backslashes + 1;
  5834. length++;
  5835. if (c == '\\')
  5836. backslashes++;
  5837. else
  5838. backslashes = 0;
  5839. }
  5840. if (quote_around)
  5841. length += backslashes + 1;
  5842. quoted_string = XMALLOC (char, length + 1);
  5843. p = quoted_string;
  5844. backslashes = 0;
  5845. if (quote_around)
  5846. *p++ = '"';
  5847. for (s = string; *s != '\0'; s++)
  5848. {
  5849. char c = *s;
  5850. if (c == '"')
  5851. {
  5852. unsigned int j;
  5853. for (j = backslashes + 1; j > 0; j--)
  5854. *p++ = '\\';
  5855. }
  5856. *p++ = c;
  5857. if (c == '\\')
  5858. backslashes++;
  5859. else
  5860. backslashes = 0;
  5861. }
  5862. if (quote_around)
  5863. {
  5864. unsigned int j;
  5865. for (j = backslashes; j > 0; j--)
  5866. *p++ = '\\';
  5867. *p++ = '"';
  5868. }
  5869. *p = '\0';
  5870. new_argv[i] = quoted_string;
  5871. }
  5872. else
  5873. new_argv[i] = (char *) string;
  5874. }
  5875. new_argv[argc] = NULL;
  5876. return new_argv;
  5877. }
  5878. EOF
  5879. ;;
  5880. esac
  5881. cat <<"EOF"
  5882. void lt_dump_script (FILE* f)
  5883. {
  5884. EOF
  5885. func_emit_wrapper yes |
  5886. $SED -n -e '
  5887. s/^\(.\{79\}\)\(..*\)/\1\
  5888. \2/
  5889. h
  5890. s/\([\\"]\)/\\\1/g
  5891. s/$/\\n/
  5892. s/\([^\n]*\).*/ fputs ("\1", f);/p
  5893. g
  5894. D'
  5895. cat <<"EOF"
  5896. }
  5897. EOF
  5898. }
  5899. # end: func_emit_cwrapperexe_src
  5900. # func_win32_import_lib_p ARG
  5901. # True if ARG is an import lib, as indicated by $file_magic_cmd
  5902. func_win32_import_lib_p ()
  5903. {
  5904. $debug_cmd
  5905. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  5906. *import*) : ;;
  5907. *) false ;;
  5908. esac
  5909. }
  5910. # func_suncc_cstd_abi
  5911. # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
  5912. # Several compiler flags select an ABI that is incompatible with the
  5913. # Cstd library. Avoid specifying it if any are in CXXFLAGS.
  5914. func_suncc_cstd_abi ()
  5915. {
  5916. $debug_cmd
  5917. case " $compile_command " in
  5918. *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
  5919. suncc_use_cstd_abi=no
  5920. ;;
  5921. *)
  5922. suncc_use_cstd_abi=yes
  5923. ;;
  5924. esac
  5925. }
  5926. # func_mode_link arg...
  5927. func_mode_link ()
  5928. {
  5929. $debug_cmd
  5930. case $host in
  5931. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  5932. # It is impossible to link a dll without this setting, and
  5933. # we shouldn't force the makefile maintainer to figure out
  5934. # what system we are compiling for in order to pass an extra
  5935. # flag for every libtool invocation.
  5936. # allow_undefined=no
  5937. # FIXME: Unfortunately, there are problems with the above when trying
  5938. # to make a dll that has undefined symbols, in which case not
  5939. # even a static library is built. For now, we need to specify
  5940. # -no-undefined on the libtool link line when we can be certain
  5941. # that all symbols are satisfied, otherwise we get a static library.
  5942. allow_undefined=yes
  5943. ;;
  5944. *)
  5945. allow_undefined=yes
  5946. ;;
  5947. esac
  5948. libtool_args=$nonopt
  5949. base_compile="$nonopt $@"
  5950. compile_command=$nonopt
  5951. finalize_command=$nonopt
  5952. compile_rpath=
  5953. finalize_rpath=
  5954. compile_shlibpath=
  5955. finalize_shlibpath=
  5956. convenience=
  5957. old_convenience=
  5958. deplibs=
  5959. old_deplibs=
  5960. compiler_flags=
  5961. linker_flags=
  5962. dllsearchpath=
  5963. lib_search_path=`pwd`
  5964. inst_prefix_dir=
  5965. new_inherited_linker_flags=
  5966. avoid_version=no
  5967. bindir=
  5968. dlfiles=
  5969. dlprefiles=
  5970. dlself=no
  5971. export_dynamic=no
  5972. export_symbols=
  5973. export_symbols_regex=
  5974. generated=
  5975. libobjs=
  5976. ltlibs=
  5977. module=no
  5978. no_install=no
  5979. objs=
  5980. os2dllname=
  5981. non_pic_objects=
  5982. precious_files_regex=
  5983. prefer_static_libs=no
  5984. preload=false
  5985. prev=
  5986. prevarg=
  5987. release=
  5988. rpath=
  5989. xrpath=
  5990. perm_rpath=
  5991. temp_rpath=
  5992. thread_safe=no
  5993. vinfo=
  5994. vinfo_number=no
  5995. weak_libs=
  5996. single_module=$wl-single_module
  5997. func_infer_tag $base_compile
  5998. # We need to know -static, to get the right output filenames.
  5999. for arg
  6000. do
  6001. case $arg in
  6002. -shared)
  6003. test yes != "$build_libtool_libs" \
  6004. && func_fatal_configuration "cannot build a shared library"
  6005. build_old_libs=no
  6006. break
  6007. ;;
  6008. -all-static | -static | -static-libtool-libs)
  6009. case $arg in
  6010. -all-static)
  6011. if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
  6012. func_warning "complete static linking is impossible in this configuration"
  6013. fi
  6014. if test -n "$link_static_flag"; then
  6015. dlopen_self=$dlopen_self_static
  6016. fi
  6017. prefer_static_libs=yes
  6018. ;;
  6019. -static)
  6020. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6021. dlopen_self=$dlopen_self_static
  6022. fi
  6023. prefer_static_libs=built
  6024. ;;
  6025. -static-libtool-libs)
  6026. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6027. dlopen_self=$dlopen_self_static
  6028. fi
  6029. prefer_static_libs=yes
  6030. ;;
  6031. esac
  6032. build_libtool_libs=no
  6033. build_old_libs=yes
  6034. break
  6035. ;;
  6036. esac
  6037. done
  6038. # See if our shared archives depend on static archives.
  6039. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  6040. # Go through the arguments, transforming them on the way.
  6041. while test "$#" -gt 0; do
  6042. arg=$1
  6043. shift
  6044. func_quote_for_eval "$arg"
  6045. qarg=$func_quote_for_eval_unquoted_result
  6046. func_append libtool_args " $func_quote_for_eval_result"
  6047. # If the previous option needs an argument, assign it.
  6048. if test -n "$prev"; then
  6049. case $prev in
  6050. output)
  6051. func_append compile_command " @OUTPUT@"
  6052. func_append finalize_command " @OUTPUT@"
  6053. ;;
  6054. esac
  6055. case $prev in
  6056. bindir)
  6057. bindir=$arg
  6058. prev=
  6059. continue
  6060. ;;
  6061. dlfiles|dlprefiles)
  6062. $preload || {
  6063. # Add the symbol object into the linking commands.
  6064. func_append compile_command " @SYMFILE@"
  6065. func_append finalize_command " @SYMFILE@"
  6066. preload=:
  6067. }
  6068. case $arg in
  6069. *.la | *.lo) ;; # We handle these cases below.
  6070. force)
  6071. if test no = "$dlself"; then
  6072. dlself=needless
  6073. export_dynamic=yes
  6074. fi
  6075. prev=
  6076. continue
  6077. ;;
  6078. self)
  6079. if test dlprefiles = "$prev"; then
  6080. dlself=yes
  6081. elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
  6082. dlself=yes
  6083. else
  6084. dlself=needless
  6085. export_dynamic=yes
  6086. fi
  6087. prev=
  6088. continue
  6089. ;;
  6090. *)
  6091. if test dlfiles = "$prev"; then
  6092. func_append dlfiles " $arg"
  6093. else
  6094. func_append dlprefiles " $arg"
  6095. fi
  6096. prev=
  6097. continue
  6098. ;;
  6099. esac
  6100. ;;
  6101. expsyms)
  6102. export_symbols=$arg
  6103. test -f "$arg" \
  6104. || func_fatal_error "symbol file '$arg' does not exist"
  6105. prev=
  6106. continue
  6107. ;;
  6108. expsyms_regex)
  6109. export_symbols_regex=$arg
  6110. prev=
  6111. continue
  6112. ;;
  6113. framework)
  6114. case $host in
  6115. *-*-darwin*)
  6116. case "$deplibs " in
  6117. *" $qarg.ltframework "*) ;;
  6118. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  6119. ;;
  6120. esac
  6121. ;;
  6122. esac
  6123. prev=
  6124. continue
  6125. ;;
  6126. inst_prefix)
  6127. inst_prefix_dir=$arg
  6128. prev=
  6129. continue
  6130. ;;
  6131. mllvm)
  6132. # Clang does not use LLVM to link, so we can simply discard any
  6133. # '-mllvm $arg' options when doing the link step.
  6134. prev=
  6135. continue
  6136. ;;
  6137. objectlist)
  6138. if test -f "$arg"; then
  6139. save_arg=$arg
  6140. moreargs=
  6141. for fil in `cat "$save_arg"`
  6142. do
  6143. # func_append moreargs " $fil"
  6144. arg=$fil
  6145. # A libtool-controlled object.
  6146. # Check to see that this really is a libtool object.
  6147. if func_lalib_unsafe_p "$arg"; then
  6148. pic_object=
  6149. non_pic_object=
  6150. # Read the .lo file
  6151. func_source "$arg"
  6152. if test -z "$pic_object" ||
  6153. test -z "$non_pic_object" ||
  6154. test none = "$pic_object" &&
  6155. test none = "$non_pic_object"; then
  6156. func_fatal_error "cannot find name of object for '$arg'"
  6157. fi
  6158. # Extract subdirectory from the argument.
  6159. func_dirname "$arg" "/" ""
  6160. xdir=$func_dirname_result
  6161. if test none != "$pic_object"; then
  6162. # Prepend the subdirectory the object is found in.
  6163. pic_object=$xdir$pic_object
  6164. if test dlfiles = "$prev"; then
  6165. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6166. func_append dlfiles " $pic_object"
  6167. prev=
  6168. continue
  6169. else
  6170. # If libtool objects are unsupported, then we need to preload.
  6171. prev=dlprefiles
  6172. fi
  6173. fi
  6174. # CHECK ME: I think I busted this. -Ossama
  6175. if test dlprefiles = "$prev"; then
  6176. # Preload the old-style object.
  6177. func_append dlprefiles " $pic_object"
  6178. prev=
  6179. fi
  6180. # A PIC object.
  6181. func_append libobjs " $pic_object"
  6182. arg=$pic_object
  6183. fi
  6184. # Non-PIC object.
  6185. if test none != "$non_pic_object"; then
  6186. # Prepend the subdirectory the object is found in.
  6187. non_pic_object=$xdir$non_pic_object
  6188. # A standard non-PIC object
  6189. func_append non_pic_objects " $non_pic_object"
  6190. if test -z "$pic_object" || test none = "$pic_object"; then
  6191. arg=$non_pic_object
  6192. fi
  6193. else
  6194. # If the PIC object exists, use it instead.
  6195. # $xdir was prepended to $pic_object above.
  6196. non_pic_object=$pic_object
  6197. func_append non_pic_objects " $non_pic_object"
  6198. fi
  6199. else
  6200. # Only an error if not doing a dry-run.
  6201. if $opt_dry_run; then
  6202. # Extract subdirectory from the argument.
  6203. func_dirname "$arg" "/" ""
  6204. xdir=$func_dirname_result
  6205. func_lo2o "$arg"
  6206. pic_object=$xdir$objdir/$func_lo2o_result
  6207. non_pic_object=$xdir$func_lo2o_result
  6208. func_append libobjs " $pic_object"
  6209. func_append non_pic_objects " $non_pic_object"
  6210. else
  6211. func_fatal_error "'$arg' is not a valid libtool object"
  6212. fi
  6213. fi
  6214. done
  6215. else
  6216. func_fatal_error "link input file '$arg' does not exist"
  6217. fi
  6218. arg=$save_arg
  6219. prev=
  6220. continue
  6221. ;;
  6222. os2dllname)
  6223. os2dllname=$arg
  6224. prev=
  6225. continue
  6226. ;;
  6227. precious_regex)
  6228. precious_files_regex=$arg
  6229. prev=
  6230. continue
  6231. ;;
  6232. release)
  6233. release=-$arg
  6234. prev=
  6235. continue
  6236. ;;
  6237. rpath | xrpath)
  6238. # We need an absolute path.
  6239. case $arg in
  6240. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6241. *)
  6242. func_fatal_error "only absolute run-paths are allowed"
  6243. ;;
  6244. esac
  6245. if test rpath = "$prev"; then
  6246. case "$rpath " in
  6247. *" $arg "*) ;;
  6248. *) func_append rpath " $arg" ;;
  6249. esac
  6250. else
  6251. case "$xrpath " in
  6252. *" $arg "*) ;;
  6253. *) func_append xrpath " $arg" ;;
  6254. esac
  6255. fi
  6256. prev=
  6257. continue
  6258. ;;
  6259. shrext)
  6260. shrext_cmds=$arg
  6261. prev=
  6262. continue
  6263. ;;
  6264. weak)
  6265. func_append weak_libs " $arg"
  6266. prev=
  6267. continue
  6268. ;;
  6269. xcclinker)
  6270. func_append linker_flags " $qarg"
  6271. func_append compiler_flags " $qarg"
  6272. prev=
  6273. func_append compile_command " $qarg"
  6274. func_append finalize_command " $qarg"
  6275. continue
  6276. ;;
  6277. xcompiler)
  6278. func_append compiler_flags " $qarg"
  6279. prev=
  6280. func_append compile_command " $qarg"
  6281. func_append finalize_command " $qarg"
  6282. continue
  6283. ;;
  6284. xlinker)
  6285. func_append linker_flags " $qarg"
  6286. func_append compiler_flags " $wl$qarg"
  6287. prev=
  6288. func_append compile_command " $wl$qarg"
  6289. func_append finalize_command " $wl$qarg"
  6290. continue
  6291. ;;
  6292. *)
  6293. eval "$prev=\"\$arg\""
  6294. prev=
  6295. continue
  6296. ;;
  6297. esac
  6298. fi # test -n "$prev"
  6299. prevarg=$arg
  6300. case $arg in
  6301. -all-static)
  6302. if test -n "$link_static_flag"; then
  6303. # See comment for -static flag below, for more details.
  6304. func_append compile_command " $link_static_flag"
  6305. func_append finalize_command " $link_static_flag"
  6306. fi
  6307. continue
  6308. ;;
  6309. -allow-undefined)
  6310. # FIXME: remove this flag sometime in the future.
  6311. func_fatal_error "'-allow-undefined' must not be used because it is the default"
  6312. ;;
  6313. -avoid-version)
  6314. avoid_version=yes
  6315. continue
  6316. ;;
  6317. -bindir)
  6318. prev=bindir
  6319. continue
  6320. ;;
  6321. -dlopen)
  6322. prev=dlfiles
  6323. continue
  6324. ;;
  6325. -dlpreopen)
  6326. prev=dlprefiles
  6327. continue
  6328. ;;
  6329. -export-dynamic)
  6330. export_dynamic=yes
  6331. continue
  6332. ;;
  6333. -export-symbols | -export-symbols-regex)
  6334. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  6335. func_fatal_error "more than one -exported-symbols argument is not allowed"
  6336. fi
  6337. if test X-export-symbols = "X$arg"; then
  6338. prev=expsyms
  6339. else
  6340. prev=expsyms_regex
  6341. fi
  6342. continue
  6343. ;;
  6344. -framework)
  6345. prev=framework
  6346. continue
  6347. ;;
  6348. -inst-prefix-dir)
  6349. prev=inst_prefix
  6350. continue
  6351. ;;
  6352. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  6353. # so, if we see these flags be careful not to treat them like -L
  6354. -L[A-Z][A-Z]*:*)
  6355. case $with_gcc/$host in
  6356. no/*-*-irix* | /*-*-irix*)
  6357. func_append compile_command " $arg"
  6358. func_append finalize_command " $arg"
  6359. ;;
  6360. esac
  6361. continue
  6362. ;;
  6363. -L*)
  6364. func_stripname "-L" '' "$arg"
  6365. if test -z "$func_stripname_result"; then
  6366. if test "$#" -gt 0; then
  6367. func_fatal_error "require no space between '-L' and '$1'"
  6368. else
  6369. func_fatal_error "need path for '-L' option"
  6370. fi
  6371. fi
  6372. func_resolve_sysroot "$func_stripname_result"
  6373. dir=$func_resolve_sysroot_result
  6374. # We need an absolute path.
  6375. case $dir in
  6376. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6377. *)
  6378. absdir=`cd "$dir" && pwd`
  6379. test -z "$absdir" && \
  6380. func_fatal_error "cannot determine absolute directory name of '$dir'"
  6381. dir=$absdir
  6382. ;;
  6383. esac
  6384. case "$deplibs " in
  6385. *" -L$dir "* | *" $arg "*)
  6386. # Will only happen for absolute or sysroot arguments
  6387. ;;
  6388. *)
  6389. # Preserve sysroot, but never include relative directories
  6390. case $dir in
  6391. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  6392. *) func_append deplibs " -L$dir" ;;
  6393. esac
  6394. func_append lib_search_path " $dir"
  6395. ;;
  6396. esac
  6397. case $host in
  6398. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6399. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  6400. case :$dllsearchpath: in
  6401. *":$dir:"*) ;;
  6402. ::) dllsearchpath=$dir;;
  6403. *) func_append dllsearchpath ":$dir";;
  6404. esac
  6405. case :$dllsearchpath: in
  6406. *":$testbindir:"*) ;;
  6407. ::) dllsearchpath=$testbindir;;
  6408. *) func_append dllsearchpath ":$testbindir";;
  6409. esac
  6410. ;;
  6411. esac
  6412. continue
  6413. ;;
  6414. -l*)
  6415. if test X-lc = "X$arg" || test X-lm = "X$arg"; then
  6416. case $host in
  6417. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6418. # These systems don't actually have a C or math library (as such)
  6419. continue
  6420. ;;
  6421. *-*-os2*)
  6422. # These systems don't actually have a C library (as such)
  6423. test X-lc = "X$arg" && continue
  6424. ;;
  6425. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6426. # Do not include libc due to us having libc/libc_r.
  6427. test X-lc = "X$arg" && continue
  6428. ;;
  6429. *-*-rhapsody* | *-*-darwin1.[012])
  6430. # Rhapsody C and math libraries are in the System framework
  6431. func_append deplibs " System.ltframework"
  6432. continue
  6433. ;;
  6434. *-*-sco3.2v5* | *-*-sco5v6*)
  6435. # Causes problems with __ctype
  6436. test X-lc = "X$arg" && continue
  6437. ;;
  6438. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6439. # Compiler inserts libc in the correct place for threads to work
  6440. test X-lc = "X$arg" && continue
  6441. ;;
  6442. esac
  6443. elif test X-lc_r = "X$arg"; then
  6444. case $host in
  6445. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6446. # Do not include libc_r directly, use -pthread flag.
  6447. continue
  6448. ;;
  6449. esac
  6450. fi
  6451. func_append deplibs " $arg"
  6452. continue
  6453. ;;
  6454. -mllvm)
  6455. prev=mllvm
  6456. continue
  6457. ;;
  6458. -module)
  6459. module=yes
  6460. continue
  6461. ;;
  6462. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  6463. # classes, name mangling, and exception handling.
  6464. # Darwin uses the -arch flag to determine output architecture.
  6465. -model|-arch|-isysroot|--sysroot)
  6466. func_append compiler_flags " $arg"
  6467. func_append compile_command " $arg"
  6468. func_append finalize_command " $arg"
  6469. prev=xcompiler
  6470. continue
  6471. ;;
  6472. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6473. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6474. func_append compiler_flags " $arg"
  6475. func_append compile_command " $arg"
  6476. func_append finalize_command " $arg"
  6477. case "$new_inherited_linker_flags " in
  6478. *" $arg "*) ;;
  6479. * ) func_append new_inherited_linker_flags " $arg" ;;
  6480. esac
  6481. continue
  6482. ;;
  6483. -multi_module)
  6484. single_module=$wl-multi_module
  6485. continue
  6486. ;;
  6487. -no-fast-install)
  6488. fast_install=no
  6489. continue
  6490. ;;
  6491. -no-install)
  6492. case $host in
  6493. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  6494. # The PATH hackery in wrapper scripts is required on Windows
  6495. # and Darwin in order for the loader to find any dlls it needs.
  6496. func_warning "'-no-install' is ignored for $host"
  6497. func_warning "assuming '-no-fast-install' instead"
  6498. fast_install=no
  6499. ;;
  6500. *) no_install=yes ;;
  6501. esac
  6502. continue
  6503. ;;
  6504. -no-undefined)
  6505. allow_undefined=no
  6506. continue
  6507. ;;
  6508. -objectlist)
  6509. prev=objectlist
  6510. continue
  6511. ;;
  6512. -os2dllname)
  6513. prev=os2dllname
  6514. continue
  6515. ;;
  6516. -o) prev=output ;;
  6517. -precious-files-regex)
  6518. prev=precious_regex
  6519. continue
  6520. ;;
  6521. -release)
  6522. prev=release
  6523. continue
  6524. ;;
  6525. -rpath)
  6526. prev=rpath
  6527. continue
  6528. ;;
  6529. -R)
  6530. prev=xrpath
  6531. continue
  6532. ;;
  6533. -R*)
  6534. func_stripname '-R' '' "$arg"
  6535. dir=$func_stripname_result
  6536. # We need an absolute path.
  6537. case $dir in
  6538. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6539. =*)
  6540. func_stripname '=' '' "$dir"
  6541. dir=$lt_sysroot$func_stripname_result
  6542. ;;
  6543. *)
  6544. func_fatal_error "only absolute run-paths are allowed"
  6545. ;;
  6546. esac
  6547. case "$xrpath " in
  6548. *" $dir "*) ;;
  6549. *) func_append xrpath " $dir" ;;
  6550. esac
  6551. continue
  6552. ;;
  6553. -shared)
  6554. # The effects of -shared are defined in a previous loop.
  6555. continue
  6556. ;;
  6557. -shrext)
  6558. prev=shrext
  6559. continue
  6560. ;;
  6561. -static | -static-libtool-libs)
  6562. # The effects of -static are defined in a previous loop.
  6563. # We used to do the same as -all-static on platforms that
  6564. # didn't have a PIC flag, but the assumption that the effects
  6565. # would be equivalent was wrong. It would break on at least
  6566. # Digital Unix and AIX.
  6567. continue
  6568. ;;
  6569. -thread-safe)
  6570. thread_safe=yes
  6571. continue
  6572. ;;
  6573. -version-info)
  6574. prev=vinfo
  6575. continue
  6576. ;;
  6577. -version-number)
  6578. prev=vinfo
  6579. vinfo_number=yes
  6580. continue
  6581. ;;
  6582. -weak)
  6583. prev=weak
  6584. continue
  6585. ;;
  6586. -Wc,*)
  6587. func_stripname '-Wc,' '' "$arg"
  6588. args=$func_stripname_result
  6589. arg=
  6590. save_ifs=$IFS; IFS=,
  6591. for flag in $args; do
  6592. IFS=$save_ifs
  6593. func_quote_for_eval "$flag"
  6594. func_append arg " $func_quote_for_eval_result"
  6595. func_append compiler_flags " $func_quote_for_eval_result"
  6596. done
  6597. IFS=$save_ifs
  6598. func_stripname ' ' '' "$arg"
  6599. arg=$func_stripname_result
  6600. ;;
  6601. -Wl,*)
  6602. func_stripname '-Wl,' '' "$arg"
  6603. args=$func_stripname_result
  6604. arg=
  6605. save_ifs=$IFS; IFS=,
  6606. for flag in $args; do
  6607. IFS=$save_ifs
  6608. func_quote_for_eval "$flag"
  6609. func_append arg " $wl$func_quote_for_eval_result"
  6610. func_append compiler_flags " $wl$func_quote_for_eval_result"
  6611. func_append linker_flags " $func_quote_for_eval_result"
  6612. done
  6613. IFS=$save_ifs
  6614. func_stripname ' ' '' "$arg"
  6615. arg=$func_stripname_result
  6616. ;;
  6617. -Xcompiler)
  6618. prev=xcompiler
  6619. continue
  6620. ;;
  6621. -Xlinker)
  6622. prev=xlinker
  6623. continue
  6624. ;;
  6625. -XCClinker)
  6626. prev=xcclinker
  6627. continue
  6628. ;;
  6629. # -msg_* for osf cc
  6630. -msg_*)
  6631. func_quote_for_eval "$arg"
  6632. arg=$func_quote_for_eval_result
  6633. ;;
  6634. # Flags to be passed through unchanged, with rationale:
  6635. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  6636. # -r[0-9][0-9]* specify processor for the SGI compiler
  6637. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  6638. # +DA*, +DD* enable 64-bit mode for the HP compiler
  6639. # -q* compiler args for the IBM compiler
  6640. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  6641. # -F/path path to uninstalled frameworks, gcc on darwin
  6642. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  6643. # -fstack-protector* stack protector flags for GCC
  6644. # @file GCC response files
  6645. # -tp=* Portland pgcc target processor selection
  6646. # --sysroot=* for sysroot support
  6647. # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  6648. # -stdlib=* select c++ std lib with clang
  6649. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  6650. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  6651. -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
  6652. func_quote_for_eval "$arg"
  6653. arg=$func_quote_for_eval_result
  6654. func_append compile_command " $arg"
  6655. func_append finalize_command " $arg"
  6656. func_append compiler_flags " $arg"
  6657. continue
  6658. ;;
  6659. -Z*)
  6660. if test os2 = "`expr $host : '.*\(os2\)'`"; then
  6661. # OS/2 uses -Zxxx to specify OS/2-specific options
  6662. compiler_flags="$compiler_flags $arg"
  6663. func_append compile_command " $arg"
  6664. func_append finalize_command " $arg"
  6665. case $arg in
  6666. -Zlinker | -Zstack)
  6667. prev=xcompiler
  6668. ;;
  6669. esac
  6670. continue
  6671. else
  6672. # Otherwise treat like 'Some other compiler flag' below
  6673. func_quote_for_eval "$arg"
  6674. arg=$func_quote_for_eval_result
  6675. fi
  6676. ;;
  6677. # Some other compiler flag.
  6678. -* | +*)
  6679. func_quote_for_eval "$arg"
  6680. arg=$func_quote_for_eval_result
  6681. ;;
  6682. *.$objext)
  6683. # A standard object.
  6684. func_append objs " $arg"
  6685. ;;
  6686. *.lo)
  6687. # A libtool-controlled object.
  6688. # Check to see that this really is a libtool object.
  6689. if func_lalib_unsafe_p "$arg"; then
  6690. pic_object=
  6691. non_pic_object=
  6692. # Read the .lo file
  6693. func_source "$arg"
  6694. if test -z "$pic_object" ||
  6695. test -z "$non_pic_object" ||
  6696. test none = "$pic_object" &&
  6697. test none = "$non_pic_object"; then
  6698. func_fatal_error "cannot find name of object for '$arg'"
  6699. fi
  6700. # Extract subdirectory from the argument.
  6701. func_dirname "$arg" "/" ""
  6702. xdir=$func_dirname_result
  6703. test none = "$pic_object" || {
  6704. # Prepend the subdirectory the object is found in.
  6705. pic_object=$xdir$pic_object
  6706. if test dlfiles = "$prev"; then
  6707. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6708. func_append dlfiles " $pic_object"
  6709. prev=
  6710. continue
  6711. else
  6712. # If libtool objects are unsupported, then we need to preload.
  6713. prev=dlprefiles
  6714. fi
  6715. fi
  6716. # CHECK ME: I think I busted this. -Ossama
  6717. if test dlprefiles = "$prev"; then
  6718. # Preload the old-style object.
  6719. func_append dlprefiles " $pic_object"
  6720. prev=
  6721. fi
  6722. # A PIC object.
  6723. func_append libobjs " $pic_object"
  6724. arg=$pic_object
  6725. }
  6726. # Non-PIC object.
  6727. if test none != "$non_pic_object"; then
  6728. # Prepend the subdirectory the object is found in.
  6729. non_pic_object=$xdir$non_pic_object
  6730. # A standard non-PIC object
  6731. func_append non_pic_objects " $non_pic_object"
  6732. if test -z "$pic_object" || test none = "$pic_object"; then
  6733. arg=$non_pic_object
  6734. fi
  6735. else
  6736. # If the PIC object exists, use it instead.
  6737. # $xdir was prepended to $pic_object above.
  6738. non_pic_object=$pic_object
  6739. func_append non_pic_objects " $non_pic_object"
  6740. fi
  6741. else
  6742. # Only an error if not doing a dry-run.
  6743. if $opt_dry_run; then
  6744. # Extract subdirectory from the argument.
  6745. func_dirname "$arg" "/" ""
  6746. xdir=$func_dirname_result
  6747. func_lo2o "$arg"
  6748. pic_object=$xdir$objdir/$func_lo2o_result
  6749. non_pic_object=$xdir$func_lo2o_result
  6750. func_append libobjs " $pic_object"
  6751. func_append non_pic_objects " $non_pic_object"
  6752. else
  6753. func_fatal_error "'$arg' is not a valid libtool object"
  6754. fi
  6755. fi
  6756. ;;
  6757. *.$libext)
  6758. # An archive.
  6759. func_append deplibs " $arg"
  6760. func_append old_deplibs " $arg"
  6761. continue
  6762. ;;
  6763. *.la)
  6764. # A libtool-controlled library.
  6765. func_resolve_sysroot "$arg"
  6766. if test dlfiles = "$prev"; then
  6767. # This library was specified with -dlopen.
  6768. func_append dlfiles " $func_resolve_sysroot_result"
  6769. prev=
  6770. elif test dlprefiles = "$prev"; then
  6771. # The library was specified with -dlpreopen.
  6772. func_append dlprefiles " $func_resolve_sysroot_result"
  6773. prev=
  6774. else
  6775. func_append deplibs " $func_resolve_sysroot_result"
  6776. fi
  6777. continue
  6778. ;;
  6779. # Some other compiler argument.
  6780. *)
  6781. # Unknown arguments in both finalize_command and compile_command need
  6782. # to be aesthetically quoted because they are evaled later.
  6783. func_quote_for_eval "$arg"
  6784. arg=$func_quote_for_eval_result
  6785. ;;
  6786. esac # arg
  6787. # Now actually substitute the argument into the commands.
  6788. if test -n "$arg"; then
  6789. func_append compile_command " $arg"
  6790. func_append finalize_command " $arg"
  6791. fi
  6792. done # argument parsing loop
  6793. test -n "$prev" && \
  6794. func_fatal_help "the '$prevarg' option requires an argument"
  6795. if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
  6796. eval arg=\"$export_dynamic_flag_spec\"
  6797. func_append compile_command " $arg"
  6798. func_append finalize_command " $arg"
  6799. fi
  6800. oldlibs=
  6801. # calculate the name of the file, without its directory
  6802. func_basename "$output"
  6803. outputname=$func_basename_result
  6804. libobjs_save=$libobjs
  6805. if test -n "$shlibpath_var"; then
  6806. # get the directories listed in $shlibpath_var
  6807. eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
  6808. else
  6809. shlib_search_path=
  6810. fi
  6811. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  6812. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  6813. # Definition is injected by LT_CONFIG during libtool generation.
  6814. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
  6815. func_dirname "$output" "/" ""
  6816. output_objdir=$func_dirname_result$objdir
  6817. func_to_tool_file "$output_objdir/"
  6818. tool_output_objdir=$func_to_tool_file_result
  6819. # Create the object directory.
  6820. func_mkdir_p "$output_objdir"
  6821. # Determine the type of output
  6822. case $output in
  6823. "")
  6824. func_fatal_help "you must specify an output file"
  6825. ;;
  6826. *.$libext) linkmode=oldlib ;;
  6827. *.lo | *.$objext) linkmode=obj ;;
  6828. *.la) linkmode=lib ;;
  6829. *) linkmode=prog ;; # Anything else should be a program.
  6830. esac
  6831. specialdeplibs=
  6832. libs=
  6833. # Find all interdependent deplibs by searching for libraries
  6834. # that are linked more than once (e.g. -la -lb -la)
  6835. for deplib in $deplibs; do
  6836. if $opt_preserve_dup_deps; then
  6837. case "$libs " in
  6838. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  6839. esac
  6840. fi
  6841. func_append libs " $deplib"
  6842. done
  6843. if test lib = "$linkmode"; then
  6844. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  6845. # Compute libraries that are listed more than once in $predeps
  6846. # $postdeps and mark them as special (i.e., whose duplicates are
  6847. # not to be eliminated).
  6848. pre_post_deps=
  6849. if $opt_duplicate_compiler_generated_deps; then
  6850. for pre_post_dep in $predeps $postdeps; do
  6851. case "$pre_post_deps " in
  6852. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  6853. esac
  6854. func_append pre_post_deps " $pre_post_dep"
  6855. done
  6856. fi
  6857. pre_post_deps=
  6858. fi
  6859. deplibs=
  6860. newdependency_libs=
  6861. newlib_search_path=
  6862. need_relink=no # whether we're linking any uninstalled libtool libraries
  6863. notinst_deplibs= # not-installed libtool libraries
  6864. notinst_path= # paths that contain not-installed libtool libraries
  6865. case $linkmode in
  6866. lib)
  6867. passes="conv dlpreopen link"
  6868. for file in $dlfiles $dlprefiles; do
  6869. case $file in
  6870. *.la) ;;
  6871. *)
  6872. func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
  6873. ;;
  6874. esac
  6875. done
  6876. ;;
  6877. prog)
  6878. compile_deplibs=
  6879. finalize_deplibs=
  6880. alldeplibs=false
  6881. newdlfiles=
  6882. newdlprefiles=
  6883. passes="conv scan dlopen dlpreopen link"
  6884. ;;
  6885. *) passes="conv"
  6886. ;;
  6887. esac
  6888. for pass in $passes; do
  6889. # The preopen pass in lib mode reverses $deplibs; put it back here
  6890. # so that -L comes before libs that need it for instance...
  6891. if test lib,link = "$linkmode,$pass"; then
  6892. ## FIXME: Find the place where the list is rebuilt in the wrong
  6893. ## order, and fix it there properly
  6894. tmp_deplibs=
  6895. for deplib in $deplibs; do
  6896. tmp_deplibs="$deplib $tmp_deplibs"
  6897. done
  6898. deplibs=$tmp_deplibs
  6899. fi
  6900. if test lib,link = "$linkmode,$pass" ||
  6901. test prog,scan = "$linkmode,$pass"; then
  6902. libs=$deplibs
  6903. deplibs=
  6904. fi
  6905. if test prog = "$linkmode"; then
  6906. case $pass in
  6907. dlopen) libs=$dlfiles ;;
  6908. dlpreopen) libs=$dlprefiles ;;
  6909. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  6910. esac
  6911. fi
  6912. if test lib,dlpreopen = "$linkmode,$pass"; then
  6913. # Collect and forward deplibs of preopened libtool libs
  6914. for lib in $dlprefiles; do
  6915. # Ignore non-libtool-libs
  6916. dependency_libs=
  6917. func_resolve_sysroot "$lib"
  6918. case $lib in
  6919. *.la) func_source "$func_resolve_sysroot_result" ;;
  6920. esac
  6921. # Collect preopened libtool deplibs, except any this library
  6922. # has declared as weak libs
  6923. for deplib in $dependency_libs; do
  6924. func_basename "$deplib"
  6925. deplib_base=$func_basename_result
  6926. case " $weak_libs " in
  6927. *" $deplib_base "*) ;;
  6928. *) func_append deplibs " $deplib" ;;
  6929. esac
  6930. done
  6931. done
  6932. libs=$dlprefiles
  6933. fi
  6934. if test dlopen = "$pass"; then
  6935. # Collect dlpreopened libraries
  6936. save_deplibs=$deplibs
  6937. deplibs=
  6938. fi
  6939. for deplib in $libs; do
  6940. lib=
  6941. found=false
  6942. case $deplib in
  6943. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6944. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6945. if test prog,link = "$linkmode,$pass"; then
  6946. compile_deplibs="$deplib $compile_deplibs"
  6947. finalize_deplibs="$deplib $finalize_deplibs"
  6948. else
  6949. func_append compiler_flags " $deplib"
  6950. if test lib = "$linkmode"; then
  6951. case "$new_inherited_linker_flags " in
  6952. *" $deplib "*) ;;
  6953. * ) func_append new_inherited_linker_flags " $deplib" ;;
  6954. esac
  6955. fi
  6956. fi
  6957. continue
  6958. ;;
  6959. -l*)
  6960. if test lib != "$linkmode" && test prog != "$linkmode"; then
  6961. func_warning "'-l' is ignored for archives/objects"
  6962. continue
  6963. fi
  6964. func_stripname '-l' '' "$deplib"
  6965. name=$func_stripname_result
  6966. if test lib = "$linkmode"; then
  6967. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  6968. else
  6969. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  6970. fi
  6971. for searchdir in $searchdirs; do
  6972. for search_ext in .la $std_shrext .so .a; do
  6973. # Search the libtool library
  6974. lib=$searchdir/lib$name$search_ext
  6975. if test -f "$lib"; then
  6976. if test .la = "$search_ext"; then
  6977. found=:
  6978. else
  6979. found=false
  6980. fi
  6981. break 2
  6982. fi
  6983. done
  6984. done
  6985. if $found; then
  6986. # deplib is a libtool library
  6987. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  6988. # We need to do some special things here, and not later.
  6989. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  6990. case " $predeps $postdeps " in
  6991. *" $deplib "*)
  6992. if func_lalib_p "$lib"; then
  6993. library_names=
  6994. old_library=
  6995. func_source "$lib"
  6996. for l in $old_library $library_names; do
  6997. ll=$l
  6998. done
  6999. if test "X$ll" = "X$old_library"; then # only static version available
  7000. found=false
  7001. func_dirname "$lib" "" "."
  7002. ladir=$func_dirname_result
  7003. lib=$ladir/$old_library
  7004. if test prog,link = "$linkmode,$pass"; then
  7005. compile_deplibs="$deplib $compile_deplibs"
  7006. finalize_deplibs="$deplib $finalize_deplibs"
  7007. else
  7008. deplibs="$deplib $deplibs"
  7009. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7010. fi
  7011. continue
  7012. fi
  7013. fi
  7014. ;;
  7015. *) ;;
  7016. esac
  7017. fi
  7018. else
  7019. # deplib doesn't seem to be a libtool library
  7020. if test prog,link = "$linkmode,$pass"; then
  7021. compile_deplibs="$deplib $compile_deplibs"
  7022. finalize_deplibs="$deplib $finalize_deplibs"
  7023. else
  7024. deplibs="$deplib $deplibs"
  7025. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7026. fi
  7027. continue
  7028. fi
  7029. ;; # -l
  7030. *.ltframework)
  7031. if test prog,link = "$linkmode,$pass"; then
  7032. compile_deplibs="$deplib $compile_deplibs"
  7033. finalize_deplibs="$deplib $finalize_deplibs"
  7034. else
  7035. deplibs="$deplib $deplibs"
  7036. if test lib = "$linkmode"; then
  7037. case "$new_inherited_linker_flags " in
  7038. *" $deplib "*) ;;
  7039. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7040. esac
  7041. fi
  7042. fi
  7043. continue
  7044. ;;
  7045. -L*)
  7046. case $linkmode in
  7047. lib)
  7048. deplibs="$deplib $deplibs"
  7049. test conv = "$pass" && continue
  7050. newdependency_libs="$deplib $newdependency_libs"
  7051. func_stripname '-L' '' "$deplib"
  7052. func_resolve_sysroot "$func_stripname_result"
  7053. func_append newlib_search_path " $func_resolve_sysroot_result"
  7054. ;;
  7055. prog)
  7056. if test conv = "$pass"; then
  7057. deplibs="$deplib $deplibs"
  7058. continue
  7059. fi
  7060. if test scan = "$pass"; then
  7061. deplibs="$deplib $deplibs"
  7062. else
  7063. compile_deplibs="$deplib $compile_deplibs"
  7064. finalize_deplibs="$deplib $finalize_deplibs"
  7065. fi
  7066. func_stripname '-L' '' "$deplib"
  7067. func_resolve_sysroot "$func_stripname_result"
  7068. func_append newlib_search_path " $func_resolve_sysroot_result"
  7069. ;;
  7070. *)
  7071. func_warning "'-L' is ignored for archives/objects"
  7072. ;;
  7073. esac # linkmode
  7074. continue
  7075. ;; # -L
  7076. -R*)
  7077. if test link = "$pass"; then
  7078. func_stripname '-R' '' "$deplib"
  7079. func_resolve_sysroot "$func_stripname_result"
  7080. dir=$func_resolve_sysroot_result
  7081. # Make sure the xrpath contains only unique directories.
  7082. case "$xrpath " in
  7083. *" $dir "*) ;;
  7084. *) func_append xrpath " $dir" ;;
  7085. esac
  7086. fi
  7087. deplibs="$deplib $deplibs"
  7088. continue
  7089. ;;
  7090. *.la)
  7091. func_resolve_sysroot "$deplib"
  7092. lib=$func_resolve_sysroot_result
  7093. ;;
  7094. *.$libext)
  7095. if test conv = "$pass"; then
  7096. deplibs="$deplib $deplibs"
  7097. continue
  7098. fi
  7099. case $linkmode in
  7100. lib)
  7101. # Linking convenience modules into shared libraries is allowed,
  7102. # but linking other static libraries is non-portable.
  7103. case " $dlpreconveniencelibs " in
  7104. *" $deplib "*) ;;
  7105. *)
  7106. valid_a_lib=false
  7107. case $deplibs_check_method in
  7108. match_pattern*)
  7109. set dummy $deplibs_check_method; shift
  7110. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7111. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  7112. | $EGREP "$match_pattern_regex" > /dev/null; then
  7113. valid_a_lib=:
  7114. fi
  7115. ;;
  7116. pass_all)
  7117. valid_a_lib=:
  7118. ;;
  7119. esac
  7120. if $valid_a_lib; then
  7121. echo
  7122. $ECHO "*** Warning: Linking the shared library $output against the"
  7123. $ECHO "*** static library $deplib is not portable!"
  7124. deplibs="$deplib $deplibs"
  7125. else
  7126. echo
  7127. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  7128. echo "*** I have the capability to make that library automatically link in when"
  7129. echo "*** you link to this library. But I can only do this if you have a"
  7130. echo "*** shared version of the library, which you do not appear to have"
  7131. echo "*** because the file extensions .$libext of this argument makes me believe"
  7132. echo "*** that it is just a static archive that I should not use here."
  7133. fi
  7134. ;;
  7135. esac
  7136. continue
  7137. ;;
  7138. prog)
  7139. if test link != "$pass"; then
  7140. deplibs="$deplib $deplibs"
  7141. else
  7142. compile_deplibs="$deplib $compile_deplibs"
  7143. finalize_deplibs="$deplib $finalize_deplibs"
  7144. fi
  7145. continue
  7146. ;;
  7147. esac # linkmode
  7148. ;; # *.$libext
  7149. *.lo | *.$objext)
  7150. if test conv = "$pass"; then
  7151. deplibs="$deplib $deplibs"
  7152. elif test prog = "$linkmode"; then
  7153. if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
  7154. # If there is no dlopen support or we're linking statically,
  7155. # we need to preload.
  7156. func_append newdlprefiles " $deplib"
  7157. compile_deplibs="$deplib $compile_deplibs"
  7158. finalize_deplibs="$deplib $finalize_deplibs"
  7159. else
  7160. func_append newdlfiles " $deplib"
  7161. fi
  7162. fi
  7163. continue
  7164. ;;
  7165. %DEPLIBS%)
  7166. alldeplibs=:
  7167. continue
  7168. ;;
  7169. esac # case $deplib
  7170. $found || test -f "$lib" \
  7171. || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
  7172. # Check to see that this really is a libtool archive.
  7173. func_lalib_unsafe_p "$lib" \
  7174. || func_fatal_error "'$lib' is not a valid libtool archive"
  7175. func_dirname "$lib" "" "."
  7176. ladir=$func_dirname_result
  7177. dlname=
  7178. dlopen=
  7179. dlpreopen=
  7180. libdir=
  7181. library_names=
  7182. old_library=
  7183. inherited_linker_flags=
  7184. # If the library was installed with an old release of libtool,
  7185. # it will not redefine variables installed, or shouldnotlink
  7186. installed=yes
  7187. shouldnotlink=no
  7188. avoidtemprpath=
  7189. # Read the .la file
  7190. func_source "$lib"
  7191. # Convert "-framework foo" to "foo.ltframework"
  7192. if test -n "$inherited_linker_flags"; then
  7193. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  7194. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  7195. case " $new_inherited_linker_flags " in
  7196. *" $tmp_inherited_linker_flag "*) ;;
  7197. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  7198. esac
  7199. done
  7200. fi
  7201. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7202. if test lib,link = "$linkmode,$pass" ||
  7203. test prog,scan = "$linkmode,$pass" ||
  7204. { test prog != "$linkmode" && test lib != "$linkmode"; }; then
  7205. test -n "$dlopen" && func_append dlfiles " $dlopen"
  7206. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  7207. fi
  7208. if test conv = "$pass"; then
  7209. # Only check for convenience libraries
  7210. deplibs="$lib $deplibs"
  7211. if test -z "$libdir"; then
  7212. if test -z "$old_library"; then
  7213. func_fatal_error "cannot find name of link library for '$lib'"
  7214. fi
  7215. # It is a libtool convenience library, so add in its objects.
  7216. func_append convenience " $ladir/$objdir/$old_library"
  7217. func_append old_convenience " $ladir/$objdir/$old_library"
  7218. elif test prog != "$linkmode" && test lib != "$linkmode"; then
  7219. func_fatal_error "'$lib' is not a convenience library"
  7220. fi
  7221. tmp_libs=
  7222. for deplib in $dependency_libs; do
  7223. deplibs="$deplib $deplibs"
  7224. if $opt_preserve_dup_deps; then
  7225. case "$tmp_libs " in
  7226. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7227. esac
  7228. fi
  7229. func_append tmp_libs " $deplib"
  7230. done
  7231. continue
  7232. fi # $pass = conv
  7233. # Get the name of the library we link against.
  7234. linklib=
  7235. if test -n "$old_library" &&
  7236. { test yes = "$prefer_static_libs" ||
  7237. test built,no = "$prefer_static_libs,$installed"; }; then
  7238. linklib=$old_library
  7239. else
  7240. for l in $old_library $library_names; do
  7241. linklib=$l
  7242. done
  7243. fi
  7244. if test -z "$linklib"; then
  7245. func_fatal_error "cannot find name of link library for '$lib'"
  7246. fi
  7247. # This library was specified with -dlopen.
  7248. if test dlopen = "$pass"; then
  7249. test -z "$libdir" \
  7250. && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
  7251. if test -z "$dlname" ||
  7252. test yes != "$dlopen_support" ||
  7253. test no = "$build_libtool_libs"
  7254. then
  7255. # If there is no dlname, no dlopen support or we're linking
  7256. # statically, we need to preload. We also need to preload any
  7257. # dependent libraries so libltdl's deplib preloader doesn't
  7258. # bomb out in the load deplibs phase.
  7259. func_append dlprefiles " $lib $dependency_libs"
  7260. else
  7261. func_append newdlfiles " $lib"
  7262. fi
  7263. continue
  7264. fi # $pass = dlopen
  7265. # We need an absolute path.
  7266. case $ladir in
  7267. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
  7268. *)
  7269. abs_ladir=`cd "$ladir" && pwd`
  7270. if test -z "$abs_ladir"; then
  7271. func_warning "cannot determine absolute directory name of '$ladir'"
  7272. func_warning "passing it literally to the linker, although it might fail"
  7273. abs_ladir=$ladir
  7274. fi
  7275. ;;
  7276. esac
  7277. func_basename "$lib"
  7278. laname=$func_basename_result
  7279. # Find the relevant object directory and library name.
  7280. if test yes = "$installed"; then
  7281. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7282. func_warning "library '$lib' was moved."
  7283. dir=$ladir
  7284. absdir=$abs_ladir
  7285. libdir=$abs_ladir
  7286. else
  7287. dir=$lt_sysroot$libdir
  7288. absdir=$lt_sysroot$libdir
  7289. fi
  7290. test yes = "$hardcode_automatic" && avoidtemprpath=yes
  7291. else
  7292. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7293. dir=$ladir
  7294. absdir=$abs_ladir
  7295. # Remove this search path later
  7296. func_append notinst_path " $abs_ladir"
  7297. else
  7298. dir=$ladir/$objdir
  7299. absdir=$abs_ladir/$objdir
  7300. # Remove this search path later
  7301. func_append notinst_path " $abs_ladir"
  7302. fi
  7303. fi # $installed = yes
  7304. func_stripname 'lib' '.la' "$laname"
  7305. name=$func_stripname_result
  7306. # This library was specified with -dlpreopen.
  7307. if test dlpreopen = "$pass"; then
  7308. if test -z "$libdir" && test prog = "$linkmode"; then
  7309. func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
  7310. fi
  7311. case $host in
  7312. # special handling for platforms with PE-DLLs.
  7313. *cygwin* | *mingw* | *cegcc* )
  7314. # Linker will automatically link against shared library if both
  7315. # static and shared are present. Therefore, ensure we extract
  7316. # symbols from the import library if a shared library is present
  7317. # (otherwise, the dlopen module name will be incorrect). We do
  7318. # this by putting the import library name into $newdlprefiles.
  7319. # We recover the dlopen module name by 'saving' the la file
  7320. # name in a special purpose variable, and (later) extracting the
  7321. # dlname from the la file.
  7322. if test -n "$dlname"; then
  7323. func_tr_sh "$dir/$linklib"
  7324. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  7325. func_append newdlprefiles " $dir/$linklib"
  7326. else
  7327. func_append newdlprefiles " $dir/$old_library"
  7328. # Keep a list of preopened convenience libraries to check
  7329. # that they are being used correctly in the link pass.
  7330. test -z "$libdir" && \
  7331. func_append dlpreconveniencelibs " $dir/$old_library"
  7332. fi
  7333. ;;
  7334. * )
  7335. # Prefer using a static library (so that no silly _DYNAMIC symbols
  7336. # are required to link).
  7337. if test -n "$old_library"; then
  7338. func_append newdlprefiles " $dir/$old_library"
  7339. # Keep a list of preopened convenience libraries to check
  7340. # that they are being used correctly in the link pass.
  7341. test -z "$libdir" && \
  7342. func_append dlpreconveniencelibs " $dir/$old_library"
  7343. # Otherwise, use the dlname, so that lt_dlopen finds it.
  7344. elif test -n "$dlname"; then
  7345. func_append newdlprefiles " $dir/$dlname"
  7346. else
  7347. func_append newdlprefiles " $dir/$linklib"
  7348. fi
  7349. ;;
  7350. esac
  7351. fi # $pass = dlpreopen
  7352. if test -z "$libdir"; then
  7353. # Link the convenience library
  7354. if test lib = "$linkmode"; then
  7355. deplibs="$dir/$old_library $deplibs"
  7356. elif test prog,link = "$linkmode,$pass"; then
  7357. compile_deplibs="$dir/$old_library $compile_deplibs"
  7358. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  7359. else
  7360. deplibs="$lib $deplibs" # used for prog,scan pass
  7361. fi
  7362. continue
  7363. fi
  7364. if test prog = "$linkmode" && test link != "$pass"; then
  7365. func_append newlib_search_path " $ladir"
  7366. deplibs="$lib $deplibs"
  7367. linkalldeplibs=false
  7368. if test no != "$link_all_deplibs" || test -z "$library_names" ||
  7369. test no = "$build_libtool_libs"; then
  7370. linkalldeplibs=:
  7371. fi
  7372. tmp_libs=
  7373. for deplib in $dependency_libs; do
  7374. case $deplib in
  7375. -L*) func_stripname '-L' '' "$deplib"
  7376. func_resolve_sysroot "$func_stripname_result"
  7377. func_append newlib_search_path " $func_resolve_sysroot_result"
  7378. ;;
  7379. esac
  7380. # Need to link against all dependency_libs?
  7381. if $linkalldeplibs; then
  7382. deplibs="$deplib $deplibs"
  7383. else
  7384. # Need to hardcode shared library paths
  7385. # or/and link against static libraries
  7386. newdependency_libs="$deplib $newdependency_libs"
  7387. fi
  7388. if $opt_preserve_dup_deps; then
  7389. case "$tmp_libs " in
  7390. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7391. esac
  7392. fi
  7393. func_append tmp_libs " $deplib"
  7394. done # for deplib
  7395. continue
  7396. fi # $linkmode = prog...
  7397. if test prog,link = "$linkmode,$pass"; then
  7398. if test -n "$library_names" &&
  7399. { { test no = "$prefer_static_libs" ||
  7400. test built,yes = "$prefer_static_libs,$installed"; } ||
  7401. test -z "$old_library"; }; then
  7402. # We need to hardcode the library path
  7403. if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
  7404. # Make sure the rpath contains only unique directories.
  7405. case $temp_rpath: in
  7406. *"$absdir:"*) ;;
  7407. *) func_append temp_rpath "$absdir:" ;;
  7408. esac
  7409. fi
  7410. # Hardcode the library path.
  7411. # Skip directories that are in the system default run-time
  7412. # search path.
  7413. case " $sys_lib_dlsearch_path " in
  7414. *" $absdir "*) ;;
  7415. *)
  7416. case "$compile_rpath " in
  7417. *" $absdir "*) ;;
  7418. *) func_append compile_rpath " $absdir" ;;
  7419. esac
  7420. ;;
  7421. esac
  7422. case " $sys_lib_dlsearch_path " in
  7423. *" $libdir "*) ;;
  7424. *)
  7425. case "$finalize_rpath " in
  7426. *" $libdir "*) ;;
  7427. *) func_append finalize_rpath " $libdir" ;;
  7428. esac
  7429. ;;
  7430. esac
  7431. fi # $linkmode,$pass = prog,link...
  7432. if $alldeplibs &&
  7433. { test pass_all = "$deplibs_check_method" ||
  7434. { test yes = "$build_libtool_libs" &&
  7435. test -n "$library_names"; }; }; then
  7436. # We only need to search for static libraries
  7437. continue
  7438. fi
  7439. fi
  7440. link_static=no # Whether the deplib will be linked statically
  7441. use_static_libs=$prefer_static_libs
  7442. if test built = "$use_static_libs" && test yes = "$installed"; then
  7443. use_static_libs=no
  7444. fi
  7445. if test -n "$library_names" &&
  7446. { test no = "$use_static_libs" || test -z "$old_library"; }; then
  7447. case $host in
  7448. *cygwin* | *mingw* | *cegcc* | *os2*)
  7449. # No point in relinking DLLs because paths are not encoded
  7450. func_append notinst_deplibs " $lib"
  7451. need_relink=no
  7452. ;;
  7453. *)
  7454. if test no = "$installed"; then
  7455. func_append notinst_deplibs " $lib"
  7456. need_relink=yes
  7457. fi
  7458. ;;
  7459. esac
  7460. # This is a shared library
  7461. # Warn about portability, can't link against -module's on some
  7462. # systems (darwin). Don't bleat about dlopened modules though!
  7463. dlopenmodule=
  7464. for dlpremoduletest in $dlprefiles; do
  7465. if test "X$dlpremoduletest" = "X$lib"; then
  7466. dlopenmodule=$dlpremoduletest
  7467. break
  7468. fi
  7469. done
  7470. if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
  7471. echo
  7472. if test prog = "$linkmode"; then
  7473. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  7474. else
  7475. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  7476. fi
  7477. $ECHO "*** $linklib is not portable!"
  7478. fi
  7479. if test lib = "$linkmode" &&
  7480. test yes = "$hardcode_into_libs"; then
  7481. # Hardcode the library path.
  7482. # Skip directories that are in the system default run-time
  7483. # search path.
  7484. case " $sys_lib_dlsearch_path " in
  7485. *" $absdir "*) ;;
  7486. *)
  7487. case "$compile_rpath " in
  7488. *" $absdir "*) ;;
  7489. *) func_append compile_rpath " $absdir" ;;
  7490. esac
  7491. ;;
  7492. esac
  7493. case " $sys_lib_dlsearch_path " in
  7494. *" $libdir "*) ;;
  7495. *)
  7496. case "$finalize_rpath " in
  7497. *" $libdir "*) ;;
  7498. *) func_append finalize_rpath " $libdir" ;;
  7499. esac
  7500. ;;
  7501. esac
  7502. fi
  7503. if test -n "$old_archive_from_expsyms_cmds"; then
  7504. # figure out the soname
  7505. set dummy $library_names
  7506. shift
  7507. realname=$1
  7508. shift
  7509. libname=`eval "\\$ECHO \"$libname_spec\""`
  7510. # use dlname if we got it. it's perfectly good, no?
  7511. if test -n "$dlname"; then
  7512. soname=$dlname
  7513. elif test -n "$soname_spec"; then
  7514. # bleh windows
  7515. case $host in
  7516. *cygwin* | mingw* | *cegcc* | *os2*)
  7517. func_arith $current - $age
  7518. major=$func_arith_result
  7519. versuffix=-$major
  7520. ;;
  7521. esac
  7522. eval soname=\"$soname_spec\"
  7523. else
  7524. soname=$realname
  7525. fi
  7526. # Make a new name for the extract_expsyms_cmds to use
  7527. soroot=$soname
  7528. func_basename "$soroot"
  7529. soname=$func_basename_result
  7530. func_stripname 'lib' '.dll' "$soname"
  7531. newlib=libimp-$func_stripname_result.a
  7532. # If the library has no export list, then create one now
  7533. if test -f "$output_objdir/$soname-def"; then :
  7534. else
  7535. func_verbose "extracting exported symbol list from '$soname'"
  7536. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  7537. fi
  7538. # Create $newlib
  7539. if test -f "$output_objdir/$newlib"; then :; else
  7540. func_verbose "generating import library for '$soname'"
  7541. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  7542. fi
  7543. # make sure the library variables are pointing to the new library
  7544. dir=$output_objdir
  7545. linklib=$newlib
  7546. fi # test -n "$old_archive_from_expsyms_cmds"
  7547. if test prog = "$linkmode" || test relink != "$opt_mode"; then
  7548. add_shlibpath=
  7549. add_dir=
  7550. add=
  7551. lib_linked=yes
  7552. case $hardcode_action in
  7553. immediate | unsupported)
  7554. if test no = "$hardcode_direct"; then
  7555. add=$dir/$linklib
  7556. case $host in
  7557. *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
  7558. *-*-sysv4*uw2*) add_dir=-L$dir ;;
  7559. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  7560. *-*-unixware7*) add_dir=-L$dir ;;
  7561. *-*-darwin* )
  7562. # if the lib is a (non-dlopened) module then we cannot
  7563. # link against it, someone is ignoring the earlier warnings
  7564. if /usr/bin/file -L $add 2> /dev/null |
  7565. $GREP ": [^:]* bundle" >/dev/null; then
  7566. if test "X$dlopenmodule" != "X$lib"; then
  7567. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  7568. if test -z "$old_library"; then
  7569. echo
  7570. echo "*** And there doesn't seem to be a static archive available"
  7571. echo "*** The link will probably fail, sorry"
  7572. else
  7573. add=$dir/$old_library
  7574. fi
  7575. elif test -n "$old_library"; then
  7576. add=$dir/$old_library
  7577. fi
  7578. fi
  7579. esac
  7580. elif test no = "$hardcode_minus_L"; then
  7581. case $host in
  7582. *-*-sunos*) add_shlibpath=$dir ;;
  7583. esac
  7584. add_dir=-L$dir
  7585. add=-l$name
  7586. elif test no = "$hardcode_shlibpath_var"; then
  7587. add_shlibpath=$dir
  7588. add=-l$name
  7589. else
  7590. lib_linked=no
  7591. fi
  7592. ;;
  7593. relink)
  7594. if test yes = "$hardcode_direct" &&
  7595. test no = "$hardcode_direct_absolute"; then
  7596. add=$dir/$linklib
  7597. elif test yes = "$hardcode_minus_L"; then
  7598. add_dir=-L$absdir
  7599. # Try looking first in the location we're being installed to.
  7600. if test -n "$inst_prefix_dir"; then
  7601. case $libdir in
  7602. [\\/]*)
  7603. func_append add_dir " -L$inst_prefix_dir$libdir"
  7604. ;;
  7605. esac
  7606. fi
  7607. add=-l$name
  7608. elif test yes = "$hardcode_shlibpath_var"; then
  7609. add_shlibpath=$dir
  7610. add=-l$name
  7611. else
  7612. lib_linked=no
  7613. fi
  7614. ;;
  7615. *) lib_linked=no ;;
  7616. esac
  7617. if test yes != "$lib_linked"; then
  7618. func_fatal_configuration "unsupported hardcode properties"
  7619. fi
  7620. if test -n "$add_shlibpath"; then
  7621. case :$compile_shlibpath: in
  7622. *":$add_shlibpath:"*) ;;
  7623. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  7624. esac
  7625. fi
  7626. if test prog = "$linkmode"; then
  7627. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  7628. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  7629. else
  7630. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7631. test -n "$add" && deplibs="$add $deplibs"
  7632. if test yes != "$hardcode_direct" &&
  7633. test yes != "$hardcode_minus_L" &&
  7634. test yes = "$hardcode_shlibpath_var"; then
  7635. case :$finalize_shlibpath: in
  7636. *":$libdir:"*) ;;
  7637. *) func_append finalize_shlibpath "$libdir:" ;;
  7638. esac
  7639. fi
  7640. fi
  7641. fi
  7642. if test prog = "$linkmode" || test relink = "$opt_mode"; then
  7643. add_shlibpath=
  7644. add_dir=
  7645. add=
  7646. # Finalize command for both is simple: just hardcode it.
  7647. if test yes = "$hardcode_direct" &&
  7648. test no = "$hardcode_direct_absolute"; then
  7649. add=$libdir/$linklib
  7650. elif test yes = "$hardcode_minus_L"; then
  7651. add_dir=-L$libdir
  7652. add=-l$name
  7653. elif test yes = "$hardcode_shlibpath_var"; then
  7654. case :$finalize_shlibpath: in
  7655. *":$libdir:"*) ;;
  7656. *) func_append finalize_shlibpath "$libdir:" ;;
  7657. esac
  7658. add=-l$name
  7659. elif test yes = "$hardcode_automatic"; then
  7660. if test -n "$inst_prefix_dir" &&
  7661. test -f "$inst_prefix_dir$libdir/$linklib"; then
  7662. add=$inst_prefix_dir$libdir/$linklib
  7663. else
  7664. add=$libdir/$linklib
  7665. fi
  7666. else
  7667. # We cannot seem to hardcode it, guess we'll fake it.
  7668. add_dir=-L$libdir
  7669. # Try looking first in the location we're being installed to.
  7670. if test -n "$inst_prefix_dir"; then
  7671. case $libdir in
  7672. [\\/]*)
  7673. func_append add_dir " -L$inst_prefix_dir$libdir"
  7674. ;;
  7675. esac
  7676. fi
  7677. add=-l$name
  7678. fi
  7679. if test prog = "$linkmode"; then
  7680. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  7681. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  7682. else
  7683. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7684. test -n "$add" && deplibs="$add $deplibs"
  7685. fi
  7686. fi
  7687. elif test prog = "$linkmode"; then
  7688. # Here we assume that one of hardcode_direct or hardcode_minus_L
  7689. # is not unsupported. This is valid on all known static and
  7690. # shared platforms.
  7691. if test unsupported != "$hardcode_direct"; then
  7692. test -n "$old_library" && linklib=$old_library
  7693. compile_deplibs="$dir/$linklib $compile_deplibs"
  7694. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  7695. else
  7696. compile_deplibs="-l$name -L$dir $compile_deplibs"
  7697. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  7698. fi
  7699. elif test yes = "$build_libtool_libs"; then
  7700. # Not a shared library
  7701. if test pass_all != "$deplibs_check_method"; then
  7702. # We're trying link a shared library against a static one
  7703. # but the system doesn't support it.
  7704. # Just print a warning and add the library to dependency_libs so
  7705. # that the program can be linked against the static library.
  7706. echo
  7707. $ECHO "*** Warning: This system cannot link to static lib archive $lib."
  7708. echo "*** I have the capability to make that library automatically link in when"
  7709. echo "*** you link to this library. But I can only do this if you have a"
  7710. echo "*** shared version of the library, which you do not appear to have."
  7711. if test yes = "$module"; then
  7712. echo "*** But as you try to build a module library, libtool will still create "
  7713. echo "*** a static module, that should work as long as the dlopening application"
  7714. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  7715. if test -z "$global_symbol_pipe"; then
  7716. echo
  7717. echo "*** However, this would only work if libtool was able to extract symbol"
  7718. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  7719. echo "*** not find such a program. So, this module is probably useless."
  7720. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  7721. fi
  7722. if test no = "$build_old_libs"; then
  7723. build_libtool_libs=module
  7724. build_old_libs=yes
  7725. else
  7726. build_libtool_libs=no
  7727. fi
  7728. fi
  7729. else
  7730. deplibs="$dir/$old_library $deplibs"
  7731. link_static=yes
  7732. fi
  7733. fi # link shared/static library?
  7734. if test lib = "$linkmode"; then
  7735. if test -n "$dependency_libs" &&
  7736. { test yes != "$hardcode_into_libs" ||
  7737. test yes = "$build_old_libs" ||
  7738. test yes = "$link_static"; }; then
  7739. # Extract -R from dependency_libs
  7740. temp_deplibs=
  7741. for libdir in $dependency_libs; do
  7742. case $libdir in
  7743. -R*) func_stripname '-R' '' "$libdir"
  7744. temp_xrpath=$func_stripname_result
  7745. case " $xrpath " in
  7746. *" $temp_xrpath "*) ;;
  7747. *) func_append xrpath " $temp_xrpath";;
  7748. esac;;
  7749. *) func_append temp_deplibs " $libdir";;
  7750. esac
  7751. done
  7752. dependency_libs=$temp_deplibs
  7753. fi
  7754. func_append newlib_search_path " $absdir"
  7755. # Link against this library
  7756. test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  7757. # ... and its dependency_libs
  7758. tmp_libs=
  7759. for deplib in $dependency_libs; do
  7760. newdependency_libs="$deplib $newdependency_libs"
  7761. case $deplib in
  7762. -L*) func_stripname '-L' '' "$deplib"
  7763. func_resolve_sysroot "$func_stripname_result";;
  7764. *) func_resolve_sysroot "$deplib" ;;
  7765. esac
  7766. if $opt_preserve_dup_deps; then
  7767. case "$tmp_libs " in
  7768. *" $func_resolve_sysroot_result "*)
  7769. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  7770. esac
  7771. fi
  7772. func_append tmp_libs " $func_resolve_sysroot_result"
  7773. done
  7774. if test no != "$link_all_deplibs"; then
  7775. # Add the search paths of all dependency libraries
  7776. for deplib in $dependency_libs; do
  7777. path=
  7778. case $deplib in
  7779. -L*) path=$deplib ;;
  7780. *.la)
  7781. func_resolve_sysroot "$deplib"
  7782. deplib=$func_resolve_sysroot_result
  7783. func_dirname "$deplib" "" "."
  7784. dir=$func_dirname_result
  7785. # We need an absolute path.
  7786. case $dir in
  7787. [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
  7788. *)
  7789. absdir=`cd "$dir" && pwd`
  7790. if test -z "$absdir"; then
  7791. func_warning "cannot determine absolute directory name of '$dir'"
  7792. absdir=$dir
  7793. fi
  7794. ;;
  7795. esac
  7796. if $GREP "^installed=no" $deplib > /dev/null; then
  7797. case $host in
  7798. *-*-darwin*)
  7799. depdepl=
  7800. eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  7801. if test -n "$deplibrary_names"; then
  7802. for tmp in $deplibrary_names; do
  7803. depdepl=$tmp
  7804. done
  7805. if test -f "$absdir/$objdir/$depdepl"; then
  7806. depdepl=$absdir/$objdir/$depdepl
  7807. darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7808. if test -z "$darwin_install_name"; then
  7809. darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7810. fi
  7811. func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
  7812. func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
  7813. path=
  7814. fi
  7815. fi
  7816. ;;
  7817. *)
  7818. path=-L$absdir/$objdir
  7819. ;;
  7820. esac
  7821. else
  7822. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7823. test -z "$libdir" && \
  7824. func_fatal_error "'$deplib' is not a valid libtool archive"
  7825. test "$absdir" != "$libdir" && \
  7826. func_warning "'$deplib' seems to be moved"
  7827. path=-L$absdir
  7828. fi
  7829. ;;
  7830. esac
  7831. case " $deplibs " in
  7832. *" $path "*) ;;
  7833. *) deplibs="$path $deplibs" ;;
  7834. esac
  7835. done
  7836. fi # link_all_deplibs != no
  7837. fi # linkmode = lib
  7838. done # for deplib in $libs
  7839. if test link = "$pass"; then
  7840. if test prog = "$linkmode"; then
  7841. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  7842. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  7843. else
  7844. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7845. fi
  7846. fi
  7847. dependency_libs=$newdependency_libs
  7848. if test dlpreopen = "$pass"; then
  7849. # Link the dlpreopened libraries before other libraries
  7850. for deplib in $save_deplibs; do
  7851. deplibs="$deplib $deplibs"
  7852. done
  7853. fi
  7854. if test dlopen != "$pass"; then
  7855. test conv = "$pass" || {
  7856. # Make sure lib_search_path contains only unique directories.
  7857. lib_search_path=
  7858. for dir in $newlib_search_path; do
  7859. case "$lib_search_path " in
  7860. *" $dir "*) ;;
  7861. *) func_append lib_search_path " $dir" ;;
  7862. esac
  7863. done
  7864. newlib_search_path=
  7865. }
  7866. if test prog,link = "$linkmode,$pass"; then
  7867. vars="compile_deplibs finalize_deplibs"
  7868. else
  7869. vars=deplibs
  7870. fi
  7871. for var in $vars dependency_libs; do
  7872. # Add libraries to $var in reverse order
  7873. eval tmp_libs=\"\$$var\"
  7874. new_libs=
  7875. for deplib in $tmp_libs; do
  7876. # FIXME: Pedantically, this is the right thing to do, so
  7877. # that some nasty dependency loop isn't accidentally
  7878. # broken:
  7879. #new_libs="$deplib $new_libs"
  7880. # Pragmatically, this seems to cause very few problems in
  7881. # practice:
  7882. case $deplib in
  7883. -L*) new_libs="$deplib $new_libs" ;;
  7884. -R*) ;;
  7885. *)
  7886. # And here is the reason: when a library appears more
  7887. # than once as an explicit dependence of a library, or
  7888. # is implicitly linked in more than once by the
  7889. # compiler, it is considered special, and multiple
  7890. # occurrences thereof are not removed. Compare this
  7891. # with having the same library being listed as a
  7892. # dependency of multiple other libraries: in this case,
  7893. # we know (pedantically, we assume) the library does not
  7894. # need to be listed more than once, so we keep only the
  7895. # last copy. This is not always right, but it is rare
  7896. # enough that we require users that really mean to play
  7897. # such unportable linking tricks to link the library
  7898. # using -Wl,-lname, so that libtool does not consider it
  7899. # for duplicate removal.
  7900. case " $specialdeplibs " in
  7901. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  7902. *)
  7903. case " $new_libs " in
  7904. *" $deplib "*) ;;
  7905. *) new_libs="$deplib $new_libs" ;;
  7906. esac
  7907. ;;
  7908. esac
  7909. ;;
  7910. esac
  7911. done
  7912. tmp_libs=
  7913. for deplib in $new_libs; do
  7914. case $deplib in
  7915. -L*)
  7916. case " $tmp_libs " in
  7917. *" $deplib "*) ;;
  7918. *) func_append tmp_libs " $deplib" ;;
  7919. esac
  7920. ;;
  7921. *) func_append tmp_libs " $deplib" ;;
  7922. esac
  7923. done
  7924. eval $var=\"$tmp_libs\"
  7925. done # for var
  7926. fi
  7927. # Add Sun CC postdeps if required:
  7928. test CXX = "$tagname" && {
  7929. case $host_os in
  7930. linux*)
  7931. case `$CC -V 2>&1 | sed 5q` in
  7932. *Sun\ C*) # Sun C++ 5.9
  7933. func_suncc_cstd_abi
  7934. if test no != "$suncc_use_cstd_abi"; then
  7935. func_append postdeps ' -library=Cstd -library=Crun'
  7936. fi
  7937. ;;
  7938. esac
  7939. ;;
  7940. solaris*)
  7941. func_cc_basename "$CC"
  7942. case $func_cc_basename_result in
  7943. CC* | sunCC*)
  7944. func_suncc_cstd_abi
  7945. if test no != "$suncc_use_cstd_abi"; then
  7946. func_append postdeps ' -library=Cstd -library=Crun'
  7947. fi
  7948. ;;
  7949. esac
  7950. ;;
  7951. esac
  7952. }
  7953. # Last step: remove runtime libs from dependency_libs
  7954. # (they stay in deplibs)
  7955. tmp_libs=
  7956. for i in $dependency_libs; do
  7957. case " $predeps $postdeps $compiler_lib_search_path " in
  7958. *" $i "*)
  7959. i=
  7960. ;;
  7961. esac
  7962. if test -n "$i"; then
  7963. func_append tmp_libs " $i"
  7964. fi
  7965. done
  7966. dependency_libs=$tmp_libs
  7967. done # for pass
  7968. if test prog = "$linkmode"; then
  7969. dlfiles=$newdlfiles
  7970. fi
  7971. if test prog = "$linkmode" || test lib = "$linkmode"; then
  7972. dlprefiles=$newdlprefiles
  7973. fi
  7974. case $linkmode in
  7975. oldlib)
  7976. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  7977. func_warning "'-dlopen' is ignored for archives"
  7978. fi
  7979. case " $deplibs" in
  7980. *\ -l* | *\ -L*)
  7981. func_warning "'-l' and '-L' are ignored for archives" ;;
  7982. esac
  7983. test -n "$rpath" && \
  7984. func_warning "'-rpath' is ignored for archives"
  7985. test -n "$xrpath" && \
  7986. func_warning "'-R' is ignored for archives"
  7987. test -n "$vinfo" && \
  7988. func_warning "'-version-info/-version-number' is ignored for archives"
  7989. test -n "$release" && \
  7990. func_warning "'-release' is ignored for archives"
  7991. test -n "$export_symbols$export_symbols_regex" && \
  7992. func_warning "'-export-symbols' is ignored for archives"
  7993. # Now set the variables for building old libraries.
  7994. build_libtool_libs=no
  7995. oldlibs=$output
  7996. func_append objs "$old_deplibs"
  7997. ;;
  7998. lib)
  7999. # Make sure we only generate libraries of the form 'libNAME.la'.
  8000. case $outputname in
  8001. lib*)
  8002. func_stripname 'lib' '.la' "$outputname"
  8003. name=$func_stripname_result
  8004. eval shared_ext=\"$shrext_cmds\"
  8005. eval libname=\"$libname_spec\"
  8006. ;;
  8007. *)
  8008. test no = "$module" \
  8009. && func_fatal_help "libtool library '$output' must begin with 'lib'"
  8010. if test no != "$need_lib_prefix"; then
  8011. # Add the "lib" prefix for modules if required
  8012. func_stripname '' '.la' "$outputname"
  8013. name=$func_stripname_result
  8014. eval shared_ext=\"$shrext_cmds\"
  8015. eval libname=\"$libname_spec\"
  8016. else
  8017. func_stripname '' '.la' "$outputname"
  8018. libname=$func_stripname_result
  8019. fi
  8020. ;;
  8021. esac
  8022. if test -n "$objs"; then
  8023. if test pass_all != "$deplibs_check_method"; then
  8024. func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
  8025. else
  8026. echo
  8027. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  8028. $ECHO "*** objects $objs is not portable!"
  8029. func_append libobjs " $objs"
  8030. fi
  8031. fi
  8032. test no = "$dlself" \
  8033. || func_warning "'-dlopen self' is ignored for libtool libraries"
  8034. set dummy $rpath
  8035. shift
  8036. test 1 -lt "$#" \
  8037. && func_warning "ignoring multiple '-rpath's for a libtool library"
  8038. install_libdir=$1
  8039. oldlibs=
  8040. if test -z "$rpath"; then
  8041. if test yes = "$build_libtool_libs"; then
  8042. # Building a libtool convenience library.
  8043. # Some compilers have problems with a '.al' extension so
  8044. # convenience libraries should have the same extension an
  8045. # archive normally would.
  8046. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  8047. build_libtool_libs=convenience
  8048. build_old_libs=yes
  8049. fi
  8050. test -n "$vinfo" && \
  8051. func_warning "'-version-info/-version-number' is ignored for convenience libraries"
  8052. test -n "$release" && \
  8053. func_warning "'-release' is ignored for convenience libraries"
  8054. else
  8055. # Parse the version information argument.
  8056. save_ifs=$IFS; IFS=:
  8057. set dummy $vinfo 0 0 0
  8058. shift
  8059. IFS=$save_ifs
  8060. test -n "$7" && \
  8061. func_fatal_help "too many parameters to '-version-info'"
  8062. # convert absolute version numbers to libtool ages
  8063. # this retains compatibility with .la files and attempts
  8064. # to make the code below a bit more comprehensible
  8065. case $vinfo_number in
  8066. yes)
  8067. number_major=$1
  8068. number_minor=$2
  8069. number_revision=$3
  8070. #
  8071. # There are really only two kinds -- those that
  8072. # use the current revision as the major version
  8073. # and those that subtract age and use age as
  8074. # a minor version. But, then there is irix
  8075. # that has an extra 1 added just for fun
  8076. #
  8077. case $version_type in
  8078. # correct linux to gnu/linux during the next big refactor
  8079. darwin|freebsd-elf|linux|osf|windows|none)
  8080. func_arith $number_major + $number_minor
  8081. current=$func_arith_result
  8082. age=$number_minor
  8083. revision=$number_revision
  8084. ;;
  8085. freebsd-aout|qnx|sunos)
  8086. current=$number_major
  8087. revision=$number_minor
  8088. age=0
  8089. ;;
  8090. irix|nonstopux)
  8091. func_arith $number_major + $number_minor
  8092. current=$func_arith_result
  8093. age=$number_minor
  8094. revision=$number_minor
  8095. lt_irix_increment=no
  8096. ;;
  8097. esac
  8098. ;;
  8099. no)
  8100. current=$1
  8101. revision=$2
  8102. age=$3
  8103. ;;
  8104. esac
  8105. # Check that each of the things are valid numbers.
  8106. case $current in
  8107. 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]) ;;
  8108. *)
  8109. func_error "CURRENT '$current' must be a nonnegative integer"
  8110. func_fatal_error "'$vinfo' is not valid version information"
  8111. ;;
  8112. esac
  8113. case $revision in
  8114. 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]) ;;
  8115. *)
  8116. func_error "REVISION '$revision' must be a nonnegative integer"
  8117. func_fatal_error "'$vinfo' is not valid version information"
  8118. ;;
  8119. esac
  8120. case $age in
  8121. 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]) ;;
  8122. *)
  8123. func_error "AGE '$age' must be a nonnegative integer"
  8124. func_fatal_error "'$vinfo' is not valid version information"
  8125. ;;
  8126. esac
  8127. if test "$age" -gt "$current"; then
  8128. func_error "AGE '$age' is greater than the current interface number '$current'"
  8129. func_fatal_error "'$vinfo' is not valid version information"
  8130. fi
  8131. # Calculate the version variables.
  8132. major=
  8133. versuffix=
  8134. verstring=
  8135. case $version_type in
  8136. none) ;;
  8137. darwin)
  8138. # Like Linux, but with the current version available in
  8139. # verstring for coding it into the library header
  8140. func_arith $current - $age
  8141. major=.$func_arith_result
  8142. versuffix=$major.$age.$revision
  8143. # Darwin ld doesn't like 0 for these options...
  8144. func_arith $current + 1
  8145. minor_current=$func_arith_result
  8146. xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8147. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8148. # On Darwin other compilers
  8149. case $CC in
  8150. nagfor*)
  8151. verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8152. ;;
  8153. *)
  8154. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8155. ;;
  8156. esac
  8157. ;;
  8158. freebsd-aout)
  8159. major=.$current
  8160. versuffix=.$current.$revision
  8161. ;;
  8162. freebsd-elf)
  8163. func_arith $current - $age
  8164. major=.$func_arith_result
  8165. versuffix=$major.$age.$revision
  8166. ;;
  8167. irix | nonstopux)
  8168. if test no = "$lt_irix_increment"; then
  8169. func_arith $current - $age
  8170. else
  8171. func_arith $current - $age + 1
  8172. fi
  8173. major=$func_arith_result
  8174. case $version_type in
  8175. nonstopux) verstring_prefix=nonstopux ;;
  8176. *) verstring_prefix=sgi ;;
  8177. esac
  8178. verstring=$verstring_prefix$major.$revision
  8179. # Add in all the interfaces that we are compatible with.
  8180. loop=$revision
  8181. while test 0 -ne "$loop"; do
  8182. func_arith $revision - $loop
  8183. iface=$func_arith_result
  8184. func_arith $loop - 1
  8185. loop=$func_arith_result
  8186. verstring=$verstring_prefix$major.$iface:$verstring
  8187. done
  8188. # Before this point, $major must not contain '.'.
  8189. major=.$major
  8190. versuffix=$major.$revision
  8191. ;;
  8192. linux) # correct to gnu/linux during the next big refactor
  8193. func_arith $current - $age
  8194. major=.$func_arith_result
  8195. versuffix=$major.$age.$revision
  8196. ;;
  8197. osf)
  8198. func_arith $current - $age
  8199. major=.$func_arith_result
  8200. versuffix=.$current.$age.$revision
  8201. verstring=$current.$age.$revision
  8202. # Add in all the interfaces that we are compatible with.
  8203. loop=$age
  8204. while test 0 -ne "$loop"; do
  8205. func_arith $current - $loop
  8206. iface=$func_arith_result
  8207. func_arith $loop - 1
  8208. loop=$func_arith_result
  8209. verstring=$verstring:$iface.0
  8210. done
  8211. # Make executables depend on our current version.
  8212. func_append verstring ":$current.0"
  8213. ;;
  8214. qnx)
  8215. major=.$current
  8216. versuffix=.$current
  8217. ;;
  8218. sco)
  8219. major=.$current
  8220. versuffix=.$current
  8221. ;;
  8222. sunos)
  8223. major=.$current
  8224. versuffix=.$current.$revision
  8225. ;;
  8226. windows)
  8227. # Use '-' rather than '.', since we only want one
  8228. # extension on DOS 8.3 file systems.
  8229. func_arith $current - $age
  8230. major=$func_arith_result
  8231. versuffix=-$major
  8232. ;;
  8233. *)
  8234. func_fatal_configuration "unknown library version type '$version_type'"
  8235. ;;
  8236. esac
  8237. # Clear the version info if we defaulted, and they specified a release.
  8238. if test -z "$vinfo" && test -n "$release"; then
  8239. major=
  8240. case $version_type in
  8241. darwin)
  8242. # we can't check for "0.0" in archive_cmds due to quoting
  8243. # problems, so we reset it completely
  8244. verstring=
  8245. ;;
  8246. *)
  8247. verstring=0.0
  8248. ;;
  8249. esac
  8250. if test no = "$need_version"; then
  8251. versuffix=
  8252. else
  8253. versuffix=.0.0
  8254. fi
  8255. fi
  8256. # Remove version info from name if versioning should be avoided
  8257. if test yes,no = "$avoid_version,$need_version"; then
  8258. major=
  8259. versuffix=
  8260. verstring=
  8261. fi
  8262. # Check to see if the archive will have undefined symbols.
  8263. if test yes = "$allow_undefined"; then
  8264. if test unsupported = "$allow_undefined_flag"; then
  8265. if test yes = "$build_old_libs"; then
  8266. func_warning "undefined symbols not allowed in $host shared libraries; building static only"
  8267. build_libtool_libs=no
  8268. else
  8269. func_fatal_error "can't build $host shared library unless -no-undefined is specified"
  8270. fi
  8271. fi
  8272. else
  8273. # Don't allow undefined symbols.
  8274. allow_undefined_flag=$no_undefined_flag
  8275. fi
  8276. fi
  8277. func_generate_dlsyms "$libname" "$libname" :
  8278. func_append libobjs " $symfileobj"
  8279. test " " = "$libobjs" && libobjs=
  8280. if test relink != "$opt_mode"; then
  8281. # Remove our outputs, but don't remove object files since they
  8282. # may have been created when compiling PIC objects.
  8283. removelist=
  8284. tempremovelist=`$ECHO "$output_objdir/*"`
  8285. for p in $tempremovelist; do
  8286. case $p in
  8287. *.$objext | *.gcno)
  8288. ;;
  8289. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
  8290. if test -n "$precious_files_regex"; then
  8291. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  8292. then
  8293. continue
  8294. fi
  8295. fi
  8296. func_append removelist " $p"
  8297. ;;
  8298. *) ;;
  8299. esac
  8300. done
  8301. test -n "$removelist" && \
  8302. func_show_eval "${RM}r \$removelist"
  8303. fi
  8304. # Now set the variables for building old libraries.
  8305. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
  8306. func_append oldlibs " $output_objdir/$libname.$libext"
  8307. # Transform .lo files to .o files.
  8308. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
  8309. fi
  8310. # Eliminate all temporary directories.
  8311. #for path in $notinst_path; do
  8312. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  8313. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  8314. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  8315. #done
  8316. if test -n "$xrpath"; then
  8317. # If the user specified any rpath flags, then add them.
  8318. temp_xrpath=
  8319. for libdir in $xrpath; do
  8320. func_replace_sysroot "$libdir"
  8321. func_append temp_xrpath " -R$func_replace_sysroot_result"
  8322. case "$finalize_rpath " in
  8323. *" $libdir "*) ;;
  8324. *) func_append finalize_rpath " $libdir" ;;
  8325. esac
  8326. done
  8327. if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
  8328. dependency_libs="$temp_xrpath $dependency_libs"
  8329. fi
  8330. fi
  8331. # Make sure dlfiles contains only unique files that won't be dlpreopened
  8332. old_dlfiles=$dlfiles
  8333. dlfiles=
  8334. for lib in $old_dlfiles; do
  8335. case " $dlprefiles $dlfiles " in
  8336. *" $lib "*) ;;
  8337. *) func_append dlfiles " $lib" ;;
  8338. esac
  8339. done
  8340. # Make sure dlprefiles contains only unique files
  8341. old_dlprefiles=$dlprefiles
  8342. dlprefiles=
  8343. for lib in $old_dlprefiles; do
  8344. case "$dlprefiles " in
  8345. *" $lib "*) ;;
  8346. *) func_append dlprefiles " $lib" ;;
  8347. esac
  8348. done
  8349. if test yes = "$build_libtool_libs"; then
  8350. if test -n "$rpath"; then
  8351. case $host in
  8352. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  8353. # these systems don't actually have a c library (as such)!
  8354. ;;
  8355. *-*-rhapsody* | *-*-darwin1.[012])
  8356. # Rhapsody C library is in the System framework
  8357. func_append deplibs " System.ltframework"
  8358. ;;
  8359. *-*-netbsd*)
  8360. # Don't link with libc until the a.out ld.so is fixed.
  8361. ;;
  8362. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  8363. # Do not include libc due to us having libc/libc_r.
  8364. ;;
  8365. *-*-sco3.2v5* | *-*-sco5v6*)
  8366. # Causes problems with __ctype
  8367. ;;
  8368. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  8369. # Compiler inserts libc in the correct place for threads to work
  8370. ;;
  8371. *)
  8372. # Add libc to deplibs on all other systems if necessary.
  8373. if test yes = "$build_libtool_need_lc"; then
  8374. func_append deplibs " -lc"
  8375. fi
  8376. ;;
  8377. esac
  8378. fi
  8379. # Transform deplibs into only deplibs that can be linked in shared.
  8380. name_save=$name
  8381. libname_save=$libname
  8382. release_save=$release
  8383. versuffix_save=$versuffix
  8384. major_save=$major
  8385. # I'm not sure if I'm treating the release correctly. I think
  8386. # release should show up in the -l (ie -lgmp5) so we don't want to
  8387. # add it in twice. Is that correct?
  8388. release=
  8389. versuffix=
  8390. major=
  8391. newdeplibs=
  8392. droppeddeps=no
  8393. case $deplibs_check_method in
  8394. pass_all)
  8395. # Don't check for shared/static. Everything works.
  8396. # This might be a little naive. We might want to check
  8397. # whether the library exists or not. But this is on
  8398. # osf3 & osf4 and I'm not really sure... Just
  8399. # implementing what was already the behavior.
  8400. newdeplibs=$deplibs
  8401. ;;
  8402. test_compile)
  8403. # This code stresses the "libraries are programs" paradigm to its
  8404. # limits. Maybe even breaks it. We compile a program, linking it
  8405. # against the deplibs as a proxy for the library. Then we can check
  8406. # whether they linked in statically or dynamically with ldd.
  8407. $opt_dry_run || $RM conftest.c
  8408. cat > conftest.c <<EOF
  8409. int main() { return 0; }
  8410. EOF
  8411. $opt_dry_run || $RM conftest
  8412. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  8413. ldd_output=`ldd conftest`
  8414. for i in $deplibs; do
  8415. case $i in
  8416. -l*)
  8417. func_stripname -l '' "$i"
  8418. name=$func_stripname_result
  8419. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8420. case " $predeps $postdeps " in
  8421. *" $i "*)
  8422. func_append newdeplibs " $i"
  8423. i=
  8424. ;;
  8425. esac
  8426. fi
  8427. if test -n "$i"; then
  8428. libname=`eval "\\$ECHO \"$libname_spec\""`
  8429. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8430. set dummy $deplib_matches; shift
  8431. deplib_match=$1
  8432. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8433. func_append newdeplibs " $i"
  8434. else
  8435. droppeddeps=yes
  8436. echo
  8437. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8438. echo "*** I have the capability to make that library automatically link in when"
  8439. echo "*** you link to this library. But I can only do this if you have a"
  8440. echo "*** shared version of the library, which I believe you do not have"
  8441. echo "*** because a test_compile did reveal that the linker did not use it for"
  8442. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  8443. fi
  8444. fi
  8445. ;;
  8446. *)
  8447. func_append newdeplibs " $i"
  8448. ;;
  8449. esac
  8450. done
  8451. else
  8452. # Error occurred in the first compile. Let's try to salvage
  8453. # the situation: Compile a separate program for each library.
  8454. for i in $deplibs; do
  8455. case $i in
  8456. -l*)
  8457. func_stripname -l '' "$i"
  8458. name=$func_stripname_result
  8459. $opt_dry_run || $RM conftest
  8460. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  8461. ldd_output=`ldd conftest`
  8462. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8463. case " $predeps $postdeps " in
  8464. *" $i "*)
  8465. func_append newdeplibs " $i"
  8466. i=
  8467. ;;
  8468. esac
  8469. fi
  8470. if test -n "$i"; then
  8471. libname=`eval "\\$ECHO \"$libname_spec\""`
  8472. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8473. set dummy $deplib_matches; shift
  8474. deplib_match=$1
  8475. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8476. func_append newdeplibs " $i"
  8477. else
  8478. droppeddeps=yes
  8479. echo
  8480. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8481. echo "*** I have the capability to make that library automatically link in when"
  8482. echo "*** you link to this library. But I can only do this if you have a"
  8483. echo "*** shared version of the library, which you do not appear to have"
  8484. echo "*** because a test_compile did reveal that the linker did not use this one"
  8485. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  8486. fi
  8487. fi
  8488. else
  8489. droppeddeps=yes
  8490. echo
  8491. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  8492. echo "*** make it link in! You will probably need to install it or some"
  8493. echo "*** library that it depends on before this library will be fully"
  8494. echo "*** functional. Installing it before continuing would be even better."
  8495. fi
  8496. ;;
  8497. *)
  8498. func_append newdeplibs " $i"
  8499. ;;
  8500. esac
  8501. done
  8502. fi
  8503. ;;
  8504. file_magic*)
  8505. set dummy $deplibs_check_method; shift
  8506. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8507. for a_deplib in $deplibs; do
  8508. case $a_deplib in
  8509. -l*)
  8510. func_stripname -l '' "$a_deplib"
  8511. name=$func_stripname_result
  8512. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8513. case " $predeps $postdeps " in
  8514. *" $a_deplib "*)
  8515. func_append newdeplibs " $a_deplib"
  8516. a_deplib=
  8517. ;;
  8518. esac
  8519. fi
  8520. if test -n "$a_deplib"; then
  8521. libname=`eval "\\$ECHO \"$libname_spec\""`
  8522. if test -n "$file_magic_glob"; then
  8523. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  8524. else
  8525. libnameglob=$libname
  8526. fi
  8527. test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  8528. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8529. if test yes = "$want_nocaseglob"; then
  8530. shopt -s nocaseglob
  8531. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8532. $nocaseglob
  8533. else
  8534. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8535. fi
  8536. for potent_lib in $potential_libs; do
  8537. # Follow soft links.
  8538. if ls -lLd "$potent_lib" 2>/dev/null |
  8539. $GREP " -> " >/dev/null; then
  8540. continue
  8541. fi
  8542. # The statement above tries to avoid entering an
  8543. # endless loop below, in case of cyclic links.
  8544. # We might still enter an endless loop, since a link
  8545. # loop can be closed while we follow links,
  8546. # but so what?
  8547. potlib=$potent_lib
  8548. while test -h "$potlib" 2>/dev/null; do
  8549. potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  8550. case $potliblink in
  8551. [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  8552. *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  8553. esac
  8554. done
  8555. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  8556. $SED -e 10q |
  8557. $EGREP "$file_magic_regex" > /dev/null; then
  8558. func_append newdeplibs " $a_deplib"
  8559. a_deplib=
  8560. break 2
  8561. fi
  8562. done
  8563. done
  8564. fi
  8565. if test -n "$a_deplib"; then
  8566. droppeddeps=yes
  8567. echo
  8568. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8569. echo "*** I have the capability to make that library automatically link in when"
  8570. echo "*** you link to this library. But I can only do this if you have a"
  8571. echo "*** shared version of the library, which you do not appear to have"
  8572. echo "*** because I did check the linker path looking for a file starting"
  8573. if test -z "$potlib"; then
  8574. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  8575. else
  8576. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8577. $ECHO "*** using a file magic. Last file checked: $potlib"
  8578. fi
  8579. fi
  8580. ;;
  8581. *)
  8582. # Add a -L argument.
  8583. func_append newdeplibs " $a_deplib"
  8584. ;;
  8585. esac
  8586. done # Gone through all deplibs.
  8587. ;;
  8588. match_pattern*)
  8589. set dummy $deplibs_check_method; shift
  8590. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8591. for a_deplib in $deplibs; do
  8592. case $a_deplib in
  8593. -l*)
  8594. func_stripname -l '' "$a_deplib"
  8595. name=$func_stripname_result
  8596. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8597. case " $predeps $postdeps " in
  8598. *" $a_deplib "*)
  8599. func_append newdeplibs " $a_deplib"
  8600. a_deplib=
  8601. ;;
  8602. esac
  8603. fi
  8604. if test -n "$a_deplib"; then
  8605. libname=`eval "\\$ECHO \"$libname_spec\""`
  8606. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8607. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  8608. for potent_lib in $potential_libs; do
  8609. potlib=$potent_lib # see symlink-check above in file_magic test
  8610. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  8611. $EGREP "$match_pattern_regex" > /dev/null; then
  8612. func_append newdeplibs " $a_deplib"
  8613. a_deplib=
  8614. break 2
  8615. fi
  8616. done
  8617. done
  8618. fi
  8619. if test -n "$a_deplib"; then
  8620. droppeddeps=yes
  8621. echo
  8622. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8623. echo "*** I have the capability to make that library automatically link in when"
  8624. echo "*** you link to this library. But I can only do this if you have a"
  8625. echo "*** shared version of the library, which you do not appear to have"
  8626. echo "*** because I did check the linker path looking for a file starting"
  8627. if test -z "$potlib"; then
  8628. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  8629. else
  8630. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8631. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  8632. fi
  8633. fi
  8634. ;;
  8635. *)
  8636. # Add a -L argument.
  8637. func_append newdeplibs " $a_deplib"
  8638. ;;
  8639. esac
  8640. done # Gone through all deplibs.
  8641. ;;
  8642. none | unknown | *)
  8643. newdeplibs=
  8644. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  8645. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8646. for i in $predeps $postdeps; do
  8647. # can't use Xsed below, because $i might contain '/'
  8648. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  8649. done
  8650. fi
  8651. case $tmp_deplibs in
  8652. *[!\ \ ]*)
  8653. echo
  8654. if test none = "$deplibs_check_method"; then
  8655. echo "*** Warning: inter-library dependencies are not supported in this platform."
  8656. else
  8657. echo "*** Warning: inter-library dependencies are not known to be supported."
  8658. fi
  8659. echo "*** All declared inter-library dependencies are being dropped."
  8660. droppeddeps=yes
  8661. ;;
  8662. esac
  8663. ;;
  8664. esac
  8665. versuffix=$versuffix_save
  8666. major=$major_save
  8667. release=$release_save
  8668. libname=$libname_save
  8669. name=$name_save
  8670. case $host in
  8671. *-*-rhapsody* | *-*-darwin1.[012])
  8672. # On Rhapsody replace the C library with the System framework
  8673. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  8674. ;;
  8675. esac
  8676. if test yes = "$droppeddeps"; then
  8677. if test yes = "$module"; then
  8678. echo
  8679. echo "*** Warning: libtool could not satisfy all declared inter-library"
  8680. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  8681. echo "*** a static module, that should work as long as the dlopening"
  8682. echo "*** application is linked with the -dlopen flag."
  8683. if test -z "$global_symbol_pipe"; then
  8684. echo
  8685. echo "*** However, this would only work if libtool was able to extract symbol"
  8686. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  8687. echo "*** not find such a program. So, this module is probably useless."
  8688. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  8689. fi
  8690. if test no = "$build_old_libs"; then
  8691. oldlibs=$output_objdir/$libname.$libext
  8692. build_libtool_libs=module
  8693. build_old_libs=yes
  8694. else
  8695. build_libtool_libs=no
  8696. fi
  8697. else
  8698. echo "*** The inter-library dependencies that have been dropped here will be"
  8699. echo "*** automatically added whenever a program is linked with this library"
  8700. echo "*** or is declared to -dlopen it."
  8701. if test no = "$allow_undefined"; then
  8702. echo
  8703. echo "*** Since this library must not contain undefined symbols,"
  8704. echo "*** because either the platform does not support them or"
  8705. echo "*** it was explicitly requested with -no-undefined,"
  8706. echo "*** libtool will only create a static version of it."
  8707. if test no = "$build_old_libs"; then
  8708. oldlibs=$output_objdir/$libname.$libext
  8709. build_libtool_libs=module
  8710. build_old_libs=yes
  8711. else
  8712. build_libtool_libs=no
  8713. fi
  8714. fi
  8715. fi
  8716. fi
  8717. # Done checking deplibs!
  8718. deplibs=$newdeplibs
  8719. fi
  8720. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  8721. case $host in
  8722. *-*-darwin*)
  8723. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8724. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8725. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8726. ;;
  8727. esac
  8728. # move library search paths that coincide with paths to not yet
  8729. # installed libraries to the beginning of the library search list
  8730. new_libs=
  8731. for path in $notinst_path; do
  8732. case " $new_libs " in
  8733. *" -L$path/$objdir "*) ;;
  8734. *)
  8735. case " $deplibs " in
  8736. *" -L$path/$objdir "*)
  8737. func_append new_libs " -L$path/$objdir" ;;
  8738. esac
  8739. ;;
  8740. esac
  8741. done
  8742. for deplib in $deplibs; do
  8743. case $deplib in
  8744. -L*)
  8745. case " $new_libs " in
  8746. *" $deplib "*) ;;
  8747. *) func_append new_libs " $deplib" ;;
  8748. esac
  8749. ;;
  8750. *) func_append new_libs " $deplib" ;;
  8751. esac
  8752. done
  8753. deplibs=$new_libs
  8754. # All the library-specific variables (install_libdir is set above).
  8755. library_names=
  8756. old_library=
  8757. dlname=
  8758. # Test again, we may have decided not to build it any more
  8759. if test yes = "$build_libtool_libs"; then
  8760. # Remove $wl instances when linking with ld.
  8761. # FIXME: should test the right _cmds variable.
  8762. case $archive_cmds in
  8763. *\$LD\ *) wl= ;;
  8764. esac
  8765. if test yes = "$hardcode_into_libs"; then
  8766. # Hardcode the library paths
  8767. hardcode_libdirs=
  8768. dep_rpath=
  8769. rpath=$finalize_rpath
  8770. test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  8771. for libdir in $rpath; do
  8772. if test -n "$hardcode_libdir_flag_spec"; then
  8773. if test -n "$hardcode_libdir_separator"; then
  8774. func_replace_sysroot "$libdir"
  8775. libdir=$func_replace_sysroot_result
  8776. if test -z "$hardcode_libdirs"; then
  8777. hardcode_libdirs=$libdir
  8778. else
  8779. # Just accumulate the unique libdirs.
  8780. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  8781. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  8782. ;;
  8783. *)
  8784. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  8785. ;;
  8786. esac
  8787. fi
  8788. else
  8789. eval flag=\"$hardcode_libdir_flag_spec\"
  8790. func_append dep_rpath " $flag"
  8791. fi
  8792. elif test -n "$runpath_var"; then
  8793. case "$perm_rpath " in
  8794. *" $libdir "*) ;;
  8795. *) func_append perm_rpath " $libdir" ;;
  8796. esac
  8797. fi
  8798. done
  8799. # Substitute the hardcoded libdirs into the rpath.
  8800. if test -n "$hardcode_libdir_separator" &&
  8801. test -n "$hardcode_libdirs"; then
  8802. libdir=$hardcode_libdirs
  8803. eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  8804. fi
  8805. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  8806. # We should set the runpath_var.
  8807. rpath=
  8808. for dir in $perm_rpath; do
  8809. func_append rpath "$dir:"
  8810. done
  8811. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  8812. fi
  8813. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  8814. fi
  8815. shlibpath=$finalize_shlibpath
  8816. test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  8817. if test -n "$shlibpath"; then
  8818. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  8819. fi
  8820. # Get the real and link names of the library.
  8821. eval shared_ext=\"$shrext_cmds\"
  8822. eval library_names=\"$library_names_spec\"
  8823. set dummy $library_names
  8824. shift
  8825. realname=$1
  8826. shift
  8827. if test -n "$soname_spec"; then
  8828. eval soname=\"$soname_spec\"
  8829. else
  8830. soname=$realname
  8831. fi
  8832. if test -z "$dlname"; then
  8833. dlname=$soname
  8834. fi
  8835. lib=$output_objdir/$realname
  8836. linknames=
  8837. for link
  8838. do
  8839. func_append linknames " $link"
  8840. done
  8841. # Use standard objects if they are pic
  8842. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  8843. test "X$libobjs" = "X " && libobjs=
  8844. delfiles=
  8845. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8846. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  8847. export_symbols=$output_objdir/$libname.uexp
  8848. func_append delfiles " $export_symbols"
  8849. fi
  8850. orig_export_symbols=
  8851. case $host_os in
  8852. cygwin* | mingw* | cegcc*)
  8853. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  8854. # exporting using user supplied symfile
  8855. func_dll_def_p "$export_symbols" || {
  8856. # and it's NOT already a .def file. Must figure out
  8857. # which of the given symbols are data symbols and tag
  8858. # them as such. So, trigger use of export_symbols_cmds.
  8859. # export_symbols gets reassigned inside the "prepare
  8860. # the list of exported symbols" if statement, so the
  8861. # include_expsyms logic still works.
  8862. orig_export_symbols=$export_symbols
  8863. export_symbols=
  8864. always_export_symbols=yes
  8865. }
  8866. fi
  8867. ;;
  8868. esac
  8869. # Prepare the list of exported symbols
  8870. if test -z "$export_symbols"; then
  8871. if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  8872. func_verbose "generating symbol list for '$libname.la'"
  8873. export_symbols=$output_objdir/$libname.exp
  8874. $opt_dry_run || $RM $export_symbols
  8875. cmds=$export_symbols_cmds
  8876. save_ifs=$IFS; IFS='~'
  8877. for cmd1 in $cmds; do
  8878. IFS=$save_ifs
  8879. # Take the normal branch if the nm_file_list_spec branch
  8880. # doesn't work or if tool conversion is not needed.
  8881. case $nm_file_list_spec~$to_tool_file_cmd in
  8882. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  8883. try_normal_branch=yes
  8884. eval cmd=\"$cmd1\"
  8885. func_len " $cmd"
  8886. len=$func_len_result
  8887. ;;
  8888. *)
  8889. try_normal_branch=no
  8890. ;;
  8891. esac
  8892. if test yes = "$try_normal_branch" \
  8893. && { test "$len" -lt "$max_cmd_len" \
  8894. || test "$max_cmd_len" -le -1; }
  8895. then
  8896. func_show_eval "$cmd" 'exit $?'
  8897. skipped_export=false
  8898. elif test -n "$nm_file_list_spec"; then
  8899. func_basename "$output"
  8900. output_la=$func_basename_result
  8901. save_libobjs=$libobjs
  8902. save_output=$output
  8903. output=$output_objdir/$output_la.nm
  8904. func_to_tool_file "$output"
  8905. libobjs=$nm_file_list_spec$func_to_tool_file_result
  8906. func_append delfiles " $output"
  8907. func_verbose "creating $NM input file list: $output"
  8908. for obj in $save_libobjs; do
  8909. func_to_tool_file "$obj"
  8910. $ECHO "$func_to_tool_file_result"
  8911. done > "$output"
  8912. eval cmd=\"$cmd1\"
  8913. func_show_eval "$cmd" 'exit $?'
  8914. output=$save_output
  8915. libobjs=$save_libobjs
  8916. skipped_export=false
  8917. else
  8918. # The command line is too long to execute in one step.
  8919. func_verbose "using reloadable object file for export list..."
  8920. skipped_export=:
  8921. # Break out early, otherwise skipped_export may be
  8922. # set to false by a later but shorter cmd.
  8923. break
  8924. fi
  8925. done
  8926. IFS=$save_ifs
  8927. if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  8928. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  8929. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  8930. fi
  8931. fi
  8932. fi
  8933. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8934. tmp_export_symbols=$export_symbols
  8935. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  8936. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  8937. fi
  8938. if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  8939. # The given exports_symbols file has to be filtered, so filter it.
  8940. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  8941. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  8942. # 's' commands, which not all seds can handle. GNU sed should be fine
  8943. # though. Also, the filter scales superlinearly with the number of
  8944. # global variables. join(1) would be nice here, but unfortunately
  8945. # isn't a blessed tool.
  8946. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  8947. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  8948. export_symbols=$output_objdir/$libname.def
  8949. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  8950. fi
  8951. tmp_deplibs=
  8952. for test_deplib in $deplibs; do
  8953. case " $convenience " in
  8954. *" $test_deplib "*) ;;
  8955. *)
  8956. func_append tmp_deplibs " $test_deplib"
  8957. ;;
  8958. esac
  8959. done
  8960. deplibs=$tmp_deplibs
  8961. if test -n "$convenience"; then
  8962. if test -n "$whole_archive_flag_spec" &&
  8963. test yes = "$compiler_needs_object" &&
  8964. test -z "$libobjs"; then
  8965. # extract the archives, so we have objects to list.
  8966. # TODO: could optimize this to just extract one archive.
  8967. whole_archive_flag_spec=
  8968. fi
  8969. if test -n "$whole_archive_flag_spec"; then
  8970. save_libobjs=$libobjs
  8971. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  8972. test "X$libobjs" = "X " && libobjs=
  8973. else
  8974. gentop=$output_objdir/${outputname}x
  8975. func_append generated " $gentop"
  8976. func_extract_archives $gentop $convenience
  8977. func_append libobjs " $func_extract_archives_result"
  8978. test "X$libobjs" = "X " && libobjs=
  8979. fi
  8980. fi
  8981. if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  8982. eval flag=\"$thread_safe_flag_spec\"
  8983. func_append linker_flags " $flag"
  8984. fi
  8985. # Make a backup of the uninstalled library when relinking
  8986. if test relink = "$opt_mode"; then
  8987. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  8988. fi
  8989. # Do each of the archive commands.
  8990. if test yes = "$module" && test -n "$module_cmds"; then
  8991. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  8992. eval test_cmds=\"$module_expsym_cmds\"
  8993. cmds=$module_expsym_cmds
  8994. else
  8995. eval test_cmds=\"$module_cmds\"
  8996. cmds=$module_cmds
  8997. fi
  8998. else
  8999. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9000. eval test_cmds=\"$archive_expsym_cmds\"
  9001. cmds=$archive_expsym_cmds
  9002. else
  9003. eval test_cmds=\"$archive_cmds\"
  9004. cmds=$archive_cmds
  9005. fi
  9006. fi
  9007. if test : != "$skipped_export" &&
  9008. func_len " $test_cmds" &&
  9009. len=$func_len_result &&
  9010. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9011. :
  9012. else
  9013. # The command line is too long to link in one step, link piecewise
  9014. # or, if using GNU ld and skipped_export is not :, use a linker
  9015. # script.
  9016. # Save the value of $output and $libobjs because we want to
  9017. # use them later. If we have whole_archive_flag_spec, we
  9018. # want to use save_libobjs as it was before
  9019. # whole_archive_flag_spec was expanded, because we can't
  9020. # assume the linker understands whole_archive_flag_spec.
  9021. # This may have to be revisited, in case too many
  9022. # convenience libraries get linked in and end up exceeding
  9023. # the spec.
  9024. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  9025. save_libobjs=$libobjs
  9026. fi
  9027. save_output=$output
  9028. func_basename "$output"
  9029. output_la=$func_basename_result
  9030. # Clear the reloadable object creation command queue and
  9031. # initialize k to one.
  9032. test_cmds=
  9033. concat_cmds=
  9034. objlist=
  9035. last_robj=
  9036. k=1
  9037. if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  9038. output=$output_objdir/$output_la.lnkscript
  9039. func_verbose "creating GNU ld script: $output"
  9040. echo 'INPUT (' > $output
  9041. for obj in $save_libobjs
  9042. do
  9043. func_to_tool_file "$obj"
  9044. $ECHO "$func_to_tool_file_result" >> $output
  9045. done
  9046. echo ')' >> $output
  9047. func_append delfiles " $output"
  9048. func_to_tool_file "$output"
  9049. output=$func_to_tool_file_result
  9050. elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  9051. output=$output_objdir/$output_la.lnk
  9052. func_verbose "creating linker input file list: $output"
  9053. : > $output
  9054. set x $save_libobjs
  9055. shift
  9056. firstobj=
  9057. if test yes = "$compiler_needs_object"; then
  9058. firstobj="$1 "
  9059. shift
  9060. fi
  9061. for obj
  9062. do
  9063. func_to_tool_file "$obj"
  9064. $ECHO "$func_to_tool_file_result" >> $output
  9065. done
  9066. func_append delfiles " $output"
  9067. func_to_tool_file "$output"
  9068. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  9069. else
  9070. if test -n "$save_libobjs"; then
  9071. func_verbose "creating reloadable object files..."
  9072. output=$output_objdir/$output_la-$k.$objext
  9073. eval test_cmds=\"$reload_cmds\"
  9074. func_len " $test_cmds"
  9075. len0=$func_len_result
  9076. len=$len0
  9077. # Loop over the list of objects to be linked.
  9078. for obj in $save_libobjs
  9079. do
  9080. func_len " $obj"
  9081. func_arith $len + $func_len_result
  9082. len=$func_arith_result
  9083. if test -z "$objlist" ||
  9084. test "$len" -lt "$max_cmd_len"; then
  9085. func_append objlist " $obj"
  9086. else
  9087. # The command $test_cmds is almost too long, add a
  9088. # command to the queue.
  9089. if test 1 -eq "$k"; then
  9090. # The first file doesn't have a previous command to add.
  9091. reload_objs=$objlist
  9092. eval concat_cmds=\"$reload_cmds\"
  9093. else
  9094. # All subsequent reloadable object files will link in
  9095. # the last one created.
  9096. reload_objs="$objlist $last_robj"
  9097. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  9098. fi
  9099. last_robj=$output_objdir/$output_la-$k.$objext
  9100. func_arith $k + 1
  9101. k=$func_arith_result
  9102. output=$output_objdir/$output_la-$k.$objext
  9103. objlist=" $obj"
  9104. func_len " $last_robj"
  9105. func_arith $len0 + $func_len_result
  9106. len=$func_arith_result
  9107. fi
  9108. done
  9109. # Handle the remaining objects by creating one last
  9110. # reloadable object file. All subsequent reloadable object
  9111. # files will link in the last one created.
  9112. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9113. reload_objs="$objlist $last_robj"
  9114. eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  9115. if test -n "$last_robj"; then
  9116. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9117. fi
  9118. func_append delfiles " $output"
  9119. else
  9120. output=
  9121. fi
  9122. ${skipped_export-false} && {
  9123. func_verbose "generating symbol list for '$libname.la'"
  9124. export_symbols=$output_objdir/$libname.exp
  9125. $opt_dry_run || $RM $export_symbols
  9126. libobjs=$output
  9127. # Append the command to create the export file.
  9128. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9129. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  9130. if test -n "$last_robj"; then
  9131. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9132. fi
  9133. }
  9134. test -n "$save_libobjs" &&
  9135. func_verbose "creating a temporary reloadable object file: $output"
  9136. # Loop through the commands generated above and execute them.
  9137. save_ifs=$IFS; IFS='~'
  9138. for cmd in $concat_cmds; do
  9139. IFS=$save_ifs
  9140. $opt_quiet || {
  9141. func_quote_for_expand "$cmd"
  9142. eval "func_echo $func_quote_for_expand_result"
  9143. }
  9144. $opt_dry_run || eval "$cmd" || {
  9145. lt_exit=$?
  9146. # Restore the uninstalled library and exit
  9147. if test relink = "$opt_mode"; then
  9148. ( cd "$output_objdir" && \
  9149. $RM "${realname}T" && \
  9150. $MV "${realname}U" "$realname" )
  9151. fi
  9152. exit $lt_exit
  9153. }
  9154. done
  9155. IFS=$save_ifs
  9156. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  9157. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9158. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9159. fi
  9160. fi
  9161. ${skipped_export-false} && {
  9162. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9163. tmp_export_symbols=$export_symbols
  9164. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9165. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9166. fi
  9167. if test -n "$orig_export_symbols"; then
  9168. # The given exports_symbols file has to be filtered, so filter it.
  9169. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9170. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9171. # 's' commands, which not all seds can handle. GNU sed should be fine
  9172. # though. Also, the filter scales superlinearly with the number of
  9173. # global variables. join(1) would be nice here, but unfortunately
  9174. # isn't a blessed tool.
  9175. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9176. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9177. export_symbols=$output_objdir/$libname.def
  9178. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9179. fi
  9180. }
  9181. libobjs=$output
  9182. # Restore the value of output.
  9183. output=$save_output
  9184. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  9185. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9186. test "X$libobjs" = "X " && libobjs=
  9187. fi
  9188. # Expand the library linking commands again to reset the
  9189. # value of $libobjs for piecewise linking.
  9190. # Do each of the archive commands.
  9191. if test yes = "$module" && test -n "$module_cmds"; then
  9192. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9193. cmds=$module_expsym_cmds
  9194. else
  9195. cmds=$module_cmds
  9196. fi
  9197. else
  9198. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9199. cmds=$archive_expsym_cmds
  9200. else
  9201. cmds=$archive_cmds
  9202. fi
  9203. fi
  9204. fi
  9205. if test -n "$delfiles"; then
  9206. # Append the command to remove temporary files to $cmds.
  9207. eval cmds=\"\$cmds~\$RM $delfiles\"
  9208. fi
  9209. # Add any objects from preloaded convenience libraries
  9210. if test -n "$dlprefiles"; then
  9211. gentop=$output_objdir/${outputname}x
  9212. func_append generated " $gentop"
  9213. func_extract_archives $gentop $dlprefiles
  9214. func_append libobjs " $func_extract_archives_result"
  9215. test "X$libobjs" = "X " && libobjs=
  9216. fi
  9217. save_ifs=$IFS; IFS='~'
  9218. for cmd in $cmds; do
  9219. IFS=$sp$nl
  9220. eval cmd=\"$cmd\"
  9221. IFS=$save_ifs
  9222. $opt_quiet || {
  9223. func_quote_for_expand "$cmd"
  9224. eval "func_echo $func_quote_for_expand_result"
  9225. }
  9226. $opt_dry_run || eval "$cmd" || {
  9227. lt_exit=$?
  9228. # Restore the uninstalled library and exit
  9229. if test relink = "$opt_mode"; then
  9230. ( cd "$output_objdir" && \
  9231. $RM "${realname}T" && \
  9232. $MV "${realname}U" "$realname" )
  9233. fi
  9234. exit $lt_exit
  9235. }
  9236. done
  9237. IFS=$save_ifs
  9238. # Restore the uninstalled library and exit
  9239. if test relink = "$opt_mode"; then
  9240. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  9241. if test -n "$convenience"; then
  9242. if test -z "$whole_archive_flag_spec"; then
  9243. func_show_eval '${RM}r "$gentop"'
  9244. fi
  9245. fi
  9246. exit $EXIT_SUCCESS
  9247. fi
  9248. # Create links to the real library.
  9249. for linkname in $linknames; do
  9250. if test "$realname" != "$linkname"; then
  9251. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  9252. fi
  9253. done
  9254. # If -module or -export-dynamic was specified, set the dlname.
  9255. if test yes = "$module" || test yes = "$export_dynamic"; then
  9256. # On all known operating systems, these are identical.
  9257. dlname=$soname
  9258. fi
  9259. fi
  9260. ;;
  9261. obj)
  9262. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  9263. func_warning "'-dlopen' is ignored for objects"
  9264. fi
  9265. case " $deplibs" in
  9266. *\ -l* | *\ -L*)
  9267. func_warning "'-l' and '-L' are ignored for objects" ;;
  9268. esac
  9269. test -n "$rpath" && \
  9270. func_warning "'-rpath' is ignored for objects"
  9271. test -n "$xrpath" && \
  9272. func_warning "'-R' is ignored for objects"
  9273. test -n "$vinfo" && \
  9274. func_warning "'-version-info' is ignored for objects"
  9275. test -n "$release" && \
  9276. func_warning "'-release' is ignored for objects"
  9277. case $output in
  9278. *.lo)
  9279. test -n "$objs$old_deplibs" && \
  9280. func_fatal_error "cannot build library object '$output' from non-libtool objects"
  9281. libobj=$output
  9282. func_lo2o "$libobj"
  9283. obj=$func_lo2o_result
  9284. ;;
  9285. *)
  9286. libobj=
  9287. obj=$output
  9288. ;;
  9289. esac
  9290. # Delete the old objects.
  9291. $opt_dry_run || $RM $obj $libobj
  9292. # Objects from convenience libraries. This assumes
  9293. # single-version convenience libraries. Whenever we create
  9294. # different ones for PIC/non-PIC, this we'll have to duplicate
  9295. # the extraction.
  9296. reload_conv_objs=
  9297. gentop=
  9298. # if reload_cmds runs $LD directly, get rid of -Wl from
  9299. # whole_archive_flag_spec and hope we can get by with turning comma
  9300. # into space.
  9301. case $reload_cmds in
  9302. *\$LD[\ \$]*) wl= ;;
  9303. esac
  9304. if test -n "$convenience"; then
  9305. if test -n "$whole_archive_flag_spec"; then
  9306. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  9307. test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  9308. reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  9309. else
  9310. gentop=$output_objdir/${obj}x
  9311. func_append generated " $gentop"
  9312. func_extract_archives $gentop $convenience
  9313. reload_conv_objs="$reload_objs $func_extract_archives_result"
  9314. fi
  9315. fi
  9316. # If we're not building shared, we need to use non_pic_objs
  9317. test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  9318. # Create the old-style object.
  9319. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  9320. output=$obj
  9321. func_execute_cmds "$reload_cmds" 'exit $?'
  9322. # Exit if we aren't doing a library object file.
  9323. if test -z "$libobj"; then
  9324. if test -n "$gentop"; then
  9325. func_show_eval '${RM}r "$gentop"'
  9326. fi
  9327. exit $EXIT_SUCCESS
  9328. fi
  9329. test yes = "$build_libtool_libs" || {
  9330. if test -n "$gentop"; then
  9331. func_show_eval '${RM}r "$gentop"'
  9332. fi
  9333. # Create an invalid libtool object if no PIC, so that we don't
  9334. # accidentally link it into a program.
  9335. # $show "echo timestamp > $libobj"
  9336. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  9337. exit $EXIT_SUCCESS
  9338. }
  9339. if test -n "$pic_flag" || test default != "$pic_mode"; then
  9340. # Only do commands if we really have different PIC objects.
  9341. reload_objs="$libobjs $reload_conv_objs"
  9342. output=$libobj
  9343. func_execute_cmds "$reload_cmds" 'exit $?'
  9344. fi
  9345. if test -n "$gentop"; then
  9346. func_show_eval '${RM}r "$gentop"'
  9347. fi
  9348. exit $EXIT_SUCCESS
  9349. ;;
  9350. prog)
  9351. case $host in
  9352. *cygwin*) func_stripname '' '.exe' "$output"
  9353. output=$func_stripname_result.exe;;
  9354. esac
  9355. test -n "$vinfo" && \
  9356. func_warning "'-version-info' is ignored for programs"
  9357. test -n "$release" && \
  9358. func_warning "'-release' is ignored for programs"
  9359. $preload \
  9360. && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  9361. && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  9362. case $host in
  9363. *-*-rhapsody* | *-*-darwin1.[012])
  9364. # On Rhapsody replace the C library is the System framework
  9365. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9366. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9367. ;;
  9368. esac
  9369. case $host in
  9370. *-*-darwin*)
  9371. # Don't allow lazy linking, it breaks C++ global constructors
  9372. # But is supposedly fixed on 10.4 or later (yay!).
  9373. if test CXX = "$tagname"; then
  9374. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  9375. 10.[0123])
  9376. func_append compile_command " $wl-bind_at_load"
  9377. func_append finalize_command " $wl-bind_at_load"
  9378. ;;
  9379. esac
  9380. fi
  9381. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9382. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9383. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9384. ;;
  9385. esac
  9386. # move library search paths that coincide with paths to not yet
  9387. # installed libraries to the beginning of the library search list
  9388. new_libs=
  9389. for path in $notinst_path; do
  9390. case " $new_libs " in
  9391. *" -L$path/$objdir "*) ;;
  9392. *)
  9393. case " $compile_deplibs " in
  9394. *" -L$path/$objdir "*)
  9395. func_append new_libs " -L$path/$objdir" ;;
  9396. esac
  9397. ;;
  9398. esac
  9399. done
  9400. for deplib in $compile_deplibs; do
  9401. case $deplib in
  9402. -L*)
  9403. case " $new_libs " in
  9404. *" $deplib "*) ;;
  9405. *) func_append new_libs " $deplib" ;;
  9406. esac
  9407. ;;
  9408. *) func_append new_libs " $deplib" ;;
  9409. esac
  9410. done
  9411. compile_deplibs=$new_libs
  9412. func_append compile_command " $compile_deplibs"
  9413. func_append finalize_command " $finalize_deplibs"
  9414. if test -n "$rpath$xrpath"; then
  9415. # If the user specified any rpath flags, then add them.
  9416. for libdir in $rpath $xrpath; do
  9417. # This is the magic to use -rpath.
  9418. case "$finalize_rpath " in
  9419. *" $libdir "*) ;;
  9420. *) func_append finalize_rpath " $libdir" ;;
  9421. esac
  9422. done
  9423. fi
  9424. # Now hardcode the library paths
  9425. rpath=
  9426. hardcode_libdirs=
  9427. for libdir in $compile_rpath $finalize_rpath; do
  9428. if test -n "$hardcode_libdir_flag_spec"; then
  9429. if test -n "$hardcode_libdir_separator"; then
  9430. if test -z "$hardcode_libdirs"; then
  9431. hardcode_libdirs=$libdir
  9432. else
  9433. # Just accumulate the unique libdirs.
  9434. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9435. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9436. ;;
  9437. *)
  9438. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9439. ;;
  9440. esac
  9441. fi
  9442. else
  9443. eval flag=\"$hardcode_libdir_flag_spec\"
  9444. func_append rpath " $flag"
  9445. fi
  9446. elif test -n "$runpath_var"; then
  9447. case "$perm_rpath " in
  9448. *" $libdir "*) ;;
  9449. *) func_append perm_rpath " $libdir" ;;
  9450. esac
  9451. fi
  9452. case $host in
  9453. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  9454. testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  9455. case :$dllsearchpath: in
  9456. *":$libdir:"*) ;;
  9457. ::) dllsearchpath=$libdir;;
  9458. *) func_append dllsearchpath ":$libdir";;
  9459. esac
  9460. case :$dllsearchpath: in
  9461. *":$testbindir:"*) ;;
  9462. ::) dllsearchpath=$testbindir;;
  9463. *) func_append dllsearchpath ":$testbindir";;
  9464. esac
  9465. ;;
  9466. esac
  9467. done
  9468. # Substitute the hardcoded libdirs into the rpath.
  9469. if test -n "$hardcode_libdir_separator" &&
  9470. test -n "$hardcode_libdirs"; then
  9471. libdir=$hardcode_libdirs
  9472. eval rpath=\" $hardcode_libdir_flag_spec\"
  9473. fi
  9474. compile_rpath=$rpath
  9475. rpath=
  9476. hardcode_libdirs=
  9477. for libdir in $finalize_rpath; do
  9478. if test -n "$hardcode_libdir_flag_spec"; then
  9479. if test -n "$hardcode_libdir_separator"; then
  9480. if test -z "$hardcode_libdirs"; then
  9481. hardcode_libdirs=$libdir
  9482. else
  9483. # Just accumulate the unique libdirs.
  9484. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9485. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9486. ;;
  9487. *)
  9488. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9489. ;;
  9490. esac
  9491. fi
  9492. else
  9493. eval flag=\"$hardcode_libdir_flag_spec\"
  9494. func_append rpath " $flag"
  9495. fi
  9496. elif test -n "$runpath_var"; then
  9497. case "$finalize_perm_rpath " in
  9498. *" $libdir "*) ;;
  9499. *) func_append finalize_perm_rpath " $libdir" ;;
  9500. esac
  9501. fi
  9502. done
  9503. # Substitute the hardcoded libdirs into the rpath.
  9504. if test -n "$hardcode_libdir_separator" &&
  9505. test -n "$hardcode_libdirs"; then
  9506. libdir=$hardcode_libdirs
  9507. eval rpath=\" $hardcode_libdir_flag_spec\"
  9508. fi
  9509. finalize_rpath=$rpath
  9510. if test -n "$libobjs" && test yes = "$build_old_libs"; then
  9511. # Transform all the library objects into standard objects.
  9512. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9513. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9514. fi
  9515. func_generate_dlsyms "$outputname" "@PROGRAM@" false
  9516. # template prelinking step
  9517. if test -n "$prelink_cmds"; then
  9518. func_execute_cmds "$prelink_cmds" 'exit $?'
  9519. fi
  9520. wrappers_required=:
  9521. case $host in
  9522. *cegcc* | *mingw32ce*)
  9523. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  9524. wrappers_required=false
  9525. ;;
  9526. *cygwin* | *mingw* )
  9527. test yes = "$build_libtool_libs" || wrappers_required=false
  9528. ;;
  9529. *)
  9530. if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  9531. wrappers_required=false
  9532. fi
  9533. ;;
  9534. esac
  9535. $wrappers_required || {
  9536. # Replace the output file specification.
  9537. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9538. link_command=$compile_command$compile_rpath
  9539. # We have no uninstalled library dependencies, so finalize right now.
  9540. exit_status=0
  9541. func_show_eval "$link_command" 'exit_status=$?'
  9542. if test -n "$postlink_cmds"; then
  9543. func_to_tool_file "$output"
  9544. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9545. func_execute_cmds "$postlink_cmds" 'exit $?'
  9546. fi
  9547. # Delete the generated files.
  9548. if test -f "$output_objdir/${outputname}S.$objext"; then
  9549. func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  9550. fi
  9551. exit $exit_status
  9552. }
  9553. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  9554. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  9555. fi
  9556. if test -n "$finalize_shlibpath"; then
  9557. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  9558. fi
  9559. compile_var=
  9560. finalize_var=
  9561. if test -n "$runpath_var"; then
  9562. if test -n "$perm_rpath"; then
  9563. # We should set the runpath_var.
  9564. rpath=
  9565. for dir in $perm_rpath; do
  9566. func_append rpath "$dir:"
  9567. done
  9568. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9569. fi
  9570. if test -n "$finalize_perm_rpath"; then
  9571. # We should set the runpath_var.
  9572. rpath=
  9573. for dir in $finalize_perm_rpath; do
  9574. func_append rpath "$dir:"
  9575. done
  9576. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9577. fi
  9578. fi
  9579. if test yes = "$no_install"; then
  9580. # We don't need to create a wrapper script.
  9581. link_command=$compile_var$compile_command$compile_rpath
  9582. # Replace the output file specification.
  9583. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9584. # Delete the old output file.
  9585. $opt_dry_run || $RM $output
  9586. # Link the executable and exit
  9587. func_show_eval "$link_command" 'exit $?'
  9588. if test -n "$postlink_cmds"; then
  9589. func_to_tool_file "$output"
  9590. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9591. func_execute_cmds "$postlink_cmds" 'exit $?'
  9592. fi
  9593. exit $EXIT_SUCCESS
  9594. fi
  9595. case $hardcode_action,$fast_install in
  9596. relink,*)
  9597. # Fast installation is not supported
  9598. link_command=$compile_var$compile_command$compile_rpath
  9599. relink_command=$finalize_var$finalize_command$finalize_rpath
  9600. func_warning "this platform does not like uninstalled shared libraries"
  9601. func_warning "'$output' will be relinked during installation"
  9602. ;;
  9603. *,yes)
  9604. link_command=$finalize_var$compile_command$finalize_rpath
  9605. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  9606. ;;
  9607. *,no)
  9608. link_command=$compile_var$compile_command$compile_rpath
  9609. relink_command=$finalize_var$finalize_command$finalize_rpath
  9610. ;;
  9611. *,needless)
  9612. link_command=$finalize_var$compile_command$finalize_rpath
  9613. relink_command=
  9614. ;;
  9615. esac
  9616. # Replace the output file specification.
  9617. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  9618. # Delete the old output files.
  9619. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  9620. func_show_eval "$link_command" 'exit $?'
  9621. if test -n "$postlink_cmds"; then
  9622. func_to_tool_file "$output_objdir/$outputname"
  9623. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9624. func_execute_cmds "$postlink_cmds" 'exit $?'
  9625. fi
  9626. # Now create the wrapper script.
  9627. func_verbose "creating $output"
  9628. # Quote the relink command for shipping.
  9629. if test -n "$relink_command"; then
  9630. # Preserve any variables that may affect compiler behavior
  9631. for var in $variables_saved_for_relink; do
  9632. if eval test -z \"\${$var+set}\"; then
  9633. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9634. elif eval var_value=\$$var; test -z "$var_value"; then
  9635. relink_command="$var=; export $var; $relink_command"
  9636. else
  9637. func_quote_for_eval "$var_value"
  9638. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9639. fi
  9640. done
  9641. relink_command="(cd `pwd`; $relink_command)"
  9642. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9643. fi
  9644. # Only actually do things if not in dry run mode.
  9645. $opt_dry_run || {
  9646. # win32 will think the script is a binary if it has
  9647. # a .exe suffix, so we strip it off here.
  9648. case $output in
  9649. *.exe) func_stripname '' '.exe' "$output"
  9650. output=$func_stripname_result ;;
  9651. esac
  9652. # test for cygwin because mv fails w/o .exe extensions
  9653. case $host in
  9654. *cygwin*)
  9655. exeext=.exe
  9656. func_stripname '' '.exe' "$outputname"
  9657. outputname=$func_stripname_result ;;
  9658. *) exeext= ;;
  9659. esac
  9660. case $host in
  9661. *cygwin* | *mingw* )
  9662. func_dirname_and_basename "$output" "" "."
  9663. output_name=$func_basename_result
  9664. output_path=$func_dirname_result
  9665. cwrappersource=$output_path/$objdir/lt-$output_name.c
  9666. cwrapper=$output_path/$output_name.exe
  9667. $RM $cwrappersource $cwrapper
  9668. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  9669. func_emit_cwrapperexe_src > $cwrappersource
  9670. # The wrapper executable is built using the $host compiler,
  9671. # because it contains $host paths and files. If cross-
  9672. # compiling, it, like the target executable, must be
  9673. # executed on the $host or under an emulation environment.
  9674. $opt_dry_run || {
  9675. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  9676. $STRIP $cwrapper
  9677. }
  9678. # Now, create the wrapper script for func_source use:
  9679. func_ltwrapper_scriptname $cwrapper
  9680. $RM $func_ltwrapper_scriptname_result
  9681. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  9682. $opt_dry_run || {
  9683. # note: this script will not be executed, so do not chmod.
  9684. if test "x$build" = "x$host"; then
  9685. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  9686. else
  9687. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  9688. fi
  9689. }
  9690. ;;
  9691. * )
  9692. $RM $output
  9693. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  9694. func_emit_wrapper no > $output
  9695. chmod +x $output
  9696. ;;
  9697. esac
  9698. }
  9699. exit $EXIT_SUCCESS
  9700. ;;
  9701. esac
  9702. # See if we need to build an old-fashioned archive.
  9703. for oldlib in $oldlibs; do
  9704. case $build_libtool_libs in
  9705. convenience)
  9706. oldobjs="$libobjs_save $symfileobj"
  9707. addlibs=$convenience
  9708. build_libtool_libs=no
  9709. ;;
  9710. module)
  9711. oldobjs=$libobjs_save
  9712. addlibs=$old_convenience
  9713. build_libtool_libs=no
  9714. ;;
  9715. *)
  9716. oldobjs="$old_deplibs $non_pic_objects"
  9717. $preload && test -f "$symfileobj" \
  9718. && func_append oldobjs " $symfileobj"
  9719. addlibs=$old_convenience
  9720. ;;
  9721. esac
  9722. if test -n "$addlibs"; then
  9723. gentop=$output_objdir/${outputname}x
  9724. func_append generated " $gentop"
  9725. func_extract_archives $gentop $addlibs
  9726. func_append oldobjs " $func_extract_archives_result"
  9727. fi
  9728. # Do each command in the archive commands.
  9729. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  9730. cmds=$old_archive_from_new_cmds
  9731. else
  9732. # Add any objects from preloaded convenience libraries
  9733. if test -n "$dlprefiles"; then
  9734. gentop=$output_objdir/${outputname}x
  9735. func_append generated " $gentop"
  9736. func_extract_archives $gentop $dlprefiles
  9737. func_append oldobjs " $func_extract_archives_result"
  9738. fi
  9739. # POSIX demands no paths to be encoded in archives. We have
  9740. # to avoid creating archives with duplicate basenames if we
  9741. # might have to extract them afterwards, e.g., when creating a
  9742. # static archive out of a convenience library, or when linking
  9743. # the entirety of a libtool archive into another (currently
  9744. # not supported by libtool).
  9745. if (for obj in $oldobjs
  9746. do
  9747. func_basename "$obj"
  9748. $ECHO "$func_basename_result"
  9749. done | sort | sort -uc >/dev/null 2>&1); then
  9750. :
  9751. else
  9752. echo "copying selected object files to avoid basename conflicts..."
  9753. gentop=$output_objdir/${outputname}x
  9754. func_append generated " $gentop"
  9755. func_mkdir_p "$gentop"
  9756. save_oldobjs=$oldobjs
  9757. oldobjs=
  9758. counter=1
  9759. for obj in $save_oldobjs
  9760. do
  9761. func_basename "$obj"
  9762. objbase=$func_basename_result
  9763. case " $oldobjs " in
  9764. " ") oldobjs=$obj ;;
  9765. *[\ /]"$objbase "*)
  9766. while :; do
  9767. # Make sure we don't pick an alternate name that also
  9768. # overlaps.
  9769. newobj=lt$counter-$objbase
  9770. func_arith $counter + 1
  9771. counter=$func_arith_result
  9772. case " $oldobjs " in
  9773. *[\ /]"$newobj "*) ;;
  9774. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  9775. esac
  9776. done
  9777. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  9778. func_append oldobjs " $gentop/$newobj"
  9779. ;;
  9780. *) func_append oldobjs " $obj" ;;
  9781. esac
  9782. done
  9783. fi
  9784. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  9785. tool_oldlib=$func_to_tool_file_result
  9786. eval cmds=\"$old_archive_cmds\"
  9787. func_len " $cmds"
  9788. len=$func_len_result
  9789. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9790. cmds=$old_archive_cmds
  9791. elif test -n "$archiver_list_spec"; then
  9792. func_verbose "using command file archive linking..."
  9793. for obj in $oldobjs
  9794. do
  9795. func_to_tool_file "$obj"
  9796. $ECHO "$func_to_tool_file_result"
  9797. done > $output_objdir/$libname.libcmd
  9798. func_to_tool_file "$output_objdir/$libname.libcmd"
  9799. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  9800. cmds=$old_archive_cmds
  9801. else
  9802. # the command line is too long to link in one step, link in parts
  9803. func_verbose "using piecewise archive linking..."
  9804. save_RANLIB=$RANLIB
  9805. RANLIB=:
  9806. objlist=
  9807. concat_cmds=
  9808. save_oldobjs=$oldobjs
  9809. oldobjs=
  9810. # Is there a better way of finding the last object in the list?
  9811. for obj in $save_oldobjs
  9812. do
  9813. last_oldobj=$obj
  9814. done
  9815. eval test_cmds=\"$old_archive_cmds\"
  9816. func_len " $test_cmds"
  9817. len0=$func_len_result
  9818. len=$len0
  9819. for obj in $save_oldobjs
  9820. do
  9821. func_len " $obj"
  9822. func_arith $len + $func_len_result
  9823. len=$func_arith_result
  9824. func_append objlist " $obj"
  9825. if test "$len" -lt "$max_cmd_len"; then
  9826. :
  9827. else
  9828. # the above command should be used before it gets too long
  9829. oldobjs=$objlist
  9830. if test "$obj" = "$last_oldobj"; then
  9831. RANLIB=$save_RANLIB
  9832. fi
  9833. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9834. eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  9835. objlist=
  9836. len=$len0
  9837. fi
  9838. done
  9839. RANLIB=$save_RANLIB
  9840. oldobjs=$objlist
  9841. if test -z "$oldobjs"; then
  9842. eval cmds=\"\$concat_cmds\"
  9843. else
  9844. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  9845. fi
  9846. fi
  9847. fi
  9848. func_execute_cmds "$cmds" 'exit $?'
  9849. done
  9850. test -n "$generated" && \
  9851. func_show_eval "${RM}r$generated"
  9852. # Now create the libtool archive.
  9853. case $output in
  9854. *.la)
  9855. old_library=
  9856. test yes = "$build_old_libs" && old_library=$libname.$libext
  9857. func_verbose "creating $output"
  9858. # Preserve any variables that may affect compiler behavior
  9859. for var in $variables_saved_for_relink; do
  9860. if eval test -z \"\${$var+set}\"; then
  9861. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9862. elif eval var_value=\$$var; test -z "$var_value"; then
  9863. relink_command="$var=; export $var; $relink_command"
  9864. else
  9865. func_quote_for_eval "$var_value"
  9866. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9867. fi
  9868. done
  9869. # Quote the link command for shipping.
  9870. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  9871. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9872. if test yes = "$hardcode_automatic"; then
  9873. relink_command=
  9874. fi
  9875. # Only create the output if not a dry run.
  9876. $opt_dry_run || {
  9877. for installed in no yes; do
  9878. if test yes = "$installed"; then
  9879. if test -z "$install_libdir"; then
  9880. break
  9881. fi
  9882. output=$output_objdir/${outputname}i
  9883. # Replace all uninstalled libtool libraries with the installed ones
  9884. newdependency_libs=
  9885. for deplib in $dependency_libs; do
  9886. case $deplib in
  9887. *.la)
  9888. func_basename "$deplib"
  9889. name=$func_basename_result
  9890. func_resolve_sysroot "$deplib"
  9891. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  9892. test -z "$libdir" && \
  9893. func_fatal_error "'$deplib' is not a valid libtool archive"
  9894. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  9895. ;;
  9896. -L*)
  9897. func_stripname -L '' "$deplib"
  9898. func_replace_sysroot "$func_stripname_result"
  9899. func_append newdependency_libs " -L$func_replace_sysroot_result"
  9900. ;;
  9901. -R*)
  9902. func_stripname -R '' "$deplib"
  9903. func_replace_sysroot "$func_stripname_result"
  9904. func_append newdependency_libs " -R$func_replace_sysroot_result"
  9905. ;;
  9906. *) func_append newdependency_libs " $deplib" ;;
  9907. esac
  9908. done
  9909. dependency_libs=$newdependency_libs
  9910. newdlfiles=
  9911. for lib in $dlfiles; do
  9912. case $lib in
  9913. *.la)
  9914. func_basename "$lib"
  9915. name=$func_basename_result
  9916. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9917. test -z "$libdir" && \
  9918. func_fatal_error "'$lib' is not a valid libtool archive"
  9919. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  9920. ;;
  9921. *) func_append newdlfiles " $lib" ;;
  9922. esac
  9923. done
  9924. dlfiles=$newdlfiles
  9925. newdlprefiles=
  9926. for lib in $dlprefiles; do
  9927. case $lib in
  9928. *.la)
  9929. # Only pass preopened files to the pseudo-archive (for
  9930. # eventual linking with the app. that links it) if we
  9931. # didn't already link the preopened objects directly into
  9932. # the library:
  9933. func_basename "$lib"
  9934. name=$func_basename_result
  9935. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9936. test -z "$libdir" && \
  9937. func_fatal_error "'$lib' is not a valid libtool archive"
  9938. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  9939. ;;
  9940. esac
  9941. done
  9942. dlprefiles=$newdlprefiles
  9943. else
  9944. newdlfiles=
  9945. for lib in $dlfiles; do
  9946. case $lib in
  9947. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  9948. *) abs=`pwd`"/$lib" ;;
  9949. esac
  9950. func_append newdlfiles " $abs"
  9951. done
  9952. dlfiles=$newdlfiles
  9953. newdlprefiles=
  9954. for lib in $dlprefiles; do
  9955. case $lib in
  9956. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  9957. *) abs=`pwd`"/$lib" ;;
  9958. esac
  9959. func_append newdlprefiles " $abs"
  9960. done
  9961. dlprefiles=$newdlprefiles
  9962. fi
  9963. $RM $output
  9964. # place dlname in correct position for cygwin
  9965. # In fact, it would be nice if we could use this code for all target
  9966. # systems that can't hard-code library paths into their executables
  9967. # and that have no shared library path variable independent of PATH,
  9968. # but it turns out we can't easily determine that from inspecting
  9969. # libtool variables, so we have to hard-code the OSs to which it
  9970. # applies here; at the moment, that means platforms that use the PE
  9971. # object format with DLL files. See the long comment at the top of
  9972. # tests/bindir.at for full details.
  9973. tdlname=$dlname
  9974. case $host,$output,$installed,$module,$dlname in
  9975. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  9976. # If a -bindir argument was supplied, place the dll there.
  9977. if test -n "$bindir"; then
  9978. func_relative_path "$install_libdir" "$bindir"
  9979. tdlname=$func_relative_path_result/$dlname
  9980. else
  9981. # Otherwise fall back on heuristic.
  9982. tdlname=../bin/$dlname
  9983. fi
  9984. ;;
  9985. esac
  9986. $ECHO > $output "\
  9987. # $outputname - a libtool library file
  9988. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  9989. #
  9990. # Please DO NOT delete this file!
  9991. # It is necessary for linking the library.
  9992. # The name that we can dlopen(3).
  9993. dlname='$tdlname'
  9994. # Names of this library.
  9995. library_names='$library_names'
  9996. # The name of the static archive.
  9997. old_library='$old_library'
  9998. # Linker flags that cannot go in dependency_libs.
  9999. inherited_linker_flags='$new_inherited_linker_flags'
  10000. # Libraries that this one depends upon.
  10001. dependency_libs='$dependency_libs'
  10002. # Names of additional weak libraries provided by this library
  10003. weak_library_names='$weak_libs'
  10004. # Version information for $libname.
  10005. current=$current
  10006. age=$age
  10007. revision=$revision
  10008. # Is this an already installed library?
  10009. installed=$installed
  10010. # Should we warn about portability when linking against -modules?
  10011. shouldnotlink=$module
  10012. # Files to dlopen/dlpreopen
  10013. dlopen='$dlfiles'
  10014. dlpreopen='$dlprefiles'
  10015. # Directory that this library needs to be installed in:
  10016. libdir='$install_libdir'"
  10017. if test no,yes = "$installed,$need_relink"; then
  10018. $ECHO >> $output "\
  10019. relink_command=\"$relink_command\""
  10020. fi
  10021. done
  10022. }
  10023. # Do a symbolic link so that the libtool archive can be found in
  10024. # LD_LIBRARY_PATH before the program is installed.
  10025. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  10026. ;;
  10027. esac
  10028. exit $EXIT_SUCCESS
  10029. }
  10030. if test link = "$opt_mode" || test relink = "$opt_mode"; then
  10031. func_mode_link ${1+"$@"}
  10032. fi
  10033. # func_mode_uninstall arg...
  10034. func_mode_uninstall ()
  10035. {
  10036. $debug_cmd
  10037. RM=$nonopt
  10038. files=
  10039. rmforce=false
  10040. exit_status=0
  10041. # This variable tells wrapper scripts just to set variables rather
  10042. # than running their programs.
  10043. libtool_install_magic=$magic
  10044. for arg
  10045. do
  10046. case $arg in
  10047. -f) func_append RM " $arg"; rmforce=: ;;
  10048. -*) func_append RM " $arg" ;;
  10049. *) func_append files " $arg" ;;
  10050. esac
  10051. done
  10052. test -z "$RM" && \
  10053. func_fatal_help "you must specify an RM program"
  10054. rmdirs=
  10055. for file in $files; do
  10056. func_dirname "$file" "" "."
  10057. dir=$func_dirname_result
  10058. if test . = "$dir"; then
  10059. odir=$objdir
  10060. else
  10061. odir=$dir/$objdir
  10062. fi
  10063. func_basename "$file"
  10064. name=$func_basename_result
  10065. test uninstall = "$opt_mode" && odir=$dir
  10066. # Remember odir for removal later, being careful to avoid duplicates
  10067. if test clean = "$opt_mode"; then
  10068. case " $rmdirs " in
  10069. *" $odir "*) ;;
  10070. *) func_append rmdirs " $odir" ;;
  10071. esac
  10072. fi
  10073. # Don't error if the file doesn't exist and rm -f was used.
  10074. if { test -L "$file"; } >/dev/null 2>&1 ||
  10075. { test -h "$file"; } >/dev/null 2>&1 ||
  10076. test -f "$file"; then
  10077. :
  10078. elif test -d "$file"; then
  10079. exit_status=1
  10080. continue
  10081. elif $rmforce; then
  10082. continue
  10083. fi
  10084. rmfiles=$file
  10085. case $name in
  10086. *.la)
  10087. # Possibly a libtool archive, so verify it.
  10088. if func_lalib_p "$file"; then
  10089. func_source $dir/$name
  10090. # Delete the libtool libraries and symlinks.
  10091. for n in $library_names; do
  10092. func_append rmfiles " $odir/$n"
  10093. done
  10094. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  10095. case $opt_mode in
  10096. clean)
  10097. case " $library_names " in
  10098. *" $dlname "*) ;;
  10099. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  10100. esac
  10101. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  10102. ;;
  10103. uninstall)
  10104. if test -n "$library_names"; then
  10105. # Do each command in the postuninstall commands.
  10106. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  10107. fi
  10108. if test -n "$old_library"; then
  10109. # Do each command in the old_postuninstall commands.
  10110. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  10111. fi
  10112. # FIXME: should reinstall the best remaining shared library.
  10113. ;;
  10114. esac
  10115. fi
  10116. ;;
  10117. *.lo)
  10118. # Possibly a libtool object, so verify it.
  10119. if func_lalib_p "$file"; then
  10120. # Read the .lo file
  10121. func_source $dir/$name
  10122. # Add PIC object to the list of files to remove.
  10123. if test -n "$pic_object" && test none != "$pic_object"; then
  10124. func_append rmfiles " $dir/$pic_object"
  10125. fi
  10126. # Add non-PIC object to the list of files to remove.
  10127. if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  10128. func_append rmfiles " $dir/$non_pic_object"
  10129. fi
  10130. fi
  10131. ;;
  10132. *)
  10133. if test clean = "$opt_mode"; then
  10134. noexename=$name
  10135. case $file in
  10136. *.exe)
  10137. func_stripname '' '.exe' "$file"
  10138. file=$func_stripname_result
  10139. func_stripname '' '.exe' "$name"
  10140. noexename=$func_stripname_result
  10141. # $file with .exe has already been added to rmfiles,
  10142. # add $file without .exe
  10143. func_append rmfiles " $file"
  10144. ;;
  10145. esac
  10146. # Do a test to see if this is a libtool program.
  10147. if func_ltwrapper_p "$file"; then
  10148. if func_ltwrapper_executable_p "$file"; then
  10149. func_ltwrapper_scriptname "$file"
  10150. relink_command=
  10151. func_source $func_ltwrapper_scriptname_result
  10152. func_append rmfiles " $func_ltwrapper_scriptname_result"
  10153. else
  10154. relink_command=
  10155. func_source $dir/$noexename
  10156. fi
  10157. # note $name still contains .exe if it was in $file originally
  10158. # as does the version of $file that was added into $rmfiles
  10159. func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  10160. if test yes = "$fast_install" && test -n "$relink_command"; then
  10161. func_append rmfiles " $odir/lt-$name"
  10162. fi
  10163. if test "X$noexename" != "X$name"; then
  10164. func_append rmfiles " $odir/lt-$noexename.c"
  10165. fi
  10166. fi
  10167. fi
  10168. ;;
  10169. esac
  10170. func_show_eval "$RM $rmfiles" 'exit_status=1'
  10171. done
  10172. # Try to remove the $objdir's in the directories where we deleted files
  10173. for dir in $rmdirs; do
  10174. if test -d "$dir"; then
  10175. func_show_eval "rmdir $dir >/dev/null 2>&1"
  10176. fi
  10177. done
  10178. exit $exit_status
  10179. }
  10180. if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  10181. func_mode_uninstall ${1+"$@"}
  10182. fi
  10183. test -z "$opt_mode" && {
  10184. help=$generic_help
  10185. func_fatal_help "you must specify a MODE"
  10186. }
  10187. test -z "$exec_cmd" && \
  10188. func_fatal_help "invalid operation mode '$opt_mode'"
  10189. if test -n "$exec_cmd"; then
  10190. eval exec "$exec_cmd"
  10191. exit $EXIT_FAILURE
  10192. fi
  10193. exit $exit_status
  10194. # The TAGs below are defined such that we never get into a situation
  10195. # where we disable both kinds of libraries. Given conflicting
  10196. # choices, we go for a static library, that is the most portable,
  10197. # since we can't tell whether shared libraries were disabled because
  10198. # the user asked for that or because the platform doesn't support
  10199. # them. This is particularly important on AIX, because we don't
  10200. # support having both static and shared libraries enabled at the same
  10201. # time on that platform, so we default to a shared-only configuration.
  10202. # If a disable-shared tag is given, we'll fallback to a static-only
  10203. # configuration. But we'll never go from static-only to shared-only.
  10204. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  10205. build_libtool_libs=no
  10206. build_old_libs=yes
  10207. # ### END LIBTOOL TAG CONFIG: disable-shared
  10208. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  10209. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  10210. # ### END LIBTOOL TAG CONFIG: disable-static
  10211. # Local Variables:
  10212. # mode:shell-script
  10213. # sh-indentation:2
  10214. # End:
  10215. # ### BEGIN LIBTOOL TAG CONFIG: CXX
  10216. # The linker used to build libraries.
  10217. LD="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
  10218. # How to create reloadable object files.
  10219. reload_flag=" -r"
  10220. reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \$wl-r -o \$output\$reload_objs"
  10221. # Commands used to build an old-style archive.
  10222. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  10223. # A language specific compiler.
  10224. CC="g++"
  10225. # Is the compiler the GNU compiler?
  10226. with_gcc=yes
  10227. # Compiler flag to turn off builtin functions.
  10228. no_builtin_flag=" -fno-builtin"
  10229. # Additional compiler flags for building library objects.
  10230. pic_flag=" -fno-common -DPIC"
  10231. # How to pass a linker flag through the compiler.
  10232. wl="-Wl,"
  10233. # Compiler flag to prevent dynamic linking.
  10234. link_static_flag=""
  10235. # Does compiler simultaneously support -c and -o options?
  10236. compiler_c_o="yes"
  10237. # Whether or not to add -lc for building shared libraries.
  10238. build_libtool_need_lc=no
  10239. # Whether or not to disallow shared libs when runtime libs are static.
  10240. allow_libtool_libs_with_static_runtimes=no
  10241. # Compiler flag to allow reflexive dlopens.
  10242. export_dynamic_flag_spec=""
  10243. # Compiler flag to generate shared objects directly from archives.
  10244. whole_archive_flag_spec="\`for conv in \$convenience\\\"\\\"; do test -n \\\"\$conv\\\" && new_convenience=\\\"\$new_convenience \$wl-force_load,\$conv\\\"; done; func_echo_all \\\"\$new_convenience\\\"\`"
  10245. # Whether the compiler copes with passing no objects directly.
  10246. compiler_needs_object="no"
  10247. # Create an old-style archive from a shared archive.
  10248. old_archive_from_new_cmds=""
  10249. # Create a temporary old-style archive to link instead of a shared archive.
  10250. old_archive_from_expsyms_cmds=""
  10251. # Commands used to build a shared archive.
  10252. archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module"
  10253. 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 \$single_module \$wl-exported_symbols_list,\$output_objdir/\$libname-symbols.expsym"
  10254. # Commands used to build a loadable module if different from building
  10255. # a shared archive.
  10256. module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags"
  10257. 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"
  10258. # Whether we are building with GNU ld or not.
  10259. with_gnu_ld="no"
  10260. # Flag that allows shared libraries with undefined symbols to be built.
  10261. allow_undefined_flag="\$wl-undefined \${wl}dynamic_lookup"
  10262. # Flag that enforces no undefined symbols.
  10263. no_undefined_flag=""
  10264. # Flag to hardcode $libdir into a binary during linking.
  10265. # This must work even if $libdir does not exist
  10266. hardcode_libdir_flag_spec=""
  10267. # Whether we need a single "-rpath" flag with a separated argument.
  10268. hardcode_libdir_separator=""
  10269. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  10270. # DIR into the resulting binary.
  10271. hardcode_direct=no
  10272. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  10273. # DIR into the resulting binary and the resulting library dependency is
  10274. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  10275. # library is relocated.
  10276. hardcode_direct_absolute=no
  10277. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  10278. # into the resulting binary.
  10279. hardcode_minus_L=no
  10280. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  10281. # into the resulting binary.
  10282. hardcode_shlibpath_var=unsupported
  10283. # Set to "yes" if building a shared library automatically hardcodes DIR
  10284. # into the library and all subsequent libraries and executables linked
  10285. # against it.
  10286. hardcode_automatic=yes
  10287. # Set to yes if linker adds runtime paths of dependent libraries
  10288. # to runtime path list.
  10289. inherit_rpath=no
  10290. # Whether libtool must link a program against all its dependency libraries.
  10291. link_all_deplibs=yes
  10292. # Set to "yes" if exported symbols are required.
  10293. always_export_symbols=no
  10294. # The commands to list exported symbols.
  10295. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
  10296. # Symbols that should not be listed in the preloaded symbols.
  10297. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
  10298. # Symbols that must always be exported.
  10299. include_expsyms=""
  10300. # Commands necessary for linking programs (against libraries) with templates.
  10301. prelink_cmds=""
  10302. # Commands necessary for finishing linking programs.
  10303. postlink_cmds=""
  10304. # Specify filename containing input files.
  10305. file_list_spec=""
  10306. # How to hardcode a shared library path into an executable.
  10307. hardcode_action=immediate
  10308. # The directories searched by this compiler when creating a shared library.
  10309. compiler_lib_search_dirs=""
  10310. # Dependencies to place before and after the objects being linked to
  10311. # create a shared library.
  10312. predep_objects=""
  10313. postdep_objects=""
  10314. predeps=""
  10315. postdeps=""
  10316. # The library search path used internally by the compiler when linking
  10317. # a shared library.
  10318. compiler_lib_search_path=""
  10319. # ### END LIBTOOL TAG CONFIG: CXX