]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Modify --with-pic to support per-package configurations.
authorOllie Wild <aaw@google.com>
Wed, 10 Nov 2010 20:06:50 +0000 (21:06 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 10 Nov 2010 21:40:11 +0000 (22:40 +0100)
* libltdl/m4/libtool.m4:  Modify --with-pic to accept a list of
package names.  Modelled off --enable-shared.
* tests/with-pic.at: New test.
* Makefile.am (TESTSUITE_AT): Add tests/with-pic.at.
* doc/libtool.texi (LT_INIT): Enhance documentation of
--with-pic configure flag.
* NEWS (New features): Mention that --with-pic now accepts a
comma-separated list of package names.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
Makefile.am
NEWS
doc/libtool.texi
libltdl/m4/ltoptions.m4
tests/with-pic.at [new file with mode: 0644]

index 9c169e0e8e9adf5ad7e5dbe8fb987207e1438b66..97b94488fe96a8b5516e84b936db6af61d35907d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-07  Ollie Wild  <aaw@google.com>
+
+       Modify --with-pic to support per-package configurations.
+       * libltdl/m4/libtool.m4:  Modify --with-pic to accept a list of
+       package names.  Modelled off --enable-shared.
+       * tests/with-pic.at: New test.
+       * Makefile.am (TESTSUITE_AT): Add tests/with-pic.at.
+       * doc/libtool.texi (LT_INIT): Enhance documentation of
+       --with-pic configure flag.
+       * NEWS (New features): Mention that --with-pic now accepts a
+       comma-separated list of package names.
+
 2010-11-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Fix cwrapper test failure with --disable-static.
index db2c0a9e27e3884131df236924a745495957378c..66f38b104e2471af02bcc92df82180900fdb99a5 100644 (file)
@@ -502,6 +502,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/ctor.at \
                  tests/exceptions.at \
                  tests/early-libtool.at \
+                 tests/with-pic.at \
                  tests/no-executables.at \
                  tests/deplibs-ident.at \
                  tests/configure-iface.at \
diff --git a/NEWS b/NEWS
index d8d692e68ce453bc9bfea771340fa13780707342..693027463039cb6011565d697b41d588ed2b1aba 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ NEWS - list of user-visible changes between releases of GNU Libtool
 
 New in 2.4.2 2010-12-??: git version 2.4.1a, Libtool team:
 
+* New features:
+
+  - The --with-pic configure option now supports a list of comma-separated
+    package names.  This can be used to build some static libraries with PIC
+    objects while building others with non-PIC objects.
+
 * Bug fixes:
 
   - The generic approximation of the command line length limit (when getconf is
index 2f48a09bef0a392aa6e47d997f5399eda9363ae0..5c2570d1b7953a8575610bbc32853a09ffe00bc5 100644 (file)
@@ -2042,9 +2042,10 @@ LT_PREREQ([@value{VERSION}])
 @defmac LT_INIT (@var{options})
 @defmacx AC_PROG_LIBTOOL
 @defmacx AM_PROG_LIBTOOL
-Add support for the @option{--enable-shared} and @option{--disable-shared}
-@code{configure} flags.@footnote{@code{LT_INIT} requires that
-you define the @file{Makefile} variable @code{top_builddir} in your
+Add support for the @option{--enable-shared}, @option{--disable-shared},
+@option{--enable-static}, @option{--disable-static}, @option{--with-pic}, and
+@option{--without-pic} @code{configure} flags.@footnote{@code{LT_INIT} requires
+that you define the @file{Makefile} variable @code{top_builddir} in your
 @file{Makefile.in}.  Automake does this automatically, but Autoconf
 users should set it to the relative path to the top of your build
 directory (@file{../..}, for example).}  @code{AC_PROG_LIBTOOL} and
@@ -2086,6 +2087,16 @@ behaves similarly, but it uses @option{--enable-static} and
 The package name @samp{default} matches any packages that have not set
 their name in the @code{PACKAGE} environment variable.
 
+The @option{--with-pic} and @option{--without-pic} configure flags can be used
+to specify whether or not @command{libtool} uses PIC objects.  By default,
+@command{libtool} uses PIC objects for shared libraries and non-PIC objects for
+static libraries.  The @option{--with-pic} option also accepts a comma-separated
+list of package names.  Specifying @option{--with-pic=@var{pkgs}} is the same
+as configuring every package in @var{pkgs} with @option{--with-pic} and every
+other package with the default configuration.  The package name @samp{default}
+is treated the same as for @option{--enable-shared} and
+@option{--enable-static}.
+
 This macro also sets the shell variable @code{LIBTOOL_DEPS}, that you
 can use to automatically update the libtool script if it becomes
 out-of-date.  In order to do that, add to your @file{configure.ac}:
index 17cfd51c0b34ed2f118b8b5d4d28947889eec9c3..5d9acd8e23bcfd20d353804aff13666ecbed54f4 100644 (file)
@@ -326,9 +326,24 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 # MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
        [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [pic_mode="$withval"],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+       IFS="$lt_save_ifs"
+       if test "X$lt_pkg" = "X$lt_p"; then
+         pic_mode=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
     [pic_mode=default])
 
 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
diff --git a/tests/with-pic.at b/tests/with-pic.at
new file mode 100644 (file)
index 0000000..c01e5d7
--- /dev/null
@@ -0,0 +1,53 @@
+# with-pic.at -- test the --with-pic flag -*- Autotest -*-
+
+#   Copyright (C) 2010 Free Software Foundation, Inc.
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+AT_SETUP([test --with-pic])
+eval `$LIBTOOL --config | $EGREP '^(pic_flag|FGREP)='`
+
+AT_CHECK([test "z$pic_flag" != "z" || exit 77])
+AT_CHECK([test "$at_srcdir" != . || exit 77])
+
+CONFIGURE=$abs_top_srcdir/tests/demo/configure
+: ${MAKE=make}
+
+LT_AT_CONFIGURE([--disable-shared --with-pic=no], [$CONFIGURE])
+AT_CHECK([$MAKE], [], [stdout], [ignore])
+AT_CHECK([$FGREP -v "$pic_flag" stdout], [], [ignore], [ignore])
+$MAKE clean
+
+LT_AT_CONFIGURE([--disable-shared --with-pic=yes], [$CONFIGURE])
+AT_CHECK([$MAKE], [], [stdout], [ignore])
+AT_CHECK([$FGREP "$pic_flag" stdout], [], [ignore], [ignore])
+$MAKE clean
+
+LT_AT_CONFIGURE([--disable-shared --with-pic="demo,foo,bar"], [$CONFIGURE])
+AT_CHECK([$MAKE], [], [stdout], [ignore])
+AT_CHECK([$FGREP "$pic_flag" stdout], [], [ignore], [ignore])
+$MAKE clean
+
+LT_AT_CONFIGURE([--disable-shared --with-pic="foo,bar"], [$CONFIGURE])
+AT_CHECK([$MAKE], [], [stdout], [ignore])
+AT_CHECK([$FGREP -v "$pic_flag" stdout], [], [ignore], [ignore])
+$MAKE clean
+
+AT_CLEANUP