* ltmain.in: add support for installing into temporary

staging area (e.g. 'make install DESTDIR=...')


* libtool.m4 (AC_LIBTOOL_LANG_CXX_CONFIG): restore setting
allow_undefined_flag=unsupported for cygwin and mingw.
(AC_LIBTOOL_PROG_LD_SHLIBS): ditto, for both "normal" gcc/ld
and for the (unmaintained?) MSVC case.


* doc/libtool.texi (Install mode): document new
-inst-prefix option.
This commit is contained in:
Ossama Othman 2002-11-03 17:35:37 +00:00 committed by Bob Friesenhahn
parent 900d3d6911
commit d2c4f8f8fc
4 changed files with 128 additions and 21 deletions

View File

@ -1,3 +1,20 @@
2002-11-03 Ossama Othman <ossama@doc.ece.uci.edu>
* ltmain.in: add support for installing into temporary
staging area (e.g. 'make install DESTDIR=...')
2002-11-03 Charles Wilson <cwilson@ece.gatech.edu>
* libtool.m4 (AC_LIBTOOL_LANG_CXX_CONFIG): restore setting
allow_undefined_flag=unsupported for cygwin and mingw.
(AC_LIBTOOL_PROG_LD_SHLIBS): ditto, for both "normal" gcc/ld
and for the (unmaintained?) MSVC case.
2002-11-03 Charles Wilson <cwilson@ece.gatech.edu>
* doc/libtool.texi (Install mode): document new
-inst-prefix option.
2002-11-02 Robert Boehne <rboehne@gnu.org>
* ltmain.in: Print a warning if the mode is not specified.

View File

@ -1354,12 +1354,53 @@ any of their required library directories are added to the library path.
@cindex install mode
@cindex mode, install
In @dfn{install} mode, libtool interprets @var{mode-args} as an
installation command beginning with @code{cp}, or a BSD-compatible
@code{install} program.
In @dfn{install} mode, libtool interprets most of the elements of
@var{mode-args} as an installation command beginning with
@code{cp}, or a BSD-compatible @code{install} program.
The rest of the @var{mode-args} are interpreted as arguments to that
command.
The following components of @var{mode-args} are treated specially:
@table @samp
@item -inst-prefix @var{inst-prefix-dir}
When installing into a temporary staging area, rather than the
final @var{prefix}, this argument is used to reflect the
temporary path, in much the same way @code{automake} uses
@var{DESTDIR}. For instance, if @var{prefix} is @code{/usr/local},
but @var{inst-prefix-dir} is @code{/tmp}, then the object will be
installed under @code{/tmp/usr/local/}. If the installed object
is a libtool library, then the internal fields of that library
will reflect only @var{prefix}, not @var{inst-prefix-dir}:
@example
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
@end example
not
@example
# Directory that this library needs to be installed in:
libdir='/tmp/usr/local/lib'
@end example
@code{inst-prefix} is also used to insure that if the installed
object must be relinked upon installation, that it is relinked
against the libraries in @var{inst-prefix-dir}/@var{prefix},
not @var{prefix}.
In truth, this option is not really intended for use when calling
libtool directly; it is automatically used when @code{libtool --mode=install}
calls @code{libtool --mode=relink}. Libtool does this by
analyzing the destination path given in the original
@code{libtool --mode=install} command and comparing it to the
expected installation path established during @code{libtool --mode=link}.
Thus, end-users need change nothing, and @code{automake}-style
@code{make install DESTDIR=/tmp} will Just Work(tm).
@end table
The rest of the @var{mode-args} are interpreted as arguments to the
@code{cp} or @code{install} command.
The command is run, and any necessary unprivileged post-installation
commands are also completed.

29
libtool.m4 vendored
View File

@ -775,11 +775,16 @@ else
lt_cv_dlopen_self=yes
;;
cygwin* | mingw* | pw32*)
mingw* | pw32*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
;;
cygwin*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
;;
*)
AC_CHECK_FUNC([shl_load],
[lt_cv_dlopen="shl_load"],
@ -2645,6 +2650,7 @@ case $host_os in
# _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_AC_TAGVAR(always_export_symbols, $1)=no
if $LD --help 2>&1 | egrep 'auto-import' > /dev/null; then
@ -2657,6 +2663,7 @@ case $host_os in
mingw* | pw32* )
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_AC_TAGVAR(always_export_symbols, $1)=no
if $LD --help 2>&1 | egrep 'auto-import' > /dev/null; then
@ -4649,6 +4656,7 @@ EOF
# _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_AC_TAGVAR(always_export_symbols, $1)=no
if $LD --help 2>&1 | egrep 'auto-import' > /dev/null; then
@ -4711,20 +4719,12 @@ EOF
runpath_var=LD_RUN_PATH
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
case $host_os in
cygwin* | mingw* | pw32*)
# dlltool doesn't understand --whole-archive et. al.
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
;;
*)
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
fi
;;
esac
fi
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
@ -4877,6 +4877,7 @@ EOF
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# FIXME: Setting linknames here is a bad hack.

View File

@ -843,6 +843,7 @@ EOF
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
inst_prefix_dir=
avoid_version=no
dlfiles=
@ -975,6 +976,11 @@ EOF
prev=
continue
;;
inst_prefix)
inst_prefix_dir="$arg"
prev=
continue
;;
release)
release="-$arg"
prev=
@ -1191,6 +1197,11 @@ EOF
continue
;;
-inst-prefix-dir)
prev=inst_prefix
continue
;;
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*)
@ -2245,6 +2256,14 @@ EOF
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case "$libdir" in
[\\/]*)
add_dir="-L$inst_prefix_dir$libdir $add_dir"
;;
esac
fi
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
add_shlibpath="$dir"
@ -2303,6 +2322,14 @@ EOF
else
# We cannot seem to hardcode it, guess we'll fake it.
add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case "$libdir" in
[\\/]*)
add_dir="-L$inst_prefix_dir$libdir $add_dir"
;;
esac
fi
add="-l$name"
fi
@ -4469,7 +4496,7 @@ fi\
fi
done
# Quote the link command for shipping.
relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
# Only create the output if not a dry run.
@ -4770,12 +4797,33 @@ relink_command=\"$relink_command\""
dir="$dir$objdir"
if test -n "$relink_command"; then
# Determine the prefix the user has applied to our future dir.
inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
# Don't allow the user to place us outside of our expected
# location b/c this prevents finding dependent libraries that
# are installed to the same prefix.
# At present, this check doesn't affect windows .dll's that
# are installed into $libdir/../bin (currently, that works fine)
# but it's something to keep an eye on.
if test "$inst_prefix_dir" = "$destdir"; then
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
exit 1
fi
if test -n "$inst_prefix_dir"; then
# Stick the inst_prefix_dir data into the link command.
relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
else
relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
fi
$echo "$modename: warning: relinking \`$file'" 1>&2
$show "$relink_command"
if $run eval "$relink_command"; then :
else
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
continue
exit 1
fi
fi