From 0ae504b9d113618cdc94a7c5d323036b47ce6161 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Mon, 29 Jan 2024 16:58:48 +0100
Subject: [PATCH 2/2] Rename option --with-aix-soname to --enable-aix-soname.

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

* doc/libtool.texi (LT_INIT): Talk about --enable-aix-soname instead of --with-aix-soname.
* m4/ltoptions.m4 (_LT_WITH_AIX_SONAME): Use AC_ARG_ENABLE instead of
AC_ARG_WITH. In the default case, use _AC_ENABLE_IF, in order to still
recognize the old option --with-aix-soname.
* m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER): Update comment.
* configure.ac: Update comment.
* NEWS: Mention the change.
---
 NEWS             |  4 ++++
 configure.ac     |  2 +-
 doc/libtool.texi |  6 +++---
 m4/libtool.m4    |  2 +-
 m4/ltoptions.m4  | 42 ++++++++++++++++++++++++++----------------
 5 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/NEWS b/NEWS
index 555b2743..642bb95a 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,10 @@ NEWS - list of user-visible changes between releases of GNU Libtool
     --with-pic and --without-pic are still supported, though, for
     backward compatibility.
 
+  - The configure option --with-aix-soname has been renamed to
+    --enable-aix-soname.  The old name --with-aix-soname is still
+    supported, though, for backward compatibility.
+
 ** Changes in supported systems or compilers:
 
   - Removed support for bitrig (*-*-bitrig*).
diff --git a/configure.ac b/configure.ac
index 9aef55d3..5f53fd71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,7 +166,7 @@ LT_LANG(Windows Resource)
 AC_SUBST([to_host_file_cmd])dnl
 AC_SUBST([to_tool_file_cmd])dnl
 
-# Propagate --with-aix-soname option to the testsuite.
+# Propagate --enable-aix-soname option to the testsuite.
 AC_SUBST([with_aix_soname])dnl
 
 ## ---------------------- ##
diff --git a/doc/libtool.texi b/doc/libtool.texi
index 2bbfd102..29fd2cdf 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -2223,7 +2223,7 @@ in link mode from the package @code{Makefile}.  Naturally, if you pass
 @item aix-soname=aix
 @itemx aix-soname=svr4
 @itemx aix-soname=both
-Enable the @option{--with-aix-soname} to @command{configure}, which the
+Enable the @option{--enable-aix-soname} to @command{configure}, which the
 user can pass to override the given default.
 
 By default (and @strong{always} in releases prior to 2.4.4), Libtool always
@@ -2237,13 +2237,13 @@ shared archives are built from shared objects, without any filename-based
 versioning; and without @option{-brtl} no shared archives are built at all.
 
 When @code{aix-soname=svr4} option is given, or the
-@option{--with-aix-soname=svr4} @command{configure} option is passed, static
+@option{--enable-aix-soname=svr4} @command{configure} option is passed, static
 archives are always created from static objects, even without @option{-brtl}
 in @code{LDFLAGS}. Shared archives are made from shared objects, and filename
 based versioning is enabled.
 
 When @code{aix-soname=both} option is given, or the
-@option{--with-aix-soname=svr4} @command{configure} option is passed, static
+@option{--enable-aix-soname=svr4} @command{configure} option is passed, static
 archives are built traditionally (as @option{aix-soname=aix}), and both
 kinds of shared archives are built. The @code{.la} pseudo-archive specifies
 one or the other depending on whether @option{-brtl} is specified in
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 20527f83..411331d9 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2441,7 +2441,7 @@ aix[[4-9]]*)
     # Unfortunately, runtime linking may impact performance, so we do
     # not want this to be the default eventually. Also, we use the
     # versioned .so libs for executables only if there is the -brtl
-    # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
+    # linker flag in LDFLAGS as well, or --enable-aix-soname=svr4 only.
     # To allow for filename-based versioning support, we need to create
     # libNAME.so.V as an archive file, containing:
     # *) an Import File, referring to the versioned filename of the
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
index 7e224ac8..391239ec 100644
--- a/m4/ltoptions.m4
+++ b/m4/ltoptions.m4
@@ -323,29 +323,39 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 
 # _LT_WITH_AIX_SONAME([DEFAULT])
 # ----------------------------------
-# implement the --with-aix-soname flag, and support the `aix-soname=aix'
-# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
-# is either `aix', `both' or `svr4'.  If omitted, it defaults to `aix'.
+# implement the --enable-aix-soname configure option, and support the
+# `aix-soname=aix' and `aix-soname=both' and `aix-soname=svr4' LT_INIT options.
+# DEFAULT is either `aix', `both', or `svr4'.  If omitted, it defaults to `aix'.
 m4_define([_LT_WITH_AIX_SONAME],
 [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
 shared_archive_member_spec=
 case $host,$enable_shared in
 power*-*-aix[[5-9]]*,yes)
   AC_MSG_CHECKING([which variant of shared library versioning to provide])
-  AC_ARG_WITH([aix-soname],
-    [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
+  AC_ARG_ENABLE([aix-soname],
+    [AS_HELP_STRING([--enable-aix-soname=aix|svr4|both],
       [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
-    [case $withval in
-    aix|svr4|both)
-      ;;
-    *)
-      AC_MSG_ERROR([Unknown argument to --with-aix-soname])
-      ;;
-    esac
-    lt_cv_with_aix_soname=$with_aix_soname],
-    [AC_CACHE_VAL([lt_cv_with_aix_soname],
-      [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
-    with_aix_soname=$lt_cv_with_aix_soname])
+    [case $enableval in
+     aix|svr4|both)
+       ;;
+     *)
+       AC_MSG_ERROR([Unknown argument to --enable-aix-soname])
+       ;;
+     esac
+     lt_cv_with_aix_soname=$enable_aix_soname],
+    [_AC_ENABLE_IF([with], [aix-soname],
+        [case $withval in
+         aix|svr4|both)
+           ;;
+         *)
+           AC_MSG_ERROR([Unknown argument to --with-aix-soname])
+           ;;
+         esac
+         lt_cv_with_aix_soname=$with_aix_soname],
+        [AC_CACHE_VAL([lt_cv_with_aix_soname],
+           [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)])
+     enable_aix_soname=$lt_cv_with_aix_soname])
+  with_aix_soname=$enable_aix_soname
   AC_MSG_RESULT([$with_aix_soname])
   if test aix != "$with_aix_soname"; then
     # For the AIX way of multilib, we name the shared archive member
-- 
2.34.1

