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