f28ce772df6f6339eabe626183e1ba60b8d3b640
[ncurses.git] / test / configure.in
1 dnl*****************************************************************************
2 dnl Copyright 1996,1997 by Thomas E. Dickey <dickey@clark.net>                 *
3 dnl All Rights Reserved.                                                       *
4 dnl                                                                            *
5 dnl Permission to use, copy, modify, and distribute this software and its      *
6 dnl documentation for any purpose and without fee is hereby granted, provided  *
7 dnl that the above copyright notice appear in all copies and that both that    *
8 dnl copyright notice and this permission notice appear in supporting           *
9 dnl documentation, and that the name of the above listed copyright holder(s)   *
10 dnl not be used in advertising or publicity pertaining to distribution of the  *
11 dnl software without specific, written prior permission. THE ABOVE LISTED      *
12 dnl COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,  *
13 dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO     *
14 dnl EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY         *
15 dnl SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER       *
16 dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF       *
17 dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN        *
18 dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.                   *
19 dnl*****************************************************************************
20 dnl $Id: configure.in,v 1.15 1997/05/06 00:36:02 tom Exp $
21 dnl This is a simple configuration-script for the ncurses test programs that
22 dnl allows the test-directory to be separately configured against a reference
23 dnl system (i.e., sysvr4 curses)
24 dnl
25 dnl If you're configuring ncurses, you shouldn't need to use this script.
26 dnl It's only for testing purposes.
27 dnl
28 dnl dickey@clark.net (Thomas Dickey)
29 AC_PREREQ(2.12)
30 AC_INIT(ncurses.c)
31
32 AC_PROG_CC
33
34 CC_G_OPT="-g"                           AC_SUBST(CC_G_OPT)
35 CC_SHARED_OPTS=unknown                  AC_SUBST(CC_SHARED_OPTS)
36 CPPFLAGS="$CPPFLAGS"                    AC_SUBST(CPPFLAGS)
37 DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'`    AC_SUBST(DFT_OBJ_SUBDIR)
38 DFT_UPR_MODEL="NORMAL"                  AC_SUBST(DFT_UPR_MODEL)
39 EXTRA_LIBS=""                           AC_SUBST(EXTRA_LIBS)
40 LIB_NAME=curses                         AC_SUBST(LIB_NAME)
41 LINT=lint                               AC_SUBST(LINT)
42 LINT_OPTS=""                            AC_SUBST(LINT_OPTS)
43 TEST_ARGS=""                            AC_SUBST(TEST_ARGS)
44
45 dnl SunOS 4.x
46 AC_ARG_WITH(5lib,
47         [  --with-5lib             use SunOS sysv-libraries],
48         [LIBS="-L/usr/5lib $LIBS"
49          CPPFLAGS="$CPPFLAGS -I/usr/5include"])
50
51 dnl Ncurses, installed in conventional location
52 AC_ARG_WITH(ncurses,
53         [  --with-ncurses          use ncurses-libraries (installed)],
54         [AC_CHECK_LIB(gpm,Gpm_Open)
55          LIB_NAME=ncurses
56          for p in $HOME /usr/local /usr
57          do
58                 if test -f $p/include/ncurses/curses.h
59                 then
60                         CPPFLAGS="$CPPFLAGS -I$p/include/ncurses"
61                         test $p != /usr && LIBS="-L$p/lib $LIBS"
62                         break
63                 elif test $p != /usr
64                 then
65                         if test -f $p/include/curses.h
66                         then
67                                 CPPFLAGS="$CPPFLAGS -I$p/include"
68                                 LIBS="-L$p/lib $LIBS"
69                                 break
70                         fi
71                 fi
72          done
73         ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])
74
75 dnl If we've not specified a library, assume we're using sysvr4 libraries
76 dnl installed conventionally (e.g., SunOS 5.x - solaris).
77
78 dnl Autoconf builds up the $LIBS in reverse order
79
80 AC_CHECK_LIB($LIB_NAME,initscr)
81 AC_CHECK_LIB(form,form_driver,,,-lcurses)
82 AC_CHECK_LIB(menu,menu_driver,,,-lcurses)
83 AC_CHECK_LIB(panel,new_panel,,,-lcurses)
84
85 AC_TYPE_SIGNAL
86
87 AC_STDC_HEADERS
88 AC_HEADER_TIME
89 AC_CHECK_HEADERS( \
90 form.h \
91 getopt.h \
92 menu.h \
93 nc_alloc.h \
94 panel.h \
95 sys/ioctl.h \
96 sys/select.h \
97 sys/time.h \
98 termios.h \
99 unistd.h \
100 )
101
102 AC_CHECK_FUNCS( \
103 gettimeofday \
104 napms \
105 resizeterm \
106 strdup \
107 vsscanf \
108 )
109
110 AC_CHECKING([for SCO by checking on /usr/bin/scosh])
111 AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot)
112 if test "$COULD_BE_SCO" = "maybe"
113 then
114         AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO)
115 fi
116
117 dnl Things that we don't need (or must override) if we're not building ncurses
118 ECHO_LINK='@ echo linking $@ ... ;'
119 AC_SUBST(ECHO_LINK)
120
121 LD_MODEL=""
122 AC_SUBST(LD_MODEL)
123
124 LOCAL_LDFLAGS=""
125 AC_SUBST(LOCAL_LDFLAGS)
126
127 nc_cv_abi_version=""
128 AC_SUBST(nc_cv_abi_version)
129
130 TEST_DEPS=""
131 AC_SUBST(TEST_DEPS)
132
133 LIB_PREFIX="-l"
134 AC_SUBST(LIB_PREFIX)
135
136 DFT_DEP_SUFFIX=""
137 AC_SUBST(DFT_DEP_SUFFIX)
138
139 rm -f config_h.in
140 echo '@DEFS@' >config_h.in
141
142 changequote({,})dnl
143 AC_OUTPUT(config_h Makefile,{
144
145 ### Special editing.  We generate ncurses_cfg.h directly to allow all filenames
146 ### to be MSDOS-compatible, as well as to make the list of definitions be
147 ### dynamically determined by the configuration script -- a consideration when
148 ### doing type-clean development testing.
149
150 echo creating ncurses_cfg.h
151 rm -f ncurses_cfg.h
152 echo "/* generated by configure-script
153  * On host: $SYS_NAME
154  */
155 #ifndef NC_CONFIG_H
156 #define NC_CONFIG_H" >ncurses_cfg.h
157 sed     -e '/^ -D/!d' \
158         -e 's/ -D/\
159 #define /g' \
160         -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1    /g' \
161         -e 's@\\@@g' \
162         config_h | sort >>ncurses_cfg.h
163 echo "
164         /* The C compiler may not treat these properly, but C++ has to */
165 #ifdef __cplusplus
166 #undef const
167 #undef inline
168 #endif
169
170 #endif /* NC_CONFIG_H */" >> ncurses_cfg.h
171 echo removing config_h
172 rm config_h
173 },{
174 ### Special initialization commands, used to pass information from the
175 ### configuration-run into config.status
176
177 SYS_NAME="`(uname -a || hostname) 2>/dev/null | sed 1q`"
178 if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi
179 })
180 changequote([,])dnl
181
182 rm -f config_h.in