This repository has been archived by the owner on Mar 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
/
configure.ac
452 lines (378 loc) · 15 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# This file is part of cc-oci-runtime.
#
# Copyright (C) 2016 Intel Corporation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
AC_PREREQ([2.69])
AC_INIT([cc-oci-runtime], [2.2.4])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign -Wall -Werror -Wno-portability silent-rules subdir-objects color-tests no-dist-gzip dist-xz])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile data/hypervisor.args])
AC_LANG(C)
LT_INIT
# Check for macros
AC_DEFUN_ONCE([MACRO_CHECK],
[
ifdef([$1], true, [AC_FATAL([Please install autoconf-archive],)])
])
MACRO_CHECK([AX_VALGRIND_CHECK])
MACRO_CHECK([AX_CODE_COVERAGE])
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MKDIR_P
# We need go!
AC_CHECK_PROG(GO,[go],[go],[no])
test "$GO" == "no" && AC_MSG_ERROR([go is required to build cc-oci-runtime])
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h mntent.h stdlib.h string.h sys/mount.h unistd.h uuid/uuid.h gio/gio.h gio/gunixsocketaddress.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT64_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS([atexit dup2 memset strdup])
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debug mode @<:@default=no@:>@]),
[], [enable_debug=no])
AS_IF([test "x$enable_debug" = "xyes"],
[AC_DEFINE([DEBUG], [1], [Debugging mode enabled])],
[AC_DEFINE([NDEBUG], [1], [Debugging and assertions disabled])])
AM_CONDITIONAL([DEBUG], [test x$enable_debug = x"yes"])
AS_IF([test "x$enable_debug" = "xyes"],
[[CFLAGS=`echo "$CFLAGS" | sed -e "s/ -O[1-9s]*\b/ -O0/g"`
CFLAGS=`echo "$CFLAGS" | sed -e "s/ -g\b/ -ggdb3/g"`
LDFLAGS=`echo "$LDFLAGS" | sed -e "s/ -Wl,-O[0-9]*\b//g"`
LDFLAGS=`echo "$LDFLAGS" | sed -e "s/ -g\b/ -ggdb3/g"`
]])
AS_IF([test "x$enable_debug" = "xno"],
[[CFLAGS=`echo "$CFLAGS" | sed -e "s/ -O[1-9s]*\b/& -D_FORTIFY_SOURCE=2/g"`]])
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests], [build unit tests @<:@default=yes@:>@]),
[], [enable_tests=yes])
AS_IF([test x"$enable_tests" = "xyes"],
[AC_SUBST([BUILD_TESTS], [1])],
[AC_SUBST([BUILD_TESTS], [0])])
AM_CONDITIONAL([BUILD_TESTS], [test x$enable_tests = x"yes"])
AC_ARG_ENABLE(cppcheck, AS_HELP_STRING([--enable-cppcheck], [enable static analysis @<:@default=no@:>@]),
[], [enable_cppcheck=no])
AS_IF([test x"$enable_cppcheck" = "xyes"],
[AC_SUBST([CPPCHECK], [1])],
[AC_SUBST([CPPCHECK], [0])])
AM_CONDITIONAL([CPPCHECK], [test x$enable_cppcheck = x"yes"])
# Runtime functional tests
AC_ARG_ENABLE(functional-tests,
AS_HELP_STRING([--disable-functional-tests],
[disable functional tests @<:@default=no@:>@]))
# If "--[enable|disable]-functional-tests" isn't specified, the variable will not
# have a value (meaning *DO* run the tests).
AS_IF([test x"$enable_functional_tests" = x"yes" -o x"$enable_functional_tests" = x""],
[run_functional_tests=yes],
[run_functional_tests=no])
AS_IF([test x"$run_functional_tests" = x"yes"],
[AC_SUBST([FUNCTIONAL_TESTS], [1])],
[AC_SUBST([FUNCTIONAL_TESTS], [0])])
AM_CONDITIONAL([FUNCTIONAL_TESTS], [test x"$run_functional_tests" = x"yes"])
# Docker integration tests
AC_ARG_ENABLE(docker-tests, AS_HELP_STRING([--disable-docker-tests],
[disable docker tests @<:@default=no@:>@]))
AS_IF([test x"$enable_docker_tests" = x"yes" -o x"$enable_docker_tests" = x""],
[run_docker_tests=yes],
[run_docker_tests=no])
AS_IF([test x"$run_docker_tests" = x"yes"],
[AC_SUBST([DOCKER_TESTS], [1])],
[AC_SUBST([DOCKER_TESTS], [0])])
AM_CONDITIONAL([DOCKER_TESTS], [test x"$run_docker_tests" = x"yes"])
# Metrics tests
AC_ARG_ENABLE(metrics-tests, AS_HELP_STRING([--disable-metrics-tests],
[disable metrics tests @<:@default=no@:>@]))
AS_IF([test x"$enable_metrics_tests" = x"yes" -o x"$enable_metrics_tests" = x""],
[run_metrics_tests=yes],
[run_metrics_tests=no])
AS_IF([test x"$run_metrics_tests" = x"yes"],
[AC_SUBST([METRICS_TESTS], [1])],
[AC_SUBST([METRICS_TESTS], [0])])
AM_CONDITIONAL([METRICS_TESTS], [test x"$run_metrics_tests" = x"yes"])
# CRI-O integration tests
AC_ARG_ENABLE(crio-tests, AS_HELP_STRING([--disable-crio-tests],
[disable CRI-O tests @<:@default=no@:>@]))
AS_IF([test x"$enable_crio_tests" = x"yes" -o x"$enable_crio_tests" = x""],
[run_crio_tests=yes],
[run_crio_tests=no])
AS_IF([test x"$run_crio_tests" = x"yes"],
[AC_SUBST([CRIO_TESTS], [1])],
[AC_SUBST([CRIO_TESTS], [0])])
AM_CONDITIONAL([CRIO_TESTS], [test x"$run_crio_tests" = x"yes"])
# Checks for libraries.
source $srcdir/versions.txt
AC_SUBST([CLEAR_VM_IMAGE_VERSION], [$clear_vm_image_version])
AC_SUBST([CLEAR_VM_KERNEL_VERSION], [$clear_vm_kernel_version])
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= "$glib_version"], have_required_glib=yes, have_required_glib=no)
AS_IF([test "$have_required_glib" != "yes"], AC_MSG_ERROR([ERROR: need glib ${glib_version}+ for the `G_FILE_MONITOR_WATCH_MOVES' flag]))
PKG_CHECK_MODULES([GIO], [gio-unix-2.0])
PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0])
PKG_CHECK_MODULES([UUID], [uuid])
PKG_CHECK_MODULES([LIBMNL], [libmnl])
AS_IF([test $BUILD_TESTS = 1],
[PKG_CHECK_MODULES([CHECK], [check])]
)
AS_IF([test $CPPCHECK = 1],
[AC_PATH_PROG([CPPCHECK_PATH], [cppcheck], [no], [$PATH:/sbin:/usr/sbin])
if test x"$CPPCHECK_PATH" == x"no" ; then
AC_MSG_ERROR([Please install cppcheck.])
fi
AC_SUBST(CPPCHECK_PATH)]
)
AS_IF([test $FUNCTIONAL_TESTS = 1],
[AC_PATH_PROG([BATS_PATH], [bats], [no], [$PATH:/sbin:/usr/sbin])
if test x"$BATS_PATH" == x"no" ; then
AC_MSG_ERROR([Please install bats (Bash Automated Testing System).)])
fi
AC_SUBST(BATS_PATH)]
)
#path to install systemd files used to boot by cc-image
AC_ARG_WITH([cc-image-systemdsystemunitdir],
AS_HELP_STRING([--with-cc-image-systemdsystemunitdir=DIR],[path to systemd service directory for cc-image]),
[
CC_IMAGE_SYSTEMDSYSTEMUNIT_PATH=${withval}
AC_SUBST(CC_IMAGE_SYSTEMDSYSTEMUNIT_PATH)
],
[CC_IMAGE_SYSTEMDSYSTEMUNIT_PATH=no]
)
AM_CONDITIONAL([CC_IMAGE_SYSTEMDSYSTEMUNIT],[test x"$CC_IMAGE_SYSTEMDSYSTEMUNIT_PATH" != xno])
AC_SUBST([CC_IMAGE_SYSTEMDSYSTEMUNIT], [1])
AC_ARG_WITH([cc-image-bootchart-config-dir],
AS_HELP_STRING([--with-cc-image-bootchart-config-dir=DIR],
[path to bootchart config directory for cc-image]),
[
CC_IMAGE_BOOTCHART_CONFIG_DIR=${withval}
AC_SUBST(CC_IMAGE_BOOTCHART_CONFIG_DIR)
],
[WITH_CC_IMAGE_BOOTCHART_CONFIG=no]
)
AM_CONDITIONAL([CC_IMAGE_BOOTCHART_CONFIG],[test x"$WITH_CC_IMAGE_BOOTCHART_CONFIG" != xno])
#Check for qemu
DEFAULT_QEMU_PATH=/usr/bin/qemu-system-x86_64
AC_ARG_WITH([qemu-path],
[AS_HELP_STRING([--with-qemu-path=[[QEMU-PATH]]],
[path to qemu with pc-lite support @<:@default=qemu-system-x86_64@:>@])
],
[
QEMU=$with_qemu_path
QEMUout=`$QEMU -machine help | grep -o pc-lite | tail -1`
AS_IF([test "x$QEMUout" != "xpc-lite"],
AC_MSG_WARN([$QEMU does not support pc-lite machine]),
[has_pc_lite=yes]
)
],
[with_qemu_path=no]
)
AC_CACHE_CHECK(
[for qemu that supports pc-lite machine], [ac_cv_path_QEMU],
[
AC_PATH_PROGS_FEATURE_CHECK([QEMU],
[qemu-lite-system-x86_64 qemu-system-x86_64],
[
QEMUout=`$ac_path_QEMU -machine help | grep -o pc-lite | tail -1`
AS_IF([test "x$QEMUout" = "xpc-lite"],
[
ac_cv_path_QEMU=$ac_path_QEMU
has_pc_lite=yes
ac_path_QEMU_found=:
])
],
[
AC_MSG_WARN([No qemu detected with pc-lite machine support using:])
ac_cv_path_QEMU=$DEFAULT_QEMU_PATH
has_pc_lite=no
]
)
]
)
AC_SUBST([QEMU_PATH], [$ac_cv_path_QEMU])
AC_DEFINE_UNQUOTED([QEMU_PATH], ["$QEMU_PATH"], "Path to qemu with pc-lite support")
#Read Kernel parameters
AC_SUBST([CMDLINE], [$(cat $srcdir/data/kernel-cmdline)])
# Read Dockerfile parameters
AC_SUBST([DOCKER_ENGINE_FEDORA_VERSION], [$docker_engine_fedora_version])
AC_SUBST([DOCKER_ENGINE_UBUNTU_VERSION], [$docker_engine_ubuntu_version])
# Sytemd unit files (host)
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[],
[with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != "xno"; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])
#bundle path for functional-test
AC_ARG_WITH([tests-bundle-path],
[AS_HELP_STRING([--with-tests-bundle-path=[[BUNDLE-PATH]]],
[path to OCI bundle to execute functional tests])
]
)
AC_ARG_ENABLE([auto-bundle-creation],
AS_HELP_STRING([--disable-auto-bundle-creation], [do not
automatically create a bundle directory
if --with-tests-bundle-path= is not specified.]),
[auto_bundle_creation=no],
[auto_bundle_creation=yes])
AC_ARG_WITH([auto-bundle-creation-path],
[AS_HELP_STRING([--with-auto-bundle-creation-path=[[BUNDLE-PATH]]],
[path to create an OCI bundle in])
],
[
auto_bundle_creation_path="$with_auto_bundle_creation_path"
],
[
# default value
auto_bundle_creation_path="tests/functional/bundle"
]
)
AS_IF([echo "$auto_bundle_creation_path"|grep -qv ^/],
[auto_bundle_creation_path="$(pwd)/$auto_bundle_creation_path"])
# Determine if automatic bundle creation should be enabled.
AS_IF([test x"$auto_bundle_creation" = x"yes" dnl
-a x"$with_tests_bundle_path" = x"" dnl
-a x"$enable_tests" = x"yes" dnl
-a x"$run_functional_tests" = x"yes"],
[enable_auto_bundle_creation=yes])
AM_CONDITIONAL([AUTO_BUNDLE_CREATION],
[test x"$enable_auto_bundle_creation" = x"yes"])
# Determine the bundle path.
AS_IF([test x"$with_tests_bundle_path" != x""],
[AC_SUBST([BUNDLE_TEST_PATH], [$with_tests_bundle_path])],
[test x"$auto_bundle_creation_path" != x""],
[AC_SUBST([BUNDLE_TEST_PATH], [$auto_bundle_creation_path])],
[])
#Kernel path for Clear Containers
DEFAULT_KERNEL_PATH=$localstatedir/lib/$PACKAGE_NAME/data/kernel/vmlinux.container
# Verify container kernel is installed by package.
OBS_PKG_KERNEL_PATH="/usr/share/clear-containers/vmlinux.container"
if [ ! -f "$DEFAULT_KERNEL_PATH" -a -f "$OBS_PKG_KERNEL_PATH" ] ; then
DEFAULT_KERNEL_PATH="$OBS_PKG_KERNEL_PATH"
AC_MSG_WARN($DEFAULT_KERNEL_PATH detected using as default kernel path)
fi
AC_ARG_WITH([cc-kernel],
[AS_HELP_STRING([--with-cc-kernel=[[KERNEL-PATH]]],
[clear container kernel path])
],
[
CONTAINER_KERNEL=$with_cc_kernel
AC_SUBST([CONTAINER_KERNEL])
],
[
AC_SUBST([CONTAINER_KERNEL], [$DEFAULT_KERNEL_PATH])
]
)
if test -f "$CONTAINER_KERNEL"; then
KERNEL_FOUND=yes
else
KERNEL_HELP="Could not find $CONTAINER_KERNEL kernel file. Use --with-cc-kernel to specify the correct path to container kernel."
AC_MSG_WARN([$KERNEL_HELP])
KERNEL_FOUND=no
fi
#Container image path for Clear Containers
DEFAULT_CONTAINER_IMG=$localstatedir/lib/$PACKAGE_NAME/data/image/clear-containers.img
# Verify container image is installed by package.
OBS_PKG_IMAGE_PATH="/usr/share/clear-containers/clear-containers.img"
if [ ! -f "$DEFAULT_CONTAINER_IMG" -a -f "$OBS_PKG_IMAGE_PATH" ] ; then
DEFAULT_CONTAINER_IMG="$OBS_PKG_IMAGE_PATH"
AC_MSG_WARN($DEFAULT_CONTAINER_IMG detected using as default kernel path)
fi
AC_ARG_WITH([cc-image],
[AS_HELP_STRING([--with-cc-image=[[IMAGE-PATH]]],
[clear container image path])
],
[
CONTAINERS_IMG=$with_cc_image
AC_SUBST([CONTAINERS_IMG])
],
[
AC_SUBST([CONTAINERS_IMG],[$DEFAULT_CONTAINER_IMG])
]
)
if test -f "$CONTAINERS_IMG"; then
IMAGE_FOUND=yes
else
IMAGE_HELP="Could not find $CONTAINERS_IMG image file. Use --with-cc-image to specify the correct path to container image."
AC_MSG_WARN([$IMAGE_HELP])
IMAGE_FOUND=no
fi
# CRI-O artifacts
DEFAULT_CRIO_CACHE=$localstatedir/lib/$PACKAGE_NAME/cri-o/cache
AC_ARG_WITH([crio-cache],
[AS_HELP_STRING([--with-crio-cache=[[CACHE-PATH]]],
[CRIO cache directory])
],
[
CONTAINERS_IMG=$with_crio_cache
AC_SUBST([CRIO_CACHE])
],
[
AC_SUBST([CRIO_CACHE],[$DEFAULT_CRIO_CACHE])
]
)
AC_ARG_ENABLE([autogopath],
AS_HELP_STRING([--enable-autogopath], [Set GOPATH variable for you, used when packaging @<:@default=false@:>@]),
[case "${enableval}" in
yes) autogopath=true ;;
no) autogopath=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-autogopath]) ;;
esac],
[autogopath=false]
)
AM_CONDITIONAL([AUTOGOPATH], [test x$autogopath = xtrue])
AX_VALGRIND_CHECK
AX_CODE_COVERAGE
AC_OUTPUT
dnl === Summary ===============================================================
AS_IF([test x"$disable_docker_tests" = xno],
[enable_docker_tests=yes], [enable_docker_tests=no])
AS_IF([test x"$disable_crio_tests" = xno],
[enable_crio_tests=yes], [enable_crio_tests=no])
AC_MSG_RESULT([
cc-oci-runtime - $VERSION
• General:
QEMU : $ac_cv_path_QEMU
QEMU pc-lite : $has_pc_lite
Container kernel : $CONTAINER_KERNEL (found: $KERNEL_FOUND)
$KERNEL_HELP
Container image : $CONTAINERS_IMG (found: $IMAGE_FOUND)
$IMAGE_HELP
Container image services : $CC_IMAGE_SYSTEMDSYSTEMUNIT_PATH
Debug build : $enable_debug
• Proxy:
Systemd unit directory : $systemdsystemunitdir
• Tests:
Unit tests : $enable_tests
Functional tests : $run_functional_tests
Docker tests : $run_docker_tests
CRI-O tests : $run_crio_tests
Cppcheck : $enable_cppcheck
Valgrind : $VALGRIND_ENABLED
Code coverage : $CODE_COVERAGE_ENABLED
Bundle path : $BUNDLE_TEST_PATH
Create + delete bundle : $auto_bundle_creation
])