Remove unnecessary double equals from configure.ac.
[xboard.git] / configure.ac
1 1;2205;0cdnl| configure.in
2 dnl|
3 dnl| Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, 2007, 
4 dnl| 2008, 2009, 2010 Free Software Foundation, Inc.
5 dnl|
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.
10 dnl| 
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.
15 dnl| 
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/.  
18 dnl| 
19 dnl| --------------------------------------------------------------------
20 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.
23 dnl|
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.
29
30 dnl| define second argument as VERSION.PATCHLEVEL. e.g. 4.4.0j
31 AC_INIT([xboard],[master-20100327],[bug-xboard@gnu.org])
32
33 dnl| need this to be able to compile some files in a subdir (filebrowser)
34 AM_INIT_AUTOMAKE([subdir-objects])
35
36 AC_CONFIG_HEADERS([config.h])
37
38 dnl | a bunch of templates for defines used below
39 AH_TEMPLATE([FIRST_PTY_LETTER],[template])
40 AH_TEMPLATE([HAVE_FCNTL_H],[template])
41 AH_TEMPLATE([HAVE_GETHOSTNAME],[template])
42 AH_TEMPLATE([HAVE_GETTIMEOFDAY],[template])
43 AH_TEMPLATE([HAVE_RANDOM],[template])
44 AH_TEMPLATE([HAVE_SYS_SOCKET_H],[template])
45 AH_TEMPLATE([IBMRTAIX],[template])
46 AH_TEMPLATE([LAST_PTY_LETTER],[template])
47 AH_TEMPLATE([PTY_ITERATION],[template])
48 AH_TEMPLATE([PTY_NAME_SPRINTF],[template])
49 AH_TEMPLATE([PTY_OPEN],[template])
50 AH_TEMPLATE([PTY_TTY_NAME_SPRINTF],[template])
51 AH_TEMPLATE([REMOTE_SHELL],[template])
52 AH_TEMPLATE([RTU],[template])
53 AH_TEMPLATE([UNIPLUS],[template])
54 AH_TEMPLATE([USE_PTYS],[template])
55 AH_TEMPLATE([X_WCHAR],[template])
56 AH_TEMPLATE([ATTENTION],[template])
57 AH_TEMPLATE([DEFINED_SYS_ERRLIST],[template])
58 AH_TEMPLATE([HAVE_LIBXPM],[template])
59 AH_TEMPLATE([USE_XAW3D],[template])
60 AH_TEMPLATE([X_LOCALE],[template])
61
62
63
64 if test -z "$CFLAGS" ; then
65 dnl| Prevent the next macro from setting CFLAGS to -g
66   CFLAGS=" "
67 fi
68 AC_PROG_CC
69
70 dnl| need this to be able to compile files in a subdir
71 AM_PROG_CC_C_O 
72
73 AC_PROG_CPP
74 AC_ISC_POSIX
75 AC_PROG_INSTALL
76
77 AC_PROG_LEX
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], [''])
82 fi
83
84
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\"
89    exit 1
90 fi
91 AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$RSH")
92 AC_CHECK_PROG(NROFF, nroff, [nroff -man], cat)
93 AC_SUBST(NROFFFLAGS)
94 AC_PATH_PROGS(AWKPATH, awk mawk gawk nawk)
95 AC_PATH_PROGS(PERLPATH, perl)
96
97 AC_HEADER_STDC
98 AC_HEADER_TIME
99 AC_HEADER_SYS_WAIT
100 AC_HEADER_DIRENT
101 AC_TYPE_SIGNAL
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))
106
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)))
113
114 AC_CHECK_LIB(seq, getpseudotty)
115
116
117 dnl | check for X-libraries
118 AC_PATH_XTRA
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
123   exit 1
124 fi
125
126 AC_CHECK_HEADER(X11/Intrinsic.h,xt="yes",xt="no")
127
128 if test "$xt" = "no" ; then
129    echo Xt headers not found
130    exit 1
131 fi
132
133 dnl | test if user wants ot use Xaw3d headers
134 AC_ARG_WITH([Xaw3d],
135             [AS_HELP_STRING([--with-Xaw3d],
136                             [use Xaw3d instead of Xaw])],
137             [with_xaw3d=yes],
138             [with_xaw3d=no])
139
140 XAW_LIBS=
141 AS_IF([test "x$with_xaw3d" != xno],
142       [AC_CHECK_LIB([Xaw3d], 
143                     [XawTextReplace],
144                     [AC_SUBST([XAW_LIBS], 
145                               ["-lXaw3d"])
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")
149                      AC_MSG_FAILURE(
150                                [--with-Xaw3d was given, but test for Xaw3d failed])],
151                                [-lXaw])])
152 if test "$with_xaw3d" = "no" ; then
153    XAW_LIBS="-lXaw"
154 fi
155 AC_SUBST(XAW_LIBS)
156
157 dnl | end Xaw3d test
158
159 if test "$xaw_headers" = "no" ; then
160    echo Xaw headers not found 
161    exit 1
162
163 fi
164
165
166 AC_CANONICAL_HOST
167
168 dnl| The following info is mostly gathered from GNU Emacs 19.24.  Basically,
169 dnl| we are trying to find out whether this is a System-V derivative in
170 dnl| which pipes don't work with select() and if so, whether there is anything
171 dnl| strange about the way to open a pty.  Some of the work was done above
172 dnl| by looking for _getpty, grantpt, and getpseudotty.  A few other strange
173 dnl| properties of particular systems are also handled here.
174
175 dnl| 4/6/97 I'm not sure there really are any systems where pipes
176 dnl| don't work with select(), and ptys cause problems on many
177 dnl| systems, so I'm changing the default to disable ptys in all
178 dnl| cases.  I will change it back if I get bug reports that are fixed
179 dnl| by doing a "configure --enable-ptys"
180
181 USE_PTYS=0
182 case "$host" in
183   *-*-hpux* )
184     AC_DEFINE(PTY_TTY_NAME_SPRINTF,
185         [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])
186     AC_DEFINE(PTY_NAME_SPRINTF,
187         [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])
188 dnl| USE_PTYS=1
189     if test "$GCC" = yes; then
190       CONF_CFLAGS="-fwritable-strings"
191     else
192
193 dnl| Note: You might be able to build xboard even if your compiler does not
194 dnl| support ANSI C (-Aa).  xboard itself does not require ANSI C.  I don't
195 dnl| know whether the X header files on HP-UX require it.
196
197       CONF_CFLAGS="-Aa -D_HPUX_SOURCE"
198     fi
199
200 dnl| HP doesn't supply a full set of X header files and libraries.  People
201 dnl| often have some things installed in one place and some in another. 
202 dnl| AC_PATH_XTRA will find only one place, so we try to add all the
203 dnl| likely ones that might be missing here.  It might be better to
204 dnl| change AC_PATH_XTRA to try to extract this information from imake,
205 dnl| since folks who install the missing bits often configure their
206 dnl| imake to find them, but I don't want to delve into autoconf and
207 dnl| hack on its internals.
208
209     if test -d /opt/hppd/include/X11; then
210       X_CFLAGS="$X_CFLAGS -I/opt/hppd/include"
211       X_LIBS="$X_LIBS -L/opt/hppd/lib"
212     elif test -d /usr/contrib/X11R5/include; then
213       X_CFLAGS="$X_CFLAGS -I/usr/contrib/X11R5/include"
214       X_LIBS="$X_LIBS -L/usr/contrib/X11R5/lib"
215     elif test -d /usr/contrib/mitX11R5/include; then
216       X_CFLAGS="$X_CFLAGS -I/usr/contrib/mitX11R5/include"
217       X_LIBS="$X_LIBS -L/usr/contrib/mitX11R5/lib"
218     elif test -d /MIT/X11R5/include; then
219       X_CFLAGS="$X_CFLAGS -I/MIT/X11R5/include"
220       X_LIBS="$X_LIBS -L/MIT/X11R5/lib"
221     elif test -d /usr/local/include/X11R5; then
222       X_CFLAGS="$X_CFLAGS -I/usr/local/include/X11R5"
223       X_LIBS="$X_LIBS -L/usr/local/lib/X11R5"
224     fi
225     if test -d /usr/include/X11R5; then
226       X_CFLAGS="$X_CFLAGS -I/usr/include/X11R5"
227       X_LIBS="$X_LIBS -L/usr/lib/X11R5 -L/usr/lib/X11R4"
228     elif test -d /usr/include/X11R4; then
229       X_CFLAGS="$X_CFLAGS -I/usr/include/X11R4"
230       X_LIBS="$X_LIBS -L/usr/lib/X11R4"
231     fi
232   ;;
233
234   romp-ibm-aix* )
235     AC_DEFINE(IBMRTAIX, 1)
236 dnl| USE_PTYS=1
237   ;;
238
239   i386-ibm-aix )
240 dnl| USE_PTYS=1
241     if test "$GCC" = yes; then
242       CONF_CFLAGS="-fwritable-strings"
243     fi
244   ;;
245
246   *-*-aix3* | *-*-bosx* )
247     AC_DEFINE(PTY_ITERATION, [for (c = 0; !c; c++)])
248     AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
249     AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));])
250 dnl| USE_PTYS=1
251   ;;
252
253   *-*-cxux* )
254     AC_DEFINE(FIRST_PTY_LETTER, 'A')
255     AC_DEFINE(LAST_PTY_LETTER, 'P')
256 dnl| USE_PTYS=1
257   ;;
258
259   *-*-uniplus* )
260     AC_DEFINE(UNIPLUS, 1)
261 dnl| USE_PTYS=1
262   ;;
263
264   *-*-rtu* )
265     AC_DEFINE(FIRST_PTY_LETTER, 'z')
266     AC_DEFINE(PTY_TTY_NAME_SPRINTF,
267         [sprintf (pty_name, "/dev/ttyp%x", i);])
268     AC_DEFINE(PTY_NAME_SPRINTF,
269         [sprintf (pty_name, "/dev/pty%x", i);])
270     AC_DEFINE(RTU, 1)
271 dnl| USE_PTYS=1
272   ;;
273
274   *-*-iris* | *-*-irix3* )
275     AC_DEFINE(PTY_ITERATION, [for (c = 0; !c; c++)])
276     AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
277     AC_DEFINE(PTY_TTY_NAME_SPRINTF,
278         [sprintf (pty_name, "/dev/ttyq%d", minor(stb.st_rdev));])
279 dnl| USE_PTYS=1
280   ;;
281
282   *-*-irix* )
283 dnl| USE_PTYS=1
284   ;;
285
286   *-*-sunos4* | *-*-solaris1* )
287
288 dnl| Work around a bug in the SunOS 4.x linker.  Not needed if you have patches
289 dnl|  100512-02 and 100573-03 from Sun.  The X FAQ says that the following is
290 dnl|  "overkill," but doesn't explain what should be done instead.
291
292     if test "$GCC" = yes; then
293       PRE_XMULIB="-static"
294       POST_XMULIB="-dynamic"
295     else
296       PRE_XMULIB="-Bstatic"
297       POST_XMULIB="-Bdynamic"
298     fi
299   ;;
300
301   *-*-sunos5* | *-*-solaris2* )
302 dnl| USE_PTYS=1
303
304 dnl| I'm not sure -lelf is needed, but it was in the old Imakefile.
305 dnl| The other libraries should all be found by Ac_PATH_XTRA or other
306 dnl| code above.
307
308     X_LIBS="$X_LIBS -lelf"
309   ;;
310
311   *-*-sco* )
312     AC_DEFINE(PTY_ITERATION, [for (i = 0; ; i++)])
313     AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptyp%d", i);])
314     AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ttyp%d", i);])
315 dnl| USE_PTYS=1
316   ;;
317         
318   *-*-dynix* | *-*-ptx* )
319 dnl| USE_PTYS=1
320   ;;
321
322   *-*-esix* )
323 dnl| USE_PTYS=1
324   ;;
325
326   *-*-usg5-4* | *-*-sysvr4* )
327 dnl| USE_PTYS=1
328   ;;
329
330   *-*-usg* | *-*-sysv* | *-*-aix* )
331 dnl| USE_PTYS=1
332   ;;
333
334   vax-*-ultrix )
335     if test "$GCC" = yes; then
336       CONF_CFLAGS="-fwritable-strings"
337     fi
338   ;;
339
340 dnl| add some libs for OS X
341   *-apple-* )
342   ;;
343 esac
344
345 AC_ARG_ENABLE(  [xpm],
346                 [AS_HELP_STRING([--enable-xpm],[libXpm will be used if found (default)])],
347                 [enable_xpm="$enableval"],
348                 [enable_xpm="yes"])
349
350 if test x"$enable_xpm" != "xno"; then
351   save_cflags="$CFLAGS"
352   CFLAGS="$CFLAGS $X_CFLAGS"
353   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
354   AC_CHECK_HEADERS(X11/xpm.h)
355   CFLAGS="$save_cflags"
356   if test "$ac_cv_header_X11_xpm_h" = "yes"; then
357     save_ldflags="$LDFLAGS"
358     LDFLAGS="$LDFLAGS $X_LIBS"
359     AC_CHECK_LIB(Xpm, XpmReadFileToPixmap,
360                  [X_PRE_LIBS="-lXpm $X_PRE_LIBS"; AC_DEFINE(HAVE_LIBXPM)], [],
361                  [$X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
362     LDFLAGS="$save_ldflags"
363   fi
364 fi
365
366 AC_SUBST(PRE_XMULIB)
367 AC_SUBST(POST_XMULIB)
368 AC_SUBST(CONF_CFLAGS)
369 AC_SUBST(CONF_LDFLAGS)
370
371 AC_MSG_CHECKING(whether ptys or pipes should be used)
372 AC_ARG_ENABLE( [ptys], 
373                [AS_HELP_STRING([--enable-ptys],[force use of pseudo-ttys with child processes])],
374 [if test "$enableval" = yes; then
375   USE_PTYS=1
376   enable_ptys="ptys"
377   AC_MSG_RESULT([ptys (user override)])
378 fi
379 if test "$enableval" = no; then
380   USE_PTYS=0
381   enable_ptys="pipes"
382   AC_MSG_RESULT([pipes (user override)])
383 fi],
384 [if test "$USE_PTYS" = 1; then
385   AC_MSG_RESULT(ptys)
386   enable_ptys="ptys"
387 else
388   AC_MSG_RESULT(pipes)
389   enable_ptys="pipes"
390 fi])
391 AC_DEFINE_UNQUOTED(USE_PTYS, $USE_PTYS)
392
393
394 dnl | define not to build zippy as a default, so that autoheader is happy
395 AC_DEFINE(ZIPPY, 0,[should zippy be enabled])
396 AC_ARG_ENABLE( [zippy], 
397                [AS_HELP_STRING([--enable-zippy],[support interfacing a chess program to ICS (default)])],
398                [], 
399                [enable_zippy="yes"])
400
401 if test x"$enable_zippy" != xno; then
402   AC_DEFINE(ZIPPY, 1,[should zippy be enabled])
403 fi
404 AM_CONDITIONAL([ZIPPY], [test x$enable_zippy != xno])
405
406
407 AC_ARG_ENABLE(sigint, 
408 [AS_HELP_STRING([--enable-sigint],[sending SIGINT (^C) wakes up GNU Chess (default)])],
409 [if test "$enableval" = yes; then
410   AC_DEFINE(ATTENTION, 1)
411 fi
412 enable_sigint=$enableval
413 ],
414 [enable_sigint="yes"
415 AC_DEFINE(ATTENTION, 1)])
416
417
418 dnl | save all information for X in X_LIBS, also add the libraries themself
419 dnl | since AC_PATH_XTRA only adds the paths
420 X_LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXmu -lX11 -lXt "    
421 AC_SUBST(X_CFLAGS)
422 AC_SUBST(X_LIBS)
423
424
425 AC_CONFIG_FILES([Makefile cmail])
426 AC_CONFIG_COMMANDS([test-stamp-h],[test -z "$CONFIG_HEADERS" || date > stamp-h])
427 AC_CONFIG_COMMANDS([chmod-cmail],[chmod 755 cmail])
428 AC_OUTPUT
429
430 dnl
431 dnl Output a summary
432 dnl
433 echo ""
434 echo " Configurations summary:"
435 echo ""
436 echo "        prefix:          $prefix       "
437 echo "        datarootdir:     $datarootdir  "
438 echo "        datadir:         $datadir   (icons will go in \$datadir\icons\hicolor\...)"
439 echo "        infodir:         $infodir   (info files will go here)"
440 echo "        sysconfdir:      $sysconfdir   (xboard.conf will go here)"
441 echo ""
442 echo "        Xaw3d:           $with_xaw3d"
443 echo ""
444 echo "        xpm:             $enable_xpm"
445 echo "        ptys:            $enable_ptys"
446 echo "        zippy:           $enable_zippy"
447 echo "        sigint:          $enable_sigint"