Browse code

Autotools: Use pkg-config to detect curses

Attempt to first use pkg-config to detect curses before using the
traditional method.

Micah Snyder authored on 2020/08/22 12:38:33
Showing 1 changed files
... ...
@@ -4,12 +4,21 @@ AC_ARG_ENABLE(clamdtop,
4 4
 
5 5
 if test "$enable_clamdtop" != "no"; then
6 6
 
7
-AC_LIB_FIND([ncurses], [ncurses/ncurses.h],
7
+PKG_CHECK_MODULES(NCURSES, [ncurses], [
8
+	HAVE_LIBNCURSES=yes
9
+	CURSES_INCLUDE="<ncurses.h>"
10
+	CURSES_CPPFLAGS="$NCURSES_CFLAGS"
11
+	CURSES_LIBS="$NCURSES_LIBS"
12
+	], [HAVE_LIBNCURSES=])
13
+
14
+if test "X$HAVE_LIBNCURSES" != "Xyes"; then
15
+    AC_LIB_FIND([ncurses], [ncurses/ncurses.h],
8 16
 	    AC_LANG_PROGRAM([#include <ncurses/ncurses.h>],
9 17
 			    [initscr(); KEY_RESIZE;]),
10 18
 	    [CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES";
11 19
 	     CURSES_INCLUDE="<ncurses/ncurses.h>"],
12 20
 	    [])
21
+fi
13 22
 
14 23
 if test "X$HAVE_LIBNCURSES" != "Xyes"; then
15 24
     HAVE_LIBNCURSES=