Fixed NAG annotations which are greater than the count in nag.data.
[cboard.git] / configure.ac
blobe801bc127b3f30c649d982f2ad8fe5e8810b8202
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(cboard, 0.2.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_CONFIG_SRCDIR([src/cboard.c])
9 AM_CONFIG_HEADER([config.h])
10 AC_CONFIG_SUBDIRS([libchess])
12 case "$target_os" in
13     darwin*)
14         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
15         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
16         ;;
17     *)
18         ;;
19 esac
21 CFLAGS="$CFLAGS -D_GNU_SOURCE"
23 dnl Checks for programs.
24 AC_PROG_AWK
25 AC_PROG_LN_S
26 AC_PROG_CC
27 AC_PROG_INSTALL
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.
39 AC_HEADER_DIRENT
40 AC_HEADER_SYS_WAIT
41 AC_HEADER_STDC
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 \
46                  putw_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.
67 AC_HEADER_STDBOOL
68 AC_C_CONST
69 AC_TYPE_PID_T
70 AC_TYPE_SIZE_T
71 AC_HEADER_TIME
72 AC_STRUCT_TM
74 dnl Checks for library functions.
75 AC_FUNC_ALLOCA
76 AC_FUNC_MEMCMP
77 AC_FUNC_VPRINTF
78 AC_FUNC_FORK
79 AC_FUNC_MALLOC
80 AC_FUNC_REALLOC
81 AC_FUNC_SELECT_ARGTYPES
82 AC_TYPE_SIGNAL
83 AC_FUNC_STAT
84 AC_FUNC_STRFTIME
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().]))
95 AC_DEFUN([AC_DEBUG],
97     if test "$1"; then
98         ac_cv_sys_debug=$1
99     fi
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
111     have_ptmx=yes
112 else
113     have_ptmx=no
116 ptmx_works=no
118 if test "x$have_ptmx" = "xyes"; then
119     AC_RUN_IFELSE([\
120                    #include <stdio.h>
121                    #include <sys/types.h>
122                    #include <sys/stat.h>
123                    #include <fcntl.h>
125                    int main()
126                    {
127                        int fd;
129                        if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
130                            exit(1);
132                        if (ptsname(fd) == NULL)
133                            exit(1);
135                        exit(0);
136                    }
137                    ], [ptmx_works=yes], [ptmx_works=no])
139     if test "x$ptmx_works" = "xyes"; then
140         AC_MSG_RESULT([yes])
141         AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
142     else
143         AC_MSG_RESULT([no])
144     fi
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
151     pdir='/dev/ptym'
152     else
153     pdir='/dev'
154     fi
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)
165     fi
168 AM_WITH_DMALLOC
170 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \
171                  test/Makefile])
172 AC_OUTPUT