Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

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