Initiate new ChangeLog using git2cl.
[gnushogi.git] / configure.ac
blob85d880bcf3d12004064e5d4318624d9371f06bc6
1 # ------------------------------------------------------------
2 # GNU shogi and xshogi configuration script.
3 # ------------------------------------------------------------
5 dnl Process this file with autoconf to produce a configure script.
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)
14 # Check for C compiler.
17 echo
18 AC_MSG_CHECKING(for C compiler)
19 echo
21 AC_PROG_CC
25 # Check for parser generators.
28 echo
29 AC_MSG_CHECKING([for yacc/bison, lex/flex, and install])
30 echo
32 AC_PROG_YACC
33 AC_PROG_LEX
34 AC_PROG_INSTALL
38 # Check for X windows.
41 echo
42 AC_PATH_XTRA
45 # Check for ncurses.
48 AC_ARG_WITH([curses],
49   [AS_HELP_STRING([--with-curses],
50     [enable curses UI])],
51   [],
52   [with_curses=check])
54 LIBCURSES=
55 AS_IF([test "x$with_curses" != xno],
56   [AC_CHECK_LIB([curses], [clrtoeol],
57     [AC_SUBST([LIBCURSES], ["-lcurses"])
58      AC_DEFINE([HAVE_LIBCURSES], [1],
59                [Define if you have lib])
60     ],
61     [AC_MSG_FAILURE(
62        [--with-curses was given, but test for curses failed])],
63     [-ltermcap])])
66 # Check for other libraries.
69 AC_CHECK_LIB(m, pow)
70 dnl Replace `main' with a function in -ltermcap:
71 AC_CHECK_LIB(termcap, tgoto)
75 # C compiler warnings.
78 if [[ $ac_cv_c_compiler_gnu = yes ]]
79 then
80 WARNINGS="-Wall -Wno-implicit-int -Wstrict-prototypes -ansi -pedantic"
81 CEXTRAFLAGS="-fsigned-char -funroll-loops \$(HASH)"
82 # For profiling targets:
83 CEXTRAFLAGS2="-fsigned-char -pg -fprofile-arcs -ftest-coverage \$(HASH)"
84 else
85 # Who knows what warnings your compiler uses?
86 WARNINGS=
87 CEXTRAFLAGS="\$(HASH)"
90 AC_SUBST(WARNINGS)
91 AC_SUBST(CEXTRAFLAGS)
92 AC_SUBST(CEXTRAFLAGS2)
96 # Check for header files.
99 echo
100 AC_MSG_CHECKING(for header files)
101 echo
103 AC_HEADER_STDC
104 AC_HEADER_SYS_WAIT
105 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/file.h sys/ioctl.h])
106 AC_CHECK_HEADERS([sys/param.h sys/time.h unistd.h])
107 AC_CHECK_HEADERS(errno.h)
108 AC_HEADER_TIME
112 # Check for typedefs, structures, and compiler characteristics.
115 echo 
116 AC_MSG_CHECKING(for typedefs)
117 echo
119 AC_C_CONST
120 AC_HEADER_STDBOOL
121 AC_C_INLINE
122 AC_TYPE_PID_T
123 AC_TYPE_SIZE_T
124 AC_HEADER_TIME
125 AC_STRUCT_TM
127 echo 
128 AC_MSG_CHECKING(for compiler characteristics)
129 echo
131 AC_CHECK_SIZEOF(long)
135 # Check for library functions.
138 echo
139 AC_MSG_CHECKING(for library functions)
140 echo
142 AC_FUNC_FORK
143 AC_PROG_GCC_TRADITIONAL
144 AC_FUNC_MALLOC
145 AC_FUNC_SETVBUF_REVERSED
146 AC_TYPE_SIGNAL
147 AC_CHECK_FUNCS([dup2 gethostname gettimeofday memset pow strcasecmp])
148 AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol])
149 AC_CHECK_FUNCS(memcpy bcopy)
150 AC_CHECK_FUNCS(setlinebuf setvbuf)
154 # Set various user-definable options.
156 # Valid OPT settings:
157 # --with-top-part-bitmaps
159 # Other settings:
160 # --with-first-shogi-program=PROGNAME
161 # --with-second-shogi-program=PROGNAME
162 # --with-first-host=HOSTNAME
163 # --with-second-host=HOSTNAME
166 OPT=
167 FIRST_SHOGI_PROGRAM=gnushogi
168 SECOND_SHOGI_PROGRAM=gnushogi
169 FIRST_HOST=localhost
170 SECOND_HOST=localhost
172 AC_ARG_WITH(xshogi,
173 [  --with-xshogi
174         Compile the xshogi graphical interface to GNU shogi (default: no)],
175 with_xshogi=$withval,
176 with_xshogi=no)
178 AC_ARG_WITH(top-part-bitmaps,
179 [  --with-top-part-bitmaps    Use top part of Kanji bitmaps only in xshogi.],
180 OPT=-DTOP_PART_BITMAPS)
182 AC_ARG_WITH(first-shogi-program,
183 [  --with-first-shogi-program=PROGNAME    
184         Use PROGNAME as the first shogi program in xshogi (default: gnushogi)],
185 FIRST_SHOGI_PROGRAM=$withval)
187 AC_ARG_WITH(second-shogi-program,
188 [  --with-second-shogi-program=PROGNAME    
189         Use PROGNAME as the second shogi program in xshogi(default: gnushogi)],
190 SECOND_SHOGI_PROGRAM=$withval)
192 AC_ARG_WITH(first-host,
193 [  --with-first-host=HOSTNAME    
194         Use HOSTNAME as the machine on which the first shogi program 
195         runs in xshogi (default: localhost)],
196 FIRST_HOST=$withval)
198 AC_ARG_WITH(second-host,
199 [  --with-second-host=HOSTNAME    
200         Use HOSTNAME as the machine on which the second shogi program 
201         runs in xshogi (default: localhost)],
202 SECOND_HOST=$withval)
204 AC_SUBST(OPT)
205 AC_SUBST(FIRST_SHOGI_PROGRAM)
206 AC_SUBST(SECOND_SHOGI_PROGRAM)
207 AC_SUBST(FIRST_HOST)
208 AC_SUBST(SECOND_HOST)
210 if [[ $with_xshogi = yes ]]
211 then
212 XSHOGI=xshogi_compile
213 XSHOGIINSTALL=xshogi_install
214 XSHOGICLEAN=xshogi_clean
215 else
216 XSHOGI=
217 XSHOGIINSTALL=
218 XSHOGICLEAN=
221 AC_SUBST(XSHOGI)
222 AC_SUBST(XSHOGIINSTALL)
223 AC_SUBST(XSHOGICLEAN)
226 echo
227 echo outputting files...
229 AC_CONFIG_FILES([Makefile
230                  gnushogi/Makefile
231                                  gnushogi/Makefile.profile
232                  xshogi/Makefile])
233 AC_OUTPUT