2 dnl Automated Testing Framework (atf)
4 dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
5 dnl All rights reserved.
7 dnl Redistribution and use in source and binary forms, with or without
8 dnl modification, are permitted provided that the following conditions
10 dnl 1. Redistributions of source code must retain the above copyright
11 dnl notice, this list of conditions and the following disclaimer.
12 dnl 2. Redistributions in binary form must reproduce the above copyright
13 dnl notice, this list of conditions and the following disclaimer in the
14 dnl documentation and/or other materials provided with the distribution.
16 dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 dnl -----------------------------------------------------------------------
31 dnl Initialize the GNU build system.
32 dnl -----------------------------------------------------------------------
34 AC_INIT([Automated Testing Framework], [0.16], [atf-devel@NetBSD.org], [atf],
35 [http://code.google.com/p/kyua/wiki/ATF])
37 AC_COPYRIGHT([Copyright (c) 2007-2012 The NetBSD Foundation, Inc.])
38 AC_DEFINE([PACKAGE_COPYRIGHT],
39 ["Copyright (c) 2007-2012 The NetBSD Foundation, Inc."],
40 [Define to the copyright string applicable to this package.])
41 AC_CONFIG_AUX_DIR([admin])
42 AC_CONFIG_HEADERS([bconfig.h])
43 AC_CONFIG_MACRO_DIR([m4])
44 AC_CONFIG_SRCDIR([atf-c.h])
45 AC_CONFIG_TESTDIR([bootstrap])
49 AM_INIT_AUTOMAKE([1.9 check-news foreign subdir-objects -Wall])
54 AS_HELP_STRING([--enable-tools],
55 [Enables the build of the deprecated ATF tools]),
57 yes|no) enable_tools=${enableval} ;;
58 *) AC_MSG_ERROR([Invalid value passed to --enable-tools]) ;;
61 AC_SUBST([ENABLE_TOOLS], ${enable_tools})
62 AM_CONDITIONAL([ENABLE_TOOLS], [test "${enable_tools}" = yes])
64 dnl -----------------------------------------------------------------------
65 dnl Check for the C and C++ compilers and required features.
66 dnl -----------------------------------------------------------------------
71 dnl The C compiler check automatically aborts if the compiler does not work.
72 dnl Nothing to do here.
76 AC_CACHE_CHECK([whether the C++ compiler works],
77 [atf_cv_prog_cxx_works],
79 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
80 [atf_cv_prog_cxx_works=yes],
81 [atf_cv_prog_cxx_works=no])
83 if test "${atf_cv_prog_cxx_works}" = no; then
84 AC_MSG_ERROR([C++ compiler cannot create executables])
87 KYUA_DEVELOPER_MODE([C,C++])
89 ATF_MODULE_APPLICATION
96 AC_CHECK_TYPE([timer_t], [], [], [[#include <time.h>]])
98 ATF_RUNTIME_TOOL([ATF_BUILD_CC],
99 [C compiler to use at runtime], [${CC}])
100 ATF_RUNTIME_TOOL([ATF_BUILD_CFLAGS],
101 [C compiler flags to use at runtime], [${CFLAGS}])
102 ATF_RUNTIME_TOOL([ATF_BUILD_CPP],
103 [C/C++ preprocessor to use at runtime], [${CPP}])
104 ATF_RUNTIME_TOOL([ATF_BUILD_CPPFLAGS],
105 [C/C++ preprocessor flags to use at runtime], [${CPPFLAGS}])
106 ATF_RUNTIME_TOOL([ATF_BUILD_CXX],
107 [C++ compiler to use at runtime], [${CXX}])
108 ATF_RUNTIME_TOOL([ATF_BUILD_CXXFLAGS],
109 [C++ compiler flags to use at runtime], [${CXXFLAGS}])
111 dnl -----------------------------------------------------------------------
112 dnl Generation of files in srcdir.
113 dnl -----------------------------------------------------------------------
115 dnl BSD make(1) doesn't deal with targets specified as './foo' well: they
116 dnl need to be specified as 'foo'. The following hack is to workaround this
118 if test "${srcdir}" = .; then
121 target_srcdir="${srcdir}/"
123 AC_SUBST([target_srcdir])
125 dnl -----------------------------------------------------------------------
126 dnl Architecture and machine checks.
127 dnl -----------------------------------------------------------------------
130 atf_machine=`uname -m`
132 AC_MSG_NOTICE([Machine type: ${atf_machine}, architecture: ${atf_arch}])
133 AC_SUBST(atf_arch, ${atf_arch})
134 AC_SUBST(atf_machine, ${atf_machine})
136 dnl -----------------------------------------------------------------------
137 dnl User-customizable variables.
138 dnl -----------------------------------------------------------------------
140 AC_ARG_VAR([ATF_CONFSUBDIR],
141 [Subdirectory of sysconfdir under which to look for files])
142 if test x"${ATF_CONFSUBDIR-unset}" = x"unset"; then
145 case ${ATF_CONFSUBDIR} in
147 AC_MSG_ERROR([ATF_CONFSUBDIR must hold a relative path])
153 if test x"${ATF_CONFSUBDIR}" = x""; then
154 AC_SUBST(atf_confdir, \${sysconfdir})
156 AC_SUBST(atf_confdir, \${sysconfdir}/${ATF_CONFSUBDIR})
159 AC_ARG_VAR([ATF_WORKDIR],
160 [Default location to use for ATF work directories])
161 if test x"${ATF_WORKDIR}" = x""; then
162 for t in /tmp /var/tmp; do
163 if test -d ${t}; then
168 if test x"${ATF_WORKDIR}" = x""; then
169 AC_MSG_ERROR([Could not guess a value for ATF_WORKDIR])
172 case ${ATF_WORKDIR} in
176 AC_MSG_ERROR([ATF_WORKDIR must hold an absolute path])
181 AC_SUBST(atf_aclocaldir, \${datadir}/aclocal)
182 AC_SUBST(atf_cssdir, \${datadir}/examples/atf)
183 AC_SUBST(atf_dtddir, \${datadir}/xml/atf)
184 AC_SUBST(atf_egdir, \${datadir}/examples/atf)
185 AC_SUBST(atf_pkgconfigdir, \${libdir}/pkgconfig)
186 AC_SUBST(atf_xsldir, \${datadir}/xsl/atf)
188 dnl -----------------------------------------------------------------------
189 dnl Check for the shell and portability problems.
190 dnl -----------------------------------------------------------------------
192 AC_ARG_VAR([ATF_SHELL], [Location of the POSIX shell interpreter to use])
193 if test x"${ATF_SHELL}" = x""; then
194 AC_PATH_PROGS(ATF_SHELL, [bash sh])
200 AC_MSG_ERROR([ATF_SHELL must hold an absolute path])
204 if test x"${ATF_SHELL}" = x""; then
205 AC_MSG_ERROR([No POSIX shell interpreter found; maybe set ATF_SHELL?])
208 dnl -----------------------------------------------------------------------
209 dnl Check for required tools.
210 dnl -----------------------------------------------------------------------
212 AC_PATH_PROG([GDB], [gdb])
213 AC_PATH_PROG([KYUA], [kyua])
214 AM_CONDITIONAL([HAVE_KYUA], [test -n "${KYUA}"])
215 AC_PATH_PROG([GIT], [git])
217 dnl -----------------------------------------------------------------------
218 dnl Finally, generate output.
219 dnl -----------------------------------------------------------------------
221 AC_OUTPUT([Makefile atf-c/defs.h])
223 if 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.])
228 dnl vim: syntax=m4:expandtab:shiftwidth=4:softtabstop=4