1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cboard, 0.6.2-dev, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
6 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
7 AC_USE_SYSTEM_EXTENSIONS()
8 AM_CONFIG_HEADER([config.h])
9 AM_GNU_GETTEXT([external])
10 AM_GNU_GETTEXT_VERSION([0.18.1])
14 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
15 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
21 dnl Checks for programs.
31 dnl Checks for library functions.
37 AC_ARG_WITH(libperl, AC_HELP_STRING([--with-libperl], [PERL support.]),
38 want_libperl=yes, want_libperl=no)
40 AC_MSG_CHECKING([if PERL support is wanted])
41 AC_MSG_RESULT($want_libperl)
43 if test "$want_libperl" = "yes"; then
44 AC_CHECK_LIB(perl, perl_run, have_libperl=yes, have_libperl=no)
46 if test "$have_libperl" = "yes"; then
47 LIBPERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
49 if test $? -ne 0; then
50 AC_MSG_ERROR([Missing or incomplete PERL installation.])
53 AC_SUBST(LIBPERL_CFLAGS)
54 LIBPERL_LDFLAGS=`perl -MExtUtils::Embed -e ldopts`
55 AC_SUBST(LIBPERL_LDFLAGS)
56 AC_DEFINE([WITH_LIBPERL], 1, [Define if you want PERL support.])
58 AC_MSG_ERROR([Missing or incomplete PERL installation.])
62 AM_CONDITIONAL([WITH_LIBPERL], [test "$have_libperl" = "yes"])
63 dnl Checks for header files.
67 AC_CHECK_HEADERS([fcntl.h paths.h sys/socket.h limits.h sys/time.h unistd.h \
68 stdlib.h string.h strings.h curses.h panel.h form.h wchar.h \
69 getopt.h sys/param.h regex.h glob.h stdarg.h paths.h])
70 AC_CHECK_HEADERS([err.h],, [AC_CHECK_FUNCS([fputs_unlocked putwc_unlocked \
73 AM_CONDITIONAL([NO_ERR_H], [test "x$ac_cv_header_err_h" = "xno"])
75 AC_TRY_COMPILE([#include <curses.h>], [attr_t n = 0;],
76 AC_DEFINE([HAVE_ATTR_T], 1, \
77 [Define if your curses installation contains attr_t.]))
79 AC_TRY_LINK([#include <err.h>], [extern char *__progname;],
80 AC_DEFINE([HAVE_PROGNAME], 1, \
81 [Define if your system has __progname.]))
83 AC_TRY_COMPILE([#include <glob.h>], [int n = GLOB_NOMATCH;],
84 AC_DEFINE([HAVE_GLOB_NOMATCH], 1, \
85 [Define if glob.h defines GLOB_NOMATCH.]))
87 AC_TRY_COMPILE([#include <form.h>], [FIELDTYPE *t = TYPE_IPV4;],
88 AC_DEFINE([HAVE_TYPE_IPV4], 1, \
89 [Define if form.h defines TYPE_IPV4.]))
91 dnl Checks for typedefs, structures, and compiler characteristics.
99 dnl Checks for library functions.
106 AC_FUNC_SELECT_ARGTYPES
110 AC_CHECK_FUNCS([bzero dup2 getcwd gethostbyname memset mkdir mkfifo regcomp \
111 select socket strcasecmp strdup strerror strrchr strstr \
112 vasprintf strsep strchr strncasecmp strpbrk putenv])
118 AM_CONDITIONAL([NO_STRSEP], [test "x$ac_cv_func_strsep" = "xno"])
120 AC_TRY_LINK([#include <curses.h>], [WINDOW *w; wresize(w, 0, 0);],
121 AC_DEFINE([HAVE_WRESIZE], 1, \
122 [Define if your curses installation contains wresize().]))
130 AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
131 [ac_cv_sys_debug=no])
132 AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
135 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
136 AC_DEBUG([$enableval]), AC_DEBUG)
138 AC_MSG_CHECKING([for Unix98 pty support])
139 if test -c "/dev/ptmx"; then
147 if test "x$have_ptmx" = "xyes"; then
149 AC_RUN_IFELSE([AC_LANG_SOURCE([[\
151 #include <sys/types.h>
152 #include <sys/stat.h>
159 if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
162 if (ptsname(fd) == NULL)
167 ]])], [ptmx_works=yes], [ptmx_works=no])
169 if test "x$ptmx_works" = "xyes"; then
171 AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
177 if test "x$have_ptmx" = "xno" -o "x$ptmx_works" = "xno"; then
178 # From the GNU Screen package.
179 AC_MSG_CHECKING([pty ranges])
180 if test -d /dev/ptym; then
186 ptys=`echo $pdir/pty??`
188 if test "$ptys" != "$pdir/pty??" ; then
189 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
190 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
192 AC_DEFINE_UNQUOTED([PTY_MAJOR], "$p0", [Pseudo tty ranges.])
193 AC_DEFINE_UNQUOTED([PTY_MINOR], "$p1", [Pseudo tty ranges.])
194 AC_MSG_RESULT($p0 $p1)
200 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \
201 libchess/Makefile po/Makefile.in])