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