3 dnl| Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 dnl| 2008, 2009 Free Software Foundation, Inc.
6 dnl| GNU XBoard is free software: you can redistribute it and/or modify
7 dnl| it under the terms of the GNU General Public License as published by
8 dnl| the Free Software Foundation, either version 3 of the License, or (at
9 dnl| your option) any later version.
11 dnl| GNU XBoard is distributed in the hope that it will be useful, but
12 dnl| WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl| General Public License for more details.
16 dnl| You should have received a copy of the GNU General Public License
17 dnl| along with this program. If not, see http://www.gnu.org/licenses/.
19 dnl| --------------------------------------------------------------------
21 dnl| You can process this file with autoconf to produce a configure script.
22 dnl| However, normally the supplied configure script will work fine.
24 dnl| If you do need to change the configure script, instead of editing
25 dnl| it directly, try to edit configure.in (in a way that will keep
26 dnl| it portable to sites and systems other than your own), and run autoconf
27 dnl| to regenerate configure. Then submit your changes to be folded into
28 dnl| the standard version of xboard.
30 dnl| define second argument as VERSION.PATCHLEVEL. e.g. 4.4.0j
31 AC_INIT([xboard],[4.4.1.pre],[bug-xboard@gnu.org])
34 AC_CONFIG_HEADERS([config.h])
36 dnl | a bunch of templates for defines used below
37 AH_TEMPLATE([FIRST_PTY_LETTER],[template])
38 AH_TEMPLATE([HAVE_FCNTL_H],[template])
39 AH_TEMPLATE([HAVE_GETHOSTNAME],[template])
40 AH_TEMPLATE([HAVE_GETTIMEOFDAY],[template])
41 AH_TEMPLATE([HAVE_RANDOM],[template])
42 AH_TEMPLATE([HAVE_SYS_SOCKET_H],[template])
43 AH_TEMPLATE([IBMRTAIX],[template])
44 AH_TEMPLATE([LAST_PTY_LETTER],[template])
45 AH_TEMPLATE([PTY_ITERATION],[template])
46 AH_TEMPLATE([PTY_NAME_SPRINTF],[template])
47 AH_TEMPLATE([PTY_OPEN],[template])
48 AH_TEMPLATE([PTY_TTY_NAME_SPRINTF],[template])
49 AH_TEMPLATE([REMOTE_SHELL],[template])
50 AH_TEMPLATE([RTU],[template])
51 AH_TEMPLATE([UNIPLUS],[template])
52 AH_TEMPLATE([USE_PTYS],[template])
53 AH_TEMPLATE([X_WCHAR],[template])
54 AH_TEMPLATE([ATTENTION],[template])
55 AH_TEMPLATE([DEFINED_SYS_ERRLIST],[template])
56 AH_TEMPLATE([HAVE_LIBXPM],[template])
57 AH_TEMPLATE([USE_XAW3D],[template])
58 AH_TEMPLATE([X_LOCALE],[template])
62 if test -z "$CFLAGS" ; then
63 dnl| Prevent the next macro from setting CFLAGS to -g
72 if test "$LEX" != flex; then
73 LEX="$SHELL $missing_dir/missing flex"
74 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
75 AC_SUBST([LEXLIB], [''])
79 AC_CHECK_PROGS(RSH, remsh rsh, rsh)
80 AC_CHECK_PROGS(MINFO, makeinfo, makeinfo_not_found)
81 if test "$MINFO" == makeinfo_not_found ; then
82 echo Please install \"makeinfo\"
85 AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$RSH")
86 AC_CHECK_PROG(NROFF, nroff, [nroff -man], cat)
88 AC_PATH_PROGS(AWKPATH, awk mawk gawk nawk)
89 AC_PATH_PROGS(PERLPATH, perl)
96 AC_CHECK_HEADERS(stropts.h sys/time.h string.h unistd.h sys/systeminfo.h malloc.h)
97 AC_CHECK_HEADERS(fcntl.h sys/fcntl.h, break)
98 AC_CHECK_HEADERS(sys/socket.h lan/socket.h, break)
99 AC_CHECK_HEADER(stddef.h, [], AC_DEFINE(X_WCHAR, 1))
101 AC_CHECK_FUNCS(_getpty grantpt setitimer usleep)
102 AC_CHECK_FUNCS(gettimeofday ftime, break)
103 AC_CHECK_FUNCS(random rand48, break)
104 AC_CHECK_FUNCS(gethostname sysinfo, break)
105 AC_CHECK_FUNC(setlocale, [],
106 AC_CHECK_LIB(i, setlocale, [], AC_DEFINE(X_LOCALE, 1)))
108 AC_CHECK_LIB(seq, getpseudotty)
111 if test -n "$no_x" ; then
112 echo $PACKAGE requires the X Window System header files and libraries!
113 echo They were not found on your system. See FAQ topic C.2.
114 echo configure failed
118 AC_CHECK_HEADER(X11/Intrinsic.h,xt="yes",xt="no")
120 if test "$xt" == "no" ; then
121 echo Xt headers not found
125 dnl | test if user wants ot use Xaw3d headers
127 [AS_HELP_STRING([--with-Xaw3d],
128 [use Xaw3d instead of Xaw])],
133 AS_IF([test "x$with_xaw3d" != xno],
134 [AC_CHECK_LIB([Xaw3d],
136 [AC_SUBST([XAW_LIBS],
138 AC_DEFINE([USE_XAW3D], [1],
139 [Define if you want to use Xaw3d])],
140 [AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")
142 [--with-Xaw3d was given, but test for Xaw3d failed])],
144 if test "$with_xaw3d" == "no" ; then
151 if test "$xaw_headers" == "no" ; then
152 echo Xaw headers not found
160 dnl| The following info is mostly gathered from GNU Emacs 19.24. Basically,
161 dnl| we are trying to find out whether this is a System-V derivative in
162 dnl| which pipes don't work with select() and if so, whether there is anything
163 dnl| strange about the way to open a pty. Some of the work was done above
164 dnl| by looking for _getpty, grantpt, and getpseudotty. A few other strange
165 dnl| properties of particular systems are also handled here.
167 dnl| 4/6/97 I'm not sure there really are any systems where pipes
168 dnl| don't work with select(), and ptys cause problems on many
169 dnl| systems, so I'm changing the default to disable ptys in all
170 dnl| cases. I will change it back if I get bug reports that are fixed
171 dnl| by doing a "configure --enable-ptys"
176 AC_DEFINE(PTY_TTY_NAME_SPRINTF,
177 [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])
178 AC_DEFINE(PTY_NAME_SPRINTF,
179 [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])
181 if test "$GCC" = yes; then
182 CONF_CFLAGS="-fwritable-strings"
185 dnl| Note: You might be able to build xboard even if your compiler does not
186 dnl| support ANSI C (-Aa). xboard itself does not require ANSI C. I don't
187 dnl| know whether the X header files on HP-UX require it.
189 CONF_CFLAGS="-Aa -D_HPUX_SOURCE"
192 dnl| HP doesn't supply a full set of X header files and libraries. People
193 dnl| often have some things installed in one place and some in another.
194 dnl| AC_PATH_XTRA will find only one place, so we try to add all the
195 dnl| likely ones that might be missing here. It might be better to
196 dnl| change AC_PATH_XTRA to try to extract this information from imake,
197 dnl| since folks who install the missing bits often configure their
198 dnl| imake to find them, but I don't want to delve into autoconf and
199 dnl| hack on its internals.
201 if test -d /opt/hppd/include/X11; then
202 X_CFLAGS="$X_CFLAGS -I/opt/hppd/include"
203 X_LIBS="$X_LIBS -L/opt/hppd/lib"
204 elif test -d /usr/contrib/X11R5/include; then
205 X_CFLAGS="$X_CFLAGS -I/usr/contrib/X11R5/include"
206 X_LIBS="$X_LIBS -L/usr/contrib/X11R5/lib"
207 elif test -d /usr/contrib/mitX11R5/include; then
208 X_CFLAGS="$X_CFLAGS -I/usr/contrib/mitX11R5/include"
209 X_LIBS="$X_LIBS -L/usr/contrib/mitX11R5/lib"
210 elif test -d /MIT/X11R5/include; then
211 X_CFLAGS="$X_CFLAGS -I/MIT/X11R5/include"
212 X_LIBS="$X_LIBS -L/MIT/X11R5/lib"
213 elif test -d /usr/local/include/X11R5; then
214 X_CFLAGS="$X_CFLAGS -I/usr/local/include/X11R5"
215 X_LIBS="$X_LIBS -L/usr/local/lib/X11R5"
217 if test -d /usr/include/X11R5; then
218 X_CFLAGS="$X_CFLAGS -I/usr/include/X11R5"
219 X_LIBS="$X_LIBS -L/usr/lib/X11R5 -L/usr/lib/X11R4"
220 elif test -d /usr/include/X11R4; then
221 X_CFLAGS="$X_CFLAGS -I/usr/include/X11R4"
222 X_LIBS="$X_LIBS -L/usr/lib/X11R4"
227 AC_DEFINE(IBMRTAIX, 1)
233 if test "$GCC" = yes; then
234 CONF_CFLAGS="-fwritable-strings"
238 *-*-aix3* | *-*-bosx* )
239 AC_DEFINE(PTY_ITERATION, [for (c = 0; !c; c++)])
240 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
241 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));])
246 AC_DEFINE(FIRST_PTY_LETTER, 'A')
247 AC_DEFINE(LAST_PTY_LETTER, 'P')
252 AC_DEFINE(UNIPLUS, 1)
257 AC_DEFINE(FIRST_PTY_LETTER, 'z')
258 AC_DEFINE(PTY_TTY_NAME_SPRINTF,
259 [sprintf (pty_name, "/dev/ttyp%x", i);])
260 AC_DEFINE(PTY_NAME_SPRINTF,
261 [sprintf (pty_name, "/dev/pty%x", i);])
266 *-*-iris* | *-*-irix3* )
267 AC_DEFINE(PTY_ITERATION, [for (c = 0; !c; c++)])
268 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
269 AC_DEFINE(PTY_TTY_NAME_SPRINTF,
270 [sprintf (pty_name, "/dev/ttyq%d", minor(stb.st_rdev));])
278 *-*-sunos4* | *-*-solaris1* )
280 dnl| Work around a bug in the SunOS 4.x linker. Not needed if you have patches
281 dnl| 100512-02 and 100573-03 from Sun. The X FAQ says that the following is
282 dnl| "overkill," but doesn't explain what should be done instead.
284 if test "$GCC" = yes; then
286 POST_XMULIB="-dynamic"
288 PRE_XMULIB="-Bstatic"
289 POST_XMULIB="-Bdynamic"
293 *-*-sunos5* | *-*-solaris2* )
296 dnl| I'm not sure -lelf is needed, but it was in the old Imakefile.
297 dnl| The other libraries should all be found by Ac_PATH_XTRA or other
300 X_LIBS="$X_LIBS -lelf"
304 AC_DEFINE(PTY_ITERATION, [for (i = 0; ; i++)])
305 AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptyp%d", i);])
306 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ttyp%d", i);])
310 *-*-dynix* | *-*-ptx* )
318 *-*-usg5-4* | *-*-sysvr4* )
322 *-*-usg* | *-*-sysv* | *-*-aix* )
327 if test "$GCC" = yes; then
328 CONF_CFLAGS="-fwritable-strings"
332 dnl| add some libs for OS X
334 X_LIBS="$X_LIBS -lX11 -lXt"
338 AC_ARG_ENABLE( [xpm],
339 [AS_HELP_STRING([--enable-xpm],[libXpm will be used if found (default)])],
340 [enable_xpm="$enableval"],
343 if test x"$enable_xpm" != "xno"; then
344 save_cflags="$CFLAGS"
345 CFLAGS="$CFLAGS $X_CFLAGS"
346 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
347 AC_CHECK_HEADERS(X11/xpm.h)
348 CFLAGS="$save_cflags"
349 if test "$ac_cv_header_X11_xpm_h" = "yes"; then
350 save_ldflags="$LDFLAGS"
351 LDFLAGS="$LDFLAGS $X_LIBS"
352 AC_CHECK_LIB(Xpm, XpmReadFileToPixmap,
353 [X_PRE_LIBS="-lXpm $X_PRE_LIBS"; AC_DEFINE(HAVE_LIBXPM)], [],
354 [$X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
355 LDFLAGS="$save_ldflags"
360 AC_SUBST(POST_XMULIB)
361 AC_SUBST(CONF_CFLAGS)
362 AC_SUBST(CONF_LDFLAGS)
364 AC_MSG_CHECKING(whether ptys or pipes should be used)
365 AC_ARG_ENABLE( [ptys],
366 [AS_HELP_STRING([--enable-ptys],[force use of pseudo-ttys with child processes])],
367 [if test "$enableval" = yes; then
370 AC_MSG_RESULT([ptys (user override)])
372 if test "$enableval" = no; then
375 AC_MSG_RESULT([pipes (user override)])
377 [if test "$USE_PTYS" = 1; then
384 AC_DEFINE_UNQUOTED(USE_PTYS, $USE_PTYS)
387 dnl | define not to build zippy as a default, so that autoheader is happy
388 AC_DEFINE(ZIPPY, 0,[should zippy be enabled])
389 AC_ARG_ENABLE( [zippy],
390 [AS_HELP_STRING([--enable-zippy],[support interfacing a chess program to ICS (default)])],
392 [enable_zippy="yes"])
394 if test x"$enable_zippy" != xno; then
395 AC_DEFINE(ZIPPY, 1,[should zippy be enabled])
397 AM_CONDITIONAL([ZIPPY], [test x$enable_zippy != xno])
400 AC_ARG_ENABLE(sigint,
401 [AS_HELP_STRING([--enable-sigint],[sending SIGINT (^C) wakes up GNU Chess (default)])],
402 [if test "$enableval" = yes; then
403 AC_DEFINE(ATTENTION, 1)
405 enable_sigint=$enableval
408 AC_DEFINE(ATTENTION, 1)])
411 AC_CONFIG_FILES([Makefile cmail])
412 AC_CONFIG_COMMANDS([test-stamp-h],[test -z "$CONFIG_HEADERS" || date > stamp-h])
413 AC_CONFIG_COMMANDS([chmod-cmail],[chmod 755 cmail])
420 echo " Configurations summary:"
422 echo " prefix: $prefix"
424 echo " Xaw3d: $with_xaw3d"
426 echo " xpm: $enable_xpm"
427 echo " ptys: $enable_ptys"
428 echo " zippy: $enable_zippy"
429 echo " sigint: $enable_sigint"