Use centralized version from configure.ac, drop use of separate patchlevel.
[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([gnushogi/gnushogi.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_SUBST([CURSESDSP], [cursesdsp.o])
41      AC_DEFINE([HAVE_LIBCURSES], [1],
42                [Define if you have lib])
43     ],
44     [AC_MSG_ERROR(
45        [--with-curses was given, but test for curses failed])],
46     [-ltermcap])])
47
48 # other libraries.
49 AC_CHECK_LIB(m, pow)
50 AC_CHECK_LIB(termcap, tgoto)
51
52
53
54 ##########
55 # C compiler warnings.
56
57 if [[ $ac_cv_c_compiler_gnu = yes ]]
58 then
59 WARNINGS="-Wall -Wno-implicit-int -Wstrict-prototypes -ansi -pedantic"
60 CEXTRAFLAGS="-fsigned-char -funroll-loops \$(HASH)"
61 # For profiling targets:
62 CEXTRAFLAGS2="-fsigned-char -pg -fprofile-arcs -ftest-coverage \$(HASH)"
63 else
64 # Who knows what warnings your compiler uses?
65 WARNINGS=
66 CEXTRAFLAGS="\$(HASH)"
67 fi
68
69 AC_SUBST(WARNINGS)
70 AC_SUBST(CEXTRAFLAGS)
71 AC_SUBST(CEXTRAFLAGS2)
72
73 ##########
74 AC_MSG_NOTICE([header files])
75
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
82
83 ##########
84 AC_MSG_NOTICE([typedefs])
85
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
93
94 ##########
95 AC_MSG_NOTICE([compiler characteristics])
96
97 AC_CHECK_SIZEOF(long)
98
99 ##########
100 AC_MSG_NOTICE([library functions])
101
102 AC_FUNC_FORK
103 AC_PROG_GCC_TRADITIONAL
104 AC_FUNC_MALLOC
105 AC_FUNC_SETVBUF_REVERSED
106 AC_TYPE_SIGNAL
107 AC_CHECK_FUNCS([dup2 gethostname gettimeofday memset pow strcasecmp])
108 AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol])
109 AC_CHECK_FUNCS(memcpy bcopy)
110 AC_CHECK_FUNCS(setlinebuf setvbuf)
111
112
113 #
114 # Set various user-definable options.
115 #
116 # Valid OPT settings:
117 # --with-top-part-bitmaps
118 #
119 # Other settings:
120 # --with-first-shogi-program=PROGNAME
121 # --with-second-shogi-program=PROGNAME
122 # --with-first-host=HOSTNAME
123 # --with-second-host=HOSTNAME
124 #
125
126 OPT=
127 FIRST_SHOGI_PROGRAM=gnushogi
128 SECOND_SHOGI_PROGRAM=gnushogi
129 FIRST_HOST=localhost
130 SECOND_HOST=localhost
131
132 AC_ARG_ENABLE(xshogi,
133 [  --enable-xshogi
134         Compile the xshogi graphical interface to GNU shogi (default: no)],
135 enable_xshogi=$enableval,
136 enable_xshogi=no)
137
138 AC_ARG_WITH(top-part-bitmaps,
139 [  --with-top-part-bitmaps    Use top part of Kanji bitmaps only in xshogi.],
140 OPT=-DTOP_PART_BITMAPS)
141
142 AC_ARG_WITH(first-shogi-program,
143 [  --with-first-shogi-program=PROGNAME    
144         Use PROGNAME as the first shogi program in xshogi (default: gnushogi)],
145 FIRST_SHOGI_PROGRAM=$withval)
146
147 AC_ARG_WITH(second-shogi-program,
148 [  --with-second-shogi-program=PROGNAME    
149         Use PROGNAME as the second shogi program in xshogi (default: gnushogi)],
150 SECOND_SHOGI_PROGRAM=$withval)
151
152 AC_ARG_WITH(first-host,
153 [  --with-first-host=HOSTNAME    
154         Use HOSTNAME as the machine on which the first shogi program 
155         runs in xshogi (default: localhost)],
156 FIRST_HOST=$withval)
157
158 AC_ARG_WITH(second-host,
159 [  --with-second-host=HOSTNAME    
160         Use HOSTNAME as the machine on which the second shogi program 
161         runs in xshogi (default: localhost)],
162 SECOND_HOST=$withval)
163
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)
169
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=
179 fi
180
181 AC_SUBST(XSHOGI)
182 AC_SUBST(XSHOGIINSTALL)
183 AC_SUBST(XSHOGICLEAN)
184
185 ##########
186 AC_CONFIG_FILES([Makefile
187                  gnushogi/Makefile
188                  gnushogi/Makefile.profile
189                  xshogi/Makefile])
190 AC_OUTPUT