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