Revision: 889
http://vcs.pcre.org/viewvc?view=rev&revision=889
Author: ph10
Date: 2012-01-17 14:51:50 +0000 (Tue, 17 Jan 2012)
Log Message:
-----------
More portable way of linking pcretest with -lreadline.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/configure.ac
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2012-01-17 14:43:23 UTC (rev 888)
+++ code/trunk/ChangeLog 2012-01-17 14:51:50 UTC (rev 889)
@@ -48,6 +48,9 @@
12. Stephen Kelly's patch to CMakeLists.txt allows it to parse the version
information out of configure.ac instead of relying on pcre.h.generic, which
is not stored in the repository.
+
+13. Applied Dmitry V. Levin's patch for a more portable method for linking with
+ -lreadline.
Version 8.21 12-Dec-2011
Modified: code/trunk/configure.ac
===================================================================
--- code/trunk/configure.ac 2012-01-17 14:43:23 UTC (rev 888)
+++ code/trunk/configure.ac 2012-01-17 14:51:50 UTC (rev 889)
@@ -536,7 +536,30 @@
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])
@@ -795,9 +818,11 @@
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(