1 # ------------------------------------------------------------
2 # GNU shogi and xshogi configuration script.
3 # ------------------------------------------------------------
5 dnl Process this file with autoconf to produce a configure script.
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.
18 AC_MSG_CHECKING(for C compiler)
25 # Check for parser generators.
29 AC_MSG_CHECKING([for yacc/bison, lex/flex, and install])
38 # Check for X windows.
49 [AS_HELP_STRING([--with-curses],
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])
62 [--with-curses was given, but test for curses failed])],
66 # Check for other libraries.
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 ]]
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)"
85 # Who knows what warnings your compiler uses?
87 CEXTRAFLAGS="\$(HASH)"
92 AC_SUBST(CEXTRAFLAGS2)
96 # Check for header files.
100 AC_MSG_CHECKING(for header files)
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)
112 # Check for typedefs, structures, and compiler characteristics.
116 AC_MSG_CHECKING(for typedefs)
128 AC_MSG_CHECKING(for compiler characteristics)
131 AC_CHECK_SIZEOF(long)
135 # Check for library functions.
139 AC_MSG_CHECKING(for library functions)
143 AC_PROG_GCC_TRADITIONAL
145 AC_FUNC_SETVBUF_REVERSED
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
160 # --with-first-shogi-program=PROGNAME
161 # --with-second-shogi-program=PROGNAME
162 # --with-first-host=HOSTNAME
163 # --with-second-host=HOSTNAME
167 FIRST_SHOGI_PROGRAM=gnushogi
168 SECOND_SHOGI_PROGRAM=gnushogi
170 SECOND_HOST=localhost
174 Compile the xshogi graphical interface to GNU shogi (default: no)],
175 with_xshogi=$withval,
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)],
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)
205 AC_SUBST(FIRST_SHOGI_PROGRAM)
206 AC_SUBST(SECOND_SHOGI_PROGRAM)
208 AC_SUBST(SECOND_HOST)
210 if [[ $with_xshogi = yes ]]
212 XSHOGI=xshogi_compile
213 XSHOGIINSTALL=xshogi_install
214 XSHOGICLEAN=xshogi_clean
222 AC_SUBST(XSHOGIINSTALL)
223 AC_SUBST(XSHOGICLEAN)
227 echo outputting files...
229 AC_CONFIG_FILES([Makefile
231 gnushogi/Makefile.profile