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.4.1-rc0+],[https://savannah.gnu.org/bugs/?group=gnushogi])
9 AC_CONFIG_SRCDIR([gnushogi/gnushogi.h])
10 AC_CONFIG_HEADER(config.h)
13 AC_MSG_NOTICE([C compiler])
17 AC_MSG_NOTICE([yacc/bison, lex/flex, and install])
31 [AS_HELP_STRING([--with-curses],
32 [enable curses UI (default: yes if available)])],
37 AS_IF([test "x$with_curses" != xno],
38 [AC_CHECK_LIB([curses], [clrtoeol],
39 [AC_SUBST([LIBCURSES], [-lcurses])
40 AC_SUBST([CURSESDSP], [cursesdsp.o])
41 AC_DEFINE([HAVE_LIBCURSES], [1],
42 [Define if you have lib])
44 [AS_IF([test "x$with_curses" = xyes],
46 [--with-curses was given, but test for curses failed])])],
50 AC_CHECK_LIB([m], [pow])
51 AC_CHECK_LIB([termcap], [tgoto])
56 # C compiler warnings.
58 if [[ $ac_cv_c_compiler_gnu = yes ]]
60 WARNINGS="-Wall -Wno-implicit-int -Wstrict-prototypes -ansi -pedantic"
61 CEXTRAFLAGS="-fsigned-char -funroll-loops"
62 # For profiling targets:
63 CEXTRAFLAGS2="-fsigned-char -pg -fprofile-arcs -ftest-coverage"
65 # Who knows what warnings your compiler uses?
72 AC_SUBST(CEXTRAFLAGS2)
75 AC_MSG_NOTICE([header files])
79 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/file.h sys/ioctl.h])
80 AC_CHECK_HEADERS([sys/param.h sys/time.h unistd.h])
81 AC_CHECK_HEADERS(errno.h)
85 AC_MSG_NOTICE([typedefs])
96 AC_MSG_NOTICE([compiler characteristics])
101 AC_MSG_NOTICE([library functions])
104 AC_PROG_GCC_TRADITIONAL
106 AC_FUNC_SETVBUF_REVERSED
108 AC_CHECK_FUNCS([dup2 gethostname gettimeofday memset pow strcasecmp])
109 AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol])
110 AC_CHECK_FUNCS([memcpy bcopy])
111 AC_CHECK_FUNCS([setlinebuf setvbuf])
115 # Set various user-definable options.
118 AC_ARG_ENABLE([minishogi],
120 Build gnuminishogi instead of gnushogi (default: no)],
121 [AC_DEFINE([MINISHOGI], [], [Define to build gnuminishogi instead of gnushogi])
122 AC_SUBST([PROGNAME], [gnuminishogi])
124 [AC_SUBST([PROGNAME], [gnushogi])
128 FIRST_SHOGI_PROGRAM=gnushogi
129 SECOND_SHOGI_PROGRAM=gnushogi
131 SECOND_HOST=localhost
133 AC_ARG_ENABLE([xshogi],
134 AS_HELP_STRING([--enable-xshogi],
135 [compile the xshogi graphical interface to GNU shogi (default: no)]),
136 [enable_xshogi=$enableval],
139 AC_ARG_WITH([top-part-bitmaps],
140 AS_HELP_STRING([--with-top-part-bitmaps],
141 [use top part of Kanji bitmaps only in xshogi]),
142 [OPT=-DTOP_PART_BITMAPS])
144 AC_ARG_WITH([first-shogi-program],
145 AS_HELP_STRING([--with-first-shogi-program=PROGNAME],
146 [use PROGNAME as the first shogi program in xshogi (default: gnushogi)]),
147 [FIRST_SHOGI_PROGRAM=$withval])
149 AC_ARG_WITH([second-shogi-program],
150 AS_HELP_STRING([--with-second-shogi-program=PROGNAME],
151 [use PROGNAME as the second shogi program in xshogi (default: gnushogi)]),
152 [SECOND_SHOGI_PROGRAM=$withval])
154 AC_ARG_WITH([first-host],
155 AS_HELP_STRING([--with-first-host=HOSTNAME],
156 [use HOSTNAME as the machine on which the first shogi program runs in xshogi (default: localhost)]),
157 [FIRST_HOST=$withval])
159 AC_ARG_WITH([second-host],
160 AS_HELP_STRING([--with-second-host=HOSTNAME],
161 [use HOSTNAME as the machine on which the second shogi program runs in xshogi (default: localhost)]),
162 [SECOND_HOST=$withval])
165 AC_SUBST(FIRST_SHOGI_PROGRAM)
166 AC_SUBST(SECOND_SHOGI_PROGRAM)
168 AC_SUBST(SECOND_HOST)
170 if [[ $enable_xshogi = yes ]]
172 XSHOGI=xshogi_compile
173 XSHOGIINSTALL=xshogi_install
174 XSHOGICLEAN=xshogi_clean
182 AC_SUBST(XSHOGIINSTALL)
183 AC_SUBST(XSHOGICLEAN)
186 AC_CONFIG_FILES([Makefile
188 gnushogi/Makefile.profile