1dnl Copyright 2010 The Kyua Authors.
2dnl All rights reserved.
3dnl
4dnl Redistribution and use in source and binary forms, with or without
5dnl modification, are permitted provided that the following conditions are
6dnl met:
7dnl
8dnl * Redistributions of source code must retain the above copyright
9dnl   notice, this list of conditions and the following disclaimer.
10dnl * Redistributions in binary form must reproduce the above copyright
11dnl   notice, this list of conditions and the following disclaimer in the
12dnl   documentation and/or other materials provided with the distribution.
13dnl * Neither the name of Google Inc. nor the names of its contributors
14dnl   may be used to endorse or promote products derived from this software
15dnl   without specific prior written permission.
16dnl
17dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29AC_INIT([Kyua], [0.14], [kyua-discuss@googlegroups.com], [kyua],
30        [https://github.com/jmmv/kyua/])
31AC_PREREQ([2.65])
32
33
34AC_COPYRIGHT([Copyright 2010 The Kyua Authors.])
35AC_CONFIG_AUX_DIR([admin])
36AC_CONFIG_FILES([Doxyfile Makefile utils/defs.hpp])
37AC_CONFIG_HEADERS([config.h])
38AC_CONFIG_MACRO_DIR([m4])
39AC_CONFIG_SRCDIR([main.cpp])
40AC_CONFIG_TESTDIR([bootstrap])
41
42
43AM_INIT_AUTOMAKE([1.9 foreign subdir-objects -Wall])
44
45
46AC_LANG([C++])
47AC_PROG_CXX
48AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
49m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
50KYUA_DEVELOPER_MODE([C++])
51KYUA_ATTRIBUTE_NORETURN
52KYUA_ATTRIBUTE_PURE
53KYUA_ATTRIBUTE_UNUSED
54KYUA_FS_MODULE
55KYUA_GETOPT
56KYUA_LAST_SIGNO
57KYUA_MEMORY
58AC_CHECK_FUNCS([putenv setenv unsetenv])
59AC_CHECK_HEADERS([termios.h])
60
61
62AC_PROG_RANLIB
63
64
65m4_ifndef([PKG_CHECK_MODULES],
66    [m4_fatal([Cannot find pkg.m4; see the INSTALL document for help])])
67
68m4_ifndef([ATF_CHECK_CXX],
69    [m4_fatal([Cannot find atf-c++.m4; see the INSTALL document for help])])
70ATF_CHECK_CXX([>= 0.17])
71m4_ifndef([ATF_CHECK_SH],
72    [m4_fatal([Cannot find atf-sh.m4; see the INSTALL document for help])])
73ATF_CHECK_SH([>= 0.15])
74m4_ifndef([ATF_ARG_WITH],
75    [m4_fatal([Cannot find atf-common.m4; see the INSTALL document for help])])
76ATF_ARG_WITH
77
78PKG_CHECK_MODULES([LUTOK], [lutok >= 0.4],
79                  [],
80                  AC_MSG_ERROR([lutok (0.4 or newer) is required]))
81PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.22],
82                  [],
83                  AC_MSG_ERROR([sqlite3 (3.6.22 or newer) is required]))
84KYUA_DOXYGEN
85AC_PATH_PROG([GDB], [gdb])
86test -n "${GDB}" || GDB=gdb
87AC_PATH_PROG([GIT], [git])
88
89
90KYUA_UNAME_ARCHITECTURE
91KYUA_UNAME_PLATFORM
92
93
94AC_ARG_VAR([KYUA_CONFSUBDIR],
95           [Subdirectory of sysconfdir under which to look for files])
96if test x"${KYUA_CONFSUBDIR-unset}" = x"unset"; then
97    KYUA_CONFSUBDIR=kyua
98else
99    case ${KYUA_CONFSUBDIR} in
100    /*)
101        AC_MSG_ERROR([KYUA_CONFSUBDIR must hold a relative path])
102        ;;
103    *)
104        ;;
105    esac
106fi
107if test x"${KYUA_CONFSUBDIR}" = x""; then
108    AC_SUBST(kyua_confdir, \${sysconfdir})
109else
110    AC_SUBST(kyua_confdir, \${sysconfdir}/${KYUA_CONFSUBDIR})
111fi
112
113
114dnl Allow the caller of 'make check', 'make installcheck' and 'make distcheck'
115dnl on the Kyua source tree to override the configuration file passed to our
116dnl own test runs.  This is for the development of Kyua only and the value of
117dnl this setting has no effect on the built product in any way.  If we go
118dnl through great extents in validating the value of this setting, it is to
119dnl minimize the chance of false test run negatives later on.
120AC_ARG_VAR([KYUA_CONFIG_FILE_FOR_CHECK],
121           [kyua.conf file to use at 'make (|dist|install)check' time])
122case "${KYUA_CONFIG_FILE_FOR_CHECK-none}" in
123none)
124    KYUA_CONFIG_FILE_FOR_CHECK=none
125    ;;
126/*)
127    if test -f "${KYUA_CONFIG_FILE_FOR_CHECK}"; then
128        : # All good!
129    else
130        AC_MSG_ERROR([KYUA_CONFIG_FILE_FOR_CHECK file does not exist])
131    fi
132    ;;
133*)
134    AC_MSG_ERROR([KYUA_CONFIG_FILE_FOR_CHECK must hold an absolute path])
135    ;;
136esac
137
138
139AC_ARG_VAR([KYUA_TMPDIR],
140           [Path to the directory in which to place work directories])
141case "${KYUA_TMPDIR:-unset}" in
142    unset)
143        KYUA_TMPDIR=/tmp
144        ;;
145    /*)
146        ;;
147    *)
148        AC_MSG_ERROR([KYUA_TMPDIR must be an absolute path])
149        ;;
150esac
151
152
153AC_SUBST(examplesdir, \${pkgdatadir}/examples)
154AC_SUBST(luadir, \${pkgdatadir}/lua)
155AC_SUBST(miscdir, \${pkgdatadir}/misc)
156AC_SUBST(pkgtestsdir, \${testsdir}/kyua)
157AC_SUBST(storedir, \${pkgdatadir}/store)
158AC_SUBST(testsdir, \${exec_prefix}/tests)
159
160
161dnl BSD make(1) doesn't deal with targets specified as './foo' well: they
162dnl need to be specified as 'foo'.  The following hack is to workaround this
163dnl issue.
164if test "${srcdir}" = .; then
165    target_srcdir=
166else
167    target_srcdir="${srcdir}/"
168fi
169AM_CONDITIONAL(TARGET_SRCDIR_EMPTY, [test -z "${target_srcdir}"])
170AC_SUBST([target_srcdir])
171
172
173AC_OUTPUT
174