ncurses 5.1
[ncurses.git] / test / configure.in
1 dnl***************************************************************************
2 dnl Copyright (c) 1998,1999 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 <dickey@clark.net> 1996,1997,1998
30 dnl
31 dnl $Id: configure.in,v 1.29 1999/12/19 03:12:13 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 dickey@clark.net (Thomas Dickey)
40 AC_PREREQ(2.12)
41 AC_INIT(ncurses.c)
42 AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
43
44 AC_PROG_CC
45
46 dnl Things that we don't need (or must override) if we're not building ncurses
47 CC_G_OPT="-g"                           AC_SUBST(CC_G_OPT)
48 CC_SHARED_OPTS=unknown                  AC_SUBST(CC_SHARED_OPTS)
49 CPPFLAGS="$CPPFLAGS"                    AC_SUBST(CPPFLAGS)
50 DFT_DEP_SUFFIX=""                       AC_SUBST(DFT_DEP_SUFFIX)
51 DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'`    AC_SUBST(DFT_OBJ_SUBDIR)
52 DFT_UPR_MODEL="NORMAL"                  AC_SUBST(DFT_UPR_MODEL)
53 ECHO_LINK='@ echo linking $@ ... ;'     AC_SUBST(ECHO_LINK)
54 EXTRA_LIBS=""                           AC_SUBST(EXTRA_LIBS)
55 LD="ld"                                 AC_SUBST(LD)
56 LDFLAGS_SHARED=""                       AC_SUBST(LDFLAGS_SHARED)
57 LD_MODEL=""                             AC_SUBST(LD_MODEL)
58 LD_SHARED_OPTS=""                       AC_SUBST(LD_SHARED_OPTS)
59 LIB_NAME=curses                         AC_SUBST(LIB_NAME)
60 LIB_PREFIX="-l"                         AC_SUBST(LIB_PREFIX)
61 LINK_TESTS=""                           AC_SUBST(LINK_TESTS)
62 LINT=lint                               AC_SUBST(LINT)
63 LINT_OPTS=""                            AC_SUBST(LINT_OPTS)
64 LOCAL_LDFLAGS=""                        AC_SUBST(LOCAL_LDFLAGS)
65 MATH_LIB="-lm"                          AC_SUBST(MATH_LIB)
66 PROG_EXT=""                             AC_SUBST(PROG_EXT)
67 TEST_ARGS=""                            AC_SUBST(TEST_ARGS)
68 TEST_DEPS=""                            AC_SUBST(TEST_DEPS)
69 cf_cv_abi_version=""                    AC_SUBST(cf_cv_abi_version)
70 cf_cv_rel_version=""                    AC_SUBST(cf_cv_rel_version)
71
72 dnl SunOS 4.x
73 AC_ARG_WITH(5lib,
74         [  --with-5lib             use SunOS sysv-libraries],
75         [LIBS="-L/usr/5lib $LIBS"
76          CPPFLAGS="$CPPFLAGS -I/usr/5include"])
77
78 dnl Ncurses, installed in conventional location
79 AC_ARG_WITH(ncurses,
80         [  --with-ncurses          use ncurses-libraries (installed)],
81         [AC_CHECK_FUNC(initscr,,[
82          AC_CHECK_LIB(gpm,Gpm_Open)
83          LIB_NAME=ncurses
84          for p in $HOME /usr/local /usr
85          do
86                 if test -f $p/include/ncurses/curses.h
87                 then
88                         CPPFLAGS="$CPPFLAGS -I$p/include/ncurses"
89                         test $p != /usr && LIBS="-L$p/lib $LIBS"
90                         break
91                 elif test $p != /usr
92                 then
93                         if test -f $p/include/curses.h
94                         then
95                                 CPPFLAGS="$CPPFLAGS -I$p/include"
96                                 LIBS="-L$p/lib $LIBS"
97                                 break
98                         fi
99                 fi
100          done
101         ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])])
102
103 dnl If we've not specified a library, assume we're using sysvr4 libraries
104 dnl installed conventionally (e.g., SunOS 5.x - solaris).
105
106 dnl Autoconf builds up the $LIBS in reverse order
107
108 AC_CHECK_FUNC(initscr,,[
109 AC_CHECK_LIB($LIB_NAME,initscr)])
110 AC_CHECK_LIB(form,form_driver)
111 AC_CHECK_LIB(menu,menu_driver)
112 AC_CHECK_LIB(panel,new_panel)
113
114 AC_TYPE_SIGNAL
115
116 AC_STDC_HEADERS
117 AC_HEADER_TIME
118 AC_CHECK_HEADERS( \
119 form.h \
120 getopt.h \
121 menu.h \
122 nc_alloc.h \
123 panel.h \
124 sys/ioctl.h \
125 sys/select.h \
126 sys/time.h \
127 termios.h \
128 unistd.h \
129 )
130
131 AC_CHECK_FUNCS( \
132 gettimeofday \
133 napms \
134 resizeterm \
135 strdup \
136 use_default_colors \
137 vsscanf \
138 wresize \
139 )
140
141 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
142 dnl It's a character string "SVR4", not documented.
143 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
144 AC_TRY_RUN([
145 #include <curses.h>
146 int main()
147 {
148         char temp[1024];
149         sprintf(temp, "%s\n", curses_version());
150         exit(0);
151 }]
152 ,[cf_cv_func_curses_version=yes]
153 ,[cf_cv_func_curses_version=no]
154 ,[cf_cv_func_curses_version=unknown])
155 rm -f core])
156 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
157
158 dnl ---------------------------------------------------------------------------
159 dnl [CF_SYS_TIME_SELECT]
160 AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h)
161 AC_CACHE_VAL(cf_cv_sys_time_select,[
162 AC_TRY_COMPILE([
163 #if HAVE_SYS_TIME_H
164 #include <sys/time.h>
165 #endif
166 #if HAVE_SYS_SELECT_H
167 #include <sys/select.h>
168 #endif
169 ],[],[cf_cv_sys_time_select=yes],
170      [cf_cv_sys_time_select=no])
171      ])
172 AC_MSG_RESULT($cf_cv_sys_time_select)
173 test $cf_cv_sys_time_select = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
174 dnl ---------------------------------------------------------------------------
175
176 AC_OUTPUT(Makefile,[
177         cat >>Makefile <<TEST_EOF
178
179 # These rules are generated so we do not rely on suffix rules, which do not
180 # work consistently for different make-programs (the '\$(MODEL)/' confuses
181 # some, and the '\$x' confuses others).
182 TEST_EOF
183 LIST=`make echo_tests`
184 LAST=`make echo_suffix`
185 for n in $LIST
186 do
187         N=`echo $n | sed -e s/${LAST}\$//`
188         cat >>Makefile <<TEST_EOF
189
190 \$(MODEL)/$N.o : $N.c \\
191         test.priv.h \\
192         ncurses_cfg.h
193         @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
194 TEST_EOF
195 done
196 ],[],sort)