a3eed7445362a8eff85e0e3baff9b9b6922c9d7e
[ncurses.git] / test / configure.in
1 dnl***************************************************************************
2 dnl Copyright (c) 1998 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.23 1998/02/11 12:14:05 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 LD_MODEL=""                             AC_SUBST(LD_MODEL)
57 LDFLAGS_SHARED=""                       AC_SUBST(LDFLAGS_SHARED)
58 LIB_NAME=curses                         AC_SUBST(LIB_NAME)
59 LIB_PREFIX="-l"                         AC_SUBST(LIB_PREFIX)
60 LINT=lint                               AC_SUBST(LINT)
61 LINT_OPTS=""                            AC_SUBST(LINT_OPTS)
62 LOCAL_LDFLAGS=""                        AC_SUBST(LOCAL_LDFLAGS)
63 MATH_LIB="-lm"                          AC_SUBST(MATH_LIB)
64 PROG_EXT=""                             AC_SUBST(PROG_EXT)
65 TEST_ARGS=""                            AC_SUBST(TEST_ARGS)
66 TEST_DEPS=""                            AC_SUBST(TEST_DEPS)
67 cf_cv_abi_version=""                    AC_SUBST(cf_cv_abi_version)
68 cf_cv_rel_version=""                    AC_SUBST(cf_cv_rel_version)
69
70 dnl SunOS 4.x
71 AC_ARG_WITH(5lib,
72         [  --with-5lib             use SunOS sysv-libraries],
73         [LIBS="-L/usr/5lib $LIBS"
74          CPPFLAGS="$CPPFLAGS -I/usr/5include"])
75
76 dnl Ncurses, installed in conventional location
77 AC_ARG_WITH(ncurses,
78         [  --with-ncurses          use ncurses-libraries (installed)],
79         [AC_CHECK_FUNC(initscr,,[
80          AC_CHECK_LIB(gpm,Gpm_Open)
81          LIB_NAME=ncurses
82          for p in $HOME /usr/local /usr
83          do
84                 if test -f $p/include/ncurses/curses.h
85                 then
86                         CPPFLAGS="$CPPFLAGS -I$p/include/ncurses"
87                         test $p != /usr && LIBS="-L$p/lib $LIBS"
88                         break
89                 elif test $p != /usr
90                 then
91                         if test -f $p/include/curses.h
92                         then
93                                 CPPFLAGS="$CPPFLAGS -I$p/include"
94                                 LIBS="-L$p/lib $LIBS"
95                                 break
96                         fi
97                 fi
98          done
99         ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])])
100
101 dnl If we've not specified a library, assume we're using sysvr4 libraries
102 dnl installed conventionally (e.g., SunOS 5.x - solaris).
103
104 dnl Autoconf builds up the $LIBS in reverse order
105
106 AC_CHECK_FUNC(initscr,,[
107 AC_CHECK_LIB($LIB_NAME,initscr)])
108 AC_CHECK_LIB(form,form_driver)
109 AC_CHECK_LIB(menu,menu_driver)
110 AC_CHECK_LIB(panel,new_panel)
111
112 AC_TYPE_SIGNAL
113
114 AC_STDC_HEADERS
115 AC_HEADER_TIME
116 AC_CHECK_HEADERS( \
117 form.h \
118 getopt.h \
119 menu.h \
120 nc_alloc.h \
121 panel.h \
122 sys/ioctl.h \
123 sys/select.h \
124 sys/time.h \
125 termios.h \
126 unistd.h \
127 )
128
129 AC_CHECK_FUNCS( \
130 gettimeofday \
131 napms \
132 resizeterm \
133 strdup \
134 vsscanf \
135 )
136
137 dnl ---------------------------------------------------------------------------
138 dnl [CF_SYS_TIME_SELECT]
139 AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h)
140 AC_CACHE_VAL(cf_cv_sys_time_select,[
141 AC_TRY_COMPILE([
142 #if HAVE_SYS_TIME_H
143 #include <sys/time.h>
144 #endif
145 #if HAVE_SYS_SELECT_H
146 #include <sys/select.h>
147 #endif
148 ],[],[cf_cv_sys_time_select=yes],
149      [cf_cv_sys_time_select=no])
150      ])
151 AC_MSG_RESULT($cf_cv_sys_time_select)
152 test $cf_cv_sys_time_select = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
153 dnl ---------------------------------------------------------------------------
154
155 AC_OUTPUT(Makefile,[
156         cat >>Makefile <<TEST_EOF
157
158 # These rules are generated so we do not rely on suffix rules, which do not
159 # work consistently for different make-programs (the '\$(MODEL)/' confuses
160 # some, and the '\$x' confuses others).
161 TEST_EOF
162 LIST=`make echo_tests`
163 LAST=`make echo_suffix`
164 for n in $LIST
165 do
166         N=`echo $n | sed -e s/${LAST}\$//`
167         cat >>Makefile <<TEST_EOF
168
169 \$(MODEL)/$N.o : $N.c \\
170         test.priv.h \\
171         ncurses_cfg.h
172         @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
173 TEST_EOF
174 done
175 ],[],sort)