summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xaux/slibtool.sh37
-rw-r--r--m4/slibtool.m46
-rw-r--r--project/extras.mk1
3 files changed, 44 insertions, 0 deletions
diff --git a/aux/slibtool.sh b/aux/slibtool.sh
new file mode 100755
index 0000000..0bde87d
--- /dev/null
+++ b/aux/slibtool.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+#####################################################################
+## slibtool: a strong libtool implementation, written in C ##
+## Copyright (C) 2016--2024 SysDeer Technologies, LLC ##
+## Released under the Standard MIT License; see COPYING.SLIBTOOL. ##
+#####################################################################
+
+#####################################################################
+## slibtool.sh: a backward compatible slibtool wrapper script ##
+## ---------------------------------------------------------- ##
+## This script only exists to satisfy build-time requirements in ##
+## projects that directly invoke the generated libtool script at ##
+## configure time (bad practice to beging with, should never be ##
+## necessary in the first place). ##
+## ##
+## By default, slibtool.sh is _NOT_ copied to a project's build ##
+## directory. If found by configure, however (either as a symlink ##
+## to the system installed slibtool.sh or as a physical copy of ##
+## the above, configure shall create ``libtool'' as a symlink to ##
+## this script. ##
+#####################################################################
+
+set -eu
+
+mb_escaped_arg=
+mb_escaped_args=
+mb_escaped_space=
+
+for arg ; do
+ mb_escaped_arg=\'$(printf '%s\n' "$arg" | sed -e "s/'/'\\\\''/g")\'
+ mb_escaped_arg="$mb_escaped_space$mb_escaped_arg"
+ mb_escaped_args="$mb_escaped_args$mb_escaped_arg"
+ mb_escaped_space=' '
+done
+
+eval ${SLIBTOOL:-slibtool} "$mb_escaped_args"
diff --git a/m4/slibtool.m4 b/m4/slibtool.m4
index 61a849c..cc33f15 100644
--- a/m4/slibtool.m4
+++ b/m4/slibtool.m4
@@ -534,6 +534,12 @@ AC_CONFIG_COMMANDS_PRE(
[${SLIBTOOL:-slibtool} --mkvars=Makefile --config > slibtool.cfg],
[rm -f slibtool.cfg || exit 2]))
+# optionally create libtool as a symlink to slibtool.sh
+AC_CONFIG_COMMANDS_PRE(
+ [if [[ -s slibtool.sh ]]; then
+ ln -f -s slibtool.sh libtool || exit 2
+ fi])
+
# SLIBTOOL_PREREQ(_version_)
# --------------------------
diff --git a/project/extras.mk b/project/extras.mk
index 804a7cc..0565646 100644
--- a/project/extras.mk
+++ b/project/extras.mk
@@ -92,5 +92,6 @@ install-slibtoolize:
cp -p $(SOURCE_DIR)/m4/slibtool.m4 $(DESTDIR)$(DATADIR)/$(PACKAGE)
cp -p $(SOURCE_DIR)/aux/ltmain.sh $(DESTDIR)$(DATADIR)/$(PACKAGE)
+ cp -p $(SOURCE_DIR)/aux/slibtool.sh $(DESTDIR)$(DATADIR)/$(PACKAGE)
.PHONY: install-slibtoolize