diff --git a/ChangeLog b/ChangeLog index 67c50e15..6677fb0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2003-10-07 Ralph Schleicher + * ltmain.in: Do not create `.o' objects when `-shared' is + specified in compile mode. + Do not make a static library when `-shared' is specified in link + mode. + * doc/libtool.texi (Compile mode): Document it. + * NEWS: Updated. + * doc/libtool.texi (Compile mode): Be more specific about the effect of `-static'. * ltmain.in: Do not create `.lo' objects when `-static' is diff --git a/NEWS b/NEWS index 9a60ef32..d49cc601 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,11 @@ NEWS - list of user-visible changes between releases of GNU Libtool New in 1.5b: 2003-??-??; CVS version 1.5a, Libtool team: * Shared objects (.lo) are no longer created when `-static' is passed in compile mode. +* New compile mode option `-shared' prevents creation of static objects (.o). +* New link mode option `-shared' creates only shared libraries at link time. +* If you configure libtool with --disable-shared (or if libtool does not + support shared libraries on your platform) trying to build a library using + `-shared' is a fatal error. * libtoolize installs libtool.m4 (and ltdl.m4 if used) to AC_CONFIG_M4_DIR. * Mode inferrence removed, shorthand for choosing modes added. * Specifying -allow-undefined is now an error. diff --git a/doc/libtool.texi b/doc/libtool.texi index 46db6360..643093e4 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1155,6 +1155,11 @@ and @samp{-Xcompiler @var{flag}}. If the @samp{-static} option is given, then only a @samp{.o} file is built, even if libtool was configured with @samp{--disable-static}. +If the @samp{-shared} option is given, then no @samp{.o} file is built, +even if libtool was configured with @samp{--enable-static}. Libtool +will signal an error if it was configured with @samp{--disable-shared}, +or if the host does not support shared libraries. + Note that the @samp{-o} option is now fully supported. It is emulated on the platforms that don't support it (by locking and moving the objects), so it is really easy to use libtool, just with minor @@ -1295,6 +1300,14 @@ path. If @var{output-file} is a library, add -R@var{libdir} to its @var{dependency_libs}, so that, whenever the library is linked into a program, @var{libdir} will be added to its run-time path. +@item -shared +If @var{output-file} is a program, then link it against any +uninstalled shared libtool libraries (this is the default behavior). +If @var{output-file} is a library, then only create a shared library. +In the later case, libtool will signal an error if it was configured +with @samp{--disable-shared}, or if the host does not support shared +libraries. + @item -static If @var{output-file} is a program, then do not link it against any uninstalled shared libtool libraries. If @var{output-file} is a diff --git a/ltmain.in b/ltmain.in index 6ba620e7..5ce32f09 100644 --- a/ltmain.in +++ b/ltmain.in @@ -388,6 +388,16 @@ exec_cmd= continue ;; + -shared) + if test "$build_libtool_libs" != yes; then + $echo "$modename: can not build a shared library" 1>&2 + $echo "Fatal configuration error." 1>&2 + exit 1 + fi + build_old_libs=no + continue + ;; + -static) build_libtool_libs=no build_old_libs=yes @@ -873,6 +883,15 @@ EOF for arg do case $arg in + -shared) + if test "$build_libtool_libs" != yes; then + $echo "$modename: can not build a shared library" 1>&2 + $echo "Fatal configuration error." 1>&2 + exit 1 + fi + build_old_libs=no + break + ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then @@ -1385,6 +1404,11 @@ EOF continue ;; + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that @@ -6213,7 +6237,8 @@ This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. @@ -6300,6 +6325,7 @@ The following components of LINK-COMMAND are treated specially: -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0]