mirror of
git://git.savannah.gnu.org/libtool.git
synced 2024-11-21 01:40:57 +08:00
* doc/libtool.texi (Compile mode): Document that -o is fully
supported. * libtool.m4 (libtool-lock): new ARG_ENABLE; sets (need_locks) * ltconfig.in (disable-lock): control need_locks (hard_links): check whether hard-links can be used for locking * ltmain.in (need_locks): use $output_obj.lock for locking
This commit is contained in:
parent
5791e6c05e
commit
8747a04ff9
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
1998-11-04 Eric Estievenart <eric@via.ecp.fr>
|
||||
|
||||
* doc/libtool.texi (Compile mode): Document that -o is fully
|
||||
supported.
|
||||
|
||||
* libtool.m4 (libtool-lock): new ARG_ENABLE; sets (need_locks)
|
||||
* ltconfig.in (disable-lock): control need_locks
|
||||
(hard_links): check whether hard-links can be used for locking
|
||||
* ltmain.in (need_locks): use $output_obj.lock for locking
|
||||
|
||||
1998-11-03 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* ltmain.in: correctly create libraries and programs with
|
||||
|
@ -1066,10 +1066,14 @@ are substituted into the compilation command.
|
||||
If the @samp{-static} option is given, then a @samp{.o} file is built,
|
||||
even if libtool was configured with @samp{--disable-static}.
|
||||
|
||||
Note that the @samp{-o} option is not supported for compile mode,
|
||||
because it cannot be implemented properly for all platforms. It is far
|
||||
easier just to change your Makefiles to create all the output files in
|
||||
the current working directory.
|
||||
Note that the @samp{-o} option is now fully supported. It is emulated
|
||||
for the platforms that don't support it (by locking and moving the
|
||||
objects), so it is really easy to use libtool, just with minor
|
||||
modifications to your Makefiles. Typing for example
|
||||
@example
|
||||
libtool gcc -c foo/x.c -o foo/x.lo
|
||||
@end example
|
||||
will do what you expect.
|
||||
|
||||
@node Link mode
|
||||
@section Link mode
|
||||
|
14
libtool.m4
vendored
14
libtool.m4
vendored
@ -21,7 +21,7 @@
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 26 AM_PROG_LIBTOOL
|
||||
# serial 27 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AM_ENABLE_STATIC])dnl
|
||||
@ -79,6 +79,18 @@ case "$host" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable the --disable-libtool-lock switch
|
||||
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock force libtool not to do file locking],
|
||||
need_locks=$enableval,
|
||||
need_locks=yes)
|
||||
|
||||
if test x"$need_locks" = xno; then
|
||||
libtool_flags="$libtool_flags --disable-lock"
|
||||
fi
|
||||
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
|
46
ltconfig.in
46
ltconfig.in
@ -117,6 +117,7 @@ ofile="$default_ofile"
|
||||
verify_host=yes
|
||||
with_gcc=no
|
||||
with_gnu_ld=no
|
||||
need_locks=yes
|
||||
|
||||
old_AR="$AR"
|
||||
old_CC="$CC"
|
||||
@ -162,6 +163,7 @@ Generate a system-specific libtool script.
|
||||
--version output version information and exit
|
||||
--with-gcc assume that the GNU C compiler will be used
|
||||
--with-gnu-ld assume that the C compiler uses the GNU linker
|
||||
--disable-lock disable file locking
|
||||
|
||||
LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
|
||||
that provides basic libtool functionality.
|
||||
@ -195,6 +197,8 @@ EOM
|
||||
--with-gcc) with_gcc=yes ;;
|
||||
--with-gnu-ld) with_gnu_ld=yes ;;
|
||||
|
||||
--disable-lock) need_locks=no ;;
|
||||
|
||||
-*)
|
||||
echo "$progname: unrecognized option \`$option'" 1>&2
|
||||
echo "$help" 1>&2
|
||||
@ -638,6 +642,36 @@ fi
|
||||
CFLAGS="$save_CFLAGS"
|
||||
$rm conftest*
|
||||
|
||||
# Check to see if we can do hard links to lock some files if needed
|
||||
hard_links="nottested"
|
||||
if test "$compiler_c_o" = no && test "$need_locks" != no; then
|
||||
# do not overwrite the value of need_locks provided by the user
|
||||
echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
|
||||
hard_links=yes
|
||||
$rm conftest*
|
||||
ln conftest.a conftest.b 2>/dev/null && hard_links=no
|
||||
touch conftest.a
|
||||
ln conftest.a conftest.b 2>&5 || hard_links=no
|
||||
ln conftest.a conftest.b 2>/dev/null && hard_links=no
|
||||
echo "$ac_t$hard_links" 1>&6
|
||||
$rm conftest*
|
||||
else
|
||||
need_locks=no
|
||||
fi
|
||||
|
||||
# Abort if we need locks and they don't work and the user didn't disable them
|
||||
|
||||
if test "$hard_links" = no; then
|
||||
echo "*** Warning, your platform support neither -c and -o with your compiler"
|
||||
echo "*** and doesn't provide working hard links to do file locking."
|
||||
echo "*** You can use ltconfig --disable-lock or configure --disable-libtool-lock"
|
||||
echo "*** but you should never try to do parallel compilation (make -j n)"
|
||||
echo "*** unless the package maintainer told you that you could."
|
||||
echo "*** You should report this bug to <bug-libtool@gnu.org>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Check for any special shared library compilation flags.
|
||||
if test -n "$special_shlib_compile_flags"; then
|
||||
echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
|
||||
@ -1362,7 +1396,7 @@ case "$ltmain" in
|
||||
old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \
|
||||
allow_undefined_flag no_undefined_flag \
|
||||
finish_cmds finish_eval global_symbol_pipe \
|
||||
hardcode_libdir_flag_spec hardcode_libdir_separator compiler_c_o; do
|
||||
hardcode_libdir_flag_spec hardcode_libdir_separator compiler_c_o need_locks; do
|
||||
|
||||
case "$var" in
|
||||
reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
|
||||
@ -1380,13 +1414,6 @@ case "$ltmain" in
|
||||
trap "$rm \"$ofile\"; exit 1" 1 2 15
|
||||
echo "creating $ofile"
|
||||
$rm "$ofile"
|
||||
if test "$compiler_c_o" = no; then
|
||||
$echo "**** Warning ! Your compiler doesn't support -c and -o options"
|
||||
$echo "**** If you use a single makefile, with relative directories and"
|
||||
$echo "**** use the -o option of libtool gcc, we strongly discourage"
|
||||
$echo "**** to make parallel builds (make -j n) if there are source"
|
||||
$echo "**** files with the same name in different subdirectories"
|
||||
fi
|
||||
cat <<EOF > "$ofile"
|
||||
#! $SHELL
|
||||
|
||||
@ -1507,6 +1534,9 @@ pic_flag=$pic_flag
|
||||
# Does compiler simultaneously support -c and -o options
|
||||
compiler_c_o=$compiler_c_o
|
||||
|
||||
# Must we lock files when doing compilation ?
|
||||
need_locks=$need_locks
|
||||
|
||||
# Compiler flag to prevent dynamic linking.
|
||||
link_static_flag=$link_static_flag
|
||||
|
||||
|
15
ltmain.in
15
ltmain.in
@ -375,6 +375,16 @@ if test -z "$show_help"; then
|
||||
output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.o
|
||||
fi
|
||||
|
||||
# Lock this critical section if it is needed
|
||||
# We use this script file to make the link, it avoids creating a new file
|
||||
if test "$need_locks" = yes; then
|
||||
until ln "$0" "$output_obj.lock" 2>/dev/null; do
|
||||
$show "Waiting for lock on $output_obj to be removed"
|
||||
sleep 2
|
||||
done
|
||||
trap "rm $output_obj.lock; exit 1" 1 2 15
|
||||
fi
|
||||
|
||||
# Only build a PIC object if we are building libtool libraries.
|
||||
if test "$build_libtool_libs" = yes; then
|
||||
# Without this assignment, base_compile gets emptied.
|
||||
@ -435,6 +445,11 @@ if test -z "$show_help"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Unlock the critical section if it was locked
|
||||
if test "$need_locks" = yes; then
|
||||
rm "$output_obj.lock"
|
||||
fi
|
||||
|
||||
# Create an invalid libtool object if no PIC, so that we do not
|
||||
# accidentally link it into a program.
|
||||
if test "$build_libtool_libs" != yes; then
|
||||
|
Loading…
Reference in New Issue
Block a user