1# ------------------------------------------------------------
2# GNU shogi and xshogi configuration script.
3# ------------------------------------------------------------
4
5dnl Process this file with autoconf to produce a configure script.
6
7AC_PREREQ(2.57)
8AC_INIT([gnushogi],[1.4.2],[https://savannah.gnu.org/bugs/?group=gnushogi])
9AC_CONFIG_SRCDIR([gnushogi/gnushogi.h])
10AC_CONFIG_HEADER(config.h)
11
12##########
13AC_MSG_NOTICE([C compiler])
14AC_PROG_CC
15AC_PROG_INSTALL
16
17##########
18AC_MSG_NOTICE([libs])
19
20# curses
21AC_ARG_WITH([curses],
22  [AS_HELP_STRING([--with-curses],
23    [enable curses UI (default: yes if available)])],
24  [],
25  [with_curses=check])
26
27LIBCURSES=
28AS_IF([test "x$with_curses" != xno],
29  [AC_CHECK_LIB([curses], [clrtoeol],
30    [AC_SUBST([LIBCURSES], [-lcurses])
31     AC_SUBST([CURSESDSP], [cursesdsp.o])
32     AC_DEFINE([HAVE_LIBCURSES], [1],
33               [Define if you have lib])
34    ],
35    [AS_IF([test "x$with_curses" = xyes],
36      [AC_MSG_ERROR(
37	 [--with-curses was given, but test for curses failed])])],
38    [-ltermcap])])
39
40# other libraries.
41AC_CHECK_LIB([m], [pow])
42AC_CHECK_LIB([termcap], [tgoto])
43
44
45
46##########
47# C compiler warnings.
48
49if [[ $ac_cv_c_compiler_gnu = yes ]]
50then
51WARNINGS="-Wall -Wno-implicit-int -Wstrict-prototypes -ansi -pedantic"
52CEXTRAFLAGS="-fsigned-char -funroll-loops"
53else
54# Who knows what warnings your compiler uses?
55WARNINGS=
56CEXTRAFLAGS=
57fi
58
59AC_SUBST(WARNINGS)
60AC_SUBST(CEXTRAFLAGS)
61
62##########
63AC_MSG_NOTICE([header files])
64
65AC_HEADER_STDC
66AC_HEADER_SYS_WAIT
67AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/file.h sys/ioctl.h])
68AC_CHECK_HEADERS([sys/param.h sys/time.h unistd.h])
69AC_CHECK_HEADERS(errno.h)
70AC_HEADER_TIME
71
72##########
73AC_MSG_NOTICE([typedefs])
74
75AC_C_CONST
76AC_HEADER_STDBOOL
77AC_C_INLINE
78AC_TYPE_PID_T
79AC_TYPE_SIZE_T
80AC_HEADER_TIME
81AC_STRUCT_TM
82
83##########
84AC_MSG_NOTICE([compiler characteristics])
85
86AC_CHECK_SIZEOF(long)
87
88##########
89AC_MSG_NOTICE([library functions])
90
91AC_PROG_GCC_TRADITIONAL
92AC_FUNC_MALLOC
93AC_TYPE_SIGNAL
94AC_CHECK_FUNCS([gettimeofday memset pow])
95AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol])
96AC_CHECK_FUNCS([memcpy bcopy])
97AC_CHECK_FUNCS([setvbuf setlinebuf])
98
99
100#
101# Set various user-definable options.
102#
103
104AC_ARG_ENABLE([minishogi],
105[  --enable-minishogi
106        Build gnuminishogi instead of gnushogi (default: no)],
107[AC_DEFINE([MINISHOGI], [], [Define to build gnuminishogi instead of gnushogi])
108AC_SUBST([PROGNAME], [gnuminishogi])
109],
110[AC_SUBST([PROGNAME], [gnushogi])
111])
112
113##########
114AC_CONFIG_FILES([Makefile
115                 gnushogi/Makefile
116                 win32/config.h
117                 doc/Makefile])
118AC_OUTPUT
119