]> ncurses.scripts.mit.edu Git - ncurses.git/blob - test/configure.in
d963022c0bfd9fa3fcafb715d3b0ea910b3e1831
[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.27 1999/10/23 20:01:42 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 curses_version \
133 gettimeofday \
134 napms \
135 resizeterm \
136 strdup \
137 vsscanf \
138 )
139
140 dnl ---------------------------------------------------------------------------
141 dnl [CF_SYS_TIME_SELECT]
142 AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h)
143 AC_CACHE_VAL(cf_cv_sys_time_select,[
144 AC_TRY_COMPILE([
145 #if HAVE_SYS_TIME_H
146 #include <sys/time.h>
147 #endif
148 #if HAVE_SYS_SELECT_H
149 #include <sys/select.h>
150 #endif
151 ],[],[cf_cv_sys_time_select=yes],
152      [cf_cv_sys_time_select=no])
153      ])
154 AC_MSG_RESULT($cf_cv_sys_time_select)
155 test $cf_cv_sys_time_select = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
156 dnl ---------------------------------------------------------------------------
157
158 AC_OUTPUT(Makefile,[
159         cat >>Makefile <<TEST_EOF
160
161 # These rules are generated so we do not rely on suffix rules, which do not
162 # work consistently for different make-programs (the '\$(MODEL)/' confuses
163 # some, and the '\$x' confuses others).
164 TEST_EOF
165 LIST=`make echo_tests`
166 LAST=`make echo_suffix`
167 for n in $LIST
168 do
169         N=`echo $n | sed -e s/${LAST}\$//`
170         cat >>Makefile <<TEST_EOF
171
172 \$(MODEL)/$N.o : $N.c \\
173         test.priv.h \\
174         ncurses_cfg.h
175         @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
176 TEST_EOF
177 done
178 ],[],sort)