blob: 331b7f02e4598beddab65e5b3d47f747a174e1ea [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From 2a75095638002d37a2f9c7aeb0ec54f271b0a1c4 Mon Sep 17 00:00:00 2001
2From: Joe Slater <joe.slater@windriver.com>
3Date: Tue, 1 Aug 2017 12:36:53 -0700
4Subject: [PATCH] slang: fix terminfo related problems
5
Brad Bishopd7bf8c12018-02-25 22:55:05 -05006Do not use the JD_TERMCAP macro since we cannot get the terminfo from
7ncurses pkg-config, but fix the macro to not reference host directories.
8Also add src/test/Makefile.in so that we can use -ltermcap if we want to.
9
Andrew Geissler595f6302022-01-24 19:11:47 +000010Upstream isn't going to take this, as it forces blank values and
11removes functionality without replacing it.
12Upstream-Status: Inappropriate [see above]
Brad Bishopd7bf8c12018-02-25 22:55:05 -050013
14Signed-off-by: Joe Slater <joe.slater@windriver.com>
15
Patrick Williams92b42cb2022-09-03 06:53:57 -050016---
17 autoconf/aclocal.m4 | 8 +---
18 autoconf/configure.ac | 11 +++++-
19 src/test/Makefile.in | 90 +++++++++++++++++++++++++++++++++++++++++++
20 3 files changed, 100 insertions(+), 9 deletions(-)
21 create mode 100644 src/test/Makefile.in
Brad Bishopd7bf8c12018-02-25 22:55:05 -050022
Patrick Williams92b42cb2022-09-03 06:53:57 -050023diff --git a/autoconf/aclocal.m4 b/autoconf/aclocal.m4
24index b2dfcd3..5f94ed3 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025--- a/autoconf/aclocal.m4
26+++ b/autoconf/aclocal.m4
Patrick Williams92b42cb2022-09-03 06:53:57 -050027@@ -509,15 +509,9 @@ then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050028 else
29 MISC_TERMINFO_DIRS=""
30 fi
31-JD_Terminfo_Dirs="$MISC_TERMINFO_DIRS \
32- /usr/lib/terminfo \
33- /usr/share/terminfo \
34- /usr/share/lib/terminfo \
Patrick Williams92b42cb2022-09-03 06:53:57 -050035- /usr/local/lib/terminfo \
36- /etc/terminfo /lib/terminfo"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050037 TERMCAP=-ltermcap
38
39-for terminfo_dir in $JD_Terminfo_Dirs
40+for terminfo_dir in $MISC_TERMINFO_DIRS
41 do
42 if test -d $terminfo_dir
43 then
Patrick Williams92b42cb2022-09-03 06:53:57 -050044diff --git a/autoconf/configure.ac b/autoconf/configure.ac
45index 8e11e13..9e6402c 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050046--- a/autoconf/configure.ac
47+++ b/autoconf/configure.ac
Patrick Williams92b42cb2022-09-03 06:53:57 -050048@@ -250,7 +250,14 @@ AC_CHECK_SIZEOF(size_t)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050049 JD_CHECK_LONG_LONG
50 JD_LARGE_FILE_SUPPORT
51
52-JD_TERMCAP
53+dnl Do not use JD_TERMCAP, since we cannot get terminfo from ncurses*-config anymore.
54+dnl Set TERMCAP=-ltermcap and AC_DEFINE(USE_TERMCAP,1,[Define to use termcap])
55+dnl to use libtermcap.
56+TERMCAP=""
57+MISC_TERMINFO_DIRS=""
58+AC_SUBST(TERMCAP)dnl
59+AC_SUBST(MISC_TERMINFO_DIRS)dnl
60+
61 JD_GCC_WARNINGS
62
63 JD_SET_OBJ_SRC_DIR(src)
Patrick Williams92b42cb2022-09-03 06:53:57 -050064@@ -365,7 +372,7 @@ AC_CONFIG_HEADER(src/sysconf.h:src/config.hin)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050065 dnl AC_CONFIG_SUBDIRS(demo)
66
67 AC_OUTPUT(Makefile:autoconf/Makefile.in \
68- src/Makefile slsh/Makefile modules/Makefile demo/Makefile \
69+ src/Makefile src/test/Makefile slsh/Makefile modules/Makefile demo/Makefile \
70 slang.pc:autoconf/slangpc.in \
71 )
72
Patrick Williams92b42cb2022-09-03 06:53:57 -050073diff --git a/src/test/Makefile.in b/src/test/Makefile.in
74new file mode 100644
75index 0000000..4b7307f
Brad Bishopd7bf8c12018-02-25 22:55:05 -050076--- /dev/null
77+++ b/src/test/Makefile.in
78@@ -0,0 +1,90 @@
79+# -*- make -*-
80+TEST_SCRIPTS_SLC = argv syntax scircuit eqs sscanf loops arith array strops \
81+ bstring pack stdio assoc selfload struct nspace path ifeval anytype arrmult \
82+ time utf8 except bugs list regexp method deref naninf overflow sort \
83+ longlong signal dollar req docfun debug qualif compare break multline \
84+ stack misc posixio posdir proc math
85+
86+TEST_SCRIPTS_NO_SLC = autoload nspace2 prep
87+
88+TEST_SCRIPTS = $(TEST_SCRIPTS_SLC) $(TEST_SCRIPTS_NO_SLC)
89+
90+TEST_PGM = sltest
91+MEMCHECK = valgrind --tool=memcheck --leak-check=yes --leak-resolution=med --num-callers=20
92+RUN_TEST_PGM = ./$(TEST_PGM)
93+SLANGINC = ..
94+SLANGLIB = ../$(ARCH)objs
95+OTHER_LIBS = -lm @TERMCAP@
96+OTHER_CFLAGS =
97+
98+runtests: $(TEST_PGM) cleantmp
99+ @tests=""; \
100+ for test in $(TEST_SCRIPTS); \
101+ do \
102+ tests="$$tests $$test.sl"; \
103+ done; \
104+ for test in $(TEST_SCRIPTS_SLC); \
105+ do \
106+ tests="$$tests $$test.slc"; \
107+ done; \
108+ MAKERUNNING=1 ./runtests.sh $$tests
109+# @touch $(TEST_PGM).c
110+
111+update: $(TEST_PGM) cleantmp
112+ @tests=""; \
113+ for X in $(TEST_SCRIPTS); \
114+ do \
115+ if [ ! -e lastrun/$$X.sl ] || [ $$X.sl -nt lastrun/$$X.sl ] ; \
116+ then \
117+ tests="$$tests $$X.sl"; \
118+ fi \
119+ done; \
120+ for X in $(TEST_SCRIPTS_SLC); \
121+ do \
122+ if [ ! -e lastrun/$$X.slc ] || [ $$X.sl -nt lastrun/$$X.slc ] ; \
123+ then \
124+ tests="$$tests $$X.slc"; \
125+ fi \
126+ done; \
127+ if test -n "$$tests"; \
128+ then \
129+ MAKERUNNING=1 ./runtests.sh $$tests; \
130+ fi
131+# @touch $(TEST_PGM).c
132+
133+memcheck_runtests: $(TEST_PGM) cleantmp
134+ @echo ""
135+ @echo "Running tests:"
136+ @echo ""
137+ -@for X in $(TEST_SCRIPTS); \
138+ do \
139+ $(MEMCHECK) --log-file=log.$${X} $(RUN_TEST_PGM) $$X.sl; \
140+ grep ERROR log.$${X}; grep 'lost: [^0]' log.$${X}; \
141+ $(MEMCHECK) --log-file=log.$${X}_u $(RUN_TEST_PGM) -utf8 $$X.sl; \
142+ grep ERROR log.$${X}_u; grep 'lost: [^0]' log.$${X}_u; \
143+ done
144+# touch $(TEST_PGM).c
145+
146+memcheck_runtests_slc: $(TEST_PGM) cleantmp
147+ @echo ""
148+ @echo "Running tests:"
149+ @echo ""
150+ -@for X in $(TEST_SCRIPTS_SLC); \
151+ do \
152+ $(MEMCHECK) --log-file=log.$${X}_c $(RUN_TEST_PGM) $$X.slc; \
153+ $(MEMCHECK) --log-file=log.$${X}_uc $(RUN_TEST_PGM) -utf8 $$X.slc; \
154+ done
155+# touch $(TEST_PGM).c
156+
157+memcheck: memcheck_runtests memcheck_runtests_slc
158+
159+$(TEST_PGM): $(TEST_PGM).c assoc.c list.c $(SLANGLIB)/libslang.a
160+ $(CC) $(CFLAGS) $(OTHER_CFLAGS) $(LDFLAGS) $(TEST_PGM).c -o $(TEST_PGM) -I$(SLANGINC) -L$(SLANGLIB) -lslang $(OTHER_LIBS)
161+cleantmp:
162+ -/bin/rm -rf tmpfile*.* tmpdir*.*
163+clean: cleantmp
164+ -/bin/rm -f *~ *.o *.log log.pid* *.slc log.* *.log-*
165+distclean: clean
166+ /bin/rm -f $(TEST_PGM) $(TEST_PGM).gcda $(TEST_PGM).gcno
167+.PHONY: clean memcheck runtests memcheck_runtests_slc memcheck_runtests cleantmp
168+