5 kx #! /bin/sh
5 kx
5 kx # libtool (GNU @PACKAGE@) @VERSION@
5 kx # Provide generalized library-building support services.
5 kx # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 kx
5 kx # Copyright (C) 1996-2015 Free Software Foundation, Inc.
5 kx # This is free software; see the source for copying conditions. There is NO
5 kx # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 kx
5 kx # GNU Libtool is free software; you can redistribute it and/or modify
5 kx # it under the terms of the GNU General Public License as published by
5 kx # the Free Software Foundation; either version 2 of the License, or
5 kx # (at your option) any later version.
5 kx #
5 kx # As a special exception to the GNU General Public License,
5 kx # if you distribute this file as part of a program or library that
5 kx # is built using GNU Libtool, you may include this file under the
5 kx # same distribution terms that you use for the rest of that program.
5 kx #
5 kx # GNU Libtool is distributed in the hope that it will be useful, but
5 kx # WITHOUT ANY WARRANTY; without even the implied warranty of
5 kx # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5 kx # General Public License for more details.
5 kx #
5 kx # You should have received a copy of the GNU General Public License
5 kx # along with this program. If not, see <http://www.gnu.org/licenses/>.
5 kx
5 kx
5 kx PROGRAM=libtool
5 kx PACKAGE=@PACKAGE@
5 kx VERSION=@VERSION@
5 kx package_revision=@package_revision@
5 kx
5 kx
5 kx ## ------ ##
5 kx ## Usage. ##
5 kx ## ------ ##
5 kx
5 kx # Run './libtool --help' for help with using this script from the
5 kx # command line.
5 kx
5 kx
5 kx ## ------------------------------- ##
5 kx ## User overridable command paths. ##
5 kx ## ------------------------------- ##
5 kx
5 kx # After configure completes, it has a better idea of some of the
5 kx # shell tools we need than the defaults used by the functions shared
5 kx # with bootstrap, so set those here where they can still be over-
5 kx # ridden by the user, but otherwise take precedence.
5 kx
5 kx : ${AUTOCONF="autoconf"}
5 kx : ${AUTOMAKE="automake"}
5 kx
5 kx
5 kx ## -------------------------- ##
5 kx ## Source external libraries. ##
5 kx ## -------------------------- ##
5 kx
5 kx # Much of our low-level functionality needs to be sourced from external
5 kx # libraries, which are installed to $pkgauxdir.
5 kx
5 kx . `echo "$0" |${SED-sed} 's|[^/]*$||'`"funclib.sh"
5 kx . `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser"
5 kx
5 kx # Set a version string.
5 kx scriptversion='(GNU @PACKAGE@) @VERSION@'
5 kx
5 kx
5 kx # func_echo ARG...
5 kx # ----------------
5 kx # Libtool also displays the current mode in messages, so override
5 kx # funclib.sh func_echo with this custom definition.
5 kx func_echo ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx _G_message=$*
5 kx
5 kx func_echo_IFS=$IFS
5 kx IFS=$nl
5 kx for _G_line in $_G_message; do
5 kx IFS=$func_echo_IFS
5 kx $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
5 kx done
5 kx IFS=$func_echo_IFS
5 kx }
5 kx
5 kx
5 kx # func_warning ARG...
5 kx # -------------------
5 kx # Libtool warnings are not categorized, so override funclib.sh
5 kx # func_warning with this simpler definition.
5 kx func_warning ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx $warning_func ${1+"$@"}
5 kx }
5 kx
5 kx
5 kx ## ---------------- ##
5 kx ## Options parsing. ##
5 kx ## ---------------- ##
5 kx
5 kx # Hook in the functions to make sure our own options are parsed during
5 kx # the option parsing loop.
5 kx
5 kx usage='$progpath [OPTION]... [MODE-ARG]...'
5 kx
5 kx # Short help message in response to '-h'.
5 kx usage_message="Options:
5 kx --config show all configuration variables
5 kx --debug enable verbose shell tracing
5 kx -n, --dry-run display commands without modifying any files
5 kx --features display basic configuration information and exit
5 kx --mode=MODE use operation mode MODE
5 kx --no-warnings equivalent to '-Wnone'
5 kx --preserve-dup-deps don't remove duplicate dependency libraries
5 kx --quiet, --silent don't print informational messages
5 kx --tag=TAG use configuration variables from tag TAG
5 kx -v, --verbose print more informational messages than default
5 kx --version print version information
5 kx -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
5 kx -h, --help, --help-all print short, long, or detailed help message
5 kx "
5 kx
5 kx # Additional text appended to 'usage_message' in response to '--help'.
5 kx func_help ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_usage_message
5 kx $ECHO "$long_help_message
5 kx
5 kx MODE must be one of the following:
5 kx
5 kx clean remove files from the build directory
5 kx compile compile a source file into a libtool object
5 kx execute automatically set library path, then run a program
5 kx finish complete the installation of libtool libraries
5 kx install install libraries or executables
5 kx link create a library or an executable
5 kx uninstall remove libraries from an installed directory
5 kx
5 kx MODE-ARGS vary depending on the MODE. When passed as first option,
5 kx '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
5 kx Try '$progname --help --mode=MODE' for a more detailed description of MODE.
5 kx
5 kx When reporting a bug, please describe a test case to reproduce it and
5 kx include the following information:
5 kx
5 kx host-triplet: $host
5 kx shell: $SHELL
5 kx compiler: $LTCC
5 kx compiler flags: $LTCFLAGS
5 kx linker: $LD (gnu? $with_gnu_ld)
5 kx version: $progname (GNU @PACKAGE@) @VERSION@
5 kx automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
5 kx autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
5 kx
5 kx Report bugs to <@PACKAGE_BUGREPORT@>.
5 kx GNU @PACKAGE@ home page: <@PACKAGE_URL@>.
5 kx General help using GNU software: <http://www.gnu.org/gethelp/>."
5 kx exit 0
5 kx }
5 kx
5 kx
5 kx # func_lo2o OBJECT-NAME
5 kx # ---------------------
5 kx # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
5 kx # object suffix.
5 kx
5 kx lo2o=s/\\.lo\$/.$objext/
5 kx o2lo=s/\\.$objext\$/.lo/
5 kx
5 kx if test yes = "$_G_HAVE_XSI_OPS"; then
5 kx eval 'func_lo2o ()
5 kx {
5 kx case $1 in
5 kx *.lo) func_lo2o_result=${1%.lo}.$objext ;;
5 kx * ) func_lo2o_result=$1 ;;
5 kx esac
5 kx }'
5 kx
5 kx # func_xform LIBOBJ-OR-SOURCE
5 kx # ---------------------------
5 kx # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
5 kx # suffix to a '.lo' libtool-object suffix.
5 kx eval 'func_xform ()
5 kx {
5 kx func_xform_result=${1%.*}.lo
5 kx }'
5 kx else
5 kx # ...otherwise fall back to using sed.
5 kx func_lo2o ()
5 kx {
5 kx func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
5 kx }
5 kx
5 kx func_xform ()
5 kx {
5 kx func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
5 kx }
5 kx fi
5 kx
5 kx
5 kx # func_fatal_configuration ARG...
5 kx # -------------------------------
5 kx # Echo program name prefixed message to standard error, followed by
5 kx # a configuration failure hint, and exit.
5 kx func_fatal_configuration ()
5 kx {
5 kx func__fatal_error ${1+"$@"} \
5 kx "See the $PACKAGE documentation for more information." \
5 kx "Fatal configuration error."
5 kx }
5 kx
5 kx
5 kx # func_config
5 kx # -----------
5 kx # Display the configuration for all the tags in this script.
5 kx func_config ()
5 kx {
5 kx re_begincf='^# ### BEGIN LIBTOOL'
5 kx re_endcf='^# ### END LIBTOOL'
5 kx
5 kx # Default configuration.
5 kx $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
5 kx
5 kx # Now print the configurations for the tags.
5 kx for tagname in $taglist; do
5 kx $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
5 kx done
5 kx
5 kx exit $?
5 kx }
5 kx
5 kx
5 kx # func_features
5 kx # -------------
5 kx # Display the features supported by this script.
5 kx func_features ()
5 kx {
5 kx echo "host: $host"
5 kx if test yes = "$build_libtool_libs"; then
5 kx echo "enable shared libraries"
5 kx else
5 kx echo "disable shared libraries"
5 kx fi
5 kx if test yes = "$build_old_libs"; then
5 kx echo "enable static libraries"
5 kx else
5 kx echo "disable static libraries"
5 kx fi
5 kx
5 kx exit $?
5 kx }
5 kx
5 kx
5 kx # func_enable_tag TAGNAME
5 kx # -----------------------
5 kx # Verify that TAGNAME is valid, and either flag an error and exit, or
5 kx # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
5 kx # variable here.
5 kx func_enable_tag ()
5 kx {
5 kx # Global variable:
5 kx tagname=$1
5 kx
5 kx re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
5 kx re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
5 kx sed_extractcf=/$re_begincf/,/$re_endcf/p
5 kx
5 kx # Validate tagname.
5 kx case $tagname in
5 kx *[!-_A-Za-z0-9,/]*)
5 kx func_fatal_error "invalid tag name: $tagname"
5 kx ;;
5 kx esac
5 kx
5 kx # Don't test for the "default" C tag, as we know it's
5 kx # there but not specially marked.
5 kx case $tagname in
5 kx CC) ;;
5 kx *)
5 kx if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
5 kx taglist="$taglist $tagname"
5 kx
5 kx # Evaluate the configuration. Be careful to quote the path
5 kx # and the sed script, to avoid splitting on whitespace, but
5 kx # also don't use non-portable quotes within backquotes within
5 kx # quotes we have to do it in 2 steps:
5 kx extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
5 kx eval "$extractedcf"
5 kx else
5 kx func_error "ignoring unknown tag $tagname"
5 kx fi
5 kx ;;
5 kx esac
5 kx }
5 kx
5 kx
5 kx # func_check_version_match
5 kx # ------------------------
5 kx # Ensure that we are using m4 macros, and libtool script from the same
5 kx # release of libtool.
5 kx func_check_version_match ()
5 kx {
5 kx if test "$package_revision" != "$macro_revision"; then
5 kx if test "$VERSION" != "$macro_version"; then
5 kx if test -z "$macro_version"; then
5 kx cat >&2 <<_LT_EOF
5 kx $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
5 kx $progname: definition of this LT_INIT comes from an older release.
5 kx $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
5 kx $progname: and run autoconf again.
5 kx _LT_EOF
5 kx else
5 kx cat >&2 <<_LT_EOF
5 kx $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
5 kx $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
5 kx $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
5 kx $progname: and run autoconf again.
5 kx _LT_EOF
5 kx fi
5 kx else
5 kx cat >&2 <<_LT_EOF
5 kx $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
5 kx $progname: but the definition of this LT_INIT comes from revision $macro_revision.
5 kx $progname: You should recreate aclocal.m4 with macros from revision $package_revision
5 kx $progname: of $PACKAGE $VERSION and run autoconf again.
5 kx _LT_EOF
5 kx fi
5 kx
5 kx exit $EXIT_MISMATCH
5 kx fi
5 kx }
5 kx
5 kx
5 kx # libtool_options_prep [ARG]...
5 kx # -----------------------------
5 kx # Preparation for options parsed by libtool.
5 kx libtool_options_prep ()
5 kx {
5 kx $debug_mode
5 kx
5 kx # Option defaults:
5 kx opt_config=false
5 kx opt_dlopen=
5 kx opt_dry_run=false
5 kx opt_help=false
5 kx opt_mode=
5 kx opt_preserve_dup_deps=false
5 kx opt_quiet=false
5 kx
5 kx nonopt=
5 kx preserve_args=
5 kx
5 kx # Shorthand for --mode=foo, only valid as the first argument
5 kx case $1 in
5 kx clean|clea|cle|cl)
5 kx shift; set dummy --mode clean ${1+"$@"}; shift
5 kx ;;
5 kx compile|compil|compi|comp|com|co|c)
5 kx shift; set dummy --mode compile ${1+"$@"}; shift
5 kx ;;
5 kx execute|execut|execu|exec|exe|ex|e)
5 kx shift; set dummy --mode execute ${1+"$@"}; shift
5 kx ;;
5 kx finish|finis|fini|fin|fi|f)
5 kx shift; set dummy --mode finish ${1+"$@"}; shift
5 kx ;;
5 kx install|instal|insta|inst|ins|in|i)
5 kx shift; set dummy --mode install ${1+"$@"}; shift
5 kx ;;
5 kx link|lin|li|l)
5 kx shift; set dummy --mode link ${1+"$@"}; shift
5 kx ;;
5 kx uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
5 kx shift; set dummy --mode uninstall ${1+"$@"}; shift
5 kx ;;
5 kx esac
5 kx
5 kx # Pass back the list of options.
5 kx func_quote_for_eval ${1+"$@"}
5 kx libtool_options_prep_result=$func_quote_for_eval_result
5 kx }
5 kx func_add_hook func_options_prep libtool_options_prep
5 kx
5 kx
5 kx # libtool_parse_options [ARG]...
5 kx # ---------------------------------
5 kx # Provide handling for libtool specific options.
5 kx libtool_parse_options ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx # Perform our own loop to consume as many options as possible in
5 kx # each iteration.
5 kx while test $# -gt 0; do
5 kx _G_opt=$1
5 kx shift
5 kx case $_G_opt in
5 kx --dry-run|--dryrun|-n)
5 kx opt_dry_run=:
5 kx ;;
5 kx
5 kx --config) func_config ;;
5 kx
5 kx --dlopen|-dlopen)
5 kx opt_dlopen="${opt_dlopen+$opt_dlopen
5 kx }$1"
5 kx shift
5 kx ;;
5 kx
5 kx --preserve-dup-deps)
5 kx opt_preserve_dup_deps=: ;;
5 kx
5 kx --features) func_features ;;
5 kx
5 kx --finish) set dummy --mode finish ${1+"$@"}; shift ;;
5 kx
5 kx --help) opt_help=: ;;
5 kx
5 kx --help-all) opt_help=': help-all' ;;
5 kx
5 kx --mode) test $# = 0 && func_missing_arg $_G_opt && break
5 kx opt_mode=$1
5 kx case $1 in
5 kx # Valid mode arguments:
5 kx clean|compile|execute|finish|install|link|relink|uninstall) ;;
5 kx
5 kx # Catch anything else as an error
5 kx *) func_error "invalid argument for $_G_opt"
5 kx exit_cmd=exit
5 kx break
5 kx ;;
5 kx esac
5 kx shift
5 kx ;;
5 kx
5 kx --no-silent|--no-quiet)
5 kx opt_quiet=false
5 kx func_append preserve_args " $_G_opt"
5 kx ;;
5 kx
5 kx --no-warnings|--no-warning|--no-warn)
5 kx opt_warning=false
5 kx func_append preserve_args " $_G_opt"
5 kx ;;
5 kx
5 kx --no-verbose)
5 kx opt_verbose=false
5 kx func_append preserve_args " $_G_opt"
5 kx ;;
5 kx
5 kx --silent|--quiet)
5 kx opt_quiet=:
5 kx opt_verbose=false
5 kx func_append preserve_args " $_G_opt"
5 kx ;;
5 kx
5 kx --tag) test $# = 0 && func_missing_arg $_G_opt && break
5 kx opt_tag=$1
5 kx func_append preserve_args " $_G_opt $1"
5 kx func_enable_tag "$1"
5 kx shift
5 kx ;;
5 kx
5 kx --verbose|-v) opt_quiet=false
5 kx opt_verbose=:
5 kx func_append preserve_args " $_G_opt"
5 kx ;;
5 kx
5 kx # An option not handled by this hook function:
5 kx *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
5 kx esac
5 kx done
5 kx
5 kx
5 kx # save modified positional parameters for caller
5 kx func_quote_for_eval ${1+"$@"}
5 kx libtool_parse_options_result=$func_quote_for_eval_result
5 kx }
5 kx func_add_hook func_parse_options libtool_parse_options
5 kx
5 kx
5 kx
5 kx # libtool_validate_options [ARG]...
5 kx # ---------------------------------
5 kx # Perform any sanity checks on option settings and/or unconsumed
5 kx # arguments.
5 kx libtool_validate_options ()
5 kx {
5 kx # save first non-option argument
5 kx if test 0 -lt $#; then
5 kx nonopt=$1
5 kx shift
5 kx fi
5 kx
5 kx # preserve --debug
5 kx test : = "$debug_cmd" || func_append preserve_args " --debug"
5 kx
5 kx case $host in
5 kx # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
5 kx # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
5 kx *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
5 kx # don't eliminate duplications in $postdeps and $predeps
5 kx opt_duplicate_compiler_generated_deps=:
5 kx ;;
5 kx *)
5 kx opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
5 kx ;;
5 kx esac
5 kx
5 kx $opt_help || {
5 kx # Sanity checks first:
5 kx func_check_version_match
5 kx
5 kx test yes != "$build_libtool_libs" \
5 kx && test yes != "$build_old_libs" \
5 kx && func_fatal_configuration "not configured to build any kind of library"
5 kx
5 kx # Darwin sucks
5 kx eval std_shrext=\"$shrext_cmds\"
5 kx
5 kx # Only execute mode is allowed to have -dlopen flags.
5 kx if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
5 kx func_error "unrecognized option '-dlopen'"
5 kx $ECHO "$help" 1>&2
5 kx exit $EXIT_FAILURE
5 kx fi
5 kx
5 kx # Change the help message to a mode-specific one.
5 kx generic_help=$help
5 kx help="Try '$progname --help --mode=$opt_mode' for more information."
5 kx }
5 kx
5 kx # Pass back the unparsed argument list
5 kx func_quote_for_eval ${1+"$@"}
5 kx libtool_validate_options_result=$func_quote_for_eval_result
5 kx }
5 kx func_add_hook func_validate_options libtool_validate_options
5 kx
5 kx
5 kx # Process options as early as possible so that --help and --version
5 kx # can return quickly.
5 kx func_options ${1+"$@"}
5 kx eval set dummy "$func_options_result"; shift
5 kx
5 kx
5 kx
5 kx ## ----------- ##
5 kx ## Main. ##
5 kx ## ----------- ##
5 kx
5 kx magic='%%%MAGIC variable%%%'
5 kx magic_exe='%%%MAGIC EXE variable%%%'
5 kx
5 kx # Global variables.
5 kx extracted_archives=
5 kx extracted_serial=0
5 kx
5 kx # If this variable is set in any of the actions, the command in it
5 kx # will be execed at the end. This prevents here-documents from being
5 kx # left over by shells.
5 kx exec_cmd=
5 kx
5 kx
5 kx # A function that is used when there is no print builtin or printf.
5 kx func_fallback_echo ()
5 kx {
5 kx eval 'cat <<_LTECHO_EOF
5 kx $1
5 kx _LTECHO_EOF'
5 kx }
5 kx
5 kx # func_generated_by_libtool
5 kx # True iff stdin has been generated by Libtool. This function is only
5 kx # a basic sanity check; it will hardly flush out determined imposters.
5 kx func_generated_by_libtool_p ()
5 kx {
5 kx $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
5 kx }
5 kx
5 kx # func_lalib_p file
5 kx # True iff FILE is a libtool '.la' library or '.lo' object file.
5 kx # This function is only a basic sanity check; it will hardly flush out
5 kx # determined imposters.
5 kx func_lalib_p ()
5 kx {
5 kx test -f "$1" &&
5 kx $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
5 kx }
5 kx
5 kx # func_lalib_unsafe_p file
5 kx # True iff FILE is a libtool '.la' library or '.lo' object file.
5 kx # This function implements the same check as func_lalib_p without
5 kx # resorting to external programs. To this end, it redirects stdin and
5 kx # closes it afterwards, without saving the original file descriptor.
5 kx # As a safety measure, use it only where a negative result would be
5 kx # fatal anyway. Works if 'file' does not exist.
5 kx func_lalib_unsafe_p ()
5 kx {
5 kx lalib_p=no
5 kx if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
5 kx for lalib_p_l in 1 2 3 4
5 kx do
5 kx read lalib_p_line
5 kx case $lalib_p_line in
5 kx \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
5 kx esac
5 kx done
5 kx exec 0<&5 5<&-
5 kx fi
5 kx test yes = "$lalib_p"
5 kx }
5 kx
5 kx # func_ltwrapper_script_p file
5 kx # True iff FILE is a libtool wrapper script
5 kx # This function is only a basic sanity check; it will hardly flush out
5 kx # determined imposters.
5 kx func_ltwrapper_script_p ()
5 kx {
5 kx test -f "$1" &&
5 kx $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
5 kx }
5 kx
5 kx # func_ltwrapper_executable_p file
5 kx # True iff FILE is a libtool wrapper executable
5 kx # This function is only a basic sanity check; it will hardly flush out
5 kx # determined imposters.
5 kx func_ltwrapper_executable_p ()
5 kx {
5 kx func_ltwrapper_exec_suffix=
5 kx case $1 in
5 kx *.exe) ;;
5 kx *) func_ltwrapper_exec_suffix=.exe ;;
5 kx esac
5 kx $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
5 kx }
5 kx
5 kx # func_ltwrapper_scriptname file
5 kx # Assumes file is an ltwrapper_executable
5 kx # uses $file to determine the appropriate filename for a
5 kx # temporary ltwrapper_script.
5 kx func_ltwrapper_scriptname ()
5 kx {
5 kx func_dirname_and_basename "$1" "" "."
5 kx func_stripname '' '.exe' "$func_basename_result"
5 kx func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
5 kx }
5 kx
5 kx # func_ltwrapper_p file
5 kx # True iff FILE is a libtool wrapper script or wrapper executable
5 kx # This function is only a basic sanity check; it will hardly flush out
5 kx # determined imposters.
5 kx func_ltwrapper_p ()
5 kx {
5 kx func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
5 kx }
5 kx
5 kx
5 kx # func_execute_cmds commands fail_cmd
5 kx # Execute tilde-delimited COMMANDS.
5 kx # If FAIL_CMD is given, eval that upon failure.
5 kx # FAIL_CMD may read-access the current command in variable CMD!
5 kx func_execute_cmds ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx save_ifs=$IFS; IFS='~'
5 kx for cmd in $1; do
5 kx IFS=$sp$nl
5 kx eval cmd=\"$cmd\"
5 kx IFS=$save_ifs
5 kx func_show_eval "$cmd" "${2-:}"
5 kx done
5 kx IFS=$save_ifs
5 kx }
5 kx
5 kx
5 kx # func_source file
5 kx # Source FILE, adding directory component if necessary.
5 kx # Note that it is not necessary on cygwin/mingw to append a dot to
5 kx # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
5 kx # behavior happens only for exec(3), not for open(2)! Also, sourcing
5 kx # 'FILE.' does not work on cygwin managed mounts.
5 kx func_source ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx case $1 in
5 kx */* | *\\*) . "$1" ;;
5 kx *) . "./$1" ;;
5 kx esac
5 kx }
5 kx
5 kx
5 kx # func_resolve_sysroot PATH
5 kx # Replace a leading = in PATH with a sysroot. Store the result into
5 kx # func_resolve_sysroot_result
5 kx func_resolve_sysroot ()
5 kx {
5 kx func_resolve_sysroot_result=$1
5 kx case $func_resolve_sysroot_result in
5 kx =*)
5 kx func_stripname '=' '' "$func_resolve_sysroot_result"
5 kx func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
5 kx ;;
5 kx esac
5 kx }
5 kx
5 kx # func_replace_sysroot PATH
5 kx # If PATH begins with the sysroot, replace it with = and
5 kx # store the result into func_replace_sysroot_result.
5 kx func_replace_sysroot ()
5 kx {
5 kx case $lt_sysroot:$1 in
5 kx ?*:"$lt_sysroot"*)
5 kx func_stripname "$lt_sysroot" '' "$1"
5 kx func_replace_sysroot_result='='$func_stripname_result
5 kx ;;
5 kx *)
5 kx # Including no sysroot.
5 kx func_replace_sysroot_result=$1
5 kx ;;
5 kx esac
5 kx }
5 kx
5 kx # func_infer_tag arg
5 kx # Infer tagged configuration to use if any are available and
5 kx # if one wasn't chosen via the "--tag" command line option.
5 kx # Only attempt this if the compiler in the base compile
5 kx # command doesn't match the default compiler.
5 kx # arg is usually of the form 'gcc ...'
5 kx func_infer_tag ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx if test -n "$available_tags" && test -z "$tagname"; then
5 kx CC_quoted=
5 kx for arg in $CC; do
5 kx func_append_quoted CC_quoted "$arg"
5 kx done
5 kx CC_expanded=`func_echo_all $CC`
5 kx CC_quoted_expanded=`func_echo_all $CC_quoted`
5 kx case $@ in
5 kx # Blanks in the command may have been stripped by the calling shell,
5 kx # but not from the CC environment variable when configure was run.
5 kx " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
5 kx " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
5 kx # Blanks at the start of $base_compile will cause this to fail
5 kx # if we don't check for them as well.
5 kx *)
5 kx for z in $available_tags; do
5 kx if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
5 kx # Evaluate the configuration.
5 kx eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
5 kx CC_quoted=
5 kx for arg in $CC; do
5 kx # Double-quote args containing other shell metacharacters.
5 kx func_append_quoted CC_quoted "$arg"
5 kx done
5 kx CC_expanded=`func_echo_all $CC`
5 kx CC_quoted_expanded=`func_echo_all $CC_quoted`
5 kx case "$@ " in
5 kx " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
5 kx " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
5 kx # The compiler in the base compile command matches
5 kx # the one in the tagged configuration.
5 kx # Assume this is the tagged configuration we want.
5 kx tagname=$z
5 kx break
5 kx ;;
5 kx esac
5 kx fi
5 kx done
5 kx # If $tagname still isn't set, then no tagged configuration
5 kx # was found and let the user know that the "--tag" command
5 kx # line option must be used.
5 kx if test -z "$tagname"; then
5 kx func_echo "unable to infer tagged configuration"
5 kx func_fatal_error "specify a tag with '--tag'"
5 kx # else
5 kx # func_verbose "using $tagname tagged configuration"
5 kx fi
5 kx ;;
5 kx esac
5 kx fi
5 kx }
5 kx
5 kx
5 kx
5 kx # func_write_libtool_object output_name pic_name nonpic_name
5 kx # Create a libtool object file (analogous to a ".la" file),
5 kx # but don't create it if we're doing a dry run.
5 kx func_write_libtool_object ()
5 kx {
5 kx write_libobj=$1
5 kx if test yes = "$build_libtool_libs"; then
5 kx write_lobj=\'$2\'
5 kx else
5 kx write_lobj=none
5 kx fi
5 kx
5 kx if test yes = "$build_old_libs"; then
5 kx write_oldobj=\'$3\'
5 kx else
5 kx write_oldobj=none
5 kx fi
5 kx
5 kx $opt_dry_run || {
5 kx cat >${write_libobj}T <<EOF
5 kx # $write_libobj - a libtool object file
5 kx # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5 kx #
5 kx # Please DO NOT delete this file!
5 kx # It is necessary for linking the library.
5 kx
5 kx # Name of the PIC object.
5 kx pic_object=$write_lobj
5 kx
5 kx # Name of the non-PIC object
5 kx non_pic_object=$write_oldobj
5 kx
5 kx EOF
5 kx $MV "${write_libobj}T" "$write_libobj"
5 kx }
5 kx }
5 kx
5 kx
5 kx ##################################################
5 kx # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
5 kx ##################################################
5 kx
5 kx # func_convert_core_file_wine_to_w32 ARG
5 kx # Helper function used by file name conversion functions when $build is *nix,
5 kx # and $host is mingw, cygwin, or some other w32 environment. Relies on a
5 kx # correctly configured wine environment available, with the winepath program
5 kx # in $build's $PATH.
5 kx #
5 kx # ARG is the $build file name to be converted to w32 format.
5 kx # Result is available in $func_convert_core_file_wine_to_w32_result, and will
5 kx # be empty on error (or when ARG is empty)
5 kx func_convert_core_file_wine_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_convert_core_file_wine_to_w32_result=$1
5 kx if test -n "$1"; then
5 kx # Unfortunately, winepath does not exit with a non-zero error code, so we
5 kx # are forced to check the contents of stdout. On the other hand, if the
5 kx # command is not found, the shell will set an exit code of 127 and print
5 kx # *an error message* to stdout. So we must check for both error code of
5 kx # zero AND non-empty stdout, which explains the odd construction:
5 kx func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
5 kx if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
5 kx func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
5 kx $SED -e "$sed_naive_backslashify"`
5 kx else
5 kx func_convert_core_file_wine_to_w32_result=
5 kx fi
5 kx fi
5 kx }
5 kx # end: func_convert_core_file_wine_to_w32
5 kx
5 kx
5 kx # func_convert_core_path_wine_to_w32 ARG
5 kx # Helper function used by path conversion functions when $build is *nix, and
5 kx # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
5 kx # configured wine environment available, with the winepath program in $build's
5 kx # $PATH. Assumes ARG has no leading or trailing path separator characters.
5 kx #
5 kx # ARG is path to be converted from $build format to win32.
5 kx # Result is available in $func_convert_core_path_wine_to_w32_result.
5 kx # Unconvertible file (directory) names in ARG are skipped; if no directory names
5 kx # are convertible, then the result may be empty.
5 kx func_convert_core_path_wine_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx # unfortunately, winepath doesn't convert paths, only file names
5 kx func_convert_core_path_wine_to_w32_result=
5 kx if test -n "$1"; then
5 kx oldIFS=$IFS
5 kx IFS=:
5 kx for func_convert_core_path_wine_to_w32_f in $1; do
5 kx IFS=$oldIFS
5 kx func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
5 kx if test -n "$func_convert_core_file_wine_to_w32_result"; then
5 kx if test -z "$func_convert_core_path_wine_to_w32_result"; then
5 kx func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
5 kx else
5 kx func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
5 kx fi
5 kx fi
5 kx done
5 kx IFS=$oldIFS
5 kx fi
5 kx }
5 kx # end: func_convert_core_path_wine_to_w32
5 kx
5 kx
5 kx # func_cygpath ARGS...
5 kx # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
5 kx # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
5 kx # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
5 kx # (2), returns the Cygwin file name or path in func_cygpath_result (input
5 kx # file name or path is assumed to be in w32 format, as previously converted
5 kx # from $build's *nix or MSYS format). In case (3), returns the w32 file name
5 kx # or path in func_cygpath_result (input file name or path is assumed to be in
5 kx # Cygwin format). Returns an empty string on error.
5 kx #
5 kx # ARGS are passed to cygpath, with the last one being the file name or path to
5 kx # be converted.
5 kx #
5 kx # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
5 kx # environment variable; do not put it in $PATH.
5 kx func_cygpath ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
5 kx func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
5 kx if test "$?" -ne 0; then
5 kx # on failure, ensure result is empty
5 kx func_cygpath_result=
5 kx fi
5 kx else
5 kx func_cygpath_result=
5 kx func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
5 kx fi
5 kx }
5 kx #end: func_cygpath
5 kx
5 kx
5 kx # func_convert_core_msys_to_w32 ARG
5 kx # Convert file name or path ARG from MSYS format to w32 format. Return
5 kx # result in func_convert_core_msys_to_w32_result.
5 kx func_convert_core_msys_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx # awkward: cmd appends spaces to result
5 kx func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
5 kx $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
5 kx }
5 kx #end: func_convert_core_msys_to_w32
5 kx
5 kx
5 kx # func_convert_file_check ARG1 ARG2
5 kx # Verify that ARG1 (a file name in $build format) was converted to $host
5 kx # format in ARG2. Otherwise, emit an error message, but continue (resetting
5 kx # func_to_host_file_result to ARG1).
5 kx func_convert_file_check ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx if test -z "$2" && test -n "$1"; then
5 kx func_error "Could not determine host file name corresponding to"
5 kx func_error " '$1'"
5 kx func_error "Continuing, but uninstalled executables may not work."
5 kx # Fallback:
5 kx func_to_host_file_result=$1
5 kx fi
5 kx }
5 kx # end func_convert_file_check
5 kx
5 kx
5 kx # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
5 kx # Verify that FROM_PATH (a path in $build format) was converted to $host
5 kx # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
5 kx # func_to_host_file_result to a simplistic fallback value (see below).
5 kx func_convert_path_check ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx if test -z "$4" && test -n "$3"; then
5 kx func_error "Could not determine the host path corresponding to"
5 kx func_error " '$3'"
5 kx func_error "Continuing, but uninstalled executables may not work."
5 kx # Fallback. This is a deliberately simplistic "conversion" and
5 kx # should not be "improved". See libtool.info.
5 kx if test "x$1" != "x$2"; then
5 kx lt_replace_pathsep_chars="s|$1|$2|g"
5 kx func_to_host_path_result=`echo "$3" |
5 kx $SED -e "$lt_replace_pathsep_chars"`
5 kx else
5 kx func_to_host_path_result=$3
5 kx fi
5 kx fi
5 kx }
5 kx # end func_convert_path_check
5 kx
5 kx
5 kx # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
5 kx # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
5 kx # and appending REPL if ORIG matches BACKPAT.
5 kx func_convert_path_front_back_pathsep ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx case $4 in
5 kx $1 ) func_to_host_path_result=$3$func_to_host_path_result
5 kx ;;
5 kx esac
5 kx case $4 in
5 kx $2 ) func_append func_to_host_path_result "$3"
5 kx ;;
5 kx esac
5 kx }
5 kx # end func_convert_path_front_back_pathsep
5 kx
5 kx
5 kx ##################################################
5 kx # $build to $host FILE NAME CONVERSION FUNCTIONS #
5 kx ##################################################
5 kx # invoked via '$to_host_file_cmd ARG'
5 kx #
5 kx # In each case, ARG is the path to be converted from $build to $host format.
5 kx # Result will be available in $func_to_host_file_result.
5 kx
5 kx
5 kx # func_to_host_file ARG
5 kx # Converts the file name ARG from $build format to $host format. Return result
5 kx # in func_to_host_file_result.
5 kx func_to_host_file ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx $to_host_file_cmd "$1"
5 kx }
5 kx # end func_to_host_file
5 kx
5 kx
5 kx # func_to_tool_file ARG LAZY
5 kx # converts the file name ARG from $build format to toolchain format. Return
5 kx # result in func_to_tool_file_result. If the conversion in use is listed
5 kx # in (the comma separated) LAZY, no conversion takes place.
5 kx func_to_tool_file ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx case ,$2, in
5 kx *,"$to_tool_file_cmd",*)
5 kx func_to_tool_file_result=$1
5 kx ;;
5 kx *)
5 kx $to_tool_file_cmd "$1"
5 kx func_to_tool_file_result=$func_to_host_file_result
5 kx ;;
5 kx esac
5 kx }
5 kx # end func_to_tool_file
5 kx
5 kx
5 kx # func_convert_file_noop ARG
5 kx # Copy ARG to func_to_host_file_result.
5 kx func_convert_file_noop ()
5 kx {
5 kx func_to_host_file_result=$1
5 kx }
5 kx # end func_convert_file_noop
5 kx
5 kx
5 kx # func_convert_file_msys_to_w32 ARG
5 kx # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
5 kx # conversion to w32 is not available inside the cwrapper. Returns result in
5 kx # func_to_host_file_result.
5 kx func_convert_file_msys_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_file_result=$1
5 kx if test -n "$1"; then
5 kx func_convert_core_msys_to_w32 "$1"
5 kx func_to_host_file_result=$func_convert_core_msys_to_w32_result
5 kx fi
5 kx func_convert_file_check "$1" "$func_to_host_file_result"
5 kx }
5 kx # end func_convert_file_msys_to_w32
5 kx
5 kx
5 kx # func_convert_file_cygwin_to_w32 ARG
5 kx # Convert file name ARG from Cygwin to w32 format. Returns result in
5 kx # func_to_host_file_result.
5 kx func_convert_file_cygwin_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_file_result=$1
5 kx if test -n "$1"; then
5 kx # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
5 kx # LT_CYGPATH in this case.
5 kx func_to_host_file_result=`cygpath -m "$1"`
5 kx fi
5 kx func_convert_file_check "$1" "$func_to_host_file_result"
5 kx }
5 kx # end func_convert_file_cygwin_to_w32
5 kx
5 kx
5 kx # func_convert_file_nix_to_w32 ARG
5 kx # Convert file name ARG from *nix to w32 format. Requires a wine environment
5 kx # and a working winepath. Returns result in func_to_host_file_result.
5 kx func_convert_file_nix_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_file_result=$1
5 kx if test -n "$1"; then
5 kx func_convert_core_file_wine_to_w32 "$1"
5 kx func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
5 kx fi
5 kx func_convert_file_check "$1" "$func_to_host_file_result"
5 kx }
5 kx # end func_convert_file_nix_to_w32
5 kx
5 kx
5 kx # func_convert_file_msys_to_cygwin ARG
5 kx # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
5 kx # Returns result in func_to_host_file_result.
5 kx func_convert_file_msys_to_cygwin ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_file_result=$1
5 kx if test -n "$1"; then
5 kx func_convert_core_msys_to_w32 "$1"
5 kx func_cygpath -u "$func_convert_core_msys_to_w32_result"
5 kx func_to_host_file_result=$func_cygpath_result
5 kx fi
5 kx func_convert_file_check "$1" "$func_to_host_file_result"
5 kx }
5 kx # end func_convert_file_msys_to_cygwin
5 kx
5 kx
5 kx # func_convert_file_nix_to_cygwin ARG
5 kx # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
5 kx # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
5 kx # in func_to_host_file_result.
5 kx func_convert_file_nix_to_cygwin ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_file_result=$1
5 kx if test -n "$1"; then
5 kx # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
5 kx func_convert_core_file_wine_to_w32 "$1"
5 kx func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
5 kx func_to_host_file_result=$func_cygpath_result
5 kx fi
5 kx func_convert_file_check "$1" "$func_to_host_file_result"
5 kx }
5 kx # end func_convert_file_nix_to_cygwin
5 kx
5 kx
5 kx #############################################
5 kx # $build to $host PATH CONVERSION FUNCTIONS #
5 kx #############################################
5 kx # invoked via '$to_host_path_cmd ARG'
5 kx #
5 kx # In each case, ARG is the path to be converted from $build to $host format.
5 kx # The result will be available in $func_to_host_path_result.
5 kx #
5 kx # Path separators are also converted from $build format to $host format. If
5 kx # ARG begins or ends with a path separator character, it is preserved (but
5 kx # converted to $host format) on output.
5 kx #
5 kx # All path conversion functions are named using the following convention:
5 kx # file name conversion function : func_convert_file_X_to_Y ()
5 kx # path conversion function : func_convert_path_X_to_Y ()
5 kx # where, for any given $build/$host combination the 'X_to_Y' value is the
5 kx # same. If conversion functions are added for new $build/$host combinations,
5 kx # the two new functions must follow this pattern, or func_init_to_host_path_cmd
5 kx # will break.
5 kx
5 kx
5 kx # func_init_to_host_path_cmd
5 kx # Ensures that function "pointer" variable $to_host_path_cmd is set to the
5 kx # appropriate value, based on the value of $to_host_file_cmd.
5 kx to_host_path_cmd=
5 kx func_init_to_host_path_cmd ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx if test -z "$to_host_path_cmd"; then
5 kx func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
5 kx to_host_path_cmd=func_convert_path_$func_stripname_result
5 kx fi
5 kx }
5 kx
5 kx
5 kx # func_to_host_path ARG
5 kx # Converts the path ARG from $build format to $host format. Return result
5 kx # in func_to_host_path_result.
5 kx func_to_host_path ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_init_to_host_path_cmd
5 kx $to_host_path_cmd "$1"
5 kx }
5 kx # end func_to_host_path
5 kx
5 kx
5 kx # func_convert_path_noop ARG
5 kx # Copy ARG to func_to_host_path_result.
5 kx func_convert_path_noop ()
5 kx {
5 kx func_to_host_path_result=$1
5 kx }
5 kx # end func_convert_path_noop
5 kx
5 kx
5 kx # func_convert_path_msys_to_w32 ARG
5 kx # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
5 kx # conversion to w32 is not available inside the cwrapper. Returns result in
5 kx # func_to_host_path_result.
5 kx func_convert_path_msys_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_path_result=$1
5 kx if test -n "$1"; then
5 kx # Remove leading and trailing path separator characters from ARG. MSYS
5 kx # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
5 kx # and winepath ignores them completely.
5 kx func_stripname : : "$1"
5 kx func_to_host_path_tmp1=$func_stripname_result
5 kx func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
5 kx func_to_host_path_result=$func_convert_core_msys_to_w32_result
5 kx func_convert_path_check : ";" \
5 kx "$func_to_host_path_tmp1" "$func_to_host_path_result"
5 kx func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
5 kx fi
5 kx }
5 kx # end func_convert_path_msys_to_w32
5 kx
5 kx
5 kx # func_convert_path_cygwin_to_w32 ARG
5 kx # Convert path ARG from Cygwin to w32 format. Returns result in
5 kx # func_to_host_file_result.
5 kx func_convert_path_cygwin_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_path_result=$1
5 kx if test -n "$1"; then
5 kx # See func_convert_path_msys_to_w32:
5 kx func_stripname : : "$1"
5 kx func_to_host_path_tmp1=$func_stripname_result
5 kx func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
5 kx func_convert_path_check : ";" \
5 kx "$func_to_host_path_tmp1" "$func_to_host_path_result"
5 kx func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
5 kx fi
5 kx }
5 kx # end func_convert_path_cygwin_to_w32
5 kx
5 kx
5 kx # func_convert_path_nix_to_w32 ARG
5 kx # Convert path ARG from *nix to w32 format. Requires a wine environment and
5 kx # a working winepath. Returns result in func_to_host_file_result.
5 kx func_convert_path_nix_to_w32 ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_path_result=$1
5 kx if test -n "$1"; then
5 kx # See func_convert_path_msys_to_w32:
5 kx func_stripname : : "$1"
5 kx func_to_host_path_tmp1=$func_stripname_result
5 kx func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
5 kx func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
5 kx func_convert_path_check : ";" \
5 kx "$func_to_host_path_tmp1" "$func_to_host_path_result"
5 kx func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
5 kx fi
5 kx }
5 kx # end func_convert_path_nix_to_w32
5 kx
5 kx
5 kx # func_convert_path_msys_to_cygwin ARG
5 kx # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
5 kx # Returns result in func_to_host_file_result.
5 kx func_convert_path_msys_to_cygwin ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_path_result=$1
5 kx if test -n "$1"; then
5 kx # See func_convert_path_msys_to_w32:
5 kx func_stripname : : "$1"
5 kx func_to_host_path_tmp1=$func_stripname_result
5 kx func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
5 kx func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
5 kx func_to_host_path_result=$func_cygpath_result
5 kx func_convert_path_check : : \
5 kx "$func_to_host_path_tmp1" "$func_to_host_path_result"
5 kx func_convert_path_front_back_pathsep ":*" "*:" : "$1"
5 kx fi
5 kx }
5 kx # end func_convert_path_msys_to_cygwin
5 kx
5 kx
5 kx # func_convert_path_nix_to_cygwin ARG
5 kx # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
5 kx # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
5 kx # func_to_host_file_result.
5 kx func_convert_path_nix_to_cygwin ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_host_path_result=$1
5 kx if test -n "$1"; then
5 kx # Remove leading and trailing path separator characters from
5 kx # ARG. msys behavior is inconsistent here, cygpath turns them
5 kx # into '.;' and ';.', and winepath ignores them completely.
5 kx func_stripname : : "$1"
5 kx func_to_host_path_tmp1=$func_stripname_result
5 kx func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
5 kx func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
5 kx func_to_host_path_result=$func_cygpath_result
5 kx func_convert_path_check : : \
5 kx "$func_to_host_path_tmp1" "$func_to_host_path_result"
5 kx func_convert_path_front_back_pathsep ":*" "*:" : "$1"
5 kx fi
5 kx }
5 kx # end func_convert_path_nix_to_cygwin
5 kx
5 kx
5 kx # func_dll_def_p FILE
5 kx # True iff FILE is a Windows DLL '.def' file.
5 kx # Keep in sync with _LT_DLL_DEF_P in libtool.m4
5 kx func_dll_def_p ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_dll_def_p_tmp=`$SED -n \
5 kx -e 's/^[ ]*//' \
5 kx -e '/^\(;.*\)*$/d' \
5 kx -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
5 kx -e q \
5 kx "$1"`
5 kx test DEF = "$func_dll_def_p_tmp"
5 kx }
5 kx
5 kx
5 kx # func_mode_compile arg...
5 kx func_mode_compile ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx # Get the compilation command and the source file.
5 kx base_compile=
5 kx srcfile=$nonopt # always keep a non-empty value in "srcfile"
5 kx suppress_opt=yes
5 kx suppress_output=
5 kx arg_mode=normal
5 kx libobj=
5 kx later=
5 kx pie_flag=
5 kx
5 kx for arg
5 kx do
5 kx case $arg_mode in
5 kx arg )
5 kx # do not "continue". Instead, add this to base_compile
5 kx lastarg=$arg
5 kx arg_mode=normal
5 kx ;;
5 kx
5 kx target )
5 kx libobj=$arg
5 kx arg_mode=normal
5 kx continue
5 kx ;;
5 kx
5 kx normal )
5 kx # Accept any command-line options.
5 kx case $arg in
5 kx -o)
5 kx test -n "$libobj" && \
5 kx func_fatal_error "you cannot specify '-o' more than once"
5 kx arg_mode=target
5 kx continue
5 kx ;;
5 kx
5 kx -pie | -fpie | -fPIE)
5 kx func_append pie_flag " $arg"
5 kx continue
5 kx ;;
5 kx
5 kx -shared | -static | -prefer-pic | -prefer-non-pic)
5 kx func_append later " $arg"
5 kx continue
5 kx ;;
5 kx
5 kx -no-suppress)
5 kx suppress_opt=no
5 kx continue
5 kx ;;
5 kx
5 kx -Xcompiler)
5 kx arg_mode=arg # the next one goes into the "base_compile" arg list
5 kx continue # The current "srcfile" will either be retained or
5 kx ;; # replaced later. I would guess that would be a bug.
5 kx
5 kx -Wc,*)
5 kx func_stripname '-Wc,' '' "$arg"
5 kx args=$func_stripname_result
5 kx lastarg=
5 kx save_ifs=$IFS; IFS=,
5 kx for arg in $args; do
5 kx IFS=$save_ifs
5 kx func_append_quoted lastarg "$arg"
5 kx done
5 kx IFS=$save_ifs
5 kx func_stripname ' ' '' "$lastarg"
5 kx lastarg=$func_stripname_result
5 kx
5 kx # Add the arguments to base_compile.
5 kx func_append base_compile " $lastarg"
5 kx continue
5 kx ;;
5 kx
5 kx *)
5 kx # Accept the current argument as the source file.
5 kx # The previous "srcfile" becomes the current argument.
5 kx #
5 kx lastarg=$srcfile
5 kx srcfile=$arg
5 kx ;;
5 kx esac # case $arg
5 kx ;;
5 kx esac # case $arg_mode
5 kx
5 kx # Aesthetically quote the previous argument.
5 kx func_append_quoted base_compile "$lastarg"
5 kx done # for arg
5 kx
5 kx case $arg_mode in
5 kx arg)
5 kx func_fatal_error "you must specify an argument for -Xcompile"
5 kx ;;
5 kx target)
5 kx func_fatal_error "you must specify a target with '-o'"
5 kx ;;
5 kx *)
5 kx # Get the name of the library object.
5 kx test -z "$libobj" && {
5 kx func_basename "$srcfile"
5 kx libobj=$func_basename_result
5 kx }
5 kx ;;
5 kx esac
5 kx
5 kx # Recognize several different file suffixes.
5 kx # If the user specifies -o file.o, it is replaced with file.lo
5 kx case $libobj in
5 kx *.[cCFSifmso] | \
5 kx *.ada | *.adb | *.ads | *.asm | \
5 kx *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
5 kx *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
5 kx func_xform "$libobj"
5 kx libobj=$func_xform_result
5 kx ;;
5 kx esac
5 kx
5 kx case $libobj in
5 kx *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
5 kx *)
5 kx func_fatal_error "cannot determine name of library object from '$libobj'"
5 kx ;;
5 kx esac
5 kx
5 kx func_infer_tag $base_compile
5 kx
5 kx for arg in $later; do
5 kx case $arg in
5 kx -shared)
5 kx test yes = "$build_libtool_libs" \
5 kx || func_fatal_configuration "cannot build a shared library"
5 kx build_old_libs=no
5 kx continue
5 kx ;;
5 kx
5 kx -static)
5 kx build_libtool_libs=no
5 kx build_old_libs=yes
5 kx continue
5 kx ;;
5 kx
5 kx -prefer-pic)
5 kx pic_mode=yes
5 kx continue
5 kx ;;
5 kx
5 kx -prefer-non-pic)
5 kx pic_mode=no
5 kx continue
5 kx ;;
5 kx esac
5 kx done
5 kx
5 kx func_quote_for_eval "$libobj"
5 kx test "X$libobj" != "X$func_quote_for_eval_result" \
5 kx && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
5 kx && func_warning "libobj name '$libobj' may not contain shell special characters."
5 kx func_dirname_and_basename "$obj" "/" ""
5 kx objname=$func_basename_result
5 kx xdir=$func_dirname_result
5 kx lobj=$xdir$objdir/$objname
5 kx
5 kx test -z "$base_compile" && \
5 kx func_fatal_help "you must specify a compilation command"
5 kx
5 kx # Delete any leftover library objects.
5 kx if test yes = "$build_old_libs"; then
5 kx removelist="$obj $lobj $libobj ${libobj}T"
5 kx else
5 kx removelist="$lobj $libobj ${libobj}T"
5 kx fi
5 kx
5 kx # On Cygwin there's no "real" PIC flag so we must build both object types
5 kx case $host_os in
5 kx cygwin* | mingw* | pw32* | os2* | cegcc*)
5 kx pic_mode=default
5 kx ;;
5 kx esac
5 kx if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
5 kx # non-PIC code in shared libraries is not supported
5 kx pic_mode=default
5 kx fi
5 kx
5 kx # Calculate the filename of the output object if compiler does
5 kx # not support -o with -c
5 kx if test no = "$compiler_c_o"; then
5 kx output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
5 kx lockfile=$output_obj.lock
5 kx else
5 kx output_obj=
5 kx need_locks=no
5 kx lockfile=
5 kx fi
5 kx
5 kx # Lock this critical section if it is needed
5 kx # We use this script file to make the link, it avoids creating a new file
5 kx if test yes = "$need_locks"; then
5 kx until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5 kx func_echo "Waiting for $lockfile to be removed"
5 kx sleep 2
5 kx done
5 kx elif test warn = "$need_locks"; then
5 kx if test -f "$lockfile"; then
5 kx $ECHO "\
5 kx *** ERROR, $lockfile exists and contains:
5 kx `cat $lockfile 2>/dev/null`
5 kx
5 kx This indicates that another process is trying to use the same
5 kx temporary object file, and libtool could not work around it because
5 kx your compiler does not support '-c' and '-o' together. If you
5 kx repeat this compilation, it may succeed, by chance, but you had better
5 kx avoid parallel builds (make -j) in this platform, or get a better
5 kx compiler."
5 kx
5 kx $opt_dry_run || $RM $removelist
5 kx exit $EXIT_FAILURE
5 kx fi
5 kx func_append removelist " $output_obj"
5 kx $ECHO "$srcfile" > "$lockfile"
5 kx fi
5 kx
5 kx $opt_dry_run || $RM $removelist
5 kx func_append removelist " $lockfile"
5 kx trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
5 kx
5 kx func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
5 kx srcfile=$func_to_tool_file_result
5 kx func_quote_for_eval "$srcfile"
5 kx qsrcfile=$func_quote_for_eval_result
5 kx
5 kx # Only build a PIC object if we are building libtool libraries.
5 kx if test yes = "$build_libtool_libs"; then
5 kx # Without this assignment, base_compile gets emptied.
5 kx fbsd_hideous_sh_bug=$base_compile
5 kx
5 kx if test no != "$pic_mode"; then
5 kx command="$base_compile $qsrcfile $pic_flag"
5 kx else
5 kx # Don't build PIC code
5 kx command="$base_compile $qsrcfile"
5 kx fi
5 kx
5 kx func_mkdir_p "$xdir$objdir"
5 kx
5 kx if test -z "$output_obj"; then
5 kx # Place PIC objects in $objdir
5 kx func_append command " -o $lobj"
5 kx fi
5 kx
5 kx func_show_eval_locale "$command" \
5 kx 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
5 kx
5 kx if test warn = "$need_locks" &&
5 kx test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
5 kx $ECHO "\
5 kx *** ERROR, $lockfile contains:
5 kx `cat $lockfile 2>/dev/null`
5 kx
5 kx but it should contain:
5 kx $srcfile
5 kx
5 kx This indicates that another process is trying to use the same
5 kx temporary object file, and libtool could not work around it because
5 kx your compiler does not support '-c' and '-o' together. If you
5 kx repeat this compilation, it may succeed, by chance, but you had better
5 kx avoid parallel builds (make -j) in this platform, or get a better
5 kx compiler."
5 kx
5 kx $opt_dry_run || $RM $removelist
5 kx exit $EXIT_FAILURE
5 kx fi
5 kx
5 kx # Just move the object if needed, then go on to compile the next one
5 kx if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
5 kx func_show_eval '$MV "$output_obj" "$lobj"' \
5 kx 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
5 kx fi
5 kx
5 kx # Allow error messages only from the first compilation.
5 kx if test yes = "$suppress_opt"; then
5 kx suppress_output=' >/dev/null 2>&1'
5 kx fi
5 kx fi
5 kx
5 kx # Only build a position-dependent object if we build old libraries.
5 kx if test yes = "$build_old_libs"; then
5 kx if test yes != "$pic_mode"; then
5 kx # Don't build PIC code
5 kx command="$base_compile $qsrcfile$pie_flag"
5 kx else
5 kx command="$base_compile $qsrcfile $pic_flag"
5 kx fi
5 kx if test yes = "$compiler_c_o"; then
5 kx func_append command " -o $obj"
5 kx fi
5 kx
5 kx # Suppress compiler output if we already did a PIC compilation.
5 kx func_append command "$suppress_output"
5 kx func_show_eval_locale "$command" \
5 kx '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
5 kx
5 kx if test warn = "$need_locks" &&
5 kx test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
5 kx $ECHO "\
5 kx *** ERROR, $lockfile contains:
5 kx `cat $lockfile 2>/dev/null`
5 kx
5 kx but it should contain:
5 kx $srcfile
5 kx
5 kx This indicates that another process is trying to use the same
5 kx temporary object file, and libtool could not work around it because
5 kx your compiler does not support '-c' and '-o' together. If you
5 kx repeat this compilation, it may succeed, by chance, but you had better
5 kx avoid parallel builds (make -j) in this platform, or get a better
5 kx compiler."
5 kx
5 kx $opt_dry_run || $RM $removelist
5 kx exit $EXIT_FAILURE
5 kx fi
5 kx
5 kx # Just move the object if needed
5 kx if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
5 kx func_show_eval '$MV "$output_obj" "$obj"' \
5 kx 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
5 kx fi
5 kx fi
5 kx
5 kx $opt_dry_run || {
5 kx func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
5 kx
5 kx # Unlock the critical section if it was locked
5 kx if test no != "$need_locks"; then
5 kx removelist=$lockfile
5 kx $RM "$lockfile"
5 kx fi
5 kx }
5 kx
5 kx exit $EXIT_SUCCESS
5 kx }
5 kx
5 kx $opt_help || {
5 kx test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
5 kx }
5 kx
5 kx func_mode_help ()
5 kx {
5 kx # We need to display help for each of the modes.
5 kx case $opt_mode in
5 kx "")
5 kx # Generic help is extracted from the usage comments
5 kx # at the start of this file.
5 kx func_help
5 kx ;;
5 kx
5 kx clean)
5 kx $ECHO \
5 kx "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5 kx
5 kx Remove files from the build directory.
5 kx
5 kx RM is the name of the program to use to delete files associated with each FILE
5 kx (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
5 kx to RM.
5 kx
5 kx If FILE is a libtool library, object or program, all the files associated
5 kx with it are deleted. Otherwise, only FILE itself is deleted using RM."
5 kx ;;
5 kx
5 kx compile)
5 kx $ECHO \
5 kx "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5 kx
5 kx Compile a source file into a libtool library object.
5 kx
5 kx This mode accepts the following additional options:
5 kx
5 kx -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5 kx -no-suppress do not suppress compiler output for multiple passes
5 kx -prefer-pic try to build PIC objects only
5 kx -prefer-non-pic try to build non-PIC objects only
5 kx -shared do not build a '.o' file suitable for static linking
5 kx -static only build a '.o' file suitable for static linking
5 kx -Wc,FLAG pass FLAG directly to the compiler
5 kx
5 kx COMPILE-COMMAND is a command to be used in creating a 'standard' object file
5 kx from the given SOURCEFILE.
5 kx
5 kx The output file name is determined by removing the directory component from
5 kx SOURCEFILE, then substituting the C source code suffix '.c' with the
5 kx library object suffix, '.lo'."
5 kx ;;
5 kx
5 kx execute)
5 kx $ECHO \
5 kx "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
5 kx
5 kx Automatically set library path, then run a program.
5 kx
5 kx This mode accepts the following additional options:
5 kx
5 kx -dlopen FILE add the directory containing FILE to the library path
5 kx
5 kx This mode sets the library path environment variable according to '-dlopen'
5 kx flags.
5 kx
5 kx If any of the ARGS are libtool executable wrappers, then they are translated
5 kx into their corresponding uninstalled binary, and any of their required library
5 kx directories are added to the library path.
5 kx
5 kx Then, COMMAND is executed, with ARGS as arguments."
5 kx ;;
5 kx
5 kx finish)
5 kx $ECHO \
5 kx "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
5 kx
5 kx Complete the installation of libtool libraries.
5 kx
5 kx Each LIBDIR is a directory that contains libtool libraries.
5 kx
5 kx The commands that this mode executes may require superuser privileges. Use
5 kx the '--dry-run' option if you just want to see what would be executed."
5 kx ;;
5 kx
5 kx install)
5 kx $ECHO \
5 kx "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
5 kx
5 kx Install executables or libraries.
5 kx
5 kx INSTALL-COMMAND is the installation command. The first component should be
5 kx either the 'install' or 'cp' program.
5 kx
5 kx The following components of INSTALL-COMMAND are treated specially:
5 kx
5 kx -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
5 kx
5 kx The rest of the components are interpreted as arguments to that command (only
5 kx BSD-compatible install options are recognized)."
5 kx ;;
5 kx
5 kx link)
5 kx $ECHO \
5 kx "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
5 kx
5 kx Link object files or libraries together to form another library, or to
5 kx create an executable program.
5 kx
5 kx LINK-COMMAND is a command using the C compiler that you would use to create
5 kx a program from several object files.
5 kx
5 kx The following components of LINK-COMMAND are treated specially:
5 kx
5 kx -all-static do not do any dynamic linking at all
5 kx -avoid-version do not add a version suffix if possible
5 kx -bindir BINDIR specify path to binaries directory (for systems where
5 kx libraries must be found in the PATH setting at runtime)
5 kx -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
5 kx -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5 kx -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5 kx -export-symbols SYMFILE
5 kx try to export only the symbols listed in SYMFILE
5 kx -export-symbols-regex REGEX
5 kx try to export only the symbols matching REGEX
5 kx -LLIBDIR search LIBDIR for required installed libraries
5 kx -lNAME OUTPUT-FILE requires the installed library libNAME
5 kx -module build a library that can dlopened
5 kx -no-fast-install disable the fast-install mode
5 kx -no-install link a not-installable executable
5 kx -no-undefined declare that a library does not refer to external symbols
5 kx -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5 kx -objectlist FILE use a list of object files found in FILE to specify objects
5 kx -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
5 kx -precious-files-regex REGEX
5 kx don't remove output files matching REGEX
5 kx -release RELEASE specify package release information
5 kx -rpath LIBDIR the created library will eventually be installed in LIBDIR
5 kx -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5 kx -shared only do dynamic linking of libtool libraries
5 kx -shrext SUFFIX override the standard shared library file extension
5 kx -static do not do any dynamic linking of uninstalled libtool libraries
5 kx -static-libtool-libs
5 kx do not do any dynamic linking of libtool libraries
5 kx -version-info CURRENT[:REVISION[:AGE]]
5 kx specify library version info [each variable defaults to 0]
5 kx -weak LIBNAME declare that the target provides the LIBNAME interface
5 kx -Wc,FLAG
5 kx -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
5 kx -Wl,FLAG
5 kx -Xlinker FLAG pass linker-specific FLAG directly to the linker
5 kx -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
5 kx
5 kx All other options (arguments beginning with '-') are ignored.
5 kx
5 kx Every other argument is treated as a filename. Files ending in '.la' are
5 kx treated as uninstalled libtool libraries, other files are standard or library
5 kx object files.
5 kx
5 kx If the OUTPUT-FILE ends in '.la', then a libtool library is created,
5 kx only library objects ('.lo' files) may be specified, and '-rpath' is
5 kx required, except when creating a convenience library.
5 kx
5 kx If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
5 kx using 'ar' and 'ranlib', or on Windows using 'lib'.
5 kx
5 kx If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
5 kx is created, otherwise an executable program is created."
5 kx ;;
5 kx
5 kx uninstall)
5 kx $ECHO \
5 kx "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5 kx
5 kx Remove libraries from an installation directory.
5 kx
5 kx RM is the name of the program to use to delete files associated with each FILE
5 kx (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
5 kx to RM.
5 kx
5 kx If FILE is a libtool library, all the files associated with it are deleted.
5 kx Otherwise, only FILE itself is deleted using RM."
5 kx ;;
5 kx
5 kx *)
5 kx func_fatal_help "invalid operation mode '$opt_mode'"
5 kx ;;
5 kx esac
5 kx
5 kx echo
5 kx $ECHO "Try '$progname --help' for more information about other modes."
5 kx }
5 kx
5 kx # Now that we've collected a possible --mode arg, show help if necessary
5 kx if $opt_help; then
5 kx if test : = "$opt_help"; then
5 kx func_mode_help
5 kx else
5 kx {
5 kx func_help noexit
5 kx for opt_mode in compile link execute install finish uninstall clean; do
5 kx func_mode_help
5 kx done
5 kx } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
5 kx {
5 kx func_help noexit
5 kx for opt_mode in compile link execute install finish uninstall clean; do
5 kx echo
5 kx func_mode_help
5 kx done
5 kx } |
5 kx $SED '1d
5 kx /^When reporting/,/^Report/{
5 kx H
5 kx d
5 kx }
5 kx $x
5 kx /information about other modes/d
5 kx /more detailed .*MODE/d
5 kx s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
5 kx fi
5 kx exit $?
5 kx fi
5 kx
5 kx
5 kx # func_mode_execute arg...
5 kx func_mode_execute ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx # The first argument is the command name.
5 kx cmd=$nonopt
5 kx test -z "$cmd" && \
5 kx func_fatal_help "you must specify a COMMAND"
5 kx
5 kx # Handle -dlopen flags immediately.
5 kx for file in $opt_dlopen; do
5 kx test -f "$file" \
5 kx || func_fatal_help "'$file' is not a file"
5 kx
5 kx dir=
5 kx case $file in
5 kx *.la)
5 kx func_resolve_sysroot "$file"
5 kx file=$func_resolve_sysroot_result
5 kx
5 kx # Check to see that this really is a libtool archive.
5 kx func_lalib_unsafe_p "$file" \
5 kx || func_fatal_help "'$lib' is not a valid libtool archive"
5 kx
5 kx # Read the libtool library.
5 kx dlname=
5 kx library_names=
5 kx func_source "$file"
5 kx
5 kx # Skip this library if it cannot be dlopened.
5 kx if test -z "$dlname"; then
5 kx # Warn if it was a shared library.
5 kx test -n "$library_names" && \
5 kx func_warning "'$file' was not linked with '-export-dynamic'"
5 kx continue
5 kx fi
5 kx
5 kx func_dirname "$file" "" "."
5 kx dir=$func_dirname_result
5 kx
5 kx if test -f "$dir/$objdir/$dlname"; then
5 kx func_append dir "/$objdir"
5 kx else
5 kx if test ! -f "$dir/$dlname"; then
5 kx func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
5 kx fi
5 kx fi
5 kx ;;
5 kx
5 kx *.lo)
5 kx # Just add the directory containing the .lo file.
5 kx func_dirname "$file" "" "."
5 kx dir=$func_dirname_result
5 kx ;;
5 kx
5 kx *)
5 kx func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
5 kx continue
5 kx ;;
5 kx esac
5 kx
5 kx # Get the absolute pathname.
5 kx absdir=`cd "$dir" && pwd`
5 kx test -n "$absdir" && dir=$absdir
5 kx
5 kx # Now add the directory to shlibpath_var.
5 kx if eval "test -z \"\$$shlibpath_var\""; then
5 kx eval "$shlibpath_var=\"\$dir\""
5 kx else
5 kx eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5 kx fi
5 kx done
5 kx
5 kx # This variable tells wrapper scripts just to set shlibpath_var
5 kx # rather than running their programs.
5 kx libtool_execute_magic=$magic
5 kx
5 kx # Check if any of the arguments is a wrapper script.
5 kx args=
5 kx for file
5 kx do
5 kx case $file in
5 kx -* | *.la | *.lo ) ;;
5 kx *)
5 kx # Do a test to see if this is really a libtool program.
5 kx if func_ltwrapper_script_p "$file"; then
5 kx func_source "$file"
5 kx # Transform arg to wrapped name.
5 kx file=$progdir/$program
5 kx elif func_ltwrapper_executable_p "$file"; then
5 kx func_ltwrapper_scriptname "$file"
5 kx func_source "$func_ltwrapper_scriptname_result"
5 kx # Transform arg to wrapped name.
5 kx file=$progdir/$program
5 kx fi
5 kx ;;
5 kx esac
5 kx # Quote arguments (to preserve shell metacharacters).
5 kx func_append_quoted args "$file"
5 kx done
5 kx
5 kx if $opt_dry_run; then
5 kx # Display what would be done.
5 kx if test -n "$shlibpath_var"; then
5 kx eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
5 kx echo "export $shlibpath_var"
5 kx fi
5 kx $ECHO "$cmd$args"
5 kx exit $EXIT_SUCCESS
5 kx else
5 kx if test -n "$shlibpath_var"; then
5 kx # Export the shlibpath_var.
5 kx eval "export $shlibpath_var"
5 kx fi
5 kx
5 kx # Restore saved environment variables
5 kx for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
5 kx do
5 kx eval "if test \"\${save_$lt_var+set}\" = set; then
5 kx $lt_var=\$save_$lt_var; export $lt_var
5 kx else
5 kx $lt_unset $lt_var
5 kx fi"
5 kx done
5 kx
5 kx # Now prepare to actually exec the command.
5 kx exec_cmd=\$cmd$args
5 kx fi
5 kx }
5 kx
5 kx test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
5 kx
5 kx
5 kx # func_mode_finish arg...
5 kx func_mode_finish ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx libs=
5 kx libdirs=
5 kx admincmds=
5 kx
5 kx for opt in "$nonopt" ${1+"$@"}
5 kx do
5 kx if test -d "$opt"; then
5 kx func_append libdirs " $opt"
5 kx
5 kx elif test -f "$opt"; then
5 kx if func_lalib_unsafe_p "$opt"; then
5 kx func_append libs " $opt"
5 kx else
5 kx func_warning "'$opt' is not a valid libtool archive"
5 kx fi
5 kx
5 kx else
5 kx func_fatal_error "invalid argument '$opt'"
5 kx fi
5 kx done
5 kx
5 kx if test -n "$libs"; then
5 kx if test -n "$lt_sysroot"; then
5 kx sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
5 kx sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
5 kx else
5 kx sysroot_cmd=
5 kx fi
5 kx
5 kx # Remove sysroot references
5 kx if $opt_dry_run; then
5 kx for lib in $libs; do
5 kx echo "removing references to $lt_sysroot and '=' prefixes from $lib"
5 kx done
5 kx else
5 kx tmpdir=`func_mktempdir`
5 kx for lib in $libs; do
5 kx $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
5 kx > $tmpdir/tmp-la
5 kx mv -f $tmpdir/tmp-la $lib
5 kx done
5 kx ${RM}r "$tmpdir"
5 kx fi
5 kx fi
5 kx
5 kx if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5 kx for libdir in $libdirs; do
5 kx if test -n "$finish_cmds"; then
5 kx # Do each command in the finish commands.
5 kx func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
5 kx '"$cmd"'"'
5 kx fi
5 kx if test -n "$finish_eval"; then
5 kx # Do the single finish_eval.
5 kx eval cmds=\"$finish_eval\"
5 kx $opt_dry_run || eval "$cmds" || func_append admincmds "
5 kx $cmds"
5 kx fi
5 kx done
5 kx fi
5 kx
5 kx # Exit here if they wanted silent mode.
5 kx $opt_quiet && exit $EXIT_SUCCESS
5 kx
5 kx if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5 kx echo "----------------------------------------------------------------------"
5 kx echo "Libraries have been installed in:"
5 kx for libdir in $libdirs; do
5 kx $ECHO " $libdir"
5 kx done
5 kx echo
5 kx echo "If you ever happen to want to link against installed libraries"
5 kx echo "in a given directory, LIBDIR, you must either use libtool, and"
5 kx echo "specify the full pathname of the library, or use the '-LLIBDIR'"
5 kx echo "flag during linking and do at least one of the following:"
5 kx if test -n "$shlibpath_var"; then
5 kx echo " - add LIBDIR to the '$shlibpath_var' environment variable"
5 kx echo " during execution"
5 kx fi
5 kx if test -n "$runpath_var"; then
5 kx echo " - add LIBDIR to the '$runpath_var' environment variable"
5 kx echo " during linking"
5 kx fi
5 kx if test -n "$hardcode_libdir_flag_spec"; then
5 kx libdir=LIBDIR
5 kx eval flag=\"$hardcode_libdir_flag_spec\"
5 kx
5 kx $ECHO " - use the '$flag' linker flag"
5 kx fi
5 kx if test -n "$admincmds"; then
5 kx $ECHO " - have your system administrator run these commands:$admincmds"
5 kx fi
5 kx if test -f /etc/ld.so.conf; then
5 kx echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
5 kx fi
5 kx echo
5 kx
5 kx echo "See any operating system documentation about shared libraries for"
5 kx case $host in
5 kx solaris2.[6789]|solaris2.1[0-9])
5 kx echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
5 kx echo "pages."
5 kx ;;
5 kx *)
5 kx echo "more information, such as the ld(1) and ld.so(8) manual pages."
5 kx ;;
5 kx esac
5 kx echo "----------------------------------------------------------------------"
5 kx fi
5 kx exit $EXIT_SUCCESS
5 kx }
5 kx
5 kx test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
5 kx
5 kx
5 kx # func_mode_install arg...
5 kx func_mode_install ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx # There may be an optional sh(1) argument at the beginning of
5 kx # install_prog (especially on Windows NT).
5 kx if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
5 kx # Allow the use of GNU shtool's install command.
5 kx case $nonopt in *shtool*) :;; *) false;; esac
5 kx then
5 kx # Aesthetically quote it.
5 kx func_quote_for_eval "$nonopt"
5 kx install_prog="$func_quote_for_eval_result "
5 kx arg=$1
5 kx shift
5 kx else
5 kx install_prog=
5 kx arg=$nonopt
5 kx fi
5 kx
5 kx # The real first argument should be the name of the installation program.
5 kx # Aesthetically quote it.
5 kx func_quote_for_eval "$arg"
5 kx func_append install_prog "$func_quote_for_eval_result"
5 kx install_shared_prog=$install_prog
5 kx case " $install_prog " in
5 kx *[\\\ /]cp\ *) install_cp=: ;;
5 kx *) install_cp=false ;;
5 kx esac
5 kx
5 kx # We need to accept at least all the BSD install flags.
5 kx dest=
5 kx files=
5 kx opts=
5 kx prev=
5 kx install_type=
5 kx isdir=false
5 kx stripme=
5 kx no_mode=:
5 kx for arg
5 kx do
5 kx arg2=
5 kx if test -n "$dest"; then
5 kx func_append files " $dest"
5 kx dest=$arg
5 kx continue
5 kx fi
5 kx
5 kx case $arg in
5 kx -d) isdir=: ;;
5 kx -f)
5 kx if $install_cp; then :; else
5 kx prev=$arg
5 kx fi
5 kx ;;
5 kx -g | -m | -o)
5 kx prev=$arg
5 kx ;;
5 kx -s)
5 kx stripme=" -s"
5 kx continue
5 kx ;;
5 kx -*)
5 kx ;;
5 kx *)
5 kx # If the previous option needed an argument, then skip it.
5 kx if test -n "$prev"; then
5 kx if test X-m = "X$prev" && test -n "$install_override_mode"; then
5 kx arg2=$install_override_mode
5 kx no_mode=false
5 kx fi
5 kx prev=
5 kx else
5 kx dest=$arg
5 kx continue
5 kx fi
5 kx ;;
5 kx esac
5 kx
5 kx # Aesthetically quote the argument.
5 kx func_quote_for_eval "$arg"
5 kx func_append install_prog " $func_quote_for_eval_result"
5 kx if test -n "$arg2"; then
5 kx func_quote_for_eval "$arg2"
5 kx fi
5 kx func_append install_shared_prog " $func_quote_for_eval_result"
5 kx done
5 kx
5 kx test -z "$install_prog" && \
5 kx func_fatal_help "you must specify an install program"
5 kx
5 kx test -n "$prev" && \
5 kx func_fatal_help "the '$prev' option requires an argument"
5 kx
5 kx if test -n "$install_override_mode" && $no_mode; then
5 kx if $install_cp; then :; else
5 kx func_quote_for_eval "$install_override_mode"
5 kx func_append install_shared_prog " -m $func_quote_for_eval_result"
5 kx fi
5 kx fi
5 kx
5 kx if test -z "$files"; then
5 kx if test -z "$dest"; then
5 kx func_fatal_help "no file or destination specified"
5 kx else
5 kx func_fatal_help "you must specify a destination"
5 kx fi
5 kx fi
5 kx
5 kx # Strip any trailing slash from the destination.
5 kx func_stripname '' '/' "$dest"
5 kx dest=$func_stripname_result
5 kx
5 kx # Check to see that the destination is a directory.
5 kx test -d "$dest" && isdir=:
5 kx if $isdir; then
5 kx destdir=$dest
5 kx destname=
5 kx else
5 kx func_dirname_and_basename "$dest" "" "."
5 kx destdir=$func_dirname_result
5 kx destname=$func_basename_result
5 kx
5 kx # Not a directory, so check to see that there is only one file specified.
5 kx set dummy $files; shift
5 kx test "$#" -gt 1 && \
5 kx func_fatal_help "'$dest' is not a directory"
5 kx fi
5 kx case $destdir in
5 kx [\\/]* | [A-Za-z]:[\\/]*) ;;
5 kx *)
5 kx for file in $files; do
5 kx case $file in
5 kx *.lo) ;;
5 kx *)
5 kx func_fatal_help "'$destdir' must be an absolute directory name"
5 kx ;;
5 kx esac
5 kx done
5 kx ;;
5 kx esac
5 kx
5 kx # This variable tells wrapper scripts just to set variables rather
5 kx # than running their programs.
5 kx libtool_install_magic=$magic
5 kx
5 kx staticlibs=
5 kx future_libdirs=
5 kx current_libdirs=
5 kx for file in $files; do
5 kx
5 kx # Do each installation.
5 kx case $file in
5 kx *.$libext)
5 kx # Do the static libraries later.
5 kx func_append staticlibs " $file"
5 kx ;;
5 kx
5 kx *.la)
5 kx func_resolve_sysroot "$file"
5 kx file=$func_resolve_sysroot_result
5 kx
5 kx # Check to see that this really is a libtool archive.
5 kx func_lalib_unsafe_p "$file" \
5 kx || func_fatal_help "'$file' is not a valid libtool archive"
5 kx
5 kx library_names=
5 kx old_library=
5 kx relink_command=
5 kx func_source "$file"
5 kx
5 kx # Add the libdir to current_libdirs if it is the destination.
5 kx if test "X$destdir" = "X$libdir"; then
5 kx case "$current_libdirs " in
5 kx *" $libdir "*) ;;
5 kx *) func_append current_libdirs " $libdir" ;;
5 kx esac
5 kx else
5 kx # Note the libdir as a future libdir.
5 kx case "$future_libdirs " in
5 kx *" $libdir "*) ;;
5 kx *) func_append future_libdirs " $libdir" ;;
5 kx esac
5 kx fi
5 kx
5 kx func_dirname "$file" "/" ""
5 kx dir=$func_dirname_result
5 kx func_append dir "$objdir"
5 kx
5 kx if test -n "$relink_command"; then
5 kx # Determine the prefix the user has applied to our future dir.
5 kx inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
5 kx
5 kx # Don't allow the user to place us outside of our expected
5 kx # location b/c this prevents finding dependent libraries that
5 kx # are installed to the same prefix.
5 kx # At present, this check doesn't affect windows .dll's that
5 kx # are installed into $libdir/../bin (currently, that works fine)
5 kx # but it's something to keep an eye on.
5 kx test "$inst_prefix_dir" = "$destdir" && \
5 kx func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
5 kx
5 kx if test -n "$inst_prefix_dir"; then
5 kx # Stick the inst_prefix_dir data into the link command.
5 kx relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5 kx else
5 kx relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5 kx fi
5 kx
5 kx func_warning "relinking '$file'"
5 kx func_show_eval "$relink_command" \
5 kx 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
5 kx fi
5 kx
5 kx # See the names of the shared library.
5 kx set dummy $library_names; shift
5 kx if test -n "$1"; then
5 kx realname=$1
5 kx shift
5 kx
5 kx srcname=$realname
5 kx test -n "$relink_command" && srcname=${realname}T
5 kx
5 kx # Install the shared library and build the symlinks.
5 kx func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
5 kx 'exit $?'
5 kx tstripme=$stripme
5 kx case $host_os in
5 kx cygwin* | mingw* | pw32* | cegcc*)
5 kx case $realname in
5 kx *.dll.a)
5 kx tstripme=
5 kx ;;
5 kx esac
5 kx ;;
5 kx os2*)
5 kx case $realname in
5 kx *_dll.a)
5 kx tstripme=
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx if test -n "$tstripme" && test -n "$striplib"; then
5 kx func_show_eval "$striplib $destdir/$realname" 'exit $?'
5 kx fi
5 kx
5 kx if test "$#" -gt 0; then
5 kx # Delete the old symlinks, and create new ones.
5 kx # Try 'ln -sf' first, because the 'ln' binary might depend on
5 kx # the symlink we replace! Solaris /bin/ln does not understand -f,
5 kx # so we also need to try rm && ln -s.
5 kx for linkname
5 kx do
5 kx test "$linkname" != "$realname" \
5 kx && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
5 kx done
5 kx fi
5 kx
5 kx # Do each command in the postinstall commands.
5 kx lib=$destdir/$realname
5 kx func_execute_cmds "$postinstall_cmds" 'exit $?'
5 kx fi
5 kx
5 kx # Install the pseudo-library for information purposes.
5 kx func_basename "$file"
5 kx name=$func_basename_result
5 kx instname=$dir/${name}i
5 kx func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
5 kx
5 kx # Maybe install the static library, too.
5 kx test -n "$old_library" && func_append staticlibs " $dir/$old_library"
5 kx ;;
5 kx
5 kx *.lo)
5 kx # Install (i.e. copy) a libtool object.
5 kx
5 kx # Figure out destination file name, if it wasn't already specified.
5 kx if test -n "$destname"; then
5 kx destfile=$destdir/$destname
5 kx else
5 kx func_basename "$file"
5 kx destfile=$func_basename_result
5 kx destfile=$destdir/$destfile
5 kx fi
5 kx
5 kx # Deduce the name of the destination old-style object file.
5 kx case $destfile in
5 kx *.lo)
5 kx func_lo2o "$destfile"
5 kx staticdest=$func_lo2o_result
5 kx ;;
5 kx *.$objext)
5 kx staticdest=$destfile
5 kx destfile=
5 kx ;;
5 kx *)
5 kx func_fatal_help "cannot copy a libtool object to '$destfile'"
5 kx ;;
5 kx esac
5 kx
5 kx # Install the libtool object if requested.
5 kx test -n "$destfile" && \
5 kx func_show_eval "$install_prog $file $destfile" 'exit $?'
5 kx
5 kx # Install the old object if enabled.
5 kx if test yes = "$build_old_libs"; then
5 kx # Deduce the name of the old-style object file.
5 kx func_lo2o "$file"
5 kx staticobj=$func_lo2o_result
5 kx func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
5 kx fi
5 kx exit $EXIT_SUCCESS
5 kx ;;
5 kx
5 kx *)
5 kx # Figure out destination file name, if it wasn't already specified.
5 kx if test -n "$destname"; then
5 kx destfile=$destdir/$destname
5 kx else
5 kx func_basename "$file"
5 kx destfile=$func_basename_result
5 kx destfile=$destdir/$destfile
5 kx fi
5 kx
5 kx # If the file is missing, and there is a .exe on the end, strip it
5 kx # because it is most likely a libtool script we actually want to
5 kx # install
5 kx stripped_ext=
5 kx case $file in
5 kx *.exe)
5 kx if test ! -f "$file"; then
5 kx func_stripname '' '.exe' "$file"
5 kx file=$func_stripname_result
5 kx stripped_ext=.exe
5 kx fi
5 kx ;;
5 kx esac
5 kx
5 kx # Do a test to see if this is really a libtool program.
5 kx case $host in
5 kx *cygwin* | *mingw*)
5 kx if func_ltwrapper_executable_p "$file"; then
5 kx func_ltwrapper_scriptname "$file"
5 kx wrapper=$func_ltwrapper_scriptname_result
5 kx else
5 kx func_stripname '' '.exe' "$file"
5 kx wrapper=$func_stripname_result
5 kx fi
5 kx ;;
5 kx *)
5 kx wrapper=$file
5 kx ;;
5 kx esac
5 kx if func_ltwrapper_script_p "$wrapper"; then
5 kx notinst_deplibs=
5 kx relink_command=
5 kx
5 kx func_source "$wrapper"
5 kx
5 kx # Check the variables that should have been set.
5 kx test -z "$generated_by_libtool_version" && \
5 kx func_fatal_error "invalid libtool wrapper script '$wrapper'"
5 kx
5 kx finalize=:
5 kx for lib in $notinst_deplibs; do
5 kx # Check to see that each library is installed.
5 kx libdir=
5 kx if test -f "$lib"; then
5 kx func_source "$lib"
5 kx fi
5 kx libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
5 kx if test -n "$libdir" && test ! -f "$libfile"; then
5 kx func_warning "'$lib' has not been installed in '$libdir'"
5 kx finalize=false
5 kx fi
5 kx done
5 kx
5 kx relink_command=
5 kx func_source "$wrapper"
5 kx
5 kx outputname=
5 kx if test no = "$fast_install" && test -n "$relink_command"; then
5 kx $opt_dry_run || {
5 kx if $finalize; then
5 kx tmpdir=`func_mktempdir`
5 kx func_basename "$file$stripped_ext"
5 kx file=$func_basename_result
5 kx outputname=$tmpdir/$file
5 kx # Replace the output file specification.
5 kx relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
5 kx
5 kx $opt_quiet || {
5 kx func_quote_for_expand "$relink_command"
5 kx eval "func_echo $func_quote_for_expand_result"
5 kx }
5 kx if eval "$relink_command"; then :
5 kx else
5 kx func_error "error: relink '$file' with the above command before installing it"
5 kx $opt_dry_run || ${RM}r "$tmpdir"
5 kx continue
5 kx fi
5 kx file=$outputname
5 kx else
5 kx func_warning "cannot relink '$file'"
5 kx fi
5 kx }
5 kx else
5 kx # Install the binary that we compiled earlier.
5 kx file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
5 kx fi
5 kx fi
5 kx
5 kx # remove .exe since cygwin /usr/bin/install will append another
5 kx # one anyway
5 kx case $install_prog,$host in
5 kx */usr/bin/install*,*cygwin*)
5 kx case $file:$destfile in
5 kx *.exe:*.exe)
5 kx # this is ok
5 kx ;;
5 kx *.exe:*)
5 kx destfile=$destfile.exe
5 kx ;;
5 kx *:*.exe)
5 kx func_stripname '' '.exe' "$destfile"
5 kx destfile=$func_stripname_result
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
5 kx $opt_dry_run || if test -n "$outputname"; then
5 kx ${RM}r "$tmpdir"
5 kx fi
5 kx ;;
5 kx esac
5 kx done
5 kx
5 kx for file in $staticlibs; do
5 kx func_basename "$file"
5 kx name=$func_basename_result
5 kx
5 kx # Set up the ranlib parameters.
5 kx oldlib=$destdir/$name
5 kx func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
5 kx tool_oldlib=$func_to_tool_file_result
5 kx
5 kx func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
5 kx
5 kx if test -n "$stripme" && test -n "$old_striplib"; then
5 kx func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
5 kx fi
5 kx
5 kx # Do each command in the postinstall commands.
5 kx func_execute_cmds "$old_postinstall_cmds" 'exit $?'
5 kx done
5 kx
5 kx test -n "$future_libdirs" && \
5 kx func_warning "remember to run '$progname --finish$future_libdirs'"
5 kx
5 kx if test -n "$current_libdirs"; then
5 kx # Maybe just do a dry run.
5 kx $opt_dry_run && current_libdirs=" -n$current_libdirs"
5 kx exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
5 kx else
5 kx exit $EXIT_SUCCESS
5 kx fi
5 kx }
5 kx
5 kx test install = "$opt_mode" && func_mode_install ${1+"$@"}
5 kx
5 kx
5 kx # func_generate_dlsyms outputname originator pic_p
5 kx # Extract symbols from dlprefiles and create ${outputname}S.o with
5 kx # a dlpreopen symbol table.
5 kx func_generate_dlsyms ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx my_outputname=$1
5 kx my_originator=$2
5 kx my_pic_p=${3-false}
5 kx my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
5 kx my_dlsyms=
5 kx
5 kx if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
5 kx if test -n "$NM" && test -n "$global_symbol_pipe"; then
5 kx my_dlsyms=${my_outputname}S.c
5 kx else
5 kx func_error "not configured to extract global symbols from dlpreopened files"
5 kx fi
5 kx fi
5 kx
5 kx if test -n "$my_dlsyms"; then
5 kx case $my_dlsyms in
5 kx "") ;;
5 kx *.c)
5 kx # Discover the nlist of each of the dlfiles.
5 kx nlist=$output_objdir/$my_outputname.nm
5 kx
5 kx func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
5 kx
5 kx # Parse the name list into a source file.
5 kx func_verbose "creating $output_objdir/$my_dlsyms"
5 kx
5 kx $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
5 kx /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
5 kx /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
5 kx
5 kx #ifdef __cplusplus
5 kx extern \"C\" {
5 kx #endif
5 kx
5 kx #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
5 kx #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
5 kx #endif
5 kx
5 kx /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5 kx #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5 kx /* DATA imports from DLLs on WIN32 can't be const, because runtime
5 kx relocations are performed -- see ld's documentation on pseudo-relocs. */
5 kx # define LT_DLSYM_CONST
5 kx #elif defined __osf__
5 kx /* This system does not cope well with relocations in const data. */
5 kx # define LT_DLSYM_CONST
5 kx #else
5 kx # define LT_DLSYM_CONST const
5 kx #endif
5 kx
5 kx #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5 kx
5 kx /* External symbol declarations for the compiler. */\
5 kx "
5 kx
5 kx if test yes = "$dlself"; then
5 kx func_verbose "generating symbol list for '$output'"
5 kx
5 kx $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
5 kx
5 kx # Add our own program objects to the symbol list.
5 kx progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5 kx for progfile in $progfiles; do
5 kx func_to_tool_file "$progfile" func_convert_file_msys_to_w32
5 kx func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
5 kx $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
5 kx done
5 kx
5 kx if test -n "$exclude_expsyms"; then
5 kx $opt_dry_run || {
5 kx eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
5 kx eval '$MV "$nlist"T "$nlist"'
5 kx }
5 kx fi
5 kx
5 kx if test -n "$export_symbols_regex"; then
5 kx $opt_dry_run || {
5 kx eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
5 kx eval '$MV "$nlist"T "$nlist"'
5 kx }
5 kx fi
5 kx
5 kx # Prepare the list of exported symbols
5 kx if test -z "$export_symbols"; then
5 kx export_symbols=$output_objdir/$outputname.exp
5 kx $opt_dry_run || {
5 kx $RM $export_symbols
5 kx eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
5 kx case $host in
5 kx *cygwin* | *mingw* | *cegcc* )
5 kx eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5 kx eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
5 kx ;;
5 kx esac
5 kx }
5 kx else
5 kx $opt_dry_run || {
5 kx eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
5 kx eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
5 kx eval '$MV "$nlist"T "$nlist"'
5 kx case $host in
5 kx *cygwin* | *mingw* | *cegcc* )
5 kx eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5 kx eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
5 kx ;;
5 kx esac
5 kx }
5 kx fi
5 kx fi
5 kx
5 kx for dlprefile in $dlprefiles; do
5 kx func_verbose "extracting global C symbols from '$dlprefile'"
5 kx func_basename "$dlprefile"
5 kx name=$func_basename_result
5 kx case $host in
5 kx *cygwin* | *mingw* | *cegcc* )
5 kx # if an import library, we need to obtain dlname
5 kx if func_win32_import_lib_p "$dlprefile"; then
5 kx func_tr_sh "$dlprefile"
5 kx eval "curr_lafile=\$libfile_$func_tr_sh_result"
5 kx dlprefile_dlbasename=
5 kx if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
5 kx # Use subshell, to avoid clobbering current variable values
5 kx dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
5 kx if test -n "$dlprefile_dlname"; then
5 kx func_basename "$dlprefile_dlname"
5 kx dlprefile_dlbasename=$func_basename_result
5 kx else
5 kx # no lafile. user explicitly requested -dlpreopen <import library>.
5 kx $sharedlib_from_linklib_cmd "$dlprefile"
5 kx dlprefile_dlbasename=$sharedlib_from_linklib_result
5 kx fi
5 kx fi
5 kx $opt_dry_run || {
5 kx if test -n "$dlprefile_dlbasename"; then
5 kx eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
5 kx else
5 kx func_warning "Could not compute DLL name from $name"
5 kx eval '$ECHO ": $name " >> "$nlist"'
5 kx fi
5 kx func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5 kx eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5 kx $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
5 kx }
5 kx else # not an import lib
5 kx $opt_dry_run || {
5 kx eval '$ECHO ": $name " >> "$nlist"'
5 kx func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5 kx eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5 kx }
5 kx fi
5 kx ;;
5 kx *)
5 kx $opt_dry_run || {
5 kx eval '$ECHO ": $name " >> "$nlist"'
5 kx func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5 kx eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5 kx }
5 kx ;;
5 kx esac
5 kx done
5 kx
5 kx $opt_dry_run || {
5 kx # Make sure we have at least an empty file.
5 kx test -f "$nlist" || : > "$nlist"
5 kx
5 kx if test -n "$exclude_expsyms"; then
5 kx $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
5 kx $MV "$nlist"T "$nlist"
5 kx fi
5 kx
5 kx # Try sorting and uniquifying the output.
5 kx if $GREP -v "^: " < "$nlist" |
5 kx if sort -k 3 </dev/null >/dev/null 2>&1; then
5 kx sort -k 3
5 kx else
5 kx sort +2
5 kx fi |
5 kx uniq > "$nlist"S; then
5 kx :
5 kx else
5 kx $GREP -v "^: " < "$nlist" > "$nlist"S
5 kx fi
5 kx
5 kx if test -f "$nlist"S; then
5 kx eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
5 kx else
5 kx echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
5 kx fi
5 kx
5 kx func_show_eval '$RM "${nlist}I"'
5 kx if test -n "$global_symbol_to_import"; then
5 kx eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
5 kx fi
5 kx
5 kx echo >> "$output_objdir/$my_dlsyms" "\
5 kx
5 kx /* The mapping between symbol names and symbols. */
5 kx typedef struct {
5 kx const char *name;
5 kx void *address;
5 kx } lt_dlsymlist;
5 kx extern LT_DLSYM_CONST lt_dlsymlist
5 kx lt_${my_prefix}_LTX_preloaded_symbols[];\
5 kx "
5 kx
5 kx if test -s "$nlist"I; then
5 kx echo >> "$output_objdir/$my_dlsyms" "\
5 kx static void lt_syminit(void)
5 kx {
5 kx LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
5 kx for (; symbol->name; ++symbol)
5 kx {"
5 kx $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
5 kx echo >> "$output_objdir/$my_dlsyms" "\
5 kx }
5 kx }"
5 kx fi
5 kx echo >> "$output_objdir/$my_dlsyms" "\
5 kx LT_DLSYM_CONST lt_dlsymlist
5 kx lt_${my_prefix}_LTX_preloaded_symbols[] =
5 kx { {\"$my_originator\", (void *) 0},"
5 kx
5 kx if test -s "$nlist"I; then
5 kx echo >> "$output_objdir/$my_dlsyms" "\
5 kx {\"@INIT@\", (void *) <_syminit},"
5 kx fi
5 kx
5 kx case $need_lib_prefix in
5 kx no)
5 kx eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5 kx ;;
5 kx *)
5 kx eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5 kx ;;
5 kx esac
5 kx echo >> "$output_objdir/$my_dlsyms" "\
5 kx {0, (void *) 0}
5 kx };
5 kx
5 kx /* This works around a problem in FreeBSD linker */
5 kx #ifdef FREEBSD_WORKAROUND
5 kx static const void *lt_preloaded_setup() {
5 kx return lt_${my_prefix}_LTX_preloaded_symbols;
5 kx }
5 kx #endif
5 kx
5 kx #ifdef __cplusplus
5 kx }
5 kx #endif\
5 kx "
5 kx } # !$opt_dry_run
5 kx
5 kx pic_flag_for_symtable=
5 kx case "$compile_command " in
5 kx *" -static "*) ;;
5 kx *)
5 kx case $host in
5 kx # compiling the symbol table file with pic_flag works around
5 kx # a FreeBSD bug that causes programs to crash when -lm is
5 kx # linked before any other PIC object. But we must not use
5 kx # pic_flag when linking with -static. The problem exists in
5 kx # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5 kx *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5 kx pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5 kx *-*-hpux*)
5 kx pic_flag_for_symtable=" $pic_flag" ;;
5 kx *)
5 kx $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx symtab_cflags=
5 kx for arg in $LTCFLAGS; do
5 kx case $arg in
5 kx -pie | -fpie | -fPIE) ;;
5 kx *) func_append symtab_cflags " $arg" ;;
5 kx esac
5 kx done
5 kx
5 kx # Now compile the dynamic symbol file.
5 kx func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5 kx
5 kx # Clean up the generated files.
5 kx func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5 kx
5 kx # Transform the symbol file into the correct name.
5 kx symfileobj=$output_objdir/${my_outputname}S.$objext
5 kx case $host in
5 kx *cygwin* | *mingw* | *cegcc* )
5 kx if test -f "$output_objdir/$my_outputname.def"; then
5 kx compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5 kx finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5 kx else
5 kx compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5 kx finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5 kx fi
5 kx ;;
5 kx *)
5 kx compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5 kx finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5 kx ;;
5 kx esac
5 kx ;;
5 kx *)
5 kx func_fatal_error "unknown suffix for '$my_dlsyms'"
5 kx ;;
5 kx esac
5 kx else
5 kx # We keep going just in case the user didn't refer to
5 kx # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5 kx # really was required.
5 kx
5 kx # Nullify the symbol file.
5 kx compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5 kx finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5 kx fi
5 kx }
5 kx
5 kx # func_cygming_gnu_implib_p ARG
5 kx # This predicate returns with zero status (TRUE) if
5 kx # ARG is a GNU/binutils-style import library. Returns
5 kx # with nonzero status (FALSE) otherwise.
5 kx func_cygming_gnu_implib_p ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_tool_file "$1" func_convert_file_msys_to_w32
5 kx func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
5 kx test -n "$func_cygming_gnu_implib_tmp"
5 kx }
5 kx
5 kx # func_cygming_ms_implib_p ARG
5 kx # This predicate returns with zero status (TRUE) if
5 kx # ARG is an MS-style import library. Returns
5 kx # with nonzero status (FALSE) otherwise.
5 kx func_cygming_ms_implib_p ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx func_to_tool_file "$1" func_convert_file_msys_to_w32
5 kx func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5 kx test -n "$func_cygming_ms_implib_tmp"
5 kx }
5 kx
5 kx # func_win32_libid arg
5 kx # return the library type of file 'arg'
5 kx #
5 kx # Need a lot of goo to handle *both* DLLs and import libs
5 kx # Has to be a shell function in order to 'eat' the argument
5 kx # that is supplied when $file_magic_command is called.
5 kx # Despite the name, also deal with 64 bit binaries.
5 kx func_win32_libid ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx win32_libid_type=unknown
5 kx win32_fileres=`file -L $1 2>/dev/null`
5 kx case $win32_fileres in
5 kx *ar\ archive\ import\ library*) # definitely import
5 kx win32_libid_type="x86 archive import"
5 kx ;;
5 kx *ar\ archive*) # could be an import, or static
5 kx # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5 kx if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5 kx $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5 kx case $nm_interface in
5 kx "MS dumpbin")
5 kx if func_cygming_ms_implib_p "$1" ||
5 kx func_cygming_gnu_implib_p "$1"
5 kx then
5 kx win32_nmres=import
5 kx else
5 kx win32_nmres=
5 kx fi
5 kx ;;
5 kx *)
5 kx func_to_tool_file "$1" func_convert_file_msys_to_w32
5 kx win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5 kx $SED -n -e '
5 kx 1,100{
5 kx / I /{
5 kx s|.*|import|
5 kx p
5 kx q
5 kx }
5 kx }'`
5 kx ;;
5 kx esac
5 kx case $win32_nmres in
5 kx import*) win32_libid_type="x86 archive import";;
5 kx *) win32_libid_type="x86 archive static";;
5 kx esac
5 kx fi
5 kx ;;
5 kx *DLL*)
5 kx win32_libid_type="x86 DLL"
5 kx ;;
5 kx *executable*) # but shell scripts are "executable" too...
5 kx case $win32_fileres in
5 kx *MS\ Windows\ PE\ Intel*)
5 kx win32_libid_type="x86 DLL"
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx $ECHO "$win32_libid_type"
5 kx }
5 kx
5 kx # func_cygming_dll_for_implib ARG
5 kx #
5 kx # Platform-specific function to extract the
5 kx # name of the DLL associated with the specified
5 kx # import library ARG.
5 kx # Invoked by eval'ing the libtool variable
5 kx # $sharedlib_from_linklib_cmd
5 kx # Result is available in the variable
5 kx # $sharedlib_from_linklib_result
5 kx func_cygming_dll_for_implib ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5 kx }
5 kx
5 kx # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5 kx #
5 kx # The is the core of a fallback implementation of a
5 kx # platform-specific function to extract the name of the
5 kx # DLL associated with the specified import library LIBNAME.
5 kx #
5 kx # SECTION_NAME is either .idata$6 or .idata$7, depending
5 kx # on the platform and compiler that created the implib.
5 kx #
5 kx # Echos the name of the DLL associated with the
5 kx # specified import library.
5 kx func_cygming_dll_for_implib_fallback_core ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5 kx $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5 kx $SED '/^Contents of section '"$match_literal"':/{
5 kx # Place marker at beginning of archive member dllname section
5 kx s/.*/====MARK====/
5 kx p
5 kx d
5 kx }
5 kx # These lines can sometimes be longer than 43 characters, but
5 kx # are always uninteresting
5 kx /:[ ]*file format pe[i]\{,1\}-/d
5 kx /^In archive [^:]*:/d
5 kx # Ensure marker is printed
5 kx /^====MARK====/p
5 kx # Remove all lines with less than 43 characters
5 kx /^.\{43\}/!d
5 kx # From remaining lines, remove first 43 characters
5 kx s/^.\{43\}//' |
5 kx $SED -n '
5 kx # Join marker and all lines until next marker into a single line
5 kx /^====MARK====/ b para
5 kx H
5 kx $ b para
5 kx b
5 kx :para
5 kx x
5 kx s/\n//g
5 kx # Remove the marker
5 kx s/^====MARK====//
5 kx # Remove trailing dots and whitespace
5 kx s/[\. \t]*$//
5 kx # Print
5 kx /./p' |
5 kx # we now have a list, one entry per line, of the stringified
5 kx # contents of the appropriate section of all members of the
5 kx # archive that possess that section. Heuristic: eliminate
5 kx # all those that have a first or second character that is
5 kx # a '.' (that is, objdump's representation of an unprintable
5 kx # character.) This should work for all archives with less than
5 kx # 0x302f exports -- but will fail for DLLs whose name actually
5 kx # begins with a literal '.' or a single character followed by
5 kx # a '.'.
5 kx #
5 kx # Of those that remain, print the first one.
5 kx $SED -e '/^\./d;/^.\./d;q'
5 kx }
5 kx
5 kx # func_cygming_dll_for_implib_fallback ARG
5 kx # Platform-specific function to extract the
5 kx # name of the DLL associated with the specified
5 kx # import library ARG.
5 kx #
5 kx # This fallback implementation is for use when $DLLTOOL
5 kx # does not support the --identify-strict option.
5 kx # Invoked by eval'ing the libtool variable
5 kx # $sharedlib_from_linklib_cmd
5 kx # Result is available in the variable
5 kx # $sharedlib_from_linklib_result
5 kx func_cygming_dll_for_implib_fallback ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx if func_cygming_gnu_implib_p "$1"; then
5 kx # binutils import library
5 kx sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5 kx elif func_cygming_ms_implib_p "$1"; then
5 kx # ms-generated import library
5 kx sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5 kx else
5 kx # unknown
5 kx sharedlib_from_linklib_result=
5 kx fi
5 kx }
5 kx
5 kx
5 kx # func_extract_an_archive dir oldlib
5 kx func_extract_an_archive ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx f_ex_an_ar_dir=$1; shift
5 kx f_ex_an_ar_oldlib=$1
5 kx if test yes = "$lock_old_archive_extraction"; then
5 kx lockfile=$f_ex_an_ar_oldlib.lock
5 kx until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5 kx func_echo "Waiting for $lockfile to be removed"
5 kx sleep 2
5 kx done
5 kx fi
5 kx func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5 kx 'stat=$?; rm -f "$lockfile"; exit $stat'
5 kx if test yes = "$lock_old_archive_extraction"; then
5 kx $opt_dry_run || rm -f "$lockfile"
5 kx fi
5 kx if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5 kx :
5 kx else
5 kx func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5 kx fi
5 kx }
5 kx
5 kx
5 kx # func_extract_archives gentop oldlib ...
5 kx func_extract_archives ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx my_gentop=$1; shift
5 kx my_oldlibs=${1+"$@"}
5 kx my_oldobjs=
5 kx my_xlib=
5 kx my_xabs=
5 kx my_xdir=
5 kx
5 kx for my_xlib in $my_oldlibs; do
5 kx # Extract the objects.
5 kx case $my_xlib in
5 kx [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5 kx *) my_xabs=`pwd`"/$my_xlib" ;;
5 kx esac
5 kx func_basename "$my_xlib"
5 kx my_xlib=$func_basename_result
5 kx my_xlib_u=$my_xlib
5 kx while :; do
5 kx case " $extracted_archives " in
5 kx *" $my_xlib_u "*)
5 kx func_arith $extracted_serial + 1
5 kx extracted_serial=$func_arith_result
5 kx my_xlib_u=lt$extracted_serial-$my_xlib ;;
5 kx *) break ;;
5 kx esac
5 kx done
5 kx extracted_archives="$extracted_archives $my_xlib_u"
5 kx my_xdir=$my_gentop/$my_xlib_u
5 kx
5 kx func_mkdir_p "$my_xdir"
5 kx
5 kx case $host in
5 kx *-darwin*)
5 kx func_verbose "Extracting $my_xabs"
5 kx # Do not bother doing anything if just a dry run
5 kx $opt_dry_run || {
5 kx darwin_orig_dir=`pwd`
5 kx cd $my_xdir || exit $?
5 kx darwin_archive=$my_xabs
5 kx darwin_curdir=`pwd`
5 kx func_basename "$darwin_archive"
5 kx darwin_base_archive=$func_basename_result
5 kx darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5 kx if test -n "$darwin_arches"; then
5 kx darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5 kx darwin_arch=
5 kx func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5 kx for darwin_arch in $darwin_arches; do
5 kx func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5 kx $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5 kx cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5 kx func_extract_an_archive "`pwd`" "$darwin_base_archive"
5 kx cd "$darwin_curdir"
5 kx $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5 kx done # $darwin_arches
5 kx ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5 kx darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5 kx darwin_file=
5 kx darwin_files=
5 kx for darwin_file in $darwin_filelist; do
5 kx darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5 kx $LIPO -create -output "$darwin_file" $darwin_files
5 kx done # $darwin_filelist
5 kx $RM -rf unfat-$$
5 kx cd "$darwin_orig_dir"
5 kx else
5 kx cd $darwin_orig_dir
5 kx func_extract_an_archive "$my_xdir" "$my_xabs"
5 kx fi # $darwin_arches
5 kx } # !$opt_dry_run
5 kx ;;
5 kx *)
5 kx func_extract_an_archive "$my_xdir" "$my_xabs"
5 kx ;;
5 kx esac
5 kx my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5 kx done
5 kx
5 kx func_extract_archives_result=$my_oldobjs
5 kx }
5 kx
5 kx
5 kx # func_emit_wrapper [arg=no]
5 kx #
5 kx # Emit a libtool wrapper script on stdout.
5 kx # Don't directly open a file because we may want to
5 kx # incorporate the script contents within a cygwin/mingw
5 kx # wrapper executable. Must ONLY be called from within
5 kx # func_mode_link because it depends on a number of variables
5 kx # set therein.
5 kx #
5 kx # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5 kx # variable will take. If 'yes', then the emitted script
5 kx # will assume that the directory where it is stored is
5 kx # the $objdir directory. This is a cygwin/mingw-specific
5 kx # behavior.
5 kx func_emit_wrapper ()
5 kx {
5 kx func_emit_wrapper_arg1=${1-no}
5 kx
5 kx $ECHO "\
5 kx #! $SHELL
5 kx
5 kx # $output - temporary wrapper script for $objdir/$outputname
5 kx # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5 kx #
5 kx # The $output program cannot be directly executed until all the libtool
5 kx # libraries that it depends on are installed.
5 kx #
5 kx # This wrapper script should never be moved out of the build directory.
5 kx # If it is, it will not operate correctly.
5 kx
5 kx # Sed substitution that helps us do robust quoting. It backslashifies
5 kx # metacharacters that are still active within double-quoted strings.
5 kx sed_quote_subst='$sed_quote_subst'
5 kx
5 kx # Be Bourne compatible
5 kx if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5 kx emulate sh
5 kx NULLCMD=:
5 kx # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5 kx # is contrary to our usage. Disable this feature.
5 kx alias -g '\${1+\"\$@\"}'='\"\$@\"'
5 kx setopt NO_GLOB_SUBST
5 kx else
5 kx case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5 kx fi
5 kx BIN_SH=xpg4; export BIN_SH # for Tru64
5 kx DUALCASE=1; export DUALCASE # for MKS sh
5 kx
5 kx # The HP-UX ksh and POSIX shell print the target directory to stdout
5 kx # if CDPATH is set.
5 kx (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5 kx
5 kx relink_command=\"$relink_command\"
5 kx
5 kx # This environment variable determines our operation mode.
5 kx if test \"\$libtool_install_magic\" = \"$magic\"; then
5 kx # install mode needs the following variables:
5 kx generated_by_libtool_version='$macro_version'
5 kx notinst_deplibs='$notinst_deplibs'
5 kx else
5 kx # When we are sourced in execute mode, \$file and \$ECHO are already set.
5 kx if test \"\$libtool_execute_magic\" != \"$magic\"; then
5 kx file=\"\$0\""
5 kx
5 kx qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5 kx $ECHO "\
5 kx
5 kx # A function that is used when there is no print builtin or printf.
5 kx func_fallback_echo ()
5 kx {
5 kx eval 'cat <<_LTECHO_EOF
5 kx \$1
5 kx _LTECHO_EOF'
5 kx }
5 kx ECHO=\"$qECHO\"
5 kx fi
5 kx
5 kx # Very basic option parsing. These options are (a) specific to
5 kx # the libtool wrapper, (b) are identical between the wrapper
5 kx # /script/ and the wrapper /executable/ that is used only on
5 kx # windows platforms, and (c) all begin with the string "--lt-"
5 kx # (application programs are unlikely to have options that match
5 kx # this pattern).
5 kx #
5 kx # There are only two supported options: --lt-debug and
5 kx # --lt-dump-script. There is, deliberately, no --lt-help.
5 kx #
5 kx # The first argument to this parsing function should be the
5 kx # script's $0 value, followed by "$@".
5 kx lt_option_debug=
5 kx func_parse_lt_options ()
5 kx {
5 kx lt_script_arg0=\$0
5 kx shift
5 kx for lt_opt
5 kx do
5 kx case \"\$lt_opt\" in
5 kx --lt-debug) lt_option_debug=1 ;;
5 kx --lt-dump-script)
5 kx lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5 kx test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5 kx lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5 kx cat \"\$lt_dump_D/\$lt_dump_F\"
5 kx exit 0
5 kx ;;
5 kx --lt-*)
5 kx \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5 kx exit 1
5 kx ;;
5 kx esac
5 kx done
5 kx
5 kx # Print the debug banner immediately:
5 kx if test -n \"\$lt_option_debug\"; then
5 kx echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5 kx fi
5 kx }
5 kx
5 kx # Used when --lt-debug. Prints its arguments to stdout
5 kx # (redirection is the responsibility of the caller)
5 kx func_lt_dump_args ()
5 kx {
5 kx lt_dump_args_N=1;
5 kx for lt_arg
5 kx do
5 kx \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5 kx lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5 kx done
5 kx }
5 kx
5 kx # Core function for launching the target application
5 kx func_exec_program_core ()
5 kx {
5 kx "
5 kx case $host in
5 kx # Backslashes separate directories on plain windows
5 kx *-*-mingw | *-*-os2* | *-cegcc*)
5 kx $ECHO "\
5 kx if test -n \"\$lt_option_debug\"; then
5 kx \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5 kx func_lt_dump_args \${1+\"\$@\"} 1>&2
5 kx fi
5 kx exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5 kx "
5 kx ;;
5 kx
5 kx *)
5 kx $ECHO "\
5 kx if test -n \"\$lt_option_debug\"; then
5 kx \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5 kx func_lt_dump_args \${1+\"\$@\"} 1>&2
5 kx fi
5 kx exec \"\$progdir/\$program\" \${1+\"\$@\"}
5 kx "
5 kx ;;
5 kx esac
5 kx $ECHO "\
5 kx \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5 kx exit 1
5 kx }
5 kx
5 kx # A function to encapsulate launching the target application
5 kx # Strips options in the --lt-* namespace from \$@ and
5 kx # launches target application with the remaining arguments.
5 kx func_exec_program ()
5 kx {
5 kx case \" \$* \" in
5 kx *\\ --lt-*)
5 kx for lt_wr_arg
5 kx do
5 kx case \$lt_wr_arg in
5 kx --lt-*) ;;
5 kx *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5 kx esac
5 kx shift
5 kx done ;;
5 kx esac
5 kx func_exec_program_core \${1+\"\$@\"}
5 kx }
5 kx
5 kx # Parse options
5 kx func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5 kx
5 kx # Find the directory that this script lives in.
5 kx thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5 kx test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5 kx
5 kx # Follow symbolic links until we get to the real thisdir.
5 kx file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5 kx while test -n \"\$file\"; do
5 kx destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5 kx
5 kx # If there was a directory component, then change thisdir.
5 kx if test \"x\$destdir\" != \"x\$file\"; then
5 kx case \"\$destdir\" in
5 kx [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5 kx *) thisdir=\"\$thisdir/\$destdir\" ;;
5 kx esac
5 kx fi
5 kx
5 kx file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5 kx file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5 kx done
5 kx
5 kx # Usually 'no', except on cygwin/mingw when embedded into
5 kx # the cwrapper.
5 kx WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5 kx if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5 kx # special case for '.'
5 kx if test \"\$thisdir\" = \".\"; then
5 kx thisdir=\`pwd\`
5 kx fi
5 kx # remove .libs from thisdir
5 kx case \"\$thisdir\" in
5 kx *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5 kx $objdir ) thisdir=. ;;
5 kx esac
5 kx fi
5 kx
5 kx # Try to get the absolute directory name.
5 kx absdir=\`cd \"\$thisdir\" && pwd\`
5 kx test -n \"\$absdir\" && thisdir=\"\$absdir\"
5 kx "
5 kx
5 kx if test yes = "$fast_install"; then
5 kx $ECHO "\
5 kx program=lt-'$outputname'$exeext
5 kx progdir=\"\$thisdir/$objdir\"
5 kx
5 kx if test ! -f \"\$progdir/\$program\" ||
5 kx { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5 kx test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5 kx
5 kx file=\"\$\$-\$program\"
5 kx
5 kx if test ! -d \"\$progdir\"; then
5 kx $MKDIR \"\$progdir\"
5 kx else
5 kx $RM \"\$progdir/\$file\"
5 kx fi"
5 kx
5 kx $ECHO "\
5 kx
5 kx # relink executable if necessary
5 kx if test -n \"\$relink_command\"; then
5 kx if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5 kx else
5 kx \$ECHO \"\$relink_command_output\" >&2
5 kx $RM \"\$progdir/\$file\"
5 kx exit 1
5 kx fi
5 kx fi
5 kx
5 kx $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5 kx { $RM \"\$progdir/\$program\";
5 kx $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5 kx $RM \"\$progdir/\$file\"
5 kx fi"
5 kx else
5 kx $ECHO "\
5 kx program='$outputname'
5 kx progdir=\"\$thisdir/$objdir\"
5 kx "
5 kx fi
5 kx
5 kx $ECHO "\
5 kx
5 kx if test -f \"\$progdir/\$program\"; then"
5 kx
5 kx # fixup the dll searchpath if we need to.
5 kx #
5 kx # Fix the DLL searchpath if we need to. Do this before prepending
5 kx # to shlibpath, because on Windows, both are PATH and uninstalled
5 kx # libraries must come first.
5 kx if test -n "$dllsearchpath"; then
5 kx $ECHO "\
5 kx # Add the dll search path components to the executable PATH
5 kx PATH=$dllsearchpath:\$PATH
5 kx "
5 kx fi
5 kx
5 kx # Export our shlibpath_var if we have one.
5 kx if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5 kx $ECHO "\
5 kx # Add our own library path to $shlibpath_var
5 kx $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5 kx
5 kx # Some systems cannot cope with colon-terminated $shlibpath_var
5 kx # The second colon is a workaround for a bug in BeOS R4 sed
5 kx $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5 kx
5 kx export $shlibpath_var
5 kx "
5 kx fi
5 kx
5 kx $ECHO "\
5 kx if test \"\$libtool_execute_magic\" != \"$magic\"; then
5 kx # Run the actual program with our arguments.
5 kx func_exec_program \${1+\"\$@\"}
5 kx fi
5 kx else
5 kx # The program doesn't exist.
5 kx \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5 kx \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5 kx \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5 kx exit 1
5 kx fi
5 kx fi\
5 kx "
5 kx }
5 kx
5 kx
5 kx # func_emit_cwrapperexe_src
5 kx # emit the source code for a wrapper executable on stdout
5 kx # Must ONLY be called from within func_mode_link because
5 kx # it depends on a number of variable set therein.
5 kx func_emit_cwrapperexe_src ()
5 kx {
5 kx cat <<EOF
5 kx
5 kx /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5 kx Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5 kx
5 kx The $output program cannot be directly executed until all the libtool
5 kx libraries that it depends on are installed.
5 kx
5 kx This wrapper executable should never be moved out of the build directory.
5 kx If it is, it will not operate correctly.
5 kx */
5 kx EOF
5 kx cat <<"EOF"
5 kx #ifdef _MSC_VER
5 kx # define _CRT_SECURE_NO_DEPRECATE 1
5 kx #endif
5 kx #include <stdio.h>
5 kx #include <stdlib.h>
5 kx #ifdef _MSC_VER
5 kx # include <direct.h>
5 kx # include <process.h>
5 kx # include <io.h>
5 kx #else
5 kx # include <unistd.h>
5 kx # include <stdint.h>
5 kx # ifdef __CYGWIN__
5 kx # include <io.h>
5 kx # endif
5 kx #endif
5 kx #include <malloc.h>
5 kx #include <stdarg.h>
5 kx #include <assert.h>
5 kx #include <string.h>
5 kx #include <ctype.h>
5 kx #include <errno.h>
5 kx #include <fcntl.h>
5 kx #include <sys/stat.h>
5 kx
5 kx #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5 kx
5 kx /* declarations of non-ANSI functions */
5 kx #if defined __MINGW32__
5 kx # ifdef __STRICT_ANSI__
5 kx int _putenv (const char *);
5 kx # endif
5 kx #elif defined __CYGWIN__
5 kx # ifdef __STRICT_ANSI__
5 kx char *realpath (const char *, char *);
5 kx int putenv (char *);
5 kx int setenv (const char *, const char *, int);
5 kx # endif
5 kx /* #elif defined other_platform || defined ... */
5 kx #endif
5 kx
5 kx /* portability defines, excluding path handling macros */
5 kx #if defined _MSC_VER
5 kx # define setmode _setmode
5 kx # define stat _stat
5 kx # define chmod _chmod
5 kx # define getcwd _getcwd
5 kx # define putenv _putenv
5 kx # define S_IXUSR _S_IEXEC
5 kx #elif defined __MINGW32__
5 kx # define setmode _setmode
5 kx # define stat _stat
5 kx # define chmod _chmod
5 kx # define getcwd _getcwd
5 kx # define putenv _putenv
5 kx #elif defined __CYGWIN__
5 kx # define HAVE_SETENV
5 kx # define FOPEN_WB "wb"
5 kx /* #elif defined other platforms ... */
5 kx #endif
5 kx
5 kx #if defined PATH_MAX
5 kx # define LT_PATHMAX PATH_MAX
5 kx #elif defined MAXPATHLEN
5 kx # define LT_PATHMAX MAXPATHLEN
5 kx #else
5 kx # define LT_PATHMAX 1024
5 kx #endif
5 kx
5 kx #ifndef S_IXOTH
5 kx # define S_IXOTH 0
5 kx #endif
5 kx #ifndef S_IXGRP
5 kx # define S_IXGRP 0
5 kx #endif
5 kx
5 kx /* path handling portability macros */
5 kx #ifndef DIR_SEPARATOR
5 kx # define DIR_SEPARATOR '/'
5 kx # define PATH_SEPARATOR ':'
5 kx #endif
5 kx
5 kx #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5 kx defined __OS2__
5 kx # define HAVE_DOS_BASED_FILE_SYSTEM
5 kx # define FOPEN_WB "wb"
5 kx # ifndef DIR_SEPARATOR_2
5 kx # define DIR_SEPARATOR_2 '\\'
5 kx # endif
5 kx # ifndef PATH_SEPARATOR_2
5 kx # define PATH_SEPARATOR_2 ';'
5 kx # endif
5 kx #endif
5 kx
5 kx #ifndef DIR_SEPARATOR_2
5 kx # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5 kx #else /* DIR_SEPARATOR_2 */
5 kx # define IS_DIR_SEPARATOR(ch) \
5 kx (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5 kx #endif /* DIR_SEPARATOR_2 */
5 kx
5 kx #ifndef PATH_SEPARATOR_2
5 kx # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5 kx #else /* PATH_SEPARATOR_2 */
5 kx # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5 kx #endif /* PATH_SEPARATOR_2 */
5 kx
5 kx #ifndef FOPEN_WB
5 kx # define FOPEN_WB "w"
5 kx #endif
5 kx #ifndef _O_BINARY
5 kx # define _O_BINARY 0
5 kx #endif
5 kx
5 kx #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5 kx #define XFREE(stale) do { \
5 kx if (stale) { free (stale); stale = 0; } \
5 kx } while (0)
5 kx
5 kx #if defined LT_DEBUGWRAPPER
5 kx static int lt_debug = 1;
5 kx #else
5 kx static int lt_debug = 0;
5 kx #endif
5 kx
5 kx const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
5 kx
5 kx void *xmalloc (size_t num);
5 kx char *xstrdup (const char *string);
5 kx const char *base_name (const char *name);
5 kx char *find_executable (const char *wrapper);
5 kx char *chase_symlinks (const char *pathspec);
5 kx int make_executable (const char *path);
5 kx int check_executable (const char *path);
5 kx char *strendzap (char *str, const char *pat);
5 kx void lt_debugprintf (const char *file, int line, const char *fmt, ...);
5 kx void lt_fatal (const char *file, int line, const char *message, ...);
5 kx static const char *nonnull (const char *s);
5 kx static const char *nonempty (const char *s);
5 kx void lt_setenv (const char *name, const char *value);
5 kx char *lt_extend_str (const char *orig_value, const char *add, int to_end);
5 kx void lt_update_exe_path (const char *name, const char *value);
5 kx void lt_update_lib_path (const char *name, const char *value);
5 kx char **prepare_spawn (char **argv);
5 kx void lt_dump_script (FILE *f);
5 kx EOF
5 kx
5 kx cat <<EOF
5 kx #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
5 kx # define externally_visible volatile
5 kx #else
5 kx # define externally_visible __attribute__((externally_visible)) volatile
5 kx #endif
5 kx externally_visible const char * MAGIC_EXE = "$magic_exe";
5 kx const char * LIB_PATH_VARNAME = "$shlibpath_var";
5 kx EOF
5 kx
5 kx if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5 kx func_to_host_path "$temp_rpath"
5 kx cat <<EOF
5 kx const char * LIB_PATH_VALUE = "$func_to_host_path_result";
5 kx EOF
5 kx else
5 kx cat <<"EOF"
5 kx const char * LIB_PATH_VALUE = "";
5 kx EOF
5 kx fi
5 kx
5 kx if test -n "$dllsearchpath"; then
5 kx func_to_host_path "$dllsearchpath:"
5 kx cat <<EOF
5 kx const char * EXE_PATH_VARNAME = "PATH";
5 kx const char * EXE_PATH_VALUE = "$func_to_host_path_result";
5 kx EOF
5 kx else
5 kx cat <<"EOF"
5 kx const char * EXE_PATH_VARNAME = "";
5 kx const char * EXE_PATH_VALUE = "";
5 kx EOF
5 kx fi
5 kx
5 kx if test yes = "$fast_install"; then
5 kx cat <<EOF
5 kx const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
5 kx EOF
5 kx else
5 kx cat <<EOF
5 kx const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
5 kx EOF
5 kx fi
5 kx
5 kx
5 kx cat <<"EOF"
5 kx
5 kx #define LTWRAPPER_OPTION_PREFIX "--lt-"
5 kx
5 kx static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
5 kx static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
5 kx static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
5 kx
5 kx int
5 kx main (int argc, char *argv[])
5 kx {
5 kx char **newargz;
5 kx int newargc;
5 kx char *tmp_pathspec;
5 kx char *actual_cwrapper_path;
5 kx char *actual_cwrapper_name;
5 kx char *target_name;
5 kx char *lt_argv_zero;
5 kx int rval = 127;
5 kx
5 kx int i;
5 kx
5 kx program_name = (char *) xstrdup (base_name (argv[0]));
5 kx newargz = XMALLOC (char *, (size_t) argc + 1);
5 kx
5 kx /* very simple arg parsing; don't want to rely on getopt
5 kx * also, copy all non cwrapper options to newargz, except
5 kx * argz[0], which is handled differently
5 kx */
5 kx newargc=0;
5 kx for (i = 1; i < argc; i++)
5 kx {
5 kx if (STREQ (argv[i], dumpscript_opt))
5 kx {
5 kx EOF
5 kx case $host in
5 kx *mingw* | *cygwin* )
5 kx # make stdout use "unix" line endings
5 kx echo " setmode(1,_O_BINARY);"
5 kx ;;
5 kx esac
5 kx
5 kx cat <<"EOF"
5 kx lt_dump_script (stdout);
5 kx return 0;
5 kx }
5 kx if (STREQ (argv[i], debug_opt))
5 kx {
5 kx lt_debug = 1;
5 kx continue;
5 kx }
5 kx if (STREQ (argv[i], ltwrapper_option_prefix))
5 kx {
5 kx /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
5 kx namespace, but it is not one of the ones we know about and
5 kx have already dealt with, above (inluding dump-script), then
5 kx report an error. Otherwise, targets might begin to believe
5 kx they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
5 kx namespace. The first time any user complains about this, we'll
5 kx need to make LTWRAPPER_OPTION_PREFIX a configure-time option
5 kx or a configure.ac-settable value.
5 kx */
5 kx lt_fatal (__FILE__, __LINE__,
5 kx "unrecognized %s option: '%s'",
5 kx ltwrapper_option_prefix, argv[i]);
5 kx }
5 kx /* otherwise ... */
5 kx newargz[++newargc] = xstrdup (argv[i]);
5 kx }
5 kx newargz[++newargc] = NULL;
5 kx
5 kx EOF
5 kx cat <<EOF
5 kx /* The GNU banner must be the first non-error debug message */
5 kx lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
5 kx EOF
5 kx cat <<"EOF"
5 kx lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
5 kx lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
5 kx
5 kx tmp_pathspec = find_executable (argv[0]);
5 kx if (tmp_pathspec == NULL)
5 kx lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
5 kx lt_debugprintf (__FILE__, __LINE__,
5 kx "(main) found exe (before symlink chase) at: %s\n",
5 kx tmp_pathspec);
5 kx
5 kx actual_cwrapper_path = chase_symlinks (tmp_pathspec);
5 kx lt_debugprintf (__FILE__, __LINE__,
5 kx "(main) found exe (after symlink chase) at: %s\n",
5 kx actual_cwrapper_path);
5 kx XFREE (tmp_pathspec);
5 kx
5 kx actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
5 kx strendzap (actual_cwrapper_path, actual_cwrapper_name);
5 kx
5 kx /* wrapper name transforms */
5 kx strendzap (actual_cwrapper_name, ".exe");
5 kx tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
5 kx XFREE (actual_cwrapper_name);
5 kx actual_cwrapper_name = tmp_pathspec;
5 kx tmp_pathspec = 0;
5 kx
5 kx /* target_name transforms -- use actual target program name; might have lt- prefix */
5 kx target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
5 kx strendzap (target_name, ".exe");
5 kx tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
5 kx XFREE (target_name);
5 kx target_name = tmp_pathspec;
5 kx tmp_pathspec = 0;
5 kx
5 kx lt_debugprintf (__FILE__, __LINE__,
5 kx "(main) libtool target name: %s\n",
5 kx target_name);
5 kx EOF
5 kx
5 kx cat <<EOF
5 kx newargz[0] =
5 kx XMALLOC (char, (strlen (actual_cwrapper_path) +
5 kx strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
5 kx strcpy (newargz[0], actual_cwrapper_path);
5 kx strcat (newargz[0], "$objdir");
5 kx strcat (newargz[0], "/");
5 kx EOF
5 kx
5 kx cat <<"EOF"
5 kx /* stop here, and copy so we don't have to do this twice */
5 kx tmp_pathspec = xstrdup (newargz[0]);
5 kx
5 kx /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
5 kx strcat (newargz[0], actual_cwrapper_name);
5 kx
5 kx /* DO want the lt- prefix here if it exists, so use target_name */
5 kx lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
5 kx XFREE (tmp_pathspec);
5 kx tmp_pathspec = NULL;
5 kx EOF
5 kx
5 kx case $host_os in
5 kx mingw*)
5 kx cat <<"EOF"
5 kx {
5 kx char* p;
5 kx while ((p = strchr (newargz[0], '\\')) != NULL)
5 kx {
5 kx *p = '/';
5 kx }
5 kx while ((p = strchr (lt_argv_zero, '\\')) != NULL)
5 kx {
5 kx *p = '/';
5 kx }
5 kx }
5 kx EOF
5 kx ;;
5 kx esac
5 kx
5 kx cat <<"EOF"
5 kx XFREE (target_name);
5 kx XFREE (actual_cwrapper_path);
5 kx XFREE (actual_cwrapper_name);
5 kx
5 kx lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
5 kx lt_setenv ("DUALCASE", "1"); /* for MSK sh */
5 kx /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
5 kx be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
5 kx because on Windows, both *_VARNAMEs are PATH but uninstalled
5 kx libraries must come first. */
5 kx lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
5 kx lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
5 kx
5 kx lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
5 kx nonnull (lt_argv_zero));
5 kx for (i = 0; i < newargc; i++)
5 kx {
5 kx lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
5 kx i, nonnull (newargz[i]));
5 kx }
5 kx
5 kx EOF
5 kx
5 kx case $host_os in
5 kx mingw*)
5 kx cat <<"EOF"
5 kx /* execv doesn't actually work on mingw as expected on unix */
5 kx newargz = prepare_spawn (newargz);
5 kx rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
5 kx if (rval == -1)
5 kx {
5 kx /* failed to start process */
5 kx lt_debugprintf (__FILE__, __LINE__,
5 kx "(main) failed to launch target \"%s\": %s\n",
5 kx lt_argv_zero, nonnull (strerror (errno)));
5 kx return 127;
5 kx }
5 kx return rval;
5 kx EOF
5 kx ;;
5 kx *)
5 kx cat <<"EOF"
5 kx execv (lt_argv_zero, newargz);
5 kx return rval; /* =127, but avoids unused variable warning */
5 kx EOF
5 kx ;;
5 kx esac
5 kx
5 kx cat <<"EOF"
5 kx }
5 kx
5 kx void *
5 kx xmalloc (size_t num)
5 kx {
5 kx void *p = (void *) malloc (num);
5 kx if (!p)
5 kx lt_fatal (__FILE__, __LINE__, "memory exhausted");
5 kx
5 kx return p;
5 kx }
5 kx
5 kx char *
5 kx xstrdup (const char *string)
5 kx {
5 kx return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
5 kx string) : NULL;
5 kx }
5 kx
5 kx const char *
5 kx base_name (const char *name)
5 kx {
5 kx const char *base;
5 kx
5 kx #if defined HAVE_DOS_BASED_FILE_SYSTEM
5 kx /* Skip over the disk name in MSDOS pathnames. */
5 kx if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5 kx name += 2;
5 kx #endif
5 kx
5 kx for (base = name; *name; name++)
5 kx if (IS_DIR_SEPARATOR (*name))
5 kx base = name + 1;
5 kx return base;
5 kx }
5 kx
5 kx int
5 kx check_executable (const char *path)
5 kx {
5 kx struct stat st;
5 kx
5 kx lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5 kx nonempty (path));
5 kx if ((!path) || (!*path))
5 kx return 0;
5 kx
5 kx if ((stat (path, &st) >= 0)
5 kx && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5 kx return 1;
5 kx else
5 kx return 0;
5 kx }
5 kx
5 kx int
5 kx make_executable (const char *path)
5 kx {
5 kx int rval = 0;
5 kx struct stat st;
5 kx
5 kx lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5 kx nonempty (path));
5 kx if ((!path) || (!*path))
5 kx return 0;
5 kx
5 kx if (stat (path, &st) >= 0)
5 kx {
5 kx rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5 kx }
5 kx return rval;
5 kx }
5 kx
5 kx /* Searches for the full path of the wrapper. Returns
5 kx newly allocated full path name if found, NULL otherwise
5 kx Does not chase symlinks, even on platforms that support them.
5 kx */
5 kx char *
5 kx find_executable (const char *wrapper)
5 kx {
5 kx int has_slash = 0;
5 kx const char *p;
5 kx const char *p_next;
5 kx /* static buffer for getcwd */
5 kx char tmp[LT_PATHMAX + 1];
5 kx size_t tmp_len;
5 kx char *concat_name;
5 kx
5 kx lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5 kx nonempty (wrapper));
5 kx
5 kx if ((wrapper == NULL) || (*wrapper == '\0'))
5 kx return NULL;
5 kx
5 kx /* Absolute path? */
5 kx #if defined HAVE_DOS_BASED_FILE_SYSTEM
5 kx if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5 kx {
5 kx concat_name = xstrdup (wrapper);
5 kx if (check_executable (concat_name))
5 kx return concat_name;
5 kx XFREE (concat_name);
5 kx }
5 kx else
5 kx {
5 kx #endif
5 kx if (IS_DIR_SEPARATOR (wrapper[0]))
5 kx {
5 kx concat_name = xstrdup (wrapper);
5 kx if (check_executable (concat_name))
5 kx return concat_name;
5 kx XFREE (concat_name);
5 kx }
5 kx #if defined HAVE_DOS_BASED_FILE_SYSTEM
5 kx }
5 kx #endif
5 kx
5 kx for (p = wrapper; *p; p++)
5 kx if (*p == '/')
5 kx {
5 kx has_slash = 1;
5 kx break;
5 kx }
5 kx if (!has_slash)
5 kx {
5 kx /* no slashes; search PATH */
5 kx const char *path = getenv ("PATH");
5 kx if (path != NULL)
5 kx {
5 kx for (p = path; *p; p = p_next)
5 kx {
5 kx const char *q;
5 kx size_t p_len;
5 kx for (q = p; *q; q++)
5 kx if (IS_PATH_SEPARATOR (*q))
5 kx break;
5 kx p_len = (size_t) (q - p);
5 kx p_next = (*q == '\0' ? q : q + 1);
5 kx if (p_len == 0)
5 kx {
5 kx /* empty path: current directory */
5 kx if (getcwd (tmp, LT_PATHMAX) == NULL)
5 kx lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5 kx nonnull (strerror (errno)));
5 kx tmp_len = strlen (tmp);
5 kx concat_name =
5 kx XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5 kx memcpy (concat_name, tmp, tmp_len);
5 kx concat_name[tmp_len] = '/';
5 kx strcpy (concat_name + tmp_len + 1, wrapper);
5 kx }
5 kx else
5 kx {
5 kx concat_name =
5 kx XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5 kx memcpy (concat_name, p, p_len);
5 kx concat_name[p_len] = '/';
5 kx strcpy (concat_name + p_len + 1, wrapper);
5 kx }
5 kx if (check_executable (concat_name))
5 kx return concat_name;
5 kx XFREE (concat_name);
5 kx }
5 kx }
5 kx /* not found in PATH; assume curdir */
5 kx }
5 kx /* Relative path | not found in path: prepend cwd */
5 kx if (getcwd (tmp, LT_PATHMAX) == NULL)
5 kx lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5 kx nonnull (strerror (errno)));
5 kx tmp_len = strlen (tmp);
5 kx concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5 kx memcpy (concat_name, tmp, tmp_len);
5 kx concat_name[tmp_len] = '/';
5 kx strcpy (concat_name + tmp_len + 1, wrapper);
5 kx
5 kx if (check_executable (concat_name))
5 kx return concat_name;
5 kx XFREE (concat_name);
5 kx return NULL;
5 kx }
5 kx
5 kx char *
5 kx chase_symlinks (const char *pathspec)
5 kx {
5 kx #ifndef S_ISLNK
5 kx return xstrdup (pathspec);
5 kx #else
5 kx char buf[LT_PATHMAX];
5 kx struct stat s;
5 kx char *tmp_pathspec = xstrdup (pathspec);
5 kx char *p;
5 kx int has_symlinks = 0;
5 kx while (strlen (tmp_pathspec) && !has_symlinks)
5 kx {
5 kx lt_debugprintf (__FILE__, __LINE__,
5 kx "checking path component for symlinks: %s\n",
5 kx tmp_pathspec);
5 kx if (lstat (tmp_pathspec, &s) == 0)
5 kx {
5 kx if (S_ISLNK (s.st_mode) != 0)
5 kx {
5 kx has_symlinks = 1;
5 kx break;
5 kx }
5 kx
5 kx /* search backwards for last DIR_SEPARATOR */
5 kx p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5 kx while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5 kx p--;
5 kx if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5 kx {
5 kx /* no more DIR_SEPARATORS left */
5 kx break;
5 kx }
5 kx *p = '\0';
5 kx }
5 kx else
5 kx {
5 kx lt_fatal (__FILE__, __LINE__,
5 kx "error accessing file \"%s\": %s",
5 kx tmp_pathspec, nonnull (strerror (errno)));
5 kx }
5 kx }
5 kx XFREE (tmp_pathspec);
5 kx
5 kx if (!has_symlinks)
5 kx {
5 kx return xstrdup (pathspec);
5 kx }
5 kx
5 kx tmp_pathspec = realpath (pathspec, buf);
5 kx if (tmp_pathspec == 0)
5 kx {
5 kx lt_fatal (__FILE__, __LINE__,
5 kx "could not follow symlinks for %s", pathspec);
5 kx }
5 kx return xstrdup (tmp_pathspec);
5 kx #endif
5 kx }
5 kx
5 kx char *
5 kx strendzap (char *str, const char *pat)
5 kx {
5 kx size_t len, patlen;
5 kx
5 kx assert (str != NULL);
5 kx assert (pat != NULL);
5 kx
5 kx len = strlen (str);
5 kx patlen = strlen (pat);
5 kx
5 kx if (patlen <= len)
5 kx {
5 kx str += len - patlen;
5 kx if (STREQ (str, pat))
5 kx *str = '\0';
5 kx }
5 kx return str;
5 kx }
5 kx
5 kx void
5 kx lt_debugprintf (const char *file, int line, const char *fmt, ...)
5 kx {
5 kx va_list args;
5 kx if (lt_debug)
5 kx {
5 kx (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5 kx va_start (args, fmt);
5 kx (void) vfprintf (stderr, fmt, args);
5 kx va_end (args);
5 kx }
5 kx }
5 kx
5 kx static void
5 kx lt_error_core (int exit_status, const char *file,
5 kx int line, const char *mode,
5 kx const char *message, va_list ap)
5 kx {
5 kx fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
5 kx vfprintf (stderr, message, ap);
5 kx fprintf (stderr, ".\n");
5 kx
5 kx if (exit_status >= 0)
5 kx exit (exit_status);
5 kx }
5 kx
5 kx void
5 kx lt_fatal (const char *file, int line, const char *message, ...)
5 kx {
5 kx va_list ap;
5 kx va_start (ap, message);
5 kx lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
5 kx va_end (ap);
5 kx }
5 kx
5 kx static const char *
5 kx nonnull (const char *s)
5 kx {
5 kx return s ? s : "(null)";
5 kx }
5 kx
5 kx static const char *
5 kx nonempty (const char *s)
5 kx {
5 kx return (s && !*s) ? "(empty)" : nonnull (s);
5 kx }
5 kx
5 kx void
5 kx lt_setenv (const char *name, const char *value)
5 kx {
5 kx lt_debugprintf (__FILE__, __LINE__,
5 kx "(lt_setenv) setting '%s' to '%s'\n",
5 kx nonnull (name), nonnull (value));
5 kx {
5 kx #ifdef HAVE_SETENV
5 kx /* always make a copy, for consistency with !HAVE_SETENV */
5 kx char *str = xstrdup (value);
5 kx setenv (name, str, 1);
5 kx #else
5 kx size_t len = strlen (name) + 1 + strlen (value) + 1;
5 kx char *str = XMALLOC (char, len);
5 kx sprintf (str, "%s=%s", name, value);
5 kx if (putenv (str) != EXIT_SUCCESS)
5 kx {
5 kx XFREE (str);
5 kx }
5 kx #endif
5 kx }
5 kx }
5 kx
5 kx char *
5 kx lt_extend_str (const char *orig_value, const char *add, int to_end)
5 kx {
5 kx char *new_value;
5 kx if (orig_value && *orig_value)
5 kx {
5 kx size_t orig_value_len = strlen (orig_value);
5 kx size_t add_len = strlen (add);
5 kx new_value = XMALLOC (char, add_len + orig_value_len + 1);
5 kx if (to_end)
5 kx {
5 kx strcpy (new_value, orig_value);
5 kx strcpy (new_value + orig_value_len, add);
5 kx }
5 kx else
5 kx {
5 kx strcpy (new_value, add);
5 kx strcpy (new_value + add_len, orig_value);
5 kx }
5 kx }
5 kx else
5 kx {
5 kx new_value = xstrdup (add);
5 kx }
5 kx return new_value;
5 kx }
5 kx
5 kx void
5 kx lt_update_exe_path (const char *name, const char *value)
5 kx {
5 kx lt_debugprintf (__FILE__, __LINE__,
5 kx "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5 kx nonnull (name), nonnull (value));
5 kx
5 kx if (name && *name && value && *value)
5 kx {
5 kx char *new_value = lt_extend_str (getenv (name), value, 0);
5 kx /* some systems can't cope with a ':'-terminated path #' */
5 kx size_t len = strlen (new_value);
5 kx while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5 kx {
5 kx new_value[--len] = '\0';
5 kx }
5 kx lt_setenv (name, new_value);
5 kx XFREE (new_value);
5 kx }
5 kx }
5 kx
5 kx void
5 kx lt_update_lib_path (const char *name, const char *value)
5 kx {
5 kx lt_debugprintf (__FILE__, __LINE__,
5 kx "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5 kx nonnull (name), nonnull (value));
5 kx
5 kx if (name && *name && value && *value)
5 kx {
5 kx char *new_value = lt_extend_str (getenv (name), value, 0);
5 kx lt_setenv (name, new_value);
5 kx XFREE (new_value);
5 kx }
5 kx }
5 kx
5 kx EOF
5 kx case $host_os in
5 kx mingw*)
5 kx cat <<"EOF"
5 kx
5 kx /* Prepares an argument vector before calling spawn().
5 kx Note that spawn() does not by itself call the command interpreter
5 kx (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5 kx ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5 kx GetVersionEx(&v);
5 kx v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5 kx }) ? "cmd.exe" : "command.com").
5 kx Instead it simply concatenates the arguments, separated by ' ', and calls
5 kx CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5 kx interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5 kx special way:
5 kx - Space and tab are interpreted as delimiters. They are not treated as
5 kx delimiters if they are surrounded by double quotes: "...".
5 kx - Unescaped double quotes are removed from the input. Their only effect is
5 kx that within double quotes, space and tab are treated like normal
5 kx characters.
5 kx - Backslashes not followed by double quotes are not special.
5 kx - But 2*n+1 backslashes followed by a double quote become
5 kx n backslashes followed by a double quote (n >= 0):
5 kx \" -> "
5 kx \\\" -> \"
5 kx \\\\\" -> \\"
5 kx */
5 kx #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"
5 kx #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"
5 kx char **
5 kx prepare_spawn (char **argv)
5 kx {
5 kx size_t argc;
5 kx char **new_argv;
5 kx size_t i;
5 kx
5 kx /* Count number of arguments. */
5 kx for (argc = 0; argv[argc] != NULL; argc++)
5 kx ;
5 kx
5 kx /* Allocate new argument vector. */
5 kx new_argv = XMALLOC (char *, argc + 1);
5 kx
5 kx /* Put quoted arguments into the new argument vector. */
5 kx for (i = 0; i < argc; i++)
5 kx {
5 kx const char *string = argv[i];
5 kx
5 kx if (string[0] == '\0')
5 kx new_argv[i] = xstrdup ("\"\"");
5 kx else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5 kx {
5 kx int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5 kx size_t length;
5 kx unsigned int backslashes;
5 kx const char *s;
5 kx char *quoted_string;
5 kx char *p;
5 kx
5 kx length = 0;
5 kx backslashes = 0;
5 kx if (quote_around)
5 kx length++;
5 kx for (s = string; *s != '\0'; s++)
5 kx {
5 kx char c = *s;
5 kx if (c == '"')
5 kx length += backslashes + 1;
5 kx length++;
5 kx if (c == '\\')
5 kx backslashes++;
5 kx else
5 kx backslashes = 0;
5 kx }
5 kx if (quote_around)
5 kx length += backslashes + 1;
5 kx
5 kx quoted_string = XMALLOC (char, length + 1);
5 kx
5 kx p = quoted_string;
5 kx backslashes = 0;
5 kx if (quote_around)
5 kx *p++ = '"';
5 kx for (s = string; *s != '\0'; s++)
5 kx {
5 kx char c = *s;
5 kx if (c == '"')
5 kx {
5 kx unsigned int j;
5 kx for (j = backslashes + 1; j > 0; j--)
5 kx *p++ = '\\';
5 kx }
5 kx *p++ = c;
5 kx if (c == '\\')
5 kx backslashes++;
5 kx else
5 kx backslashes = 0;
5 kx }
5 kx if (quote_around)
5 kx {
5 kx unsigned int j;
5 kx for (j = backslashes; j > 0; j--)
5 kx *p++ = '\\';
5 kx *p++ = '"';
5 kx }
5 kx *p = '\0';
5 kx
5 kx new_argv[i] = quoted_string;
5 kx }
5 kx else
5 kx new_argv[i] = (char *) string;
5 kx }
5 kx new_argv[argc] = NULL;
5 kx
5 kx return new_argv;
5 kx }
5 kx EOF
5 kx ;;
5 kx esac
5 kx
5 kx cat <<"EOF"
5 kx void lt_dump_script (FILE* f)
5 kx {
5 kx EOF
5 kx func_emit_wrapper yes |
5 kx $SED -n -e '
5 kx s/^\(.\{79\}\)\(..*\)/\1\
5 kx \2/
5 kx h
5 kx s/\([\\"]\)/\\\1/g
5 kx s/$/\\n/
5 kx s/\([^\n]*\).*/ fputs ("\1", f);/p
5 kx g
5 kx D'
5 kx cat <<"EOF"
5 kx }
5 kx EOF
5 kx }
5 kx # end: func_emit_cwrapperexe_src
5 kx
5 kx # func_win32_import_lib_p ARG
5 kx # True if ARG is an import lib, as indicated by $file_magic_cmd
5 kx func_win32_import_lib_p ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5 kx *import*) : ;;
5 kx *) false ;;
5 kx esac
5 kx }
5 kx
5 kx # func_suncc_cstd_abi
5 kx # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
5 kx # Several compiler flags select an ABI that is incompatible with the
5 kx # Cstd library. Avoid specifying it if any are in CXXFLAGS.
5 kx func_suncc_cstd_abi ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx case " $compile_command " in
5 kx *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
5 kx suncc_use_cstd_abi=no
5 kx ;;
5 kx *)
5 kx suncc_use_cstd_abi=yes
5 kx ;;
5 kx esac
5 kx }
5 kx
5 kx # func_mode_link arg...
5 kx func_mode_link ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx case $host in
5 kx *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5 kx # It is impossible to link a dll without this setting, and
5 kx # we shouldn't force the makefile maintainer to figure out
5 kx # what system we are compiling for in order to pass an extra
5 kx # flag for every libtool invocation.
5 kx # allow_undefined=no
5 kx
5 kx # FIXME: Unfortunately, there are problems with the above when trying
5 kx # to make a dll that has undefined symbols, in which case not
5 kx # even a static library is built. For now, we need to specify
5 kx # -no-undefined on the libtool link line when we can be certain
5 kx # that all symbols are satisfied, otherwise we get a static library.
5 kx allow_undefined=yes
5 kx ;;
5 kx *)
5 kx allow_undefined=yes
5 kx ;;
5 kx esac
5 kx libtool_args=$nonopt
5 kx base_compile="$nonopt $@"
5 kx compile_command=$nonopt
5 kx finalize_command=$nonopt
5 kx
5 kx compile_rpath=
5 kx finalize_rpath=
5 kx compile_shlibpath=
5 kx finalize_shlibpath=
5 kx convenience=
5 kx old_convenience=
5 kx deplibs=
5 kx old_deplibs=
5 kx compiler_flags=
5 kx linker_flags=
5 kx dllsearchpath=
5 kx lib_search_path=`pwd`
5 kx inst_prefix_dir=
5 kx new_inherited_linker_flags=
5 kx
5 kx avoid_version=no
5 kx bindir=
5 kx dlfiles=
5 kx dlprefiles=
5 kx dlself=no
5 kx export_dynamic=no
5 kx export_symbols=
5 kx export_symbols_regex=
5 kx generated=
5 kx libobjs=
5 kx ltlibs=
5 kx module=no
5 kx no_install=no
5 kx objs=
5 kx os2dllname=
5 kx non_pic_objects=
5 kx precious_files_regex=
5 kx prefer_static_libs=no
5 kx preload=false
5 kx prev=
5 kx prevarg=
5 kx release=
5 kx rpath=
5 kx xrpath=
5 kx perm_rpath=
5 kx temp_rpath=
5 kx thread_safe=no
5 kx vinfo=
5 kx vinfo_number=no
5 kx weak_libs=
5 kx single_module=$wl-single_module
5 kx func_infer_tag $base_compile
5 kx
5 kx # We need to know -static, to get the right output filenames.
5 kx for arg
5 kx do
5 kx case $arg in
5 kx -shared)
5 kx test yes != "$build_libtool_libs" \
5 kx && func_fatal_configuration "cannot build a shared library"
5 kx build_old_libs=no
5 kx break
5 kx ;;
5 kx -all-static | -static | -static-libtool-libs)
5 kx case $arg in
5 kx -all-static)
5 kx if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
5 kx func_warning "complete static linking is impossible in this configuration"
5 kx fi
5 kx if test -n "$link_static_flag"; then
5 kx dlopen_self=$dlopen_self_static
5 kx fi
5 kx prefer_static_libs=yes
5 kx ;;
5 kx -static)
5 kx if test -z "$pic_flag" && test -n "$link_static_flag"; then
5 kx dlopen_self=$dlopen_self_static
5 kx fi
5 kx prefer_static_libs=built
5 kx ;;
5 kx -static-libtool-libs)
5 kx if test -z "$pic_flag" && test -n "$link_static_flag"; then
5 kx dlopen_self=$dlopen_self_static
5 kx fi
5 kx prefer_static_libs=yes
5 kx ;;
5 kx esac
5 kx build_libtool_libs=no
5 kx build_old_libs=yes
5 kx break
5 kx ;;
5 kx esac
5 kx done
5 kx
5 kx # See if our shared archives depend on static archives.
5 kx test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5 kx
5 kx # Go through the arguments, transforming them on the way.
5 kx while test "$#" -gt 0; do
5 kx arg=$1
5 kx shift
5 kx func_quote_for_eval "$arg"
5 kx qarg=$func_quote_for_eval_unquoted_result
5 kx func_append libtool_args " $func_quote_for_eval_result"
5 kx
5 kx # If the previous option needs an argument, assign it.
5 kx if test -n "$prev"; then
5 kx case $prev in
5 kx output)
5 kx func_append compile_command " @OUTPUT@"
5 kx func_append finalize_command " @OUTPUT@"
5 kx ;;
5 kx esac
5 kx
5 kx case $prev in
5 kx bindir)
5 kx bindir=$arg
5 kx prev=
5 kx continue
5 kx ;;
5 kx dlfiles|dlprefiles)
5 kx $preload || {
5 kx # Add the symbol object into the linking commands.
5 kx func_append compile_command " @SYMFILE@"
5 kx func_append finalize_command " @SYMFILE@"
5 kx preload=:
5 kx }
5 kx case $arg in
5 kx *.la | *.lo) ;; # We handle these cases below.
5 kx force)
5 kx if test no = "$dlself"; then
5 kx dlself=needless
5 kx export_dynamic=yes
5 kx fi
5 kx prev=
5 kx continue
5 kx ;;
5 kx self)
5 kx if test dlprefiles = "$prev"; then
5 kx dlself=yes
5 kx elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
5 kx dlself=yes
5 kx else
5 kx dlself=needless
5 kx export_dynamic=yes
5 kx fi
5 kx prev=
5 kx continue
5 kx ;;
5 kx *)
5 kx if test dlfiles = "$prev"; then
5 kx func_append dlfiles " $arg"
5 kx else
5 kx func_append dlprefiles " $arg"
5 kx fi
5 kx prev=
5 kx continue
5 kx ;;
5 kx esac
5 kx ;;
5 kx expsyms)
5 kx export_symbols=$arg
5 kx test -f "$arg" \
5 kx || func_fatal_error "symbol file '$arg' does not exist"
5 kx prev=
5 kx continue
5 kx ;;
5 kx expsyms_regex)
5 kx export_symbols_regex=$arg
5 kx prev=
5 kx continue
5 kx ;;
5 kx framework)
5 kx case $host in
5 kx *-*-darwin*)
5 kx case "$deplibs " in
5 kx *" $qarg.ltframework "*) ;;
5 kx *) func_append deplibs " $qarg.ltframework" # this is fixed later
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx prev=
5 kx continue
5 kx ;;
5 kx inst_prefix)
5 kx inst_prefix_dir=$arg
5 kx prev=
5 kx continue
5 kx ;;
5 kx mllvm)
5 kx # Clang does not use LLVM to link, so we can simply discard any
5 kx # '-mllvm $arg' options when doing the link step.
5 kx prev=
5 kx continue
5 kx ;;
5 kx objectlist)
5 kx if test -f "$arg"; then
5 kx save_arg=$arg
5 kx moreargs=
5 kx for fil in `cat "$save_arg"`
5 kx do
5 kx # func_append moreargs " $fil"
5 kx arg=$fil
5 kx # A libtool-controlled object.
5 kx
5 kx # Check to see that this really is a libtool object.
5 kx if func_lalib_unsafe_p "$arg"; then
5 kx pic_object=
5 kx non_pic_object=
5 kx
5 kx # Read the .lo file
5 kx func_source "$arg"
5 kx
5 kx if test -z "$pic_object" ||
5 kx test -z "$non_pic_object" ||
5 kx test none = "$pic_object" &&
5 kx test none = "$non_pic_object"; then
5 kx func_fatal_error "cannot find name of object for '$arg'"
5 kx fi
5 kx
5 kx # Extract subdirectory from the argument.
5 kx func_dirname "$arg" "/" ""
5 kx xdir=$func_dirname_result
5 kx
5 kx if test none != "$pic_object"; then
5 kx # Prepend the subdirectory the object is found in.
5 kx pic_object=$xdir$pic_object
5 kx
5 kx if test dlfiles = "$prev"; then
5 kx if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
5 kx func_append dlfiles " $pic_object"
5 kx prev=
5 kx continue
5 kx else
5 kx # If libtool objects are unsupported, then we need to preload.
5 kx prev=dlprefiles
5 kx fi
5 kx fi
5 kx
5 kx # CHECK ME: I think I busted this. -Ossama
5 kx if test dlprefiles = "$prev"; then
5 kx # Preload the old-style object.
5 kx func_append dlprefiles " $pic_object"
5 kx prev=
5 kx fi
5 kx
5 kx # A PIC object.
5 kx func_append libobjs " $pic_object"
5 kx arg=$pic_object
5 kx fi
5 kx
5 kx # Non-PIC object.
5 kx if test none != "$non_pic_object"; then
5 kx # Prepend the subdirectory the object is found in.
5 kx non_pic_object=$xdir$non_pic_object
5 kx
5 kx # A standard non-PIC object
5 kx func_append non_pic_objects " $non_pic_object"
5 kx if test -z "$pic_object" || test none = "$pic_object"; then
5 kx arg=$non_pic_object
5 kx fi
5 kx else
5 kx # If the PIC object exists, use it instead.
5 kx # $xdir was prepended to $pic_object above.
5 kx non_pic_object=$pic_object
5 kx func_append non_pic_objects " $non_pic_object"
5 kx fi
5 kx else
5 kx # Only an error if not doing a dry-run.
5 kx if $opt_dry_run; then
5 kx # Extract subdirectory from the argument.
5 kx func_dirname "$arg" "/" ""
5 kx xdir=$func_dirname_result
5 kx
5 kx func_lo2o "$arg"
5 kx pic_object=$xdir$objdir/$func_lo2o_result
5 kx non_pic_object=$xdir$func_lo2o_result
5 kx func_append libobjs " $pic_object"
5 kx func_append non_pic_objects " $non_pic_object"
5 kx else
5 kx func_fatal_error "'$arg' is not a valid libtool object"
5 kx fi
5 kx fi
5 kx done
5 kx else
5 kx func_fatal_error "link input file '$arg' does not exist"
5 kx fi
5 kx arg=$save_arg
5 kx prev=
5 kx continue
5 kx ;;
5 kx os2dllname)
5 kx os2dllname=$arg
5 kx prev=
5 kx continue
5 kx ;;
5 kx precious_regex)
5 kx precious_files_regex=$arg
5 kx prev=
5 kx continue
5 kx ;;
5 kx release)
5 kx release=-$arg
5 kx prev=
5 kx continue
5 kx ;;
5 kx rpath | xrpath)
5 kx # We need an absolute path.
5 kx case $arg in
5 kx [\\/]* | [A-Za-z]:[\\/]*) ;;
5 kx *)
5 kx func_fatal_error "only absolute run-paths are allowed"
5 kx ;;
5 kx esac
5 kx if test rpath = "$prev"; then
5 kx case "$rpath " in
5 kx *" $arg "*) ;;
5 kx *) func_append rpath " $arg" ;;
5 kx esac
5 kx else
5 kx case "$xrpath " in
5 kx *" $arg "*) ;;
5 kx *) func_append xrpath " $arg" ;;
5 kx esac
5 kx fi
5 kx prev=
5 kx continue
5 kx ;;
5 kx shrext)
5 kx shrext_cmds=$arg
5 kx prev=
5 kx continue
5 kx ;;
5 kx weak)
5 kx func_append weak_libs " $arg"
5 kx prev=
5 kx continue
5 kx ;;
5 kx xcclinker)
5 kx func_append linker_flags " $qarg"
5 kx func_append compiler_flags " $qarg"
5 kx prev=
5 kx func_append compile_command " $qarg"
5 kx func_append finalize_command " $qarg"
5 kx continue
5 kx ;;
5 kx xcompiler)
5 kx func_append compiler_flags " $qarg"
5 kx prev=
5 kx func_append compile_command " $qarg"
5 kx func_append finalize_command " $qarg"
5 kx continue
5 kx ;;
5 kx xlinker)
5 kx func_append linker_flags " $qarg"
5 kx func_append compiler_flags " $wl$qarg"
5 kx prev=
5 kx func_append compile_command " $wl$qarg"
5 kx func_append finalize_command " $wl$qarg"
5 kx continue
5 kx ;;
5 kx *)
5 kx eval "$prev=\"\$arg\""
5 kx prev=
5 kx continue
5 kx ;;
5 kx esac
5 kx fi # test -n "$prev"
5 kx
5 kx prevarg=$arg
5 kx
5 kx case $arg in
5 kx -all-static)
5 kx if test -n "$link_static_flag"; then
5 kx # See comment for -static flag below, for more details.
5 kx func_append compile_command " $link_static_flag"
5 kx func_append finalize_command " $link_static_flag"
5 kx fi
5 kx continue
5 kx ;;
5 kx
5 kx -allow-undefined)
5 kx # FIXME: remove this flag sometime in the future.
5 kx func_fatal_error "'-allow-undefined' must not be used because it is the default"
5 kx ;;
5 kx
5 kx -avoid-version)
5 kx avoid_version=yes
5 kx continue
5 kx ;;
5 kx
5 kx -bindir)
5 kx prev=bindir
5 kx continue
5 kx ;;
5 kx
5 kx -dlopen)
5 kx prev=dlfiles
5 kx continue
5 kx ;;
5 kx
5 kx -dlpreopen)
5 kx prev=dlprefiles
5 kx continue
5 kx ;;
5 kx
5 kx -export-dynamic)
5 kx export_dynamic=yes
5 kx continue
5 kx ;;
5 kx
5 kx -export-symbols | -export-symbols-regex)
5 kx if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5 kx func_fatal_error "more than one -exported-symbols argument is not allowed"
5 kx fi
5 kx if test X-export-symbols = "X$arg"; then
5 kx prev=expsyms
5 kx else
5 kx prev=expsyms_regex
5 kx fi
5 kx continue
5 kx ;;
5 kx
5 kx -framework)
5 kx prev=framework
5 kx continue
5 kx ;;
5 kx
5 kx -inst-prefix-dir)
5 kx prev=inst_prefix
5 kx continue
5 kx ;;
5 kx
5 kx # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5 kx # so, if we see these flags be careful not to treat them like -L
5 kx -L[A-Z][A-Z]*:*)
5 kx case $with_gcc/$host in
5 kx no/*-*-irix* | /*-*-irix*)
5 kx func_append compile_command " $arg"
5 kx func_append finalize_command " $arg"
5 kx ;;
5 kx esac
5 kx continue
5 kx ;;
5 kx
5 kx -L*)
5 kx func_stripname "-L" '' "$arg"
5 kx if test -z "$func_stripname_result"; then
5 kx if test "$#" -gt 0; then
5 kx func_fatal_error "require no space between '-L' and '$1'"
5 kx else
5 kx func_fatal_error "need path for '-L' option"
5 kx fi
5 kx fi
5 kx func_resolve_sysroot "$func_stripname_result"
5 kx dir=$func_resolve_sysroot_result
5 kx # We need an absolute path.
5 kx case $dir in
5 kx [\\/]* | [A-Za-z]:[\\/]*) ;;
5 kx *)
5 kx absdir=`cd "$dir" && pwd`
5 kx test -z "$absdir" && \
5 kx func_fatal_error "cannot determine absolute directory name of '$dir'"
5 kx dir=$absdir
5 kx ;;
5 kx esac
5 kx case "$deplibs " in
5 kx *" -L$dir "* | *" $arg "*)
5 kx # Will only happen for absolute or sysroot arguments
5 kx ;;
5 kx *)
5 kx # Preserve sysroot, but never include relative directories
5 kx case $dir in
5 kx [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5 kx *) func_append deplibs " -L$dir" ;;
5 kx esac
5 kx func_append lib_search_path " $dir"
5 kx ;;
5 kx esac
5 kx case $host in
5 kx *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5 kx testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5 kx case :$dllsearchpath: in
5 kx *":$dir:"*) ;;
5 kx ::) dllsearchpath=$dir;;
5 kx *) func_append dllsearchpath ":$dir";;
5 kx esac
5 kx case :$dllsearchpath: in
5 kx *":$testbindir:"*) ;;
5 kx ::) dllsearchpath=$testbindir;;
5 kx *) func_append dllsearchpath ":$testbindir";;
5 kx esac
5 kx ;;
5 kx esac
5 kx continue
5 kx ;;
5 kx
5 kx -l*)
5 kx if test X-lc = "X$arg" || test X-lm = "X$arg"; then
5 kx case $host in
5 kx *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5 kx # These systems don't actually have a C or math library (as such)
5 kx continue
5 kx ;;
5 kx *-*-os2*)
5 kx # These systems don't actually have a C library (as such)
5 kx test X-lc = "X$arg" && continue
5 kx ;;
5 kx *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
5 kx # Do not include libc due to us having libc/libc_r.
5 kx test X-lc = "X$arg" && continue
5 kx ;;
5 kx *-*-rhapsody* | *-*-darwin1.[012])
5 kx # Rhapsody C and math libraries are in the System framework
5 kx func_append deplibs " System.ltframework"
5 kx continue
5 kx ;;
5 kx *-*-sco3.2v5* | *-*-sco5v6*)
5 kx # Causes problems with __ctype
5 kx test X-lc = "X$arg" && continue
5 kx ;;
5 kx *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5 kx # Compiler inserts libc in the correct place for threads to work
5 kx test X-lc = "X$arg" && continue
5 kx ;;
5 kx esac
5 kx elif test X-lc_r = "X$arg"; then
5 kx case $host in
5 kx *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
5 kx # Do not include libc_r directly, use -pthread flag.
5 kx continue
5 kx ;;
5 kx esac
5 kx fi
5 kx func_append deplibs " $arg"
5 kx continue
5 kx ;;
5 kx
5 kx -mllvm)
5 kx prev=mllvm
5 kx continue
5 kx ;;
5 kx
5 kx -module)
5 kx module=yes
5 kx continue
5 kx ;;
5 kx
5 kx # Tru64 UNIX uses -model [arg] to determine the layout of C++
5 kx # classes, name mangling, and exception handling.
5 kx # Darwin uses the -arch flag to determine output architecture.
5 kx -model|-arch|-isysroot|--sysroot)
5 kx func_append compiler_flags " $arg"
5 kx func_append compile_command " $arg"
5 kx func_append finalize_command " $arg"
5 kx prev=xcompiler
5 kx continue
5 kx ;;
5 kx
5 kx -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5 kx |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5 kx func_append compiler_flags " $arg"
5 kx func_append compile_command " $arg"
5 kx func_append finalize_command " $arg"
5 kx case "$new_inherited_linker_flags " in
5 kx *" $arg "*) ;;
5 kx * ) func_append new_inherited_linker_flags " $arg" ;;
5 kx esac
5 kx continue
5 kx ;;
5 kx
5 kx -multi_module)
5 kx single_module=$wl-multi_module
5 kx continue
5 kx ;;
5 kx
5 kx -no-fast-install)
5 kx fast_install=no
5 kx continue
5 kx ;;
5 kx
5 kx -no-install)
5 kx case $host in
5 kx *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5 kx # The PATH hackery in wrapper scripts is required on Windows
5 kx # and Darwin in order for the loader to find any dlls it needs.
5 kx func_warning "'-no-install' is ignored for $host"
5 kx func_warning "assuming '-no-fast-install' instead"
5 kx fast_install=no
5 kx ;;
5 kx *) no_install=yes ;;
5 kx esac
5 kx continue
5 kx ;;
5 kx
5 kx -no-undefined)
5 kx allow_undefined=no
5 kx continue
5 kx ;;
5 kx
5 kx -objectlist)
5 kx prev=objectlist
5 kx continue
5 kx ;;
5 kx
5 kx -os2dllname)
5 kx prev=os2dllname
5 kx continue
5 kx ;;
5 kx
5 kx -o) prev=output ;;
5 kx
5 kx -precious-files-regex)
5 kx prev=precious_regex
5 kx continue
5 kx ;;
5 kx
5 kx -release)
5 kx prev=release
5 kx continue
5 kx ;;
5 kx
5 kx -rpath)
5 kx prev=rpath
5 kx continue
5 kx ;;
5 kx
5 kx -R)
5 kx prev=xrpath
5 kx continue
5 kx ;;
5 kx
5 kx -R*)
5 kx func_stripname '-R' '' "$arg"
5 kx dir=$func_stripname_result
5 kx # We need an absolute path.
5 kx case $dir in
5 kx [\\/]* | [A-Za-z]:[\\/]*) ;;
5 kx =*)
5 kx func_stripname '=' '' "$dir"
5 kx dir=$lt_sysroot$func_stripname_result
5 kx ;;
5 kx *)
5 kx func_fatal_error "only absolute run-paths are allowed"
5 kx ;;
5 kx esac
5 kx case "$xrpath " in
5 kx *" $dir "*) ;;
5 kx *) func_append xrpath " $dir" ;;
5 kx esac
5 kx continue
5 kx ;;
5 kx
5 kx -shared)
5 kx # The effects of -shared are defined in a previous loop.
5 kx continue
5 kx ;;
5 kx
5 kx -shrext)
5 kx prev=shrext
5 kx continue
5 kx ;;
5 kx
5 kx -static | -static-libtool-libs)
5 kx # The effects of -static are defined in a previous loop.
5 kx # We used to do the same as -all-static on platforms that
5 kx # didn't have a PIC flag, but the assumption that the effects
5 kx # would be equivalent was wrong. It would break on at least
5 kx # Digital Unix and AIX.
5 kx continue
5 kx ;;
5 kx
5 kx -thread-safe)
5 kx thread_safe=yes
5 kx continue
5 kx ;;
5 kx
5 kx -version-info)
5 kx prev=vinfo
5 kx continue
5 kx ;;
5 kx
5 kx -version-number)
5 kx prev=vinfo
5 kx vinfo_number=yes
5 kx continue
5 kx ;;
5 kx
5 kx -weak)
5 kx prev=weak
5 kx continue
5 kx ;;
5 kx
5 kx -Wc,*)
5 kx func_stripname '-Wc,' '' "$arg"
5 kx args=$func_stripname_result
5 kx arg=
5 kx save_ifs=$IFS; IFS=,
5 kx for flag in $args; do
5 kx IFS=$save_ifs
5 kx func_quote_for_eval "$flag"
5 kx func_append arg " $func_quote_for_eval_result"
5 kx func_append compiler_flags " $func_quote_for_eval_result"
5 kx done
5 kx IFS=$save_ifs
5 kx func_stripname ' ' '' "$arg"
5 kx arg=$func_stripname_result
5 kx ;;
5 kx
5 kx -Wl,*)
5 kx func_stripname '-Wl,' '' "$arg"
5 kx args=$func_stripname_result
5 kx arg=
5 kx save_ifs=$IFS; IFS=,
5 kx for flag in $args; do
5 kx IFS=$save_ifs
5 kx func_quote_for_eval "$flag"
5 kx func_append arg " $wl$func_quote_for_eval_result"
5 kx func_append compiler_flags " $wl$func_quote_for_eval_result"
5 kx func_append linker_flags " $func_quote_for_eval_result"
5 kx done
5 kx IFS=$save_ifs
5 kx func_stripname ' ' '' "$arg"
5 kx arg=$func_stripname_result
5 kx ;;
5 kx
5 kx -Xcompiler)
5 kx prev=xcompiler
5 kx continue
5 kx ;;
5 kx
5 kx -Xlinker)
5 kx prev=xlinker
5 kx continue
5 kx ;;
5 kx
5 kx -XCClinker)
5 kx prev=xcclinker
5 kx continue
5 kx ;;
5 kx
5 kx # -msg_* for osf cc
5 kx -msg_*)
5 kx func_quote_for_eval "$arg"
5 kx arg=$func_quote_for_eval_result
5 kx ;;
5 kx
5 kx # Flags to be passed through unchanged, with rationale:
5 kx # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5 kx # -r[0-9][0-9]* specify processor for the SGI compiler
5 kx # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5 kx # +DA*, +DD* enable 64-bit mode for the HP compiler
5 kx # -q* compiler args for the IBM compiler
5 kx # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5 kx # -F/path path to uninstalled frameworks, gcc on darwin
5 kx # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5 kx # -fstack-protector* stack protector flags for GCC
5 kx # @file GCC response files
5 kx # -tp=* Portland pgcc target processor selection
5 kx # --sysroot=* for sysroot support
5 kx # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5 kx # -stdlib=* select c++ std lib with clang
5 kx -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5 kx -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5 kx -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
5 kx func_quote_for_eval "$arg"
5 kx arg=$func_quote_for_eval_result
5 kx func_append compile_command " $arg"
5 kx func_append finalize_command " $arg"
5 kx func_append compiler_flags " $arg"
5 kx continue
5 kx ;;
5 kx
5 kx -Z*)
5 kx if test os2 = "`expr $host : '.*\(os2\)'`"; then
5 kx # OS/2 uses -Zxxx to specify OS/2-specific options
5 kx compiler_flags="$compiler_flags $arg"
5 kx func_append compile_command " $arg"
5 kx func_append finalize_command " $arg"
5 kx case $arg in
5 kx -Zlinker | -Zstack)
5 kx prev=xcompiler
5 kx ;;
5 kx esac
5 kx continue
5 kx else
5 kx # Otherwise treat like 'Some other compiler flag' below
5 kx func_quote_for_eval "$arg"
5 kx arg=$func_quote_for_eval_result
5 kx fi
5 kx ;;
5 kx
5 kx # Some other compiler flag.
5 kx -* | +*)
5 kx func_quote_for_eval "$arg"
5 kx arg=$func_quote_for_eval_result
5 kx ;;
5 kx
5 kx *.$objext)
5 kx # A standard object.
5 kx func_append objs " $arg"
5 kx ;;
5 kx
5 kx *.lo)
5 kx # A libtool-controlled object.
5 kx
5 kx # Check to see that this really is a libtool object.
5 kx if func_lalib_unsafe_p "$arg"; then
5 kx pic_object=
5 kx non_pic_object=
5 kx
5 kx # Read the .lo file
5 kx func_source "$arg"
5 kx
5 kx if test -z "$pic_object" ||
5 kx test -z "$non_pic_object" ||
5 kx test none = "$pic_object" &&
5 kx test none = "$non_pic_object"; then
5 kx func_fatal_error "cannot find name of object for '$arg'"
5 kx fi
5 kx
5 kx # Extract subdirectory from the argument.
5 kx func_dirname "$arg" "/" ""
5 kx xdir=$func_dirname_result
5 kx
5 kx test none = "$pic_object" || {
5 kx # Prepend the subdirectory the object is found in.
5 kx pic_object=$xdir$pic_object
5 kx
5 kx if test dlfiles = "$prev"; then
5 kx if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
5 kx func_append dlfiles " $pic_object"
5 kx prev=
5 kx continue
5 kx else
5 kx # If libtool objects are unsupported, then we need to preload.
5 kx prev=dlprefiles
5 kx fi
5 kx fi
5 kx
5 kx # CHECK ME: I think I busted this. -Ossama
5 kx if test dlprefiles = "$prev"; then
5 kx # Preload the old-style object.
5 kx func_append dlprefiles " $pic_object"
5 kx prev=
5 kx fi
5 kx
5 kx # A PIC object.
5 kx func_append libobjs " $pic_object"
5 kx arg=$pic_object
5 kx }
5 kx
5 kx # Non-PIC object.
5 kx if test none != "$non_pic_object"; then
5 kx # Prepend the subdirectory the object is found in.
5 kx non_pic_object=$xdir$non_pic_object
5 kx
5 kx # A standard non-PIC object
5 kx func_append non_pic_objects " $non_pic_object"
5 kx if test -z "$pic_object" || test none = "$pic_object"; then
5 kx arg=$non_pic_object
5 kx fi
5 kx else
5 kx # If the PIC object exists, use it instead.
5 kx # $xdir was prepended to $pic_object above.
5 kx non_pic_object=$pic_object
5 kx func_append non_pic_objects " $non_pic_object"
5 kx fi
5 kx else
5 kx # Only an error if not doing a dry-run.
5 kx if $opt_dry_run; then
5 kx # Extract subdirectory from the argument.
5 kx func_dirname "$arg" "/" ""
5 kx xdir=$func_dirname_result
5 kx
5 kx func_lo2o "$arg"
5 kx pic_object=$xdir$objdir/$func_lo2o_result
5 kx non_pic_object=$xdir$func_lo2o_result
5 kx func_append libobjs " $pic_object"
5 kx func_append non_pic_objects " $non_pic_object"
5 kx else
5 kx func_fatal_error "'$arg' is not a valid libtool object"
5 kx fi
5 kx fi
5 kx ;;
5 kx
5 kx *.$libext)
5 kx # An archive.
5 kx func_append deplibs " $arg"
5 kx func_append old_deplibs " $arg"
5 kx continue
5 kx ;;
5 kx
5 kx *.la)
5 kx # A libtool-controlled library.
5 kx
5 kx func_resolve_sysroot "$arg"
5 kx if test dlfiles = "$prev"; then
5 kx # This library was specified with -dlopen.
5 kx func_append dlfiles " $func_resolve_sysroot_result"
5 kx prev=
5 kx elif test dlprefiles = "$prev"; then
5 kx # The library was specified with -dlpreopen.
5 kx func_append dlprefiles " $func_resolve_sysroot_result"
5 kx prev=
5 kx else
5 kx func_append deplibs " $func_resolve_sysroot_result"
5 kx fi
5 kx continue
5 kx ;;
5 kx
5 kx # Some other compiler argument.
5 kx *)
5 kx # Unknown arguments in both finalize_command and compile_command need
5 kx # to be aesthetically quoted because they are evaled later.
5 kx func_quote_for_eval "$arg"
5 kx arg=$func_quote_for_eval_result
5 kx ;;
5 kx esac # arg
5 kx
5 kx # Now actually substitute the argument into the commands.
5 kx if test -n "$arg"; then
5 kx func_append compile_command " $arg"
5 kx func_append finalize_command " $arg"
5 kx fi
5 kx done # argument parsing loop
5 kx
5 kx test -n "$prev" && \
5 kx func_fatal_help "the '$prevarg' option requires an argument"
5 kx
5 kx if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
5 kx eval arg=\"$export_dynamic_flag_spec\"
5 kx func_append compile_command " $arg"
5 kx func_append finalize_command " $arg"
5 kx fi
5 kx
5 kx oldlibs=
5 kx # calculate the name of the file, without its directory
5 kx func_basename "$output"
5 kx outputname=$func_basename_result
5 kx libobjs_save=$libobjs
5 kx
5 kx if test -n "$shlibpath_var"; then
5 kx # get the directories listed in $shlibpath_var
5 kx eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
5 kx else
5 kx shlib_search_path=
5 kx fi
5 kx eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5 kx eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5 kx
5 kx # Definition is injected by LT_CONFIG during libtool generation.
5 kx func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
5 kx
5 kx func_dirname "$output" "/" ""
5 kx output_objdir=$func_dirname_result$objdir
5 kx func_to_tool_file "$output_objdir/"
5 kx tool_output_objdir=$func_to_tool_file_result
5 kx # Create the object directory.
5 kx func_mkdir_p "$output_objdir"
5 kx
5 kx # Determine the type of output
5 kx case $output in
5 kx "")
5 kx func_fatal_help "you must specify an output file"
5 kx ;;
5 kx *.$libext) linkmode=oldlib ;;
5 kx *.lo | *.$objext) linkmode=obj ;;
5 kx *.la) linkmode=lib ;;
5 kx *) linkmode=prog ;; # Anything else should be a program.
5 kx esac
5 kx
5 kx specialdeplibs=
5 kx
5 kx libs=
5 kx # Find all interdependent deplibs by searching for libraries
5 kx # that are linked more than once (e.g. -la -lb -la)
5 kx for deplib in $deplibs; do
5 kx if $opt_preserve_dup_deps; then
5 kx case "$libs " in
5 kx *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5 kx esac
5 kx fi
5 kx func_append libs " $deplib"
5 kx done
5 kx
5 kx if test lib = "$linkmode"; then
5 kx libs="$predeps $libs $compiler_lib_search_path $postdeps"
5 kx
5 kx # Compute libraries that are listed more than once in $predeps
5 kx # $postdeps and mark them as special (i.e., whose duplicates are
5 kx # not to be eliminated).
5 kx pre_post_deps=
5 kx if $opt_duplicate_compiler_generated_deps; then
5 kx for pre_post_dep in $predeps $postdeps; do
5 kx case "$pre_post_deps " in
5 kx *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
5 kx esac
5 kx func_append pre_post_deps " $pre_post_dep"
5 kx done
5 kx fi
5 kx pre_post_deps=
5 kx fi
5 kx
5 kx deplibs=
5 kx newdependency_libs=
5 kx newlib_search_path=
5 kx need_relink=no # whether we're linking any uninstalled libtool libraries
5 kx notinst_deplibs= # not-installed libtool libraries
5 kx notinst_path= # paths that contain not-installed libtool libraries
5 kx
5 kx case $linkmode in
5 kx lib)
5 kx passes="conv dlpreopen link"
5 kx for file in $dlfiles $dlprefiles; do
5 kx case $file in
5 kx *.la) ;;
5 kx *)
5 kx func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
5 kx ;;
5 kx esac
5 kx done
5 kx ;;
5 kx prog)
5 kx compile_deplibs=
5 kx finalize_deplibs=
5 kx alldeplibs=false
5 kx newdlfiles=
5 kx newdlprefiles=
5 kx passes="conv scan dlopen dlpreopen link"
5 kx ;;
5 kx *) passes="conv"
5 kx ;;
5 kx esac
5 kx
5 kx for pass in $passes; do
5 kx # The preopen pass in lib mode reverses $deplibs; put it back here
5 kx # so that -L comes before libs that need it for instance...
5 kx if test lib,link = "$linkmode,$pass"; then
5 kx ## FIXME: Find the place where the list is rebuilt in the wrong
5 kx ## order, and fix it there properly
5 kx tmp_deplibs=
5 kx for deplib in $deplibs; do
5 kx tmp_deplibs="$deplib $tmp_deplibs"
5 kx done
5 kx deplibs=$tmp_deplibs
5 kx fi
5 kx
5 kx if test lib,link = "$linkmode,$pass" ||
5 kx test prog,scan = "$linkmode,$pass"; then
5 kx libs=$deplibs
5 kx deplibs=
5 kx fi
5 kx if test prog = "$linkmode"; then
5 kx case $pass in
5 kx dlopen) libs=$dlfiles ;;
5 kx dlpreopen) libs=$dlprefiles ;;
5 kx link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5 kx esac
5 kx fi
5 kx if test lib,dlpreopen = "$linkmode,$pass"; then
5 kx # Collect and forward deplibs of preopened libtool libs
5 kx for lib in $dlprefiles; do
5 kx # Ignore non-libtool-libs
5 kx dependency_libs=
5 kx func_resolve_sysroot "$lib"
5 kx case $lib in
5 kx *.la) func_source "$func_resolve_sysroot_result" ;;
5 kx esac
5 kx
5 kx # Collect preopened libtool deplibs, except any this library
5 kx # has declared as weak libs
5 kx for deplib in $dependency_libs; do
5 kx func_basename "$deplib"
5 kx deplib_base=$func_basename_result
5 kx case " $weak_libs " in
5 kx *" $deplib_base "*) ;;
5 kx *) func_append deplibs " $deplib" ;;
5 kx esac
5 kx done
5 kx done
5 kx libs=$dlprefiles
5 kx fi
5 kx if test dlopen = "$pass"; then
5 kx # Collect dlpreopened libraries
5 kx save_deplibs=$deplibs
5 kx deplibs=
5 kx fi
5 kx
5 kx for deplib in $libs; do
5 kx lib=
5 kx found=false
5 kx case $deplib in
5 kx -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5 kx |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5 kx if test prog,link = "$linkmode,$pass"; then
5 kx compile_deplibs="$deplib $compile_deplibs"
5 kx finalize_deplibs="$deplib $finalize_deplibs"
5 kx else
5 kx func_append compiler_flags " $deplib"
5 kx if test lib = "$linkmode"; then
5 kx case "$new_inherited_linker_flags " in
5 kx *" $deplib "*) ;;
5 kx * ) func_append new_inherited_linker_flags " $deplib" ;;
5 kx esac
5 kx fi
5 kx fi
5 kx continue
5 kx ;;
5 kx -l*)
5 kx if test lib != "$linkmode" && test prog != "$linkmode"; then
5 kx func_warning "'-l' is ignored for archives/objects"
5 kx continue
5 kx fi
5 kx func_stripname '-l' '' "$deplib"
5 kx name=$func_stripname_result
5 kx if test lib = "$linkmode"; then
5 kx searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5 kx else
5 kx searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5 kx fi
5 kx for searchdir in $searchdirs; do
5 kx for search_ext in .la $std_shrext .so .a; do
5 kx # Search the libtool library
5 kx lib=$searchdir/lib$name$search_ext
5 kx if test -f "$lib"; then
5 kx if test .la = "$search_ext"; then
5 kx found=:
5 kx else
5 kx found=false
5 kx fi
5 kx break 2
5 kx fi
5 kx done
5 kx done
5 kx if $found; then
5 kx # deplib is a libtool library
5 kx # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5 kx # We need to do some special things here, and not later.
5 kx if test yes = "$allow_libtool_libs_with_static_runtimes"; then
5 kx case " $predeps $postdeps " in
5 kx *" $deplib "*)
5 kx if func_lalib_p "$lib"; then
5 kx library_names=
5 kx old_library=
5 kx func_source "$lib"
5 kx for l in $old_library $library_names; do
5 kx ll=$l
5 kx done
5 kx if test "X$ll" = "X$old_library"; then # only static version available
5 kx found=false
5 kx func_dirname "$lib" "" "."
5 kx ladir=$func_dirname_result
5 kx lib=$ladir/$old_library
5 kx if test prog,link = "$linkmode,$pass"; then
5 kx compile_deplibs="$deplib $compile_deplibs"
5 kx finalize_deplibs="$deplib $finalize_deplibs"
5 kx else
5 kx deplibs="$deplib $deplibs"
5 kx test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
5 kx fi
5 kx continue
5 kx fi
5 kx fi
5 kx ;;
5 kx *) ;;
5 kx esac
5 kx fi
5 kx else
5 kx # deplib doesn't seem to be a libtool library
5 kx if test prog,link = "$linkmode,$pass"; then
5 kx compile_deplibs="$deplib $compile_deplibs"
5 kx finalize_deplibs="$deplib $finalize_deplibs"
5 kx else
5 kx deplibs="$deplib $deplibs"
5 kx test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
5 kx fi
5 kx continue
5 kx fi
5 kx ;; # -l
5 kx *.ltframework)
5 kx if test prog,link = "$linkmode,$pass"; then
5 kx compile_deplibs="$deplib $compile_deplibs"
5 kx finalize_deplibs="$deplib $finalize_deplibs"
5 kx else
5 kx deplibs="$deplib $deplibs"
5 kx if test lib = "$linkmode"; then
5 kx case "$new_inherited_linker_flags " in
5 kx *" $deplib "*) ;;
5 kx * ) func_append new_inherited_linker_flags " $deplib" ;;
5 kx esac
5 kx fi
5 kx fi
5 kx continue
5 kx ;;
5 kx -L*)
5 kx case $linkmode in
5 kx lib)
5 kx deplibs="$deplib $deplibs"
5 kx test conv = "$pass" && continue
5 kx newdependency_libs="$deplib $newdependency_libs"
5 kx func_stripname '-L' '' "$deplib"
5 kx func_resolve_sysroot "$func_stripname_result"
5 kx func_append newlib_search_path " $func_resolve_sysroot_result"
5 kx ;;
5 kx prog)
5 kx if test conv = "$pass"; then
5 kx deplibs="$deplib $deplibs"
5 kx continue
5 kx fi
5 kx if test scan = "$pass"; then
5 kx deplibs="$deplib $deplibs"
5 kx else
5 kx compile_deplibs="$deplib $compile_deplibs"
5 kx finalize_deplibs="$deplib $finalize_deplibs"
5 kx fi
5 kx func_stripname '-L' '' "$deplib"
5 kx func_resolve_sysroot "$func_stripname_result"
5 kx func_append newlib_search_path " $func_resolve_sysroot_result"
5 kx ;;
5 kx *)
5 kx func_warning "'-L' is ignored for archives/objects"
5 kx ;;
5 kx esac # linkmode
5 kx continue
5 kx ;; # -L
5 kx -R*)
5 kx if test link = "$pass"; then
5 kx func_stripname '-R' '' "$deplib"
5 kx func_resolve_sysroot "$func_stripname_result"
5 kx dir=$func_resolve_sysroot_result
5 kx # Make sure the xrpath contains only unique directories.
5 kx case "$xrpath " in
5 kx *" $dir "*) ;;
5 kx *) func_append xrpath " $dir" ;;
5 kx esac
5 kx fi
5 kx deplibs="$deplib $deplibs"
5 kx continue
5 kx ;;
5 kx *.la)
5 kx func_resolve_sysroot "$deplib"
5 kx lib=$func_resolve_sysroot_result
5 kx ;;
5 kx *.$libext)
5 kx if test conv = "$pass"; then
5 kx deplibs="$deplib $deplibs"
5 kx continue
5 kx fi
5 kx case $linkmode in
5 kx lib)
5 kx # Linking convenience modules into shared libraries is allowed,
5 kx # but linking other static libraries is non-portable.
5 kx case " $dlpreconveniencelibs " in
5 kx *" $deplib "*) ;;
5 kx *)
5 kx valid_a_lib=false
5 kx case $deplibs_check_method in
5 kx match_pattern*)
5 kx set dummy $deplibs_check_method; shift
5 kx match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5 kx if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
5 kx | $EGREP "$match_pattern_regex" > /dev/null; then
5 kx valid_a_lib=:
5 kx fi
5 kx ;;
5 kx pass_all)
5 kx valid_a_lib=:
5 kx ;;
5 kx esac
5 kx if $valid_a_lib; then
5 kx echo
5 kx $ECHO "*** Warning: Linking the shared library $output against the"
5 kx $ECHO "*** static library $deplib is not portable!"
5 kx deplibs="$deplib $deplibs"
5 kx else
5 kx echo
5 kx $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5 kx echo "*** I have the capability to make that library automatically link in when"
5 kx echo "*** you link to this library. But I can only do this if you have a"
5 kx echo "*** shared version of the library, which you do not appear to have"
5 kx echo "*** because the file extensions .$libext of this argument makes me believe"
5 kx echo "*** that it is just a static archive that I should not use here."
5 kx fi
5 kx ;;
5 kx esac
5 kx continue
5 kx ;;
5 kx prog)
5 kx if test link != "$pass"; then
5 kx deplibs="$deplib $deplibs"
5 kx else
5 kx compile_deplibs="$deplib $compile_deplibs"
5 kx finalize_deplibs="$deplib $finalize_deplibs"
5 kx fi
5 kx continue
5 kx ;;
5 kx esac # linkmode
5 kx ;; # *.$libext
5 kx *.lo | *.$objext)
5 kx if test conv = "$pass"; then
5 kx deplibs="$deplib $deplibs"
5 kx elif test prog = "$linkmode"; then
5 kx if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
5 kx # If there is no dlopen support or we're linking statically,
5 kx # we need to preload.
5 kx func_append newdlprefiles " $deplib"
5 kx compile_deplibs="$deplib $compile_deplibs"
5 kx finalize_deplibs="$deplib $finalize_deplibs"
5 kx else
5 kx func_append newdlfiles " $deplib"
5 kx fi
5 kx fi
5 kx continue
5 kx ;;
5 kx %DEPLIBS%)
5 kx alldeplibs=:
5 kx continue
5 kx ;;
5 kx esac # case $deplib
5 kx
5 kx $found || test -f "$lib" \
5 kx || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
5 kx
5 kx # Check to see that this really is a libtool archive.
5 kx func_lalib_unsafe_p "$lib" \
5 kx || func_fatal_error "'$lib' is not a valid libtool archive"
5 kx
5 kx func_dirname "$lib" "" "."
5 kx ladir=$func_dirname_result
5 kx
5 kx dlname=
5 kx dlopen=
5 kx dlpreopen=
5 kx libdir=
5 kx library_names=
5 kx old_library=
5 kx inherited_linker_flags=
5 kx # If the library was installed with an old release of libtool,
5 kx # it will not redefine variables installed, or shouldnotlink
5 kx installed=yes
5 kx shouldnotlink=no
5 kx avoidtemprpath=
5 kx
5 kx
5 kx # Read the .la file
5 kx func_source "$lib"
5 kx
5 kx # Convert "-framework foo" to "foo.ltframework"
5 kx if test -n "$inherited_linker_flags"; then
5 kx tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
5 kx for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5 kx case " $new_inherited_linker_flags " in
5 kx *" $tmp_inherited_linker_flag "*) ;;
5 kx *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
5 kx esac
5 kx done
5 kx fi
5 kx dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5 kx if test lib,link = "$linkmode,$pass" ||
5 kx test prog,scan = "$linkmode,$pass" ||
5 kx { test prog != "$linkmode" && test lib != "$linkmode"; }; then
5 kx test -n "$dlopen" && func_append dlfiles " $dlopen"
5 kx test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
5 kx fi
5 kx
5 kx if test conv = "$pass"; then
5 kx # Only check for convenience libraries
5 kx deplibs="$lib $deplibs"
5 kx if test -z "$libdir"; then
5 kx if test -z "$old_library"; then
5 kx func_fatal_error "cannot find name of link library for '$lib'"
5 kx fi
5 kx # It is a libtool convenience library, so add in its objects.
5 kx func_append convenience " $ladir/$objdir/$old_library"
5 kx func_append old_convenience " $ladir/$objdir/$old_library"
5 kx elif test prog != "$linkmode" && test lib != "$linkmode"; then
5 kx func_fatal_error "'$lib' is not a convenience library"
5 kx fi
5 kx tmp_libs=
5 kx for deplib in $dependency_libs; do
5 kx deplibs="$deplib $deplibs"
5 kx if $opt_preserve_dup_deps; then
5 kx case "$tmp_libs " in
5 kx *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5 kx esac
5 kx fi
5 kx func_append tmp_libs " $deplib"
5 kx done
5 kx continue
5 kx fi # $pass = conv
5 kx
5 kx
5 kx # Get the name of the library we link against.
5 kx linklib=
5 kx if test -n "$old_library" &&
5 kx { test yes = "$prefer_static_libs" ||
5 kx test built,no = "$prefer_static_libs,$installed"; }; then
5 kx linklib=$old_library
5 kx else
5 kx for l in $old_library $library_names; do
5 kx linklib=$l
5 kx done
5 kx fi
5 kx if test -z "$linklib"; then
5 kx func_fatal_error "cannot find name of link library for '$lib'"
5 kx fi
5 kx
5 kx # This library was specified with -dlopen.
5 kx if test dlopen = "$pass"; then
5 kx test -z "$libdir" \
5 kx && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
5 kx if test -z "$dlname" ||
5 kx test yes != "$dlopen_support" ||
5 kx test no = "$build_libtool_libs"
5 kx then
5 kx # If there is no dlname, no dlopen support or we're linking
5 kx # statically, we need to preload. We also need to preload any
5 kx # dependent libraries so libltdl's deplib preloader doesn't
5 kx # bomb out in the load deplibs phase.
5 kx func_append dlprefiles " $lib $dependency_libs"
5 kx else
5 kx func_append newdlfiles " $lib"
5 kx fi
5 kx continue
5 kx fi # $pass = dlopen
5 kx
5 kx # We need an absolute path.
5 kx case $ladir in
5 kx [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
5 kx *)
5 kx abs_ladir=`cd "$ladir" && pwd`
5 kx if test -z "$abs_ladir"; then
5 kx func_warning "cannot determine absolute directory name of '$ladir'"
5 kx func_warning "passing it literally to the linker, although it might fail"
5 kx abs_ladir=$ladir
5 kx fi
5 kx ;;
5 kx esac
5 kx func_basename "$lib"
5 kx laname=$func_basename_result
5 kx
5 kx # Find the relevant object directory and library name.
5 kx if test yes = "$installed"; then
5 kx if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5 kx #func_warning "library '$lib' was moved."
5 kx dir=$ladir
5 kx absdir=$abs_ladir
5 kx libdir=$abs_ladir
5 kx else
5 kx dir=$lt_sysroot$libdir
5 kx absdir=$lt_sysroot$libdir
5 kx fi
5 kx test yes = "$hardcode_automatic" && avoidtemprpath=yes
5 kx else
5 kx if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5 kx dir=$ladir
5 kx absdir=$abs_ladir
5 kx # Remove this search path later
5 kx func_append notinst_path " $abs_ladir"
5 kx else
5 kx dir=$ladir/$objdir
5 kx absdir=$abs_ladir/$objdir
5 kx # Remove this search path later
5 kx func_append notinst_path " $abs_ladir"
5 kx fi
5 kx fi # $installed = yes
5 kx func_stripname 'lib' '.la' "$laname"
5 kx name=$func_stripname_result
5 kx
5 kx # This library was specified with -dlpreopen.
5 kx if test dlpreopen = "$pass"; then
5 kx if test -z "$libdir" && test prog = "$linkmode"; then
5 kx func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
5 kx fi
5 kx case $host in
5 kx # special handling for platforms with PE-DLLs.
5 kx *cygwin* | *mingw* | *cegcc* )
5 kx # Linker will automatically link against shared library if both
5 kx # static and shared are present. Therefore, ensure we extract
5 kx # symbols from the import library if a shared library is present
5 kx # (otherwise, the dlopen module name will be incorrect). We do
5 kx # this by putting the import library name into $newdlprefiles.
5 kx # We recover the dlopen module name by 'saving' the la file
5 kx # name in a special purpose variable, and (later) extracting the
5 kx # dlname from the la file.
5 kx if test -n "$dlname"; then
5 kx func_tr_sh "$dir/$linklib"
5 kx eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
5 kx func_append newdlprefiles " $dir/$linklib"
5 kx else
5 kx func_append newdlprefiles " $dir/$old_library"
5 kx # Keep a list of preopened convenience libraries to check
5 kx # that they are being used correctly in the link pass.
5 kx test -z "$libdir" && \
5 kx func_append dlpreconveniencelibs " $dir/$old_library"
5 kx fi
5 kx ;;
5 kx * )
5 kx # Prefer using a static library (so that no silly _DYNAMIC symbols
5 kx # are required to link).
5 kx if test -n "$old_library"; then
5 kx func_append newdlprefiles " $dir/$old_library"
5 kx # Keep a list of preopened convenience libraries to check
5 kx # that they are being used correctly in the link pass.
5 kx test -z "$libdir" && \
5 kx func_append dlpreconveniencelibs " $dir/$old_library"
5 kx # Otherwise, use the dlname, so that lt_dlopen finds it.
5 kx elif test -n "$dlname"; then
5 kx func_append newdlprefiles " $dir/$dlname"
5 kx else
5 kx func_append newdlprefiles " $dir/$linklib"
5 kx fi
5 kx ;;
5 kx esac
5 kx fi # $pass = dlpreopen
5 kx
5 kx if test -z "$libdir"; then
5 kx # Link the convenience library
5 kx if test lib = "$linkmode"; then
5 kx deplibs="$dir/$old_library $deplibs"
5 kx elif test prog,link = "$linkmode,$pass"; then
5 kx compile_deplibs="$dir/$old_library $compile_deplibs"
5 kx finalize_deplibs="$dir/$old_library $finalize_deplibs"
5 kx else
5 kx deplibs="$lib $deplibs" # used for prog,scan pass
5 kx fi
5 kx continue
5 kx fi
5 kx
5 kx
5 kx if test prog = "$linkmode" && test link != "$pass"; then
5 kx func_append newlib_search_path " $ladir"
5 kx deplibs="$lib $deplibs"
5 kx
5 kx linkalldeplibs=false
5 kx if test no != "$link_all_deplibs" || test -z "$library_names" ||
5 kx test no = "$build_libtool_libs"; then
5 kx linkalldeplibs=:
5 kx fi
5 kx
5 kx tmp_libs=
5 kx for deplib in $dependency_libs; do
5 kx case $deplib in
5 kx -L*) func_stripname '-L' '' "$deplib"
5 kx func_resolve_sysroot "$func_stripname_result"
5 kx func_append newlib_search_path " $func_resolve_sysroot_result"
5 kx ;;
5 kx esac
5 kx # Need to link against all dependency_libs?
5 kx if $linkalldeplibs; then
5 kx deplibs="$deplib $deplibs"
5 kx else
5 kx # Need to hardcode shared library paths
5 kx # or/and link against static libraries
5 kx newdependency_libs="$deplib $newdependency_libs"
5 kx fi
5 kx if $opt_preserve_dup_deps; then
5 kx case "$tmp_libs " in
5 kx *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5 kx esac
5 kx fi
5 kx func_append tmp_libs " $deplib"
5 kx done # for deplib
5 kx continue
5 kx fi # $linkmode = prog...
5 kx
5 kx if test prog,link = "$linkmode,$pass"; then
5 kx if test -n "$library_names" &&
5 kx { { test no = "$prefer_static_libs" ||
5 kx test built,yes = "$prefer_static_libs,$installed"; } ||
5 kx test -z "$old_library"; }; then
5 kx # We need to hardcode the library path
5 kx if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
5 kx # Make sure the rpath contains only unique directories.
5 kx case $temp_rpath: in
5 kx *"$absdir:"*) ;;
5 kx *) func_append temp_rpath "$absdir:" ;;
5 kx esac
5 kx fi
5 kx
5 kx # Hardcode the library path.
5 kx # Skip directories that are in the system default run-time
5 kx # search path.
5 kx case " $sys_lib_dlsearch_path " in
5 kx *" $absdir "*) ;;
5 kx *)
5 kx case "$compile_rpath " in
5 kx *" $absdir "*) ;;
5 kx *) func_append compile_rpath " $absdir" ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx case " $sys_lib_dlsearch_path " in
5 kx *" $libdir "*) ;;
5 kx *)
5 kx case "$finalize_rpath " in
5 kx *" $libdir "*) ;;
5 kx *) func_append finalize_rpath " $libdir" ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx fi # $linkmode,$pass = prog,link...
5 kx
5 kx if $alldeplibs &&
5 kx { test pass_all = "$deplibs_check_method" ||
5 kx { test yes = "$build_libtool_libs" &&
5 kx test -n "$library_names"; }; }; then
5 kx # We only need to search for static libraries
5 kx continue
5 kx fi
5 kx fi
5 kx
5 kx link_static=no # Whether the deplib will be linked statically
5 kx use_static_libs=$prefer_static_libs
5 kx if test built = "$use_static_libs" && test yes = "$installed"; then
5 kx use_static_libs=no
5 kx fi
5 kx if test -n "$library_names" &&
5 kx { test no = "$use_static_libs" || test -z "$old_library"; }; then
5 kx case $host in
5 kx *cygwin* | *mingw* | *cegcc* | *os2*)
5 kx # No point in relinking DLLs because paths are not encoded
5 kx func_append notinst_deplibs " $lib"
5 kx need_relink=no
5 kx ;;
5 kx *)
5 kx if test no = "$installed"; then
5 kx func_append notinst_deplibs " $lib"
5 kx need_relink=yes
5 kx fi
5 kx ;;
5 kx esac
5 kx # This is a shared library
5 kx
5 kx # Warn about portability, can't link against -module's on some
5 kx # systems (darwin). Don't bleat about dlopened modules though!
5 kx dlopenmodule=
5 kx for dlpremoduletest in $dlprefiles; do
5 kx if test "X$dlpremoduletest" = "X$lib"; then
5 kx dlopenmodule=$dlpremoduletest
5 kx break
5 kx fi
5 kx done
5 kx if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
5 kx echo
5 kx if test prog = "$linkmode"; then
5 kx $ECHO "*** Warning: Linking the executable $output against the loadable module"
5 kx else
5 kx $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5 kx fi
5 kx $ECHO "*** $linklib is not portable!"
5 kx fi
5 kx if test lib = "$linkmode" &&
5 kx test yes = "$hardcode_into_libs"; then
5 kx # Hardcode the library path.
5 kx # Skip directories that are in the system default run-time
5 kx # search path.
5 kx case " $sys_lib_dlsearch_path " in
5 kx *" $absdir "*) ;;
5 kx *)
5 kx case "$compile_rpath " in
5 kx *" $absdir "*) ;;
5 kx *) func_append compile_rpath " $absdir" ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx case " $sys_lib_dlsearch_path " in
5 kx *" $libdir "*) ;;
5 kx *)
5 kx case "$finalize_rpath " in
5 kx *" $libdir "*) ;;
5 kx *) func_append finalize_rpath " $libdir" ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx fi
5 kx
5 kx if test -n "$old_archive_from_expsyms_cmds"; then
5 kx # figure out the soname
5 kx set dummy $library_names
5 kx shift
5 kx realname=$1
5 kx shift
5 kx libname=`eval "\\$ECHO \"$libname_spec\""`
5 kx # use dlname if we got it. it's perfectly good, no?
5 kx if test -n "$dlname"; then
5 kx soname=$dlname
5 kx elif test -n "$soname_spec"; then
5 kx # bleh windows
5 kx case $host in
5 kx *cygwin* | mingw* | *cegcc* | *os2*)
5 kx func_arith $current - $age
5 kx major=$func_arith_result
5 kx versuffix=-$major
5 kx ;;
5 kx esac
5 kx eval soname=\"$soname_spec\"
5 kx else
5 kx soname=$realname
5 kx fi
5 kx
5 kx # Make a new name for the extract_expsyms_cmds to use
5 kx soroot=$soname
5 kx func_basename "$soroot"
5 kx soname=$func_basename_result
5 kx func_stripname 'lib' '.dll' "$soname"
5 kx newlib=libimp-$func_stripname_result.a
5 kx
5 kx # If the library has no export list, then create one now
5 kx if test -f "$output_objdir/$soname-def"; then :
5 kx else
5 kx func_verbose "extracting exported symbol list from '$soname'"
5 kx func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5 kx fi
5 kx
5 kx # Create $newlib
5 kx if test -f "$output_objdir/$newlib"; then :; else
5 kx func_verbose "generating import library for '$soname'"
5 kx func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5 kx fi
5 kx # make sure the library variables are pointing to the new library
5 kx dir=$output_objdir
5 kx linklib=$newlib
5 kx fi # test -n "$old_archive_from_expsyms_cmds"
5 kx
5 kx if test prog = "$linkmode" || test relink != "$opt_mode"; then
5 kx add_shlibpath=
5 kx add_dir=
5 kx add=
5 kx lib_linked=yes
5 kx case $hardcode_action in
5 kx immediate | unsupported)
5 kx if test no = "$hardcode_direct"; then
5 kx add=$dir/$linklib
5 kx case $host in
5 kx *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
5 kx *-*-sysv4*uw2*) add_dir=-L$dir ;;
5 kx *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5 kx *-*-unixware7*) add_dir=-L$dir ;;
5 kx *-*-darwin* )
5 kx # if the lib is a (non-dlopened) module then we cannot
5 kx # link against it, someone is ignoring the earlier warnings
5 kx if /usr/bin/file -L $add 2> /dev/null |
5 kx $GREP ": [^:]* bundle" >/dev/null; then
5 kx if test "X$dlopenmodule" != "X$lib"; then
5 kx $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5 kx if test -z "$old_library"; then
5 kx echo
5 kx echo "*** And there doesn't seem to be a static archive available"
5 kx echo "*** The link will probably fail, sorry"
5 kx else
5 kx add=$dir/$old_library
5 kx fi
5 kx elif test -n "$old_library"; then
5 kx add=$dir/$old_library
5 kx fi
5 kx fi
5 kx esac
5 kx elif test no = "$hardcode_minus_L"; then
5 kx case $host in
5 kx *-*-sunos*) add_shlibpath=$dir ;;
5 kx esac
5 kx add_dir=-L$dir
5 kx add=-l$name
5 kx elif test no = "$hardcode_shlibpath_var"; then
5 kx add_shlibpath=$dir
5 kx add=-l$name
5 kx else
5 kx lib_linked=no
5 kx fi
5 kx ;;
5 kx relink)
5 kx if test yes = "$hardcode_direct" &&
5 kx test no = "$hardcode_direct_absolute"; then
5 kx add=$dir/$linklib
5 kx elif test yes = "$hardcode_minus_L"; then
5 kx add_dir=-L$absdir
5 kx # Try looking first in the location we're being installed to.
5 kx if test -n "$inst_prefix_dir"; then
5 kx case $libdir in
5 kx [\\/]*)
5 kx func_append add_dir " -L$inst_prefix_dir$libdir"
5 kx ;;
5 kx esac
5 kx fi
5 kx add=-l$name
5 kx elif test yes = "$hardcode_shlibpath_var"; then
5 kx add_shlibpath=$dir
5 kx add=-l$name
5 kx else
5 kx lib_linked=no
5 kx fi
5 kx ;;
5 kx *) lib_linked=no ;;
5 kx esac
5 kx
5 kx if test yes != "$lib_linked"; then
5 kx func_fatal_configuration "unsupported hardcode properties"
5 kx fi
5 kx
5 kx if test -n "$add_shlibpath"; then
5 kx case :$compile_shlibpath: in
5 kx *":$add_shlibpath:"*) ;;
5 kx *) func_append compile_shlibpath "$add_shlibpath:" ;;
5 kx esac
5 kx fi
5 kx if test prog = "$linkmode"; then
5 kx test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5 kx test -n "$add" && compile_deplibs="$add $compile_deplibs"
5 kx else
5 kx test -n "$add_dir" && deplibs="$add_dir $deplibs"
5 kx test -n "$add" && deplibs="$add $deplibs"
5 kx if test yes != "$hardcode_direct" &&
5 kx test yes != "$hardcode_minus_L" &&
5 kx test yes = "$hardcode_shlibpath_var"; then
5 kx case :$finalize_shlibpath: in
5 kx *":$libdir:"*) ;;
5 kx *) func_append finalize_shlibpath "$libdir:" ;;
5 kx esac
5 kx fi
5 kx fi
5 kx fi
5 kx
5 kx if test prog = "$linkmode" || test relink = "$opt_mode"; then
5 kx add_shlibpath=
5 kx add_dir=
5 kx add=
5 kx # Finalize command for both is simple: just hardcode it.
5 kx if test yes = "$hardcode_direct" &&
5 kx test no = "$hardcode_direct_absolute"; then
5 kx add=$libdir/$linklib
5 kx elif test yes = "$hardcode_minus_L"; then
5 kx add_dir=-L$libdir
5 kx add=-l$name
5 kx elif test yes = "$hardcode_shlibpath_var"; then
5 kx case :$finalize_shlibpath: in
5 kx *":$libdir:"*) ;;
5 kx *) func_append finalize_shlibpath "$libdir:" ;;
5 kx esac
5 kx add=-l$name
5 kx elif test yes = "$hardcode_automatic"; then
5 kx if test -n "$inst_prefix_dir" &&
5 kx test -f "$inst_prefix_dir$libdir/$linklib"; then
5 kx add=$inst_prefix_dir$libdir/$linklib
5 kx else
5 kx add=$libdir/$linklib
5 kx fi
5 kx else
5 kx # We cannot seem to hardcode it, guess we'll fake it.
5 kx add_dir=-L$libdir
5 kx # Try looking first in the location we're being installed to.
5 kx if test -n "$inst_prefix_dir"; then
5 kx case $libdir in
5 kx [\\/]*)
5 kx func_append add_dir " -L$inst_prefix_dir$libdir"
5 kx ;;
5 kx esac
5 kx fi
5 kx add=-l$name
5 kx fi
5 kx
5 kx if test prog = "$linkmode"; then
5 kx test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5 kx test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5 kx else
5 kx test -n "$add_dir" && deplibs="$add_dir $deplibs"
5 kx test -n "$add" && deplibs="$add $deplibs"
5 kx fi
5 kx fi
5 kx elif test prog = "$linkmode"; then
5 kx # Here we assume that one of hardcode_direct or hardcode_minus_L
5 kx # is not unsupported. This is valid on all known static and
5 kx # shared platforms.
5 kx if test unsupported != "$hardcode_direct"; then
5 kx test -n "$old_library" && linklib=$old_library
5 kx compile_deplibs="$dir/$linklib $compile_deplibs"
5 kx finalize_deplibs="$dir/$linklib $finalize_deplibs"
5 kx else
5 kx compile_deplibs="-l$name -L$dir $compile_deplibs"
5 kx finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5 kx fi
5 kx elif test yes = "$build_libtool_libs"; then
5 kx # Not a shared library
5 kx if test pass_all != "$deplibs_check_method"; then
5 kx # We're trying link a shared library against a static one
5 kx # but the system doesn't support it.
5 kx
5 kx # Just print a warning and add the library to dependency_libs so
5 kx # that the program can be linked against the static library.
5 kx echo
5 kx $ECHO "*** Warning: This system cannot link to static lib archive $lib."
5 kx echo "*** I have the capability to make that library automatically link in when"
5 kx echo "*** you link to this library. But I can only do this if you have a"
5 kx echo "*** shared version of the library, which you do not appear to have."
5 kx if test yes = "$module"; then
5 kx echo "*** But as you try to build a module library, libtool will still create "
5 kx echo "*** a static module, that should work as long as the dlopening application"
5 kx echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
5 kx if test -z "$global_symbol_pipe"; then
5 kx echo
5 kx echo "*** However, this would only work if libtool was able to extract symbol"
5 kx echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
5 kx echo "*** not find such a program. So, this module is probably useless."
5 kx echo "*** 'nm' from GNU binutils and a full rebuild may help."
5 kx fi
5 kx if test no = "$build_old_libs"; then
5 kx build_libtool_libs=module
5 kx build_old_libs=yes
5 kx else
5 kx build_libtool_libs=no
5 kx fi
5 kx fi
5 kx else
5 kx deplibs="$dir/$old_library $deplibs"
5 kx link_static=yes
5 kx fi
5 kx fi # link shared/static library?
5 kx
5 kx if test lib = "$linkmode"; then
5 kx if test -n "$dependency_libs" &&
5 kx { test yes != "$hardcode_into_libs" ||
5 kx test yes = "$build_old_libs" ||
5 kx test yes = "$link_static"; }; then
5 kx # Extract -R from dependency_libs
5 kx temp_deplibs=
5 kx for libdir in $dependency_libs; do
5 kx case $libdir in
5 kx -R*) func_stripname '-R' '' "$libdir"
5 kx temp_xrpath=$func_stripname_result
5 kx case " $xrpath " in
5 kx *" $temp_xrpath "*) ;;
5 kx *) func_append xrpath " $temp_xrpath";;
5 kx esac;;
5 kx *) func_append temp_deplibs " $libdir";;
5 kx esac
5 kx done
5 kx dependency_libs=$temp_deplibs
5 kx fi
5 kx
5 kx func_append newlib_search_path " $absdir"
5 kx # Link against this library
5 kx test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5 kx # ... and its dependency_libs
5 kx tmp_libs=
5 kx for deplib in $dependency_libs; do
5 kx newdependency_libs="$deplib $newdependency_libs"
5 kx case $deplib in
5 kx -L*) func_stripname '-L' '' "$deplib"
5 kx func_resolve_sysroot "$func_stripname_result";;
5 kx *) func_resolve_sysroot "$deplib" ;;
5 kx esac
5 kx if $opt_preserve_dup_deps; then
5 kx case "$tmp_libs " in
5 kx *" $func_resolve_sysroot_result "*)
5 kx func_append specialdeplibs " $func_resolve_sysroot_result" ;;
5 kx esac
5 kx fi
5 kx func_append tmp_libs " $func_resolve_sysroot_result"
5 kx done
5 kx
5 kx if test no != "$link_all_deplibs"; then
5 kx # Add the search paths of all dependency libraries
5 kx for deplib in $dependency_libs; do
5 kx path=
5 kx case $deplib in
5 kx -L*) path=$deplib ;;
5 kx *.la)
5 kx func_resolve_sysroot "$deplib"
5 kx deplib=$func_resolve_sysroot_result
5 kx func_dirname "$deplib" "" "."
5 kx dir=$func_dirname_result
5 kx # We need an absolute path.
5 kx case $dir in
5 kx [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
5 kx *)
5 kx absdir=`cd "$dir" && pwd`
5 kx if test -z "$absdir"; then
5 kx func_warning "cannot determine absolute directory name of '$dir'"
5 kx absdir=$dir
5 kx fi
5 kx ;;
5 kx esac
5 kx if $GREP "^installed=no" $deplib > /dev/null; then
5 kx case $host in
5 kx *-*-darwin*)
5 kx depdepl=
5 kx eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5 kx if test -n "$deplibrary_names"; then
5 kx for tmp in $deplibrary_names; do
5 kx depdepl=$tmp
5 kx done
5 kx if test -f "$absdir/$objdir/$depdepl"; then
5 kx depdepl=$absdir/$objdir/$depdepl
5 kx darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5 kx if test -z "$darwin_install_name"; then
5 kx darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5 kx fi
5 kx func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
5 kx func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
5 kx path=
5 kx fi
5 kx fi
5 kx ;;
5 kx *)
5 kx path=-L$absdir/$objdir
5 kx ;;
5 kx esac
5 kx else
5 kx eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5 kx test -z "$libdir" && \
5 kx func_fatal_error "'$deplib' is not a valid libtool archive"
5 kx #test "$absdir" != "$libdir" && \
5 kx # func_warning "'$deplib' seems to be moved"
5 kx
5 kx path=-L$absdir
5 kx fi
5 kx ;;
5 kx esac
5 kx case " $deplibs " in
5 kx *" $path "*) ;;
5 kx *) deplibs="$path $deplibs" ;;
5 kx esac
5 kx done
5 kx fi # link_all_deplibs != no
5 kx fi # linkmode = lib
5 kx done # for deplib in $libs
5 kx if test link = "$pass"; then
5 kx if test prog = "$linkmode"; then
5 kx compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5 kx finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5 kx else
5 kx compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5 kx fi
5 kx fi
5 kx dependency_libs=$newdependency_libs
5 kx if test dlpreopen = "$pass"; then
5 kx # Link the dlpreopened libraries before other libraries
5 kx for deplib in $save_deplibs; do
5 kx deplibs="$deplib $deplibs"
5 kx done
5 kx fi
5 kx if test dlopen != "$pass"; then
5 kx test conv = "$pass" || {
5 kx # Make sure lib_search_path contains only unique directories.
5 kx lib_search_path=
5 kx for dir in $newlib_search_path; do
5 kx case "$lib_search_path " in
5 kx *" $dir "*) ;;
5 kx *) func_append lib_search_path " $dir" ;;
5 kx esac
5 kx done
5 kx newlib_search_path=
5 kx }
5 kx
5 kx if test prog,link = "$linkmode,$pass"; then
5 kx vars="compile_deplibs finalize_deplibs"
5 kx else
5 kx vars=deplibs
5 kx fi
5 kx for var in $vars dependency_libs; do
5 kx # Add libraries to $var in reverse order
5 kx eval tmp_libs=\"\$$var\"
5 kx new_libs=
5 kx for deplib in $tmp_libs; do
5 kx # FIXME: Pedantically, this is the right thing to do, so
5 kx # that some nasty dependency loop isn't accidentally
5 kx # broken:
5 kx #new_libs="$deplib $new_libs"
5 kx # Pragmatically, this seems to cause very few problems in
5 kx # practice:
5 kx case $deplib in
5 kx -L*) new_libs="$deplib $new_libs" ;;
5 kx -R*) ;;
5 kx *)
5 kx # And here is the reason: when a library appears more
5 kx # than once as an explicit dependence of a library, or
5 kx # is implicitly linked in more than once by the
5 kx # compiler, it is considered special, and multiple
5 kx # occurrences thereof are not removed. Compare this
5 kx # with having the same library being listed as a
5 kx # dependency of multiple other libraries: in this case,
5 kx # we know (pedantically, we assume) the library does not
5 kx # need to be listed more than once, so we keep only the
5 kx # last copy. This is not always right, but it is rare
5 kx # enough that we require users that really mean to play
5 kx # such unportable linking tricks to link the library
5 kx # using -Wl,-lname, so that libtool does not consider it
5 kx # for duplicate removal.
5 kx case " $specialdeplibs " in
5 kx *" $deplib "*) new_libs="$deplib $new_libs" ;;
5 kx *)
5 kx case " $new_libs " in
5 kx *" $deplib "*) ;;
5 kx *) new_libs="$deplib $new_libs" ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx done
5 kx tmp_libs=
5 kx for deplib in $new_libs; do
5 kx case $deplib in
5 kx -L*)
5 kx case " $tmp_libs " in
5 kx *" $deplib "*) ;;
5 kx *) func_append tmp_libs " $deplib" ;;
5 kx esac
5 kx ;;
5 kx *) func_append tmp_libs " $deplib" ;;
5 kx esac
5 kx done
5 kx eval $var=\"$tmp_libs\"
5 kx done # for var
5 kx fi
5 kx
5 kx # Add Sun CC postdeps if required:
5 kx test CXX = "$tagname" && {
5 kx case $host_os in
5 kx linux*)
5 kx case `$CC -V 2>&1 | sed 5q` in
5 kx *Sun\ C*) # Sun C++ 5.9
5 kx func_suncc_cstd_abi
5 kx
5 kx if test no != "$suncc_use_cstd_abi"; then
5 kx func_append postdeps ' -library=Cstd -library=Crun'
5 kx fi
5 kx ;;
5 kx esac
5 kx ;;
5 kx
5 kx solaris*)
5 kx func_cc_basename "$CC"
5 kx case $func_cc_basename_result in
5 kx CC* | sunCC*)
5 kx func_suncc_cstd_abi
5 kx
5 kx if test no != "$suncc_use_cstd_abi"; then
5 kx func_append postdeps ' -library=Cstd -library=Crun'
5 kx fi
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx }
5 kx
5 kx # Last step: remove runtime libs from dependency_libs
5 kx # (they stay in deplibs)
5 kx tmp_libs=
5 kx for i in $dependency_libs; do
5 kx case " $predeps $postdeps $compiler_lib_search_path " in
5 kx *" $i "*)
5 kx i=
5 kx ;;
5 kx esac
5 kx if test -n "$i"; then
5 kx func_append tmp_libs " $i"
5 kx fi
5 kx done
5 kx dependency_libs=$tmp_libs
5 kx done # for pass
5 kx if test prog = "$linkmode"; then
5 kx dlfiles=$newdlfiles
5 kx fi
5 kx if test prog = "$linkmode" || test lib = "$linkmode"; then
5 kx dlprefiles=$newdlprefiles
5 kx fi
5 kx
5 kx case $linkmode in
5 kx oldlib)
5 kx if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
5 kx func_warning "'-dlopen' is ignored for archives"
5 kx fi
5 kx
5 kx case " $deplibs" in
5 kx *\ -l* | *\ -L*)
5 kx func_warning "'-l' and '-L' are ignored for archives" ;;
5 kx esac
5 kx
5 kx test -n "$rpath" && \
5 kx func_warning "'-rpath' is ignored for archives"
5 kx
5 kx test -n "$xrpath" && \
5 kx func_warning "'-R' is ignored for archives"
5 kx
5 kx test -n "$vinfo" && \
5 kx func_warning "'-version-info/-version-number' is ignored for archives"
5 kx
5 kx test -n "$release" && \
5 kx func_warning "'-release' is ignored for archives"
5 kx
5 kx test -n "$export_symbols$export_symbols_regex" && \
5 kx func_warning "'-export-symbols' is ignored for archives"
5 kx
5 kx # Now set the variables for building old libraries.
5 kx build_libtool_libs=no
5 kx oldlibs=$output
5 kx func_append objs "$old_deplibs"
5 kx ;;
5 kx
5 kx lib)
5 kx # Make sure we only generate libraries of the form 'libNAME.la'.
5 kx case $outputname in
5 kx lib*)
5 kx func_stripname 'lib' '.la' "$outputname"
5 kx name=$func_stripname_result
5 kx eval shared_ext=\"$shrext_cmds\"
5 kx eval libname=\"$libname_spec\"
5 kx ;;
5 kx *)
5 kx test no = "$module" \
5 kx && func_fatal_help "libtool library '$output' must begin with 'lib'"
5 kx
5 kx if test no != "$need_lib_prefix"; then
5 kx # Add the "lib" prefix for modules if required
5 kx func_stripname '' '.la' "$outputname"
5 kx name=$func_stripname_result
5 kx eval shared_ext=\"$shrext_cmds\"
5 kx eval libname=\"$libname_spec\"
5 kx else
5 kx func_stripname '' '.la' "$outputname"
5 kx libname=$func_stripname_result
5 kx fi
5 kx ;;
5 kx esac
5 kx
5 kx if test -n "$objs"; then
5 kx if test pass_all != "$deplibs_check_method"; then
5 kx func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
5 kx else
5 kx echo
5 kx $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
5 kx $ECHO "*** objects $objs is not portable!"
5 kx func_append libobjs " $objs"
5 kx fi
5 kx fi
5 kx
5 kx test no = "$dlself" \
5 kx || func_warning "'-dlopen self' is ignored for libtool libraries"
5 kx
5 kx set dummy $rpath
5 kx shift
5 kx test 1 -lt "$#" \
5 kx && func_warning "ignoring multiple '-rpath's for a libtool library"
5 kx
5 kx install_libdir=$1
5 kx
5 kx oldlibs=
5 kx if test -z "$rpath"; then
5 kx if test yes = "$build_libtool_libs"; then
5 kx # Building a libtool convenience library.
5 kx # Some compilers have problems with a '.al' extension so
5 kx # convenience libraries should have the same extension an
5 kx # archive normally would.
5 kx oldlibs="$output_objdir/$libname.$libext $oldlibs"
5 kx build_libtool_libs=convenience
5 kx build_old_libs=yes
5 kx fi
5 kx
5 kx test -n "$vinfo" && \
5 kx func_warning "'-version-info/-version-number' is ignored for convenience libraries"
5 kx
5 kx test -n "$release" && \
5 kx func_warning "'-release' is ignored for convenience libraries"
5 kx else
5 kx
5 kx # Parse the version information argument.
5 kx save_ifs=$IFS; IFS=:
5 kx set dummy $vinfo 0 0 0
5 kx shift
5 kx IFS=$save_ifs
5 kx
5 kx test -n "$7" && \
5 kx func_fatal_help "too many parameters to '-version-info'"
5 kx
5 kx # convert absolute version numbers to libtool ages
5 kx # this retains compatibility with .la files and attempts
5 kx # to make the code below a bit more comprehensible
5 kx
5 kx case $vinfo_number in
5 kx yes)
5 kx number_major=$1
5 kx number_minor=$2
5 kx number_revision=$3
5 kx #
5 kx # There are really only two kinds -- those that
5 kx # use the current revision as the major version
5 kx # and those that subtract age and use age as
5 kx # a minor version. But, then there is irix
5 kx # that has an extra 1 added just for fun
5 kx #
5 kx case $version_type in
5 kx # correct linux to gnu/linux during the next big refactor
5 kx darwin|freebsd-elf|linux|osf|windows|none)
5 kx func_arith $number_major + $number_minor
5 kx current=$func_arith_result
5 kx age=$number_minor
5 kx revision=$number_revision
5 kx ;;
5 kx freebsd-aout|qnx|sunos)
5 kx current=$number_major
5 kx revision=$number_minor
5 kx age=0
5 kx ;;
5 kx irix|nonstopux)
5 kx func_arith $number_major + $number_minor
5 kx current=$func_arith_result
5 kx age=$number_minor
5 kx revision=$number_minor
5 kx lt_irix_increment=no
5 kx ;;
5 kx esac
5 kx ;;
5 kx no)
5 kx current=$1
5 kx revision=$2
5 kx age=$3
5 kx ;;
5 kx esac
5 kx
5 kx # Check that each of the things are valid numbers.
5 kx case $current in
5 kx 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]) ;;
5 kx *)
5 kx func_error "CURRENT '$current' must be a nonnegative integer"
5 kx func_fatal_error "'$vinfo' is not valid version information"
5 kx ;;
5 kx esac
5 kx
5 kx case $revision in
5 kx 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]) ;;
5 kx *)
5 kx func_error "REVISION '$revision' must be a nonnegative integer"
5 kx func_fatal_error "'$vinfo' is not valid version information"
5 kx ;;
5 kx esac
5 kx
5 kx case $age in
5 kx 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]) ;;
5 kx *)
5 kx func_error "AGE '$age' must be a nonnegative integer"
5 kx func_fatal_error "'$vinfo' is not valid version information"
5 kx ;;
5 kx esac
5 kx
5 kx if test "$age" -gt "$current"; then
5 kx func_error "AGE '$age' is greater than the current interface number '$current'"
5 kx func_fatal_error "'$vinfo' is not valid version information"
5 kx fi
5 kx
5 kx # Calculate the version variables.
5 kx major=
5 kx versuffix=
5 kx verstring=
5 kx case $version_type in
5 kx none) ;;
5 kx
5 kx darwin)
5 kx # Like Linux, but with the current version available in
5 kx # verstring for coding it into the library header
5 kx func_arith $current - $age
5 kx major=.$func_arith_result
5 kx versuffix=$major.$age.$revision
5 kx # Darwin ld doesn't like 0 for these options...
5 kx func_arith $current + 1
5 kx minor_current=$func_arith_result
5 kx xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
5 kx verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
5 kx # On Darwin other compilers
5 kx case $CC in
5 kx nagfor*)
5 kx verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
5 kx ;;
5 kx *)
5 kx verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
5 kx ;;
5 kx esac
5 kx ;;
5 kx
5 kx freebsd-aout)
5 kx major=.$current
5 kx versuffix=.$current.$revision
5 kx ;;
5 kx
5 kx freebsd-elf)
5 kx func_arith $current - $age
5 kx major=.$func_arith_result
5 kx versuffix=$major.$age.$revision
5 kx ;;
5 kx
5 kx irix | nonstopux)
5 kx if test no = "$lt_irix_increment"; then
5 kx func_arith $current - $age
5 kx else
5 kx func_arith $current - $age + 1
5 kx fi
5 kx major=$func_arith_result
5 kx
5 kx case $version_type in
5 kx nonstopux) verstring_prefix=nonstopux ;;
5 kx *) verstring_prefix=sgi ;;
5 kx esac
5 kx verstring=$verstring_prefix$major.$revision
5 kx
5 kx # Add in all the interfaces that we are compatible with.
5 kx loop=$revision
5 kx while test 0 -ne "$loop"; do
5 kx func_arith $revision - $loop
5 kx iface=$func_arith_result
5 kx func_arith $loop - 1
5 kx loop=$func_arith_result
5 kx verstring=$verstring_prefix$major.$iface:$verstring
5 kx done
5 kx
5 kx # Before this point, $major must not contain '.'.
5 kx major=.$major
5 kx versuffix=$major.$revision
5 kx ;;
5 kx
5 kx linux) # correct to gnu/linux during the next big refactor
5 kx func_arith $current - $age
5 kx major=.$func_arith_result
5 kx versuffix=$major.$age.$revision
5 kx ;;
5 kx
5 kx osf)
5 kx func_arith $current - $age
5 kx major=.$func_arith_result
5 kx versuffix=.$current.$age.$revision
5 kx verstring=$current.$age.$revision
5 kx
5 kx # Add in all the interfaces that we are compatible with.
5 kx loop=$age
5 kx while test 0 -ne "$loop"; do
5 kx func_arith $current - $loop
5 kx iface=$func_arith_result
5 kx func_arith $loop - 1
5 kx loop=$func_arith_result
5 kx verstring=$verstring:$iface.0
5 kx done
5 kx
5 kx # Make executables depend on our current version.
5 kx func_append verstring ":$current.0"
5 kx ;;
5 kx
5 kx qnx)
5 kx major=.$current
5 kx versuffix=.$current
5 kx ;;
5 kx
5 kx sco)
5 kx major=.$current
5 kx versuffix=.$current
5 kx ;;
5 kx
5 kx sunos)
5 kx major=.$current
5 kx versuffix=.$current.$revision
5 kx ;;
5 kx
5 kx windows)
5 kx # Use '-' rather than '.', since we only want one
5 kx # extension on DOS 8.3 file systems.
5 kx func_arith $current - $age
5 kx major=$func_arith_result
5 kx versuffix=-$major
5 kx ;;
5 kx
5 kx *)
5 kx func_fatal_configuration "unknown library version type '$version_type'"
5 kx ;;
5 kx esac
5 kx
5 kx # Clear the version info if we defaulted, and they specified a release.
5 kx if test -z "$vinfo" && test -n "$release"; then
5 kx major=
5 kx case $version_type in
5 kx darwin)
5 kx # we can't check for "0.0" in archive_cmds due to quoting
5 kx # problems, so we reset it completely
5 kx verstring=
5 kx ;;
5 kx *)
5 kx verstring=0.0
5 kx ;;
5 kx esac
5 kx if test no = "$need_version"; then
5 kx versuffix=
5 kx else
5 kx versuffix=.0.0
5 kx fi
5 kx fi
5 kx
5 kx # Remove version info from name if versioning should be avoided
5 kx if test yes,no = "$avoid_version,$need_version"; then
5 kx major=
5 kx versuffix=
5 kx verstring=
5 kx fi
5 kx
5 kx # Check to see if the archive will have undefined symbols.
5 kx if test yes = "$allow_undefined"; then
5 kx if test unsupported = "$allow_undefined_flag"; then
5 kx if test yes = "$build_old_libs"; then
5 kx func_warning "undefined symbols not allowed in $host shared libraries; building static only"
5 kx build_libtool_libs=no
5 kx else
5 kx func_fatal_error "can't build $host shared library unless -no-undefined is specified"
5 kx fi
5 kx fi
5 kx else
5 kx # Don't allow undefined symbols.
5 kx allow_undefined_flag=$no_undefined_flag
5 kx fi
5 kx
5 kx fi
5 kx
5 kx func_generate_dlsyms "$libname" "$libname" :
5 kx func_append libobjs " $symfileobj"
5 kx test " " = "$libobjs" && libobjs=
5 kx
5 kx if test relink != "$opt_mode"; then
5 kx # Remove our outputs, but don't remove object files since they
5 kx # may have been created when compiling PIC objects.
5 kx removelist=
5 kx tempremovelist=`$ECHO "$output_objdir/*"`
5 kx for p in $tempremovelist; do
5 kx case $p in
5 kx *.$objext | *.gcno)
5 kx ;;
5 kx $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
5 kx if test -n "$precious_files_regex"; then
5 kx if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
5 kx then
5 kx continue
5 kx fi
5 kx fi
5 kx func_append removelist " $p"
5 kx ;;
5 kx *) ;;
5 kx esac
5 kx done
5 kx test -n "$removelist" && \
5 kx func_show_eval "${RM}r \$removelist"
5 kx fi
5 kx
5 kx # Now set the variables for building old libraries.
5 kx if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
5 kx func_append oldlibs " $output_objdir/$libname.$libext"
5 kx
5 kx # Transform .lo files to .o files.
5 kx oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
5 kx fi
5 kx
5 kx # Eliminate all temporary directories.
5 kx #for path in $notinst_path; do
5 kx # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
5 kx # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
5 kx # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
5 kx #done
5 kx
5 kx if test -n "$xrpath"; then
5 kx # If the user specified any rpath flags, then add them.
5 kx temp_xrpath=
5 kx for libdir in $xrpath; do
5 kx func_replace_sysroot "$libdir"
5 kx func_append temp_xrpath " -R$func_replace_sysroot_result"
5 kx case "$finalize_rpath " in
5 kx *" $libdir "*) ;;
5 kx *) func_append finalize_rpath " $libdir" ;;
5 kx esac
5 kx done
5 kx if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
5 kx dependency_libs="$temp_xrpath $dependency_libs"
5 kx fi
5 kx fi
5 kx
5 kx # Make sure dlfiles contains only unique files that won't be dlpreopened
5 kx old_dlfiles=$dlfiles
5 kx dlfiles=
5 kx for lib in $old_dlfiles; do
5 kx case " $dlprefiles $dlfiles " in
5 kx *" $lib "*) ;;
5 kx *) func_append dlfiles " $lib" ;;
5 kx esac
5 kx done
5 kx
5 kx # Make sure dlprefiles contains only unique files
5 kx old_dlprefiles=$dlprefiles
5 kx dlprefiles=
5 kx for lib in $old_dlprefiles; do
5 kx case "$dlprefiles " in
5 kx *" $lib "*) ;;
5 kx *) func_append dlprefiles " $lib" ;;
5 kx esac
5 kx done
5 kx
5 kx if test yes = "$build_libtool_libs"; then
5 kx if test -n "$rpath"; then
5 kx case $host in
5 kx *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
5 kx # these systems don't actually have a c library (as such)!
5 kx ;;
5 kx *-*-rhapsody* | *-*-darwin1.[012])
5 kx # Rhapsody C library is in the System framework
5 kx func_append deplibs " System.ltframework"
5 kx ;;
5 kx *-*-netbsd*)
5 kx # Don't link with libc until the a.out ld.so is fixed.
5 kx ;;
5 kx *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5 kx # Do not include libc due to us having libc/libc_r.
5 kx ;;
5 kx *-*-sco3.2v5* | *-*-sco5v6*)
5 kx # Causes problems with __ctype
5 kx ;;
5 kx *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5 kx # Compiler inserts libc in the correct place for threads to work
5 kx ;;
5 kx *)
5 kx # Add libc to deplibs on all other systems if necessary.
5 kx if test yes = "$build_libtool_need_lc"; then
5 kx func_append deplibs " -lc"
5 kx fi
5 kx ;;
5 kx esac
5 kx fi
5 kx
5 kx # Transform deplibs into only deplibs that can be linked in shared.
5 kx name_save=$name
5 kx libname_save=$libname
5 kx release_save=$release
5 kx versuffix_save=$versuffix
5 kx major_save=$major
5 kx # I'm not sure if I'm treating the release correctly. I think
5 kx # release should show up in the -l (ie -lgmp5) so we don't want to
5 kx # add it in twice. Is that correct?
5 kx release=
5 kx versuffix=
5 kx major=
5 kx newdeplibs=
5 kx droppeddeps=no
5 kx case $deplibs_check_method in
5 kx pass_all)
5 kx # Don't check for shared/static. Everything works.
5 kx # This might be a little naive. We might want to check
5 kx # whether the library exists or not. But this is on
5 kx # osf3 & osf4 and I'm not really sure... Just
5 kx # implementing what was already the behavior.
5 kx newdeplibs=$deplibs
5 kx ;;
5 kx test_compile)
5 kx # This code stresses the "libraries are programs" paradigm to its
5 kx # limits. Maybe even breaks it. We compile a program, linking it
5 kx # against the deplibs as a proxy for the library. Then we can check
5 kx # whether they linked in statically or dynamically with ldd.
5 kx $opt_dry_run || $RM conftest.c
5 kx cat > conftest.c <<EOF
5 kx int main() { return 0; }
5 kx EOF
5 kx $opt_dry_run || $RM conftest
5 kx if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
5 kx ldd_output=`ldd conftest`
5 kx for i in $deplibs; do
5 kx case $i in
5 kx -l*)
5 kx func_stripname -l '' "$i"
5 kx name=$func_stripname_result
5 kx if test yes = "$allow_libtool_libs_with_static_runtimes"; then
5 kx case " $predeps $postdeps " in
5 kx *" $i "*)
5 kx func_append newdeplibs " $i"
5 kx i=
5 kx ;;
5 kx esac
5 kx fi
5 kx if test -n "$i"; then
5 kx libname=`eval "\\$ECHO \"$libname_spec\""`
5 kx deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5 kx set dummy $deplib_matches; shift
5 kx deplib_match=$1
5 kx if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
5 kx func_append newdeplibs " $i"
5 kx else
5 kx droppeddeps=yes
5 kx echo
5 kx $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5 kx echo "*** I have the capability to make that library automatically link in when"
5 kx echo "*** you link to this library. But I can only do this if you have a"
5 kx echo "*** shared version of the library, which I believe you do not have"
5 kx echo "*** because a test_compile did reveal that the linker did not use it for"
5 kx echo "*** its dynamic dependency list that programs get resolved with at runtime."
5 kx fi
5 kx fi
5 kx ;;
5 kx *)
5 kx func_append newdeplibs " $i"
5 kx ;;
5 kx esac
5 kx done
5 kx else
5 kx # Error occurred in the first compile. Let's try to salvage
5 kx # the situation: Compile a separate program for each library.
5 kx for i in $deplibs; do
5 kx case $i in
5 kx -l*)
5 kx func_stripname -l '' "$i"
5 kx name=$func_stripname_result
5 kx $opt_dry_run || $RM conftest
5 kx if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
5 kx ldd_output=`ldd conftest`
5 kx if test yes = "$allow_libtool_libs_with_static_runtimes"; then
5 kx case " $predeps $postdeps " in
5 kx *" $i "*)
5 kx func_append newdeplibs " $i"
5 kx i=
5 kx ;;
5 kx esac
5 kx fi
5 kx if test -n "$i"; then
5 kx libname=`eval "\\$ECHO \"$libname_spec\""`
5 kx deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5 kx set dummy $deplib_matches; shift
5 kx deplib_match=$1
5 kx if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
5 kx func_append newdeplibs " $i"
5 kx else
5 kx droppeddeps=yes
5 kx echo
5 kx $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5 kx echo "*** I have the capability to make that library automatically link in when"
5 kx echo "*** you link to this library. But I can only do this if you have a"
5 kx echo "*** shared version of the library, which you do not appear to have"
5 kx echo "*** because a test_compile did reveal that the linker did not use this one"
5 kx echo "*** as a dynamic dependency that programs can get resolved with at runtime."
5 kx fi
5 kx fi
5 kx else
5 kx droppeddeps=yes
5 kx echo
5 kx $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
5 kx echo "*** make it link in! You will probably need to install it or some"
5 kx echo "*** library that it depends on before this library will be fully"
5 kx echo "*** functional. Installing it before continuing would be even better."
5 kx fi
5 kx ;;
5 kx *)
5 kx func_append newdeplibs " $i"
5 kx ;;
5 kx esac
5 kx done
5 kx fi
5 kx ;;
5 kx file_magic*)
5 kx set dummy $deplibs_check_method; shift
5 kx file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5 kx for a_deplib in $deplibs; do
5 kx case $a_deplib in
5 kx -l*)
5 kx func_stripname -l '' "$a_deplib"
5 kx name=$func_stripname_result
5 kx if test yes = "$allow_libtool_libs_with_static_runtimes"; then
5 kx case " $predeps $postdeps " in
5 kx *" $a_deplib "*)
5 kx func_append newdeplibs " $a_deplib"
5 kx a_deplib=
5 kx ;;
5 kx esac
5 kx fi
5 kx if test -n "$a_deplib"; then
5 kx libname=`eval "\\$ECHO \"$libname_spec\""`
5 kx if test -n "$file_magic_glob"; then
5 kx libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
5 kx else
5 kx libnameglob=$libname
5 kx fi
5 kx test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
5 kx for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5 kx if test yes = "$want_nocaseglob"; then
5 kx shopt -s nocaseglob
5 kx potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
5 kx $nocaseglob
5 kx else
5 kx potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
5 kx fi
5 kx for potent_lib in $potential_libs; do
5 kx # Follow soft links.
5 kx if ls -lLd "$potent_lib" 2>/dev/null |
5 kx $GREP " -> " >/dev/null; then
5 kx continue
5 kx fi
5 kx # The statement above tries to avoid entering an
5 kx # endless loop below, in case of cyclic links.
5 kx # We might still enter an endless loop, since a link
5 kx # loop can be closed while we follow links,
5 kx # but so what?
5 kx potlib=$potent_lib
5 kx while test -h "$potlib" 2>/dev/null; do
5 kx potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
5 kx case $potliblink in
5 kx [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
5 kx *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
5 kx esac
5 kx done
5 kx if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
5 kx $SED -e 10q |
5 kx $EGREP "$file_magic_regex" > /dev/null; then
5 kx func_append newdeplibs " $a_deplib"
5 kx a_deplib=
5 kx break 2
5 kx fi
5 kx done
5 kx done
5 kx fi
5 kx if test -n "$a_deplib"; then
5 kx droppeddeps=yes
5 kx echo
5 kx $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5 kx echo "*** I have the capability to make that library automatically link in when"
5 kx echo "*** you link to this library. But I can only do this if you have a"
5 kx echo "*** shared version of the library, which you do not appear to have"
5 kx echo "*** because I did check the linker path looking for a file starting"
5 kx if test -z "$potlib"; then
5 kx $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
5 kx else
5 kx $ECHO "*** with $libname and none of the candidates passed a file format test"
5 kx $ECHO "*** using a file magic. Last file checked: $potlib"
5 kx fi
5 kx fi
5 kx ;;
5 kx *)
5 kx # Add a -L argument.
5 kx func_append newdeplibs " $a_deplib"
5 kx ;;
5 kx esac
5 kx done # Gone through all deplibs.
5 kx ;;
5 kx match_pattern*)
5 kx set dummy $deplibs_check_method; shift
5 kx match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5 kx for a_deplib in $deplibs; do
5 kx case $a_deplib in
5 kx -l*)
5 kx func_stripname -l '' "$a_deplib"
5 kx name=$func_stripname_result
5 kx if test yes = "$allow_libtool_libs_with_static_runtimes"; then
5 kx case " $predeps $postdeps " in
5 kx *" $a_deplib "*)
5 kx func_append newdeplibs " $a_deplib"
5 kx a_deplib=
5 kx ;;
5 kx esac
5 kx fi
5 kx if test -n "$a_deplib"; then
5 kx libname=`eval "\\$ECHO \"$libname_spec\""`
5 kx for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5 kx potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5 kx for potent_lib in $potential_libs; do
5 kx potlib=$potent_lib # see symlink-check above in file_magic test
5 kx if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
5 kx $EGREP "$match_pattern_regex" > /dev/null; then
5 kx func_append newdeplibs " $a_deplib"
5 kx a_deplib=
5 kx break 2
5 kx fi
5 kx done
5 kx done
5 kx fi
5 kx if test -n "$a_deplib"; then
5 kx droppeddeps=yes
5 kx echo
5 kx $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5 kx echo "*** I have the capability to make that library automatically link in when"
5 kx echo "*** you link to this library. But I can only do this if you have a"
5 kx echo "*** shared version of the library, which you do not appear to have"
5 kx echo "*** because I did check the linker path looking for a file starting"
5 kx if test -z "$potlib"; then
5 kx $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
5 kx else
5 kx $ECHO "*** with $libname and none of the candidates passed a file format test"
5 kx $ECHO "*** using a regex pattern. Last file checked: $potlib"
5 kx fi
5 kx fi
5 kx ;;
5 kx *)
5 kx # Add a -L argument.
5 kx func_append newdeplibs " $a_deplib"
5 kx ;;
5 kx esac
5 kx done # Gone through all deplibs.
5 kx ;;
5 kx none | unknown | *)
5 kx newdeplibs=
5 kx tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
5 kx if test yes = "$allow_libtool_libs_with_static_runtimes"; then
5 kx for i in $predeps $postdeps; do
5 kx # can't use Xsed below, because $i might contain '/'
5 kx tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
5 kx done
5 kx fi
5 kx case $tmp_deplibs in
5 kx *[!\ \ ]*)
5 kx echo
5 kx if test none = "$deplibs_check_method"; then
5 kx echo "*** Warning: inter-library dependencies are not supported in this platform."
5 kx else
5 kx echo "*** Warning: inter-library dependencies are not known to be supported."
5 kx fi
5 kx echo "*** All declared inter-library dependencies are being dropped."
5 kx droppeddeps=yes
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx versuffix=$versuffix_save
5 kx major=$major_save
5 kx release=$release_save
5 kx libname=$libname_save
5 kx name=$name_save
5 kx
5 kx case $host in
5 kx *-*-rhapsody* | *-*-darwin1.[012])
5 kx # On Rhapsody replace the C library with the System framework
5 kx newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
5 kx ;;
5 kx esac
5 kx
5 kx if test yes = "$droppeddeps"; then
5 kx if test yes = "$module"; then
5 kx echo
5 kx echo "*** Warning: libtool could not satisfy all declared inter-library"
5 kx $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
5 kx echo "*** a static module, that should work as long as the dlopening"
5 kx echo "*** application is linked with the -dlopen flag."
5 kx if test -z "$global_symbol_pipe"; then
5 kx echo
5 kx echo "*** However, this would only work if libtool was able to extract symbol"
5 kx echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
5 kx echo "*** not find such a program. So, this module is probably useless."
5 kx echo "*** 'nm' from GNU binutils and a full rebuild may help."
5 kx fi
5 kx if test no = "$build_old_libs"; then
5 kx oldlibs=$output_objdir/$libname.$libext
5 kx build_libtool_libs=module
5 kx build_old_libs=yes
5 kx else
5 kx build_libtool_libs=no
5 kx fi
5 kx else
5 kx echo "*** The inter-library dependencies that have been dropped here will be"
5 kx echo "*** automatically added whenever a program is linked with this library"
5 kx echo "*** or is declared to -dlopen it."
5 kx
5 kx if test no = "$allow_undefined"; then
5 kx echo
5 kx echo "*** Since this library must not contain undefined symbols,"
5 kx echo "*** because either the platform does not support them or"
5 kx echo "*** it was explicitly requested with -no-undefined,"
5 kx echo "*** libtool will only create a static version of it."
5 kx if test no = "$build_old_libs"; then
5 kx oldlibs=$output_objdir/$libname.$libext
5 kx build_libtool_libs=module
5 kx build_old_libs=yes
5 kx else
5 kx build_libtool_libs=no
5 kx fi
5 kx fi
5 kx fi
5 kx fi
5 kx # Done checking deplibs!
5 kx deplibs=$newdeplibs
5 kx fi
5 kx # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5 kx case $host in
5 kx *-*-darwin*)
5 kx newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5 kx new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5 kx deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5 kx ;;
5 kx esac
5 kx
5 kx # move library search paths that coincide with paths to not yet
5 kx # installed libraries to the beginning of the library search list
5 kx new_libs=
5 kx for path in $notinst_path; do
5 kx case " $new_libs " in
5 kx *" -L$path/$objdir "*) ;;
5 kx *)
5 kx case " $deplibs " in
5 kx *" -L$path/$objdir "*)
5 kx func_append new_libs " -L$path/$objdir" ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx done
5 kx for deplib in $deplibs; do
5 kx case $deplib in
5 kx -L*)
5 kx case " $new_libs " in
5 kx *" $deplib "*) ;;
5 kx *) func_append new_libs " $deplib" ;;
5 kx esac
5 kx ;;
5 kx *) func_append new_libs " $deplib" ;;
5 kx esac
5 kx done
5 kx deplibs=$new_libs
5 kx
5 kx # All the library-specific variables (install_libdir is set above).
5 kx library_names=
5 kx old_library=
5 kx dlname=
5 kx
5 kx # Test again, we may have decided not to build it any more
5 kx if test yes = "$build_libtool_libs"; then
5 kx # Remove $wl instances when linking with ld.
5 kx # FIXME: should test the right _cmds variable.
5 kx case $archive_cmds in
5 kx *\$LD\ *) wl= ;;
5 kx esac
5 kx if test yes = "$hardcode_into_libs"; then
5 kx # Hardcode the library paths
5 kx hardcode_libdirs=
5 kx dep_rpath=
5 kx rpath=$finalize_rpath
5 kx test relink = "$opt_mode" || rpath=$compile_rpath$rpath
5 kx for libdir in $rpath; do
5 kx if test -n "$hardcode_libdir_flag_spec"; then
5 kx if test -n "$hardcode_libdir_separator"; then
5 kx func_replace_sysroot "$libdir"
5 kx libdir=$func_replace_sysroot_result
5 kx if test -z "$hardcode_libdirs"; then
5 kx hardcode_libdirs=$libdir
5 kx else
5 kx # Just accumulate the unique libdirs.
5 kx case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5 kx *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5 kx ;;
5 kx *)
5 kx func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
5 kx ;;
5 kx esac
5 kx fi
5 kx else
5 kx eval flag=\"$hardcode_libdir_flag_spec\"
5 kx func_append dep_rpath " $flag"
5 kx fi
5 kx elif test -n "$runpath_var"; then
5 kx case "$perm_rpath " in
5 kx *" $libdir "*) ;;
5 kx *) func_append perm_rpath " $libdir" ;;
5 kx esac
5 kx fi
5 kx done
5 kx # Substitute the hardcoded libdirs into the rpath.
5 kx if test -n "$hardcode_libdir_separator" &&
5 kx test -n "$hardcode_libdirs"; then
5 kx libdir=$hardcode_libdirs
5 kx eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
5 kx fi
5 kx if test -n "$runpath_var" && test -n "$perm_rpath"; then
5 kx # We should set the runpath_var.
5 kx rpath=
5 kx for dir in $perm_rpath; do
5 kx func_append rpath "$dir:"
5 kx done
5 kx eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
5 kx fi
5 kx test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
5 kx fi
5 kx
5 kx shlibpath=$finalize_shlibpath
5 kx test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
5 kx if test -n "$shlibpath"; then
5 kx eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
5 kx fi
5 kx
5 kx # Get the real and link names of the library.
5 kx eval shared_ext=\"$shrext_cmds\"
5 kx eval library_names=\"$library_names_spec\"
5 kx set dummy $library_names
5 kx shift
5 kx realname=$1
5 kx shift
5 kx
5 kx if test -n "$soname_spec"; then
5 kx eval soname=\"$soname_spec\"
5 kx else
5 kx soname=$realname
5 kx fi
5 kx if test -z "$dlname"; then
5 kx dlname=$soname
5 kx fi
5 kx
5 kx lib=$output_objdir/$realname
5 kx linknames=
5 kx for link
5 kx do
5 kx func_append linknames " $link"
5 kx done
5 kx
5 kx # Use standard objects if they are pic
5 kx test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5 kx test "X$libobjs" = "X " && libobjs=
5 kx
5 kx delfiles=
5 kx if test -n "$export_symbols" && test -n "$include_expsyms"; then
5 kx $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
5 kx export_symbols=$output_objdir/$libname.uexp
5 kx func_append delfiles " $export_symbols"
5 kx fi
5 kx
5 kx orig_export_symbols=
5 kx case $host_os in
5 kx cygwin* | mingw* | cegcc*)
5 kx if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
5 kx # exporting using user supplied symfile
5 kx func_dll_def_p "$export_symbols" || {
5 kx # and it's NOT already a .def file. Must figure out
5 kx # which of the given symbols are data symbols and tag
5 kx # them as such. So, trigger use of export_symbols_cmds.
5 kx # export_symbols gets reassigned inside the "prepare
5 kx # the list of exported symbols" if statement, so the
5 kx # include_expsyms logic still works.
5 kx orig_export_symbols=$export_symbols
5 kx export_symbols=
5 kx always_export_symbols=yes
5 kx }
5 kx fi
5 kx ;;
5 kx esac
5 kx
5 kx # Prepare the list of exported symbols
5 kx if test -z "$export_symbols"; then
5 kx if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
5 kx func_verbose "generating symbol list for '$libname.la'"
5 kx export_symbols=$output_objdir/$libname.exp
5 kx $opt_dry_run || $RM $export_symbols
5 kx cmds=$export_symbols_cmds
5 kx save_ifs=$IFS; IFS='~'
5 kx for cmd1 in $cmds; do
5 kx IFS=$save_ifs
5 kx # Take the normal branch if the nm_file_list_spec branch
5 kx # doesn't work or if tool conversion is not needed.
5 kx case $nm_file_list_spec~$to_tool_file_cmd in
5 kx *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
5 kx try_normal_branch=yes
5 kx eval cmd=\"$cmd1\"
5 kx func_len " $cmd"
5 kx len=$func_len_result
5 kx ;;
5 kx *)
5 kx try_normal_branch=no
5 kx ;;
5 kx esac
5 kx if test yes = "$try_normal_branch" \
5 kx && { test "$len" -lt "$max_cmd_len" \
5 kx || test "$max_cmd_len" -le -1; }
5 kx then
5 kx func_show_eval "$cmd" 'exit $?'
5 kx skipped_export=false
5 kx elif test -n "$nm_file_list_spec"; then
5 kx func_basename "$output"
5 kx output_la=$func_basename_result
5 kx save_libobjs=$libobjs
5 kx save_output=$output
5 kx output=$output_objdir/$output_la.nm
5 kx func_to_tool_file "$output"
5 kx libobjs=$nm_file_list_spec$func_to_tool_file_result
5 kx func_append delfiles " $output"
5 kx func_verbose "creating $NM input file list: $output"
5 kx for obj in $save_libobjs; do
5 kx func_to_tool_file "$obj"
5 kx $ECHO "$func_to_tool_file_result"
5 kx done > "$output"
5 kx eval cmd=\"$cmd1\"
5 kx func_show_eval "$cmd" 'exit $?'
5 kx output=$save_output
5 kx libobjs=$save_libobjs
5 kx skipped_export=false
5 kx else
5 kx # The command line is too long to execute in one step.
5 kx func_verbose "using reloadable object file for export list..."
5 kx skipped_export=:
5 kx # Break out early, otherwise skipped_export may be
5 kx # set to false by a later but shorter cmd.
5 kx break
5 kx fi
5 kx done
5 kx IFS=$save_ifs
5 kx if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
5 kx func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5 kx func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5 kx fi
5 kx fi
5 kx fi
5 kx
5 kx if test -n "$export_symbols" && test -n "$include_expsyms"; then
5 kx tmp_export_symbols=$export_symbols
5 kx test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
5 kx $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
5 kx fi
5 kx
5 kx if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
5 kx # The given exports_symbols file has to be filtered, so filter it.
5 kx func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
5 kx # FIXME: $output_objdir/$libname.filter potentially contains lots of
5 kx # 's' commands, which not all seds can handle. GNU sed should be fine
5 kx # though. Also, the filter scales superlinearly with the number of
5 kx # global variables. join(1) would be nice here, but unfortunately
5 kx # isn't a blessed tool.
5 kx $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5 kx func_append delfiles " $export_symbols $output_objdir/$libname.filter"
5 kx export_symbols=$output_objdir/$libname.def
5 kx $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5 kx fi
5 kx
5 kx tmp_deplibs=
5 kx for test_deplib in $deplibs; do
5 kx case " $convenience " in
5 kx *" $test_deplib "*) ;;
5 kx *)
5 kx func_append tmp_deplibs " $test_deplib"
5 kx ;;
5 kx esac
5 kx done
5 kx deplibs=$tmp_deplibs
5 kx
5 kx if test -n "$convenience"; then
5 kx if test -n "$whole_archive_flag_spec" &&
5 kx test yes = "$compiler_needs_object" &&
5 kx test -z "$libobjs"; then
5 kx # extract the archives, so we have objects to list.
5 kx # TODO: could optimize this to just extract one archive.
5 kx whole_archive_flag_spec=
5 kx fi
5 kx if test -n "$whole_archive_flag_spec"; then
5 kx save_libobjs=$libobjs
5 kx eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5 kx test "X$libobjs" = "X " && libobjs=
5 kx else
5 kx gentop=$output_objdir/${outputname}x
5 kx func_append generated " $gentop"
5 kx
5 kx func_extract_archives $gentop $convenience
5 kx func_append libobjs " $func_extract_archives_result"
5 kx test "X$libobjs" = "X " && libobjs=
5 kx fi
5 kx fi
5 kx
5 kx if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
5 kx eval flag=\"$thread_safe_flag_spec\"
5 kx func_append linker_flags " $flag"
5 kx fi
5 kx
5 kx # Make a backup of the uninstalled library when relinking
5 kx if test relink = "$opt_mode"; then
5 kx $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
5 kx fi
5 kx
5 kx # Do each of the archive commands.
5 kx if test yes = "$module" && test -n "$module_cmds"; then
5 kx if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5 kx eval test_cmds=\"$module_expsym_cmds\"
5 kx cmds=$module_expsym_cmds
5 kx else
5 kx eval test_cmds=\"$module_cmds\"
5 kx cmds=$module_cmds
5 kx fi
5 kx else
5 kx if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5 kx eval test_cmds=\"$archive_expsym_cmds\"
5 kx cmds=$archive_expsym_cmds
5 kx else
5 kx eval test_cmds=\"$archive_cmds\"
5 kx cmds=$archive_cmds
5 kx fi
5 kx fi
5 kx
5 kx if test : != "$skipped_export" &&
5 kx func_len " $test_cmds" &&
5 kx len=$func_len_result &&
5 kx test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5 kx :
5 kx else
5 kx # The command line is too long to link in one step, link piecewise
5 kx # or, if using GNU ld and skipped_export is not :, use a linker
5 kx # script.
5 kx
5 kx # Save the value of $output and $libobjs because we want to
5 kx # use them later. If we have whole_archive_flag_spec, we
5 kx # want to use save_libobjs as it was before
5 kx # whole_archive_flag_spec was expanded, because we can't
5 kx # assume the linker understands whole_archive_flag_spec.
5 kx # This may have to be revisited, in case too many
5 kx # convenience libraries get linked in and end up exceeding
5 kx # the spec.
5 kx if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
5 kx save_libobjs=$libobjs
5 kx fi
5 kx save_output=$output
5 kx func_basename "$output"
5 kx output_la=$func_basename_result
5 kx
5 kx # Clear the reloadable object creation command queue and
5 kx # initialize k to one.
5 kx test_cmds=
5 kx concat_cmds=
5 kx objlist=
5 kx last_robj=
5 kx k=1
5 kx
5 kx if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
5 kx output=$output_objdir/$output_la.lnkscript
5 kx func_verbose "creating GNU ld script: $output"
5 kx echo 'INPUT (' > $output
5 kx for obj in $save_libobjs
5 kx do
5 kx func_to_tool_file "$obj"
5 kx $ECHO "$func_to_tool_file_result" >> $output
5 kx done
5 kx echo ')' >> $output
5 kx func_append delfiles " $output"
5 kx func_to_tool_file "$output"
5 kx output=$func_to_tool_file_result
5 kx elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
5 kx output=$output_objdir/$output_la.lnk
5 kx func_verbose "creating linker input file list: $output"
5 kx : > $output
5 kx set x $save_libobjs
5 kx shift
5 kx firstobj=
5 kx if test yes = "$compiler_needs_object"; then
5 kx firstobj="$1 "
5 kx shift
5 kx fi
5 kx for obj
5 kx do
5 kx func_to_tool_file "$obj"
5 kx $ECHO "$func_to_tool_file_result" >> $output
5 kx done
5 kx func_append delfiles " $output"
5 kx func_to_tool_file "$output"
5 kx output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
5 kx else
5 kx if test -n "$save_libobjs"; then
5 kx func_verbose "creating reloadable object files..."
5 kx output=$output_objdir/$output_la-$k.$objext
5 kx eval test_cmds=\"$reload_cmds\"
5 kx func_len " $test_cmds"
5 kx len0=$func_len_result
5 kx len=$len0
5 kx
5 kx # Loop over the list of objects to be linked.
5 kx for obj in $save_libobjs
5 kx do
5 kx func_len " $obj"
5 kx func_arith $len + $func_len_result
5 kx len=$func_arith_result
5 kx if test -z "$objlist" ||
5 kx test "$len" -lt "$max_cmd_len"; then
5 kx func_append objlist " $obj"
5 kx else
5 kx # The command $test_cmds is almost too long, add a
5 kx # command to the queue.
5 kx if test 1 -eq "$k"; then
5 kx # The first file doesn't have a previous command to add.
5 kx reload_objs=$objlist
5 kx eval concat_cmds=\"$reload_cmds\"
5 kx else
5 kx # All subsequent reloadable object files will link in
5 kx # the last one created.
5 kx reload_objs="$objlist $last_robj"
5 kx eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
5 kx fi
5 kx last_robj=$output_objdir/$output_la-$k.$objext
5 kx func_arith $k + 1
5 kx k=$func_arith_result
5 kx output=$output_objdir/$output_la-$k.$objext
5 kx objlist=" $obj"
5 kx func_len " $last_robj"
5 kx func_arith $len0 + $func_len_result
5 kx len=$func_arith_result
5 kx fi
5 kx done
5 kx # Handle the remaining objects by creating one last
5 kx # reloadable object file. All subsequent reloadable object
5 kx # files will link in the last one created.
5 kx test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5 kx reload_objs="$objlist $last_robj"
5 kx eval concat_cmds=\"\$concat_cmds$reload_cmds\"
5 kx if test -n "$last_robj"; then
5 kx eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
5 kx fi
5 kx func_append delfiles " $output"
5 kx
5 kx else
5 kx output=
5 kx fi
5 kx
5 kx ${skipped_export-false} && {
5 kx func_verbose "generating symbol list for '$libname.la'"
5 kx export_symbols=$output_objdir/$libname.exp
5 kx $opt_dry_run || $RM $export_symbols
5 kx libobjs=$output
5 kx # Append the command to create the export file.
5 kx test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5 kx eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
5 kx if test -n "$last_robj"; then
5 kx eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
5 kx fi
5 kx }
5 kx
5 kx test -n "$save_libobjs" &&
5 kx func_verbose "creating a temporary reloadable object file: $output"
5 kx
5 kx # Loop through the commands generated above and execute them.
5 kx save_ifs=$IFS; IFS='~'
5 kx for cmd in $concat_cmds; do
5 kx IFS=$save_ifs
5 kx $opt_quiet || {
5 kx func_quote_for_expand "$cmd"
5 kx eval "func_echo $func_quote_for_expand_result"
5 kx }
5 kx $opt_dry_run || eval "$cmd" || {
5 kx lt_exit=$?
5 kx
5 kx # Restore the uninstalled library and exit
5 kx if test relink = "$opt_mode"; then
5 kx ( cd "$output_objdir" && \
5 kx $RM "${realname}T" && \
5 kx $MV "${realname}U" "$realname" )
5 kx fi
5 kx
5 kx exit $lt_exit
5 kx }
5 kx done
5 kx IFS=$save_ifs
5 kx
5 kx if test -n "$export_symbols_regex" && ${skipped_export-false}; then
5 kx func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5 kx func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5 kx fi
5 kx fi
5 kx
5 kx ${skipped_export-false} && {
5 kx if test -n "$export_symbols" && test -n "$include_expsyms"; then
5 kx tmp_export_symbols=$export_symbols
5 kx test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
5 kx $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
5 kx fi
5 kx
5 kx if test -n "$orig_export_symbols"; then
5 kx # The given exports_symbols file has to be filtered, so filter it.
5 kx func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
5 kx # FIXME: $output_objdir/$libname.filter potentially contains lots of
5 kx # 's' commands, which not all seds can handle. GNU sed should be fine
5 kx # though. Also, the filter scales superlinearly with the number of
5 kx # global variables. join(1) would be nice here, but unfortunately
5 kx # isn't a blessed tool.
5 kx $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5 kx func_append delfiles " $export_symbols $output_objdir/$libname.filter"
5 kx export_symbols=$output_objdir/$libname.def
5 kx $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5 kx fi
5 kx }
5 kx
5 kx libobjs=$output
5 kx # Restore the value of output.
5 kx output=$save_output
5 kx
5 kx if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
5 kx eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5 kx test "X$libobjs" = "X " && libobjs=
5 kx fi
5 kx # Expand the library linking commands again to reset the
5 kx # value of $libobjs for piecewise linking.
5 kx
5 kx # Do each of the archive commands.
5 kx if test yes = "$module" && test -n "$module_cmds"; then
5 kx if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5 kx cmds=$module_expsym_cmds
5 kx else
5 kx cmds=$module_cmds
5 kx fi
5 kx else
5 kx if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5 kx cmds=$archive_expsym_cmds
5 kx else
5 kx cmds=$archive_cmds
5 kx fi
5 kx fi
5 kx fi
5 kx
5 kx if test -n "$delfiles"; then
5 kx # Append the command to remove temporary files to $cmds.
5 kx eval cmds=\"\$cmds~\$RM $delfiles\"
5 kx fi
5 kx
5 kx # Add any objects from preloaded convenience libraries
5 kx if test -n "$dlprefiles"; then
5 kx gentop=$output_objdir/${outputname}x
5 kx func_append generated " $gentop"
5 kx
5 kx func_extract_archives $gentop $dlprefiles
5 kx func_append libobjs " $func_extract_archives_result"
5 kx test "X$libobjs" = "X " && libobjs=
5 kx fi
5 kx
5 kx save_ifs=$IFS; IFS='~'
5 kx for cmd in $cmds; do
5 kx IFS=$sp$nl
5 kx eval cmd=\"$cmd\"
5 kx IFS=$save_ifs
5 kx $opt_quiet || {
5 kx func_quote_for_expand "$cmd"
5 kx eval "func_echo $func_quote_for_expand_result"
5 kx }
5 kx $opt_dry_run || eval "$cmd" || {
5 kx lt_exit=$?
5 kx
5 kx # Restore the uninstalled library and exit
5 kx if test relink = "$opt_mode"; then
5 kx ( cd "$output_objdir" && \
5 kx $RM "${realname}T" && \
5 kx $MV "${realname}U" "$realname" )
5 kx fi
5 kx
5 kx exit $lt_exit
5 kx }
5 kx done
5 kx IFS=$save_ifs
5 kx
5 kx # Restore the uninstalled library and exit
5 kx if test relink = "$opt_mode"; then
5 kx $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
5 kx
5 kx if test -n "$convenience"; then
5 kx if test -z "$whole_archive_flag_spec"; then
5 kx func_show_eval '${RM}r "$gentop"'
5 kx fi
5 kx fi
5 kx
5 kx exit $EXIT_SUCCESS
5 kx fi
5 kx
5 kx # Create links to the real library.
5 kx for linkname in $linknames; do
5 kx if test "$realname" != "$linkname"; then
5 kx func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
5 kx fi
5 kx done
5 kx
5 kx # If -module or -export-dynamic was specified, set the dlname.
5 kx if test yes = "$module" || test yes = "$export_dynamic"; then
5 kx # On all known operating systems, these are identical.
5 kx dlname=$soname
5 kx fi
5 kx fi
5 kx ;;
5 kx
5 kx obj)
5 kx if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
5 kx func_warning "'-dlopen' is ignored for objects"
5 kx fi
5 kx
5 kx case " $deplibs" in
5 kx *\ -l* | *\ -L*)
5 kx func_warning "'-l' and '-L' are ignored for objects" ;;
5 kx esac
5 kx
5 kx test -n "$rpath" && \
5 kx func_warning "'-rpath' is ignored for objects"
5 kx
5 kx test -n "$xrpath" && \
5 kx func_warning "'-R' is ignored for objects"
5 kx
5 kx test -n "$vinfo" && \
5 kx func_warning "'-version-info' is ignored for objects"
5 kx
5 kx test -n "$release" && \
5 kx func_warning "'-release' is ignored for objects"
5 kx
5 kx case $output in
5 kx *.lo)
5 kx test -n "$objs$old_deplibs" && \
5 kx func_fatal_error "cannot build library object '$output' from non-libtool objects"
5 kx
5 kx libobj=$output
5 kx func_lo2o "$libobj"
5 kx obj=$func_lo2o_result
5 kx ;;
5 kx *)
5 kx libobj=
5 kx obj=$output
5 kx ;;
5 kx esac
5 kx
5 kx # Delete the old objects.
5 kx $opt_dry_run || $RM $obj $libobj
5 kx
5 kx # Objects from convenience libraries. This assumes
5 kx # single-version convenience libraries. Whenever we create
5 kx # different ones for PIC/non-PIC, this we'll have to duplicate
5 kx # the extraction.
5 kx reload_conv_objs=
5 kx gentop=
5 kx # if reload_cmds runs $LD directly, get rid of -Wl from
5 kx # whole_archive_flag_spec and hope we can get by with turning comma
5 kx # into space.
5 kx case $reload_cmds in
5 kx *\$LD[\ \$]*) wl= ;;
5 kx esac
5 kx if test -n "$convenience"; then
5 kx if test -n "$whole_archive_flag_spec"; then
5 kx eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
5 kx test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
5 kx reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
5 kx else
5 kx gentop=$output_objdir/${obj}x
5 kx func_append generated " $gentop"
5 kx
5 kx func_extract_archives $gentop $convenience
5 kx reload_conv_objs="$reload_objs $func_extract_archives_result"
5 kx fi
5 kx fi
5 kx
5 kx # If we're not building shared, we need to use non_pic_objs
5 kx test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
5 kx
5 kx # Create the old-style object.
5 kx reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
5 kx
5 kx output=$obj
5 kx func_execute_cmds "$reload_cmds" 'exit $?'
5 kx
5 kx # Exit if we aren't doing a library object file.
5 kx if test -z "$libobj"; then
5 kx if test -n "$gentop"; then
5 kx func_show_eval '${RM}r "$gentop"'
5 kx fi
5 kx
5 kx exit $EXIT_SUCCESS
5 kx fi
5 kx
5 kx test yes = "$build_libtool_libs" || {
5 kx if test -n "$gentop"; then
5 kx func_show_eval '${RM}r "$gentop"'
5 kx fi
5 kx
5 kx # Create an invalid libtool object if no PIC, so that we don't
5 kx # accidentally link it into a program.
5 kx # $show "echo timestamp > $libobj"
5 kx # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
5 kx exit $EXIT_SUCCESS
5 kx }
5 kx
5 kx if test -n "$pic_flag" || test default != "$pic_mode"; then
5 kx # Only do commands if we really have different PIC objects.
5 kx reload_objs="$libobjs $reload_conv_objs"
5 kx output=$libobj
5 kx func_execute_cmds "$reload_cmds" 'exit $?'
5 kx fi
5 kx
5 kx if test -n "$gentop"; then
5 kx func_show_eval '${RM}r "$gentop"'
5 kx fi
5 kx
5 kx exit $EXIT_SUCCESS
5 kx ;;
5 kx
5 kx prog)
5 kx case $host in
5 kx *cygwin*) func_stripname '' '.exe' "$output"
5 kx output=$func_stripname_result.exe;;
5 kx esac
5 kx test -n "$vinfo" && \
5 kx func_warning "'-version-info' is ignored for programs"
5 kx
5 kx test -n "$release" && \
5 kx func_warning "'-release' is ignored for programs"
5 kx
5 kx $preload \
5 kx && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
5 kx && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
5 kx
5 kx case $host in
5 kx *-*-rhapsody* | *-*-darwin1.[012])
5 kx # On Rhapsody replace the C library is the System framework
5 kx compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
5 kx finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
5 kx ;;
5 kx esac
5 kx
5 kx case $host in
5 kx *-*-darwin*)
5 kx # Don't allow lazy linking, it breaks C++ global constructors
5 kx # But is supposedly fixed on 10.4 or later (yay!).
5 kx if test CXX = "$tagname"; then
5 kx case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
5 kx 10.[0123])
5 kx func_append compile_command " $wl-bind_at_load"
5 kx func_append finalize_command " $wl-bind_at_load"
5 kx ;;
5 kx esac
5 kx fi
5 kx # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5 kx compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5 kx finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5 kx ;;
5 kx esac
5 kx
5 kx
5 kx # move library search paths that coincide with paths to not yet
5 kx # installed libraries to the beginning of the library search list
5 kx new_libs=
5 kx for path in $notinst_path; do
5 kx case " $new_libs " in
5 kx *" -L$path/$objdir "*) ;;
5 kx *)
5 kx case " $compile_deplibs " in
5 kx *" -L$path/$objdir "*)
5 kx func_append new_libs " -L$path/$objdir" ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx done
5 kx for deplib in $compile_deplibs; do
5 kx case $deplib in
5 kx -L*)
5 kx case " $new_libs " in
5 kx *" $deplib "*) ;;
5 kx *) func_append new_libs " $deplib" ;;
5 kx esac
5 kx ;;
5 kx *) func_append new_libs " $deplib" ;;
5 kx esac
5 kx done
5 kx compile_deplibs=$new_libs
5 kx
5 kx
5 kx func_append compile_command " $compile_deplibs"
5 kx func_append finalize_command " $finalize_deplibs"
5 kx
5 kx if test -n "$rpath$xrpath"; then
5 kx # If the user specified any rpath flags, then add them.
5 kx for libdir in $rpath $xrpath; do
5 kx # This is the magic to use -rpath.
5 kx case "$finalize_rpath " in
5 kx *" $libdir "*) ;;
5 kx *) func_append finalize_rpath " $libdir" ;;
5 kx esac
5 kx done
5 kx fi
5 kx
5 kx # Now hardcode the library paths
5 kx rpath=
5 kx hardcode_libdirs=
5 kx for libdir in $compile_rpath $finalize_rpath; do
5 kx if test -n "$hardcode_libdir_flag_spec"; then
5 kx if test -n "$hardcode_libdir_separator"; then
5 kx if test -z "$hardcode_libdirs"; then
5 kx hardcode_libdirs=$libdir
5 kx else
5 kx # Just accumulate the unique libdirs.
5 kx case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5 kx *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5 kx ;;
5 kx *)
5 kx func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
5 kx ;;
5 kx esac
5 kx fi
5 kx else
5 kx eval flag=\"$hardcode_libdir_flag_spec\"
5 kx func_append rpath " $flag"
5 kx fi
5 kx elif test -n "$runpath_var"; then
5 kx case "$perm_rpath " in
5 kx *" $libdir "*) ;;
5 kx *) func_append perm_rpath " $libdir" ;;
5 kx esac
5 kx fi
5 kx case $host in
5 kx *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5 kx testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
5 kx case :$dllsearchpath: in
5 kx *":$libdir:"*) ;;
5 kx ::) dllsearchpath=$libdir;;
5 kx *) func_append dllsearchpath ":$libdir";;
5 kx esac
5 kx case :$dllsearchpath: in
5 kx *":$testbindir:"*) ;;
5 kx ::) dllsearchpath=$testbindir;;
5 kx *) func_append dllsearchpath ":$testbindir";;
5 kx esac
5 kx ;;
5 kx esac
5 kx done
5 kx # Substitute the hardcoded libdirs into the rpath.
5 kx if test -n "$hardcode_libdir_separator" &&
5 kx test -n "$hardcode_libdirs"; then
5 kx libdir=$hardcode_libdirs
5 kx eval rpath=\" $hardcode_libdir_flag_spec\"
5 kx fi
5 kx compile_rpath=$rpath
5 kx
5 kx rpath=
5 kx hardcode_libdirs=
5 kx for libdir in $finalize_rpath; do
5 kx if test -n "$hardcode_libdir_flag_spec"; then
5 kx if test -n "$hardcode_libdir_separator"; then
5 kx if test -z "$hardcode_libdirs"; then
5 kx hardcode_libdirs=$libdir
5 kx else
5 kx # Just accumulate the unique libdirs.
5 kx case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5 kx *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5 kx ;;
5 kx *)
5 kx func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
5 kx ;;
5 kx esac
5 kx fi
5 kx else
5 kx eval flag=\"$hardcode_libdir_flag_spec\"
5 kx func_append rpath " $flag"
5 kx fi
5 kx elif test -n "$runpath_var"; then
5 kx case "$finalize_perm_rpath " in
5 kx *" $libdir "*) ;;
5 kx *) func_append finalize_perm_rpath " $libdir" ;;
5 kx esac
5 kx fi
5 kx done
5 kx # Substitute the hardcoded libdirs into the rpath.
5 kx if test -n "$hardcode_libdir_separator" &&
5 kx test -n "$hardcode_libdirs"; then
5 kx libdir=$hardcode_libdirs
5 kx eval rpath=\" $hardcode_libdir_flag_spec\"
5 kx fi
5 kx finalize_rpath=$rpath
5 kx
5 kx if test -n "$libobjs" && test yes = "$build_old_libs"; then
5 kx # Transform all the library objects into standard objects.
5 kx compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
5 kx finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
5 kx fi
5 kx
5 kx func_generate_dlsyms "$outputname" "@PROGRAM@" false
5 kx
5 kx # template prelinking step
5 kx if test -n "$prelink_cmds"; then
5 kx func_execute_cmds "$prelink_cmds" 'exit $?'
5 kx fi
5 kx
5 kx wrappers_required=:
5 kx case $host in
5 kx *cegcc* | *mingw32ce*)
5 kx # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
5 kx wrappers_required=false
5 kx ;;
5 kx *cygwin* | *mingw* )
5 kx test yes = "$build_libtool_libs" || wrappers_required=false
5 kx ;;
5 kx *)
5 kx if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
5 kx wrappers_required=false
5 kx fi
5 kx ;;
5 kx esac
5 kx $wrappers_required || {
5 kx # Replace the output file specification.
5 kx compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
5 kx link_command=$compile_command$compile_rpath
5 kx
5 kx # We have no uninstalled library dependencies, so finalize right now.
5 kx exit_status=0
5 kx func_show_eval "$link_command" 'exit_status=$?'
5 kx
5 kx if test -n "$postlink_cmds"; then
5 kx func_to_tool_file "$output"
5 kx postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
5 kx func_execute_cmds "$postlink_cmds" 'exit $?'
5 kx fi
5 kx
5 kx # Delete the generated files.
5 kx if test -f "$output_objdir/${outputname}S.$objext"; then
5 kx func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
5 kx fi
5 kx
5 kx exit $exit_status
5 kx }
5 kx
5 kx if test -n "$compile_shlibpath$finalize_shlibpath"; then
5 kx compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
5 kx fi
5 kx if test -n "$finalize_shlibpath"; then
5 kx finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
5 kx fi
5 kx
5 kx compile_var=
5 kx finalize_var=
5 kx if test -n "$runpath_var"; then
5 kx if test -n "$perm_rpath"; then
5 kx # We should set the runpath_var.
5 kx rpath=
5 kx for dir in $perm_rpath; do
5 kx func_append rpath "$dir:"
5 kx done
5 kx compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
5 kx fi
5 kx if test -n "$finalize_perm_rpath"; then
5 kx # We should set the runpath_var.
5 kx rpath=
5 kx for dir in $finalize_perm_rpath; do
5 kx func_append rpath "$dir:"
5 kx done
5 kx finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
5 kx fi
5 kx fi
5 kx
5 kx if test yes = "$no_install"; then
5 kx # We don't need to create a wrapper script.
5 kx link_command=$compile_var$compile_command$compile_rpath
5 kx # Replace the output file specification.
5 kx link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
5 kx # Delete the old output file.
5 kx $opt_dry_run || $RM $output
5 kx # Link the executable and exit
5 kx func_show_eval "$link_command" 'exit $?'
5 kx
5 kx if test -n "$postlink_cmds"; then
5 kx func_to_tool_file "$output"
5 kx postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
5 kx func_execute_cmds "$postlink_cmds" 'exit $?'
5 kx fi
5 kx
5 kx exit $EXIT_SUCCESS
5 kx fi
5 kx
5 kx case $hardcode_action,$fast_install in
5 kx relink,*)
5 kx # Fast installation is not supported
5 kx link_command=$compile_var$compile_command$compile_rpath
5 kx relink_command=$finalize_var$finalize_command$finalize_rpath
5 kx
5 kx func_warning "this platform does not like uninstalled shared libraries"
5 kx func_warning "'$output' will be relinked during installation"
5 kx ;;
5 kx *,yes)
5 kx link_command=$finalize_var$compile_command$finalize_rpath
5 kx relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
5 kx ;;
5 kx *,no)
5 kx link_command=$compile_var$compile_command$compile_rpath
5 kx relink_command=$finalize_var$finalize_command$finalize_rpath
5 kx ;;
5 kx *,needless)
5 kx link_command=$finalize_var$compile_command$finalize_rpath
5 kx relink_command=
5 kx ;;
5 kx esac
5 kx
5 kx # Replace the output file specification.
5 kx link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
5 kx
5 kx # Delete the old output files.
5 kx $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
5 kx
5 kx func_show_eval "$link_command" 'exit $?'
5 kx
5 kx if test -n "$postlink_cmds"; then
5 kx func_to_tool_file "$output_objdir/$outputname"
5 kx postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
5 kx func_execute_cmds "$postlink_cmds" 'exit $?'
5 kx fi
5 kx
5 kx # Now create the wrapper script.
5 kx func_verbose "creating $output"
5 kx
5 kx # Quote the relink command for shipping.
5 kx if test -n "$relink_command"; then
5 kx # Preserve any variables that may affect compiler behavior
5 kx for var in $variables_saved_for_relink; do
5 kx if eval test -z \"\${$var+set}\"; then
5 kx relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
5 kx elif eval var_value=\$$var; test -z "$var_value"; then
5 kx relink_command="$var=; export $var; $relink_command"
5 kx else
5 kx func_quote_for_eval "$var_value"
5 kx relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
5 kx fi
5 kx done
5 kx relink_command="(cd `pwd`; $relink_command)"
5 kx relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
5 kx fi
5 kx
5 kx # Only actually do things if not in dry run mode.
5 kx $opt_dry_run || {
5 kx # win32 will think the script is a binary if it has
5 kx # a .exe suffix, so we strip it off here.
5 kx case $output in
5 kx *.exe) func_stripname '' '.exe' "$output"
5 kx output=$func_stripname_result ;;
5 kx esac
5 kx # test for cygwin because mv fails w/o .exe extensions
5 kx case $host in
5 kx *cygwin*)
5 kx exeext=.exe
5 kx func_stripname '' '.exe' "$outputname"
5 kx outputname=$func_stripname_result ;;
5 kx *) exeext= ;;
5 kx esac
5 kx case $host in
5 kx *cygwin* | *mingw* )
5 kx func_dirname_and_basename "$output" "" "."
5 kx output_name=$func_basename_result
5 kx output_path=$func_dirname_result
5 kx cwrappersource=$output_path/$objdir/lt-$output_name.c
5 kx cwrapper=$output_path/$output_name.exe
5 kx $RM $cwrappersource $cwrapper
5 kx trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
5 kx
5 kx func_emit_cwrapperexe_src > $cwrappersource
5 kx
5 kx # The wrapper executable is built using the $host compiler,
5 kx # because it contains $host paths and files. If cross-
5 kx # compiling, it, like the target executable, must be
5 kx # executed on the $host or under an emulation environment.
5 kx $opt_dry_run || {
5 kx $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
5 kx $STRIP $cwrapper
5 kx }
5 kx
5 kx # Now, create the wrapper script for func_source use:
5 kx func_ltwrapper_scriptname $cwrapper
5 kx $RM $func_ltwrapper_scriptname_result
5 kx trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
5 kx $opt_dry_run || {
5 kx # note: this script will not be executed, so do not chmod.
5 kx if test "x$build" = "x$host"; then
5 kx $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
5 kx else
5 kx func_emit_wrapper no > $func_ltwrapper_scriptname_result
5 kx fi
5 kx }
5 kx ;;
5 kx * )
5 kx $RM $output
5 kx trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
5 kx
5 kx func_emit_wrapper no > $output
5 kx chmod +x $output
5 kx ;;
5 kx esac
5 kx }
5 kx exit $EXIT_SUCCESS
5 kx ;;
5 kx esac
5 kx
5 kx # See if we need to build an old-fashioned archive.
5 kx for oldlib in $oldlibs; do
5 kx
5 kx case $build_libtool_libs in
5 kx convenience)
5 kx oldobjs="$libobjs_save $symfileobj"
5 kx addlibs=$convenience
5 kx build_libtool_libs=no
5 kx ;;
5 kx module)
5 kx oldobjs=$libobjs_save
5 kx addlibs=$old_convenience
5 kx build_libtool_libs=no
5 kx ;;
5 kx *)
5 kx oldobjs="$old_deplibs $non_pic_objects"
5 kx $preload && test -f "$symfileobj" \
5 kx && func_append oldobjs " $symfileobj"
5 kx addlibs=$old_convenience
5 kx ;;
5 kx esac
5 kx
5 kx if test -n "$addlibs"; then
5 kx gentop=$output_objdir/${outputname}x
5 kx func_append generated " $gentop"
5 kx
5 kx func_extract_archives $gentop $addlibs
5 kx func_append oldobjs " $func_extract_archives_result"
5 kx fi
5 kx
5 kx # Do each command in the archive commands.
5 kx if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
5 kx cmds=$old_archive_from_new_cmds
5 kx else
5 kx
5 kx # Add any objects from preloaded convenience libraries
5 kx if test -n "$dlprefiles"; then
5 kx gentop=$output_objdir/${outputname}x
5 kx func_append generated " $gentop"
5 kx
5 kx func_extract_archives $gentop $dlprefiles
5 kx func_append oldobjs " $func_extract_archives_result"
5 kx fi
5 kx
5 kx # POSIX demands no paths to be encoded in archives. We have
5 kx # to avoid creating archives with duplicate basenames if we
5 kx # might have to extract them afterwards, e.g., when creating a
5 kx # static archive out of a convenience library, or when linking
5 kx # the entirety of a libtool archive into another (currently
5 kx # not supported by libtool).
5 kx if (for obj in $oldobjs
5 kx do
5 kx func_basename "$obj"
5 kx $ECHO "$func_basename_result"
5 kx done | sort | sort -uc >/dev/null 2>&1); then
5 kx :
5 kx else
5 kx echo "copying selected object files to avoid basename conflicts..."
5 kx gentop=$output_objdir/${outputname}x
5 kx func_append generated " $gentop"
5 kx func_mkdir_p "$gentop"
5 kx save_oldobjs=$oldobjs
5 kx oldobjs=
5 kx counter=1
5 kx for obj in $save_oldobjs
5 kx do
5 kx func_basename "$obj"
5 kx objbase=$func_basename_result
5 kx case " $oldobjs " in
5 kx " ") oldobjs=$obj ;;
5 kx *[\ /]"$objbase "*)
5 kx while :; do
5 kx # Make sure we don't pick an alternate name that also
5 kx # overlaps.
5 kx newobj=lt$counter-$objbase
5 kx func_arith $counter + 1
5 kx counter=$func_arith_result
5 kx case " $oldobjs " in
5 kx *[\ /]"$newobj "*) ;;
5 kx *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5 kx esac
5 kx done
5 kx func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5 kx func_append oldobjs " $gentop/$newobj"
5 kx ;;
5 kx *) func_append oldobjs " $obj" ;;
5 kx esac
5 kx done
5 kx fi
5 kx func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
5 kx tool_oldlib=$func_to_tool_file_result
5 kx eval cmds=\"$old_archive_cmds\"
5 kx
5 kx func_len " $cmds"
5 kx len=$func_len_result
5 kx if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5 kx cmds=$old_archive_cmds
5 kx elif test -n "$archiver_list_spec"; then
5 kx func_verbose "using command file archive linking..."
5 kx for obj in $oldobjs
5 kx do
5 kx func_to_tool_file "$obj"
5 kx $ECHO "$func_to_tool_file_result"
5 kx done > $output_objdir/$libname.libcmd
5 kx func_to_tool_file "$output_objdir/$libname.libcmd"
5 kx oldobjs=" $archiver_list_spec$func_to_tool_file_result"
5 kx cmds=$old_archive_cmds
5 kx else
5 kx # the command line is too long to link in one step, link in parts
5 kx func_verbose "using piecewise archive linking..."
5 kx save_RANLIB=$RANLIB
5 kx RANLIB=:
5 kx objlist=
5 kx concat_cmds=
5 kx save_oldobjs=$oldobjs
5 kx oldobjs=
5 kx # Is there a better way of finding the last object in the list?
5 kx for obj in $save_oldobjs
5 kx do
5 kx last_oldobj=$obj
5 kx done
5 kx eval test_cmds=\"$old_archive_cmds\"
5 kx func_len " $test_cmds"
5 kx len0=$func_len_result
5 kx len=$len0
5 kx for obj in $save_oldobjs
5 kx do
5 kx func_len " $obj"
5 kx func_arith $len + $func_len_result
5 kx len=$func_arith_result
5 kx func_append objlist " $obj"
5 kx if test "$len" -lt "$max_cmd_len"; then
5 kx :
5 kx else
5 kx # the above command should be used before it gets too long
5 kx oldobjs=$objlist
5 kx if test "$obj" = "$last_oldobj"; then
5 kx RANLIB=$save_RANLIB
5 kx fi
5 kx test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5 kx eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
5 kx objlist=
5 kx len=$len0
5 kx fi
5 kx done
5 kx RANLIB=$save_RANLIB
5 kx oldobjs=$objlist
5 kx if test -z "$oldobjs"; then
5 kx eval cmds=\"\$concat_cmds\"
5 kx else
5 kx eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5 kx fi
5 kx fi
5 kx fi
5 kx func_execute_cmds "$cmds" 'exit $?'
5 kx done
5 kx
5 kx test -n "$generated" && \
5 kx func_show_eval "${RM}r$generated"
5 kx
5 kx # Now create the libtool archive.
5 kx case $output in
5 kx *.la)
5 kx old_library=
5 kx test yes = "$build_old_libs" && old_library=$libname.$libext
5 kx func_verbose "creating $output"
5 kx
5 kx # Preserve any variables that may affect compiler behavior
5 kx for var in $variables_saved_for_relink; do
5 kx if eval test -z \"\${$var+set}\"; then
5 kx relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
5 kx elif eval var_value=\$$var; test -z "$var_value"; then
5 kx relink_command="$var=; export $var; $relink_command"
5 kx else
5 kx func_quote_for_eval "$var_value"
5 kx relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
5 kx fi
5 kx done
5 kx # Quote the link command for shipping.
5 kx relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5 kx relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
5 kx if test yes = "$hardcode_automatic"; then
5 kx relink_command=
5 kx fi
5 kx
5 kx # Only create the output if not a dry run.
5 kx $opt_dry_run || {
5 kx for installed in no yes; do
5 kx if test yes = "$installed"; then
5 kx if test -z "$install_libdir"; then
5 kx break
5 kx fi
5 kx output=$output_objdir/${outputname}i
5 kx # Replace all uninstalled libtool libraries with the installed ones
5 kx newdependency_libs=
5 kx for deplib in $dependency_libs; do
5 kx case $deplib in
5 kx *.la)
5 kx func_basename "$deplib"
5 kx name=$func_basename_result
5 kx func_resolve_sysroot "$deplib"
5 kx eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
5 kx test -z "$libdir" && \
5 kx func_fatal_error "'$deplib' is not a valid libtool archive"
5 kx func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
5 kx ;;
5 kx -L*)
5 kx func_stripname -L '' "$deplib"
5 kx func_replace_sysroot "$func_stripname_result"
5 kx func_append newdependency_libs " -L$func_replace_sysroot_result"
5 kx ;;
5 kx -R*)
5 kx func_stripname -R '' "$deplib"
5 kx func_replace_sysroot "$func_stripname_result"
5 kx func_append newdependency_libs " -R$func_replace_sysroot_result"
5 kx ;;
5 kx *) func_append newdependency_libs " $deplib" ;;
5 kx esac
5 kx done
5 kx dependency_libs=$newdependency_libs
5 kx newdlfiles=
5 kx
5 kx for lib in $dlfiles; do
5 kx case $lib in
5 kx *.la)
5 kx func_basename "$lib"
5 kx name=$func_basename_result
5 kx eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5 kx test -z "$libdir" && \
5 kx func_fatal_error "'$lib' is not a valid libtool archive"
5 kx func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
5 kx ;;
5 kx *) func_append newdlfiles " $lib" ;;
5 kx esac
5 kx done
5 kx dlfiles=$newdlfiles
5 kx newdlprefiles=
5 kx for lib in $dlprefiles; do
5 kx case $lib in
5 kx *.la)
5 kx # Only pass preopened files to the pseudo-archive (for
5 kx # eventual linking with the app. that links it) if we
5 kx # didn't already link the preopened objects directly into
5 kx # the library:
5 kx func_basename "$lib"
5 kx name=$func_basename_result
5 kx eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5 kx test -z "$libdir" && \
5 kx func_fatal_error "'$lib' is not a valid libtool archive"
5 kx func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
5 kx ;;
5 kx esac
5 kx done
5 kx dlprefiles=$newdlprefiles
5 kx else
5 kx newdlfiles=
5 kx for lib in $dlfiles; do
5 kx case $lib in
5 kx [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
5 kx *) abs=`pwd`"/$lib" ;;
5 kx esac
5 kx func_append newdlfiles " $abs"
5 kx done
5 kx dlfiles=$newdlfiles
5 kx newdlprefiles=
5 kx for lib in $dlprefiles; do
5 kx case $lib in
5 kx [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
5 kx *) abs=`pwd`"/$lib" ;;
5 kx esac
5 kx func_append newdlprefiles " $abs"
5 kx done
5 kx dlprefiles=$newdlprefiles
5 kx fi
5 kx $RM $output
5 kx # place dlname in correct position for cygwin
5 kx # In fact, it would be nice if we could use this code for all target
5 kx # systems that can't hard-code library paths into their executables
5 kx # and that have no shared library path variable independent of PATH,
5 kx # but it turns out we can't easily determine that from inspecting
5 kx # libtool variables, so we have to hard-code the OSs to which it
5 kx # applies here; at the moment, that means platforms that use the PE
5 kx # object format with DLL files. See the long comment at the top of
5 kx # tests/bindir.at for full details.
5 kx tdlname=$dlname
5 kx case $host,$output,$installed,$module,$dlname in
5 kx *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
5 kx # If a -bindir argument was supplied, place the dll there.
5 kx if test -n "$bindir"; then
5 kx func_relative_path "$install_libdir" "$bindir"
5 kx tdlname=$func_relative_path_result/$dlname
5 kx else
5 kx # Otherwise fall back on heuristic.
5 kx tdlname=../bin/$dlname
5 kx fi
5 kx ;;
5 kx esac
5 kx $ECHO > $output "\
5 kx # $outputname - a libtool library file
5 kx # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5 kx #
5 kx # Please DO NOT delete this file!
5 kx # It is necessary for linking the library.
5 kx
5 kx # The name that we can dlopen(3).
5 kx dlname='$tdlname'
5 kx
5 kx # Names of this library.
5 kx library_names='$library_names'
5 kx
5 kx # The name of the static archive.
5 kx old_library='$old_library'
5 kx
5 kx # Linker flags that cannot go in dependency_libs.
5 kx inherited_linker_flags='$new_inherited_linker_flags'
5 kx
5 kx # Libraries that this one depends upon.
5 kx dependency_libs='$dependency_libs'
5 kx
5 kx # Names of additional weak libraries provided by this library
5 kx weak_library_names='$weak_libs'
5 kx
5 kx # Version information for $libname.
5 kx current=$current
5 kx age=$age
5 kx revision=$revision
5 kx
5 kx # Is this an already installed library?
5 kx installed=$installed
5 kx
5 kx # Should we warn about portability when linking against -modules?
5 kx shouldnotlink=$module
5 kx
5 kx # Files to dlopen/dlpreopen
5 kx dlopen='$dlfiles'
5 kx dlpreopen='$dlprefiles'
5 kx
5 kx # Directory that this library needs to be installed in:
5 kx libdir='$install_libdir'"
5 kx if test no,yes = "$installed,$need_relink"; then
5 kx $ECHO >> $output "\
5 kx relink_command=\"$relink_command\""
5 kx fi
5 kx done
5 kx }
5 kx
5 kx # Do a symbolic link so that the libtool archive can be found in
5 kx # LD_LIBRARY_PATH before the program is installed.
5 kx func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
5 kx ;;
5 kx esac
5 kx exit $EXIT_SUCCESS
5 kx }
5 kx
5 kx if test link = "$opt_mode" || test relink = "$opt_mode"; then
5 kx func_mode_link ${1+"$@"}
5 kx fi
5 kx
5 kx
5 kx # func_mode_uninstall arg...
5 kx func_mode_uninstall ()
5 kx {
5 kx $debug_cmd
5 kx
5 kx RM=$nonopt
5 kx files=
5 kx rmforce=false
5 kx exit_status=0
5 kx
5 kx # This variable tells wrapper scripts just to set variables rather
5 kx # than running their programs.
5 kx libtool_install_magic=$magic
5 kx
5 kx for arg
5 kx do
5 kx case $arg in
5 kx -f) func_append RM " $arg"; rmforce=: ;;
5 kx -*) func_append RM " $arg" ;;
5 kx *) func_append files " $arg" ;;
5 kx esac
5 kx done
5 kx
5 kx test -z "$RM" && \
5 kx func_fatal_help "you must specify an RM program"
5 kx
5 kx rmdirs=
5 kx
5 kx for file in $files; do
5 kx func_dirname "$file" "" "."
5 kx dir=$func_dirname_result
5 kx if test . = "$dir"; then
5 kx odir=$objdir
5 kx else
5 kx odir=$dir/$objdir
5 kx fi
5 kx func_basename "$file"
5 kx name=$func_basename_result
5 kx test uninstall = "$opt_mode" && odir=$dir
5 kx
5 kx # Remember odir for removal later, being careful to avoid duplicates
5 kx if test clean = "$opt_mode"; then
5 kx case " $rmdirs " in
5 kx *" $odir "*) ;;
5 kx *) func_append rmdirs " $odir" ;;
5 kx esac
5 kx fi
5 kx
5 kx # Don't error if the file doesn't exist and rm -f was used.
5 kx if { test -L "$file"; } >/dev/null 2>&1 ||
5 kx { test -h "$file"; } >/dev/null 2>&1 ||
5 kx test -f "$file"; then
5 kx :
5 kx elif test -d "$file"; then
5 kx exit_status=1
5 kx continue
5 kx elif $rmforce; then
5 kx continue
5 kx fi
5 kx
5 kx rmfiles=$file
5 kx
5 kx case $name in
5 kx *.la)
5 kx # Possibly a libtool archive, so verify it.
5 kx if func_lalib_p "$file"; then
5 kx func_source $dir/$name
5 kx
5 kx # Delete the libtool libraries and symlinks.
5 kx for n in $library_names; do
5 kx func_append rmfiles " $odir/$n"
5 kx done
5 kx test -n "$old_library" && func_append rmfiles " $odir/$old_library"
5 kx
5 kx case $opt_mode in
5 kx clean)
5 kx case " $library_names " in
5 kx *" $dlname "*) ;;
5 kx *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
5 kx esac
5 kx test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
5 kx ;;
5 kx uninstall)
5 kx if test -n "$library_names"; then
5 kx # Do each command in the postuninstall commands.
5 kx func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
5 kx fi
5 kx
5 kx if test -n "$old_library"; then
5 kx # Do each command in the old_postuninstall commands.
5 kx func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
5 kx fi
5 kx # FIXME: should reinstall the best remaining shared library.
5 kx ;;
5 kx esac
5 kx fi
5 kx ;;
5 kx
5 kx *.lo)
5 kx # Possibly a libtool object, so verify it.
5 kx if func_lalib_p "$file"; then
5 kx
5 kx # Read the .lo file
5 kx func_source $dir/$name
5 kx
5 kx # Add PIC object to the list of files to remove.
5 kx if test -n "$pic_object" && test none != "$pic_object"; then
5 kx func_append rmfiles " $dir/$pic_object"
5 kx fi
5 kx
5 kx # Add non-PIC object to the list of files to remove.
5 kx if test -n "$non_pic_object" && test none != "$non_pic_object"; then
5 kx func_append rmfiles " $dir/$non_pic_object"
5 kx fi
5 kx fi
5 kx ;;
5 kx
5 kx *)
5 kx if test clean = "$opt_mode"; then
5 kx noexename=$name
5 kx case $file in
5 kx *.exe)
5 kx func_stripname '' '.exe' "$file"
5 kx file=$func_stripname_result
5 kx func_stripname '' '.exe' "$name"
5 kx noexename=$func_stripname_result
5 kx # $file with .exe has already been added to rmfiles,
5 kx # add $file without .exe
5 kx func_append rmfiles " $file"
5 kx ;;
5 kx esac
5 kx # Do a test to see if this is a libtool program.
5 kx if func_ltwrapper_p "$file"; then
5 kx if func_ltwrapper_executable_p "$file"; then
5 kx func_ltwrapper_scriptname "$file"
5 kx relink_command=
5 kx func_source $func_ltwrapper_scriptname_result
5 kx func_append rmfiles " $func_ltwrapper_scriptname_result"
5 kx else
5 kx relink_command=
5 kx func_source $dir/$noexename
5 kx fi
5 kx
5 kx # note $name still contains .exe if it was in $file originally
5 kx # as does the version of $file that was added into $rmfiles
5 kx func_append rmfiles " $odir/$name $odir/${name}S.$objext"
5 kx if test yes = "$fast_install" && test -n "$relink_command"; then
5 kx func_append rmfiles " $odir/lt-$name"
5 kx fi
5 kx if test "X$noexename" != "X$name"; then
5 kx func_append rmfiles " $odir/lt-$noexename.c"
5 kx fi
5 kx fi
5 kx fi
5 kx ;;
5 kx esac
5 kx func_show_eval "$RM $rmfiles" 'exit_status=1'
5 kx done
5 kx
5 kx # Try to remove the $objdir's in the directories where we deleted files
5 kx for dir in $rmdirs; do
5 kx if test -d "$dir"; then
5 kx func_show_eval "rmdir $dir >/dev/null 2>&1"
5 kx fi
5 kx done
5 kx
5 kx exit $exit_status
5 kx }
5 kx
5 kx if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
5 kx func_mode_uninstall ${1+"$@"}
5 kx fi
5 kx
5 kx test -z "$opt_mode" && {
5 kx help=$generic_help
5 kx func_fatal_help "you must specify a MODE"
5 kx }
5 kx
5 kx test -z "$exec_cmd" && \
5 kx func_fatal_help "invalid operation mode '$opt_mode'"
5 kx
5 kx if test -n "$exec_cmd"; then
5 kx eval exec "$exec_cmd"
5 kx exit $EXIT_FAILURE
5 kx fi
5 kx
5 kx exit $exit_status
5 kx
5 kx
5 kx # The TAGs below are defined such that we never get into a situation
5 kx # where we disable both kinds of libraries. Given conflicting
5 kx # choices, we go for a static library, that is the most portable,
5 kx # since we can't tell whether shared libraries were disabled because
5 kx # the user asked for that or because the platform doesn't support
5 kx # them. This is particularly important on AIX, because we don't
5 kx # support having both static and shared libraries enabled at the same
5 kx # time on that platform, so we default to a shared-only configuration.
5 kx # If a disable-shared tag is given, we'll fallback to a static-only
5 kx # configuration. But we'll never go from static-only to shared-only.
5 kx
5 kx # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5 kx build_libtool_libs=no
5 kx build_old_libs=yes
5 kx # ### END LIBTOOL TAG CONFIG: disable-shared
5 kx
5 kx # ### BEGIN LIBTOOL TAG CONFIG: disable-static
5 kx build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5 kx # ### END LIBTOOL TAG CONFIG: disable-static
5 kx
5 kx # Local Variables:
5 kx # mode:shell-script
5 kx # sh-indentation:2
5 kx # End: