Skip to content

Commit

Permalink
build: Add friendly warning to advise user to install pkg-config
Browse files Browse the repository at this point in the history
If we can detect the presence of '*curses*.pc' files in some
pkg-config default search directories, print a warning message.

Signed-off-by: Kang-Che Sung <[email protected]>
  • Loading branch information
Explorer09 authored and BenBE committed Sep 20, 2024
1 parent d5f24d2 commit 082b977
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,53 @@ esac

case ${htop_curses_capability}-$enable_unicode in
none-*|nonwide-yes)
if test "x$PKG_CONFIG" = x; then (
# Friendly warning to advise user to install pkg-config.
# The local variables get discarded when done.
list=""
echo "" >conftest.c
if test "$cross_compiling" != yes; then
# "-print-multi-directory" supported in GCC 3.0 or later
name=""
if $CC $CPPFLAGS $CFLAGS -print-multi-directory -E conftest.c >/dev/null 2>&1; then
name=`$CC $CPPFLAGS $CFLAGS -print-multi-directory -E conftest.c 2>/dev/null |
sed '/^ *#/ d; s/^\.$//; q'`
fi
list="/usr/lib${name}/pkgconfig $list"
case $host_os in
darwin*)
list="/opt/homebrew/Library/Homebrew/os/mac/pkgconfig $list"
;;
freebsd*)
list="/usr/libdata/pkgconfig $list"
;;
netbsd*)
list="/usr/pkg/lib/pkgconfig $list"
;;
esac
fi
if test "x$host_alias" != x; then
list="/usr/lib/${host_alias}/pkgconfig $list"
fi
# "-print-multiarch" supported in GCC 4.6 or later
if $CC $CPPFLAGS $CFLAGS -print-multiarch -E conftest.c >/dev/null 2>&1; then
name=`$CC $CPPFLAGS $CFLAGS -print-multiarch -E conftest.c 2>/dev/null |
sed '/^ *#/ d; q'`
if test "x$name" != x; then
list="/usr/lib/${name}/pkgconfig $list"
fi
fi
rm -f conftest.*

for d in $list; do
result=`find "$d" -name '*curses*.pc' 2>/dev/null | sed '1 q'`
if test "x$result" != x; then
AC_MSG_WARN([your system supports pkg-config; installing pkg-config is recommended before configuring htop])
break
fi
done
) fi

# OpenBSD and Solaris are known to not provide '*curses*.pc' files.
AC_MSG_RESULT([no curses information found through '*-config' utilities; will guess the linker flags])
for curses_name in $curses_pkg_names; do
Expand Down

0 comments on commit 082b977

Please sign in to comment.