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