Version updates.
[cboard.git] / configure.ac
blob932073e7f1d8fdd039a2b1c2e0bdd6dc547628ce
1 dnl $Id: configure.ac,v 1.18 2003-02-07 19:27:39 bjk Exp $
2 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.59)
4 AC_INIT(cboard, 0.2.3, [Ben Kibbey bjk@luxsci.net])
5 AC_CONFIG_AUX_DIR(build)
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE([foreign])
8 AC_PROG_MAKE_SET
9 AC_CONFIG_SRCDIR([src/cboard.c])
10 AM_CONFIG_HEADER([config.h])
11 AC_CONFIG_SUBDIRS([libchess])
13 case "$target_os" in
14     darwin*)
15         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
16         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
17         ;;
18     *)
19         ;;
20 esac
22 CFLAGS="$CFLAGS -D_GNU_SOURCE"
24 dnl Checks for programs.
25 AC_PROG_AWK
26 AC_PROG_LN_S
27 AC_PROG_CC
28 AC_PROG_INSTALL
30 dnl Checks for library functions.
31 AC_CHECK_LIB(ncurses, initscr, ,
32              [AC_MSG_ERROR([Missing or incomplete ncurses installation.])])
33 AC_CHECK_LIB(panel, new_panel, ,
34              [AC_MSG_ERROR([Missing or incomplete ncurses installation.])])
35 AC_CHECK_LIB(form, new_form, ,
36              [AC_MSG_ERROR([Missing or incomplete ncurses 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 ncurses.h panel.h form.h getopt.h \
44                   sys/param.h regex.h wordexp.h])
46 dnl Checks for typedefs, structures, and compiler characteristics.
47 AC_HEADER_STDBOOL
48 AC_C_CONST
49 AC_TYPE_PID_T
50 AC_TYPE_SIZE_T
51 AC_HEADER_TIME
52 AC_STRUCT_TM
54 dnl Checks for library functions.
55 AC_FUNC_FORK
56 AC_FUNC_MALLOC
57 AC_FUNC_REALLOC
58 AC_FUNC_SELECT_ARGTYPES
59 AC_TYPE_SIGNAL
60 AC_FUNC_STAT
61 AC_FUNC_STRFTIME
62 AC_CHECK_FUNCS([bzero dup2 getcwd gethostbyname memset mkdir mkfifo regcomp \
63                 select socket strcasecmp strdup strerror strrchr strstr \
64                 vasprintf])
66 AC_DEFUN([AC_DEBUG],
68     if test "$1"; then
69         ac_cv_sys_debug=$1
70     fi
72     AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
73         [ac_cv_sys_debug=no])
75     if test "$ac_cv_sys_debug" = "yes"; then
76         CPPFLAGS="$CPPFLAGS -DDEBUG"
77     fi
80 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
81     AC_DEBUG([$enableval]), AC_DEBUG)
83 AC_MSG_CHECKING([for Unix98 pty support])
84 if test -c "/dev/ptmx"; then
85     have_ptmx=yes
86 else
87     have_ptmx=no
90 ptmx_works=no
92 if test "x$have_ptmx" = "xyes"; then
93     AC_RUN_IFELSE([\
94                    #include <stdio.h>
95                    #include <sys/types.h>
96                    #include <sys/stat.h>
97                    #include <fcntl.h>
99                    int main()
100                    {
101                        int fd;
103                        if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
104                            exit(1);
106                        if (ptsname(fd) == NULL)
107                            exit(1);
109                        exit(0);
110                    }
111                    ], [ptmx_works=yes], [ptmx_works=no])
113     if test "x$ptmx_works" = "xyes"; then
114         AC_MSG_RESULT([yes])
115         AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
116     else
117         AC_MSG_RESULT([no])
118     fi
121 if test "x$have_ptmx" = "xno" -o "x$ptmx_works" = "xno"; then
122 # From the GNU Screen package.
123     AC_MSG_CHECKING([pty ranges])
124     if test -d /dev/ptym; then
125     pdir='/dev/ptym'
126     else
127     pdir='/dev'
128     fi
130     ptys=`echo $pdir/pty??`
132     if test "$ptys" != "$pdir/pty??" ; then
133     p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
134     p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g'  | sort -u | tr -d '\012'`
136     AC_DEFINE_UNQUOTED([PTY_MAJOR], "$p0", [Pseudo tty ranges.])
137     AC_DEFINE_UNQUOTED([PTY_MINOR], "$p1", [Pseudo tty ranges.])
138     AC_MSG_RESULT($p0 $p1)
139     fi
142 AM_WITH_DMALLOC
144 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \
145                  test/Makefile])
146 AC_OUTPUT