-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
449 lines (396 loc) · 15.6 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
dnl --------------------------------
dnl Initialization macros.
dnl --------------------------------
AC_INIT([libvmi], [0.11.0])
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_SRCDIR(libvmi/core.c)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(config.h)
LIBRARY_NAME=libvmi
MAJOR_VERSION=0
MINOR_VERSION=11
MICRO_VERSION=0
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
RELEASE=$MAJOR_VERSION.$MINOR_VERSION
AC_SUBST(LIBRARY_NAME)
AC_SUBST(VERSION)
AC_SUBST(RELEASE)
dnl -----------------------------------------------
dnl Helper function to check presence of a define
dnl -----------------------------------------------
AC_DEFUN([AC_CHECK_DEFINE],[dnl
AC_CACHE_CHECK(for $1 in $2, ac_cv_define_$1,
AC_EGREP_CPP([YES_IS_DEFINED], [
#include <$2>
#ifdef $1
YES_IS_DEFINED
#endif
], ac_cv_define_$1=yes, ac_cv_define_$1=no)
)
if test "$ac_cv_define_$1" = "yes" ; then
AC_DEFINE([HAVE_$1],[],[Added by AC_CHECK_DEFINE])
have_$1="yes"
else
have_$1="no"
fi
])dnl
dnl -----------------------------------------------
dnl Check package options
dnl -----------------------------------------------
AC_ARG_ENABLE([xen],
[AS_HELP_STRING([--disable-xen],
[Support memory introspection with live Xen domains (default is yes)])],
[enable_xen=$enableval],
[enable_xen=yes])
AM_CONDITIONAL([XEN], [test x"$enable_xen" = xyes])
AC_ARG_ENABLE([xen_events],
[AS_HELP_STRING([--enable-xen-events],
[Support use of Xen memory events (default is no)])],
[enable_xen_events=$enableval],
[enable_xen_events=no])
AM_CONDITIONAL([XEN_EVENTS], [test x"$enable_xen_events" = xyes])
AC_ARG_WITH([xenstore],
[AS_HELP_STRING([--without-xenstore],
[Build LibVMI without Xenstore])],
[with_xenstore=$withval],
[with_xenstore=yes])
AM_CONDITIONAL([XENSTORE], [test x"$with_xenstore" = xyes])
AC_ARG_ENABLE([kvm],
[AS_HELP_STRING([--disable-kvm],
[Support memory introspection with live KVM VMs (default is yes)])],
[enable_kvm=$enableval],
[enable_kvm=yes])
AM_CONDITIONAL([KVM], [test x"$enable_kvm" = xyes])
AC_ARG_ENABLE([shm_snapshot],
[AS_HELP_STRING([--disable-shm-snapshot],
[Support shm-snapshot with KVM VMs (Xen is pending) (default is no)])],
[enable_shm_snapshot=$enableval],
[enable_shm_snapshot=no])
AM_CONDITIONAL([SHM], [test x"$enable_shm_snapshot" = xyes])
AC_ARG_ENABLE([file],
[AS_HELP_STRING([--disable-file],
[Support memory introspection with physical memory dumps in a file (default is yes)])],
[enable_file=$enableval],
[enable_file=yes])
AM_CONDITIONAL([FILE], [test x"$enable_file" = xyes])
AC_ARG_ENABLE([windows],
[AS_HELP_STRING([--disable-windows],
[Support introspecting Windows (XP - 8)])],
[enable_windows=$enableval],
[enable_windows=yes])
AM_CONDITIONAL([WINDOWS], [test x"$enable_windows" = xyes])
AC_ARG_ENABLE([linux],
[AS_HELP_STRING([--disable-linux],
[Support introspecting Linux])],
[enable_linux=$enableval],
[enable_linux=yes])
AM_CONDITIONAL([LINUX], [test x"$enable_linux" = xyes])
AC_ARG_ENABLE([vmifs],
[AS_HELP_STRING([--disable-vmifs],
[Build VMIFS tool: maps memory to a file through FUSE])],
[enable_vmifs=$enableval],
[enable_vmifs=yes])
AM_CONDITIONAL([VMIFS], [test x"$enable_vmifs" = xyes])
dnl -----------------------------------------------
dnl Checks for programs, libraries, etc.
dnl -----------------------------------------------
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_LIBTOOL
AM_SANITY_CHECK
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check="yes"], [have_check="no"])
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16])
AC_SUBST([GLIB_CFLAGS])
AC_SUBST([GLIB_LIBS])
AC_CHECK_LIB(m, ceil)
have_xen='no'
xen_space=' '
have_xen_events='no'
xen_event_space=' '
[if test "$enable_xen" = "yes"]
[then]
[if test "$with_xenstore" = "yes"]
[then]
AC_CHECK_LIB(xenstore, xs_read, [], [missing="yes"])
AC_CHECK_HEADERS([xenstore.h])
AC_CHECK_HEADERS([xs.h])
[fi]
[if test "$with_xenstore" = "yes" -a "$missing" = "yes"]
[then]
AC_DEFINE([ENABLE_XEN], [0], [Define to 1 to enable Xen support.])
missing='no'
enable_xen='no'
have_xen='missing xenstore'
[else]
AC_CHECK_LIB(xenctrl, xc_interface_open, [], [missing="yes"])
[if test "$missing" = "yes"]
[then]
AC_DEFINE([ENABLE_XEN], [0], [Define to 1 to enable Xen support.])
missing='no'
enable_xen='no'
have_xen='missing xenctrl'
[else]
AC_DEFINE([ENABLE_XEN], [1], [Define to 1 to enable Xen support.])
have_xen='yes'
xen_space=' '
[if test "$enable_xen_events" = "yes"]
[then]
have_xc_mem_event_enable='no'
have_xc_mem_access_enable='no'
have_hvmmem_access_t='no'
have_xenmem_access_t='no'
# Check for xen events capability (only relevant if Xen is enabled).
AC_CHECK_LIB(xenctrl,
[xc_mem_event_enable],
[
have_xc_mem_event_enable='yes'
AC_DEFINE([HAVE_XC_MEM_EVENT_ENABLE], [1], "xenctrl has xc_mem_event_enable")
],
[])
AC_CHECK_LIB(xenctrl,
[xc_mem_access_enable],
[
have_xc_mem_access_enable='yes'
AC_DEFINE([HAVE_XC_MEM_ACCESS_ENABLE], [1], "xenctrl has xc_mem_access_enable")],
[])
AC_CHECK_DEFINE(XENCTRL_HAS_XC_INTERFACE, xenctrl.h)
# MSR events are only available in Xen 4.3+
AC_CHECK_DEFINE(MEM_EVENT_REASON_MSR, xen/mem_event.h)
AC_CHECK_TYPE(
[hvmmem_access_t],
[
have_hvmmem_access_t='yes'
AC_DEFINE([HAVE_HVMMEM_ACCESS_T], [1], [xenctrl defines hvmmem_access_t])],
[],
[#include <xenctrl.h> #include <xen/hvm/save.h>])
AC_CHECK_TYPE(
[xenmem_access_t],
[
have_xenmem_access_t='yes'
AC_DEFINE([HAVE_XENMEM_ACCESS_T], [1], [xenctrl defines xenmem_access_t])],
[],
[#include <xenctrl.h> #include <xen/memory.h>])
#validate that Xen events are in fact possible
[if (test "$have_XENCTRL_HAS_XC_INTERFACE" != "yes")]
[then]
AC_MSG_WARN([XENCTRL_HAS_XC_INTERFACE undefined, event support disabled.])
have_xen_events='missing event support'
enable_xen_events='no'
[else]
[if (test "$have_xc_mem_event_enable" = "yes" && test "$have_hvmmem_access_t" = "yes")]
[then]
have_xen_events='yes'
xen_event_space=''
AC_DEFINE([ENABLE_XEN_EVENTS], [1], [Define to 1 to enable Xen mem events support.])
AC_DEFINE([XEN_EVENTS_VERSION], [410], [Define the xen events version.])
AC_MSG_NOTICE([4.1 style events enabled.])
[else]
[if (test "$have_xc_mem_access_enable" = "yes")]
[then]
[if (test "$have_hvmmem_access_t" = "yes")]
[then]
have_xen_events='yes'
xen_event_space=''
AC_DEFINE([ENABLE_XEN_EVENTS], [1], [Define to 1 to enable Xen mem events support.])
AC_DEFINE([XEN_EVENTS_VERSION], [420], [Define the xen events version.])
AC_MSG_NOTICE([4.2 style events enabled.])
[else]
[if (test "$have_xenmem_access_t" = "yes")]
[then]
have_xen_events='yes'
xen_event_space=''
AC_DEFINE([ENABLE_XEN_EVENTS], [1], [Define to 1 to enable Xen mem events support.])
AC_DEFINE([XEN_EVENTS_VERSION], [450], [Define the xen events version.])
AC_MSG_NOTICE([4.5 style events enabled.])
[else]
AC_MSG_WARN([Xen event support missing.])
have_xen_events='missing event support'
enable_xen_events='no'
[fi]
[fi]
[else]
AC_MSG_WARN([Xen event support missing.])
have_xen_events='missing event support'
enable_xen_events='no'
[fi]
[fi]
[fi]
[fi]
[fi]
[fi]
AC_CHECK_TYPE(
[vcpu_guest_context_any_t],
AC_DEFINE([HAVE_CONTEXT_ANY], [1], [Checks existence of vcpu_guest_context_any_t to know how to check cpu context on this libxc version.]),
[],
[#include "xenctrl.h"])
[fi]
AM_CONDITIONAL([HAVE_XEN], [test x"$have_xen" = "xyes"])
AM_CONDITIONAL([HAVE_XEN_EVENTS], [test x"$have_xen_events" = "xyes"])
have_kvm='no'
kvm_space=' '
[if test "$enable_kvm" = "yes"]
[then]
AC_PATH_PROG(GREP, grep)
[if test x"$GREP" = "x"]
[then]
AC_DEFINE([ENABLE_KVM], [0], [Define to 1 to enable KVM support.])
enable_kvm='no'
have_kvm='grep missing'
[fi]
AC_PATH_PROG(LSMOD, lsmod)
[if test x"$LSMOD" = "x"]
[then]
AC_DEFINE([ENABLE_KVM], [0], [Define to 1 to enable KVM support.])
enable_kvm='no'
have_kvm='lsmod missing'
[fi]
[if test x"$LSMOD" != "x" && test x"$GREP" != "x"]
[then]
KVM_PRESENT=$($LSMOD | $GREP kvm)
[if test x"$KVM_PRESENT" != "x"]
[then]
AC_CHECK_LIB(virt, virConnectOpen, [], [missing="yes"])
[if test "$missing" = "yes"]
[then]
AC_DEFINE([ENABLE_KVM], [0], [Define to 1 to enable KVM support.])
missing='no'
enable_kvm='no'
have_kvm='libvirt missing'
[else]
AC_DEFINE([ENABLE_KVM], [1], [Define to 1 to enable KVM support.])
missing='no'
have_kvm='yes'
kvm_space=' '
[fi]
[else]
AC_DEFINE([ENABLE_KVM], [0], [Define to 1 to enable KVM support.])
enable_kvm='no'
have_kvm='kernel module is not loaded'
[fi]
[fi]
[fi]
AM_CONDITIONAL([HAVE_KVM], [test x"$have_kvm" = "xyes"])
have_shm_snapshot='no'
shm_snapshot_space=' '
[if test "$enable_shm_snapshot" = "yes"]
[then]
AC_DEFINE([ENABLE_SHM_SNAPSHOT], [1], [Define to 1 to enable shm-snapshot support.])
shm_snapshot_space=''
have_shm_snapshot='yes'
[fi]
have_file='no'
file_space=' '
[if test "$enable_file" = "yes"]
[then]
AC_DEFINE([ENABLE_FILE], [1], [Define to 1 to enable file support.])
file_space=' '
have_file='yes'
[fi]
AM_CONDITIONAL([HAVE_FILE], [test x"$have_file" = "xyes"])
[if test "$enable_windows" = "yes"]
[then]
AC_DEFINE([ENABLE_WINDOWS], [1], [Define to 1 to Windows support.])
[fi]
[if test "$enable_linux" = "yes"]
[then]
AC_DEFINE([ENABLE_LINUX], [1], [Define to 1 to Linux support.])
[fi]
have_vmifs='no'
vmifs_space=' '
[if test "$enable_vmifs" = "yes"]
[then]
PKG_CHECK_MODULES([FUSE], [fuse >= 2.2], [missing="no"], [missing="yes"])
[if test x"$missing" = "xyes"]
[then]
AC_DEFINE([ENABLE_VMIFS], [0], [Define to 1 to build VMIFS.])
have_vmifs='FUSE library missing (libfuse-dev)'
enable_vmifs='no'
[else]
AC_DEFINE([ENABLE_VMIFS], [1], [Define to 1 to build VMIFS.])
AC_SUBST([FUSE_CFLAGS])
AC_SUBST([FUSE_LIBS])
vmifs_dir="tools/vmifs"
AC_SUBST(vmifs_dir)
have_vmifs='yes'
vmifs_space=' '
AC_CONFIG_FILES(tools/vmifs/Makefile)
[fi]
[fi]
AC_CHECK_PROGS(YACC, bison yacc byacc, [no], [path = $PATH])
[if test "$YACC" = "no"]
[then]
[echo "yacc not found in the search path. Please ensure that it is"]
[echo "installed and its directory is included in the search path."]
[echo "Then run configure again before attempting to build LibVMI."]
[exit 1]
[else]
[echo "Found yacc as $YACC."]
[fi]
AC_PROG_YACC
AC_CHECK_PROGS(LEX, lex flex , [no], [path = $PATH])
[if test "$LEX" = "no"]
[then]
[echo "lex not found in the search path. Please ensure that it is"]
[echo "installed and its directory is included in the search path".]
[echo "Then run configure again before attempting to build LibVMI."]
[exit 1]
[else]
[echo "Found lex as $LEX."]
[fi]
AC_PROG_LEX
have_jansson='no'
PKG_CHECK_MODULES([JANSSON], [jansson >= 2.1], [missing="no"], [missing="yes"])
[if test x"$missing" = "xno"]
[then]
have_jansson='yes'
AC_SUBST([JANSSON_LIBS])
AC_SUBST([JANSSON_CFLAGS])
AC_DEFINE([REKALL_PROFILES], [1], [Defined to 1 when working Jansson library was found to parse Rekall profiles.])
[else]
have_jansson='Disabled, missing libjansson-dev.'
[echo "No working Jansson library found (libjansson-dev), Rekall system profiles won't be supported."]
[fi]
dnl -----------------------------------------------
dnl Generates Makefile's, configuration files and scripts
dnl -----------------------------------------------
AC_CONFIG_FILES(Makefile \
libvmi.pc \
libvmi/Makefile \
libvmi/config/Makefile \
examples/Makefile
)
[if test "$have_check" = "yes"]
[then]
AC_CONFIG_FILES(tests/Makefile)
[fi]
AC_OUTPUT
dnl -----------------------------------------------
dnl Print current configuration out for user
dnl -----------------------------------------------
AC_MSG_RESULT([-------------------------------------------------------------------------------
LibVMI is configured as follows. Please verify that this configuration
matches your expectations.
Host system type: $host
Build system type: $build
Installation prefix: $prefix
Feature | Option | Reason
-------------|---------------------------|----------------------------
Xen Support | --enable-xen=$enable_xen$xen_space | $have_xen
Xen Events | --enable-xen-events=$enable_xen_events$xen_event_space | $have_xen_events
KVM Support | --enable-kvm=$enable_kvm$kvm_space | $have_kvm
File Support | --enable-file=$enable_file$file_space | $have_file
Shm-snapshot | --enable-shm-snapshot=$enable_shm_snapshot$shm_snapshot_space | $have_shm_snapshot
-------------|---------------------------|----------------------------
OS | Option
-------------|--------------------------------------------------------
Windows | --enable-windows=$enable_windows
Linux | --enable-linux=$enable_linux
Tools | Option | Reason
-------------|---------------------------|----------------------------
VMIFS | --enable-vmifs=$enable_vmifs$vmifs_space | $have_vmifs
Extra features
----------------------------------------------------------------------
Support of Rekall profiles: $have_jansson
If everything is correct, you can now run 'make' and (optionally)
'make install'. Otherwise, you can run './configure' again.
])