Skip to content

Commit

Permalink
Prefer bash-completion directory from pkg-config...
Browse files Browse the repository at this point in the history
...with backwards compatibility for pkg-config < 0.28
  • Loading branch information
robert-scheck committed Jun 13, 2024
1 parent e9f27bf commit 3269155
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ AC_ARG_ENABLE([fs-test],
AM_CONDITIONAL(ENABLE_FS_TEST, test "$enable_fs_test" = yes)
AM_CONDITIONAL(ENABLE_FEATURE_TEST, test "$enable_feature_test" = yes)

##bash-completion
PKG_CHECK_VAR([bashcompletiondir], [bash-completion], [completionsdir], [],
[bashcompletiondir="${sysconfdir}/bash_completion.d"])
AC_SUBST(bashcompletiondir)

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
Expand Down
24 changes: 24 additions & 0 deletions m4/compat.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# backwards compat with older pkg-config
# - pull in AC_DEFUN from pkg.m4
m4_ifndef([PKG_CHECK_VAR], [
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
# Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR
])

# This hack makes PKG_CHECK_VARS from m4/pkg.m4 work on autoconf 2.63
# (courtesy of sunnybear in https://github.com/gdnsd/gdnsd/issues/85)
m4_ifndef([AS_VAR_COPY],
[m4_define([AS_VAR_COPY],
[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])
## End Autoconf-2.63-Compat
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ partclone_imgfuse_LDADD+=-ldl -lcrypto ${LDADD_static}
endif
endif

compconfdir=$(sysconfdir)/bash_completion.d
compconfdir=@bashcompletiondir@
compconf_DATA = partclone-prompt

# Extra
Expand Down

0 comments on commit 3269155

Please sign in to comment.