Remove more duplicate variable declarations.
[gnushogi.git] / configure.ac
blobe852a7376fb0789b979cc8ea31e22dd53e04adfb
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.4.1+],[https://savannah.gnu.org/bugs/?group=gnushogi])
9 AM_INIT_AUTOMAKE
10 AC_CONFIG_SRCDIR([gnushogi/gnushogi.h])
11 AC_CONFIG_HEADER(config.h)
13 ##########
14 AC_MSG_NOTICE([C compiler])
15 AC_PROG_CC
17 ##########
18 AC_MSG_NOTICE([yacc/bison, lex/flex, and install])
19 AC_PROG_YACC
20 AC_PROG_LEX
21 AC_PROG_INSTALL
23 ##########
24 AC_MSG_NOTICE([X])
25 AC_PATH_XTRA
27 ##########
28 AC_MSG_NOTICE([libs])
30 # curses
31 AC_ARG_WITH([curses],
32   [AS_HELP_STRING([--with-curses],
33     [enable curses UI (default: yes if available)])],
34   [],
35   [with_curses=check])
37 LIBCURSES=
38 AS_IF([test "x$with_curses" != xno],
39   [AC_CHECK_LIB([curses], [clrtoeol],
40     [AC_SUBST([LIBCURSES], [-lcurses])
41      AC_SUBST([CURSESDSP], [gnushogi-cursesdsp.o])
42      AC_SUBST([CURSESDSPMINI], [gnuminishogi-cursesdsp.o])
43      AC_DEFINE([HAVE_LIBCURSES], [1],
44                [Define if you have lib])
45     ],
46     [AS_IF([test "x$with_curses" = xyes],
47       [AC_MSG_ERROR(
48          [--with-curses was given, but test for curses failed])])],
49     [-ltermcap])])
51 # other libraries.
52 AC_CHECK_LIB([m], [pow])
53 AC_CHECK_LIB([termcap], [tgoto])
57 ##########
58 # C compiler warnings.
60 if [[ $ac_cv_c_compiler_gnu = yes ]]
61 then
62 WARNINGS="-Wall -Wno-implicit-int -Wstrict-prototypes -ansi"
63 CEXTRAFLAGS="-fsigned-char -funroll-loops"
64 else
65 # Who knows what warnings your compiler uses?
66 WARNINGS=
67 CEXTRAFLAGS=
70 AC_SUBST(WARNINGS)
71 AC_SUBST(CEXTRAFLAGS)
73 ##########
74 AC_MSG_NOTICE([header files])
76 AC_HEADER_STDC
77 AC_HEADER_SYS_WAIT
78 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/file.h sys/ioctl.h])
79 AC_CHECK_HEADERS([sys/param.h sys/time.h unistd.h])
80 AC_CHECK_HEADERS(errno.h)
81 AC_HEADER_TIME
83 ##########
84 AC_MSG_NOTICE([typedefs])
86 AC_C_CONST
87 AC_HEADER_STDBOOL
88 AC_C_INLINE
89 AC_TYPE_PID_T
90 AC_TYPE_SIZE_T
91 AC_HEADER_TIME
92 AC_STRUCT_TM
94 ##########
95 AC_MSG_NOTICE([compiler characteristics])
97 AC_CHECK_SIZEOF(long)
99 ##########
100 AC_MSG_NOTICE([library functions])
102 AC_FUNC_FORK
103 AC_PROG_GCC_TRADITIONAL
104 AC_FUNC_MALLOC
105 AC_TYPE_SIGNAL
106 AC_CHECK_FUNCS([dup2 gethostname gettimeofday memset pow strcasecmp])
107 AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol])
108 AC_CHECK_FUNCS([memcpy bcopy])
109 AC_CHECK_FUNCS([setvbuf setlinebuf])
113 # Set various user-definable options.
116 OPT=
117 FIRST_SHOGI_PROGRAM=gnushogi
118 SECOND_SHOGI_PROGRAM=gnushogi
119 FIRST_HOST=localhost
120 SECOND_HOST=localhost
122 AC_ARG_ENABLE([xshogi],
123 AS_HELP_STRING([--enable-xshogi],
124   [compile the xshogi graphical interface to GNU shogi (default: no)]),
125 [enable_xshogi=$enableval],
126 [enable_xshogi=no])
128 AC_ARG_WITH([top-part-bitmaps],
129 AS_HELP_STRING([--with-top-part-bitmaps],
130   [use top part of Kanji bitmaps only in xshogi]),
131 [OPT=-DTOP_PART_BITMAPS])
133 AC_ARG_WITH([first-shogi-program],
134 AS_HELP_STRING([--with-first-shogi-program=PROGNAME],
135   [use PROGNAME as the first shogi program in xshogi (default: gnushogi)]),
136 [FIRST_SHOGI_PROGRAM=$withval])
138 AC_ARG_WITH([second-shogi-program],
139 AS_HELP_STRING([--with-second-shogi-program=PROGNAME],
140   [use PROGNAME as the second shogi program in xshogi (default: gnushogi)]),
141 [SECOND_SHOGI_PROGRAM=$withval])
143 AC_ARG_WITH([first-host],
144 AS_HELP_STRING([--with-first-host=HOSTNAME],
145   [use HOSTNAME as the machine on which the first shogi program runs in xshogi (default: localhost)]),
146 [FIRST_HOST=$withval])
148 AC_ARG_WITH([second-host],
149 AS_HELP_STRING([--with-second-host=HOSTNAME],
150   [use HOSTNAME as the machine on which the second shogi program runs in xshogi (default: localhost)]),
151 [SECOND_HOST=$withval])
153 AC_SUBST(OPT)
154 AC_SUBST(FIRST_SHOGI_PROGRAM)
155 AC_SUBST(SECOND_SHOGI_PROGRAM)
156 AC_SUBST(FIRST_HOST)
157 AC_SUBST(SECOND_HOST)
159 if [[ $enable_xshogi = yes ]]
160 then
161 XSHOGI=xshogi
162 XSHOGIMAN=xshogi.6
163 XDOCS='$(XDOCS)'
164 else
165 XSHOGI=
166 XSHOGIMAN=
167 XDOCS=
170 AC_SUBST(XSHOGI)
171 AC_SUBST(XSHOGIMAN)
172 AC_SUBST(XDOCS)
174 ##########
175 AC_CONFIG_FILES([Makefile
176                  gnushogi/Makefile
177                  win32/config.h
178                  doc/Makefile
179                  xshogi/Makefile])
180 AC_OUTPUT