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