Add explict --enable-relative ./configure flag for using FindBin

This commit is contained in:
Danielle McLean 2023-10-23 16:13:57 +11:00
parent 70b6c6cd9e
commit 51e303a798
Signed by: 00dani
GPG Key ID: 52C059C3B22A753E
2 changed files with 14 additions and 4 deletions

View File

@ -116,14 +116,14 @@ edit = sed -e 's|[@]PERL[@]|$(PERL)|g' \
pmdir_in_INC = \
PERL5LIB= $(PERL) -V | \
awk '/@INC/ {p=1; next} p==1 {print $$1}' | \
grep -F -q "$(pmdir)"
grep -F -x -q "$(pmdir)"
calc_use_lib_pmdir = \
pmdir="$(pmdir)"; \
if $(pmdir_in_INC); then \
if [ $(FINDBIN) = yes ]; then \
use_lib_pmdir="use FindBin; use lib \"\$$FindBin::Bin/../$${pmdir\#$(prefix)/}\";"; \
elif $(pmdir_in_INC); then \
use_lib_pmdir=""; \
elif [ "$${pmdir\#../}" != "$$pmdir" ]; then \
use_lib_pmdir="use FindBin; use lib \"\$$FindBin::Bin/$$pmdir\";"; \
else \
use_lib_pmdir="use lib \"$(pmdir)\";"; \
fi

View File

@ -70,6 +70,15 @@ AC_ARG_WITH(
[Install Perl modules in DIR]),
[PMDIR=${withval}],
[PMDIR='${prefix}'/"$pmdir_relative_path"])
AC_ARG_ENABLE(
[relative],
AS_HELP_STRING(
[--enable-relative],
[Load Stow modules relative to the main script]),
[FINDBIN="$enable_relative"],
[FINDBIN=no])
AC_CONFIG_COMMANDS_POST([[
eval pmdir="$PMDIR"
cat <<EOF
@ -108,6 +117,7 @@ EOF
fi
]])
AC_SUBST([PMDIR])
AC_SUBST([FINDBIN])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT