summaryrefslogtreecommitdiff
blob: 4e13459f39c2f6e584dbc1b63df5696888d7ba86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 Makefile.am  |  2 ++
 configure.ac | 20 ++++++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 05a72e7..7908937 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,6 +36,8 @@ SUFFIXES = .h
 BUILT_SOURCES = $(myhtopheaders)
 htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h
 
+htop_LDADD = $(NCURSES_LIBS)
+
 profile:
 	$(MAKE) all CFLAGS="" AM_CPPFLAGS="-pg -O2"
 
diff --git a/configure.ac b/configure.ac
index ff6901b..6226d90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@
 AC_DISABLE_SHARED
 AC_ENABLE_STATIC
 AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG

 # Checks for libraries.
 AC_CHECK_LIB([m], [ceil], [], [missing_libraries="$missing_libraries libm"])
@@ -89,16 +89,20 @@ fi
 
 AC_ARG_ENABLE(unicode, [AC_HELP_STRING([--enable-unicode], [enable Unicode support])], ,enable_unicode="yes")
 if test "x$enable_unicode" = xyes; then
-   AC_CHECK_LIB([ncursesw], [refresh], [], [
-      missing_libraries="$missing_libraries libncursesw"
-      AC_MSG_ERROR([You may want to use --disable-unicode or install libncursesw.])
+   PKG_CHECK_MODULES([NCURSES], [ncursesw],[
+      AC_CHECK_LIB([ncursesw], [refresh], [], [
+         missing_libraries="$missing_libraries libncursesw"
+         AC_MSG_ERROR([You may want to use --disable-unicode or install libncursesw.])
+      ])
+      AC_CHECK_HEADERS([ncursesw/curses.h],[:],
+           [AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
+             [AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])
    ])
-   AC_CHECK_HEADERS([ncursesw/curses.h],[:],
-        [AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
-          [AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])
 else
-   AC_CHECK_LIB([ncurses], [refresh], [], [missing_libraries="$missing_libraries libncurses"])
-   AC_CHECK_HEADERS([curses.h],[:],[missing_headers="$missing_headers $ac_header"])
+   PKG_CHECK_MODULES([NCURSES], [ncurses],[
+      AC_CHECK_LIB([ncurses], [refresh], [], [missing_libraries="$missing_libraries libncurses"])
+      AC_CHECK_HEADERS([curses.h],[:],[missing_headers="$missing_headers $ac_header"])
+   ])
 fi
 
 if test ! -z "$missing_libraries"; then