]> ncurses.scripts.mit.edu Git - ncurses.git/blob - test/configure.in
d61d477d691c71934f84b68e480dbd06fe074a69
[ncurses.git] / test / configure.in
1 dnl***************************************************************************
2 dnl Copyright (c) 1998,1999,2000 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,1997,1998,2000
30 dnl
31 dnl $Id: configure.in,v 1.31 2000/10/15 18:46:17 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://dickey.his.com/autoconf/ for additional information.
40 dnl ---------------------------------------------------------------------------
41 AC_PREREQ(2.13.20000819)
42 AC_INIT(ncurses.c)
43 AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
44
45 AC_PROG_CC
46
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)
56 LD="ld"                                 AC_SUBST(LD)
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)
73
74 dnl SunOS 4.x
75 AC_ARG_WITH(5lib,
76         [  --with-5lib             use SunOS sysv-libraries],
77         [LIBS="-L/usr/5lib $LIBS"
78          CPPFLAGS="$CPPFLAGS -I/usr/5include"])
79
80 dnl Ncurses, installed in conventional location
81 AC_ARG_WITH(ncurses,
82         [  --with-ncurses          use ncurses-libraries (installed)],
83         [AC_CHECK_FUNC(initscr,,[
84          AC_CHECK_LIB(gpm,Gpm_Open)
85          LIB_NAME=ncurses
86          for p in $HOME /usr/local /usr
87          do
88                 if test -f $p/include/ncurses/curses.h
89                 then
90                         CPPFLAGS="$CPPFLAGS -I$p/include/ncurses"
91                         test $p != /usr && CPPFLAGS="$CPPFLAGS -I$p/include"
92                         test $p != /usr && LIBS="-L$p/lib $LIBS"
93                         break
94                 elif test $p != /usr
95                 then
96                         if test -f $p/include/curses.h
97                         then
98                                 CPPFLAGS="$CPPFLAGS -I$p/include"
99                                 LIBS="-L$p/lib $LIBS"
100                                 break
101                         fi
102                 fi
103          done
104         ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])])
105
106 dnl If we've not specified a library, assume we're using sysvr4 libraries
107 dnl installed conventionally (e.g., SunOS 5.x - solaris).
108
109 dnl Autoconf builds up the $LIBS in reverse order
110
111 AC_CHECK_FUNC(initscr,,[
112 AC_CHECK_LIB($LIB_NAME,initscr)])
113 AC_CHECK_LIB(form,form_driver)
114 AC_CHECK_LIB(menu,menu_driver)
115 AC_CHECK_LIB(panel,new_panel)
116
117 AC_TYPE_SIGNAL
118
119 AC_STDC_HEADERS
120 AC_HEADER_TIME
121 AC_CHECK_HEADERS( \
122 form.h \
123 getopt.h \
124 menu.h \
125 nc_alloc.h \
126 panel.h \
127 sys/ioctl.h \
128 sys/select.h \
129 sys/time.h \
130 termios.h \
131 unistd.h \
132 )
133
134 AC_CHECK_FUNCS( \
135 gettimeofday \
136 napms \
137 resizeterm \
138 strdup \
139 use_default_colors \
140 vsscanf \
141 wresize \
142 )
143
144 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
145 dnl It's a character string "SVR4", not documented.
146 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
147 AC_TRY_RUN([
148 #include <curses.h>
149 int main()
150 {
151         char temp[1024];
152         sprintf(temp, "%s\n", curses_version());
153         exit(0);
154 }]
155 ,[cf_cv_func_curses_version=yes]
156 ,[cf_cv_func_curses_version=no]
157 ,[cf_cv_func_curses_version=unknown])
158 rm -f core])
159 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
160
161 dnl ---------------------------------------------------------------------------
162 dnl [CF_SYS_TIME_SELECT]
163 AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h)
164 AC_CACHE_VAL(cf_cv_sys_time_select,[
165 AC_TRY_COMPILE([
166 #if HAVE_SYS_TIME_H
167 #include <sys/time.h>
168 #endif
169 #if HAVE_SYS_SELECT_H
170 #include <sys/select.h>
171 #endif
172 ],[],[cf_cv_sys_time_select=yes],
173      [cf_cv_sys_time_select=no])
174      ])
175 AC_MSG_RESULT($cf_cv_sys_time_select)
176 test $cf_cv_sys_time_select = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
177 dnl ---------------------------------------------------------------------------
178
179 AC_OUTPUT(Makefile,[
180         cat >>Makefile <<TEST_EOF
181
182 # These rules are generated so we do not rely on suffix rules, which do not
183 # work consistently for different make-programs (the '\$(MODEL)/' confuses
184 # some, and the '\$x' confuses others).
185 TEST_EOF
186 LIST=`make echo_tests`
187 LAST=`make echo_suffix`
188 for n in $LIST
189 do
190         N=`echo $n | sed -e s/${LAST}\$//`
191         cat >>Makefile <<TEST_EOF
192
193 \$(MODEL)/$N.o : $N.c \\
194         test.priv.h \\
195         ncurses_cfg.h
196         @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
197 TEST_EOF
198 done
199 ],[],sort)