summaryrefslogtreecommitdiff
blob: 51105c909f5415b16ebee2482f491092b8aa3b3e (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
60
61
62
63
64
65
--- a/configure.ac
+++ b/configure.ac
@@ -1058,27 +1058,25 @@
       ;;
       yes|*)
         use_uim_fep="yes"
-	AC_CHECK_LIB(curses, setupterm, FEP_LIBADD="-lcurses $FEP_LIBADD",
-	  [AC_CHECK_LIB(ncurses, setupterm, FEP_LIBADD="-lncurses $FEP_LIBADD",
-	    AC_MSG_WARN([fep needs setupterm in libcurses or libncurses. disabled...]);use_uim_fep="no")])
-	AC_CHECK_FUNCS(forkpty)
-	if test $ac_cv_func_forkpty = no; then
-	  AC_CHECK_LIB(util, forkpty, [AC_DEFINE(HAVE_FORKPTY) FEP_LIBADD="-lutil $FEP_LIBADD"])
-	fi
-	AC_SUBST(FEP_LIBADD)
       ;;
     esac
   ],
-  [ use_uim_fep="yes"
-    AC_CHECK_LIB(curses, setupterm, FEP_LIBADD="-lcurses $FEP_LIBADD",
-      [AC_CHECK_LIB(ncurses, setupterm, FEP_LIBADD="-lncurses $FEP_LIBADD",
-        AC_MSG_WARN([fep needs setupterm in libcurses or libncurses. disabled...]);use_uim_fep="no")])
-    AC_CHECK_FUNCS(forkpty)
-    if test $ac_cv_func_forkpty = no; then
-      AC_CHECK_LIB(util, forkpty, [AC_DEFINE(HAVE_FORKPTY) FEP_LIBADD="-lutil $FEP_LIBADD"])
-    fi
-    AC_SUBST(FEP_LIBADD)
-  ])
+  [use_uim_fep="yes"])
+
+if test "x$use_uim_fep" != "xno"; then
+  PKG_CHECK_MODULES(CURSES, ncurses,
+    [FEP_LIBADD="$CURSES_LIBS $FEP_LIBADD"],
+    [
+      AC_CHECK_LIB(curses, setupterm, FEP_LIBADD="-lcurses $FEP_LIBADD",
+        [AC_CHECK_LIB(ncurses, setupterm, FEP_LIBADD="-lncurses $FEP_LIBADD",
+          AC_MSG_WARN([fep needs setupterm in libcurses or libncurses. disabled...]);use_uim_fep="no")])
+    ])
+  AC_CHECK_FUNCS(forkpty)
+  if test $ac_cv_func_forkpty = no; then
+    AC_CHECK_LIB(util, forkpty, [AC_DEFINE(HAVE_FORKPTY) FEP_LIBADD="-lutil $FEP_LIBADD"])
+  fi
+  AC_SUBST(FEP_LIBADD)
+fi
 
 AC_ARG_ENABLE(emacs,
   AC_HELP_STRING([--disable-emacs],
@@ -1210,10 +1208,14 @@
     saved_LDFLAGS=$LDFLAGS
     CPPFLAGS="${CPPFLAGS} -I$libedit_path/include"
     LDFLAGS="${LDFLAGS} -L$libedit_path/lib"
-    AC_CHECK_LIB(curses, tgetent, LIBEDIT_LIBS="-lcurses",
-        [AC_CHECK_LIB(ncurses, tgetent, LIBEDIT_LIBS="-lncurses",
-            AC_MSG_WARN("libedit needs libcurses or libncurses. disabled...")
-            use_libedit="no")])
+    PKG_CHECK_MODULES(CURSES, ncurses,
+        [LIBEDIT_LIBS="$CURSES_LIBS"],
+        [
+            AC_CHECK_LIB(curses, tgetent, LIBEDIT_LIBS="-lcurses",
+                [AC_CHECK_LIB(ncurses, tgetent, LIBEDIT_LIBS="-lncurses",
+                    AC_MSG_WARN("libedit needs libcurses or libncurses. disabled...")
+                    use_libedit="no")])
+        ])
     if test "x$use_libedit" != "xno"; then
         AC_CHECK_LIB(edit, el_init,
             [LIBEDIT_LIBS="-ledit $LIBEDIT_LIBS -L$libedit_path/lib"