]> ncurses.scripts.mit.edu Git - ncurses.git/blob - test/configure.in
ncurses 5.7 - patch 20100724
[ncurses.git] / test / configure.in
1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
3 dnl                                                                          *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
5 dnl copy of this software and associated documentation files (the            *
6 dnl "Software"), to deal in the Software without restriction, including      *
7 dnl without limitation the rights to use, copy, modify, merge, publish,      *
8 dnl distribute, distribute with modifications, sublicense, and/or sell       *
9 dnl copies of the Software, and to permit persons to whom the Software is    *
10 dnl furnished to do so, subject to the following conditions:                 *
11 dnl                                                                          *
12 dnl The above copyright notice and this permission notice shall be included  *
13 dnl in all copies or substantial portions of the Software.                   *
14 dnl                                                                          *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 dnl                                                                          *
23 dnl Except as contained in this notice, the name(s) of the above copyright   *
24 dnl holders shall not be used in advertising or otherwise to promote the     *
25 dnl sale, use or other dealings in this Software without prior written       *
26 dnl authorization.                                                           *
27 dnl***************************************************************************
28 dnl
29 dnl Author: Thomas E. Dickey 1996, etc.
30 dnl
31 dnl $Id: configure.in,v 1.78 2010/04/03 15:43:44 tom Exp $
32 dnl This is a simple configuration-script for the ncurses test programs that
33 dnl allows the test-directory to be separately configured against a reference
34 dnl system (i.e., sysvr4 curses)
35 dnl
36 dnl If you're configuring ncurses, you shouldn't need to use this script.
37 dnl It's only for testing purposes.
38 dnl
39 dnl See http://invisible-island.net/autoconf/ for additional information.
40 dnl ---------------------------------------------------------------------------
41 AC_PREREQ(2.13.20020210)
42 AC_INIT(ncurses.c)
43 AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
44
45 CF_INHERIT_SCRIPT(config.guess)
46 CF_INHERIT_SCRIPT(config.sub)
47 CF_CHECK_CACHE
48
49 AC_PROG_MAKE_SET
50 AC_PROG_CC
51 AC_PROG_CPP
52 AC_PROG_AWK
53 CF_MAKE_TAGS
54
55 dnl Things that we don't need (or must override) if we're not building ncurses
56 CC_G_OPT="-g"                                   AC_SUBST(CC_G_OPT)
57 CC_SHARED_OPTS=unknown                  AC_SUBST(CC_SHARED_OPTS)
58 CPPFLAGS="$CPPFLAGS"                    AC_SUBST(CPPFLAGS)
59 DFT_DEP_SUFFIX=""                               AC_SUBST(DFT_DEP_SUFFIX)
60 DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'`    AC_SUBST(DFT_OBJ_SUBDIR)
61 DFT_UPR_MODEL="NORMAL"                  AC_SUBST(DFT_UPR_MODEL)
62 LD="ld"                                                 AC_SUBST(LD)
63 LDFLAGS_SHARED=""                               AC_SUBST(LDFLAGS_SHARED)
64 LDFLAGS_STATIC=""                               AC_SUBST(LDFLAGS_STATIC)
65 LD_MODEL=""                                             AC_SUBST(LD_MODEL)
66 LD_SHARED_OPTS=""                               AC_SUBST(LD_SHARED_OPTS)
67 LIBTOOL=""                                              AC_SUBST(LIBTOOL)
68 LIB_CLEAN=""                                    AC_SUBST(LIB_CLEAN)
69 LIB_COMPILE=""                                  AC_SUBST(LIB_COMPILE)
70 LIB_LINK='${CC}'                                AC_SUBST(LIB_LINK)
71 LINK_TESTS=""                                   AC_SUBST(LINK_TESTS)
72 LINT=lint                                               AC_SUBST(LINT)
73 LINT_OPTS=""                                    AC_SUBST(LINT_OPTS)
74 LOCAL_LDFLAGS=""                                AC_SUBST(LOCAL_LDFLAGS)
75 MATH_LIB="-lm"                                  AC_SUBST(MATH_LIB)
76 PTHREAD="-lm"                                   AC_SUBST(PTHREAD)
77 TEST_ARGS=""                                    AC_SUBST(TEST_ARGS)
78 TEST_DEPS=""                                    AC_SUBST(TEST_DEPS)
79 TEST_LIBS=""                                    AC_SUBST(TEST_LIBS)
80 TINFO_ARGS='$(LIBS_CURSES)'             AC_SUBST(TINFO_ARGS)
81 cf_cv_abi_version=""                    AC_SUBST(cf_cv_abi_version)
82 cf_cv_rel_version=""                    AC_SUBST(cf_cv_rel_version)
83
84 cf_cv_screen=curses
85 cf_cv_libtype=
86
87 AC_EXEEXT
88 AC_OBJEXT
89
90 CF_ANSI_CC_REQD
91 CF_GCC_ATTRIBUTES
92 CF_XOPEN_SOURCE
93 AC_C_CONST
94 CF_SIG_ATOMIC_T
95
96 CF_DISABLE_ECHO
97 CF_ENABLE_WARNINGS
98
99 CF_WITH_CURSES_DIR
100
101 dnl SunOS 4.x
102 AC_ARG_WITH(5lib,
103         [  --with-5lib             use SunOS sysv-libraries],
104         [LIBS="-L/usr/5lib $LIBS"
105          CPPFLAGS="$CPPFLAGS -I/usr/5include"])
106
107 dnl ---------------------------------------------------------------------------
108 dnl NcursesW, installed in conventional location
109 AC_ARG_WITH(ncursesw,
110         [  --with-ncursesw         use wide ncurses-libraries (installed)],
111         [cf_cv_screen=ncursesw],[
112
113 dnl Ncurses, installed in conventional location
114 AC_ARG_WITH(ncurses,
115         [  --with-ncurses          use ncurses-libraries (installed)],
116         [cf_cv_screen=ncurses],[
117
118 AC_ARG_WITH(pdcurses,
119         [  --with-pdcurses         compile/link with pdcurses X11 library],
120         [cf_cv_screen=pdcurses])])])
121
122 case $cf_cv_screen in
123 curses)
124         CF_CURSES_CONFIG
125         ;;
126 ncurses)
127         CF_NCURSES_CONFIG
128         ;;
129 ncursesw)
130         cf_cv_libtype=w
131         CF_UTF8_LIB
132         CF_NCURSES_CONFIG(ncursesw)
133         ;;
134 pdcurses) #(vi
135         CF_PDCURSES_X11
136         ;;
137 esac
138
139 dnl If we've not specified a library, assume we're using sysvr4 libraries
140 dnl installed conventionally (e.g., SunOS 5.x - solaris).
141
142 dnl Autoconf builds up the $LIBS in reverse order
143
144 case $cf_cv_screen in #(vi
145 pdcurses) #(vi
146         ;;
147 *)
148         # look for curses-related libraries
149         AC_CHECK_LIB(panel$cf_cv_libtype,new_panel)
150         AC_CHECK_LIB(menu$cf_cv_libtype,menu_driver)
151         AC_CHECK_LIB(form$cf_cv_libtype,form_driver)
152
153         # look for curses-related headers
154         AC_CHECK_HEADERS( \
155                 nc_alloc.h \
156                 nomacros.h \
157                 form.h \
158                 menu.h \
159                 panel.h \
160                 )
161         ;;
162 esac
163
164 AC_TYPE_SIGNAL
165
166 AC_STDC_HEADERS
167 AC_HEADER_TIME
168 AC_CHECK_HEADERS( \
169 getopt.h \
170 locale.h \
171 stdarg.h \
172 sys/ioctl.h \
173 sys/select.h \
174 sys/time.h \
175 termios.h \
176 unistd.h \
177 )
178
179 AC_CHECK_FUNCS( \
180 gettimeofday \
181 mblen \
182 mbrlen \
183 mbrtowc \
184 mbsrtowcs \
185 mbstowcs \
186 mbtowc \
187 strdup \
188 wcsrtombs \
189 wcstombs \
190 )
191
192 CF_CURSES_FUNCS( \
193 chgat \
194 color_set \
195 filter \
196 getbegx \
197 getcurx \
198 getmaxx \
199 getnstr \
200 getparx \
201 getwin \
202 mvvline \
203 mvwvline \
204 napms \
205 putwin \
206 resize_term \
207 resizeterm \
208 ripoffline \
209 setupterm \
210 slk_color \
211 slk_init \
212 termattrs \
213 tgetent \
214 tigetnum \
215 tigetstr \
216 typeahead \
217 use_default_colors \
218 vw_printw \
219 vsscanf \
220 wchgat \
221 winsstr \
222 wresize \
223 )
224
225 CF_NCURSES_EXT_FUNCS
226
227 AC_CACHE_CHECK(for wide-character functions,cf_cv_widechar_funcs,[
228 AC_TRY_LINK([
229 #include <${cf_cv_ncurses_header-curses.h}>],
230 [
231         static wchar_t src_wchar[2];
232         static cchar_t dst_cchar;
233         setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0);
234         ],
235         [cf_cv_widechar_funcs=yes],
236         [cf_cv_widechar_funcs=no])
237 ])
238 if test "$cf_cv_widechar_funcs" != no ; then
239         AC_DEFINE(USE_WIDEC_SUPPORT,1)
240 else
241         AC_DEFINE(USE_WIDEC_SUPPORT,0)
242 fi
243
244 AC_FUNC_VFORK
245 CF_SYS_TIME_SELECT
246 CF_FUNC_CURSES_VERSION
247 CF_CURSES_ACS_MAP
248 CF_CURSES_WACS_MAP
249
250 CF_CURSES_CHECK_TYPE(attr_t,long)
251
252 CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T, NCURSES_OK_MBSTATE_T)
253 CF_WCHAR_TYPE(wchar_t,   NCURSES_WCHAR_T,   NCURSES_OK_WCHAR_T)
254 CF_WCHAR_TYPE(wint_t,    NCURSES_WINT_T,    NCURSES_OK_WINT_T)
255
256 if test "$NCURSES_OK_MBSTATE_T" = 0 ; then
257         CF_CURSES_CHECK_TYPE(mbstate_t,long)
258 fi
259
260 if test "$NCURSES_OK_WCHAR_T" = 0 ; then
261         CF_CURSES_CHECK_TYPE(wchar_t,long)
262 fi
263
264 if test "$NCURSES_OK_WINT_T" = 0 ; then
265         CF_CURSES_CHECK_TYPE(wint_t,long)
266 fi
267
268 CF_CURSES_CHECK_DATA(boolnames)
269 CF_CURSES_CHECK_DATA(boolfnames)
270
271 TEST_ARGS="$LIBS"
272 LIBS=
273
274 dnl ---------------------------------------------------------------------------
275
276 AC_OUTPUT(Makefile,[
277 CF_PRG_RULES([$srcdir/mk-test.awk ECHO_LINK="$ECHO_LD"], .)
278         cat >>Makefile <<TEST_EOF
279
280 # These rules are generated so we do not rely on suffix rules, which do not
281 # work consistently for different make-programs (the '\$(MODEL)/' confuses
282 # some, and the '\$x' confuses others).
283 TEST_EOF
284 LIST=`sed -e 's/[[      ]].*//' -e '/^[[#@]]/d' $srcdir/modules`
285 for N in $LIST
286 do
287         cat >>Makefile <<TEST_EOF
288
289 \$(MODEL)/$N.o : $N.c \\
290         test.priv.h \\
291         ncurses_cfg.h
292         @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
293 TEST_EOF
294 done
295 ],[
296 AWK="$AWK"
297 ECHO_LD="$ECHO_LD"
298 ],cat)