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