1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2000,2002 Free Software Foundation, Inc. *
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: *
12 dnl The above copyright notice and this permission notice shall be included *
13 dnl in all copies or substantial portions of the Software. *
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. *
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 *
27 dnl***************************************************************************
29 dnl Author: Thomas E. Dickey 1996, etc.
31 dnl $Id: configure.in,v 1.36 2002/09/07 16:55:23 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)
36 dnl If you're configuring ncurses, you shouldn't need to use this script.
37 dnl It's only for testing purposes.
39 dnl See http://invisible-island.net/autoconf/ for additional information.
40 dnl ---------------------------------------------------------------------------
41 AC_PREREQ(2.13.20000819)
43 AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
47 dnl Things that we don't need (or must override) if we're not building ncurses
48 CC_G_OPT="-g" AC_SUBST(CC_G_OPT)
49 CC_SHARED_OPTS=unknown AC_SUBST(CC_SHARED_OPTS)
50 CPPFLAGS="$CPPFLAGS" AC_SUBST(CPPFLAGS)
51 DFT_DEP_SUFFIX="" AC_SUBST(DFT_DEP_SUFFIX)
52 DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'` AC_SUBST(DFT_OBJ_SUBDIR)
53 DFT_UPR_MODEL="NORMAL" AC_SUBST(DFT_UPR_MODEL)
54 ECHO_LINK='@ echo linking $@ ... ;' AC_SUBST(ECHO_LINK)
55 EXTRA_LIBS="" AC_SUBST(EXTRA_LIBS)
57 LDFLAGS_SHARED="" AC_SUBST(LDFLAGS_SHARED)
58 LD_MODEL="" AC_SUBST(LD_MODEL)
59 LD_SHARED_OPTS="" AC_SUBST(LD_SHARED_OPTS)
60 LIBTOOL="" AC_SUBST(LIBTOOL)
61 LIB_NAME=curses AC_SUBST(LIB_NAME)
62 LIB_PREFIX="-l" AC_SUBST(LIB_PREFIX)
63 LINK_TESTS="" AC_SUBST(LINK_TESTS)
64 LINT=lint AC_SUBST(LINT)
65 LINT_OPTS="" AC_SUBST(LINT_OPTS)
66 LOCAL_LDFLAGS="" AC_SUBST(LOCAL_LDFLAGS)
67 MATH_LIB="-lm" AC_SUBST(MATH_LIB)
68 PROG_EXT="" AC_SUBST(PROG_EXT)
69 TEST_ARGS="" AC_SUBST(TEST_ARGS)
70 TEST_DEPS="" AC_SUBST(TEST_DEPS)
71 cf_cv_abi_version="" AC_SUBST(cf_cv_abi_version)
72 cf_cv_rel_version="" AC_SUBST(cf_cv_rel_version)
76 [ --with-5lib use SunOS sysv-libraries],
77 [LIBS="-L/usr/5lib $LIBS"
78 CPPFLAGS="$CPPFLAGS -I/usr/5include"])
80 dnl ---------------------------------------------------------------------------
82 AC_DEFUN([CF_LIBUTF8],
84 AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
88 #include <libutf8.h>],[putwc(0,0);],
94 if test "$cf_cv_libutf8" = yes ; then
95 AC_DEFINE(HAVE_LIBUTF8_H)
100 dnl ---------------------------------------------------------------------------
101 dnl NcursesW, installed in conventional location
102 AC_ARG_WITH(ncursesw,
103 [ --with-ncursesw use wide ncurses-libraries (installed)],
105 AC_DEFINE(_GNU_SOURCE)
106 AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
107 AC_CHECK_FUNC(initscr,,[
108 AC_CHECK_LIB(gpm,Gpm_Open)
110 AC_CHECK_FUNC(putwc,,[CF_LIBUTF8])
111 for p in $HOME /usr/local /usr
113 if test -f $p/include/ncursesw/curses.h
115 CPPFLAGS="$CPPFLAGS -I$p/include/ncursesw"
116 test $p != /usr && CPPFLAGS="$CPPFLAGS -I$p/include"
117 test $p != /usr && LIBS="-L$p/lib $LIBS"
121 if test -f $p/include/curses.h
123 CPPFLAGS="$CPPFLAGS -I$p/include"
124 LIBS="-L$p/lib $LIBS"
129 ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])])
131 dnl Ncurses, installed in conventional location
133 [ --with-ncurses use ncurses-libraries (installed)],
134 [AC_CHECK_FUNC(initscr,,[
135 AC_CHECK_LIB(gpm,Gpm_Open)
137 for p in $HOME /usr/local /usr
139 if test -f $p/include/ncurses/curses.h
141 CPPFLAGS="$CPPFLAGS -I$p/include/ncurses"
142 test $p != /usr && CPPFLAGS="$CPPFLAGS -I$p/include"
143 test $p != /usr && LIBS="-L$p/lib $LIBS"
147 if test -f $p/include/curses.h
149 CPPFLAGS="$CPPFLAGS -I$p/include"
150 LIBS="-L$p/lib $LIBS"
155 ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])])
157 dnl If we've not specified a library, assume we're using sysvr4 libraries
158 dnl installed conventionally (e.g., SunOS 5.x - solaris).
160 dnl Autoconf builds up the $LIBS in reverse order
162 AC_CHECK_FUNC(initscr,,[
163 AC_CHECK_LIB($LIB_NAME,initscr)])
164 AC_CHECK_LIB(form,form_driver)
165 AC_CHECK_LIB(menu,menu_driver)
166 AC_CHECK_LIB(panel,new_panel)
199 dnl ---------------------------------------------------------------------------
200 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
201 dnl It's a character string "SVR4", not documented.
202 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
208 sprintf(temp, "%s\n", curses_version());
211 ,[cf_cv_func_curses_version=yes]
212 ,[cf_cv_func_curses_version=no]
213 ,[cf_cv_func_curses_version=unknown])
215 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
217 dnl ---------------------------------------------------------------------------
218 dnl Check for likely values of acs_map[]:
219 AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
220 cf_cv_curses_acs_map=unknown
221 for name in acs_map _acs_map __acs_map _nc_acs_map
226 $name['k'] = ACS_PLUS
227 ],[cf_cv_curses_acs_map=$name; break])
231 test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
233 dnl ---------------------------------------------------------------------------
234 dnl Check for likely values of wacs_map[]:
235 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
236 cf_cv_curses_wacs_map=unknown
237 for name in wacs_map _wacs_map __wacs_map _nc_wacs
240 #ifndef _XOPEN_SOURCE_EXTENDED
241 #define _XOPEN_SOURCE_EXTENDED
245 $name['k'] = *WACS_PLUS
246 ],[cf_cv_curses_wacs_map=$name; break])
250 test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map)
252 dnl ---------------------------------------------------------------------------
253 dnl Make an uppercase version of a variable
257 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
260 dnl ---------------------------------------------------------------------------
261 dnl Check if curses.h defines the given type
262 AC_DEFUN([CF_CURSES_TYPE],
264 AC_MSG_CHECKING(for type $1 in curses.h)
266 #ifndef _XOPEN_SOURCE_EXTENDED
267 #define _XOPEN_SOURCE_EXTENDED
269 #include <curses.h>],[
271 ],cf_result=yes,cf_result=no)
272 AC_MSG_RESULT($cf_result)
273 if test $cf_result = yes ; then
274 CF_UPPER(cf_result,have_type_$1)
275 AC_DEFINE_UNQUOTED($cf_result)
277 AC_DEFINE_UNQUOTED($1,$2)
281 CF_CURSES_TYPE(attr_t,long)
282 CF_CURSES_TYPE(mbstate_t,long)
284 dnl ---------------------------------------------------------------------------
285 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
286 dnl older SCO configurations.
287 dnl [CF_SYS_TIME_SELECT]
289 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
290 AC_CACHE_VAL(cf_cv_sys_time_select,[
292 #include <sys/types.h>
293 #ifdef HAVE_SYS_TIME_H
294 #include <sys/time.h>
296 #ifdef HAVE_SYS_SELECT_H
297 #include <sys/select.h>
299 ],[],[cf_cv_sys_time_select=yes],
300 [cf_cv_sys_time_select=no])
302 AC_MSG_RESULT($cf_cv_sys_time_select)
303 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
305 dnl ---------------------------------------------------------------------------
308 cat >>Makefile <<TEST_EOF
310 # These rules are generated so we do not rely on suffix rules, which do not
311 # work consistently for different make-programs (the '\$(MODEL)/' confuses
312 # some, and the '\$x' confuses others).
314 LIST=`make echo_tests`
315 LAST=`make echo_suffix`
318 N=`echo $n | sed -e s/${LAST}\$//`
319 cat >>Makefile <<TEST_EOF
321 \$(MODEL)/$N.o : $N.c \\
324 @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c