Removed unimplemented/broken parts (epd.[ch]/ICS and others).
[cboard.git] / configure.ac
blob3e5ae263f943590c1d1aff52bc992e836bb1f883
1 dnl $Id: configure.ac,v 1.18 2003-02-07 19:27:39 bjk Exp $
2 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.59)
4 AC_INIT(cboard, 0.1-git, [Ben Kibbey <bjk@luxsci.net>])
5 AC_CONFIG_AUX_DIR(build)
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE([foreign])
8 AC_PROG_MAKE_SET
9 AC_CONFIG_SRCDIR([src/cboard.c])
10 AM_CONFIG_HEADER([config.h])
12 case "$target_os" in
13     darwin*)
14         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
15         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
16         ;;
17     *)
18         ;;
19 esac
21 CFLAGS="$CFLAGS -D_GNU_SOURCE"
23 dnl Checks for programs.
24 AC_PROG_AWK
25 AC_PROG_LN_S
26 AC_PROG_CC
27 AC_PROG_INSTALL
29 dnl Checks for library functions.
30 AC_CHECK_LIB(ncurses, initscr, ,
31              [AC_MSG_ERROR([Missing or incomplete ncurses installation.])])
32 AC_CHECK_LIB(panel, new_panel, ,
33              [AC_MSG_ERROR([Missing or incomplete ncurses installation.])])
34 AC_CHECK_LIB(form, new_form, ,
35              [AC_MSG_ERROR([Missing or incomplete ncurses installation.])])
36 AC_CHECK_LIB(menu, new_menu, , 
37              [AC_MSG_ERROR([Missing or incomplete ncurses installation.])])
39 dnl Checks for header files.
40 AC_HEADER_DIRENT
41 AC_HEADER_SYS_WAIT
42 AC_HEADER_STDC
43 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h paths.h \
44                   sys/socket.h limits.h sys/time.h unistd.h stdlib.h string.h \
45                   ncurses.h panel.h form.h menu.h getopt.h sys/param.h \
46                   regex.h])
48 dnl Checks for typedefs, structures, and compiler characteristics.
49 AC_HEADER_STDBOOL
50 AC_C_CONST
51 AC_TYPE_PID_T
52 AC_TYPE_SIZE_T
53 AC_HEADER_TIME
54 AC_STRUCT_TM
56 dnl Checks for library functions.
57 AC_FUNC_CLOSEDIR_VOID
58 AC_FUNC_FORK
59 AC_FUNC_MALLOC
60 AC_FUNC_REALLOC
61 AC_FUNC_SELECT_ARGTYPES
62 AC_TYPE_SIGNAL
63 AC_FUNC_STAT
64 AC_FUNC_STRFTIME
65 AC_CHECK_FUNCS([bzero dup2 getcwd gethostbyname memset mkdir mkfifo regcomp \
66                 select socket strcasecmp strdup strerror strrchr strstr \
67                 vasprintf])
69 AH_TOP([/* Maximum line length in a PGN file. */
70 #define MAX_PGN_LINE_LEN 255])
72 AH_TOP([/* Maximum SAN move length without terminating NULL. */
73 #define MAX_SAN_MOVE_LEN 7])
75 AH_TOP([/* Maximum number of NAG entries per move. */
76 #define MAX_PGN_NAG 5])
78 AH_TOP([/* Default internet chess server. */
79 #define DEFAULT_ICS_SERVER "localhost"])
81 AH_TOP([/* Default internet chess server port. */
82 #define DEFAULT_ICS_PORT 5000])
84 AH_TOP([/* Default internet chess server username. */
85 #define DEFAULT_ICS_USER "guest"])
87 AH_TOP([/* Default chess engine. 0=gnuchess, 1=crafty. */ 
88 #define DEFAULT_ENGINE 0])
90 AC_DEFUN([AC_DEBUG],
92     if test "$1"; then
93         ac_cv_sys_debug=$1
94     fi
96     AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
97         [ac_cv_sys_debug=no])
99     if test "$ac_cv_sys_debug" = "yes"; then
100         CPPFLAGS="$CPPFLAGS -DDEBUG"
101     fi
104 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
105     AC_DEBUG([$enableval]), AC_DEBUG)
107 AC_MSG_CHECKING([for Unix98 pty support])
108 if test -c "/dev/ptmx"; then
109     have_ptmx=yes
110 else
111     have_ptmx=no
114 ptmx_works=no
116 if test "x$have_ptmx" = "xyes"; then
117     AC_RUN_IFELSE([\
118                    #include <stdio.h>
119                    #include <sys/types.h>
120                    #include <sys/stat.h>
121                    #include <fcntl.h>
123                    int main()
124                    {
125                        int fd;
127                        if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
128                            exit(1);
130                        if (ptsname(fd) == NULL)
131                            exit(1);
133                        exit(0);
134                    }
135                    ], [ptmx_works=yes], [ptmx_works=no])
137     if test "x$ptmx_works" = "xyes"; then
138         AC_MSG_RESULT([yes])
139         AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
140     else
141         AC_MSG_RESULT([no])
142     fi
145 if test "x$have_ptmx" = "xno" -o "x$ptmx_works" = "xno"; then
146 # From the GNU Screen package.
147     AC_MSG_CHECKING([pty ranges])
148     if test -d /dev/ptym; then
149     pdir='/dev/ptym'
150     else
151     pdir='/dev'
152     fi
154     ptys=`echo $pdir/pty??`
156     if test "$ptys" != "$pdir/pty??" ; then
157     p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
158     p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g'  | sort -u | tr -d '\012'`
160     AC_DEFINE_UNQUOTED([PTY_MAJOR], "$p0", [Pseudo tty ranges.])
161     AC_DEFINE_UNQUOTED([PTY_MINOR], "$p1", [Pseudo tty ranges.])
162     AC_MSG_RESULT($p0 $p1)
163     fi
166 AM_WITH_DMALLOC
168 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \
169                  test/Makefile])
170 AC_OUTPUT