summaryrefslogtreecommitdiff
blob: 75a7b897eb4023a938a1284e105ccbe78dc2aaa1 (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
http://bugs.exim.org/show_bug.cgi?id=997
http://bugs.exim.org/attachment.cgi?id=525
https://bugs.gentoo.org/show_bug.cgi?id=395343

libpcre needs curses when building pcretest

--- pcre/configure.ac
+++ pcre/configure.ac
@@ -467,7 +467,30 @@ LIBS="$OLD_LIBS"
 
 AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
 AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
-AC_CHECK_LIB([readline], [readline], [HAVE_LIB_READLINE=1])
+AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"],
+  [unset ac_cv_lib_readline_readline;
+   AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"],
+    [unset ac_cv_lib_readline_readline;
+     AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"],
+      [unset ac_cv_lib_readline_readline;
+       AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
+        [unset ac_cv_lib_readline_readline;
+	 AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
+          [unset ac_cv_lib_readline_readline;
+	   AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
+            [LIBREADLINE=""],
+            [-ltermcap])],
+          [-lncursesw])],
+        [-lncurses])],
+      [-lcurses])],
+    [-ltinfo])])
+AC_SUBST(LIBREADLINE)
+if test -n "$LIBREADLINE"; then
+  if test "$LIBREADLINE" != "-lreadline"; then
+    echo "-lreadline needs $LIBREADLINE"
+    LIBREADLINE="-lreadline $LIBREADLINE"
+  fi
+fi
 
 # This facilitates -ansi builds under Linux
 dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
@@ -712,9 +735,11 @@ if test "$enable_pcretest_libreadline" = "yes"; then
     echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
     exit 1
   fi
-  LIBREADLINE="-lreadline"
+  if test -z "$LIBREADLINE"; then
+    echo "** Cannot --enable-pcretest-readline because readline library was not found."
+    exit 1
+  fi
 fi
-AC_SUBST(LIBREADLINE)
 
 # Produce these files, in addition to config.h.
 AC_CONFIG_FILES(