Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #! /bin/sh
  2.  
  3. # libtool - Provide generalized library-building support services.
  4. # Generated automatically by config.status ()
  5. # Libtool was configured on host SERGE-ÏÊ:
  6. # NOTE: Changes made to this file will be lost: look at ltmain.sh.
  7. #
  8. #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
  9. #                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
  10. #                 Foundation, Inc.
  11. #   Written by Gordon Matzigkeit, 1996
  12. #
  13. #   This file is part of GNU Libtool.
  14. #
  15. # GNU Libtool is free software; you can redistribute it and/or
  16. # modify it under the terms of the GNU General Public License as
  17. # published by the Free Software Foundation; either version 2 of
  18. # the License, or (at your option) any later version.
  19. #
  20. # As a special exception to the GNU General Public License,
  21. # if you distribute this file as part of a program or library that
  22. # is built using GNU Libtool, you may include this file under the
  23. # same distribution terms that you use for the rest of that program.
  24. #
  25. # GNU Libtool is distributed in the hope that it will be useful,
  26. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  28. # GNU General Public License for more details.
  29. #
  30. # You should have received a copy of the GNU General Public License
  31. # along with GNU Libtool; see the file COPYING.  If not, a copy
  32. # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
  33. # obtained by writing to the Free Software Foundation, Inc.,
  34. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  35.  
  36.  
  37. # The names of the tagged configurations supported by this script.
  38. available_tags=""
  39.  
  40. # ### BEGIN LIBTOOL CONFIG
  41.  
  42. # Which release of libtool.m4 was used?
  43. macro_version=2.4.2
  44. macro_revision=1.3337
  45.  
  46. # Assembler program.
  47. AS="as"
  48.  
  49. # DLL creation program.
  50. DLLTOOL="dlltool"
  51.  
  52. # Object dumper program.
  53. OBJDUMP="objdump"
  54.  
  55. # Whether or not to build shared libraries.
  56. build_libtool_libs=yes
  57.  
  58. # Whether or not to build static libraries.
  59. build_old_libs=yes
  60.  
  61. # What type of objects to build.
  62. pic_mode=default
  63.  
  64. # Whether or not to optimize for fast installation.
  65. fast_install=needless
  66.  
  67. # Shell to use when invoking shell scripts.
  68. SHELL="/bin/sh"
  69.  
  70. # An echo program that protects backslashes.
  71. ECHO="printf %s\\n"
  72.  
  73. # The PATH separator for the build system.
  74. PATH_SEPARATOR=":"
  75.  
  76. # The host system.
  77. host_alias=
  78. host=i686-pc-mingw32
  79. host_os=mingw32
  80.  
  81. # The build system.
  82. build_alias=
  83. build=i686-pc-mingw32
  84. build_os=mingw32
  85.  
  86. # A sed program that does not truncate output.
  87. SED="/bin/sed"
  88.  
  89. # Sed that helps us avoid accidentally triggering echo(1) options like -n.
  90. Xsed="$SED -e 1s/^X//"
  91.  
  92. # A grep program that handles long lines.
  93. GREP="/bin/grep"
  94.  
  95. # An ERE matcher.
  96. EGREP="/bin/grep -E"
  97.  
  98. # A literal string matcher.
  99. FGREP="/bin/grep -F"
  100.  
  101. # A BSD- or MS-compatible name lister.
  102. NM="/mingw/bin/nm"
  103.  
  104. # Whether we need soft or hard links.
  105. LN_S="ln -s"
  106.  
  107. # What is the maximum length of a command?
  108. max_cmd_len=8192
  109.  
  110. # Object file suffix (normally "o").
  111. objext=o
  112.  
  113. # Executable file suffix (normally "").
  114. exeext=
  115.  
  116. # whether the shell understands "unset".
  117. lt_unset=unset
  118.  
  119. # turn spaces into newlines.
  120. SP2NL="tr \\040 \\012"
  121.  
  122. # turn newlines into spaces.
  123. NL2SP="tr \\015\\012 \\040\\040"
  124.  
  125. # convert $build file names to $host format.
  126. to_host_file_cmd=func_convert_file_msys_to_w32
  127.  
  128. # convert $build files to toolchain format.
  129. to_tool_file_cmd=func_convert_file_msys_to_w32
  130.  
  131. # Method to check whether dependent libraries are shared objects.
  132. deplibs_check_method="file_magic ^x86 archive import|^x86 DLL"
  133.  
  134. # Command to use when deplibs_check_method = "file_magic".
  135. file_magic_cmd="func_win32_libid"
  136.  
  137. # How to find potential files when deplibs_check_method = "file_magic".
  138. file_magic_glob=""
  139.  
  140. # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
  141. want_nocaseglob="yes"
  142.  
  143. # Command to associate shared and link libraries.
  144. sharedlib_from_linklib_cmd="func_cygming_dll_for_implib"
  145.  
  146. # The archiver.
  147. AR="ar"
  148.  
  149. # Flags to create an archive.
  150. AR_FLAGS="cru"
  151.  
  152. # How to feed a file listing to the archiver.
  153. archiver_list_spec="@"
  154.  
  155. # A symbol stripping program.
  156. STRIP="strip"
  157.  
  158. # Commands used to install an old-style archive.
  159. RANLIB="ranlib"
  160. old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
  161. old_postuninstall_cmds=""
  162.  
  163. # Whether to use a lock for old archive extraction.
  164. lock_old_archive_extraction=no
  165.  
  166. # A C compiler.
  167. LTCC="gcc"
  168.  
  169. # LTCC compiler flags.
  170. LTCFLAGS="-g -O2"
  171.  
  172. # Take the output of nm and produce a listing of raw symbols and C names.
  173. 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'"
  174.  
  175. # Transform the output of nm in a proper C declaration.
  176. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
  177.  
  178. # Transform the output of nm in a C name address pair.
  179. global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/  {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/  {\"\\2\", (void *) \\&\\2},/p'"
  180.  
  181. # Transform the output of nm in a C name address pair when lib prefix is needed.
  182. global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/  {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/  {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/  {\"lib\\2\", (void *) \\&\\2},/p'"
  183.  
  184. # Specify filename containing input files for $NM.
  185. nm_file_list_spec="@"
  186.  
  187. # The root where to search for dependent libraries,and in which our libraries should be installed.
  188. lt_sysroot=
  189.  
  190. # The name of the directory that contains temporary libtool files.
  191. objdir=.libs
  192.  
  193. # Used to examine libraries when file_magic_cmd begins with "file".
  194. MAGIC_CMD=file
  195.  
  196. # Must we lock files when doing compilation?
  197. need_locks="no"
  198.  
  199. # Manifest tool.
  200. MANIFEST_TOOL=":"
  201.  
  202. # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
  203. DSYMUTIL=""
  204.  
  205. # Tool to change global to local symbols on Mac OS X.
  206. NMEDIT=""
  207.  
  208. # Tool to manipulate fat objects and archives on Mac OS X.
  209. LIPO=""
  210.  
  211. # ldd/readelf like tool for Mach-O binaries on Mac OS X.
  212. OTOOL=""
  213.  
  214. # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
  215. OTOOL64=""
  216.  
  217. # Old archive suffix (normally "a").
  218. libext=a
  219.  
  220. # Shared library suffix (normally ".so").
  221. shrext_cmds=".dll"
  222.  
  223. # The commands to extract the exported symbol list from a shared archive.
  224. extract_expsyms_cmds=""
  225.  
  226. # Variables whose values should be saved in libtool wrapper scripts and
  227. # restored at link time.
  228. variables_saved_for_relink="PATH PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
  229.  
  230. # Do we need the "lib" prefix for modules?
  231. need_lib_prefix=no
  232.  
  233. # Do we need a version for libraries?
  234. need_version=no
  235.  
  236. # Library versioning type.
  237. version_type=windows
  238.  
  239. # Shared library runtime path variable.
  240. runpath_var=LD_RUN_PATH
  241.  
  242. # Shared library path variable.
  243. shlibpath_var=PATH
  244.  
  245. # Is shlibpath searched before the hard-coded library search path?
  246. shlibpath_overrides_runpath=yes
  247.  
  248. # Format of library name prefix.
  249. libname_spec="lib\$name"
  250.  
  251. # List of archive names.  First name is the real one, the rest are links.
  252. # The last name is the one that the linker finds with -lNAME
  253. library_names_spec="\$libname.dll.a"
  254.  
  255. # The coded name of the library, if different from the real name.
  256. soname_spec="\${libname}\`echo \${release} | \$SED -e s/[.]/-/g\`\${versuffix}\${shared_ext}"
  257.  
  258. # Permission mode override for installation of shared libraries.
  259. install_override_mode=""
  260.  
  261. # Command to use after installation of a shared archive.
  262. postinstall_cmds="base_file=\\\`basename \\\${file}\\\`~
  263.       dlpath=\\\`\$SHELL 2>&1 -c '. \$dir/'\\\${base_file}'i; echo \\\$dlname'\\\`~
  264.       dldir=\$destdir/\\\`dirname \\\$dlpath\\\`~
  265.       test -d \\\$dldir || mkdir -p \\\$dldir~
  266.       \$install_prog \$dir/\$dlname \\\$dldir/\$dlname~
  267.       chmod a+x \\\$dldir/\$dlname~
  268.       if test -n '\$stripme' && test -n '\$striplib'; then
  269.         eval '\$striplib \\\$dldir/\$dlname' || exit \\\$?;
  270.       fi"
  271.  
  272. # Command to use after uninstallation of a shared archive.
  273. postuninstall_cmds="dldll=\\\`\$SHELL 2>&1 -c '. \$file; echo \\\$dlname'\\\`~
  274.       dlpath=\$dir/\\\$dldll~
  275.        \$RM \\\$dlpath"
  276.  
  277. # Commands used to finish a libtool library installation in a directory.
  278. finish_cmds=""
  279.  
  280. # As "finish_cmds", except a single script fragment to be evaled but
  281. # not shown.
  282. finish_eval=""
  283.  
  284. # Whether we should hardcode library paths into libraries.
  285. hardcode_into_libs=no
  286.  
  287. # Compile-time system search path for libraries.
  288. sys_lib_search_path_spec="c:/mingw/lib/gcc/mingw32/4.7.2 c:/mingw/lib/gcc c:/mingw/mingw32/lib c:/mingw/lib /mingw/lib "
  289.  
  290. # Run-time system search path for libraries.
  291. sys_lib_dlsearch_path_spec="/lib /usr/lib"
  292.  
  293. # Whether dlopen is supported.
  294. dlopen_support=unknown
  295.  
  296. # Whether dlopen of programs is supported.
  297. dlopen_self=unknown
  298.  
  299. # Whether dlopen of statically linked programs is supported.
  300. dlopen_self_static=unknown
  301.  
  302. # Commands to strip libraries.
  303. old_striplib="strip --strip-debug"
  304. striplib="strip --strip-unneeded"
  305.  
  306.  
  307. # The linker used to build libraries.
  308. LD="c:/mingw/mingw32/bin/ld.exe"
  309.  
  310. # How to create reloadable object files.
  311. reload_flag=" -r"
  312. reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
  313.  
  314. # Commands used to build an old-style archive.
  315. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  316.  
  317. # A language specific compiler.
  318. CC="gcc"
  319.  
  320. # Is the compiler the GNU compiler?
  321. with_gcc=yes
  322.  
  323. # Compiler flag to turn off builtin functions.
  324. no_builtin_flag=" -fno-builtin"
  325.  
  326. # Additional compiler flags for building library objects.
  327. pic_flag=" -DDLL_EXPORT -DPIC"
  328.  
  329. # How to pass a linker flag through the compiler.
  330. wl="-Wl,"
  331.  
  332. # Compiler flag to prevent dynamic linking.
  333. link_static_flag="-static"
  334.  
  335. # Does compiler simultaneously support -c and -o options?
  336. compiler_c_o="yes"
  337.  
  338. # Whether or not to add -lc for building shared libraries.
  339. build_libtool_need_lc=yes
  340.  
  341. # Whether or not to disallow shared libs when runtime libs are static.
  342. allow_libtool_libs_with_static_runtimes=yes
  343.  
  344. # Compiler flag to allow reflexive dlopens.
  345. export_dynamic_flag_spec="\${wl}--export-all-symbols"
  346.  
  347. # Compiler flag to generate shared objects directly from archives.
  348. whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
  349.  
  350. # Whether the compiler copes with passing no objects directly.
  351. compiler_needs_object="no"
  352.  
  353. # Create an old-style archive from a shared archive.
  354. old_archive_from_new_cmds=""
  355.  
  356. # Create a temporary old-style archive to link instead of a shared archive.
  357. old_archive_from_expsyms_cmds=""
  358.  
  359. # Commands used to build a shared archive.
  360. archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags -o \$output_objdir/\$soname \${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib"
  361. archive_expsym_cmds="if test \\\"x\\\`\$SED 1q \$export_symbols\\\`\\\" = xEXPORTS; then
  362.           cp \$export_symbols \$output_objdir/\$soname.def;
  363.         else
  364.           echo EXPORTS > \$output_objdir/\$soname.def;
  365.           cat \$export_symbols >> \$output_objdir/\$soname.def;
  366.         fi~
  367.         \$CC -shared \$output_objdir/\$soname.def \$libobjs \$deplibs \$compiler_flags -o \$output_objdir/\$soname \${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib"
  368.  
  369. # Commands used to build a loadable module if different from building
  370. # a shared archive.
  371. module_cmds=""
  372. module_expsym_cmds=""
  373.  
  374. # Whether we are building with GNU ld or not.
  375. with_gnu_ld="yes"
  376.  
  377. # Flag that allows shared libraries with undefined symbols to be built.
  378. allow_undefined_flag="unsupported"
  379.  
  380. # Flag that enforces no undefined symbols.
  381. no_undefined_flag=""
  382.  
  383. # Flag to hardcode $libdir into a binary during linking.
  384. # This must work even if $libdir does not exist
  385. hardcode_libdir_flag_spec="-L\$libdir"
  386.  
  387. # Whether we need a single "-rpath" flag with a separated argument.
  388. hardcode_libdir_separator=""
  389.  
  390. # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
  391. # DIR into the resulting binary.
  392. hardcode_direct=no
  393.  
  394. # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
  395. # DIR into the resulting binary and the resulting library dependency is
  396. # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
  397. # library is relocated.
  398. hardcode_direct_absolute=no
  399.  
  400. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  401. # into the resulting binary.
  402. hardcode_minus_L=no
  403.  
  404. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  405. # into the resulting binary.
  406. hardcode_shlibpath_var=unsupported
  407.  
  408. # Set to "yes" if building a shared library automatically hardcodes DIR
  409. # into the library and all subsequent libraries and executables linked
  410. # against it.
  411. hardcode_automatic=no
  412.  
  413. # Set to yes if linker adds runtime paths of dependent libraries
  414. # to runtime path list.
  415. inherit_rpath=no
  416.  
  417. # Whether libtool must link a program against all its dependency libraries.
  418. link_all_deplibs=unknown
  419.  
  420. # Set to "yes" if exported symbols are required.
  421. always_export_symbols=no
  422.  
  423. # The commands to list exported symbols.
  424. 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"
  425.  
  426. # Symbols that should not be listed in the preloaded symbols.
  427. exclude_expsyms="[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname"
  428.  
  429. # Symbols that must always be exported.
  430. include_expsyms=""
  431.  
  432. # Commands necessary for linking programs (against libraries) with templates.
  433. prelink_cmds=""
  434.  
  435. # Commands necessary for finishing linking programs.
  436. postlink_cmds=""
  437.  
  438. # Specify filename containing input files.
  439. file_list_spec=""
  440.  
  441. # How to hardcode a shared library path into an executable.
  442. hardcode_action=immediate
  443.  
  444. # ### END LIBTOOL CONFIG
  445.  
  446.  
  447. # libtool (GNU libtool) 2.4.2
  448. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  449.  
  450. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
  451. # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
  452. # This is free software; see the source for copying conditions.  There is NO
  453. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  454.  
  455. # GNU Libtool is free software; you can redistribute it and/or modify
  456. # it under the terms of the GNU General Public License as published by
  457. # the Free Software Foundation; either version 2 of the License, or
  458. # (at your option) any later version.
  459. #
  460. # As a special exception to the GNU General Public License,
  461. # if you distribute this file as part of a program or library that
  462. # is built using GNU Libtool, you may include this file under the
  463. # same distribution terms that you use for the rest of that program.
  464. #
  465. # GNU Libtool is distributed in the hope that it will be useful, but
  466. # WITHOUT ANY WARRANTY; without even the implied warranty of
  467. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  468. # General Public License for more details.
  469. #
  470. # You should have received a copy of the GNU General Public License
  471. # along with GNU Libtool; see the file COPYING.  If not, a copy
  472. # can be downloaded from http://www.gnu.org/licenses/gpl.html,
  473. # or obtained by writing to the Free Software Foundation, Inc.,
  474. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  475.  
  476. # Usage: $progname [OPTION]... [MODE-ARG]...
  477. #
  478. # Provide generalized library-building support services.
  479. #
  480. #       --config             show all configuration variables
  481. #       --debug              enable verbose shell tracing
  482. #   -n, --dry-run            display commands without modifying any files
  483. #       --features           display basic configuration information and exit
  484. #       --mode=MODE          use operation mode MODE
  485. #       --preserve-dup-deps  don't remove duplicate dependency libraries
  486. #       --quiet, --silent    don't print informational messages
  487. #       --no-quiet, --no-silent
  488. #                            print informational messages (default)
  489. #       --no-warn            don't display warning messages
  490. #       --tag=TAG            use configuration variables from tag TAG
  491. #   -v, --verbose            print more informational messages than default
  492. #       --no-verbose         don't print the extra informational messages
  493. #       --version            print version information
  494. #   -h, --help, --help-all   print short, long, or detailed help message
  495. #
  496. # MODE must be one of the following:
  497. #
  498. #         clean              remove files from the build directory
  499. #         compile            compile a source file into a libtool object
  500. #         execute            automatically set library path, then run a program
  501. #         finish             complete the installation of libtool libraries
  502. #         install            install libraries or executables
  503. #         link               create a library or an executable
  504. #         uninstall          remove libraries from an installed directory
  505. #
  506. # MODE-ARGS vary depending on the MODE.  When passed as first option,
  507. # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
  508. # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
  509. #
  510. # When reporting a bug, please describe a test case to reproduce it and
  511. # include the following information:
  512. #
  513. #         host-triplet: $host
  514. #         shell:                $SHELL
  515. #         compiler:             $LTCC
  516. #         compiler flags:               $LTCFLAGS
  517. #         linker:               $LD (gnu? $with_gnu_ld)
  518. #         $progname:    (GNU libtool) 2.4.2
  519. #         automake:     $automake_version
  520. #         autoconf:     $autoconf_version
  521. #
  522. # Report bugs to <bug-libtool@gnu.org>.
  523. # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
  524. # General help using GNU software: <http://www.gnu.org/gethelp/>.
  525.  
  526. PROGRAM=libtool
  527. PACKAGE=libtool
  528. VERSION=2.4.2
  529. TIMESTAMP=""
  530. package_revision=1.3337
  531.  
  532. # Be Bourne compatible
  533. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  534.   emulate sh
  535.   NULLCMD=:
  536.   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  537.   # is contrary to our usage.  Disable this feature.
  538.   alias -g '${1+"$@"}'='"$@"'
  539.   setopt NO_GLOB_SUBST
  540. else
  541.   case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
  542. fi
  543. BIN_SH=xpg4; export BIN_SH # for Tru64
  544. DUALCASE=1; export DUALCASE # for MKS sh
  545.  
  546. # A function that is used when there is no print builtin or printf.
  547. func_fallback_echo ()
  548. {
  549.   eval 'cat <<_LTECHO_EOF
  550. $1
  551. _LTECHO_EOF'
  552. }
  553.  
  554. # NLS nuisances: We save the old values to restore during execute mode.
  555. lt_user_locale=
  556. lt_safe_locale=
  557. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  558. do
  559.   eval "if test \"\${$lt_var+set}\" = set; then
  560.           save_$lt_var=\$$lt_var
  561.           $lt_var=C
  562.           export $lt_var
  563.           lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
  564.           lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
  565.         fi"
  566. done
  567. LC_ALL=C
  568. LANGUAGE=C
  569. export LANGUAGE LC_ALL
  570.  
  571. $lt_unset CDPATH
  572.  
  573.  
  574. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  575. # is ksh but when the shell is invoked as "sh" and the current value of
  576. # the _XPG environment variable is not equal to 1 (one), the special
  577. # positional parameter $0, within a function call, is the name of the
  578. # function.
  579. progpath="$0"
  580.  
  581.  
  582.  
  583. : ${CP="cp -f"}
  584. test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
  585. : ${MAKE="make"}
  586. : ${MKDIR="mkdir"}
  587. : ${MV="mv -f"}
  588. : ${RM="rm -f"}
  589. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  590. : ${Xsed="$SED -e 1s/^X//"}
  591.  
  592. # Global variables:
  593. EXIT_SUCCESS=0
  594. EXIT_FAILURE=1
  595. EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
  596. EXIT_SKIP=77      # $? = 77 is used to indicate a skipped test to automake.
  597.  
  598. exit_status=$EXIT_SUCCESS
  599.  
  600. # Make sure IFS has a sensible default
  601. lt_nl='
  602. '
  603. IFS="   $lt_nl"
  604.  
  605. dirname="s,/[^/]*$,,"
  606. basename="s,^.*/,,"
  607.  
  608. # func_dirname file append nondir_replacement
  609. # Compute the dirname of FILE.  If nonempty, add APPEND to the result,
  610. # otherwise set result to NONDIR_REPLACEMENT.
  611. func_dirname ()
  612. {
  613.     case ${1} in
  614.       */*) func_dirname_result="${1%/*}${2}" ;;
  615.       *  ) func_dirname_result="${3}" ;;
  616.     esac
  617. } # Extended-shell func_dirname implementation
  618.  
  619.  
  620. # func_basename file
  621. func_basename ()
  622. {
  623.     func_basename_result="${1##*/}"
  624. } # Extended-shell func_basename implementation
  625.  
  626.  
  627. # func_dirname_and_basename file append nondir_replacement
  628. # perform func_basename and func_dirname in a single function
  629. # call:
  630. #   dirname:  Compute the dirname of FILE.  If nonempty,
  631. #             add APPEND to the result, otherwise set result
  632. #             to NONDIR_REPLACEMENT.
  633. #             value returned in "$func_dirname_result"
  634. #   basename: Compute filename of FILE.
  635. #             value retuned in "$func_basename_result"
  636. # Implementation must be kept synchronized with func_dirname
  637. # and func_basename. For efficiency, we do not delegate to
  638. # those functions but instead duplicate the functionality here.
  639. func_dirname_and_basename ()
  640. {
  641.     case ${1} in
  642.       */*) func_dirname_result="${1%/*}${2}" ;;
  643.       *  ) func_dirname_result="${3}" ;;
  644.     esac
  645.     func_basename_result="${1##*/}"
  646. } # Extended-shell func_dirname_and_basename implementation
  647.  
  648.  
  649. # func_stripname prefix suffix name
  650. # strip PREFIX and SUFFIX off of NAME.
  651. # PREFIX and SUFFIX must not contain globbing or regex special
  652. # characters, hashes, percent signs, but SUFFIX may contain a leading
  653. # dot (in which case that matches only a dot).
  654. # func_strip_suffix prefix name
  655. func_stripname ()
  656. {
  657.     # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  658.     # positional parameters, so assign one to ordinary parameter first.
  659.     func_stripname_result=${3}
  660.     func_stripname_result=${func_stripname_result#"${1}"}
  661.     func_stripname_result=${func_stripname_result%"${2}"}
  662. } # Extended-shell func_stripname implementation
  663.  
  664.  
  665. # These SED scripts presuppose an absolute path with a trailing slash.
  666. pathcar='s,^/\([^/]*\).*$,\1,'
  667. pathcdr='s,^/[^/]*,,'
  668. removedotparts=':dotsl
  669.                 s@/\./@/@g
  670.                 t dotsl
  671.                 s,/\.$,/,'
  672. collapseslashes='s@/\{1,\}@/@g'
  673. finalslash='s,/*$,/,'
  674.  
  675. # func_normal_abspath PATH
  676. # Remove doubled-up and trailing slashes, "." path components,
  677. # and cancel out any ".." path components in PATH after making
  678. # it an absolute path.
  679. #             value returned in "$func_normal_abspath_result"
  680. func_normal_abspath ()
  681. {
  682.   # Start from root dir and reassemble the path.
  683.   func_normal_abspath_result=
  684.   func_normal_abspath_tpath=$1
  685.   func_normal_abspath_altnamespace=
  686.   case $func_normal_abspath_tpath in
  687.     "")
  688.       # Empty path, that just means $cwd.
  689.       func_stripname '' '/' "`pwd`"
  690.       func_normal_abspath_result=$func_stripname_result
  691.       return
  692.     ;;
  693.     # The next three entries are used to spot a run of precisely
  694.     # two leading slashes without using negated character classes;
  695.     # we take advantage of case's first-match behaviour.
  696.     ///*)
  697.       # Unusual form of absolute path, do nothing.
  698.     ;;
  699.     //*)
  700.       # Not necessarily an ordinary path; POSIX reserves leading '//'
  701.       # and for example Cygwin uses it to access remote file shares
  702.       # over CIFS/SMB, so we conserve a leading double slash if found.
  703.       func_normal_abspath_altnamespace=/
  704.     ;;
  705.     /*)
  706.       # Absolute path, do nothing.
  707.     ;;
  708.     *)
  709.       # Relative path, prepend $cwd.
  710.       func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  711.     ;;
  712.   esac
  713.   # Cancel out all the simple stuff to save iterations.  We also want
  714.   # the path to end with a slash for ease of parsing, so make sure
  715.   # there is one (and only one) here.
  716.   func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  717.         -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
  718.   while :; do
  719.     # Processed it all yet?
  720.     if test "$func_normal_abspath_tpath" = / ; then
  721.       # If we ascended to the root using ".." the result may be empty now.
  722.       if test -z "$func_normal_abspath_result" ; then
  723.         func_normal_abspath_result=/
  724.       fi
  725.       break
  726.     fi
  727.     func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  728.         -e "$pathcar"`
  729.     func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  730.         -e "$pathcdr"`
  731.     # Figure out what to do with it
  732.     case $func_normal_abspath_tcomponent in
  733.       "")
  734.         # Trailing empty path component, ignore it.
  735.       ;;
  736.       ..)
  737.         # Parent dir; strip last assembled component from result.
  738.         func_dirname "$func_normal_abspath_result"
  739.         func_normal_abspath_result=$func_dirname_result
  740.       ;;
  741.       *)
  742.         # Actual path component, append it.
  743.         func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
  744.       ;;
  745.     esac
  746.   done
  747.   # Restore leading double-slash if one was found on entry.
  748.   func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  749. }
  750.  
  751. # func_relative_path SRCDIR DSTDIR
  752. # generates a relative path from SRCDIR to DSTDIR, with a trailing
  753. # slash if non-empty, suitable for immediately appending a filename
  754. # without needing to append a separator.
  755. #             value returned in "$func_relative_path_result"
  756. func_relative_path ()
  757. {
  758.   func_relative_path_result=
  759.   func_normal_abspath "$1"
  760.   func_relative_path_tlibdir=$func_normal_abspath_result
  761.   func_normal_abspath "$2"
  762.   func_relative_path_tbindir=$func_normal_abspath_result
  763.  
  764.   # Ascend the tree starting from libdir
  765.   while :; do
  766.     # check if we have found a prefix of bindir
  767.     case $func_relative_path_tbindir in
  768.       $func_relative_path_tlibdir)
  769.         # found an exact match
  770.         func_relative_path_tcancelled=
  771.         break
  772.         ;;
  773.       $func_relative_path_tlibdir*)
  774.         # found a matching prefix
  775.         func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  776.         func_relative_path_tcancelled=$func_stripname_result
  777.         if test -z "$func_relative_path_result"; then
  778.           func_relative_path_result=.
  779.         fi
  780.         break
  781.         ;;
  782.       *)
  783.         func_dirname $func_relative_path_tlibdir
  784.         func_relative_path_tlibdir=${func_dirname_result}
  785.         if test "x$func_relative_path_tlibdir" = x ; then
  786.           # Have to descend all the way to the root!
  787.           func_relative_path_result=../$func_relative_path_result
  788.           func_relative_path_tcancelled=$func_relative_path_tbindir
  789.           break
  790.         fi
  791.         func_relative_path_result=../$func_relative_path_result
  792.         ;;
  793.     esac
  794.   done
  795.  
  796.   # Now calculate path; take care to avoid doubling-up slashes.
  797.   func_stripname '' '/' "$func_relative_path_result"
  798.   func_relative_path_result=$func_stripname_result
  799.   func_stripname '/' '/' "$func_relative_path_tcancelled"
  800.   if test "x$func_stripname_result" != x ; then
  801.     func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
  802.   fi
  803.  
  804.   # Normalisation. If bindir is libdir, return empty string,
  805.   # else relative path ending with a slash; either way, target
  806.   # file name can be directly appended.
  807.   if test ! -z "$func_relative_path_result"; then
  808.     func_stripname './' '' "$func_relative_path_result/"
  809.     func_relative_path_result=$func_stripname_result
  810.   fi
  811. }
  812.  
  813. # The name of this program:
  814. func_dirname_and_basename "$progpath"
  815. progname=$func_basename_result
  816.  
  817. # Make sure we have an absolute path for reexecution:
  818. case $progpath in
  819.   [\\/]*|[A-Za-z]:\\*) ;;
  820.   *[\\/]*)
  821.      progdir=$func_dirname_result
  822.      progdir=`cd "$progdir" && pwd`
  823.      progpath="$progdir/$progname"
  824.      ;;
  825.   *)
  826.      save_IFS="$IFS"
  827.      IFS=${PATH_SEPARATOR-:}
  828.      for progdir in $PATH; do
  829.        IFS="$save_IFS"
  830.        test -x "$progdir/$progname" && break
  831.      done
  832.      IFS="$save_IFS"
  833.      test -n "$progdir" || progdir=`pwd`
  834.      progpath="$progdir/$progname"
  835.      ;;
  836. esac
  837.  
  838. # Sed substitution that helps us do robust quoting.  It backslashifies
  839. # metacharacters that are still active within double-quoted strings.
  840. Xsed="${SED}"' -e 1s/^X//'
  841. sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
  842.  
  843. # Same as above, but do not quote variable references.
  844. double_quote_subst='s/\(["`\\]\)/\\\1/g'
  845.  
  846. # Sed substitution that turns a string into a regex matching for the
  847. # string literally.
  848. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
  849.  
  850. # Sed substitution that converts a w32 file name or path
  851. # which contains forward slashes, into one that contains
  852. # (escaped) backslashes.  A very naive implementation.
  853. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  854.  
  855. # Re-`\' parameter expansions in output of double_quote_subst that were
  856. # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
  857. # in input to double_quote_subst, that '$' was protected from expansion.
  858. # Since each input `\' is now two `\'s, look for any number of runs of
  859. # four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
  860. bs='\\'
  861. bs2='\\\\'
  862. bs4='\\\\\\\\'
  863. dollar='\$'
  864. sed_double_backslash="\
  865.   s/$bs4/&\\
  866. /g
  867.   s/^$bs2$dollar/$bs&/
  868.   s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
  869.   s/\n//g"
  870.  
  871. # Standard options:
  872. opt_dry_run=false
  873. opt_help=false
  874. opt_quiet=false
  875. opt_verbose=false
  876. opt_warning=:
  877.  
  878. # func_echo arg...
  879. # Echo program name prefixed message, along with the current mode
  880. # name if it has been set yet.
  881. func_echo ()
  882. {
  883.     $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
  884. }
  885.  
  886. # func_verbose arg...
  887. # Echo program name prefixed message in verbose mode only.
  888. func_verbose ()
  889. {
  890.     $opt_verbose && func_echo ${1+"$@"}
  891.  
  892.     # A bug in bash halts the script if the last line of a function
  893.     # fails when set -e is in force, so we need another command to
  894.     # work around that:
  895.     :
  896. }
  897.  
  898. # func_echo_all arg...
  899. # Invoke $ECHO with all args, space-separated.
  900. func_echo_all ()
  901. {
  902.     $ECHO "$*"
  903. }
  904.  
  905. # func_error arg...
  906. # Echo program name prefixed message to standard error.
  907. func_error ()
  908. {
  909.     $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
  910. }
  911.  
  912. # func_warning arg...
  913. # Echo program name prefixed warning message to standard error.
  914. func_warning ()
  915. {
  916.     $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
  917.  
  918.     # bash bug again:
  919.     :
  920. }
  921.  
  922. # func_fatal_error arg...
  923. # Echo program name prefixed message to standard error, and exit.
  924. func_fatal_error ()
  925. {
  926.     func_error ${1+"$@"}
  927.     exit $EXIT_FAILURE
  928. }
  929.  
  930. # func_fatal_help arg...
  931. # Echo program name prefixed message to standard error, followed by
  932. # a help hint, and exit.
  933. func_fatal_help ()
  934. {
  935.     func_error ${1+"$@"}
  936.     func_fatal_error "$help"
  937. }
  938. help="Try \`$progname --help' for more information."  ## default
  939.  
  940.  
  941. # func_grep expression filename
  942. # Check whether EXPRESSION matches any line of FILENAME, without output.
  943. func_grep ()
  944. {
  945.     $GREP "$1" "$2" >/dev/null 2>&1
  946. }
  947.  
  948.  
  949. # func_mkdir_p directory-path
  950. # Make sure the entire path to DIRECTORY-PATH is available.
  951. func_mkdir_p ()
  952. {
  953.     my_directory_path="$1"
  954.     my_dir_list=
  955.  
  956.     if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
  957.  
  958.       # Protect directory names starting with `-'
  959.       case $my_directory_path in
  960.         -*) my_directory_path="./$my_directory_path" ;;
  961.       esac
  962.  
  963.       # While some portion of DIR does not yet exist...
  964.       while test ! -d "$my_directory_path"; do
  965.         # ...make a list in topmost first order.  Use a colon delimited
  966.         # list incase some portion of path contains whitespace.
  967.         my_dir_list="$my_directory_path:$my_dir_list"
  968.  
  969.         # If the last portion added has no slash in it, the list is done
  970.         case $my_directory_path in */*) ;; *) break ;; esac
  971.  
  972.         # ...otherwise throw away the child directory and loop
  973.         my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
  974.       done
  975.       my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
  976.  
  977.       save_mkdir_p_IFS="$IFS"; IFS=':'
  978.       for my_dir in $my_dir_list; do
  979.         IFS="$save_mkdir_p_IFS"
  980.         # mkdir can fail with a `File exist' error if two processes
  981.         # try to create one of the directories concurrently.  Don't
  982.         # stop in that case!
  983.         $MKDIR "$my_dir" 2>/dev/null || :
  984.       done
  985.       IFS="$save_mkdir_p_IFS"
  986.  
  987.       # Bail out if we (or some other process) failed to create a directory.
  988.       test -d "$my_directory_path" || \
  989.         func_fatal_error "Failed to create \`$1'"
  990.     fi
  991. }
  992.  
  993.  
  994. # func_mktempdir [string]
  995. # Make a temporary directory that won't clash with other running
  996. # libtool processes, and avoids race conditions if possible.  If
  997. # given, STRING is the basename for that directory.
  998. func_mktempdir ()
  999. {
  1000.     my_template="${TMPDIR-/tmp}/${1-$progname}"
  1001.  
  1002.     if test "$opt_dry_run" = ":"; then
  1003.       # Return a directory name, but don't create it in dry-run mode
  1004.       my_tmpdir="${my_template}-$$"
  1005.     else
  1006.  
  1007.       # If mktemp works, use that first and foremost
  1008.       my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
  1009.  
  1010.       if test ! -d "$my_tmpdir"; then
  1011.         # Failing that, at least try and use $RANDOM to avoid a race
  1012.         my_tmpdir="${my_template}-${RANDOM-0}$$"
  1013.  
  1014.         save_mktempdir_umask=`umask`
  1015.         umask 0077
  1016.         $MKDIR "$my_tmpdir"
  1017.         umask $save_mktempdir_umask
  1018.       fi
  1019.  
  1020.       # If we're not in dry-run mode, bomb out on failure
  1021.       test -d "$my_tmpdir" || \
  1022.         func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
  1023.     fi
  1024.  
  1025.     $ECHO "$my_tmpdir"
  1026. }
  1027.  
  1028.  
  1029. # func_quote_for_eval arg
  1030. # Aesthetically quote ARG to be evaled later.
  1031. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
  1032. # is double-quoted, suitable for a subsequent eval, whereas
  1033. # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
  1034. # which are still active within double quotes backslashified.
  1035. func_quote_for_eval ()
  1036. {
  1037.     case $1 in
  1038.       *[\\\`\"\$]*)
  1039.         func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
  1040.       *)
  1041.         func_quote_for_eval_unquoted_result="$1" ;;
  1042.     esac
  1043.  
  1044.     case $func_quote_for_eval_unquoted_result in
  1045.       # Double-quote args containing shell metacharacters to delay
  1046.       # word splitting, command substitution and and variable
  1047.       # expansion for a subsequent eval.
  1048.       # Many Bourne shells cannot handle close brackets correctly
  1049.       # in scan sets, so we specify it separately.
  1050.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
  1051.         func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
  1052.         ;;
  1053.       *)
  1054.         func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
  1055.     esac
  1056. }
  1057.  
  1058.  
  1059. # func_quote_for_expand arg
  1060. # Aesthetically quote ARG to be evaled later; same as above,
  1061. # but do not quote variable references.
  1062. func_quote_for_expand ()
  1063. {
  1064.     case $1 in
  1065.       *[\\\`\"]*)
  1066.         my_arg=`$ECHO "$1" | $SED \
  1067.             -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
  1068.       *)
  1069.         my_arg="$1" ;;
  1070.     esac
  1071.  
  1072.     case $my_arg in
  1073.       # Double-quote args containing shell metacharacters to delay
  1074.       # word splitting and command substitution for a subsequent eval.
  1075.       # Many Bourne shells cannot handle close brackets correctly
  1076.       # in scan sets, so we specify it separately.
  1077.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
  1078.         my_arg="\"$my_arg\""
  1079.         ;;
  1080.     esac
  1081.  
  1082.     func_quote_for_expand_result="$my_arg"
  1083. }
  1084.  
  1085.  
  1086. # func_show_eval cmd [fail_exp]
  1087. # Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
  1088. # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
  1089. # is given, then evaluate it.
  1090. func_show_eval ()
  1091. {
  1092.     my_cmd="$1"
  1093.     my_fail_exp="${2-:}"
  1094.  
  1095.     ${opt_silent-false} || {
  1096.       func_quote_for_expand "$my_cmd"
  1097.       eval "func_echo $func_quote_for_expand_result"
  1098.     }
  1099.  
  1100.     if ${opt_dry_run-false}; then :; else
  1101.       eval "$my_cmd"
  1102.       my_status=$?
  1103.       if test "$my_status" -eq 0; then :; else
  1104.         eval "(exit $my_status); $my_fail_exp"
  1105.       fi
  1106.     fi
  1107. }
  1108.  
  1109.  
  1110. # func_show_eval_locale cmd [fail_exp]
  1111. # Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
  1112. # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
  1113. # is given, then evaluate it.  Use the saved locale for evaluation.
  1114. func_show_eval_locale ()
  1115. {
  1116.     my_cmd="$1"
  1117.     my_fail_exp="${2-:}"
  1118.  
  1119.     ${opt_silent-false} || {
  1120.       func_quote_for_expand "$my_cmd"
  1121.       eval "func_echo $func_quote_for_expand_result"
  1122.     }
  1123.  
  1124.     if ${opt_dry_run-false}; then :; else
  1125.       eval "$lt_user_locale
  1126.             $my_cmd"
  1127.       my_status=$?
  1128.       eval "$lt_safe_locale"
  1129.       if test "$my_status" -eq 0; then :; else
  1130.         eval "(exit $my_status); $my_fail_exp"
  1131.       fi
  1132.     fi
  1133. }
  1134.  
  1135. # func_tr_sh
  1136. # Turn $1 into a string suitable for a shell variable name.
  1137. # Result is stored in $func_tr_sh_result.  All characters
  1138. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1139. # if $1 begins with a digit, a '_' is prepended as well.
  1140. func_tr_sh ()
  1141. {
  1142.   case $1 in
  1143.   [0-9]* | *[!a-zA-Z0-9_]*)
  1144.     func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
  1145.     ;;
  1146.   * )
  1147.     func_tr_sh_result=$1
  1148.     ;;
  1149.   esac
  1150. }
  1151.  
  1152.  
  1153. # func_version
  1154. # Echo version message to standard output and exit.
  1155. func_version ()
  1156. {
  1157.     $opt_debug
  1158.  
  1159.     $SED -n '/(C)/!b go
  1160.         :more
  1161.         /\./!{
  1162.           N
  1163.           s/\n# / /
  1164.           b more
  1165.         }
  1166.         :go
  1167.         /^# '$PROGRAM' (GNU /,/# warranty; / {
  1168.         s/^# //
  1169.         s/^# *$//
  1170.         s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
  1171.         p
  1172.      }' < "$progpath"
  1173.      exit $?
  1174. }
  1175.  
  1176. # func_usage
  1177. # Echo short help message to standard output and exit.
  1178. func_usage ()
  1179. {
  1180.     $opt_debug
  1181.  
  1182.     $SED -n '/^# Usage:/,/^#  *.*--help/ {
  1183.         s/^# //
  1184.         s/^# *$//
  1185.         s/\$progname/'$progname'/
  1186.         p
  1187.     }' < "$progpath"
  1188.     echo
  1189.     $ECHO "run \`$progname --help | more' for full usage"
  1190.     exit $?
  1191. }
  1192.  
  1193. # func_help [NOEXIT]
  1194. # Echo long help message to standard output and exit,
  1195. # unless 'noexit' is passed as argument.
  1196. func_help ()
  1197. {
  1198.     $opt_debug
  1199.  
  1200.     $SED -n '/^# Usage:/,/# Report bugs to/ {
  1201.         :print
  1202.         s/^# //
  1203.         s/^# *$//
  1204.         s*\$progname*'$progname'*
  1205.         s*\$host*'"$host"'*
  1206.         s*\$SHELL*'"$SHELL"'*
  1207.         s*\$LTCC*'"$LTCC"'*
  1208.         s*\$LTCFLAGS*'"$LTCFLAGS"'*
  1209.         s*\$LD*'"$LD"'*
  1210.         s/\$with_gnu_ld/'"$with_gnu_ld"'/
  1211.         s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
  1212.         s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
  1213.         p
  1214.         d
  1215.      }
  1216.      /^# .* home page:/b print
  1217.      /^# General help using/b print
  1218.      ' < "$progpath"
  1219.     ret=$?
  1220.     if test -z "$1"; then
  1221.       exit $ret
  1222.     fi
  1223. }
  1224.  
  1225. # func_missing_arg argname
  1226. # Echo program name prefixed message to standard error and set global
  1227. # exit_cmd.
  1228. func_missing_arg ()
  1229. {
  1230.     $opt_debug
  1231.  
  1232.     func_error "missing argument for $1."
  1233.     exit_cmd=exit
  1234. }
  1235.  
  1236.  
  1237. # func_split_short_opt shortopt
  1238. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  1239. # variables after splitting SHORTOPT after the 2nd character.
  1240. func_split_short_opt ()
  1241. {
  1242.     func_split_short_opt_arg=${1#??}
  1243.     func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  1244. } # Extended-shell func_split_short_opt implementation
  1245.  
  1246.  
  1247. # func_split_long_opt longopt
  1248. # Set func_split_long_opt_name and func_split_long_opt_arg shell
  1249. # variables after splitting LONGOPT at the `=' sign.
  1250. func_split_long_opt ()
  1251. {
  1252.     func_split_long_opt_name=${1%%=*}
  1253.     func_split_long_opt_arg=${1#*=}
  1254. } # Extended-shell func_split_long_opt implementation
  1255.  
  1256. exit_cmd=:
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262. magic="%%%MAGIC variable%%%"
  1263. magic_exe="%%%MAGIC EXE variable%%%"
  1264.  
  1265. # Global variables.
  1266. nonopt=
  1267. preserve_args=
  1268. lo2o="s/\\.lo\$/.${objext}/"
  1269. o2lo="s/\\.${objext}\$/.lo/"
  1270. extracted_archives=
  1271. extracted_serial=0
  1272.  
  1273. # If this variable is set in any of the actions, the command in it
  1274. # will be execed at the end.  This prevents here-documents from being
  1275. # left over by shells.
  1276. exec_cmd=
  1277.  
  1278. # func_append var value
  1279. # Append VALUE to the end of shell variable VAR.
  1280. func_append ()
  1281. {
  1282.     eval "${1}+=\${2}"
  1283. } # Extended-shell func_append implementation
  1284.  
  1285. # func_append_quoted var value
  1286. # Quote VALUE and append to the end of shell variable VAR, separated
  1287. # by a space.
  1288. func_append_quoted ()
  1289. {
  1290.     func_quote_for_eval "${2}"
  1291.     eval "${1}+=\\ \$func_quote_for_eval_result"
  1292. } # Extended-shell func_append_quoted implementation
  1293.  
  1294.  
  1295. # func_arith arithmetic-term...
  1296. func_arith ()
  1297. {
  1298.     func_arith_result=$(( $* ))
  1299. } # Extended-shell func_arith implementation
  1300.  
  1301.  
  1302. # func_len string
  1303. # STRING may not start with a hyphen.
  1304. func_len ()
  1305. {
  1306.     func_len_result=${#1}
  1307. } # Extended-shell func_len implementation
  1308.  
  1309.  
  1310. # func_lo2o object
  1311. func_lo2o ()
  1312. {
  1313.     case ${1} in
  1314.       *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
  1315.       *)    func_lo2o_result=${1} ;;
  1316.     esac
  1317. } # Extended-shell func_lo2o implementation
  1318.  
  1319.  
  1320. # func_xform libobj-or-source
  1321. func_xform ()
  1322. {
  1323.     func_xform_result=${1%.*}.lo
  1324. } # Extended-shell func_xform implementation
  1325.  
  1326.  
  1327. # func_fatal_configuration arg...
  1328. # Echo program name prefixed message to standard error, followed by
  1329. # a configuration failure hint, and exit.
  1330. func_fatal_configuration ()
  1331. {
  1332.     func_error ${1+"$@"}
  1333.     func_error "See the $PACKAGE documentation for more information."
  1334.     func_fatal_error "Fatal configuration error."
  1335. }
  1336.  
  1337.  
  1338. # func_config
  1339. # Display the configuration for all the tags in this script.
  1340. func_config ()
  1341. {
  1342.     re_begincf='^# ### BEGIN LIBTOOL'
  1343.     re_endcf='^# ### END LIBTOOL'
  1344.  
  1345.     # Default configuration.
  1346.     $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  1347.  
  1348.     # Now print the configurations for the tags.
  1349.     for tagname in $taglist; do
  1350.       $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  1351.     done
  1352.  
  1353.     exit $?
  1354. }
  1355.  
  1356. # func_features
  1357. # Display the features supported by this script.
  1358. func_features ()
  1359. {
  1360.     echo "host: $host"
  1361.     if test "$build_libtool_libs" = yes; then
  1362.       echo "enable shared libraries"
  1363.     else
  1364.       echo "disable shared libraries"
  1365.     fi
  1366.     if test "$build_old_libs" = yes; then
  1367.       echo "enable static libraries"
  1368.     else
  1369.       echo "disable static libraries"
  1370.     fi
  1371.  
  1372.     exit $?
  1373. }
  1374.  
  1375. # func_enable_tag tagname
  1376. # Verify that TAGNAME is valid, and either flag an error and exit, or
  1377. # enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
  1378. # variable here.
  1379. func_enable_tag ()
  1380. {
  1381.   # Global variable:
  1382.   tagname="$1"
  1383.  
  1384.   re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  1385.   re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  1386.   sed_extractcf="/$re_begincf/,/$re_endcf/p"
  1387.  
  1388.   # Validate tagname.
  1389.   case $tagname in
  1390.     *[!-_A-Za-z0-9,/]*)
  1391.       func_fatal_error "invalid tag name: $tagname"
  1392.       ;;
  1393.   esac
  1394.  
  1395.   # Don't test for the "default" C tag, as we know it's
  1396.   # there but not specially marked.
  1397.   case $tagname in
  1398.     CC) ;;
  1399.     *)
  1400.       if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  1401.         taglist="$taglist $tagname"
  1402.  
  1403.         # Evaluate the configuration.  Be careful to quote the path
  1404.         # and the sed script, to avoid splitting on whitespace, but
  1405.         # also don't use non-portable quotes within backquotes within
  1406.         # quotes we have to do it in 2 steps:
  1407.         extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  1408.         eval "$extractedcf"
  1409.       else
  1410.         func_error "ignoring unknown tag $tagname"
  1411.       fi
  1412.       ;;
  1413.   esac
  1414. }
  1415.  
  1416. # func_check_version_match
  1417. # Ensure that we are using m4 macros, and libtool script from the same
  1418. # release of libtool.
  1419. func_check_version_match ()
  1420. {
  1421.   if test "$package_revision" != "$macro_revision"; then
  1422.     if test "$VERSION" != "$macro_version"; then
  1423.       if test -z "$macro_version"; then
  1424.         cat >&2 <<_LT_EOF
  1425. $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
  1426. $progname: definition of this LT_INIT comes from an older release.
  1427. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  1428. $progname: and run autoconf again.
  1429. _LT_EOF
  1430.       else
  1431.         cat >&2 <<_LT_EOF
  1432. $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
  1433. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  1434. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  1435. $progname: and run autoconf again.
  1436. _LT_EOF
  1437.       fi
  1438.     else
  1439.       cat >&2 <<_LT_EOF
  1440. $progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
  1441. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  1442. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  1443. $progname: of $PACKAGE $VERSION and run autoconf again.
  1444. _LT_EOF
  1445.     fi
  1446.  
  1447.     exit $EXIT_MISMATCH
  1448.   fi
  1449. }
  1450.  
  1451.  
  1452. # Shorthand for --mode=foo, only valid as the first argument
  1453. case $1 in
  1454. clean|clea|cle|cl)
  1455.   shift; set dummy --mode clean ${1+"$@"}; shift
  1456.   ;;
  1457. compile|compil|compi|comp|com|co|c)
  1458.   shift; set dummy --mode compile ${1+"$@"}; shift
  1459.   ;;
  1460. execute|execut|execu|exec|exe|ex|e)
  1461.   shift; set dummy --mode execute ${1+"$@"}; shift
  1462.   ;;
  1463. finish|finis|fini|fin|fi|f)
  1464.   shift; set dummy --mode finish ${1+"$@"}; shift
  1465.   ;;
  1466. install|instal|insta|inst|ins|in|i)
  1467.   shift; set dummy --mode install ${1+"$@"}; shift
  1468.   ;;
  1469. link|lin|li|l)
  1470.   shift; set dummy --mode link ${1+"$@"}; shift
  1471.   ;;
  1472. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  1473.   shift; set dummy --mode uninstall ${1+"$@"}; shift
  1474.   ;;
  1475. esac
  1476.  
  1477.  
  1478.  
  1479. # Option defaults:
  1480. opt_debug=:
  1481. opt_dry_run=false
  1482. opt_config=false
  1483. opt_preserve_dup_deps=false
  1484. opt_features=false
  1485. opt_finish=false
  1486. opt_help=false
  1487. opt_help_all=false
  1488. opt_silent=:
  1489. opt_warning=:
  1490. opt_verbose=:
  1491. opt_silent=false
  1492. opt_verbose=false
  1493.  
  1494.  
  1495. # Parse options once, thoroughly.  This comes as soon as possible in the
  1496. # script to make things like `--version' happen as quickly as we can.
  1497. {
  1498.   # this just eases exit handling
  1499.   while test $# -gt 0; do
  1500.     opt="$1"
  1501.     shift
  1502.     case $opt in
  1503.       --debug|-x)       opt_debug='set -x'
  1504.                         func_echo "enabling shell trace mode"
  1505.                         $opt_debug
  1506.                         ;;
  1507.       --dry-run|--dryrun|-n)
  1508.                         opt_dry_run=:
  1509.                         ;;
  1510.       --config)
  1511.                         opt_config=:
  1512. func_config
  1513.                         ;;
  1514.       --dlopen|-dlopen)
  1515.                         optarg="$1"
  1516.                         opt_dlopen="${opt_dlopen+$opt_dlopen
  1517. }$optarg"
  1518.                         shift
  1519.                         ;;
  1520.       --preserve-dup-deps)
  1521.                         opt_preserve_dup_deps=:
  1522.                         ;;
  1523.       --features)
  1524.                         opt_features=:
  1525. func_features
  1526.                         ;;
  1527.       --finish)
  1528.                         opt_finish=:
  1529. set dummy --mode finish ${1+"$@"}; shift
  1530.                         ;;
  1531.       --help)
  1532.                         opt_help=:
  1533.                         ;;
  1534.       --help-all)
  1535.                         opt_help_all=:
  1536. opt_help=': help-all'
  1537.                         ;;
  1538.       --mode)
  1539.                         test $# = 0 && func_missing_arg $opt && break
  1540.                         optarg="$1"
  1541.                         opt_mode="$optarg"
  1542. case $optarg in
  1543.   # Valid mode arguments:
  1544.   clean|compile|execute|finish|install|link|relink|uninstall) ;;
  1545.  
  1546.   # Catch anything else as an error
  1547.   *) func_error "invalid argument for $opt"
  1548.      exit_cmd=exit
  1549.      break
  1550.      ;;
  1551. esac
  1552.                         shift
  1553.                         ;;
  1554.       --no-silent|--no-quiet)
  1555.                         opt_silent=false
  1556. preserve_args+=" $opt"
  1557.                         ;;
  1558.       --no-warning|--no-warn)
  1559.                         opt_warning=false
  1560. preserve_args+=" $opt"
  1561.                         ;;
  1562.       --no-verbose)
  1563.                         opt_verbose=false
  1564. preserve_args+=" $opt"
  1565.                         ;;
  1566.       --silent|--quiet)
  1567.                         opt_silent=:
  1568. preserve_args+=" $opt"
  1569.         opt_verbose=false
  1570.                         ;;
  1571.       --verbose|-v)
  1572.                         opt_verbose=:
  1573. preserve_args+=" $opt"
  1574. opt_silent=false
  1575.                         ;;
  1576.       --tag)
  1577.                         test $# = 0 && func_missing_arg $opt && break
  1578.                         optarg="$1"
  1579.                         opt_tag="$optarg"
  1580. preserve_args+=" $opt $optarg"
  1581. func_enable_tag "$optarg"
  1582.                         shift
  1583.                         ;;
  1584.  
  1585.       -\?|-h)           func_usage                              ;;
  1586.       --help)           func_help                               ;;
  1587.       --version)        func_version                            ;;
  1588.  
  1589.       # Separate optargs to long options:
  1590.       --*=*)
  1591.                         func_split_long_opt "$opt"
  1592.                         set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
  1593.                         shift
  1594.                         ;;
  1595.  
  1596.       # Separate non-argument short options:
  1597.       -\?*|-h*|-n*|-v*)
  1598.                         func_split_short_opt "$opt"
  1599.                         set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
  1600.                         shift
  1601.                         ;;
  1602.  
  1603.       --)               break                                   ;;
  1604.       -*)               func_fatal_help "unrecognized option \`$opt'" ;;
  1605.       *)                set dummy "$opt" ${1+"$@"};     shift; break  ;;
  1606.     esac
  1607.   done
  1608.  
  1609.   # Validate options:
  1610.  
  1611.   # save first non-option argument
  1612.   if test "$#" -gt 0; then
  1613.     nonopt="$opt"
  1614.     shift
  1615.   fi
  1616.  
  1617.   # preserve --debug
  1618.   test "$opt_debug" = : || preserve_args+=" --debug"
  1619.  
  1620.   case $host in
  1621.     *cygwin* | *mingw* | *pw32* | *cegcc*)
  1622.       # don't eliminate duplications in $postdeps and $predeps
  1623.       opt_duplicate_compiler_generated_deps=:
  1624.       ;;
  1625.     *)
  1626.       opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  1627.       ;;
  1628.   esac
  1629.  
  1630.   $opt_help || {
  1631.     # Sanity checks first:
  1632.     func_check_version_match
  1633.  
  1634.     if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  1635.       func_fatal_configuration "not configured to build any kind of library"
  1636.     fi
  1637.  
  1638.     # Darwin sucks
  1639.     eval std_shrext=\"$shrext_cmds\"
  1640.  
  1641.     # Only execute mode is allowed to have -dlopen flags.
  1642.     if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
  1643.       func_error "unrecognized option \`-dlopen'"
  1644.       $ECHO "$help" 1>&2
  1645.       exit $EXIT_FAILURE
  1646.     fi
  1647.  
  1648.     # Change the help message to a mode-specific one.
  1649.     generic_help="$help"
  1650.     help="Try \`$progname --help --mode=$opt_mode' for more information."
  1651.   }
  1652.  
  1653.  
  1654.   # Bail if the options were screwed
  1655.   $exit_cmd $EXIT_FAILURE
  1656. }
  1657.  
  1658.  
  1659.  
  1660.  
  1661. ## ----------- ##
  1662. ##    Main.    ##
  1663. ## ----------- ##
  1664.  
  1665. # func_lalib_p file
  1666. # True iff FILE is a libtool `.la' library or `.lo' object file.
  1667. # This function is only a basic sanity check; it will hardly flush out
  1668. # determined imposters.
  1669. func_lalib_p ()
  1670. {
  1671.     test -f "$1" &&
  1672.       $SED -e 4q "$1" 2>/dev/null \
  1673.         | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  1674. }
  1675.  
  1676. # func_lalib_unsafe_p file
  1677. # True iff FILE is a libtool `.la' library or `.lo' object file.
  1678. # This function implements the same check as func_lalib_p without
  1679. # resorting to external programs.  To this end, it redirects stdin and
  1680. # closes it afterwards, without saving the original file descriptor.
  1681. # As a safety measure, use it only where a negative result would be
  1682. # fatal anyway.  Works if `file' does not exist.
  1683. func_lalib_unsafe_p ()
  1684. {
  1685.     lalib_p=no
  1686.     if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  1687.         for lalib_p_l in 1 2 3 4
  1688.         do
  1689.             read lalib_p_line
  1690.             case "$lalib_p_line" in
  1691.                 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  1692.             esac
  1693.         done
  1694.         exec 0<&5 5<&-
  1695.     fi
  1696.     test "$lalib_p" = yes
  1697. }
  1698.  
  1699. # func_ltwrapper_script_p file
  1700. # True iff FILE is a libtool wrapper script
  1701. # This function is only a basic sanity check; it will hardly flush out
  1702. # determined imposters.
  1703. func_ltwrapper_script_p ()
  1704. {
  1705.     func_lalib_p "$1"
  1706. }
  1707.  
  1708. # func_ltwrapper_executable_p file
  1709. # True iff FILE is a libtool wrapper executable
  1710. # This function is only a basic sanity check; it will hardly flush out
  1711. # determined imposters.
  1712. func_ltwrapper_executable_p ()
  1713. {
  1714.     func_ltwrapper_exec_suffix=
  1715.     case $1 in
  1716.     *.exe) ;;
  1717.     *) func_ltwrapper_exec_suffix=.exe ;;
  1718.     esac
  1719.     $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  1720. }
  1721.  
  1722. # func_ltwrapper_scriptname file
  1723. # Assumes file is an ltwrapper_executable
  1724. # uses $file to determine the appropriate filename for a
  1725. # temporary ltwrapper_script.
  1726. func_ltwrapper_scriptname ()
  1727. {
  1728.     func_dirname_and_basename "$1" "" "."
  1729.     func_stripname '' '.exe' "$func_basename_result"
  1730.     func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
  1731. }
  1732.  
  1733. # func_ltwrapper_p file
  1734. # True iff FILE is a libtool wrapper script or wrapper executable
  1735. # This function is only a basic sanity check; it will hardly flush out
  1736. # determined imposters.
  1737. func_ltwrapper_p ()
  1738. {
  1739.     func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  1740. }
  1741.  
  1742.  
  1743. # func_execute_cmds commands fail_cmd
  1744. # Execute tilde-delimited COMMANDS.
  1745. # If FAIL_CMD is given, eval that upon failure.
  1746. # FAIL_CMD may read-access the current command in variable CMD!
  1747. func_execute_cmds ()
  1748. {
  1749.     $opt_debug
  1750.     save_ifs=$IFS; IFS='~'
  1751.     for cmd in $1; do
  1752.       IFS=$save_ifs
  1753.       eval cmd=\"$cmd\"
  1754.       func_show_eval "$cmd" "${2-:}"
  1755.     done
  1756.     IFS=$save_ifs
  1757. }
  1758.  
  1759.  
  1760. # func_source file
  1761. # Source FILE, adding directory component if necessary.
  1762. # Note that it is not necessary on cygwin/mingw to append a dot to
  1763. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  1764. # behavior happens only for exec(3), not for open(2)!  Also, sourcing
  1765. # `FILE.' does not work on cygwin managed mounts.
  1766. func_source ()
  1767. {
  1768.     $opt_debug
  1769.     case $1 in
  1770.     */* | *\\*) . "$1" ;;
  1771.     *)          . "./$1" ;;
  1772.     esac
  1773. }
  1774.  
  1775.  
  1776. # func_resolve_sysroot PATH
  1777. # Replace a leading = in PATH with a sysroot.  Store the result into
  1778. # func_resolve_sysroot_result
  1779. func_resolve_sysroot ()
  1780. {
  1781.   func_resolve_sysroot_result=$1
  1782.   case $func_resolve_sysroot_result in
  1783.   =*)
  1784.     func_stripname '=' '' "$func_resolve_sysroot_result"
  1785.     func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  1786.     ;;
  1787.   esac
  1788. }
  1789.  
  1790. # func_replace_sysroot PATH
  1791. # If PATH begins with the sysroot, replace it with = and
  1792. # store the result into func_replace_sysroot_result.
  1793. func_replace_sysroot ()
  1794. {
  1795.   case "$lt_sysroot:$1" in
  1796.   ?*:"$lt_sysroot"*)
  1797.     func_stripname "$lt_sysroot" '' "$1"
  1798.     func_replace_sysroot_result="=$func_stripname_result"
  1799.     ;;
  1800.   *)
  1801.     # Including no sysroot.
  1802.     func_replace_sysroot_result=$1
  1803.     ;;
  1804.   esac
  1805. }
  1806.  
  1807. # func_infer_tag arg
  1808. # Infer tagged configuration to use if any are available and
  1809. # if one wasn't chosen via the "--tag" command line option.
  1810. # Only attempt this if the compiler in the base compile
  1811. # command doesn't match the default compiler.
  1812. # arg is usually of the form 'gcc ...'
  1813. func_infer_tag ()
  1814. {
  1815.     $opt_debug
  1816.     if test -n "$available_tags" && test -z "$tagname"; then
  1817.       CC_quoted=
  1818.       for arg in $CC; do
  1819.         func_append_quoted CC_quoted "$arg"
  1820.       done
  1821.       CC_expanded=`func_echo_all $CC`
  1822.       CC_quoted_expanded=`func_echo_all $CC_quoted`
  1823.       case $@ in
  1824.       # Blanks in the command may have been stripped by the calling shell,
  1825.       # but not from the CC environment variable when configure was run.
  1826.       " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  1827.       " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  1828.       # Blanks at the start of $base_compile will cause this to fail
  1829.       # if we don't check for them as well.
  1830.       *)
  1831.         for z in $available_tags; do
  1832.           if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  1833.             # Evaluate the configuration.
  1834.             eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  1835.             CC_quoted=
  1836.             for arg in $CC; do
  1837.               # Double-quote args containing other shell metacharacters.
  1838.               func_append_quoted CC_quoted "$arg"
  1839.             done
  1840.             CC_expanded=`func_echo_all $CC`
  1841.             CC_quoted_expanded=`func_echo_all $CC_quoted`
  1842.             case "$@ " in
  1843.             " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  1844.             " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  1845.               # The compiler in the base compile command matches
  1846.               # the one in the tagged configuration.
  1847.               # Assume this is the tagged configuration we want.
  1848.               tagname=$z
  1849.               break
  1850.               ;;
  1851.             esac
  1852.           fi
  1853.         done
  1854.         # If $tagname still isn't set, then no tagged configuration
  1855.         # was found and let the user know that the "--tag" command
  1856.         # line option must be used.
  1857.         if test -z "$tagname"; then
  1858.           func_echo "unable to infer tagged configuration"
  1859.           func_fatal_error "specify a tag with \`--tag'"
  1860. #       else
  1861. #         func_verbose "using $tagname tagged configuration"
  1862.         fi
  1863.         ;;
  1864.       esac
  1865.     fi
  1866. }
  1867.  
  1868.  
  1869.  
  1870. # func_write_libtool_object output_name pic_name nonpic_name
  1871. # Create a libtool object file (analogous to a ".la" file),
  1872. # but don't create it if we're doing a dry run.
  1873. func_write_libtool_object ()
  1874. {
  1875.     write_libobj=${1}
  1876.     if test "$build_libtool_libs" = yes; then
  1877.       write_lobj=\'${2}\'
  1878.     else
  1879.       write_lobj=none
  1880.     fi
  1881.  
  1882.     if test "$build_old_libs" = yes; then
  1883.       write_oldobj=\'${3}\'
  1884.     else
  1885.       write_oldobj=none
  1886.     fi
  1887.  
  1888.     $opt_dry_run || {
  1889.       cat >${write_libobj}T <<EOF
  1890. # $write_libobj - a libtool object file
  1891. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  1892. #
  1893. # Please DO NOT delete this file!
  1894. # It is necessary for linking the library.
  1895.  
  1896. # Name of the PIC object.
  1897. pic_object=$write_lobj
  1898.  
  1899. # Name of the non-PIC object
  1900. non_pic_object=$write_oldobj
  1901.  
  1902. EOF
  1903.       $MV "${write_libobj}T" "${write_libobj}"
  1904.     }
  1905. }
  1906.  
  1907.  
  1908. ##################################################
  1909. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  1910. ##################################################
  1911.  
  1912. # func_convert_core_file_wine_to_w32 ARG
  1913. # Helper function used by file name conversion functions when $build is *nix,
  1914. # and $host is mingw, cygwin, or some other w32 environment. Relies on a
  1915. # correctly configured wine environment available, with the winepath program
  1916. # in $build's $PATH.
  1917. #
  1918. # ARG is the $build file name to be converted to w32 format.
  1919. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  1920. # be empty on error (or when ARG is empty)
  1921. func_convert_core_file_wine_to_w32 ()
  1922. {
  1923.   $opt_debug
  1924.   func_convert_core_file_wine_to_w32_result="$1"
  1925.   if test -n "$1"; then
  1926.     # Unfortunately, winepath does not exit with a non-zero error code, so we
  1927.     # are forced to check the contents of stdout. On the other hand, if the
  1928.     # command is not found, the shell will set an exit code of 127 and print
  1929.     # *an error message* to stdout. So we must check for both error code of
  1930.     # zero AND non-empty stdout, which explains the odd construction:
  1931.     func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  1932.     if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
  1933.       func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  1934.         $SED -e "$lt_sed_naive_backslashify"`
  1935.     else
  1936.       func_convert_core_file_wine_to_w32_result=
  1937.     fi
  1938.   fi
  1939. }
  1940. # end: func_convert_core_file_wine_to_w32
  1941.  
  1942.  
  1943. # func_convert_core_path_wine_to_w32 ARG
  1944. # Helper function used by path conversion functions when $build is *nix, and
  1945. # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
  1946. # configured wine environment available, with the winepath program in $build's
  1947. # $PATH. Assumes ARG has no leading or trailing path separator characters.
  1948. #
  1949. # ARG is path to be converted from $build format to win32.
  1950. # Result is available in $func_convert_core_path_wine_to_w32_result.
  1951. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  1952. # are convertible, then the result may be empty.
  1953. func_convert_core_path_wine_to_w32 ()
  1954. {
  1955.   $opt_debug
  1956.   # unfortunately, winepath doesn't convert paths, only file names
  1957.   func_convert_core_path_wine_to_w32_result=""
  1958.   if test -n "$1"; then
  1959.     oldIFS=$IFS
  1960.     IFS=:
  1961.     for func_convert_core_path_wine_to_w32_f in $1; do
  1962.       IFS=$oldIFS
  1963.       func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  1964.       if test -n "$func_convert_core_file_wine_to_w32_result" ; then
  1965.         if test -z "$func_convert_core_path_wine_to_w32_result"; then
  1966.           func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
  1967.         else
  1968.           func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  1969.         fi
  1970.       fi
  1971.     done
  1972.     IFS=$oldIFS
  1973.   fi
  1974. }
  1975. # end: func_convert_core_path_wine_to_w32
  1976.  
  1977.  
  1978. # func_cygpath ARGS...
  1979. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  1980. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  1981. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  1982. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  1983. # file name or path is assumed to be in w32 format, as previously converted
  1984. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  1985. # or path in func_cygpath_result (input file name or path is assumed to be in
  1986. # Cygwin format). Returns an empty string on error.
  1987. #
  1988. # ARGS are passed to cygpath, with the last one being the file name or path to
  1989. # be converted.
  1990. #
  1991. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  1992. # environment variable; do not put it in $PATH.
  1993. func_cygpath ()
  1994. {
  1995.   $opt_debug
  1996.   if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  1997.     func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  1998.     if test "$?" -ne 0; then
  1999.       # on failure, ensure result is empty
  2000.       func_cygpath_result=
  2001.     fi
  2002.   else
  2003.     func_cygpath_result=
  2004.     func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
  2005.   fi
  2006. }
  2007. #end: func_cygpath
  2008.  
  2009.  
  2010. # func_convert_core_msys_to_w32 ARG
  2011. # Convert file name or path ARG from MSYS format to w32 format.  Return
  2012. # result in func_convert_core_msys_to_w32_result.
  2013. func_convert_core_msys_to_w32 ()
  2014. {
  2015.   $opt_debug
  2016.   # awkward: cmd appends spaces to result
  2017.   func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2018.     $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
  2019. }
  2020. #end: func_convert_core_msys_to_w32
  2021.  
  2022.  
  2023. # func_convert_file_check ARG1 ARG2
  2024. # Verify that ARG1 (a file name in $build format) was converted to $host
  2025. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  2026. # func_to_host_file_result to ARG1).
  2027. func_convert_file_check ()
  2028. {
  2029.   $opt_debug
  2030.   if test -z "$2" && test -n "$1" ; then
  2031.     func_error "Could not determine host file name corresponding to"
  2032.     func_error "  \`$1'"
  2033.     func_error "Continuing, but uninstalled executables may not work."
  2034.     # Fallback:
  2035.     func_to_host_file_result="$1"
  2036.   fi
  2037. }
  2038. # end func_convert_file_check
  2039.  
  2040.  
  2041. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  2042. # Verify that FROM_PATH (a path in $build format) was converted to $host
  2043. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  2044. # func_to_host_file_result to a simplistic fallback value (see below).
  2045. func_convert_path_check ()
  2046. {
  2047.   $opt_debug
  2048.   if test -z "$4" && test -n "$3"; then
  2049.     func_error "Could not determine the host path corresponding to"
  2050.     func_error "  \`$3'"
  2051.     func_error "Continuing, but uninstalled executables may not work."
  2052.     # Fallback.  This is a deliberately simplistic "conversion" and
  2053.     # should not be "improved".  See libtool.info.
  2054.     if test "x$1" != "x$2"; then
  2055.       lt_replace_pathsep_chars="s|$1|$2|g"
  2056.       func_to_host_path_result=`echo "$3" |
  2057.         $SED -e "$lt_replace_pathsep_chars"`
  2058.     else
  2059.       func_to_host_path_result="$3"
  2060.     fi
  2061.   fi
  2062. }
  2063. # end func_convert_path_check
  2064.  
  2065.  
  2066. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  2067. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  2068. # and appending REPL if ORIG matches BACKPAT.
  2069. func_convert_path_front_back_pathsep ()
  2070. {
  2071.   $opt_debug
  2072.   case $4 in
  2073.   $1 ) func_to_host_path_result="$3$func_to_host_path_result"
  2074.     ;;
  2075.   esac
  2076.   case $4 in
  2077.   $2 ) func_to_host_path_result+="$3"
  2078.     ;;
  2079.   esac
  2080. }
  2081. # end func_convert_path_front_back_pathsep
  2082.  
  2083.  
  2084. ##################################################
  2085. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  2086. ##################################################
  2087. # invoked via `$to_host_file_cmd ARG'
  2088. #
  2089. # In each case, ARG is the path to be converted from $build to $host format.
  2090. # Result will be available in $func_to_host_file_result.
  2091.  
  2092.  
  2093. # func_to_host_file ARG
  2094. # Converts the file name ARG from $build format to $host format. Return result
  2095. # in func_to_host_file_result.
  2096. func_to_host_file ()
  2097. {
  2098.   $opt_debug
  2099.   $to_host_file_cmd "$1"
  2100. }
  2101. # end func_to_host_file
  2102.  
  2103.  
  2104. # func_to_tool_file ARG LAZY
  2105. # converts the file name ARG from $build format to toolchain format. Return
  2106. # result in func_to_tool_file_result.  If the conversion in use is listed
  2107. # in (the comma separated) LAZY, no conversion takes place.
  2108. func_to_tool_file ()
  2109. {
  2110.   $opt_debug
  2111.   case ,$2, in
  2112.     *,"$to_tool_file_cmd",*)
  2113.       func_to_tool_file_result=$1
  2114.       ;;
  2115.     *)
  2116.       $to_tool_file_cmd "$1"
  2117.       func_to_tool_file_result=$func_to_host_file_result
  2118.       ;;
  2119.   esac
  2120. }
  2121. # end func_to_tool_file
  2122.  
  2123.  
  2124. # func_convert_file_noop ARG
  2125. # Copy ARG to func_to_host_file_result.
  2126. func_convert_file_noop ()
  2127. {
  2128.   func_to_host_file_result="$1"
  2129. }
  2130. # end func_convert_file_noop
  2131.  
  2132.  
  2133. # func_convert_file_msys_to_w32 ARG
  2134. # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2135. # conversion to w32 is not available inside the cwrapper.  Returns result in
  2136. # func_to_host_file_result.
  2137. func_convert_file_msys_to_w32 ()
  2138. {
  2139.   $opt_debug
  2140.   func_to_host_file_result="$1"
  2141.   if test -n "$1"; then
  2142.     func_convert_core_msys_to_w32 "$1"
  2143.     func_to_host_file_result="$func_convert_core_msys_to_w32_result"
  2144.   fi
  2145.   func_convert_file_check "$1" "$func_to_host_file_result"
  2146. }
  2147. # end func_convert_file_msys_to_w32
  2148.  
  2149.  
  2150. # func_convert_file_cygwin_to_w32 ARG
  2151. # Convert file name ARG from Cygwin to w32 format.  Returns result in
  2152. # func_to_host_file_result.
  2153. func_convert_file_cygwin_to_w32 ()
  2154. {
  2155.   $opt_debug
  2156.   func_to_host_file_result="$1"
  2157.   if test -n "$1"; then
  2158.     # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
  2159.     # LT_CYGPATH in this case.
  2160.     func_to_host_file_result=`cygpath -m "$1"`
  2161.   fi
  2162.   func_convert_file_check "$1" "$func_to_host_file_result"
  2163. }
  2164. # end func_convert_file_cygwin_to_w32
  2165.  
  2166.  
  2167. # func_convert_file_nix_to_w32 ARG
  2168. # Convert file name ARG from *nix to w32 format.  Requires a wine environment
  2169. # and a working winepath. Returns result in func_to_host_file_result.
  2170. func_convert_file_nix_to_w32 ()
  2171. {
  2172.   $opt_debug
  2173.   func_to_host_file_result="$1"
  2174.   if test -n "$1"; then
  2175.     func_convert_core_file_wine_to_w32 "$1"
  2176.     func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
  2177.   fi
  2178.   func_convert_file_check "$1" "$func_to_host_file_result"
  2179. }
  2180. # end func_convert_file_nix_to_w32
  2181.  
  2182.  
  2183. # func_convert_file_msys_to_cygwin ARG
  2184. # Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
  2185. # Returns result in func_to_host_file_result.
  2186. func_convert_file_msys_to_cygwin ()
  2187. {
  2188.   $opt_debug
  2189.   func_to_host_file_result="$1"
  2190.   if test -n "$1"; then
  2191.     func_convert_core_msys_to_w32 "$1"
  2192.     func_cygpath -u "$func_convert_core_msys_to_w32_result"
  2193.     func_to_host_file_result="$func_cygpath_result"
  2194.   fi
  2195.   func_convert_file_check "$1" "$func_to_host_file_result"
  2196. }
  2197. # end func_convert_file_msys_to_cygwin
  2198.  
  2199.  
  2200. # func_convert_file_nix_to_cygwin ARG
  2201. # Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
  2202. # in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
  2203. # in func_to_host_file_result.
  2204. func_convert_file_nix_to_cygwin ()
  2205. {
  2206.   $opt_debug
  2207.   func_to_host_file_result="$1"
  2208.   if test -n "$1"; then
  2209.     # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
  2210.     func_convert_core_file_wine_to_w32 "$1"
  2211.     func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
  2212.     func_to_host_file_result="$func_cygpath_result"
  2213.   fi
  2214.   func_convert_file_check "$1" "$func_to_host_file_result"
  2215. }
  2216. # end func_convert_file_nix_to_cygwin
  2217.  
  2218.  
  2219. #############################################
  2220. # $build to $host PATH CONVERSION FUNCTIONS #
  2221. #############################################
  2222. # invoked via `$to_host_path_cmd ARG'
  2223. #
  2224. # In each case, ARG is the path to be converted from $build to $host format.
  2225. # The result will be available in $func_to_host_path_result.
  2226. #
  2227. # Path separators are also converted from $build format to $host format.  If
  2228. # ARG begins or ends with a path separator character, it is preserved (but
  2229. # converted to $host format) on output.
  2230. #
  2231. # All path conversion functions are named using the following convention:
  2232. #   file name conversion function    : func_convert_file_X_to_Y ()
  2233. #   path conversion function         : func_convert_path_X_to_Y ()
  2234. # where, for any given $build/$host combination the 'X_to_Y' value is the
  2235. # same.  If conversion functions are added for new $build/$host combinations,
  2236. # the two new functions must follow this pattern, or func_init_to_host_path_cmd
  2237. # will break.
  2238.  
  2239.  
  2240. # func_init_to_host_path_cmd
  2241. # Ensures that function "pointer" variable $to_host_path_cmd is set to the
  2242. # appropriate value, based on the value of $to_host_file_cmd.
  2243. to_host_path_cmd=
  2244. func_init_to_host_path_cmd ()
  2245. {
  2246.   $opt_debug
  2247.   if test -z "$to_host_path_cmd"; then
  2248.     func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
  2249.     to_host_path_cmd="func_convert_path_${func_stripname_result}"
  2250.   fi
  2251. }
  2252.  
  2253.  
  2254. # func_to_host_path ARG
  2255. # Converts the path ARG from $build format to $host format. Return result
  2256. # in func_to_host_path_result.
  2257. func_to_host_path ()
  2258. {
  2259.   $opt_debug
  2260.   func_init_to_host_path_cmd
  2261.   $to_host_path_cmd "$1"
  2262. }
  2263. # end func_to_host_path
  2264.  
  2265.  
  2266. # func_convert_path_noop ARG
  2267. # Copy ARG to func_to_host_path_result.
  2268. func_convert_path_noop ()
  2269. {
  2270.   func_to_host_path_result="$1"
  2271. }
  2272. # end func_convert_path_noop
  2273.  
  2274.  
  2275. # func_convert_path_msys_to_w32 ARG
  2276. # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2277. # conversion to w32 is not available inside the cwrapper.  Returns result in
  2278. # func_to_host_path_result.
  2279. func_convert_path_msys_to_w32 ()
  2280. {
  2281.   $opt_debug
  2282.   func_to_host_path_result="$1"
  2283.   if test -n "$1"; then
  2284.     # Remove leading and trailing path separator characters from ARG.  MSYS
  2285.     # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
  2286.     # and winepath ignores them completely.
  2287.     func_stripname : : "$1"
  2288.     func_to_host_path_tmp1=$func_stripname_result
  2289.     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  2290.     func_to_host_path_result="$func_convert_core_msys_to_w32_result"
  2291.     func_convert_path_check : ";" \
  2292.       "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2293.     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2294.   fi
  2295. }
  2296. # end func_convert_path_msys_to_w32
  2297.  
  2298.  
  2299. # func_convert_path_cygwin_to_w32 ARG
  2300. # Convert path ARG from Cygwin to w32 format.  Returns result in
  2301. # func_to_host_file_result.
  2302. func_convert_path_cygwin_to_w32 ()
  2303. {
  2304.   $opt_debug
  2305.   func_to_host_path_result="$1"
  2306.   if test -n "$1"; then
  2307.     # See func_convert_path_msys_to_w32:
  2308.     func_stripname : : "$1"
  2309.     func_to_host_path_tmp1=$func_stripname_result
  2310.     func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
  2311.     func_convert_path_check : ";" \
  2312.       "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2313.     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2314.   fi
  2315. }
  2316. # end func_convert_path_cygwin_to_w32
  2317.  
  2318.  
  2319. # func_convert_path_nix_to_w32 ARG
  2320. # Convert path ARG from *nix to w32 format.  Requires a wine environment and
  2321. # a working winepath.  Returns result in func_to_host_file_result.
  2322. func_convert_path_nix_to_w32 ()
  2323. {
  2324.   $opt_debug
  2325.   func_to_host_path_result="$1"
  2326.   if test -n "$1"; then
  2327.     # See func_convert_path_msys_to_w32:
  2328.     func_stripname : : "$1"
  2329.     func_to_host_path_tmp1=$func_stripname_result
  2330.     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  2331.     func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
  2332.     func_convert_path_check : ";" \
  2333.       "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2334.     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2335.   fi
  2336. }
  2337. # end func_convert_path_nix_to_w32
  2338.  
  2339.  
  2340. # func_convert_path_msys_to_cygwin ARG
  2341. # Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
  2342. # Returns result in func_to_host_file_result.
  2343. func_convert_path_msys_to_cygwin ()
  2344. {
  2345.   $opt_debug
  2346.   func_to_host_path_result="$1"
  2347.   if test -n "$1"; then
  2348.     # See func_convert_path_msys_to_w32:
  2349.     func_stripname : : "$1"
  2350.     func_to_host_path_tmp1=$func_stripname_result
  2351.     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  2352.     func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
  2353.     func_to_host_path_result="$func_cygpath_result"
  2354.     func_convert_path_check : : \
  2355.       "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2356.     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  2357.   fi
  2358. }
  2359. # end func_convert_path_msys_to_cygwin
  2360.  
  2361.  
  2362. # func_convert_path_nix_to_cygwin ARG
  2363. # Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
  2364. # a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
  2365. # func_to_host_file_result.
  2366. func_convert_path_nix_to_cygwin ()
  2367. {
  2368.   $opt_debug
  2369.   func_to_host_path_result="$1"
  2370.   if test -n "$1"; then
  2371.     # Remove leading and trailing path separator characters from
  2372.     # ARG. msys behavior is inconsistent here, cygpath turns them
  2373.     # into '.;' and ';.', and winepath ignores them completely.
  2374.     func_stripname : : "$1"
  2375.     func_to_host_path_tmp1=$func_stripname_result
  2376.     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  2377.     func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
  2378.     func_to_host_path_result="$func_cygpath_result"
  2379.     func_convert_path_check : : \
  2380.       "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2381.     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  2382.   fi
  2383. }
  2384. # end func_convert_path_nix_to_cygwin
  2385.  
  2386.  
  2387. # func_mode_compile arg...
  2388. func_mode_compile ()
  2389. {
  2390.     $opt_debug
  2391.     # Get the compilation command and the source file.
  2392.     base_compile=
  2393.     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
  2394.     suppress_opt=yes
  2395.     suppress_output=
  2396.     arg_mode=normal
  2397.     libobj=
  2398.     later=
  2399.     pie_flag=
  2400.  
  2401.     for arg
  2402.     do
  2403.       case $arg_mode in
  2404.       arg  )
  2405.         # do not "continue".  Instead, add this to base_compile
  2406.         lastarg="$arg"
  2407.         arg_mode=normal
  2408.         ;;
  2409.  
  2410.       target )
  2411.         libobj="$arg"
  2412.         arg_mode=normal
  2413.         continue
  2414.         ;;
  2415.  
  2416.       normal )
  2417.         # Accept any command-line options.
  2418.         case $arg in
  2419.         -o)
  2420.           test -n "$libobj" && \
  2421.             func_fatal_error "you cannot specify \`-o' more than once"
  2422.           arg_mode=target
  2423.           continue
  2424.           ;;
  2425.  
  2426.         -pie | -fpie | -fPIE)
  2427.           pie_flag+=" $arg"
  2428.           continue
  2429.           ;;
  2430.  
  2431.         -shared | -static | -prefer-pic | -prefer-non-pic)
  2432.           later+=" $arg"
  2433.           continue
  2434.           ;;
  2435.  
  2436.         -no-suppress)
  2437.           suppress_opt=no
  2438.           continue
  2439.           ;;
  2440.  
  2441.         -Xcompiler)
  2442.           arg_mode=arg  #  the next one goes into the "base_compile" arg list
  2443.           continue      #  The current "srcfile" will either be retained or
  2444.           ;;            #  replaced later.  I would guess that would be a bug.
  2445.  
  2446.         -Wc,*)
  2447.           func_stripname '-Wc,' '' "$arg"
  2448.           args=$func_stripname_result
  2449.           lastarg=
  2450.           save_ifs="$IFS"; IFS=','
  2451.           for arg in $args; do
  2452.             IFS="$save_ifs"
  2453.             func_append_quoted lastarg "$arg"
  2454.           done
  2455.           IFS="$save_ifs"
  2456.           func_stripname ' ' '' "$lastarg"
  2457.           lastarg=$func_stripname_result
  2458.  
  2459.           # Add the arguments to base_compile.
  2460.           base_compile+=" $lastarg"
  2461.           continue
  2462.           ;;
  2463.  
  2464.         *)
  2465.           # Accept the current argument as the source file.
  2466.           # The previous "srcfile" becomes the current argument.
  2467.           #
  2468.           lastarg="$srcfile"
  2469.           srcfile="$arg"
  2470.           ;;
  2471.         esac  #  case $arg
  2472.         ;;
  2473.       esac    #  case $arg_mode
  2474.  
  2475.       # Aesthetically quote the previous argument.
  2476.       func_append_quoted base_compile "$lastarg"
  2477.     done # for arg
  2478.  
  2479.     case $arg_mode in
  2480.     arg)
  2481.       func_fatal_error "you must specify an argument for -Xcompile"
  2482.       ;;
  2483.     target)
  2484.       func_fatal_error "you must specify a target with \`-o'"
  2485.       ;;
  2486.     *)
  2487.       # Get the name of the library object.
  2488.       test -z "$libobj" && {
  2489.         func_basename "$srcfile"
  2490.         libobj="$func_basename_result"
  2491.       }
  2492.       ;;
  2493.     esac
  2494.  
  2495.     # Recognize several different file suffixes.
  2496.     # If the user specifies -o file.o, it is replaced with file.lo
  2497.     case $libobj in
  2498.     *.[cCFSifmso] | \
  2499.     *.ada | *.adb | *.ads | *.asm | \
  2500.     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  2501.     *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
  2502.       func_xform "$libobj"
  2503.       libobj=$func_xform_result
  2504.       ;;
  2505.     esac
  2506.  
  2507.     case $libobj in
  2508.     *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  2509.     *)
  2510.       func_fatal_error "cannot determine name of library object from \`$libobj'"
  2511.       ;;
  2512.     esac
  2513.  
  2514.     func_infer_tag $base_compile
  2515.  
  2516.     for arg in $later; do
  2517.       case $arg in
  2518.       -shared)
  2519.         test "$build_libtool_libs" != yes && \
  2520.           func_fatal_configuration "can not build a shared library"
  2521.         build_old_libs=no
  2522.         continue
  2523.         ;;
  2524.  
  2525.       -static)
  2526.         build_libtool_libs=no
  2527.         build_old_libs=yes
  2528.         continue
  2529.         ;;
  2530.  
  2531.       -prefer-pic)
  2532.         pic_mode=yes
  2533.         continue
  2534.         ;;
  2535.  
  2536.       -prefer-non-pic)
  2537.         pic_mode=no
  2538.         continue
  2539.         ;;
  2540.       esac
  2541.     done
  2542.  
  2543.     func_quote_for_eval "$libobj"
  2544.     test "X$libobj" != "X$func_quote_for_eval_result" \
  2545.       && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'    &()|`$[]' \
  2546.       && func_warning "libobj name \`$libobj' may not contain shell special characters."
  2547.     func_dirname_and_basename "$obj" "/" ""
  2548.     objname="$func_basename_result"
  2549.     xdir="$func_dirname_result"
  2550.     lobj=${xdir}$objdir/$objname
  2551.  
  2552.     test -z "$base_compile" && \
  2553.       func_fatal_help "you must specify a compilation command"
  2554.  
  2555.     # Delete any leftover library objects.
  2556.     if test "$build_old_libs" = yes; then
  2557.       removelist="$obj $lobj $libobj ${libobj}T"
  2558.     else
  2559.       removelist="$lobj $libobj ${libobj}T"
  2560.     fi
  2561.  
  2562.     # On Cygwin there's no "real" PIC flag so we must build both object types
  2563.     case $host_os in
  2564.     cygwin* | mingw* | pw32* | os2* | cegcc*)
  2565.       pic_mode=default
  2566.       ;;
  2567.     esac
  2568.     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  2569.       # non-PIC code in shared libraries is not supported
  2570.       pic_mode=default
  2571.     fi
  2572.  
  2573.     # Calculate the filename of the output object if compiler does
  2574.     # not support -o with -c
  2575.     if test "$compiler_c_o" = no; then
  2576.       output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
  2577.       lockfile="$output_obj.lock"
  2578.     else
  2579.       output_obj=
  2580.       need_locks=no
  2581.       lockfile=
  2582.     fi
  2583.  
  2584.     # Lock this critical section if it is needed
  2585.     # We use this script file to make the link, it avoids creating a new file
  2586.     if test "$need_locks" = yes; then
  2587.       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  2588.         func_echo "Waiting for $lockfile to be removed"
  2589.         sleep 2
  2590.       done
  2591.     elif test "$need_locks" = warn; then
  2592.       if test -f "$lockfile"; then
  2593.         $ECHO "\
  2594. *** ERROR, $lockfile exists and contains:
  2595. `cat $lockfile 2>/dev/null`
  2596.  
  2597. This indicates that another process is trying to use the same
  2598. temporary object file, and libtool could not work around it because
  2599. your compiler does not support \`-c' and \`-o' together.  If you
  2600. repeat this compilation, it may succeed, by chance, but you had better
  2601. avoid parallel builds (make -j) in this platform, or get a better
  2602. compiler."
  2603.  
  2604.         $opt_dry_run || $RM $removelist
  2605.         exit $EXIT_FAILURE
  2606.       fi
  2607.       removelist+=" $output_obj"
  2608.       $ECHO "$srcfile" > "$lockfile"
  2609.     fi
  2610.  
  2611.     $opt_dry_run || $RM $removelist
  2612.     removelist+=" $lockfile"
  2613.     trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  2614.  
  2615.     func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
  2616.     srcfile=$func_to_tool_file_result
  2617.     func_quote_for_eval "$srcfile"
  2618.     qsrcfile=$func_quote_for_eval_result
  2619.  
  2620.     # Only build a PIC object if we are building libtool libraries.
  2621.     if test "$build_libtool_libs" = yes; then
  2622.       # Without this assignment, base_compile gets emptied.
  2623.       fbsd_hideous_sh_bug=$base_compile
  2624.  
  2625.       if test "$pic_mode" != no; then
  2626.         command="$base_compile $qsrcfile $pic_flag"
  2627.       else
  2628.         # Don't build PIC code
  2629.         command="$base_compile $qsrcfile"
  2630.       fi
  2631.  
  2632.       func_mkdir_p "$xdir$objdir"
  2633.  
  2634.       if test -z "$output_obj"; then
  2635.         # Place PIC objects in $objdir
  2636.         command+=" -o $lobj"
  2637.       fi
  2638.  
  2639.       func_show_eval_locale "$command"  \
  2640.           'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  2641.  
  2642.       if test "$need_locks" = warn &&
  2643.          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  2644.         $ECHO "\
  2645. *** ERROR, $lockfile contains:
  2646. `cat $lockfile 2>/dev/null`
  2647.  
  2648. but it should contain:
  2649. $srcfile
  2650.  
  2651. This indicates that another process is trying to use the same
  2652. temporary object file, and libtool could not work around it because
  2653. your compiler does not support \`-c' and \`-o' together.  If you
  2654. repeat this compilation, it may succeed, by chance, but you had better
  2655. avoid parallel builds (make -j) in this platform, or get a better
  2656. compiler."
  2657.  
  2658.         $opt_dry_run || $RM $removelist
  2659.         exit $EXIT_FAILURE
  2660.       fi
  2661.  
  2662.       # Just move the object if needed, then go on to compile the next one
  2663.       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  2664.         func_show_eval '$MV "$output_obj" "$lobj"' \
  2665.           'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  2666.       fi
  2667.  
  2668.       # Allow error messages only from the first compilation.
  2669.       if test "$suppress_opt" = yes; then
  2670.         suppress_output=' >/dev/null 2>&1'
  2671.       fi
  2672.     fi
  2673.  
  2674.     # Only build a position-dependent object if we build old libraries.
  2675.     if test "$build_old_libs" = yes; then
  2676.       if test "$pic_mode" != yes; then
  2677.         # Don't build PIC code
  2678.         command="$base_compile $qsrcfile$pie_flag"
  2679.       else
  2680.         command="$base_compile $qsrcfile $pic_flag"
  2681.       fi
  2682.       if test "$compiler_c_o" = yes; then
  2683.         command+=" -o $obj"
  2684.       fi
  2685.  
  2686.       # Suppress compiler output if we already did a PIC compilation.
  2687.       command+="$suppress_output"
  2688.       func_show_eval_locale "$command" \
  2689.         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  2690.  
  2691.       if test "$need_locks" = warn &&
  2692.          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  2693.         $ECHO "\
  2694. *** ERROR, $lockfile contains:
  2695. `cat $lockfile 2>/dev/null`
  2696.  
  2697. but it should contain:
  2698. $srcfile
  2699.  
  2700. This indicates that another process is trying to use the same
  2701. temporary object file, and libtool could not work around it because
  2702. your compiler does not support \`-c' and \`-o' together.  If you
  2703. repeat this compilation, it may succeed, by chance, but you had better
  2704. avoid parallel builds (make -j) in this platform, or get a better
  2705. compiler."
  2706.  
  2707.         $opt_dry_run || $RM $removelist
  2708.         exit $EXIT_FAILURE
  2709.       fi
  2710.  
  2711.       # Just move the object if needed
  2712.       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  2713.         func_show_eval '$MV "$output_obj" "$obj"' \
  2714.           'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  2715.       fi
  2716.     fi
  2717.  
  2718.     $opt_dry_run || {
  2719.       func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  2720.  
  2721.       # Unlock the critical section if it was locked
  2722.       if test "$need_locks" != no; then
  2723.         removelist=$lockfile
  2724.         $RM "$lockfile"
  2725.       fi
  2726.     }
  2727.  
  2728.     exit $EXIT_SUCCESS
  2729. }
  2730.  
  2731. $opt_help || {
  2732.   test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
  2733. }
  2734.  
  2735. func_mode_help ()
  2736. {
  2737.     # We need to display help for each of the modes.
  2738.     case $opt_mode in
  2739.       "")
  2740.         # Generic help is extracted from the usage comments
  2741.         # at the start of this file.
  2742.         func_help
  2743.         ;;
  2744.  
  2745.       clean)
  2746.         $ECHO \
  2747. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  2748.  
  2749. Remove files from the build directory.
  2750.  
  2751. RM is the name of the program to use to delete files associated with each FILE
  2752. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  2753. to RM.
  2754.  
  2755. If FILE is a libtool library, object or program, all the files associated
  2756. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  2757.         ;;
  2758.  
  2759.       compile)
  2760.       $ECHO \
  2761. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  2762.  
  2763. Compile a source file into a libtool library object.
  2764.  
  2765. This mode accepts the following additional options:
  2766.  
  2767.   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  2768.   -no-suppress      do not suppress compiler output for multiple passes
  2769.   -prefer-pic       try to build PIC objects only
  2770.   -prefer-non-pic   try to build non-PIC objects only
  2771.   -shared           do not build a \`.o' file suitable for static linking
  2772.   -static           only build a \`.o' file suitable for static linking
  2773.   -Wc,FLAG          pass FLAG directly to the compiler
  2774.  
  2775. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  2776. from the given SOURCEFILE.
  2777.  
  2778. The output file name is determined by removing the directory component from
  2779. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  2780. library object suffix, \`.lo'."
  2781.         ;;
  2782.  
  2783.       execute)
  2784.         $ECHO \
  2785. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  2786.  
  2787. Automatically set library path, then run a program.
  2788.  
  2789. This mode accepts the following additional options:
  2790.  
  2791.   -dlopen FILE      add the directory containing FILE to the library path
  2792.  
  2793. This mode sets the library path environment variable according to \`-dlopen'
  2794. flags.
  2795.  
  2796. If any of the ARGS are libtool executable wrappers, then they are translated
  2797. into their corresponding uninstalled binary, and any of their required library
  2798. directories are added to the library path.
  2799.  
  2800. Then, COMMAND is executed, with ARGS as arguments."
  2801.         ;;
  2802.  
  2803.       finish)
  2804.         $ECHO \
  2805. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  2806.  
  2807. Complete the installation of libtool libraries.
  2808.  
  2809. Each LIBDIR is a directory that contains libtool libraries.
  2810.  
  2811. The commands that this mode executes may require superuser privileges.  Use
  2812. the \`--dry-run' option if you just want to see what would be executed."
  2813.         ;;
  2814.  
  2815.       install)
  2816.         $ECHO \
  2817. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  2818.  
  2819. Install executables or libraries.
  2820.  
  2821. INSTALL-COMMAND is the installation command.  The first component should be
  2822. either the \`install' or \`cp' program.
  2823.  
  2824. The following components of INSTALL-COMMAND are treated specially:
  2825.  
  2826.   -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
  2827.  
  2828. The rest of the components are interpreted as arguments to that command (only
  2829. BSD-compatible install options are recognized)."
  2830.         ;;
  2831.  
  2832.       link)
  2833.         $ECHO \
  2834. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  2835.  
  2836. Link object files or libraries together to form another library, or to
  2837. create an executable program.
  2838.  
  2839. LINK-COMMAND is a command using the C compiler that you would use to create
  2840. a program from several object files.
  2841.  
  2842. The following components of LINK-COMMAND are treated specially:
  2843.  
  2844.   -all-static       do not do any dynamic linking at all
  2845.   -avoid-version    do not add a version suffix if possible
  2846.   -bindir BINDIR    specify path to binaries directory (for systems where
  2847.                     libraries must be found in the PATH setting at runtime)
  2848.   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  2849.   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  2850.   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  2851.   -export-symbols SYMFILE
  2852.                     try to export only the symbols listed in SYMFILE
  2853.   -export-symbols-regex REGEX
  2854.                     try to export only the symbols matching REGEX
  2855.   -LLIBDIR          search LIBDIR for required installed libraries
  2856.   -lNAME            OUTPUT-FILE requires the installed library libNAME
  2857.   -module           build a library that can dlopened
  2858.   -no-fast-install  disable the fast-install mode
  2859.   -no-install       link a not-installable executable
  2860.   -no-undefined     declare that a library does not refer to external symbols
  2861.   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  2862.   -objectlist FILE  Use a list of object files found in FILE to specify objects
  2863.   -precious-files-regex REGEX
  2864.                     don't remove output files matching REGEX
  2865.   -release RELEASE  specify package release information
  2866.   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  2867.   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  2868.   -shared           only do dynamic linking of libtool libraries
  2869.   -shrext SUFFIX    override the standard shared library file extension
  2870.   -static           do not do any dynamic linking of uninstalled libtool libraries
  2871.   -static-libtool-libs
  2872.                     do not do any dynamic linking of libtool libraries
  2873.   -version-info CURRENT[:REVISION[:AGE]]
  2874.                     specify library version info [each variable defaults to 0]
  2875.   -weak LIBNAME     declare that the target provides the LIBNAME interface
  2876.   -Wc,FLAG
  2877.   -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
  2878.   -Wl,FLAG
  2879.   -Xlinker FLAG     pass linker-specific FLAG directly to the linker
  2880.   -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
  2881.  
  2882. All other options (arguments beginning with \`-') are ignored.
  2883.  
  2884. Every other argument is treated as a filename.  Files ending in \`.la' are
  2885. treated as uninstalled libtool libraries, other files are standard or library
  2886. object files.
  2887.  
  2888. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  2889. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  2890. required, except when creating a convenience library.
  2891.  
  2892. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  2893. using \`ar' and \`ranlib', or on Windows using \`lib'.
  2894.  
  2895. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  2896. is created, otherwise an executable program is created."
  2897.         ;;
  2898.  
  2899.       uninstall)
  2900.         $ECHO \
  2901. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  2902.  
  2903. Remove libraries from an installation directory.
  2904.  
  2905. RM is the name of the program to use to delete files associated with each FILE
  2906. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  2907. to RM.
  2908.  
  2909. If FILE is a libtool library, all the files associated with it are deleted.
  2910. Otherwise, only FILE itself is deleted using RM."
  2911.         ;;
  2912.  
  2913.       *)
  2914.         func_fatal_help "invalid operation mode \`$opt_mode'"
  2915.         ;;
  2916.     esac
  2917.  
  2918.     echo
  2919.     $ECHO "Try \`$progname --help' for more information about other modes."
  2920. }
  2921.  
  2922. # Now that we've collected a possible --mode arg, show help if necessary
  2923. if $opt_help; then
  2924.   if test "$opt_help" = :; then
  2925.     func_mode_help
  2926.   else
  2927.     {
  2928.       func_help noexit
  2929.       for opt_mode in compile link execute install finish uninstall clean; do
  2930.         func_mode_help
  2931.       done
  2932.     } | sed -n '1p; 2,$s/^Usage:/  or: /p'
  2933.     {
  2934.       func_help noexit
  2935.       for opt_mode in compile link execute install finish uninstall clean; do
  2936.         echo
  2937.         func_mode_help
  2938.       done
  2939.     } |
  2940.     sed '1d
  2941.       /^When reporting/,/^Report/{
  2942.         H
  2943.         d
  2944.       }
  2945.       $x
  2946.       /information about other modes/d
  2947.       /more detailed .*MODE/d
  2948.       s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  2949.   fi
  2950.   exit $?
  2951. fi
  2952.  
  2953.  
  2954. # func_mode_execute arg...
  2955. func_mode_execute ()
  2956. {
  2957.     $opt_debug
  2958.     # The first argument is the command name.
  2959.     cmd="$nonopt"
  2960.     test -z "$cmd" && \
  2961.       func_fatal_help "you must specify a COMMAND"
  2962.  
  2963.     # Handle -dlopen flags immediately.
  2964.     for file in $opt_dlopen; do
  2965.       test -f "$file" \
  2966.         || func_fatal_help "\`$file' is not a file"
  2967.  
  2968.       dir=
  2969.       case $file in
  2970.       *.la)
  2971.         func_resolve_sysroot "$file"
  2972.         file=$func_resolve_sysroot_result
  2973.  
  2974.         # Check to see that this really is a libtool archive.
  2975.         func_lalib_unsafe_p "$file" \
  2976.           || func_fatal_help "\`$lib' is not a valid libtool archive"
  2977.  
  2978.         # Read the libtool library.
  2979.         dlname=
  2980.         library_names=
  2981.         func_source "$file"
  2982.  
  2983.         # Skip this library if it cannot be dlopened.
  2984.         if test -z "$dlname"; then
  2985.           # Warn if it was a shared library.
  2986.           test -n "$library_names" && \
  2987.             func_warning "\`$file' was not linked with \`-export-dynamic'"
  2988.           continue
  2989.         fi
  2990.  
  2991.         func_dirname "$file" "" "."
  2992.         dir="$func_dirname_result"
  2993.  
  2994.         if test -f "$dir/$objdir/$dlname"; then
  2995.           dir+="/$objdir"
  2996.         else
  2997.           if test ! -f "$dir/$dlname"; then
  2998.             func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
  2999.           fi
  3000.         fi
  3001.         ;;
  3002.  
  3003.       *.lo)
  3004.         # Just add the directory containing the .lo file.
  3005.         func_dirname "$file" "" "."
  3006.         dir="$func_dirname_result"
  3007.         ;;
  3008.  
  3009.       *)
  3010.         func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
  3011.         continue
  3012.         ;;
  3013.       esac
  3014.  
  3015.       # Get the absolute pathname.
  3016.       absdir=`cd "$dir" && pwd`
  3017.       test -n "$absdir" && dir="$absdir"
  3018.  
  3019.       # Now add the directory to shlibpath_var.
  3020.       if eval "test -z \"\$$shlibpath_var\""; then
  3021.         eval "$shlibpath_var=\"\$dir\""
  3022.       else
  3023.         eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3024.       fi
  3025.     done
  3026.  
  3027.     # This variable tells wrapper scripts just to set shlibpath_var
  3028.     # rather than running their programs.
  3029.     libtool_execute_magic="$magic"
  3030.  
  3031.     # Check if any of the arguments is a wrapper script.
  3032.     args=
  3033.     for file
  3034.     do
  3035.       case $file in
  3036.       -* | *.la | *.lo ) ;;
  3037.       *)
  3038.         # Do a test to see if this is really a libtool program.
  3039.         if func_ltwrapper_script_p "$file"; then
  3040.           func_source "$file"
  3041.           # Transform arg to wrapped name.
  3042.           file="$progdir/$program"
  3043.         elif func_ltwrapper_executable_p "$file"; then
  3044.           func_ltwrapper_scriptname "$file"
  3045.           func_source "$func_ltwrapper_scriptname_result"
  3046.           # Transform arg to wrapped name.
  3047.           file="$progdir/$program"
  3048.         fi
  3049.         ;;
  3050.       esac
  3051.       # Quote arguments (to preserve shell metacharacters).
  3052.       func_append_quoted args "$file"
  3053.     done
  3054.  
  3055.     if test "X$opt_dry_run" = Xfalse; then
  3056.       if test -n "$shlibpath_var"; then
  3057.         # Export the shlibpath_var.
  3058.         eval "export $shlibpath_var"
  3059.       fi
  3060.  
  3061.       # Restore saved environment variables
  3062.       for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  3063.       do
  3064.         eval "if test \"\${save_$lt_var+set}\" = set; then
  3065.                 $lt_var=\$save_$lt_var; export $lt_var
  3066.               else
  3067.                 $lt_unset $lt_var
  3068.               fi"
  3069.       done
  3070.  
  3071.       # Now prepare to actually exec the command.
  3072.       exec_cmd="\$cmd$args"
  3073.     else
  3074.       # Display what would be done.
  3075.       if test -n "$shlibpath_var"; then
  3076.         eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  3077.         echo "export $shlibpath_var"
  3078.       fi
  3079.       $ECHO "$cmd$args"
  3080.       exit $EXIT_SUCCESS
  3081.     fi
  3082. }
  3083.  
  3084. test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
  3085.  
  3086.  
  3087. # func_mode_finish arg...
  3088. func_mode_finish ()
  3089. {
  3090.     $opt_debug
  3091.     libs=
  3092.     libdirs=
  3093.     admincmds=
  3094.  
  3095.     for opt in "$nonopt" ${1+"$@"}
  3096.     do
  3097.       if test -d "$opt"; then
  3098.         libdirs+=" $opt"
  3099.  
  3100.       elif test -f "$opt"; then
  3101.         if func_lalib_unsafe_p "$opt"; then
  3102.           libs+=" $opt"
  3103.         else
  3104.           func_warning "\`$opt' is not a valid libtool archive"
  3105.         fi
  3106.  
  3107.       else
  3108.         func_fatal_error "invalid argument \`$opt'"
  3109.       fi
  3110.     done
  3111.  
  3112.     if test -n "$libs"; then
  3113.       if test -n "$lt_sysroot"; then
  3114.         sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
  3115.         sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
  3116.       else
  3117.         sysroot_cmd=
  3118.       fi
  3119.  
  3120.       # Remove sysroot references
  3121.       if $opt_dry_run; then
  3122.         for lib in $libs; do
  3123.           echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
  3124.         done
  3125.       else
  3126.         tmpdir=`func_mktempdir`
  3127.         for lib in $libs; do
  3128.           sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
  3129.             > $tmpdir/tmp-la
  3130.           mv -f $tmpdir/tmp-la $lib
  3131.         done
  3132.         ${RM}r "$tmpdir"
  3133.       fi
  3134.     fi
  3135.  
  3136.     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3137.       for libdir in $libdirs; do
  3138.         if test -n "$finish_cmds"; then
  3139.           # Do each command in the finish commands.
  3140.           func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  3141. '"$cmd"'"'
  3142.         fi
  3143.         if test -n "$finish_eval"; then
  3144.           # Do the single finish_eval.
  3145.           eval cmds=\"$finish_eval\"
  3146.           $opt_dry_run || eval "$cmds" || admincmds+="
  3147.        $cmds"
  3148.         fi
  3149.       done
  3150.     fi
  3151.  
  3152.     # Exit here if they wanted silent mode.
  3153.     $opt_silent && exit $EXIT_SUCCESS
  3154.  
  3155.     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3156.       echo "----------------------------------------------------------------------"
  3157.       echo "Libraries have been installed in:"
  3158.       for libdir in $libdirs; do
  3159.         $ECHO "   $libdir"
  3160.       done
  3161.       echo
  3162.       echo "If you ever happen to want to link against installed libraries"
  3163.       echo "in a given directory, LIBDIR, you must either use libtool, and"
  3164.       echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  3165.       echo "flag during linking and do at least one of the following:"
  3166.       if test -n "$shlibpath_var"; then
  3167.         echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  3168.         echo "     during execution"
  3169.       fi
  3170.       if test -n "$runpath_var"; then
  3171.         echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  3172.         echo "     during linking"
  3173.       fi
  3174.       if test -n "$hardcode_libdir_flag_spec"; then
  3175.         libdir=LIBDIR
  3176.         eval flag=\"$hardcode_libdir_flag_spec\"
  3177.  
  3178.         $ECHO "   - use the \`$flag' linker flag"
  3179.       fi
  3180.       if test -n "$admincmds"; then
  3181.         $ECHO "   - have your system administrator run these commands:$admincmds"
  3182.       fi
  3183.       if test -f /etc/ld.so.conf; then
  3184.         echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  3185.       fi
  3186.       echo
  3187.  
  3188.       echo "See any operating system documentation about shared libraries for"
  3189.       case $host in
  3190.         solaris2.[6789]|solaris2.1[0-9])
  3191.           echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  3192.           echo "pages."
  3193.           ;;
  3194.         *)
  3195.           echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3196.           ;;
  3197.       esac
  3198.       echo "----------------------------------------------------------------------"
  3199.     fi
  3200.     exit $EXIT_SUCCESS
  3201. }
  3202.  
  3203. test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
  3204.  
  3205.  
  3206. # func_mode_install arg...
  3207. func_mode_install ()
  3208. {
  3209.     $opt_debug
  3210.     # There may be an optional sh(1) argument at the beginning of
  3211.     # install_prog (especially on Windows NT).
  3212.     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  3213.        # Allow the use of GNU shtool's install command.
  3214.        case $nonopt in *shtool*) :;; *) false;; esac; then
  3215.       # Aesthetically quote it.
  3216.       func_quote_for_eval "$nonopt"
  3217.       install_prog="$func_quote_for_eval_result "
  3218.       arg=$1
  3219.       shift
  3220.     else
  3221.       install_prog=
  3222.       arg=$nonopt
  3223.     fi
  3224.  
  3225.     # The real first argument should be the name of the installation program.
  3226.     # Aesthetically quote it.
  3227.     func_quote_for_eval "$arg"
  3228.     install_prog+="$func_quote_for_eval_result"
  3229.     install_shared_prog=$install_prog
  3230.     case " $install_prog " in
  3231.       *[\\\ /]cp\ *) install_cp=: ;;
  3232.       *) install_cp=false ;;
  3233.     esac
  3234.  
  3235.     # We need to accept at least all the BSD install flags.
  3236.     dest=
  3237.     files=
  3238.     opts=
  3239.     prev=
  3240.     install_type=
  3241.     isdir=no
  3242.     stripme=
  3243.     no_mode=:
  3244.     for arg
  3245.     do
  3246.       arg2=
  3247.       if test -n "$dest"; then
  3248.         files+=" $dest"
  3249.         dest=$arg
  3250.         continue
  3251.       fi
  3252.  
  3253.       case $arg in
  3254.       -d) isdir=yes ;;
  3255.       -f)
  3256.         if $install_cp; then :; else
  3257.           prev=$arg
  3258.         fi
  3259.         ;;
  3260.       -g | -m | -o)
  3261.         prev=$arg
  3262.         ;;
  3263.       -s)
  3264.         stripme=" -s"
  3265.         continue
  3266.         ;;
  3267.       -*)
  3268.         ;;
  3269.       *)
  3270.         # If the previous option needed an argument, then skip it.
  3271.         if test -n "$prev"; then
  3272.           if test "x$prev" = x-m && test -n "$install_override_mode"; then
  3273.             arg2=$install_override_mode
  3274.             no_mode=false
  3275.           fi
  3276.           prev=
  3277.         else
  3278.           dest=$arg
  3279.           continue
  3280.         fi
  3281.         ;;
  3282.       esac
  3283.  
  3284.       # Aesthetically quote the argument.
  3285.       func_quote_for_eval "$arg"
  3286.       install_prog+=" $func_quote_for_eval_result"
  3287.       if test -n "$arg2"; then
  3288.         func_quote_for_eval "$arg2"
  3289.       fi
  3290.       install_shared_prog+=" $func_quote_for_eval_result"
  3291.     done
  3292.  
  3293.     test -z "$install_prog" && \
  3294.       func_fatal_help "you must specify an install program"
  3295.  
  3296.     test -n "$prev" && \
  3297.       func_fatal_help "the \`$prev' option requires an argument"
  3298.  
  3299.     if test -n "$install_override_mode" && $no_mode; then
  3300.       if $install_cp; then :; else
  3301.         func_quote_for_eval "$install_override_mode"
  3302.         install_shared_prog+=" -m $func_quote_for_eval_result"
  3303.       fi
  3304.     fi
  3305.  
  3306.     if test -z "$files"; then
  3307.       if test -z "$dest"; then
  3308.         func_fatal_help "no file or destination specified"
  3309.       else
  3310.         func_fatal_help "you must specify a destination"
  3311.       fi
  3312.     fi
  3313.  
  3314.     # Strip any trailing slash from the destination.
  3315.     func_stripname '' '/' "$dest"
  3316.     dest=$func_stripname_result
  3317.  
  3318.     # Check to see that the destination is a directory.
  3319.     test -d "$dest" && isdir=yes
  3320.     if test "$isdir" = yes; then
  3321.       destdir="$dest"
  3322.       destname=
  3323.     else
  3324.       func_dirname_and_basename "$dest" "" "."
  3325.       destdir="$func_dirname_result"
  3326.       destname="$func_basename_result"
  3327.  
  3328.       # Not a directory, so check to see that there is only one file specified.
  3329.       set dummy $files; shift
  3330.       test "$#" -gt 1 && \
  3331.         func_fatal_help "\`$dest' is not a directory"
  3332.     fi
  3333.     case $destdir in
  3334.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  3335.     *)
  3336.       for file in $files; do
  3337.         case $file in
  3338.         *.lo) ;;
  3339.         *)
  3340.           func_fatal_help "\`$destdir' must be an absolute directory name"
  3341.           ;;
  3342.         esac
  3343.       done
  3344.       ;;
  3345.     esac
  3346.  
  3347.     # This variable tells wrapper scripts just to set variables rather
  3348.     # than running their programs.
  3349.     libtool_install_magic="$magic"
  3350.  
  3351.     staticlibs=
  3352.     future_libdirs=
  3353.     current_libdirs=
  3354.     for file in $files; do
  3355.  
  3356.       # Do each installation.
  3357.       case $file in
  3358.       *.$libext)
  3359.         # Do the static libraries later.
  3360.         staticlibs+=" $file"
  3361.         ;;
  3362.  
  3363.       *.la)
  3364.         func_resolve_sysroot "$file"
  3365.         file=$func_resolve_sysroot_result
  3366.  
  3367.         # Check to see that this really is a libtool archive.
  3368.         func_lalib_unsafe_p "$file" \
  3369.           || func_fatal_help "\`$file' is not a valid libtool archive"
  3370.  
  3371.         library_names=
  3372.         old_library=
  3373.         relink_command=
  3374.         func_source "$file"
  3375.  
  3376.         # Add the libdir to current_libdirs if it is the destination.
  3377.         if test "X$destdir" = "X$libdir"; then
  3378.           case "$current_libdirs " in
  3379.           *" $libdir "*) ;;
  3380.           *) current_libdirs+=" $libdir" ;;
  3381.           esac
  3382.         else
  3383.           # Note the libdir as a future libdir.
  3384.           case "$future_libdirs " in
  3385.           *" $libdir "*) ;;
  3386.           *) future_libdirs+=" $libdir" ;;
  3387.           esac
  3388.         fi
  3389.  
  3390.         func_dirname "$file" "/" ""
  3391.         dir="$func_dirname_result"
  3392.         dir+="$objdir"
  3393.  
  3394.         if test -n "$relink_command"; then
  3395.           # Determine the prefix the user has applied to our future dir.
  3396.           inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  3397.  
  3398.           # Don't allow the user to place us outside of our expected
  3399.           # location b/c this prevents finding dependent libraries that
  3400.           # are installed to the same prefix.
  3401.           # At present, this check doesn't affect windows .dll's that
  3402.           # are installed into $libdir/../bin (currently, that works fine)
  3403.           # but it's something to keep an eye on.
  3404.           test "$inst_prefix_dir" = "$destdir" && \
  3405.             func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
  3406.  
  3407.           if test -n "$inst_prefix_dir"; then
  3408.             # Stick the inst_prefix_dir data into the link command.
  3409.             relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  3410.           else
  3411.             relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  3412.           fi
  3413.  
  3414.           func_warning "relinking \`$file'"
  3415.           func_show_eval "$relink_command" \
  3416.             'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
  3417.         fi
  3418.  
  3419.         # See the names of the shared library.
  3420.         set dummy $library_names; shift
  3421.         if test -n "$1"; then
  3422.           realname="$1"
  3423.           shift
  3424.  
  3425.           srcname="$realname"
  3426.           test -n "$relink_command" && srcname="$realname"T
  3427.  
  3428.           # Install the shared library and build the symlinks.
  3429.           func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  3430.               'exit $?'
  3431.           tstripme="$stripme"
  3432.           case $host_os in
  3433.           cygwin* | mingw* | pw32* | cegcc*)
  3434.             case $realname in
  3435.             *.dll.a)
  3436.               tstripme=""
  3437.               ;;
  3438.             esac
  3439.             ;;
  3440.           esac
  3441.           if test -n "$tstripme" && test -n "$striplib"; then
  3442.             func_show_eval "$striplib $destdir/$realname" 'exit $?'
  3443.           fi
  3444.  
  3445.           if test "$#" -gt 0; then
  3446.             # Delete the old symlinks, and create new ones.
  3447.             # Try `ln -sf' first, because the `ln' binary might depend on
  3448.             # the symlink we replace!  Solaris /bin/ln does not understand -f,
  3449.             # so we also need to try rm && ln -s.
  3450.             for linkname
  3451.             do
  3452.               test "$linkname" != "$realname" \
  3453.                 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  3454.             done
  3455.           fi
  3456.  
  3457.           # Do each command in the postinstall commands.
  3458.           lib="$destdir/$realname"
  3459.           func_execute_cmds "$postinstall_cmds" 'exit $?'
  3460.         fi
  3461.  
  3462.         # Install the pseudo-library for information purposes.
  3463.         func_basename "$file"
  3464.         name="$func_basename_result"
  3465.         instname="$dir/$name"i
  3466.         func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  3467.  
  3468.         # Maybe install the static library, too.
  3469.         test -n "$old_library" && staticlibs+=" $dir/$old_library"
  3470.         ;;
  3471.  
  3472.       *.lo)
  3473.         # Install (i.e. copy) a libtool object.
  3474.  
  3475.         # Figure out destination file name, if it wasn't already specified.
  3476.         if test -n "$destname"; then
  3477.           destfile="$destdir/$destname"
  3478.         else
  3479.           func_basename "$file"
  3480.           destfile="$func_basename_result"
  3481.           destfile="$destdir/$destfile"
  3482.         fi
  3483.  
  3484.         # Deduce the name of the destination old-style object file.
  3485.         case $destfile in
  3486.         *.lo)
  3487.           func_lo2o "$destfile"
  3488.           staticdest=$func_lo2o_result
  3489.           ;;
  3490.         *.$objext)
  3491.           staticdest="$destfile"
  3492.           destfile=
  3493.           ;;
  3494.         *)
  3495.           func_fatal_help "cannot copy a libtool object to \`$destfile'"
  3496.           ;;
  3497.         esac
  3498.  
  3499.         # Install the libtool object if requested.
  3500.         test -n "$destfile" && \
  3501.           func_show_eval "$install_prog $file $destfile" 'exit $?'
  3502.  
  3503.         # Install the old object if enabled.
  3504.         if test "$build_old_libs" = yes; then
  3505.           # Deduce the name of the old-style object file.
  3506.           func_lo2o "$file"
  3507.           staticobj=$func_lo2o_result
  3508.           func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  3509.         fi
  3510.         exit $EXIT_SUCCESS
  3511.         ;;
  3512.  
  3513.       *)
  3514.         # Figure out destination file name, if it wasn't already specified.
  3515.         if test -n "$destname"; then
  3516.           destfile="$destdir/$destname"
  3517.         else
  3518.           func_basename "$file"
  3519.           destfile="$func_basename_result"
  3520.           destfile="$destdir/$destfile"
  3521.         fi
  3522.  
  3523.         # If the file is missing, and there is a .exe on the end, strip it
  3524.         # because it is most likely a libtool script we actually want to
  3525.         # install
  3526.         stripped_ext=""
  3527.         case $file in
  3528.           *.exe)
  3529.             if test ! -f "$file"; then
  3530.               func_stripname '' '.exe' "$file"
  3531.               file=$func_stripname_result
  3532.               stripped_ext=".exe"
  3533.             fi
  3534.             ;;
  3535.         esac
  3536.  
  3537.         # Do a test to see if this is really a libtool program.
  3538.         case $host in
  3539.         *cygwin* | *mingw*)
  3540.             if func_ltwrapper_executable_p "$file"; then
  3541.               func_ltwrapper_scriptname "$file"
  3542.               wrapper=$func_ltwrapper_scriptname_result
  3543.             else
  3544.               func_stripname '' '.exe' "$file"
  3545.               wrapper=$func_stripname_result
  3546.             fi
  3547.             ;;
  3548.         *)
  3549.             wrapper=$file
  3550.             ;;
  3551.         esac
  3552.         if func_ltwrapper_script_p "$wrapper"; then
  3553.           notinst_deplibs=
  3554.           relink_command=
  3555.  
  3556.           func_source "$wrapper"
  3557.  
  3558.           # Check the variables that should have been set.
  3559.           test -z "$generated_by_libtool_version" && \
  3560.             func_fatal_error "invalid libtool wrapper script \`$wrapper'"
  3561.  
  3562.           finalize=yes
  3563.           for lib in $notinst_deplibs; do
  3564.             # Check to see that each library is installed.
  3565.             libdir=
  3566.             if test -f "$lib"; then
  3567.               func_source "$lib"
  3568.             fi
  3569.             libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
  3570.             if test -n "$libdir" && test ! -f "$libfile"; then
  3571.               func_warning "\`$lib' has not been installed in \`$libdir'"
  3572.               finalize=no
  3573.             fi
  3574.           done
  3575.  
  3576.           relink_command=
  3577.           func_source "$wrapper"
  3578.  
  3579.           outputname=
  3580.           if test "$fast_install" = no && test -n "$relink_command"; then
  3581.             $opt_dry_run || {
  3582.               if test "$finalize" = yes; then
  3583.                 tmpdir=`func_mktempdir`
  3584.                 func_basename "$file$stripped_ext"
  3585.                 file="$func_basename_result"
  3586.                 outputname="$tmpdir/$file"
  3587.                 # Replace the output file specification.
  3588.                 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  3589.  
  3590.                 $opt_silent || {
  3591.                   func_quote_for_expand "$relink_command"
  3592.                   eval "func_echo $func_quote_for_expand_result"
  3593.                 }
  3594.                 if eval "$relink_command"; then :
  3595.                   else
  3596.                   func_error "error: relink \`$file' with the above command before installing it"
  3597.                   $opt_dry_run || ${RM}r "$tmpdir"
  3598.                   continue
  3599.                 fi
  3600.                 file="$outputname"
  3601.               else
  3602.                 func_warning "cannot relink \`$file'"
  3603.               fi
  3604.             }
  3605.           else
  3606.             # Install the binary that we compiled earlier.
  3607.             file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  3608.           fi
  3609.         fi
  3610.  
  3611.         # remove .exe since cygwin /usr/bin/install will append another
  3612.         # one anyway
  3613.         case $install_prog,$host in
  3614.         */usr/bin/install*,*cygwin*)
  3615.           case $file:$destfile in
  3616.           *.exe:*.exe)
  3617.             # this is ok
  3618.             ;;
  3619.           *.exe:*)
  3620.             destfile=$destfile.exe
  3621.             ;;
  3622.           *:*.exe)
  3623.             func_stripname '' '.exe' "$destfile"
  3624.             destfile=$func_stripname_result
  3625.             ;;
  3626.           esac
  3627.           ;;
  3628.         esac
  3629.         func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  3630.         $opt_dry_run || if test -n "$outputname"; then
  3631.           ${RM}r "$tmpdir"
  3632.         fi
  3633.         ;;
  3634.       esac
  3635.     done
  3636.  
  3637.     for file in $staticlibs; do
  3638.       func_basename "$file"
  3639.       name="$func_basename_result"
  3640.  
  3641.       # Set up the ranlib parameters.
  3642.       oldlib="$destdir/$name"
  3643.       func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  3644.       tool_oldlib=$func_to_tool_file_result
  3645.  
  3646.       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  3647.  
  3648.       if test -n "$stripme" && test -n "$old_striplib"; then
  3649.         func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  3650.       fi
  3651.  
  3652.       # Do each command in the postinstall commands.
  3653.       func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  3654.     done
  3655.  
  3656.     test -n "$future_libdirs" && \
  3657.       func_warning "remember to run \`$progname --finish$future_libdirs'"
  3658.  
  3659.     if test -n "$current_libdirs"; then
  3660.       # Maybe just do a dry run.
  3661.       $opt_dry_run && current_libdirs=" -n$current_libdirs"
  3662.       exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  3663.     else
  3664.       exit $EXIT_SUCCESS
  3665.     fi
  3666. }
  3667.  
  3668. test "$opt_mode" = install && func_mode_install ${1+"$@"}
  3669.  
  3670.  
  3671. # func_generate_dlsyms outputname originator pic_p
  3672. # Extract symbols from dlprefiles and create ${outputname}S.o with
  3673. # a dlpreopen symbol table.
  3674. func_generate_dlsyms ()
  3675. {
  3676.     $opt_debug
  3677.     my_outputname="$1"
  3678.     my_originator="$2"
  3679.     my_pic_p="${3-no}"
  3680.     my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
  3681.     my_dlsyms=
  3682.  
  3683.     if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3684.       if test -n "$NM" && test -n "$global_symbol_pipe"; then
  3685.         my_dlsyms="${my_outputname}S.c"
  3686.       else
  3687.         func_error "not configured to extract global symbols from dlpreopened files"
  3688.       fi
  3689.     fi
  3690.  
  3691.     if test -n "$my_dlsyms"; then
  3692.       case $my_dlsyms in
  3693.       "") ;;
  3694.       *.c)
  3695.         # Discover the nlist of each of the dlfiles.
  3696.         nlist="$output_objdir/${my_outputname}.nm"
  3697.  
  3698.         func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  3699.  
  3700.         # Parse the name list into a source file.
  3701.         func_verbose "creating $output_objdir/$my_dlsyms"
  3702.  
  3703.         $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  3704. /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
  3705. /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
  3706.  
  3707. #ifdef __cplusplus
  3708. extern \"C\" {
  3709. #endif
  3710.  
  3711. #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  3712. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  3713. #endif
  3714.  
  3715. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
  3716. #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
  3717. /* DATA imports from DLLs on WIN32 con't be const, because runtime
  3718.    relocations are performed -- see ld's documentation on pseudo-relocs.  */
  3719. # define LT_DLSYM_CONST
  3720. #elif defined(__osf__)
  3721. /* This system does not cope well with relocations in const data.  */
  3722. # define LT_DLSYM_CONST
  3723. #else
  3724. # define LT_DLSYM_CONST const
  3725. #endif
  3726.  
  3727. /* External symbol declarations for the compiler. */\
  3728. "
  3729.  
  3730.         if test "$dlself" = yes; then
  3731.           func_verbose "generating symbol list for \`$output'"
  3732.  
  3733.           $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  3734.  
  3735.           # Add our own program objects to the symbol list.
  3736.           progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  3737.           for progfile in $progfiles; do
  3738.             func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  3739.             func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
  3740.             $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  3741.           done
  3742.  
  3743.           if test -n "$exclude_expsyms"; then
  3744.             $opt_dry_run || {
  3745.               eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  3746.               eval '$MV "$nlist"T "$nlist"'
  3747.             }
  3748.           fi
  3749.  
  3750.           if test -n "$export_symbols_regex"; then
  3751.             $opt_dry_run || {
  3752.               eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  3753.               eval '$MV "$nlist"T "$nlist"'
  3754.             }
  3755.           fi
  3756.  
  3757.           # Prepare the list of exported symbols
  3758.           if test -z "$export_symbols"; then
  3759.             export_symbols="$output_objdir/$outputname.exp"
  3760.             $opt_dry_run || {
  3761.               $RM $export_symbols
  3762.               eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  3763.               case $host in
  3764.               *cygwin* | *mingw* | *cegcc* )
  3765.                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  3766.                 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  3767.                 ;;
  3768.               esac
  3769.             }
  3770.           else
  3771.             $opt_dry_run || {
  3772.               eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  3773.               eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  3774.               eval '$MV "$nlist"T "$nlist"'
  3775.               case $host in
  3776.                 *cygwin* | *mingw* | *cegcc* )
  3777.                   eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  3778.                   eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  3779.                   ;;
  3780.               esac
  3781.             }
  3782.           fi
  3783.         fi
  3784.  
  3785.         for dlprefile in $dlprefiles; do
  3786.           func_verbose "extracting global C symbols from \`$dlprefile'"
  3787.           func_basename "$dlprefile"
  3788.           name="$func_basename_result"
  3789.           case $host in
  3790.             *cygwin* | *mingw* | *cegcc* )
  3791.               # if an import library, we need to obtain dlname
  3792.               if func_win32_import_lib_p "$dlprefile"; then
  3793.                 func_tr_sh "$dlprefile"
  3794.                 eval "curr_lafile=\$libfile_$func_tr_sh_result"
  3795.                 dlprefile_dlbasename=""
  3796.                 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  3797.                   # Use subshell, to avoid clobbering current variable values
  3798.                   dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  3799.                   if test -n "$dlprefile_dlname" ; then
  3800.                     func_basename "$dlprefile_dlname"
  3801.                     dlprefile_dlbasename="$func_basename_result"
  3802.                   else
  3803.                     # no lafile. user explicitly requested -dlpreopen <import library>.
  3804.                     $sharedlib_from_linklib_cmd "$dlprefile"
  3805.                     dlprefile_dlbasename=$sharedlib_from_linklib_result
  3806.                   fi
  3807.                 fi
  3808.                 $opt_dry_run || {
  3809.                   if test -n "$dlprefile_dlbasename" ; then
  3810.                     eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  3811.                   else
  3812.                     func_warning "Could not compute DLL name from $name"
  3813.                     eval '$ECHO ": $name " >> "$nlist"'
  3814.                   fi
  3815.                   func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  3816.                   eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  3817.                     $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  3818.                 }
  3819.               else # not an import lib
  3820.                 $opt_dry_run || {
  3821.                   eval '$ECHO ": $name " >> "$nlist"'
  3822.                   func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  3823.                   eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  3824.                 }
  3825.               fi
  3826.             ;;
  3827.             *)
  3828.               $opt_dry_run || {
  3829.                 eval '$ECHO ": $name " >> "$nlist"'
  3830.                 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  3831.                 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  3832.               }
  3833.             ;;
  3834.           esac
  3835.         done
  3836.  
  3837.         $opt_dry_run || {
  3838.           # Make sure we have at least an empty file.
  3839.           test -f "$nlist" || : > "$nlist"
  3840.  
  3841.           if test -n "$exclude_expsyms"; then
  3842.             $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  3843.             $MV "$nlist"T "$nlist"
  3844.           fi
  3845.  
  3846.           # Try sorting and uniquifying the output.
  3847.           if $GREP -v "^: " < "$nlist" |
  3848.               if sort -k 3 </dev/null >/dev/null 2>&1; then
  3849.                 sort -k 3
  3850.               else
  3851.                 sort +2
  3852.               fi |
  3853.               uniq > "$nlist"S; then
  3854.             :
  3855.           else
  3856.             $GREP -v "^: " < "$nlist" > "$nlist"S
  3857.           fi
  3858.  
  3859.           if test -f "$nlist"S; then
  3860.             eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  3861.           else
  3862.             echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  3863.           fi
  3864.  
  3865.           echo >> "$output_objdir/$my_dlsyms" "\
  3866.  
  3867. /* The mapping between symbol names and symbols.  */
  3868. typedef struct {
  3869.   const char *name;
  3870.   void *address;
  3871. } lt_dlsymlist;
  3872. extern LT_DLSYM_CONST lt_dlsymlist
  3873. lt_${my_prefix}_LTX_preloaded_symbols[];
  3874. LT_DLSYM_CONST lt_dlsymlist
  3875. lt_${my_prefix}_LTX_preloaded_symbols[] =
  3876. {\
  3877.   { \"$my_originator\", (void *) 0 },"
  3878.  
  3879.           case $need_lib_prefix in
  3880.           no)
  3881.             eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  3882.             ;;
  3883.           *)
  3884.             eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  3885.             ;;
  3886.           esac
  3887.           echo >> "$output_objdir/$my_dlsyms" "\
  3888.   {0, (void *) 0}
  3889. };
  3890.  
  3891. /* This works around a problem in FreeBSD linker */
  3892. #ifdef FREEBSD_WORKAROUND
  3893. static const void *lt_preloaded_setup() {
  3894.   return lt_${my_prefix}_LTX_preloaded_symbols;
  3895. }
  3896. #endif
  3897.  
  3898. #ifdef __cplusplus
  3899. }
  3900. #endif\
  3901. "
  3902.         } # !$opt_dry_run
  3903.  
  3904.         pic_flag_for_symtable=
  3905.         case "$compile_command " in
  3906.         *" -static "*) ;;
  3907.         *)
  3908.           case $host in
  3909.           # compiling the symbol table file with pic_flag works around
  3910.           # a FreeBSD bug that causes programs to crash when -lm is
  3911.           # linked before any other PIC object.  But we must not use
  3912.           # pic_flag when linking with -static.  The problem exists in
  3913.           # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  3914.           *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  3915.             pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  3916.           *-*-hpux*)
  3917.             pic_flag_for_symtable=" $pic_flag"  ;;
  3918.           *)
  3919.             if test "X$my_pic_p" != Xno; then
  3920.               pic_flag_for_symtable=" $pic_flag"
  3921.             fi
  3922.             ;;
  3923.           esac
  3924.           ;;
  3925.         esac
  3926.         symtab_cflags=
  3927.         for arg in $LTCFLAGS; do
  3928.           case $arg in
  3929.           -pie | -fpie | -fPIE) ;;
  3930.           *) symtab_cflags+=" $arg" ;;
  3931.           esac
  3932.         done
  3933.  
  3934.         # Now compile the dynamic symbol file.
  3935.         func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  3936.  
  3937.         # Clean up the generated files.
  3938.         func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
  3939.  
  3940.         # Transform the symbol file into the correct name.
  3941.         symfileobj="$output_objdir/${my_outputname}S.$objext"
  3942.         case $host in
  3943.         *cygwin* | *mingw* | *cegcc* )
  3944.           if test -f "$output_objdir/$my_outputname.def"; then
  3945.             compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  3946.             finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  3947.           else
  3948.             compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  3949.             finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  3950.           fi
  3951.           ;;
  3952.         *)
  3953.           compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  3954.           finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  3955.           ;;
  3956.         esac
  3957.         ;;
  3958.       *)
  3959.         func_fatal_error "unknown suffix for \`$my_dlsyms'"
  3960.         ;;
  3961.       esac
  3962.     else
  3963.       # We keep going just in case the user didn't refer to
  3964.       # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  3965.       # really was required.
  3966.  
  3967.       # Nullify the symbol file.
  3968.       compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  3969.       finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  3970.     fi
  3971. }
  3972.  
  3973. # func_win32_libid arg
  3974. # return the library type of file 'arg'
  3975. #
  3976. # Need a lot of goo to handle *both* DLLs and import libs
  3977. # Has to be a shell function in order to 'eat' the argument
  3978. # that is supplied when $file_magic_command is called.
  3979. # Despite the name, also deal with 64 bit binaries.
  3980. func_win32_libid ()
  3981. {
  3982.   $opt_debug
  3983.   win32_libid_type="unknown"
  3984.   win32_fileres=`file -L $1 2>/dev/null`
  3985.   case $win32_fileres in
  3986.   *ar\ archive\ import\ library*) # definitely import
  3987.     win32_libid_type="x86 archive import"
  3988.     ;;
  3989.   *ar\ archive*) # could be an import, or static
  3990.     # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  3991.     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  3992.        $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  3993.       func_to_tool_file "$1" func_convert_file_msys_to_w32
  3994.       win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  3995.         $SED -n -e '
  3996.             1,100{
  3997.                 / I /{
  3998.                     s,.*,import,
  3999.                     p
  4000.                     q
  4001.                 }
  4002.             }'`
  4003.       case $win32_nmres in
  4004.       import*)  win32_libid_type="x86 archive import";;
  4005.       *)        win32_libid_type="x86 archive static";;
  4006.       esac
  4007.     fi
  4008.     ;;
  4009.   *DLL*)
  4010.     win32_libid_type="x86 DLL"
  4011.     ;;
  4012.   *executable*) # but shell scripts are "executable" too...
  4013.     case $win32_fileres in
  4014.     *MS\ Windows\ PE\ Intel*)
  4015.       win32_libid_type="x86 DLL"
  4016.       ;;
  4017.     esac
  4018.     ;;
  4019.   esac
  4020.   $ECHO "$win32_libid_type"
  4021. }
  4022.  
  4023. # func_cygming_dll_for_implib ARG
  4024. #
  4025. # Platform-specific function to extract the
  4026. # name of the DLL associated with the specified
  4027. # import library ARG.
  4028. # Invoked by eval'ing the libtool variable
  4029. #    $sharedlib_from_linklib_cmd
  4030. # Result is available in the variable
  4031. #    $sharedlib_from_linklib_result
  4032. func_cygming_dll_for_implib ()
  4033. {
  4034.   $opt_debug
  4035.   sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4036. }
  4037.  
  4038. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4039. #
  4040. # The is the core of a fallback implementation of a
  4041. # platform-specific function to extract the name of the
  4042. # DLL associated with the specified import library LIBNAME.
  4043. #
  4044. # SECTION_NAME is either .idata$6 or .idata$7, depending
  4045. # on the platform and compiler that created the implib.
  4046. #
  4047. # Echos the name of the DLL associated with the
  4048. # specified import library.
  4049. func_cygming_dll_for_implib_fallback_core ()
  4050. {
  4051.   $opt_debug
  4052.   match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  4053.   $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  4054.     $SED '/^Contents of section '"$match_literal"':/{
  4055.       # Place marker at beginning of archive member dllname section
  4056.       s/.*/====MARK====/
  4057.       p
  4058.       d
  4059.     }
  4060.     # These lines can sometimes be longer than 43 characters, but
  4061.     # are always uninteresting
  4062.     /:[  ]*file format pe[i]\{,1\}-/d
  4063.     /^In archive [^:]*:/d
  4064.     # Ensure marker is printed
  4065.     /^====MARK====/p
  4066.     # Remove all lines with less than 43 characters
  4067.     /^.\{43\}/!d
  4068.     # From remaining lines, remove first 43 characters
  4069.     s/^.\{43\}//' |
  4070.     $SED -n '
  4071.       # Join marker and all lines until next marker into a single line
  4072.       /^====MARK====/ b para
  4073.       H
  4074.       $ b para
  4075.       b
  4076.       :para
  4077.       x
  4078.       s/\n//g
  4079.       # Remove the marker
  4080.       s/^====MARK====//
  4081.       # Remove trailing dots and whitespace
  4082.       s/[\. \t]*$//
  4083.       # Print
  4084.       /./p' |
  4085.     # we now have a list, one entry per line, of the stringified
  4086.     # contents of the appropriate section of all members of the
  4087.     # archive which possess that section. Heuristic: eliminate
  4088.     # all those which have a first or second character that is
  4089.     # a '.' (that is, objdump's representation of an unprintable
  4090.     # character.) This should work for all archives with less than
  4091.     # 0x302f exports -- but will fail for DLLs whose name actually
  4092.     # begins with a literal '.' or a single character followed by
  4093.     # a '.'.
  4094.     #
  4095.     # Of those that remain, print the first one.
  4096.     $SED -e '/^\./d;/^.\./d;q'
  4097. }
  4098.  
  4099. # func_cygming_gnu_implib_p ARG
  4100. # This predicate returns with zero status (TRUE) if
  4101. # ARG is a GNU/binutils-style import library. Returns
  4102. # with nonzero status (FALSE) otherwise.
  4103. func_cygming_gnu_implib_p ()
  4104. {
  4105.   $opt_debug
  4106.   func_to_tool_file "$1" func_convert_file_msys_to_w32
  4107.   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)$'`
  4108.   test -n "$func_cygming_gnu_implib_tmp"
  4109. }
  4110.  
  4111. # func_cygming_ms_implib_p ARG
  4112. # This predicate returns with zero status (TRUE) if
  4113. # ARG is an MS-style import library. Returns
  4114. # with nonzero status (FALSE) otherwise.
  4115. func_cygming_ms_implib_p ()
  4116. {
  4117.   $opt_debug
  4118.   func_to_tool_file "$1" func_convert_file_msys_to_w32
  4119.   func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4120.   test -n "$func_cygming_ms_implib_tmp"
  4121. }
  4122.  
  4123. # func_cygming_dll_for_implib_fallback ARG
  4124. # Platform-specific function to extract the
  4125. # name of the DLL associated with the specified
  4126. # import library ARG.
  4127. #
  4128. # This fallback implementation is for use when $DLLTOOL
  4129. # does not support the --identify-strict option.
  4130. # Invoked by eval'ing the libtool variable
  4131. #    $sharedlib_from_linklib_cmd
  4132. # Result is available in the variable
  4133. #    $sharedlib_from_linklib_result
  4134. func_cygming_dll_for_implib_fallback ()
  4135. {
  4136.   $opt_debug
  4137.   if func_cygming_gnu_implib_p "$1" ; then
  4138.     # binutils import library
  4139.     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  4140.   elif func_cygming_ms_implib_p "$1" ; then
  4141.     # ms-generated import library
  4142.     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  4143.   else
  4144.     # unknown
  4145.     sharedlib_from_linklib_result=""
  4146.   fi
  4147. }
  4148.  
  4149.  
  4150. # func_extract_an_archive dir oldlib
  4151. func_extract_an_archive ()
  4152. {
  4153.     $opt_debug
  4154.     f_ex_an_ar_dir="$1"; shift
  4155.     f_ex_an_ar_oldlib="$1"
  4156.     if test "$lock_old_archive_extraction" = yes; then
  4157.       lockfile=$f_ex_an_ar_oldlib.lock
  4158.       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  4159.         func_echo "Waiting for $lockfile to be removed"
  4160.         sleep 2
  4161.       done
  4162.     fi
  4163.     func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  4164.                    'stat=$?; rm -f "$lockfile"; exit $stat'
  4165.     if test "$lock_old_archive_extraction" = yes; then
  4166.       $opt_dry_run || rm -f "$lockfile"
  4167.     fi
  4168.     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  4169.      :
  4170.     else
  4171.       func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  4172.     fi
  4173. }
  4174.  
  4175.  
  4176. # func_extract_archives gentop oldlib ...
  4177. func_extract_archives ()
  4178. {
  4179.     $opt_debug
  4180.     my_gentop="$1"; shift
  4181.     my_oldlibs=${1+"$@"}
  4182.     my_oldobjs=""
  4183.     my_xlib=""
  4184.     my_xabs=""
  4185.     my_xdir=""
  4186.  
  4187.     for my_xlib in $my_oldlibs; do
  4188.       # Extract the objects.
  4189.       case $my_xlib in
  4190.         [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
  4191.         *) my_xabs=`pwd`"/$my_xlib" ;;
  4192.       esac
  4193.       func_basename "$my_xlib"
  4194.       my_xlib="$func_basename_result"
  4195.       my_xlib_u=$my_xlib
  4196.       while :; do
  4197.         case " $extracted_archives " in
  4198.         *" $my_xlib_u "*)
  4199.           func_arith $extracted_serial + 1
  4200.           extracted_serial=$func_arith_result
  4201.           my_xlib_u=lt$extracted_serial-$my_xlib ;;
  4202.         *) break ;;
  4203.         esac
  4204.       done
  4205.       extracted_archives="$extracted_archives $my_xlib_u"
  4206.       my_xdir="$my_gentop/$my_xlib_u"
  4207.  
  4208.       func_mkdir_p "$my_xdir"
  4209.  
  4210.       case $host in
  4211.       *-darwin*)
  4212.         func_verbose "Extracting $my_xabs"
  4213.         # Do not bother doing anything if just a dry run
  4214.         $opt_dry_run || {
  4215.           darwin_orig_dir=`pwd`
  4216.           cd $my_xdir || exit $?
  4217.           darwin_archive=$my_xabs
  4218.           darwin_curdir=`pwd`
  4219.           darwin_base_archive=`basename "$darwin_archive"`
  4220.           darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  4221.           if test -n "$darwin_arches"; then
  4222.             darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  4223.             darwin_arch=
  4224.             func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  4225.             for darwin_arch in  $darwin_arches ; do
  4226.               func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  4227.               $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  4228.               cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  4229.               func_extract_an_archive "`pwd`" "${darwin_base_archive}"
  4230.               cd "$darwin_curdir"
  4231.               $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
  4232.             done # $darwin_arches
  4233.             ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  4234.             darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
  4235.             darwin_file=
  4236.             darwin_files=
  4237.             for darwin_file in $darwin_filelist; do
  4238.               darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  4239.               $LIPO -create -output "$darwin_file" $darwin_files
  4240.             done # $darwin_filelist
  4241.             $RM -rf unfat-$$
  4242.             cd "$darwin_orig_dir"
  4243.           else
  4244.             cd $darwin_orig_dir
  4245.             func_extract_an_archive "$my_xdir" "$my_xabs"
  4246.           fi # $darwin_arches
  4247.         } # !$opt_dry_run
  4248.         ;;
  4249.       *)
  4250.         func_extract_an_archive "$my_xdir" "$my_xabs"
  4251.         ;;
  4252.       esac
  4253.       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  4254.     done
  4255.  
  4256.     func_extract_archives_result="$my_oldobjs"
  4257. }
  4258.  
  4259.  
  4260. # func_emit_wrapper [arg=no]
  4261. #
  4262. # Emit a libtool wrapper script on stdout.
  4263. # Don't directly open a file because we may want to
  4264. # incorporate the script contents within a cygwin/mingw
  4265. # wrapper executable.  Must ONLY be called from within
  4266. # func_mode_link because it depends on a number of variables
  4267. # set therein.
  4268. #
  4269. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  4270. # variable will take.  If 'yes', then the emitted script
  4271. # will assume that the directory in which it is stored is
  4272. # the $objdir directory.  This is a cygwin/mingw-specific
  4273. # behavior.
  4274. func_emit_wrapper ()
  4275. {
  4276.         func_emit_wrapper_arg1=${1-no}
  4277.  
  4278.         $ECHO "\
  4279. #! $SHELL
  4280.  
  4281. # $output - temporary wrapper script for $objdir/$outputname
  4282. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  4283. #
  4284. # The $output program cannot be directly executed until all the libtool
  4285. # libraries that it depends on are installed.
  4286. #
  4287. # This wrapper script should never be moved out of the build directory.
  4288. # If it is, it will not operate correctly.
  4289.  
  4290. # Sed substitution that helps us do robust quoting.  It backslashifies
  4291. # metacharacters that are still active within double-quoted strings.
  4292. sed_quote_subst='$sed_quote_subst'
  4293.  
  4294. # Be Bourne compatible
  4295. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  4296.   emulate sh
  4297.   NULLCMD=:
  4298.   # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  4299.   # is contrary to our usage.  Disable this feature.
  4300.   alias -g '\${1+\"\$@\"}'='\"\$@\"'
  4301.   setopt NO_GLOB_SUBST
  4302. else
  4303.   case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  4304. fi
  4305. BIN_SH=xpg4; export BIN_SH # for Tru64
  4306. DUALCASE=1; export DUALCASE # for MKS sh
  4307.  
  4308. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4309. # if CDPATH is set.
  4310. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4311.  
  4312. relink_command=\"$relink_command\"
  4313.  
  4314. # This environment variable determines our operation mode.
  4315. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4316.   # install mode needs the following variables:
  4317.   generated_by_libtool_version='$macro_version'
  4318.   notinst_deplibs='$notinst_deplibs'
  4319. else
  4320.   # When we are sourced in execute mode, \$file and \$ECHO are already set.
  4321.   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4322.     file=\"\$0\""
  4323.  
  4324.     qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
  4325.     $ECHO "\
  4326.  
  4327. # A function that is used when there is no print builtin or printf.
  4328. func_fallback_echo ()
  4329. {
  4330.   eval 'cat <<_LTECHO_EOF
  4331. \$1
  4332. _LTECHO_EOF'
  4333. }
  4334.     ECHO=\"$qECHO\"
  4335.   fi
  4336.  
  4337. # Very basic option parsing. These options are (a) specific to
  4338. # the libtool wrapper, (b) are identical between the wrapper
  4339. # /script/ and the wrapper /executable/ which is used only on
  4340. # windows platforms, and (c) all begin with the string "--lt-"
  4341. # (application programs are unlikely to have options which match
  4342. # this pattern).
  4343. #
  4344. # There are only two supported options: --lt-debug and
  4345. # --lt-dump-script. There is, deliberately, no --lt-help.
  4346. #
  4347. # The first argument to this parsing function should be the
  4348. # script's $0 value, followed by "$@".
  4349. lt_option_debug=
  4350. func_parse_lt_options ()
  4351. {
  4352.   lt_script_arg0=\$0
  4353.   shift
  4354.   for lt_opt
  4355.   do
  4356.     case \"\$lt_opt\" in
  4357.     --lt-debug) lt_option_debug=1 ;;
  4358.     --lt-dump-script)
  4359.         lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  4360.         test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  4361.         lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  4362.         cat \"\$lt_dump_D/\$lt_dump_F\"
  4363.         exit 0
  4364.       ;;
  4365.     --lt-*)
  4366.         \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  4367.         exit 1
  4368.       ;;
  4369.     esac
  4370.   done
  4371.  
  4372.   # Print the debug banner immediately:
  4373.   if test -n \"\$lt_option_debug\"; then
  4374.     echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
  4375.   fi
  4376. }
  4377.  
  4378. # Used when --lt-debug. Prints its arguments to stdout
  4379. # (redirection is the responsibility of the caller)
  4380. func_lt_dump_args ()
  4381. {
  4382.   lt_dump_args_N=1;
  4383.   for lt_arg
  4384.   do
  4385.     \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
  4386.     lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  4387.   done
  4388. }
  4389.  
  4390. # Core function for launching the target application
  4391. func_exec_program_core ()
  4392. {
  4393. "
  4394.   case $host in
  4395.   # Backslashes separate directories on plain windows
  4396.   *-*-mingw | *-*-os2* | *-cegcc*)
  4397.     $ECHO "\
  4398.       if test -n \"\$lt_option_debug\"; then
  4399.         \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
  4400.         func_lt_dump_args \${1+\"\$@\"} 1>&2
  4401.       fi
  4402.       exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  4403. "
  4404.     ;;
  4405.  
  4406.   *)
  4407.     $ECHO "\
  4408.       if test -n \"\$lt_option_debug\"; then
  4409.         \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
  4410.         func_lt_dump_args \${1+\"\$@\"} 1>&2
  4411.       fi
  4412.       exec \"\$progdir/\$program\" \${1+\"\$@\"}
  4413. "
  4414.     ;;
  4415.   esac
  4416.   $ECHO "\
  4417.       \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  4418.       exit 1
  4419. }
  4420.  
  4421. # A function to encapsulate launching the target application
  4422. # Strips options in the --lt-* namespace from \$@ and
  4423. # launches target application with the remaining arguments.
  4424. func_exec_program ()
  4425. {
  4426.   case \" \$* \" in
  4427.   *\\ --lt-*)
  4428.     for lt_wr_arg
  4429.     do
  4430.       case \$lt_wr_arg in
  4431.       --lt-*) ;;
  4432.       *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  4433.       esac
  4434.       shift
  4435.     done ;;
  4436.   esac
  4437.   func_exec_program_core \${1+\"\$@\"}
  4438. }
  4439.  
  4440.   # Parse options
  4441.   func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  4442.  
  4443.   # Find the directory that this script lives in.
  4444.   thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  4445.   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4446.  
  4447.   # Follow symbolic links until we get to the real thisdir.
  4448.   file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  4449.   while test -n \"\$file\"; do
  4450.     destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  4451.  
  4452.     # If there was a directory component, then change thisdir.
  4453.     if test \"x\$destdir\" != \"x\$file\"; then
  4454.       case \"\$destdir\" in
  4455.       [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4456.       *) thisdir=\"\$thisdir/\$destdir\" ;;
  4457.       esac
  4458.     fi
  4459.  
  4460.     file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  4461.     file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  4462.   done
  4463.  
  4464.   # Usually 'no', except on cygwin/mingw when embedded into
  4465.   # the cwrapper.
  4466.   WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  4467.   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  4468.     # special case for '.'
  4469.     if test \"\$thisdir\" = \".\"; then
  4470.       thisdir=\`pwd\`
  4471.     fi
  4472.     # remove .libs from thisdir
  4473.     case \"\$thisdir\" in
  4474.     *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  4475.     $objdir )   thisdir=. ;;
  4476.     esac
  4477.   fi
  4478.  
  4479.   # Try to get the absolute directory name.
  4480.   absdir=\`cd \"\$thisdir\" && pwd\`
  4481.   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4482. "
  4483.  
  4484.         if test "$fast_install" = yes; then
  4485.           $ECHO "\
  4486.   program=lt-'$outputname'$exeext
  4487.   progdir=\"\$thisdir/$objdir\"
  4488.  
  4489.   if test ! -f \"\$progdir/\$program\" ||
  4490.      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  4491.        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  4492.  
  4493.     file=\"\$\$-\$program\"
  4494.  
  4495.     if test ! -d \"\$progdir\"; then
  4496.       $MKDIR \"\$progdir\"
  4497.     else
  4498.       $RM \"\$progdir/\$file\"
  4499.     fi"
  4500.  
  4501.           $ECHO "\
  4502.  
  4503.     # relink executable if necessary
  4504.     if test -n \"\$relink_command\"; then
  4505.       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  4506.       else
  4507.         $ECHO \"\$relink_command_output\" >&2
  4508.         $RM \"\$progdir/\$file\"
  4509.         exit 1
  4510.       fi
  4511.     fi
  4512.  
  4513.     $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  4514.     { $RM \"\$progdir/\$program\";
  4515.       $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  4516.     $RM \"\$progdir/\$file\"
  4517.   fi"
  4518.         else
  4519.           $ECHO "\
  4520.   program='$outputname'
  4521.   progdir=\"\$thisdir/$objdir\"
  4522. "
  4523.         fi
  4524.  
  4525.         $ECHO "\
  4526.  
  4527.   if test -f \"\$progdir/\$program\"; then"
  4528.  
  4529.         # fixup the dll searchpath if we need to.
  4530.         #
  4531.         # Fix the DLL searchpath if we need to.  Do this before prepending
  4532.         # to shlibpath, because on Windows, both are PATH and uninstalled
  4533.         # libraries must come first.
  4534.         if test -n "$dllsearchpath"; then
  4535.           $ECHO "\
  4536.     # Add the dll search path components to the executable PATH
  4537.     PATH=$dllsearchpath:\$PATH
  4538. "
  4539.         fi
  4540.  
  4541.         # Export our shlibpath_var if we have one.
  4542.         if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  4543.           $ECHO "\
  4544.     # Add our own library path to $shlibpath_var
  4545.     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  4546.  
  4547.     # Some systems cannot cope with colon-terminated $shlibpath_var
  4548.     # The second colon is a workaround for a bug in BeOS R4 sed
  4549.     $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  4550.  
  4551.     export $shlibpath_var
  4552. "
  4553.         fi
  4554.  
  4555.         $ECHO "\
  4556.     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4557.       # Run the actual program with our arguments.
  4558.       func_exec_program \${1+\"\$@\"}
  4559.     fi
  4560.   else
  4561.     # The program doesn't exist.
  4562.     \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  4563.     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  4564.     \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  4565.     exit 1
  4566.   fi
  4567. fi\
  4568. "
  4569. }
  4570.  
  4571.  
  4572. # func_emit_cwrapperexe_src
  4573. # emit the source code for a wrapper executable on stdout
  4574. # Must ONLY be called from within func_mode_link because
  4575. # it depends on a number of variable set therein.
  4576. func_emit_cwrapperexe_src ()
  4577. {
  4578.         cat <<EOF
  4579.  
  4580. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  4581.    Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  4582.  
  4583.    The $output program cannot be directly executed until all the libtool
  4584.    libraries that it depends on are installed.
  4585.  
  4586.    This wrapper executable should never be moved out of the build directory.
  4587.    If it is, it will not operate correctly.
  4588. */
  4589. EOF
  4590.             cat <<"EOF"
  4591. #ifdef _MSC_VER
  4592. # define _CRT_SECURE_NO_DEPRECATE 1
  4593. #endif
  4594. #include <stdio.h>
  4595. #include <stdlib.h>
  4596. #ifdef _MSC_VER
  4597. # include <direct.h>
  4598. # include <process.h>
  4599. # include <io.h>
  4600. #else
  4601. # include <unistd.h>
  4602. # include <stdint.h>
  4603. # ifdef __CYGWIN__
  4604. #  include <io.h>
  4605. # endif
  4606. #endif
  4607. #include <malloc.h>
  4608. #include <stdarg.h>
  4609. #include <assert.h>
  4610. #include <string.h>
  4611. #include <ctype.h>
  4612. #include <errno.h>
  4613. #include <fcntl.h>
  4614. #include <sys/stat.h>
  4615.  
  4616. /* declarations of non-ANSI functions */
  4617. #if defined(__MINGW32__)
  4618. # ifdef __STRICT_ANSI__
  4619. int _putenv (const char *);
  4620. # endif
  4621. #elif defined(__CYGWIN__)
  4622. # ifdef __STRICT_ANSI__
  4623. char *realpath (const char *, char *);
  4624. int putenv (char *);
  4625. int setenv (const char *, const char *, int);
  4626. # endif
  4627. /* #elif defined (other platforms) ... */
  4628. #endif
  4629.  
  4630. /* portability defines, excluding path handling macros */
  4631. #if defined(_MSC_VER)
  4632. # define setmode _setmode
  4633. # define stat    _stat
  4634. # define chmod   _chmod
  4635. # define getcwd  _getcwd
  4636. # define putenv  _putenv
  4637. # define S_IXUSR _S_IEXEC
  4638. # ifndef _INTPTR_T_DEFINED
  4639. #  define _INTPTR_T_DEFINED
  4640. #  define intptr_t int
  4641. # endif
  4642. #elif defined(__MINGW32__)
  4643. # define setmode _setmode
  4644. # define stat    _stat
  4645. # define chmod   _chmod
  4646. # define getcwd  _getcwd
  4647. # define putenv  _putenv
  4648. #elif defined(__CYGWIN__)
  4649. # define HAVE_SETENV
  4650. # define FOPEN_WB "wb"
  4651. /* #elif defined (other platforms) ... */
  4652. #endif
  4653.  
  4654. #if defined(PATH_MAX)
  4655. # define LT_PATHMAX PATH_MAX
  4656. #elif defined(MAXPATHLEN)
  4657. # define LT_PATHMAX MAXPATHLEN
  4658. #else
  4659. # define LT_PATHMAX 1024
  4660. #endif
  4661.  
  4662. #ifndef S_IXOTH
  4663. # define S_IXOTH 0
  4664. #endif
  4665. #ifndef S_IXGRP
  4666. # define S_IXGRP 0
  4667. #endif
  4668.  
  4669. /* path handling portability macros */
  4670. #ifndef DIR_SEPARATOR
  4671. # define DIR_SEPARATOR '/'
  4672. # define PATH_SEPARATOR ':'
  4673. #endif
  4674.  
  4675. #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  4676.   defined (__OS2__)
  4677. # define HAVE_DOS_BASED_FILE_SYSTEM
  4678. # define FOPEN_WB "wb"
  4679. # ifndef DIR_SEPARATOR_2
  4680. #  define DIR_SEPARATOR_2 '\\'
  4681. # endif
  4682. # ifndef PATH_SEPARATOR_2
  4683. #  define PATH_SEPARATOR_2 ';'
  4684. # endif
  4685. #endif
  4686.  
  4687. #ifndef DIR_SEPARATOR_2
  4688. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  4689. #else /* DIR_SEPARATOR_2 */
  4690. # define IS_DIR_SEPARATOR(ch) \
  4691.         (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  4692. #endif /* DIR_SEPARATOR_2 */
  4693.  
  4694. #ifndef PATH_SEPARATOR_2
  4695. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  4696. #else /* PATH_SEPARATOR_2 */
  4697. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  4698. #endif /* PATH_SEPARATOR_2 */
  4699.  
  4700. #ifndef FOPEN_WB
  4701. # define FOPEN_WB "w"
  4702. #endif
  4703. #ifndef _O_BINARY
  4704. # define _O_BINARY 0
  4705. #endif
  4706.  
  4707. #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  4708. #define XFREE(stale) do { \
  4709.   if (stale) { free ((void *) stale); stale = 0; } \
  4710. } while (0)
  4711.  
  4712. #if defined(LT_DEBUGWRAPPER)
  4713. static int lt_debug = 1;
  4714. #else
  4715. static int lt_debug = 0;
  4716. #endif
  4717.  
  4718. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  4719.  
  4720. void *xmalloc (size_t num);
  4721. char *xstrdup (const char *string);
  4722. const char *base_name (const char *name);
  4723. char *find_executable (const char *wrapper);
  4724. char *chase_symlinks (const char *pathspec);
  4725. int make_executable (const char *path);
  4726. int check_executable (const char *path);
  4727. char *strendzap (char *str, const char *pat);
  4728. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  4729. void lt_fatal (const char *file, int line, const char *message, ...);
  4730. static const char *nonnull (const char *s);
  4731. static const char *nonempty (const char *s);
  4732. void lt_setenv (const char *name, const char *value);
  4733. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  4734. void lt_update_exe_path (const char *name, const char *value);
  4735. void lt_update_lib_path (const char *name, const char *value);
  4736. char **prepare_spawn (char **argv);
  4737. void lt_dump_script (FILE *f);
  4738. EOF
  4739.  
  4740.             cat <<EOF
  4741. volatile const char * MAGIC_EXE = "$magic_exe";
  4742. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  4743. EOF
  4744.  
  4745.             if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  4746.               func_to_host_path "$temp_rpath"
  4747.               cat <<EOF
  4748. const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
  4749. EOF
  4750.             else
  4751.               cat <<"EOF"
  4752. const char * LIB_PATH_VALUE   = "";
  4753. EOF
  4754.             fi
  4755.  
  4756.             if test -n "$dllsearchpath"; then
  4757.               func_to_host_path "$dllsearchpath:"
  4758.               cat <<EOF
  4759. const char * EXE_PATH_VARNAME = "PATH";
  4760. const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
  4761. EOF
  4762.             else
  4763.               cat <<"EOF"
  4764. const char * EXE_PATH_VARNAME = "";
  4765. const char * EXE_PATH_VALUE   = "";
  4766. EOF
  4767.             fi
  4768.  
  4769.             if test "$fast_install" = yes; then
  4770.               cat <<EOF
  4771. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  4772. EOF
  4773.             else
  4774.               cat <<EOF
  4775. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  4776. EOF
  4777.             fi
  4778.  
  4779.  
  4780.             cat <<"EOF"
  4781.  
  4782. #define LTWRAPPER_OPTION_PREFIX         "--lt-"
  4783.  
  4784. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  4785. static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
  4786. static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
  4787.  
  4788. int
  4789. main (int argc, char *argv[])
  4790. {
  4791.   char **newargz;
  4792.   int  newargc;
  4793.   char *tmp_pathspec;
  4794.   char *actual_cwrapper_path;
  4795.   char *actual_cwrapper_name;
  4796.   char *target_name;
  4797.   char *lt_argv_zero;
  4798.   intptr_t rval = 127;
  4799.  
  4800.   int i;
  4801.  
  4802.   program_name = (char *) xstrdup (base_name (argv[0]));
  4803.   newargz = XMALLOC (char *, argc + 1);
  4804.  
  4805.   /* very simple arg parsing; don't want to rely on getopt
  4806.    * also, copy all non cwrapper options to newargz, except
  4807.    * argz[0], which is handled differently
  4808.    */
  4809.   newargc=0;
  4810.   for (i = 1; i < argc; i++)
  4811.     {
  4812.       if (strcmp (argv[i], dumpscript_opt) == 0)
  4813.         {
  4814. EOF
  4815.             case "$host" in
  4816.               *mingw* | *cygwin* )
  4817.                 # make stdout use "unix" line endings
  4818.                 echo "          setmode(1,_O_BINARY);"
  4819.                 ;;
  4820.               esac
  4821.  
  4822.             cat <<"EOF"
  4823.           lt_dump_script (stdout);
  4824.           return 0;
  4825.         }
  4826.       if (strcmp (argv[i], debug_opt) == 0)
  4827.         {
  4828.           lt_debug = 1;
  4829.           continue;
  4830.         }
  4831.       if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
  4832.         {
  4833.           /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  4834.              namespace, but it is not one of the ones we know about and
  4835.              have already dealt with, above (inluding dump-script), then
  4836.              report an error. Otherwise, targets might begin to believe
  4837.              they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  4838.              namespace. The first time any user complains about this, we'll
  4839.              need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  4840.              or a configure.ac-settable value.
  4841.            */
  4842.           lt_fatal (__FILE__, __LINE__,
  4843.                     "unrecognized %s option: '%s'",
  4844.                     ltwrapper_option_prefix, argv[i]);
  4845.         }
  4846.       /* otherwise ... */
  4847.       newargz[++newargc] = xstrdup (argv[i]);
  4848.     }
  4849.   newargz[++newargc] = NULL;
  4850.  
  4851. EOF
  4852.             cat <<EOF
  4853.   /* The GNU banner must be the first non-error debug message */
  4854.   lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
  4855. EOF
  4856.             cat <<"EOF"
  4857.   lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  4858.   lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  4859.  
  4860.   tmp_pathspec = find_executable (argv[0]);
  4861.   if (tmp_pathspec == NULL)
  4862.     lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  4863.   lt_debugprintf (__FILE__, __LINE__,
  4864.                   "(main) found exe (before symlink chase) at: %s\n",
  4865.                   tmp_pathspec);
  4866.  
  4867.   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  4868.   lt_debugprintf (__FILE__, __LINE__,
  4869.                   "(main) found exe (after symlink chase) at: %s\n",
  4870.                   actual_cwrapper_path);
  4871.   XFREE (tmp_pathspec);
  4872.  
  4873.   actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  4874.   strendzap (actual_cwrapper_path, actual_cwrapper_name);
  4875.  
  4876.   /* wrapper name transforms */
  4877.   strendzap (actual_cwrapper_name, ".exe");
  4878.   tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  4879.   XFREE (actual_cwrapper_name);
  4880.   actual_cwrapper_name = tmp_pathspec;
  4881.   tmp_pathspec = 0;
  4882.  
  4883.   /* target_name transforms -- use actual target program name; might have lt- prefix */
  4884.   target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  4885.   strendzap (target_name, ".exe");
  4886.   tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  4887.   XFREE (target_name);
  4888.   target_name = tmp_pathspec;
  4889.   tmp_pathspec = 0;
  4890.  
  4891.   lt_debugprintf (__FILE__, __LINE__,
  4892.                   "(main) libtool target name: %s\n",
  4893.                   target_name);
  4894. EOF
  4895.  
  4896.             cat <<EOF
  4897.   newargz[0] =
  4898.     XMALLOC (char, (strlen (actual_cwrapper_path) +
  4899.                     strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  4900.   strcpy (newargz[0], actual_cwrapper_path);
  4901.   strcat (newargz[0], "$objdir");
  4902.   strcat (newargz[0], "/");
  4903. EOF
  4904.  
  4905.             cat <<"EOF"
  4906.   /* stop here, and copy so we don't have to do this twice */
  4907.   tmp_pathspec = xstrdup (newargz[0]);
  4908.  
  4909.   /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  4910.   strcat (newargz[0], actual_cwrapper_name);
  4911.  
  4912.   /* DO want the lt- prefix here if it exists, so use target_name */
  4913.   lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  4914.   XFREE (tmp_pathspec);
  4915.   tmp_pathspec = NULL;
  4916. EOF
  4917.  
  4918.             case $host_os in
  4919.               mingw*)
  4920.             cat <<"EOF"
  4921.   {
  4922.     char* p;
  4923.     while ((p = strchr (newargz[0], '\\')) != NULL)
  4924.       {
  4925.         *p = '/';
  4926.       }
  4927.     while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  4928.       {
  4929.         *p = '/';
  4930.       }
  4931.   }
  4932. EOF
  4933.             ;;
  4934.             esac
  4935.  
  4936.             cat <<"EOF"
  4937.   XFREE (target_name);
  4938.   XFREE (actual_cwrapper_path);
  4939.   XFREE (actual_cwrapper_name);
  4940.  
  4941.   lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  4942.   lt_setenv ("DUALCASE", "1");  /* for MSK sh */
  4943.   /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
  4944.      be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  4945.      because on Windows, both *_VARNAMEs are PATH but uninstalled
  4946.      libraries must come first. */
  4947.   lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  4948.   lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  4949.  
  4950.   lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  4951.                   nonnull (lt_argv_zero));
  4952.   for (i = 0; i < newargc; i++)
  4953.     {
  4954.       lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  4955.                       i, nonnull (newargz[i]));
  4956.     }
  4957.  
  4958. EOF
  4959.  
  4960.             case $host_os in
  4961.               mingw*)
  4962.                 cat <<"EOF"
  4963.   /* execv doesn't actually work on mingw as expected on unix */
  4964.   newargz = prepare_spawn (newargz);
  4965.   rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  4966.   if (rval == -1)
  4967.     {
  4968.       /* failed to start process */
  4969.       lt_debugprintf (__FILE__, __LINE__,
  4970.                       "(main) failed to launch target \"%s\": %s\n",
  4971.                       lt_argv_zero, nonnull (strerror (errno)));
  4972.       return 127;
  4973.     }
  4974.   return rval;
  4975. EOF
  4976.                 ;;
  4977.               *)
  4978.                 cat <<"EOF"
  4979.   execv (lt_argv_zero, newargz);
  4980.   return rval; /* =127, but avoids unused variable warning */
  4981. EOF
  4982.                 ;;
  4983.             esac
  4984.  
  4985.             cat <<"EOF"
  4986. }
  4987.  
  4988. void *
  4989. xmalloc (size_t num)
  4990. {
  4991.   void *p = (void *) malloc (num);
  4992.   if (!p)
  4993.     lt_fatal (__FILE__, __LINE__, "memory exhausted");
  4994.  
  4995.   return p;
  4996. }
  4997.  
  4998. char *
  4999. xstrdup (const char *string)
  5000. {
  5001.   return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5002.                           string) : NULL;
  5003. }
  5004.  
  5005. const char *
  5006. base_name (const char *name)
  5007. {
  5008.   const char *base;
  5009.  
  5010. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  5011.   /* Skip over the disk name in MSDOS pathnames. */
  5012.   if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5013.     name += 2;
  5014. #endif
  5015.  
  5016.   for (base = name; *name; name++)
  5017.     if (IS_DIR_SEPARATOR (*name))
  5018.       base = name + 1;
  5019.   return base;
  5020. }
  5021.  
  5022. int
  5023. check_executable (const char *path)
  5024. {
  5025.   struct stat st;
  5026.  
  5027.   lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5028.                   nonempty (path));
  5029.   if ((!path) || (!*path))
  5030.     return 0;
  5031.  
  5032.   if ((stat (path, &st) >= 0)
  5033.       && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5034.     return 1;
  5035.   else
  5036.     return 0;
  5037. }
  5038.  
  5039. int
  5040. make_executable (const char *path)
  5041. {
  5042.   int rval = 0;
  5043.   struct stat st;
  5044.  
  5045.   lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5046.                   nonempty (path));
  5047.   if ((!path) || (!*path))
  5048.     return 0;
  5049.  
  5050.   if (stat (path, &st) >= 0)
  5051.     {
  5052.       rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5053.     }
  5054.   return rval;
  5055. }
  5056.  
  5057. /* Searches for the full path of the wrapper.  Returns
  5058.    newly allocated full path name if found, NULL otherwise
  5059.    Does not chase symlinks, even on platforms that support them.
  5060. */
  5061. char *
  5062. find_executable (const char *wrapper)
  5063. {
  5064.   int has_slash = 0;
  5065.   const char *p;
  5066.   const char *p_next;
  5067.   /* static buffer for getcwd */
  5068.   char tmp[LT_PATHMAX + 1];
  5069.   int tmp_len;
  5070.   char *concat_name;
  5071.  
  5072.   lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  5073.                   nonempty (wrapper));
  5074.  
  5075.   if ((wrapper == NULL) || (*wrapper == '\0'))
  5076.     return NULL;
  5077.  
  5078.   /* Absolute path? */
  5079. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  5080.   if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  5081.     {
  5082.       concat_name = xstrdup (wrapper);
  5083.       if (check_executable (concat_name))
  5084.         return concat_name;
  5085.       XFREE (concat_name);
  5086.     }
  5087.   else
  5088.     {
  5089. #endif
  5090.       if (IS_DIR_SEPARATOR (wrapper[0]))
  5091.         {
  5092.           concat_name = xstrdup (wrapper);
  5093.           if (check_executable (concat_name))
  5094.             return concat_name;
  5095.           XFREE (concat_name);
  5096.         }
  5097. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  5098.     }
  5099. #endif
  5100.  
  5101.   for (p = wrapper; *p; p++)
  5102.     if (*p == '/')
  5103.       {
  5104.         has_slash = 1;
  5105.         break;
  5106.       }
  5107.   if (!has_slash)
  5108.     {
  5109.       /* no slashes; search PATH */
  5110.       const char *path = getenv ("PATH");
  5111.       if (path != NULL)
  5112.         {
  5113.           for (p = path; *p; p = p_next)
  5114.             {
  5115.               const char *q;
  5116.               size_t p_len;
  5117.               for (q = p; *q; q++)
  5118.                 if (IS_PATH_SEPARATOR (*q))
  5119.                   break;
  5120.               p_len = q - p;
  5121.               p_next = (*q == '\0' ? q : q + 1);
  5122.               if (p_len == 0)
  5123.                 {
  5124.                   /* empty path: current directory */
  5125.                   if (getcwd (tmp, LT_PATHMAX) == NULL)
  5126.                     lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5127.                               nonnull (strerror (errno)));
  5128.                   tmp_len = strlen (tmp);
  5129.                   concat_name =
  5130.                     XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5131.                   memcpy (concat_name, tmp, tmp_len);
  5132.                   concat_name[tmp_len] = '/';
  5133.                   strcpy (concat_name + tmp_len + 1, wrapper);
  5134.                 }
  5135.               else
  5136.                 {
  5137.                   concat_name =
  5138.                     XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  5139.                   memcpy (concat_name, p, p_len);
  5140.                   concat_name[p_len] = '/';
  5141.                   strcpy (concat_name + p_len + 1, wrapper);
  5142.                 }
  5143.               if (check_executable (concat_name))
  5144.                 return concat_name;
  5145.               XFREE (concat_name);
  5146.             }
  5147.         }
  5148.       /* not found in PATH; assume curdir */
  5149.     }
  5150.   /* Relative path | not found in path: prepend cwd */
  5151.   if (getcwd (tmp, LT_PATHMAX) == NULL)
  5152.     lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5153.               nonnull (strerror (errno)));
  5154.   tmp_len = strlen (tmp);
  5155.   concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5156.   memcpy (concat_name, tmp, tmp_len);
  5157.   concat_name[tmp_len] = '/';
  5158.   strcpy (concat_name + tmp_len + 1, wrapper);
  5159.  
  5160.   if (check_executable (concat_name))
  5161.     return concat_name;
  5162.   XFREE (concat_name);
  5163.   return NULL;
  5164. }
  5165.  
  5166. char *
  5167. chase_symlinks (const char *pathspec)
  5168. {
  5169. #ifndef S_ISLNK
  5170.   return xstrdup (pathspec);
  5171. #else
  5172.   char buf[LT_PATHMAX];
  5173.   struct stat s;
  5174.   char *tmp_pathspec = xstrdup (pathspec);
  5175.   char *p;
  5176.   int has_symlinks = 0;
  5177.   while (strlen (tmp_pathspec) && !has_symlinks)
  5178.     {
  5179.       lt_debugprintf (__FILE__, __LINE__,
  5180.                       "checking path component for symlinks: %s\n",
  5181.                       tmp_pathspec);
  5182.       if (lstat (tmp_pathspec, &s) == 0)
  5183.         {
  5184.           if (S_ISLNK (s.st_mode) != 0)
  5185.             {
  5186.               has_symlinks = 1;
  5187.               break;
  5188.             }
  5189.  
  5190.           /* search backwards for last DIR_SEPARATOR */
  5191.           p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  5192.           while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5193.             p--;
  5194.           if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5195.             {
  5196.               /* no more DIR_SEPARATORS left */
  5197.               break;
  5198.             }
  5199.           *p = '\0';
  5200.         }
  5201.       else
  5202.         {
  5203.           lt_fatal (__FILE__, __LINE__,
  5204.                     "error accessing file \"%s\": %s",
  5205.                     tmp_pathspec, nonnull (strerror (errno)));
  5206.         }
  5207.     }
  5208.   XFREE (tmp_pathspec);
  5209.  
  5210.   if (!has_symlinks)
  5211.     {
  5212.       return xstrdup (pathspec);
  5213.     }
  5214.  
  5215.   tmp_pathspec = realpath (pathspec, buf);
  5216.   if (tmp_pathspec == 0)
  5217.     {
  5218.       lt_fatal (__FILE__, __LINE__,
  5219.                 "could not follow symlinks for %s", pathspec);
  5220.     }
  5221.   return xstrdup (tmp_pathspec);
  5222. #endif
  5223. }
  5224.  
  5225. char *
  5226. strendzap (char *str, const char *pat)
  5227. {
  5228.   size_t len, patlen;
  5229.  
  5230.   assert (str != NULL);
  5231.   assert (pat != NULL);
  5232.  
  5233.   len = strlen (str);
  5234.   patlen = strlen (pat);
  5235.  
  5236.   if (patlen <= len)
  5237.     {
  5238.       str += len - patlen;
  5239.       if (strcmp (str, pat) == 0)
  5240.         *str = '\0';
  5241.     }
  5242.   return str;
  5243. }
  5244.  
  5245. void
  5246. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  5247. {
  5248.   va_list args;
  5249.   if (lt_debug)
  5250.     {
  5251.       (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  5252.       va_start (args, fmt);
  5253.       (void) vfprintf (stderr, fmt, args);
  5254.       va_end (args);
  5255.     }
  5256. }
  5257.  
  5258. static void
  5259. lt_error_core (int exit_status, const char *file,
  5260.                int line, const char *mode,
  5261.                const char *message, va_list ap)
  5262. {
  5263.   fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  5264.   vfprintf (stderr, message, ap);
  5265.   fprintf (stderr, ".\n");
  5266.  
  5267.   if (exit_status >= 0)
  5268.     exit (exit_status);
  5269. }
  5270.  
  5271. void
  5272. lt_fatal (const char *file, int line, const char *message, ...)
  5273. {
  5274.   va_list ap;
  5275.   va_start (ap, message);
  5276.   lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  5277.   va_end (ap);
  5278. }
  5279.  
  5280. static const char *
  5281. nonnull (const char *s)
  5282. {
  5283.   return s ? s : "(null)";
  5284. }
  5285.  
  5286. static const char *
  5287. nonempty (const char *s)
  5288. {
  5289.   return (s && !*s) ? "(empty)" : nonnull (s);
  5290. }
  5291.  
  5292. void
  5293. lt_setenv (const char *name, const char *value)
  5294. {
  5295.   lt_debugprintf (__FILE__, __LINE__,
  5296.                   "(lt_setenv) setting '%s' to '%s'\n",
  5297.                   nonnull (name), nonnull (value));
  5298.   {
  5299. #ifdef HAVE_SETENV
  5300.     /* always make a copy, for consistency with !HAVE_SETENV */
  5301.     char *str = xstrdup (value);
  5302.     setenv (name, str, 1);
  5303. #else
  5304.     int len = strlen (name) + 1 + strlen (value) + 1;
  5305.     char *str = XMALLOC (char, len);
  5306.     sprintf (str, "%s=%s", name, value);
  5307.     if (putenv (str) != EXIT_SUCCESS)
  5308.       {
  5309.         XFREE (str);
  5310.       }
  5311. #endif
  5312.   }
  5313. }
  5314.  
  5315. char *
  5316. lt_extend_str (const char *orig_value, const char *add, int to_end)
  5317. {
  5318.   char *new_value;
  5319.   if (orig_value && *orig_value)
  5320.     {
  5321.       int orig_value_len = strlen (orig_value);
  5322.       int add_len = strlen (add);
  5323.       new_value = XMALLOC (char, add_len + orig_value_len + 1);
  5324.       if (to_end)
  5325.         {
  5326.           strcpy (new_value, orig_value);
  5327.           strcpy (new_value + orig_value_len, add);
  5328.         }
  5329.       else
  5330.         {
  5331.           strcpy (new_value, add);
  5332.           strcpy (new_value + add_len, orig_value);
  5333.         }
  5334.     }
  5335.   else
  5336.     {
  5337.       new_value = xstrdup (add);
  5338.     }
  5339.   return new_value;
  5340. }
  5341.  
  5342. void
  5343. lt_update_exe_path (const char *name, const char *value)
  5344. {
  5345.   lt_debugprintf (__FILE__, __LINE__,
  5346.                   "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  5347.                   nonnull (name), nonnull (value));
  5348.  
  5349.   if (name && *name && value && *value)
  5350.     {
  5351.       char *new_value = lt_extend_str (getenv (name), value, 0);
  5352.       /* some systems can't cope with a ':'-terminated path #' */
  5353.       int len = strlen (new_value);
  5354.       while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  5355.         {
  5356.           new_value[len-1] = '\0';
  5357.         }
  5358.       lt_setenv (name, new_value);
  5359.       XFREE (new_value);
  5360.     }
  5361. }
  5362.  
  5363. void
  5364. lt_update_lib_path (const char *name, const char *value)
  5365. {
  5366.   lt_debugprintf (__FILE__, __LINE__,
  5367.                   "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  5368.                   nonnull (name), nonnull (value));
  5369.  
  5370.   if (name && *name && value && *value)
  5371.     {
  5372.       char *new_value = lt_extend_str (getenv (name), value, 0);
  5373.       lt_setenv (name, new_value);
  5374.       XFREE (new_value);
  5375.     }
  5376. }
  5377.  
  5378. EOF
  5379.             case $host_os in
  5380.               mingw*)
  5381.                 cat <<"EOF"
  5382.  
  5383. /* Prepares an argument vector before calling spawn().
  5384.    Note that spawn() does not by itself call the command interpreter
  5385.      (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  5386.       ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  5387.          GetVersionEx(&v);
  5388.          v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  5389.       }) ? "cmd.exe" : "command.com").
  5390.    Instead it simply concatenates the arguments, separated by ' ', and calls
  5391.    CreateProcess().  We must quote the arguments since Win32 CreateProcess()
  5392.    interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  5393.    special way:
  5394.    - Space and tab are interpreted as delimiters. They are not treated as
  5395.      delimiters if they are surrounded by double quotes: "...".
  5396.    - Unescaped double quotes are removed from the input. Their only effect is
  5397.      that within double quotes, space and tab are treated like normal
  5398.      characters.
  5399.    - Backslashes not followed by double quotes are not special.
  5400.    - But 2*n+1 backslashes followed by a double quote become
  5401.      n backslashes followed by a double quote (n >= 0):
  5402.        \" -> "
  5403.        \\\" -> \"
  5404.        \\\\\" -> \\"
  5405.  */
  5406. #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"
  5407. #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"
  5408. char **
  5409. prepare_spawn (char **argv)
  5410. {
  5411.   size_t argc;
  5412.   char **new_argv;
  5413.   size_t i;
  5414.  
  5415.   /* Count number of arguments.  */
  5416.   for (argc = 0; argv[argc] != NULL; argc++)
  5417.     ;
  5418.  
  5419.   /* Allocate new argument vector.  */
  5420.   new_argv = XMALLOC (char *, argc + 1);
  5421.  
  5422.   /* Put quoted arguments into the new argument vector.  */
  5423.   for (i = 0; i < argc; i++)
  5424.     {
  5425.       const char *string = argv[i];
  5426.  
  5427.       if (string[0] == '\0')
  5428.         new_argv[i] = xstrdup ("\"\"");
  5429.       else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  5430.         {
  5431.           int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  5432.           size_t length;
  5433.           unsigned int backslashes;
  5434.           const char *s;
  5435.           char *quoted_string;
  5436.           char *p;
  5437.  
  5438.           length = 0;
  5439.           backslashes = 0;
  5440.           if (quote_around)
  5441.             length++;
  5442.           for (s = string; *s != '\0'; s++)
  5443.             {
  5444.               char c = *s;
  5445.               if (c == '"')
  5446.                 length += backslashes + 1;
  5447.               length++;
  5448.               if (c == '\\')
  5449.                 backslashes++;
  5450.               else
  5451.                 backslashes = 0;
  5452.             }
  5453.           if (quote_around)
  5454.             length += backslashes + 1;
  5455.  
  5456.           quoted_string = XMALLOC (char, length + 1);
  5457.  
  5458.           p = quoted_string;
  5459.           backslashes = 0;
  5460.           if (quote_around)
  5461.             *p++ = '"';
  5462.           for (s = string; *s != '\0'; s++)
  5463.             {
  5464.               char c = *s;
  5465.               if (c == '"')
  5466.                 {
  5467.                   unsigned int j;
  5468.                   for (j = backslashes + 1; j > 0; j--)
  5469.                     *p++ = '\\';
  5470.                 }
  5471.               *p++ = c;
  5472.               if (c == '\\')
  5473.                 backslashes++;
  5474.               else
  5475.                 backslashes = 0;
  5476.             }
  5477.           if (quote_around)
  5478.             {
  5479.               unsigned int j;
  5480.               for (j = backslashes; j > 0; j--)
  5481.                 *p++ = '\\';
  5482.               *p++ = '"';
  5483.             }
  5484.           *p = '\0';
  5485.  
  5486.           new_argv[i] = quoted_string;
  5487.         }
  5488.       else
  5489.         new_argv[i] = (char *) string;
  5490.     }
  5491.   new_argv[argc] = NULL;
  5492.  
  5493.   return new_argv;
  5494. }
  5495. EOF
  5496.                 ;;
  5497.             esac
  5498.  
  5499.             cat <<"EOF"
  5500. void lt_dump_script (FILE* f)
  5501. {
  5502. EOF
  5503.             func_emit_wrapper yes |
  5504.               $SED -n -e '
  5505. s/^\(.\{79\}\)\(..*\)/\1\
  5506. \2/
  5507. h
  5508. s/\([\\"]\)/\\\1/g
  5509. s/$/\\n/
  5510. s/\([^\n]*\).*/  fputs ("\1", f);/p
  5511. g
  5512. D'
  5513.             cat <<"EOF"
  5514. }
  5515. EOF
  5516. }
  5517. # end: func_emit_cwrapperexe_src
  5518.  
  5519. # func_win32_import_lib_p ARG
  5520. # True if ARG is an import lib, as indicated by $file_magic_cmd
  5521. func_win32_import_lib_p ()
  5522. {
  5523.     $opt_debug
  5524.     case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  5525.     *import*) : ;;
  5526.     *) false ;;
  5527.     esac
  5528. }
  5529.  
  5530. # func_mode_link arg...
  5531. func_mode_link ()
  5532. {
  5533.     $opt_debug
  5534.     case $host in
  5535.     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  5536.       # It is impossible to link a dll without this setting, and
  5537.       # we shouldn't force the makefile maintainer to figure out
  5538.       # which system we are compiling for in order to pass an extra
  5539.       # flag for every libtool invocation.
  5540.       # allow_undefined=no
  5541.  
  5542.       # FIXME: Unfortunately, there are problems with the above when trying
  5543.       # to make a dll which has undefined symbols, in which case not
  5544.       # even a static library is built.  For now, we need to specify
  5545.       # -no-undefined on the libtool link line when we can be certain
  5546.       # that all symbols are satisfied, otherwise we get a static library.
  5547.       allow_undefined=yes
  5548.       ;;
  5549.     *)
  5550.       allow_undefined=yes
  5551.       ;;
  5552.     esac
  5553.     libtool_args=$nonopt
  5554.     base_compile="$nonopt $@"
  5555.     compile_command=$nonopt
  5556.     finalize_command=$nonopt
  5557.  
  5558.     compile_rpath=
  5559.     finalize_rpath=
  5560.     compile_shlibpath=
  5561.     finalize_shlibpath=
  5562.     convenience=
  5563.     old_convenience=
  5564.     deplibs=
  5565.     old_deplibs=
  5566.     compiler_flags=
  5567.     linker_flags=
  5568.     dllsearchpath=
  5569.     lib_search_path=`pwd`
  5570.     inst_prefix_dir=
  5571.     new_inherited_linker_flags=
  5572.  
  5573.     avoid_version=no
  5574.     bindir=
  5575.     dlfiles=
  5576.     dlprefiles=
  5577.     dlself=no
  5578.     export_dynamic=no
  5579.     export_symbols=
  5580.     export_symbols_regex=
  5581.     generated=
  5582.     libobjs=
  5583.     ltlibs=
  5584.     module=no
  5585.     no_install=no
  5586.     objs=
  5587.     non_pic_objects=
  5588.     precious_files_regex=
  5589.     prefer_static_libs=no
  5590.     preload=no
  5591.     prev=
  5592.     prevarg=
  5593.     release=
  5594.     rpath=
  5595.     xrpath=
  5596.     perm_rpath=
  5597.     temp_rpath=
  5598.     thread_safe=no
  5599.     vinfo=
  5600.     vinfo_number=no
  5601.     weak_libs=
  5602.     single_module="${wl}-single_module"
  5603.     func_infer_tag $base_compile
  5604.  
  5605.     # We need to know -static, to get the right output filenames.
  5606.     for arg
  5607.     do
  5608.       case $arg in
  5609.       -shared)
  5610.         test "$build_libtool_libs" != yes && \
  5611.           func_fatal_configuration "can not build a shared library"
  5612.         build_old_libs=no
  5613.         break
  5614.         ;;
  5615.       -all-static | -static | -static-libtool-libs)
  5616.         case $arg in
  5617.         -all-static)
  5618.           if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  5619.             func_warning "complete static linking is impossible in this configuration"
  5620.           fi
  5621.           if test -n "$link_static_flag"; then
  5622.             dlopen_self=$dlopen_self_static
  5623.           fi
  5624.           prefer_static_libs=yes
  5625.           ;;
  5626.         -static)
  5627.           if test -z "$pic_flag" && test -n "$link_static_flag"; then
  5628.             dlopen_self=$dlopen_self_static
  5629.           fi
  5630.           prefer_static_libs=built
  5631.           ;;
  5632.         -static-libtool-libs)
  5633.           if test -z "$pic_flag" && test -n "$link_static_flag"; then
  5634.             dlopen_self=$dlopen_self_static
  5635.           fi
  5636.           prefer_static_libs=yes
  5637.           ;;
  5638.         esac
  5639.         build_libtool_libs=no
  5640.         build_old_libs=yes
  5641.         break
  5642.         ;;
  5643.       esac
  5644.     done
  5645.  
  5646.     # See if our shared archives depend on static archives.
  5647.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  5648.  
  5649.     # Go through the arguments, transforming them on the way.
  5650.     while test "$#" -gt 0; do
  5651.       arg="$1"
  5652.       shift
  5653.       func_quote_for_eval "$arg"
  5654.       qarg=$func_quote_for_eval_unquoted_result
  5655.       libtool_args+=" $func_quote_for_eval_result"
  5656.  
  5657.       # If the previous option needs an argument, assign it.
  5658.       if test -n "$prev"; then
  5659.         case $prev in
  5660.         output)
  5661.           compile_command+=" @OUTPUT@"
  5662.           finalize_command+=" @OUTPUT@"
  5663.           ;;
  5664.         esac
  5665.  
  5666.         case $prev in
  5667.         bindir)
  5668.           bindir="$arg"
  5669.           prev=
  5670.           continue
  5671.           ;;
  5672.         dlfiles|dlprefiles)
  5673.           if test "$preload" = no; then
  5674.             # Add the symbol object into the linking commands.
  5675.             compile_command+=" @SYMFILE@"
  5676.             finalize_command+=" @SYMFILE@"
  5677.             preload=yes
  5678.           fi
  5679.           case $arg in
  5680.           *.la | *.lo) ;;  # We handle these cases below.
  5681.           force)
  5682.             if test "$dlself" = no; then
  5683.               dlself=needless
  5684.               export_dynamic=yes
  5685.             fi
  5686.             prev=
  5687.             continue
  5688.             ;;
  5689.           self)
  5690.             if test "$prev" = dlprefiles; then
  5691.               dlself=yes
  5692.             elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  5693.               dlself=yes
  5694.             else
  5695.               dlself=needless
  5696.               export_dynamic=yes
  5697.             fi
  5698.             prev=
  5699.             continue
  5700.             ;;
  5701.           *)
  5702.             if test "$prev" = dlfiles; then
  5703.               dlfiles+=" $arg"
  5704.             else
  5705.               dlprefiles+=" $arg"
  5706.             fi
  5707.             prev=
  5708.             continue
  5709.             ;;
  5710.           esac
  5711.           ;;
  5712.         expsyms)
  5713.           export_symbols="$arg"
  5714.           test -f "$arg" \
  5715.             || func_fatal_error "symbol file \`$arg' does not exist"
  5716.           prev=
  5717.           continue
  5718.           ;;
  5719.         expsyms_regex)
  5720.           export_symbols_regex="$arg"
  5721.           prev=
  5722.           continue
  5723.           ;;
  5724.         framework)
  5725.           case $host in
  5726.             *-*-darwin*)
  5727.               case "$deplibs " in
  5728.                 *" $qarg.ltframework "*) ;;
  5729.                 *) deplibs+=" $qarg.ltframework" # this is fixed later
  5730.                    ;;
  5731.               esac
  5732.               ;;
  5733.           esac
  5734.           prev=
  5735.           continue
  5736.           ;;
  5737.         inst_prefix)
  5738.           inst_prefix_dir="$arg"
  5739.           prev=
  5740.           continue
  5741.           ;;
  5742.         objectlist)
  5743.           if test -f "$arg"; then
  5744.             save_arg=$arg
  5745.             moreargs=
  5746.             for fil in `cat "$save_arg"`
  5747.             do
  5748. #             moreargs+=" $fil"
  5749.               arg=$fil
  5750.               # A libtool-controlled object.
  5751.  
  5752.               # Check to see that this really is a libtool object.
  5753.               if func_lalib_unsafe_p "$arg"; then
  5754.                 pic_object=
  5755.                 non_pic_object=
  5756.  
  5757.                 # Read the .lo file
  5758.                 func_source "$arg"
  5759.  
  5760.                 if test -z "$pic_object" ||
  5761.                    test -z "$non_pic_object" ||
  5762.                    test "$pic_object" = none &&
  5763.                    test "$non_pic_object" = none; then
  5764.                   func_fatal_error "cannot find name of object for \`$arg'"
  5765.                 fi
  5766.  
  5767.                 # Extract subdirectory from the argument.
  5768.                 func_dirname "$arg" "/" ""
  5769.                 xdir="$func_dirname_result"
  5770.  
  5771.                 if test "$pic_object" != none; then
  5772.                   # Prepend the subdirectory the object is found in.
  5773.                   pic_object="$xdir$pic_object"
  5774.  
  5775.                   if test "$prev" = dlfiles; then
  5776.                     if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  5777.                       dlfiles+=" $pic_object"
  5778.                       prev=
  5779.                       continue
  5780.                     else
  5781.                       # If libtool objects are unsupported, then we need to preload.
  5782.                       prev=dlprefiles
  5783.                     fi
  5784.                   fi
  5785.  
  5786.                   # CHECK ME:  I think I busted this.  -Ossama
  5787.                   if test "$prev" = dlprefiles; then
  5788.                     # Preload the old-style object.
  5789.                     dlprefiles+=" $pic_object"
  5790.                     prev=
  5791.                   fi
  5792.  
  5793.                   # A PIC object.
  5794.                   libobjs+=" $pic_object"
  5795.                   arg="$pic_object"
  5796.                 fi
  5797.  
  5798.                 # Non-PIC object.
  5799.                 if test "$non_pic_object" != none; then
  5800.                   # Prepend the subdirectory the object is found in.
  5801.                   non_pic_object="$xdir$non_pic_object"
  5802.  
  5803.                   # A standard non-PIC object
  5804.                   non_pic_objects+=" $non_pic_object"
  5805.                   if test -z "$pic_object" || test "$pic_object" = none ; then
  5806.                     arg="$non_pic_object"
  5807.                   fi
  5808.                 else
  5809.                   # If the PIC object exists, use it instead.
  5810.                   # $xdir was prepended to $pic_object above.
  5811.                   non_pic_object="$pic_object"
  5812.                   non_pic_objects+=" $non_pic_object"
  5813.                 fi
  5814.               else
  5815.                 # Only an error if not doing a dry-run.
  5816.                 if $opt_dry_run; then
  5817.                   # Extract subdirectory from the argument.
  5818.                   func_dirname "$arg" "/" ""
  5819.                   xdir="$func_dirname_result"
  5820.  
  5821.                   func_lo2o "$arg"
  5822.                   pic_object=$xdir$objdir/$func_lo2o_result
  5823.                   non_pic_object=$xdir$func_lo2o_result
  5824.                   libobjs+=" $pic_object"
  5825.                   non_pic_objects+=" $non_pic_object"
  5826.                 else
  5827.                   func_fatal_error "\`$arg' is not a valid libtool object"
  5828.                 fi
  5829.               fi
  5830.             done
  5831.           else
  5832.             func_fatal_error "link input file \`$arg' does not exist"
  5833.           fi
  5834.           arg=$save_arg
  5835.           prev=
  5836.           continue
  5837.           ;;
  5838.         precious_regex)
  5839.           precious_files_regex="$arg"
  5840.           prev=
  5841.           continue
  5842.           ;;
  5843.         release)
  5844.           release="-$arg"
  5845.           prev=
  5846.           continue
  5847.           ;;
  5848.         rpath | xrpath)
  5849.           # We need an absolute path.
  5850.           case $arg in
  5851.           [\\/]* | [A-Za-z]:[\\/]*) ;;
  5852.           *)
  5853.             func_fatal_error "only absolute run-paths are allowed"
  5854.             ;;
  5855.           esac
  5856.           if test "$prev" = rpath; then
  5857.             case "$rpath " in
  5858.             *" $arg "*) ;;
  5859.             *) rpath+=" $arg" ;;
  5860.             esac
  5861.           else
  5862.             case "$xrpath " in
  5863.             *" $arg "*) ;;
  5864.             *) xrpath+=" $arg" ;;
  5865.             esac
  5866.           fi
  5867.           prev=
  5868.           continue
  5869.           ;;
  5870.         shrext)
  5871.           shrext_cmds="$arg"
  5872.           prev=
  5873.           continue
  5874.           ;;
  5875.         weak)
  5876.           weak_libs+=" $arg"
  5877.           prev=
  5878.           continue
  5879.           ;;
  5880.         xcclinker)
  5881.           linker_flags+=" $qarg"
  5882.           compiler_flags+=" $qarg"
  5883.           prev=
  5884.           compile_command+=" $qarg"
  5885.           finalize_command+=" $qarg"
  5886.           continue
  5887.           ;;
  5888.         xcompiler)
  5889.           compiler_flags+=" $qarg"
  5890.           prev=
  5891.           compile_command+=" $qarg"
  5892.           finalize_command+=" $qarg"
  5893.           continue
  5894.           ;;
  5895.         xlinker)
  5896.           linker_flags+=" $qarg"
  5897.           compiler_flags+=" $wl$qarg"
  5898.           prev=
  5899.           compile_command+=" $wl$qarg"
  5900.           finalize_command+=" $wl$qarg"
  5901.           continue
  5902.           ;;
  5903.         *)
  5904.           eval "$prev=\"\$arg\""
  5905.           prev=
  5906.           continue
  5907.           ;;
  5908.         esac
  5909.       fi # test -n "$prev"
  5910.  
  5911.       prevarg="$arg"
  5912.  
  5913.       case $arg in
  5914.       -all-static)
  5915.         if test -n "$link_static_flag"; then
  5916.           # See comment for -static flag below, for more details.
  5917.           compile_command+=" $link_static_flag"
  5918.           finalize_command+=" $link_static_flag"
  5919.         fi
  5920.         continue
  5921.         ;;
  5922.  
  5923.       -allow-undefined)
  5924.         # FIXME: remove this flag sometime in the future.
  5925.         func_fatal_error "\`-allow-undefined' must not be used because it is the default"
  5926.         ;;
  5927.  
  5928.       -avoid-version)
  5929.         avoid_version=yes
  5930.         continue
  5931.         ;;
  5932.  
  5933.       -bindir)
  5934.         prev=bindir
  5935.         continue
  5936.         ;;
  5937.  
  5938.       -dlopen)
  5939.         prev=dlfiles
  5940.         continue
  5941.         ;;
  5942.  
  5943.       -dlpreopen)
  5944.         prev=dlprefiles
  5945.         continue
  5946.         ;;
  5947.  
  5948.       -export-dynamic)
  5949.         export_dynamic=yes
  5950.         continue
  5951.         ;;
  5952.  
  5953.       -export-symbols | -export-symbols-regex)
  5954.         if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  5955.           func_fatal_error "more than one -exported-symbols argument is not allowed"
  5956.         fi
  5957.         if test "X$arg" = "X-export-symbols"; then
  5958.           prev=expsyms
  5959.         else
  5960.           prev=expsyms_regex
  5961.         fi
  5962.         continue
  5963.         ;;
  5964.  
  5965.       -framework)
  5966.         prev=framework
  5967.         continue
  5968.         ;;
  5969.  
  5970.       -inst-prefix-dir)
  5971.         prev=inst_prefix
  5972.         continue
  5973.         ;;
  5974.  
  5975.       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  5976.       # so, if we see these flags be careful not to treat them like -L
  5977.       -L[A-Z][A-Z]*:*)
  5978.         case $with_gcc/$host in
  5979.         no/*-*-irix* | /*-*-irix*)
  5980.           compile_command+=" $arg"
  5981.           finalize_command+=" $arg"
  5982.           ;;
  5983.         esac
  5984.         continue
  5985.         ;;
  5986.  
  5987.       -L*)
  5988.         func_stripname "-L" '' "$arg"
  5989.         if test -z "$func_stripname_result"; then
  5990.           if test "$#" -gt 0; then
  5991.             func_fatal_error "require no space between \`-L' and \`$1'"
  5992.           else
  5993.             func_fatal_error "need path for \`-L' option"
  5994.           fi
  5995.         fi
  5996.         func_resolve_sysroot "$func_stripname_result"
  5997.         dir=$func_resolve_sysroot_result
  5998.         # We need an absolute path.
  5999.         case $dir in
  6000.         [\\/]* | [A-Za-z]:[\\/]*) ;;
  6001.         *)
  6002.           absdir=`cd "$dir" && pwd`
  6003.           test -z "$absdir" && \
  6004.             func_fatal_error "cannot determine absolute directory name of \`$dir'"
  6005.           dir="$absdir"
  6006.           ;;
  6007.         esac
  6008.         case "$deplibs " in
  6009.         *" -L$dir "* | *" $arg "*)
  6010.           # Will only happen for absolute or sysroot arguments
  6011.           ;;
  6012.         *)
  6013.           # Preserve sysroot, but never include relative directories
  6014.           case $dir in
  6015.             [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
  6016.             *) deplibs+=" -L$dir" ;;
  6017.           esac
  6018.           lib_search_path+=" $dir"
  6019.           ;;
  6020.         esac
  6021.         case $host in
  6022.         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6023.           testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  6024.           case :$dllsearchpath: in
  6025.           *":$dir:"*) ;;
  6026.           ::) dllsearchpath=$dir;;
  6027.           *) dllsearchpath+=":$dir";;
  6028.           esac
  6029.           case :$dllsearchpath: in
  6030.           *":$testbindir:"*) ;;
  6031.           ::) dllsearchpath=$testbindir;;
  6032.           *) dllsearchpath+=":$testbindir";;
  6033.           esac
  6034.           ;;
  6035.         esac
  6036.         continue
  6037.         ;;
  6038.  
  6039.       -l*)
  6040.         if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  6041.           case $host in
  6042.           *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6043.             # These systems don't actually have a C or math library (as such)
  6044.             continue
  6045.             ;;
  6046.           *-*-os2*)
  6047.             # These systems don't actually have a C library (as such)
  6048.             test "X$arg" = "X-lc" && continue
  6049.             ;;
  6050.           *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  6051.             # Do not include libc due to us having libc/libc_r.
  6052.             test "X$arg" = "X-lc" && continue
  6053.             ;;
  6054.           *-*-rhapsody* | *-*-darwin1.[012])
  6055.             # Rhapsody C and math libraries are in the System framework
  6056.             deplibs+=" System.ltframework"
  6057.             continue
  6058.             ;;
  6059.           *-*-sco3.2v5* | *-*-sco5v6*)
  6060.             # Causes problems with __ctype
  6061.             test "X$arg" = "X-lc" && continue
  6062.             ;;
  6063.           *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6064.             # Compiler inserts libc in the correct place for threads to work
  6065.             test "X$arg" = "X-lc" && continue
  6066.             ;;
  6067.           esac
  6068.         elif test "X$arg" = "X-lc_r"; then
  6069.          case $host in
  6070.          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  6071.            # Do not include libc_r directly, use -pthread flag.
  6072.            continue
  6073.            ;;
  6074.          esac
  6075.         fi
  6076.         deplibs+=" $arg"
  6077.         continue
  6078.         ;;
  6079.  
  6080.       -module)
  6081.         module=yes
  6082.         continue
  6083.         ;;
  6084.  
  6085.       # Tru64 UNIX uses -model [arg] to determine the layout of C++
  6086.       # classes, name mangling, and exception handling.
  6087.       # Darwin uses the -arch flag to determine output architecture.
  6088.       -model|-arch|-isysroot|--sysroot)
  6089.         compiler_flags+=" $arg"
  6090.         compile_command+=" $arg"
  6091.         finalize_command+=" $arg"
  6092.         prev=xcompiler
  6093.         continue
  6094.         ;;
  6095.  
  6096.       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6097.       |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6098.         compiler_flags+=" $arg"
  6099.         compile_command+=" $arg"
  6100.         finalize_command+=" $arg"
  6101.         case "$new_inherited_linker_flags " in
  6102.             *" $arg "*) ;;
  6103.             * ) new_inherited_linker_flags+=" $arg" ;;
  6104.         esac
  6105.         continue
  6106.         ;;
  6107.  
  6108.       -multi_module)
  6109.         single_module="${wl}-multi_module"
  6110.         continue
  6111.         ;;
  6112.  
  6113.       -no-fast-install)
  6114.         fast_install=no
  6115.         continue
  6116.         ;;
  6117.  
  6118.       -no-install)
  6119.         case $host in
  6120.         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  6121.           # The PATH hackery in wrapper scripts is required on Windows
  6122.           # and Darwin in order for the loader to find any dlls it needs.
  6123.           func_warning "\`-no-install' is ignored for $host"
  6124.           func_warning "assuming \`-no-fast-install' instead"
  6125.           fast_install=no
  6126.           ;;
  6127.         *) no_install=yes ;;
  6128.         esac
  6129.         continue
  6130.         ;;
  6131.  
  6132.       -no-undefined)
  6133.         allow_undefined=no
  6134.         continue
  6135.         ;;
  6136.  
  6137.       -objectlist)
  6138.         prev=objectlist
  6139.         continue
  6140.         ;;
  6141.  
  6142.       -o) prev=output ;;
  6143.  
  6144.       -precious-files-regex)
  6145.         prev=precious_regex
  6146.         continue
  6147.         ;;
  6148.  
  6149.       -release)
  6150.         prev=release
  6151.         continue
  6152.         ;;
  6153.  
  6154.       -rpath)
  6155.         prev=rpath
  6156.         continue
  6157.         ;;
  6158.  
  6159.       -R)
  6160.         prev=xrpath
  6161.         continue
  6162.         ;;
  6163.  
  6164.       -R*)
  6165.         func_stripname '-R' '' "$arg"
  6166.         dir=$func_stripname_result
  6167.         # We need an absolute path.
  6168.         case $dir in
  6169.         [\\/]* | [A-Za-z]:[\\/]*) ;;
  6170.         =*)
  6171.           func_stripname '=' '' "$dir"
  6172.           dir=$lt_sysroot$func_stripname_result
  6173.           ;;
  6174.         *)
  6175.           func_fatal_error "only absolute run-paths are allowed"
  6176.           ;;
  6177.         esac
  6178.         case "$xrpath " in
  6179.         *" $dir "*) ;;
  6180.         *) xrpath+=" $dir" ;;
  6181.         esac
  6182.         continue
  6183.         ;;
  6184.  
  6185.       -shared)
  6186.         # The effects of -shared are defined in a previous loop.
  6187.         continue
  6188.         ;;
  6189.  
  6190.       -shrext)
  6191.         prev=shrext
  6192.         continue
  6193.         ;;
  6194.  
  6195.       -static | -static-libtool-libs)
  6196.         # The effects of -static are defined in a previous loop.
  6197.         # We used to do the same as -all-static on platforms that
  6198.         # didn't have a PIC flag, but the assumption that the effects
  6199.         # would be equivalent was wrong.  It would break on at least
  6200.         # Digital Unix and AIX.
  6201.         continue
  6202.         ;;
  6203.  
  6204.       -thread-safe)
  6205.         thread_safe=yes
  6206.         continue
  6207.         ;;
  6208.  
  6209.       -version-info)
  6210.         prev=vinfo
  6211.         continue
  6212.         ;;
  6213.  
  6214.       -version-number)
  6215.         prev=vinfo
  6216.         vinfo_number=yes
  6217.         continue
  6218.         ;;
  6219.  
  6220.       -weak)
  6221.         prev=weak
  6222.         continue
  6223.         ;;
  6224.  
  6225.       -Wc,*)
  6226.         func_stripname '-Wc,' '' "$arg"
  6227.         args=$func_stripname_result
  6228.         arg=
  6229.         save_ifs="$IFS"; IFS=','
  6230.         for flag in $args; do
  6231.           IFS="$save_ifs"
  6232.           func_quote_for_eval "$flag"
  6233.           arg+=" $func_quote_for_eval_result"
  6234.           compiler_flags+=" $func_quote_for_eval_result"
  6235.         done
  6236.         IFS="$save_ifs"
  6237.         func_stripname ' ' '' "$arg"
  6238.         arg=$func_stripname_result
  6239.         ;;
  6240.  
  6241.       -Wl,*)
  6242.         func_stripname '-Wl,' '' "$arg"
  6243.         args=$func_stripname_result
  6244.         arg=
  6245.         save_ifs="$IFS"; IFS=','
  6246.         for flag in $args; do
  6247.           IFS="$save_ifs"
  6248.           func_quote_for_eval "$flag"
  6249.           arg+=" $wl$func_quote_for_eval_result"
  6250.           compiler_flags+=" $wl$func_quote_for_eval_result"
  6251.           linker_flags+=" $func_quote_for_eval_result"
  6252.         done
  6253.         IFS="$save_ifs"
  6254.         func_stripname ' ' '' "$arg"
  6255.         arg=$func_stripname_result
  6256.         ;;
  6257.  
  6258.       -Xcompiler)
  6259.         prev=xcompiler
  6260.         continue
  6261.         ;;
  6262.  
  6263.       -Xlinker)
  6264.         prev=xlinker
  6265.         continue
  6266.         ;;
  6267.  
  6268.       -XCClinker)
  6269.         prev=xcclinker
  6270.         continue
  6271.         ;;
  6272.  
  6273.       # -msg_* for osf cc
  6274.       -msg_*)
  6275.         func_quote_for_eval "$arg"
  6276.         arg="$func_quote_for_eval_result"
  6277.         ;;
  6278.  
  6279.       # Flags to be passed through unchanged, with rationale:
  6280.       # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
  6281.       # -r[0-9][0-9]*        specify processor for the SGI compiler
  6282.       # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  6283.       # +DA*, +DD*           enable 64-bit mode for the HP compiler
  6284.       # -q*                  compiler args for the IBM compiler
  6285.       # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  6286.       # -F/path              path to uninstalled frameworks, gcc on darwin
  6287.       # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
  6288.       # @file                GCC response files
  6289.       # -tp=*                Portland pgcc target processor selection
  6290.       # --sysroot=*          for sysroot support
  6291.       # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  6292.       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  6293.       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  6294.       -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
  6295.         func_quote_for_eval "$arg"
  6296.         arg="$func_quote_for_eval_result"
  6297.         compile_command+=" $arg"
  6298.         finalize_command+=" $arg"
  6299.         compiler_flags+=" $arg"
  6300.         continue
  6301.         ;;
  6302.  
  6303.       # Some other compiler flag.
  6304.       -* | +*)
  6305.         func_quote_for_eval "$arg"
  6306.         arg="$func_quote_for_eval_result"
  6307.         ;;
  6308.  
  6309.       *.$objext)
  6310.         # A standard object.
  6311.         objs+=" $arg"
  6312.         ;;
  6313.  
  6314.       *.lo)
  6315.         # A libtool-controlled object.
  6316.  
  6317.         # Check to see that this really is a libtool object.
  6318.         if func_lalib_unsafe_p "$arg"; then
  6319.           pic_object=
  6320.           non_pic_object=
  6321.  
  6322.           # Read the .lo file
  6323.           func_source "$arg"
  6324.  
  6325.           if test -z "$pic_object" ||
  6326.              test -z "$non_pic_object" ||
  6327.              test "$pic_object" = none &&
  6328.              test "$non_pic_object" = none; then
  6329.             func_fatal_error "cannot find name of object for \`$arg'"
  6330.           fi
  6331.  
  6332.           # Extract subdirectory from the argument.
  6333.           func_dirname "$arg" "/" ""
  6334.           xdir="$func_dirname_result"
  6335.  
  6336.           if test "$pic_object" != none; then
  6337.             # Prepend the subdirectory the object is found in.
  6338.             pic_object="$xdir$pic_object"
  6339.  
  6340.             if test "$prev" = dlfiles; then
  6341.               if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  6342.                 dlfiles+=" $pic_object"
  6343.                 prev=
  6344.                 continue
  6345.               else
  6346.                 # If libtool objects are unsupported, then we need to preload.
  6347.                 prev=dlprefiles
  6348.               fi
  6349.             fi
  6350.  
  6351.             # CHECK ME:  I think I busted this.  -Ossama
  6352.             if test "$prev" = dlprefiles; then
  6353.               # Preload the old-style object.
  6354.               dlprefiles+=" $pic_object"
  6355.               prev=
  6356.             fi
  6357.  
  6358.             # A PIC object.
  6359.             libobjs+=" $pic_object"
  6360.             arg="$pic_object"
  6361.           fi
  6362.  
  6363.           # Non-PIC object.
  6364.           if test "$non_pic_object" != none; then
  6365.             # Prepend the subdirectory the object is found in.
  6366.             non_pic_object="$xdir$non_pic_object"
  6367.  
  6368.             # A standard non-PIC object
  6369.             non_pic_objects+=" $non_pic_object"
  6370.             if test -z "$pic_object" || test "$pic_object" = none ; then
  6371.               arg="$non_pic_object"
  6372.             fi
  6373.           else
  6374.             # If the PIC object exists, use it instead.
  6375.             # $xdir was prepended to $pic_object above.
  6376.             non_pic_object="$pic_object"
  6377.             non_pic_objects+=" $non_pic_object"
  6378.           fi
  6379.         else
  6380.           # Only an error if not doing a dry-run.
  6381.           if $opt_dry_run; then
  6382.             # Extract subdirectory from the argument.
  6383.             func_dirname "$arg" "/" ""
  6384.             xdir="$func_dirname_result"
  6385.  
  6386.             func_lo2o "$arg"
  6387.             pic_object=$xdir$objdir/$func_lo2o_result
  6388.             non_pic_object=$xdir$func_lo2o_result
  6389.             libobjs+=" $pic_object"
  6390.             non_pic_objects+=" $non_pic_object"
  6391.           else
  6392.             func_fatal_error "\`$arg' is not a valid libtool object"
  6393.           fi
  6394.         fi
  6395.         ;;
  6396.  
  6397.       *.$libext)
  6398.         # An archive.
  6399.         deplibs+=" $arg"
  6400.         old_deplibs+=" $arg"
  6401.         continue
  6402.         ;;
  6403.  
  6404.       *.la)
  6405.         # A libtool-controlled library.
  6406.  
  6407.         func_resolve_sysroot "$arg"
  6408.         if test "$prev" = dlfiles; then
  6409.           # This library was specified with -dlopen.
  6410.           dlfiles+=" $func_resolve_sysroot_result"
  6411.           prev=
  6412.         elif test "$prev" = dlprefiles; then
  6413.           # The library was specified with -dlpreopen.
  6414.           dlprefiles+=" $func_resolve_sysroot_result"
  6415.           prev=
  6416.         else
  6417.           deplibs+=" $func_resolve_sysroot_result"
  6418.         fi
  6419.         continue
  6420.         ;;
  6421.  
  6422.       # Some other compiler argument.
  6423.       *)
  6424.         # Unknown arguments in both finalize_command and compile_command need
  6425.         # to be aesthetically quoted because they are evaled later.
  6426.         func_quote_for_eval "$arg"
  6427.         arg="$func_quote_for_eval_result"
  6428.         ;;
  6429.       esac # arg
  6430.  
  6431.       # Now actually substitute the argument into the commands.
  6432.       if test -n "$arg"; then
  6433.         compile_command+=" $arg"
  6434.         finalize_command+=" $arg"
  6435.       fi
  6436.     done # argument parsing loop
  6437.  
  6438.     test -n "$prev" && \
  6439.       func_fatal_help "the \`$prevarg' option requires an argument"
  6440.  
  6441.     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  6442.       eval arg=\"$export_dynamic_flag_spec\"
  6443.       compile_command+=" $arg"
  6444.       finalize_command+=" $arg"
  6445.     fi
  6446.  
  6447.     oldlibs=
  6448.     # calculate the name of the file, without its directory
  6449.     func_basename "$output"
  6450.     outputname="$func_basename_result"
  6451.     libobjs_save="$libobjs"
  6452.  
  6453.     if test -n "$shlibpath_var"; then
  6454.       # get the directories listed in $shlibpath_var
  6455.       eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
  6456.     else
  6457.       shlib_search_path=
  6458.     fi
  6459.     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  6460.     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  6461.  
  6462.     func_dirname "$output" "/" ""
  6463.     output_objdir="$func_dirname_result$objdir"
  6464.     func_to_tool_file "$output_objdir/"
  6465.     tool_output_objdir=$func_to_tool_file_result
  6466.     # Create the object directory.
  6467.     func_mkdir_p "$output_objdir"
  6468.  
  6469.     # Determine the type of output
  6470.     case $output in
  6471.     "")
  6472.       func_fatal_help "you must specify an output file"
  6473.       ;;
  6474.     *.$libext) linkmode=oldlib ;;
  6475.     *.lo | *.$objext) linkmode=obj ;;
  6476.     *.la) linkmode=lib ;;
  6477.     *) linkmode=prog ;; # Anything else should be a program.
  6478.     esac
  6479.  
  6480.     specialdeplibs=
  6481.  
  6482.     libs=
  6483.     # Find all interdependent deplibs by searching for libraries
  6484.     # that are linked more than once (e.g. -la -lb -la)
  6485.     for deplib in $deplibs; do
  6486.       if $opt_preserve_dup_deps ; then
  6487.         case "$libs " in
  6488.         *" $deplib "*) specialdeplibs+=" $deplib" ;;
  6489.         esac
  6490.       fi
  6491.       libs+=" $deplib"
  6492.     done
  6493.  
  6494.     if test "$linkmode" = lib; then
  6495.       libs="$predeps $libs $compiler_lib_search_path $postdeps"
  6496.  
  6497.       # Compute libraries that are listed more than once in $predeps
  6498.       # $postdeps and mark them as special (i.e., whose duplicates are
  6499.       # not to be eliminated).
  6500.       pre_post_deps=
  6501.       if $opt_duplicate_compiler_generated_deps; then
  6502.         for pre_post_dep in $predeps $postdeps; do
  6503.           case "$pre_post_deps " in
  6504.           *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
  6505.           esac
  6506.           pre_post_deps+=" $pre_post_dep"
  6507.         done
  6508.       fi
  6509.       pre_post_deps=
  6510.     fi
  6511.  
  6512.     deplibs=
  6513.     newdependency_libs=
  6514.     newlib_search_path=
  6515.     need_relink=no # whether we're linking any uninstalled libtool libraries
  6516.     notinst_deplibs= # not-installed libtool libraries
  6517.     notinst_path= # paths that contain not-installed libtool libraries
  6518.  
  6519.     case $linkmode in
  6520.     lib)
  6521.         passes="conv dlpreopen link"
  6522.         for file in $dlfiles $dlprefiles; do
  6523.           case $file in
  6524.           *.la) ;;
  6525.           *)
  6526.             func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
  6527.             ;;
  6528.           esac
  6529.         done
  6530.         ;;
  6531.     prog)
  6532.         compile_deplibs=
  6533.         finalize_deplibs=
  6534.         alldeplibs=no
  6535.         newdlfiles=
  6536.         newdlprefiles=
  6537.         passes="conv scan dlopen dlpreopen link"
  6538.         ;;
  6539.     *)  passes="conv"
  6540.         ;;
  6541.     esac
  6542.  
  6543.     for pass in $passes; do
  6544.       # The preopen pass in lib mode reverses $deplibs; put it back here
  6545.       # so that -L comes before libs that need it for instance...
  6546.       if test "$linkmode,$pass" = "lib,link"; then
  6547.         ## FIXME: Find the place where the list is rebuilt in the wrong
  6548.         ##        order, and fix it there properly
  6549.         tmp_deplibs=
  6550.         for deplib in $deplibs; do
  6551.           tmp_deplibs="$deplib $tmp_deplibs"
  6552.         done
  6553.         deplibs="$tmp_deplibs"
  6554.       fi
  6555.  
  6556.       if test "$linkmode,$pass" = "lib,link" ||
  6557.          test "$linkmode,$pass" = "prog,scan"; then
  6558.         libs="$deplibs"
  6559.         deplibs=
  6560.       fi
  6561.       if test "$linkmode" = prog; then
  6562.         case $pass in
  6563.         dlopen) libs="$dlfiles" ;;
  6564.         dlpreopen) libs="$dlprefiles" ;;
  6565.         link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  6566.         esac
  6567.       fi
  6568.       if test "$linkmode,$pass" = "lib,dlpreopen"; then
  6569.         # Collect and forward deplibs of preopened libtool libs
  6570.         for lib in $dlprefiles; do
  6571.           # Ignore non-libtool-libs
  6572.           dependency_libs=
  6573.           func_resolve_sysroot "$lib"
  6574.           case $lib in
  6575.           *.la) func_source "$func_resolve_sysroot_result" ;;
  6576.           esac
  6577.  
  6578.           # Collect preopened libtool deplibs, except any this library
  6579.           # has declared as weak libs
  6580.           for deplib in $dependency_libs; do
  6581.             func_basename "$deplib"
  6582.             deplib_base=$func_basename_result
  6583.             case " $weak_libs " in
  6584.             *" $deplib_base "*) ;;
  6585.             *) deplibs+=" $deplib" ;;
  6586.             esac
  6587.           done
  6588.         done
  6589.         libs="$dlprefiles"
  6590.       fi
  6591.       if test "$pass" = dlopen; then
  6592.         # Collect dlpreopened libraries
  6593.         save_deplibs="$deplibs"
  6594.         deplibs=
  6595.       fi
  6596.  
  6597.       for deplib in $libs; do
  6598.         lib=
  6599.         found=no
  6600.         case $deplib in
  6601.         -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6602.         |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6603.           if test "$linkmode,$pass" = "prog,link"; then
  6604.             compile_deplibs="$deplib $compile_deplibs"
  6605.             finalize_deplibs="$deplib $finalize_deplibs"
  6606.           else
  6607.             compiler_flags+=" $deplib"
  6608.             if test "$linkmode" = lib ; then
  6609.                 case "$new_inherited_linker_flags " in
  6610.                     *" $deplib "*) ;;
  6611.                     * ) new_inherited_linker_flags+=" $deplib" ;;
  6612.                 esac
  6613.             fi
  6614.           fi
  6615.           continue
  6616.           ;;
  6617.         -l*)
  6618.           if test "$linkmode" != lib && test "$linkmode" != prog; then
  6619.             func_warning "\`-l' is ignored for archives/objects"
  6620.             continue
  6621.           fi
  6622.           func_stripname '-l' '' "$deplib"
  6623.           name=$func_stripname_result
  6624.           if test "$linkmode" = lib; then
  6625.             searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  6626.           else
  6627.             searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  6628.           fi
  6629.           for searchdir in $searchdirs; do
  6630.             for search_ext in .la $std_shrext .so .a; do
  6631.               # Search the libtool library
  6632.               lib="$searchdir/lib${name}${search_ext}"
  6633.               if test -f "$lib"; then
  6634.                 if test "$search_ext" = ".la"; then
  6635.                   found=yes
  6636.                 else
  6637.                   found=no
  6638.                 fi
  6639.                 break 2
  6640.               fi
  6641.             done
  6642.           done
  6643.           if test "$found" != yes; then
  6644.             # deplib doesn't seem to be a libtool library
  6645.             if test "$linkmode,$pass" = "prog,link"; then
  6646.               compile_deplibs="$deplib $compile_deplibs"
  6647.               finalize_deplibs="$deplib $finalize_deplibs"
  6648.             else
  6649.               deplibs="$deplib $deplibs"
  6650.               test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  6651.             fi
  6652.             continue
  6653.           else # deplib is a libtool library
  6654.             # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  6655.             # We need to do some special things here, and not later.
  6656.             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6657.               case " $predeps $postdeps " in
  6658.               *" $deplib "*)
  6659.                 if func_lalib_p "$lib"; then
  6660.                   library_names=
  6661.                   old_library=
  6662.                   func_source "$lib"
  6663.                   for l in $old_library $library_names; do
  6664.                     ll="$l"
  6665.                   done
  6666.                   if test "X$ll" = "X$old_library" ; then # only static version available
  6667.                     found=no
  6668.                     func_dirname "$lib" "" "."
  6669.                     ladir="$func_dirname_result"
  6670.                     lib=$ladir/$old_library
  6671.                     if test "$linkmode,$pass" = "prog,link"; then
  6672.                       compile_deplibs="$deplib $compile_deplibs"
  6673.                       finalize_deplibs="$deplib $finalize_deplibs"
  6674.                     else
  6675.                       deplibs="$deplib $deplibs"
  6676.                       test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  6677.                     fi
  6678.                     continue
  6679.                   fi
  6680.                 fi
  6681.                 ;;
  6682.               *) ;;
  6683.               esac
  6684.             fi
  6685.           fi
  6686.           ;; # -l
  6687.         *.ltframework)
  6688.           if test "$linkmode,$pass" = "prog,link"; then
  6689.             compile_deplibs="$deplib $compile_deplibs"
  6690.             finalize_deplibs="$deplib $finalize_deplibs"
  6691.           else
  6692.             deplibs="$deplib $deplibs"
  6693.             if test "$linkmode" = lib ; then
  6694.                 case "$new_inherited_linker_flags " in
  6695.                     *" $deplib "*) ;;
  6696.                     * ) new_inherited_linker_flags+=" $deplib" ;;
  6697.                 esac
  6698.             fi
  6699.           fi
  6700.           continue
  6701.           ;;
  6702.         -L*)
  6703.           case $linkmode in
  6704.           lib)
  6705.             deplibs="$deplib $deplibs"
  6706.             test "$pass" = conv && continue
  6707.             newdependency_libs="$deplib $newdependency_libs"
  6708.             func_stripname '-L' '' "$deplib"
  6709.             func_resolve_sysroot "$func_stripname_result"
  6710.             newlib_search_path+=" $func_resolve_sysroot_result"
  6711.             ;;
  6712.           prog)
  6713.             if test "$pass" = conv; then
  6714.               deplibs="$deplib $deplibs"
  6715.               continue
  6716.             fi
  6717.             if test "$pass" = scan; then
  6718.               deplibs="$deplib $deplibs"
  6719.             else
  6720.               compile_deplibs="$deplib $compile_deplibs"
  6721.               finalize_deplibs="$deplib $finalize_deplibs"
  6722.             fi
  6723.             func_stripname '-L' '' "$deplib"
  6724.             func_resolve_sysroot "$func_stripname_result"
  6725.             newlib_search_path+=" $func_resolve_sysroot_result"
  6726.             ;;
  6727.           *)
  6728.             func_warning "\`-L' is ignored for archives/objects"
  6729.             ;;
  6730.           esac # linkmode
  6731.           continue
  6732.           ;; # -L
  6733.         -R*)
  6734.           if test "$pass" = link; then
  6735.             func_stripname '-R' '' "$deplib"
  6736.             func_resolve_sysroot "$func_stripname_result"
  6737.             dir=$func_resolve_sysroot_result
  6738.             # Make sure the xrpath contains only unique directories.
  6739.             case "$xrpath " in
  6740.             *" $dir "*) ;;
  6741.             *) xrpath+=" $dir" ;;
  6742.             esac
  6743.           fi
  6744.           deplibs="$deplib $deplibs"
  6745.           continue
  6746.           ;;
  6747.         *.la)
  6748.           func_resolve_sysroot "$deplib"
  6749.           lib=$func_resolve_sysroot_result
  6750.           ;;
  6751.         *.$libext)
  6752.           if test "$pass" = conv; then
  6753.             deplibs="$deplib $deplibs"
  6754.             continue
  6755.           fi
  6756.           case $linkmode in
  6757.           lib)
  6758.             # Linking convenience modules into shared libraries is allowed,
  6759.             # but linking other static libraries is non-portable.
  6760.             case " $dlpreconveniencelibs " in
  6761.             *" $deplib "*) ;;
  6762.             *)
  6763.               valid_a_lib=no
  6764.               case $deplibs_check_method in
  6765.                 match_pattern*)
  6766.                   set dummy $deplibs_check_method; shift
  6767.                   match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6768.                   if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  6769.                     | $EGREP "$match_pattern_regex" > /dev/null; then
  6770.                     valid_a_lib=yes
  6771.                   fi
  6772.                 ;;
  6773.                 pass_all)
  6774.                   valid_a_lib=yes
  6775.                 ;;
  6776.               esac
  6777.               if test "$valid_a_lib" != yes; then
  6778.                 echo
  6779.                 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  6780.                 echo "*** I have the capability to make that library automatically link in when"
  6781.                 echo "*** you link to this library.  But I can only do this if you have a"
  6782.                 echo "*** shared version of the library, which you do not appear to have"
  6783.                 echo "*** because the file extensions .$libext of this argument makes me believe"
  6784.                 echo "*** that it is just a static archive that I should not use here."
  6785.               else
  6786.                 echo
  6787.                 $ECHO "*** Warning: Linking the shared library $output against the"
  6788.                 $ECHO "*** static library $deplib is not portable!"
  6789.                 deplibs="$deplib $deplibs"
  6790.               fi
  6791.               ;;
  6792.             esac
  6793.             continue
  6794.             ;;
  6795.           prog)
  6796.             if test "$pass" != link; then
  6797.               deplibs="$deplib $deplibs"
  6798.             else
  6799.               compile_deplibs="$deplib $compile_deplibs"
  6800.               finalize_deplibs="$deplib $finalize_deplibs"
  6801.             fi
  6802.             continue
  6803.             ;;
  6804.           esac # linkmode
  6805.           ;; # *.$libext
  6806.         *.lo | *.$objext)
  6807.           if test "$pass" = conv; then
  6808.             deplibs="$deplib $deplibs"
  6809.           elif test "$linkmode" = prog; then
  6810.             if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  6811.               # If there is no dlopen support or we're linking statically,
  6812.               # we need to preload.
  6813.               newdlprefiles+=" $deplib"
  6814.               compile_deplibs="$deplib $compile_deplibs"
  6815.               finalize_deplibs="$deplib $finalize_deplibs"
  6816.             else
  6817.               newdlfiles+=" $deplib"
  6818.             fi
  6819.           fi
  6820.           continue
  6821.           ;;
  6822.         %DEPLIBS%)
  6823.           alldeplibs=yes
  6824.           continue
  6825.           ;;
  6826.         esac # case $deplib
  6827.  
  6828.         if test "$found" = yes || test -f "$lib"; then :
  6829.         else
  6830.           func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
  6831.         fi
  6832.  
  6833.         # Check to see that this really is a libtool archive.
  6834.         func_lalib_unsafe_p "$lib" \
  6835.           || func_fatal_error "\`$lib' is not a valid libtool archive"
  6836.  
  6837.         func_dirname "$lib" "" "."
  6838.         ladir="$func_dirname_result"
  6839.  
  6840.         dlname=
  6841.         dlopen=
  6842.         dlpreopen=
  6843.         libdir=
  6844.         library_names=
  6845.         old_library=
  6846.         inherited_linker_flags=
  6847.         # If the library was installed with an old release of libtool,
  6848.         # it will not redefine variables installed, or shouldnotlink
  6849.         installed=yes
  6850.         shouldnotlink=no
  6851.         avoidtemprpath=
  6852.  
  6853.  
  6854.         # Read the .la file
  6855.         func_source "$lib"
  6856.  
  6857.         # Convert "-framework foo" to "foo.ltframework"
  6858.         if test -n "$inherited_linker_flags"; then
  6859.           tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  6860.           for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  6861.             case " $new_inherited_linker_flags " in
  6862.               *" $tmp_inherited_linker_flag "*) ;;
  6863.               *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
  6864.             esac
  6865.           done
  6866.         fi
  6867.         dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  6868.         if test "$linkmode,$pass" = "lib,link" ||
  6869.            test "$linkmode,$pass" = "prog,scan" ||
  6870.            { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  6871.           test -n "$dlopen" && dlfiles+=" $dlopen"
  6872.           test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
  6873.         fi
  6874.  
  6875.         if test "$pass" = conv; then
  6876.           # Only check for convenience libraries
  6877.           deplibs="$lib $deplibs"
  6878.           if test -z "$libdir"; then
  6879.             if test -z "$old_library"; then
  6880.               func_fatal_error "cannot find name of link library for \`$lib'"
  6881.             fi
  6882.             # It is a libtool convenience library, so add in its objects.
  6883.             convenience+=" $ladir/$objdir/$old_library"
  6884.             old_convenience+=" $ladir/$objdir/$old_library"
  6885.           elif test "$linkmode" != prog && test "$linkmode" != lib; then
  6886.             func_fatal_error "\`$lib' is not a convenience library"
  6887.           fi
  6888.           tmp_libs=
  6889.           for deplib in $dependency_libs; do
  6890.             deplibs="$deplib $deplibs"
  6891.             if $opt_preserve_dup_deps ; then
  6892.               case "$tmp_libs " in
  6893.               *" $deplib "*) specialdeplibs+=" $deplib" ;;
  6894.               esac
  6895.             fi
  6896.             tmp_libs+=" $deplib"
  6897.           done
  6898.           continue
  6899.         fi # $pass = conv
  6900.  
  6901.  
  6902.         # Get the name of the library we link against.
  6903.         linklib=
  6904.         if test -n "$old_library" &&
  6905.            { test "$prefer_static_libs" = yes ||
  6906.              test "$prefer_static_libs,$installed" = "built,no"; }; then
  6907.           linklib=$old_library
  6908.         else
  6909.           for l in $old_library $library_names; do
  6910.             linklib="$l"
  6911.           done
  6912.         fi
  6913.         if test -z "$linklib"; then
  6914.           func_fatal_error "cannot find name of link library for \`$lib'"
  6915.         fi
  6916.  
  6917.         # This library was specified with -dlopen.
  6918.         if test "$pass" = dlopen; then
  6919.           if test -z "$libdir"; then
  6920.             func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
  6921.           fi
  6922.           if test -z "$dlname" ||
  6923.              test "$dlopen_support" != yes ||
  6924.              test "$build_libtool_libs" = no; then
  6925.             # If there is no dlname, no dlopen support or we're linking
  6926.             # statically, we need to preload.  We also need to preload any
  6927.             # dependent libraries so libltdl's deplib preloader doesn't
  6928.             # bomb out in the load deplibs phase.
  6929.             dlprefiles+=" $lib $dependency_libs"
  6930.           else
  6931.             newdlfiles+=" $lib"
  6932.           fi
  6933.           continue
  6934.         fi # $pass = dlopen
  6935.  
  6936.         # We need an absolute path.
  6937.         case $ladir in
  6938.         [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  6939.         *)
  6940.           abs_ladir=`cd "$ladir" && pwd`
  6941.           if test -z "$abs_ladir"; then
  6942.             func_warning "cannot determine absolute directory name of \`$ladir'"
  6943.             func_warning "passing it literally to the linker, although it might fail"
  6944.             abs_ladir="$ladir"
  6945.           fi
  6946.           ;;
  6947.         esac
  6948.         func_basename "$lib"
  6949.         laname="$func_basename_result"
  6950.  
  6951.         # Find the relevant object directory and library name.
  6952.         if test "X$installed" = Xyes; then
  6953.           if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  6954.             func_warning "library \`$lib' was moved."
  6955.             dir="$ladir"
  6956.             absdir="$abs_ladir"
  6957.             libdir="$abs_ladir"
  6958.           else
  6959.             dir="$lt_sysroot$libdir"
  6960.             absdir="$lt_sysroot$libdir"
  6961.           fi
  6962.           test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
  6963.         else
  6964.           if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  6965.             dir="$ladir"
  6966.             absdir="$abs_ladir"
  6967.             # Remove this search path later
  6968.             notinst_path+=" $abs_ladir"
  6969.           else
  6970.             dir="$ladir/$objdir"
  6971.             absdir="$abs_ladir/$objdir"
  6972.             # Remove this search path later
  6973.             notinst_path+=" $abs_ladir"
  6974.           fi
  6975.         fi # $installed = yes
  6976.         func_stripname 'lib' '.la' "$laname"
  6977.         name=$func_stripname_result
  6978.  
  6979.         # This library was specified with -dlpreopen.
  6980.         if test "$pass" = dlpreopen; then
  6981.           if test -z "$libdir" && test "$linkmode" = prog; then
  6982.             func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
  6983.           fi
  6984.           case "$host" in
  6985.             # special handling for platforms with PE-DLLs.
  6986.             *cygwin* | *mingw* | *cegcc* )
  6987.               # Linker will automatically link against shared library if both
  6988.               # static and shared are present.  Therefore, ensure we extract
  6989.               # symbols from the import library if a shared library is present
  6990.               # (otherwise, the dlopen module name will be incorrect).  We do
  6991.               # this by putting the import library name into $newdlprefiles.
  6992.               # We recover the dlopen module name by 'saving' the la file
  6993.               # name in a special purpose variable, and (later) extracting the
  6994.               # dlname from the la file.
  6995.               if test -n "$dlname"; then
  6996.                 func_tr_sh "$dir/$linklib"
  6997.                 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  6998.                 newdlprefiles+=" $dir/$linklib"
  6999.               else
  7000.                 newdlprefiles+=" $dir/$old_library"
  7001.                 # Keep a list of preopened convenience libraries to check
  7002.                 # that they are being used correctly in the link pass.
  7003.                 test -z "$libdir" && \
  7004.                   dlpreconveniencelibs+=" $dir/$old_library"
  7005.               fi
  7006.             ;;
  7007.             * )
  7008.               # Prefer using a static library (so that no silly _DYNAMIC symbols
  7009.               # are required to link).
  7010.               if test -n "$old_library"; then
  7011.                 newdlprefiles+=" $dir/$old_library"
  7012.                 # Keep a list of preopened convenience libraries to check
  7013.                 # that they are being used correctly in the link pass.
  7014.                 test -z "$libdir" && \
  7015.                   dlpreconveniencelibs+=" $dir/$old_library"
  7016.               # Otherwise, use the dlname, so that lt_dlopen finds it.
  7017.               elif test -n "$dlname"; then
  7018.                 newdlprefiles+=" $dir/$dlname"
  7019.               else
  7020.                 newdlprefiles+=" $dir/$linklib"
  7021.               fi
  7022.             ;;
  7023.           esac
  7024.         fi # $pass = dlpreopen
  7025.  
  7026.         if test -z "$libdir"; then
  7027.           # Link the convenience library
  7028.           if test "$linkmode" = lib; then
  7029.             deplibs="$dir/$old_library $deplibs"
  7030.           elif test "$linkmode,$pass" = "prog,link"; then
  7031.             compile_deplibs="$dir/$old_library $compile_deplibs"
  7032.             finalize_deplibs="$dir/$old_library $finalize_deplibs"
  7033.           else
  7034.             deplibs="$lib $deplibs" # used for prog,scan pass
  7035.           fi
  7036.           continue
  7037.         fi
  7038.  
  7039.  
  7040.         if test "$linkmode" = prog && test "$pass" != link; then
  7041.           newlib_search_path+=" $ladir"
  7042.           deplibs="$lib $deplibs"
  7043.  
  7044.           linkalldeplibs=no
  7045.           if test "$link_all_deplibs" != no || test -z "$library_names" ||
  7046.              test "$build_libtool_libs" = no; then
  7047.             linkalldeplibs=yes
  7048.           fi
  7049.  
  7050.           tmp_libs=
  7051.           for deplib in $dependency_libs; do
  7052.             case $deplib in
  7053.             -L*) func_stripname '-L' '' "$deplib"
  7054.                  func_resolve_sysroot "$func_stripname_result"
  7055.                  newlib_search_path+=" $func_resolve_sysroot_result"
  7056.                  ;;
  7057.             esac
  7058.             # Need to link against all dependency_libs?
  7059.             if test "$linkalldeplibs" = yes; then
  7060.               deplibs="$deplib $deplibs"
  7061.             else
  7062.               # Need to hardcode shared library paths
  7063.               # or/and link against static libraries
  7064.               newdependency_libs="$deplib $newdependency_libs"
  7065.             fi
  7066.             if $opt_preserve_dup_deps ; then
  7067.               case "$tmp_libs " in
  7068.               *" $deplib "*) specialdeplibs+=" $deplib" ;;
  7069.               esac
  7070.             fi
  7071.             tmp_libs+=" $deplib"
  7072.           done # for deplib
  7073.           continue
  7074.         fi # $linkmode = prog...
  7075.  
  7076.         if test "$linkmode,$pass" = "prog,link"; then
  7077.           if test -n "$library_names" &&
  7078.              { { test "$prefer_static_libs" = no ||
  7079.                  test "$prefer_static_libs,$installed" = "built,yes"; } ||
  7080.                test -z "$old_library"; }; then
  7081.             # We need to hardcode the library path
  7082.             if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  7083.               # Make sure the rpath contains only unique directories.
  7084.               case "$temp_rpath:" in
  7085.               *"$absdir:"*) ;;
  7086.               *) temp_rpath+="$absdir:" ;;
  7087.               esac
  7088.             fi
  7089.  
  7090.             # Hardcode the library path.
  7091.             # Skip directories that are in the system default run-time
  7092.             # search path.
  7093.             case " $sys_lib_dlsearch_path " in
  7094.             *" $absdir "*) ;;
  7095.             *)
  7096.               case "$compile_rpath " in
  7097.               *" $absdir "*) ;;
  7098.               *) compile_rpath+=" $absdir" ;;
  7099.               esac
  7100.               ;;
  7101.             esac
  7102.             case " $sys_lib_dlsearch_path " in
  7103.             *" $libdir "*) ;;
  7104.             *)
  7105.               case "$finalize_rpath " in
  7106.               *" $libdir "*) ;;
  7107.               *) finalize_rpath+=" $libdir" ;;
  7108.               esac
  7109.               ;;
  7110.             esac
  7111.           fi # $linkmode,$pass = prog,link...
  7112.  
  7113.           if test "$alldeplibs" = yes &&
  7114.              { test "$deplibs_check_method" = pass_all ||
  7115.                { test "$build_libtool_libs" = yes &&
  7116.                  test -n "$library_names"; }; }; then
  7117.             # We only need to search for static libraries
  7118.             continue
  7119.           fi
  7120.         fi
  7121.  
  7122.         link_static=no # Whether the deplib will be linked statically
  7123.         use_static_libs=$prefer_static_libs
  7124.         if test "$use_static_libs" = built && test "$installed" = yes; then
  7125.           use_static_libs=no
  7126.         fi
  7127.         if test -n "$library_names" &&
  7128.            { test "$use_static_libs" = no || test -z "$old_library"; }; then
  7129.           case $host in
  7130.           *cygwin* | *mingw* | *cegcc*)
  7131.               # No point in relinking DLLs because paths are not encoded
  7132.               notinst_deplibs+=" $lib"
  7133.               need_relink=no
  7134.             ;;
  7135.           *)
  7136.             if test "$installed" = no; then
  7137.               notinst_deplibs+=" $lib"
  7138.               need_relink=yes
  7139.             fi
  7140.             ;;
  7141.           esac
  7142.           # This is a shared library
  7143.  
  7144.           # Warn about portability, can't link against -module's on some
  7145.           # systems (darwin).  Don't bleat about dlopened modules though!
  7146.           dlopenmodule=""
  7147.           for dlpremoduletest in $dlprefiles; do
  7148.             if test "X$dlpremoduletest" = "X$lib"; then
  7149.               dlopenmodule="$dlpremoduletest"
  7150.               break
  7151.             fi
  7152.           done
  7153.           if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
  7154.             echo
  7155.             if test "$linkmode" = prog; then
  7156.               $ECHO "*** Warning: Linking the executable $output against the loadable module"
  7157.             else
  7158.               $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  7159.             fi
  7160.             $ECHO "*** $linklib is not portable!"
  7161.           fi
  7162.           if test "$linkmode" = lib &&
  7163.              test "$hardcode_into_libs" = yes; then
  7164.             # Hardcode the library path.
  7165.             # Skip directories that are in the system default run-time
  7166.             # search path.
  7167.             case " $sys_lib_dlsearch_path " in
  7168.             *" $absdir "*) ;;
  7169.             *)
  7170.               case "$compile_rpath " in
  7171.               *" $absdir "*) ;;
  7172.               *) compile_rpath+=" $absdir" ;;
  7173.               esac
  7174.               ;;
  7175.             esac
  7176.             case " $sys_lib_dlsearch_path " in
  7177.             *" $libdir "*) ;;
  7178.             *)
  7179.               case "$finalize_rpath " in
  7180.               *" $libdir "*) ;;
  7181.               *) finalize_rpath+=" $libdir" ;;
  7182.               esac
  7183.               ;;
  7184.             esac
  7185.           fi
  7186.  
  7187.           if test -n "$old_archive_from_expsyms_cmds"; then
  7188.             # figure out the soname
  7189.             set dummy $library_names
  7190.             shift
  7191.             realname="$1"
  7192.             shift
  7193.             libname=`eval "\\$ECHO \"$libname_spec\""`
  7194.             # use dlname if we got it. it's perfectly good, no?
  7195.             if test -n "$dlname"; then
  7196.               soname="$dlname"
  7197.             elif test -n "$soname_spec"; then
  7198.               # bleh windows
  7199.               case $host in
  7200.               *cygwin* | mingw* | *cegcc*)
  7201.                 func_arith $current - $age
  7202.                 major=$func_arith_result
  7203.                 versuffix="-$major"
  7204.                 ;;
  7205.               esac
  7206.               eval soname=\"$soname_spec\"
  7207.             else
  7208.               soname="$realname"
  7209.             fi
  7210.  
  7211.             # Make a new name for the extract_expsyms_cmds to use
  7212.             soroot="$soname"
  7213.             func_basename "$soroot"
  7214.             soname="$func_basename_result"
  7215.             func_stripname 'lib' '.dll' "$soname"
  7216.             newlib=libimp-$func_stripname_result.a
  7217.  
  7218.             # If the library has no export list, then create one now
  7219.             if test -f "$output_objdir/$soname-def"; then :
  7220.             else
  7221.               func_verbose "extracting exported symbol list from \`$soname'"
  7222.               func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  7223.             fi
  7224.  
  7225.             # Create $newlib
  7226.             if test -f "$output_objdir/$newlib"; then :; else
  7227.               func_verbose "generating import library for \`$soname'"
  7228.               func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  7229.             fi
  7230.             # make sure the library variables are pointing to the new library
  7231.             dir=$output_objdir
  7232.             linklib=$newlib
  7233.           fi # test -n "$old_archive_from_expsyms_cmds"
  7234.  
  7235.           if test "$linkmode" = prog || test "$opt_mode" != relink; then
  7236.             add_shlibpath=
  7237.             add_dir=
  7238.             add=
  7239.             lib_linked=yes
  7240.             case $hardcode_action in
  7241.             immediate | unsupported)
  7242.               if test "$hardcode_direct" = no; then
  7243.                 add="$dir/$linklib"
  7244.                 case $host in
  7245.                   *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
  7246.                   *-*-sysv4*uw2*) add_dir="-L$dir" ;;
  7247.                   *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  7248.                     *-*-unixware7*) add_dir="-L$dir" ;;
  7249.                   *-*-darwin* )
  7250.                     # if the lib is a (non-dlopened) module then we can not
  7251.                     # link against it, someone is ignoring the earlier warnings
  7252.                     if /usr/bin/file -L $add 2> /dev/null |
  7253.                          $GREP ": [^:]* bundle" >/dev/null ; then
  7254.                       if test "X$dlopenmodule" != "X$lib"; then
  7255.                         $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  7256.                         if test -z "$old_library" ; then
  7257.                           echo
  7258.                           echo "*** And there doesn't seem to be a static archive available"
  7259.                           echo "*** The link will probably fail, sorry"
  7260.                         else
  7261.                           add="$dir/$old_library"
  7262.                         fi
  7263.                       elif test -n "$old_library"; then
  7264.                         add="$dir/$old_library"
  7265.                       fi
  7266.                     fi
  7267.                 esac
  7268.               elif test "$hardcode_minus_L" = no; then
  7269.                 case $host in
  7270.                 *-*-sunos*) add_shlibpath="$dir" ;;
  7271.                 esac
  7272.                 add_dir="-L$dir"
  7273.                 add="-l$name"
  7274.               elif test "$hardcode_shlibpath_var" = no; then
  7275.                 add_shlibpath="$dir"
  7276.                 add="-l$name"
  7277.               else
  7278.                 lib_linked=no
  7279.               fi
  7280.               ;;
  7281.             relink)
  7282.               if test "$hardcode_direct" = yes &&
  7283.                  test "$hardcode_direct_absolute" = no; then
  7284.                 add="$dir/$linklib"
  7285.               elif test "$hardcode_minus_L" = yes; then
  7286.                 add_dir="-L$absdir"
  7287.                 # Try looking first in the location we're being installed to.
  7288.                 if test -n "$inst_prefix_dir"; then
  7289.                   case $libdir in
  7290.                     [\\/]*)
  7291.                       add_dir+=" -L$inst_prefix_dir$libdir"
  7292.                       ;;
  7293.                   esac
  7294.                 fi
  7295.                 add="-l$name"
  7296.               elif test "$hardcode_shlibpath_var" = yes; then
  7297.                 add_shlibpath="$dir"
  7298.                 add="-l$name"
  7299.               else
  7300.                 lib_linked=no
  7301.               fi
  7302.               ;;
  7303.             *) lib_linked=no ;;
  7304.             esac
  7305.  
  7306.             if test "$lib_linked" != yes; then
  7307.               func_fatal_configuration "unsupported hardcode properties"
  7308.             fi
  7309.  
  7310.             if test -n "$add_shlibpath"; then
  7311.               case :$compile_shlibpath: in
  7312.               *":$add_shlibpath:"*) ;;
  7313.               *) compile_shlibpath+="$add_shlibpath:" ;;
  7314.               esac
  7315.             fi
  7316.             if test "$linkmode" = prog; then
  7317.               test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  7318.               test -n "$add" && compile_deplibs="$add $compile_deplibs"
  7319.             else
  7320.               test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7321.               test -n "$add" && deplibs="$add $deplibs"
  7322.               if test "$hardcode_direct" != yes &&
  7323.                  test "$hardcode_minus_L" != yes &&
  7324.                  test "$hardcode_shlibpath_var" = yes; then
  7325.                 case :$finalize_shlibpath: in
  7326.                 *":$libdir:"*) ;;
  7327.                 *) finalize_shlibpath+="$libdir:" ;;
  7328.                 esac
  7329.               fi
  7330.             fi
  7331.           fi
  7332.  
  7333.           if test "$linkmode" = prog || test "$opt_mode" = relink; then
  7334.             add_shlibpath=
  7335.             add_dir=
  7336.             add=
  7337.             # Finalize command for both is simple: just hardcode it.
  7338.             if test "$hardcode_direct" = yes &&
  7339.                test "$hardcode_direct_absolute" = no; then
  7340.               add="$libdir/$linklib"
  7341.             elif test "$hardcode_minus_L" = yes; then
  7342.               add_dir="-L$libdir"
  7343.               add="-l$name"
  7344.             elif test "$hardcode_shlibpath_var" = yes; then
  7345.               case :$finalize_shlibpath: in
  7346.               *":$libdir:"*) ;;
  7347.               *) finalize_shlibpath+="$libdir:" ;;
  7348.               esac
  7349.               add="-l$name"
  7350.             elif test "$hardcode_automatic" = yes; then
  7351.               if test -n "$inst_prefix_dir" &&
  7352.                  test -f "$inst_prefix_dir$libdir/$linklib" ; then
  7353.                 add="$inst_prefix_dir$libdir/$linklib"
  7354.               else
  7355.                 add="$libdir/$linklib"
  7356.               fi
  7357.             else
  7358.               # We cannot seem to hardcode it, guess we'll fake it.
  7359.               add_dir="-L$libdir"
  7360.               # Try looking first in the location we're being installed to.
  7361.               if test -n "$inst_prefix_dir"; then
  7362.                 case $libdir in
  7363.                   [\\/]*)
  7364.                     add_dir+=" -L$inst_prefix_dir$libdir"
  7365.                     ;;
  7366.                 esac
  7367.               fi
  7368.               add="-l$name"
  7369.             fi
  7370.  
  7371.             if test "$linkmode" = prog; then
  7372.               test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  7373.               test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  7374.             else
  7375.               test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7376.               test -n "$add" && deplibs="$add $deplibs"
  7377.             fi
  7378.           fi
  7379.         elif test "$linkmode" = prog; then
  7380.           # Here we assume that one of hardcode_direct or hardcode_minus_L
  7381.           # is not unsupported.  This is valid on all known static and
  7382.           # shared platforms.
  7383.           if test "$hardcode_direct" != unsupported; then
  7384.             test -n "$old_library" && linklib="$old_library"
  7385.             compile_deplibs="$dir/$linklib $compile_deplibs"
  7386.             finalize_deplibs="$dir/$linklib $finalize_deplibs"
  7387.           else
  7388.             compile_deplibs="-l$name -L$dir $compile_deplibs"
  7389.             finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  7390.           fi
  7391.         elif test "$build_libtool_libs" = yes; then
  7392.           # Not a shared library
  7393.           if test "$deplibs_check_method" != pass_all; then
  7394.             # We're trying link a shared library against a static one
  7395.             # but the system doesn't support it.
  7396.  
  7397.             # Just print a warning and add the library to dependency_libs so
  7398.             # that the program can be linked against the static library.
  7399.             echo
  7400.             $ECHO "*** Warning: This system can not link to static lib archive $lib."
  7401.             echo "*** I have the capability to make that library automatically link in when"
  7402.             echo "*** you link to this library.  But I can only do this if you have a"
  7403.             echo "*** shared version of the library, which you do not appear to have."
  7404.             if test "$module" = yes; then
  7405.               echo "*** But as you try to build a module library, libtool will still create "
  7406.               echo "*** a static module, that should work as long as the dlopening application"
  7407.               echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  7408.               if test -z "$global_symbol_pipe"; then
  7409.                 echo
  7410.                 echo "*** However, this would only work if libtool was able to extract symbol"
  7411.                 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  7412.                 echo "*** not find such a program.  So, this module is probably useless."
  7413.                 echo "*** \`nm' from GNU binutils and a full rebuild may help."
  7414.               fi
  7415.               if test "$build_old_libs" = no; then
  7416.                 build_libtool_libs=module
  7417.                 build_old_libs=yes
  7418.               else
  7419.                 build_libtool_libs=no
  7420.               fi
  7421.             fi
  7422.           else
  7423.             deplibs="$dir/$old_library $deplibs"
  7424.             link_static=yes
  7425.           fi
  7426.         fi # link shared/static library?
  7427.  
  7428.         if test "$linkmode" = lib; then
  7429.           if test -n "$dependency_libs" &&
  7430.              { test "$hardcode_into_libs" != yes ||
  7431.                test "$build_old_libs" = yes ||
  7432.                test "$link_static" = yes; }; then
  7433.             # Extract -R from dependency_libs
  7434.             temp_deplibs=
  7435.             for libdir in $dependency_libs; do
  7436.               case $libdir in
  7437.               -R*) func_stripname '-R' '' "$libdir"
  7438.                    temp_xrpath=$func_stripname_result
  7439.                    case " $xrpath " in
  7440.                    *" $temp_xrpath "*) ;;
  7441.                    *) xrpath+=" $temp_xrpath";;
  7442.                    esac;;
  7443.               *) temp_deplibs+=" $libdir";;
  7444.               esac
  7445.             done
  7446.             dependency_libs="$temp_deplibs"
  7447.           fi
  7448.  
  7449.           newlib_search_path+=" $absdir"
  7450.           # Link against this library
  7451.           test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  7452.           # ... and its dependency_libs
  7453.           tmp_libs=
  7454.           for deplib in $dependency_libs; do
  7455.             newdependency_libs="$deplib $newdependency_libs"
  7456.             case $deplib in
  7457.               -L*) func_stripname '-L' '' "$deplib"
  7458.                    func_resolve_sysroot "$func_stripname_result";;
  7459.               *) func_resolve_sysroot "$deplib" ;;
  7460.             esac
  7461.             if $opt_preserve_dup_deps ; then
  7462.               case "$tmp_libs " in
  7463.               *" $func_resolve_sysroot_result "*)
  7464.                 specialdeplibs+=" $func_resolve_sysroot_result" ;;
  7465.               esac
  7466.             fi
  7467.             tmp_libs+=" $func_resolve_sysroot_result"
  7468.           done
  7469.  
  7470.           if test "$link_all_deplibs" != no; then
  7471.             # Add the search paths of all dependency libraries
  7472.             for deplib in $dependency_libs; do
  7473.               path=
  7474.               case $deplib in
  7475.               -L*) path="$deplib" ;;
  7476.               *.la)
  7477.                 func_resolve_sysroot "$deplib"
  7478.                 deplib=$func_resolve_sysroot_result
  7479.                 func_dirname "$deplib" "" "."
  7480.                 dir=$func_dirname_result
  7481.                 # We need an absolute path.
  7482.                 case $dir in
  7483.                 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  7484.                 *)
  7485.                   absdir=`cd "$dir" && pwd`
  7486.                   if test -z "$absdir"; then
  7487.                     func_warning "cannot determine absolute directory name of \`$dir'"
  7488.                     absdir="$dir"
  7489.                   fi
  7490.                   ;;
  7491.                 esac
  7492.                 if $GREP "^installed=no" $deplib > /dev/null; then
  7493.                 case $host in
  7494.                 *-*-darwin*)
  7495.                   depdepl=
  7496.                   eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  7497.                   if test -n "$deplibrary_names" ; then
  7498.                     for tmp in $deplibrary_names ; do
  7499.                       depdepl=$tmp
  7500.                     done
  7501.                     if test -f "$absdir/$objdir/$depdepl" ; then
  7502.                       depdepl="$absdir/$objdir/$depdepl"
  7503.                       darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7504.                       if test -z "$darwin_install_name"; then
  7505.                           darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
  7506.                       fi
  7507.                       compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
  7508.                       linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}"
  7509.                       path=
  7510.                     fi
  7511.                   fi
  7512.                   ;;
  7513.                 *)
  7514.                   path="-L$absdir/$objdir"
  7515.                   ;;
  7516.                 esac
  7517.                 else
  7518.                   eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7519.                   test -z "$libdir" && \
  7520.                     func_fatal_error "\`$deplib' is not a valid libtool archive"
  7521.                   test "$absdir" != "$libdir" && \
  7522.                     func_warning "\`$deplib' seems to be moved"
  7523.  
  7524.                   path="-L$absdir"
  7525.                 fi
  7526.                 ;;
  7527.               esac
  7528.               case " $deplibs " in
  7529.               *" $path "*) ;;
  7530.               *) deplibs="$path $deplibs" ;;
  7531.               esac
  7532.             done
  7533.           fi # link_all_deplibs != no
  7534.         fi # linkmode = lib
  7535.       done # for deplib in $libs
  7536.       if test "$pass" = link; then
  7537.         if test "$linkmode" = "prog"; then
  7538.           compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  7539.           finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  7540.         else
  7541.           compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7542.         fi
  7543.       fi
  7544.       dependency_libs="$newdependency_libs"
  7545.       if test "$pass" = dlpreopen; then
  7546.         # Link the dlpreopened libraries before other libraries
  7547.         for deplib in $save_deplibs; do
  7548.           deplibs="$deplib $deplibs"
  7549.         done
  7550.       fi
  7551.       if test "$pass" != dlopen; then
  7552.         if test "$pass" != conv; then
  7553.           # Make sure lib_search_path contains only unique directories.
  7554.           lib_search_path=
  7555.           for dir in $newlib_search_path; do
  7556.             case "$lib_search_path " in
  7557.             *" $dir "*) ;;
  7558.             *) lib_search_path+=" $dir" ;;
  7559.             esac
  7560.           done
  7561.           newlib_search_path=
  7562.         fi
  7563.  
  7564.         if test "$linkmode,$pass" != "prog,link"; then
  7565.           vars="deplibs"
  7566.         else
  7567.           vars="compile_deplibs finalize_deplibs"
  7568.         fi
  7569.         for var in $vars dependency_libs; do
  7570.           # Add libraries to $var in reverse order
  7571.           eval tmp_libs=\"\$$var\"
  7572.           new_libs=
  7573.           for deplib in $tmp_libs; do
  7574.             # FIXME: Pedantically, this is the right thing to do, so
  7575.             #        that some nasty dependency loop isn't accidentally
  7576.             #        broken:
  7577.             #new_libs="$deplib $new_libs"
  7578.             # Pragmatically, this seems to cause very few problems in
  7579.             # practice:
  7580.             case $deplib in
  7581.             -L*) new_libs="$deplib $new_libs" ;;
  7582.             -R*) ;;
  7583.             *)
  7584.               # And here is the reason: when a library appears more
  7585.               # than once as an explicit dependence of a library, or
  7586.               # is implicitly linked in more than once by the
  7587.               # compiler, it is considered special, and multiple
  7588.               # occurrences thereof are not removed.  Compare this
  7589.               # with having the same library being listed as a
  7590.               # dependency of multiple other libraries: in this case,
  7591.               # we know (pedantically, we assume) the library does not
  7592.               # need to be listed more than once, so we keep only the
  7593.               # last copy.  This is not always right, but it is rare
  7594.               # enough that we require users that really mean to play
  7595.               # such unportable linking tricks to link the library
  7596.               # using -Wl,-lname, so that libtool does not consider it
  7597.               # for duplicate removal.
  7598.               case " $specialdeplibs " in
  7599.               *" $deplib "*) new_libs="$deplib $new_libs" ;;
  7600.               *)
  7601.                 case " $new_libs " in
  7602.                 *" $deplib "*) ;;
  7603.                 *) new_libs="$deplib $new_libs" ;;
  7604.                 esac
  7605.                 ;;
  7606.               esac
  7607.               ;;
  7608.             esac
  7609.           done
  7610.           tmp_libs=
  7611.           for deplib in $new_libs; do
  7612.             case $deplib in
  7613.             -L*)
  7614.               case " $tmp_libs " in
  7615.               *" $deplib "*) ;;
  7616.               *) tmp_libs+=" $deplib" ;;
  7617.               esac
  7618.               ;;
  7619.             *) tmp_libs+=" $deplib" ;;
  7620.             esac
  7621.           done
  7622.           eval $var=\"$tmp_libs\"
  7623.         done # for var
  7624.       fi
  7625.       # Last step: remove runtime libs from dependency_libs
  7626.       # (they stay in deplibs)
  7627.       tmp_libs=
  7628.       for i in $dependency_libs ; do
  7629.         case " $predeps $postdeps $compiler_lib_search_path " in
  7630.         *" $i "*)
  7631.           i=""
  7632.           ;;
  7633.         esac
  7634.         if test -n "$i" ; then
  7635.           tmp_libs+=" $i"
  7636.         fi
  7637.       done
  7638.       dependency_libs=$tmp_libs
  7639.     done # for pass
  7640.     if test "$linkmode" = prog; then
  7641.       dlfiles="$newdlfiles"
  7642.     fi
  7643.     if test "$linkmode" = prog || test "$linkmode" = lib; then
  7644.       dlprefiles="$newdlprefiles"
  7645.     fi
  7646.  
  7647.     case $linkmode in
  7648.     oldlib)
  7649.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  7650.         func_warning "\`-dlopen' is ignored for archives"
  7651.       fi
  7652.  
  7653.       case " $deplibs" in
  7654.       *\ -l* | *\ -L*)
  7655.         func_warning "\`-l' and \`-L' are ignored for archives" ;;
  7656.       esac
  7657.  
  7658.       test -n "$rpath" && \
  7659.         func_warning "\`-rpath' is ignored for archives"
  7660.  
  7661.       test -n "$xrpath" && \
  7662.         func_warning "\`-R' is ignored for archives"
  7663.  
  7664.       test -n "$vinfo" && \
  7665.         func_warning "\`-version-info/-version-number' is ignored for archives"
  7666.  
  7667.       test -n "$release" && \
  7668.         func_warning "\`-release' is ignored for archives"
  7669.  
  7670.       test -n "$export_symbols$export_symbols_regex" && \
  7671.         func_warning "\`-export-symbols' is ignored for archives"
  7672.  
  7673.       # Now set the variables for building old libraries.
  7674.       build_libtool_libs=no
  7675.       oldlibs="$output"
  7676.       objs+="$old_deplibs"
  7677.       ;;
  7678.  
  7679.     lib)
  7680.       # Make sure we only generate libraries of the form `libNAME.la'.
  7681.       case $outputname in
  7682.       lib*)
  7683.         func_stripname 'lib' '.la' "$outputname"
  7684.         name=$func_stripname_result
  7685.         eval shared_ext=\"$shrext_cmds\"
  7686.         eval libname=\"$libname_spec\"
  7687.         ;;
  7688.       *)
  7689.         test "$module" = no && \
  7690.           func_fatal_help "libtool library \`$output' must begin with \`lib'"
  7691.  
  7692.         if test "$need_lib_prefix" != no; then
  7693.           # Add the "lib" prefix for modules if required
  7694.           func_stripname '' '.la' "$outputname"
  7695.           name=$func_stripname_result
  7696.           eval shared_ext=\"$shrext_cmds\"
  7697.           eval libname=\"$libname_spec\"
  7698.         else
  7699.           func_stripname '' '.la' "$outputname"
  7700.           libname=$func_stripname_result
  7701.         fi
  7702.         ;;
  7703.       esac
  7704.  
  7705.       if test -n "$objs"; then
  7706.         if test "$deplibs_check_method" != pass_all; then
  7707.           func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
  7708.         else
  7709.           echo
  7710.           $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  7711.           $ECHO "*** objects $objs is not portable!"
  7712.           libobjs+=" $objs"
  7713.         fi
  7714.       fi
  7715.  
  7716.       test "$dlself" != no && \
  7717.         func_warning "\`-dlopen self' is ignored for libtool libraries"
  7718.  
  7719.       set dummy $rpath
  7720.       shift
  7721.       test "$#" -gt 1 && \
  7722.         func_warning "ignoring multiple \`-rpath's for a libtool library"
  7723.  
  7724.       install_libdir="$1"
  7725.  
  7726.       oldlibs=
  7727.       if test -z "$rpath"; then
  7728.         if test "$build_libtool_libs" = yes; then
  7729.           # Building a libtool convenience library.
  7730.           # Some compilers have problems with a `.al' extension so
  7731.           # convenience libraries should have the same extension an
  7732.           # archive normally would.
  7733.           oldlibs="$output_objdir/$libname.$libext $oldlibs"
  7734.           build_libtool_libs=convenience
  7735.           build_old_libs=yes
  7736.         fi
  7737.  
  7738.         test -n "$vinfo" && \
  7739.           func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
  7740.  
  7741.         test -n "$release" && \
  7742.           func_warning "\`-release' is ignored for convenience libraries"
  7743.       else
  7744.  
  7745.         # Parse the version information argument.
  7746.         save_ifs="$IFS"; IFS=':'
  7747.         set dummy $vinfo 0 0 0
  7748.         shift
  7749.         IFS="$save_ifs"
  7750.  
  7751.         test -n "$7" && \
  7752.           func_fatal_help "too many parameters to \`-version-info'"
  7753.  
  7754.         # convert absolute version numbers to libtool ages
  7755.         # this retains compatibility with .la files and attempts
  7756.         # to make the code below a bit more comprehensible
  7757.  
  7758.         case $vinfo_number in
  7759.         yes)
  7760.           number_major="$1"
  7761.           number_minor="$2"
  7762.           number_revision="$3"
  7763.           #
  7764.           # There are really only two kinds -- those that
  7765.           # use the current revision as the major version
  7766.           # and those that subtract age and use age as
  7767.           # a minor version.  But, then there is irix
  7768.           # which has an extra 1 added just for fun
  7769.           #
  7770.           case $version_type in
  7771.           # correct linux to gnu/linux during the next big refactor
  7772.           darwin|linux|osf|windows|none)
  7773.             func_arith $number_major + $number_minor
  7774.             current=$func_arith_result
  7775.             age="$number_minor"
  7776.             revision="$number_revision"
  7777.             ;;
  7778.           freebsd-aout|freebsd-elf|qnx|sunos)
  7779.             current="$number_major"
  7780.             revision="$number_minor"
  7781.             age="0"
  7782.             ;;
  7783.           irix|nonstopux)
  7784.             func_arith $number_major + $number_minor
  7785.             current=$func_arith_result
  7786.             age="$number_minor"
  7787.             revision="$number_minor"
  7788.             lt_irix_increment=no
  7789.             ;;
  7790.           esac
  7791.           ;;
  7792.         no)
  7793.           current="$1"
  7794.           revision="$2"
  7795.           age="$3"
  7796.           ;;
  7797.         esac
  7798.  
  7799.         # Check that each of the things are valid numbers.
  7800.         case $current in
  7801.         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]) ;;
  7802.         *)
  7803.           func_error "CURRENT \`$current' must be a nonnegative integer"
  7804.           func_fatal_error "\`$vinfo' is not valid version information"
  7805.           ;;
  7806.         esac
  7807.  
  7808.         case $revision in
  7809.         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]) ;;
  7810.         *)
  7811.           func_error "REVISION \`$revision' must be a nonnegative integer"
  7812.           func_fatal_error "\`$vinfo' is not valid version information"
  7813.           ;;
  7814.         esac
  7815.  
  7816.         case $age in
  7817.         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]) ;;
  7818.         *)
  7819.           func_error "AGE \`$age' must be a nonnegative integer"
  7820.           func_fatal_error "\`$vinfo' is not valid version information"
  7821.           ;;
  7822.         esac
  7823.  
  7824.         if test "$age" -gt "$current"; then
  7825.           func_error "AGE \`$age' is greater than the current interface number \`$current'"
  7826.           func_fatal_error "\`$vinfo' is not valid version information"
  7827.         fi
  7828.  
  7829.         # Calculate the version variables.
  7830.         major=
  7831.         versuffix=
  7832.         verstring=
  7833.         case $version_type in
  7834.         none) ;;
  7835.  
  7836.         darwin)
  7837.           # Like Linux, but with the current version available in
  7838.           # verstring for coding it into the library header
  7839.           func_arith $current - $age
  7840.           major=.$func_arith_result
  7841.           versuffix="$major.$age.$revision"
  7842.           # Darwin ld doesn't like 0 for these options...
  7843.           func_arith $current + 1
  7844.           minor_current=$func_arith_result
  7845.           xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  7846.           verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  7847.           ;;
  7848.  
  7849.         freebsd-aout)
  7850.           major=".$current"
  7851.           versuffix=".$current.$revision";
  7852.           ;;
  7853.  
  7854.         freebsd-elf)
  7855.           major=".$current"
  7856.           versuffix=".$current"
  7857.           ;;
  7858.  
  7859.         irix | nonstopux)
  7860.           if test "X$lt_irix_increment" = "Xno"; then
  7861.             func_arith $current - $age
  7862.           else
  7863.             func_arith $current - $age + 1
  7864.           fi
  7865.           major=$func_arith_result
  7866.  
  7867.           case $version_type in
  7868.             nonstopux) verstring_prefix=nonstopux ;;
  7869.             *)         verstring_prefix=sgi ;;
  7870.           esac
  7871.           verstring="$verstring_prefix$major.$revision"
  7872.  
  7873.           # Add in all the interfaces that we are compatible with.
  7874.           loop=$revision
  7875.           while test "$loop" -ne 0; do
  7876.             func_arith $revision - $loop
  7877.             iface=$func_arith_result
  7878.             func_arith $loop - 1
  7879.             loop=$func_arith_result
  7880.             verstring="$verstring_prefix$major.$iface:$verstring"
  7881.           done
  7882.  
  7883.           # Before this point, $major must not contain `.'.
  7884.           major=.$major
  7885.           versuffix="$major.$revision"
  7886.           ;;
  7887.  
  7888.         linux) # correct to gnu/linux during the next big refactor
  7889.           func_arith $current - $age
  7890.           major=.$func_arith_result
  7891.           versuffix="$major.$age.$revision"
  7892.           ;;
  7893.  
  7894.         osf)
  7895.           func_arith $current - $age
  7896.           major=.$func_arith_result
  7897.           versuffix=".$current.$age.$revision"
  7898.           verstring="$current.$age.$revision"
  7899.  
  7900.           # Add in all the interfaces that we are compatible with.
  7901.           loop=$age
  7902.           while test "$loop" -ne 0; do
  7903.             func_arith $current - $loop
  7904.             iface=$func_arith_result
  7905.             func_arith $loop - 1
  7906.             loop=$func_arith_result
  7907.             verstring="$verstring:${iface}.0"
  7908.           done
  7909.  
  7910.           # Make executables depend on our current version.
  7911.           verstring+=":${current}.0"
  7912.           ;;
  7913.  
  7914.         qnx)
  7915.           major=".$current"
  7916.           versuffix=".$current"
  7917.           ;;
  7918.  
  7919.         sunos)
  7920.           major=".$current"
  7921.           versuffix=".$current.$revision"
  7922.           ;;
  7923.  
  7924.         windows)
  7925.           # Use '-' rather than '.', since we only want one
  7926.           # extension on DOS 8.3 filesystems.
  7927.           func_arith $current - $age
  7928.           major=$func_arith_result
  7929.           versuffix="-$major"
  7930.           ;;
  7931.  
  7932.         *)
  7933.           func_fatal_configuration "unknown library version type \`$version_type'"
  7934.           ;;
  7935.         esac
  7936.  
  7937.         # Clear the version info if we defaulted, and they specified a release.
  7938.         if test -z "$vinfo" && test -n "$release"; then
  7939.           major=
  7940.           case $version_type in
  7941.           darwin)
  7942.             # we can't check for "0.0" in archive_cmds due to quoting
  7943.             # problems, so we reset it completely
  7944.             verstring=
  7945.             ;;
  7946.           *)
  7947.             verstring="0.0"
  7948.             ;;
  7949.           esac
  7950.           if test "$need_version" = no; then
  7951.             versuffix=
  7952.           else
  7953.             versuffix=".0.0"
  7954.           fi
  7955.         fi
  7956.  
  7957.         # Remove version info from name if versioning should be avoided
  7958.         if test "$avoid_version" = yes && test "$need_version" = no; then
  7959.           major=
  7960.           versuffix=
  7961.           verstring=""
  7962.         fi
  7963.  
  7964.         # Check to see if the archive will have undefined symbols.
  7965.         if test "$allow_undefined" = yes; then
  7966.           if test "$allow_undefined_flag" = unsupported; then
  7967.             func_warning "undefined symbols not allowed in $host shared libraries"
  7968.             build_libtool_libs=no
  7969.             build_old_libs=yes
  7970.           fi
  7971.         else
  7972.           # Don't allow undefined symbols.
  7973.           allow_undefined_flag="$no_undefined_flag"
  7974.         fi
  7975.  
  7976.       fi
  7977.  
  7978.       func_generate_dlsyms "$libname" "$libname" "yes"
  7979.       libobjs+=" $symfileobj"
  7980.       test "X$libobjs" = "X " && libobjs=
  7981.  
  7982.       if test "$opt_mode" != relink; then
  7983.         # Remove our outputs, but don't remove object files since they
  7984.         # may have been created when compiling PIC objects.
  7985.         removelist=
  7986.         tempremovelist=`$ECHO "$output_objdir/*"`
  7987.         for p in $tempremovelist; do
  7988.           case $p in
  7989.             *.$objext | *.gcno)
  7990.                ;;
  7991.             $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  7992.                if test "X$precious_files_regex" != "X"; then
  7993.                  if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  7994.                  then
  7995.                    continue
  7996.                  fi
  7997.                fi
  7998.                removelist+=" $p"
  7999.                ;;
  8000.             *) ;;
  8001.           esac
  8002.         done
  8003.         test -n "$removelist" && \
  8004.           func_show_eval "${RM}r \$removelist"
  8005.       fi
  8006.  
  8007.       # Now set the variables for building old libraries.
  8008.       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  8009.         oldlibs+=" $output_objdir/$libname.$libext"
  8010.  
  8011.         # Transform .lo files to .o files.
  8012.         oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
  8013.       fi
  8014.  
  8015.       # Eliminate all temporary directories.
  8016.       #for path in $notinst_path; do
  8017.       # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  8018.       # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  8019.       # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  8020.       #done
  8021.  
  8022.       if test -n "$xrpath"; then
  8023.         # If the user specified any rpath flags, then add them.
  8024.         temp_xrpath=
  8025.         for libdir in $xrpath; do
  8026.           func_replace_sysroot "$libdir"
  8027.           temp_xrpath+=" -R$func_replace_sysroot_result"
  8028.           case "$finalize_rpath " in
  8029.           *" $libdir "*) ;;
  8030.           *) finalize_rpath+=" $libdir" ;;
  8031.           esac
  8032.         done
  8033.         if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  8034.           dependency_libs="$temp_xrpath $dependency_libs"
  8035.         fi
  8036.       fi
  8037.  
  8038.       # Make sure dlfiles contains only unique files that won't be dlpreopened
  8039.       old_dlfiles="$dlfiles"
  8040.       dlfiles=
  8041.       for lib in $old_dlfiles; do
  8042.         case " $dlprefiles $dlfiles " in
  8043.         *" $lib "*) ;;
  8044.         *) dlfiles+=" $lib" ;;
  8045.         esac
  8046.       done
  8047.  
  8048.       # Make sure dlprefiles contains only unique files
  8049.       old_dlprefiles="$dlprefiles"
  8050.       dlprefiles=
  8051.       for lib in $old_dlprefiles; do
  8052.         case "$dlprefiles " in
  8053.         *" $lib "*) ;;
  8054.         *) dlprefiles+=" $lib" ;;
  8055.         esac
  8056.       done
  8057.  
  8058.       if test "$build_libtool_libs" = yes; then
  8059.         if test -n "$rpath"; then
  8060.           case $host in
  8061.           *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  8062.             # these systems don't actually have a c library (as such)!
  8063.             ;;
  8064.           *-*-rhapsody* | *-*-darwin1.[012])
  8065.             # Rhapsody C library is in the System framework
  8066.             deplibs+=" System.ltframework"
  8067.             ;;
  8068.           *-*-netbsd*)
  8069.             # Don't link with libc until the a.out ld.so is fixed.
  8070.             ;;
  8071.           *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  8072.             # Do not include libc due to us having libc/libc_r.
  8073.             ;;
  8074.           *-*-sco3.2v5* | *-*-sco5v6*)
  8075.             # Causes problems with __ctype
  8076.             ;;
  8077.           *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  8078.             # Compiler inserts libc in the correct place for threads to work
  8079.             ;;
  8080.           *)
  8081.             # Add libc to deplibs on all other systems if necessary.
  8082.             if test "$build_libtool_need_lc" = "yes"; then
  8083.               deplibs+=" -lc"
  8084.             fi
  8085.             ;;
  8086.           esac
  8087.         fi
  8088.  
  8089.         # Transform deplibs into only deplibs that can be linked in shared.
  8090.         name_save=$name
  8091.         libname_save=$libname
  8092.         release_save=$release
  8093.         versuffix_save=$versuffix
  8094.         major_save=$major
  8095.         # I'm not sure if I'm treating the release correctly.  I think
  8096.         # release should show up in the -l (ie -lgmp5) so we don't want to
  8097.         # add it in twice.  Is that correct?
  8098.         release=""
  8099.         versuffix=""
  8100.         major=""
  8101.         newdeplibs=
  8102.         droppeddeps=no
  8103.         case $deplibs_check_method in
  8104.         pass_all)
  8105.           # Don't check for shared/static.  Everything works.
  8106.           # This might be a little naive.  We might want to check
  8107.           # whether the library exists or not.  But this is on
  8108.           # osf3 & osf4 and I'm not really sure... Just
  8109.           # implementing what was already the behavior.
  8110.           newdeplibs=$deplibs
  8111.           ;;
  8112.         test_compile)
  8113.           # This code stresses the "libraries are programs" paradigm to its
  8114.           # limits. Maybe even breaks it.  We compile a program, linking it
  8115.           # against the deplibs as a proxy for the library.  Then we can check
  8116.           # whether they linked in statically or dynamically with ldd.
  8117.           $opt_dry_run || $RM conftest.c
  8118.           cat > conftest.c <<EOF
  8119.           int main() { return 0; }
  8120. EOF
  8121.           $opt_dry_run || $RM conftest
  8122.           if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  8123.             ldd_output=`ldd conftest`
  8124.             for i in $deplibs; do
  8125.               case $i in
  8126.               -l*)
  8127.                 func_stripname -l '' "$i"
  8128.                 name=$func_stripname_result
  8129.                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  8130.                   case " $predeps $postdeps " in
  8131.                   *" $i "*)
  8132.                     newdeplibs+=" $i"
  8133.                     i=""
  8134.                     ;;
  8135.                   esac
  8136.                 fi
  8137.                 if test -n "$i" ; then
  8138.                   libname=`eval "\\$ECHO \"$libname_spec\""`
  8139.                   deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8140.                   set dummy $deplib_matches; shift
  8141.                   deplib_match=$1
  8142.                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  8143.                     newdeplibs+=" $i"
  8144.                   else
  8145.                     droppeddeps=yes
  8146.                     echo
  8147.                     $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8148.                     echo "*** I have the capability to make that library automatically link in when"
  8149.                     echo "*** you link to this library.  But I can only do this if you have a"
  8150.                     echo "*** shared version of the library, which I believe you do not have"
  8151.                     echo "*** because a test_compile did reveal that the linker did not use it for"
  8152.                     echo "*** its dynamic dependency list that programs get resolved with at runtime."
  8153.                   fi
  8154.                 fi
  8155.                 ;;
  8156.               *)
  8157.                 newdeplibs+=" $i"
  8158.                 ;;
  8159.               esac
  8160.             done
  8161.           else
  8162.             # Error occurred in the first compile.  Let's try to salvage
  8163.             # the situation: Compile a separate program for each library.
  8164.             for i in $deplibs; do
  8165.               case $i in
  8166.               -l*)
  8167.                 func_stripname -l '' "$i"
  8168.                 name=$func_stripname_result
  8169.                 $opt_dry_run || $RM conftest
  8170.                 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  8171.                   ldd_output=`ldd conftest`
  8172.                   if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  8173.                     case " $predeps $postdeps " in
  8174.                     *" $i "*)
  8175.                       newdeplibs+=" $i"
  8176.                       i=""
  8177.                       ;;
  8178.                     esac
  8179.                   fi
  8180.                   if test -n "$i" ; then
  8181.                     libname=`eval "\\$ECHO \"$libname_spec\""`
  8182.                     deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8183.                     set dummy $deplib_matches; shift
  8184.                     deplib_match=$1
  8185.                     if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  8186.                       newdeplibs+=" $i"
  8187.                     else
  8188.                       droppeddeps=yes
  8189.                       echo
  8190.                       $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8191.                       echo "*** I have the capability to make that library automatically link in when"
  8192.                       echo "*** you link to this library.  But I can only do this if you have a"
  8193.                       echo "*** shared version of the library, which you do not appear to have"
  8194.                       echo "*** because a test_compile did reveal that the linker did not use this one"
  8195.                       echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  8196.                     fi
  8197.                   fi
  8198.                 else
  8199.                   droppeddeps=yes
  8200.                   echo
  8201.                   $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
  8202.                   echo "*** make it link in!  You will probably need to install it or some"
  8203.                   echo "*** library that it depends on before this library will be fully"
  8204.                   echo "*** functional.  Installing it before continuing would be even better."
  8205.                 fi
  8206.                 ;;
  8207.               *)
  8208.                 newdeplibs+=" $i"
  8209.                 ;;
  8210.               esac
  8211.             done
  8212.           fi
  8213.           ;;
  8214.         file_magic*)
  8215.           set dummy $deplibs_check_method; shift
  8216.           file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8217.           for a_deplib in $deplibs; do
  8218.             case $a_deplib in
  8219.             -l*)
  8220.               func_stripname -l '' "$a_deplib"
  8221.               name=$func_stripname_result
  8222.               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  8223.                 case " $predeps $postdeps " in
  8224.                 *" $a_deplib "*)
  8225.                   newdeplibs+=" $a_deplib"
  8226.                   a_deplib=""
  8227.                   ;;
  8228.                 esac
  8229.               fi
  8230.               if test -n "$a_deplib" ; then
  8231.                 libname=`eval "\\$ECHO \"$libname_spec\""`
  8232.                 if test -n "$file_magic_glob"; then
  8233.                   libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  8234.                 else
  8235.                   libnameglob=$libname
  8236.                 fi
  8237.                 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
  8238.                 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8239.                   if test "$want_nocaseglob" = yes; then
  8240.                     shopt -s nocaseglob
  8241.                     potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8242.                     $nocaseglob
  8243.                   else
  8244.                     potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8245.                   fi
  8246.                   for potent_lib in $potential_libs; do
  8247.                       # Follow soft links.
  8248.                       if ls -lLd "$potent_lib" 2>/dev/null |
  8249.                          $GREP " -> " >/dev/null; then
  8250.                         continue
  8251.                       fi
  8252.                       # The statement above tries to avoid entering an
  8253.                       # endless loop below, in case of cyclic links.
  8254.                       # We might still enter an endless loop, since a link
  8255.                       # loop can be closed while we follow links,
  8256.                       # but so what?
  8257.                       potlib="$potent_lib"
  8258.                       while test -h "$potlib" 2>/dev/null; do
  8259.                         potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  8260.                         case $potliblink in
  8261.                         [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  8262.                         *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
  8263.                         esac
  8264.                       done
  8265.                       if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  8266.                          $SED -e 10q |
  8267.                          $EGREP "$file_magic_regex" > /dev/null; then
  8268.                         newdeplibs+=" $a_deplib"
  8269.                         a_deplib=""
  8270.                         break 2
  8271.                       fi
  8272.                   done
  8273.                 done
  8274.               fi
  8275.               if test -n "$a_deplib" ; then
  8276.                 droppeddeps=yes
  8277.                 echo
  8278.                 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8279.                 echo "*** I have the capability to make that library automatically link in when"
  8280.                 echo "*** you link to this library.  But I can only do this if you have a"
  8281.                 echo "*** shared version of the library, which you do not appear to have"
  8282.                 echo "*** because I did check the linker path looking for a file starting"
  8283.                 if test -z "$potlib" ; then
  8284.                   $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  8285.                 else
  8286.                   $ECHO "*** with $libname and none of the candidates passed a file format test"
  8287.                   $ECHO "*** using a file magic. Last file checked: $potlib"
  8288.                 fi
  8289.               fi
  8290.               ;;
  8291.             *)
  8292.               # Add a -L argument.
  8293.               newdeplibs+=" $a_deplib"
  8294.               ;;
  8295.             esac
  8296.           done # Gone through all deplibs.
  8297.           ;;
  8298.         match_pattern*)
  8299.           set dummy $deplibs_check_method; shift
  8300.           match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8301.           for a_deplib in $deplibs; do
  8302.             case $a_deplib in
  8303.             -l*)
  8304.               func_stripname -l '' "$a_deplib"
  8305.               name=$func_stripname_result
  8306.               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  8307.                 case " $predeps $postdeps " in
  8308.                 *" $a_deplib "*)
  8309.                   newdeplibs+=" $a_deplib"
  8310.                   a_deplib=""
  8311.                   ;;
  8312.                 esac
  8313.               fi
  8314.               if test -n "$a_deplib" ; then
  8315.                 libname=`eval "\\$ECHO \"$libname_spec\""`
  8316.                 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8317.                   potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  8318.                   for potent_lib in $potential_libs; do
  8319.                     potlib="$potent_lib" # see symlink-check above in file_magic test
  8320.                     if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  8321.                        $EGREP "$match_pattern_regex" > /dev/null; then
  8322.                       newdeplibs+=" $a_deplib"
  8323.                       a_deplib=""
  8324.                       break 2
  8325.                     fi
  8326.                   done
  8327.                 done
  8328.               fi
  8329.               if test -n "$a_deplib" ; then
  8330.                 droppeddeps=yes
  8331.                 echo
  8332.                 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8333.                 echo "*** I have the capability to make that library automatically link in when"
  8334.                 echo "*** you link to this library.  But I can only do this if you have a"
  8335.                 echo "*** shared version of the library, which you do not appear to have"
  8336.                 echo "*** because I did check the linker path looking for a file starting"
  8337.                 if test -z "$potlib" ; then
  8338.                   $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  8339.                 else
  8340.                   $ECHO "*** with $libname and none of the candidates passed a file format test"
  8341.                   $ECHO "*** using a regex pattern. Last file checked: $potlib"
  8342.                 fi
  8343.               fi
  8344.               ;;
  8345.             *)
  8346.               # Add a -L argument.
  8347.               newdeplibs+=" $a_deplib"
  8348.               ;;
  8349.             esac
  8350.           done # Gone through all deplibs.
  8351.           ;;
  8352.         none | unknown | *)
  8353.           newdeplibs=""
  8354.           tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  8355.           if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  8356.             for i in $predeps $postdeps ; do
  8357.               # can't use Xsed below, because $i might contain '/'
  8358.               tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
  8359.             done
  8360.           fi
  8361.           case $tmp_deplibs in
  8362.           *[!\  \ ]*)
  8363.             echo
  8364.             if test "X$deplibs_check_method" = "Xnone"; then
  8365.               echo "*** Warning: inter-library dependencies are not supported in this platform."
  8366.             else
  8367.               echo "*** Warning: inter-library dependencies are not known to be supported."
  8368.             fi
  8369.             echo "*** All declared inter-library dependencies are being dropped."
  8370.             droppeddeps=yes
  8371.             ;;
  8372.           esac
  8373.           ;;
  8374.         esac
  8375.         versuffix=$versuffix_save
  8376.         major=$major_save
  8377.         release=$release_save
  8378.         libname=$libname_save
  8379.         name=$name_save
  8380.  
  8381.         case $host in
  8382.         *-*-rhapsody* | *-*-darwin1.[012])
  8383.           # On Rhapsody replace the C library with the System framework
  8384.           newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  8385.           ;;
  8386.         esac
  8387.  
  8388.         if test "$droppeddeps" = yes; then
  8389.           if test "$module" = yes; then
  8390.             echo
  8391.             echo "*** Warning: libtool could not satisfy all declared inter-library"
  8392.             $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
  8393.             echo "*** a static module, that should work as long as the dlopening"
  8394.             echo "*** application is linked with the -dlopen flag."
  8395.             if test -z "$global_symbol_pipe"; then
  8396.               echo
  8397.               echo "*** However, this would only work if libtool was able to extract symbol"
  8398.               echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  8399.               echo "*** not find such a program.  So, this module is probably useless."
  8400.               echo "*** \`nm' from GNU binutils and a full rebuild may help."
  8401.             fi
  8402.             if test "$build_old_libs" = no; then
  8403.               oldlibs="$output_objdir/$libname.$libext"
  8404.               build_libtool_libs=module
  8405.               build_old_libs=yes
  8406.             else
  8407.               build_libtool_libs=no
  8408.             fi
  8409.           else
  8410.             echo "*** The inter-library dependencies that have been dropped here will be"
  8411.             echo "*** automatically added whenever a program is linked with this library"
  8412.             echo "*** or is declared to -dlopen it."
  8413.  
  8414.             if test "$allow_undefined" = no; then
  8415.               echo
  8416.               echo "*** Since this library must not contain undefined symbols,"
  8417.               echo "*** because either the platform does not support them or"
  8418.               echo "*** it was explicitly requested with -no-undefined,"
  8419.               echo "*** libtool will only create a static version of it."
  8420.               if test "$build_old_libs" = no; then
  8421.                 oldlibs="$output_objdir/$libname.$libext"
  8422.                 build_libtool_libs=module
  8423.                 build_old_libs=yes
  8424.               else
  8425.                 build_libtool_libs=no
  8426.               fi
  8427.             fi
  8428.           fi
  8429.         fi
  8430.         # Done checking deplibs!
  8431.         deplibs=$newdeplibs
  8432.       fi
  8433.       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  8434.       case $host in
  8435.         *-*-darwin*)
  8436.           newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8437.           new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8438.           deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8439.           ;;
  8440.       esac
  8441.  
  8442.       # move library search paths that coincide with paths to not yet
  8443.       # installed libraries to the beginning of the library search list
  8444.       new_libs=
  8445.       for path in $notinst_path; do
  8446.         case " $new_libs " in
  8447.         *" -L$path/$objdir "*) ;;
  8448.         *)
  8449.           case " $deplibs " in
  8450.           *" -L$path/$objdir "*)
  8451.             new_libs+=" -L$path/$objdir" ;;
  8452.           esac
  8453.           ;;
  8454.         esac
  8455.       done
  8456.       for deplib in $deplibs; do
  8457.         case $deplib in
  8458.         -L*)
  8459.           case " $new_libs " in
  8460.           *" $deplib "*) ;;
  8461.           *) new_libs+=" $deplib" ;;
  8462.           esac
  8463.           ;;
  8464.         *) new_libs+=" $deplib" ;;
  8465.         esac
  8466.       done
  8467.       deplibs="$new_libs"
  8468.  
  8469.       # All the library-specific variables (install_libdir is set above).
  8470.       library_names=
  8471.       old_library=
  8472.       dlname=
  8473.  
  8474.       # Test again, we may have decided not to build it any more
  8475.       if test "$build_libtool_libs" = yes; then
  8476.         # Remove ${wl} instances when linking with ld.
  8477.         # FIXME: should test the right _cmds variable.
  8478.         case $archive_cmds in
  8479.           *\$LD\ *) wl= ;;
  8480.         esac
  8481.         if test "$hardcode_into_libs" = yes; then
  8482.           # Hardcode the library paths
  8483.           hardcode_libdirs=
  8484.           dep_rpath=
  8485.           rpath="$finalize_rpath"
  8486.           test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
  8487.           for libdir in $rpath; do
  8488.             if test -n "$hardcode_libdir_flag_spec"; then
  8489.               if test -n "$hardcode_libdir_separator"; then
  8490.                 func_replace_sysroot "$libdir"
  8491.                 libdir=$func_replace_sysroot_result
  8492.                 if test -z "$hardcode_libdirs"; then
  8493.                   hardcode_libdirs="$libdir"
  8494.                 else
  8495.                   # Just accumulate the unique libdirs.
  8496.                   case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  8497.                   *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  8498.                     ;;
  8499.                   *)
  8500.                     hardcode_libdirs+="$hardcode_libdir_separator$libdir"
  8501.                     ;;
  8502.                   esac
  8503.                 fi
  8504.               else
  8505.                 eval flag=\"$hardcode_libdir_flag_spec\"
  8506.                 dep_rpath+=" $flag"
  8507.               fi
  8508.             elif test -n "$runpath_var"; then
  8509.               case "$perm_rpath " in
  8510.               *" $libdir "*) ;;
  8511.               *) perm_rpath+=" $libdir" ;;
  8512.               esac
  8513.             fi
  8514.           done
  8515.           # Substitute the hardcoded libdirs into the rpath.
  8516.           if test -n "$hardcode_libdir_separator" &&
  8517.              test -n "$hardcode_libdirs"; then
  8518.             libdir="$hardcode_libdirs"
  8519.             eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  8520.           fi
  8521.           if test -n "$runpath_var" && test -n "$perm_rpath"; then
  8522.             # We should set the runpath_var.
  8523.             rpath=
  8524.             for dir in $perm_rpath; do
  8525.               rpath+="$dir:"
  8526.             done
  8527.             eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  8528.           fi
  8529.           test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  8530.         fi
  8531.  
  8532.         shlibpath="$finalize_shlibpath"
  8533.         test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  8534.         if test -n "$shlibpath"; then
  8535.           eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  8536.         fi
  8537.  
  8538.         # Get the real and link names of the library.
  8539.         eval shared_ext=\"$shrext_cmds\"
  8540.         eval library_names=\"$library_names_spec\"
  8541.         set dummy $library_names
  8542.         shift
  8543.         realname="$1"
  8544.         shift
  8545.  
  8546.         if test -n "$soname_spec"; then
  8547.           eval soname=\"$soname_spec\"
  8548.         else
  8549.           soname="$realname"
  8550.         fi
  8551.         if test -z "$dlname"; then
  8552.           dlname=$soname
  8553.         fi
  8554.  
  8555.         lib="$output_objdir/$realname"
  8556.         linknames=
  8557.         for link
  8558.         do
  8559.           linknames+=" $link"
  8560.         done
  8561.  
  8562.         # Use standard objects if they are pic
  8563.         test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  8564.         test "X$libobjs" = "X " && libobjs=
  8565.  
  8566.         delfiles=
  8567.         if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8568.           $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  8569.           export_symbols="$output_objdir/$libname.uexp"
  8570.           delfiles+=" $export_symbols"
  8571.         fi
  8572.  
  8573.         orig_export_symbols=
  8574.         case $host_os in
  8575.         cygwin* | mingw* | cegcc*)
  8576.           if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  8577.             # exporting using user supplied symfile
  8578.             if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
  8579.               # and it's NOT already a .def file. Must figure out
  8580.               # which of the given symbols are data symbols and tag
  8581.               # them as such. So, trigger use of export_symbols_cmds.
  8582.               # export_symbols gets reassigned inside the "prepare
  8583.               # the list of exported symbols" if statement, so the
  8584.               # include_expsyms logic still works.
  8585.               orig_export_symbols="$export_symbols"
  8586.               export_symbols=
  8587.               always_export_symbols=yes
  8588.             fi
  8589.           fi
  8590.           ;;
  8591.         esac
  8592.  
  8593.         # Prepare the list of exported symbols
  8594.         if test -z "$export_symbols"; then
  8595.           if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  8596.             func_verbose "generating symbol list for \`$libname.la'"
  8597.             export_symbols="$output_objdir/$libname.exp"
  8598.             $opt_dry_run || $RM $export_symbols
  8599.             cmds=$export_symbols_cmds
  8600.             save_ifs="$IFS"; IFS='~'
  8601.             for cmd1 in $cmds; do
  8602.               IFS="$save_ifs"
  8603.               # Take the normal branch if the nm_file_list_spec branch
  8604.               # doesn't work or if tool conversion is not needed.
  8605.               case $nm_file_list_spec~$to_tool_file_cmd in
  8606.                 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  8607.                   try_normal_branch=yes
  8608.                   eval cmd=\"$cmd1\"
  8609.                   func_len " $cmd"
  8610.                   len=$func_len_result
  8611.                   ;;
  8612.                 *)
  8613.                   try_normal_branch=no
  8614.                   ;;
  8615.               esac
  8616.               if test "$try_normal_branch" = yes \
  8617.                  && { test "$len" -lt "$max_cmd_len" \
  8618.                       || test "$max_cmd_len" -le -1; }
  8619.               then
  8620.                 func_show_eval "$cmd" 'exit $?'
  8621.                 skipped_export=false
  8622.               elif test -n "$nm_file_list_spec"; then
  8623.                 func_basename "$output"
  8624.                 output_la=$func_basename_result
  8625.                 save_libobjs=$libobjs
  8626.                 save_output=$output
  8627.                 output=${output_objdir}/${output_la}.nm
  8628.                 func_to_tool_file "$output"
  8629.                 libobjs=$nm_file_list_spec$func_to_tool_file_result
  8630.                 delfiles+=" $output"
  8631.                 func_verbose "creating $NM input file list: $output"
  8632.                 for obj in $save_libobjs; do
  8633.                   func_to_tool_file "$obj"
  8634.                   $ECHO "$func_to_tool_file_result"
  8635.                 done > "$output"
  8636.                 eval cmd=\"$cmd1\"
  8637.                 func_show_eval "$cmd" 'exit $?'
  8638.                 output=$save_output
  8639.                 libobjs=$save_libobjs
  8640.                 skipped_export=false
  8641.               else
  8642.                 # The command line is too long to execute in one step.
  8643.                 func_verbose "using reloadable object file for export list..."
  8644.                 skipped_export=:
  8645.                 # Break out early, otherwise skipped_export may be
  8646.                 # set to false by a later but shorter cmd.
  8647.                 break
  8648.               fi
  8649.             done
  8650.             IFS="$save_ifs"
  8651.             if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
  8652.               func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  8653.               func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  8654.             fi
  8655.           fi
  8656.         fi
  8657.  
  8658.         if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8659.           tmp_export_symbols="$export_symbols"
  8660.           test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  8661.           $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  8662.         fi
  8663.  
  8664.         if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
  8665.           # The given exports_symbols file has to be filtered, so filter it.
  8666.           func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  8667.           # FIXME: $output_objdir/$libname.filter potentially contains lots of
  8668.           # 's' commands which not all seds can handle. GNU sed should be fine
  8669.           # though. Also, the filter scales superlinearly with the number of
  8670.           # global variables. join(1) would be nice here, but unfortunately
  8671.           # isn't a blessed tool.
  8672.           $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  8673.           delfiles+=" $export_symbols $output_objdir/$libname.filter"
  8674.           export_symbols=$output_objdir/$libname.def
  8675.           $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  8676.         fi
  8677.  
  8678.         tmp_deplibs=
  8679.         for test_deplib in $deplibs; do
  8680.           case " $convenience " in
  8681.           *" $test_deplib "*) ;;
  8682.           *)
  8683.             tmp_deplibs+=" $test_deplib"
  8684.             ;;
  8685.           esac
  8686.         done
  8687.         deplibs="$tmp_deplibs"
  8688.  
  8689.         if test -n "$convenience"; then
  8690.           if test -n "$whole_archive_flag_spec" &&
  8691.             test "$compiler_needs_object" = yes &&
  8692.             test -z "$libobjs"; then
  8693.             # extract the archives, so we have objects to list.
  8694.             # TODO: could optimize this to just extract one archive.
  8695.             whole_archive_flag_spec=
  8696.           fi
  8697.           if test -n "$whole_archive_flag_spec"; then
  8698.             save_libobjs=$libobjs
  8699.             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  8700.             test "X$libobjs" = "X " && libobjs=
  8701.           else
  8702.             gentop="$output_objdir/${outputname}x"
  8703.             generated+=" $gentop"
  8704.  
  8705.             func_extract_archives $gentop $convenience
  8706.             libobjs+=" $func_extract_archives_result"
  8707.             test "X$libobjs" = "X " && libobjs=
  8708.           fi
  8709.         fi
  8710.  
  8711.         if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  8712.           eval flag=\"$thread_safe_flag_spec\"
  8713.           linker_flags+=" $flag"
  8714.         fi
  8715.  
  8716.         # Make a backup of the uninstalled library when relinking
  8717.         if test "$opt_mode" = relink; then
  8718.           $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  8719.         fi
  8720.  
  8721.         # Do each of the archive commands.
  8722.         if test "$module" = yes && test -n "$module_cmds" ; then
  8723.           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  8724.             eval test_cmds=\"$module_expsym_cmds\"
  8725.             cmds=$module_expsym_cmds
  8726.           else
  8727.             eval test_cmds=\"$module_cmds\"
  8728.             cmds=$module_cmds
  8729.           fi
  8730.         else
  8731.           if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  8732.             eval test_cmds=\"$archive_expsym_cmds\"
  8733.             cmds=$archive_expsym_cmds
  8734.           else
  8735.             eval test_cmds=\"$archive_cmds\"
  8736.             cmds=$archive_cmds
  8737.           fi
  8738.         fi
  8739.  
  8740.         if test "X$skipped_export" != "X:" &&
  8741.            func_len " $test_cmds" &&
  8742.            len=$func_len_result &&
  8743.            test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  8744.           :
  8745.         else
  8746.           # The command line is too long to link in one step, link piecewise
  8747.           # or, if using GNU ld and skipped_export is not :, use a linker
  8748.           # script.
  8749.  
  8750.           # Save the value of $output and $libobjs because we want to
  8751.           # use them later.  If we have whole_archive_flag_spec, we
  8752.           # want to use save_libobjs as it was before
  8753.           # whole_archive_flag_spec was expanded, because we can't
  8754.           # assume the linker understands whole_archive_flag_spec.
  8755.           # This may have to be revisited, in case too many
  8756.           # convenience libraries get linked in and end up exceeding
  8757.           # the spec.
  8758.           if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  8759.             save_libobjs=$libobjs
  8760.           fi
  8761.           save_output=$output
  8762.           func_basename "$output"
  8763.           output_la=$func_basename_result
  8764.  
  8765.           # Clear the reloadable object creation command queue and
  8766.           # initialize k to one.
  8767.           test_cmds=
  8768.           concat_cmds=
  8769.           objlist=
  8770.           last_robj=
  8771.           k=1
  8772.  
  8773.           if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
  8774.             output=${output_objdir}/${output_la}.lnkscript
  8775.             func_verbose "creating GNU ld script: $output"
  8776.             echo 'INPUT (' > $output
  8777.             for obj in $save_libobjs
  8778.             do
  8779.               func_to_tool_file "$obj"
  8780.               $ECHO "$func_to_tool_file_result" >> $output
  8781.             done
  8782.             echo ')' >> $output
  8783.             delfiles+=" $output"
  8784.             func_to_tool_file "$output"
  8785.             output=$func_to_tool_file_result
  8786.           elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
  8787.             output=${output_objdir}/${output_la}.lnk
  8788.             func_verbose "creating linker input file list: $output"
  8789.             : > $output
  8790.             set x $save_libobjs
  8791.             shift
  8792.             firstobj=
  8793.             if test "$compiler_needs_object" = yes; then
  8794.               firstobj="$1 "
  8795.               shift
  8796.             fi
  8797.             for obj
  8798.             do
  8799.               func_to_tool_file "$obj"
  8800.               $ECHO "$func_to_tool_file_result" >> $output
  8801.             done
  8802.             delfiles+=" $output"
  8803.             func_to_tool_file "$output"
  8804.             output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  8805.           else
  8806.             if test -n "$save_libobjs"; then
  8807.               func_verbose "creating reloadable object files..."
  8808.               output=$output_objdir/$output_la-${k}.$objext
  8809.               eval test_cmds=\"$reload_cmds\"
  8810.               func_len " $test_cmds"
  8811.               len0=$func_len_result
  8812.               len=$len0
  8813.  
  8814.               # Loop over the list of objects to be linked.
  8815.               for obj in $save_libobjs
  8816.               do
  8817.                 func_len " $obj"
  8818.                 func_arith $len + $func_len_result
  8819.                 len=$func_arith_result
  8820.                 if test "X$objlist" = X ||
  8821.                    test "$len" -lt "$max_cmd_len"; then
  8822.                   objlist+=" $obj"
  8823.                 else
  8824.                   # The command $test_cmds is almost too long, add a
  8825.                   # command to the queue.
  8826.                   if test "$k" -eq 1 ; then
  8827.                     # The first file doesn't have a previous command to add.
  8828.                     reload_objs=$objlist
  8829.                     eval concat_cmds=\"$reload_cmds\"
  8830.                   else
  8831.                     # All subsequent reloadable object files will link in
  8832.                     # the last one created.
  8833.                     reload_objs="$objlist $last_robj"
  8834.                     eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  8835.                   fi
  8836.                   last_robj=$output_objdir/$output_la-${k}.$objext
  8837.                   func_arith $k + 1
  8838.                   k=$func_arith_result
  8839.                   output=$output_objdir/$output_la-${k}.$objext
  8840.                   objlist=" $obj"
  8841.                   func_len " $last_robj"
  8842.                   func_arith $len0 + $func_len_result
  8843.                   len=$func_arith_result
  8844.                 fi
  8845.               done
  8846.               # Handle the remaining objects by creating one last
  8847.               # reloadable object file.  All subsequent reloadable object
  8848.               # files will link in the last one created.
  8849.               test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  8850.               reload_objs="$objlist $last_robj"
  8851.               eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
  8852.               if test -n "$last_robj"; then
  8853.                 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
  8854.               fi
  8855.               delfiles+=" $output"
  8856.  
  8857.             else
  8858.               output=
  8859.             fi
  8860.  
  8861.             if ${skipped_export-false}; then
  8862.               func_verbose "generating symbol list for \`$libname.la'"
  8863.               export_symbols="$output_objdir/$libname.exp"
  8864.               $opt_dry_run || $RM $export_symbols
  8865.               libobjs=$output
  8866.               # Append the command to create the export file.
  8867.               test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  8868.               eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  8869.               if test -n "$last_robj"; then
  8870.                 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  8871.               fi
  8872.             fi
  8873.  
  8874.             test -n "$save_libobjs" &&
  8875.               func_verbose "creating a temporary reloadable object file: $output"
  8876.  
  8877.             # Loop through the commands generated above and execute them.
  8878.             save_ifs="$IFS"; IFS='~'
  8879.             for cmd in $concat_cmds; do
  8880.               IFS="$save_ifs"
  8881.               $opt_silent || {
  8882.                   func_quote_for_expand "$cmd"
  8883.                   eval "func_echo $func_quote_for_expand_result"
  8884.               }
  8885.               $opt_dry_run || eval "$cmd" || {
  8886.                 lt_exit=$?
  8887.  
  8888.                 # Restore the uninstalled library and exit
  8889.                 if test "$opt_mode" = relink; then
  8890.                   ( cd "$output_objdir" && \
  8891.                     $RM "${realname}T" && \
  8892.                     $MV "${realname}U" "$realname" )
  8893.                 fi
  8894.  
  8895.                 exit $lt_exit
  8896.               }
  8897.             done
  8898.             IFS="$save_ifs"
  8899.  
  8900.             if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  8901.               func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  8902.               func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  8903.             fi
  8904.           fi
  8905.  
  8906.           if ${skipped_export-false}; then
  8907.             if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8908.               tmp_export_symbols="$export_symbols"
  8909.               test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  8910.               $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  8911.             fi
  8912.  
  8913.             if test -n "$orig_export_symbols"; then
  8914.               # The given exports_symbols file has to be filtered, so filter it.
  8915.               func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  8916.               # FIXME: $output_objdir/$libname.filter potentially contains lots of
  8917.               # 's' commands which not all seds can handle. GNU sed should be fine
  8918.               # though. Also, the filter scales superlinearly with the number of
  8919.               # global variables. join(1) would be nice here, but unfortunately
  8920.               # isn't a blessed tool.
  8921.               $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  8922.               delfiles+=" $export_symbols $output_objdir/$libname.filter"
  8923.               export_symbols=$output_objdir/$libname.def
  8924.               $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  8925.             fi
  8926.           fi
  8927.  
  8928.           libobjs=$output
  8929.           # Restore the value of output.
  8930.           output=$save_output
  8931.  
  8932.           if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  8933.             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  8934.             test "X$libobjs" = "X " && libobjs=
  8935.           fi
  8936.           # Expand the library linking commands again to reset the
  8937.           # value of $libobjs for piecewise linking.
  8938.  
  8939.           # Do each of the archive commands.
  8940.           if test "$module" = yes && test -n "$module_cmds" ; then
  8941.             if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  8942.               cmds=$module_expsym_cmds
  8943.             else
  8944.               cmds=$module_cmds
  8945.             fi
  8946.           else
  8947.             if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  8948.               cmds=$archive_expsym_cmds
  8949.             else
  8950.               cmds=$archive_cmds
  8951.             fi
  8952.           fi
  8953.         fi
  8954.  
  8955.         if test -n "$delfiles"; then
  8956.           # Append the command to remove temporary files to $cmds.
  8957.           eval cmds=\"\$cmds~\$RM $delfiles\"
  8958.         fi
  8959.  
  8960.         # Add any objects from preloaded convenience libraries
  8961.         if test -n "$dlprefiles"; then
  8962.           gentop="$output_objdir/${outputname}x"
  8963.           generated+=" $gentop"
  8964.  
  8965.           func_extract_archives $gentop $dlprefiles
  8966.           libobjs+=" $func_extract_archives_result"
  8967.           test "X$libobjs" = "X " && libobjs=
  8968.         fi
  8969.  
  8970.         save_ifs="$IFS"; IFS='~'
  8971.         for cmd in $cmds; do
  8972.           IFS="$save_ifs"
  8973.           eval cmd=\"$cmd\"
  8974.           $opt_silent || {
  8975.             func_quote_for_expand "$cmd"
  8976.             eval "func_echo $func_quote_for_expand_result"
  8977.           }
  8978.           $opt_dry_run || eval "$cmd" || {
  8979.             lt_exit=$?
  8980.  
  8981.             # Restore the uninstalled library and exit
  8982.             if test "$opt_mode" = relink; then
  8983.               ( cd "$output_objdir" && \
  8984.                 $RM "${realname}T" && \
  8985.                 $MV "${realname}U" "$realname" )
  8986.             fi
  8987.  
  8988.             exit $lt_exit
  8989.           }
  8990.         done
  8991.         IFS="$save_ifs"
  8992.  
  8993.         # Restore the uninstalled library and exit
  8994.         if test "$opt_mode" = relink; then
  8995.           $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  8996.  
  8997.           if test -n "$convenience"; then
  8998.             if test -z "$whole_archive_flag_spec"; then
  8999.               func_show_eval '${RM}r "$gentop"'
  9000.             fi
  9001.           fi
  9002.  
  9003.           exit $EXIT_SUCCESS
  9004.         fi
  9005.  
  9006.         # Create links to the real library.
  9007.         for linkname in $linknames; do
  9008.           if test "$realname" != "$linkname"; then
  9009.             func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  9010.           fi
  9011.         done
  9012.  
  9013.         # If -module or -export-dynamic was specified, set the dlname.
  9014.         if test "$module" = yes || test "$export_dynamic" = yes; then
  9015.           # On all known operating systems, these are identical.
  9016.           dlname="$soname"
  9017.         fi
  9018.       fi
  9019.       ;;
  9020.  
  9021.     obj)
  9022.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  9023.         func_warning "\`-dlopen' is ignored for objects"
  9024.       fi
  9025.  
  9026.       case " $deplibs" in
  9027.       *\ -l* | *\ -L*)
  9028.         func_warning "\`-l' and \`-L' are ignored for objects" ;;
  9029.       esac
  9030.  
  9031.       test -n "$rpath" && \
  9032.         func_warning "\`-rpath' is ignored for objects"
  9033.  
  9034.       test -n "$xrpath" && \
  9035.         func_warning "\`-R' is ignored for objects"
  9036.  
  9037.       test -n "$vinfo" && \
  9038.         func_warning "\`-version-info' is ignored for objects"
  9039.  
  9040.       test -n "$release" && \
  9041.         func_warning "\`-release' is ignored for objects"
  9042.  
  9043.       case $output in
  9044.       *.lo)
  9045.         test -n "$objs$old_deplibs" && \
  9046.           func_fatal_error "cannot build library object \`$output' from non-libtool objects"
  9047.  
  9048.         libobj=$output
  9049.         func_lo2o "$libobj"
  9050.         obj=$func_lo2o_result
  9051.         ;;
  9052.       *)
  9053.         libobj=
  9054.         obj="$output"
  9055.         ;;
  9056.       esac
  9057.  
  9058.       # Delete the old objects.
  9059.       $opt_dry_run || $RM $obj $libobj
  9060.  
  9061.       # Objects from convenience libraries.  This assumes
  9062.       # single-version convenience libraries.  Whenever we create
  9063.       # different ones for PIC/non-PIC, this we'll have to duplicate
  9064.       # the extraction.
  9065.       reload_conv_objs=
  9066.       gentop=
  9067.       # reload_cmds runs $LD directly, so let us get rid of
  9068.       # -Wl from whole_archive_flag_spec and hope we can get by with
  9069.       # turning comma into space..
  9070.       wl=
  9071.  
  9072.       if test -n "$convenience"; then
  9073.         if test -n "$whole_archive_flag_spec"; then
  9074.           eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  9075.           reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  9076.         else
  9077.           gentop="$output_objdir/${obj}x"
  9078.           generated+=" $gentop"
  9079.  
  9080.           func_extract_archives $gentop $convenience
  9081.           reload_conv_objs="$reload_objs $func_extract_archives_result"
  9082.         fi
  9083.       fi
  9084.  
  9085.       # If we're not building shared, we need to use non_pic_objs
  9086.       test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
  9087.  
  9088.       # Create the old-style object.
  9089.       reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  9090.  
  9091.       output="$obj"
  9092.       func_execute_cmds "$reload_cmds" 'exit $?'
  9093.  
  9094.       # Exit if we aren't doing a library object file.
  9095.       if test -z "$libobj"; then
  9096.         if test -n "$gentop"; then
  9097.           func_show_eval '${RM}r "$gentop"'
  9098.         fi
  9099.  
  9100.         exit $EXIT_SUCCESS
  9101.       fi
  9102.  
  9103.       if test "$build_libtool_libs" != yes; then
  9104.         if test -n "$gentop"; then
  9105.           func_show_eval '${RM}r "$gentop"'
  9106.         fi
  9107.  
  9108.         # Create an invalid libtool object if no PIC, so that we don't
  9109.         # accidentally link it into a program.
  9110.         # $show "echo timestamp > $libobj"
  9111.         # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  9112.         exit $EXIT_SUCCESS
  9113.       fi
  9114.  
  9115.       if test -n "$pic_flag" || test "$pic_mode" != default; then
  9116.         # Only do commands if we really have different PIC objects.
  9117.         reload_objs="$libobjs $reload_conv_objs"
  9118.         output="$libobj"
  9119.         func_execute_cmds "$reload_cmds" 'exit $?'
  9120.       fi
  9121.  
  9122.       if test -n "$gentop"; then
  9123.         func_show_eval '${RM}r "$gentop"'
  9124.       fi
  9125.  
  9126.       exit $EXIT_SUCCESS
  9127.       ;;
  9128.  
  9129.     prog)
  9130.       case $host in
  9131.         *cygwin*) func_stripname '' '.exe' "$output"
  9132.                   output=$func_stripname_result.exe;;
  9133.       esac
  9134.       test -n "$vinfo" && \
  9135.         func_warning "\`-version-info' is ignored for programs"
  9136.  
  9137.       test -n "$release" && \
  9138.         func_warning "\`-release' is ignored for programs"
  9139.  
  9140.       test "$preload" = yes \
  9141.         && test "$dlopen_support" = unknown \
  9142.         && test "$dlopen_self" = unknown \
  9143.         && test "$dlopen_self_static" = unknown && \
  9144.           func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
  9145.  
  9146.       case $host in
  9147.       *-*-rhapsody* | *-*-darwin1.[012])
  9148.         # On Rhapsody replace the C library is the System framework
  9149.         compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9150.         finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9151.         ;;
  9152.       esac
  9153.  
  9154.       case $host in
  9155.       *-*-darwin*)
  9156.         # Don't allow lazy linking, it breaks C++ global constructors
  9157.         # But is supposedly fixed on 10.4 or later (yay!).
  9158.         if test "$tagname" = CXX ; then
  9159.           case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  9160.             10.[0123])
  9161.               compile_command+=" ${wl}-bind_at_load"
  9162.               finalize_command+=" ${wl}-bind_at_load"
  9163.             ;;
  9164.           esac
  9165.         fi
  9166.         # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9167.         compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9168.         finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9169.         ;;
  9170.       esac
  9171.  
  9172.  
  9173.       # move library search paths that coincide with paths to not yet
  9174.       # installed libraries to the beginning of the library search list
  9175.       new_libs=
  9176.       for path in $notinst_path; do
  9177.         case " $new_libs " in
  9178.         *" -L$path/$objdir "*) ;;
  9179.         *)
  9180.           case " $compile_deplibs " in
  9181.           *" -L$path/$objdir "*)
  9182.             new_libs+=" -L$path/$objdir" ;;
  9183.           esac
  9184.           ;;
  9185.         esac
  9186.       done
  9187.       for deplib in $compile_deplibs; do
  9188.         case $deplib in
  9189.         -L*)
  9190.           case " $new_libs " in
  9191.           *" $deplib "*) ;;
  9192.           *) new_libs+=" $deplib" ;;
  9193.           esac
  9194.           ;;
  9195.         *) new_libs+=" $deplib" ;;
  9196.         esac
  9197.       done
  9198.       compile_deplibs="$new_libs"
  9199.  
  9200.  
  9201.       compile_command+=" $compile_deplibs"
  9202.       finalize_command+=" $finalize_deplibs"
  9203.  
  9204.       if test -n "$rpath$xrpath"; then
  9205.         # If the user specified any rpath flags, then add them.
  9206.         for libdir in $rpath $xrpath; do
  9207.           # This is the magic to use -rpath.
  9208.           case "$finalize_rpath " in
  9209.           *" $libdir "*) ;;
  9210.           *) finalize_rpath+=" $libdir" ;;
  9211.           esac
  9212.         done
  9213.       fi
  9214.  
  9215.       # Now hardcode the library paths
  9216.       rpath=
  9217.       hardcode_libdirs=
  9218.       for libdir in $compile_rpath $finalize_rpath; do
  9219.         if test -n "$hardcode_libdir_flag_spec"; then
  9220.           if test -n "$hardcode_libdir_separator"; then
  9221.             if test -z "$hardcode_libdirs"; then
  9222.               hardcode_libdirs="$libdir"
  9223.             else
  9224.               # Just accumulate the unique libdirs.
  9225.               case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9226.               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9227.                 ;;
  9228.               *)
  9229.                 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
  9230.                 ;;
  9231.               esac
  9232.             fi
  9233.           else
  9234.             eval flag=\"$hardcode_libdir_flag_spec\"
  9235.             rpath+=" $flag"
  9236.           fi
  9237.         elif test -n "$runpath_var"; then
  9238.           case "$perm_rpath " in
  9239.           *" $libdir "*) ;;
  9240.           *) perm_rpath+=" $libdir" ;;
  9241.           esac
  9242.         fi
  9243.         case $host in
  9244.         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  9245.           testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
  9246.           case :$dllsearchpath: in
  9247.           *":$libdir:"*) ;;
  9248.           ::) dllsearchpath=$libdir;;
  9249.           *) dllsearchpath+=":$libdir";;
  9250.           esac
  9251.           case :$dllsearchpath: in
  9252.           *":$testbindir:"*) ;;
  9253.           ::) dllsearchpath=$testbindir;;
  9254.           *) dllsearchpath+=":$testbindir";;
  9255.           esac
  9256.           ;;
  9257.         esac
  9258.       done
  9259.       # Substitute the hardcoded libdirs into the rpath.
  9260.       if test -n "$hardcode_libdir_separator" &&
  9261.          test -n "$hardcode_libdirs"; then
  9262.         libdir="$hardcode_libdirs"
  9263.         eval rpath=\" $hardcode_libdir_flag_spec\"
  9264.       fi
  9265.       compile_rpath="$rpath"
  9266.  
  9267.       rpath=
  9268.       hardcode_libdirs=
  9269.       for libdir in $finalize_rpath; do
  9270.         if test -n "$hardcode_libdir_flag_spec"; then
  9271.           if test -n "$hardcode_libdir_separator"; then
  9272.             if test -z "$hardcode_libdirs"; then
  9273.               hardcode_libdirs="$libdir"
  9274.             else
  9275.               # Just accumulate the unique libdirs.
  9276.               case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9277.               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9278.                 ;;
  9279.               *)
  9280.                 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
  9281.                 ;;
  9282.               esac
  9283.             fi
  9284.           else
  9285.             eval flag=\"$hardcode_libdir_flag_spec\"
  9286.             rpath+=" $flag"
  9287.           fi
  9288.         elif test -n "$runpath_var"; then
  9289.           case "$finalize_perm_rpath " in
  9290.           *" $libdir "*) ;;
  9291.           *) finalize_perm_rpath+=" $libdir" ;;
  9292.           esac
  9293.         fi
  9294.       done
  9295.       # Substitute the hardcoded libdirs into the rpath.
  9296.       if test -n "$hardcode_libdir_separator" &&
  9297.          test -n "$hardcode_libdirs"; then
  9298.         libdir="$hardcode_libdirs"
  9299.         eval rpath=\" $hardcode_libdir_flag_spec\"
  9300.       fi
  9301.       finalize_rpath="$rpath"
  9302.  
  9303.       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  9304.         # Transform all the library objects into standard objects.
  9305.         compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9306.         finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9307.       fi
  9308.  
  9309.       func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
  9310.  
  9311.       # template prelinking step
  9312.       if test -n "$prelink_cmds"; then
  9313.         func_execute_cmds "$prelink_cmds" 'exit $?'
  9314.       fi
  9315.  
  9316.       wrappers_required=yes
  9317.       case $host in
  9318.       *cegcc* | *mingw32ce*)
  9319.         # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  9320.         wrappers_required=no
  9321.         ;;
  9322.       *cygwin* | *mingw* )
  9323.         if test "$build_libtool_libs" != yes; then
  9324.           wrappers_required=no
  9325.         fi
  9326.         ;;
  9327.       *)
  9328.         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  9329.           wrappers_required=no
  9330.         fi
  9331.         ;;
  9332.       esac
  9333.       if test "$wrappers_required" = no; then
  9334.         # Replace the output file specification.
  9335.         compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9336.         link_command="$compile_command$compile_rpath"
  9337.  
  9338.         # We have no uninstalled library dependencies, so finalize right now.
  9339.         exit_status=0
  9340.         func_show_eval "$link_command" 'exit_status=$?'
  9341.  
  9342.         if test -n "$postlink_cmds"; then
  9343.           func_to_tool_file "$output"
  9344.           postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9345.           func_execute_cmds "$postlink_cmds" 'exit $?'
  9346.         fi
  9347.  
  9348.         # Delete the generated files.
  9349.         if test -f "$output_objdir/${outputname}S.${objext}"; then
  9350.           func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
  9351.         fi
  9352.  
  9353.         exit $exit_status
  9354.       fi
  9355.  
  9356.       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  9357.         compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  9358.       fi
  9359.       if test -n "$finalize_shlibpath"; then
  9360.         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  9361.       fi
  9362.  
  9363.       compile_var=
  9364.       finalize_var=
  9365.       if test -n "$runpath_var"; then
  9366.         if test -n "$perm_rpath"; then
  9367.           # We should set the runpath_var.
  9368.           rpath=
  9369.           for dir in $perm_rpath; do
  9370.             rpath+="$dir:"
  9371.           done
  9372.           compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9373.         fi
  9374.         if test -n "$finalize_perm_rpath"; then
  9375.           # We should set the runpath_var.
  9376.           rpath=
  9377.           for dir in $finalize_perm_rpath; do
  9378.             rpath+="$dir:"
  9379.           done
  9380.           finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9381.         fi
  9382.       fi
  9383.  
  9384.       if test "$no_install" = yes; then
  9385.         # We don't need to create a wrapper script.
  9386.         link_command="$compile_var$compile_command$compile_rpath"
  9387.         # Replace the output file specification.
  9388.         link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9389.         # Delete the old output file.
  9390.         $opt_dry_run || $RM $output
  9391.         # Link the executable and exit
  9392.         func_show_eval "$link_command" 'exit $?'
  9393.  
  9394.         if test -n "$postlink_cmds"; then
  9395.           func_to_tool_file "$output"
  9396.           postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9397.           func_execute_cmds "$postlink_cmds" 'exit $?'
  9398.         fi
  9399.  
  9400.         exit $EXIT_SUCCESS
  9401.       fi
  9402.  
  9403.       if test "$hardcode_action" = relink; then
  9404.         # Fast installation is not supported
  9405.         link_command="$compile_var$compile_command$compile_rpath"
  9406.         relink_command="$finalize_var$finalize_command$finalize_rpath"
  9407.  
  9408.         func_warning "this platform does not like uninstalled shared libraries"
  9409.         func_warning "\`$output' will be relinked during installation"
  9410.       else
  9411.         if test "$fast_install" != no; then
  9412.           link_command="$finalize_var$compile_command$finalize_rpath"
  9413.           if test "$fast_install" = yes; then
  9414.             relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  9415.           else
  9416.             # fast_install is set to needless
  9417.             relink_command=
  9418.           fi
  9419.         else
  9420.           link_command="$compile_var$compile_command$compile_rpath"
  9421.           relink_command="$finalize_var$finalize_command$finalize_rpath"
  9422.         fi
  9423.       fi
  9424.  
  9425.       # Replace the output file specification.
  9426.       link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  9427.  
  9428.       # Delete the old output files.
  9429.       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  9430.  
  9431.       func_show_eval "$link_command" 'exit $?'
  9432.  
  9433.       if test -n "$postlink_cmds"; then
  9434.         func_to_tool_file "$output_objdir/$outputname"
  9435.         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'`
  9436.         func_execute_cmds "$postlink_cmds" 'exit $?'
  9437.       fi
  9438.  
  9439.       # Now create the wrapper script.
  9440.       func_verbose "creating $output"
  9441.  
  9442.       # Quote the relink command for shipping.
  9443.       if test -n "$relink_command"; then
  9444.         # Preserve any variables that may affect compiler behavior
  9445.         for var in $variables_saved_for_relink; do
  9446.           if eval test -z \"\${$var+set}\"; then
  9447.             relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9448.           elif eval var_value=\$$var; test -z "$var_value"; then
  9449.             relink_command="$var=; export $var; $relink_command"
  9450.           else
  9451.             func_quote_for_eval "$var_value"
  9452.             relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9453.           fi
  9454.         done
  9455.         relink_command="(cd `pwd`; $relink_command)"
  9456.         relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9457.       fi
  9458.  
  9459.       # Only actually do things if not in dry run mode.
  9460.       $opt_dry_run || {
  9461.         # win32 will think the script is a binary if it has
  9462.         # a .exe suffix, so we strip it off here.
  9463.         case $output in
  9464.           *.exe) func_stripname '' '.exe' "$output"
  9465.                  output=$func_stripname_result ;;
  9466.         esac
  9467.         # test for cygwin because mv fails w/o .exe extensions
  9468.         case $host in
  9469.           *cygwin*)
  9470.             exeext=.exe
  9471.             func_stripname '' '.exe' "$outputname"
  9472.             outputname=$func_stripname_result ;;
  9473.           *) exeext= ;;
  9474.         esac
  9475.         case $host in
  9476.           *cygwin* | *mingw* )
  9477.             func_dirname_and_basename "$output" "" "."
  9478.             output_name=$func_basename_result
  9479.             output_path=$func_dirname_result
  9480.             cwrappersource="$output_path/$objdir/lt-$output_name.c"
  9481.             cwrapper="$output_path/$output_name.exe"
  9482.             $RM $cwrappersource $cwrapper
  9483.             trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  9484.  
  9485.             func_emit_cwrapperexe_src > $cwrappersource
  9486.  
  9487.             # The wrapper executable is built using the $host compiler,
  9488.             # because it contains $host paths and files. If cross-
  9489.             # compiling, it, like the target executable, must be
  9490.             # executed on the $host or under an emulation environment.
  9491.             $opt_dry_run || {
  9492.               $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  9493.               $STRIP $cwrapper
  9494.             }
  9495.  
  9496.             # Now, create the wrapper script for func_source use:
  9497.             func_ltwrapper_scriptname $cwrapper
  9498.             $RM $func_ltwrapper_scriptname_result
  9499.             trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  9500.             $opt_dry_run || {
  9501.               # note: this script will not be executed, so do not chmod.
  9502.               if test "x$build" = "x$host" ; then
  9503.                 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  9504.               else
  9505.                 func_emit_wrapper no > $func_ltwrapper_scriptname_result
  9506.               fi
  9507.             }
  9508.           ;;
  9509.           * )
  9510.             $RM $output
  9511.             trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  9512.  
  9513.             func_emit_wrapper no > $output
  9514.             chmod +x $output
  9515.           ;;
  9516.         esac
  9517.       }
  9518.       exit $EXIT_SUCCESS
  9519.       ;;
  9520.     esac
  9521.  
  9522.     # See if we need to build an old-fashioned archive.
  9523.     for oldlib in $oldlibs; do
  9524.  
  9525.       if test "$build_libtool_libs" = convenience; then
  9526.         oldobjs="$libobjs_save $symfileobj"
  9527.         addlibs="$convenience"
  9528.         build_libtool_libs=no
  9529.       else
  9530.         if test "$build_libtool_libs" = module; then
  9531.           oldobjs="$libobjs_save"
  9532.           build_libtool_libs=no
  9533.         else
  9534.           oldobjs="$old_deplibs $non_pic_objects"
  9535.           if test "$preload" = yes && test -f "$symfileobj"; then
  9536.             oldobjs+=" $symfileobj"
  9537.           fi
  9538.         fi
  9539.         addlibs="$old_convenience"
  9540.       fi
  9541.  
  9542.       if test -n "$addlibs"; then
  9543.         gentop="$output_objdir/${outputname}x"
  9544.         generated+=" $gentop"
  9545.  
  9546.         func_extract_archives $gentop $addlibs
  9547.         oldobjs+=" $func_extract_archives_result"
  9548.       fi
  9549.  
  9550.       # Do each command in the archive commands.
  9551.       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  9552.         cmds=$old_archive_from_new_cmds
  9553.       else
  9554.  
  9555.         # Add any objects from preloaded convenience libraries
  9556.         if test -n "$dlprefiles"; then
  9557.           gentop="$output_objdir/${outputname}x"
  9558.           generated+=" $gentop"
  9559.  
  9560.           func_extract_archives $gentop $dlprefiles
  9561.           oldobjs+=" $func_extract_archives_result"
  9562.         fi
  9563.  
  9564.         # POSIX demands no paths to be encoded in archives.  We have
  9565.         # to avoid creating archives with duplicate basenames if we
  9566.         # might have to extract them afterwards, e.g., when creating a
  9567.         # static archive out of a convenience library, or when linking
  9568.         # the entirety of a libtool archive into another (currently
  9569.         # not supported by libtool).
  9570.         if (for obj in $oldobjs
  9571.             do
  9572.               func_basename "$obj"
  9573.               $ECHO "$func_basename_result"
  9574.             done | sort | sort -uc >/dev/null 2>&1); then
  9575.           :
  9576.         else
  9577.           echo "copying selected object files to avoid basename conflicts..."
  9578.           gentop="$output_objdir/${outputname}x"
  9579.           generated+=" $gentop"
  9580.           func_mkdir_p "$gentop"
  9581.           save_oldobjs=$oldobjs
  9582.           oldobjs=
  9583.           counter=1
  9584.           for obj in $save_oldobjs
  9585.           do
  9586.             func_basename "$obj"
  9587.             objbase="$func_basename_result"
  9588.             case " $oldobjs " in
  9589.             " ") oldobjs=$obj ;;
  9590.             *[\ /]"$objbase "*)
  9591.               while :; do
  9592.                 # Make sure we don't pick an alternate name that also
  9593.                 # overlaps.
  9594.                 newobj=lt$counter-$objbase
  9595.                 func_arith $counter + 1
  9596.                 counter=$func_arith_result
  9597.                 case " $oldobjs " in
  9598.                 *[\ /]"$newobj "*) ;;
  9599.                 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  9600.                 esac
  9601.               done
  9602.               func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  9603.               oldobjs+=" $gentop/$newobj"
  9604.               ;;
  9605.             *) oldobjs+=" $obj" ;;
  9606.             esac
  9607.           done
  9608.         fi
  9609.         func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  9610.         tool_oldlib=$func_to_tool_file_result
  9611.         eval cmds=\"$old_archive_cmds\"
  9612.  
  9613.         func_len " $cmds"
  9614.         len=$func_len_result
  9615.         if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9616.           cmds=$old_archive_cmds
  9617.         elif test -n "$archiver_list_spec"; then
  9618.           func_verbose "using command file archive linking..."
  9619.           for obj in $oldobjs
  9620.           do
  9621.             func_to_tool_file "$obj"
  9622.             $ECHO "$func_to_tool_file_result"
  9623.           done > $output_objdir/$libname.libcmd
  9624.           func_to_tool_file "$output_objdir/$libname.libcmd"
  9625.           oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  9626.           cmds=$old_archive_cmds
  9627.         else
  9628.           # the command line is too long to link in one step, link in parts
  9629.           func_verbose "using piecewise archive linking..."
  9630.           save_RANLIB=$RANLIB
  9631.           RANLIB=:
  9632.           objlist=
  9633.           concat_cmds=
  9634.           save_oldobjs=$oldobjs
  9635.           oldobjs=
  9636.           # Is there a better way of finding the last object in the list?
  9637.           for obj in $save_oldobjs
  9638.           do
  9639.             last_oldobj=$obj
  9640.           done
  9641.           eval test_cmds=\"$old_archive_cmds\"
  9642.           func_len " $test_cmds"
  9643.           len0=$func_len_result
  9644.           len=$len0
  9645.           for obj in $save_oldobjs
  9646.           do
  9647.             func_len " $obj"
  9648.             func_arith $len + $func_len_result
  9649.             len=$func_arith_result
  9650.             objlist+=" $obj"
  9651.             if test "$len" -lt "$max_cmd_len"; then
  9652.               :
  9653.             else
  9654.               # the above command should be used before it gets too long
  9655.               oldobjs=$objlist
  9656.               if test "$obj" = "$last_oldobj" ; then
  9657.                 RANLIB=$save_RANLIB
  9658.               fi
  9659.               test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9660.               eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  9661.               objlist=
  9662.               len=$len0
  9663.             fi
  9664.           done
  9665.           RANLIB=$save_RANLIB
  9666.           oldobjs=$objlist
  9667.           if test "X$oldobjs" = "X" ; then
  9668.             eval cmds=\"\$concat_cmds\"
  9669.           else
  9670.             eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  9671.           fi
  9672.         fi
  9673.       fi
  9674.       func_execute_cmds "$cmds" 'exit $?'
  9675.     done
  9676.  
  9677.     test -n "$generated" && \
  9678.       func_show_eval "${RM}r$generated"
  9679.  
  9680.     # Now create the libtool archive.
  9681.     case $output in
  9682.     *.la)
  9683.       old_library=
  9684.       test "$build_old_libs" = yes && old_library="$libname.$libext"
  9685.       func_verbose "creating $output"
  9686.  
  9687.       # Preserve any variables that may affect compiler behavior
  9688.       for var in $variables_saved_for_relink; do
  9689.         if eval test -z \"\${$var+set}\"; then
  9690.           relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9691.         elif eval var_value=\$$var; test -z "$var_value"; then
  9692.           relink_command="$var=; export $var; $relink_command"
  9693.         else
  9694.           func_quote_for_eval "$var_value"
  9695.           relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9696.         fi
  9697.       done
  9698.       # Quote the link command for shipping.
  9699.       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  9700.       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9701.       if test "$hardcode_automatic" = yes ; then
  9702.         relink_command=
  9703.       fi
  9704.  
  9705.       # Only create the output if not a dry run.
  9706.       $opt_dry_run || {
  9707.         for installed in no yes; do
  9708.           if test "$installed" = yes; then
  9709.             if test -z "$install_libdir"; then
  9710.               break
  9711.             fi
  9712.             output="$output_objdir/$outputname"i
  9713.             # Replace all uninstalled libtool libraries with the installed ones
  9714.             newdependency_libs=
  9715.             for deplib in $dependency_libs; do
  9716.               case $deplib in
  9717.               *.la)
  9718.                 func_basename "$deplib"
  9719.                 name="$func_basename_result"
  9720.                 func_resolve_sysroot "$deplib"
  9721.                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  9722.                 test -z "$libdir" && \
  9723.                   func_fatal_error "\`$deplib' is not a valid libtool archive"
  9724.                 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
  9725.                 ;;
  9726.               -L*)
  9727.                 func_stripname -L '' "$deplib"
  9728.                 func_replace_sysroot "$func_stripname_result"
  9729.                 newdependency_libs+=" -L$func_replace_sysroot_result"
  9730.                 ;;
  9731.               -R*)
  9732.                 func_stripname -R '' "$deplib"
  9733.                 func_replace_sysroot "$func_stripname_result"
  9734.                 newdependency_libs+=" -R$func_replace_sysroot_result"
  9735.                 ;;
  9736.               *) newdependency_libs+=" $deplib" ;;
  9737.               esac
  9738.             done
  9739.             dependency_libs="$newdependency_libs"
  9740.             newdlfiles=
  9741.  
  9742.             for lib in $dlfiles; do
  9743.               case $lib in
  9744.               *.la)
  9745.                 func_basename "$lib"
  9746.                 name="$func_basename_result"
  9747.                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9748.                 test -z "$libdir" && \
  9749.                   func_fatal_error "\`$lib' is not a valid libtool archive"
  9750.                 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
  9751.                 ;;
  9752.               *) newdlfiles+=" $lib" ;;
  9753.               esac
  9754.             done
  9755.             dlfiles="$newdlfiles"
  9756.             newdlprefiles=
  9757.             for lib in $dlprefiles; do
  9758.               case $lib in
  9759.               *.la)
  9760.                 # Only pass preopened files to the pseudo-archive (for
  9761.                 # eventual linking with the app. that links it) if we
  9762.                 # didn't already link the preopened objects directly into
  9763.                 # the library:
  9764.                 func_basename "$lib"
  9765.                 name="$func_basename_result"
  9766.                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9767.                 test -z "$libdir" && \
  9768.                   func_fatal_error "\`$lib' is not a valid libtool archive"
  9769.                 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
  9770.                 ;;
  9771.               esac
  9772.             done
  9773.             dlprefiles="$newdlprefiles"
  9774.           else
  9775.             newdlfiles=
  9776.             for lib in $dlfiles; do
  9777.               case $lib in
  9778.                 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  9779.                 *) abs=`pwd`"/$lib" ;;
  9780.               esac
  9781.               newdlfiles+=" $abs"
  9782.             done
  9783.             dlfiles="$newdlfiles"
  9784.             newdlprefiles=
  9785.             for lib in $dlprefiles; do
  9786.               case $lib in
  9787.                 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  9788.                 *) abs=`pwd`"/$lib" ;;
  9789.               esac
  9790.               newdlprefiles+=" $abs"
  9791.             done
  9792.             dlprefiles="$newdlprefiles"
  9793.           fi
  9794.           $RM $output
  9795.           # place dlname in correct position for cygwin
  9796.           # In fact, it would be nice if we could use this code for all target
  9797.           # systems that can't hard-code library paths into their executables
  9798.           # and that have no shared library path variable independent of PATH,
  9799.           # but it turns out we can't easily determine that from inspecting
  9800.           # libtool variables, so we have to hard-code the OSs to which it
  9801.           # applies here; at the moment, that means platforms that use the PE
  9802.           # object format with DLL files.  See the long comment at the top of
  9803.           # tests/bindir.at for full details.
  9804.           tdlname=$dlname
  9805.           case $host,$output,$installed,$module,$dlname in
  9806.             *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  9807.               # If a -bindir argument was supplied, place the dll there.
  9808.               if test "x$bindir" != x ;
  9809.               then
  9810.                 func_relative_path "$install_libdir" "$bindir"
  9811.                 tdlname=$func_relative_path_result$dlname
  9812.               else
  9813.                 # Otherwise fall back on heuristic.
  9814.                 tdlname=../bin/$dlname
  9815.               fi
  9816.               ;;
  9817.           esac
  9818.           $ECHO > $output "\
  9819. # $outputname - a libtool library file
  9820. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  9821. #
  9822. # Please DO NOT delete this file!
  9823. # It is necessary for linking the library.
  9824.  
  9825. # The name that we can dlopen(3).
  9826. dlname='$tdlname'
  9827.  
  9828. # Names of this library.
  9829. library_names='$library_names'
  9830.  
  9831. # The name of the static archive.
  9832. old_library='$old_library'
  9833.  
  9834. # Linker flags that can not go in dependency_libs.
  9835. inherited_linker_flags='$new_inherited_linker_flags'
  9836.  
  9837. # Libraries that this one depends upon.
  9838. dependency_libs='$dependency_libs'
  9839.  
  9840. # Names of additional weak libraries provided by this library
  9841. weak_library_names='$weak_libs'
  9842.  
  9843. # Version information for $libname.
  9844. current=$current
  9845. age=$age
  9846. revision=$revision
  9847.  
  9848. # Is this an already installed library?
  9849. installed=$installed
  9850.  
  9851. # Should we warn about portability when linking against -modules?
  9852. shouldnotlink=$module
  9853.  
  9854. # Files to dlopen/dlpreopen
  9855. dlopen='$dlfiles'
  9856. dlpreopen='$dlprefiles'
  9857.  
  9858. # Directory that this library needs to be installed in:
  9859. libdir='$install_libdir'"
  9860.           if test "$installed" = no && test "$need_relink" = yes; then
  9861.             $ECHO >> $output "\
  9862. relink_command=\"$relink_command\""
  9863.           fi
  9864.         done
  9865.       }
  9866.  
  9867.       # Do a symbolic link so that the libtool archive can be found in
  9868.       # LD_LIBRARY_PATH before the program is installed.
  9869.       func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  9870.       ;;
  9871.     esac
  9872.     exit $EXIT_SUCCESS
  9873. }
  9874.  
  9875. { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
  9876.     func_mode_link ${1+"$@"}
  9877.  
  9878.  
  9879. # func_mode_uninstall arg...
  9880. func_mode_uninstall ()
  9881. {
  9882.     $opt_debug
  9883.     RM="$nonopt"
  9884.     files=
  9885.     rmforce=
  9886.     exit_status=0
  9887.  
  9888.     # This variable tells wrapper scripts just to set variables rather
  9889.     # than running their programs.
  9890.     libtool_install_magic="$magic"
  9891.  
  9892.     for arg
  9893.     do
  9894.       case $arg in
  9895.       -f) RM+=" $arg"; rmforce=yes ;;
  9896.       -*) RM+=" $arg" ;;
  9897.       *) files+=" $arg" ;;
  9898.       esac
  9899.     done
  9900.  
  9901.     test -z "$RM" && \
  9902.       func_fatal_help "you must specify an RM program"
  9903.  
  9904.     rmdirs=
  9905.  
  9906.     for file in $files; do
  9907.       func_dirname "$file" "" "."
  9908.       dir="$func_dirname_result"
  9909.       if test "X$dir" = X.; then
  9910.         odir="$objdir"
  9911.       else
  9912.         odir="$dir/$objdir"
  9913.       fi
  9914.       func_basename "$file"
  9915.       name="$func_basename_result"
  9916.       test "$opt_mode" = uninstall && odir="$dir"
  9917.  
  9918.       # Remember odir for removal later, being careful to avoid duplicates
  9919.       if test "$opt_mode" = clean; then
  9920.         case " $rmdirs " in
  9921.           *" $odir "*) ;;
  9922.           *) rmdirs+=" $odir" ;;
  9923.         esac
  9924.       fi
  9925.  
  9926.       # Don't error if the file doesn't exist and rm -f was used.
  9927.       if { test -L "$file"; } >/dev/null 2>&1 ||
  9928.          { test -h "$file"; } >/dev/null 2>&1 ||
  9929.          test -f "$file"; then
  9930.         :
  9931.       elif test -d "$file"; then
  9932.         exit_status=1
  9933.         continue
  9934.       elif test "$rmforce" = yes; then
  9935.         continue
  9936.       fi
  9937.  
  9938.       rmfiles="$file"
  9939.  
  9940.       case $name in
  9941.       *.la)
  9942.         # Possibly a libtool archive, so verify it.
  9943.         if func_lalib_p "$file"; then
  9944.           func_source $dir/$name
  9945.  
  9946.           # Delete the libtool libraries and symlinks.
  9947.           for n in $library_names; do
  9948.             rmfiles+=" $odir/$n"
  9949.           done
  9950.           test -n "$old_library" && rmfiles+=" $odir/$old_library"
  9951.  
  9952.           case "$opt_mode" in
  9953.           clean)
  9954.             case " $library_names " in
  9955.             *" $dlname "*) ;;
  9956.             *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
  9957.             esac
  9958.             test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
  9959.             ;;
  9960.           uninstall)
  9961.             if test -n "$library_names"; then
  9962.               # Do each command in the postuninstall commands.
  9963.               func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  9964.             fi
  9965.  
  9966.             if test -n "$old_library"; then
  9967.               # Do each command in the old_postuninstall commands.
  9968.               func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  9969.             fi
  9970.             # FIXME: should reinstall the best remaining shared library.
  9971.             ;;
  9972.           esac
  9973.         fi
  9974.         ;;
  9975.  
  9976.       *.lo)
  9977.         # Possibly a libtool object, so verify it.
  9978.         if func_lalib_p "$file"; then
  9979.  
  9980.           # Read the .lo file
  9981.           func_source $dir/$name
  9982.  
  9983.           # Add PIC object to the list of files to remove.
  9984.           if test -n "$pic_object" &&
  9985.              test "$pic_object" != none; then
  9986.             rmfiles+=" $dir/$pic_object"
  9987.           fi
  9988.  
  9989.           # Add non-PIC object to the list of files to remove.
  9990.           if test -n "$non_pic_object" &&
  9991.              test "$non_pic_object" != none; then
  9992.             rmfiles+=" $dir/$non_pic_object"
  9993.           fi
  9994.         fi
  9995.         ;;
  9996.  
  9997.       *)
  9998.         if test "$opt_mode" = clean ; then
  9999.           noexename=$name
  10000.           case $file in
  10001.           *.exe)
  10002.             func_stripname '' '.exe' "$file"
  10003.             file=$func_stripname_result
  10004.             func_stripname '' '.exe' "$name"
  10005.             noexename=$func_stripname_result
  10006.             # $file with .exe has already been added to rmfiles,
  10007.             # add $file without .exe
  10008.             rmfiles+=" $file"
  10009.             ;;
  10010.           esac
  10011.           # Do a test to see if this is a libtool program.
  10012.           if func_ltwrapper_p "$file"; then
  10013.             if func_ltwrapper_executable_p "$file"; then
  10014.               func_ltwrapper_scriptname "$file"
  10015.               relink_command=
  10016.               func_source $func_ltwrapper_scriptname_result
  10017.               rmfiles+=" $func_ltwrapper_scriptname_result"
  10018.             else
  10019.               relink_command=
  10020.               func_source $dir/$noexename
  10021.             fi
  10022.  
  10023.             # note $name still contains .exe if it was in $file originally
  10024.             # as does the version of $file that was added into $rmfiles
  10025.             rmfiles+=" $odir/$name $odir/${name}S.${objext}"
  10026.             if test "$fast_install" = yes && test -n "$relink_command"; then
  10027.               rmfiles+=" $odir/lt-$name"
  10028.             fi
  10029.             if test "X$noexename" != "X$name" ; then
  10030.               rmfiles+=" $odir/lt-${noexename}.c"
  10031.             fi
  10032.           fi
  10033.         fi
  10034.         ;;
  10035.       esac
  10036.       func_show_eval "$RM $rmfiles" 'exit_status=1'
  10037.     done
  10038.  
  10039.     # Try to remove the ${objdir}s in the directories where we deleted files
  10040.     for dir in $rmdirs; do
  10041.       if test -d "$dir"; then
  10042.         func_show_eval "rmdir $dir >/dev/null 2>&1"
  10043.       fi
  10044.     done
  10045.  
  10046.     exit $exit_status
  10047. }
  10048.  
  10049. { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
  10050.     func_mode_uninstall ${1+"$@"}
  10051.  
  10052. test -z "$opt_mode" && {
  10053.   help="$generic_help"
  10054.   func_fatal_help "you must specify a MODE"
  10055. }
  10056.  
  10057. test -z "$exec_cmd" && \
  10058.   func_fatal_help "invalid operation mode \`$opt_mode'"
  10059.  
  10060. if test -n "$exec_cmd"; then
  10061.   eval exec "$exec_cmd"
  10062.   exit $EXIT_FAILURE
  10063. fi
  10064.  
  10065. exit $exit_status
  10066.  
  10067.  
  10068. # The TAGs below are defined such that we never get into a situation
  10069. # in which we disable both kinds of libraries.  Given conflicting
  10070. # choices, we go for a static library, that is the most portable,
  10071. # since we can't tell whether shared libraries were disabled because
  10072. # the user asked for that or because the platform doesn't support
  10073. # them.  This is particularly important on AIX, because we don't
  10074. # support having both static and shared libraries enabled at the same
  10075. # time on that platform, so we default to a shared-only configuration.
  10076. # If a disable-shared tag is given, we'll fallback to a static-only
  10077. # configuration.  But we'll never go from static-only to shared-only.
  10078.  
  10079. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  10080. build_libtool_libs=no
  10081. build_old_libs=yes
  10082. # ### END LIBTOOL TAG CONFIG: disable-shared
  10083.  
  10084. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  10085. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  10086. # ### END LIBTOOL TAG CONFIG: disable-static
  10087.  
  10088. # Local Variables:
  10089. # mode:shell-script
  10090. # sh-indentation:2
  10091. # End:
  10092. # vi:sw=2
  10093.  
  10094.