Use SEEK_SET instead of literal 0 in lseek calls.
[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.2+],[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 AM_MAINTAINER_MODE
13
14 ##########
15 AC_MSG_NOTICE([C compiler])
16 AC_PROG_CC
17 AC_CANONICAL_BUILD
18 AC_PROG_INSTALL
19
20 ##########
21 AC_MSG_NOTICE([libs])
22
23 # curses
24 AC_ARG_WITH([curses],
25   [AS_HELP_STRING([--with-curses],
26     [enable curses UI (default: yes if available)])],
27   [],
28   [with_curses=check])
29
30 LIBCURSES=
31 AS_IF([test "x$with_curses" != xno],
32   [AC_CHECK_LIB([curses], [clrtoeol],
33     [AC_SUBST([LIBCURSES], [-lcurses])
34      AC_SUBST([CURSESDSP], [gnushogi-cursesdsp.o])
35      AC_SUBST([CURSESDSPMINI], [gnuminishogi-cursesdsp.o])
36      AC_DEFINE([HAVE_LIBCURSES], [1],
37                [Define if you have lib])
38     ],
39     [AS_IF([test "x$with_curses" = xyes],
40       [AC_MSG_ERROR(
41          [--with-curses was given, but test for curses failed])])],
42     [-ltermcap])])
43
44 # other libraries.
45 AC_CHECK_LIB([m], [pow])
46 AC_CHECK_LIB([termcap], [tgoto])
47
48
49
50 ##########
51 # C compiler warnings.
52
53 if [[ $ac_cv_c_compiler_gnu = yes ]]
54 then
55 WARNINGS="-Wall -Wno-implicit-int -Wstrict-prototypes"
56 CEXTRAFLAGS="-fsigned-char -funroll-loops"
57 else
58 # Who knows what warnings your compiler uses?
59 WARNINGS=
60 CEXTRAFLAGS=
61 fi
62
63 AC_SUBST(WARNINGS)
64 AC_SUBST(CEXTRAFLAGS)
65
66 ##########
67 AC_MSG_NOTICE([header files])
68
69 AC_HEADER_STDC
70 AC_HEADER_SYS_WAIT
71 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/file.h sys/ioctl.h])
72 AC_CHECK_HEADERS([sys/param.h sys/time.h unistd.h])
73 AC_CHECK_HEADERS(errno.h)
74 AC_HEADER_TIME
75
76 ##########
77 AC_MSG_NOTICE([typedefs])
78
79 AC_C_CONST
80 AC_HEADER_STDBOOL
81 AC_C_INLINE
82 AC_TYPE_PID_T
83 AC_TYPE_SIZE_T
84 AC_HEADER_TIME
85 AC_STRUCT_TM
86
87 ##########
88 AC_MSG_NOTICE([compiler characteristics])
89
90 AC_CHECK_SIZEOF(long)
91
92 ##########
93 AC_MSG_NOTICE([library functions])
94
95 AC_PROG_GCC_TRADITIONAL
96 AC_TYPE_SIGNAL
97 AC_CHECK_FUNCS([gettimeofday memset pow])
98 AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol])
99 AC_CHECK_FUNCS([memcpy bcopy])
100 AC_CHECK_FUNCS([setvbuf setlinebuf])
101
102
103 #
104 # Set various user-definable options.
105 #
106
107 AC_ARG_ENABLE([minishogi],
108 [  --enable-minishogi
109         Build gnuminishogi instead of gnushogi (default: no)],
110 [AC_DEFINE([MINISHOGI], [], [Define to build gnuminishogi instead of gnushogi])
111 AC_SUBST([PROGNAME], [gnuminishogi])
112 ],
113 [AC_SUBST([PROGNAME], [gnushogi])
114 ])
115
116 ##########
117
118 # don't build pat2inc when cross-compiling, we don't need it
119 if test "$cross_compiling" = no; then
120    AC_SUBST([PAT2INC], [pat2inc])
121    AC_SUBST([PAT2INCEXE], [pat2inc$EXEEXT])
122 fi
123
124 ##########
125 AC_CONFIG_FILES([Makefile
126                  gnushogi/Makefile
127                  doc/Makefile])
128 AC_OUTPUT