aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorMatthew Fioravante <matthew.fioravante@jhuapl.edu>2013-01-18 10:55:47 +0000
committerMatthew Fioravante <matthew.fioravante@jhuapl.edu>2013-01-18 10:55:47 +0000
commit1f44053686221af63cca7be601d74c835777d89b (patch)
tree27d24907804e6e78e16f8a2757c1b88a74c12883 /m4
parente627fcdae7b08d3ec7b04284bd3f5f7ae277f4f5 (diff)
downloadxen-1f44053686221af63cca7be601d74c835777d89b.tar.gz
xen-1f44053686221af63cca7be601d74c835777d89b.tar.bz2
xen-1f44053686221af63cca7be601d74c835777d89b.zip
stubdom: Add autoconf
Stub domains now use autoconf to build. This configure script can enable or disable specific domains and also specify custom download locations for stubdom library packages. See ./configure --help for details. C and Caml are disabled by default. vtpm-stubdom is conditional on the presense of cmake. Rename vtpmmgrdom to vtpmmgr-stubdom Also update .*ignore Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/curses.m420
-rw-r--r--m4/depends.m415
-rw-r--r--m4/extfs.m420
-rw-r--r--m4/features.m421
-rw-r--r--m4/fetcher.m414
-rw-r--r--m4/ocaml.m4241
-rw-r--r--m4/path_or_fail.m46
-rw-r--r--m4/pkg.m4157
-rw-r--r--m4/pthread.m441
-rw-r--r--m4/ptyfuncs.m435
-rw-r--r--m4/python_devel.m436
-rw-r--r--m4/python_version.m412
-rw-r--r--m4/savevar.m46
-rw-r--r--m4/set_cflags_ldflags.m420
-rw-r--r--m4/stubdom.m496
-rw-r--r--m4/uuid.m49
16 files changed, 749 insertions, 0 deletions
diff --git a/m4/curses.m4 b/m4/curses.m4
new file mode 100644
index 0000000000..c1e483f80d
--- /dev/null
+++ b/m4/curses.m4
@@ -0,0 +1,20 @@
+AC_DEFUN([AX_CHECK_CURSES], [
+AC_CHECK_HEADER([curses.h], [
+ AC_CHECK_LIB([curses], [clear], [curses="y"], [curses="n"])
+], [curses="n"])
+AC_CHECK_HEADER([ncurses.h], [
+ AC_CHECK_LIB([ncurses], [clear], [ncurses="y"], [ncurses="n"])
+], [ncurses="n"])
+AS_IF([test "$curses" = "n" && test "$ncurses" = "n"], [
+ AC_MSG_ERROR([Unable to find a suitable curses library])
+])
+# Prefer ncurses over curses if both are present
+AS_IF([test "$ncurses" = "y"], [
+ CURSES_LIBS="-lncurses"
+ AC_DEFINE([INCLUDE_CURSES_H], [<ncurses.h>], [Define curses header to use])
+], [
+ CURSES_LIBS="-lcurses"
+ AC_DEFINE([INCLUDE_CURSES_H], [<curses.h>], [Define curses header to use])
+])
+AC_SUBST(CURSES_LIBS)
+])
diff --git a/m4/depends.m4 b/m4/depends.m4
new file mode 100644
index 0000000000..916e665de7
--- /dev/null
+++ b/m4/depends.m4
@@ -0,0 +1,15 @@
+
+AC_DEFUN([AX_DEPENDS_PATH_PROG], [
+AS_IF([test "x$$1" = "xy"], [AX_PATH_PROG_OR_FAIL([$2], [$3])], [
+AS_IF([test "x$$1" = "xn"], [
+$2="/$3-disabled-in-configure-script"
+], [
+AC_PATH_PROG([$2], [$3], [no])
+AS_IF([test x"${$2}" = "xno"], [
+$1=n
+$2="/$3-disabled-in-configure-script"
+])
+])
+])
+AC_SUBST($2)
+])
diff --git a/m4/extfs.m4 b/m4/extfs.m4
new file mode 100644
index 0000000000..7309da978d
--- /dev/null
+++ b/m4/extfs.m4
@@ -0,0 +1,20 @@
+AC_DEFUN([AX_CHECK_EXTFS], [
+AC_CHECK_HEADER([ext2fs/ext2fs.h], [
+AC_CHECK_LIB([ext2fs], [ext2fs_open2], [
+ AC_DEFINE([INCLUDE_EXTFS_H], [<ext2fs/ext2fs.h>],
+ [Define extfs header to use])
+ EXTFS_LIBS="-lext2fs"
+])
+])
+dnl This is a temporary hack for CentOS 5.x, which split the ext4 support
+dnl of ext2fs in a different package. Once CentOS 5.x is no longer supported
+dnl we can remove this.
+AC_CHECK_HEADER([ext4fs/ext2fs.h], [
+AC_CHECK_LIB([ext4fs], [ext2fs_open2], [
+ AC_DEFINE([INCLUDE_EXTFS_H], [<ext4fs/ext2fs.h>],
+ [Define extfs header to use])
+ EXTFS_LIBS="-lext4fs"
+])
+])
+AC_SUBST(EXTFS_LIBS)
+])
diff --git a/m4/features.m4 b/m4/features.m4
new file mode 100644
index 0000000000..bd672ab8bc
--- /dev/null
+++ b/m4/features.m4
@@ -0,0 +1,21 @@
+AC_DEFUN([AX_ARG_DEFAULT_ENABLE], [
+AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [$2 (default is ENABLED)]))
+AX_PARSE_VALUE([$1], [y])
+])
+
+AC_DEFUN([AX_ARG_DEFAULT_DISABLE], [
+AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1], [$2 (default is DISABLED)]))
+AX_PARSE_VALUE([$1], [n])
+])
+
+dnl This function should not be called outside of this file
+AC_DEFUN([AX_PARSE_VALUE], [
+AS_IF([test "x$enable_$1" = "xno"], [
+ ax_cv_$1="n"
+], [test "x$enable_$1" = "xyes"], [
+ ax_cv_$1="y"
+], [test -z $ax_cv_$1], [
+ ax_cv_$1="$2"
+])
+$1=$ax_cv_$1
+AC_SUBST($1)])
diff --git a/m4/fetcher.m4 b/m4/fetcher.m4
new file mode 100644
index 0000000000..86f33b3937
--- /dev/null
+++ b/m4/fetcher.m4
@@ -0,0 +1,14 @@
+AC_DEFUN([AX_CHECK_FETCHER], [
+AC_PATH_PROG([WGET],[wget], [no])
+AS_IF([test x"$WGET" != x"no"], [
+ FETCHER="$WGET -c -O"
+], [
+ AC_PATH_PROG([FTP],[ftp], [no])
+ AS_IF([test x"$FTP" != x"no"], [
+ FETCHER="$FTP -o"
+ ], [
+ AC_MSG_ERROR([cannot find wget or ftp])
+ ])
+])
+AC_SUBST(FETCHER)
+])
diff --git a/m4/ocaml.m4 b/m4/ocaml.m4
new file mode 100644
index 0000000000..b067ee9427
--- /dev/null
+++ b/m4/ocaml.m4
@@ -0,0 +1,241 @@
+dnl autoconf macros for OCaml
+dnl from http://forge.ocamlcore.org/
+dnl
+dnl Copyright © 2009 Richard W.M. Jones
+dnl Copyright © 2009 Stefano Zacchiroli
+dnl Copyright © 2000-2005 Olivier Andrieu
+dnl Copyright © 2000-2005 Jean-Christophe Filliâtre
+dnl Copyright © 2000-2005 Georges Mariano
+dnl
+dnl For documentation, please read the ocaml.m4 man page.
+
+AC_DEFUN([AC_PROG_OCAML],
+[dnl
+ # checking for ocamlc
+ AC_CHECK_TOOL([OCAMLC],[ocamlc],[no])
+
+ if test "$OCAMLC" != "no"; then
+ OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'`
+ AC_MSG_RESULT([OCaml version is $OCAMLVERSION])
+ # If OCAMLLIB is set, use it
+ if test "$OCAMLLIB" = ""; then
+ OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
+ else
+ AC_MSG_RESULT([OCAMLLIB previously set; preserving it.])
+ fi
+ AC_MSG_RESULT([OCaml library path is $OCAMLLIB])
+
+ AC_SUBST([OCAMLVERSION])
+ AC_SUBST([OCAMLLIB])
+
+ # checking for ocamlopt
+ AC_CHECK_TOOL([OCAMLOPT],[ocamlopt],[no])
+ OCAMLBEST=byte
+ if test "$OCAMLOPT" = "no"; then
+ AC_MSG_WARN([Cannot find ocamlopt; bytecode compilation only.])
+ else
+ TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+ if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+ AC_MSG_RESULT([versions differs from ocamlc; ocamlopt discarded.])
+ OCAMLOPT=no
+ else
+ OCAMLBEST=opt
+ fi
+ fi
+
+ AC_SUBST([OCAMLBEST])
+
+ # checking for ocamlc.opt
+ AC_CHECK_TOOL([OCAMLCDOTOPT],[ocamlc.opt],[no])
+ if test "$OCAMLCDOTOPT" != "no"; then
+ TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+ if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+ AC_MSG_RESULT([versions differs from ocamlc; ocamlc.opt discarded.])
+ else
+ OCAMLC=$OCAMLCDOTOPT
+ fi
+ fi
+
+ # checking for ocamlopt.opt
+ if test "$OCAMLOPT" != "no" ; then
+ AC_CHECK_TOOL([OCAMLOPTDOTOPT],[ocamlopt.opt],[no])
+ if test "$OCAMLOPTDOTOPT" != "no"; then
+ TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+ if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+ AC_MSG_RESULT([version differs from ocamlc; ocamlopt.opt discarded.])
+ else
+ OCAMLOPT=$OCAMLOPTDOTOPT
+ fi
+ fi
+ fi
+
+ AC_SUBST([OCAMLOPT])
+ fi
+
+ AC_SUBST([OCAMLC])
+
+ # checking for ocaml toplevel
+ AC_CHECK_TOOL([OCAML],[ocaml],[no])
+
+ # checking for ocamldep
+ AC_CHECK_TOOL([OCAMLDEP],[ocamldep],[no])
+
+ # checking for ocamlmktop
+ AC_CHECK_TOOL([OCAMLMKTOP],[ocamlmktop],[no])
+
+ # checking for ocamlmklib
+ AC_CHECK_TOOL([OCAMLMKLIB],[ocamlmklib],[no])
+
+ # checking for ocamldoc
+ AC_CHECK_TOOL([OCAMLDOC],[ocamldoc],[no])
+
+ # checking for ocamlbuild
+ AC_CHECK_TOOL([OCAMLBUILD],[ocamlbuild],[no])
+])
+
+
+AC_DEFUN([AC_PROG_OCAMLLEX],
+[dnl
+ # checking for ocamllex
+ AC_CHECK_TOOL([OCAMLLEX],[ocamllex],[no])
+ if test "$OCAMLLEX" != "no"; then
+ AC_CHECK_TOOL([OCAMLLEXDOTOPT],[ocamllex.opt],[no])
+ if test "$OCAMLLEXDOTOPT" != "no"; then
+ OCAMLLEX=$OCAMLLEXDOTOPT
+ fi
+ fi
+ AC_SUBST([OCAMLLEX])
+])
+
+AC_DEFUN([AC_PROG_OCAMLYACC],
+[dnl
+ AC_CHECK_TOOL([OCAMLYACC],[ocamlyacc],[no])
+ AC_SUBST([OCAMLYACC])
+])
+
+
+AC_DEFUN([AC_PROG_CAMLP4],
+[dnl
+ AC_REQUIRE([AC_PROG_OCAML])dnl
+
+ # checking for camlp4
+ AC_CHECK_TOOL([CAMLP4],[camlp4],[no])
+ if test "$CAMLP4" != "no"; then
+ TMPVERSION=`$CAMLP4 -v 2>&1| sed -n -e 's|.*version *\(.*\)$|\1|p'`
+ if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+ AC_MSG_RESULT([versions differs from ocamlc])
+ CAMLP4=no
+ fi
+ fi
+ AC_SUBST([CAMLP4])
+
+ # checking for companion tools
+ AC_CHECK_TOOL([CAMLP4BOOT],[camlp4boot],[no])
+ AC_CHECK_TOOL([CAMLP4O],[camlp4o],[no])
+ AC_CHECK_TOOL([CAMLP4OF],[camlp4of],[no])
+ AC_CHECK_TOOL([CAMLP4OOF],[camlp4oof],[no])
+ AC_CHECK_TOOL([CAMLP4ORF],[camlp4orf],[no])
+ AC_CHECK_TOOL([CAMLP4PROF],[camlp4prof],[no])
+ AC_CHECK_TOOL([CAMLP4R],[camlp4r],[no])
+ AC_CHECK_TOOL([CAMLP4RF],[camlp4rf],[no])
+ AC_SUBST([CAMLP4BOOT])
+ AC_SUBST([CAMLP4O])
+ AC_SUBST([CAMLP4OF])
+ AC_SUBST([CAMLP4OOF])
+ AC_SUBST([CAMLP4ORF])
+ AC_SUBST([CAMLP4PROF])
+ AC_SUBST([CAMLP4R])
+ AC_SUBST([CAMLP4RF])
+])
+
+
+AC_DEFUN([AC_PROG_FINDLIB],
+[dnl
+ AC_REQUIRE([AC_PROG_OCAML])dnl
+
+ # checking for ocamlfind
+ AC_CHECK_TOOL([OCAMLFIND],[ocamlfind],[no])
+ AC_SUBST([OCAMLFIND])
+])
+
+
+dnl Thanks to Jim Meyering for working this next bit out for us.
+dnl XXX We should define AS_TR_SH if it's not defined already
+dnl (eg. for old autoconf).
+AC_DEFUN([AC_CHECK_OCAML_PKG],
+[dnl
+ AC_REQUIRE([AC_PROG_FINDLIB])dnl
+
+ AC_MSG_CHECKING([for OCaml findlib package $1])
+
+ unset found
+ unset pkg
+ found=no
+ for pkg in $1 $2 ; do
+ if $OCAMLFIND query $pkg >/dev/null 2>/dev/null; then
+ AC_MSG_RESULT([found])
+ AS_TR_SH([OCAML_PKG_$1])=$pkg
+ found=yes
+ break
+ fi
+ done
+ if test "$found" = "no" ; then
+ AC_MSG_RESULT([not found])
+ AS_TR_SH([OCAML_PKG_$1])=no
+ fi
+
+ AC_SUBST(AS_TR_SH([OCAML_PKG_$1]))
+])
+
+
+AC_DEFUN([AC_CHECK_OCAML_MODULE],
+[dnl
+ AC_MSG_CHECKING([for OCaml module $2])
+
+ cat > conftest.ml <<EOF
+open $3
+EOF
+ unset found
+ for $1 in $$1 $4 ; do
+ if $OCAMLC -c -I "$$1" conftest.ml >&5 2>&5 ; then
+ found=yes
+ break
+ fi
+ done
+
+ if test "$found" ; then
+ AC_MSG_RESULT([$$1])
+ else
+ AC_MSG_RESULT([not found])
+ $1=no
+ fi
+ AC_SUBST([$1])
+])
+
+
+dnl XXX Cross-compiling
+AC_DEFUN([AC_CHECK_OCAML_WORD_SIZE],
+[dnl
+ AC_REQUIRE([AC_PROG_OCAML])dnl
+ AC_MSG_CHECKING([for OCaml compiler word size])
+ cat > conftest.ml <<EOF
+ print_endline (string_of_int Sys.word_size)
+ EOF
+ OCAML_WORD_SIZE=`$OCAML conftest.ml`
+ AC_MSG_RESULT([$OCAML_WORD_SIZE])
+ AC_SUBST([OCAML_WORD_SIZE])
+])
+
+AC_DEFUN([AC_CHECK_OCAML_OS_TYPE],
+[dnl
+ AC_REQUIRE([AC_PROG_OCAML])dnl
+ AC_MSG_CHECKING([OCaml Sys.os_type])
+
+ cat > conftest.ml <<EOF
+ print_string(Sys.os_type);;
+EOF
+
+ OCAML_OS_TYPE=`$OCAML conftest.ml`
+ AC_MSG_RESULT([$OCAML_OS_TYPE])
+ AC_SUBST([OCAML_OS_TYPE])
+])
diff --git a/m4/path_or_fail.m4 b/m4/path_or_fail.m4
new file mode 100644
index 0000000000..ece8cd4b3d
--- /dev/null
+++ b/m4/path_or_fail.m4
@@ -0,0 +1,6 @@
+AC_DEFUN([AX_PATH_PROG_OR_FAIL],
+[AC_PATH_PROG([$1], [$2], [no])
+if test x"${$1}" == x"no"
+then
+ AC_MSG_ERROR([Unable to find $2, please install $2])
+fi])
diff --git a/m4/pkg.m4 b/m4/pkg.m4
new file mode 100644
index 0000000000..9bb3e068cf
--- /dev/null
+++ b/m4/pkg.m4
@@ -0,0 +1,157 @@
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
diff --git a/m4/pthread.m4 b/m4/pthread.m4
new file mode 100644
index 0000000000..c8189991be
--- /dev/null
+++ b/m4/pthread.m4
@@ -0,0 +1,41 @@
+# We define, separately, PTHREAD_CFLAGS, _LDFLAGS and _LIBS
+# even though currently we don't set them very separately.
+# This means that the makefiles will not need to change in
+# the future if we make the test more sophisticated.
+
+AC_DEFUN([AX_PTHREAD_CV2VARS],[
+ PTHREAD_CFLAGS="$ax_cv_pthread_flags"
+ PTHREAD_LDFLAGS="$ax_cv_pthread_flags"
+ PTHREAD_LIBS=""
+])
+
+# We invoke AX_PTHREAD_VARS with the name of another macro
+# which is then expanded once for each variable.
+AC_DEFUN([AX_PTHREAD_VARS],[$1(CFLAGS) $1(LDFLAGS) $1(LIBS)])
+
+AC_DEFUN([AX_PTHREAD_VAR_APPLY],[
+ $1="$$1 $PTHREAD_$1"
+])
+AC_DEFUN([AX_PTHREAD_VAR_SUBST],[AC_SUBST(PTHREAD_$1)])
+
+AC_DEFUN([AX_CHECK_PTHREAD],[
+ AC_CACHE_CHECK([for pthread flag], [ax_cv_pthread_flags], [
+ ax_cv_pthread_flags=-pthread
+ AX_PTHREAD_CV2VARS
+ AX_PTHREAD_VARS([AX_SAVEVAR_SAVE])
+ AX_PTHREAD_VARS([AX_PTHREAD_VAR_APPLY])
+ AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <pthread.h>
+int main(void) {
+ pthread_atfork(0,0,0);
+ pthread_create(0,0,0,0);
+}
+])],[],[ax_cv_pthread_flags=failed])
+ AX_PTHREAD_VARS([AX_SAVEVAR_RESTORE])
+ ])
+ if test "x$ax_cv_pthread_flags" = xfailed; then
+ AC_MSG_ERROR([-pthread does not work])
+ fi
+ AX_PTHREAD_CV2VARS
+ AX_PTHREAD_VARS([AX_PTHREAD_VAR_SUBST])
+])
diff --git a/m4/ptyfuncs.m4 b/m4/ptyfuncs.m4
new file mode 100644
index 0000000000..3e37b5a23c
--- /dev/null
+++ b/m4/ptyfuncs.m4
@@ -0,0 +1,35 @@
+AC_DEFUN([AX_CHECK_PTYFUNCS], [
+ dnl This is a workaround for a bug in Debian package
+ dnl libbsd-dev-0.3.0-1. Once we no longer support that
+ dnl package we can remove the addition of -Werror to
+ dnl CPPFLAGS.
+ AX_SAVEVAR_SAVE(CPPFLAGS)
+ CPPFLAGS="$CPPFLAGS -Werror"
+ AC_CHECK_HEADER([libutil.h],[
+ AC_DEFINE([INCLUDE_LIBUTIL_H],[<libutil.h>],[libutil header file name])
+ ])
+ AX_SAVEVAR_RESTORE(CPPFLAGS)
+ AC_CACHE_CHECK([for openpty et al], [ax_cv_ptyfuncs_libs], [
+ for ax_cv_ptyfuncs_libs in -lutil "" NOT_FOUND; do
+ if test "x$ax_cv_ptyfuncs_libs" = "xNOT_FOUND"; then
+ AC_MSG_FAILURE([Unable to find library for openpty and login_tty])
+ fi
+ AX_SAVEVAR_SAVE(LIBS)
+ LIBS="$LIBS $ax_cv_ptyfuncs_libs"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([
+#ifdef INCLUDE_LIBUTIL_H
+#include INCLUDE_LIBUTIL_H
+#endif
+int main(void) {
+ openpty(0,0,0,0,0);
+ login_tty(0);
+}
+])],[
+ break
+ ],[])
+ AX_SAVEVAR_RESTORE(LIBS)
+ done
+ ])
+ PTYFUNCS_LIBS="$ax_cv_ptyfuncs_libs"
+ AC_SUBST(PTYFUNCS_LIBS)
+])
diff --git a/m4/python_devel.m4 b/m4/python_devel.m4
new file mode 100644
index 0000000000..0a2202cd9a
--- /dev/null
+++ b/m4/python_devel.m4
@@ -0,0 +1,36 @@
+AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [
+ac_previous_cppflags=$CPPFLAGS
+ac_previous_ldflags=$LDFLAGS
+ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
+ print distutils.sysconfig.get_config_var("VERSION")'`
+AC_PATH_PROG([pyconfig], [$PYTHON-config], [no])
+AS_IF([test x"$pyconfig" == x"no"], [
+ dnl For those that don't have python-config
+ CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
+ CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print distutils.sysconfig.get_config_var("CFLAGS")'`"
+ LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print distutils.sysconfig.get_config_var("LIBS")'`"
+ LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print distutils.sysconfig.get_config_var("SYSLIBS")'`"
+ LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
+ standard_lib=1) + "/config"'`"
+ LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print distutils.sysconfig.get_config_var("LINKFORSHARED")'`"
+ LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+], [
+ dnl If python-config is found use it
+ CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
+ LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
+])
+
+AC_CHECK_HEADER([Python.h], [],
+ [AC_MSG_ERROR([Unable to find Python development headers])],)
+AC_CHECK_LIB(python$ac_python_version, PyArg_ParseTuple, [],
+ [AC_MSG_ERROR([Unable to find a suitable python development library])])
+CPPFLAGS=$ac_previous_cppflags
+LDLFAGS=$ac_previous_ldflags
+])
diff --git a/m4/python_version.m4 b/m4/python_version.m4
new file mode 100644
index 0000000000..4e2b594654
--- /dev/null
+++ b/m4/python_version.m4
@@ -0,0 +1,12 @@
+AC_DEFUN([AX_CHECK_PYTHON_VERSION],
+[AC_MSG_CHECKING([for python version >= $1.$2 ])
+`$PYTHON -c 'import sys; sys.exit(eval("sys.version_info < ($1, $2)"))'`
+if test "$?" != "0"
+then
+ python_version=`$PYTHON -V 2>&1`
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR(
+ [$python_version is too old, minimum required version is $1.$2])
+else
+ AC_MSG_RESULT([yes])
+fi])
diff --git a/m4/savevar.m4 b/m4/savevar.m4
new file mode 100644
index 0000000000..2156beed17
--- /dev/null
+++ b/m4/savevar.m4
@@ -0,0 +1,6 @@
+AC_DEFUN([AX_SAVEVAR_SAVE],[
+ saved_$1="$$1"
+])
+AC_DEFUN([AX_SAVEVAR_RESTORE],[
+ $1="$saved_$1"
+])
diff --git a/m4/set_cflags_ldflags.m4 b/m4/set_cflags_ldflags.m4
new file mode 100644
index 0000000000..cbad3c10b0
--- /dev/null
+++ b/m4/set_cflags_ldflags.m4
@@ -0,0 +1,20 @@
+AC_DEFUN([AX_SET_FLAGS],
+[for cppflag in $PREPEND_INCLUDES
+do
+ PREPEND_CPPFLAGS="$PREPEND_CPPFLAGS -I$cppflag"
+done
+for ldflag in $PREPEND_LIB
+do
+ PREPEND_LDFLAGS="$PREPEND_LDFLAGS -L$ldflag"
+done
+for cppflag in $APPEND_INCLUDES
+do
+ APPEND_CPPFLAGS="$APPEND_CPPFLAGS -I$cppflag"
+done
+for ldflag in $APPEND_LIB
+do
+ APPEND_LDFLAGS="$APPEND_LDFLAGS -L$ldflag"
+done
+CPPFLAGS="$PREPEND_CPPFLAGS $CPPFLAGS $APPEND_CPPFLAGS"
+LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"])
+
diff --git a/m4/stubdom.m4 b/m4/stubdom.m4
new file mode 100644
index 0000000000..f4b4cefa74
--- /dev/null
+++ b/m4/stubdom.m4
@@ -0,0 +1,96 @@
+AC_DEFUN([AX_STUBDOM_DEFAULT_ENABLE], [
+AC_ARG_ENABLE([$1],
+AS_HELP_STRING([--disable-$1], [Build and install $1 (default is ENABLED)]),[
+AX_STUBDOM_INTERNAL([$1], [$2])
+],[
+AX_ENABLE_STUBDOM([$1], [$2])
+])
+AC_SUBST([$2])
+])
+
+AC_DEFUN([AX_STUBDOM_DEFAULT_DISABLE], [
+AC_ARG_ENABLE([$1],
+AS_HELP_STRING([--enable-$1], [Build and install $1 (default is DISABLED)]),[
+AX_STUBDOM_INTERNAL([$1], [$2])
+],[
+AX_DISABLE_STUBDOM([$1], [$2])
+])
+AC_SUBST([$2])
+])
+
+AC_DEFUN([AX_STUBDOM_CONDITIONAL], [
+AC_ARG_ENABLE([$1],
+AS_HELP_STRING([--enable-$1], [Build and install $1]),[
+AX_STUBDOM_INTERNAL([$1], [$2])
+])
+])
+
+AC_DEFUN([AX_STUBDOM_CONDITIONAL_FINISH], [
+AS_IF([test "x$$2" = "xy" || test "x$$2" = "x"], [
+AX_ENABLE_STUBDOM([$1],[$2])
+],[
+AX_DISABLE_STUBDOM([$1],[$2])
+])
+AC_SUBST([$2])
+])
+
+AC_DEFUN([AX_STUBDOM_AUTO_DEPENDS], [
+AS_IF([test "x$$1" = "x" && test "x$$2" = "xn"], [
+$1="n"
+])
+])
+
+
+AC_DEFUN([AX_ENABLE_STUBDOM], [
+$2=y
+STUBDOM_TARGETS="$STUBDOM_TARGETS $2"
+STUBDOM_BUILD="$STUBDOM_BUILD $1"
+STUBDOM_INSTALL="$STUBDOM_INSTALL install-$2"
+])
+
+AC_DEFUN([AX_DISABLE_STUBDOM], [
+$2=n
+])
+
+dnl Don't call this outside of this file
+AC_DEFUN([AX_STUBDOM_INTERNAL], [
+AS_IF([test "x$enableval" = "xyes"], [
+AX_ENABLE_STUBDOM([$1], [$2])
+],[
+AS_IF([test "x$enableval" = "xno"],[
+AX_DISABLE_STUBDOM([$1], [$2])
+])
+])
+])
+
+AC_DEFUN([AX_STUBDOM_FINISH], [
+AC_SUBST(STUBDOM_TARGETS)
+AC_SUBST(STUBDOM_BUILD)
+AC_SUBST(STUBDOM_INSTALL)
+echo "Will build the following stub domains:"
+for x in $STUBDOM_BUILD; do
+ echo " $x"
+done
+])
+
+AC_DEFUN([AX_STUBDOM_LIB], [
+AC_ARG_VAR([$1_URL], [Download url for $2])
+AS_IF([test "x$$1_URL" = "x"], [
+ AS_IF([test "x$extfiles" = "xy"],
+ [$1_URL=\@S|@\@{:@XEN_EXTFILES_URL\@:}@],
+ [$1_URL="$4"])
+ ])
+$1_VERSION="$3"
+AC_SUBST($1_URL)
+AC_SUBST($1_VERSION)
+])
+
+AC_DEFUN([AX_STUBDOM_LIB_NOEXT], [
+AC_ARG_VAR([$1_URL], [Download url for $2])
+AS_IF([test "x$$1_URL" = "x"], [
+ $1_URL="$4"
+ ])
+$1_VERSION="$3"
+AC_SUBST($1_URL)
+AC_SUBST($1_VERSION)
+])
diff --git a/m4/uuid.m4 b/m4/uuid.m4
new file mode 100644
index 0000000000..117da5c09d
--- /dev/null
+++ b/m4/uuid.m4
@@ -0,0 +1,9 @@
+AC_DEFUN([AX_CHECK_UUID], [
+AC_CHECK_HEADER([uuid/uuid.h],[
+ AC_CHECK_LIB([uuid], [uuid_clear], [libuuid="y"])
+])
+AC_CHECK_HEADER([uuid.h],[libuuid="y"])
+AS_IF([test "$libuuid" != "y"], [
+ AC_MSG_ERROR([cannot find a valid uuid library])
+])
+])