1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cboard, 0.3, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
6 AM_INIT_AUTOMAKE([foreign])
10 AC_CONFIG_SRCDIR([src/cboard.c])
11 AM_CONFIG_HEADER([config.h])
12 #AC_CONFIG_SUBDIRS([libchess])
16 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
17 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
23 CFLAGS="$CFLAGS -D_GNU_SOURCE"
25 dnl Checks for programs.
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.
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 \
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.
76 dnl Checks for library functions.
83 AC_FUNC_SELECT_ARGTYPES
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().]))
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
120 if test "x$have_ptmx" = "xyes"; then
123 #include <sys/types.h>
124 #include <sys/stat.h>
131 if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
134 if (ptsname(fd) == NULL)
139 ], [ptmx_works=yes], [ptmx_works=no])
141 if test "x$ptmx_works" = "xyes"; then
143 AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
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
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)
172 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \
173 test/Makefile libchess/Makefile])