1dnl Process this file with autoconf to produce a configure script.
2AC_REVISION($Revision: 1.4 $)
3
4AC_INIT(moon-buggy, 1.0.51, voss@seehuhn.de)
5AC_CONFIG_SRCDIR([moon-buggy.h])
6AM_INIT_AUTOMAKE
7AM_CONFIG_HEADER(config.h)
8
9AC_CANONICAL_HOST
10
11dnl Some systems want _XOPEN_SOURCE to be defined as we use curses.
12case "$host" in
13  *bsd*|sparc-sun-solaris2.4|*-*-darwin*) ;;
14  *) AC_DEFINE(_XOPEN_SOURCE,1,[Define this if your system supports it.]) ;;
15esac
16
17AC_ARG_WITH(setgid,
18[  --with-setgid=NAME      setgid usage: install moon-buggy as group NAME],
19[case "${withval}" in
20  no)  GAMEGROUP="" ;;
21  yes) AC_MSG_ERROR([missing argument for --with-setgid]) ;;
22  *)   GAMEGROUP="$withval" ;;
23esac])
24AC_SUBST(GAMEGROUP)
25
26dnl Checks for programs.
27AC_PROG_CC
28
29dnl Checks for libraries.
30AC_CHECK_LIB(m, modf)
31JV_CHECK_CURSES
32
33dnl Checks for header files.
34AC_HEADER_STDC
35AC_CHECK_HEADERS(getopt.h errno.h locale.h termios.h)
36
37# Check if <sys/select.h> needs to be included for fd_set
38AC_MSG_CHECKING([for fd_set])
39AC_TRY_COMPILE([#include <sys/types.h>],
40        [fd_set readMask, writeMask;], mb_ok=yes, mb_ok=no)
41if test $mb_ok = yes; then
42    AC_MSG_RESULT([yes, found in sys/types.h])
43else
44    AC_EGREP_HEADER(fd_mask, sys/select.h, mb_ok=yes)
45    if test $mb_ok = yes; then
46        AC_DEFINE(HAVE_SYS_SELECT_H,1,
47		  [Define if you have the <errno.h> header file.])
48        AC_MSG_RESULT([yes, found in sys/select.h])
49    else
50        AC_DEFINE(NO_FD_SET,1,[Define if your system lacks `fd_set'.])
51        AC_MSG_RESULT(no)
52    fi
53fi
54
55dnl Checks for typedefs, structures, and compiler characteristics.
56AC_C_CONST
57AC_TYPE_UID_T
58AC_TYPE_SIZE_T
59
60dnl Checks for library functions.
61AC_TYPE_SIGNAL
62AC_CHECK_FUNCS(fclean ftruncate getopt_long setreuid setlocale)
63
64AM_CONDITIONAL(short_getopt, test "x$ac_cv_func_getopt_long" != xyes)
65
66AC_CONFIG_FILES([Makefile])
67AC_OUTPUT
68