1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl Copyright (C) 2001-2021 Free Software Foundation, Inc.
4dnl
5dnl This file is free software; as a special exception the author gives
6dnl unlimited permission to copy and/or distribute it, with or without
7dnl modifications, as long as this notice is preserved.
8dnl
9dnl This program is distributed in the hope that it will be useful, but
10dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13AC_INIT([GNU Chess], [6.2.9], [bug-gnu-chess@gnu.org], [gnuchess])
14AC_PREREQ(2.69)
15AC_CONFIG_HEADERS(src/config.h)
16AC_CONFIG_SRCDIR([src/main.cc])
17AM_INIT_AUTOMAKE
18
19dnl Checks for programs.
20AC_PROG_CC
21AC_PROG_CXX
22AM_PROG_AR
23AC_PROG_RANLIB
24AC_PROG_INSTALL
25AC_PROG_AWK
26AC_PROG_LN_S
27AC_STRUCT_TM
28AM_PROG_LEX
29
30dnl --with and --enable things
31AC_ARG_WITH(readline,
32	AC_HELP_STRING([--with-readline],
33	[use readline library if available (default is YES)]),
34	ac_cv_use_readline=$withval,
35	ac_cv_use_readline=yes)
36
37dnl Check for readline library _and_ headers
38if test x"$ac_cv_use_readline" = "xyes"; then
39	AC_CHECK_LIB(ncurses, tputs)
40	AC_CHECK_LIB(readline, readline)
41	AC_CHECK_HEADERS(readline/readline.h readline/history.h)
42fi
43
44dnl Checks for header files.
45AC_HEADER_STDC
46
47dnl Either we should make these checks fail with an
48dnl AC_MSG_ERROR or we should treat missing headers
49dnl with #ifdef somehow. (As it stands, it still gives
50dnl valuable debugging info for bug reports, but not more.)
51AC_CHECK_HEADERS(time.h sys/time.h unistd.h errno.h fcntl.h libintl.h)
52
53dnl Checks for typedefs, structures, and compiler characteristics.
54AC_C_CONST
55AC_C_VOLATILE
56AC_FUNC_REALLOC
57AC_HEADER_STDBOOL
58AC_C_INLINE
59AC_TYPE_SIZE_T
60AC_HEADER_TIME
61AX_CREATE_STDINT_H(src/GCint.h)
62
63dnl Checks for library functions.
64AC_TYPE_SIGNAL
65AC_FUNC_MALLOC
66AC_FUNC_MEMCMP
67
68dnl See above, how do we treat failure here?
69AC_CHECK_FUNCS(gettimeofday strchr strcspn strstr strerror memset strdup strtol)
70
71dnl Don't Check for getopt_long
72dnl just use bundled version like hello does
73dnl AC_SUBST(LIBOBJS)
74dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
75ACX_PTHREAD()
76
77# GNU help2man creates man pages from --help output; in many cases, this
78# is sufficient, and obviates the need to maintain man pages separately.
79# However, this means invoking executables, which we generally cannot do
80# when cross-compiling, so we test to avoid that (the variable
81# "cross_compiling" is set by AC_PROG_CC).
82if test $cross_compiling = no; then
83  AM_MISSING_PROG(HELP2MAN, help2man)
84else
85  HELP2MAN=:
86fi
87
88# Support from GNU gettext.
89AM_GNU_GETTEXT_VERSION([0.18.3])
90AM_GNU_GETTEXT([external])
91
92AC_ARG_WITH([pluginsdir],
93            [AS_HELP_STRING([--with-pluginsdir=DIR],
94                            [path where game data files get installed (default: $datadir/games/plugins)])],
95            [PLUGINSDIR="$withval"],
96            [PLUGINSDIR='$(datadir)/games/plugins'])
97
98AC_SUBST(PLUGINSDIR)
99
100AC_CONFIG_FILES(Makefile src/Makefile src/frontend/Makefile src/adapter/Makefile src/engine/Makefile doc/Makefile po/Makefile.in man/Makefile)
101AC_OUTPUT
102