summaryrefslogtreecommitdiff
blob: 7cb8131fb0bcd265e9ce04d5bb9d5b1e2c072c6a (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
59
From 0176793f19a368c3786c231042b87c3a2ef3de2b Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Sun, 3 Feb 2013 00:40:57 +0200
Subject: [PATCH] build: detect ncurses using pkg-config

---
 configure.ac | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index a551913..a84680f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,22 +10,30 @@ AC_CONFIG_HEADERS([config.h])
 
 # Checks for programs.
 AC_PROG_CC
+PKG_PROG_PKG_CONFIG
 
 # Checks for libraries.
 
-# Check for ncurses. If we find the library then we check to see if it's
-# in a ncurses directory inside the include directory.
-# The assumption is made in the source code that panel.h will be in the same place
-AC_CHECK_LIB([ncurses], [delscreen], [
-        LIBS="-lncurses $LIBS"
-        AC_CHECK_HEADERS(ncurses.h,, [
-            AC_CHECK_HEADERS(ncurses/ncurses.h, [
-                AC_DEFINE([NCURSES_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
-                ], [AC_MSG_ERROR([ncurses headers not found])])
-        ])
-    ], [AC_MSG_ERROR([ncurses development library not found])]
+PKG_CHECK_MODULES(
+	[PANEL],
+	[panel],
+	[
+		CFLAGS="${CFLAGS} ${PANEL_CFLAGS}"
+		LIBS="${LIBS} ${PANEL_LIBS}"
+	],
+	[
+		AC_CHECK_LIB([ncurses], [delscreen], [
+			LIBS="-lncurses $LIBS"
+			AC_CHECK_HEADERS(ncurses.h,, [
+			    AC_CHECK_HEADERS(ncurses/ncurses.h, [
+				AC_DEFINE([NCURSES_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
+				], [AC_MSG_ERROR([ncurses headers not found])])
+			])
+		    ], [AC_MSG_ERROR([ncurses development library not found])]
+		)
+		AC_CHECK_LIB([panel], [main], ,[AC_MSG_ERROR([ncurses panel library not found])])
+	]
 )
-AC_CHECK_LIB([panel], [main], ,[AC_MSG_ERROR([ncurses panel library not found])])
 
 AC_CHECK_LIB([parted], [ped_device_probe_all], ,[AC_MSG_ERROR([parted development library not found])])
 AC_CHECK_LIB([pthread], [main], ,[AC_MSG_ERROR([pthread development library not found])])
-- 
1.7.12.4