Skip to content

Commit cf2479d

Browse files
committed
build: Introduce HTOP_PKG_CHECK_MODULES wrapper macro
HTOP_PKG_CHECK_MODULES is a wrapper of PKG_CHECK_MODULES that expands to fallback code when pkg.m4 is not available. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
1 parent 183db6c commit cf2479d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

configure.ac

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,25 @@ if test "x$enable_affinity" = xyes; then
896896
fi
897897

898898

899+
dnl HTOP_PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
900+
dnl This macro is a wrapper of PKG_CHECK_MODULES, which checks if
901+
dnl MODULES exist, and then sets VARIABLE-PREFIX_CFLAGS and
902+
dnl VARIABLE-PREFIX_LIBS from pkg-config --cflags and --libs output
903+
dnl respectively, and then runs ACTION-IF-FOUND. If pkg.m4 is absent or
904+
dnl pkg-config MODULES don't exist, this instead runs
905+
dnl ACTION-IF-NOT-FOUND. ACTION-IF-NOT-FOUND defaults to printing an
906+
dnl error message and exiting.
907+
AC_DEFUN([HTOP_PKG_CHECK_MODULES],
908+
[m4_ifdef(
909+
[PKG_PROG_PKG_CONFIG],
910+
[PKG_CHECK_MODULES([$1], [$2], [$3], [$4])],
911+
[m4_default(
912+
[$4],
913+
[AC_MSG_ERROR([pkg.m4 required to check for pkg-config modules '$2'; please regenerate configure script])]
914+
)]
915+
)]
916+
)
917+
899918
# $1: Header file name
900919
# $2: List of directories to search, separated by spaces
901920
# $3: Additional include directives

0 commit comments

Comments
 (0)