-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
229 lines (198 loc) · 7.25 KB
/
configure.in
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
dnl***************************************************************************
dnl Copyright 2017-2023,2024 Thomas E. Dickey *
dnl Copyright 2007-2015,2017 Free Software Foundation, Inc. *
dnl *
dnl Permission is hereby granted, free of charge, to any person obtaining a *
dnl copy of this software and associated documentation files (the *
dnl "Software"), to deal in the Software without restriction, including *
dnl without limitation the rights to use, copy, modify, merge, publish, *
dnl distribute, distribute with modifications, sublicense, and/or sell *
dnl copies of the Software, and to permit persons to whom the Software is *
dnl furnished to do so, subject to the following conditions: *
dnl *
dnl The above copyright notice and this permission notice shall be included *
dnl in all copies or substantial portions of the Software. *
dnl *
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
dnl *
dnl Except as contained in this notice, the name(s) of the above copyright *
dnl holders shall not be used in advertising or otherwise to promote the *
dnl sale, use or other dealings in this Software without prior written *
dnl authorization. *
dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 2007-on
dnl
dnl $Id: configure.in,v 1.49 2024/05/01 21:41:32 tom Exp $
dnl This is a simple configuration-script for tack which makes it simpler to
dnl build outside the ncurses tree (provided that ncurses was configured using
dnl the --with-ticlib option).
dnl
dnl See http://invisible-island.net/autoconf/ for additional information.
dnl ---------------------------------------------------------------------------
AC_PREREQ(2.52.20230114)
AC_INIT(tack.c)
AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
AC_DEFUN([CF_PDCURSES_X11],[
AC_MSG_ERROR(tack cannot be built with PDCurses)
])dnl
CF_INHERIT_SCRIPT(config.guess)
CF_INHERIT_SCRIPT(config.sub)
CF_CHECK_CACHE
AC_ARG_PROGRAM
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
CF_WITHOUT_X
CF_PROG_INSTALL
CF_PROG_LINT
CF_MAKEFLAGS
CF_MAKE_TAGS
dnl These are standard among *NIX systems, but not when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, ':')
AC_CHECK_TOOL(LD, ld, ld)
AC_CHECK_TOOL(AR, ar, ar)
AC_CHECK_TOOL(NM, nm, nm)
CF_AR_FLAGS
dnl Things that we don't need (or must override) if we're not building ncurses
CC_G_OPT="-g" AC_SUBST(CC_G_OPT)
CC_SHARED_OPTS=unknown AC_SUBST(CC_SHARED_OPTS)
DESTDIR="" AC_SUBST(DESTDIR)
DFT_DEP_SUFFIX="" AC_SUBST(DFT_DEP_SUFFIX)
DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'` AC_SUBST(DFT_OBJ_SUBDIR)
DFT_LWR_MODEL="normal" AC_SUBST(DFT_LWR_MODEL)
DFT_UPR_MODEL="NORMAL" AC_SUBST(DFT_UPR_MODEL)
EXTRA_LDFLAGS="" AC_SUBST(EXTRA_LDFLAGS)
LDFLAGS_SHARED="" AC_SUBST(LDFLAGS_SHARED)
LD_MODEL="" AC_SUBST(LD_MODEL)
LD_SHARED_OPTS="" AC_SUBST(LD_SHARED_OPTS)
LIBTOOL="" AC_SUBST(LIBTOOL)
LIB_CLEAN="" AC_SUBST(LIB_CLEAN)
LIB_COMPILE="" AC_SUBST(LIB_COMPILE)
LIB_INSTALL="" AC_SUBST(LIB_INSTALL)
LIB_LINK='$(CC)' AC_SUBST(LIB_LINK)
LIB_SUFFIX="" AC_SUBST(LIB_SUFFIX)
LIB_UNINSTALL="" AC_SUBST(LIB_UNINSTALL)
LINK_PROGS="" AC_SUBST(LINK_PROGS)
LOCAL_LDFLAGS="" AC_SUBST(LOCAL_LDFLAGS)
TINFO_LDFLAGS="" AC_SUBST(TINFO_LDFLAGS)
TINFO_LIBS="" AC_SUBST(TINFO_LIBS)
cf_cv_abi_version="" AC_SUBST(cf_cv_abi_version)
cf_cv_rel_version="" AC_SUBST(cf_cv_rel_version)
NCURSES_TREE="#"
AC_SUBST(NCURSES_TREE)
CF_TOP_BUILDDIR
cf_cv_screen=ncurses
cf_cv_libtype=
AC_EXEEXT
AC_OBJEXT
AC_SYS_LONG_FILE_NAMES
CF_WITH_LIB_PREFIX
CF_ANSI_CC_REQD
CF_DISABLE_ECHO
# ncurses uses a different symbol as of 2012/02/26 (workaround)
ECHO_LINK="$ECHO_LD"
AC_SUBST(ECHO_LINK)
CF_ENABLE_WARNINGS
CF_GCC_ATTRIBUTES
CF_XOPEN_SOURCE
AC_CHECK_DECL(exit)
### Checks for external-data
CF_LINK_DATAONLY
dnl ---------------------------------------------------------------------------
CF_PKG_CONFIG
CF_WITH_NCURSES_ETC
CF_CURSES_TERM_H
CF_CURSES_CHECK_DATA(boolnames boolfnames)
CF_CURSES_CHECK_DATA(acs_map _acs_map __acs_map acs32map, break)
# The CF_*CURSES_CONFIG stuff provides curses/ncurses, which may include tinfo.
# Check if (a) we have tinfo library and (b) if we need ncurses library too.
cf_curses_lib=$cf_cv_screen$cf_cv_libtype
cf_tinfo_lib=tinfo$cf_cv_libtype
# If we do not have and/or do not need tinfo, reset cf_tinfo_lib to empty.
AC_CHECK_FUNC(setupterm,[
case "x$LIBS" in #(vi
*$cf_tinfo_lib*) #(vi
;;
*)
AC_CHECK_LIB($cf_tinfo_lib,reset_shell_mode,
[LIBS="-l$cf_tinfo_lib $LIBS"],
[cf_tinfo_lib=''])
;;
esac
],[
AC_CHECK_LIB($cf_tinfo_lib, setupterm,
[LIBS="-l$cf_tinfo_lib $LIBS"],
[cf_tinfo_lib=''])
])
CF_DISABLE_RPATH_HACK
CF_DISABLE_LEAKS
# look for curses-related headers
AC_CHECK_HEADERS( \
term_entry.h \
)
AC_CHECK_HEADERS( \
sys/select.h \
sys/time.h \
)
AC_CHECK_FUNCS( \
exit_terminfo \
_nc_free_tinfo \
gettimeofday \
select \
)
# check if the terminfo functions use const, as done by ncurses and NetBSD
AC_MSG_CHECKING(if terminfo string parameters are const)
AC_TRY_COMPILE([
$ac_includes_default
#if defined(HAVE_TERM_H)
#include <term.h>
#elif defined(HAVE_NCURSES_TERM_H)
#include <ncurses/term.h>
#elif defined(HAVE_NCURSESW_TERM_H)
#include <ncursesw/term.h>
#else
#error no term.h found
#endif
extern char *tigetstr(const char *);
],[char *foo = tigetstr("cup"); (void) foo],[
cf_terminfo_const=yes],[
cf_terminfo_const=no])
AC_MSG_RESULT($cf_terminfo_const)
test $cf_terminfo_const = yes && AC_DEFINE(NCURSES_CONST,const,[define to const if terminfo needs it])
CF_SIG_ATOMIC_T
CF_TERMIOS_TYPES
CF_WITH_MAN2HTML
### Now that we're done running tests, add the compiler-warnings, if any
CF_ADD_CFLAGS($EXTRA_CFLAGS)
dnl ---------------------------------------------------------------------------
AC_OUTPUT(Makefile,[
cat >>Makefile <<TEST_EOF
# These rules are generated so we do not rely on suffix rules, which do not
# work consistently for different make-programs (the '\$(MODEL)/' confuses
# some, and the '\$x' confuses others).
TEST_EOF
LIST=`sed -e 's/[[ ]].*//' -e '/^[[#@]]/d' $srcdir/modules`
for N in $LIST
do
P=tack.h
test $N != tackgen && P="$P tackgen.h"
cat >>Makefile <<TEST_EOF
\$(MODEL)/$N.o : $N.c \\
$P \\
ncurses_cfg.h
$SHOW_CC
$ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) $N.c
TEST_EOF
done
],[],
[set |${FGREP-fgrep} _CC= |sed -e s%=%=\'% -e s%\$%\'% -e s%\'\'%\'%g -e s%=\'\$%=\'\'% >>$CONFIG_STATUS
cat])
# vi:ts=4 sw=4
CF_MAKE_DOCS(tack,1)