From 76e7dd4a14144116b0589b34dd047244c6d1e132 Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Tue, 29 Oct 2024 07:57:54 +0800 Subject: [PATCH] build: Improve configure logic with pkg.m4 support It is slightly more robust to grep for the 'pkg_m4_included' token when running "make dist". Also, shorten the "make dist" warning message, and tell users if they need to regenerate configure when we recommend them to install pkg-config. Signed-off-by: Kang-Che Sung --- Makefile.am | 8 ++++---- configure.ac | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 386506c92..65de4f922 100644 --- a/Makefile.am +++ b/Makefile.am @@ -508,11 +508,11 @@ cppcheck: cppcheck -q -v . --enable=all -DHAVE_OPENVZ dist-hook: $(top_distdir)/configure - @if test "x$$FORCE_MAKE_DIST" = x && \ - grep 'pkg_m4_absent' '$(top_distdir)/configure' >/dev/null; then \ - echo 'ERROR: This distribution would have incomplete pkg-config support. Rebuilding the configure script is advised. Set FORCE_MAKE_DIST=1 to ignore this warning.'>&2; \ + @if test "x$$FORCE_MAKE_DIST" != x || \ + grep 'pkg_m4_included' '$(top_distdir)/configure' >/dev/null; then :; \ + else \ + echo 'ERROR: The configure script has incomplete pkg-config support and regenerating it is advised. Set FORCE_MAKE_DIST=1 to ignore this warning.'>&2; \ (exit 1); \ - else :; \ fi @if grep 'PACKAGE_VERSION.*-g' '$(top_distdir)/configure'; then \ echo 'WARNING: You are building a dist from a git version. Better run make dist outside of a .git repo on a tagged release.'>&2; \ diff --git a/configure.ac b/configure.ac index 353c5232a..f0b712749 100644 --- a/configure.ac +++ b/configure.ac @@ -384,8 +384,8 @@ dnl If the macro is not called, some pkg-config checks might be skipped dnl and $PKG_CONFIG might be unset. m4_ifdef([PKG_PROG_PKG_CONFIG], [ PKG_PROG_PKG_CONFIG() + pkg_m4_included=1 # Makefile might grep this keyword. Don't remove. ], [ - pkg_m4_absent=1 # Makefile might grep this keyword. Don't remove. m4_warn( [syntax], [pkg.m4 is absent or older than version 0.16; this 'configure' would have incomplete pkg-config support]) @@ -609,6 +609,9 @@ none-*|nonwide-yes) if test "x$result" != x; then echo detected a .pc file: "$result" >&AS_MESSAGE_LOG_FD AC_MSG_WARN([your system supports pkg-config; installing pkg-config is recommended before configuring htop]) + m4_ifdef([PKG_PROG_PKG_CONFIG], [], [ + AC_MSG_WARN([this configure script would also need to be regenerated]) + ]) break fi done