1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cboard, 0.2.4, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
6 AM_INIT_AUTOMAKE([foreign])
8 AC_CONFIG_SRCDIR([src/cboard.c])
9 AM_CONFIG_HEADER([config.h])
10 AC_CONFIG_SUBDIRS([libchess])
14 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
15 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
21 CFLAGS="$CFLAGS -D_GNU_SOURCE"
23 dnl Checks for programs.
29 dnl Checks for library functions.
30 AC_CHECK_LIB(curses, initscr, ,
31 AC_CHECK_LIB(ncurses, initscr, ,
32 [AC_MSG_ERROR([Missing or incomplete curses installation.])]))
33 AC_CHECK_LIB(panel, new_panel, ,
34 [AC_MSG_ERROR([Missing or incomplete curses installation.])])
35 AC_CHECK_LIB(form, new_form, ,
36 [AC_MSG_ERROR([Missing or incomplete curses installation.])])
38 dnl Checks for header files.
42 AC_CHECK_HEADERS([fcntl.h paths.h sys/socket.h limits.h sys/time.h unistd.h \
43 stdlib.h string.h strings.h curses.h panel.h form.h wchar.h \
44 getopt.h sys/param.h regex.h glob.h stdarg.h paths.h])
45 AC_CHECK_HEADERS([err.h],, [AC_CHECK_FUNCS([fputs_unlocked putwc_unlocked \
48 AM_CONDITIONAL([NO_ERR_H], [test "x$ac_cv_header_err_h" = "xno"])
50 AC_TRY_COMPILE([#include <curses.h>], [attr_t n = 0;],
51 AC_DEFINE([HAVE_ATTR_T], 1, \
52 [Define if your curses installation contains attr_t.]))
54 AC_TRY_LINK([#include <err.h>], [extern char *__progname;],
55 AC_DEFINE([HAVE_PROGNAME], 1, \
56 [Define if your system has __progname.]))
58 AC_TRY_COMPILE([#include <glob.h>], [int n = GLOB_NOMATCH;],
59 AC_DEFINE([HAVE_GLOB_NOMATCH], 1, \
60 [Define if glob.h defines GLOB_NOMATCH.]))
62 AC_TRY_COMPILE([#include <form.h>], [FIELDTYPE *t = TYPE_IPV4;],
63 AC_DEFINE([HAVE_TYPE_IPV4], 1, \
64 [Define if form.h defines TYPE_IPV4.]))
66 dnl Checks for typedefs, structures, and compiler characteristics.
74 dnl Checks for library functions.
81 AC_FUNC_SELECT_ARGTYPES
85 AC_CHECK_FUNCS([bzero dup2 getcwd gethostbyname memset mkdir mkfifo regcomp \
86 select socket strcasecmp strdup strerror strrchr strstr \
87 vasprintf strsep strchr strncasecmp strpbrk])
89 AM_CONDITIONAL([NO_STRSEP], [test "x$ac_cv_func_strsep" = "xno"])
91 AC_TRY_LINK([#include <curses.h>], [WINDOW *w; wresize(w, 0, 0);],
92 AC_DEFINE([HAVE_WRESIZE], 1, \
93 [Define if your curses installation contains wresize().]))
101 AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
102 [ac_cv_sys_debug=no])
103 AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
106 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
107 AC_DEBUG([$enableval]), AC_DEBUG)
109 AC_MSG_CHECKING([for Unix98 pty support])
110 if test -c "/dev/ptmx"; then
118 if test "x$have_ptmx" = "xyes"; then
121 #include <sys/types.h>
122 #include <sys/stat.h>
129 if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
132 if (ptsname(fd) == NULL)
137 ], [ptmx_works=yes], [ptmx_works=no])
139 if test "x$ptmx_works" = "xyes"; then
141 AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
147 if test "x$have_ptmx" = "xno" -o "x$ptmx_works" = "xno"; then
148 # From the GNU Screen package.
149 AC_MSG_CHECKING([pty ranges])
150 if test -d /dev/ptym; then
156 ptys=`echo $pdir/pty??`
158 if test "$ptys" != "$pdir/pty??" ; then
159 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
160 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
162 AC_DEFINE_UNQUOTED([PTY_MAJOR], "$p0", [Pseudo tty ranges.])
163 AC_DEFINE_UNQUOTED([PTY_MINOR], "$p1", [Pseudo tty ranges.])
164 AC_MSG_RESULT($p0 $p1)
170 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \