Skip to content

Commit

Permalink
configure: Check for -ltermcap and term.h
Browse files Browse the repository at this point in the history
This patch adds clever detection for a -ltermcap capable library, which
can be any of: libtermcap, libtinfo, libcurses, or libncurses.  It also
checks for term.h, not termcap.h, because we like cookies.

Configure is clever in that it adds the found library to $LIBS, which is
what mg is later linked with, along with $(lite_LIBS) which pkg-config
provides us with.  So, this patch also remove -ltermcap from mg_LDADD,
since anything that has tgoto() will do.

Signed-off-by: Joachim Nilsson <[email protected]>
  • Loading branch information
troglobit committed May 15, 2016
1 parent 2117158 commit ea0aaa3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mg_CFLAGS += -fomit-frame-pointer -fdata-sections -ffunction-sections \
-Wl,--gc-sections -Wl,-z,norelro -Wl,--hash-style=gnu \
-Wl,--build-id=none
endif
mg_LDADD = -ltermcap $(lite_LIBS)
mg_LDADD = $(lite_LIBS)
dist_man1_MANS = mg.1
doc_DATA = README
EXTRA_DIST = tutorial
Expand Down
14 changes: 14 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ AC_HEADER_STDC
# Check for required libraries
PKG_CHECK_MODULES([lite], [libite >= 1.6.0])

# Check for a termcap compatible library
AC_CHECK_LIB(termcap, tgoto, , [
AC_CHECK_LIB(tinfo, tgoto, , [
AC_CHECK_LIB(curses, tgoto, , [
AC_CHECK_LIB(ncurses, tgoto, , [
AC_MSG_ERROR([Cannot find a termcap capable library, try installing Ncurses.])])
])
])
])

# We want term.h, not termcap.h, because cookies ...
AC_CHECK_HEADERS(term.h, , [
AC_MSG_ERROR([Cannot find required header file term.h, try installing Ncurses.])])

# Check for configured features
AC_ARG_ENABLE(regexp, AS_HELP_STRING([--enable-regexp], [Enable full regexp search]))
AC_ARG_ENABLE(size-optimizations,
Expand Down

0 comments on commit ea0aaa3

Please sign in to comment.