Disabling default compilation of xshogi.
[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.3.2],[mvanier@cs.caltech.edu])
9 AC_CONFIG_SRCDIR([version.h])
10 AC_CONFIG_HEADER(config.h)
11
12
13 #
14 # Check for C compiler.
15 #
16
17 echo
18 AC_MSG_CHECKING(for C compiler)
19 echo
20
21 AC_PROG_CC
22
23
24 #
25 # Check for parser generators.
26 #
27
28 echo
29 AC_MSG_CHECKING([for yacc/bison, lex/flex, and install])
30 echo
31
32 AC_PROG_YACC
33 AC_PROG_LEX
34 AC_PROG_INSTALL
35
36
37 #
38 # Check for X windows.
39 #
40
41 echo
42 AC_PATH_XTRA
43
44
45 #
46 # Check for other libraries.
47 #
48
49 AC_CHECK_LIB(curses, clrtoeol)
50 AC_CHECK_LIB(m, pow)
51 dnl Replace `main' with a function in -ltermcap:
52 AC_CHECK_LIB(termcap, tgoto)
53
54
55 #
56 # C compiler warnings.
57 #
58
59 if [[ $ac_cv_c_compiler_gnu = yes ]]
60 then
61 WARNINGS="-Wall -Wno-implicit-int -Wstrict-prototypes -ansi -pedantic"
62 CEXTRAFLAGS="-fsigned-char -funroll-loops \$(HASH)"
63 # For profiling targets:
64 CEXTRAFLAGS2="-fsigned-char -pg -fprofile-arcs -ftest-coverage \$(HASH)"
65 else
66 # Who knows what warnings your compiler uses?
67 WARNINGS=
68 CEXTRAFLAGS="\$(HASH)"
69 fi
70
71 AC_SUBST(WARNINGS)
72 AC_SUBST(CEXTRAFLAGS)
73 AC_SUBST(CEXTRAFLAGS2)
74
75
76 #
77 # Check for header files.
78 #
79
80 echo
81 AC_MSG_CHECKING(for header files)
82 echo
83
84 AC_HEADER_STDC
85 AC_HEADER_SYS_WAIT
86 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/file.h sys/ioctl.h])
87 AC_CHECK_HEADERS([sys/param.h sys/time.h unistd.h])
88 AC_CHECK_HEADERS(errno.h)
89 AC_HEADER_TIME
90
91
92 #
93 # Check for typedefs, structures, and compiler characteristics.
94 #
95
96 echo 
97 AC_MSG_CHECKING(for typedefs)
98 echo
99
100 AC_C_CONST
101 AC_HEADER_STDBOOL
102 AC_C_INLINE
103 AC_TYPE_PID_T
104 AC_TYPE_SIZE_T
105 AC_HEADER_TIME
106 AC_STRUCT_TM
107
108 echo 
109 AC_MSG_CHECKING(for compiler characteristics)
110 echo
111
112 AC_CHECK_SIZEOF(long)
113
114
115 #
116 # Check for library functions.
117 #
118
119 echo
120 AC_MSG_CHECKING(for library functions)
121 echo
122
123 AC_FUNC_FORK
124 AC_PROG_GCC_TRADITIONAL
125 AC_FUNC_MALLOC
126 AC_FUNC_SETVBUF_REVERSED
127 AC_TYPE_SIGNAL
128 AC_CHECK_FUNCS([dup2 gethostname gettimeofday memset pow strcasecmp])
129 AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol])
130 AC_CHECK_FUNCS(memcpy bcopy)
131 AC_CHECK_FUNCS(setlinebuf setvbuf)
132
133
134 #
135 # Set various user-definable options.
136 #
137 # Valid OPT settings:
138 # --with-top-part-bitmaps
139 #
140 # Other settings:
141 # --with-first-shogi-program=PROGNAME
142 # --with-second-shogi-program=PROGNAME
143 # --with-first-host=HOSTNAME
144 # --with-second-host=HOSTNAME
145 #
146
147 OPT=
148 FIRST_SHOGI_PROGRAM=gnushogi
149 SECOND_SHOGI_PROGRAM=gnushogi
150 FIRST_HOST=localhost
151 SECOND_HOST=localhost
152
153 AC_ARG_WITH(top-part-bitmaps,
154 [  --with-top-part-bitmaps    Use top part of Kanji bitmaps only.],
155 OPT=-DTOP_PART_BITMAPS)
156
157 AC_ARG_WITH(first-shogi-program,
158 [  --with-first-shogi-program=PROGNAME    
159         Use PROGNAME as the first shogi program (default: gnushogi)],
160 FIRST_SHOGI_PROGRAM=$withval)
161
162 AC_ARG_WITH(second-shogi-program,
163 [  --with-second-shogi-program=PROGNAME    
164         Use PROGNAME as the second shogi program (default: gnushogi)],
165 SECOND_SHOGI_PROGRAM=$withval)
166
167 AC_ARG_WITH(first-host,
168 [  --with-first-host=HOSTNAME    
169         Use HOSTNAME as the machine on which the first shogi program 
170         runs (default: localhost)],
171 FIRST_HOST=$withval)
172
173 AC_ARG_WITH(second-host,
174 [  --with-second-host=HOSTNAME    
175         Use HOSTNAME as the machine on which the second shogi program 
176         runs (default: localhost)],
177 SECOND_HOST=$withval)
178
179 AC_ARG_WITH(xshogi,
180 [  --with-xshogi    
181         Compile the xshogi graphical interface to GNU shogi (default: no)],
182 with_xshogi=$withval,
183 with_xshogi=no)
184
185 AC_SUBST(OPT)
186 AC_SUBST(FIRST_SHOGI_PROGRAM)
187 AC_SUBST(SECOND_SHOGI_PROGRAM)
188 AC_SUBST(FIRST_HOST)
189 AC_SUBST(SECOND_HOST)
190
191 if [[ $with_xshogi = yes ]]
192 then
193 XSHOGI=xshogi_compile
194 XSHOGIINSTALL=xshogi_install
195 XSHOGICLEAN=xshogi_clean
196 else
197 XSHOGI=
198 XSHOGIINSTALL=
199 XSHOGICLEAN=
200 fi
201
202 AC_SUBST(XSHOGI)
203 AC_SUBST(XSHOGIINSTALL)
204 AC_SUBST(XSHOGICLEAN)
205
206
207 echo
208 echo outputting files...
209
210 AC_CONFIG_FILES([Makefile
211                  gnushogi/Makefile
212                                  gnushogi/Makefile.profile
213                  xshogi/Makefile])
214 AC_OUTPUT
215