File wyrd-1.4.6-ncurses.patch of Package wyrd
---
configure.ac | 4 ++++
curses/configure.ac | 35 ++++++++++++++++-------------------
2 files changed, 20 insertions(+), 19 deletions(-)
--- configure.ac
+++ configure.ac 2017-05-17 08:26:18.529806611 +0000
@@ -154,6 +154,10 @@ fi
# find a C compiler
AC_PROG_CC()
+AC_CHECK_PROG(PKG_CONFIG,pkg-config,pkg-config,no)
+if test "$PKG_CONFIG" = no ; then
+ AC_MSG_ERROR(Cannot find pkg-config.)
+fi
# check Remind version
AC_PATH_PROG(REMINDPATH, remind, not found)
--- curses/configure.ac
+++ curses/configure.ac 2017-05-17 09:17:11.486466413 +0000
@@ -24,6 +24,10 @@ AC_ARG_ENABLE(widec,
AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_RANLIB
+AC_CHECK_PROG(PKG_CONFIG,pkg-config,pkg-config,no)
+if test "$PKG_CONFIG" = no ; then
+ AC_MSG_ERROR(Cannot find pkg-config.)
+fi
ORIG_LIBS="$LIBS"
ORIG_CPPFLAGS="$CPPFLAGS"
@@ -38,10 +42,14 @@ AC_MSG_CHECKING(for working ncurses libr
if test "$try_widec" != "no"
then
-LIBS="-lncursesw $ORIG_LIBS"
+CHK_LIBS="$($PKG_CONFIG --libs ncursesw)"
+CHK_CFLAGS="$($PKG_CONFIG --cflags ncursesw)"
+LIBS="$CHK_LIBS $ORIG_LIBS"
+CPPFLAGS="$CHK_CFLAGS $ORIG_CPPFLAGS"
AC_TRY_LINK(
[#include <ncursesw/curses.h>], [initscr(); use_default_colors()],
- [CURSES_LIB=-lncursesw
+ [CURSES_LIB="$CHK_LIBS"
+ CURSES_INCLUDE="$CHK_CFLAGS"
AC_DEFINE(CURSES_HEADER, <ncursesw/curses.h>, [Defined to ncurses header file])])
fi
@@ -90,22 +98,11 @@ fi
# Try to locate term.h, which has a sadly nonstandardized location
AC_MSG_CHECKING(for term.h)
-AC_TRY_COMPILE(
- [#include <term.h>], [TERMINAL __dummy],
- [TERM_H_STRING="<term.h>"
- AC_DEFINE(CURSES_TERM_H, <term.h>, [Defined to ncurses term.h file])],
- [
-AC_TRY_COMPILE(
- [#include <ncurses/term.h>], [TERMINAL __dummy],
- [TERM_H_STRING="<ncurses/term.h>"
- AC_DEFINE(CURSES_TERM_H, <ncurses/term.h>, [Defined to ncurses term.h file])],
- [
-AC_TRY_COMPILE(
- [#include <curses/term.h>], [TERMINAL __dummy],
- [TERM_H_STRING="<curses/term.h>"
- AC_DEFINE(CURSES_TERM_H, <curses/term.h>, [Defined to ncurses term.h file])],
-) ]) ])
-
+AC_CHECK_HEADERS([term.h ncurses/term.h curses/term.h],[
+TERM_H_STRING="<$ac_header>"
+AC_DEFINE_UNQUOTED(CURSES_TERM_H,<$ac_header>, [Defined to ncurses term.h file])
+CURSES_TERM_H="<$ac_header>"
+break])
if test -n "$TERM_H_STRING"
then
AC_MSG_RESULT([found in $TERM_H_STRING])
@@ -143,7 +140,7 @@ fi
AC_CHECK_FUNCS([resizeterm resize_term])
-CURSES_LIB_BASE=`expr "$CURSES_LIB" : '-l\(.*\)'`
+CURSES_LIB_BASE=$(echo "$CURSES_LIB" | sed -r 's/-l//g')
CPPFLAGS="$ORIG_CPPFLAGS"
LIBS="$ORIG_LIBS"