summaryrefslogtreecommitdiff
path: root/net-misc/suite3270/files/suite3270-4.2_p5-ncurses-pkg-config.patch
blob: 7142bb293c0024b1bbba4b8cc496bbd58e913a84 (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
Needed to ensure we pick up definitions from ncurses' pkg-config file
like -DNCURSES_WIDECHAR (issue is observable on say, musl).
--- a/x3270if/configure.in
+++ b/x3270if/configure.in
@@ -65,6 +65,9 @@ AC_CHECK_HEADERS(getopt.h)
 if test "$with_readline" != no; then
 AC_CHECK_HEADERS(readline/history.h)
 fi
+
+dnl Try pkg-config first, and if it fails, try the traditional methods.
+PKG_CHECK_MODULES([ncurses], [ncursesw], [AC_DEFINE([HAVE_NCURSESW_NCURSES_H] ,[1]) AC_DEFINE([HAVE_NCURSESW_TERM_H], [1])], [
 dnl Find the best curses header file and hope it's consistent with the library
 dnl we found.
 AC_CHECK_HEADERS(ncursesw/ncurses.h, ,
@@ -75,15 +78,16 @@ AC_CHECK_HEADERS(ncursesw/term.h, ,
  [AC_CHECK_HEADERS(ncurses/term.h, ,
   [AC_CHECK_HEADERS(term.h)])])
 
+  AC_SEARCH_LIBS(newterm, ncursesw ncurses curses, , [AC_MSG_ERROR(Can't find libncurses or new-enough libcurses)])
+  AC_SEARCH_LIBS(setupterm, tinfow tinfo, , [AC_MSG_ERROR(Can't find terminfo library)])
+  AC_CHECK_FUNCS(tiparm)])
+
 dnl Check for --without-readline
 AC_ARG_WITH(readline, [  --without-readline      Don't use the readline library]) 
 
 dnl Checks for library functions.
 AC_CHECK_FUNCS(vasprintf)
 AC_FUNC_FSEEKO
-AC_SEARCH_LIBS(newterm, ncursesw ncurses curses, , [AC_MSG_ERROR(Can't find libncurses or new-enough libcurses)])
-AC_SEARCH_LIBS(setupterm, tinfow tinfo, , [AC_MSG_ERROR(Can't find terminfo library)])
-AC_CHECK_FUNCS(tiparm)
 if test "$with_readline" != no; then
 AC_CHECK_LIB(readline, rl_initialize)
 fi
--- a/x3270if/Makefile.obj.in
+++ b/x3270if/Makefile.obj.in
@@ -51,9 +51,9 @@ INSTALL_DATA = @INSTALL_DATA@
 
 CCOPTIONS = @CCOPTIONS@
 XCPPFLAGS = -I$(THIS) -I$(TOP)/include -I$(TOP)/Common/x3270if @CPPFLAGS@
-CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS) @CFLAGS@
+CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS) @ncurses_CFLAGS@ @CFLAGS@
 LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
+LIBS = @LIBS@ @ncurses_LIBS@
 
 XVERSION = xversion.c
 version.o: mkversion.sh $(VOBJS) version.txt