Rename option --with-pic to --enable-pic.

Reported at <https://savannah.gnu.org/support/index.php?110674>.

* doc/libtool.texi (LT_INIT): Talk about --enable-pic instead of
--with-pic, and about --disable-pic instead of --without-pic.
(Test descriptions): Likewise.
* m4/ltoptions.m4 (_LT_WITH_PIC): Use AC_ARG_ENABLE instead of
AC_ARG_WITH. In the default case, use _AC_ENABLE_IF, in order to still
recognize the old options --with-pic and --without-pic.
* tests/demo.at: Add a test for --enable-pic, keeping the test for
--with-pic. Test '--disable-pic' instead of '--with-pic=no'.
* tests/with-pic.at: Test --enable-pic instead of --with-pic.
* NEWS: Mention the change.
This commit is contained in:
Bruno Haible 2024-01-29 16:35:17 +01:00 committed by Ileana Dumitrescu
parent ec703fac9e
commit 9a8535f4e9
No known key found for this signature in database
GPG Key ID: 6570EA01146F7354
5 changed files with 76 additions and 38 deletions

7
NEWS
View File

@ -2,6 +2,13 @@ NEWS - list of user-visible changes between releases of GNU Libtool
* Noteworthy changes in release ?.? (????-??-??) [?]
** Bug fixes:
- The configure options --with-pic and --without-pic have been renamed
to --enable-pic and --disable-pic, respectively. The old names
--with-pic and --without-pic are still supported, though, for
backward compatibility.
* Noteworthy changes in release 2.5.2 (2024-08-29) [beta]

View File

@ -2138,8 +2138,8 @@ LT_PREREQ([@value{VERSION}])
@defmacx AC_PROG_LIBTOOL
@defmacx AM_PROG_LIBTOOL
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
@option{--enable-static}, @option{--disable-static}, @option{--enable-pic}, and
@option{--disable-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
@ -2182,12 +2182,13 @@ 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,
The @option{--enable-pic} and @option{--disable-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
static libraries.
The @option{--enable-pic} option also accepts a comma-separated
list of package names. Specifying @option{--enable-pic=@var{pkgs}} is the same
as configuring every package in @var{pkgs} with @option{--enable-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}.
@ -2301,12 +2302,12 @@ specifying @option{--enable-static} to @command{configure}.
@item pic-only
Change the default behaviour for @command{libtool} to try to use only
PIC objects. The user may still override this default by specifying
@option{--without-pic} to @command{configure}.
@option{--disable-pic} to @command{configure}.
@item no-pic
Change the default behaviour of @command{libtool} to try to use only
non-PIC objects. The user may still override this default by
specifying @option{--with-pic} to @command{configure}.
specifying @option{--enable-pic} to @command{configure}.
@end table
@ -5605,9 +5606,9 @@ update. In each case, the tests verify that the original library will link and
install as expected.
@item @file{tests/with_pic.at}
Tests the function of the @option{--with-pic} flag. The @option{--with-pic}
Tests the function of the @option{--enable-pic} flag. The @option{--enable-pic}
flag is used to specify whether or not @command{libtool} uses PIC objects.
This includes tests for setting @option{--with-pic} to no, yes, or a comma
This includes tests for setting @option{--enable-pic} to no, yes, or a comma
delimited list of package names.
@end table

60
m4/ltoptions.m4 vendored
View File

@ -8,7 +8,7 @@
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 9 ltoptions.m4
# serial 10 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@ -376,30 +376,50 @@ LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
# implement the --enable-pic flag, and support the 'pic-only' and 'no-pic'
# LT_INIT options.
# 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@<:@=PKGS@:>@],
[AC_ARG_ENABLE([pic],
[AS_HELP_STRING([--enable-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[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=m4_default([$1], [default])])
case $enableval in
yes|no) pic_mode=$enableval ;;
*)
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 $enableval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[dnl Continue to support --with-pic and --without-pic, for backward
dnl compatibility.
_AC_ENABLE_IF([with], [pic],
[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=m4_default([$1], [default])])]
)
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC

View File

@ -495,6 +495,16 @@ AT_SETUP([force PIC objects])
_LT_DEMO_SETUP
LT_AT_CHECK_CONFIG([--enable-pic])
_LT_CHECK_EXECUTE
AT_CLEANUP
AT_SETUP([force PIC objects (old option name)])
_LT_DEMO_SETUP
LT_AT_CHECK_CONFIG([--with-pic])
_LT_CHECK_EXECUTE
@ -533,7 +543,7 @@ fi
])
_LT_DEMO_SETUP
LT_AT_CHECK_CONFIG([--with-pic=no])
LT_AT_CHECK_CONFIG([--disable-pic])
_LT_CHECK_EXECUTE
AT_CLEANUP

View File

@ -1,4 +1,4 @@
# with-pic.at -- test the --with-pic flag -*- Autotest -*-
# with-pic.at -- test the --enable-pic flag -*- Autotest -*-
# Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
#
@ -18,7 +18,7 @@
# along with GNU Libtool. If not, see <https://www.gnu.org/licenses/>.
####
AT_SETUP([test --with-pic])
AT_SETUP([test --enable-pic])
# Set up a tests/demo.at style project.
_LT_DEMO_SETUP
@ -38,22 +38,22 @@ AT_CHECK([test . != "$at_srcdir" || exit 77])
: ${MAKE=make}
LT_AT_CONFIGURE([--disable-shared --with-pic=no])
LT_AT_CONFIGURE([--disable-shared --enable-pic=no])
AT_CHECK([$MAKE], [], [stdout], [ignore])
AT_CHECK([$FGREP -v "$pic_flag" stdout], [], [ignore], [ignore])
$MAKE clean
LT_AT_CONFIGURE([--disable-shared --with-pic=yes])
LT_AT_CONFIGURE([--disable-shared --enable-pic=yes])
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"])
LT_AT_CONFIGURE([--disable-shared --enable-pic="demo,foo,bar"])
AT_CHECK([$MAKE], [], [stdout], [ignore])
AT_CHECK([$FGREP "$pic_flag" stdout], [], [ignore], [ignore])
$MAKE clean
LT_AT_CONFIGURE([--disable-shared --with-pic="foo,bar"])
LT_AT_CONFIGURE([--disable-shared --enable-pic="foo,bar"])
AT_CHECK([$MAKE], [], [stdout], [ignore])
AT_CHECK([$FGREP -v "$pic_flag" stdout], [], [ignore], [ignore])
$MAKE clean