Skip to content

Commit

Permalink
build: Improve configure logic with pkg.m4 support
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Explorer09 authored and BenBE committed Dec 14, 2024
1 parent d464ad1 commit 76e7dd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 76e7dd4

Please sign in to comment.