1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ([2.67]) 5AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]), 6 [xen-devel@lists.xen.org], [xen], [http://www.xen.org/]) 7AC_CONFIG_SRCDIR([libxl/libxl.c]) 8AC_CONFIG_FILES([ 9../config/Tools.mk 10hotplug/FreeBSD/rc.d/xencommons 11hotplug/FreeBSD/rc.d/xendriverdomain 12hotplug/Linux/init.d/sysconfig.xencommons 13hotplug/Linux/init.d/sysconfig.xendomains 14hotplug/Linux/init.d/xen-watchdog 15hotplug/Linux/init.d/xencommons 16hotplug/Linux/init.d/xendomains 17hotplug/Linux/init.d/xendriverdomain 18hotplug/Linux/launch-xenstore 19hotplug/Linux/vif-setup 20hotplug/Linux/xen-hotplug-common.sh 21hotplug/Linux/xendomains 22hotplug/NetBSD/rc.d/xencommons 23hotplug/NetBSD/rc.d/xendriverdomain 24ocaml/xenstored/oxenstored.conf 25]) 26AC_CONFIG_HEADERS([config.h]) 27AC_CONFIG_AUX_DIR([../]) 28 29# Check if CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is set and print a warning 30 31AS_IF([test -n "$CC$CFLAGS$LDFLAGS$LIBS$CPPFLAGS$CPP"], [ 32 AC_MSG_WARN( 33[Setting CC, CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is not \ 34recommended, use PREPEND_INCLUDES, PREPEND_LIB, \ 35APPEND_INCLUDES and APPEND_LIB instead when possible.]) 36]) 37 38AC_CANONICAL_HOST 39 40case $host_vendor in 41rumpxen|rumprun) CONFIG_RUMP=y; rump=true ;; 42*) CONFIG_RUMP=n; rump=false ;; 43esac 44AC_SUBST(CONFIG_RUMP) 45 46AC_SYS_LARGEFILE 47 48case $ac_cv_sys_file_offset_bits in #( 49 no | unknown) ;; 50 *) 51 FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits 52;; 53esac 54AC_SUBST(FILE_OFFSET_BITS) 55 56# M4 Macro includes 57m4_include([../m4/savevar.m4]) 58m4_include([../m4/features.m4]) 59m4_include([../m4/path_or_fail.m4]) 60m4_include([../m4/checkpolicy.m4]) 61m4_include([../m4/set_cflags_ldflags.m4]) 62m4_include([../m4/python_version.m4]) 63m4_include([../m4/python_devel.m4]) 64m4_include([../m4/python_fortify_noopt.m4]) 65m4_include([../m4/ocaml.m4]) 66m4_include([../m4/uuid.m4]) 67m4_include([../m4/pkg.m4]) 68m4_include([../m4/curses.m4]) 69m4_include([../m4/pthread.m4]) 70m4_include([../m4/ptyfuncs.m4]) 71m4_include([../m4/extfs.m4]) 72m4_include([../m4/fetcher.m4]) 73m4_include([../m4/ax_compare_version.m4]) 74m4_include([../m4/paths.m4]) 75m4_include([../m4/systemd.m4]) 76 77AX_XEN_EXPAND_CONFIG() 78 79# Enable/disable options 80AX_ARG_DEFAULT_DISABLE([rpath], [Build tools with -Wl,-rpath,LIBDIR]) 81AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP]) 82AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools]) 83AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools]) 84AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation]) 85AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF]) 86AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS]) 87 88AC_ARG_WITH([linux-backend-modules], 89 AS_HELP_STRING([--with-linux-backend-modules="mod1 mod2"], 90 [List of Linux backend module or modalias names to be autoloaded on startup.]), 91 [LINUX_BACKEND_MODULES="$withval"], 92 [case "$host_os" in 93*linux*) 94LINUX_BACKEND_MODULES=" 95xen-evtchn 96xen-gntdev 97xen-gntalloc 98xen-blkback 99xen-netback 100xen-pciback 101evtchn 102gntdev 103netbk 104blkbk 105xen-scsibk 106usbbk 107pciback 108xen-acpi-processor 109blktap2 110" 111;; 112*) 113LINUX_BACKEND_MODULES= 114;; 115esac]) 116LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`" 117AC_SUBST(LINUX_BACKEND_MODULES) 118 119dnl Enable blktap2 on Linux only. 120AC_ARG_ENABLE([blktap2], 121 AS_HELP_STRING([--enable-blktap2], 122 [Enable blktap2, (DEFAULT is off)]),,[ 123 enable_blktap2="no" 124]) 125AS_IF([test "x$enable_blktap2" = "xyes"], [ 126AC_DEFINE([HAVE_BLKTAP2], [1], [Blktap2 enabled]) 127 blktap2=y],[ 128 blktap2=n 129]) 130AC_SUBST(blktap2) 131 132 133AC_ARG_ENABLE([qemu-traditional], 134 AS_HELP_STRING([--enable-qemu-traditional], 135 [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[ 136 case "$host_cpu" in 137 i[[3456]]86|x86_64) 138 enable_qemu_traditional="yes";; 139 *) enable_qemu_traditional="no";; 140 esac 141 case "$host_os" in 142 freebsd*) 143 enable_qemu_traditional="no";; 144 esac 145 146]) 147AS_IF([test "x$enable_qemu_traditional" = "xyes"], [ 148AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled]) 149 qemu_traditional=y],[ 150 qemu_traditional=n 151]) 152AC_SUBST(qemu_traditional) 153 154AC_ARG_ENABLE([rombios], 155 AS_HELP_STRING([--enable-rombios], 156 [Enable ROMBIOS, (DEFAULT is on if qemu-traditional is enabled, otherwise off)]),,[ 157 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [ 158 enable_rombios="yes" 159 ], [ 160 enable_rombios="no" 161 ]) 162]) 163AS_IF([test "x$enable_rombios" = "xyes"], [ 164 dnl as86, ld86, and bcc are only required when building rombios. They 165 dnl are only needed when the host system is x86 but that check is done 166 dnl for us above when checking if we should build with qemu-traditional. 167 AX_PATH_PROG_OR_FAIL([AS86], [as86]) 168 AX_PATH_PROG_OR_FAIL([LD86], [ld86]) 169 AX_PATH_PROG_OR_FAIL([BCC], [bcc]) 170 AC_CHECK_LIB([lzma], [lzma_version_number], [], 171 [AC_MSG_ERROR([Could not find lzma, needed to build rombios])]) 172 AC_DEFINE([HAVE_ROMBIOS], [1], [ROMBIOS enabled]) 173 rombios=y],[ 174 rombios=n 175]) 176AC_SUBST(rombios) 177 178AC_ARG_WITH([system-qemu], 179 AS_HELP_STRING([--with-system-qemu@<:@=PATH@:>@], 180 [Use system supplied qemu PATH or qemu (taken from $PATH) as qemu-xen 181 device model instead of building and installing our own version]),[ 182 case $withval in 183 yes) 184 qemu_xen=n ; qemu_xen_path="qemu-system-i386" 185 qemu_xen_systemd="/usr/bin/env $qemu_xen_path" ;; 186 no) 187 qemu_xen=y ;; 188 *) 189 qemu_xen=n ; qemu_xen_path="$withval" ; 190 qemu_xen_systemd="$qemu_xen_path" ;; 191 esac 192],[ 193 case "$host_cpu" in 194 i[[3456]]86|x86_64) 195 qemu_xen=y;; 196 arm*|aarch64) 197 qemu_xen=y;; 198 *) qemu_xen=n;; 199 esac 200]) 201AS_IF([test "x$qemu_xen" = "xy"], [ 202 qemu_xen_path="$LIBEXEC_BIN/qemu-system-i386" 203 qemu_xen_systemd="$qemu_xen_path" 204]) 205AC_DEFINE_UNQUOTED([QEMU_XEN_PATH], ["$qemu_xen_path"], [Qemu Xen path]) 206AC_SUBST(qemu_xen) 207AC_SUBST(qemu_xen_path) 208AC_SUBST(qemu_xen_systemd) 209 210AC_ARG_WITH([system-seabios], 211 AS_HELP_STRING([--with-system-seabios@<:@=PATH@:>@], 212 [Use system supplied seabios PATH instead of building and installing 213 our own version]),[ 214 # Disable compilation of SeaBIOS. 215 seabios=n 216 case $withval in 217 no) seabios_path= ;; 218 *) seabios_path=$withval ;; 219 esac 220],[]) 221AS_IF([test "x$seabios" = "xy" -o -n "$seabios_path" ], [ 222 AC_DEFINE_UNQUOTED([SEABIOS_PATH], 223 ["${seabios_path:-$XENFIRMWAREDIR/seabios.bin}"], 224 [SeaBIOS path]) 225]) 226 227AC_ARG_WITH([system-ovmf], 228 AS_HELP_STRING([--with-system-ovmf@<:@=PATH@:>@], 229 [Use system supplied OVMF PATH instead of building and installing 230 our own version]),[ 231 # Disable compilation of OVMF. 232 ovmf=n 233 case $withval in 234 no) ovmf_path= ;; 235 *) ovmf_path=$withval ;; 236 esac 237],[]) 238AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [ 239 AC_DEFINE_UNQUOTED([OVMF_PATH], 240 ["${ovmf_path:-$XENFIRMWAREDIR/ovmf.bin}"], 241 [OVMF path]) 242]) 243 244AC_ARG_WITH([extra-qemuu-configure-args], 245 AS_HELP_STRING([--with-extra-qemuu-configure-args@<:@="--ARG1 ..."@:>@], 246 [List of additional configure options for upstream qemu]),[ 247 case $withval in 248 no) EXTRA_QEMUU_CONFIGURE_ARGS= ;; 249 *) EXTRA_QEMUU_CONFIGURE_ARGS=$withval ;; 250 esac 251],[]) 252AC_SUBST(EXTRA_QEMUU_CONFIGURE_ARGS) 253 254AC_ARG_VAR([PREPEND_INCLUDES], 255 [List of include folders to prepend to CFLAGS (without -I)]) 256AC_ARG_VAR([PREPEND_LIB], 257 [List of library folders to prepend to LDFLAGS (without -L)]) 258AC_ARG_VAR([APPEND_INCLUDES], 259 [List of include folders to append to CFLAGS (without -I)]) 260AC_ARG_VAR([APPEND_LIB], 261 [List of library folders to append to LDFLAGS (without -L)]) 262 263AX_SET_FLAGS 264 265AC_ARG_VAR([PYTHON], [Path to the Python parser]) 266AC_ARG_VAR([PERL], [Path to Perl parser]) 267AC_ARG_VAR([BISON], [Path to Bison parser generator]) 268AC_ARG_VAR([FLEX], [Path to Flex lexical analyser generator]) 269AC_ARG_VAR([CURL], [Path to curl-config tool]) 270AC_ARG_VAR([XML], [Path to xml2-config tool]) 271AC_ARG_VAR([BASH], [Path to bash shell]) 272AC_ARG_VAR([XGETTEXT], [Path to xgetttext tool]) 273AC_ARG_VAR([AS86], [Path to as86 tool]) 274AC_ARG_VAR([LD86], [Path to ld86 tool]) 275AC_ARG_VAR([BCC], [Path to bcc tool]) 276AC_ARG_VAR([IASL], [Path to iasl tool]) 277AC_ARG_VAR([AWK], [Path to awk tool]) 278 279# Checks for programs. 280AC_PROG_CC 281AC_PROG_MAKE_SET 282AC_PROG_INSTALL 283AC_PATH_PROG([BISON], [bison]) 284AC_PATH_PROG([FLEX], [flex]) 285AX_PATH_PROG_OR_FAIL([PERL], [perl]) 286AX_PATH_PROG_OR_FAIL([AWK], [awk]) 287 288AC_PROG_OCAML 289AC_PROG_FINDLIB 290 291AS_IF([test "x$ocamltools" = "xy"], [ 292 AS_IF([test "x$OCAMLOPT" = "xno" || test "x$OCAMLFIND" = "xno"], [ 293 AS_IF([test "x$enable_ocamltools" = "xyes"], [ 294 AC_MSG_ERROR([Ocaml tools enabled, but missing ocamlopt or ocamlfind])]) 295 ocamltools="n" 296 ], [ 297 AX_COMPARE_VERSION([$OCAMLVERSION], [lt], [3.09.3], [ 298 AS_IF([test "x$enable_ocamltools" = "xyes"], [ 299 AC_MSG_ERROR([Your version of OCaml: $OCAMLVERSION is not supported])]) 300 ocamltools="n" 301 ]) 302 ]) 303]) 304 305m4_include([../m4/xenstored.m4]) 306AX_XENSTORE_OPTIONS 307AX_XENSTORE_SET 308 309AS_IF([test "x$xsmpolicy" = "xy"], [ 310 AC_PROG_CHECKPOLICY 311 AS_IF([test "x$CHECKPOLICY" = "xno"], [ 312 AS_IF([test "x$enable_xsmpolicy" = "xyes"], [ 313 AC_MSG_ERROR([XSM policy compilation enabled, but unable to find checkpolicy])]) 314 xsmpolicy="n" 315 ]) 316]) 317dnl FreeBSD doesn't require bash (hotplug scripts are in plain sh) 318case "$host_os" in 319 freebsd*) ;; 320 *) AX_PATH_PROG_OR_FAIL([BASH], [bash]);; 321esac 322AS_IF([echo "$PYTHON" | grep -q "^/"], [ 323 PYTHONPATH=$PYTHON 324 PYTHON=`basename $PYTHONPATH` 325],[test -z "$PYTHON"], [PYTHON="python"], 326[AC_MSG_ERROR([PYTHON specified, but is not an absolute path])]) 327AX_PATH_PROG_OR_FAIL([PYTHONPATH], [$PYTHON]) 328AX_CHECK_PYTHON_VERSION([2], [3]) 329 330AS_IF([test "$cross_compiling" != yes], [ 331 AX_CHECK_PYTHON_DEVEL() 332 AX_CHECK_PYTHON_FORTIFY_NOOPT() 333]) 334 335if ! $rump; then 336 337AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext]) 338dnl as86, ld86, bcc and iasl are only required when the host system is x86*. 339dnl "host" here means the platform on which the hypervisor and tools is 340dnl going to run, not the platform on which we are building (known as 341dnl "build" in gnu speak). 342case "$host_cpu" in 343i[[3456]]86|x86_64|aarch64) 344 AX_PATH_PROG_OR_FAIL([IASL], [iasl]) 345 ;; 346esac 347 AX_CHECK_UUID 348 AX_CHECK_CURSES 349AS_IF([test "$ncurses" = "y"], [ 350AC_CHECK_LIB([tinfo], [define_key], [TINFO_LIBS=-ltinfo]) 351]) 352AC_SUBST(TINFO_LIBS) 353 354dnl The following are only required when upstream QEMU is built 355AS_IF([test "x$qemu_xen" = "xy"], [ 356PKG_CHECK_MODULES(glib, [glib-2.0 >= 2.12]) 357PKG_CHECK_MODULES(pixman, [pixman-1 >= 0.21.8]) 358]) 359AX_CHECK_FETCHER 360 361# Checks for libraries. 362AC_CHECK_HEADER([bzlib.h], [ 363AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [zlib="$zlib -DHAVE_BZLIB -lbz2"]) 364]) 365AC_CHECK_HEADER([lzma.h], [ 366AC_CHECK_LIB([lzma], [lzma_stream_decoder], [zlib="$zlib -DHAVE_LZMA -llzma"]) 367]) 368AC_CHECK_HEADER([lzo/lzo1x.h], [ 369AC_CHECK_LIB([lzo2], [lzo1x_decompress], [zlib="$zlib -DHAVE_LZO1X -llzo2"]) 370]) 371AC_SUBST(zlib) 372AS_IF([test "x$enable_blktap2" = "xyes"], [ 373AC_CHECK_LIB([aio], [io_setup], [], [AC_MSG_ERROR([Could not find libaio])]) 374]) 375AC_SUBST(system_aio) 376AX_CHECK_EXTFS 377AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"]) 378AC_SUBST(libgcrypt) 379AX_CHECK_PTHREAD 380AX_CHECK_PTYFUNCS 381AC_CHECK_LIB([yajl], [yajl_alloc], [], 382 [AC_MSG_ERROR([Could not find yajl])]) 383AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])]) 384AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"]) 385AC_SUBST(libiconv) 386AC_CHECK_HEADER([argp.h], [ 387AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"]) 388], [AC_MSG_ERROR([Could not find argp])]) 389AC_SUBST(argp_ldflags) 390 391# FDT is needed only on ARM 392case "$host_cpu" in 393arm*|aarch64) 394AC_CHECK_LIB([fdt], [fdt_create], [], [AC_MSG_ERROR([Could not find libfdt])]) 395 396# Check for libfdt >= 1.4.0. If present enable passthrough 397# Note that libfdt doesn't provide versionning. So we need to rely on 398# function present in new version. 399# Use fdt_first_property_offset which has been correctly exported since v1.4.0 400AC_CHECK_FUNC(fdt_first_property_offset, [partial_dt="y"], [partial_dt="n"]) 401 402AS_IF([test "x$partial_dt" = "xy" ], 403 [AC_DEFINE([ENABLE_PARTIAL_DEVICE_TREE], [1], 404 [Enabling support partial device tree in libxl])], 405 [AC_MSG_WARN([Disabling support for partial device tree in libxl. 406 Please install libfdt library - version 1.4.0 or higher])]) 407 408# The functions fdt_{first,next}_subnode may not be available because: 409# * It has been introduced in 2013 => Doesn't work on Wheezy 410# * The prototype exists but the functions are not exposed. Don't ask why... 411AC_CHECK_FUNCS([fdt_first_subnode fdt_next_subnode]) 412AC_CHECK_DECLS([fdt_first_subnode, fdt_next_subnode],,,[#include <libfdt.h>]) 413 414# The helper fdt_property_u32 is only present in libfdt >= 1.4.0 415# It's an inline function, so only check if the declaration is present 416AC_CHECK_DECLS([fdt_property_u32],,,[#include <libfdt.h>]) 417esac 418 419# Checks for header files. 420AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h]) 421 422# Check for libnl3 >=3.2.8. If present enable remus network buffering. 423PKG_CHECK_MODULES(LIBNL3, [libnl-3.0 >= 3.2.8 libnl-route-3.0 >= 3.2.8], 424 [libnl3_lib="y"], [libnl3_lib="n"]) 425 426AS_IF([test "x$libnl3_lib" = "xn" ], [ 427 AC_MSG_WARN([Disabling support for Remus network buffering and COLO. 428 Please install libnl3 libraries (including libnl3-route), command line tools and devel 429 headers - version 3.2.8 or higher]) 430 AC_SUBST(libnl, [n]) 431 ],[ 432 AC_SUBST(libnl, [y]) 433]) 434 435AC_SUBST(LIBNL3_LIBS) 436AC_SUBST(LIBNL3_CFLAGS) 437 438fi # ! $rump 439 440AX_AVAILABLE_SYSTEMD() 441 442AS_IF([test "x$systemd" = "xy"], [ 443 AC_CONFIG_FILES([ 444 hotplug/Linux/systemd/proc-xen.mount 445 hotplug/Linux/systemd/var-lib-xenstored.mount 446 hotplug/Linux/systemd/xen-init-dom0.service 447 hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service 448 hotplug/Linux/systemd/xen-watchdog.service 449 hotplug/Linux/systemd/xenconsoled.service 450 hotplug/Linux/systemd/xendomains.service 451 hotplug/Linux/systemd/xendriverdomain.service 452 hotplug/Linux/systemd/xenstored.service 453 ]) 454]) 455 456AC_OUTPUT() 457 458