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.0+],[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])])],
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 \$(HASH)"
62 # For profiling targets:
63 CEXTRAFLAGS2="-fsigned-char -pg -fprofile-arcs -ftest-coverage \$(HASH)"
65 # Who knows what warnings your compiler uses?
67 CEXTRAFLAGS="\$(HASH)"
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.
117 # Valid OPT settings:
118 # --with-top-part-bitmaps
121 # --with-first-shogi-program=PROGNAME
122 # --with-second-shogi-program=PROGNAME
123 # --with-first-host=HOSTNAME
124 # --with-second-host=HOSTNAME
128 FIRST_SHOGI_PROGRAM=gnushogi
129 SECOND_SHOGI_PROGRAM=gnushogi
131 SECOND_HOST=localhost
133 AC_ARG_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 [ --with-top-part-bitmaps Use top part of Kanji bitmaps only in xshogi.],
141 OPT=-DTOP_PART_BITMAPS)
143 AC_ARG_WITH(first-shogi-program,
144 [ --with-first-shogi-program=PROGNAME
145 Use PROGNAME as the first shogi program in xshogi (default: gnushogi)],
146 FIRST_SHOGI_PROGRAM=$withval)
148 AC_ARG_WITH(second-shogi-program,
149 [ --with-second-shogi-program=PROGNAME
150 Use PROGNAME as the second shogi program in xshogi (default: gnushogi)],
151 SECOND_SHOGI_PROGRAM=$withval)
153 AC_ARG_WITH(first-host,
154 [ --with-first-host=HOSTNAME
155 Use HOSTNAME as the machine on which the first shogi program
156 runs in xshogi (default: localhost)],
159 AC_ARG_WITH(second-host,
160 [ --with-second-host=HOSTNAME
161 Use HOSTNAME as the machine on which the second shogi program
162 runs in xshogi (default: localhost)],
163 SECOND_HOST=$withval)
166 AC_SUBST(FIRST_SHOGI_PROGRAM)
167 AC_SUBST(SECOND_SHOGI_PROGRAM)
169 AC_SUBST(SECOND_HOST)
171 if [[ $enable_xshogi = yes ]]
173 XSHOGI=xshogi_compile
174 XSHOGIINSTALL=xshogi_install
175 XSHOGICLEAN=xshogi_clean
183 AC_SUBST(XSHOGIINSTALL)
184 AC_SUBST(XSHOGICLEAN)
187 AC_CONFIG_FILES([Makefile
189 gnushogi/Makefile.profile