parser.c is generated by lex, so it shouldn't be tracked and also parcer.c shouldn...
[xboard.git] / configure.in
1 dnl| configure.in\r
2 dnl|\r
3 dnl| You can process this file with autoconf to produce a configure script.\r
4 dnl| However, normally the supplied configure script will work fine.\r
5 dnl|\r
6 dnl| If you do need to change the configure script, instead of editing\r
7 dnl| it directly, try to edit configure.in (in a way that will keep\r
8 dnl| it portable to sites and systems other than your own), and run autoconf \r
9 dnl| to regenerate configure.  Then submit your changes to be folded into\r
10 dnl| the standard version of xboard.\r
11 \r
12 PRODUCT=xboard\r
13 VERSION=4.4  \r
14 PATCHLEVEL=0e\r
15 \r
16 AC_INIT([PRODUCT],[VERSION-PATCHLEVEL])\r
17 AM_INIT_AUTOMAKE\r
18 \r
19 AC_CONFIG_HEADERS([config.h])\r
20 AC_CONFIG_FILES([Makefile cmail xboard.texinfo],\r
21 [test -z "$CONFIG_HEADERS" || date > stamp-h \r
22 chmod 755 cmail\r
23 ])\r
24 \r
25 dnl | a bunch of templates for defines used below\r
26 AH_TEMPLATE([FIRST_PTY_LETTER],[template])\r
27 AH_TEMPLATE([HAVE_FCNTL_H],[template])\r
28 AH_TEMPLATE([HAVE_GETHOSTNAME],[template])\r
29 AH_TEMPLATE([HAVE_GETTIMEOFDAY],[template])\r
30 AH_TEMPLATE([HAVE_RANDOM],[template])\r
31 AH_TEMPLATE([HAVE_SYS_SOCKET_H],[template])\r
32 AH_TEMPLATE([IBMRTAIX],[template])\r
33 AH_TEMPLATE([LAST_PTY_LETTER],[template])\r
34 AH_TEMPLATE([PATCHLEVEL],[template])\r
35 AH_TEMPLATE([PRODUCT],[template])\r
36 AH_TEMPLATE([PTY_ITERATION],[template])\r
37 AH_TEMPLATE([PTY_NAME_SPRINTF],[template])\r
38 AH_TEMPLATE([PTY_OPEN],[template])\r
39 AH_TEMPLATE([PTY_TTY_NAME_SPRINTF],[template])\r
40 AH_TEMPLATE([REMOTE_SHELL],[template])\r
41 AH_TEMPLATE([RTU],[template])\r
42 AH_TEMPLATE([UNIPLUS],[template])\r
43 AH_TEMPLATE([USE_PTYS],[template])\r
44 AH_TEMPLATE([VERSION],[template])\r
45 AH_TEMPLATE([X_WCHAR],[template])\r
46 AH_TEMPLATE([ATTENTION],[template])\r
47 AH_TEMPLATE([DEFINED_SYS_ERRLIST],[template])\r
48 AH_TEMPLATE([HAVE_LIBXPM],[template])\r
49 AH_TEMPLATE([USE_XAW3D],[template])\r
50 AH_TEMPLATE([X_LOCALE],[template])\r
51 \r
52 \r
53 \r
54 if test -z "$CFLAGS" ; then\r
55 dnl| Prevent the next macro from setting CFLAGS to -g\r
56   CFLAGS=" "\r
57 fi\r
58 AC_PROG_CC\r
59 AC_PROG_CPP\r
60 AC_ISC_POSIX\r
61 AC_PROG_INSTALL\r
62 AC_CHECK_PROGS(LEX, lex flex, lex_not_found)\r
63 if test "$LEX" != lex_not_found ; then\r
64   AC_DECL_YYTEXT\r
65 fi\r
66 AC_CHECK_PROGS(RSH, remsh rsh, rsh)\r
67 AC_CHECK_PROGS(MINFO, makeinfo, makeinfo_not_found)\r
68 if test "$MINFO" == makeinfo_not_found ; then\r
69    echo Please install \"makeinfo\"\r
70    exit 1\r
71 fi\r
72 AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$RSH")\r
73 AC_CHECK_PROG(NROFF, nroff, [nroff -man], cat)\r
74 AC_SUBST(NROFFFLAGS)\r
75 AC_PATH_PROGS(AWKPATH, awk mawk gawk nawk)\r
76 AC_PATH_PROGS(PERLPATH, perl)\r
77 \r
78 AC_HEADER_STDC\r
79 AC_HEADER_TIME\r
80 AC_HEADER_SYS_WAIT\r
81 AC_HEADER_DIRENT\r
82 AC_TYPE_SIGNAL\r
83 AC_CHECK_HEADERS(stropts.h sys/time.h string.h unistd.h sys/systeminfo.h)\r
84 AC_CHECK_HEADERS(fcntl.h sys/fcntl.h, break)\r
85 AC_CHECK_HEADERS(sys/socket.h lan/socket.h, break)\r
86 AC_CHECK_HEADER(stddef.h, [], AC_DEFINE(X_WCHAR, 1))\r
87 \r
88 AC_CHECK_FUNCS(_getpty grantpt setitimer usleep)\r
89 AC_CHECK_FUNCS(gettimeofday ftime, break)\r
90 AC_CHECK_FUNCS(random rand48, break)\r
91 AC_CHECK_FUNCS(gethostname sysinfo, break)\r
92 AC_CHECK_FUNC(setlocale, [],\r
93   AC_CHECK_LIB(i, setlocale, [], AC_DEFINE(X_LOCALE, 1)))\r
94 \r
95 AC_CHECK_LIB(seq, getpseudotty)\r
96 \r
97 AC_PATH_XTRA\r
98 if test -n "$no_x" ; then\r
99   echo $PRODUCT requires the X Window System header files and libraries!\r
100   echo They were not found on your system.  See FAQ topic C.2.\r
101   echo configure failed\r
102   exit 1\r
103 fi\r
104 \r
105 AC_CHECK_HEADER(X11/Intrinsic.h,xt="yes",xt="no")\r
106 \r
107 if test "$xt" == "no" ; then\r
108    echo Xt headers not found\r
109    exit 1\r
110 fi\r
111 \r
112 AC_ARG_WITH(Xaw3d, [  --with-Xaw3d            use Xaw3d instead of Xaw],\r
113   with_xaw3d="yes", with_xaw3d="no")\r
114 \r
115 \r
116 xaw_headers="no"\r
117 if test "$with_xaw3d" == "yes" ; then\r
118    XAW_LIBS="-lXaw3d"\r
119    AC_CHECK_LIB([Xaw3d], [XawTextReplace], xaw3d_lib="yes", xaw3d_lib="no")\r
120    if test "$xaw3d_lib" == "no" ; then\r
121       echo Xaw3d libraries not found\r
122       exit 1\r
123    else\r
124       AC_CHECK_HEADER(X11/Xaw3d/Dialog.h,xaw3d_headers="yes",xaw3d_headers="no")        \r
125       if test "$xaw3d_headers" == "yes" ; then\r
126         AC_DEFINE(USE_XAW3D)\r
127         xaw_headers="yes"\r
128       else\r
129         AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")     \r
130       fi\r
131    fi\r
132 else\r
133    XAW_LIBS="-lXaw"\r
134    AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")\r
135 fi\r
136 \r
137 AC_SUBST(XAW_LIBS)\r
138 \r
139 \r
140 \r
141 if test "$xaw_headers" == "no" ; then\r
142    echo Xaw headers not found \r
143    exit 1\r
144 \r
145 fi\r
146 \r
147 \r
148 AC_CANONICAL_HOST\r
149 \r
150 dnl| The following info is mostly gathered from GNU Emacs 19.24.  Basically,\r
151 dnl| we are trying to find out whether this is a System-V derivative in\r
152 dnl| which pipes don't work with select() and if so, whether there is anything\r
153 dnl| strange about the way to open a pty.  Some of the work was done above\r
154 dnl| by looking for _getpty, grantpt, and getpseudotty.  A few other strange\r
155 dnl| properties of particular systems are also handled here.\r
156 \r
157 dnl| 4/6/97 I'm not sure there really are any systems where pipes\r
158 dnl| don't work with select(), and ptys cause problems on many\r
159 dnl| systems, so I'm changing the default to disable ptys in all\r
160 dnl| cases.  I will change it back if I get bug reports that are fixed\r
161 dnl| by doing a "configure --enable-ptys"\r
162 \r
163 USE_PTYS=0\r
164 case "$host" in\r
165   *-*-hpux* )\r
166     AC_DEFINE(PTY_TTY_NAME_SPRINTF,\r
167         [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])\r
168     AC_DEFINE(PTY_NAME_SPRINTF,\r
169         [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])\r
170 dnl| USE_PTYS=1\r
171     if test "$GCC" = yes; then\r
172       CONF_CFLAGS="-fwritable-strings"\r
173     else\r
174 \r
175 dnl| Note: You might be able to build xboard even if your compiler does not\r
176 dnl| support ANSI C (-Aa).  xboard itself does not require ANSI C.  I don't\r
177 dnl| know whether the X header files on HP-UX require it.\r
178 \r
179       CONF_CFLAGS="-Aa -D_HPUX_SOURCE"\r
180     fi\r
181 \r
182 dnl| HP doesn't supply a full set of X header files and libraries.  People\r
183 dnl| often have some things installed in one place and some in another. \r
184 dnl| AC_PATH_XTRA will find only one place, so we try to add all the\r
185 dnl| likely ones that might be missing here.  It might be better to\r
186 dnl| change AC_PATH_XTRA to try to extract this information from imake,\r
187 dnl| since folks who install the missing bits often configure their\r
188 dnl| imake to find them, but I don't want to delve into autoconf and\r
189 dnl| hack on its internals.\r
190 \r
191     if test -d /opt/hppd/include/X11; then\r
192       X_CFLAGS="$X_CFLAGS -I/opt/hppd/include"\r
193       X_LIBS="$X_LIBS -L/opt/hppd/lib"\r
194     elif test -d /usr/contrib/X11R5/include; then\r
195       X_CFLAGS="$X_CFLAGS -I/usr/contrib/X11R5/include"\r
196       X_LIBS="$X_LIBS -L/usr/contrib/X11R5/lib"\r
197     elif test -d /usr/contrib/mitX11R5/include; then\r
198       X_CFLAGS="$X_CFLAGS -I/usr/contrib/mitX11R5/include"\r
199       X_LIBS="$X_LIBS -L/usr/contrib/mitX11R5/lib"\r
200     elif test -d /MIT/X11R5/include; then\r
201       X_CFLAGS="$X_CFLAGS -I/MIT/X11R5/include"\r
202       X_LIBS="$X_LIBS -L/MIT/X11R5/lib"\r
203     elif test -d /usr/local/include/X11R5; then\r
204       X_CFLAGS="$X_CFLAGS -I/usr/local/include/X11R5"\r
205       X_LIBS="$X_LIBS -L/usr/local/lib/X11R5"\r
206     fi\r
207     if test -d /usr/include/X11R5; then\r
208       X_CFLAGS="$X_CFLAGS -I/usr/include/X11R5"\r
209       X_LIBS="$X_LIBS -L/usr/lib/X11R5 -L/usr/lib/X11R4"\r
210     elif test -d /usr/include/X11R4; then\r
211       X_CFLAGS="$X_CFLAGS -I/usr/include/X11R4"\r
212       X_LIBS="$X_LIBS -L/usr/lib/X11R4"\r
213     fi\r
214   ;;\r
215 \r
216   romp-ibm-aix* )\r
217     AC_DEFINE(IBMRTAIX, 1)\r
218 dnl| USE_PTYS=1\r
219   ;;\r
220 \r
221   i386-ibm-aix )\r
222 dnl| USE_PTYS=1\r
223     if test "$GCC" = yes; then\r
224       CONF_CFLAGS="-fwritable-strings"\r
225     fi\r
226   ;;\r
227 \r
228   *-*-aix3* | *-*-bosx* )\r
229     AC_DEFINE(PTY_ITERATION, [for (c = 0; !c; c++)])\r
230     AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])\r
231     AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));])\r
232 dnl| USE_PTYS=1\r
233   ;;\r
234 \r
235   *-*-cxux* )\r
236     AC_DEFINE(FIRST_PTY_LETTER, 'A')\r
237     AC_DEFINE(LAST_PTY_LETTER, 'P')\r
238 dnl| USE_PTYS=1\r
239   ;;\r
240 \r
241   *-*-uniplus* )\r
242     AC_DEFINE(UNIPLUS, 1)\r
243 dnl| USE_PTYS=1\r
244   ;;\r
245 \r
246   *-*-rtu* )\r
247     AC_DEFINE(FIRST_PTY_LETTER, 'z')\r
248     AC_DEFINE(PTY_TTY_NAME_SPRINTF,\r
249         [sprintf (pty_name, "/dev/ttyp%x", i);])\r
250     AC_DEFINE(PTY_NAME_SPRINTF,\r
251         [sprintf (pty_name, "/dev/pty%x", i);])\r
252     AC_DEFINE(RTU, 1)\r
253 dnl| USE_PTYS=1\r
254   ;;\r
255 \r
256   *-*-iris* | *-*-irix3* )\r
257     AC_DEFINE(PTY_ITERATION, [for (c = 0; !c; c++)])\r
258     AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])\r
259     AC_DEFINE(PTY_TTY_NAME_SPRINTF,\r
260         [sprintf (pty_name, "/dev/ttyq%d", minor(stb.st_rdev));])\r
261 dnl| USE_PTYS=1\r
262   ;;\r
263 \r
264   *-*-irix* )\r
265 dnl| USE_PTYS=1\r
266   ;;\r
267 \r
268   *-*-sunos4* | *-*-solaris1* )\r
269 \r
270 dnl| Work around a bug in the SunOS 4.x linker.  Not needed if you have patches\r
271 dnl|  100512-02 and 100573-03 from Sun.  The X FAQ says that the following is\r
272 dnl|  "overkill," but doesn't explain what should be done instead.\r
273 \r
274     if test "$GCC" = yes; then\r
275       PRE_XMULIB="-static"\r
276       POST_XMULIB="-dynamic"\r
277     else\r
278       PRE_XMULIB="-Bstatic"\r
279       POST_XMULIB="-Bdynamic"\r
280     fi\r
281   ;;\r
282 \r
283   *-*-sunos5* | *-*-solaris2* )\r
284 dnl| USE_PTYS=1\r
285 \r
286 dnl| I'm not sure -lelf is needed, but it was in the old Imakefile.\r
287 dnl| The other libraries should all be found by Ac_PATH_XTRA or other\r
288 dnl| code above.\r
289 \r
290     X_LIBS="$X_LIBS -lelf"\r
291   ;;\r
292 \r
293   *-*-sco* )\r
294     AC_DEFINE(PTY_ITERATION, [for (i = 0; ; i++)])\r
295     AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptyp%d", i);])\r
296     AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ttyp%d", i);])\r
297 dnl| USE_PTYS=1\r
298   ;;\r
299         \r
300   *-*-dynix* | *-*-ptx* )\r
301 dnl| USE_PTYS=1\r
302   ;;\r
303 \r
304   *-*-esix* )\r
305 dnl| USE_PTYS=1\r
306   ;;\r
307 \r
308   *-*-usg5-4* | *-*-sysvr4* )\r
309 dnl| USE_PTYS=1\r
310   ;;\r
311 \r
312   *-*-usg* | *-*-sysv* | *-*-aix* )\r
313 dnl| USE_PTYS=1\r
314   ;;\r
315 \r
316   vax-*-ultrix )\r
317     if test "$GCC" = yes; then\r
318       CONF_CFLAGS="-fwritable-strings"\r
319     fi\r
320   ;;\r
321 esac\r
322 \r
323 AC_ARG_ENABLE(xpm,\r
324 [  --enable-xpm            libXpm will be used if found (default)\r
325   --disable-xpm           libXpm will not be used],\r
326 [enable_xpm="$enableval"], [enable_xpm="yes"])\r
327 \r
328 if test "$enable_xpm" = "yes"; then\r
329   save_cflags="$CFLAGS"\r
330   CFLAGS="$CFLAGS $X_CFLAGS"\r
331   CPPFLAGS="$CPPFLAGS $X_CFLAGS"\r
332   AC_CHECK_HEADERS(X11/xpm.h)\r
333   CFLAGS="$save_cflags"\r
334   if test "$ac_cv_header_X11_xpm_h" = "yes"; then\r
335     save_ldflags="$LDFLAGS"\r
336     LDFLAGS="$LDFLAGS $X_LIBS"\r
337     AC_CHECK_LIB(Xpm, XpmReadFileToPixmap,\r
338                  [X_PRE_LIBS="-lXpm $X_PRE_LIBS"; AC_DEFINE(HAVE_LIBXPM)], [],\r
339                  [$X_PRE_LIBS -lX11 $X_EXTRA_LIBS])\r
340     LDFLAGS="$save_ldflags"\r
341   fi\r
342 fi\r
343 \r
344 AC_SUBST(PRE_XMULIB)\r
345 AC_SUBST(POST_XMULIB)\r
346 AC_SUBST(CONF_CFLAGS)\r
347 AC_SUBST(CONF_LDFLAGS)\r
348 \r
349 AC_MSG_CHECKING(whether ptys or pipes should be used)\r
350 AC_ARG_ENABLE(ptys, \r
351 [  --enable-ptys           force use of pseudo-ttys with child processes\r
352   --disable-ptys          force use of pipes with child processes],\r
353 [if test "$enableval" = yes; then\r
354   USE_PTYS=1\r
355   AC_MSG_RESULT([ptys (user override)])\r
356 fi\r
357 if test "$enableval" = no; then\r
358   USE_PTYS=0\r
359   AC_MSG_RESULT([pipes (user override)])\r
360 fi],\r
361 [if test "$USE_PTYS" = 1; then\r
362   AC_MSG_RESULT(ptys)\r
363 else\r
364   AC_MSG_RESULT(pipes)\r
365 fi])\r
366 AC_DEFINE_UNQUOTED(USE_PTYS, $USE_PTYS)\r
367 \r
368 \r
369 dnl | define not to build zippy as a default, so that autoheader is happy\r
370 AC_DEFINE(ZIPPY, 0,[should zippy be enabled])\r
371 AC_ARG_ENABLE(zippy, \r
372 [  --enable-zippy          support interfacing a chess program to ICS (default)\r
373   --disable-zippy         do not support interfacing a chess program to ICS],\r
374 [enable_zippy="$enableval"], [enable_zippy="yes"])\r
375 if test "$enable_zippy" = yes; then\r
376   AC_DEFINE(ZIPPY, 1,[should zippy be enabled])\r
377   ZIPPY_O=zippy.o\r
378   ZIPPY_H=zippy.h\r
379 fi\r
380 AC_SUBST(ZIPPY_O)  \r
381 AC_SUBST(ZIPPY_H)  \r
382 \r
383 AC_ARG_ENABLE(sigint, \r
384 [  --enable-sigint         sending SIGINT (^C) wakes up GNU Chess (default)\r
385   --disable-sigint        typing a command wakes up GNU Chess],\r
386 [if test "$enableval" = yes; then\r
387   AC_DEFINE(ATTENTION, 1)\r
388 fi],\r
389 [AC_DEFINE(ATTENTION, 1)])\r
390 \r
391 AC_DEFINE_UNQUOTED(PRODUCT, "$PRODUCT")\r
392 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")\r
393 AC_DEFINE_UNQUOTED(PATCHLEVEL, "$PATCHLEVEL")\r
394 AC_SUBST(PRODUCT)\r
395 AC_SUBST(VERSION)\r
396 AC_SUBST(PATCHLEVEL)\r
397 \r
398 AC_OUTPUT\r