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