Configure: stop abusing AC_MSG_CHECKING, use correct idioms.
[gnushogi.git] / configure.ac
1 # ------------------------------------------------------------
2 # GNU shogi and xshogi configuration script.
3 # ------------------------------------------------------------
4
5 dnl Process this file with autoconf to produce a configure script.
6
7 AC_PREREQ(2.57)
8 AC_INIT([gnushogi],[1.4.0+],[https://savannah.gnu.org/bugs/?group=gnushogi])
9 AC_CONFIG_SRCDIR([version.h])
10 AC_CONFIG_HEADER(config.h)
11
12 ##########
13 AC_MSG_NOTICE([C compiler])
14 AC_PROG_CC
15
16 ##########
17 AC_MSG_NOTICE([yacc/bison, lex/flex, and install])
18 AC_PROG_YACC
19 AC_PROG_LEX
20 AC_PROG_INSTALL
21
22 ##########
23 AC_MSG_NOTICE([X])
24 AC_PATH_XTRA
25
26 ##########
27 AC_MSG_NOTICE([libs])
28
29 # curses
30 AC_ARG_WITH([curses],
31   [AS_HELP_STRING([--with-curses],
32     [enable curses UI])],
33   [],
34   [with_curses=check])
35
36 LIBCURSES=
37 AS_IF([test "x$with_curses" != xno],
38   [AC_CHECK_LIB([curses], [clrtoeol],
39     [AC_SUBST([LIBCURSES], ["-lcurses"])
40      AC_DEFINE([HAVE_LIBCURSES], [1],
41                [Define if you have lib])
42     ],
43     [AC_MSG_ERROR(
44        [--with-curses was given, but test for curses failed])],
45     [-ltermcap])])
46
47 # other libraries.
48 AC_CHECK_LIB(m, pow)
49 AC_CHECK_LIB(termcap, tgoto)
50
51
52
53 ##########
54 # C compiler warnings.
55
56 if [[ $ac_cv_c_compiler_gnu = yes ]]
57 then
58 WARNINGS="-Wall -Wno-implicit-int -Wstrict-prototypes -ansi -pedantic"
59 CEXTRAFLAGS="-fsigned-char -funroll-loops \$(HASH)"
60 # For profiling targets:
61 CEXTRAFLAGS2="-fsigned-char -pg -fprofile-arcs -ftest-coverage \$(HASH)"
62 else
63 # Who knows what warnings your compiler uses?
64 WARNINGS=
65 CEXTRAFLAGS="\$(HASH)"
66 fi
67
68 AC_SUBST(WARNINGS)
69 AC_SUBST(CEXTRAFLAGS)
70 AC_SUBST(CEXTRAFLAGS2)
71
72 ##########
73 AC_MSG_NOTICE([header files])
74
75 AC_HEADER_STDC
76 AC_HEADER_SYS_WAIT
77 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/file.h sys/ioctl.h])
78 AC_CHECK_HEADERS([sys/param.h sys/time.h unistd.h])
79 AC_CHECK_HEADERS(errno.h)
80 AC_HEADER_TIME
81
82 ##########
83 AC_MSG_NOTICE([typedefs])
84
85 AC_C_CONST
86 AC_HEADER_STDBOOL
87 AC_C_INLINE
88 AC_TYPE_PID_T
89 AC_TYPE_SIZE_T
90 AC_HEADER_TIME
91 AC_STRUCT_TM
92
93 ##########
94 AC_MSG_NOTICE([compiler characteristics])
95
96 AC_CHECK_SIZEOF(long)
97
98 ##########
99 AC_MSG_NOTICE([library functions])
100
101 AC_FUNC_FORK
102 AC_PROG_GCC_TRADITIONAL
103 AC_FUNC_MALLOC
104 AC_FUNC_SETVBUF_REVERSED
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(setlinebuf setvbuf)
110
111
112 #
113 # Set various user-definable options.
114 #
115 # Valid OPT settings:
116 # --with-top-part-bitmaps
117 #
118 # Other settings:
119 # --with-first-shogi-program=PROGNAME
120 # --with-second-shogi-program=PROGNAME
121 # --with-first-host=HOSTNAME
122 # --with-second-host=HOSTNAME
123 #
124
125 OPT=
126 FIRST_SHOGI_PROGRAM=gnushogi
127 SECOND_SHOGI_PROGRAM=gnushogi
128 FIRST_HOST=localhost
129 SECOND_HOST=localhost
130
131 AC_ARG_ENABLE(xshogi,
132 [  --enable-xshogi
133         Compile the xshogi graphical interface to GNU shogi (default: no)],
134 enable_xshogi=$enableval,
135 enable_xshogi=no)
136
137 AC_ARG_WITH(top-part-bitmaps,
138 [  --with-top-part-bitmaps    Use top part of Kanji bitmaps only in xshogi.],
139 OPT=-DTOP_PART_BITMAPS)
140
141 AC_ARG_WITH(first-shogi-program,
142 [  --with-first-shogi-program=PROGNAME    
143         Use PROGNAME as the first shogi program in xshogi (default: gnushogi)],
144 FIRST_SHOGI_PROGRAM=$withval)
145
146 AC_ARG_WITH(second-shogi-program,
147 [  --with-second-shogi-program=PROGNAME    
148         Use PROGNAME as the second shogi program in xshogi (default: gnushogi)],
149 SECOND_SHOGI_PROGRAM=$withval)
150
151 AC_ARG_WITH(first-host,
152 [  --with-first-host=HOSTNAME    
153         Use HOSTNAME as the machine on which the first shogi program 
154         runs in xshogi (default: localhost)],
155 FIRST_HOST=$withval)
156
157 AC_ARG_WITH(second-host,
158 [  --with-second-host=HOSTNAME    
159         Use HOSTNAME as the machine on which the second shogi program 
160         runs in xshogi (default: localhost)],
161 SECOND_HOST=$withval)
162
163 AC_SUBST(OPT)
164 AC_SUBST(FIRST_SHOGI_PROGRAM)
165 AC_SUBST(SECOND_SHOGI_PROGRAM)
166 AC_SUBST(FIRST_HOST)
167 AC_SUBST(SECOND_HOST)
168
169 if [[ $enable_xshogi = yes ]]
170 then
171 XSHOGI=xshogi_compile
172 XSHOGIINSTALL=xshogi_install
173 XSHOGICLEAN=xshogi_clean
174 else
175 XSHOGI=
176 XSHOGIINSTALL=
177 XSHOGICLEAN=
178 fi
179
180 AC_SUBST(XSHOGI)
181 AC_SUBST(XSHOGIINSTALL)
182 AC_SUBST(XSHOGICLEAN)
183
184 ##########
185 AC_CONFIG_FILES([Makefile
186                  gnushogi/Makefile
187                  gnushogi/Makefile.profile
188                  xshogi/Makefile])
189 AC_OUTPUT