3 dnl| Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 dnl| 2008, 2009, 2010 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],[master-20100806],[bug-xboard@gnu.org])
33 dnl| need this to be able to compile some files in a subdir (filebrowser)
34 AM_INIT_AUTOMAKE([subdir-objects])
35 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
37 AC_CONFIG_HEADERS([config.h])
39 dnl | a bunch of templates for defines used below
40 AH_TEMPLATE([FIRST_PTY_LETTER],[template])
41 AH_TEMPLATE([HAVE_FCNTL_H],[template])
42 AH_TEMPLATE([HAVE_GETHOSTNAME],[template])
43 AH_TEMPLATE([HAVE_GETTIMEOFDAY],[template])
44 AH_TEMPLATE([HAVE_RANDOM],[template])
45 AH_TEMPLATE([HAVE_SYS_SOCKET_H],[template])
46 AH_TEMPLATE([IBMRTAIX],[template])
47 AH_TEMPLATE([LAST_PTY_LETTER],[template])
48 AH_TEMPLATE([PTY_ITERATION],[template])
49 AH_TEMPLATE([PTY_NAME_SPRINTF],[template])
50 AH_TEMPLATE([PTY_OPEN],[template])
51 AH_TEMPLATE([PTY_TTY_NAME_SPRINTF],[template])
52 AH_TEMPLATE([REMOTE_SHELL],[template])
53 AH_TEMPLATE([RTU],[template])
54 AH_TEMPLATE([UNIPLUS],[template])
55 AH_TEMPLATE([USE_PTYS],[template])
56 AH_TEMPLATE([X_WCHAR],[template])
57 AH_TEMPLATE([ATTENTION],[template])
58 AH_TEMPLATE([DEFINED_SYS_ERRLIST],[template])
59 AH_TEMPLATE([HAVE_LIBXPM],[template])
60 AH_TEMPLATE([USE_XAW3D],[template])
61 AH_TEMPLATE([X_LOCALE],[template])
64 if test -z "$CFLAGS" ; then
65 dnl| Prevent the next macro from setting CFLAGS to -g
70 dnl| need this to be able to compile files in a subdir
78 if test "$LEX" != flex; then
79 LEX="$SHELL $missing_dir/missing flex"
80 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
81 AC_SUBST([LEXLIB], [''])
85 AC_CHECK_PROGS(RSH, remsh rsh, rsh)
86 AC_CHECK_PROGS(MINFO, makeinfo, makeinfo_not_found)
87 if test "$MINFO" = makeinfo_not_found ; then
88 echo Please install \"makeinfo\"
91 AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$RSH")
92 AC_CHECK_PROG(NROFF, nroff, [nroff -man], cat)
94 AC_PATH_PROGS(AWKPATH, awk mawk gawk nawk)
95 AC_PATH_PROGS(PERLPATH, perl)
102 AC_CHECK_HEADERS(stropts.h sys/time.h string.h unistd.h sys/systeminfo.h malloc.h)
103 AC_CHECK_HEADERS(fcntl.h sys/fcntl.h, break)
104 AC_CHECK_HEADERS(sys/socket.h lan/socket.h, break)
105 AC_CHECK_HEADER(stddef.h, [], AC_DEFINE(X_WCHAR, 1))
107 AC_CHECK_FUNCS(_getpty grantpt setitimer usleep)
108 AC_CHECK_FUNCS(gettimeofday ftime, break)
109 AC_CHECK_FUNCS(random rand48, break)
110 AC_CHECK_FUNCS(gethostname sysinfo, break)
111 AC_CHECK_FUNC(setlocale, [],
112 AC_CHECK_LIB(i, setlocale, [], AC_DEFINE(X_LOCALE, 1)))
114 AC_CHECK_LIB(seq, getpseudotty)
117 dnl | check for X-libraries
119 if test -n "$no_x" ; then
120 echo $PACKAGE requires the X Window System header files and libraries!
121 echo They were not found on your system. See FAQ topic C.2.
122 echo configure failed
126 AC_CHECK_HEADER(X11/Intrinsic.h,xt="yes",xt="no")
128 if test "$xt" = "no" ; then
129 echo Xt headers not found
133 dnl | test if user wants ot use Xaw3d headers
135 [AS_HELP_STRING([--with-Xaw3d],
136 [use Xaw3d instead of Xaw])],
141 AS_IF([test "x$with_xaw3d" != xno],
142 [AC_CHECK_LIB([Xaw3d],
144 [AC_SUBST([XAW_LIBS],
146 AC_DEFINE([USE_XAW3D], [1],
147 [Define if you want to use Xaw3d])],
148 [AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")
150 [--with-Xaw3d was given, but test for Xaw3d failed])],
152 if test "$with_xaw3d" = "no" ; then
159 if test "$xaw_headers" = "no" ; then
160 echo Xaw headers not found
166 dnl | test for readline
167 AC_ARG_WITH([readline],
168 [AS_HELP_STRING([--with-readline],
169 [support fancy command line editing @<:@default=yes@:>@])
175 AS_IF([test "x$with_readline" != xno],
176 [AC_CHECK_LIB([readline], [main],
177 [AC_SUBST([LIBREADLINE], ["-lreadline "])
178 AC_DEFINE([HAVE_LIBREADLINE], [1],
179 [Define if you have libreadline])
181 [if test "x$with_readline" != xyes; then
183 [--with-readline was given, but test for readline failed])
190 dnl| The following info is mostly gathered from GNU Emacs 19.24. Basically,
191 dnl| we are trying to find out whether this is a System-V derivative in
192 dnl| which pipes don't work with select() and if so, whether there is anything
193 dnl| strange about the way to open a pty. Some of the work was done above
194 dnl| by looking for _getpty, grantpt, and getpseudotty. A few other strange
195 dnl| properties of particular systems are also handled here.
197 dnl| 4/6/97 I'm not sure there really are any systems where pipes
198 dnl| don't work with select(), and ptys cause problems on many
199 dnl| systems, so I'm changing the default to disable ptys in all
200 dnl| cases. I will change it back if I get bug reports that are fixed
201 dnl| by doing a "configure --enable-ptys"
206 AC_DEFINE(PTY_TTY_NAME_SPRINTF,
207 [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])
208 AC_DEFINE(PTY_NAME_SPRINTF,
209 [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])
211 if test "$GCC" = yes; then
212 CONF_CFLAGS="-fwritable-strings"
215 dnl| Note: You might be able to build xboard even if your compiler does not
216 dnl| support ANSI C (-Aa). xboard itself does not require ANSI C. I don't
217 dnl| know whether the X header files on HP-UX require it.
219 CONF_CFLAGS="-Aa -D_HPUX_SOURCE"
222 dnl| HP doesn't supply a full set of X header files and libraries. People
223 dnl| often have some things installed in one place and some in another.
224 dnl| AC_PATH_XTRA will find only one place, so we try to add all the
225 dnl| likely ones that might be missing here. It might be better to
226 dnl| change AC_PATH_XTRA to try to extract this information from imake,
227 dnl| since folks who install the missing bits often configure their
228 dnl| imake to find them, but I don't want to delve into autoconf and
229 dnl| hack on its internals.
231 if test -d /opt/hppd/include/X11; then
232 X_CFLAGS="$X_CFLAGS -I/opt/hppd/include"
233 X_LIBS="$X_LIBS -L/opt/hppd/lib"
234 elif test -d /usr/contrib/X11R5/include; then
235 X_CFLAGS="$X_CFLAGS -I/usr/contrib/X11R5/include"
236 X_LIBS="$X_LIBS -L/usr/contrib/X11R5/lib"
237 elif test -d /usr/contrib/mitX11R5/include; then
238 X_CFLAGS="$X_CFLAGS -I/usr/contrib/mitX11R5/include"
239 X_LIBS="$X_LIBS -L/usr/contrib/mitX11R5/lib"
240 elif test -d /MIT/X11R5/include; then
241 X_CFLAGS="$X_CFLAGS -I/MIT/X11R5/include"
242 X_LIBS="$X_LIBS -L/MIT/X11R5/lib"
243 elif test -d /usr/local/include/X11R5; then
244 X_CFLAGS="$X_CFLAGS -I/usr/local/include/X11R5"
245 X_LIBS="$X_LIBS -L/usr/local/lib/X11R5"
247 if test -d /usr/include/X11R5; then
248 X_CFLAGS="$X_CFLAGS -I/usr/include/X11R5"
249 X_LIBS="$X_LIBS -L/usr/lib/X11R5 -L/usr/lib/X11R4"
250 elif test -d /usr/include/X11R4; then
251 X_CFLAGS="$X_CFLAGS -I/usr/include/X11R4"
252 X_LIBS="$X_LIBS -L/usr/lib/X11R4"
257 AC_DEFINE(IBMRTAIX, 1)
263 if test "$GCC" = yes; then
264 CONF_CFLAGS="-fwritable-strings"
268 *-*-aix3* | *-*-bosx* )
269 AC_DEFINE(PTY_ITERATION, [for (c = 0; !c; c++)])
270 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
271 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));])
276 AC_DEFINE(FIRST_PTY_LETTER, 'A')
277 AC_DEFINE(LAST_PTY_LETTER, 'P')
282 AC_DEFINE(UNIPLUS, 1)
287 AC_DEFINE(FIRST_PTY_LETTER, 'z')
288 AC_DEFINE(PTY_TTY_NAME_SPRINTF,
289 [sprintf (pty_name, "/dev/ttyp%x", i);])
290 AC_DEFINE(PTY_NAME_SPRINTF,
291 [sprintf (pty_name, "/dev/pty%x", i);])
296 *-*-iris* | *-*-irix3* )
297 AC_DEFINE(PTY_ITERATION, [for (c = 0; !c; c++)])
298 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
299 AC_DEFINE(PTY_TTY_NAME_SPRINTF,
300 [sprintf (pty_name, "/dev/ttyq%d", minor(stb.st_rdev));])
308 *-*-sunos4* | *-*-solaris1* )
310 dnl| Work around a bug in the SunOS 4.x linker. Not needed if you have patches
311 dnl| 100512-02 and 100573-03 from Sun. The X FAQ says that the following is
312 dnl| "overkill," but doesn't explain what should be done instead.
314 if test "$GCC" = yes; then
316 POST_XMULIB="-dynamic"
318 PRE_XMULIB="-Bstatic"
319 POST_XMULIB="-Bdynamic"
323 *-*-sunos5* | *-*-solaris2* )
326 dnl| I'm not sure -lelf is needed, but it was in the old Imakefile.
327 dnl| The other libraries should all be found by Ac_PATH_XTRA or other
330 X_LIBS="$X_LIBS -lelf"
334 AC_DEFINE(PTY_ITERATION, [for (i = 0; ; i++)])
335 AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptyp%d", i);])
336 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ttyp%d", i);])
340 *-*-dynix* | *-*-ptx* )
348 *-*-usg5-4* | *-*-sysvr4* )
352 *-*-usg* | *-*-sysv* | *-*-aix* )
357 if test "$GCC" = yes; then
358 CONF_CFLAGS="-fwritable-strings"
362 dnl| add some libs for OS X
367 AC_ARG_ENABLE( [xpm],
368 [AS_HELP_STRING([--enable-xpm],[libXpm will be used if found (default)])],
369 [enable_xpm="$enableval"],
372 if test x"$enable_xpm" != "xno"; then
373 save_cflags="$CFLAGS"
374 CFLAGS="$CFLAGS $X_CFLAGS"
375 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
376 AC_CHECK_HEADERS(X11/xpm.h)
377 CFLAGS="$save_cflags"
378 if test "$ac_cv_header_X11_xpm_h" = "yes"; then
379 save_ldflags="$LDFLAGS"
380 LDFLAGS="$LDFLAGS $X_LIBS"
381 AC_CHECK_LIB(Xpm, XpmReadFileToPixmap,
382 [X_PRE_LIBS="-lXpm $X_PRE_LIBS"; AC_DEFINE(HAVE_LIBXPM)], [],
383 [$X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
384 LDFLAGS="$save_ldflags"
389 AC_SUBST(POST_XMULIB)
390 AC_SUBST(CONF_CFLAGS)
391 AC_SUBST(CONF_LDFLAGS)
393 AC_MSG_CHECKING(whether ptys or pipes should be used)
394 AC_ARG_ENABLE( [ptys],
395 [AS_HELP_STRING([--enable-ptys],[force use of pseudo-ttys with child processes])],
396 [if test "$enableval" = yes; then
399 AC_MSG_RESULT([ptys (user override)])
401 if test "$enableval" = no; then
404 AC_MSG_RESULT([pipes (user override)])
406 [if test "$USE_PTYS" = 1; then
413 AC_DEFINE_UNQUOTED(USE_PTYS, $USE_PTYS)
416 dnl | define not to build zippy as a default, so that autoheader is happy
417 AC_DEFINE(ZIPPY, 0,[should zippy be enabled])
418 AC_ARG_ENABLE( [zippy],
419 [AS_HELP_STRING([--enable-zippy],[support interfacing a chess program to ICS (default)])],
421 [enable_zippy="yes"])
423 if test x"$enable_zippy" != xno; then
424 AC_DEFINE(ZIPPY, 1,[should zippy be enabled])
426 AM_CONDITIONAL([ZIPPY], [test x$enable_zippy != xno])
429 AC_ARG_ENABLE(sigint,
430 [AS_HELP_STRING([--enable-sigint],[sending SIGINT (^C) wakes up GNU Chess (default)])],
431 [if test "$enableval" = yes; then
432 AC_DEFINE(ATTENTION, 1)
434 enable_sigint=$enableval
437 AC_DEFINE(ATTENTION, 1)])
440 dnl | save all information for X in X_LIBS, also add the libraries themself
441 dnl | since AC_PATH_XTRA only adds the paths
442 X_LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXmu -lX11 -lXt "
447 AC_CONFIG_FILES([Makefile cmail])
448 AC_CONFIG_COMMANDS([test-stamp-h],[test -z "$CONFIG_HEADERS" || date > stamp-h])
449 AC_CONFIG_COMMANDS([chmod-cmail],[chmod 755 cmail])
456 echo " Configurations summary:"
458 echo " prefix: $prefix "
459 echo " datarootdir: $datarootdir "
460 echo " datadir: $datadir (icons will go in \$datadir\icons\hicolor\...)"
461 echo " infodir: $infodir (info files will go here)"
462 echo " sysconfdir: $sysconfdir (xboard.conf will go here)"
464 echo " Xaw3d: $with_xaw3d"
465 echo " readline: $with_readline"
467 echo " xpm: $enable_xpm"
468 echo " ptys: $enable_ptys"
469 echo " zippy: $enable_zippy"
470 echo " sigint: $enable_sigint"