1dnl 2dnl Automated Testing Framework (atf) 3dnl 4dnl Copyright (c) 2007 The NetBSD Foundation, Inc. 5dnl All rights reserved. 6dnl 7dnl Redistribution and use in source and binary forms, with or without 8dnl modification, are permitted provided that the following conditions 9dnl are met: 10dnl 1. Redistributions of source code must retain the above copyright 11dnl notice, this list of conditions and the following disclaimer. 12dnl 2. Redistributions in binary form must reproduce the above copyright 13dnl notice, this list of conditions and the following disclaimer in the 14dnl documentation and/or other materials provided with the distribution. 15dnl 16dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND 17dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 18dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28dnl 29 30dnl ----------------------------------------------------------------------- 31dnl Initialize the GNU build system. 32dnl ----------------------------------------------------------------------- 33 34AC_INIT([Automated Testing Framework], [0.17], [atf-devel@NetBSD.org], [atf], 35 [http://code.google.com/p/kyua/wiki/ATF]) 36AC_PREREQ([2.65]) 37AC_COPYRIGHT([Copyright (c) 2007-2012 The NetBSD Foundation, Inc.]) 38AC_DEFINE([PACKAGE_COPYRIGHT], 39 ["Copyright (c) 2007-2012 The NetBSD Foundation, Inc."], 40 [Define to the copyright string applicable to this package.]) 41AC_CONFIG_AUX_DIR([admin]) 42AC_CONFIG_HEADERS([bconfig.h]) 43AC_CONFIG_MACRO_DIR([m4]) 44AC_CONFIG_SRCDIR([atf-c.h]) 45AC_CONFIG_TESTDIR([bootstrap]) 46 47AC_CANONICAL_TARGET 48 49AM_INIT_AUTOMAKE([1.9 check-news foreign subdir-objects -Wall]) 50 51LT_INIT 52 53AC_ARG_ENABLE(tools, 54 AS_HELP_STRING([--enable-tools], 55 [Enables the build of the deprecated ATF tools]), 56 [case $enableval in 57 yes|no) enable_tools=${enableval} ;; 58 *) AC_MSG_ERROR([Invalid value passed to --enable-tools]) ;; 59 esac], 60 [enable_tools=no]) 61AC_SUBST([ENABLE_TOOLS], ${enable_tools}) 62AM_CONDITIONAL([ENABLE_TOOLS], [test "${enable_tools}" = yes]) 63 64dnl ----------------------------------------------------------------------- 65dnl Check for the C and C++ compilers and required features. 66dnl ----------------------------------------------------------------------- 67 68AC_LANG(C) 69AC_PROG_CC 70AM_PROG_CC_C_O 71dnl The C compiler check automatically aborts if the compiler does not work. 72dnl Nothing to do here. 73 74AC_LANG(C++) 75AC_PROG_CXX 76AC_CACHE_CHECK([whether the C++ compiler works], 77 [atf_cv_prog_cxx_works], 78 [AC_LANG_PUSH([C++]) 79 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], 80 [atf_cv_prog_cxx_works=yes], 81 [atf_cv_prog_cxx_works=no]) 82 AC_LANG_POP]) 83if test "${atf_cv_prog_cxx_works}" = no; then 84 AC_MSG_ERROR([C++ compiler cannot create executables]) 85fi 86 87KYUA_DEVELOPER_MODE([C,C++]) 88 89ATF_MODULE_APPLICATION 90ATF_MODULE_DEFS 91ATF_MODULE_ENV 92ATF_MODULE_FS 93ATF_MODULE_SANITY 94ATF_MODULE_SIGNALS 95 96AC_CHECK_TYPE([timer_t], [], [], [[#include <time.h>]]) 97 98ATF_RUNTIME_TOOL([ATF_BUILD_CC], 99 [C compiler to use at runtime], [${CC}]) 100ATF_RUNTIME_TOOL([ATF_BUILD_CFLAGS], 101 [C compiler flags to use at runtime], [${CFLAGS}]) 102ATF_RUNTIME_TOOL([ATF_BUILD_CPP], 103 [C/C++ preprocessor to use at runtime], [${CPP}]) 104ATF_RUNTIME_TOOL([ATF_BUILD_CPPFLAGS], 105 [C/C++ preprocessor flags to use at runtime], [${CPPFLAGS}]) 106ATF_RUNTIME_TOOL([ATF_BUILD_CXX], 107 [C++ compiler to use at runtime], [${CXX}]) 108ATF_RUNTIME_TOOL([ATF_BUILD_CXXFLAGS], 109 [C++ compiler flags to use at runtime], [${CXXFLAGS}]) 110 111dnl ----------------------------------------------------------------------- 112dnl Generation of files in srcdir. 113dnl ----------------------------------------------------------------------- 114 115dnl BSD make(1) doesn't deal with targets specified as './foo' well: they 116dnl need to be specified as 'foo'. The following hack is to workaround this 117dnl issue. 118if test "${srcdir}" = .; then 119 target_srcdir= 120else 121 target_srcdir="${srcdir}/" 122fi 123AC_SUBST([target_srcdir]) 124 125dnl ----------------------------------------------------------------------- 126dnl Architecture and machine checks. 127dnl ----------------------------------------------------------------------- 128 129atf_arch=`uname -p` 130atf_machine=`uname -m` 131 132AC_MSG_NOTICE([Machine type: ${atf_machine}, architecture: ${atf_arch}]) 133AC_SUBST(atf_arch, ${atf_arch}) 134AC_SUBST(atf_machine, ${atf_machine}) 135 136dnl ----------------------------------------------------------------------- 137dnl User-customizable variables. 138dnl ----------------------------------------------------------------------- 139 140AC_ARG_VAR([ATF_CONFSUBDIR], 141 [Subdirectory of sysconfdir under which to look for files]) 142if test x"${ATF_CONFSUBDIR-unset}" = x"unset"; then 143 ATF_CONFSUBDIR=atf 144else 145 case ${ATF_CONFSUBDIR} in 146 /*) 147 AC_MSG_ERROR([ATF_CONFSUBDIR must hold a relative path]) 148 ;; 149 *) 150 ;; 151 esac 152fi 153if test x"${ATF_CONFSUBDIR}" = x""; then 154 AC_SUBST(atf_confdir, \${sysconfdir}) 155else 156 AC_SUBST(atf_confdir, \${sysconfdir}/${ATF_CONFSUBDIR}) 157fi 158 159AC_ARG_VAR([ATF_WORKDIR], 160 [Default location to use for ATF work directories]) 161if test x"${ATF_WORKDIR}" = x""; then 162 for t in /tmp /var/tmp; do 163 if test -d ${t}; then 164 ATF_WORKDIR=${t} 165 break 166 fi 167 done 168 if test x"${ATF_WORKDIR}" = x""; then 169 AC_MSG_ERROR([Could not guess a value for ATF_WORKDIR]) 170 fi 171else 172 case ${ATF_WORKDIR} in 173 /*) 174 ;; 175 *) 176 AC_MSG_ERROR([ATF_WORKDIR must hold an absolute path]) 177 ;; 178 esac 179fi 180 181AC_SUBST(atf_aclocaldir, \${datadir}/aclocal) 182AC_SUBST(atf_cssdir, \${datadir}/examples/atf) 183AC_SUBST(atf_dtddir, \${datadir}/xml/atf) 184AC_SUBST(atf_egdir, \${datadir}/examples/atf) 185AC_SUBST(atf_pkgconfigdir, \${libdir}/pkgconfig) 186AC_SUBST(atf_xsldir, \${datadir}/xsl/atf) 187 188dnl ----------------------------------------------------------------------- 189dnl Check for the shell and portability problems. 190dnl ----------------------------------------------------------------------- 191 192AC_ARG_VAR([ATF_SHELL], [Location of the POSIX shell interpreter to use]) 193if test x"${ATF_SHELL}" = x""; then 194 AC_PATH_PROGS(ATF_SHELL, [bash sh]) 195else 196 case ${ATF_SHELL} in 197 /*) 198 ;; 199 *) 200 AC_MSG_ERROR([ATF_SHELL must hold an absolute path]) 201 ;; 202 esac 203fi 204if test x"${ATF_SHELL}" = x""; then 205 AC_MSG_ERROR([No POSIX shell interpreter found; maybe set ATF_SHELL?]) 206fi 207 208dnl ----------------------------------------------------------------------- 209dnl Check for required tools. 210dnl ----------------------------------------------------------------------- 211 212AC_PATH_PROG([GDB], [gdb]) 213AC_PATH_PROG([KYUA], [kyua]) 214AM_CONDITIONAL([HAVE_KYUA], [test -n "${KYUA}"]) 215AC_PATH_PROG([GIT], [git]) 216 217dnl ----------------------------------------------------------------------- 218dnl Finally, generate output. 219dnl ----------------------------------------------------------------------- 220 221AC_OUTPUT([Makefile atf-c/defs.h]) 222 223if test ${enable_tools} = yes; then 224 AC_MSG_WARN([Building the deprecated ATF tools (atf-run and atf-report);]) 225 AC_MSG_WARN([please migrate to Kyua as soon as feasible.]) 226fi 227 228dnl vim: syntax=m4:expandtab:shiftwidth=4:softtabstop=4 229