]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/atf/configure.ac
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / contrib / atf / configure.ac
1 dnl
2 dnl Automated Testing Framework (atf)
3 dnl
4 dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
5 dnl All rights reserved.
6 dnl
7 dnl Redistribution and use in source and binary forms, with or without
8 dnl modification, are permitted provided that the following conditions
9 dnl are met:
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.
15 dnl
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.
28 dnl
29
30 dnl -----------------------------------------------------------------------
31 dnl Initialize the GNU build system.
32 dnl -----------------------------------------------------------------------
33
34 AC_INIT([Automated Testing Framework], [0.16], [atf-devel@NetBSD.org], [atf],
35         [http://code.google.com/p/kyua/wiki/ATF])
36 AC_PREREQ([2.65])
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])
46
47 AC_CANONICAL_TARGET
48
49 AM_INIT_AUTOMAKE([1.9 check-news foreign subdir-objects -Wall])
50
51 LT_INIT
52
53 AC_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])
61 AC_SUBST([ENABLE_TOOLS], ${enable_tools})
62 AM_CONDITIONAL([ENABLE_TOOLS], [test "${enable_tools}" = yes])
63
64 dnl -----------------------------------------------------------------------
65 dnl Check for the C and C++ compilers and required features.
66 dnl -----------------------------------------------------------------------
67
68 AC_LANG(C)
69 AC_PROG_CC
70 AM_PROG_CC_C_O
71 dnl The C compiler check automatically aborts if the compiler does not work.
72 dnl Nothing to do here.
73
74 AC_LANG(C++)
75 AC_PROG_CXX
76 AC_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])
83 if test "${atf_cv_prog_cxx_works}" = no; then
84     AC_MSG_ERROR([C++ compiler cannot create executables])
85 fi
86
87 KYUA_DEVELOPER_MODE([C,C++])
88
89 ATF_MODULE_APPLICATION
90 ATF_MODULE_DEFS
91 ATF_MODULE_ENV
92 ATF_MODULE_FS
93 ATF_MODULE_SANITY
94 ATF_MODULE_SIGNALS
95
96 AC_CHECK_TYPE([timer_t], [], [], [[#include <time.h>]])
97
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}])
110
111 dnl -----------------------------------------------------------------------
112 dnl Generation of files in srcdir.
113 dnl -----------------------------------------------------------------------
114
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
117 dnl issue.
118 if test "${srcdir}" = .; then
119     target_srcdir=
120 else
121     target_srcdir="${srcdir}/"
122 fi
123 AC_SUBST([target_srcdir])
124
125 dnl -----------------------------------------------------------------------
126 dnl Architecture and machine checks.
127 dnl -----------------------------------------------------------------------
128
129 atf_arch=`uname -p`
130 atf_machine=`uname -m`
131
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})
135
136 dnl -----------------------------------------------------------------------
137 dnl User-customizable variables.
138 dnl -----------------------------------------------------------------------
139
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
143     ATF_CONFSUBDIR=atf
144 else
145     case ${ATF_CONFSUBDIR} in
146     /*)
147         AC_MSG_ERROR([ATF_CONFSUBDIR must hold a relative path])
148         ;;
149     *)
150         ;;
151     esac
152 fi
153 if test x"${ATF_CONFSUBDIR}" = x""; then
154     AC_SUBST(atf_confdir, \${sysconfdir})
155 else
156     AC_SUBST(atf_confdir, \${sysconfdir}/${ATF_CONFSUBDIR})
157 fi
158
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
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
171 else
172     case ${ATF_WORKDIR} in
173     /*)
174         ;;
175     *)
176         AC_MSG_ERROR([ATF_WORKDIR must hold an absolute path])
177         ;;
178     esac
179 fi
180
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)
187
188 dnl -----------------------------------------------------------------------
189 dnl Check for the shell and portability problems.
190 dnl -----------------------------------------------------------------------
191
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])
195 else
196     case ${ATF_SHELL} in
197     /*)
198         ;;
199     *)
200         AC_MSG_ERROR([ATF_SHELL must hold an absolute path])
201         ;;
202     esac
203 fi
204 if test x"${ATF_SHELL}" = x""; then
205     AC_MSG_ERROR([No POSIX shell interpreter found; maybe set ATF_SHELL?])
206 fi
207
208 dnl -----------------------------------------------------------------------
209 dnl Check for required tools.
210 dnl -----------------------------------------------------------------------
211
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])
216
217 dnl -----------------------------------------------------------------------
218 dnl Finally, generate output.
219 dnl -----------------------------------------------------------------------
220
221 AC_OUTPUT([Makefile atf-c/defs.h])
222
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.])
226 fi
227
228 dnl vim: syntax=m4:expandtab:shiftwidth=4:softtabstop=4