This repository has been archived by the owner on Feb 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
/
configure.ac
149 lines (119 loc) · 3.93 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([hyper], [1.1.0], [[email protected]])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AM_EXTRA_RECURSIVE_TARGETS([pkg])
# Checks for programs.
AC_PROG_CC
AM_PROG_AR
AC_PROG_RANLIB
# Checks for go tool chain
AC_CHECK_PROG([has_go], [go], [yes], [no])
if test "x$has_go" != "xyes" ; then
AC_MSG_ERROR(Unable to find go binary in PATH)
fi
# Platform specific setup
AC_CANONICAL_HOST
case $host_os in
linux*) AM_CONDITIONAL([ON_LINUX], [ true ]) ;;
*) AM_CONDITIONAL([ON_LINUX], [ false ]) ;;
esac
# Check for which host we are on and setup a few things
# specifically based on the host
AC_CHECK_PROG([has_virtualbox], [vboxmanage], [yes], [no])
case $host_os in
darwin* )
# Do something specific for mac
AM_CONDITIONAL([ON_DARWIN], [ true ])
if test "x$has_virtualbox" != "xyes" ; then
AC_MSG_ERROR(Unable to find vboxmanage binary in PATH)
fi
;;
linux*)
# Do something specific for linux
AM_CONDITIONAL([ON_DARWIN], [ false ])
AC_CHECK_HEADER([libdevmapper.h],
[],
[AC_MSG_ERROR([Could not find or include libdevmapper.h])],
[])
;;
*)
#Default Case
AC_MSG_ERROR([Your platform is not currently supported])
;;
esac
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h libxl.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_TYPE_PID_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([strdup])
LIBVIRT_REQUIRED="1.2.2"
AC_ARG_WITH([libvirt],
[AS_HELP_STRING([--without-libvirt],
[run hyperd without libvirt])],
[],[with_libvirt=yes])
if test "$with_libvirt" = yes; then
PKG_CHECK_MODULES([libvirt], [libvirt >= $LIBVIRT_REQUIRED], [], [with_libvirt=no])
fi
AM_CONDITIONAL([WITH_LIBVIRT], [test "x$with_libvirt" == "xyes"])
AC_ARG_WITH([xen],
[AS_HELP_STRING([--without-xen],
[run hyperd without xen (libxl, need xen 4.5 or higher)])],
[],[with_xen=yes])
if test "x$with_xen" != "xno" ; then
# Checks for libxl
AC_CHECK_HEADERS([libxl.h libxl_utils.h], [libxl_found=yes], [libxl_found=no])
if test "x$libxl_found" != "xyes"; then
with_xen=no
fi
fi
XEN_REQUIRED="4.5.0"
XENPV_REQUIRED="4.9.0"
if test "$with_xen" = yes; then
PKG_CHECK_MODULES([xen_4_5], [xenlight >= $XEN_REQUIRED], [with_xen=yes], [with_xen=no])
PKG_CHECK_MODULES([xen_4_9], [xenlight >= $XENPV_REQUIRED], [with_xen490=yes], [with_xen490=no])
fi
if test "x$with_xen" != "xno" ; then
AC_DEFINE_UNQUOTED([WITH_XEN], 1, [run hyperd with xen])
fi
if test "$with_xen490" = yes ; then
AC_DEFINE_UNQUOTED([WITH_XEN490], 1, [run hyperd with xen 4.9 or above])
fi
AM_CONDITIONAL([WITH_XEN], [test "x$with_xen" == "xyes"])
AM_CONDITIONAL([WITH_XEN490], [test "x$with_xen490" == "xyes"])
AC_ARG_WITH([btrfs],
[AS_HELP_STRING([--without-btrfs],
[compile hyperd without btrfs support])],
[],[with_btrfs=yes])
if test "x$with_btrfs" != "xno"; then
AC_CHECK_HEADERS([btrfs/ioctl.h, btrfs/ctree.h], [with_btrfs=yes], [with_btrfs=no])
AC_CHECK_HEADERS([btrfs/version.h], [with_btrfs_header_version=yes], [with_btrfs_header_version=no])
fi
AM_CONDITIONAL([WITH_BTRFS], [test "x$with_btrfs" == "xyes"])
AM_CONDITIONAL([WITH_BTRFS_HEADER_VERSION], [test "x$with_btrfs_header_version" == "xyes"])
AM_EXTRA_RECURSIVE_TARGETS([hyperd hyperctl vmlogd])
AC_CONFIG_FILES([
Makefile
cmd/Makefile
cmd/hyperd/Makefile
cmd/hyperctl/Makefile
cmd/vmlogd/Makefile
])
AC_OUTPUT
AC_MSG_RESULT([
${PACKAGE} ${VERSION}
build OS: ${build_os}
prefix: ${prefix}
has go: ${has_go}
with xen: ${with_xen}
with libvirt: ${with_libvirt}
with btrfs: ${with_btrfs}
has virtualbox: ${has_virtualbox}
])