Fully quote autoconf macro arguments, as they should.
[gnushogi.git] / configure.ac
blobbae9d3d8190fd5a29b912d49b5029ad3bc627bea
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-rc0+],[https://savannah.gnu.org/bugs/?group=gnushogi])
9 AC_CONFIG_SRCDIR([gnushogi/gnushogi.h])
10 AC_CONFIG_HEADER(config.h)
12 ##########
13 AC_MSG_NOTICE([C compiler])
14 AC_PROG_CC
16 ##########
17 AC_MSG_NOTICE([yacc/bison, lex/flex, and install])
18 AC_PROG_YACC
19 AC_PROG_LEX
20 AC_PROG_INSTALL
22 ##########
23 AC_MSG_NOTICE([X])
24 AC_PATH_XTRA
26 ##########
27 AC_MSG_NOTICE([libs])
29 # curses
30 AC_ARG_WITH([curses],
31   [AS_HELP_STRING([--with-curses],
32     [enable curses UI (default: yes if available)])],
33   [],
34   [with_curses=check])
36 LIBCURSES=
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])
43     ],
44     [AS_IF([test "x$with_curses" = xyes],
45       [AC_MSG_ERROR(
46          [--with-curses was given, but test for curses failed])])],
47     [-ltermcap])])
49 # other libraries.
50 AC_CHECK_LIB([m], [pow])
51 AC_CHECK_LIB([termcap], [tgoto])
55 ##########
56 # C compiler warnings.
58 if [[ $ac_cv_c_compiler_gnu = yes ]]
59 then
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"
64 else
65 # Who knows what warnings your compiler uses?
66 WARNINGS=
67 CEXTRAFLAGS=
70 AC_SUBST(WARNINGS)
71 AC_SUBST(CEXTRAFLAGS)
72 AC_SUBST(CEXTRAFLAGS2)
74 ##########
75 AC_MSG_NOTICE([header files])
77 AC_HEADER_STDC
78 AC_HEADER_SYS_WAIT
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)
82 AC_HEADER_TIME
84 ##########
85 AC_MSG_NOTICE([typedefs])
87 AC_C_CONST
88 AC_HEADER_STDBOOL
89 AC_C_INLINE
90 AC_TYPE_PID_T
91 AC_TYPE_SIZE_T
92 AC_HEADER_TIME
93 AC_STRUCT_TM
95 ##########
96 AC_MSG_NOTICE([compiler characteristics])
98 AC_CHECK_SIZEOF(long)
100 ##########
101 AC_MSG_NOTICE([library functions])
103 AC_FUNC_FORK
104 AC_PROG_GCC_TRADITIONAL
105 AC_FUNC_MALLOC
106 AC_FUNC_SETVBUF_REVERSED
107 AC_TYPE_SIGNAL
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],
119 [  --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])
127 OPT=
128 FIRST_SHOGI_PROGRAM=gnushogi
129 SECOND_SHOGI_PROGRAM=gnushogi
130 FIRST_HOST=localhost
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],
137 [enable_xshogi=no])
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])
164 AC_SUBST(OPT)
165 AC_SUBST(FIRST_SHOGI_PROGRAM)
166 AC_SUBST(SECOND_SHOGI_PROGRAM)
167 AC_SUBST(FIRST_HOST)
168 AC_SUBST(SECOND_HOST)
170 if [[ $enable_xshogi = yes ]]
171 then
172 XSHOGI=xshogi_compile
173 XSHOGIINSTALL=xshogi_install
174 XSHOGICLEAN=xshogi_clean
175 else
176 XSHOGI=
177 XSHOGIINSTALL=
178 XSHOGICLEAN=
181 AC_SUBST(XSHOGI)
182 AC_SUBST(XSHOGIINSTALL)
183 AC_SUBST(XSHOGICLEAN)
185 ##########
186 AC_CONFIG_FILES([Makefile
187                  gnushogi/Makefile
188                  gnushogi/Makefile.profile
189                  doc/Makefile
190                  xshogi/Makefile])
191 AC_OUTPUT