Fix shared library support on Android.
Patch from <https://savannah.gnu.org/patch/index.php?10393>.
* m4/libtool.m4: On Android, fix library_names_spec and
hardcode_libdir_flag_spec.
* libcharset/m4/libtool.m4: Likewise.
diff --git a/ChangeLog b/ChangeLog
index 49e4e69..0e2f5f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-09-18 Bruno Haible <bruno@clisp.org>
+
+ Fix shared library support on Android.
+ Patch from <https://savannah.gnu.org/patch/index.php?10393>.
+ * m4/libtool.m4: On Android, fix library_names_spec and
+ hardcode_libdir_flag_spec.
+
2023-09-16 Bruno Haible <bruno@clisp.org>
Fix a misnomer.
diff --git a/libcharset/ChangeLog b/libcharset/ChangeLog
index 7af250d..befb0ed 100644
--- a/libcharset/ChangeLog
+++ b/libcharset/ChangeLog
@@ -1,3 +1,10 @@
+2023-09-18 Bruno Haible <bruno@clisp.org>
+
+ Fix shared library support on Android.
+ Patch from <https://savannah.gnu.org/patch/index.php?10393>.
+ * m4/libtool.m4: On Android, fix library_names_spec and
+ hardcode_libdir_flag_spec.
+
2023-09-16 Bruno Haible <bruno@clisp.org>
Fix a misnomer.
diff --git a/libcharset/m4/libtool.m4 b/libcharset/m4/libtool.m4
index eb1d425..c95d015 100644
--- a/libcharset/m4/libtool.m4
+++ b/libcharset/m4/libtool.m4
@@ -2840,7 +2840,7 @@
version_type=none # Android doesn't support versioned libraries.
need_lib_prefix=no
need_version=no
- library_names_spec='$libname$release$shared_ext'
+ library_names_spec='$libname$release$shared_ext $libname$shared_ext'
soname_spec='$libname$release$shared_ext'
finish_cmds=
shlibpath_var=LD_LIBRARY_PATH
@@ -2852,8 +2852,9 @@
hardcode_into_libs=yes
dynamic_linker='Android linker'
- # Don't embed -rpath directories since the linker doesn't support them.
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ # -rpath works at least for libraries that are not overridden by
+ # libraries installed in system locations.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
;;
# This must be glibc/ELF.
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index eb1d425..c95d015 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2840,7 +2840,7 @@
version_type=none # Android doesn't support versioned libraries.
need_lib_prefix=no
need_version=no
- library_names_spec='$libname$release$shared_ext'
+ library_names_spec='$libname$release$shared_ext $libname$shared_ext'
soname_spec='$libname$release$shared_ext'
finish_cmds=
shlibpath_var=LD_LIBRARY_PATH
@@ -2852,8 +2852,9 @@
hardcode_into_libs=yes
dynamic_linker='Android linker'
- # Don't embed -rpath directories since the linker doesn't support them.
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ # -rpath works at least for libraries that are not overridden by
+ # libraries installed in system locations.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
;;
# This must be glibc/ELF.