Don't update the screen as often. CPU time is nearly 0 now.
[cboard.git] / configure.ac
blobdb3927ff90b6578da62b8b1f640fb6b7249ac9ec
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(cboard, 0.4, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
5 AC_CANONICAL_TARGET
6 AM_INIT_AUTOMAKE([foreign])
7 AC_PROG_MAKE_SET
8 AC_DISABLE_SHARED
9 AC_PROG_LIBTOOL
10 AC_CONFIG_SRCDIR([src/cboard.c])
11 AM_CONFIG_HEADER([config.h])
12 #AC_CONFIG_SUBDIRS([libchess])
14 case "$target_os" in
15     darwin*)
16         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
17         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
18         ;;
19     *)
20         ;;
21 esac
23 CFLAGS="$CFLAGS -D_GNU_SOURCE"
25 dnl Checks for programs.
26 AC_PROG_AWK
27 AC_PROG_LN_S
28 AC_PROG_CC
29 AC_PROG_INSTALL
31 dnl Checks for library functions.
32 AC_CHECK_LIB(curses, initscr, ,
33              AC_CHECK_LIB(ncurses, initscr, ,
34              [AC_MSG_ERROR([Missing or incomplete curses installation.])]))
35 AC_CHECK_LIB(panel, new_panel, ,
36              [AC_MSG_ERROR([Missing or incomplete curses installation.])])
37 AC_CHECK_LIB(form, new_form, ,
38              [AC_MSG_ERROR([Missing or incomplete curses installation.])])
40 dnl Checks for header files.
41 AC_HEADER_DIRENT
42 AC_HEADER_SYS_WAIT
43 AC_HEADER_STDC
44 AC_CHECK_HEADERS([fcntl.h paths.h sys/socket.h limits.h sys/time.h unistd.h \
45                   stdlib.h string.h strings.h curses.h panel.h form.h wchar.h \
46                   getopt.h sys/param.h regex.h glob.h stdarg.h paths.h])
47 AC_CHECK_HEADERS([err.h],, [AC_CHECK_FUNCS([fputs_unlocked putwc_unlocked \
48                  putw_unlocked])])
50 AM_CONDITIONAL([NO_ERR_H], [test "x$ac_cv_header_err_h" = "xno"])
52 AC_TRY_COMPILE([#include <curses.h>], [attr_t n = 0;],
53                AC_DEFINE([HAVE_ATTR_T], 1, \
54                          [Define if your curses installation contains attr_t.]))
56 AC_TRY_LINK([#include <err.h>], [extern char *__progname;],
57                AC_DEFINE([HAVE_PROGNAME], 1, \
58                          [Define if your system has __progname.]))
60 AC_TRY_COMPILE([#include <glob.h>], [int n = GLOB_NOMATCH;],
61                AC_DEFINE([HAVE_GLOB_NOMATCH], 1, \
62                          [Define if glob.h defines GLOB_NOMATCH.]))
64 AC_TRY_COMPILE([#include <form.h>], [FIELDTYPE *t = TYPE_IPV4;],
65                AC_DEFINE([HAVE_TYPE_IPV4], 1, \
66                          [Define if form.h defines TYPE_IPV4.]))
68 dnl Checks for typedefs, structures, and compiler characteristics.
69 AC_HEADER_STDBOOL
70 AC_C_CONST
71 AC_TYPE_PID_T
72 AC_TYPE_SIZE_T
73 AC_HEADER_TIME
74 AC_STRUCT_TM
76 dnl Checks for library functions.
77 AC_FUNC_ALLOCA
78 AC_FUNC_MEMCMP
79 AC_FUNC_VPRINTF
80 AC_FUNC_FORK
81 AC_FUNC_MALLOC
82 AC_FUNC_REALLOC
83 AC_FUNC_SELECT_ARGTYPES
84 AC_TYPE_SIGNAL
85 AC_FUNC_STAT
86 AC_FUNC_STRFTIME
87 AC_CHECK_FUNCS([bzero dup2 getcwd gethostbyname memset mkdir mkfifo regcomp \
88                 select socket strcasecmp strdup strerror strrchr strstr \
89                 vasprintf strsep strchr strncasecmp strpbrk])
91 AM_CONDITIONAL([NO_STRSEP], [test "x$ac_cv_func_strsep" = "xno"])
93 AC_TRY_LINK([#include <curses.h>], [WINDOW *w; wresize(w, 0, 0);],
94            AC_DEFINE([HAVE_WRESIZE], 1, \
95                      [Define if your curses installation contains wresize().]))
97 AC_DEFUN([AC_DEBUG],
99     if test "$1"; then
100         ac_cv_sys_debug=$1
101     fi
103     AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
104         [ac_cv_sys_debug=no])
105     AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
108 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
109     AC_DEBUG([$enableval]), AC_DEBUG)
111 AC_MSG_CHECKING([for Unix98 pty support])
112 if test -c "/dev/ptmx"; then
113     have_ptmx=yes
114 else
115     have_ptmx=no
118 ptmx_works=no
120 if test "x$have_ptmx" = "xyes"; then
121     AC_RUN_IFELSE([\
122                    #include <stdio.h>
123                    #include <sys/types.h>
124                    #include <sys/stat.h>
125                    #include <fcntl.h>
127                    int main()
128                    {
129                        int fd;
131                        if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
132                            exit(1);
134                        if (ptsname(fd) == NULL)
135                            exit(1);
137                        exit(0);
138                    }
139                    ], [ptmx_works=yes], [ptmx_works=no])
141     if test "x$ptmx_works" = "xyes"; then
142         AC_MSG_RESULT([yes])
143         AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
144     else
145         AC_MSG_RESULT([no])
146     fi
149 if test "x$have_ptmx" = "xno" -o "x$ptmx_works" = "xno"; then
150 # From the GNU Screen package.
151     AC_MSG_CHECKING([pty ranges])
152     if test -d /dev/ptym; then
153     pdir='/dev/ptym'
154     else
155     pdir='/dev'
156     fi
158     ptys=`echo $pdir/pty??`
160     if test "$ptys" != "$pdir/pty??" ; then
161     p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
162     p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g'  | sort -u | tr -d '\012'`
164     AC_DEFINE_UNQUOTED([PTY_MAJOR], "$p0", [Pseudo tty ranges.])
165     AC_DEFINE_UNQUOTED([PTY_MINOR], "$p1", [Pseudo tty ranges.])
166     AC_MSG_RESULT($p0 $p1)
167     fi
170 AM_WITH_DMALLOC
172 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \
173                  test/Makefile libchess/Makefile])
174 AC_OUTPUT