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.
38 LIBS="$CURSES_LIB $LIBS"
39 AC_MSG_CHECKING([if curses installation has wresize()])
40 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[void *w = 0; wresize(w, 0, 0);]])],
41 [have_curses_wresize=yes],
42 [have_curses_wresize=no])
43 AC_MSG_RESULT($have_curses_wresize)
44 if test x"$have_curses_wresize" = "xyes"; then
45 AC_DEFINE([HAVE_WRESIZE], 1, \
46 [Define if your curses installation contains wresize().])
49 AC_MSG_CHECKING([if curses installation has attr_t])
50 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
51 #if defined(HAVE_NCURSESW_CURSES_H)
52 # include <ncursesw/curses.h>
53 #elif defined(HAVE_NCURSESW_H)
54 # include <ncursesw.h>
55 #elif defined(HAVE_NCURSES_CURSES_H)
56 # include <ncurses/curses.h>
57 #elif defined(HAVE_NCURSES_H)
59 #elif defined(HAVE_CURSES_H)
62 # error "SysV or X/Open-compatible Curses header file required"
64 ]], [[attr_t n = 0;]])], [have_curses_attr_t=yes], [have_curses_attr_t=no])
65 AC_MSG_RESULT($have_curses_attr_t)
66 if test x"$have_curses_attr_t" = "xyes"; then
67 AC_DEFINE([HAVE_ATTR_T], 1, \
68 [Define if your curses installation contains attr_t.])
73 LIBS="$FORM_LIB $LIBS"
74 AC_MSG_CHECKING([if curses form installation defines TYPE_IPV4])
75 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
76 #if defined(HAVE_NCURSESW_FORM_H)
77 #include <ncursesw/form.h>
78 #elif defined(HAVE_NCURSES_FORM_H)
79 #include <ncurses/form.h>
80 #elif defined(HAVE_FORM_H)
83 #error "SysV-compatible Curses Form header file required"
85 ]], [[FIELDTYPE *t = TYPE_IPV4;]])],
86 [have_curses_form_ipv4=yes],
87 [have_curses_form_ipv4=no])
88 AC_MSG_RESULT($have_curses_form_ipv4)
89 if test x"$have_curses_form_ipv4" = "xyes"; then
90 AC_DEFINE([HAVE_TYPE_IPV4], 1, [Define if form.h defines TYPE_IPV4.])
95 AC_ARG_WITH(libperl, AC_HELP_STRING([--with-libperl], [PERL support.]),
96 want_libperl=yes, want_libperl=no)
98 AC_MSG_CHECKING([if PERL support is wanted])
99 AC_MSG_RESULT($want_libperl)
101 if test "$want_libperl" = "yes"; then
102 AC_CHECK_LIB(perl, perl_run, have_libperl=yes, have_libperl=no)
104 if test "$have_libperl" = "yes"; then
105 LIBPERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
107 if test $? -ne 0; then
108 AC_MSG_ERROR([Missing or incomplete PERL installation.])
111 AC_SUBST(LIBPERL_CFLAGS)
112 LIBPERL_LDFLAGS=`perl -MExtUtils::Embed -e ldopts`
113 AC_SUBST(LIBPERL_LDFLAGS)
114 AC_DEFINE([WITH_LIBPERL], 1, [Define if you want PERL support.])
116 AC_MSG_ERROR([Missing or incomplete PERL installation.])
120 AM_CONDITIONAL([WITH_LIBPERL], [test "$have_libperl" = "yes"])
121 dnl Checks for header files.
125 AC_CHECK_HEADERS([fcntl.h paths.h sys/socket.h limits.h sys/time.h unistd.h \
126 stdlib.h string.h strings.h wchar.h getopt.h sys/param.h \
127 regex.h stdarg.h paths.h])
128 AC_CHECK_HEADERS([err.h],, [AC_CHECK_FUNCS([fputs_unlocked putwc_unlocked \
131 AM_CONDITIONAL([NO_ERR_H], [test "x$ac_cv_header_err_h" = "xno"])
133 if test x"$ac_cv_header_err_h" = "xyes"; then
134 AC_MSG_CHECKING([for __progname])
135 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
138 extern char *__progname;
140 printf("%s\n", __progname);
141 ]])], [have_progname=yes], [have_progname=no])
142 AC_MSG_RESULT($have_progname)
143 if test x"$have_progname" = "xyes"; then
144 AC_DEFINE([HAVE_PROGNAME], 1, \
145 [Define if your system has __progname.])
149 AC_CHECK_HEADERS([glob.h])
150 if test x"$ac_cv_header_glob_h" = "xyes"; then
151 AC_MSG_CHECKING([if glob.h defines GLOB_NOMATCH])
152 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
155 int n = GLOB_NOMATCH;
156 ]])], [have_glob_nomatch=yes], [have_glob_nomatch=no])
157 AC_MSG_RESULT($have_glob_nomatch)
158 if test x"$have_glob_nomatch" = "xyes"; then
159 AC_DEFINE([HAVE_GLOB_NOMATCH], 1, \
160 [Define if glob.h defines GLOB_NOMATCH.])
164 dnl Checks for typedefs, structures, and compiler characteristics.
172 dnl Checks for library functions.
179 AC_FUNC_SELECT_ARGTYPES
183 AC_CHECK_FUNCS([bzero dup2 getcwd gethostbyname memset mkdir mkfifo regcomp \
184 select socket strcasecmp strdup strerror strrchr strstr \
185 vasprintf strsep strchr strncasecmp strpbrk putenv])
187 AM_CONDITIONAL([NO_STRSEP], [test "x$ac_cv_func_strsep" = "xno"])
195 AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
196 [ac_cv_sys_debug=no])
197 AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
200 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
201 AC_DEBUG([$enableval]), AC_DEBUG)
203 AC_MSG_CHECKING([for Unix98 pty support])
204 if test -c "/dev/ptmx"; then
212 if test "x$have_ptmx" = "xyes"; then
214 AC_RUN_IFELSE([AC_LANG_SOURCE([[\
216 #include <sys/types.h>
217 #include <sys/stat.h>
224 if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
227 if (ptsname(fd) == NULL)
232 ]])], [ptmx_works=yes], [ptmx_works=no])
234 if test "x$ptmx_works" = "xyes"; then
236 AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
242 if test "x$have_ptmx" = "xno" -o "x$ptmx_works" = "xno"; then
243 # From the GNU Screen package.
244 AC_MSG_CHECKING([pty ranges])
245 if test -d /dev/ptym; then
251 ptys=`echo $pdir/pty??`
253 if test "$ptys" != "$pdir/pty??" ; then
254 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
255 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
257 AC_DEFINE_UNQUOTED([PTY_MAJOR], "$p0", [Pseudo tty ranges.])
258 AC_DEFINE_UNQUOTED([PTY_MINOR], "$p1", [Pseudo tty ranges.])
259 AC_MSG_RESULT($p0 $p1)
263 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \
264 libchess/Makefile po/Makefile.in doc/cboard.6])