aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure.ac
diff options
context:
space:
mode:
authorGravatar Anders Kaseorg <andersk@mit.edu>2012-03-22 18:25:15 -0400
committerGravatar Keith Winstein <keithw@mit.edu>2012-04-11 02:47:55 -0400
commit9cec566cd178864a4c9b010db903a85f6e3768b8 (patch)
tree679b3d2b8d36158b1e6645d7ed4575d307ecda8c /configure.ac
parentfd0ddf0e22180e94ddba8728de6f211529b72192 (diff)
Find ncurses from pkg-config if possible, and prefer separate libtinfo
Recent ncurses can be configured --with-termlib, which splits out the terminfo-level functions from libncurses into a separate libtinfo. This allows us to avoid an unnecessary dependency on libncurses. (We already avoided this on distributions that link with -Wl,--as-needed.) Signed-off-by: Anders Kaseorg <andersk@mit.edu> Closes #128 github pull request.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 24f5a13..93ff3d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,7 +109,7 @@ AS_IF([test x"$with_skalibs" != xno],
AC_SUBST([STDDJB_LDFLAGS], ["$SKALIBS_LDFLAGS -lstddjb"])])
# Checks for header files.
-AC_CHECK_HEADERS([arpa/inet.h curses.h fcntl.h langinfo.h limits.h locale.h netinet/in.h stddef.h stdint.h inttypes.h stdlib.h string.h sys/ioctl.h sys/resource.h sys/socket.h sys/time.h term.h termios.h unistd.h wchar.h wctype.h], [], [AC_MSG_ERROR([Missing required header file.])])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h langinfo.h limits.h locale.h netinet/in.h stddef.h stdint.h inttypes.h stdlib.h string.h sys/ioctl.h sys/resource.h sys/socket.h sys/time.h term.h termios.h unistd.h wchar.h wctype.h], [], [AC_MSG_ERROR([Missing required header file.])])
AC_CHECK_HEADERS([pty.h util.h libutil.h])
AC_CHECK_HEADERS([endian.h sys/endian.h])
@@ -135,7 +135,15 @@ AC_CHECK_FUNCS([gettimeofday setrlimit inet_ntoa iswprint memchr memset nl_langi
AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if clock_gettime is available.])])
-AC_CHECK_LIB([ncurses], [setupterm], [], [AC_MSG_ERROR([Missing ncurses.])])
+PKG_CHECK_MODULES([TINFO], [tinfo], ,
+ [PKG_CHECK_MODULES([TINFO], [ncurses], ,
+ [AX_CHECK_LIBRARY([TINFO], [curses.h], [tinfo],
+ [AC_SUBST([TINFO_CFLAGS], ["$TINFO_CPPFLAGS"])
+ AC_SUBST([TINFO_LIBS], ["$TINFO_LDFLAGS -ltinfo"])],
+ [AX_CHECK_LIBRARY([TINFO], [curses.h], [ncurses], ,
+ [AC_SUBST([TINFO_CFLAGS], ["$TINFO_CPPFLAGS"])
+ AC_SUBST([TINFO_LIBS], ["$TINFO_LDFLAGS -lncurses"])],
+ [AC_MSG_ERROR([Unable to find libtinfo or libncurses])])])])])
AC_ARG_VAR([poll_CFLAGS], [C compiler flags for poll])
AC_ARG_VAR([poll_LIBS], [linker flags for poll])