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.

11985 lines
343KB

  1. #! /bin/sh
  2. # Generated automatically by config.status (libsamplerate) 0.1.9
  3. # NOTE: Changes made to this file will be lost: look at ltmain.sh.
  4. # Provide generalized library-building support services.
  5. # Written by Gordon Matzigkeit, 1996
  6. # Copyright (C) 2014 Free Software Foundation, Inc.
  7. # This is free software; see the source for copying conditions. There is NO
  8. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # GNU Libtool is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2 of of the License, or
  12. # (at your option) any later version.
  13. #
  14. # As a special exception to the GNU General Public License, if you
  15. # distribute this file as part of a program or library that is built
  16. # using GNU Libtool, you may include this file under the same
  17. # distribution terms that you use for the rest of that program.
  18. #
  19. # GNU Libtool is distributed in the hope that it will be useful, but
  20. # WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU General Public License
  25. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. # The names of the tagged configurations supported by this script.
  27. available_tags='CXX RC '
  28. # Configured defaults for sys_lib_dlsearch_path munging.
  29. : ${LT_SYS_LIBRARY_PATH=""}
  30. # ### BEGIN LIBTOOL CONFIG
  31. # Which release of libtool.m4 was used?
  32. macro_version=2.4.6
  33. macro_revision=2.4.6
  34. # Whether or not to build shared libraries.
  35. build_libtool_libs=yes
  36. # Whether or not to build static libraries.
  37. build_old_libs=yes
  38. # What type of objects to build.
  39. pic_mode=default
  40. # Whether or not to optimize for fast installation.
  41. fast_install=needless
  42. # Shared archive member basename,for filename based shared library versioning on AIX.
  43. shared_archive_member_spec=
  44. # Shell to use when invoking shell scripts.
  45. SHELL="/bin/sh"
  46. # An echo program that protects backslashes.
  47. ECHO="printf %s\\n"
  48. # The PATH separator for the build system.
  49. PATH_SEPARATOR=":"
  50. # The host system.
  51. host_alias=
  52. host=x86_64-w64-mingw32
  53. host_os=mingw32
  54. # The build system.
  55. build_alias=x86_64-w64-mingw32
  56. build=x86_64-w64-mingw32
  57. build_os=mingw32
  58. # A sed program that does not truncate output.
  59. SED="/usr/bin/sed"
  60. # Sed that helps us avoid accidentally triggering echo(1) options like -n.
  61. Xsed="$SED -e 1s/^X//"
  62. # A grep program that handles long lines.
  63. GREP="/usr/bin/grep"
  64. # An ERE matcher.
  65. EGREP="/usr/bin/grep -E"
  66. # A literal string matcher.
  67. FGREP="/usr/bin/grep -F"
  68. # A BSD- or MS-compatible name lister.
  69. NM="/mingw64/bin/nm -B"
  70. # Whether we need soft or hard links.
  71. LN_S="cp -pR"
  72. # What is the maximum length of a command?
  73. max_cmd_len=8192
  74. # Object file suffix (normally "o").
  75. objext=o
  76. # Executable file suffix (normally "").
  77. exeext=
  78. # whether the shell understands "unset".
  79. lt_unset=unset
  80. # turn spaces into newlines.
  81. SP2NL="tr \\040 \\012"
  82. # turn newlines into spaces.
  83. NL2SP="tr \\015\\012 \\040\\040"
  84. # convert $build file names to $host format.
  85. to_host_file_cmd=func_convert_file_msys_to_w32
  86. # convert $build files to toolchain format.
  87. to_tool_file_cmd=func_convert_file_msys_to_w32
  88. # An object symbol dumper.
  89. OBJDUMP="objdump"
  90. # Method to check whether dependent libraries are shared objects.
  91. deplibs_check_method="file_magic ^x86 archive import|^x86 DLL"
  92. # Command to use when deplibs_check_method = "file_magic".
  93. file_magic_cmd="func_win32_libid"
  94. # How to find potential files when deplibs_check_method = "file_magic".
  95. file_magic_glob=""
  96. # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
  97. want_nocaseglob="yes"
  98. # DLL creation program.
  99. DLLTOOL="dlltool"
  100. # Command to associate shared and link libraries.
  101. sharedlib_from_linklib_cmd="func_cygming_dll_for_implib"
  102. # The archiver.
  103. AR="ar"
  104. # Flags to create an archive.
  105. AR_FLAGS="cru"
  106. # How to feed a file listing to the archiver.
  107. archiver_list_spec="@"
  108. # A symbol stripping program.
  109. STRIP="strip"
  110. # Commands used to install an old-style archive.
  111. RANLIB="ranlib"
  112. old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
  113. old_postuninstall_cmds=""
  114. # Whether to use a lock for old archive extraction.
  115. lock_old_archive_extraction=no
  116. # A C compiler.
  117. LTCC="gcc"
  118. # LTCC compiler flags.
  119. LTCFLAGS="-fPIC -g -O3 -march=nocona -std=gnu99 -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wpointer-arith -pipe"
  120. # Take the output of nm and produce a listing of raw symbols and C names.
  121. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\\{0,1\\}\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
  122. # Transform the output of nm in a proper C declaration.
  123. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
  124. # Transform the output of nm into a list of symbols to manually relocate.
  125. global_symbol_to_import=""
  126. # Transform the output of nm in a C name address pair.
  127. global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
  128. # Transform the output of nm in a C name address pair when lib prefix is needed.
  129. global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'"
  130. # The name lister interface.
  131. nm_interface="BSD nm"
  132. # Specify filename containing input files for $NM.
  133. nm_file_list_spec="@"
  134. # The root where to search for dependent libraries,and where our libraries should be installed.
  135. lt_sysroot=
  136. # Command to truncate a binary pipe.
  137. lt_truncate_bin="/usr/bin/dd bs=4096 count=1"
  138. # The name of the directory that contains temporary libtool files.
  139. objdir=.libs
  140. # Used to examine libraries when file_magic_cmd begins with "file".
  141. MAGIC_CMD=file
  142. # Must we lock files when doing compilation?
  143. need_locks="no"
  144. # Manifest tool.
  145. MANIFEST_TOOL=":"
  146. # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
  147. DSYMUTIL=""
  148. # Tool to change global to local symbols on Mac OS X.
  149. NMEDIT=""
  150. # Tool to manipulate fat objects and archives on Mac OS X.
  151. LIPO=""
  152. # ldd/readelf like tool for Mach-O binaries on Mac OS X.
  153. OTOOL=""
  154. # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
  155. OTOOL64=""
  156. # Old archive suffix (normally "a").
  157. libext=a
  158. # Shared library suffix (normally ".so").
  159. shrext_cmds=".dll"
  160. # The commands to extract the exported symbol list from a shared archive.
  161. extract_expsyms_cmds=""
  162. # Variables whose values should be saved in libtool wrapper scripts and
  163. # restored at link time.
  164. variables_saved_for_relink="PATH PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
  165. # Do we need the "lib" prefix for modules?
  166. need_lib_prefix=no
  167. # Do we need a version for libraries?
  168. need_version=no
  169. # Library versioning type.
  170. version_type=windows
  171. # Shared library runtime path variable.
  172. runpath_var=LD_RUN_PATH
  173. # Shared library path variable.
  174. shlibpath_var=PATH
  175. # Is shlibpath searched before the hard-coded library search path?
  176. shlibpath_overrides_runpath=yes
  177. # Format of library name prefix.
  178. libname_spec="lib\$name"
  179. # List of archive names. First name is the real one, the rest are links.
  180. # The last name is the one that the linker finds with -lNAME
  181. library_names_spec="\$libname.dll.a"
  182. # The coded name of the library, if different from the real name.
  183. soname_spec="\$libname\`echo \$release | \$SED -e s/[.]/-/g\`\$versuffix\$shared_ext"
  184. # Permission mode override for installation of shared libraries.
  185. install_override_mode=""
  186. # Command to use after installation of a shared archive.
  187. postinstall_cmds="base_file=\\\`basename \\\$file\\\`~
  188. dlpath=\\\`\$SHELL 2>&1 -c '. \$dir/'\\\$base_file'i; echo \\\$dlname'\\\`~
  189. dldir=\$destdir/\\\`dirname \\\$dlpath\\\`~
  190. test -d \\\$dldir || mkdir -p \\\$dldir~
  191. \$install_prog \$dir/\$dlname \\\$dldir/\$dlname~
  192. chmod a+x \\\$dldir/\$dlname~
  193. if test -n '\$stripme' && test -n '\$striplib'; then
  194. eval '\$striplib \\\$dldir/\$dlname' || exit \\\$?;
  195. fi"
  196. # Command to use after uninstallation of a shared archive.
  197. postuninstall_cmds="dldll=\\\`\$SHELL 2>&1 -c '. \$file; echo \\\$dlname'\\\`~
  198. dlpath=\$dir/\\\$dldll~
  199. \$RM \\\$dlpath"
  200. # Commands used to finish a libtool library installation in a directory.
  201. finish_cmds=""
  202. # As "finish_cmds", except a single script fragment to be evaled but
  203. # not shown.
  204. finish_eval=""
  205. # Whether we should hardcode library paths into libraries.
  206. hardcode_into_libs=no
  207. # Compile-time system search path for libraries.
  208. sys_lib_search_path_spec="C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.3.0 C:/msys64/mingw64/lib/gcc C:/msys64/mingw64/x86_64-w64-mingw32/lib C:/msys64/mingw64/lib "
  209. # Detected run-time system search path for libraries.
  210. sys_lib_dlsearch_path_spec="/lib /usr/lib"
  211. # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
  212. configure_time_lt_sys_library_path=""
  213. # Whether dlopen is supported.
  214. dlopen_support=unknown
  215. # Whether dlopen of programs is supported.
  216. dlopen_self=unknown
  217. # Whether dlopen of statically linked programs is supported.
  218. dlopen_self_static=unknown
  219. # Commands to strip libraries.
  220. old_striplib="strip --strip-debug"
  221. striplib="strip --strip-unneeded"
  222. # The linker used to build libraries.
  223. LD="C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe"
  224. # How to create reloadable object files.
  225. reload_flag=" -r"
  226. reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
  227. # Commands used to build an old-style archive.
  228. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  229. # A language specific compiler.
  230. CC="gcc"
  231. # Is the compiler the GNU compiler?
  232. with_gcc=yes
  233. # Compiler flag to turn off builtin functions.
  234. no_builtin_flag=" -fno-builtin"
  235. # Additional compiler flags for building library objects.
  236. pic_flag=" -DDLL_EXPORT -DPIC"
  237. # How to pass a linker flag through the compiler.
  238. wl="-Wl,"
  239. # Compiler flag to prevent dynamic linking.
  240. link_static_flag="-static"
  241. # Does compiler simultaneously support -c and -o options?
  242. compiler_c_o="yes"
  243. # Whether or not to add -lc for building shared libraries.
  244. build_libtool_need_lc=yes
  245. # Whether or not to disallow shared libs when runtime libs are static.
  246. allow_libtool_libs_with_static_runtimes=yes
  247. # Compiler flag to allow reflexive dlopens.
  248. export_dynamic_flag_spec="\$wl--export-all-symbols"
  249. # Compiler flag to generate shared objects directly from archives.
  250. whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
  251. # Whether the compiler copes with passing no objects directly.
  252. compiler_needs_object="no"
  253. # Create an old-style archive from a shared archive.
  254. old_archive_from_new_cmds=""
  255. # Create a temporary old-style archive to link instead of a shared archive.
  256. old_archive_from_expsyms_cmds=""
  257. # Commands used to build a shared archive.
  258. archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags -o \$output_objdir/\$soname \$wl--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib"
  259. archive_expsym_cmds="if test DEF = \\\"\\\`\$SED -n -e 's/^[ ]*//' -e '/^\\\\(;.*\\\\)*\$/d' -e 's/^\\\\(EXPORTS\\\\|LIBRARY\\\\)\\\\([ ].*\\\\)*\$/DEF/p' -e q \$export_symbols\\\`\\\" ; then
  260. cp \$export_symbols \$output_objdir/\$soname.def;
  261. else
  262. echo EXPORTS > \$output_objdir/\$soname.def;
  263. cat \$export_symbols >> \$output_objdir/\$soname.def;
  264. fi~
  265. \$CC -shared \$output_objdir/\$soname.def \$libobjs \$deplibs \$compiler_flags -o \$output_objdir/\$soname \$wl--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib"
  266. # Commands used to build a loadable module if different from building
  267. # a shared archive.
  268. module_cmds=""
  269. module_expsym_cmds=""
  270. # Whether we are building with GNU ld or not.
  271. with_gnu_ld="yes"
  272. # Flag that allows shared libraries with undefined symbols to be built.
  273. allow_undefined_flag="unsupported"
  274. # Flag that enforces no undefined symbols.
  275. no_undefined_flag=""
  276. # Flag to hardcode $libdir into a binary during linking.
  277. # This must work even if $libdir does not exist
  278. hardcode_libdir_flag_spec="-L\$libdir"
  279. # Whether we need a single "-rpath" flag with a separated argument.
  280. hardcode_libdir_separator=""
  281. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  282. # DIR into the resulting binary.
  283. hardcode_direct=no
  284. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  285. # DIR into the resulting binary and the resulting library dependency is
  286. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  287. # library is relocated.
  288. hardcode_direct_absolute=no
  289. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  290. # into the resulting binary.
  291. hardcode_minus_L=no
  292. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  293. # into the resulting binary.
  294. hardcode_shlibpath_var=unsupported
  295. # Set to "yes" if building a shared library automatically hardcodes DIR
  296. # into the library and all subsequent libraries and executables linked
  297. # against it.
  298. hardcode_automatic=no
  299. # Set to yes if linker adds runtime paths of dependent libraries
  300. # to runtime path list.
  301. inherit_rpath=no
  302. # Whether libtool must link a program against all its dependency libraries.
  303. link_all_deplibs=unknown
  304. # Set to "yes" if exported symbols are required.
  305. always_export_symbols=no
  306. # The commands to list exported symbols.
  307. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED -e '/^[BCDGRS][ ]/s/.*[ ]\\\\([^ ]*\\\\)/\\\\1 DATA/;s/^.*[ ]__nm__\\\\([^ ]*\\\\)[ ][^ ]*/\\\\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //' | sort | uniq > \$export_symbols"
  308. # Symbols that should not be listed in the preloaded symbols.
  309. exclude_expsyms="[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname"
  310. # Symbols that must always be exported.
  311. include_expsyms=""
  312. # Commands necessary for linking programs (against libraries) with templates.
  313. prelink_cmds=""
  314. # Commands necessary for finishing linking programs.
  315. postlink_cmds=""
  316. # Specify filename containing input files.
  317. file_list_spec=""
  318. # How to hardcode a shared library path into an executable.
  319. hardcode_action=immediate
  320. # The directories searched by this compiler when creating a shared library.
  321. compiler_lib_search_dirs=""
  322. # Dependencies to place before and after the objects being linked to
  323. # create a shared library.
  324. predep_objects=""
  325. postdep_objects=""
  326. predeps=""
  327. postdeps=""
  328. # The library search path used internally by the compiler when linking
  329. # a shared library.
  330. compiler_lib_search_path=""
  331. # ### END LIBTOOL CONFIG
  332. # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
  333. # func_munge_path_list VARIABLE PATH
  334. # -----------------------------------
  335. # VARIABLE is name of variable containing _space_ separated list of
  336. # directories to be munged by the contents of PATH, which is string
  337. # having a format:
  338. # "DIR[:DIR]:"
  339. # string "DIR[ DIR]" will be prepended to VARIABLE
  340. # ":DIR[:DIR]"
  341. # string "DIR[ DIR]" will be appended to VARIABLE
  342. # "DIRP[:DIRP]::[DIRA:]DIRA"
  343. # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
  344. # "DIRA[ DIRA]" will be appended to VARIABLE
  345. # "DIR[:DIR]"
  346. # VARIABLE will be replaced by "DIR[ DIR]"
  347. func_munge_path_list ()
  348. {
  349. case x$2 in
  350. x)
  351. ;;
  352. *:)
  353. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
  354. ;;
  355. x:*)
  356. eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
  357. ;;
  358. *::*)
  359. eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
  360. eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
  361. ;;
  362. *)
  363. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
  364. ;;
  365. esac
  366. }
  367. # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
  368. func_cc_basename ()
  369. {
  370. for cc_temp in $*""; do
  371. case $cc_temp in
  372. compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
  373. distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
  374. \-*) ;;
  375. *) break;;
  376. esac
  377. done
  378. func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
  379. }
  380. # ### END FUNCTIONS SHARED WITH CONFIGURE
  381. #! /bin/sh
  382. ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
  383. ## by inline-source v2014-01-03.01
  384. # libtool (GNU libtool) 2.4.6
  385. # Provide generalized library-building support services.
  386. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  387. # Copyright (C) 1996-2015 Free Software Foundation, Inc.
  388. # This is free software; see the source for copying conditions. There is NO
  389. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  390. # GNU Libtool is free software; you can redistribute it and/or modify
  391. # it under the terms of the GNU General Public License as published by
  392. # the Free Software Foundation; either version 2 of the License, or
  393. # (at your option) any later version.
  394. #
  395. # As a special exception to the GNU General Public License,
  396. # if you distribute this file as part of a program or library that
  397. # is built using GNU Libtool, you may include this file under the
  398. # same distribution terms that you use for the rest of that program.
  399. #
  400. # GNU Libtool is distributed in the hope that it will be useful, but
  401. # WITHOUT ANY WARRANTY; without even the implied warranty of
  402. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  403. # General Public License for more details.
  404. #
  405. # You should have received a copy of the GNU General Public License
  406. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  407. PROGRAM=libtool
  408. PACKAGE=libtool
  409. VERSION="2.4.6 Debian-2.4.6-2"
  410. package_revision=2.4.6
  411. ## ------ ##
  412. ## Usage. ##
  413. ## ------ ##
  414. # Run './libtool --help' for help with using this script from the
  415. # command line.
  416. ## ------------------------------- ##
  417. ## User overridable command paths. ##
  418. ## ------------------------------- ##
  419. # After configure completes, it has a better idea of some of the
  420. # shell tools we need than the defaults used by the functions shared
  421. # with bootstrap, so set those here where they can still be over-
  422. # ridden by the user, but otherwise take precedence.
  423. : ${AUTOCONF="autoconf"}
  424. : ${AUTOMAKE="automake"}
  425. ## -------------------------- ##
  426. ## Source external libraries. ##
  427. ## -------------------------- ##
  428. # Much of our low-level functionality needs to be sourced from external
  429. # libraries, which are installed to $pkgauxdir.
  430. # Set a version string for this script.
  431. scriptversion=2015-01-20.17; # UTC
  432. # General shell script boiler plate, and helper functions.
  433. # Written by Gary V. Vaughan, 2004
  434. # Copyright (C) 2004-2015 Free Software Foundation, Inc.
  435. # This is free software; see the source for copying conditions. There is NO
  436. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  437. # This program is free software; you can redistribute it and/or modify
  438. # it under the terms of the GNU General Public License as published by
  439. # the Free Software Foundation; either version 3 of the License, or
  440. # (at your option) any later version.
  441. # As a special exception to the GNU General Public License, if you distribute
  442. # this file as part of a program or library that is built using GNU Libtool,
  443. # you may include this file under the same distribution terms that you use
  444. # for the rest of that program.
  445. # This program is distributed in the hope that it will be useful,
  446. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  447. # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
  448. # General Public License for more details.
  449. # You should have received a copy of the GNU General Public License
  450. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  451. # Please report bugs or propose patches to gary@gnu.org.
  452. ## ------ ##
  453. ## Usage. ##
  454. ## ------ ##
  455. # Evaluate this file near the top of your script to gain access to
  456. # the functions and variables defined here:
  457. #
  458. # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  459. #
  460. # If you need to override any of the default environment variable
  461. # settings, do that before evaluating this file.
  462. ## -------------------- ##
  463. ## Shell normalisation. ##
  464. ## -------------------- ##
  465. # Some shells need a little help to be as Bourne compatible as possible.
  466. # Before doing anything else, make sure all that help has been provided!
  467. DUALCASE=1; export DUALCASE # for MKS sh
  468. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  469. emulate sh
  470. NULLCMD=:
  471. # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  472. # is contrary to our usage. Disable this feature.
  473. alias -g '${1+"$@"}'='"$@"'
  474. setopt NO_GLOB_SUBST
  475. else
  476. case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  477. fi
  478. # NLS nuisances: We save the old values in case they are required later.
  479. _G_user_locale=
  480. _G_safe_locale=
  481. for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  482. do
  483. eval "if test set = \"\${$_G_var+set}\"; then
  484. save_$_G_var=\$$_G_var
  485. $_G_var=C
  486. export $_G_var
  487. _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  488. _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  489. fi"
  490. done
  491. # CDPATH.
  492. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  493. # Make sure IFS has a sensible default
  494. sp=' '
  495. nl='
  496. '
  497. IFS="$sp $nl"
  498. # There are apparently some retarded systems that use ';' as a PATH separator!
  499. if test "${PATH_SEPARATOR+set}" != set; then
  500. PATH_SEPARATOR=:
  501. (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  502. (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  503. PATH_SEPARATOR=';'
  504. }
  505. fi
  506. ## ------------------------- ##
  507. ## Locate command utilities. ##
  508. ## ------------------------- ##
  509. # func_executable_p FILE
  510. # ----------------------
  511. # Check that FILE is an executable regular file.
  512. func_executable_p ()
  513. {
  514. test -f "$1" && test -x "$1"
  515. }
  516. # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  517. # --------------------------------------------
  518. # Search for either a program that responds to --version with output
  519. # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  520. # trying all the directories in PATH with each of the elements of
  521. # PROGS_LIST.
  522. #
  523. # CHECK_FUNC should accept the path to a candidate program, and
  524. # set $func_check_prog_result if it truncates its output less than
  525. # $_G_path_prog_max characters.
  526. func_path_progs ()
  527. {
  528. _G_progs_list=$1
  529. _G_check_func=$2
  530. _G_PATH=${3-"$PATH"}
  531. _G_path_prog_max=0
  532. _G_path_prog_found=false
  533. _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
  534. for _G_dir in $_G_PATH; do
  535. IFS=$_G_save_IFS
  536. test -z "$_G_dir" && _G_dir=.
  537. for _G_prog_name in $_G_progs_list; do
  538. for _exeext in '' .EXE; do
  539. _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  540. func_executable_p "$_G_path_prog" || continue
  541. case `"$_G_path_prog" --version 2>&1` in
  542. *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  543. *) $_G_check_func $_G_path_prog
  544. func_path_progs_result=$func_check_prog_result
  545. ;;
  546. esac
  547. $_G_path_prog_found && break 3
  548. done
  549. done
  550. done
  551. IFS=$_G_save_IFS
  552. test -z "$func_path_progs_result" && {
  553. echo "no acceptable sed could be found in \$PATH" >&2
  554. exit 1
  555. }
  556. }
  557. # We want to be able to use the functions in this file before configure
  558. # has figured out where the best binaries are kept, which means we have
  559. # to search for them ourselves - except when the results are already set
  560. # where we skip the searches.
  561. # Unless the user overrides by setting SED, search the path for either GNU
  562. # sed, or the sed that truncates its output the least.
  563. test -z "$SED" && {
  564. _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  565. for _G_i in 1 2 3 4 5 6 7; do
  566. _G_sed_script=$_G_sed_script$nl$_G_sed_script
  567. done
  568. echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  569. _G_sed_script=
  570. func_check_prog_sed ()
  571. {
  572. _G_path_prog=$1
  573. _G_count=0
  574. printf 0123456789 >conftest.in
  575. while :
  576. do
  577. cat conftest.in conftest.in >conftest.tmp
  578. mv conftest.tmp conftest.in
  579. cp conftest.in conftest.nl
  580. echo '' >> conftest.nl
  581. "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  582. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  583. _G_count=`expr $_G_count + 1`
  584. if test "$_G_count" -gt "$_G_path_prog_max"; then
  585. # Best one so far, save it but keep looking for a better one
  586. func_check_prog_result=$_G_path_prog
  587. _G_path_prog_max=$_G_count
  588. fi
  589. # 10*(2^10) chars as input seems more than enough
  590. test 10 -lt "$_G_count" && break
  591. done
  592. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  593. }
  594. func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
  595. rm -f conftest.sed
  596. SED=$func_path_progs_result
  597. }
  598. # Unless the user overrides by setting GREP, search the path for either GNU
  599. # grep, or the grep that truncates its output the least.
  600. test -z "$GREP" && {
  601. func_check_prog_grep ()
  602. {
  603. _G_path_prog=$1
  604. _G_count=0
  605. _G_path_prog_max=0
  606. printf 0123456789 >conftest.in
  607. while :
  608. do
  609. cat conftest.in conftest.in >conftest.tmp
  610. mv conftest.tmp conftest.in
  611. cp conftest.in conftest.nl
  612. echo 'GREP' >> conftest.nl
  613. "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  614. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  615. _G_count=`expr $_G_count + 1`
  616. if test "$_G_count" -gt "$_G_path_prog_max"; then
  617. # Best one so far, save it but keep looking for a better one
  618. func_check_prog_result=$_G_path_prog
  619. _G_path_prog_max=$_G_count
  620. fi
  621. # 10*(2^10) chars as input seems more than enough
  622. test 10 -lt "$_G_count" && break
  623. done
  624. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  625. }
  626. func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
  627. GREP=$func_path_progs_result
  628. }
  629. ## ------------------------------- ##
  630. ## User overridable command paths. ##
  631. ## ------------------------------- ##
  632. # All uppercase variable names are used for environment variables. These
  633. # variables can be overridden by the user before calling a script that
  634. # uses them if a suitable command of that name is not already available
  635. # in the command search PATH.
  636. : ${CP="cp -f"}
  637. : ${ECHO="printf %s\n"}
  638. : ${EGREP="$GREP -E"}
  639. : ${FGREP="$GREP -F"}
  640. : ${LN_S="ln -s"}
  641. : ${MAKE="make"}
  642. : ${MKDIR="mkdir"}
  643. : ${MV="mv -f"}
  644. : ${RM="rm -f"}
  645. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  646. ## -------------------- ##
  647. ## Useful sed snippets. ##
  648. ## -------------------- ##
  649. sed_dirname='s|/[^/]*$||'
  650. sed_basename='s|^.*/||'
  651. # Sed substitution that helps us do robust quoting. It backslashifies
  652. # metacharacters that are still active within double-quoted strings.
  653. sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  654. # Same as above, but do not quote variable references.
  655. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  656. # Sed substitution that turns a string into a regex matching for the
  657. # string literally.
  658. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  659. # Sed substitution that converts a w32 file name or path
  660. # that contains forward slashes, into one that contains
  661. # (escaped) backslashes. A very naive implementation.
  662. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  663. # Re-'\' parameter expansions in output of sed_double_quote_subst that
  664. # were '\'-ed in input to the same. If an odd number of '\' preceded a
  665. # '$' in input to sed_double_quote_subst, that '$' was protected from
  666. # expansion. Since each input '\' is now two '\'s, look for any number
  667. # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
  668. _G_bs='\\'
  669. _G_bs2='\\\\'
  670. _G_bs4='\\\\\\\\'
  671. _G_dollar='\$'
  672. sed_double_backslash="\
  673. s/$_G_bs4/&\\
  674. /g
  675. s/^$_G_bs2$_G_dollar/$_G_bs&/
  676. s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  677. s/\n//g"
  678. ## ----------------- ##
  679. ## Global variables. ##
  680. ## ----------------- ##
  681. # Except for the global variables explicitly listed below, the following
  682. # functions in the '^func_' namespace, and the '^require_' namespace
  683. # variables initialised in the 'Resource management' section, sourcing
  684. # this file will not pollute your global namespace with anything
  685. # else. There's no portable way to scope variables in Bourne shell
  686. # though, so actually running these functions will sometimes place
  687. # results into a variable named after the function, and often use
  688. # temporary variables in the '^_G_' namespace. If you are careful to
  689. # avoid using those namespaces casually in your sourcing script, things
  690. # should continue to work as you expect. And, of course, you can freely
  691. # overwrite any of the functions or variables defined here before
  692. # calling anything to customize them.
  693. EXIT_SUCCESS=0
  694. EXIT_FAILURE=1
  695. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  696. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  697. # Allow overriding, eg assuming that you follow the convention of
  698. # putting '$debug_cmd' at the start of all your functions, you can get
  699. # bash to show function call trace with:
  700. #
  701. # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  702. debug_cmd=${debug_cmd-":"}
  703. exit_cmd=:
  704. # By convention, finish your script with:
  705. #
  706. # exit $exit_status
  707. #
  708. # so that you can set exit_status to non-zero if you want to indicate
  709. # something went wrong during execution without actually bailing out at
  710. # the point of failure.
  711. exit_status=$EXIT_SUCCESS
  712. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  713. # is ksh but when the shell is invoked as "sh" and the current value of
  714. # the _XPG environment variable is not equal to 1 (one), the special
  715. # positional parameter $0, within a function call, is the name of the
  716. # function.
  717. progpath=$0
  718. # The name of this program.
  719. progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  720. # Make sure we have an absolute progpath for reexecution:
  721. case $progpath in
  722. [\\/]*|[A-Za-z]:\\*) ;;
  723. *[\\/]*)
  724. progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  725. progdir=`cd "$progdir" && pwd`
  726. progpath=$progdir/$progname
  727. ;;
  728. *)
  729. _G_IFS=$IFS
  730. IFS=${PATH_SEPARATOR-:}
  731. for progdir in $PATH; do
  732. IFS=$_G_IFS
  733. test -x "$progdir/$progname" && break
  734. done
  735. IFS=$_G_IFS
  736. test -n "$progdir" || progdir=`pwd`
  737. progpath=$progdir/$progname
  738. ;;
  739. esac
  740. ## ----------------- ##
  741. ## Standard options. ##
  742. ## ----------------- ##
  743. # The following options affect the operation of the functions defined
  744. # below, and should be set appropriately depending on run-time para-
  745. # meters passed on the command line.
  746. opt_dry_run=false
  747. opt_quiet=false
  748. opt_verbose=false
  749. # Categories 'all' and 'none' are always available. Append any others
  750. # you will pass as the first argument to func_warning from your own
  751. # code.
  752. warning_categories=
  753. # By default, display warnings according to 'opt_warning_types'. Set
  754. # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
  755. # treat the next displayed warning as a fatal error.
  756. warning_func=func_warn_and_continue
  757. # Set to 'all' to display all warnings, 'none' to suppress all
  758. # warnings, or a space delimited list of some subset of
  759. # 'warning_categories' to display only the listed warnings.
  760. opt_warning_types=all
  761. ## -------------------- ##
  762. ## Resource management. ##
  763. ## -------------------- ##
  764. # This section contains definitions for functions that each ensure a
  765. # particular resource (a file, or a non-empty configuration variable for
  766. # example) is available, and if appropriate to extract default values
  767. # from pertinent package files. Call them using their associated
  768. # 'require_*' variable to ensure that they are executed, at most, once.
  769. #
  770. # It's entirely deliberate that calling these functions can set
  771. # variables that don't obey the namespace limitations obeyed by the rest
  772. # of this file, in order that that they be as useful as possible to
  773. # callers.
  774. # require_term_colors
  775. # -------------------
  776. # Allow display of bold text on terminals that support it.
  777. require_term_colors=func_require_term_colors
  778. func_require_term_colors ()
  779. {
  780. $debug_cmd
  781. test -t 1 && {
  782. # COLORTERM and USE_ANSI_COLORS environment variables take
  783. # precedence, because most terminfo databases neglect to describe
  784. # whether color sequences are supported.
  785. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  786. if test 1 = "$USE_ANSI_COLORS"; then
  787. # Standard ANSI escape sequences
  788. tc_reset=''
  789. tc_bold=''; tc_standout=''
  790. tc_red=''; tc_green=''
  791. tc_blue=''; tc_cyan=''
  792. else
  793. # Otherwise trust the terminfo database after all.
  794. test -n "`tput sgr0 2>/dev/null`" && {
  795. tc_reset=`tput sgr0`
  796. test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
  797. tc_standout=$tc_bold
  798. test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
  799. test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
  800. test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
  801. test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
  802. test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
  803. }
  804. fi
  805. }
  806. require_term_colors=:
  807. }
  808. ## ----------------- ##
  809. ## Function library. ##
  810. ## ----------------- ##
  811. # This section contains a variety of useful functions to call in your
  812. # scripts. Take note of the portable wrappers for features provided by
  813. # some modern shells, which will fall back to slower equivalents on
  814. # less featureful shells.
  815. # func_append VAR VALUE
  816. # ---------------------
  817. # Append VALUE onto the existing contents of VAR.
  818. # We should try to minimise forks, especially on Windows where they are
  819. # unreasonably slow, so skip the feature probes when bash or zsh are
  820. # being used:
  821. if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
  822. : ${_G_HAVE_ARITH_OP="yes"}
  823. : ${_G_HAVE_XSI_OPS="yes"}
  824. # The += operator was introduced in bash 3.1
  825. case $BASH_VERSION in
  826. [12].* | 3.0 | 3.0*) ;;
  827. *)
  828. : ${_G_HAVE_PLUSEQ_OP="yes"}
  829. ;;
  830. esac
  831. fi
  832. # _G_HAVE_PLUSEQ_OP
  833. # Can be empty, in which case the shell is probed, "yes" if += is
  834. # useable or anything else if it does not work.
  835. test -z "$_G_HAVE_PLUSEQ_OP" \
  836. && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
  837. && _G_HAVE_PLUSEQ_OP=yes
  838. if test yes = "$_G_HAVE_PLUSEQ_OP"
  839. then
  840. # This is an XSI compatible shell, allowing a faster implementation...
  841. eval 'func_append ()
  842. {
  843. $debug_cmd
  844. eval "$1+=\$2"
  845. }'
  846. else
  847. # ...otherwise fall back to using expr, which is often a shell builtin.
  848. func_append ()
  849. {
  850. $debug_cmd
  851. eval "$1=\$$1\$2"
  852. }
  853. fi
  854. # func_append_quoted VAR VALUE
  855. # ----------------------------
  856. # Quote VALUE and append to the end of shell variable VAR, separated
  857. # by a space.
  858. if test yes = "$_G_HAVE_PLUSEQ_OP"; then
  859. eval 'func_append_quoted ()
  860. {
  861. $debug_cmd
  862. func_quote_for_eval "$2"
  863. eval "$1+=\\ \$func_quote_for_eval_result"
  864. }'
  865. else
  866. func_append_quoted ()
  867. {
  868. $debug_cmd
  869. func_quote_for_eval "$2"
  870. eval "$1=\$$1\\ \$func_quote_for_eval_result"
  871. }
  872. fi
  873. # func_append_uniq VAR VALUE
  874. # --------------------------
  875. # Append unique VALUE onto the existing contents of VAR, assuming
  876. # entries are delimited by the first character of VALUE. For example:
  877. #
  878. # func_append_uniq options " --another-option option-argument"
  879. #
  880. # will only append to $options if " --another-option option-argument "
  881. # is not already present somewhere in $options already (note spaces at
  882. # each end implied by leading space in second argument).
  883. func_append_uniq ()
  884. {
  885. $debug_cmd
  886. eval _G_current_value='`$ECHO $'$1'`'
  887. _G_delim=`expr "$2" : '\(.\)'`
  888. case $_G_delim$_G_current_value$_G_delim in
  889. *"$2$_G_delim"*) ;;
  890. *) func_append "$@" ;;
  891. esac
  892. }
  893. # func_arith TERM...
  894. # ------------------
  895. # Set func_arith_result to the result of evaluating TERMs.
  896. test -z "$_G_HAVE_ARITH_OP" \
  897. && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
  898. && _G_HAVE_ARITH_OP=yes
  899. if test yes = "$_G_HAVE_ARITH_OP"; then
  900. eval 'func_arith ()
  901. {
  902. $debug_cmd
  903. func_arith_result=$(( $* ))
  904. }'
  905. else
  906. func_arith ()
  907. {
  908. $debug_cmd
  909. func_arith_result=`expr "$@"`
  910. }
  911. fi
  912. # func_basename FILE
  913. # ------------------
  914. # Set func_basename_result to FILE with everything up to and including
  915. # the last / stripped.
  916. if test yes = "$_G_HAVE_XSI_OPS"; then
  917. # If this shell supports suffix pattern removal, then use it to avoid
  918. # forking. Hide the definitions single quotes in case the shell chokes
  919. # on unsupported syntax...
  920. _b='func_basename_result=${1##*/}'
  921. _d='case $1 in
  922. */*) func_dirname_result=${1%/*}$2 ;;
  923. * ) func_dirname_result=$3 ;;
  924. esac'
  925. else
  926. # ...otherwise fall back to using sed.
  927. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
  928. _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
  929. if test "X$func_dirname_result" = "X$1"; then
  930. func_dirname_result=$3
  931. else
  932. func_append func_dirname_result "$2"
  933. fi'
  934. fi
  935. eval 'func_basename ()
  936. {
  937. $debug_cmd
  938. '"$_b"'
  939. }'
  940. # func_dirname FILE APPEND NONDIR_REPLACEMENT
  941. # -------------------------------------------
  942. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  943. # otherwise set result to NONDIR_REPLACEMENT.
  944. eval 'func_dirname ()
  945. {
  946. $debug_cmd
  947. '"$_d"'
  948. }'
  949. # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
  950. # --------------------------------------------------------
  951. # Perform func_basename and func_dirname in a single function
  952. # call:
  953. # dirname: Compute the dirname of FILE. If nonempty,
  954. # add APPEND to the result, otherwise set result
  955. # to NONDIR_REPLACEMENT.
  956. # value returned in "$func_dirname_result"
  957. # basename: Compute filename of FILE.
  958. # value retuned in "$func_basename_result"
  959. # For efficiency, we do not delegate to the functions above but instead
  960. # duplicate the functionality here.
  961. eval 'func_dirname_and_basename ()
  962. {
  963. $debug_cmd
  964. '"$_b"'
  965. '"$_d"'
  966. }'
  967. # func_echo ARG...
  968. # ----------------
  969. # Echo program name prefixed message.
  970. func_echo ()
  971. {
  972. $debug_cmd
  973. _G_message=$*
  974. func_echo_IFS=$IFS
  975. IFS=$nl
  976. for _G_line in $_G_message; do
  977. IFS=$func_echo_IFS
  978. $ECHO "$progname: $_G_line"
  979. done
  980. IFS=$func_echo_IFS
  981. }
  982. # func_echo_all ARG...
  983. # --------------------
  984. # Invoke $ECHO with all args, space-separated.
  985. func_echo_all ()
  986. {
  987. $ECHO "$*"
  988. }
  989. # func_echo_infix_1 INFIX ARG...
  990. # ------------------------------
  991. # Echo program name, followed by INFIX on the first line, with any
  992. # additional lines not showing INFIX.
  993. func_echo_infix_1 ()
  994. {
  995. $debug_cmd
  996. $require_term_colors
  997. _G_infix=$1; shift
  998. _G_indent=$_G_infix
  999. _G_prefix="$progname: $_G_infix: "
  1000. _G_message=$*
  1001. # Strip color escape sequences before counting printable length
  1002. for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
  1003. do
  1004. test -n "$_G_tc" && {
  1005. _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
  1006. _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
  1007. }
  1008. done
  1009. _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
  1010. func_echo_infix_1_IFS=$IFS
  1011. IFS=$nl
  1012. for _G_line in $_G_message; do
  1013. IFS=$func_echo_infix_1_IFS
  1014. $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
  1015. _G_prefix=$_G_indent
  1016. done
  1017. IFS=$func_echo_infix_1_IFS
  1018. }
  1019. # func_error ARG...
  1020. # -----------------
  1021. # Echo program name prefixed message to standard error.
  1022. func_error ()
  1023. {
  1024. $debug_cmd
  1025. $require_term_colors
  1026. func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
  1027. }
  1028. # func_fatal_error ARG...
  1029. # -----------------------
  1030. # Echo program name prefixed message to standard error, and exit.
  1031. func_fatal_error ()
  1032. {
  1033. $debug_cmd
  1034. func_error "$*"
  1035. exit $EXIT_FAILURE
  1036. }
  1037. # func_grep EXPRESSION FILENAME
  1038. # -----------------------------
  1039. # Check whether EXPRESSION matches any line of FILENAME, without output.
  1040. func_grep ()
  1041. {
  1042. $debug_cmd
  1043. $GREP "$1" "$2" >/dev/null 2>&1
  1044. }
  1045. # func_len STRING
  1046. # ---------------
  1047. # Set func_len_result to the length of STRING. STRING may not
  1048. # start with a hyphen.
  1049. test -z "$_G_HAVE_XSI_OPS" \
  1050. && (eval 'x=a/b/c;
  1051. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1052. && _G_HAVE_XSI_OPS=yes
  1053. if test yes = "$_G_HAVE_XSI_OPS"; then
  1054. eval 'func_len ()
  1055. {
  1056. $debug_cmd
  1057. func_len_result=${#1}
  1058. }'
  1059. else
  1060. func_len ()
  1061. {
  1062. $debug_cmd
  1063. func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
  1064. }
  1065. fi
  1066. # func_mkdir_p DIRECTORY-PATH
  1067. # ---------------------------
  1068. # Make sure the entire path to DIRECTORY-PATH is available.
  1069. func_mkdir_p ()
  1070. {
  1071. $debug_cmd
  1072. _G_directory_path=$1
  1073. _G_dir_list=
  1074. if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
  1075. # Protect directory names starting with '-'
  1076. case $_G_directory_path in
  1077. -*) _G_directory_path=./$_G_directory_path ;;
  1078. esac
  1079. # While some portion of DIR does not yet exist...
  1080. while test ! -d "$_G_directory_path"; do
  1081. # ...make a list in topmost first order. Use a colon delimited
  1082. # list incase some portion of path contains whitespace.
  1083. _G_dir_list=$_G_directory_path:$_G_dir_list
  1084. # If the last portion added has no slash in it, the list is done
  1085. case $_G_directory_path in */*) ;; *) break ;; esac
  1086. # ...otherwise throw away the child directory and loop
  1087. _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
  1088. done
  1089. _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
  1090. func_mkdir_p_IFS=$IFS; IFS=:
  1091. for _G_dir in $_G_dir_list; do
  1092. IFS=$func_mkdir_p_IFS
  1093. # mkdir can fail with a 'File exist' error if two processes
  1094. # try to create one of the directories concurrently. Don't
  1095. # stop in that case!
  1096. $MKDIR "$_G_dir" 2>/dev/null || :
  1097. done
  1098. IFS=$func_mkdir_p_IFS
  1099. # Bail out if we (or some other process) failed to create a directory.
  1100. test -d "$_G_directory_path" || \
  1101. func_fatal_error "Failed to create '$1'"
  1102. fi
  1103. }
  1104. # func_mktempdir [BASENAME]
  1105. # -------------------------
  1106. # Make a temporary directory that won't clash with other running
  1107. # libtool processes, and avoids race conditions if possible. If
  1108. # given, BASENAME is the basename for that directory.
  1109. func_mktempdir ()
  1110. {
  1111. $debug_cmd
  1112. _G_template=${TMPDIR-/tmp}/${1-$progname}
  1113. if test : = "$opt_dry_run"; then
  1114. # Return a directory name, but don't create it in dry-run mode
  1115. _G_tmpdir=$_G_template-$$
  1116. else
  1117. # If mktemp works, use that first and foremost
  1118. _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
  1119. if test ! -d "$_G_tmpdir"; then
  1120. # Failing that, at least try and use $RANDOM to avoid a race
  1121. _G_tmpdir=$_G_template-${RANDOM-0}$$
  1122. func_mktempdir_umask=`umask`
  1123. umask 0077
  1124. $MKDIR "$_G_tmpdir"
  1125. umask $func_mktempdir_umask
  1126. fi
  1127. # If we're not in dry-run mode, bomb out on failure
  1128. test -d "$_G_tmpdir" || \
  1129. func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
  1130. fi
  1131. $ECHO "$_G_tmpdir"
  1132. }
  1133. # func_normal_abspath PATH
  1134. # ------------------------
  1135. # Remove doubled-up and trailing slashes, "." path components,
  1136. # and cancel out any ".." path components in PATH after making
  1137. # it an absolute path.
  1138. func_normal_abspath ()
  1139. {
  1140. $debug_cmd
  1141. # These SED scripts presuppose an absolute path with a trailing slash.
  1142. _G_pathcar='s|^/\([^/]*\).*$|\1|'
  1143. _G_pathcdr='s|^/[^/]*||'
  1144. _G_removedotparts=':dotsl
  1145. s|/\./|/|g
  1146. t dotsl
  1147. s|/\.$|/|'
  1148. _G_collapseslashes='s|/\{1,\}|/|g'
  1149. _G_finalslash='s|/*$|/|'
  1150. # Start from root dir and reassemble the path.
  1151. func_normal_abspath_result=
  1152. func_normal_abspath_tpath=$1
  1153. func_normal_abspath_altnamespace=
  1154. case $func_normal_abspath_tpath in
  1155. "")
  1156. # Empty path, that just means $cwd.
  1157. func_stripname '' '/' "`pwd`"
  1158. func_normal_abspath_result=$func_stripname_result
  1159. return
  1160. ;;
  1161. # The next three entries are used to spot a run of precisely
  1162. # two leading slashes without using negated character classes;
  1163. # we take advantage of case's first-match behaviour.
  1164. ///*)
  1165. # Unusual form of absolute path, do nothing.
  1166. ;;
  1167. //*)
  1168. # Not necessarily an ordinary path; POSIX reserves leading '//'
  1169. # and for example Cygwin uses it to access remote file shares
  1170. # over CIFS/SMB, so we conserve a leading double slash if found.
  1171. func_normal_abspath_altnamespace=/
  1172. ;;
  1173. /*)
  1174. # Absolute path, do nothing.
  1175. ;;
  1176. *)
  1177. # Relative path, prepend $cwd.
  1178. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  1179. ;;
  1180. esac
  1181. # Cancel out all the simple stuff to save iterations. We also want
  1182. # the path to end with a slash for ease of parsing, so make sure
  1183. # there is one (and only one) here.
  1184. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1185. -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
  1186. while :; do
  1187. # Processed it all yet?
  1188. if test / = "$func_normal_abspath_tpath"; then
  1189. # If we ascended to the root using ".." the result may be empty now.
  1190. if test -z "$func_normal_abspath_result"; then
  1191. func_normal_abspath_result=/
  1192. fi
  1193. break
  1194. fi
  1195. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1196. -e "$_G_pathcar"`
  1197. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1198. -e "$_G_pathcdr"`
  1199. # Figure out what to do with it
  1200. case $func_normal_abspath_tcomponent in
  1201. "")
  1202. # Trailing empty path component, ignore it.
  1203. ;;
  1204. ..)
  1205. # Parent dir; strip last assembled component from result.
  1206. func_dirname "$func_normal_abspath_result"
  1207. func_normal_abspath_result=$func_dirname_result
  1208. ;;
  1209. *)
  1210. # Actual path component, append it.
  1211. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
  1212. ;;
  1213. esac
  1214. done
  1215. # Restore leading double-slash if one was found on entry.
  1216. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  1217. }
  1218. # func_notquiet ARG...
  1219. # --------------------
  1220. # Echo program name prefixed message only when not in quiet mode.
  1221. func_notquiet ()
  1222. {
  1223. $debug_cmd
  1224. $opt_quiet || func_echo ${1+"$@"}
  1225. # A bug in bash halts the script if the last line of a function
  1226. # fails when set -e is in force, so we need another command to
  1227. # work around that:
  1228. :
  1229. }
  1230. # func_relative_path SRCDIR DSTDIR
  1231. # --------------------------------
  1232. # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
  1233. func_relative_path ()
  1234. {
  1235. $debug_cmd
  1236. func_relative_path_result=
  1237. func_normal_abspath "$1"
  1238. func_relative_path_tlibdir=$func_normal_abspath_result
  1239. func_normal_abspath "$2"
  1240. func_relative_path_tbindir=$func_normal_abspath_result
  1241. # Ascend the tree starting from libdir
  1242. while :; do
  1243. # check if we have found a prefix of bindir
  1244. case $func_relative_path_tbindir in
  1245. $func_relative_path_tlibdir)
  1246. # found an exact match
  1247. func_relative_path_tcancelled=
  1248. break
  1249. ;;
  1250. $func_relative_path_tlibdir*)
  1251. # found a matching prefix
  1252. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  1253. func_relative_path_tcancelled=$func_stripname_result
  1254. if test -z "$func_relative_path_result"; then
  1255. func_relative_path_result=.
  1256. fi
  1257. break
  1258. ;;
  1259. *)
  1260. func_dirname $func_relative_path_tlibdir
  1261. func_relative_path_tlibdir=$func_dirname_result
  1262. if test -z "$func_relative_path_tlibdir"; then
  1263. # Have to descend all the way to the root!
  1264. func_relative_path_result=../$func_relative_path_result
  1265. func_relative_path_tcancelled=$func_relative_path_tbindir
  1266. break
  1267. fi
  1268. func_relative_path_result=../$func_relative_path_result
  1269. ;;
  1270. esac
  1271. done
  1272. # Now calculate path; take care to avoid doubling-up slashes.
  1273. func_stripname '' '/' "$func_relative_path_result"
  1274. func_relative_path_result=$func_stripname_result
  1275. func_stripname '/' '/' "$func_relative_path_tcancelled"
  1276. if test -n "$func_stripname_result"; then
  1277. func_append func_relative_path_result "/$func_stripname_result"
  1278. fi
  1279. # Normalisation. If bindir is libdir, return '.' else relative path.
  1280. if test -n "$func_relative_path_result"; then
  1281. func_stripname './' '' "$func_relative_path_result"
  1282. func_relative_path_result=$func_stripname_result
  1283. fi
  1284. test -n "$func_relative_path_result" || func_relative_path_result=.
  1285. :
  1286. }
  1287. # func_quote_for_eval ARG...
  1288. # --------------------------
  1289. # Aesthetically quote ARGs to be evaled later.
  1290. # This function returns two values:
  1291. # i) func_quote_for_eval_result
  1292. # double-quoted, suitable for a subsequent eval
  1293. # ii) func_quote_for_eval_unquoted_result
  1294. # has all characters that are still active within double
  1295. # quotes backslashified.
  1296. func_quote_for_eval ()
  1297. {
  1298. $debug_cmd
  1299. func_quote_for_eval_unquoted_result=
  1300. func_quote_for_eval_result=
  1301. while test 0 -lt $#; do
  1302. case $1 in
  1303. *[\\\`\"\$]*)
  1304. _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
  1305. *)
  1306. _G_unquoted_arg=$1 ;;
  1307. esac
  1308. if test -n "$func_quote_for_eval_unquoted_result"; then
  1309. func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
  1310. else
  1311. func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
  1312. fi
  1313. case $_G_unquoted_arg in
  1314. # Double-quote args containing shell metacharacters to delay
  1315. # word splitting, command substitution and variable expansion
  1316. # for a subsequent eval.
  1317. # Many Bourne shells cannot handle close brackets correctly
  1318. # in scan sets, so we specify it separately.
  1319. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1320. _G_quoted_arg=\"$_G_unquoted_arg\"
  1321. ;;
  1322. *)
  1323. _G_quoted_arg=$_G_unquoted_arg
  1324. ;;
  1325. esac
  1326. if test -n "$func_quote_for_eval_result"; then
  1327. func_append func_quote_for_eval_result " $_G_quoted_arg"
  1328. else
  1329. func_append func_quote_for_eval_result "$_G_quoted_arg"
  1330. fi
  1331. shift
  1332. done
  1333. }
  1334. # func_quote_for_expand ARG
  1335. # -------------------------
  1336. # Aesthetically quote ARG to be evaled later; same as above,
  1337. # but do not quote variable references.
  1338. func_quote_for_expand ()
  1339. {
  1340. $debug_cmd
  1341. case $1 in
  1342. *[\\\`\"]*)
  1343. _G_arg=`$ECHO "$1" | $SED \
  1344. -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
  1345. *)
  1346. _G_arg=$1 ;;
  1347. esac
  1348. case $_G_arg in
  1349. # Double-quote args containing shell metacharacters to delay
  1350. # word splitting and command substitution for a subsequent eval.
  1351. # Many Bourne shells cannot handle close brackets correctly
  1352. # in scan sets, so we specify it separately.
  1353. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1354. _G_arg=\"$_G_arg\"
  1355. ;;
  1356. esac
  1357. func_quote_for_expand_result=$_G_arg
  1358. }
  1359. # func_stripname PREFIX SUFFIX NAME
  1360. # ---------------------------------
  1361. # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
  1362. # PREFIX and SUFFIX must not contain globbing or regex special
  1363. # characters, hashes, percent signs, but SUFFIX may contain a leading
  1364. # dot (in which case that matches only a dot).
  1365. if test yes = "$_G_HAVE_XSI_OPS"; then
  1366. eval 'func_stripname ()
  1367. {
  1368. $debug_cmd
  1369. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  1370. # positional parameters, so assign one to ordinary variable first.
  1371. func_stripname_result=$3
  1372. func_stripname_result=${func_stripname_result#"$1"}
  1373. func_stripname_result=${func_stripname_result%"$2"}
  1374. }'
  1375. else
  1376. func_stripname ()
  1377. {
  1378. $debug_cmd
  1379. case $2 in
  1380. .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
  1381. *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
  1382. esac
  1383. }
  1384. fi
  1385. # func_show_eval CMD [FAIL_EXP]
  1386. # -----------------------------
  1387. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1388. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1389. # is given, then evaluate it.
  1390. func_show_eval ()
  1391. {
  1392. $debug_cmd
  1393. _G_cmd=$1
  1394. _G_fail_exp=${2-':'}
  1395. func_quote_for_expand "$_G_cmd"
  1396. eval "func_notquiet $func_quote_for_expand_result"
  1397. $opt_dry_run || {
  1398. eval "$_G_cmd"
  1399. _G_status=$?
  1400. if test 0 -ne "$_G_status"; then
  1401. eval "(exit $_G_status); $_G_fail_exp"
  1402. fi
  1403. }
  1404. }
  1405. # func_show_eval_locale CMD [FAIL_EXP]
  1406. # ------------------------------------
  1407. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1408. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1409. # is given, then evaluate it. Use the saved locale for evaluation.
  1410. func_show_eval_locale ()
  1411. {
  1412. $debug_cmd
  1413. _G_cmd=$1
  1414. _G_fail_exp=${2-':'}
  1415. $opt_quiet || {
  1416. func_quote_for_expand "$_G_cmd"
  1417. eval "func_echo $func_quote_for_expand_result"
  1418. }
  1419. $opt_dry_run || {
  1420. eval "$_G_user_locale
  1421. $_G_cmd"
  1422. _G_status=$?
  1423. eval "$_G_safe_locale"
  1424. if test 0 -ne "$_G_status"; then
  1425. eval "(exit $_G_status); $_G_fail_exp"
  1426. fi
  1427. }
  1428. }
  1429. # func_tr_sh
  1430. # ----------
  1431. # Turn $1 into a string suitable for a shell variable name.
  1432. # Result is stored in $func_tr_sh_result. All characters
  1433. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1434. # if $1 begins with a digit, a '_' is prepended as well.
  1435. func_tr_sh ()
  1436. {
  1437. $debug_cmd
  1438. case $1 in
  1439. [0-9]* | *[!a-zA-Z0-9_]*)
  1440. func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
  1441. ;;
  1442. * )
  1443. func_tr_sh_result=$1
  1444. ;;
  1445. esac
  1446. }
  1447. # func_verbose ARG...
  1448. # -------------------
  1449. # Echo program name prefixed message in verbose mode only.
  1450. func_verbose ()
  1451. {
  1452. $debug_cmd
  1453. $opt_verbose && func_echo "$*"
  1454. :
  1455. }
  1456. # func_warn_and_continue ARG...
  1457. # -----------------------------
  1458. # Echo program name prefixed warning message to standard error.
  1459. func_warn_and_continue ()
  1460. {
  1461. $debug_cmd
  1462. $require_term_colors
  1463. func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
  1464. }
  1465. # func_warning CATEGORY ARG...
  1466. # ----------------------------
  1467. # Echo program name prefixed warning message to standard error. Warning
  1468. # messages can be filtered according to CATEGORY, where this function
  1469. # elides messages where CATEGORY is not listed in the global variable
  1470. # 'opt_warning_types'.
  1471. func_warning ()
  1472. {
  1473. $debug_cmd
  1474. # CATEGORY must be in the warning_categories list!
  1475. case " $warning_categories " in
  1476. *" $1 "*) ;;
  1477. *) func_internal_error "invalid warning category '$1'" ;;
  1478. esac
  1479. _G_category=$1
  1480. shift
  1481. case " $opt_warning_types " in
  1482. *" $_G_category "*) $warning_func ${1+"$@"} ;;
  1483. esac
  1484. }
  1485. # func_sort_ver VER1 VER2
  1486. # -----------------------
  1487. # 'sort -V' is not generally available.
  1488. # Note this deviates from the version comparison in automake
  1489. # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
  1490. # but this should suffice as we won't be specifying old
  1491. # version formats or redundant trailing .0 in bootstrap.conf.
  1492. # If we did want full compatibility then we should probably
  1493. # use m4_version_compare from autoconf.
  1494. func_sort_ver ()
  1495. {
  1496. $debug_cmd
  1497. printf '%s\n%s\n' "$1" "$2" \
  1498. | 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
  1499. }
  1500. # func_lt_ver PREV CURR
  1501. # ---------------------
  1502. # Return true if PREV and CURR are in the correct order according to
  1503. # func_sort_ver, otherwise false. Use it like this:
  1504. #
  1505. # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
  1506. func_lt_ver ()
  1507. {
  1508. $debug_cmd
  1509. test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
  1510. }
  1511. # Local variables:
  1512. # mode: shell-script
  1513. # sh-indentation: 2
  1514. # eval: (add-hook 'before-save-hook 'time-stamp)
  1515. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1516. # time-stamp-time-zone: "UTC"
  1517. # End:
  1518. #! /bin/sh
  1519. # Set a version string for this script.
  1520. scriptversion=2014-01-07.03; # UTC
  1521. # A portable, pluggable option parser for Bourne shell.
  1522. # Written by Gary V. Vaughan, 2010
  1523. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  1524. # This is free software; see the source for copying conditions. There is NO
  1525. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1526. # This program is free software: you can redistribute it and/or modify
  1527. # it under the terms of the GNU General Public License as published by
  1528. # the Free Software Foundation, either version 3 of the License, or
  1529. # (at your option) any later version.
  1530. # This program is distributed in the hope that it will be useful,
  1531. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  1532. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1533. # GNU General Public License for more details.
  1534. # You should have received a copy of the GNU General Public License
  1535. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  1536. # Please report bugs or propose patches to gary@gnu.org.
  1537. ## ------ ##
  1538. ## Usage. ##
  1539. ## ------ ##
  1540. # This file is a library for parsing options in your shell scripts along
  1541. # with assorted other useful supporting features that you can make use
  1542. # of too.
  1543. #
  1544. # For the simplest scripts you might need only:
  1545. #
  1546. # #!/bin/sh
  1547. # . relative/path/to/funclib.sh
  1548. # . relative/path/to/options-parser
  1549. # scriptversion=1.0
  1550. # func_options ${1+"$@"}
  1551. # eval set dummy "$func_options_result"; shift
  1552. # ...rest of your script...
  1553. #
  1554. # In order for the '--version' option to work, you will need to have a
  1555. # suitably formatted comment like the one at the top of this file
  1556. # starting with '# Written by ' and ending with '# warranty; '.
  1557. #
  1558. # For '-h' and '--help' to work, you will also need a one line
  1559. # description of your script's purpose in a comment directly above the
  1560. # '# Written by ' line, like the one at the top of this file.
  1561. #
  1562. # The default options also support '--debug', which will turn on shell
  1563. # execution tracing (see the comment above debug_cmd below for another
  1564. # use), and '--verbose' and the func_verbose function to allow your script
  1565. # to display verbose messages only when your user has specified
  1566. # '--verbose'.
  1567. #
  1568. # After sourcing this file, you can plug processing for additional
  1569. # options by amending the variables from the 'Configuration' section
  1570. # below, and following the instructions in the 'Option parsing'
  1571. # section further down.
  1572. ## -------------- ##
  1573. ## Configuration. ##
  1574. ## -------------- ##
  1575. # You should override these variables in your script after sourcing this
  1576. # file so that they reflect the customisations you have added to the
  1577. # option parser.
  1578. # The usage line for option parsing errors and the start of '-h' and
  1579. # '--help' output messages. You can embed shell variables for delayed
  1580. # expansion at the time the message is displayed, but you will need to
  1581. # quote other shell meta-characters carefully to prevent them being
  1582. # expanded when the contents are evaled.
  1583. usage='$progpath [OPTION]...'
  1584. # Short help message in response to '-h' and '--help'. Add to this or
  1585. # override it after sourcing this library to reflect the full set of
  1586. # options your script accepts.
  1587. usage_message="\
  1588. --debug enable verbose shell tracing
  1589. -W, --warnings=CATEGORY
  1590. report the warnings falling in CATEGORY [all]
  1591. -v, --verbose verbosely report processing
  1592. --version print version information and exit
  1593. -h, --help print short or long help message and exit
  1594. "
  1595. # Additional text appended to 'usage_message' in response to '--help'.
  1596. long_help_message="
  1597. Warning categories include:
  1598. 'all' show all warnings
  1599. 'none' turn off all the warnings
  1600. 'error' warnings are treated as fatal errors"
  1601. # Help message printed before fatal option parsing errors.
  1602. fatal_help="Try '\$progname --help' for more information."
  1603. ## ------------------------- ##
  1604. ## Hook function management. ##
  1605. ## ------------------------- ##
  1606. # This section contains functions for adding, removing, and running hooks
  1607. # to the main code. A hook is just a named list of of function, that can
  1608. # be run in order later on.
  1609. # func_hookable FUNC_NAME
  1610. # -----------------------
  1611. # Declare that FUNC_NAME will run hooks added with
  1612. # 'func_add_hook FUNC_NAME ...'.
  1613. func_hookable ()
  1614. {
  1615. $debug_cmd
  1616. func_append hookable_fns " $1"
  1617. }
  1618. # func_add_hook FUNC_NAME HOOK_FUNC
  1619. # ---------------------------------
  1620. # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
  1621. # first have been declared "hookable" by a call to 'func_hookable'.
  1622. func_add_hook ()
  1623. {
  1624. $debug_cmd
  1625. case " $hookable_fns " in
  1626. *" $1 "*) ;;
  1627. *) func_fatal_error "'$1' does not accept hook functions." ;;
  1628. esac
  1629. eval func_append ${1}_hooks '" $2"'
  1630. }
  1631. # func_remove_hook FUNC_NAME HOOK_FUNC
  1632. # ------------------------------------
  1633. # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
  1634. func_remove_hook ()
  1635. {
  1636. $debug_cmd
  1637. eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
  1638. }
  1639. # func_run_hooks FUNC_NAME [ARG]...
  1640. # ---------------------------------
  1641. # Run all hook functions registered to FUNC_NAME.
  1642. # It is assumed that the list of hook functions contains nothing more
  1643. # than a whitespace-delimited list of legal shell function names, and
  1644. # no effort is wasted trying to catch shell meta-characters or preserve
  1645. # whitespace.
  1646. func_run_hooks ()
  1647. {
  1648. $debug_cmd
  1649. case " $hookable_fns " in
  1650. *" $1 "*) ;;
  1651. *) func_fatal_error "'$1' does not support hook funcions.n" ;;
  1652. esac
  1653. eval _G_hook_fns=\$$1_hooks; shift
  1654. for _G_hook in $_G_hook_fns; do
  1655. eval $_G_hook '"$@"'
  1656. # store returned options list back into positional
  1657. # parameters for next 'cmd' execution.
  1658. eval _G_hook_result=\$${_G_hook}_result
  1659. eval set dummy "$_G_hook_result"; shift
  1660. done
  1661. func_quote_for_eval ${1+"$@"}
  1662. func_run_hooks_result=$func_quote_for_eval_result
  1663. }
  1664. ## --------------- ##
  1665. ## Option parsing. ##
  1666. ## --------------- ##
  1667. # In order to add your own option parsing hooks, you must accept the
  1668. # full positional parameter list in your hook function, remove any
  1669. # options that you action, and then pass back the remaining unprocessed
  1670. # options in '<hooked_function_name>_result', escaped suitably for
  1671. # 'eval'. Like this:
  1672. #
  1673. # my_options_prep ()
  1674. # {
  1675. # $debug_cmd
  1676. #
  1677. # # Extend the existing usage message.
  1678. # usage_message=$usage_message'
  1679. # -s, --silent don'\''t print informational messages
  1680. # '
  1681. #
  1682. # func_quote_for_eval ${1+"$@"}
  1683. # my_options_prep_result=$func_quote_for_eval_result
  1684. # }
  1685. # func_add_hook func_options_prep my_options_prep
  1686. #
  1687. #
  1688. # my_silent_option ()
  1689. # {
  1690. # $debug_cmd
  1691. #
  1692. # # Note that for efficiency, we parse as many options as we can
  1693. # # recognise in a loop before passing the remainder back to the
  1694. # # caller on the first unrecognised argument we encounter.
  1695. # while test $# -gt 0; do
  1696. # opt=$1; shift
  1697. # case $opt in
  1698. # --silent|-s) opt_silent=: ;;
  1699. # # Separate non-argument short options:
  1700. # -s*) func_split_short_opt "$_G_opt"
  1701. # set dummy "$func_split_short_opt_name" \
  1702. # "-$func_split_short_opt_arg" ${1+"$@"}
  1703. # shift
  1704. # ;;
  1705. # *) set dummy "$_G_opt" "$*"; shift; break ;;
  1706. # esac
  1707. # done
  1708. #
  1709. # func_quote_for_eval ${1+"$@"}
  1710. # my_silent_option_result=$func_quote_for_eval_result
  1711. # }
  1712. # func_add_hook func_parse_options my_silent_option
  1713. #
  1714. #
  1715. # my_option_validation ()
  1716. # {
  1717. # $debug_cmd
  1718. #
  1719. # $opt_silent && $opt_verbose && func_fatal_help "\
  1720. # '--silent' and '--verbose' options are mutually exclusive."
  1721. #
  1722. # func_quote_for_eval ${1+"$@"}
  1723. # my_option_validation_result=$func_quote_for_eval_result
  1724. # }
  1725. # func_add_hook func_validate_options my_option_validation
  1726. #
  1727. # You'll alse need to manually amend $usage_message to reflect the extra
  1728. # options you parse. It's preferable to append if you can, so that
  1729. # multiple option parsing hooks can be added safely.
  1730. # func_options [ARG]...
  1731. # ---------------------
  1732. # All the functions called inside func_options are hookable. See the
  1733. # individual implementations for details.
  1734. func_hookable func_options
  1735. func_options ()
  1736. {
  1737. $debug_cmd
  1738. func_options_prep ${1+"$@"}
  1739. eval func_parse_options \
  1740. ${func_options_prep_result+"$func_options_prep_result"}
  1741. eval func_validate_options \
  1742. ${func_parse_options_result+"$func_parse_options_result"}
  1743. eval func_run_hooks func_options \
  1744. ${func_validate_options_result+"$func_validate_options_result"}
  1745. # save modified positional parameters for caller
  1746. func_options_result=$func_run_hooks_result
  1747. }
  1748. # func_options_prep [ARG]...
  1749. # --------------------------
  1750. # All initialisations required before starting the option parse loop.
  1751. # Note that when calling hook functions, we pass through the list of
  1752. # positional parameters. If a hook function modifies that list, and
  1753. # needs to propogate that back to rest of this script, then the complete
  1754. # modified list must be put in 'func_run_hooks_result' before
  1755. # returning.
  1756. func_hookable func_options_prep
  1757. func_options_prep ()
  1758. {
  1759. $debug_cmd
  1760. # Option defaults:
  1761. opt_verbose=false
  1762. opt_warning_types=
  1763. func_run_hooks func_options_prep ${1+"$@"}
  1764. # save modified positional parameters for caller
  1765. func_options_prep_result=$func_run_hooks_result
  1766. }
  1767. # func_parse_options [ARG]...
  1768. # ---------------------------
  1769. # The main option parsing loop.
  1770. func_hookable func_parse_options
  1771. func_parse_options ()
  1772. {
  1773. $debug_cmd
  1774. func_parse_options_result=
  1775. # this just eases exit handling
  1776. while test $# -gt 0; do
  1777. # Defer to hook functions for initial option parsing, so they
  1778. # get priority in the event of reusing an option name.
  1779. func_run_hooks func_parse_options ${1+"$@"}
  1780. # Adjust func_parse_options positional parameters to match
  1781. eval set dummy "$func_run_hooks_result"; shift
  1782. # Break out of the loop if we already parsed every option.
  1783. test $# -gt 0 || break
  1784. _G_opt=$1
  1785. shift
  1786. case $_G_opt in
  1787. --debug|-x) debug_cmd='set -x'
  1788. func_echo "enabling shell trace mode"
  1789. $debug_cmd
  1790. ;;
  1791. --no-warnings|--no-warning|--no-warn)
  1792. set dummy --warnings none ${1+"$@"}
  1793. shift
  1794. ;;
  1795. --warnings|--warning|-W)
  1796. test $# = 0 && func_missing_arg $_G_opt && break
  1797. case " $warning_categories $1" in
  1798. *" $1 "*)
  1799. # trailing space prevents matching last $1 above
  1800. func_append_uniq opt_warning_types " $1"
  1801. ;;
  1802. *all)
  1803. opt_warning_types=$warning_categories
  1804. ;;
  1805. *none)
  1806. opt_warning_types=none
  1807. warning_func=:
  1808. ;;
  1809. *error)
  1810. opt_warning_types=$warning_categories
  1811. warning_func=func_fatal_error
  1812. ;;
  1813. *)
  1814. func_fatal_error \
  1815. "unsupported warning category: '$1'"
  1816. ;;
  1817. esac
  1818. shift
  1819. ;;
  1820. --verbose|-v) opt_verbose=: ;;
  1821. --version) func_version ;;
  1822. -\?|-h) func_usage ;;
  1823. --help) func_help ;;
  1824. # Separate optargs to long options (plugins may need this):
  1825. --*=*) func_split_equals "$_G_opt"
  1826. set dummy "$func_split_equals_lhs" \
  1827. "$func_split_equals_rhs" ${1+"$@"}
  1828. shift
  1829. ;;
  1830. # Separate optargs to short options:
  1831. -W*)
  1832. func_split_short_opt "$_G_opt"
  1833. set dummy "$func_split_short_opt_name" \
  1834. "$func_split_short_opt_arg" ${1+"$@"}
  1835. shift
  1836. ;;
  1837. # Separate non-argument short options:
  1838. -\?*|-h*|-v*|-x*)
  1839. func_split_short_opt "$_G_opt"
  1840. set dummy "$func_split_short_opt_name" \
  1841. "-$func_split_short_opt_arg" ${1+"$@"}
  1842. shift
  1843. ;;
  1844. --) break ;;
  1845. -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
  1846. *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  1847. esac
  1848. done
  1849. # save modified positional parameters for caller
  1850. func_quote_for_eval ${1+"$@"}
  1851. func_parse_options_result=$func_quote_for_eval_result
  1852. }
  1853. # func_validate_options [ARG]...
  1854. # ------------------------------
  1855. # Perform any sanity checks on option settings and/or unconsumed
  1856. # arguments.
  1857. func_hookable func_validate_options
  1858. func_validate_options ()
  1859. {
  1860. $debug_cmd
  1861. # Display all warnings if -W was not given.
  1862. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
  1863. func_run_hooks func_validate_options ${1+"$@"}
  1864. # Bail if the options were screwed!
  1865. $exit_cmd $EXIT_FAILURE
  1866. # save modified positional parameters for caller
  1867. func_validate_options_result=$func_run_hooks_result
  1868. }
  1869. ## ----------------- ##
  1870. ## Helper functions. ##
  1871. ## ----------------- ##
  1872. # This section contains the helper functions used by the rest of the
  1873. # hookable option parser framework in ascii-betical order.
  1874. # func_fatal_help ARG...
  1875. # ----------------------
  1876. # Echo program name prefixed message to standard error, followed by
  1877. # a help hint, and exit.
  1878. func_fatal_help ()
  1879. {
  1880. $debug_cmd
  1881. eval \$ECHO \""Usage: $usage"\"
  1882. eval \$ECHO \""$fatal_help"\"
  1883. func_error ${1+"$@"}
  1884. exit $EXIT_FAILURE
  1885. }
  1886. # func_help
  1887. # ---------
  1888. # Echo long help message to standard output and exit.
  1889. func_help ()
  1890. {
  1891. $debug_cmd
  1892. func_usage_message
  1893. $ECHO "$long_help_message"
  1894. exit 0
  1895. }
  1896. # func_missing_arg ARGNAME
  1897. # ------------------------
  1898. # Echo program name prefixed message to standard error and set global
  1899. # exit_cmd.
  1900. func_missing_arg ()
  1901. {
  1902. $debug_cmd
  1903. func_error "Missing argument for '$1'."
  1904. exit_cmd=exit
  1905. }
  1906. # func_split_equals STRING
  1907. # ------------------------
  1908. # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
  1909. # splitting STRING at the '=' sign.
  1910. test -z "$_G_HAVE_XSI_OPS" \
  1911. && (eval 'x=a/b/c;
  1912. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1913. && _G_HAVE_XSI_OPS=yes
  1914. if test yes = "$_G_HAVE_XSI_OPS"
  1915. then
  1916. # This is an XSI compatible shell, allowing a faster implementation...
  1917. eval 'func_split_equals ()
  1918. {
  1919. $debug_cmd
  1920. func_split_equals_lhs=${1%%=*}
  1921. func_split_equals_rhs=${1#*=}
  1922. test "x$func_split_equals_lhs" = "x$1" \
  1923. && func_split_equals_rhs=
  1924. }'
  1925. else
  1926. # ...otherwise fall back to using expr, which is often a shell builtin.
  1927. func_split_equals ()
  1928. {
  1929. $debug_cmd
  1930. func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
  1931. func_split_equals_rhs=
  1932. test "x$func_split_equals_lhs" = "x$1" \
  1933. || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
  1934. }
  1935. fi #func_split_equals
  1936. # func_split_short_opt SHORTOPT
  1937. # -----------------------------
  1938. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  1939. # variables after splitting SHORTOPT after the 2nd character.
  1940. if test yes = "$_G_HAVE_XSI_OPS"
  1941. then
  1942. # This is an XSI compatible shell, allowing a faster implementation...
  1943. eval 'func_split_short_opt ()
  1944. {
  1945. $debug_cmd
  1946. func_split_short_opt_arg=${1#??}
  1947. func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  1948. }'
  1949. else
  1950. # ...otherwise fall back to using expr, which is often a shell builtin.
  1951. func_split_short_opt ()
  1952. {
  1953. $debug_cmd
  1954. func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
  1955. func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
  1956. }
  1957. fi #func_split_short_opt
  1958. # func_usage
  1959. # ----------
  1960. # Echo short help message to standard output and exit.
  1961. func_usage ()
  1962. {
  1963. $debug_cmd
  1964. func_usage_message
  1965. $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
  1966. exit 0
  1967. }
  1968. # func_usage_message
  1969. # ------------------
  1970. # Echo short help message to standard output.
  1971. func_usage_message ()
  1972. {
  1973. $debug_cmd
  1974. eval \$ECHO \""Usage: $usage"\"
  1975. echo
  1976. $SED -n 's|^# ||
  1977. /^Written by/{
  1978. x;p;x
  1979. }
  1980. h
  1981. /^Written by/q' < "$progpath"
  1982. echo
  1983. eval \$ECHO \""$usage_message"\"
  1984. }
  1985. # func_version
  1986. # ------------
  1987. # Echo version message to standard output and exit.
  1988. func_version ()
  1989. {
  1990. $debug_cmd
  1991. printf '%s\n' "$progname $scriptversion"
  1992. $SED -n '
  1993. /(C)/!b go
  1994. :more
  1995. /\./!{
  1996. N
  1997. s|\n# | |
  1998. b more
  1999. }
  2000. :go
  2001. /^# Written by /,/# warranty; / {
  2002. s|^# ||
  2003. s|^# *$||
  2004. s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
  2005. p
  2006. }
  2007. /^# Written by / {
  2008. s|^# ||
  2009. p
  2010. }
  2011. /^warranty; /q' < "$progpath"
  2012. exit $?
  2013. }
  2014. # Local variables:
  2015. # mode: shell-script
  2016. # sh-indentation: 2
  2017. # eval: (add-hook 'before-save-hook 'time-stamp)
  2018. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  2019. # time-stamp-time-zone: "UTC"
  2020. # End:
  2021. # Set a version string.
  2022. scriptversion='(GNU libtool) 2.4.6'
  2023. # func_echo ARG...
  2024. # ----------------
  2025. # Libtool also displays the current mode in messages, so override
  2026. # funclib.sh func_echo with this custom definition.
  2027. func_echo ()
  2028. {
  2029. $debug_cmd
  2030. _G_message=$*
  2031. func_echo_IFS=$IFS
  2032. IFS=$nl
  2033. for _G_line in $_G_message; do
  2034. IFS=$func_echo_IFS
  2035. $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
  2036. done
  2037. IFS=$func_echo_IFS
  2038. }
  2039. # func_warning ARG...
  2040. # -------------------
  2041. # Libtool warnings are not categorized, so override funclib.sh
  2042. # func_warning with this simpler definition.
  2043. func_warning ()
  2044. {
  2045. $debug_cmd
  2046. $warning_func ${1+"$@"}
  2047. }
  2048. ## ---------------- ##
  2049. ## Options parsing. ##
  2050. ## ---------------- ##
  2051. # Hook in the functions to make sure our own options are parsed during
  2052. # the option parsing loop.
  2053. usage='$progpath [OPTION]... [MODE-ARG]...'
  2054. # Short help message in response to '-h'.
  2055. usage_message="Options:
  2056. --config show all configuration variables
  2057. --debug enable verbose shell tracing
  2058. -n, --dry-run display commands without modifying any files
  2059. --features display basic configuration information and exit
  2060. --mode=MODE use operation mode MODE
  2061. --no-warnings equivalent to '-Wnone'
  2062. --preserve-dup-deps don't remove duplicate dependency libraries
  2063. --quiet, --silent don't print informational messages
  2064. --tag=TAG use configuration variables from tag TAG
  2065. -v, --verbose print more informational messages than default
  2066. --version print version information
  2067. -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
  2068. -h, --help, --help-all print short, long, or detailed help message
  2069. "
  2070. # Additional text appended to 'usage_message' in response to '--help'.
  2071. func_help ()
  2072. {
  2073. $debug_cmd
  2074. func_usage_message
  2075. $ECHO "$long_help_message
  2076. MODE must be one of the following:
  2077. clean remove files from the build directory
  2078. compile compile a source file into a libtool object
  2079. execute automatically set library path, then run a program
  2080. finish complete the installation of libtool libraries
  2081. install install libraries or executables
  2082. link create a library or an executable
  2083. uninstall remove libraries from an installed directory
  2084. MODE-ARGS vary depending on the MODE. When passed as first option,
  2085. '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
  2086. Try '$progname --help --mode=MODE' for a more detailed description of MODE.
  2087. When reporting a bug, please describe a test case to reproduce it and
  2088. include the following information:
  2089. host-triplet: $host
  2090. shell: $SHELL
  2091. compiler: $LTCC
  2092. compiler flags: $LTCFLAGS
  2093. linker: $LD (gnu? $with_gnu_ld)
  2094. version: $progname $scriptversion Debian-2.4.6-2
  2095. automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
  2096. autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
  2097. Report bugs to <bug-libtool@gnu.org>.
  2098. GNU libtool home page: <http://www.gnu.org/s/libtool/>.
  2099. General help using GNU software: <http://www.gnu.org/gethelp/>."
  2100. exit 0
  2101. }
  2102. # func_lo2o OBJECT-NAME
  2103. # ---------------------
  2104. # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
  2105. # object suffix.
  2106. lo2o=s/\\.lo\$/.$objext/
  2107. o2lo=s/\\.$objext\$/.lo/
  2108. if test yes = "$_G_HAVE_XSI_OPS"; then
  2109. eval 'func_lo2o ()
  2110. {
  2111. case $1 in
  2112. *.lo) func_lo2o_result=${1%.lo}.$objext ;;
  2113. * ) func_lo2o_result=$1 ;;
  2114. esac
  2115. }'
  2116. # func_xform LIBOBJ-OR-SOURCE
  2117. # ---------------------------
  2118. # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
  2119. # suffix to a '.lo' libtool-object suffix.
  2120. eval 'func_xform ()
  2121. {
  2122. func_xform_result=${1%.*}.lo
  2123. }'
  2124. else
  2125. # ...otherwise fall back to using sed.
  2126. func_lo2o ()
  2127. {
  2128. func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
  2129. }
  2130. func_xform ()
  2131. {
  2132. func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
  2133. }
  2134. fi
  2135. # func_fatal_configuration ARG...
  2136. # -------------------------------
  2137. # Echo program name prefixed message to standard error, followed by
  2138. # a configuration failure hint, and exit.
  2139. func_fatal_configuration ()
  2140. {
  2141. func__fatal_error ${1+"$@"} \
  2142. "See the $PACKAGE documentation for more information." \
  2143. "Fatal configuration error."
  2144. }
  2145. # func_config
  2146. # -----------
  2147. # Display the configuration for all the tags in this script.
  2148. func_config ()
  2149. {
  2150. re_begincf='^# ### BEGIN LIBTOOL'
  2151. re_endcf='^# ### END LIBTOOL'
  2152. # Default configuration.
  2153. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  2154. # Now print the configurations for the tags.
  2155. for tagname in $taglist; do
  2156. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  2157. done
  2158. exit $?
  2159. }
  2160. # func_features
  2161. # -------------
  2162. # Display the features supported by this script.
  2163. func_features ()
  2164. {
  2165. echo "host: $host"
  2166. if test yes = "$build_libtool_libs"; then
  2167. echo "enable shared libraries"
  2168. else
  2169. echo "disable shared libraries"
  2170. fi
  2171. if test yes = "$build_old_libs"; then
  2172. echo "enable static libraries"
  2173. else
  2174. echo "disable static libraries"
  2175. fi
  2176. exit $?
  2177. }
  2178. # func_enable_tag TAGNAME
  2179. # -----------------------
  2180. # Verify that TAGNAME is valid, and either flag an error and exit, or
  2181. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  2182. # variable here.
  2183. func_enable_tag ()
  2184. {
  2185. # Global variable:
  2186. tagname=$1
  2187. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  2188. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  2189. sed_extractcf=/$re_begincf/,/$re_endcf/p
  2190. # Validate tagname.
  2191. case $tagname in
  2192. *[!-_A-Za-z0-9,/]*)
  2193. func_fatal_error "invalid tag name: $tagname"
  2194. ;;
  2195. esac
  2196. # Don't test for the "default" C tag, as we know it's
  2197. # there but not specially marked.
  2198. case $tagname in
  2199. CC) ;;
  2200. *)
  2201. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  2202. taglist="$taglist $tagname"
  2203. # Evaluate the configuration. Be careful to quote the path
  2204. # and the sed script, to avoid splitting on whitespace, but
  2205. # also don't use non-portable quotes within backquotes within
  2206. # quotes we have to do it in 2 steps:
  2207. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  2208. eval "$extractedcf"
  2209. else
  2210. func_error "ignoring unknown tag $tagname"
  2211. fi
  2212. ;;
  2213. esac
  2214. }
  2215. # func_check_version_match
  2216. # ------------------------
  2217. # Ensure that we are using m4 macros, and libtool script from the same
  2218. # release of libtool.
  2219. func_check_version_match ()
  2220. {
  2221. if test "$package_revision" != "$macro_revision"; then
  2222. if test "$VERSION" != "$macro_version"; then
  2223. if test -z "$macro_version"; then
  2224. cat >&2 <<_LT_EOF
  2225. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2226. $progname: definition of this LT_INIT comes from an older release.
  2227. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2228. $progname: and run autoconf again.
  2229. _LT_EOF
  2230. else
  2231. cat >&2 <<_LT_EOF
  2232. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2233. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  2234. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2235. $progname: and run autoconf again.
  2236. _LT_EOF
  2237. fi
  2238. else
  2239. cat >&2 <<_LT_EOF
  2240. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  2241. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  2242. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  2243. $progname: of $PACKAGE $VERSION and run autoconf again.
  2244. _LT_EOF
  2245. fi
  2246. exit $EXIT_MISMATCH
  2247. fi
  2248. }
  2249. # libtool_options_prep [ARG]...
  2250. # -----------------------------
  2251. # Preparation for options parsed by libtool.
  2252. libtool_options_prep ()
  2253. {
  2254. $debug_mode
  2255. # Option defaults:
  2256. opt_config=false
  2257. opt_dlopen=
  2258. opt_dry_run=false
  2259. opt_help=false
  2260. opt_mode=
  2261. opt_preserve_dup_deps=false
  2262. opt_quiet=false
  2263. nonopt=
  2264. preserve_args=
  2265. # Shorthand for --mode=foo, only valid as the first argument
  2266. case $1 in
  2267. clean|clea|cle|cl)
  2268. shift; set dummy --mode clean ${1+"$@"}; shift
  2269. ;;
  2270. compile|compil|compi|comp|com|co|c)
  2271. shift; set dummy --mode compile ${1+"$@"}; shift
  2272. ;;
  2273. execute|execut|execu|exec|exe|ex|e)
  2274. shift; set dummy --mode execute ${1+"$@"}; shift
  2275. ;;
  2276. finish|finis|fini|fin|fi|f)
  2277. shift; set dummy --mode finish ${1+"$@"}; shift
  2278. ;;
  2279. install|instal|insta|inst|ins|in|i)
  2280. shift; set dummy --mode install ${1+"$@"}; shift
  2281. ;;
  2282. link|lin|li|l)
  2283. shift; set dummy --mode link ${1+"$@"}; shift
  2284. ;;
  2285. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  2286. shift; set dummy --mode uninstall ${1+"$@"}; shift
  2287. ;;
  2288. esac
  2289. # Pass back the list of options.
  2290. func_quote_for_eval ${1+"$@"}
  2291. libtool_options_prep_result=$func_quote_for_eval_result
  2292. }
  2293. func_add_hook func_options_prep libtool_options_prep
  2294. # libtool_parse_options [ARG]...
  2295. # ---------------------------------
  2296. # Provide handling for libtool specific options.
  2297. libtool_parse_options ()
  2298. {
  2299. $debug_cmd
  2300. # Perform our own loop to consume as many options as possible in
  2301. # each iteration.
  2302. while test $# -gt 0; do
  2303. _G_opt=$1
  2304. shift
  2305. case $_G_opt in
  2306. --dry-run|--dryrun|-n)
  2307. opt_dry_run=:
  2308. ;;
  2309. --config) func_config ;;
  2310. --dlopen|-dlopen)
  2311. opt_dlopen="${opt_dlopen+$opt_dlopen
  2312. }$1"
  2313. shift
  2314. ;;
  2315. --preserve-dup-deps)
  2316. opt_preserve_dup_deps=: ;;
  2317. --features) func_features ;;
  2318. --finish) set dummy --mode finish ${1+"$@"}; shift ;;
  2319. --help) opt_help=: ;;
  2320. --help-all) opt_help=': help-all' ;;
  2321. --mode) test $# = 0 && func_missing_arg $_G_opt && break
  2322. opt_mode=$1
  2323. case $1 in
  2324. # Valid mode arguments:
  2325. clean|compile|execute|finish|install|link|relink|uninstall) ;;
  2326. # Catch anything else as an error
  2327. *) func_error "invalid argument for $_G_opt"
  2328. exit_cmd=exit
  2329. break
  2330. ;;
  2331. esac
  2332. shift
  2333. ;;
  2334. --no-silent|--no-quiet)
  2335. opt_quiet=false
  2336. func_append preserve_args " $_G_opt"
  2337. ;;
  2338. --no-warnings|--no-warning|--no-warn)
  2339. opt_warning=false
  2340. func_append preserve_args " $_G_opt"
  2341. ;;
  2342. --no-verbose)
  2343. opt_verbose=false
  2344. func_append preserve_args " $_G_opt"
  2345. ;;
  2346. --silent|--quiet)
  2347. opt_quiet=:
  2348. opt_verbose=false
  2349. func_append preserve_args " $_G_opt"
  2350. ;;
  2351. --tag) test $# = 0 && func_missing_arg $_G_opt && break
  2352. opt_tag=$1
  2353. func_append preserve_args " $_G_opt $1"
  2354. func_enable_tag "$1"
  2355. shift
  2356. ;;
  2357. --verbose|-v) opt_quiet=false
  2358. opt_verbose=:
  2359. func_append preserve_args " $_G_opt"
  2360. ;;
  2361. # An option not handled by this hook function:
  2362. *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  2363. esac
  2364. done
  2365. # save modified positional parameters for caller
  2366. func_quote_for_eval ${1+"$@"}
  2367. libtool_parse_options_result=$func_quote_for_eval_result
  2368. }
  2369. func_add_hook func_parse_options libtool_parse_options
  2370. # libtool_validate_options [ARG]...
  2371. # ---------------------------------
  2372. # Perform any sanity checks on option settings and/or unconsumed
  2373. # arguments.
  2374. libtool_validate_options ()
  2375. {
  2376. # save first non-option argument
  2377. if test 0 -lt $#; then
  2378. nonopt=$1
  2379. shift
  2380. fi
  2381. # preserve --debug
  2382. test : = "$debug_cmd" || func_append preserve_args " --debug"
  2383. case $host in
  2384. # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
  2385. # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
  2386. *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
  2387. # don't eliminate duplications in $postdeps and $predeps
  2388. opt_duplicate_compiler_generated_deps=:
  2389. ;;
  2390. *)
  2391. opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  2392. ;;
  2393. esac
  2394. $opt_help || {
  2395. # Sanity checks first:
  2396. func_check_version_match
  2397. test yes != "$build_libtool_libs" \
  2398. && test yes != "$build_old_libs" \
  2399. && func_fatal_configuration "not configured to build any kind of library"
  2400. # Darwin sucks
  2401. eval std_shrext=\"$shrext_cmds\"
  2402. # Only execute mode is allowed to have -dlopen flags.
  2403. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
  2404. func_error "unrecognized option '-dlopen'"
  2405. $ECHO "$help" 1>&2
  2406. exit $EXIT_FAILURE
  2407. fi
  2408. # Change the help message to a mode-specific one.
  2409. generic_help=$help
  2410. help="Try '$progname --help --mode=$opt_mode' for more information."
  2411. }
  2412. # Pass back the unparsed argument list
  2413. func_quote_for_eval ${1+"$@"}
  2414. libtool_validate_options_result=$func_quote_for_eval_result
  2415. }
  2416. func_add_hook func_validate_options libtool_validate_options
  2417. # Process options as early as possible so that --help and --version
  2418. # can return quickly.
  2419. func_options ${1+"$@"}
  2420. eval set dummy "$func_options_result"; shift
  2421. ## ----------- ##
  2422. ## Main. ##
  2423. ## ----------- ##
  2424. magic='%%%MAGIC variable%%%'
  2425. magic_exe='%%%MAGIC EXE variable%%%'
  2426. # Global variables.
  2427. extracted_archives=
  2428. extracted_serial=0
  2429. # If this variable is set in any of the actions, the command in it
  2430. # will be execed at the end. This prevents here-documents from being
  2431. # left over by shells.
  2432. exec_cmd=
  2433. # A function that is used when there is no print builtin or printf.
  2434. func_fallback_echo ()
  2435. {
  2436. eval 'cat <<_LTECHO_EOF
  2437. $1
  2438. _LTECHO_EOF'
  2439. }
  2440. # func_generated_by_libtool
  2441. # True iff stdin has been generated by Libtool. This function is only
  2442. # a basic sanity check; it will hardly flush out determined imposters.
  2443. func_generated_by_libtool_p ()
  2444. {
  2445. $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  2446. }
  2447. # func_lalib_p file
  2448. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2449. # This function is only a basic sanity check; it will hardly flush out
  2450. # determined imposters.
  2451. func_lalib_p ()
  2452. {
  2453. test -f "$1" &&
  2454. $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
  2455. }
  2456. # func_lalib_unsafe_p file
  2457. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2458. # This function implements the same check as func_lalib_p without
  2459. # resorting to external programs. To this end, it redirects stdin and
  2460. # closes it afterwards, without saving the original file descriptor.
  2461. # As a safety measure, use it only where a negative result would be
  2462. # fatal anyway. Works if 'file' does not exist.
  2463. func_lalib_unsafe_p ()
  2464. {
  2465. lalib_p=no
  2466. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  2467. for lalib_p_l in 1 2 3 4
  2468. do
  2469. read lalib_p_line
  2470. case $lalib_p_line in
  2471. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  2472. esac
  2473. done
  2474. exec 0<&5 5<&-
  2475. fi
  2476. test yes = "$lalib_p"
  2477. }
  2478. # func_ltwrapper_script_p file
  2479. # True iff FILE is a libtool wrapper script
  2480. # This function is only a basic sanity check; it will hardly flush out
  2481. # determined imposters.
  2482. func_ltwrapper_script_p ()
  2483. {
  2484. test -f "$1" &&
  2485. $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
  2486. }
  2487. # func_ltwrapper_executable_p file
  2488. # True iff FILE is a libtool wrapper executable
  2489. # This function is only a basic sanity check; it will hardly flush out
  2490. # determined imposters.
  2491. func_ltwrapper_executable_p ()
  2492. {
  2493. func_ltwrapper_exec_suffix=
  2494. case $1 in
  2495. *.exe) ;;
  2496. *) func_ltwrapper_exec_suffix=.exe ;;
  2497. esac
  2498. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  2499. }
  2500. # func_ltwrapper_scriptname file
  2501. # Assumes file is an ltwrapper_executable
  2502. # uses $file to determine the appropriate filename for a
  2503. # temporary ltwrapper_script.
  2504. func_ltwrapper_scriptname ()
  2505. {
  2506. func_dirname_and_basename "$1" "" "."
  2507. func_stripname '' '.exe' "$func_basename_result"
  2508. func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
  2509. }
  2510. # func_ltwrapper_p file
  2511. # True iff FILE is a libtool wrapper script or wrapper executable
  2512. # This function is only a basic sanity check; it will hardly flush out
  2513. # determined imposters.
  2514. func_ltwrapper_p ()
  2515. {
  2516. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  2517. }
  2518. # func_execute_cmds commands fail_cmd
  2519. # Execute tilde-delimited COMMANDS.
  2520. # If FAIL_CMD is given, eval that upon failure.
  2521. # FAIL_CMD may read-access the current command in variable CMD!
  2522. func_execute_cmds ()
  2523. {
  2524. $debug_cmd
  2525. save_ifs=$IFS; IFS='~'
  2526. for cmd in $1; do
  2527. IFS=$sp$nl
  2528. eval cmd=\"$cmd\"
  2529. IFS=$save_ifs
  2530. func_show_eval "$cmd" "${2-:}"
  2531. done
  2532. IFS=$save_ifs
  2533. }
  2534. # func_source file
  2535. # Source FILE, adding directory component if necessary.
  2536. # Note that it is not necessary on cygwin/mingw to append a dot to
  2537. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  2538. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  2539. # 'FILE.' does not work on cygwin managed mounts.
  2540. func_source ()
  2541. {
  2542. $debug_cmd
  2543. case $1 in
  2544. */* | *\\*) . "$1" ;;
  2545. *) . "./$1" ;;
  2546. esac
  2547. }
  2548. # func_resolve_sysroot PATH
  2549. # Replace a leading = in PATH with a sysroot. Store the result into
  2550. # func_resolve_sysroot_result
  2551. func_resolve_sysroot ()
  2552. {
  2553. func_resolve_sysroot_result=$1
  2554. case $func_resolve_sysroot_result in
  2555. =*)
  2556. func_stripname '=' '' "$func_resolve_sysroot_result"
  2557. func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  2558. ;;
  2559. esac
  2560. }
  2561. # func_replace_sysroot PATH
  2562. # If PATH begins with the sysroot, replace it with = and
  2563. # store the result into func_replace_sysroot_result.
  2564. func_replace_sysroot ()
  2565. {
  2566. case $lt_sysroot:$1 in
  2567. ?*:"$lt_sysroot"*)
  2568. func_stripname "$lt_sysroot" '' "$1"
  2569. func_replace_sysroot_result='='$func_stripname_result
  2570. ;;
  2571. *)
  2572. # Including no sysroot.
  2573. func_replace_sysroot_result=$1
  2574. ;;
  2575. esac
  2576. }
  2577. # func_infer_tag arg
  2578. # Infer tagged configuration to use if any are available and
  2579. # if one wasn't chosen via the "--tag" command line option.
  2580. # Only attempt this if the compiler in the base compile
  2581. # command doesn't match the default compiler.
  2582. # arg is usually of the form 'gcc ...'
  2583. func_infer_tag ()
  2584. {
  2585. $debug_cmd
  2586. if test -n "$available_tags" && test -z "$tagname"; then
  2587. CC_quoted=
  2588. for arg in $CC; do
  2589. func_append_quoted CC_quoted "$arg"
  2590. done
  2591. CC_expanded=`func_echo_all $CC`
  2592. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2593. case $@ in
  2594. # Blanks in the command may have been stripped by the calling shell,
  2595. # but not from the CC environment variable when configure was run.
  2596. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2597. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  2598. # Blanks at the start of $base_compile will cause this to fail
  2599. # if we don't check for them as well.
  2600. *)
  2601. for z in $available_tags; do
  2602. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  2603. # Evaluate the configuration.
  2604. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  2605. CC_quoted=
  2606. for arg in $CC; do
  2607. # Double-quote args containing other shell metacharacters.
  2608. func_append_quoted CC_quoted "$arg"
  2609. done
  2610. CC_expanded=`func_echo_all $CC`
  2611. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2612. case "$@ " in
  2613. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2614. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  2615. # The compiler in the base compile command matches
  2616. # the one in the tagged configuration.
  2617. # Assume this is the tagged configuration we want.
  2618. tagname=$z
  2619. break
  2620. ;;
  2621. esac
  2622. fi
  2623. done
  2624. # If $tagname still isn't set, then no tagged configuration
  2625. # was found and let the user know that the "--tag" command
  2626. # line option must be used.
  2627. if test -z "$tagname"; then
  2628. func_echo "unable to infer tagged configuration"
  2629. func_fatal_error "specify a tag with '--tag'"
  2630. # else
  2631. # func_verbose "using $tagname tagged configuration"
  2632. fi
  2633. ;;
  2634. esac
  2635. fi
  2636. }
  2637. # func_write_libtool_object output_name pic_name nonpic_name
  2638. # Create a libtool object file (analogous to a ".la" file),
  2639. # but don't create it if we're doing a dry run.
  2640. func_write_libtool_object ()
  2641. {
  2642. write_libobj=$1
  2643. if test yes = "$build_libtool_libs"; then
  2644. write_lobj=\'$2\'
  2645. else
  2646. write_lobj=none
  2647. fi
  2648. if test yes = "$build_old_libs"; then
  2649. write_oldobj=\'$3\'
  2650. else
  2651. write_oldobj=none
  2652. fi
  2653. $opt_dry_run || {
  2654. cat >${write_libobj}T <<EOF
  2655. # $write_libobj - a libtool object file
  2656. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  2657. #
  2658. # Please DO NOT delete this file!
  2659. # It is necessary for linking the library.
  2660. # Name of the PIC object.
  2661. pic_object=$write_lobj
  2662. # Name of the non-PIC object
  2663. non_pic_object=$write_oldobj
  2664. EOF
  2665. $MV "${write_libobj}T" "$write_libobj"
  2666. }
  2667. }
  2668. ##################################################
  2669. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  2670. ##################################################
  2671. # func_convert_core_file_wine_to_w32 ARG
  2672. # Helper function used by file name conversion functions when $build is *nix,
  2673. # and $host is mingw, cygwin, or some other w32 environment. Relies on a
  2674. # correctly configured wine environment available, with the winepath program
  2675. # in $build's $PATH.
  2676. #
  2677. # ARG is the $build file name to be converted to w32 format.
  2678. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  2679. # be empty on error (or when ARG is empty)
  2680. func_convert_core_file_wine_to_w32 ()
  2681. {
  2682. $debug_cmd
  2683. func_convert_core_file_wine_to_w32_result=$1
  2684. if test -n "$1"; then
  2685. # Unfortunately, winepath does not exit with a non-zero error code, so we
  2686. # are forced to check the contents of stdout. On the other hand, if the
  2687. # command is not found, the shell will set an exit code of 127 and print
  2688. # *an error message* to stdout. So we must check for both error code of
  2689. # zero AND non-empty stdout, which explains the odd construction:
  2690. func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  2691. if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
  2692. func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  2693. $SED -e "$sed_naive_backslashify"`
  2694. else
  2695. func_convert_core_file_wine_to_w32_result=
  2696. fi
  2697. fi
  2698. }
  2699. # end: func_convert_core_file_wine_to_w32
  2700. # func_convert_core_path_wine_to_w32 ARG
  2701. # Helper function used by path conversion functions when $build is *nix, and
  2702. # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
  2703. # configured wine environment available, with the winepath program in $build's
  2704. # $PATH. Assumes ARG has no leading or trailing path separator characters.
  2705. #
  2706. # ARG is path to be converted from $build format to win32.
  2707. # Result is available in $func_convert_core_path_wine_to_w32_result.
  2708. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  2709. # are convertible, then the result may be empty.
  2710. func_convert_core_path_wine_to_w32 ()
  2711. {
  2712. $debug_cmd
  2713. # unfortunately, winepath doesn't convert paths, only file names
  2714. func_convert_core_path_wine_to_w32_result=
  2715. if test -n "$1"; then
  2716. oldIFS=$IFS
  2717. IFS=:
  2718. for func_convert_core_path_wine_to_w32_f in $1; do
  2719. IFS=$oldIFS
  2720. func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  2721. if test -n "$func_convert_core_file_wine_to_w32_result"; then
  2722. if test -z "$func_convert_core_path_wine_to_w32_result"; then
  2723. func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
  2724. else
  2725. func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  2726. fi
  2727. fi
  2728. done
  2729. IFS=$oldIFS
  2730. fi
  2731. }
  2732. # end: func_convert_core_path_wine_to_w32
  2733. # func_cygpath ARGS...
  2734. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  2735. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  2736. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  2737. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  2738. # file name or path is assumed to be in w32 format, as previously converted
  2739. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  2740. # or path in func_cygpath_result (input file name or path is assumed to be in
  2741. # Cygwin format). Returns an empty string on error.
  2742. #
  2743. # ARGS are passed to cygpath, with the last one being the file name or path to
  2744. # be converted.
  2745. #
  2746. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  2747. # environment variable; do not put it in $PATH.
  2748. func_cygpath ()
  2749. {
  2750. $debug_cmd
  2751. if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  2752. func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  2753. if test "$?" -ne 0; then
  2754. # on failure, ensure result is empty
  2755. func_cygpath_result=
  2756. fi
  2757. else
  2758. func_cygpath_result=
  2759. func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
  2760. fi
  2761. }
  2762. #end: func_cygpath
  2763. # func_convert_core_msys_to_w32 ARG
  2764. # Convert file name or path ARG from MSYS format to w32 format. Return
  2765. # result in func_convert_core_msys_to_w32_result.
  2766. func_convert_core_msys_to_w32 ()
  2767. {
  2768. $debug_cmd
  2769. # awkward: cmd appends spaces to result
  2770. func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2771. $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
  2772. }
  2773. #end: func_convert_core_msys_to_w32
  2774. # func_convert_file_check ARG1 ARG2
  2775. # Verify that ARG1 (a file name in $build format) was converted to $host
  2776. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  2777. # func_to_host_file_result to ARG1).
  2778. func_convert_file_check ()
  2779. {
  2780. $debug_cmd
  2781. if test -z "$2" && test -n "$1"; then
  2782. func_error "Could not determine host file name corresponding to"
  2783. func_error " '$1'"
  2784. func_error "Continuing, but uninstalled executables may not work."
  2785. # Fallback:
  2786. func_to_host_file_result=$1
  2787. fi
  2788. }
  2789. # end func_convert_file_check
  2790. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  2791. # Verify that FROM_PATH (a path in $build format) was converted to $host
  2792. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  2793. # func_to_host_file_result to a simplistic fallback value (see below).
  2794. func_convert_path_check ()
  2795. {
  2796. $debug_cmd
  2797. if test -z "$4" && test -n "$3"; then
  2798. func_error "Could not determine the host path corresponding to"
  2799. func_error " '$3'"
  2800. func_error "Continuing, but uninstalled executables may not work."
  2801. # Fallback. This is a deliberately simplistic "conversion" and
  2802. # should not be "improved". See libtool.info.
  2803. if test "x$1" != "x$2"; then
  2804. lt_replace_pathsep_chars="s|$1|$2|g"
  2805. func_to_host_path_result=`echo "$3" |
  2806. $SED -e "$lt_replace_pathsep_chars"`
  2807. else
  2808. func_to_host_path_result=$3
  2809. fi
  2810. fi
  2811. }
  2812. # end func_convert_path_check
  2813. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  2814. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  2815. # and appending REPL if ORIG matches BACKPAT.
  2816. func_convert_path_front_back_pathsep ()
  2817. {
  2818. $debug_cmd
  2819. case $4 in
  2820. $1 ) func_to_host_path_result=$3$func_to_host_path_result
  2821. ;;
  2822. esac
  2823. case $4 in
  2824. $2 ) func_append func_to_host_path_result "$3"
  2825. ;;
  2826. esac
  2827. }
  2828. # end func_convert_path_front_back_pathsep
  2829. ##################################################
  2830. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  2831. ##################################################
  2832. # invoked via '$to_host_file_cmd ARG'
  2833. #
  2834. # In each case, ARG is the path to be converted from $build to $host format.
  2835. # Result will be available in $func_to_host_file_result.
  2836. # func_to_host_file ARG
  2837. # Converts the file name ARG from $build format to $host format. Return result
  2838. # in func_to_host_file_result.
  2839. func_to_host_file ()
  2840. {
  2841. $debug_cmd
  2842. $to_host_file_cmd "$1"
  2843. }
  2844. # end func_to_host_file
  2845. # func_to_tool_file ARG LAZY
  2846. # converts the file name ARG from $build format to toolchain format. Return
  2847. # result in func_to_tool_file_result. If the conversion in use is listed
  2848. # in (the comma separated) LAZY, no conversion takes place.
  2849. func_to_tool_file ()
  2850. {
  2851. $debug_cmd
  2852. case ,$2, in
  2853. *,"$to_tool_file_cmd",*)
  2854. func_to_tool_file_result=$1
  2855. ;;
  2856. *)
  2857. $to_tool_file_cmd "$1"
  2858. func_to_tool_file_result=$func_to_host_file_result
  2859. ;;
  2860. esac
  2861. }
  2862. # end func_to_tool_file
  2863. # func_convert_file_noop ARG
  2864. # Copy ARG to func_to_host_file_result.
  2865. func_convert_file_noop ()
  2866. {
  2867. func_to_host_file_result=$1
  2868. }
  2869. # end func_convert_file_noop
  2870. # func_convert_file_msys_to_w32 ARG
  2871. # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2872. # conversion to w32 is not available inside the cwrapper. Returns result in
  2873. # func_to_host_file_result.
  2874. func_convert_file_msys_to_w32 ()
  2875. {
  2876. $debug_cmd
  2877. func_to_host_file_result=$1
  2878. if test -n "$1"; then
  2879. func_convert_core_msys_to_w32 "$1"
  2880. func_to_host_file_result=$func_convert_core_msys_to_w32_result
  2881. fi
  2882. func_convert_file_check "$1" "$func_to_host_file_result"
  2883. }
  2884. # end func_convert_file_msys_to_w32
  2885. # func_convert_file_cygwin_to_w32 ARG
  2886. # Convert file name ARG from Cygwin to w32 format. Returns result in
  2887. # func_to_host_file_result.
  2888. func_convert_file_cygwin_to_w32 ()
  2889. {
  2890. $debug_cmd
  2891. func_to_host_file_result=$1
  2892. if test -n "$1"; then
  2893. # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
  2894. # LT_CYGPATH in this case.
  2895. func_to_host_file_result=`cygpath -m "$1"`
  2896. fi
  2897. func_convert_file_check "$1" "$func_to_host_file_result"
  2898. }
  2899. # end func_convert_file_cygwin_to_w32
  2900. # func_convert_file_nix_to_w32 ARG
  2901. # Convert file name ARG from *nix to w32 format. Requires a wine environment
  2902. # and a working winepath. Returns result in func_to_host_file_result.
  2903. func_convert_file_nix_to_w32 ()
  2904. {
  2905. $debug_cmd
  2906. func_to_host_file_result=$1
  2907. if test -n "$1"; then
  2908. func_convert_core_file_wine_to_w32 "$1"
  2909. func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
  2910. fi
  2911. func_convert_file_check "$1" "$func_to_host_file_result"
  2912. }
  2913. # end func_convert_file_nix_to_w32
  2914. # func_convert_file_msys_to_cygwin ARG
  2915. # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  2916. # Returns result in func_to_host_file_result.
  2917. func_convert_file_msys_to_cygwin ()
  2918. {
  2919. $debug_cmd
  2920. func_to_host_file_result=$1
  2921. if test -n "$1"; then
  2922. func_convert_core_msys_to_w32 "$1"
  2923. func_cygpath -u "$func_convert_core_msys_to_w32_result"
  2924. func_to_host_file_result=$func_cygpath_result
  2925. fi
  2926. func_convert_file_check "$1" "$func_to_host_file_result"
  2927. }
  2928. # end func_convert_file_msys_to_cygwin
  2929. # func_convert_file_nix_to_cygwin ARG
  2930. # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
  2931. # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
  2932. # in func_to_host_file_result.
  2933. func_convert_file_nix_to_cygwin ()
  2934. {
  2935. $debug_cmd
  2936. func_to_host_file_result=$1
  2937. if test -n "$1"; then
  2938. # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
  2939. func_convert_core_file_wine_to_w32 "$1"
  2940. func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
  2941. func_to_host_file_result=$func_cygpath_result
  2942. fi
  2943. func_convert_file_check "$1" "$func_to_host_file_result"
  2944. }
  2945. # end func_convert_file_nix_to_cygwin
  2946. #############################################
  2947. # $build to $host PATH CONVERSION FUNCTIONS #
  2948. #############################################
  2949. # invoked via '$to_host_path_cmd ARG'
  2950. #
  2951. # In each case, ARG is the path to be converted from $build to $host format.
  2952. # The result will be available in $func_to_host_path_result.
  2953. #
  2954. # Path separators are also converted from $build format to $host format. If
  2955. # ARG begins or ends with a path separator character, it is preserved (but
  2956. # converted to $host format) on output.
  2957. #
  2958. # All path conversion functions are named using the following convention:
  2959. # file name conversion function : func_convert_file_X_to_Y ()
  2960. # path conversion function : func_convert_path_X_to_Y ()
  2961. # where, for any given $build/$host combination the 'X_to_Y' value is the
  2962. # same. If conversion functions are added for new $build/$host combinations,
  2963. # the two new functions must follow this pattern, or func_init_to_host_path_cmd
  2964. # will break.
  2965. # func_init_to_host_path_cmd
  2966. # Ensures that function "pointer" variable $to_host_path_cmd is set to the
  2967. # appropriate value, based on the value of $to_host_file_cmd.
  2968. to_host_path_cmd=
  2969. func_init_to_host_path_cmd ()
  2970. {
  2971. $debug_cmd
  2972. if test -z "$to_host_path_cmd"; then
  2973. func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
  2974. to_host_path_cmd=func_convert_path_$func_stripname_result
  2975. fi
  2976. }
  2977. # func_to_host_path ARG
  2978. # Converts the path ARG from $build format to $host format. Return result
  2979. # in func_to_host_path_result.
  2980. func_to_host_path ()
  2981. {
  2982. $debug_cmd
  2983. func_init_to_host_path_cmd
  2984. $to_host_path_cmd "$1"
  2985. }
  2986. # end func_to_host_path
  2987. # func_convert_path_noop ARG
  2988. # Copy ARG to func_to_host_path_result.
  2989. func_convert_path_noop ()
  2990. {
  2991. func_to_host_path_result=$1
  2992. }
  2993. # end func_convert_path_noop
  2994. # func_convert_path_msys_to_w32 ARG
  2995. # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2996. # conversion to w32 is not available inside the cwrapper. Returns result in
  2997. # func_to_host_path_result.
  2998. func_convert_path_msys_to_w32 ()
  2999. {
  3000. $debug_cmd
  3001. func_to_host_path_result=$1
  3002. if test -n "$1"; then
  3003. # Remove leading and trailing path separator characters from ARG. MSYS
  3004. # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
  3005. # and winepath ignores them completely.
  3006. func_stripname : : "$1"
  3007. func_to_host_path_tmp1=$func_stripname_result
  3008. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3009. func_to_host_path_result=$func_convert_core_msys_to_w32_result
  3010. func_convert_path_check : ";" \
  3011. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3012. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3013. fi
  3014. }
  3015. # end func_convert_path_msys_to_w32
  3016. # func_convert_path_cygwin_to_w32 ARG
  3017. # Convert path ARG from Cygwin to w32 format. Returns result in
  3018. # func_to_host_file_result.
  3019. func_convert_path_cygwin_to_w32 ()
  3020. {
  3021. $debug_cmd
  3022. func_to_host_path_result=$1
  3023. if test -n "$1"; then
  3024. # See func_convert_path_msys_to_w32:
  3025. func_stripname : : "$1"
  3026. func_to_host_path_tmp1=$func_stripname_result
  3027. func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
  3028. func_convert_path_check : ";" \
  3029. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3030. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3031. fi
  3032. }
  3033. # end func_convert_path_cygwin_to_w32
  3034. # func_convert_path_nix_to_w32 ARG
  3035. # Convert path ARG from *nix to w32 format. Requires a wine environment and
  3036. # a working winepath. Returns result in func_to_host_file_result.
  3037. func_convert_path_nix_to_w32 ()
  3038. {
  3039. $debug_cmd
  3040. func_to_host_path_result=$1
  3041. if test -n "$1"; then
  3042. # See func_convert_path_msys_to_w32:
  3043. func_stripname : : "$1"
  3044. func_to_host_path_tmp1=$func_stripname_result
  3045. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3046. func_to_host_path_result=$func_convert_core_path_wine_to_w32_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_nix_to_w32
  3053. # func_convert_path_msys_to_cygwin ARG
  3054. # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  3055. # Returns result in func_to_host_file_result.
  3056. func_convert_path_msys_to_cygwin ()
  3057. {
  3058. $debug_cmd
  3059. func_to_host_path_result=$1
  3060. if test -n "$1"; then
  3061. # See func_convert_path_msys_to_w32:
  3062. func_stripname : : "$1"
  3063. func_to_host_path_tmp1=$func_stripname_result
  3064. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3065. func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
  3066. func_to_host_path_result=$func_cygpath_result
  3067. func_convert_path_check : : \
  3068. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3069. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3070. fi
  3071. }
  3072. # end func_convert_path_msys_to_cygwin
  3073. # func_convert_path_nix_to_cygwin ARG
  3074. # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
  3075. # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
  3076. # func_to_host_file_result.
  3077. func_convert_path_nix_to_cygwin ()
  3078. {
  3079. $debug_cmd
  3080. func_to_host_path_result=$1
  3081. if test -n "$1"; then
  3082. # Remove leading and trailing path separator characters from
  3083. # ARG. msys behavior is inconsistent here, cygpath turns them
  3084. # into '.;' and ';.', and winepath ignores them completely.
  3085. func_stripname : : "$1"
  3086. func_to_host_path_tmp1=$func_stripname_result
  3087. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3088. func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
  3089. func_to_host_path_result=$func_cygpath_result
  3090. func_convert_path_check : : \
  3091. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3092. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3093. fi
  3094. }
  3095. # end func_convert_path_nix_to_cygwin
  3096. # func_dll_def_p FILE
  3097. # True iff FILE is a Windows DLL '.def' file.
  3098. # Keep in sync with _LT_DLL_DEF_P in libtool.m4
  3099. func_dll_def_p ()
  3100. {
  3101. $debug_cmd
  3102. func_dll_def_p_tmp=`$SED -n \
  3103. -e 's/^[ ]*//' \
  3104. -e '/^\(;.*\)*$/d' \
  3105. -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
  3106. -e q \
  3107. "$1"`
  3108. test DEF = "$func_dll_def_p_tmp"
  3109. }
  3110. # func_mode_compile arg...
  3111. func_mode_compile ()
  3112. {
  3113. $debug_cmd
  3114. # Get the compilation command and the source file.
  3115. base_compile=
  3116. srcfile=$nonopt # always keep a non-empty value in "srcfile"
  3117. suppress_opt=yes
  3118. suppress_output=
  3119. arg_mode=normal
  3120. libobj=
  3121. later=
  3122. pie_flag=
  3123. for arg
  3124. do
  3125. case $arg_mode in
  3126. arg )
  3127. # do not "continue". Instead, add this to base_compile
  3128. lastarg=$arg
  3129. arg_mode=normal
  3130. ;;
  3131. target )
  3132. libobj=$arg
  3133. arg_mode=normal
  3134. continue
  3135. ;;
  3136. normal )
  3137. # Accept any command-line options.
  3138. case $arg in
  3139. -o)
  3140. test -n "$libobj" && \
  3141. func_fatal_error "you cannot specify '-o' more than once"
  3142. arg_mode=target
  3143. continue
  3144. ;;
  3145. -pie | -fpie | -fPIE)
  3146. func_append pie_flag " $arg"
  3147. continue
  3148. ;;
  3149. -shared | -static | -prefer-pic | -prefer-non-pic)
  3150. func_append later " $arg"
  3151. continue
  3152. ;;
  3153. -no-suppress)
  3154. suppress_opt=no
  3155. continue
  3156. ;;
  3157. -Xcompiler)
  3158. arg_mode=arg # the next one goes into the "base_compile" arg list
  3159. continue # The current "srcfile" will either be retained or
  3160. ;; # replaced later. I would guess that would be a bug.
  3161. -Wc,*)
  3162. func_stripname '-Wc,' '' "$arg"
  3163. args=$func_stripname_result
  3164. lastarg=
  3165. save_ifs=$IFS; IFS=,
  3166. for arg in $args; do
  3167. IFS=$save_ifs
  3168. func_append_quoted lastarg "$arg"
  3169. done
  3170. IFS=$save_ifs
  3171. func_stripname ' ' '' "$lastarg"
  3172. lastarg=$func_stripname_result
  3173. # Add the arguments to base_compile.
  3174. func_append base_compile " $lastarg"
  3175. continue
  3176. ;;
  3177. *)
  3178. # Accept the current argument as the source file.
  3179. # The previous "srcfile" becomes the current argument.
  3180. #
  3181. lastarg=$srcfile
  3182. srcfile=$arg
  3183. ;;
  3184. esac # case $arg
  3185. ;;
  3186. esac # case $arg_mode
  3187. # Aesthetically quote the previous argument.
  3188. func_append_quoted base_compile "$lastarg"
  3189. done # for arg
  3190. case $arg_mode in
  3191. arg)
  3192. func_fatal_error "you must specify an argument for -Xcompile"
  3193. ;;
  3194. target)
  3195. func_fatal_error "you must specify a target with '-o'"
  3196. ;;
  3197. *)
  3198. # Get the name of the library object.
  3199. test -z "$libobj" && {
  3200. func_basename "$srcfile"
  3201. libobj=$func_basename_result
  3202. }
  3203. ;;
  3204. esac
  3205. # Recognize several different file suffixes.
  3206. # If the user specifies -o file.o, it is replaced with file.lo
  3207. case $libobj in
  3208. *.[cCFSifmso] | \
  3209. *.ada | *.adb | *.ads | *.asm | \
  3210. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  3211. *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
  3212. func_xform "$libobj"
  3213. libobj=$func_xform_result
  3214. ;;
  3215. esac
  3216. case $libobj in
  3217. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  3218. *)
  3219. func_fatal_error "cannot determine name of library object from '$libobj'"
  3220. ;;
  3221. esac
  3222. func_infer_tag $base_compile
  3223. for arg in $later; do
  3224. case $arg in
  3225. -shared)
  3226. test yes = "$build_libtool_libs" \
  3227. || func_fatal_configuration "cannot build a shared library"
  3228. build_old_libs=no
  3229. continue
  3230. ;;
  3231. -static)
  3232. build_libtool_libs=no
  3233. build_old_libs=yes
  3234. continue
  3235. ;;
  3236. -prefer-pic)
  3237. pic_mode=yes
  3238. continue
  3239. ;;
  3240. -prefer-non-pic)
  3241. pic_mode=no
  3242. continue
  3243. ;;
  3244. esac
  3245. done
  3246. func_quote_for_eval "$libobj"
  3247. test "X$libobj" != "X$func_quote_for_eval_result" \
  3248. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  3249. && func_warning "libobj name '$libobj' may not contain shell special characters."
  3250. func_dirname_and_basename "$obj" "/" ""
  3251. objname=$func_basename_result
  3252. xdir=$func_dirname_result
  3253. lobj=$xdir$objdir/$objname
  3254. test -z "$base_compile" && \
  3255. func_fatal_help "you must specify a compilation command"
  3256. # Delete any leftover library objects.
  3257. if test yes = "$build_old_libs"; then
  3258. removelist="$obj $lobj $libobj ${libobj}T"
  3259. else
  3260. removelist="$lobj $libobj ${libobj}T"
  3261. fi
  3262. # On Cygwin there's no "real" PIC flag so we must build both object types
  3263. case $host_os in
  3264. cygwin* | mingw* | pw32* | os2* | cegcc*)
  3265. pic_mode=default
  3266. ;;
  3267. esac
  3268. if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
  3269. # non-PIC code in shared libraries is not supported
  3270. pic_mode=default
  3271. fi
  3272. # Calculate the filename of the output object if compiler does
  3273. # not support -o with -c
  3274. if test no = "$compiler_c_o"; then
  3275. output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
  3276. lockfile=$output_obj.lock
  3277. else
  3278. output_obj=
  3279. need_locks=no
  3280. lockfile=
  3281. fi
  3282. # Lock this critical section if it is needed
  3283. # We use this script file to make the link, it avoids creating a new file
  3284. if test yes = "$need_locks"; then
  3285. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  3286. func_echo "Waiting for $lockfile to be removed"
  3287. sleep 2
  3288. done
  3289. elif test warn = "$need_locks"; then
  3290. if test -f "$lockfile"; then
  3291. $ECHO "\
  3292. *** ERROR, $lockfile exists and contains:
  3293. `cat $lockfile 2>/dev/null`
  3294. This indicates that another process is trying to use the same
  3295. temporary object file, and libtool could not work around it because
  3296. your compiler does not support '-c' and '-o' together. If you
  3297. repeat this compilation, it may succeed, by chance, but you had better
  3298. avoid parallel builds (make -j) in this platform, or get a better
  3299. compiler."
  3300. $opt_dry_run || $RM $removelist
  3301. exit $EXIT_FAILURE
  3302. fi
  3303. func_append removelist " $output_obj"
  3304. $ECHO "$srcfile" > "$lockfile"
  3305. fi
  3306. $opt_dry_run || $RM $removelist
  3307. func_append removelist " $lockfile"
  3308. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  3309. func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
  3310. srcfile=$func_to_tool_file_result
  3311. func_quote_for_eval "$srcfile"
  3312. qsrcfile=$func_quote_for_eval_result
  3313. # Only build a PIC object if we are building libtool libraries.
  3314. if test yes = "$build_libtool_libs"; then
  3315. # Without this assignment, base_compile gets emptied.
  3316. fbsd_hideous_sh_bug=$base_compile
  3317. if test no != "$pic_mode"; then
  3318. command="$base_compile $qsrcfile $pic_flag"
  3319. else
  3320. # Don't build PIC code
  3321. command="$base_compile $qsrcfile"
  3322. fi
  3323. func_mkdir_p "$xdir$objdir"
  3324. if test -z "$output_obj"; then
  3325. # Place PIC objects in $objdir
  3326. func_append command " -o $lobj"
  3327. fi
  3328. func_show_eval_locale "$command" \
  3329. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  3330. if test warn = "$need_locks" &&
  3331. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3332. $ECHO "\
  3333. *** ERROR, $lockfile contains:
  3334. `cat $lockfile 2>/dev/null`
  3335. but it should contain:
  3336. $srcfile
  3337. This indicates that another process is trying to use the same
  3338. temporary object file, and libtool could not work around it because
  3339. your compiler does not support '-c' and '-o' together. If you
  3340. repeat this compilation, it may succeed, by chance, but you had better
  3341. avoid parallel builds (make -j) in this platform, or get a better
  3342. compiler."
  3343. $opt_dry_run || $RM $removelist
  3344. exit $EXIT_FAILURE
  3345. fi
  3346. # Just move the object if needed, then go on to compile the next one
  3347. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  3348. func_show_eval '$MV "$output_obj" "$lobj"' \
  3349. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3350. fi
  3351. # Allow error messages only from the first compilation.
  3352. if test yes = "$suppress_opt"; then
  3353. suppress_output=' >/dev/null 2>&1'
  3354. fi
  3355. fi
  3356. # Only build a position-dependent object if we build old libraries.
  3357. if test yes = "$build_old_libs"; then
  3358. if test yes != "$pic_mode"; then
  3359. # Don't build PIC code
  3360. command="$base_compile $qsrcfile$pie_flag"
  3361. else
  3362. command="$base_compile $qsrcfile $pic_flag"
  3363. fi
  3364. if test yes = "$compiler_c_o"; then
  3365. func_append command " -o $obj"
  3366. fi
  3367. # Suppress compiler output if we already did a PIC compilation.
  3368. func_append command "$suppress_output"
  3369. func_show_eval_locale "$command" \
  3370. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  3371. if test warn = "$need_locks" &&
  3372. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3373. $ECHO "\
  3374. *** ERROR, $lockfile contains:
  3375. `cat $lockfile 2>/dev/null`
  3376. but it should contain:
  3377. $srcfile
  3378. This indicates that another process is trying to use the same
  3379. temporary object file, and libtool could not work around it because
  3380. your compiler does not support '-c' and '-o' together. If you
  3381. repeat this compilation, it may succeed, by chance, but you had better
  3382. avoid parallel builds (make -j) in this platform, or get a better
  3383. compiler."
  3384. $opt_dry_run || $RM $removelist
  3385. exit $EXIT_FAILURE
  3386. fi
  3387. # Just move the object if needed
  3388. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  3389. func_show_eval '$MV "$output_obj" "$obj"' \
  3390. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3391. fi
  3392. fi
  3393. $opt_dry_run || {
  3394. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  3395. # Unlock the critical section if it was locked
  3396. if test no != "$need_locks"; then
  3397. removelist=$lockfile
  3398. $RM "$lockfile"
  3399. fi
  3400. }
  3401. exit $EXIT_SUCCESS
  3402. }
  3403. $opt_help || {
  3404. test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
  3405. }
  3406. func_mode_help ()
  3407. {
  3408. # We need to display help for each of the modes.
  3409. case $opt_mode in
  3410. "")
  3411. # Generic help is extracted from the usage comments
  3412. # at the start of this file.
  3413. func_help
  3414. ;;
  3415. clean)
  3416. $ECHO \
  3417. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  3418. Remove files from the build directory.
  3419. RM is the name of the program to use to delete files associated with each FILE
  3420. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3421. to RM.
  3422. If FILE is a libtool library, object or program, all the files associated
  3423. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  3424. ;;
  3425. compile)
  3426. $ECHO \
  3427. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3428. Compile a source file into a libtool library object.
  3429. This mode accepts the following additional options:
  3430. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  3431. -no-suppress do not suppress compiler output for multiple passes
  3432. -prefer-pic try to build PIC objects only
  3433. -prefer-non-pic try to build non-PIC objects only
  3434. -shared do not build a '.o' file suitable for static linking
  3435. -static only build a '.o' file suitable for static linking
  3436. -Wc,FLAG pass FLAG directly to the compiler
  3437. COMPILE-COMMAND is a command to be used in creating a 'standard' object file
  3438. from the given SOURCEFILE.
  3439. The output file name is determined by removing the directory component from
  3440. SOURCEFILE, then substituting the C source code suffix '.c' with the
  3441. library object suffix, '.lo'."
  3442. ;;
  3443. execute)
  3444. $ECHO \
  3445. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  3446. Automatically set library path, then run a program.
  3447. This mode accepts the following additional options:
  3448. -dlopen FILE add the directory containing FILE to the library path
  3449. This mode sets the library path environment variable according to '-dlopen'
  3450. flags.
  3451. If any of the ARGS are libtool executable wrappers, then they are translated
  3452. into their corresponding uninstalled binary, and any of their required library
  3453. directories are added to the library path.
  3454. Then, COMMAND is executed, with ARGS as arguments."
  3455. ;;
  3456. finish)
  3457. $ECHO \
  3458. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  3459. Complete the installation of libtool libraries.
  3460. Each LIBDIR is a directory that contains libtool libraries.
  3461. The commands that this mode executes may require superuser privileges. Use
  3462. the '--dry-run' option if you just want to see what would be executed."
  3463. ;;
  3464. install)
  3465. $ECHO \
  3466. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  3467. Install executables or libraries.
  3468. INSTALL-COMMAND is the installation command. The first component should be
  3469. either the 'install' or 'cp' program.
  3470. The following components of INSTALL-COMMAND are treated specially:
  3471. -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  3472. The rest of the components are interpreted as arguments to that command (only
  3473. BSD-compatible install options are recognized)."
  3474. ;;
  3475. link)
  3476. $ECHO \
  3477. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  3478. Link object files or libraries together to form another library, or to
  3479. create an executable program.
  3480. LINK-COMMAND is a command using the C compiler that you would use to create
  3481. a program from several object files.
  3482. The following components of LINK-COMMAND are treated specially:
  3483. -all-static do not do any dynamic linking at all
  3484. -avoid-version do not add a version suffix if possible
  3485. -bindir BINDIR specify path to binaries directory (for systems where
  3486. libraries must be found in the PATH setting at runtime)
  3487. -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
  3488. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  3489. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3490. -export-symbols SYMFILE
  3491. try to export only the symbols listed in SYMFILE
  3492. -export-symbols-regex REGEX
  3493. try to export only the symbols matching REGEX
  3494. -LLIBDIR search LIBDIR for required installed libraries
  3495. -lNAME OUTPUT-FILE requires the installed library libNAME
  3496. -module build a library that can dlopened
  3497. -no-fast-install disable the fast-install mode
  3498. -no-install link a not-installable executable
  3499. -no-undefined declare that a library does not refer to external symbols
  3500. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  3501. -objectlist FILE use a list of object files found in FILE to specify objects
  3502. -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
  3503. -precious-files-regex REGEX
  3504. don't remove output files matching REGEX
  3505. -release RELEASE specify package release information
  3506. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  3507. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  3508. -shared only do dynamic linking of libtool libraries
  3509. -shrext SUFFIX override the standard shared library file extension
  3510. -static do not do any dynamic linking of uninstalled libtool libraries
  3511. -static-libtool-libs
  3512. do not do any dynamic linking of libtool libraries
  3513. -version-info CURRENT[:REVISION[:AGE]]
  3514. specify library version info [each variable defaults to 0]
  3515. -weak LIBNAME declare that the target provides the LIBNAME interface
  3516. -Wc,FLAG
  3517. -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
  3518. -Wl,FLAG
  3519. -Xlinker FLAG pass linker-specific FLAG directly to the linker
  3520. -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
  3521. All other options (arguments beginning with '-') are ignored.
  3522. Every other argument is treated as a filename. Files ending in '.la' are
  3523. treated as uninstalled libtool libraries, other files are standard or library
  3524. object files.
  3525. If the OUTPUT-FILE ends in '.la', then a libtool library is created,
  3526. only library objects ('.lo' files) may be specified, and '-rpath' is
  3527. required, except when creating a convenience library.
  3528. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
  3529. using 'ar' and 'ranlib', or on Windows using 'lib'.
  3530. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
  3531. is created, otherwise an executable program is created."
  3532. ;;
  3533. uninstall)
  3534. $ECHO \
  3535. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3536. Remove libraries from an installation directory.
  3537. RM is the name of the program to use to delete files associated with each FILE
  3538. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3539. to RM.
  3540. If FILE is a libtool library, all the files associated with it are deleted.
  3541. Otherwise, only FILE itself is deleted using RM."
  3542. ;;
  3543. *)
  3544. func_fatal_help "invalid operation mode '$opt_mode'"
  3545. ;;
  3546. esac
  3547. echo
  3548. $ECHO "Try '$progname --help' for more information about other modes."
  3549. }
  3550. # Now that we've collected a possible --mode arg, show help if necessary
  3551. if $opt_help; then
  3552. if test : = "$opt_help"; then
  3553. func_mode_help
  3554. else
  3555. {
  3556. func_help noexit
  3557. for opt_mode in compile link execute install finish uninstall clean; do
  3558. func_mode_help
  3559. done
  3560. } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
  3561. {
  3562. func_help noexit
  3563. for opt_mode in compile link execute install finish uninstall clean; do
  3564. echo
  3565. func_mode_help
  3566. done
  3567. } |
  3568. $SED '1d
  3569. /^When reporting/,/^Report/{
  3570. H
  3571. d
  3572. }
  3573. $x
  3574. /information about other modes/d
  3575. /more detailed .*MODE/d
  3576. s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  3577. fi
  3578. exit $?
  3579. fi
  3580. # func_mode_execute arg...
  3581. func_mode_execute ()
  3582. {
  3583. $debug_cmd
  3584. # The first argument is the command name.
  3585. cmd=$nonopt
  3586. test -z "$cmd" && \
  3587. func_fatal_help "you must specify a COMMAND"
  3588. # Handle -dlopen flags immediately.
  3589. for file in $opt_dlopen; do
  3590. test -f "$file" \
  3591. || func_fatal_help "'$file' is not a file"
  3592. dir=
  3593. case $file in
  3594. *.la)
  3595. func_resolve_sysroot "$file"
  3596. file=$func_resolve_sysroot_result
  3597. # Check to see that this really is a libtool archive.
  3598. func_lalib_unsafe_p "$file" \
  3599. || func_fatal_help "'$lib' is not a valid libtool archive"
  3600. # Read the libtool library.
  3601. dlname=
  3602. library_names=
  3603. func_source "$file"
  3604. # Skip this library if it cannot be dlopened.
  3605. if test -z "$dlname"; then
  3606. # Warn if it was a shared library.
  3607. test -n "$library_names" && \
  3608. func_warning "'$file' was not linked with '-export-dynamic'"
  3609. continue
  3610. fi
  3611. func_dirname "$file" "" "."
  3612. dir=$func_dirname_result
  3613. if test -f "$dir/$objdir/$dlname"; then
  3614. func_append dir "/$objdir"
  3615. else
  3616. if test ! -f "$dir/$dlname"; then
  3617. func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
  3618. fi
  3619. fi
  3620. ;;
  3621. *.lo)
  3622. # Just add the directory containing the .lo file.
  3623. func_dirname "$file" "" "."
  3624. dir=$func_dirname_result
  3625. ;;
  3626. *)
  3627. func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
  3628. continue
  3629. ;;
  3630. esac
  3631. # Get the absolute pathname.
  3632. absdir=`cd "$dir" && pwd`
  3633. test -n "$absdir" && dir=$absdir
  3634. # Now add the directory to shlibpath_var.
  3635. if eval "test -z \"\$$shlibpath_var\""; then
  3636. eval "$shlibpath_var=\"\$dir\""
  3637. else
  3638. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3639. fi
  3640. done
  3641. # This variable tells wrapper scripts just to set shlibpath_var
  3642. # rather than running their programs.
  3643. libtool_execute_magic=$magic
  3644. # Check if any of the arguments is a wrapper script.
  3645. args=
  3646. for file
  3647. do
  3648. case $file in
  3649. -* | *.la | *.lo ) ;;
  3650. *)
  3651. # Do a test to see if this is really a libtool program.
  3652. if func_ltwrapper_script_p "$file"; then
  3653. func_source "$file"
  3654. # Transform arg to wrapped name.
  3655. file=$progdir/$program
  3656. elif func_ltwrapper_executable_p "$file"; then
  3657. func_ltwrapper_scriptname "$file"
  3658. func_source "$func_ltwrapper_scriptname_result"
  3659. # Transform arg to wrapped name.
  3660. file=$progdir/$program
  3661. fi
  3662. ;;
  3663. esac
  3664. # Quote arguments (to preserve shell metacharacters).
  3665. func_append_quoted args "$file"
  3666. done
  3667. if $opt_dry_run; then
  3668. # Display what would be done.
  3669. if test -n "$shlibpath_var"; then
  3670. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  3671. echo "export $shlibpath_var"
  3672. fi
  3673. $ECHO "$cmd$args"
  3674. exit $EXIT_SUCCESS
  3675. else
  3676. if test -n "$shlibpath_var"; then
  3677. # Export the shlibpath_var.
  3678. eval "export $shlibpath_var"
  3679. fi
  3680. # Restore saved environment variables
  3681. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  3682. do
  3683. eval "if test \"\${save_$lt_var+set}\" = set; then
  3684. $lt_var=\$save_$lt_var; export $lt_var
  3685. else
  3686. $lt_unset $lt_var
  3687. fi"
  3688. done
  3689. # Now prepare to actually exec the command.
  3690. exec_cmd=\$cmd$args
  3691. fi
  3692. }
  3693. test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
  3694. # func_mode_finish arg...
  3695. func_mode_finish ()
  3696. {
  3697. $debug_cmd
  3698. libs=
  3699. libdirs=
  3700. admincmds=
  3701. for opt in "$nonopt" ${1+"$@"}
  3702. do
  3703. if test -d "$opt"; then
  3704. func_append libdirs " $opt"
  3705. elif test -f "$opt"; then
  3706. if func_lalib_unsafe_p "$opt"; then
  3707. func_append libs " $opt"
  3708. else
  3709. func_warning "'$opt' is not a valid libtool archive"
  3710. fi
  3711. else
  3712. func_fatal_error "invalid argument '$opt'"
  3713. fi
  3714. done
  3715. if test -n "$libs"; then
  3716. if test -n "$lt_sysroot"; then
  3717. sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
  3718. sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
  3719. else
  3720. sysroot_cmd=
  3721. fi
  3722. # Remove sysroot references
  3723. if $opt_dry_run; then
  3724. for lib in $libs; do
  3725. echo "removing references to $lt_sysroot and '=' prefixes from $lib"
  3726. done
  3727. else
  3728. tmpdir=`func_mktempdir`
  3729. for lib in $libs; do
  3730. $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
  3731. > $tmpdir/tmp-la
  3732. mv -f $tmpdir/tmp-la $lib
  3733. done
  3734. ${RM}r "$tmpdir"
  3735. fi
  3736. fi
  3737. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3738. for libdir in $libdirs; do
  3739. if test -n "$finish_cmds"; then
  3740. # Do each command in the finish commands.
  3741. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  3742. '"$cmd"'"'
  3743. fi
  3744. if test -n "$finish_eval"; then
  3745. # Do the single finish_eval.
  3746. eval cmds=\"$finish_eval\"
  3747. $opt_dry_run || eval "$cmds" || func_append admincmds "
  3748. $cmds"
  3749. fi
  3750. done
  3751. fi
  3752. # Exit here if they wanted silent mode.
  3753. $opt_quiet && exit $EXIT_SUCCESS
  3754. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3755. echo "----------------------------------------------------------------------"
  3756. echo "Libraries have been installed in:"
  3757. for libdir in $libdirs; do
  3758. $ECHO " $libdir"
  3759. done
  3760. echo
  3761. echo "If you ever happen to want to link against installed libraries"
  3762. echo "in a given directory, LIBDIR, you must either use libtool, and"
  3763. echo "specify the full pathname of the library, or use the '-LLIBDIR'"
  3764. echo "flag during linking and do at least one of the following:"
  3765. if test -n "$shlibpath_var"; then
  3766. echo " - add LIBDIR to the '$shlibpath_var' environment variable"
  3767. echo " during execution"
  3768. fi
  3769. if test -n "$runpath_var"; then
  3770. echo " - add LIBDIR to the '$runpath_var' environment variable"
  3771. echo " during linking"
  3772. fi
  3773. if test -n "$hardcode_libdir_flag_spec"; then
  3774. libdir=LIBDIR
  3775. eval flag=\"$hardcode_libdir_flag_spec\"
  3776. $ECHO " - use the '$flag' linker flag"
  3777. fi
  3778. if test -n "$admincmds"; then
  3779. $ECHO " - have your system administrator run these commands:$admincmds"
  3780. fi
  3781. if test -f /etc/ld.so.conf; then
  3782. echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
  3783. fi
  3784. echo
  3785. echo "See any operating system documentation about shared libraries for"
  3786. case $host in
  3787. solaris2.[6789]|solaris2.1[0-9])
  3788. echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  3789. echo "pages."
  3790. ;;
  3791. *)
  3792. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3793. ;;
  3794. esac
  3795. echo "----------------------------------------------------------------------"
  3796. fi
  3797. exit $EXIT_SUCCESS
  3798. }
  3799. test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
  3800. # func_mode_install arg...
  3801. func_mode_install ()
  3802. {
  3803. $debug_cmd
  3804. # There may be an optional sh(1) argument at the beginning of
  3805. # install_prog (especially on Windows NT).
  3806. if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
  3807. # Allow the use of GNU shtool's install command.
  3808. case $nonopt in *shtool*) :;; *) false;; esac
  3809. then
  3810. # Aesthetically quote it.
  3811. func_quote_for_eval "$nonopt"
  3812. install_prog="$func_quote_for_eval_result "
  3813. arg=$1
  3814. shift
  3815. else
  3816. install_prog=
  3817. arg=$nonopt
  3818. fi
  3819. # The real first argument should be the name of the installation program.
  3820. # Aesthetically quote it.
  3821. func_quote_for_eval "$arg"
  3822. func_append install_prog "$func_quote_for_eval_result"
  3823. install_shared_prog=$install_prog
  3824. case " $install_prog " in
  3825. *[\\\ /]cp\ *) install_cp=: ;;
  3826. *) install_cp=false ;;
  3827. esac
  3828. # We need to accept at least all the BSD install flags.
  3829. dest=
  3830. files=
  3831. opts=
  3832. prev=
  3833. install_type=
  3834. isdir=false
  3835. stripme=
  3836. no_mode=:
  3837. for arg
  3838. do
  3839. arg2=
  3840. if test -n "$dest"; then
  3841. func_append files " $dest"
  3842. dest=$arg
  3843. continue
  3844. fi
  3845. case $arg in
  3846. -d) isdir=: ;;
  3847. -f)
  3848. if $install_cp; then :; else
  3849. prev=$arg
  3850. fi
  3851. ;;
  3852. -g | -m | -o)
  3853. prev=$arg
  3854. ;;
  3855. -s)
  3856. stripme=" -s"
  3857. continue
  3858. ;;
  3859. -*)
  3860. ;;
  3861. *)
  3862. # If the previous option needed an argument, then skip it.
  3863. if test -n "$prev"; then
  3864. if test X-m = "X$prev" && test -n "$install_override_mode"; then
  3865. arg2=$install_override_mode
  3866. no_mode=false
  3867. fi
  3868. prev=
  3869. else
  3870. dest=$arg
  3871. continue
  3872. fi
  3873. ;;
  3874. esac
  3875. # Aesthetically quote the argument.
  3876. func_quote_for_eval "$arg"
  3877. func_append install_prog " $func_quote_for_eval_result"
  3878. if test -n "$arg2"; then
  3879. func_quote_for_eval "$arg2"
  3880. fi
  3881. func_append install_shared_prog " $func_quote_for_eval_result"
  3882. done
  3883. test -z "$install_prog" && \
  3884. func_fatal_help "you must specify an install program"
  3885. test -n "$prev" && \
  3886. func_fatal_help "the '$prev' option requires an argument"
  3887. if test -n "$install_override_mode" && $no_mode; then
  3888. if $install_cp; then :; else
  3889. func_quote_for_eval "$install_override_mode"
  3890. func_append install_shared_prog " -m $func_quote_for_eval_result"
  3891. fi
  3892. fi
  3893. if test -z "$files"; then
  3894. if test -z "$dest"; then
  3895. func_fatal_help "no file or destination specified"
  3896. else
  3897. func_fatal_help "you must specify a destination"
  3898. fi
  3899. fi
  3900. # Strip any trailing slash from the destination.
  3901. func_stripname '' '/' "$dest"
  3902. dest=$func_stripname_result
  3903. # Check to see that the destination is a directory.
  3904. test -d "$dest" && isdir=:
  3905. if $isdir; then
  3906. destdir=$dest
  3907. destname=
  3908. else
  3909. func_dirname_and_basename "$dest" "" "."
  3910. destdir=$func_dirname_result
  3911. destname=$func_basename_result
  3912. # Not a directory, so check to see that there is only one file specified.
  3913. set dummy $files; shift
  3914. test "$#" -gt 1 && \
  3915. func_fatal_help "'$dest' is not a directory"
  3916. fi
  3917. case $destdir in
  3918. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3919. *)
  3920. for file in $files; do
  3921. case $file in
  3922. *.lo) ;;
  3923. *)
  3924. func_fatal_help "'$destdir' must be an absolute directory name"
  3925. ;;
  3926. esac
  3927. done
  3928. ;;
  3929. esac
  3930. # This variable tells wrapper scripts just to set variables rather
  3931. # than running their programs.
  3932. libtool_install_magic=$magic
  3933. staticlibs=
  3934. future_libdirs=
  3935. current_libdirs=
  3936. for file in $files; do
  3937. # Do each installation.
  3938. case $file in
  3939. *.$libext)
  3940. # Do the static libraries later.
  3941. func_append staticlibs " $file"
  3942. ;;
  3943. *.la)
  3944. func_resolve_sysroot "$file"
  3945. file=$func_resolve_sysroot_result
  3946. # Check to see that this really is a libtool archive.
  3947. func_lalib_unsafe_p "$file" \
  3948. || func_fatal_help "'$file' is not a valid libtool archive"
  3949. library_names=
  3950. old_library=
  3951. relink_command=
  3952. func_source "$file"
  3953. # Add the libdir to current_libdirs if it is the destination.
  3954. if test "X$destdir" = "X$libdir"; then
  3955. case "$current_libdirs " in
  3956. *" $libdir "*) ;;
  3957. *) func_append current_libdirs " $libdir" ;;
  3958. esac
  3959. else
  3960. # Note the libdir as a future libdir.
  3961. case "$future_libdirs " in
  3962. *" $libdir "*) ;;
  3963. *) func_append future_libdirs " $libdir" ;;
  3964. esac
  3965. fi
  3966. func_dirname "$file" "/" ""
  3967. dir=$func_dirname_result
  3968. func_append dir "$objdir"
  3969. if test -n "$relink_command"; then
  3970. # Determine the prefix the user has applied to our future dir.
  3971. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  3972. # Don't allow the user to place us outside of our expected
  3973. # location b/c this prevents finding dependent libraries that
  3974. # are installed to the same prefix.
  3975. # At present, this check doesn't affect windows .dll's that
  3976. # are installed into $libdir/../bin (currently, that works fine)
  3977. # but it's something to keep an eye on.
  3978. test "$inst_prefix_dir" = "$destdir" && \
  3979. func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
  3980. if test -n "$inst_prefix_dir"; then
  3981. # Stick the inst_prefix_dir data into the link command.
  3982. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  3983. else
  3984. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  3985. fi
  3986. func_warning "relinking '$file'"
  3987. func_show_eval "$relink_command" \
  3988. 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
  3989. fi
  3990. # See the names of the shared library.
  3991. set dummy $library_names; shift
  3992. if test -n "$1"; then
  3993. realname=$1
  3994. shift
  3995. srcname=$realname
  3996. test -n "$relink_command" && srcname=${realname}T
  3997. # Install the shared library and build the symlinks.
  3998. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  3999. 'exit $?'
  4000. tstripme=$stripme
  4001. case $host_os in
  4002. cygwin* | mingw* | pw32* | cegcc*)
  4003. case $realname in
  4004. *.dll.a)
  4005. tstripme=
  4006. ;;
  4007. esac
  4008. ;;
  4009. os2*)
  4010. case $realname in
  4011. *_dll.a)
  4012. tstripme=
  4013. ;;
  4014. esac
  4015. ;;
  4016. esac
  4017. if test -n "$tstripme" && test -n "$striplib"; then
  4018. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  4019. fi
  4020. if test "$#" -gt 0; then
  4021. # Delete the old symlinks, and create new ones.
  4022. # Try 'ln -sf' first, because the 'ln' binary might depend on
  4023. # the symlink we replace! Solaris /bin/ln does not understand -f,
  4024. # so we also need to try rm && ln -s.
  4025. for linkname
  4026. do
  4027. test "$linkname" != "$realname" \
  4028. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  4029. done
  4030. fi
  4031. # Do each command in the postinstall commands.
  4032. lib=$destdir/$realname
  4033. func_execute_cmds "$postinstall_cmds" 'exit $?'
  4034. fi
  4035. # Install the pseudo-library for information purposes.
  4036. func_basename "$file"
  4037. name=$func_basename_result
  4038. instname=$dir/${name}i
  4039. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  4040. # Maybe install the static library, too.
  4041. test -n "$old_library" && func_append staticlibs " $dir/$old_library"
  4042. ;;
  4043. *.lo)
  4044. # Install (i.e. copy) a libtool object.
  4045. # Figure out destination file name, if it wasn't already specified.
  4046. if test -n "$destname"; then
  4047. destfile=$destdir/$destname
  4048. else
  4049. func_basename "$file"
  4050. destfile=$func_basename_result
  4051. destfile=$destdir/$destfile
  4052. fi
  4053. # Deduce the name of the destination old-style object file.
  4054. case $destfile in
  4055. *.lo)
  4056. func_lo2o "$destfile"
  4057. staticdest=$func_lo2o_result
  4058. ;;
  4059. *.$objext)
  4060. staticdest=$destfile
  4061. destfile=
  4062. ;;
  4063. *)
  4064. func_fatal_help "cannot copy a libtool object to '$destfile'"
  4065. ;;
  4066. esac
  4067. # Install the libtool object if requested.
  4068. test -n "$destfile" && \
  4069. func_show_eval "$install_prog $file $destfile" 'exit $?'
  4070. # Install the old object if enabled.
  4071. if test yes = "$build_old_libs"; then
  4072. # Deduce the name of the old-style object file.
  4073. func_lo2o "$file"
  4074. staticobj=$func_lo2o_result
  4075. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  4076. fi
  4077. exit $EXIT_SUCCESS
  4078. ;;
  4079. *)
  4080. # Figure out destination file name, if it wasn't already specified.
  4081. if test -n "$destname"; then
  4082. destfile=$destdir/$destname
  4083. else
  4084. func_basename "$file"
  4085. destfile=$func_basename_result
  4086. destfile=$destdir/$destfile
  4087. fi
  4088. # If the file is missing, and there is a .exe on the end, strip it
  4089. # because it is most likely a libtool script we actually want to
  4090. # install
  4091. stripped_ext=
  4092. case $file in
  4093. *.exe)
  4094. if test ! -f "$file"; then
  4095. func_stripname '' '.exe' "$file"
  4096. file=$func_stripname_result
  4097. stripped_ext=.exe
  4098. fi
  4099. ;;
  4100. esac
  4101. # Do a test to see if this is really a libtool program.
  4102. case $host in
  4103. *cygwin* | *mingw*)
  4104. if func_ltwrapper_executable_p "$file"; then
  4105. func_ltwrapper_scriptname "$file"
  4106. wrapper=$func_ltwrapper_scriptname_result
  4107. else
  4108. func_stripname '' '.exe' "$file"
  4109. wrapper=$func_stripname_result
  4110. fi
  4111. ;;
  4112. *)
  4113. wrapper=$file
  4114. ;;
  4115. esac
  4116. if func_ltwrapper_script_p "$wrapper"; then
  4117. notinst_deplibs=
  4118. relink_command=
  4119. func_source "$wrapper"
  4120. # Check the variables that should have been set.
  4121. test -z "$generated_by_libtool_version" && \
  4122. func_fatal_error "invalid libtool wrapper script '$wrapper'"
  4123. finalize=:
  4124. for lib in $notinst_deplibs; do
  4125. # Check to see that each library is installed.
  4126. libdir=
  4127. if test -f "$lib"; then
  4128. func_source "$lib"
  4129. fi
  4130. libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
  4131. if test -n "$libdir" && test ! -f "$libfile"; then
  4132. func_warning "'$lib' has not been installed in '$libdir'"
  4133. finalize=false
  4134. fi
  4135. done
  4136. relink_command=
  4137. func_source "$wrapper"
  4138. outputname=
  4139. if test no = "$fast_install" && test -n "$relink_command"; then
  4140. $opt_dry_run || {
  4141. if $finalize; then
  4142. tmpdir=`func_mktempdir`
  4143. func_basename "$file$stripped_ext"
  4144. file=$func_basename_result
  4145. outputname=$tmpdir/$file
  4146. # Replace the output file specification.
  4147. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  4148. $opt_quiet || {
  4149. func_quote_for_expand "$relink_command"
  4150. eval "func_echo $func_quote_for_expand_result"
  4151. }
  4152. if eval "$relink_command"; then :
  4153. else
  4154. func_error "error: relink '$file' with the above command before installing it"
  4155. $opt_dry_run || ${RM}r "$tmpdir"
  4156. continue
  4157. fi
  4158. file=$outputname
  4159. else
  4160. func_warning "cannot relink '$file'"
  4161. fi
  4162. }
  4163. else
  4164. # Install the binary that we compiled earlier.
  4165. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  4166. fi
  4167. fi
  4168. # remove .exe since cygwin /usr/bin/install will append another
  4169. # one anyway
  4170. case $install_prog,$host in
  4171. */usr/bin/install*,*cygwin*)
  4172. case $file:$destfile in
  4173. *.exe:*.exe)
  4174. # this is ok
  4175. ;;
  4176. *.exe:*)
  4177. destfile=$destfile.exe
  4178. ;;
  4179. *:*.exe)
  4180. func_stripname '' '.exe' "$destfile"
  4181. destfile=$func_stripname_result
  4182. ;;
  4183. esac
  4184. ;;
  4185. esac
  4186. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  4187. $opt_dry_run || if test -n "$outputname"; then
  4188. ${RM}r "$tmpdir"
  4189. fi
  4190. ;;
  4191. esac
  4192. done
  4193. for file in $staticlibs; do
  4194. func_basename "$file"
  4195. name=$func_basename_result
  4196. # Set up the ranlib parameters.
  4197. oldlib=$destdir/$name
  4198. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  4199. tool_oldlib=$func_to_tool_file_result
  4200. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  4201. if test -n "$stripme" && test -n "$old_striplib"; then
  4202. func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  4203. fi
  4204. # Do each command in the postinstall commands.
  4205. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  4206. done
  4207. test -n "$future_libdirs" && \
  4208. func_warning "remember to run '$progname --finish$future_libdirs'"
  4209. if test -n "$current_libdirs"; then
  4210. # Maybe just do a dry run.
  4211. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  4212. exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
  4213. else
  4214. exit $EXIT_SUCCESS
  4215. fi
  4216. }
  4217. test install = "$opt_mode" && func_mode_install ${1+"$@"}
  4218. # func_generate_dlsyms outputname originator pic_p
  4219. # Extract symbols from dlprefiles and create ${outputname}S.o with
  4220. # a dlpreopen symbol table.
  4221. func_generate_dlsyms ()
  4222. {
  4223. $debug_cmd
  4224. my_outputname=$1
  4225. my_originator=$2
  4226. my_pic_p=${3-false}
  4227. my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
  4228. my_dlsyms=
  4229. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  4230. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4231. my_dlsyms=${my_outputname}S.c
  4232. else
  4233. func_error "not configured to extract global symbols from dlpreopened files"
  4234. fi
  4235. fi
  4236. if test -n "$my_dlsyms"; then
  4237. case $my_dlsyms in
  4238. "") ;;
  4239. *.c)
  4240. # Discover the nlist of each of the dlfiles.
  4241. nlist=$output_objdir/$my_outputname.nm
  4242. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  4243. # Parse the name list into a source file.
  4244. func_verbose "creating $output_objdir/$my_dlsyms"
  4245. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  4246. /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
  4247. /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
  4248. #ifdef __cplusplus
  4249. extern \"C\" {
  4250. #endif
  4251. #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  4252. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  4253. #endif
  4254. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
  4255. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  4256. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  4257. relocations are performed -- see ld's documentation on pseudo-relocs. */
  4258. # define LT_DLSYM_CONST
  4259. #elif defined __osf__
  4260. /* This system does not cope well with relocations in const data. */
  4261. # define LT_DLSYM_CONST
  4262. #else
  4263. # define LT_DLSYM_CONST const
  4264. #endif
  4265. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  4266. /* External symbol declarations for the compiler. */\
  4267. "
  4268. if test yes = "$dlself"; then
  4269. func_verbose "generating symbol list for '$output'"
  4270. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  4271. # Add our own program objects to the symbol list.
  4272. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  4273. for progfile in $progfiles; do
  4274. func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  4275. func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
  4276. $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  4277. done
  4278. if test -n "$exclude_expsyms"; then
  4279. $opt_dry_run || {
  4280. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4281. eval '$MV "$nlist"T "$nlist"'
  4282. }
  4283. fi
  4284. if test -n "$export_symbols_regex"; then
  4285. $opt_dry_run || {
  4286. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4287. eval '$MV "$nlist"T "$nlist"'
  4288. }
  4289. fi
  4290. # Prepare the list of exported symbols
  4291. if test -z "$export_symbols"; then
  4292. export_symbols=$output_objdir/$outputname.exp
  4293. $opt_dry_run || {
  4294. $RM $export_symbols
  4295. eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4296. case $host in
  4297. *cygwin* | *mingw* | *cegcc* )
  4298. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4299. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4300. ;;
  4301. esac
  4302. }
  4303. else
  4304. $opt_dry_run || {
  4305. eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4306. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4307. eval '$MV "$nlist"T "$nlist"'
  4308. case $host in
  4309. *cygwin* | *mingw* | *cegcc* )
  4310. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4311. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4312. ;;
  4313. esac
  4314. }
  4315. fi
  4316. fi
  4317. for dlprefile in $dlprefiles; do
  4318. func_verbose "extracting global C symbols from '$dlprefile'"
  4319. func_basename "$dlprefile"
  4320. name=$func_basename_result
  4321. case $host in
  4322. *cygwin* | *mingw* | *cegcc* )
  4323. # if an import library, we need to obtain dlname
  4324. if func_win32_import_lib_p "$dlprefile"; then
  4325. func_tr_sh "$dlprefile"
  4326. eval "curr_lafile=\$libfile_$func_tr_sh_result"
  4327. dlprefile_dlbasename=
  4328. if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  4329. # Use subshell, to avoid clobbering current variable values
  4330. dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  4331. if test -n "$dlprefile_dlname"; then
  4332. func_basename "$dlprefile_dlname"
  4333. dlprefile_dlbasename=$func_basename_result
  4334. else
  4335. # no lafile. user explicitly requested -dlpreopen <import library>.
  4336. $sharedlib_from_linklib_cmd "$dlprefile"
  4337. dlprefile_dlbasename=$sharedlib_from_linklib_result
  4338. fi
  4339. fi
  4340. $opt_dry_run || {
  4341. if test -n "$dlprefile_dlbasename"; then
  4342. eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  4343. else
  4344. func_warning "Could not compute DLL name from $name"
  4345. eval '$ECHO ": $name " >> "$nlist"'
  4346. fi
  4347. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4348. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4349. $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  4350. }
  4351. else # not an import lib
  4352. $opt_dry_run || {
  4353. eval '$ECHO ": $name " >> "$nlist"'
  4354. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4355. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4356. }
  4357. fi
  4358. ;;
  4359. *)
  4360. $opt_dry_run || {
  4361. eval '$ECHO ": $name " >> "$nlist"'
  4362. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4363. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4364. }
  4365. ;;
  4366. esac
  4367. done
  4368. $opt_dry_run || {
  4369. # Make sure we have at least an empty file.
  4370. test -f "$nlist" || : > "$nlist"
  4371. if test -n "$exclude_expsyms"; then
  4372. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4373. $MV "$nlist"T "$nlist"
  4374. fi
  4375. # Try sorting and uniquifying the output.
  4376. if $GREP -v "^: " < "$nlist" |
  4377. if sort -k 3 </dev/null >/dev/null 2>&1; then
  4378. sort -k 3
  4379. else
  4380. sort +2
  4381. fi |
  4382. uniq > "$nlist"S; then
  4383. :
  4384. else
  4385. $GREP -v "^: " < "$nlist" > "$nlist"S
  4386. fi
  4387. if test -f "$nlist"S; then
  4388. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  4389. else
  4390. echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  4391. fi
  4392. func_show_eval '$RM "${nlist}I"'
  4393. if test -n "$global_symbol_to_import"; then
  4394. eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
  4395. fi
  4396. echo >> "$output_objdir/$my_dlsyms" "\
  4397. /* The mapping between symbol names and symbols. */
  4398. typedef struct {
  4399. const char *name;
  4400. void *address;
  4401. } lt_dlsymlist;
  4402. extern LT_DLSYM_CONST lt_dlsymlist
  4403. lt_${my_prefix}_LTX_preloaded_symbols[];\
  4404. "
  4405. if test -s "$nlist"I; then
  4406. echo >> "$output_objdir/$my_dlsyms" "\
  4407. static void lt_syminit(void)
  4408. {
  4409. LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
  4410. for (; symbol->name; ++symbol)
  4411. {"
  4412. $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
  4413. echo >> "$output_objdir/$my_dlsyms" "\
  4414. }
  4415. }"
  4416. fi
  4417. echo >> "$output_objdir/$my_dlsyms" "\
  4418. LT_DLSYM_CONST lt_dlsymlist
  4419. lt_${my_prefix}_LTX_preloaded_symbols[] =
  4420. { {\"$my_originator\", (void *) 0},"
  4421. if test -s "$nlist"I; then
  4422. echo >> "$output_objdir/$my_dlsyms" "\
  4423. {\"@INIT@\", (void *) &lt_syminit},"
  4424. fi
  4425. case $need_lib_prefix in
  4426. no)
  4427. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4428. ;;
  4429. *)
  4430. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4431. ;;
  4432. esac
  4433. echo >> "$output_objdir/$my_dlsyms" "\
  4434. {0, (void *) 0}
  4435. };
  4436. /* This works around a problem in FreeBSD linker */
  4437. #ifdef FREEBSD_WORKAROUND
  4438. static const void *lt_preloaded_setup() {
  4439. return lt_${my_prefix}_LTX_preloaded_symbols;
  4440. }
  4441. #endif
  4442. #ifdef __cplusplus
  4443. }
  4444. #endif\
  4445. "
  4446. } # !$opt_dry_run
  4447. pic_flag_for_symtable=
  4448. case "$compile_command " in
  4449. *" -static "*) ;;
  4450. *)
  4451. case $host in
  4452. # compiling the symbol table file with pic_flag works around
  4453. # a FreeBSD bug that causes programs to crash when -lm is
  4454. # linked before any other PIC object. But we must not use
  4455. # pic_flag when linking with -static. The problem exists in
  4456. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4457. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4458. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  4459. *-*-hpux*)
  4460. pic_flag_for_symtable=" $pic_flag" ;;
  4461. *)
  4462. $my_pic_p && pic_flag_for_symtable=" $pic_flag"
  4463. ;;
  4464. esac
  4465. ;;
  4466. esac
  4467. symtab_cflags=
  4468. for arg in $LTCFLAGS; do
  4469. case $arg in
  4470. -pie | -fpie | -fPIE) ;;
  4471. *) func_append symtab_cflags " $arg" ;;
  4472. esac
  4473. done
  4474. # Now compile the dynamic symbol file.
  4475. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  4476. # Clean up the generated files.
  4477. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
  4478. # Transform the symbol file into the correct name.
  4479. symfileobj=$output_objdir/${my_outputname}S.$objext
  4480. case $host in
  4481. *cygwin* | *mingw* | *cegcc* )
  4482. if test -f "$output_objdir/$my_outputname.def"; then
  4483. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4484. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4485. else
  4486. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4487. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4488. fi
  4489. ;;
  4490. *)
  4491. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4492. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4493. ;;
  4494. esac
  4495. ;;
  4496. *)
  4497. func_fatal_error "unknown suffix for '$my_dlsyms'"
  4498. ;;
  4499. esac
  4500. else
  4501. # We keep going just in case the user didn't refer to
  4502. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4503. # really was required.
  4504. # Nullify the symbol file.
  4505. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  4506. finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  4507. fi
  4508. }
  4509. # func_cygming_gnu_implib_p ARG
  4510. # This predicate returns with zero status (TRUE) if
  4511. # ARG is a GNU/binutils-style import library. Returns
  4512. # with nonzero status (FALSE) otherwise.
  4513. func_cygming_gnu_implib_p ()
  4514. {
  4515. $debug_cmd
  4516. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4517. 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)$'`
  4518. test -n "$func_cygming_gnu_implib_tmp"
  4519. }
  4520. # func_cygming_ms_implib_p ARG
  4521. # This predicate returns with zero status (TRUE) if
  4522. # ARG is an MS-style import library. Returns
  4523. # with nonzero status (FALSE) otherwise.
  4524. func_cygming_ms_implib_p ()
  4525. {
  4526. $debug_cmd
  4527. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4528. func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4529. test -n "$func_cygming_ms_implib_tmp"
  4530. }
  4531. # func_win32_libid arg
  4532. # return the library type of file 'arg'
  4533. #
  4534. # Need a lot of goo to handle *both* DLLs and import libs
  4535. # Has to be a shell function in order to 'eat' the argument
  4536. # that is supplied when $file_magic_command is called.
  4537. # Despite the name, also deal with 64 bit binaries.
  4538. func_win32_libid ()
  4539. {
  4540. $debug_cmd
  4541. win32_libid_type=unknown
  4542. win32_fileres=`file -L $1 2>/dev/null`
  4543. case $win32_fileres in
  4544. *ar\ archive\ import\ library*) # definitely import
  4545. win32_libid_type="x86 archive import"
  4546. ;;
  4547. *ar\ archive*) # could be an import, or static
  4548. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  4549. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  4550. $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  4551. case $nm_interface in
  4552. "MS dumpbin")
  4553. if func_cygming_ms_implib_p "$1" ||
  4554. func_cygming_gnu_implib_p "$1"
  4555. then
  4556. win32_nmres=import
  4557. else
  4558. win32_nmres=
  4559. fi
  4560. ;;
  4561. *)
  4562. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4563. win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  4564. $SED -n -e '
  4565. 1,100{
  4566. / I /{
  4567. s|.*|import|
  4568. p
  4569. q
  4570. }
  4571. }'`
  4572. ;;
  4573. esac
  4574. case $win32_nmres in
  4575. import*) win32_libid_type="x86 archive import";;
  4576. *) win32_libid_type="x86 archive static";;
  4577. esac
  4578. fi
  4579. ;;
  4580. *DLL*)
  4581. win32_libid_type="x86 DLL"
  4582. ;;
  4583. *executable*) # but shell scripts are "executable" too...
  4584. case $win32_fileres in
  4585. *MS\ Windows\ PE\ Intel*)
  4586. win32_libid_type="x86 DLL"
  4587. ;;
  4588. esac
  4589. ;;
  4590. esac
  4591. $ECHO "$win32_libid_type"
  4592. }
  4593. # func_cygming_dll_for_implib ARG
  4594. #
  4595. # Platform-specific function to extract the
  4596. # name of the DLL associated with the specified
  4597. # import library ARG.
  4598. # Invoked by eval'ing the libtool variable
  4599. # $sharedlib_from_linklib_cmd
  4600. # Result is available in the variable
  4601. # $sharedlib_from_linklib_result
  4602. func_cygming_dll_for_implib ()
  4603. {
  4604. $debug_cmd
  4605. sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4606. }
  4607. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4608. #
  4609. # The is the core of a fallback implementation of a
  4610. # platform-specific function to extract the name of the
  4611. # DLL associated with the specified import library LIBNAME.
  4612. #
  4613. # SECTION_NAME is either .idata$6 or .idata$7, depending
  4614. # on the platform and compiler that created the implib.
  4615. #
  4616. # Echos the name of the DLL associated with the
  4617. # specified import library.
  4618. func_cygming_dll_for_implib_fallback_core ()
  4619. {
  4620. $debug_cmd
  4621. match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  4622. $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  4623. $SED '/^Contents of section '"$match_literal"':/{
  4624. # Place marker at beginning of archive member dllname section
  4625. s/.*/====MARK====/
  4626. p
  4627. d
  4628. }
  4629. # These lines can sometimes be longer than 43 characters, but
  4630. # are always uninteresting
  4631. /:[ ]*file format pe[i]\{,1\}-/d
  4632. /^In archive [^:]*:/d
  4633. # Ensure marker is printed
  4634. /^====MARK====/p
  4635. # Remove all lines with less than 43 characters
  4636. /^.\{43\}/!d
  4637. # From remaining lines, remove first 43 characters
  4638. s/^.\{43\}//' |
  4639. $SED -n '
  4640. # Join marker and all lines until next marker into a single line
  4641. /^====MARK====/ b para
  4642. H
  4643. $ b para
  4644. b
  4645. :para
  4646. x
  4647. s/\n//g
  4648. # Remove the marker
  4649. s/^====MARK====//
  4650. # Remove trailing dots and whitespace
  4651. s/[\. \t]*$//
  4652. # Print
  4653. /./p' |
  4654. # we now have a list, one entry per line, of the stringified
  4655. # contents of the appropriate section of all members of the
  4656. # archive that possess that section. Heuristic: eliminate
  4657. # all those that have a first or second character that is
  4658. # a '.' (that is, objdump's representation of an unprintable
  4659. # character.) This should work for all archives with less than
  4660. # 0x302f exports -- but will fail for DLLs whose name actually
  4661. # begins with a literal '.' or a single character followed by
  4662. # a '.'.
  4663. #
  4664. # Of those that remain, print the first one.
  4665. $SED -e '/^\./d;/^.\./d;q'
  4666. }
  4667. # func_cygming_dll_for_implib_fallback ARG
  4668. # Platform-specific function to extract the
  4669. # name of the DLL associated with the specified
  4670. # import library ARG.
  4671. #
  4672. # This fallback implementation is for use when $DLLTOOL
  4673. # does not support the --identify-strict option.
  4674. # Invoked by eval'ing the libtool variable
  4675. # $sharedlib_from_linklib_cmd
  4676. # Result is available in the variable
  4677. # $sharedlib_from_linklib_result
  4678. func_cygming_dll_for_implib_fallback ()
  4679. {
  4680. $debug_cmd
  4681. if func_cygming_gnu_implib_p "$1"; then
  4682. # binutils import library
  4683. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  4684. elif func_cygming_ms_implib_p "$1"; then
  4685. # ms-generated import library
  4686. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  4687. else
  4688. # unknown
  4689. sharedlib_from_linklib_result=
  4690. fi
  4691. }
  4692. # func_extract_an_archive dir oldlib
  4693. func_extract_an_archive ()
  4694. {
  4695. $debug_cmd
  4696. f_ex_an_ar_dir=$1; shift
  4697. f_ex_an_ar_oldlib=$1
  4698. if test yes = "$lock_old_archive_extraction"; then
  4699. lockfile=$f_ex_an_ar_oldlib.lock
  4700. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  4701. func_echo "Waiting for $lockfile to be removed"
  4702. sleep 2
  4703. done
  4704. fi
  4705. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  4706. 'stat=$?; rm -f "$lockfile"; exit $stat'
  4707. if test yes = "$lock_old_archive_extraction"; then
  4708. $opt_dry_run || rm -f "$lockfile"
  4709. fi
  4710. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  4711. :
  4712. else
  4713. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  4714. fi
  4715. }
  4716. # func_extract_archives gentop oldlib ...
  4717. func_extract_archives ()
  4718. {
  4719. $debug_cmd
  4720. my_gentop=$1; shift
  4721. my_oldlibs=${1+"$@"}
  4722. my_oldobjs=
  4723. my_xlib=
  4724. my_xabs=
  4725. my_xdir=
  4726. for my_xlib in $my_oldlibs; do
  4727. # Extract the objects.
  4728. case $my_xlib in
  4729. [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
  4730. *) my_xabs=`pwd`"/$my_xlib" ;;
  4731. esac
  4732. func_basename "$my_xlib"
  4733. my_xlib=$func_basename_result
  4734. my_xlib_u=$my_xlib
  4735. while :; do
  4736. case " $extracted_archives " in
  4737. *" $my_xlib_u "*)
  4738. func_arith $extracted_serial + 1
  4739. extracted_serial=$func_arith_result
  4740. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  4741. *) break ;;
  4742. esac
  4743. done
  4744. extracted_archives="$extracted_archives $my_xlib_u"
  4745. my_xdir=$my_gentop/$my_xlib_u
  4746. func_mkdir_p "$my_xdir"
  4747. case $host in
  4748. *-darwin*)
  4749. func_verbose "Extracting $my_xabs"
  4750. # Do not bother doing anything if just a dry run
  4751. $opt_dry_run || {
  4752. darwin_orig_dir=`pwd`
  4753. cd $my_xdir || exit $?
  4754. darwin_archive=$my_xabs
  4755. darwin_curdir=`pwd`
  4756. func_basename "$darwin_archive"
  4757. darwin_base_archive=$func_basename_result
  4758. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  4759. if test -n "$darwin_arches"; then
  4760. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  4761. darwin_arch=
  4762. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  4763. for darwin_arch in $darwin_arches; do
  4764. func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
  4765. $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
  4766. cd "unfat-$$/$darwin_base_archive-$darwin_arch"
  4767. func_extract_an_archive "`pwd`" "$darwin_base_archive"
  4768. cd "$darwin_curdir"
  4769. $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
  4770. done # $darwin_arches
  4771. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  4772. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
  4773. darwin_file=
  4774. darwin_files=
  4775. for darwin_file in $darwin_filelist; do
  4776. darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  4777. $LIPO -create -output "$darwin_file" $darwin_files
  4778. done # $darwin_filelist
  4779. $RM -rf unfat-$$
  4780. cd "$darwin_orig_dir"
  4781. else
  4782. cd $darwin_orig_dir
  4783. func_extract_an_archive "$my_xdir" "$my_xabs"
  4784. fi # $darwin_arches
  4785. } # !$opt_dry_run
  4786. ;;
  4787. *)
  4788. func_extract_an_archive "$my_xdir" "$my_xabs"
  4789. ;;
  4790. esac
  4791. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  4792. done
  4793. func_extract_archives_result=$my_oldobjs
  4794. }
  4795. # func_emit_wrapper [arg=no]
  4796. #
  4797. # Emit a libtool wrapper script on stdout.
  4798. # Don't directly open a file because we may want to
  4799. # incorporate the script contents within a cygwin/mingw
  4800. # wrapper executable. Must ONLY be called from within
  4801. # func_mode_link because it depends on a number of variables
  4802. # set therein.
  4803. #
  4804. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  4805. # variable will take. If 'yes', then the emitted script
  4806. # will assume that the directory where it is stored is
  4807. # the $objdir directory. This is a cygwin/mingw-specific
  4808. # behavior.
  4809. func_emit_wrapper ()
  4810. {
  4811. func_emit_wrapper_arg1=${1-no}
  4812. $ECHO "\
  4813. #! $SHELL
  4814. # $output - temporary wrapper script for $objdir/$outputname
  4815. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  4816. #
  4817. # The $output program cannot be directly executed until all the libtool
  4818. # libraries that it depends on are installed.
  4819. #
  4820. # This wrapper script should never be moved out of the build directory.
  4821. # If it is, it will not operate correctly.
  4822. # Sed substitution that helps us do robust quoting. It backslashifies
  4823. # metacharacters that are still active within double-quoted strings.
  4824. sed_quote_subst='$sed_quote_subst'
  4825. # Be Bourne compatible
  4826. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  4827. emulate sh
  4828. NULLCMD=:
  4829. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  4830. # is contrary to our usage. Disable this feature.
  4831. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  4832. setopt NO_GLOB_SUBST
  4833. else
  4834. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  4835. fi
  4836. BIN_SH=xpg4; export BIN_SH # for Tru64
  4837. DUALCASE=1; export DUALCASE # for MKS sh
  4838. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4839. # if CDPATH is set.
  4840. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4841. relink_command=\"$relink_command\"
  4842. # This environment variable determines our operation mode.
  4843. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4844. # install mode needs the following variables:
  4845. generated_by_libtool_version='$macro_version'
  4846. notinst_deplibs='$notinst_deplibs'
  4847. else
  4848. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  4849. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4850. file=\"\$0\""
  4851. qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
  4852. $ECHO "\
  4853. # A function that is used when there is no print builtin or printf.
  4854. func_fallback_echo ()
  4855. {
  4856. eval 'cat <<_LTECHO_EOF
  4857. \$1
  4858. _LTECHO_EOF'
  4859. }
  4860. ECHO=\"$qECHO\"
  4861. fi
  4862. # Very basic option parsing. These options are (a) specific to
  4863. # the libtool wrapper, (b) are identical between the wrapper
  4864. # /script/ and the wrapper /executable/ that is used only on
  4865. # windows platforms, and (c) all begin with the string "--lt-"
  4866. # (application programs are unlikely to have options that match
  4867. # this pattern).
  4868. #
  4869. # There are only two supported options: --lt-debug and
  4870. # --lt-dump-script. There is, deliberately, no --lt-help.
  4871. #
  4872. # The first argument to this parsing function should be the
  4873. # script's $0 value, followed by "$@".
  4874. lt_option_debug=
  4875. func_parse_lt_options ()
  4876. {
  4877. lt_script_arg0=\$0
  4878. shift
  4879. for lt_opt
  4880. do
  4881. case \"\$lt_opt\" in
  4882. --lt-debug) lt_option_debug=1 ;;
  4883. --lt-dump-script)
  4884. lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  4885. test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  4886. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  4887. cat \"\$lt_dump_D/\$lt_dump_F\"
  4888. exit 0
  4889. ;;
  4890. --lt-*)
  4891. \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  4892. exit 1
  4893. ;;
  4894. esac
  4895. done
  4896. # Print the debug banner immediately:
  4897. if test -n \"\$lt_option_debug\"; then
  4898. echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
  4899. fi
  4900. }
  4901. # Used when --lt-debug. Prints its arguments to stdout
  4902. # (redirection is the responsibility of the caller)
  4903. func_lt_dump_args ()
  4904. {
  4905. lt_dump_args_N=1;
  4906. for lt_arg
  4907. do
  4908. \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
  4909. lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  4910. done
  4911. }
  4912. # Core function for launching the target application
  4913. func_exec_program_core ()
  4914. {
  4915. "
  4916. case $host in
  4917. # Backslashes separate directories on plain windows
  4918. *-*-mingw | *-*-os2* | *-cegcc*)
  4919. $ECHO "\
  4920. if test -n \"\$lt_option_debug\"; then
  4921. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
  4922. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4923. fi
  4924. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  4925. "
  4926. ;;
  4927. *)
  4928. $ECHO "\
  4929. if test -n \"\$lt_option_debug\"; then
  4930. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
  4931. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4932. fi
  4933. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  4934. "
  4935. ;;
  4936. esac
  4937. $ECHO "\
  4938. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  4939. exit 1
  4940. }
  4941. # A function to encapsulate launching the target application
  4942. # Strips options in the --lt-* namespace from \$@ and
  4943. # launches target application with the remaining arguments.
  4944. func_exec_program ()
  4945. {
  4946. case \" \$* \" in
  4947. *\\ --lt-*)
  4948. for lt_wr_arg
  4949. do
  4950. case \$lt_wr_arg in
  4951. --lt-*) ;;
  4952. *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  4953. esac
  4954. shift
  4955. done ;;
  4956. esac
  4957. func_exec_program_core \${1+\"\$@\"}
  4958. }
  4959. # Parse options
  4960. func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  4961. # Find the directory that this script lives in.
  4962. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  4963. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4964. # Follow symbolic links until we get to the real thisdir.
  4965. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  4966. while test -n \"\$file\"; do
  4967. destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  4968. # If there was a directory component, then change thisdir.
  4969. if test \"x\$destdir\" != \"x\$file\"; then
  4970. case \"\$destdir\" in
  4971. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4972. *) thisdir=\"\$thisdir/\$destdir\" ;;
  4973. esac
  4974. fi
  4975. file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  4976. file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  4977. done
  4978. # Usually 'no', except on cygwin/mingw when embedded into
  4979. # the cwrapper.
  4980. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  4981. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  4982. # special case for '.'
  4983. if test \"\$thisdir\" = \".\"; then
  4984. thisdir=\`pwd\`
  4985. fi
  4986. # remove .libs from thisdir
  4987. case \"\$thisdir\" in
  4988. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  4989. $objdir ) thisdir=. ;;
  4990. esac
  4991. fi
  4992. # Try to get the absolute directory name.
  4993. absdir=\`cd \"\$thisdir\" && pwd\`
  4994. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4995. "
  4996. if test yes = "$fast_install"; then
  4997. $ECHO "\
  4998. program=lt-'$outputname'$exeext
  4999. progdir=\"\$thisdir/$objdir\"
  5000. if test ! -f \"\$progdir/\$program\" ||
  5001. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
  5002. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  5003. file=\"\$\$-\$program\"
  5004. if test ! -d \"\$progdir\"; then
  5005. $MKDIR \"\$progdir\"
  5006. else
  5007. $RM \"\$progdir/\$file\"
  5008. fi"
  5009. $ECHO "\
  5010. # relink executable if necessary
  5011. if test -n \"\$relink_command\"; then
  5012. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  5013. else
  5014. \$ECHO \"\$relink_command_output\" >&2
  5015. $RM \"\$progdir/\$file\"
  5016. exit 1
  5017. fi
  5018. fi
  5019. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  5020. { $RM \"\$progdir/\$program\";
  5021. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  5022. $RM \"\$progdir/\$file\"
  5023. fi"
  5024. else
  5025. $ECHO "\
  5026. program='$outputname'
  5027. progdir=\"\$thisdir/$objdir\"
  5028. "
  5029. fi
  5030. $ECHO "\
  5031. if test -f \"\$progdir/\$program\"; then"
  5032. # fixup the dll searchpath if we need to.
  5033. #
  5034. # Fix the DLL searchpath if we need to. Do this before prepending
  5035. # to shlibpath, because on Windows, both are PATH and uninstalled
  5036. # libraries must come first.
  5037. if test -n "$dllsearchpath"; then
  5038. $ECHO "\
  5039. # Add the dll search path components to the executable PATH
  5040. PATH=$dllsearchpath:\$PATH
  5041. "
  5042. fi
  5043. # Export our shlibpath_var if we have one.
  5044. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5045. $ECHO "\
  5046. # Add our own library path to $shlibpath_var
  5047. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  5048. # Some systems cannot cope with colon-terminated $shlibpath_var
  5049. # The second colon is a workaround for a bug in BeOS R4 sed
  5050. $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  5051. export $shlibpath_var
  5052. "
  5053. fi
  5054. $ECHO "\
  5055. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5056. # Run the actual program with our arguments.
  5057. func_exec_program \${1+\"\$@\"}
  5058. fi
  5059. else
  5060. # The program doesn't exist.
  5061. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
  5062. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  5063. \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  5064. exit 1
  5065. fi
  5066. fi\
  5067. "
  5068. }
  5069. # func_emit_cwrapperexe_src
  5070. # emit the source code for a wrapper executable on stdout
  5071. # Must ONLY be called from within func_mode_link because
  5072. # it depends on a number of variable set therein.
  5073. func_emit_cwrapperexe_src ()
  5074. {
  5075. cat <<EOF
  5076. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  5077. Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  5078. The $output program cannot be directly executed until all the libtool
  5079. libraries that it depends on are installed.
  5080. This wrapper executable should never be moved out of the build directory.
  5081. If it is, it will not operate correctly.
  5082. */
  5083. EOF
  5084. cat <<"EOF"
  5085. #ifdef _MSC_VER
  5086. # define _CRT_SECURE_NO_DEPRECATE 1
  5087. #endif
  5088. #include <stdio.h>
  5089. #include <stdlib.h>
  5090. #ifdef _MSC_VER
  5091. # include <direct.h>
  5092. # include <process.h>
  5093. # include <io.h>
  5094. #else
  5095. # include <unistd.h>
  5096. # include <stdint.h>
  5097. # ifdef __CYGWIN__
  5098. # include <io.h>
  5099. # endif
  5100. #endif
  5101. #include <malloc.h>
  5102. #include <stdarg.h>
  5103. #include <assert.h>
  5104. #include <string.h>
  5105. #include <ctype.h>
  5106. #include <errno.h>
  5107. #include <fcntl.h>
  5108. #include <sys/stat.h>
  5109. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  5110. /* declarations of non-ANSI functions */
  5111. #if defined __MINGW32__
  5112. # ifdef __STRICT_ANSI__
  5113. int _putenv (const char *);
  5114. # endif
  5115. #elif defined __CYGWIN__
  5116. # ifdef __STRICT_ANSI__
  5117. char *realpath (const char *, char *);
  5118. int putenv (char *);
  5119. int setenv (const char *, const char *, int);
  5120. # endif
  5121. /* #elif defined other_platform || defined ... */
  5122. #endif
  5123. /* portability defines, excluding path handling macros */
  5124. #if defined _MSC_VER
  5125. # define setmode _setmode
  5126. # define stat _stat
  5127. # define chmod _chmod
  5128. # define getcwd _getcwd
  5129. # define putenv _putenv
  5130. # define S_IXUSR _S_IEXEC
  5131. #elif defined __MINGW32__
  5132. # define setmode _setmode
  5133. # define stat _stat
  5134. # define chmod _chmod
  5135. # define getcwd _getcwd
  5136. # define putenv _putenv
  5137. #elif defined __CYGWIN__
  5138. # define HAVE_SETENV
  5139. # define FOPEN_WB "wb"
  5140. /* #elif defined other platforms ... */
  5141. #endif
  5142. #if defined PATH_MAX
  5143. # define LT_PATHMAX PATH_MAX
  5144. #elif defined MAXPATHLEN
  5145. # define LT_PATHMAX MAXPATHLEN
  5146. #else
  5147. # define LT_PATHMAX 1024
  5148. #endif
  5149. #ifndef S_IXOTH
  5150. # define S_IXOTH 0
  5151. #endif
  5152. #ifndef S_IXGRP
  5153. # define S_IXGRP 0
  5154. #endif
  5155. /* path handling portability macros */
  5156. #ifndef DIR_SEPARATOR
  5157. # define DIR_SEPARATOR '/'
  5158. # define PATH_SEPARATOR ':'
  5159. #endif
  5160. #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
  5161. defined __OS2__
  5162. # define HAVE_DOS_BASED_FILE_SYSTEM
  5163. # define FOPEN_WB "wb"
  5164. # ifndef DIR_SEPARATOR_2
  5165. # define DIR_SEPARATOR_2 '\\'
  5166. # endif
  5167. # ifndef PATH_SEPARATOR_2
  5168. # define PATH_SEPARATOR_2 ';'
  5169. # endif
  5170. #endif
  5171. #ifndef DIR_SEPARATOR_2
  5172. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  5173. #else /* DIR_SEPARATOR_2 */
  5174. # define IS_DIR_SEPARATOR(ch) \
  5175. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  5176. #endif /* DIR_SEPARATOR_2 */
  5177. #ifndef PATH_SEPARATOR_2
  5178. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  5179. #else /* PATH_SEPARATOR_2 */
  5180. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  5181. #endif /* PATH_SEPARATOR_2 */
  5182. #ifndef FOPEN_WB
  5183. # define FOPEN_WB "w"
  5184. #endif
  5185. #ifndef _O_BINARY
  5186. # define _O_BINARY 0
  5187. #endif
  5188. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  5189. #define XFREE(stale) do { \
  5190. if (stale) { free (stale); stale = 0; } \
  5191. } while (0)
  5192. #if defined LT_DEBUGWRAPPER
  5193. static int lt_debug = 1;
  5194. #else
  5195. static int lt_debug = 0;
  5196. #endif
  5197. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  5198. void *xmalloc (size_t num);
  5199. char *xstrdup (const char *string);
  5200. const char *base_name (const char *name);
  5201. char *find_executable (const char *wrapper);
  5202. char *chase_symlinks (const char *pathspec);
  5203. int make_executable (const char *path);
  5204. int check_executable (const char *path);
  5205. char *strendzap (char *str, const char *pat);
  5206. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  5207. void lt_fatal (const char *file, int line, const char *message, ...);
  5208. static const char *nonnull (const char *s);
  5209. static const char *nonempty (const char *s);
  5210. void lt_setenv (const char *name, const char *value);
  5211. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  5212. void lt_update_exe_path (const char *name, const char *value);
  5213. void lt_update_lib_path (const char *name, const char *value);
  5214. char **prepare_spawn (char **argv);
  5215. void lt_dump_script (FILE *f);
  5216. EOF
  5217. cat <<EOF
  5218. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  5219. # define externally_visible volatile
  5220. #else
  5221. # define externally_visible __attribute__((externally_visible)) volatile
  5222. #endif
  5223. externally_visible const char * MAGIC_EXE = "$magic_exe";
  5224. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  5225. EOF
  5226. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5227. func_to_host_path "$temp_rpath"
  5228. cat <<EOF
  5229. const char * LIB_PATH_VALUE = "$func_to_host_path_result";
  5230. EOF
  5231. else
  5232. cat <<"EOF"
  5233. const char * LIB_PATH_VALUE = "";
  5234. EOF
  5235. fi
  5236. if test -n "$dllsearchpath"; then
  5237. func_to_host_path "$dllsearchpath:"
  5238. cat <<EOF
  5239. const char * EXE_PATH_VARNAME = "PATH";
  5240. const char * EXE_PATH_VALUE = "$func_to_host_path_result";
  5241. EOF
  5242. else
  5243. cat <<"EOF"
  5244. const char * EXE_PATH_VARNAME = "";
  5245. const char * EXE_PATH_VALUE = "";
  5246. EOF
  5247. fi
  5248. if test yes = "$fast_install"; then
  5249. cat <<EOF
  5250. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  5251. EOF
  5252. else
  5253. cat <<EOF
  5254. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  5255. EOF
  5256. fi
  5257. cat <<"EOF"
  5258. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  5259. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  5260. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  5261. static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
  5262. int
  5263. main (int argc, char *argv[])
  5264. {
  5265. char **newargz;
  5266. int newargc;
  5267. char *tmp_pathspec;
  5268. char *actual_cwrapper_path;
  5269. char *actual_cwrapper_name;
  5270. char *target_name;
  5271. char *lt_argv_zero;
  5272. int rval = 127;
  5273. int i;
  5274. program_name = (char *) xstrdup (base_name (argv[0]));
  5275. newargz = XMALLOC (char *, (size_t) argc + 1);
  5276. /* very simple arg parsing; don't want to rely on getopt
  5277. * also, copy all non cwrapper options to newargz, except
  5278. * argz[0], which is handled differently
  5279. */
  5280. newargc=0;
  5281. for (i = 1; i < argc; i++)
  5282. {
  5283. if (STREQ (argv[i], dumpscript_opt))
  5284. {
  5285. EOF
  5286. case $host in
  5287. *mingw* | *cygwin* )
  5288. # make stdout use "unix" line endings
  5289. echo " setmode(1,_O_BINARY);"
  5290. ;;
  5291. esac
  5292. cat <<"EOF"
  5293. lt_dump_script (stdout);
  5294. return 0;
  5295. }
  5296. if (STREQ (argv[i], debug_opt))
  5297. {
  5298. lt_debug = 1;
  5299. continue;
  5300. }
  5301. if (STREQ (argv[i], ltwrapper_option_prefix))
  5302. {
  5303. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  5304. namespace, but it is not one of the ones we know about and
  5305. have already dealt with, above (inluding dump-script), then
  5306. report an error. Otherwise, targets might begin to believe
  5307. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  5308. namespace. The first time any user complains about this, we'll
  5309. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  5310. or a configure.ac-settable value.
  5311. */
  5312. lt_fatal (__FILE__, __LINE__,
  5313. "unrecognized %s option: '%s'",
  5314. ltwrapper_option_prefix, argv[i]);
  5315. }
  5316. /* otherwise ... */
  5317. newargz[++newargc] = xstrdup (argv[i]);
  5318. }
  5319. newargz[++newargc] = NULL;
  5320. EOF
  5321. cat <<EOF
  5322. /* The GNU banner must be the first non-error debug message */
  5323. lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
  5324. EOF
  5325. cat <<"EOF"
  5326. lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  5327. lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  5328. tmp_pathspec = find_executable (argv[0]);
  5329. if (tmp_pathspec == NULL)
  5330. lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  5331. lt_debugprintf (__FILE__, __LINE__,
  5332. "(main) found exe (before symlink chase) at: %s\n",
  5333. tmp_pathspec);
  5334. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  5335. lt_debugprintf (__FILE__, __LINE__,
  5336. "(main) found exe (after symlink chase) at: %s\n",
  5337. actual_cwrapper_path);
  5338. XFREE (tmp_pathspec);
  5339. actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  5340. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  5341. /* wrapper name transforms */
  5342. strendzap (actual_cwrapper_name, ".exe");
  5343. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  5344. XFREE (actual_cwrapper_name);
  5345. actual_cwrapper_name = tmp_pathspec;
  5346. tmp_pathspec = 0;
  5347. /* target_name transforms -- use actual target program name; might have lt- prefix */
  5348. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  5349. strendzap (target_name, ".exe");
  5350. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  5351. XFREE (target_name);
  5352. target_name = tmp_pathspec;
  5353. tmp_pathspec = 0;
  5354. lt_debugprintf (__FILE__, __LINE__,
  5355. "(main) libtool target name: %s\n",
  5356. target_name);
  5357. EOF
  5358. cat <<EOF
  5359. newargz[0] =
  5360. XMALLOC (char, (strlen (actual_cwrapper_path) +
  5361. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  5362. strcpy (newargz[0], actual_cwrapper_path);
  5363. strcat (newargz[0], "$objdir");
  5364. strcat (newargz[0], "/");
  5365. EOF
  5366. cat <<"EOF"
  5367. /* stop here, and copy so we don't have to do this twice */
  5368. tmp_pathspec = xstrdup (newargz[0]);
  5369. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  5370. strcat (newargz[0], actual_cwrapper_name);
  5371. /* DO want the lt- prefix here if it exists, so use target_name */
  5372. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  5373. XFREE (tmp_pathspec);
  5374. tmp_pathspec = NULL;
  5375. EOF
  5376. case $host_os in
  5377. mingw*)
  5378. cat <<"EOF"
  5379. {
  5380. char* p;
  5381. while ((p = strchr (newargz[0], '\\')) != NULL)
  5382. {
  5383. *p = '/';
  5384. }
  5385. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  5386. {
  5387. *p = '/';
  5388. }
  5389. }
  5390. EOF
  5391. ;;
  5392. esac
  5393. cat <<"EOF"
  5394. XFREE (target_name);
  5395. XFREE (actual_cwrapper_path);
  5396. XFREE (actual_cwrapper_name);
  5397. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  5398. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  5399. /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
  5400. be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  5401. because on Windows, both *_VARNAMEs are PATH but uninstalled
  5402. libraries must come first. */
  5403. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  5404. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  5405. lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  5406. nonnull (lt_argv_zero));
  5407. for (i = 0; i < newargc; i++)
  5408. {
  5409. lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  5410. i, nonnull (newargz[i]));
  5411. }
  5412. EOF
  5413. case $host_os in
  5414. mingw*)
  5415. cat <<"EOF"
  5416. /* execv doesn't actually work on mingw as expected on unix */
  5417. newargz = prepare_spawn (newargz);
  5418. rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  5419. if (rval == -1)
  5420. {
  5421. /* failed to start process */
  5422. lt_debugprintf (__FILE__, __LINE__,
  5423. "(main) failed to launch target \"%s\": %s\n",
  5424. lt_argv_zero, nonnull (strerror (errno)));
  5425. return 127;
  5426. }
  5427. return rval;
  5428. EOF
  5429. ;;
  5430. *)
  5431. cat <<"EOF"
  5432. execv (lt_argv_zero, newargz);
  5433. return rval; /* =127, but avoids unused variable warning */
  5434. EOF
  5435. ;;
  5436. esac
  5437. cat <<"EOF"
  5438. }
  5439. void *
  5440. xmalloc (size_t num)
  5441. {
  5442. void *p = (void *) malloc (num);
  5443. if (!p)
  5444. lt_fatal (__FILE__, __LINE__, "memory exhausted");
  5445. return p;
  5446. }
  5447. char *
  5448. xstrdup (const char *string)
  5449. {
  5450. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5451. string) : NULL;
  5452. }
  5453. const char *
  5454. base_name (const char *name)
  5455. {
  5456. const char *base;
  5457. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5458. /* Skip over the disk name in MSDOS pathnames. */
  5459. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5460. name += 2;
  5461. #endif
  5462. for (base = name; *name; name++)
  5463. if (IS_DIR_SEPARATOR (*name))
  5464. base = name + 1;
  5465. return base;
  5466. }
  5467. int
  5468. check_executable (const char *path)
  5469. {
  5470. struct stat st;
  5471. lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5472. nonempty (path));
  5473. if ((!path) || (!*path))
  5474. return 0;
  5475. if ((stat (path, &st) >= 0)
  5476. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5477. return 1;
  5478. else
  5479. return 0;
  5480. }
  5481. int
  5482. make_executable (const char *path)
  5483. {
  5484. int rval = 0;
  5485. struct stat st;
  5486. lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5487. nonempty (path));
  5488. if ((!path) || (!*path))
  5489. return 0;
  5490. if (stat (path, &st) >= 0)
  5491. {
  5492. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5493. }
  5494. return rval;
  5495. }
  5496. /* Searches for the full path of the wrapper. Returns
  5497. newly allocated full path name if found, NULL otherwise
  5498. Does not chase symlinks, even on platforms that support them.
  5499. */
  5500. char *
  5501. find_executable (const char *wrapper)
  5502. {
  5503. int has_slash = 0;
  5504. const char *p;
  5505. const char *p_next;
  5506. /* static buffer for getcwd */
  5507. char tmp[LT_PATHMAX + 1];
  5508. size_t tmp_len;
  5509. char *concat_name;
  5510. lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  5511. nonempty (wrapper));
  5512. if ((wrapper == NULL) || (*wrapper == '\0'))
  5513. return NULL;
  5514. /* Absolute path? */
  5515. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5516. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  5517. {
  5518. concat_name = xstrdup (wrapper);
  5519. if (check_executable (concat_name))
  5520. return concat_name;
  5521. XFREE (concat_name);
  5522. }
  5523. else
  5524. {
  5525. #endif
  5526. if (IS_DIR_SEPARATOR (wrapper[0]))
  5527. {
  5528. concat_name = xstrdup (wrapper);
  5529. if (check_executable (concat_name))
  5530. return concat_name;
  5531. XFREE (concat_name);
  5532. }
  5533. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5534. }
  5535. #endif
  5536. for (p = wrapper; *p; p++)
  5537. if (*p == '/')
  5538. {
  5539. has_slash = 1;
  5540. break;
  5541. }
  5542. if (!has_slash)
  5543. {
  5544. /* no slashes; search PATH */
  5545. const char *path = getenv ("PATH");
  5546. if (path != NULL)
  5547. {
  5548. for (p = path; *p; p = p_next)
  5549. {
  5550. const char *q;
  5551. size_t p_len;
  5552. for (q = p; *q; q++)
  5553. if (IS_PATH_SEPARATOR (*q))
  5554. break;
  5555. p_len = (size_t) (q - p);
  5556. p_next = (*q == '\0' ? q : q + 1);
  5557. if (p_len == 0)
  5558. {
  5559. /* empty path: current directory */
  5560. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5561. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5562. nonnull (strerror (errno)));
  5563. tmp_len = strlen (tmp);
  5564. concat_name =
  5565. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5566. memcpy (concat_name, tmp, tmp_len);
  5567. concat_name[tmp_len] = '/';
  5568. strcpy (concat_name + tmp_len + 1, wrapper);
  5569. }
  5570. else
  5571. {
  5572. concat_name =
  5573. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  5574. memcpy (concat_name, p, p_len);
  5575. concat_name[p_len] = '/';
  5576. strcpy (concat_name + p_len + 1, wrapper);
  5577. }
  5578. if (check_executable (concat_name))
  5579. return concat_name;
  5580. XFREE (concat_name);
  5581. }
  5582. }
  5583. /* not found in PATH; assume curdir */
  5584. }
  5585. /* Relative path | not found in path: prepend cwd */
  5586. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5587. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5588. nonnull (strerror (errno)));
  5589. tmp_len = strlen (tmp);
  5590. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5591. memcpy (concat_name, tmp, tmp_len);
  5592. concat_name[tmp_len] = '/';
  5593. strcpy (concat_name + tmp_len + 1, wrapper);
  5594. if (check_executable (concat_name))
  5595. return concat_name;
  5596. XFREE (concat_name);
  5597. return NULL;
  5598. }
  5599. char *
  5600. chase_symlinks (const char *pathspec)
  5601. {
  5602. #ifndef S_ISLNK
  5603. return xstrdup (pathspec);
  5604. #else
  5605. char buf[LT_PATHMAX];
  5606. struct stat s;
  5607. char *tmp_pathspec = xstrdup (pathspec);
  5608. char *p;
  5609. int has_symlinks = 0;
  5610. while (strlen (tmp_pathspec) && !has_symlinks)
  5611. {
  5612. lt_debugprintf (__FILE__, __LINE__,
  5613. "checking path component for symlinks: %s\n",
  5614. tmp_pathspec);
  5615. if (lstat (tmp_pathspec, &s) == 0)
  5616. {
  5617. if (S_ISLNK (s.st_mode) != 0)
  5618. {
  5619. has_symlinks = 1;
  5620. break;
  5621. }
  5622. /* search backwards for last DIR_SEPARATOR */
  5623. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  5624. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5625. p--;
  5626. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5627. {
  5628. /* no more DIR_SEPARATORS left */
  5629. break;
  5630. }
  5631. *p = '\0';
  5632. }
  5633. else
  5634. {
  5635. lt_fatal (__FILE__, __LINE__,
  5636. "error accessing file \"%s\": %s",
  5637. tmp_pathspec, nonnull (strerror (errno)));
  5638. }
  5639. }
  5640. XFREE (tmp_pathspec);
  5641. if (!has_symlinks)
  5642. {
  5643. return xstrdup (pathspec);
  5644. }
  5645. tmp_pathspec = realpath (pathspec, buf);
  5646. if (tmp_pathspec == 0)
  5647. {
  5648. lt_fatal (__FILE__, __LINE__,
  5649. "could not follow symlinks for %s", pathspec);
  5650. }
  5651. return xstrdup (tmp_pathspec);
  5652. #endif
  5653. }
  5654. char *
  5655. strendzap (char *str, const char *pat)
  5656. {
  5657. size_t len, patlen;
  5658. assert (str != NULL);
  5659. assert (pat != NULL);
  5660. len = strlen (str);
  5661. patlen = strlen (pat);
  5662. if (patlen <= len)
  5663. {
  5664. str += len - patlen;
  5665. if (STREQ (str, pat))
  5666. *str = '\0';
  5667. }
  5668. return str;
  5669. }
  5670. void
  5671. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  5672. {
  5673. va_list args;
  5674. if (lt_debug)
  5675. {
  5676. (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  5677. va_start (args, fmt);
  5678. (void) vfprintf (stderr, fmt, args);
  5679. va_end (args);
  5680. }
  5681. }
  5682. static void
  5683. lt_error_core (int exit_status, const char *file,
  5684. int line, const char *mode,
  5685. const char *message, va_list ap)
  5686. {
  5687. fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  5688. vfprintf (stderr, message, ap);
  5689. fprintf (stderr, ".\n");
  5690. if (exit_status >= 0)
  5691. exit (exit_status);
  5692. }
  5693. void
  5694. lt_fatal (const char *file, int line, const char *message, ...)
  5695. {
  5696. va_list ap;
  5697. va_start (ap, message);
  5698. lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  5699. va_end (ap);
  5700. }
  5701. static const char *
  5702. nonnull (const char *s)
  5703. {
  5704. return s ? s : "(null)";
  5705. }
  5706. static const char *
  5707. nonempty (const char *s)
  5708. {
  5709. return (s && !*s) ? "(empty)" : nonnull (s);
  5710. }
  5711. void
  5712. lt_setenv (const char *name, const char *value)
  5713. {
  5714. lt_debugprintf (__FILE__, __LINE__,
  5715. "(lt_setenv) setting '%s' to '%s'\n",
  5716. nonnull (name), nonnull (value));
  5717. {
  5718. #ifdef HAVE_SETENV
  5719. /* always make a copy, for consistency with !HAVE_SETENV */
  5720. char *str = xstrdup (value);
  5721. setenv (name, str, 1);
  5722. #else
  5723. size_t len = strlen (name) + 1 + strlen (value) + 1;
  5724. char *str = XMALLOC (char, len);
  5725. sprintf (str, "%s=%s", name, value);
  5726. if (putenv (str) != EXIT_SUCCESS)
  5727. {
  5728. XFREE (str);
  5729. }
  5730. #endif
  5731. }
  5732. }
  5733. char *
  5734. lt_extend_str (const char *orig_value, const char *add, int to_end)
  5735. {
  5736. char *new_value;
  5737. if (orig_value && *orig_value)
  5738. {
  5739. size_t orig_value_len = strlen (orig_value);
  5740. size_t add_len = strlen (add);
  5741. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  5742. if (to_end)
  5743. {
  5744. strcpy (new_value, orig_value);
  5745. strcpy (new_value + orig_value_len, add);
  5746. }
  5747. else
  5748. {
  5749. strcpy (new_value, add);
  5750. strcpy (new_value + add_len, orig_value);
  5751. }
  5752. }
  5753. else
  5754. {
  5755. new_value = xstrdup (add);
  5756. }
  5757. return new_value;
  5758. }
  5759. void
  5760. lt_update_exe_path (const char *name, const char *value)
  5761. {
  5762. lt_debugprintf (__FILE__, __LINE__,
  5763. "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  5764. nonnull (name), nonnull (value));
  5765. if (name && *name && value && *value)
  5766. {
  5767. char *new_value = lt_extend_str (getenv (name), value, 0);
  5768. /* some systems can't cope with a ':'-terminated path #' */
  5769. size_t len = strlen (new_value);
  5770. while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  5771. {
  5772. new_value[--len] = '\0';
  5773. }
  5774. lt_setenv (name, new_value);
  5775. XFREE (new_value);
  5776. }
  5777. }
  5778. void
  5779. lt_update_lib_path (const char *name, const char *value)
  5780. {
  5781. lt_debugprintf (__FILE__, __LINE__,
  5782. "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  5783. nonnull (name), nonnull (value));
  5784. if (name && *name && value && *value)
  5785. {
  5786. char *new_value = lt_extend_str (getenv (name), value, 0);
  5787. lt_setenv (name, new_value);
  5788. XFREE (new_value);
  5789. }
  5790. }
  5791. EOF
  5792. case $host_os in
  5793. mingw*)
  5794. cat <<"EOF"
  5795. /* Prepares an argument vector before calling spawn().
  5796. Note that spawn() does not by itself call the command interpreter
  5797. (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  5798. ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  5799. GetVersionEx(&v);
  5800. v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  5801. }) ? "cmd.exe" : "command.com").
  5802. Instead it simply concatenates the arguments, separated by ' ', and calls
  5803. CreateProcess(). We must quote the arguments since Win32 CreateProcess()
  5804. interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  5805. special way:
  5806. - Space and tab are interpreted as delimiters. They are not treated as
  5807. delimiters if they are surrounded by double quotes: "...".
  5808. - Unescaped double quotes are removed from the input. Their only effect is
  5809. that within double quotes, space and tab are treated like normal
  5810. characters.
  5811. - Backslashes not followed by double quotes are not special.
  5812. - But 2*n+1 backslashes followed by a double quote become
  5813. n backslashes followed by a double quote (n >= 0):
  5814. \" -> "
  5815. \\\" -> \"
  5816. \\\\\" -> \\"
  5817. */
  5818. #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"
  5819. #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"
  5820. char **
  5821. prepare_spawn (char **argv)
  5822. {
  5823. size_t argc;
  5824. char **new_argv;
  5825. size_t i;
  5826. /* Count number of arguments. */
  5827. for (argc = 0; argv[argc] != NULL; argc++)
  5828. ;
  5829. /* Allocate new argument vector. */
  5830. new_argv = XMALLOC (char *, argc + 1);
  5831. /* Put quoted arguments into the new argument vector. */
  5832. for (i = 0; i < argc; i++)
  5833. {
  5834. const char *string = argv[i];
  5835. if (string[0] == '\0')
  5836. new_argv[i] = xstrdup ("\"\"");
  5837. else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  5838. {
  5839. int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  5840. size_t length;
  5841. unsigned int backslashes;
  5842. const char *s;
  5843. char *quoted_string;
  5844. char *p;
  5845. length = 0;
  5846. backslashes = 0;
  5847. if (quote_around)
  5848. length++;
  5849. for (s = string; *s != '\0'; s++)
  5850. {
  5851. char c = *s;
  5852. if (c == '"')
  5853. length += backslashes + 1;
  5854. length++;
  5855. if (c == '\\')
  5856. backslashes++;
  5857. else
  5858. backslashes = 0;
  5859. }
  5860. if (quote_around)
  5861. length += backslashes + 1;
  5862. quoted_string = XMALLOC (char, length + 1);
  5863. p = quoted_string;
  5864. backslashes = 0;
  5865. if (quote_around)
  5866. *p++ = '"';
  5867. for (s = string; *s != '\0'; s++)
  5868. {
  5869. char c = *s;
  5870. if (c == '"')
  5871. {
  5872. unsigned int j;
  5873. for (j = backslashes + 1; j > 0; j--)
  5874. *p++ = '\\';
  5875. }
  5876. *p++ = c;
  5877. if (c == '\\')
  5878. backslashes++;
  5879. else
  5880. backslashes = 0;
  5881. }
  5882. if (quote_around)
  5883. {
  5884. unsigned int j;
  5885. for (j = backslashes; j > 0; j--)
  5886. *p++ = '\\';
  5887. *p++ = '"';
  5888. }
  5889. *p = '\0';
  5890. new_argv[i] = quoted_string;
  5891. }
  5892. else
  5893. new_argv[i] = (char *) string;
  5894. }
  5895. new_argv[argc] = NULL;
  5896. return new_argv;
  5897. }
  5898. EOF
  5899. ;;
  5900. esac
  5901. cat <<"EOF"
  5902. void lt_dump_script (FILE* f)
  5903. {
  5904. EOF
  5905. func_emit_wrapper yes |
  5906. $SED -n -e '
  5907. s/^\(.\{79\}\)\(..*\)/\1\
  5908. \2/
  5909. h
  5910. s/\([\\"]\)/\\\1/g
  5911. s/$/\\n/
  5912. s/\([^\n]*\).*/ fputs ("\1", f);/p
  5913. g
  5914. D'
  5915. cat <<"EOF"
  5916. }
  5917. EOF
  5918. }
  5919. # end: func_emit_cwrapperexe_src
  5920. # func_win32_import_lib_p ARG
  5921. # True if ARG is an import lib, as indicated by $file_magic_cmd
  5922. func_win32_import_lib_p ()
  5923. {
  5924. $debug_cmd
  5925. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  5926. *import*) : ;;
  5927. *) false ;;
  5928. esac
  5929. }
  5930. # func_suncc_cstd_abi
  5931. # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
  5932. # Several compiler flags select an ABI that is incompatible with the
  5933. # Cstd library. Avoid specifying it if any are in CXXFLAGS.
  5934. func_suncc_cstd_abi ()
  5935. {
  5936. $debug_cmd
  5937. case " $compile_command " in
  5938. *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
  5939. suncc_use_cstd_abi=no
  5940. ;;
  5941. *)
  5942. suncc_use_cstd_abi=yes
  5943. ;;
  5944. esac
  5945. }
  5946. # func_mode_link arg...
  5947. func_mode_link ()
  5948. {
  5949. $debug_cmd
  5950. case $host in
  5951. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  5952. # It is impossible to link a dll without this setting, and
  5953. # we shouldn't force the makefile maintainer to figure out
  5954. # what system we are compiling for in order to pass an extra
  5955. # flag for every libtool invocation.
  5956. # allow_undefined=no
  5957. # FIXME: Unfortunately, there are problems with the above when trying
  5958. # to make a dll that has undefined symbols, in which case not
  5959. # even a static library is built. For now, we need to specify
  5960. # -no-undefined on the libtool link line when we can be certain
  5961. # that all symbols are satisfied, otherwise we get a static library.
  5962. allow_undefined=yes
  5963. ;;
  5964. *)
  5965. allow_undefined=yes
  5966. ;;
  5967. esac
  5968. libtool_args=$nonopt
  5969. base_compile="$nonopt $@"
  5970. compile_command=$nonopt
  5971. finalize_command=$nonopt
  5972. compile_rpath=
  5973. finalize_rpath=
  5974. compile_shlibpath=
  5975. finalize_shlibpath=
  5976. convenience=
  5977. old_convenience=
  5978. deplibs=
  5979. old_deplibs=
  5980. compiler_flags=
  5981. linker_flags=
  5982. dllsearchpath=
  5983. lib_search_path=`pwd`
  5984. inst_prefix_dir=
  5985. new_inherited_linker_flags=
  5986. avoid_version=no
  5987. bindir=
  5988. dlfiles=
  5989. dlprefiles=
  5990. dlself=no
  5991. export_dynamic=no
  5992. export_symbols=
  5993. export_symbols_regex=
  5994. generated=
  5995. libobjs=
  5996. ltlibs=
  5997. module=no
  5998. no_install=no
  5999. objs=
  6000. os2dllname=
  6001. non_pic_objects=
  6002. precious_files_regex=
  6003. prefer_static_libs=no
  6004. preload=false
  6005. prev=
  6006. prevarg=
  6007. release=
  6008. rpath=
  6009. xrpath=
  6010. perm_rpath=
  6011. temp_rpath=
  6012. thread_safe=no
  6013. vinfo=
  6014. vinfo_number=no
  6015. weak_libs=
  6016. single_module=$wl-single_module
  6017. func_infer_tag $base_compile
  6018. # We need to know -static, to get the right output filenames.
  6019. for arg
  6020. do
  6021. case $arg in
  6022. -shared)
  6023. test yes != "$build_libtool_libs" \
  6024. && func_fatal_configuration "cannot build a shared library"
  6025. build_old_libs=no
  6026. break
  6027. ;;
  6028. -all-static | -static | -static-libtool-libs)
  6029. case $arg in
  6030. -all-static)
  6031. if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
  6032. func_warning "complete static linking is impossible in this configuration"
  6033. fi
  6034. if test -n "$link_static_flag"; then
  6035. dlopen_self=$dlopen_self_static
  6036. fi
  6037. prefer_static_libs=yes
  6038. ;;
  6039. -static)
  6040. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6041. dlopen_self=$dlopen_self_static
  6042. fi
  6043. prefer_static_libs=built
  6044. ;;
  6045. -static-libtool-libs)
  6046. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6047. dlopen_self=$dlopen_self_static
  6048. fi
  6049. prefer_static_libs=yes
  6050. ;;
  6051. esac
  6052. build_libtool_libs=no
  6053. build_old_libs=yes
  6054. break
  6055. ;;
  6056. esac
  6057. done
  6058. # See if our shared archives depend on static archives.
  6059. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  6060. # Go through the arguments, transforming them on the way.
  6061. while test "$#" -gt 0; do
  6062. arg=$1
  6063. shift
  6064. func_quote_for_eval "$arg"
  6065. qarg=$func_quote_for_eval_unquoted_result
  6066. func_append libtool_args " $func_quote_for_eval_result"
  6067. # If the previous option needs an argument, assign it.
  6068. if test -n "$prev"; then
  6069. case $prev in
  6070. output)
  6071. func_append compile_command " @OUTPUT@"
  6072. func_append finalize_command " @OUTPUT@"
  6073. ;;
  6074. esac
  6075. case $prev in
  6076. bindir)
  6077. bindir=$arg
  6078. prev=
  6079. continue
  6080. ;;
  6081. dlfiles|dlprefiles)
  6082. $preload || {
  6083. # Add the symbol object into the linking commands.
  6084. func_append compile_command " @SYMFILE@"
  6085. func_append finalize_command " @SYMFILE@"
  6086. preload=:
  6087. }
  6088. case $arg in
  6089. *.la | *.lo) ;; # We handle these cases below.
  6090. force)
  6091. if test no = "$dlself"; then
  6092. dlself=needless
  6093. export_dynamic=yes
  6094. fi
  6095. prev=
  6096. continue
  6097. ;;
  6098. self)
  6099. if test dlprefiles = "$prev"; then
  6100. dlself=yes
  6101. elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
  6102. dlself=yes
  6103. else
  6104. dlself=needless
  6105. export_dynamic=yes
  6106. fi
  6107. prev=
  6108. continue
  6109. ;;
  6110. *)
  6111. if test dlfiles = "$prev"; then
  6112. func_append dlfiles " $arg"
  6113. else
  6114. func_append dlprefiles " $arg"
  6115. fi
  6116. prev=
  6117. continue
  6118. ;;
  6119. esac
  6120. ;;
  6121. expsyms)
  6122. export_symbols=$arg
  6123. test -f "$arg" \
  6124. || func_fatal_error "symbol file '$arg' does not exist"
  6125. prev=
  6126. continue
  6127. ;;
  6128. expsyms_regex)
  6129. export_symbols_regex=$arg
  6130. prev=
  6131. continue
  6132. ;;
  6133. framework)
  6134. case $host in
  6135. *-*-darwin*)
  6136. case "$deplibs " in
  6137. *" $qarg.ltframework "*) ;;
  6138. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  6139. ;;
  6140. esac
  6141. ;;
  6142. esac
  6143. prev=
  6144. continue
  6145. ;;
  6146. inst_prefix)
  6147. inst_prefix_dir=$arg
  6148. prev=
  6149. continue
  6150. ;;
  6151. mllvm)
  6152. # Clang does not use LLVM to link, so we can simply discard any
  6153. # '-mllvm $arg' options when doing the link step.
  6154. prev=
  6155. continue
  6156. ;;
  6157. objectlist)
  6158. if test -f "$arg"; then
  6159. save_arg=$arg
  6160. moreargs=
  6161. for fil in `cat "$save_arg"`
  6162. do
  6163. # func_append moreargs " $fil"
  6164. arg=$fil
  6165. # A libtool-controlled object.
  6166. # Check to see that this really is a libtool object.
  6167. if func_lalib_unsafe_p "$arg"; then
  6168. pic_object=
  6169. non_pic_object=
  6170. # Read the .lo file
  6171. func_source "$arg"
  6172. if test -z "$pic_object" ||
  6173. test -z "$non_pic_object" ||
  6174. test none = "$pic_object" &&
  6175. test none = "$non_pic_object"; then
  6176. func_fatal_error "cannot find name of object for '$arg'"
  6177. fi
  6178. # Extract subdirectory from the argument.
  6179. func_dirname "$arg" "/" ""
  6180. xdir=$func_dirname_result
  6181. if test none != "$pic_object"; then
  6182. # Prepend the subdirectory the object is found in.
  6183. pic_object=$xdir$pic_object
  6184. if test dlfiles = "$prev"; then
  6185. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6186. func_append dlfiles " $pic_object"
  6187. prev=
  6188. continue
  6189. else
  6190. # If libtool objects are unsupported, then we need to preload.
  6191. prev=dlprefiles
  6192. fi
  6193. fi
  6194. # CHECK ME: I think I busted this. -Ossama
  6195. if test dlprefiles = "$prev"; then
  6196. # Preload the old-style object.
  6197. func_append dlprefiles " $pic_object"
  6198. prev=
  6199. fi
  6200. # A PIC object.
  6201. func_append libobjs " $pic_object"
  6202. arg=$pic_object
  6203. fi
  6204. # Non-PIC object.
  6205. if test none != "$non_pic_object"; then
  6206. # Prepend the subdirectory the object is found in.
  6207. non_pic_object=$xdir$non_pic_object
  6208. # A standard non-PIC object
  6209. func_append non_pic_objects " $non_pic_object"
  6210. if test -z "$pic_object" || test none = "$pic_object"; then
  6211. arg=$non_pic_object
  6212. fi
  6213. else
  6214. # If the PIC object exists, use it instead.
  6215. # $xdir was prepended to $pic_object above.
  6216. non_pic_object=$pic_object
  6217. func_append non_pic_objects " $non_pic_object"
  6218. fi
  6219. else
  6220. # Only an error if not doing a dry-run.
  6221. if $opt_dry_run; then
  6222. # Extract subdirectory from the argument.
  6223. func_dirname "$arg" "/" ""
  6224. xdir=$func_dirname_result
  6225. func_lo2o "$arg"
  6226. pic_object=$xdir$objdir/$func_lo2o_result
  6227. non_pic_object=$xdir$func_lo2o_result
  6228. func_append libobjs " $pic_object"
  6229. func_append non_pic_objects " $non_pic_object"
  6230. else
  6231. func_fatal_error "'$arg' is not a valid libtool object"
  6232. fi
  6233. fi
  6234. done
  6235. else
  6236. func_fatal_error "link input file '$arg' does not exist"
  6237. fi
  6238. arg=$save_arg
  6239. prev=
  6240. continue
  6241. ;;
  6242. os2dllname)
  6243. os2dllname=$arg
  6244. prev=
  6245. continue
  6246. ;;
  6247. precious_regex)
  6248. precious_files_regex=$arg
  6249. prev=
  6250. continue
  6251. ;;
  6252. release)
  6253. release=-$arg
  6254. prev=
  6255. continue
  6256. ;;
  6257. rpath | xrpath)
  6258. # We need an absolute path.
  6259. case $arg in
  6260. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6261. *)
  6262. func_fatal_error "only absolute run-paths are allowed"
  6263. ;;
  6264. esac
  6265. if test rpath = "$prev"; then
  6266. case "$rpath " in
  6267. *" $arg "*) ;;
  6268. *) func_append rpath " $arg" ;;
  6269. esac
  6270. else
  6271. case "$xrpath " in
  6272. *" $arg "*) ;;
  6273. *) func_append xrpath " $arg" ;;
  6274. esac
  6275. fi
  6276. prev=
  6277. continue
  6278. ;;
  6279. shrext)
  6280. shrext_cmds=$arg
  6281. prev=
  6282. continue
  6283. ;;
  6284. weak)
  6285. func_append weak_libs " $arg"
  6286. prev=
  6287. continue
  6288. ;;
  6289. xcclinker)
  6290. func_append linker_flags " $qarg"
  6291. func_append compiler_flags " $qarg"
  6292. prev=
  6293. func_append compile_command " $qarg"
  6294. func_append finalize_command " $qarg"
  6295. continue
  6296. ;;
  6297. xcompiler)
  6298. func_append compiler_flags " $qarg"
  6299. prev=
  6300. func_append compile_command " $qarg"
  6301. func_append finalize_command " $qarg"
  6302. continue
  6303. ;;
  6304. xlinker)
  6305. func_append linker_flags " $qarg"
  6306. func_append compiler_flags " $wl$qarg"
  6307. prev=
  6308. func_append compile_command " $wl$qarg"
  6309. func_append finalize_command " $wl$qarg"
  6310. continue
  6311. ;;
  6312. *)
  6313. eval "$prev=\"\$arg\""
  6314. prev=
  6315. continue
  6316. ;;
  6317. esac
  6318. fi # test -n "$prev"
  6319. prevarg=$arg
  6320. case $arg in
  6321. -all-static)
  6322. if test -n "$link_static_flag"; then
  6323. # See comment for -static flag below, for more details.
  6324. func_append compile_command " $link_static_flag"
  6325. func_append finalize_command " $link_static_flag"
  6326. fi
  6327. continue
  6328. ;;
  6329. -allow-undefined)
  6330. # FIXME: remove this flag sometime in the future.
  6331. func_fatal_error "'-allow-undefined' must not be used because it is the default"
  6332. ;;
  6333. -avoid-version)
  6334. avoid_version=yes
  6335. continue
  6336. ;;
  6337. -bindir)
  6338. prev=bindir
  6339. continue
  6340. ;;
  6341. -dlopen)
  6342. prev=dlfiles
  6343. continue
  6344. ;;
  6345. -dlpreopen)
  6346. prev=dlprefiles
  6347. continue
  6348. ;;
  6349. -export-dynamic)
  6350. export_dynamic=yes
  6351. continue
  6352. ;;
  6353. -export-symbols | -export-symbols-regex)
  6354. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  6355. func_fatal_error "more than one -exported-symbols argument is not allowed"
  6356. fi
  6357. if test X-export-symbols = "X$arg"; then
  6358. prev=expsyms
  6359. else
  6360. prev=expsyms_regex
  6361. fi
  6362. continue
  6363. ;;
  6364. -framework)
  6365. prev=framework
  6366. continue
  6367. ;;
  6368. -inst-prefix-dir)
  6369. prev=inst_prefix
  6370. continue
  6371. ;;
  6372. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  6373. # so, if we see these flags be careful not to treat them like -L
  6374. -L[A-Z][A-Z]*:*)
  6375. case $with_gcc/$host in
  6376. no/*-*-irix* | /*-*-irix*)
  6377. func_append compile_command " $arg"
  6378. func_append finalize_command " $arg"
  6379. ;;
  6380. esac
  6381. continue
  6382. ;;
  6383. -L*)
  6384. func_stripname "-L" '' "$arg"
  6385. if test -z "$func_stripname_result"; then
  6386. if test "$#" -gt 0; then
  6387. func_fatal_error "require no space between '-L' and '$1'"
  6388. else
  6389. func_fatal_error "need path for '-L' option"
  6390. fi
  6391. fi
  6392. func_resolve_sysroot "$func_stripname_result"
  6393. dir=$func_resolve_sysroot_result
  6394. # We need an absolute path.
  6395. case $dir in
  6396. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6397. *)
  6398. absdir=`cd "$dir" && pwd`
  6399. test -z "$absdir" && \
  6400. func_fatal_error "cannot determine absolute directory name of '$dir'"
  6401. dir=$absdir
  6402. ;;
  6403. esac
  6404. case "$deplibs " in
  6405. *" -L$dir "* | *" $arg "*)
  6406. # Will only happen for absolute or sysroot arguments
  6407. ;;
  6408. *)
  6409. # Preserve sysroot, but never include relative directories
  6410. case $dir in
  6411. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  6412. *) func_append deplibs " -L$dir" ;;
  6413. esac
  6414. func_append lib_search_path " $dir"
  6415. ;;
  6416. esac
  6417. case $host in
  6418. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6419. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  6420. case :$dllsearchpath: in
  6421. *":$dir:"*) ;;
  6422. ::) dllsearchpath=$dir;;
  6423. *) func_append dllsearchpath ":$dir";;
  6424. esac
  6425. case :$dllsearchpath: in
  6426. *":$testbindir:"*) ;;
  6427. ::) dllsearchpath=$testbindir;;
  6428. *) func_append dllsearchpath ":$testbindir";;
  6429. esac
  6430. ;;
  6431. esac
  6432. continue
  6433. ;;
  6434. -l*)
  6435. if test X-lc = "X$arg" || test X-lm = "X$arg"; then
  6436. case $host in
  6437. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6438. # These systems don't actually have a C or math library (as such)
  6439. continue
  6440. ;;
  6441. *-*-os2*)
  6442. # These systems don't actually have a C library (as such)
  6443. test X-lc = "X$arg" && continue
  6444. ;;
  6445. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6446. # Do not include libc due to us having libc/libc_r.
  6447. test X-lc = "X$arg" && continue
  6448. ;;
  6449. *-*-rhapsody* | *-*-darwin1.[012])
  6450. # Rhapsody C and math libraries are in the System framework
  6451. func_append deplibs " System.ltframework"
  6452. continue
  6453. ;;
  6454. *-*-sco3.2v5* | *-*-sco5v6*)
  6455. # Causes problems with __ctype
  6456. test X-lc = "X$arg" && continue
  6457. ;;
  6458. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6459. # Compiler inserts libc in the correct place for threads to work
  6460. test X-lc = "X$arg" && continue
  6461. ;;
  6462. esac
  6463. elif test X-lc_r = "X$arg"; then
  6464. case $host in
  6465. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6466. # Do not include libc_r directly, use -pthread flag.
  6467. continue
  6468. ;;
  6469. esac
  6470. fi
  6471. func_append deplibs " $arg"
  6472. continue
  6473. ;;
  6474. -mllvm)
  6475. prev=mllvm
  6476. continue
  6477. ;;
  6478. -module)
  6479. module=yes
  6480. continue
  6481. ;;
  6482. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  6483. # classes, name mangling, and exception handling.
  6484. # Darwin uses the -arch flag to determine output architecture.
  6485. -model|-arch|-isysroot|--sysroot)
  6486. func_append compiler_flags " $arg"
  6487. func_append compile_command " $arg"
  6488. func_append finalize_command " $arg"
  6489. prev=xcompiler
  6490. continue
  6491. ;;
  6492. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6493. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6494. func_append compiler_flags " $arg"
  6495. func_append compile_command " $arg"
  6496. func_append finalize_command " $arg"
  6497. case "$new_inherited_linker_flags " in
  6498. *" $arg "*) ;;
  6499. * ) func_append new_inherited_linker_flags " $arg" ;;
  6500. esac
  6501. continue
  6502. ;;
  6503. -multi_module)
  6504. single_module=$wl-multi_module
  6505. continue
  6506. ;;
  6507. -no-fast-install)
  6508. fast_install=no
  6509. continue
  6510. ;;
  6511. -no-install)
  6512. case $host in
  6513. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  6514. # The PATH hackery in wrapper scripts is required on Windows
  6515. # and Darwin in order for the loader to find any dlls it needs.
  6516. func_warning "'-no-install' is ignored for $host"
  6517. func_warning "assuming '-no-fast-install' instead"
  6518. fast_install=no
  6519. ;;
  6520. *) no_install=yes ;;
  6521. esac
  6522. continue
  6523. ;;
  6524. -no-undefined)
  6525. allow_undefined=no
  6526. continue
  6527. ;;
  6528. -objectlist)
  6529. prev=objectlist
  6530. continue
  6531. ;;
  6532. -os2dllname)
  6533. prev=os2dllname
  6534. continue
  6535. ;;
  6536. -o) prev=output ;;
  6537. -precious-files-regex)
  6538. prev=precious_regex
  6539. continue
  6540. ;;
  6541. -release)
  6542. prev=release
  6543. continue
  6544. ;;
  6545. -rpath)
  6546. prev=rpath
  6547. continue
  6548. ;;
  6549. -R)
  6550. prev=xrpath
  6551. continue
  6552. ;;
  6553. -R*)
  6554. func_stripname '-R' '' "$arg"
  6555. dir=$func_stripname_result
  6556. # We need an absolute path.
  6557. case $dir in
  6558. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6559. =*)
  6560. func_stripname '=' '' "$dir"
  6561. dir=$lt_sysroot$func_stripname_result
  6562. ;;
  6563. *)
  6564. func_fatal_error "only absolute run-paths are allowed"
  6565. ;;
  6566. esac
  6567. case "$xrpath " in
  6568. *" $dir "*) ;;
  6569. *) func_append xrpath " $dir" ;;
  6570. esac
  6571. continue
  6572. ;;
  6573. -shared)
  6574. # The effects of -shared are defined in a previous loop.
  6575. continue
  6576. ;;
  6577. -shrext)
  6578. prev=shrext
  6579. continue
  6580. ;;
  6581. -static | -static-libtool-libs)
  6582. # The effects of -static are defined in a previous loop.
  6583. # We used to do the same as -all-static on platforms that
  6584. # didn't have a PIC flag, but the assumption that the effects
  6585. # would be equivalent was wrong. It would break on at least
  6586. # Digital Unix and AIX.
  6587. continue
  6588. ;;
  6589. -thread-safe)
  6590. thread_safe=yes
  6591. continue
  6592. ;;
  6593. -version-info)
  6594. prev=vinfo
  6595. continue
  6596. ;;
  6597. -version-number)
  6598. prev=vinfo
  6599. vinfo_number=yes
  6600. continue
  6601. ;;
  6602. -weak)
  6603. prev=weak
  6604. continue
  6605. ;;
  6606. -Wc,*)
  6607. func_stripname '-Wc,' '' "$arg"
  6608. args=$func_stripname_result
  6609. arg=
  6610. save_ifs=$IFS; IFS=,
  6611. for flag in $args; do
  6612. IFS=$save_ifs
  6613. func_quote_for_eval "$flag"
  6614. func_append arg " $func_quote_for_eval_result"
  6615. func_append compiler_flags " $func_quote_for_eval_result"
  6616. done
  6617. IFS=$save_ifs
  6618. func_stripname ' ' '' "$arg"
  6619. arg=$func_stripname_result
  6620. ;;
  6621. -Wl,*)
  6622. func_stripname '-Wl,' '' "$arg"
  6623. args=$func_stripname_result
  6624. arg=
  6625. save_ifs=$IFS; IFS=,
  6626. for flag in $args; do
  6627. IFS=$save_ifs
  6628. func_quote_for_eval "$flag"
  6629. func_append arg " $wl$func_quote_for_eval_result"
  6630. func_append compiler_flags " $wl$func_quote_for_eval_result"
  6631. func_append linker_flags " $func_quote_for_eval_result"
  6632. done
  6633. IFS=$save_ifs
  6634. func_stripname ' ' '' "$arg"
  6635. arg=$func_stripname_result
  6636. ;;
  6637. -Xcompiler)
  6638. prev=xcompiler
  6639. continue
  6640. ;;
  6641. -Xlinker)
  6642. prev=xlinker
  6643. continue
  6644. ;;
  6645. -XCClinker)
  6646. prev=xcclinker
  6647. continue
  6648. ;;
  6649. # -msg_* for osf cc
  6650. -msg_*)
  6651. func_quote_for_eval "$arg"
  6652. arg=$func_quote_for_eval_result
  6653. ;;
  6654. # Flags to be passed through unchanged, with rationale:
  6655. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  6656. # -r[0-9][0-9]* specify processor for the SGI compiler
  6657. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  6658. # +DA*, +DD* enable 64-bit mode for the HP compiler
  6659. # -q* compiler args for the IBM compiler
  6660. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  6661. # -F/path path to uninstalled frameworks, gcc on darwin
  6662. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  6663. # -fstack-protector* stack protector flags for GCC
  6664. # @file GCC response files
  6665. # -tp=* Portland pgcc target processor selection
  6666. # --sysroot=* for sysroot support
  6667. # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  6668. # -specs=* GCC specs files
  6669. # -stdlib=* select c++ std lib with clang
  6670. # -fsanitize=* Clang/GCC memory and address sanitizer
  6671. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  6672. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  6673. -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
  6674. -specs=*|-fsanitize=*)
  6675. func_quote_for_eval "$arg"
  6676. arg=$func_quote_for_eval_result
  6677. func_append compile_command " $arg"
  6678. func_append finalize_command " $arg"
  6679. func_append compiler_flags " $arg"
  6680. continue
  6681. ;;
  6682. -Z*)
  6683. if test os2 = "`expr $host : '.*\(os2\)'`"; then
  6684. # OS/2 uses -Zxxx to specify OS/2-specific options
  6685. compiler_flags="$compiler_flags $arg"
  6686. func_append compile_command " $arg"
  6687. func_append finalize_command " $arg"
  6688. case $arg in
  6689. -Zlinker | -Zstack)
  6690. prev=xcompiler
  6691. ;;
  6692. esac
  6693. continue
  6694. else
  6695. # Otherwise treat like 'Some other compiler flag' below
  6696. func_quote_for_eval "$arg"
  6697. arg=$func_quote_for_eval_result
  6698. fi
  6699. ;;
  6700. # Some other compiler flag.
  6701. -* | +*)
  6702. func_quote_for_eval "$arg"
  6703. arg=$func_quote_for_eval_result
  6704. ;;
  6705. *.$objext)
  6706. # A standard object.
  6707. func_append objs " $arg"
  6708. ;;
  6709. *.lo)
  6710. # A libtool-controlled object.
  6711. # Check to see that this really is a libtool object.
  6712. if func_lalib_unsafe_p "$arg"; then
  6713. pic_object=
  6714. non_pic_object=
  6715. # Read the .lo file
  6716. func_source "$arg"
  6717. if test -z "$pic_object" ||
  6718. test -z "$non_pic_object" ||
  6719. test none = "$pic_object" &&
  6720. test none = "$non_pic_object"; then
  6721. func_fatal_error "cannot find name of object for '$arg'"
  6722. fi
  6723. # Extract subdirectory from the argument.
  6724. func_dirname "$arg" "/" ""
  6725. xdir=$func_dirname_result
  6726. test none = "$pic_object" || {
  6727. # Prepend the subdirectory the object is found in.
  6728. pic_object=$xdir$pic_object
  6729. if test dlfiles = "$prev"; then
  6730. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6731. func_append dlfiles " $pic_object"
  6732. prev=
  6733. continue
  6734. else
  6735. # If libtool objects are unsupported, then we need to preload.
  6736. prev=dlprefiles
  6737. fi
  6738. fi
  6739. # CHECK ME: I think I busted this. -Ossama
  6740. if test dlprefiles = "$prev"; then
  6741. # Preload the old-style object.
  6742. func_append dlprefiles " $pic_object"
  6743. prev=
  6744. fi
  6745. # A PIC object.
  6746. func_append libobjs " $pic_object"
  6747. arg=$pic_object
  6748. }
  6749. # Non-PIC object.
  6750. if test none != "$non_pic_object"; then
  6751. # Prepend the subdirectory the object is found in.
  6752. non_pic_object=$xdir$non_pic_object
  6753. # A standard non-PIC object
  6754. func_append non_pic_objects " $non_pic_object"
  6755. if test -z "$pic_object" || test none = "$pic_object"; then
  6756. arg=$non_pic_object
  6757. fi
  6758. else
  6759. # If the PIC object exists, use it instead.
  6760. # $xdir was prepended to $pic_object above.
  6761. non_pic_object=$pic_object
  6762. func_append non_pic_objects " $non_pic_object"
  6763. fi
  6764. else
  6765. # Only an error if not doing a dry-run.
  6766. if $opt_dry_run; then
  6767. # Extract subdirectory from the argument.
  6768. func_dirname "$arg" "/" ""
  6769. xdir=$func_dirname_result
  6770. func_lo2o "$arg"
  6771. pic_object=$xdir$objdir/$func_lo2o_result
  6772. non_pic_object=$xdir$func_lo2o_result
  6773. func_append libobjs " $pic_object"
  6774. func_append non_pic_objects " $non_pic_object"
  6775. else
  6776. func_fatal_error "'$arg' is not a valid libtool object"
  6777. fi
  6778. fi
  6779. ;;
  6780. *.$libext)
  6781. # An archive.
  6782. func_append deplibs " $arg"
  6783. func_append old_deplibs " $arg"
  6784. continue
  6785. ;;
  6786. *.la)
  6787. # A libtool-controlled library.
  6788. func_resolve_sysroot "$arg"
  6789. if test dlfiles = "$prev"; then
  6790. # This library was specified with -dlopen.
  6791. func_append dlfiles " $func_resolve_sysroot_result"
  6792. prev=
  6793. elif test dlprefiles = "$prev"; then
  6794. # The library was specified with -dlpreopen.
  6795. func_append dlprefiles " $func_resolve_sysroot_result"
  6796. prev=
  6797. else
  6798. func_append deplibs " $func_resolve_sysroot_result"
  6799. fi
  6800. continue
  6801. ;;
  6802. # Some other compiler argument.
  6803. *)
  6804. # Unknown arguments in both finalize_command and compile_command need
  6805. # to be aesthetically quoted because they are evaled later.
  6806. func_quote_for_eval "$arg"
  6807. arg=$func_quote_for_eval_result
  6808. ;;
  6809. esac # arg
  6810. # Now actually substitute the argument into the commands.
  6811. if test -n "$arg"; then
  6812. func_append compile_command " $arg"
  6813. func_append finalize_command " $arg"
  6814. fi
  6815. done # argument parsing loop
  6816. test -n "$prev" && \
  6817. func_fatal_help "the '$prevarg' option requires an argument"
  6818. if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
  6819. eval arg=\"$export_dynamic_flag_spec\"
  6820. func_append compile_command " $arg"
  6821. func_append finalize_command " $arg"
  6822. fi
  6823. oldlibs=
  6824. # calculate the name of the file, without its directory
  6825. func_basename "$output"
  6826. outputname=$func_basename_result
  6827. libobjs_save=$libobjs
  6828. if test -n "$shlibpath_var"; then
  6829. # get the directories listed in $shlibpath_var
  6830. eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
  6831. else
  6832. shlib_search_path=
  6833. fi
  6834. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  6835. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  6836. # Definition is injected by LT_CONFIG during libtool generation.
  6837. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
  6838. func_dirname "$output" "/" ""
  6839. output_objdir=$func_dirname_result$objdir
  6840. func_to_tool_file "$output_objdir/"
  6841. tool_output_objdir=$func_to_tool_file_result
  6842. # Create the object directory.
  6843. func_mkdir_p "$output_objdir"
  6844. # Determine the type of output
  6845. case $output in
  6846. "")
  6847. func_fatal_help "you must specify an output file"
  6848. ;;
  6849. *.$libext) linkmode=oldlib ;;
  6850. *.lo | *.$objext) linkmode=obj ;;
  6851. *.la) linkmode=lib ;;
  6852. *) linkmode=prog ;; # Anything else should be a program.
  6853. esac
  6854. specialdeplibs=
  6855. libs=
  6856. # Find all interdependent deplibs by searching for libraries
  6857. # that are linked more than once (e.g. -la -lb -la)
  6858. for deplib in $deplibs; do
  6859. if $opt_preserve_dup_deps; then
  6860. case "$libs " in
  6861. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  6862. esac
  6863. fi
  6864. func_append libs " $deplib"
  6865. done
  6866. if test lib = "$linkmode"; then
  6867. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  6868. # Compute libraries that are listed more than once in $predeps
  6869. # $postdeps and mark them as special (i.e., whose duplicates are
  6870. # not to be eliminated).
  6871. pre_post_deps=
  6872. if $opt_duplicate_compiler_generated_deps; then
  6873. for pre_post_dep in $predeps $postdeps; do
  6874. case "$pre_post_deps " in
  6875. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  6876. esac
  6877. func_append pre_post_deps " $pre_post_dep"
  6878. done
  6879. fi
  6880. pre_post_deps=
  6881. fi
  6882. deplibs=
  6883. newdependency_libs=
  6884. newlib_search_path=
  6885. need_relink=no # whether we're linking any uninstalled libtool libraries
  6886. notinst_deplibs= # not-installed libtool libraries
  6887. notinst_path= # paths that contain not-installed libtool libraries
  6888. case $linkmode in
  6889. lib)
  6890. passes="conv dlpreopen link"
  6891. for file in $dlfiles $dlprefiles; do
  6892. case $file in
  6893. *.la) ;;
  6894. *)
  6895. func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
  6896. ;;
  6897. esac
  6898. done
  6899. ;;
  6900. prog)
  6901. compile_deplibs=
  6902. finalize_deplibs=
  6903. alldeplibs=false
  6904. newdlfiles=
  6905. newdlprefiles=
  6906. passes="conv scan dlopen dlpreopen link"
  6907. ;;
  6908. *) passes="conv"
  6909. ;;
  6910. esac
  6911. for pass in $passes; do
  6912. # The preopen pass in lib mode reverses $deplibs; put it back here
  6913. # so that -L comes before libs that need it for instance...
  6914. if test lib,link = "$linkmode,$pass"; then
  6915. ## FIXME: Find the place where the list is rebuilt in the wrong
  6916. ## order, and fix it there properly
  6917. tmp_deplibs=
  6918. for deplib in $deplibs; do
  6919. tmp_deplibs="$deplib $tmp_deplibs"
  6920. done
  6921. deplibs=$tmp_deplibs
  6922. fi
  6923. if test lib,link = "$linkmode,$pass" ||
  6924. test prog,scan = "$linkmode,$pass"; then
  6925. libs=$deplibs
  6926. deplibs=
  6927. fi
  6928. if test prog = "$linkmode"; then
  6929. case $pass in
  6930. dlopen) libs=$dlfiles ;;
  6931. dlpreopen) libs=$dlprefiles ;;
  6932. link)
  6933. libs="$deplibs %DEPLIBS%"
  6934. test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
  6935. ;;
  6936. esac
  6937. fi
  6938. if test lib,dlpreopen = "$linkmode,$pass"; then
  6939. # Collect and forward deplibs of preopened libtool libs
  6940. for lib in $dlprefiles; do
  6941. # Ignore non-libtool-libs
  6942. dependency_libs=
  6943. func_resolve_sysroot "$lib"
  6944. case $lib in
  6945. *.la) func_source "$func_resolve_sysroot_result" ;;
  6946. esac
  6947. # Collect preopened libtool deplibs, except any this library
  6948. # has declared as weak libs
  6949. for deplib in $dependency_libs; do
  6950. func_basename "$deplib"
  6951. deplib_base=$func_basename_result
  6952. case " $weak_libs " in
  6953. *" $deplib_base "*) ;;
  6954. *) func_append deplibs " $deplib" ;;
  6955. esac
  6956. done
  6957. done
  6958. libs=$dlprefiles
  6959. fi
  6960. if test dlopen = "$pass"; then
  6961. # Collect dlpreopened libraries
  6962. save_deplibs=$deplibs
  6963. deplibs=
  6964. fi
  6965. for deplib in $libs; do
  6966. lib=
  6967. found=false
  6968. case $deplib in
  6969. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6970. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6971. if test prog,link = "$linkmode,$pass"; then
  6972. compile_deplibs="$deplib $compile_deplibs"
  6973. finalize_deplibs="$deplib $finalize_deplibs"
  6974. else
  6975. func_append compiler_flags " $deplib"
  6976. if test lib = "$linkmode"; then
  6977. case "$new_inherited_linker_flags " in
  6978. *" $deplib "*) ;;
  6979. * ) func_append new_inherited_linker_flags " $deplib" ;;
  6980. esac
  6981. fi
  6982. fi
  6983. continue
  6984. ;;
  6985. -l*)
  6986. if test lib != "$linkmode" && test prog != "$linkmode"; then
  6987. func_warning "'-l' is ignored for archives/objects"
  6988. continue
  6989. fi
  6990. func_stripname '-l' '' "$deplib"
  6991. name=$func_stripname_result
  6992. if test lib = "$linkmode"; then
  6993. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  6994. else
  6995. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  6996. fi
  6997. for searchdir in $searchdirs; do
  6998. for search_ext in .la $std_shrext .so .a; do
  6999. # Search the libtool library
  7000. lib=$searchdir/lib$name$search_ext
  7001. if test -f "$lib"; then
  7002. if test .la = "$search_ext"; then
  7003. found=:
  7004. else
  7005. found=false
  7006. fi
  7007. break 2
  7008. fi
  7009. done
  7010. done
  7011. if $found; then
  7012. # deplib is a libtool library
  7013. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  7014. # We need to do some special things here, and not later.
  7015. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  7016. case " $predeps $postdeps " in
  7017. *" $deplib "*)
  7018. if func_lalib_p "$lib"; then
  7019. library_names=
  7020. old_library=
  7021. func_source "$lib"
  7022. for l in $old_library $library_names; do
  7023. ll=$l
  7024. done
  7025. if test "X$ll" = "X$old_library"; then # only static version available
  7026. found=false
  7027. func_dirname "$lib" "" "."
  7028. ladir=$func_dirname_result
  7029. lib=$ladir/$old_library
  7030. if test prog,link = "$linkmode,$pass"; then
  7031. compile_deplibs="$deplib $compile_deplibs"
  7032. finalize_deplibs="$deplib $finalize_deplibs"
  7033. else
  7034. deplibs="$deplib $deplibs"
  7035. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7036. fi
  7037. continue
  7038. fi
  7039. fi
  7040. ;;
  7041. *) ;;
  7042. esac
  7043. fi
  7044. else
  7045. # deplib doesn't seem to be a libtool library
  7046. if test prog,link = "$linkmode,$pass"; then
  7047. compile_deplibs="$deplib $compile_deplibs"
  7048. finalize_deplibs="$deplib $finalize_deplibs"
  7049. else
  7050. deplibs="$deplib $deplibs"
  7051. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7052. fi
  7053. continue
  7054. fi
  7055. ;; # -l
  7056. *.ltframework)
  7057. if test prog,link = "$linkmode,$pass"; then
  7058. compile_deplibs="$deplib $compile_deplibs"
  7059. finalize_deplibs="$deplib $finalize_deplibs"
  7060. else
  7061. deplibs="$deplib $deplibs"
  7062. if test lib = "$linkmode"; then
  7063. case "$new_inherited_linker_flags " in
  7064. *" $deplib "*) ;;
  7065. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7066. esac
  7067. fi
  7068. fi
  7069. continue
  7070. ;;
  7071. -L*)
  7072. case $linkmode in
  7073. lib)
  7074. deplibs="$deplib $deplibs"
  7075. test conv = "$pass" && continue
  7076. newdependency_libs="$deplib $newdependency_libs"
  7077. func_stripname '-L' '' "$deplib"
  7078. func_resolve_sysroot "$func_stripname_result"
  7079. func_append newlib_search_path " $func_resolve_sysroot_result"
  7080. ;;
  7081. prog)
  7082. if test conv = "$pass"; then
  7083. deplibs="$deplib $deplibs"
  7084. continue
  7085. fi
  7086. if test scan = "$pass"; then
  7087. deplibs="$deplib $deplibs"
  7088. else
  7089. compile_deplibs="$deplib $compile_deplibs"
  7090. finalize_deplibs="$deplib $finalize_deplibs"
  7091. fi
  7092. func_stripname '-L' '' "$deplib"
  7093. func_resolve_sysroot "$func_stripname_result"
  7094. func_append newlib_search_path " $func_resolve_sysroot_result"
  7095. ;;
  7096. *)
  7097. func_warning "'-L' is ignored for archives/objects"
  7098. ;;
  7099. esac # linkmode
  7100. continue
  7101. ;; # -L
  7102. -R*)
  7103. if test link = "$pass"; then
  7104. func_stripname '-R' '' "$deplib"
  7105. func_resolve_sysroot "$func_stripname_result"
  7106. dir=$func_resolve_sysroot_result
  7107. # Make sure the xrpath contains only unique directories.
  7108. case "$xrpath " in
  7109. *" $dir "*) ;;
  7110. *) func_append xrpath " $dir" ;;
  7111. esac
  7112. fi
  7113. deplibs="$deplib $deplibs"
  7114. continue
  7115. ;;
  7116. *.la)
  7117. func_resolve_sysroot "$deplib"
  7118. lib=$func_resolve_sysroot_result
  7119. ;;
  7120. *.$libext)
  7121. if test conv = "$pass"; then
  7122. deplibs="$deplib $deplibs"
  7123. continue
  7124. fi
  7125. case $linkmode in
  7126. lib)
  7127. # Linking convenience modules into shared libraries is allowed,
  7128. # but linking other static libraries is non-portable.
  7129. case " $dlpreconveniencelibs " in
  7130. *" $deplib "*) ;;
  7131. *)
  7132. valid_a_lib=false
  7133. case $deplibs_check_method in
  7134. match_pattern*)
  7135. set dummy $deplibs_check_method; shift
  7136. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7137. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  7138. | $EGREP "$match_pattern_regex" > /dev/null; then
  7139. valid_a_lib=:
  7140. fi
  7141. ;;
  7142. pass_all)
  7143. valid_a_lib=:
  7144. ;;
  7145. esac
  7146. if $valid_a_lib; then
  7147. echo
  7148. $ECHO "*** Warning: Linking the shared library $output against the"
  7149. $ECHO "*** static library $deplib is not portable!"
  7150. deplibs="$deplib $deplibs"
  7151. else
  7152. echo
  7153. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  7154. echo "*** I have the capability to make that library automatically link in when"
  7155. echo "*** you link to this library. But I can only do this if you have a"
  7156. echo "*** shared version of the library, which you do not appear to have"
  7157. echo "*** because the file extensions .$libext of this argument makes me believe"
  7158. echo "*** that it is just a static archive that I should not use here."
  7159. fi
  7160. ;;
  7161. esac
  7162. continue
  7163. ;;
  7164. prog)
  7165. if test link != "$pass"; then
  7166. deplibs="$deplib $deplibs"
  7167. else
  7168. compile_deplibs="$deplib $compile_deplibs"
  7169. finalize_deplibs="$deplib $finalize_deplibs"
  7170. fi
  7171. continue
  7172. ;;
  7173. esac # linkmode
  7174. ;; # *.$libext
  7175. *.lo | *.$objext)
  7176. if test conv = "$pass"; then
  7177. deplibs="$deplib $deplibs"
  7178. elif test prog = "$linkmode"; then
  7179. if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
  7180. # If there is no dlopen support or we're linking statically,
  7181. # we need to preload.
  7182. func_append newdlprefiles " $deplib"
  7183. compile_deplibs="$deplib $compile_deplibs"
  7184. finalize_deplibs="$deplib $finalize_deplibs"
  7185. else
  7186. func_append newdlfiles " $deplib"
  7187. fi
  7188. fi
  7189. continue
  7190. ;;
  7191. %DEPLIBS%)
  7192. alldeplibs=:
  7193. continue
  7194. ;;
  7195. esac # case $deplib
  7196. $found || test -f "$lib" \
  7197. || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
  7198. # Check to see that this really is a libtool archive.
  7199. func_lalib_unsafe_p "$lib" \
  7200. || func_fatal_error "'$lib' is not a valid libtool archive"
  7201. func_dirname "$lib" "" "."
  7202. ladir=$func_dirname_result
  7203. dlname=
  7204. dlopen=
  7205. dlpreopen=
  7206. libdir=
  7207. library_names=
  7208. old_library=
  7209. inherited_linker_flags=
  7210. # If the library was installed with an old release of libtool,
  7211. # it will not redefine variables installed, or shouldnotlink
  7212. installed=yes
  7213. shouldnotlink=no
  7214. avoidtemprpath=
  7215. # Read the .la file
  7216. func_source "$lib"
  7217. # Convert "-framework foo" to "foo.ltframework"
  7218. if test -n "$inherited_linker_flags"; then
  7219. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  7220. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  7221. case " $new_inherited_linker_flags " in
  7222. *" $tmp_inherited_linker_flag "*) ;;
  7223. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  7224. esac
  7225. done
  7226. fi
  7227. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7228. if test lib,link = "$linkmode,$pass" ||
  7229. test prog,scan = "$linkmode,$pass" ||
  7230. { test prog != "$linkmode" && test lib != "$linkmode"; }; then
  7231. test -n "$dlopen" && func_append dlfiles " $dlopen"
  7232. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  7233. fi
  7234. if test conv = "$pass"; then
  7235. # Only check for convenience libraries
  7236. deplibs="$lib $deplibs"
  7237. if test -z "$libdir"; then
  7238. if test -z "$old_library"; then
  7239. func_fatal_error "cannot find name of link library for '$lib'"
  7240. fi
  7241. # It is a libtool convenience library, so add in its objects.
  7242. func_append convenience " $ladir/$objdir/$old_library"
  7243. func_append old_convenience " $ladir/$objdir/$old_library"
  7244. tmp_libs=
  7245. for deplib in $dependency_libs; do
  7246. deplibs="$deplib $deplibs"
  7247. if $opt_preserve_dup_deps; then
  7248. case "$tmp_libs " in
  7249. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7250. esac
  7251. fi
  7252. func_append tmp_libs " $deplib"
  7253. done
  7254. elif test prog != "$linkmode" && test lib != "$linkmode"; then
  7255. func_fatal_error "'$lib' is not a convenience library"
  7256. fi
  7257. continue
  7258. fi # $pass = conv
  7259. # Get the name of the library we link against.
  7260. linklib=
  7261. if test -n "$old_library" &&
  7262. { test yes = "$prefer_static_libs" ||
  7263. test built,no = "$prefer_static_libs,$installed"; }; then
  7264. linklib=$old_library
  7265. else
  7266. for l in $old_library $library_names; do
  7267. linklib=$l
  7268. done
  7269. fi
  7270. if test -z "$linklib"; then
  7271. func_fatal_error "cannot find name of link library for '$lib'"
  7272. fi
  7273. # This library was specified with -dlopen.
  7274. if test dlopen = "$pass"; then
  7275. test -z "$libdir" \
  7276. && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
  7277. if test -z "$dlname" ||
  7278. test yes != "$dlopen_support" ||
  7279. test no = "$build_libtool_libs"
  7280. then
  7281. # If there is no dlname, no dlopen support or we're linking
  7282. # statically, we need to preload. We also need to preload any
  7283. # dependent libraries so libltdl's deplib preloader doesn't
  7284. # bomb out in the load deplibs phase.
  7285. func_append dlprefiles " $lib $dependency_libs"
  7286. else
  7287. func_append newdlfiles " $lib"
  7288. fi
  7289. continue
  7290. fi # $pass = dlopen
  7291. # We need an absolute path.
  7292. case $ladir in
  7293. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
  7294. *)
  7295. abs_ladir=`cd "$ladir" && pwd`
  7296. if test -z "$abs_ladir"; then
  7297. func_warning "cannot determine absolute directory name of '$ladir'"
  7298. func_warning "passing it literally to the linker, although it might fail"
  7299. abs_ladir=$ladir
  7300. fi
  7301. ;;
  7302. esac
  7303. func_basename "$lib"
  7304. laname=$func_basename_result
  7305. # Find the relevant object directory and library name.
  7306. if test yes = "$installed"; then
  7307. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7308. func_warning "library '$lib' was moved."
  7309. dir=$ladir
  7310. absdir=$abs_ladir
  7311. libdir=$abs_ladir
  7312. else
  7313. dir=$lt_sysroot$libdir
  7314. absdir=$lt_sysroot$libdir
  7315. fi
  7316. test yes = "$hardcode_automatic" && avoidtemprpath=yes
  7317. else
  7318. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7319. dir=$ladir
  7320. absdir=$abs_ladir
  7321. # Remove this search path later
  7322. func_append notinst_path " $abs_ladir"
  7323. else
  7324. dir=$ladir/$objdir
  7325. absdir=$abs_ladir/$objdir
  7326. # Remove this search path later
  7327. func_append notinst_path " $abs_ladir"
  7328. fi
  7329. fi # $installed = yes
  7330. func_stripname 'lib' '.la' "$laname"
  7331. name=$func_stripname_result
  7332. # This library was specified with -dlpreopen.
  7333. if test dlpreopen = "$pass"; then
  7334. if test -z "$libdir" && test prog = "$linkmode"; then
  7335. func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
  7336. fi
  7337. case $host in
  7338. # special handling for platforms with PE-DLLs.
  7339. *cygwin* | *mingw* | *cegcc* )
  7340. # Linker will automatically link against shared library if both
  7341. # static and shared are present. Therefore, ensure we extract
  7342. # symbols from the import library if a shared library is present
  7343. # (otherwise, the dlopen module name will be incorrect). We do
  7344. # this by putting the import library name into $newdlprefiles.
  7345. # We recover the dlopen module name by 'saving' the la file
  7346. # name in a special purpose variable, and (later) extracting the
  7347. # dlname from the la file.
  7348. if test -n "$dlname"; then
  7349. func_tr_sh "$dir/$linklib"
  7350. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  7351. func_append newdlprefiles " $dir/$linklib"
  7352. else
  7353. func_append newdlprefiles " $dir/$old_library"
  7354. # Keep a list of preopened convenience libraries to check
  7355. # that they are being used correctly in the link pass.
  7356. test -z "$libdir" && \
  7357. func_append dlpreconveniencelibs " $dir/$old_library"
  7358. fi
  7359. ;;
  7360. * )
  7361. # Prefer using a static library (so that no silly _DYNAMIC symbols
  7362. # are required to link).
  7363. if test -n "$old_library"; then
  7364. func_append newdlprefiles " $dir/$old_library"
  7365. # Keep a list of preopened convenience libraries to check
  7366. # that they are being used correctly in the link pass.
  7367. test -z "$libdir" && \
  7368. func_append dlpreconveniencelibs " $dir/$old_library"
  7369. # Otherwise, use the dlname, so that lt_dlopen finds it.
  7370. elif test -n "$dlname"; then
  7371. func_append newdlprefiles " $dir/$dlname"
  7372. else
  7373. func_append newdlprefiles " $dir/$linklib"
  7374. fi
  7375. ;;
  7376. esac
  7377. fi # $pass = dlpreopen
  7378. if test -z "$libdir"; then
  7379. # Link the convenience library
  7380. if test lib = "$linkmode"; then
  7381. deplibs="$dir/$old_library $deplibs"
  7382. elif test prog,link = "$linkmode,$pass"; then
  7383. compile_deplibs="$dir/$old_library $compile_deplibs"
  7384. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  7385. else
  7386. deplibs="$lib $deplibs" # used for prog,scan pass
  7387. fi
  7388. continue
  7389. fi
  7390. if test prog = "$linkmode" && test link != "$pass"; then
  7391. func_append newlib_search_path " $ladir"
  7392. deplibs="$lib $deplibs"
  7393. linkalldeplibs=false
  7394. if test no != "$link_all_deplibs" || test -z "$library_names" ||
  7395. test no = "$build_libtool_libs"; then
  7396. linkalldeplibs=:
  7397. fi
  7398. tmp_libs=
  7399. for deplib in $dependency_libs; do
  7400. case $deplib in
  7401. -L*) func_stripname '-L' '' "$deplib"
  7402. func_resolve_sysroot "$func_stripname_result"
  7403. func_append newlib_search_path " $func_resolve_sysroot_result"
  7404. ;;
  7405. esac
  7406. # Need to link against all dependency_libs?
  7407. if $linkalldeplibs; then
  7408. deplibs="$deplib $deplibs"
  7409. else
  7410. # Need to hardcode shared library paths
  7411. # or/and link against static libraries
  7412. newdependency_libs="$deplib $newdependency_libs"
  7413. fi
  7414. if $opt_preserve_dup_deps; then
  7415. case "$tmp_libs " in
  7416. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7417. esac
  7418. fi
  7419. func_append tmp_libs " $deplib"
  7420. done # for deplib
  7421. continue
  7422. fi # $linkmode = prog...
  7423. if test prog,link = "$linkmode,$pass"; then
  7424. if test -n "$library_names" &&
  7425. { { test no = "$prefer_static_libs" ||
  7426. test built,yes = "$prefer_static_libs,$installed"; } ||
  7427. test -z "$old_library"; }; then
  7428. # We need to hardcode the library path
  7429. if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
  7430. # Make sure the rpath contains only unique directories.
  7431. case $temp_rpath: in
  7432. *"$absdir:"*) ;;
  7433. *) func_append temp_rpath "$absdir:" ;;
  7434. esac
  7435. fi
  7436. # Hardcode the library path.
  7437. # Skip directories that are in the system default run-time
  7438. # search path.
  7439. case " $sys_lib_dlsearch_path " in
  7440. *" $absdir "*) ;;
  7441. *)
  7442. case "$compile_rpath " in
  7443. *" $absdir "*) ;;
  7444. *) func_append compile_rpath " $absdir" ;;
  7445. esac
  7446. ;;
  7447. esac
  7448. case " $sys_lib_dlsearch_path " in
  7449. *" $libdir "*) ;;
  7450. *)
  7451. case "$finalize_rpath " in
  7452. *" $libdir "*) ;;
  7453. *) func_append finalize_rpath " $libdir" ;;
  7454. esac
  7455. ;;
  7456. esac
  7457. fi # $linkmode,$pass = prog,link...
  7458. if $alldeplibs &&
  7459. { test pass_all = "$deplibs_check_method" ||
  7460. { test yes = "$build_libtool_libs" &&
  7461. test -n "$library_names"; }; }; then
  7462. # We only need to search for static libraries
  7463. continue
  7464. fi
  7465. fi
  7466. link_static=no # Whether the deplib will be linked statically
  7467. use_static_libs=$prefer_static_libs
  7468. if test built = "$use_static_libs" && test yes = "$installed"; then
  7469. use_static_libs=no
  7470. fi
  7471. if test -n "$library_names" &&
  7472. { test no = "$use_static_libs" || test -z "$old_library"; }; then
  7473. case $host in
  7474. *cygwin* | *mingw* | *cegcc* | *os2*)
  7475. # No point in relinking DLLs because paths are not encoded
  7476. func_append notinst_deplibs " $lib"
  7477. need_relink=no
  7478. ;;
  7479. *)
  7480. if test no = "$installed"; then
  7481. func_append notinst_deplibs " $lib"
  7482. need_relink=yes
  7483. fi
  7484. ;;
  7485. esac
  7486. # This is a shared library
  7487. # Warn about portability, can't link against -module's on some
  7488. # systems (darwin). Don't bleat about dlopened modules though!
  7489. dlopenmodule=
  7490. for dlpremoduletest in $dlprefiles; do
  7491. if test "X$dlpremoduletest" = "X$lib"; then
  7492. dlopenmodule=$dlpremoduletest
  7493. break
  7494. fi
  7495. done
  7496. if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
  7497. echo
  7498. if test prog = "$linkmode"; then
  7499. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  7500. else
  7501. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  7502. fi
  7503. $ECHO "*** $linklib is not portable!"
  7504. fi
  7505. if test lib = "$linkmode" &&
  7506. test yes = "$hardcode_into_libs"; then
  7507. # Hardcode the library path.
  7508. # Skip directories that are in the system default run-time
  7509. # search path.
  7510. case " $sys_lib_dlsearch_path " in
  7511. *" $absdir "*) ;;
  7512. *)
  7513. case "$compile_rpath " in
  7514. *" $absdir "*) ;;
  7515. *) func_append compile_rpath " $absdir" ;;
  7516. esac
  7517. ;;
  7518. esac
  7519. case " $sys_lib_dlsearch_path " in
  7520. *" $libdir "*) ;;
  7521. *)
  7522. case "$finalize_rpath " in
  7523. *" $libdir "*) ;;
  7524. *) func_append finalize_rpath " $libdir" ;;
  7525. esac
  7526. ;;
  7527. esac
  7528. fi
  7529. if test -n "$old_archive_from_expsyms_cmds"; then
  7530. # figure out the soname
  7531. set dummy $library_names
  7532. shift
  7533. realname=$1
  7534. shift
  7535. libname=`eval "\\$ECHO \"$libname_spec\""`
  7536. # use dlname if we got it. it's perfectly good, no?
  7537. if test -n "$dlname"; then
  7538. soname=$dlname
  7539. elif test -n "$soname_spec"; then
  7540. # bleh windows
  7541. case $host in
  7542. *cygwin* | mingw* | *cegcc* | *os2*)
  7543. func_arith $current - $age
  7544. major=$func_arith_result
  7545. versuffix=-$major
  7546. ;;
  7547. esac
  7548. eval soname=\"$soname_spec\"
  7549. else
  7550. soname=$realname
  7551. fi
  7552. # Make a new name for the extract_expsyms_cmds to use
  7553. soroot=$soname
  7554. func_basename "$soroot"
  7555. soname=$func_basename_result
  7556. func_stripname 'lib' '.dll' "$soname"
  7557. newlib=libimp-$func_stripname_result.a
  7558. # If the library has no export list, then create one now
  7559. if test -f "$output_objdir/$soname-def"; then :
  7560. else
  7561. func_verbose "extracting exported symbol list from '$soname'"
  7562. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  7563. fi
  7564. # Create $newlib
  7565. if test -f "$output_objdir/$newlib"; then :; else
  7566. func_verbose "generating import library for '$soname'"
  7567. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  7568. fi
  7569. # make sure the library variables are pointing to the new library
  7570. dir=$output_objdir
  7571. linklib=$newlib
  7572. fi # test -n "$old_archive_from_expsyms_cmds"
  7573. if test prog = "$linkmode" || test relink != "$opt_mode"; then
  7574. add_shlibpath=
  7575. add_dir=
  7576. add=
  7577. lib_linked=yes
  7578. case $hardcode_action in
  7579. immediate | unsupported)
  7580. if test no = "$hardcode_direct"; then
  7581. add=$dir/$linklib
  7582. case $host in
  7583. *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
  7584. *-*-sysv4*uw2*) add_dir=-L$dir ;;
  7585. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  7586. *-*-unixware7*) add_dir=-L$dir ;;
  7587. *-*-darwin* )
  7588. # if the lib is a (non-dlopened) module then we cannot
  7589. # link against it, someone is ignoring the earlier warnings
  7590. if /usr/bin/file -L $add 2> /dev/null |
  7591. $GREP ": [^:]* bundle" >/dev/null; then
  7592. if test "X$dlopenmodule" != "X$lib"; then
  7593. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  7594. if test -z "$old_library"; then
  7595. echo
  7596. echo "*** And there doesn't seem to be a static archive available"
  7597. echo "*** The link will probably fail, sorry"
  7598. else
  7599. add=$dir/$old_library
  7600. fi
  7601. elif test -n "$old_library"; then
  7602. add=$dir/$old_library
  7603. fi
  7604. fi
  7605. esac
  7606. elif test no = "$hardcode_minus_L"; then
  7607. case $host in
  7608. *-*-sunos*) add_shlibpath=$dir ;;
  7609. esac
  7610. add_dir=-L$dir
  7611. add=-l$name
  7612. elif test no = "$hardcode_shlibpath_var"; then
  7613. add_shlibpath=$dir
  7614. add=-l$name
  7615. else
  7616. lib_linked=no
  7617. fi
  7618. ;;
  7619. relink)
  7620. if test yes = "$hardcode_direct" &&
  7621. test no = "$hardcode_direct_absolute"; then
  7622. add=$dir/$linklib
  7623. elif test yes = "$hardcode_minus_L"; then
  7624. add_dir=-L$absdir
  7625. # Try looking first in the location we're being installed to.
  7626. if test -n "$inst_prefix_dir"; then
  7627. case $libdir in
  7628. [\\/]*)
  7629. func_append add_dir " -L$inst_prefix_dir$libdir"
  7630. ;;
  7631. esac
  7632. fi
  7633. add=-l$name
  7634. elif test yes = "$hardcode_shlibpath_var"; then
  7635. add_shlibpath=$dir
  7636. add=-l$name
  7637. else
  7638. lib_linked=no
  7639. fi
  7640. ;;
  7641. *) lib_linked=no ;;
  7642. esac
  7643. if test yes != "$lib_linked"; then
  7644. func_fatal_configuration "unsupported hardcode properties"
  7645. fi
  7646. if test -n "$add_shlibpath"; then
  7647. case :$compile_shlibpath: in
  7648. *":$add_shlibpath:"*) ;;
  7649. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  7650. esac
  7651. fi
  7652. if test prog = "$linkmode"; then
  7653. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  7654. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  7655. else
  7656. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7657. test -n "$add" && deplibs="$add $deplibs"
  7658. if test yes != "$hardcode_direct" &&
  7659. test yes != "$hardcode_minus_L" &&
  7660. test yes = "$hardcode_shlibpath_var"; then
  7661. case :$finalize_shlibpath: in
  7662. *":$libdir:"*) ;;
  7663. *) func_append finalize_shlibpath "$libdir:" ;;
  7664. esac
  7665. fi
  7666. fi
  7667. fi
  7668. if test prog = "$linkmode" || test relink = "$opt_mode"; then
  7669. add_shlibpath=
  7670. add_dir=
  7671. add=
  7672. # Finalize command for both is simple: just hardcode it.
  7673. if test yes = "$hardcode_direct" &&
  7674. test no = "$hardcode_direct_absolute"; then
  7675. add=$libdir/$linklib
  7676. elif test yes = "$hardcode_minus_L"; then
  7677. add_dir=-L$libdir
  7678. add=-l$name
  7679. elif test yes = "$hardcode_shlibpath_var"; then
  7680. case :$finalize_shlibpath: in
  7681. *":$libdir:"*) ;;
  7682. *) func_append finalize_shlibpath "$libdir:" ;;
  7683. esac
  7684. add=-l$name
  7685. elif test yes = "$hardcode_automatic"; then
  7686. if test -n "$inst_prefix_dir" &&
  7687. test -f "$inst_prefix_dir$libdir/$linklib"; then
  7688. add=$inst_prefix_dir$libdir/$linklib
  7689. else
  7690. add=$libdir/$linklib
  7691. fi
  7692. else
  7693. # We cannot seem to hardcode it, guess we'll fake it.
  7694. add_dir=-L$libdir
  7695. # Try looking first in the location we're being installed to.
  7696. if test -n "$inst_prefix_dir"; then
  7697. case $libdir in
  7698. [\\/]*)
  7699. func_append add_dir " -L$inst_prefix_dir$libdir"
  7700. ;;
  7701. esac
  7702. fi
  7703. add=-l$name
  7704. fi
  7705. if test prog = "$linkmode"; then
  7706. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  7707. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  7708. else
  7709. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7710. test -n "$add" && deplibs="$add $deplibs"
  7711. fi
  7712. fi
  7713. elif test prog = "$linkmode"; then
  7714. # Here we assume that one of hardcode_direct or hardcode_minus_L
  7715. # is not unsupported. This is valid on all known static and
  7716. # shared platforms.
  7717. if test unsupported != "$hardcode_direct"; then
  7718. test -n "$old_library" && linklib=$old_library
  7719. compile_deplibs="$dir/$linklib $compile_deplibs"
  7720. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  7721. else
  7722. compile_deplibs="-l$name -L$dir $compile_deplibs"
  7723. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  7724. fi
  7725. elif test yes = "$build_libtool_libs"; then
  7726. # Not a shared library
  7727. if test pass_all != "$deplibs_check_method"; then
  7728. # We're trying link a shared library against a static one
  7729. # but the system doesn't support it.
  7730. # Just print a warning and add the library to dependency_libs so
  7731. # that the program can be linked against the static library.
  7732. echo
  7733. $ECHO "*** Warning: This system cannot link to static lib archive $lib."
  7734. echo "*** I have the capability to make that library automatically link in when"
  7735. echo "*** you link to this library. But I can only do this if you have a"
  7736. echo "*** shared version of the library, which you do not appear to have."
  7737. if test yes = "$module"; then
  7738. echo "*** But as you try to build a module library, libtool will still create "
  7739. echo "*** a static module, that should work as long as the dlopening application"
  7740. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  7741. if test -z "$global_symbol_pipe"; then
  7742. echo
  7743. echo "*** However, this would only work if libtool was able to extract symbol"
  7744. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  7745. echo "*** not find such a program. So, this module is probably useless."
  7746. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  7747. fi
  7748. if test no = "$build_old_libs"; then
  7749. build_libtool_libs=module
  7750. build_old_libs=yes
  7751. else
  7752. build_libtool_libs=no
  7753. fi
  7754. fi
  7755. else
  7756. deplibs="$dir/$old_library $deplibs"
  7757. link_static=yes
  7758. fi
  7759. fi # link shared/static library?
  7760. if test lib = "$linkmode"; then
  7761. if test -n "$dependency_libs" &&
  7762. { test yes != "$hardcode_into_libs" ||
  7763. test yes = "$build_old_libs" ||
  7764. test yes = "$link_static"; }; then
  7765. # Extract -R from dependency_libs
  7766. temp_deplibs=
  7767. for libdir in $dependency_libs; do
  7768. case $libdir in
  7769. -R*) func_stripname '-R' '' "$libdir"
  7770. temp_xrpath=$func_stripname_result
  7771. case " $xrpath " in
  7772. *" $temp_xrpath "*) ;;
  7773. *) func_append xrpath " $temp_xrpath";;
  7774. esac;;
  7775. *) func_append temp_deplibs " $libdir";;
  7776. esac
  7777. done
  7778. dependency_libs=$temp_deplibs
  7779. fi
  7780. func_append newlib_search_path " $absdir"
  7781. # Link against this library
  7782. test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  7783. # ... and its dependency_libs
  7784. tmp_libs=
  7785. for deplib in $dependency_libs; do
  7786. newdependency_libs="$deplib $newdependency_libs"
  7787. case $deplib in
  7788. -L*) func_stripname '-L' '' "$deplib"
  7789. func_resolve_sysroot "$func_stripname_result";;
  7790. *) func_resolve_sysroot "$deplib" ;;
  7791. esac
  7792. if $opt_preserve_dup_deps; then
  7793. case "$tmp_libs " in
  7794. *" $func_resolve_sysroot_result "*)
  7795. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  7796. esac
  7797. fi
  7798. func_append tmp_libs " $func_resolve_sysroot_result"
  7799. done
  7800. if test no != "$link_all_deplibs"; then
  7801. # Add the search paths of all dependency libraries
  7802. for deplib in $dependency_libs; do
  7803. path=
  7804. case $deplib in
  7805. -L*) path=$deplib ;;
  7806. *.la)
  7807. func_resolve_sysroot "$deplib"
  7808. deplib=$func_resolve_sysroot_result
  7809. func_dirname "$deplib" "" "."
  7810. dir=$func_dirname_result
  7811. # We need an absolute path.
  7812. case $dir in
  7813. [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
  7814. *)
  7815. absdir=`cd "$dir" && pwd`
  7816. if test -z "$absdir"; then
  7817. func_warning "cannot determine absolute directory name of '$dir'"
  7818. absdir=$dir
  7819. fi
  7820. ;;
  7821. esac
  7822. if $GREP "^installed=no" $deplib > /dev/null; then
  7823. case $host in
  7824. *-*-darwin*)
  7825. depdepl=
  7826. eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  7827. if test -n "$deplibrary_names"; then
  7828. for tmp in $deplibrary_names; do
  7829. depdepl=$tmp
  7830. done
  7831. if test -f "$absdir/$objdir/$depdepl"; then
  7832. depdepl=$absdir/$objdir/$depdepl
  7833. darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7834. if test -z "$darwin_install_name"; then
  7835. darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7836. fi
  7837. func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
  7838. func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
  7839. path=
  7840. fi
  7841. fi
  7842. ;;
  7843. *)
  7844. path=-L$absdir/$objdir
  7845. ;;
  7846. esac
  7847. else
  7848. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7849. test -z "$libdir" && \
  7850. func_fatal_error "'$deplib' is not a valid libtool archive"
  7851. test "$absdir" != "$libdir" && \
  7852. func_warning "'$deplib' seems to be moved"
  7853. path=-L$absdir
  7854. fi
  7855. ;;
  7856. esac
  7857. case " $deplibs " in
  7858. *" $path "*) ;;
  7859. *) deplibs="$path $deplibs" ;;
  7860. esac
  7861. done
  7862. fi # link_all_deplibs != no
  7863. fi # linkmode = lib
  7864. done # for deplib in $libs
  7865. if test link = "$pass"; then
  7866. if test prog = "$linkmode"; then
  7867. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  7868. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  7869. else
  7870. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7871. fi
  7872. fi
  7873. dependency_libs=$newdependency_libs
  7874. if test dlpreopen = "$pass"; then
  7875. # Link the dlpreopened libraries before other libraries
  7876. for deplib in $save_deplibs; do
  7877. deplibs="$deplib $deplibs"
  7878. done
  7879. fi
  7880. if test dlopen != "$pass"; then
  7881. test conv = "$pass" || {
  7882. # Make sure lib_search_path contains only unique directories.
  7883. lib_search_path=
  7884. for dir in $newlib_search_path; do
  7885. case "$lib_search_path " in
  7886. *" $dir "*) ;;
  7887. *) func_append lib_search_path " $dir" ;;
  7888. esac
  7889. done
  7890. newlib_search_path=
  7891. }
  7892. if test prog,link = "$linkmode,$pass"; then
  7893. vars="compile_deplibs finalize_deplibs"
  7894. else
  7895. vars=deplibs
  7896. fi
  7897. for var in $vars dependency_libs; do
  7898. # Add libraries to $var in reverse order
  7899. eval tmp_libs=\"\$$var\"
  7900. new_libs=
  7901. for deplib in $tmp_libs; do
  7902. # FIXME: Pedantically, this is the right thing to do, so
  7903. # that some nasty dependency loop isn't accidentally
  7904. # broken:
  7905. #new_libs="$deplib $new_libs"
  7906. # Pragmatically, this seems to cause very few problems in
  7907. # practice:
  7908. case $deplib in
  7909. -L*) new_libs="$deplib $new_libs" ;;
  7910. -R*) ;;
  7911. *)
  7912. # And here is the reason: when a library appears more
  7913. # than once as an explicit dependence of a library, or
  7914. # is implicitly linked in more than once by the
  7915. # compiler, it is considered special, and multiple
  7916. # occurrences thereof are not removed. Compare this
  7917. # with having the same library being listed as a
  7918. # dependency of multiple other libraries: in this case,
  7919. # we know (pedantically, we assume) the library does not
  7920. # need to be listed more than once, so we keep only the
  7921. # last copy. This is not always right, but it is rare
  7922. # enough that we require users that really mean to play
  7923. # such unportable linking tricks to link the library
  7924. # using -Wl,-lname, so that libtool does not consider it
  7925. # for duplicate removal.
  7926. case " $specialdeplibs " in
  7927. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  7928. *)
  7929. case " $new_libs " in
  7930. *" $deplib "*) ;;
  7931. *) new_libs="$deplib $new_libs" ;;
  7932. esac
  7933. ;;
  7934. esac
  7935. ;;
  7936. esac
  7937. done
  7938. tmp_libs=
  7939. for deplib in $new_libs; do
  7940. case $deplib in
  7941. -L*)
  7942. case " $tmp_libs " in
  7943. *" $deplib "*) ;;
  7944. *) func_append tmp_libs " $deplib" ;;
  7945. esac
  7946. ;;
  7947. *) func_append tmp_libs " $deplib" ;;
  7948. esac
  7949. done
  7950. eval $var=\"$tmp_libs\"
  7951. done # for var
  7952. fi
  7953. # Add Sun CC postdeps if required:
  7954. test CXX = "$tagname" && {
  7955. case $host_os in
  7956. linux*)
  7957. case `$CC -V 2>&1 | sed 5q` in
  7958. *Sun\ C*) # Sun C++ 5.9
  7959. func_suncc_cstd_abi
  7960. if test no != "$suncc_use_cstd_abi"; then
  7961. func_append postdeps ' -library=Cstd -library=Crun'
  7962. fi
  7963. ;;
  7964. esac
  7965. ;;
  7966. solaris*)
  7967. func_cc_basename "$CC"
  7968. case $func_cc_basename_result in
  7969. CC* | sunCC*)
  7970. func_suncc_cstd_abi
  7971. if test no != "$suncc_use_cstd_abi"; then
  7972. func_append postdeps ' -library=Cstd -library=Crun'
  7973. fi
  7974. ;;
  7975. esac
  7976. ;;
  7977. esac
  7978. }
  7979. # Last step: remove runtime libs from dependency_libs
  7980. # (they stay in deplibs)
  7981. tmp_libs=
  7982. for i in $dependency_libs; do
  7983. case " $predeps $postdeps $compiler_lib_search_path " in
  7984. *" $i "*)
  7985. i=
  7986. ;;
  7987. esac
  7988. if test -n "$i"; then
  7989. func_append tmp_libs " $i"
  7990. fi
  7991. done
  7992. dependency_libs=$tmp_libs
  7993. done # for pass
  7994. if test prog = "$linkmode"; then
  7995. dlfiles=$newdlfiles
  7996. fi
  7997. if test prog = "$linkmode" || test lib = "$linkmode"; then
  7998. dlprefiles=$newdlprefiles
  7999. fi
  8000. case $linkmode in
  8001. oldlib)
  8002. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  8003. func_warning "'-dlopen' is ignored for archives"
  8004. fi
  8005. case " $deplibs" in
  8006. *\ -l* | *\ -L*)
  8007. func_warning "'-l' and '-L' are ignored for archives" ;;
  8008. esac
  8009. test -n "$rpath" && \
  8010. func_warning "'-rpath' is ignored for archives"
  8011. test -n "$xrpath" && \
  8012. func_warning "'-R' is ignored for archives"
  8013. test -n "$vinfo" && \
  8014. func_warning "'-version-info/-version-number' is ignored for archives"
  8015. test -n "$release" && \
  8016. func_warning "'-release' is ignored for archives"
  8017. test -n "$export_symbols$export_symbols_regex" && \
  8018. func_warning "'-export-symbols' is ignored for archives"
  8019. # Now set the variables for building old libraries.
  8020. build_libtool_libs=no
  8021. oldlibs=$output
  8022. func_append objs "$old_deplibs"
  8023. ;;
  8024. lib)
  8025. # Make sure we only generate libraries of the form 'libNAME.la'.
  8026. case $outputname in
  8027. lib*)
  8028. func_stripname 'lib' '.la' "$outputname"
  8029. name=$func_stripname_result
  8030. eval shared_ext=\"$shrext_cmds\"
  8031. eval libname=\"$libname_spec\"
  8032. ;;
  8033. *)
  8034. test no = "$module" \
  8035. && func_fatal_help "libtool library '$output' must begin with 'lib'"
  8036. if test no != "$need_lib_prefix"; then
  8037. # Add the "lib" prefix for modules if required
  8038. func_stripname '' '.la' "$outputname"
  8039. name=$func_stripname_result
  8040. eval shared_ext=\"$shrext_cmds\"
  8041. eval libname=\"$libname_spec\"
  8042. else
  8043. func_stripname '' '.la' "$outputname"
  8044. libname=$func_stripname_result
  8045. fi
  8046. ;;
  8047. esac
  8048. if test -n "$objs"; then
  8049. if test pass_all != "$deplibs_check_method"; then
  8050. func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
  8051. else
  8052. echo
  8053. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  8054. $ECHO "*** objects $objs is not portable!"
  8055. func_append libobjs " $objs"
  8056. fi
  8057. fi
  8058. test no = "$dlself" \
  8059. || func_warning "'-dlopen self' is ignored for libtool libraries"
  8060. set dummy $rpath
  8061. shift
  8062. test 1 -lt "$#" \
  8063. && func_warning "ignoring multiple '-rpath's for a libtool library"
  8064. install_libdir=$1
  8065. oldlibs=
  8066. if test -z "$rpath"; then
  8067. if test yes = "$build_libtool_libs"; then
  8068. # Building a libtool convenience library.
  8069. # Some compilers have problems with a '.al' extension so
  8070. # convenience libraries should have the same extension an
  8071. # archive normally would.
  8072. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  8073. build_libtool_libs=convenience
  8074. build_old_libs=yes
  8075. fi
  8076. test -n "$vinfo" && \
  8077. func_warning "'-version-info/-version-number' is ignored for convenience libraries"
  8078. test -n "$release" && \
  8079. func_warning "'-release' is ignored for convenience libraries"
  8080. else
  8081. # Parse the version information argument.
  8082. save_ifs=$IFS; IFS=:
  8083. set dummy $vinfo 0 0 0
  8084. shift
  8085. IFS=$save_ifs
  8086. test -n "$7" && \
  8087. func_fatal_help "too many parameters to '-version-info'"
  8088. # convert absolute version numbers to libtool ages
  8089. # this retains compatibility with .la files and attempts
  8090. # to make the code below a bit more comprehensible
  8091. case $vinfo_number in
  8092. yes)
  8093. number_major=$1
  8094. number_minor=$2
  8095. number_revision=$3
  8096. #
  8097. # There are really only two kinds -- those that
  8098. # use the current revision as the major version
  8099. # and those that subtract age and use age as
  8100. # a minor version. But, then there is irix
  8101. # that has an extra 1 added just for fun
  8102. #
  8103. case $version_type in
  8104. # correct linux to gnu/linux during the next big refactor
  8105. darwin|freebsd-elf|linux|osf|windows|none)
  8106. func_arith $number_major + $number_minor
  8107. current=$func_arith_result
  8108. age=$number_minor
  8109. revision=$number_revision
  8110. ;;
  8111. freebsd-aout|qnx|sunos)
  8112. current=$number_major
  8113. revision=$number_minor
  8114. age=0
  8115. ;;
  8116. irix|nonstopux)
  8117. func_arith $number_major + $number_minor
  8118. current=$func_arith_result
  8119. age=$number_minor
  8120. revision=$number_minor
  8121. lt_irix_increment=no
  8122. ;;
  8123. *)
  8124. func_fatal_configuration "$modename: unknown library version type '$version_type'"
  8125. ;;
  8126. esac
  8127. ;;
  8128. no)
  8129. current=$1
  8130. revision=$2
  8131. age=$3
  8132. ;;
  8133. esac
  8134. # Check that each of the things are valid numbers.
  8135. case $current in
  8136. 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]) ;;
  8137. *)
  8138. func_error "CURRENT '$current' must be a nonnegative integer"
  8139. func_fatal_error "'$vinfo' is not valid version information"
  8140. ;;
  8141. esac
  8142. case $revision in
  8143. 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]) ;;
  8144. *)
  8145. func_error "REVISION '$revision' must be a nonnegative integer"
  8146. func_fatal_error "'$vinfo' is not valid version information"
  8147. ;;
  8148. esac
  8149. case $age in
  8150. 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]) ;;
  8151. *)
  8152. func_error "AGE '$age' must be a nonnegative integer"
  8153. func_fatal_error "'$vinfo' is not valid version information"
  8154. ;;
  8155. esac
  8156. if test "$age" -gt "$current"; then
  8157. func_error "AGE '$age' is greater than the current interface number '$current'"
  8158. func_fatal_error "'$vinfo' is not valid version information"
  8159. fi
  8160. # Calculate the version variables.
  8161. major=
  8162. versuffix=
  8163. verstring=
  8164. case $version_type in
  8165. none) ;;
  8166. darwin)
  8167. # Like Linux, but with the current version available in
  8168. # verstring for coding it into the library header
  8169. func_arith $current - $age
  8170. major=.$func_arith_result
  8171. versuffix=$major.$age.$revision
  8172. # Darwin ld doesn't like 0 for these options...
  8173. func_arith $current + 1
  8174. minor_current=$func_arith_result
  8175. xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8176. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8177. # On Darwin other compilers
  8178. case $CC in
  8179. nagfor*)
  8180. verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8181. ;;
  8182. *)
  8183. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8184. ;;
  8185. esac
  8186. ;;
  8187. freebsd-aout)
  8188. major=.$current
  8189. versuffix=.$current.$revision
  8190. ;;
  8191. freebsd-elf)
  8192. func_arith $current - $age
  8193. major=.$func_arith_result
  8194. versuffix=$major.$age.$revision
  8195. ;;
  8196. irix | nonstopux)
  8197. if test no = "$lt_irix_increment"; then
  8198. func_arith $current - $age
  8199. else
  8200. func_arith $current - $age + 1
  8201. fi
  8202. major=$func_arith_result
  8203. case $version_type in
  8204. nonstopux) verstring_prefix=nonstopux ;;
  8205. *) verstring_prefix=sgi ;;
  8206. esac
  8207. verstring=$verstring_prefix$major.$revision
  8208. # Add in all the interfaces that we are compatible with.
  8209. loop=$revision
  8210. while test 0 -ne "$loop"; do
  8211. func_arith $revision - $loop
  8212. iface=$func_arith_result
  8213. func_arith $loop - 1
  8214. loop=$func_arith_result
  8215. verstring=$verstring_prefix$major.$iface:$verstring
  8216. done
  8217. # Before this point, $major must not contain '.'.
  8218. major=.$major
  8219. versuffix=$major.$revision
  8220. ;;
  8221. linux) # correct to gnu/linux during the next big refactor
  8222. func_arith $current - $age
  8223. major=.$func_arith_result
  8224. versuffix=$major.$age.$revision
  8225. ;;
  8226. osf)
  8227. func_arith $current - $age
  8228. major=.$func_arith_result
  8229. versuffix=.$current.$age.$revision
  8230. verstring=$current.$age.$revision
  8231. # Add in all the interfaces that we are compatible with.
  8232. loop=$age
  8233. while test 0 -ne "$loop"; do
  8234. func_arith $current - $loop
  8235. iface=$func_arith_result
  8236. func_arith $loop - 1
  8237. loop=$func_arith_result
  8238. verstring=$verstring:$iface.0
  8239. done
  8240. # Make executables depend on our current version.
  8241. func_append verstring ":$current.0"
  8242. ;;
  8243. qnx)
  8244. major=.$current
  8245. versuffix=.$current
  8246. ;;
  8247. sco)
  8248. major=.$current
  8249. versuffix=.$current
  8250. ;;
  8251. sunos)
  8252. major=.$current
  8253. versuffix=.$current.$revision
  8254. ;;
  8255. windows)
  8256. # Use '-' rather than '.', since we only want one
  8257. # extension on DOS 8.3 file systems.
  8258. func_arith $current - $age
  8259. major=$func_arith_result
  8260. versuffix=-$major
  8261. ;;
  8262. *)
  8263. func_fatal_configuration "unknown library version type '$version_type'"
  8264. ;;
  8265. esac
  8266. # Clear the version info if we defaulted, and they specified a release.
  8267. if test -z "$vinfo" && test -n "$release"; then
  8268. major=
  8269. case $version_type in
  8270. darwin)
  8271. # we can't check for "0.0" in archive_cmds due to quoting
  8272. # problems, so we reset it completely
  8273. verstring=
  8274. ;;
  8275. *)
  8276. verstring=0.0
  8277. ;;
  8278. esac
  8279. if test no = "$need_version"; then
  8280. versuffix=
  8281. else
  8282. versuffix=.0.0
  8283. fi
  8284. fi
  8285. # Remove version info from name if versioning should be avoided
  8286. if test yes,no = "$avoid_version,$need_version"; then
  8287. major=
  8288. versuffix=
  8289. verstring=
  8290. fi
  8291. # Check to see if the archive will have undefined symbols.
  8292. if test yes = "$allow_undefined"; then
  8293. if test unsupported = "$allow_undefined_flag"; then
  8294. if test yes = "$build_old_libs"; then
  8295. func_warning "undefined symbols not allowed in $host shared libraries; building static only"
  8296. build_libtool_libs=no
  8297. else
  8298. func_fatal_error "can't build $host shared library unless -no-undefined is specified"
  8299. fi
  8300. fi
  8301. else
  8302. # Don't allow undefined symbols.
  8303. allow_undefined_flag=$no_undefined_flag
  8304. fi
  8305. fi
  8306. func_generate_dlsyms "$libname" "$libname" :
  8307. func_append libobjs " $symfileobj"
  8308. test " " = "$libobjs" && libobjs=
  8309. if test relink != "$opt_mode"; then
  8310. # Remove our outputs, but don't remove object files since they
  8311. # may have been created when compiling PIC objects.
  8312. removelist=
  8313. tempremovelist=`$ECHO "$output_objdir/*"`
  8314. for p in $tempremovelist; do
  8315. case $p in
  8316. *.$objext | *.gcno)
  8317. ;;
  8318. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
  8319. if test -n "$precious_files_regex"; then
  8320. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  8321. then
  8322. continue
  8323. fi
  8324. fi
  8325. func_append removelist " $p"
  8326. ;;
  8327. *) ;;
  8328. esac
  8329. done
  8330. test -n "$removelist" && \
  8331. func_show_eval "${RM}r \$removelist"
  8332. fi
  8333. # Now set the variables for building old libraries.
  8334. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
  8335. func_append oldlibs " $output_objdir/$libname.$libext"
  8336. # Transform .lo files to .o files.
  8337. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
  8338. fi
  8339. # Eliminate all temporary directories.
  8340. #for path in $notinst_path; do
  8341. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  8342. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  8343. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  8344. #done
  8345. if test -n "$xrpath"; then
  8346. # If the user specified any rpath flags, then add them.
  8347. temp_xrpath=
  8348. for libdir in $xrpath; do
  8349. func_replace_sysroot "$libdir"
  8350. func_append temp_xrpath " -R$func_replace_sysroot_result"
  8351. case "$finalize_rpath " in
  8352. *" $libdir "*) ;;
  8353. *) func_append finalize_rpath " $libdir" ;;
  8354. esac
  8355. done
  8356. if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
  8357. dependency_libs="$temp_xrpath $dependency_libs"
  8358. fi
  8359. fi
  8360. # Make sure dlfiles contains only unique files that won't be dlpreopened
  8361. old_dlfiles=$dlfiles
  8362. dlfiles=
  8363. for lib in $old_dlfiles; do
  8364. case " $dlprefiles $dlfiles " in
  8365. *" $lib "*) ;;
  8366. *) func_append dlfiles " $lib" ;;
  8367. esac
  8368. done
  8369. # Make sure dlprefiles contains only unique files
  8370. old_dlprefiles=$dlprefiles
  8371. dlprefiles=
  8372. for lib in $old_dlprefiles; do
  8373. case "$dlprefiles " in
  8374. *" $lib "*) ;;
  8375. *) func_append dlprefiles " $lib" ;;
  8376. esac
  8377. done
  8378. if test yes = "$build_libtool_libs"; then
  8379. if test -n "$rpath"; then
  8380. case $host in
  8381. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  8382. # these systems don't actually have a c library (as such)!
  8383. ;;
  8384. *-*-rhapsody* | *-*-darwin1.[012])
  8385. # Rhapsody C library is in the System framework
  8386. func_append deplibs " System.ltframework"
  8387. ;;
  8388. *-*-netbsd*)
  8389. # Don't link with libc until the a.out ld.so is fixed.
  8390. ;;
  8391. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  8392. # Do not include libc due to us having libc/libc_r.
  8393. ;;
  8394. *-*-sco3.2v5* | *-*-sco5v6*)
  8395. # Causes problems with __ctype
  8396. ;;
  8397. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  8398. # Compiler inserts libc in the correct place for threads to work
  8399. ;;
  8400. *)
  8401. # Add libc to deplibs on all other systems if necessary.
  8402. if test yes = "$build_libtool_need_lc"; then
  8403. func_append deplibs " -lc"
  8404. fi
  8405. ;;
  8406. esac
  8407. fi
  8408. # Transform deplibs into only deplibs that can be linked in shared.
  8409. name_save=$name
  8410. libname_save=$libname
  8411. release_save=$release
  8412. versuffix_save=$versuffix
  8413. major_save=$major
  8414. # I'm not sure if I'm treating the release correctly. I think
  8415. # release should show up in the -l (ie -lgmp5) so we don't want to
  8416. # add it in twice. Is that correct?
  8417. release=
  8418. versuffix=
  8419. major=
  8420. newdeplibs=
  8421. droppeddeps=no
  8422. case $deplibs_check_method in
  8423. pass_all)
  8424. # Don't check for shared/static. Everything works.
  8425. # This might be a little naive. We might want to check
  8426. # whether the library exists or not. But this is on
  8427. # osf3 & osf4 and I'm not really sure... Just
  8428. # implementing what was already the behavior.
  8429. newdeplibs=$deplibs
  8430. ;;
  8431. test_compile)
  8432. # This code stresses the "libraries are programs" paradigm to its
  8433. # limits. Maybe even breaks it. We compile a program, linking it
  8434. # against the deplibs as a proxy for the library. Then we can check
  8435. # whether they linked in statically or dynamically with ldd.
  8436. $opt_dry_run || $RM conftest.c
  8437. cat > conftest.c <<EOF
  8438. int main() { return 0; }
  8439. EOF
  8440. $opt_dry_run || $RM conftest
  8441. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  8442. ldd_output=`ldd conftest`
  8443. for i in $deplibs; do
  8444. case $i in
  8445. -l*)
  8446. func_stripname -l '' "$i"
  8447. name=$func_stripname_result
  8448. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8449. case " $predeps $postdeps " in
  8450. *" $i "*)
  8451. func_append newdeplibs " $i"
  8452. i=
  8453. ;;
  8454. esac
  8455. fi
  8456. if test -n "$i"; then
  8457. libname=`eval "\\$ECHO \"$libname_spec\""`
  8458. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8459. set dummy $deplib_matches; shift
  8460. deplib_match=$1
  8461. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8462. func_append newdeplibs " $i"
  8463. else
  8464. droppeddeps=yes
  8465. echo
  8466. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8467. echo "*** I have the capability to make that library automatically link in when"
  8468. echo "*** you link to this library. But I can only do this if you have a"
  8469. echo "*** shared version of the library, which I believe you do not have"
  8470. echo "*** because a test_compile did reveal that the linker did not use it for"
  8471. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  8472. fi
  8473. fi
  8474. ;;
  8475. *)
  8476. func_append newdeplibs " $i"
  8477. ;;
  8478. esac
  8479. done
  8480. else
  8481. # Error occurred in the first compile. Let's try to salvage
  8482. # the situation: Compile a separate program for each library.
  8483. for i in $deplibs; do
  8484. case $i in
  8485. -l*)
  8486. func_stripname -l '' "$i"
  8487. name=$func_stripname_result
  8488. $opt_dry_run || $RM conftest
  8489. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  8490. ldd_output=`ldd conftest`
  8491. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8492. case " $predeps $postdeps " in
  8493. *" $i "*)
  8494. func_append newdeplibs " $i"
  8495. i=
  8496. ;;
  8497. esac
  8498. fi
  8499. if test -n "$i"; then
  8500. libname=`eval "\\$ECHO \"$libname_spec\""`
  8501. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8502. set dummy $deplib_matches; shift
  8503. deplib_match=$1
  8504. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8505. func_append newdeplibs " $i"
  8506. else
  8507. droppeddeps=yes
  8508. echo
  8509. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8510. echo "*** I have the capability to make that library automatically link in when"
  8511. echo "*** you link to this library. But I can only do this if you have a"
  8512. echo "*** shared version of the library, which you do not appear to have"
  8513. echo "*** because a test_compile did reveal that the linker did not use this one"
  8514. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  8515. fi
  8516. fi
  8517. else
  8518. droppeddeps=yes
  8519. echo
  8520. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  8521. echo "*** make it link in! You will probably need to install it or some"
  8522. echo "*** library that it depends on before this library will be fully"
  8523. echo "*** functional. Installing it before continuing would be even better."
  8524. fi
  8525. ;;
  8526. *)
  8527. func_append newdeplibs " $i"
  8528. ;;
  8529. esac
  8530. done
  8531. fi
  8532. ;;
  8533. file_magic*)
  8534. set dummy $deplibs_check_method; shift
  8535. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8536. for a_deplib in $deplibs; do
  8537. case $a_deplib in
  8538. -l*)
  8539. func_stripname -l '' "$a_deplib"
  8540. name=$func_stripname_result
  8541. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8542. case " $predeps $postdeps " in
  8543. *" $a_deplib "*)
  8544. func_append newdeplibs " $a_deplib"
  8545. a_deplib=
  8546. ;;
  8547. esac
  8548. fi
  8549. if test -n "$a_deplib"; then
  8550. libname=`eval "\\$ECHO \"$libname_spec\""`
  8551. if test -n "$file_magic_glob"; then
  8552. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  8553. else
  8554. libnameglob=$libname
  8555. fi
  8556. test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  8557. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8558. if test yes = "$want_nocaseglob"; then
  8559. shopt -s nocaseglob
  8560. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8561. $nocaseglob
  8562. else
  8563. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8564. fi
  8565. for potent_lib in $potential_libs; do
  8566. # Follow soft links.
  8567. if ls -lLd "$potent_lib" 2>/dev/null |
  8568. $GREP " -> " >/dev/null; then
  8569. continue
  8570. fi
  8571. # The statement above tries to avoid entering an
  8572. # endless loop below, in case of cyclic links.
  8573. # We might still enter an endless loop, since a link
  8574. # loop can be closed while we follow links,
  8575. # but so what?
  8576. potlib=$potent_lib
  8577. while test -h "$potlib" 2>/dev/null; do
  8578. potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  8579. case $potliblink in
  8580. [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  8581. *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  8582. esac
  8583. done
  8584. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  8585. $SED -e 10q |
  8586. $EGREP "$file_magic_regex" > /dev/null; then
  8587. func_append newdeplibs " $a_deplib"
  8588. a_deplib=
  8589. break 2
  8590. fi
  8591. done
  8592. done
  8593. fi
  8594. if test -n "$a_deplib"; then
  8595. droppeddeps=yes
  8596. echo
  8597. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8598. echo "*** I have the capability to make that library automatically link in when"
  8599. echo "*** you link to this library. But I can only do this if you have a"
  8600. echo "*** shared version of the library, which you do not appear to have"
  8601. echo "*** because I did check the linker path looking for a file starting"
  8602. if test -z "$potlib"; then
  8603. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  8604. else
  8605. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8606. $ECHO "*** using a file magic. Last file checked: $potlib"
  8607. fi
  8608. fi
  8609. ;;
  8610. *)
  8611. # Add a -L argument.
  8612. func_append newdeplibs " $a_deplib"
  8613. ;;
  8614. esac
  8615. done # Gone through all deplibs.
  8616. ;;
  8617. match_pattern*)
  8618. set dummy $deplibs_check_method; shift
  8619. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8620. for a_deplib in $deplibs; do
  8621. case $a_deplib in
  8622. -l*)
  8623. func_stripname -l '' "$a_deplib"
  8624. name=$func_stripname_result
  8625. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8626. case " $predeps $postdeps " in
  8627. *" $a_deplib "*)
  8628. func_append newdeplibs " $a_deplib"
  8629. a_deplib=
  8630. ;;
  8631. esac
  8632. fi
  8633. if test -n "$a_deplib"; then
  8634. libname=`eval "\\$ECHO \"$libname_spec\""`
  8635. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8636. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  8637. for potent_lib in $potential_libs; do
  8638. potlib=$potent_lib # see symlink-check above in file_magic test
  8639. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  8640. $EGREP "$match_pattern_regex" > /dev/null; then
  8641. func_append newdeplibs " $a_deplib"
  8642. a_deplib=
  8643. break 2
  8644. fi
  8645. done
  8646. done
  8647. fi
  8648. if test -n "$a_deplib"; then
  8649. droppeddeps=yes
  8650. echo
  8651. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8652. echo "*** I have the capability to make that library automatically link in when"
  8653. echo "*** you link to this library. But I can only do this if you have a"
  8654. echo "*** shared version of the library, which you do not appear to have"
  8655. echo "*** because I did check the linker path looking for a file starting"
  8656. if test -z "$potlib"; then
  8657. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  8658. else
  8659. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8660. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  8661. fi
  8662. fi
  8663. ;;
  8664. *)
  8665. # Add a -L argument.
  8666. func_append newdeplibs " $a_deplib"
  8667. ;;
  8668. esac
  8669. done # Gone through all deplibs.
  8670. ;;
  8671. none | unknown | *)
  8672. newdeplibs=
  8673. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  8674. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8675. for i in $predeps $postdeps; do
  8676. # can't use Xsed below, because $i might contain '/'
  8677. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  8678. done
  8679. fi
  8680. case $tmp_deplibs in
  8681. *[!\ \ ]*)
  8682. echo
  8683. if test none = "$deplibs_check_method"; then
  8684. echo "*** Warning: inter-library dependencies are not supported in this platform."
  8685. else
  8686. echo "*** Warning: inter-library dependencies are not known to be supported."
  8687. fi
  8688. echo "*** All declared inter-library dependencies are being dropped."
  8689. droppeddeps=yes
  8690. ;;
  8691. esac
  8692. ;;
  8693. esac
  8694. versuffix=$versuffix_save
  8695. major=$major_save
  8696. release=$release_save
  8697. libname=$libname_save
  8698. name=$name_save
  8699. case $host in
  8700. *-*-rhapsody* | *-*-darwin1.[012])
  8701. # On Rhapsody replace the C library with the System framework
  8702. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  8703. ;;
  8704. esac
  8705. if test yes = "$droppeddeps"; then
  8706. if test yes = "$module"; then
  8707. echo
  8708. echo "*** Warning: libtool could not satisfy all declared inter-library"
  8709. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  8710. echo "*** a static module, that should work as long as the dlopening"
  8711. echo "*** application is linked with the -dlopen flag."
  8712. if test -z "$global_symbol_pipe"; then
  8713. echo
  8714. echo "*** However, this would only work if libtool was able to extract symbol"
  8715. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  8716. echo "*** not find such a program. So, this module is probably useless."
  8717. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  8718. fi
  8719. if test no = "$build_old_libs"; then
  8720. oldlibs=$output_objdir/$libname.$libext
  8721. build_libtool_libs=module
  8722. build_old_libs=yes
  8723. else
  8724. build_libtool_libs=no
  8725. fi
  8726. else
  8727. echo "*** The inter-library dependencies that have been dropped here will be"
  8728. echo "*** automatically added whenever a program is linked with this library"
  8729. echo "*** or is declared to -dlopen it."
  8730. if test no = "$allow_undefined"; then
  8731. echo
  8732. echo "*** Since this library must not contain undefined symbols,"
  8733. echo "*** because either the platform does not support them or"
  8734. echo "*** it was explicitly requested with -no-undefined,"
  8735. echo "*** libtool will only create a static version of it."
  8736. if test no = "$build_old_libs"; then
  8737. oldlibs=$output_objdir/$libname.$libext
  8738. build_libtool_libs=module
  8739. build_old_libs=yes
  8740. else
  8741. build_libtool_libs=no
  8742. fi
  8743. fi
  8744. fi
  8745. fi
  8746. # Done checking deplibs!
  8747. deplibs=$newdeplibs
  8748. fi
  8749. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  8750. case $host in
  8751. *-*-darwin*)
  8752. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8753. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8754. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8755. ;;
  8756. esac
  8757. # move library search paths that coincide with paths to not yet
  8758. # installed libraries to the beginning of the library search list
  8759. new_libs=
  8760. for path in $notinst_path; do
  8761. case " $new_libs " in
  8762. *" -L$path/$objdir "*) ;;
  8763. *)
  8764. case " $deplibs " in
  8765. *" -L$path/$objdir "*)
  8766. func_append new_libs " -L$path/$objdir" ;;
  8767. esac
  8768. ;;
  8769. esac
  8770. done
  8771. for deplib in $deplibs; do
  8772. case $deplib in
  8773. -L*)
  8774. case " $new_libs " in
  8775. *" $deplib "*) ;;
  8776. *) func_append new_libs " $deplib" ;;
  8777. esac
  8778. ;;
  8779. *) func_append new_libs " $deplib" ;;
  8780. esac
  8781. done
  8782. deplibs=$new_libs
  8783. # All the library-specific variables (install_libdir is set above).
  8784. library_names=
  8785. old_library=
  8786. dlname=
  8787. # Test again, we may have decided not to build it any more
  8788. if test yes = "$build_libtool_libs"; then
  8789. # Remove $wl instances when linking with ld.
  8790. # FIXME: should test the right _cmds variable.
  8791. case $archive_cmds in
  8792. *\$LD\ *) wl= ;;
  8793. esac
  8794. if test yes = "$hardcode_into_libs"; then
  8795. # Hardcode the library paths
  8796. hardcode_libdirs=
  8797. dep_rpath=
  8798. rpath=$finalize_rpath
  8799. test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  8800. for libdir in $rpath; do
  8801. if test -n "$hardcode_libdir_flag_spec"; then
  8802. if test -n "$hardcode_libdir_separator"; then
  8803. func_replace_sysroot "$libdir"
  8804. libdir=$func_replace_sysroot_result
  8805. if test -z "$hardcode_libdirs"; then
  8806. hardcode_libdirs=$libdir
  8807. else
  8808. # Just accumulate the unique libdirs.
  8809. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  8810. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  8811. ;;
  8812. *)
  8813. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  8814. ;;
  8815. esac
  8816. fi
  8817. else
  8818. eval flag=\"$hardcode_libdir_flag_spec\"
  8819. func_append dep_rpath " $flag"
  8820. fi
  8821. elif test -n "$runpath_var"; then
  8822. case "$perm_rpath " in
  8823. *" $libdir "*) ;;
  8824. *) func_append perm_rpath " $libdir" ;;
  8825. esac
  8826. fi
  8827. done
  8828. # Substitute the hardcoded libdirs into the rpath.
  8829. if test -n "$hardcode_libdir_separator" &&
  8830. test -n "$hardcode_libdirs"; then
  8831. libdir=$hardcode_libdirs
  8832. eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  8833. fi
  8834. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  8835. # We should set the runpath_var.
  8836. rpath=
  8837. for dir in $perm_rpath; do
  8838. func_append rpath "$dir:"
  8839. done
  8840. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  8841. fi
  8842. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  8843. fi
  8844. shlibpath=$finalize_shlibpath
  8845. test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  8846. if test -n "$shlibpath"; then
  8847. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  8848. fi
  8849. # Get the real and link names of the library.
  8850. eval shared_ext=\"$shrext_cmds\"
  8851. eval library_names=\"$library_names_spec\"
  8852. set dummy $library_names
  8853. shift
  8854. realname=$1
  8855. shift
  8856. if test -n "$soname_spec"; then
  8857. eval soname=\"$soname_spec\"
  8858. else
  8859. soname=$realname
  8860. fi
  8861. if test -z "$dlname"; then
  8862. dlname=$soname
  8863. fi
  8864. lib=$output_objdir/$realname
  8865. linknames=
  8866. for link
  8867. do
  8868. func_append linknames " $link"
  8869. done
  8870. # Use standard objects if they are pic
  8871. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  8872. test "X$libobjs" = "X " && libobjs=
  8873. delfiles=
  8874. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8875. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  8876. export_symbols=$output_objdir/$libname.uexp
  8877. func_append delfiles " $export_symbols"
  8878. fi
  8879. orig_export_symbols=
  8880. case $host_os in
  8881. cygwin* | mingw* | cegcc*)
  8882. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  8883. # exporting using user supplied symfile
  8884. func_dll_def_p "$export_symbols" || {
  8885. # and it's NOT already a .def file. Must figure out
  8886. # which of the given symbols are data symbols and tag
  8887. # them as such. So, trigger use of export_symbols_cmds.
  8888. # export_symbols gets reassigned inside the "prepare
  8889. # the list of exported symbols" if statement, so the
  8890. # include_expsyms logic still works.
  8891. orig_export_symbols=$export_symbols
  8892. export_symbols=
  8893. always_export_symbols=yes
  8894. }
  8895. fi
  8896. ;;
  8897. esac
  8898. # Prepare the list of exported symbols
  8899. if test -z "$export_symbols"; then
  8900. if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  8901. func_verbose "generating symbol list for '$libname.la'"
  8902. export_symbols=$output_objdir/$libname.exp
  8903. $opt_dry_run || $RM $export_symbols
  8904. cmds=$export_symbols_cmds
  8905. save_ifs=$IFS; IFS='~'
  8906. for cmd1 in $cmds; do
  8907. IFS=$save_ifs
  8908. # Take the normal branch if the nm_file_list_spec branch
  8909. # doesn't work or if tool conversion is not needed.
  8910. case $nm_file_list_spec~$to_tool_file_cmd in
  8911. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  8912. try_normal_branch=yes
  8913. eval cmd=\"$cmd1\"
  8914. func_len " $cmd"
  8915. len=$func_len_result
  8916. ;;
  8917. *)
  8918. try_normal_branch=no
  8919. ;;
  8920. esac
  8921. if test yes = "$try_normal_branch" \
  8922. && { test "$len" -lt "$max_cmd_len" \
  8923. || test "$max_cmd_len" -le -1; }
  8924. then
  8925. func_show_eval "$cmd" 'exit $?'
  8926. skipped_export=false
  8927. elif test -n "$nm_file_list_spec"; then
  8928. func_basename "$output"
  8929. output_la=$func_basename_result
  8930. save_libobjs=$libobjs
  8931. save_output=$output
  8932. output=$output_objdir/$output_la.nm
  8933. func_to_tool_file "$output"
  8934. libobjs=$nm_file_list_spec$func_to_tool_file_result
  8935. func_append delfiles " $output"
  8936. func_verbose "creating $NM input file list: $output"
  8937. for obj in $save_libobjs; do
  8938. func_to_tool_file "$obj"
  8939. $ECHO "$func_to_tool_file_result"
  8940. done > "$output"
  8941. eval cmd=\"$cmd1\"
  8942. func_show_eval "$cmd" 'exit $?'
  8943. output=$save_output
  8944. libobjs=$save_libobjs
  8945. skipped_export=false
  8946. else
  8947. # The command line is too long to execute in one step.
  8948. func_verbose "using reloadable object file for export list..."
  8949. skipped_export=:
  8950. # Break out early, otherwise skipped_export may be
  8951. # set to false by a later but shorter cmd.
  8952. break
  8953. fi
  8954. done
  8955. IFS=$save_ifs
  8956. if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  8957. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  8958. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  8959. fi
  8960. fi
  8961. fi
  8962. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8963. tmp_export_symbols=$export_symbols
  8964. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  8965. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  8966. fi
  8967. if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  8968. # The given exports_symbols file has to be filtered, so filter it.
  8969. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  8970. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  8971. # 's' commands, which not all seds can handle. GNU sed should be fine
  8972. # though. Also, the filter scales superlinearly with the number of
  8973. # global variables. join(1) would be nice here, but unfortunately
  8974. # isn't a blessed tool.
  8975. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  8976. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  8977. export_symbols=$output_objdir/$libname.def
  8978. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  8979. fi
  8980. tmp_deplibs=
  8981. for test_deplib in $deplibs; do
  8982. case " $convenience " in
  8983. *" $test_deplib "*) ;;
  8984. *)
  8985. func_append tmp_deplibs " $test_deplib"
  8986. ;;
  8987. esac
  8988. done
  8989. deplibs=$tmp_deplibs
  8990. if test -n "$convenience"; then
  8991. if test -n "$whole_archive_flag_spec" &&
  8992. test yes = "$compiler_needs_object" &&
  8993. test -z "$libobjs"; then
  8994. # extract the archives, so we have objects to list.
  8995. # TODO: could optimize this to just extract one archive.
  8996. whole_archive_flag_spec=
  8997. fi
  8998. if test -n "$whole_archive_flag_spec"; then
  8999. save_libobjs=$libobjs
  9000. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9001. test "X$libobjs" = "X " && libobjs=
  9002. else
  9003. gentop=$output_objdir/${outputname}x
  9004. func_append generated " $gentop"
  9005. func_extract_archives $gentop $convenience
  9006. func_append libobjs " $func_extract_archives_result"
  9007. test "X$libobjs" = "X " && libobjs=
  9008. fi
  9009. fi
  9010. if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  9011. eval flag=\"$thread_safe_flag_spec\"
  9012. func_append linker_flags " $flag"
  9013. fi
  9014. # Make a backup of the uninstalled library when relinking
  9015. if test relink = "$opt_mode"; then
  9016. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  9017. fi
  9018. # Do each of the archive commands.
  9019. if test yes = "$module" && test -n "$module_cmds"; then
  9020. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9021. eval test_cmds=\"$module_expsym_cmds\"
  9022. cmds=$module_expsym_cmds
  9023. else
  9024. eval test_cmds=\"$module_cmds\"
  9025. cmds=$module_cmds
  9026. fi
  9027. else
  9028. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9029. eval test_cmds=\"$archive_expsym_cmds\"
  9030. cmds=$archive_expsym_cmds
  9031. else
  9032. eval test_cmds=\"$archive_cmds\"
  9033. cmds=$archive_cmds
  9034. fi
  9035. fi
  9036. if test : != "$skipped_export" &&
  9037. func_len " $test_cmds" &&
  9038. len=$func_len_result &&
  9039. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9040. :
  9041. else
  9042. # The command line is too long to link in one step, link piecewise
  9043. # or, if using GNU ld and skipped_export is not :, use a linker
  9044. # script.
  9045. # Save the value of $output and $libobjs because we want to
  9046. # use them later. If we have whole_archive_flag_spec, we
  9047. # want to use save_libobjs as it was before
  9048. # whole_archive_flag_spec was expanded, because we can't
  9049. # assume the linker understands whole_archive_flag_spec.
  9050. # This may have to be revisited, in case too many
  9051. # convenience libraries get linked in and end up exceeding
  9052. # the spec.
  9053. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  9054. save_libobjs=$libobjs
  9055. fi
  9056. save_output=$output
  9057. func_basename "$output"
  9058. output_la=$func_basename_result
  9059. # Clear the reloadable object creation command queue and
  9060. # initialize k to one.
  9061. test_cmds=
  9062. concat_cmds=
  9063. objlist=
  9064. last_robj=
  9065. k=1
  9066. if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  9067. output=$output_objdir/$output_la.lnkscript
  9068. func_verbose "creating GNU ld script: $output"
  9069. echo 'INPUT (' > $output
  9070. for obj in $save_libobjs
  9071. do
  9072. func_to_tool_file "$obj"
  9073. $ECHO "$func_to_tool_file_result" >> $output
  9074. done
  9075. echo ')' >> $output
  9076. func_append delfiles " $output"
  9077. func_to_tool_file "$output"
  9078. output=$func_to_tool_file_result
  9079. elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  9080. output=$output_objdir/$output_la.lnk
  9081. func_verbose "creating linker input file list: $output"
  9082. : > $output
  9083. set x $save_libobjs
  9084. shift
  9085. firstobj=
  9086. if test yes = "$compiler_needs_object"; then
  9087. firstobj="$1 "
  9088. shift
  9089. fi
  9090. for obj
  9091. do
  9092. func_to_tool_file "$obj"
  9093. $ECHO "$func_to_tool_file_result" >> $output
  9094. done
  9095. func_append delfiles " $output"
  9096. func_to_tool_file "$output"
  9097. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  9098. else
  9099. if test -n "$save_libobjs"; then
  9100. func_verbose "creating reloadable object files..."
  9101. output=$output_objdir/$output_la-$k.$objext
  9102. eval test_cmds=\"$reload_cmds\"
  9103. func_len " $test_cmds"
  9104. len0=$func_len_result
  9105. len=$len0
  9106. # Loop over the list of objects to be linked.
  9107. for obj in $save_libobjs
  9108. do
  9109. func_len " $obj"
  9110. func_arith $len + $func_len_result
  9111. len=$func_arith_result
  9112. if test -z "$objlist" ||
  9113. test "$len" -lt "$max_cmd_len"; then
  9114. func_append objlist " $obj"
  9115. else
  9116. # The command $test_cmds is almost too long, add a
  9117. # command to the queue.
  9118. if test 1 -eq "$k"; then
  9119. # The first file doesn't have a previous command to add.
  9120. reload_objs=$objlist
  9121. eval concat_cmds=\"$reload_cmds\"
  9122. else
  9123. # All subsequent reloadable object files will link in
  9124. # the last one created.
  9125. reload_objs="$objlist $last_robj"
  9126. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  9127. fi
  9128. last_robj=$output_objdir/$output_la-$k.$objext
  9129. func_arith $k + 1
  9130. k=$func_arith_result
  9131. output=$output_objdir/$output_la-$k.$objext
  9132. objlist=" $obj"
  9133. func_len " $last_robj"
  9134. func_arith $len0 + $func_len_result
  9135. len=$func_arith_result
  9136. fi
  9137. done
  9138. # Handle the remaining objects by creating one last
  9139. # reloadable object file. All subsequent reloadable object
  9140. # files will link in the last one created.
  9141. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9142. reload_objs="$objlist $last_robj"
  9143. eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  9144. if test -n "$last_robj"; then
  9145. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9146. fi
  9147. func_append delfiles " $output"
  9148. else
  9149. output=
  9150. fi
  9151. ${skipped_export-false} && {
  9152. func_verbose "generating symbol list for '$libname.la'"
  9153. export_symbols=$output_objdir/$libname.exp
  9154. $opt_dry_run || $RM $export_symbols
  9155. libobjs=$output
  9156. # Append the command to create the export file.
  9157. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9158. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  9159. if test -n "$last_robj"; then
  9160. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9161. fi
  9162. }
  9163. test -n "$save_libobjs" &&
  9164. func_verbose "creating a temporary reloadable object file: $output"
  9165. # Loop through the commands generated above and execute them.
  9166. save_ifs=$IFS; IFS='~'
  9167. for cmd in $concat_cmds; do
  9168. IFS=$save_ifs
  9169. $opt_quiet || {
  9170. func_quote_for_expand "$cmd"
  9171. eval "func_echo $func_quote_for_expand_result"
  9172. }
  9173. $opt_dry_run || eval "$cmd" || {
  9174. lt_exit=$?
  9175. # Restore the uninstalled library and exit
  9176. if test relink = "$opt_mode"; then
  9177. ( cd "$output_objdir" && \
  9178. $RM "${realname}T" && \
  9179. $MV "${realname}U" "$realname" )
  9180. fi
  9181. exit $lt_exit
  9182. }
  9183. done
  9184. IFS=$save_ifs
  9185. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  9186. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9187. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9188. fi
  9189. fi
  9190. ${skipped_export-false} && {
  9191. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9192. tmp_export_symbols=$export_symbols
  9193. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9194. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9195. fi
  9196. if test -n "$orig_export_symbols"; then
  9197. # The given exports_symbols file has to be filtered, so filter it.
  9198. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9199. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9200. # 's' commands, which not all seds can handle. GNU sed should be fine
  9201. # though. Also, the filter scales superlinearly with the number of
  9202. # global variables. join(1) would be nice here, but unfortunately
  9203. # isn't a blessed tool.
  9204. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9205. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9206. export_symbols=$output_objdir/$libname.def
  9207. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9208. fi
  9209. }
  9210. libobjs=$output
  9211. # Restore the value of output.
  9212. output=$save_output
  9213. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  9214. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9215. test "X$libobjs" = "X " && libobjs=
  9216. fi
  9217. # Expand the library linking commands again to reset the
  9218. # value of $libobjs for piecewise linking.
  9219. # Do each of the archive commands.
  9220. if test yes = "$module" && test -n "$module_cmds"; then
  9221. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9222. cmds=$module_expsym_cmds
  9223. else
  9224. cmds=$module_cmds
  9225. fi
  9226. else
  9227. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9228. cmds=$archive_expsym_cmds
  9229. else
  9230. cmds=$archive_cmds
  9231. fi
  9232. fi
  9233. fi
  9234. if test -n "$delfiles"; then
  9235. # Append the command to remove temporary files to $cmds.
  9236. eval cmds=\"\$cmds~\$RM $delfiles\"
  9237. fi
  9238. # Add any objects from preloaded convenience libraries
  9239. if test -n "$dlprefiles"; then
  9240. gentop=$output_objdir/${outputname}x
  9241. func_append generated " $gentop"
  9242. func_extract_archives $gentop $dlprefiles
  9243. func_append libobjs " $func_extract_archives_result"
  9244. test "X$libobjs" = "X " && libobjs=
  9245. fi
  9246. save_ifs=$IFS; IFS='~'
  9247. for cmd in $cmds; do
  9248. IFS=$sp$nl
  9249. eval cmd=\"$cmd\"
  9250. IFS=$save_ifs
  9251. $opt_quiet || {
  9252. func_quote_for_expand "$cmd"
  9253. eval "func_echo $func_quote_for_expand_result"
  9254. }
  9255. $opt_dry_run || eval "$cmd" || {
  9256. lt_exit=$?
  9257. # Restore the uninstalled library and exit
  9258. if test relink = "$opt_mode"; then
  9259. ( cd "$output_objdir" && \
  9260. $RM "${realname}T" && \
  9261. $MV "${realname}U" "$realname" )
  9262. fi
  9263. exit $lt_exit
  9264. }
  9265. done
  9266. IFS=$save_ifs
  9267. # Restore the uninstalled library and exit
  9268. if test relink = "$opt_mode"; then
  9269. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  9270. if test -n "$convenience"; then
  9271. if test -z "$whole_archive_flag_spec"; then
  9272. func_show_eval '${RM}r "$gentop"'
  9273. fi
  9274. fi
  9275. exit $EXIT_SUCCESS
  9276. fi
  9277. # Create links to the real library.
  9278. for linkname in $linknames; do
  9279. if test "$realname" != "$linkname"; then
  9280. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  9281. fi
  9282. done
  9283. # If -module or -export-dynamic was specified, set the dlname.
  9284. if test yes = "$module" || test yes = "$export_dynamic"; then
  9285. # On all known operating systems, these are identical.
  9286. dlname=$soname
  9287. fi
  9288. fi
  9289. ;;
  9290. obj)
  9291. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  9292. func_warning "'-dlopen' is ignored for objects"
  9293. fi
  9294. case " $deplibs" in
  9295. *\ -l* | *\ -L*)
  9296. func_warning "'-l' and '-L' are ignored for objects" ;;
  9297. esac
  9298. test -n "$rpath" && \
  9299. func_warning "'-rpath' is ignored for objects"
  9300. test -n "$xrpath" && \
  9301. func_warning "'-R' is ignored for objects"
  9302. test -n "$vinfo" && \
  9303. func_warning "'-version-info' is ignored for objects"
  9304. test -n "$release" && \
  9305. func_warning "'-release' is ignored for objects"
  9306. case $output in
  9307. *.lo)
  9308. test -n "$objs$old_deplibs" && \
  9309. func_fatal_error "cannot build library object '$output' from non-libtool objects"
  9310. libobj=$output
  9311. func_lo2o "$libobj"
  9312. obj=$func_lo2o_result
  9313. ;;
  9314. *)
  9315. libobj=
  9316. obj=$output
  9317. ;;
  9318. esac
  9319. # Delete the old objects.
  9320. $opt_dry_run || $RM $obj $libobj
  9321. # Objects from convenience libraries. This assumes
  9322. # single-version convenience libraries. Whenever we create
  9323. # different ones for PIC/non-PIC, this we'll have to duplicate
  9324. # the extraction.
  9325. reload_conv_objs=
  9326. gentop=
  9327. # if reload_cmds runs $LD directly, get rid of -Wl from
  9328. # whole_archive_flag_spec and hope we can get by with turning comma
  9329. # into space.
  9330. case $reload_cmds in
  9331. *\$LD[\ \$]*) wl= ;;
  9332. esac
  9333. if test -n "$convenience"; then
  9334. if test -n "$whole_archive_flag_spec"; then
  9335. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  9336. test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  9337. reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  9338. else
  9339. gentop=$output_objdir/${obj}x
  9340. func_append generated " $gentop"
  9341. func_extract_archives $gentop $convenience
  9342. reload_conv_objs="$reload_objs $func_extract_archives_result"
  9343. fi
  9344. fi
  9345. # If we're not building shared, we need to use non_pic_objs
  9346. test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  9347. # Create the old-style object.
  9348. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  9349. output=$obj
  9350. func_execute_cmds "$reload_cmds" 'exit $?'
  9351. # Exit if we aren't doing a library object file.
  9352. if test -z "$libobj"; then
  9353. if test -n "$gentop"; then
  9354. func_show_eval '${RM}r "$gentop"'
  9355. fi
  9356. exit $EXIT_SUCCESS
  9357. fi
  9358. test yes = "$build_libtool_libs" || {
  9359. if test -n "$gentop"; then
  9360. func_show_eval '${RM}r "$gentop"'
  9361. fi
  9362. # Create an invalid libtool object if no PIC, so that we don't
  9363. # accidentally link it into a program.
  9364. # $show "echo timestamp > $libobj"
  9365. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  9366. exit $EXIT_SUCCESS
  9367. }
  9368. if test -n "$pic_flag" || test default != "$pic_mode"; then
  9369. # Only do commands if we really have different PIC objects.
  9370. reload_objs="$libobjs $reload_conv_objs"
  9371. output=$libobj
  9372. func_execute_cmds "$reload_cmds" 'exit $?'
  9373. fi
  9374. if test -n "$gentop"; then
  9375. func_show_eval '${RM}r "$gentop"'
  9376. fi
  9377. exit $EXIT_SUCCESS
  9378. ;;
  9379. prog)
  9380. case $host in
  9381. *cygwin*) func_stripname '' '.exe' "$output"
  9382. output=$func_stripname_result.exe;;
  9383. esac
  9384. test -n "$vinfo" && \
  9385. func_warning "'-version-info' is ignored for programs"
  9386. test -n "$release" && \
  9387. func_warning "'-release' is ignored for programs"
  9388. $preload \
  9389. && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  9390. && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  9391. case $host in
  9392. *-*-rhapsody* | *-*-darwin1.[012])
  9393. # On Rhapsody replace the C library is the System framework
  9394. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9395. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9396. ;;
  9397. esac
  9398. case $host in
  9399. *-*-darwin*)
  9400. # Don't allow lazy linking, it breaks C++ global constructors
  9401. # But is supposedly fixed on 10.4 or later (yay!).
  9402. if test CXX = "$tagname"; then
  9403. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  9404. 10.[0123])
  9405. func_append compile_command " $wl-bind_at_load"
  9406. func_append finalize_command " $wl-bind_at_load"
  9407. ;;
  9408. esac
  9409. fi
  9410. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9411. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9412. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9413. ;;
  9414. esac
  9415. # move library search paths that coincide with paths to not yet
  9416. # installed libraries to the beginning of the library search list
  9417. new_libs=
  9418. for path in $notinst_path; do
  9419. case " $new_libs " in
  9420. *" -L$path/$objdir "*) ;;
  9421. *)
  9422. case " $compile_deplibs " in
  9423. *" -L$path/$objdir "*)
  9424. func_append new_libs " -L$path/$objdir" ;;
  9425. esac
  9426. ;;
  9427. esac
  9428. done
  9429. for deplib in $compile_deplibs; do
  9430. case $deplib in
  9431. -L*)
  9432. case " $new_libs " in
  9433. *" $deplib "*) ;;
  9434. *) func_append new_libs " $deplib" ;;
  9435. esac
  9436. ;;
  9437. *) func_append new_libs " $deplib" ;;
  9438. esac
  9439. done
  9440. compile_deplibs=$new_libs
  9441. func_append compile_command " $compile_deplibs"
  9442. func_append finalize_command " $finalize_deplibs"
  9443. if test -n "$rpath$xrpath"; then
  9444. # If the user specified any rpath flags, then add them.
  9445. for libdir in $rpath $xrpath; do
  9446. # This is the magic to use -rpath.
  9447. case "$finalize_rpath " in
  9448. *" $libdir "*) ;;
  9449. *) func_append finalize_rpath " $libdir" ;;
  9450. esac
  9451. done
  9452. fi
  9453. # Now hardcode the library paths
  9454. rpath=
  9455. hardcode_libdirs=
  9456. for libdir in $compile_rpath $finalize_rpath; do
  9457. if test -n "$hardcode_libdir_flag_spec"; then
  9458. if test -n "$hardcode_libdir_separator"; then
  9459. if test -z "$hardcode_libdirs"; then
  9460. hardcode_libdirs=$libdir
  9461. else
  9462. # Just accumulate the unique libdirs.
  9463. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9464. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9465. ;;
  9466. *)
  9467. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9468. ;;
  9469. esac
  9470. fi
  9471. else
  9472. eval flag=\"$hardcode_libdir_flag_spec\"
  9473. func_append rpath " $flag"
  9474. fi
  9475. elif test -n "$runpath_var"; then
  9476. case "$perm_rpath " in
  9477. *" $libdir "*) ;;
  9478. *) func_append perm_rpath " $libdir" ;;
  9479. esac
  9480. fi
  9481. case $host in
  9482. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  9483. testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  9484. case :$dllsearchpath: in
  9485. *":$libdir:"*) ;;
  9486. ::) dllsearchpath=$libdir;;
  9487. *) func_append dllsearchpath ":$libdir";;
  9488. esac
  9489. case :$dllsearchpath: in
  9490. *":$testbindir:"*) ;;
  9491. ::) dllsearchpath=$testbindir;;
  9492. *) func_append dllsearchpath ":$testbindir";;
  9493. esac
  9494. ;;
  9495. esac
  9496. done
  9497. # Substitute the hardcoded libdirs into the rpath.
  9498. if test -n "$hardcode_libdir_separator" &&
  9499. test -n "$hardcode_libdirs"; then
  9500. libdir=$hardcode_libdirs
  9501. eval rpath=\" $hardcode_libdir_flag_spec\"
  9502. fi
  9503. compile_rpath=$rpath
  9504. rpath=
  9505. hardcode_libdirs=
  9506. for libdir in $finalize_rpath; do
  9507. if test -n "$hardcode_libdir_flag_spec"; then
  9508. if test -n "$hardcode_libdir_separator"; then
  9509. if test -z "$hardcode_libdirs"; then
  9510. hardcode_libdirs=$libdir
  9511. else
  9512. # Just accumulate the unique libdirs.
  9513. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9514. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9515. ;;
  9516. *)
  9517. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9518. ;;
  9519. esac
  9520. fi
  9521. else
  9522. eval flag=\"$hardcode_libdir_flag_spec\"
  9523. func_append rpath " $flag"
  9524. fi
  9525. elif test -n "$runpath_var"; then
  9526. case "$finalize_perm_rpath " in
  9527. *" $libdir "*) ;;
  9528. *) func_append finalize_perm_rpath " $libdir" ;;
  9529. esac
  9530. fi
  9531. done
  9532. # Substitute the hardcoded libdirs into the rpath.
  9533. if test -n "$hardcode_libdir_separator" &&
  9534. test -n "$hardcode_libdirs"; then
  9535. libdir=$hardcode_libdirs
  9536. eval rpath=\" $hardcode_libdir_flag_spec\"
  9537. fi
  9538. finalize_rpath=$rpath
  9539. if test -n "$libobjs" && test yes = "$build_old_libs"; then
  9540. # Transform all the library objects into standard objects.
  9541. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9542. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9543. fi
  9544. func_generate_dlsyms "$outputname" "@PROGRAM@" false
  9545. # template prelinking step
  9546. if test -n "$prelink_cmds"; then
  9547. func_execute_cmds "$prelink_cmds" 'exit $?'
  9548. fi
  9549. wrappers_required=:
  9550. case $host in
  9551. *cegcc* | *mingw32ce*)
  9552. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  9553. wrappers_required=false
  9554. ;;
  9555. *cygwin* | *mingw* )
  9556. test yes = "$build_libtool_libs" || wrappers_required=false
  9557. ;;
  9558. *)
  9559. if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  9560. wrappers_required=false
  9561. fi
  9562. ;;
  9563. esac
  9564. $wrappers_required || {
  9565. # Replace the output file specification.
  9566. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9567. link_command=$compile_command$compile_rpath
  9568. # We have no uninstalled library dependencies, so finalize right now.
  9569. exit_status=0
  9570. func_show_eval "$link_command" 'exit_status=$?'
  9571. if test -n "$postlink_cmds"; then
  9572. func_to_tool_file "$output"
  9573. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9574. func_execute_cmds "$postlink_cmds" 'exit $?'
  9575. fi
  9576. # Delete the generated files.
  9577. if test -f "$output_objdir/${outputname}S.$objext"; then
  9578. func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  9579. fi
  9580. exit $exit_status
  9581. }
  9582. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  9583. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  9584. fi
  9585. if test -n "$finalize_shlibpath"; then
  9586. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  9587. fi
  9588. compile_var=
  9589. finalize_var=
  9590. if test -n "$runpath_var"; then
  9591. if test -n "$perm_rpath"; then
  9592. # We should set the runpath_var.
  9593. rpath=
  9594. for dir in $perm_rpath; do
  9595. func_append rpath "$dir:"
  9596. done
  9597. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9598. fi
  9599. if test -n "$finalize_perm_rpath"; then
  9600. # We should set the runpath_var.
  9601. rpath=
  9602. for dir in $finalize_perm_rpath; do
  9603. func_append rpath "$dir:"
  9604. done
  9605. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9606. fi
  9607. fi
  9608. if test yes = "$no_install"; then
  9609. # We don't need to create a wrapper script.
  9610. link_command=$compile_var$compile_command$compile_rpath
  9611. # Replace the output file specification.
  9612. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9613. # Delete the old output file.
  9614. $opt_dry_run || $RM $output
  9615. # Link the executable and exit
  9616. func_show_eval "$link_command" 'exit $?'
  9617. if test -n "$postlink_cmds"; then
  9618. func_to_tool_file "$output"
  9619. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9620. func_execute_cmds "$postlink_cmds" 'exit $?'
  9621. fi
  9622. exit $EXIT_SUCCESS
  9623. fi
  9624. case $hardcode_action,$fast_install in
  9625. relink,*)
  9626. # Fast installation is not supported
  9627. link_command=$compile_var$compile_command$compile_rpath
  9628. relink_command=$finalize_var$finalize_command$finalize_rpath
  9629. func_warning "this platform does not like uninstalled shared libraries"
  9630. func_warning "'$output' will be relinked during installation"
  9631. ;;
  9632. *,yes)
  9633. link_command=$finalize_var$compile_command$finalize_rpath
  9634. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  9635. ;;
  9636. *,no)
  9637. link_command=$compile_var$compile_command$compile_rpath
  9638. relink_command=$finalize_var$finalize_command$finalize_rpath
  9639. ;;
  9640. *,needless)
  9641. link_command=$finalize_var$compile_command$finalize_rpath
  9642. relink_command=
  9643. ;;
  9644. esac
  9645. # Replace the output file specification.
  9646. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  9647. # Delete the old output files.
  9648. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  9649. func_show_eval "$link_command" 'exit $?'
  9650. if test -n "$postlink_cmds"; then
  9651. func_to_tool_file "$output_objdir/$outputname"
  9652. 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'`
  9653. func_execute_cmds "$postlink_cmds" 'exit $?'
  9654. fi
  9655. # Now create the wrapper script.
  9656. func_verbose "creating $output"
  9657. # Quote the relink command for shipping.
  9658. if test -n "$relink_command"; then
  9659. # Preserve any variables that may affect compiler behavior
  9660. for var in $variables_saved_for_relink; do
  9661. if eval test -z \"\${$var+set}\"; then
  9662. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9663. elif eval var_value=\$$var; test -z "$var_value"; then
  9664. relink_command="$var=; export $var; $relink_command"
  9665. else
  9666. func_quote_for_eval "$var_value"
  9667. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9668. fi
  9669. done
  9670. relink_command="(cd `pwd`; $relink_command)"
  9671. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9672. fi
  9673. # Only actually do things if not in dry run mode.
  9674. $opt_dry_run || {
  9675. # win32 will think the script is a binary if it has
  9676. # a .exe suffix, so we strip it off here.
  9677. case $output in
  9678. *.exe) func_stripname '' '.exe' "$output"
  9679. output=$func_stripname_result ;;
  9680. esac
  9681. # test for cygwin because mv fails w/o .exe extensions
  9682. case $host in
  9683. *cygwin*)
  9684. exeext=.exe
  9685. func_stripname '' '.exe' "$outputname"
  9686. outputname=$func_stripname_result ;;
  9687. *) exeext= ;;
  9688. esac
  9689. case $host in
  9690. *cygwin* | *mingw* )
  9691. func_dirname_and_basename "$output" "" "."
  9692. output_name=$func_basename_result
  9693. output_path=$func_dirname_result
  9694. cwrappersource=$output_path/$objdir/lt-$output_name.c
  9695. cwrapper=$output_path/$output_name.exe
  9696. $RM $cwrappersource $cwrapper
  9697. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  9698. func_emit_cwrapperexe_src > $cwrappersource
  9699. # The wrapper executable is built using the $host compiler,
  9700. # because it contains $host paths and files. If cross-
  9701. # compiling, it, like the target executable, must be
  9702. # executed on the $host or under an emulation environment.
  9703. $opt_dry_run || {
  9704. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  9705. $STRIP $cwrapper
  9706. }
  9707. # Now, create the wrapper script for func_source use:
  9708. func_ltwrapper_scriptname $cwrapper
  9709. $RM $func_ltwrapper_scriptname_result
  9710. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  9711. $opt_dry_run || {
  9712. # note: this script will not be executed, so do not chmod.
  9713. if test "x$build" = "x$host"; then
  9714. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  9715. else
  9716. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  9717. fi
  9718. }
  9719. ;;
  9720. * )
  9721. $RM $output
  9722. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  9723. func_emit_wrapper no > $output
  9724. chmod +x $output
  9725. ;;
  9726. esac
  9727. }
  9728. exit $EXIT_SUCCESS
  9729. ;;
  9730. esac
  9731. # See if we need to build an old-fashioned archive.
  9732. for oldlib in $oldlibs; do
  9733. case $build_libtool_libs in
  9734. convenience)
  9735. oldobjs="$libobjs_save $symfileobj"
  9736. addlibs=$convenience
  9737. build_libtool_libs=no
  9738. ;;
  9739. module)
  9740. oldobjs=$libobjs_save
  9741. addlibs=$old_convenience
  9742. build_libtool_libs=no
  9743. ;;
  9744. *)
  9745. oldobjs="$old_deplibs $non_pic_objects"
  9746. $preload && test -f "$symfileobj" \
  9747. && func_append oldobjs " $symfileobj"
  9748. addlibs=$old_convenience
  9749. ;;
  9750. esac
  9751. if test -n "$addlibs"; then
  9752. gentop=$output_objdir/${outputname}x
  9753. func_append generated " $gentop"
  9754. func_extract_archives $gentop $addlibs
  9755. func_append oldobjs " $func_extract_archives_result"
  9756. fi
  9757. # Do each command in the archive commands.
  9758. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  9759. cmds=$old_archive_from_new_cmds
  9760. else
  9761. # Add any objects from preloaded convenience libraries
  9762. if test -n "$dlprefiles"; then
  9763. gentop=$output_objdir/${outputname}x
  9764. func_append generated " $gentop"
  9765. func_extract_archives $gentop $dlprefiles
  9766. func_append oldobjs " $func_extract_archives_result"
  9767. fi
  9768. # POSIX demands no paths to be encoded in archives. We have
  9769. # to avoid creating archives with duplicate basenames if we
  9770. # might have to extract them afterwards, e.g., when creating a
  9771. # static archive out of a convenience library, or when linking
  9772. # the entirety of a libtool archive into another (currently
  9773. # not supported by libtool).
  9774. if (for obj in $oldobjs
  9775. do
  9776. func_basename "$obj"
  9777. $ECHO "$func_basename_result"
  9778. done | sort | sort -uc >/dev/null 2>&1); then
  9779. :
  9780. else
  9781. echo "copying selected object files to avoid basename conflicts..."
  9782. gentop=$output_objdir/${outputname}x
  9783. func_append generated " $gentop"
  9784. func_mkdir_p "$gentop"
  9785. save_oldobjs=$oldobjs
  9786. oldobjs=
  9787. counter=1
  9788. for obj in $save_oldobjs
  9789. do
  9790. func_basename "$obj"
  9791. objbase=$func_basename_result
  9792. case " $oldobjs " in
  9793. " ") oldobjs=$obj ;;
  9794. *[\ /]"$objbase "*)
  9795. while :; do
  9796. # Make sure we don't pick an alternate name that also
  9797. # overlaps.
  9798. newobj=lt$counter-$objbase
  9799. func_arith $counter + 1
  9800. counter=$func_arith_result
  9801. case " $oldobjs " in
  9802. *[\ /]"$newobj "*) ;;
  9803. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  9804. esac
  9805. done
  9806. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  9807. func_append oldobjs " $gentop/$newobj"
  9808. ;;
  9809. *) func_append oldobjs " $obj" ;;
  9810. esac
  9811. done
  9812. fi
  9813. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  9814. tool_oldlib=$func_to_tool_file_result
  9815. eval cmds=\"$old_archive_cmds\"
  9816. func_len " $cmds"
  9817. len=$func_len_result
  9818. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9819. cmds=$old_archive_cmds
  9820. elif test -n "$archiver_list_spec"; then
  9821. func_verbose "using command file archive linking..."
  9822. for obj in $oldobjs
  9823. do
  9824. func_to_tool_file "$obj"
  9825. $ECHO "$func_to_tool_file_result"
  9826. done > $output_objdir/$libname.libcmd
  9827. func_to_tool_file "$output_objdir/$libname.libcmd"
  9828. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  9829. cmds=$old_archive_cmds
  9830. else
  9831. # the command line is too long to link in one step, link in parts
  9832. func_verbose "using piecewise archive linking..."
  9833. save_RANLIB=$RANLIB
  9834. RANLIB=:
  9835. objlist=
  9836. concat_cmds=
  9837. save_oldobjs=$oldobjs
  9838. oldobjs=
  9839. # Is there a better way of finding the last object in the list?
  9840. for obj in $save_oldobjs
  9841. do
  9842. last_oldobj=$obj
  9843. done
  9844. eval test_cmds=\"$old_archive_cmds\"
  9845. func_len " $test_cmds"
  9846. len0=$func_len_result
  9847. len=$len0
  9848. for obj in $save_oldobjs
  9849. do
  9850. func_len " $obj"
  9851. func_arith $len + $func_len_result
  9852. len=$func_arith_result
  9853. func_append objlist " $obj"
  9854. if test "$len" -lt "$max_cmd_len"; then
  9855. :
  9856. else
  9857. # the above command should be used before it gets too long
  9858. oldobjs=$objlist
  9859. if test "$obj" = "$last_oldobj"; then
  9860. RANLIB=$save_RANLIB
  9861. fi
  9862. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9863. eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  9864. objlist=
  9865. len=$len0
  9866. fi
  9867. done
  9868. RANLIB=$save_RANLIB
  9869. oldobjs=$objlist
  9870. if test -z "$oldobjs"; then
  9871. eval cmds=\"\$concat_cmds\"
  9872. else
  9873. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  9874. fi
  9875. fi
  9876. fi
  9877. func_execute_cmds "$cmds" 'exit $?'
  9878. done
  9879. test -n "$generated" && \
  9880. func_show_eval "${RM}r$generated"
  9881. # Now create the libtool archive.
  9882. case $output in
  9883. *.la)
  9884. old_library=
  9885. test yes = "$build_old_libs" && old_library=$libname.$libext
  9886. func_verbose "creating $output"
  9887. # Preserve any variables that may affect compiler behavior
  9888. for var in $variables_saved_for_relink; do
  9889. if eval test -z \"\${$var+set}\"; then
  9890. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9891. elif eval var_value=\$$var; test -z "$var_value"; then
  9892. relink_command="$var=; export $var; $relink_command"
  9893. else
  9894. func_quote_for_eval "$var_value"
  9895. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9896. fi
  9897. done
  9898. # Quote the link command for shipping.
  9899. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  9900. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9901. if test yes = "$hardcode_automatic"; then
  9902. relink_command=
  9903. fi
  9904. # Only create the output if not a dry run.
  9905. $opt_dry_run || {
  9906. for installed in no yes; do
  9907. if test yes = "$installed"; then
  9908. if test -z "$install_libdir"; then
  9909. break
  9910. fi
  9911. output=$output_objdir/${outputname}i
  9912. # Replace all uninstalled libtool libraries with the installed ones
  9913. newdependency_libs=
  9914. for deplib in $dependency_libs; do
  9915. case $deplib in
  9916. *.la)
  9917. func_basename "$deplib"
  9918. name=$func_basename_result
  9919. func_resolve_sysroot "$deplib"
  9920. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  9921. test -z "$libdir" && \
  9922. func_fatal_error "'$deplib' is not a valid libtool archive"
  9923. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  9924. ;;
  9925. -L*)
  9926. func_stripname -L '' "$deplib"
  9927. func_replace_sysroot "$func_stripname_result"
  9928. func_append newdependency_libs " -L$func_replace_sysroot_result"
  9929. ;;
  9930. -R*)
  9931. func_stripname -R '' "$deplib"
  9932. func_replace_sysroot "$func_stripname_result"
  9933. func_append newdependency_libs " -R$func_replace_sysroot_result"
  9934. ;;
  9935. *) func_append newdependency_libs " $deplib" ;;
  9936. esac
  9937. done
  9938. dependency_libs=$newdependency_libs
  9939. newdlfiles=
  9940. for lib in $dlfiles; do
  9941. case $lib in
  9942. *.la)
  9943. func_basename "$lib"
  9944. name=$func_basename_result
  9945. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9946. test -z "$libdir" && \
  9947. func_fatal_error "'$lib' is not a valid libtool archive"
  9948. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  9949. ;;
  9950. *) func_append newdlfiles " $lib" ;;
  9951. esac
  9952. done
  9953. dlfiles=$newdlfiles
  9954. newdlprefiles=
  9955. for lib in $dlprefiles; do
  9956. case $lib in
  9957. *.la)
  9958. # Only pass preopened files to the pseudo-archive (for
  9959. # eventual linking with the app. that links it) if we
  9960. # didn't already link the preopened objects directly into
  9961. # the library:
  9962. func_basename "$lib"
  9963. name=$func_basename_result
  9964. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9965. test -z "$libdir" && \
  9966. func_fatal_error "'$lib' is not a valid libtool archive"
  9967. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  9968. ;;
  9969. esac
  9970. done
  9971. dlprefiles=$newdlprefiles
  9972. else
  9973. newdlfiles=
  9974. for lib in $dlfiles; do
  9975. case $lib in
  9976. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  9977. *) abs=`pwd`"/$lib" ;;
  9978. esac
  9979. func_append newdlfiles " $abs"
  9980. done
  9981. dlfiles=$newdlfiles
  9982. newdlprefiles=
  9983. for lib in $dlprefiles; do
  9984. case $lib in
  9985. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  9986. *) abs=`pwd`"/$lib" ;;
  9987. esac
  9988. func_append newdlprefiles " $abs"
  9989. done
  9990. dlprefiles=$newdlprefiles
  9991. fi
  9992. $RM $output
  9993. # place dlname in correct position for cygwin
  9994. # In fact, it would be nice if we could use this code for all target
  9995. # systems that can't hard-code library paths into their executables
  9996. # and that have no shared library path variable independent of PATH,
  9997. # but it turns out we can't easily determine that from inspecting
  9998. # libtool variables, so we have to hard-code the OSs to which it
  9999. # applies here; at the moment, that means platforms that use the PE
  10000. # object format with DLL files. See the long comment at the top of
  10001. # tests/bindir.at for full details.
  10002. tdlname=$dlname
  10003. case $host,$output,$installed,$module,$dlname in
  10004. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  10005. # If a -bindir argument was supplied, place the dll there.
  10006. if test -n "$bindir"; then
  10007. func_relative_path "$install_libdir" "$bindir"
  10008. tdlname=$func_relative_path_result/$dlname
  10009. else
  10010. # Otherwise fall back on heuristic.
  10011. tdlname=../bin/$dlname
  10012. fi
  10013. ;;
  10014. esac
  10015. $ECHO > $output "\
  10016. # $outputname - a libtool library file
  10017. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  10018. #
  10019. # Please DO NOT delete this file!
  10020. # It is necessary for linking the library.
  10021. # The name that we can dlopen(3).
  10022. dlname='$tdlname'
  10023. # Names of this library.
  10024. library_names='$library_names'
  10025. # The name of the static archive.
  10026. old_library='$old_library'
  10027. # Linker flags that cannot go in dependency_libs.
  10028. inherited_linker_flags='$new_inherited_linker_flags'
  10029. # Libraries that this one depends upon.
  10030. dependency_libs='$dependency_libs'
  10031. # Names of additional weak libraries provided by this library
  10032. weak_library_names='$weak_libs'
  10033. # Version information for $libname.
  10034. current=$current
  10035. age=$age
  10036. revision=$revision
  10037. # Is this an already installed library?
  10038. installed=$installed
  10039. # Should we warn about portability when linking against -modules?
  10040. shouldnotlink=$module
  10041. # Files to dlopen/dlpreopen
  10042. dlopen='$dlfiles'
  10043. dlpreopen='$dlprefiles'
  10044. # Directory that this library needs to be installed in:
  10045. libdir='$install_libdir'"
  10046. if test no,yes = "$installed,$need_relink"; then
  10047. $ECHO >> $output "\
  10048. relink_command=\"$relink_command\""
  10049. fi
  10050. done
  10051. }
  10052. # Do a symbolic link so that the libtool archive can be found in
  10053. # LD_LIBRARY_PATH before the program is installed.
  10054. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  10055. ;;
  10056. esac
  10057. exit $EXIT_SUCCESS
  10058. }
  10059. if test link = "$opt_mode" || test relink = "$opt_mode"; then
  10060. func_mode_link ${1+"$@"}
  10061. fi
  10062. # func_mode_uninstall arg...
  10063. func_mode_uninstall ()
  10064. {
  10065. $debug_cmd
  10066. RM=$nonopt
  10067. files=
  10068. rmforce=false
  10069. exit_status=0
  10070. # This variable tells wrapper scripts just to set variables rather
  10071. # than running their programs.
  10072. libtool_install_magic=$magic
  10073. for arg
  10074. do
  10075. case $arg in
  10076. -f) func_append RM " $arg"; rmforce=: ;;
  10077. -*) func_append RM " $arg" ;;
  10078. *) func_append files " $arg" ;;
  10079. esac
  10080. done
  10081. test -z "$RM" && \
  10082. func_fatal_help "you must specify an RM program"
  10083. rmdirs=
  10084. for file in $files; do
  10085. func_dirname "$file" "" "."
  10086. dir=$func_dirname_result
  10087. if test . = "$dir"; then
  10088. odir=$objdir
  10089. else
  10090. odir=$dir/$objdir
  10091. fi
  10092. func_basename "$file"
  10093. name=$func_basename_result
  10094. test uninstall = "$opt_mode" && odir=$dir
  10095. # Remember odir for removal later, being careful to avoid duplicates
  10096. if test clean = "$opt_mode"; then
  10097. case " $rmdirs " in
  10098. *" $odir "*) ;;
  10099. *) func_append rmdirs " $odir" ;;
  10100. esac
  10101. fi
  10102. # Don't error if the file doesn't exist and rm -f was used.
  10103. if { test -L "$file"; } >/dev/null 2>&1 ||
  10104. { test -h "$file"; } >/dev/null 2>&1 ||
  10105. test -f "$file"; then
  10106. :
  10107. elif test -d "$file"; then
  10108. exit_status=1
  10109. continue
  10110. elif $rmforce; then
  10111. continue
  10112. fi
  10113. rmfiles=$file
  10114. case $name in
  10115. *.la)
  10116. # Possibly a libtool archive, so verify it.
  10117. if func_lalib_p "$file"; then
  10118. func_source $dir/$name
  10119. # Delete the libtool libraries and symlinks.
  10120. for n in $library_names; do
  10121. func_append rmfiles " $odir/$n"
  10122. done
  10123. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  10124. case $opt_mode in
  10125. clean)
  10126. case " $library_names " in
  10127. *" $dlname "*) ;;
  10128. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  10129. esac
  10130. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  10131. ;;
  10132. uninstall)
  10133. if test -n "$library_names"; then
  10134. # Do each command in the postuninstall commands.
  10135. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  10136. fi
  10137. if test -n "$old_library"; then
  10138. # Do each command in the old_postuninstall commands.
  10139. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  10140. fi
  10141. # FIXME: should reinstall the best remaining shared library.
  10142. ;;
  10143. esac
  10144. fi
  10145. ;;
  10146. *.lo)
  10147. # Possibly a libtool object, so verify it.
  10148. if func_lalib_p "$file"; then
  10149. # Read the .lo file
  10150. func_source $dir/$name
  10151. # Add PIC object to the list of files to remove.
  10152. if test -n "$pic_object" && test none != "$pic_object"; then
  10153. func_append rmfiles " $dir/$pic_object"
  10154. fi
  10155. # Add non-PIC object to the list of files to remove.
  10156. if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  10157. func_append rmfiles " $dir/$non_pic_object"
  10158. fi
  10159. fi
  10160. ;;
  10161. *)
  10162. if test clean = "$opt_mode"; then
  10163. noexename=$name
  10164. case $file in
  10165. *.exe)
  10166. func_stripname '' '.exe' "$file"
  10167. file=$func_stripname_result
  10168. func_stripname '' '.exe' "$name"
  10169. noexename=$func_stripname_result
  10170. # $file with .exe has already been added to rmfiles,
  10171. # add $file without .exe
  10172. func_append rmfiles " $file"
  10173. ;;
  10174. esac
  10175. # Do a test to see if this is a libtool program.
  10176. if func_ltwrapper_p "$file"; then
  10177. if func_ltwrapper_executable_p "$file"; then
  10178. func_ltwrapper_scriptname "$file"
  10179. relink_command=
  10180. func_source $func_ltwrapper_scriptname_result
  10181. func_append rmfiles " $func_ltwrapper_scriptname_result"
  10182. else
  10183. relink_command=
  10184. func_source $dir/$noexename
  10185. fi
  10186. # note $name still contains .exe if it was in $file originally
  10187. # as does the version of $file that was added into $rmfiles
  10188. func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  10189. if test yes = "$fast_install" && test -n "$relink_command"; then
  10190. func_append rmfiles " $odir/lt-$name"
  10191. fi
  10192. if test "X$noexename" != "X$name"; then
  10193. func_append rmfiles " $odir/lt-$noexename.c"
  10194. fi
  10195. fi
  10196. fi
  10197. ;;
  10198. esac
  10199. func_show_eval "$RM $rmfiles" 'exit_status=1'
  10200. done
  10201. # Try to remove the $objdir's in the directories where we deleted files
  10202. for dir in $rmdirs; do
  10203. if test -d "$dir"; then
  10204. func_show_eval "rmdir $dir >/dev/null 2>&1"
  10205. fi
  10206. done
  10207. exit $exit_status
  10208. }
  10209. if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  10210. func_mode_uninstall ${1+"$@"}
  10211. fi
  10212. test -z "$opt_mode" && {
  10213. help=$generic_help
  10214. func_fatal_help "you must specify a MODE"
  10215. }
  10216. test -z "$exec_cmd" && \
  10217. func_fatal_help "invalid operation mode '$opt_mode'"
  10218. if test -n "$exec_cmd"; then
  10219. eval exec "$exec_cmd"
  10220. exit $EXIT_FAILURE
  10221. fi
  10222. exit $exit_status
  10223. # The TAGs below are defined such that we never get into a situation
  10224. # where we disable both kinds of libraries. Given conflicting
  10225. # choices, we go for a static library, that is the most portable,
  10226. # since we can't tell whether shared libraries were disabled because
  10227. # the user asked for that or because the platform doesn't support
  10228. # them. This is particularly important on AIX, because we don't
  10229. # support having both static and shared libraries enabled at the same
  10230. # time on that platform, so we default to a shared-only configuration.
  10231. # If a disable-shared tag is given, we'll fallback to a static-only
  10232. # configuration. But we'll never go from static-only to shared-only.
  10233. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  10234. build_libtool_libs=no
  10235. build_old_libs=yes
  10236. # ### END LIBTOOL TAG CONFIG: disable-shared
  10237. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  10238. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  10239. # ### END LIBTOOL TAG CONFIG: disable-static
  10240. # Local Variables:
  10241. # mode:shell-script
  10242. # sh-indentation:2
  10243. # End:
  10244. # ### BEGIN LIBTOOL TAG CONFIG: CXX
  10245. # The linker used to build libraries.
  10246. LD="C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe"
  10247. # How to create reloadable object files.
  10248. reload_flag=" -r"
  10249. reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
  10250. # Commands used to build an old-style archive.
  10251. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  10252. # A language specific compiler.
  10253. CC="g++"
  10254. # Is the compiler the GNU compiler?
  10255. with_gcc=yes
  10256. # Compiler flag to turn off builtin functions.
  10257. no_builtin_flag=" -fno-builtin"
  10258. # Additional compiler flags for building library objects.
  10259. pic_flag=" -DDLL_EXPORT -DPIC"
  10260. # How to pass a linker flag through the compiler.
  10261. wl="-Wl,"
  10262. # Compiler flag to prevent dynamic linking.
  10263. link_static_flag="-static"
  10264. # Does compiler simultaneously support -c and -o options?
  10265. compiler_c_o="yes"
  10266. # Whether or not to add -lc for building shared libraries.
  10267. build_libtool_need_lc=no
  10268. # Whether or not to disallow shared libs when runtime libs are static.
  10269. allow_libtool_libs_with_static_runtimes=yes
  10270. # Compiler flag to allow reflexive dlopens.
  10271. export_dynamic_flag_spec="\$wl--export-all-symbols"
  10272. # Compiler flag to generate shared objects directly from archives.
  10273. whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
  10274. # Whether the compiler copes with passing no objects directly.
  10275. compiler_needs_object="no"
  10276. # Create an old-style archive from a shared archive.
  10277. old_archive_from_new_cmds=""
  10278. # Create a temporary old-style archive to link instead of a shared archive.
  10279. old_archive_from_expsyms_cmds=""
  10280. # Commands used to build a shared archive.
  10281. archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags -o \$output_objdir/\$soname \$wl--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib"
  10282. archive_expsym_cmds="if test DEF = \\\"\\\`\$SED -n -e 's/^[ ]*//' -e '/^\\\\(;.*\\\\)*\$/d' -e 's/^\\\\(EXPORTS\\\\|LIBRARY\\\\)\\\\([ ].*\\\\)*\$/DEF/p' -e q \$export_symbols\\\`\\\" ; then
  10283. cp \$export_symbols \$output_objdir/\$soname.def;
  10284. else
  10285. echo EXPORTS > \$output_objdir/\$soname.def;
  10286. cat \$export_symbols >> \$output_objdir/\$soname.def;
  10287. fi~
  10288. \$CC -shared -nostdlib \$output_objdir/\$soname.def \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags -o \$output_objdir/\$soname \$wl--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib"
  10289. # Commands used to build a loadable module if different from building
  10290. # a shared archive.
  10291. module_cmds=""
  10292. module_expsym_cmds=""
  10293. # Whether we are building with GNU ld or not.
  10294. with_gnu_ld="yes"
  10295. # Flag that allows shared libraries with undefined symbols to be built.
  10296. allow_undefined_flag="unsupported"
  10297. # Flag that enforces no undefined symbols.
  10298. no_undefined_flag=""
  10299. # Flag to hardcode $libdir into a binary during linking.
  10300. # This must work even if $libdir does not exist
  10301. hardcode_libdir_flag_spec="-L\$libdir"
  10302. # Whether we need a single "-rpath" flag with a separated argument.
  10303. hardcode_libdir_separator=""
  10304. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  10305. # DIR into the resulting binary.
  10306. hardcode_direct=no
  10307. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  10308. # DIR into the resulting binary and the resulting library dependency is
  10309. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  10310. # library is relocated.
  10311. hardcode_direct_absolute=no
  10312. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  10313. # into the resulting binary.
  10314. hardcode_minus_L=no
  10315. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  10316. # into the resulting binary.
  10317. hardcode_shlibpath_var=unsupported
  10318. # Set to "yes" if building a shared library automatically hardcodes DIR
  10319. # into the library and all subsequent libraries and executables linked
  10320. # against it.
  10321. hardcode_automatic=no
  10322. # Set to yes if linker adds runtime paths of dependent libraries
  10323. # to runtime path list.
  10324. inherit_rpath=no
  10325. # Whether libtool must link a program against all its dependency libraries.
  10326. link_all_deplibs=unknown
  10327. # Set to "yes" if exported symbols are required.
  10328. always_export_symbols=no
  10329. # The commands to list exported symbols.
  10330. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED -e '/^[BCDGRS][ ]/s/.*[ ]\\\\([^ ]*\\\\)/\\\\1 DATA/;s/^.*[ ]__nm__\\\\([^ ]*\\\\)[ ][^ ]*/\\\\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //' | sort | uniq > \$export_symbols"
  10331. # Symbols that should not be listed in the preloaded symbols.
  10332. exclude_expsyms="[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname"
  10333. # Symbols that must always be exported.
  10334. include_expsyms=""
  10335. # Commands necessary for linking programs (against libraries) with templates.
  10336. prelink_cmds=""
  10337. # Commands necessary for finishing linking programs.
  10338. postlink_cmds=""
  10339. # Specify filename containing input files.
  10340. file_list_spec=""
  10341. # How to hardcode a shared library path into an executable.
  10342. hardcode_action=immediate
  10343. # The directories searched by this compiler when creating a shared library.
  10344. compiler_lib_search_dirs="C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0 C:/msys64/mingw64/bin/../lib/gcc C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/lib/../lib C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../lib C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/lib C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../.."
  10345. # Dependencies to place before and after the objects being linked to
  10346. # create a shared library.
  10347. predep_objects="C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/crtbegin.o"
  10348. postdep_objects="C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/crtend.o"
  10349. predeps=""
  10350. postdeps="-lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt"
  10351. # The library search path used internally by the compiler when linking
  10352. # a shared library.
  10353. compiler_lib_search_path="-LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../.."
  10354. # ### END LIBTOOL TAG CONFIG: CXX
  10355. # ### BEGIN LIBTOOL TAG CONFIG: RC
  10356. # The linker used to build libraries.
  10357. LD=""
  10358. # How to create reloadable object files.
  10359. reload_flag=""
  10360. reload_cmds=""
  10361. # Commands used to build an old-style archive.
  10362. old_archive_cmds=""
  10363. # A language specific compiler.
  10364. CC="windres"
  10365. # Is the compiler the GNU compiler?
  10366. with_gcc=
  10367. # Compiler flag to turn off builtin functions.
  10368. no_builtin_flag=""
  10369. # Additional compiler flags for building library objects.
  10370. pic_flag=""
  10371. # How to pass a linker flag through the compiler.
  10372. wl=""
  10373. # Compiler flag to prevent dynamic linking.
  10374. link_static_flag=""
  10375. # Does compiler simultaneously support -c and -o options?
  10376. compiler_c_o="yes"
  10377. # Whether or not to add -lc for building shared libraries.
  10378. build_libtool_need_lc=
  10379. # Whether or not to disallow shared libs when runtime libs are static.
  10380. allow_libtool_libs_with_static_runtimes=
  10381. # Compiler flag to allow reflexive dlopens.
  10382. export_dynamic_flag_spec=""
  10383. # Compiler flag to generate shared objects directly from archives.
  10384. whole_archive_flag_spec=""
  10385. # Whether the compiler copes with passing no objects directly.
  10386. compiler_needs_object=""
  10387. # Create an old-style archive from a shared archive.
  10388. old_archive_from_new_cmds=""
  10389. # Create a temporary old-style archive to link instead of a shared archive.
  10390. old_archive_from_expsyms_cmds=""
  10391. # Commands used to build a shared archive.
  10392. archive_cmds=""
  10393. archive_expsym_cmds=""
  10394. # Commands used to build a loadable module if different from building
  10395. # a shared archive.
  10396. module_cmds=""
  10397. module_expsym_cmds=""
  10398. # Whether we are building with GNU ld or not.
  10399. with_gnu_ld=""
  10400. # Flag that allows shared libraries with undefined symbols to be built.
  10401. allow_undefined_flag=""
  10402. # Flag that enforces no undefined symbols.
  10403. no_undefined_flag=""
  10404. # Flag to hardcode $libdir into a binary during linking.
  10405. # This must work even if $libdir does not exist
  10406. hardcode_libdir_flag_spec=""
  10407. # Whether we need a single "-rpath" flag with a separated argument.
  10408. hardcode_libdir_separator=""
  10409. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  10410. # DIR into the resulting binary.
  10411. hardcode_direct=
  10412. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  10413. # DIR into the resulting binary and the resulting library dependency is
  10414. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  10415. # library is relocated.
  10416. hardcode_direct_absolute=
  10417. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  10418. # into the resulting binary.
  10419. hardcode_minus_L=
  10420. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  10421. # into the resulting binary.
  10422. hardcode_shlibpath_var=
  10423. # Set to "yes" if building a shared library automatically hardcodes DIR
  10424. # into the library and all subsequent libraries and executables linked
  10425. # against it.
  10426. hardcode_automatic=
  10427. # Set to yes if linker adds runtime paths of dependent libraries
  10428. # to runtime path list.
  10429. inherit_rpath=
  10430. # Whether libtool must link a program against all its dependency libraries.
  10431. link_all_deplibs=
  10432. # Set to "yes" if exported symbols are required.
  10433. always_export_symbols=
  10434. # The commands to list exported symbols.
  10435. export_symbols_cmds=""
  10436. # Symbols that should not be listed in the preloaded symbols.
  10437. exclude_expsyms=""
  10438. # Symbols that must always be exported.
  10439. include_expsyms=""
  10440. # Commands necessary for linking programs (against libraries) with templates.
  10441. prelink_cmds=""
  10442. # Commands necessary for finishing linking programs.
  10443. postlink_cmds=""
  10444. # Specify filename containing input files.
  10445. file_list_spec=""
  10446. # How to hardcode a shared library path into an executable.
  10447. hardcode_action=
  10448. # The directories searched by this compiler when creating a shared library.
  10449. compiler_lib_search_dirs=""
  10450. # Dependencies to place before and after the objects being linked to
  10451. # create a shared library.
  10452. predep_objects=""
  10453. postdep_objects=""
  10454. predeps=""
  10455. postdeps=""
  10456. # The library search path used internally by the compiler when linking
  10457. # a shared library.
  10458. compiler_lib_search_path=""
  10459. # ### END LIBTOOL TAG CONFIG: RC