aboutsummaryrefslogtreecommitdiffstats
path: root/tools/m4
diff options
context:
space:
mode:
Diffstat (limited to 'tools/m4')
-rw-r--r--tools/m4/default_lib.m48
-rw-r--r--tools/m4/disable_feature.m413
-rw-r--r--tools/m4/enable_feature.m413
-rw-r--r--tools/m4/ocaml.m4241
-rw-r--r--tools/m4/path_or_fail.m46
-rw-r--r--tools/m4/pkg.m4157
-rw-r--r--tools/m4/python_devel.m418
-rw-r--r--tools/m4/python_version.m412
-rw-r--r--tools/m4/python_xml.m410
-rw-r--r--tools/m4/set_cflags_ldflags.m420
-rw-r--r--tools/m4/udev.m432
-rw-r--r--tools/m4/uuid.m410
12 files changed, 540 insertions, 0 deletions
diff --git a/tools/m4/default_lib.m4 b/tools/m4/default_lib.m4
new file mode 100644
index 0000000000..b551619205
--- /dev/null
+++ b/tools/m4/default_lib.m4
@@ -0,0 +1,8 @@
+AC_DEFUN([AX_DEFAULT_LIB],
+[AS_IF([test -d "$prefix/lib64"], [
+ LIB_PATH="lib64"
+],[
+ LIB_PATH="lib"
+])
+AC_SUBST(LIB_PATH)])
+
diff --git a/tools/m4/disable_feature.m4 b/tools/m4/disable_feature.m4
new file mode 100644
index 0000000000..4e5ceeeae6
--- /dev/null
+++ b/tools/m4/disable_feature.m4
@@ -0,0 +1,13 @@
+AC_DEFUN([AX_ARG_DISABLE_AND_EXPORT],
+[AC_ARG_ENABLE([$1],
+ AS_HELP_STRING([--disable-$1], [$2]))
+
+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="y"
+])
+$1=$ax_cv_$1
+AC_SUBST($1)])
diff --git a/tools/m4/enable_feature.m4 b/tools/m4/enable_feature.m4
new file mode 100644
index 0000000000..054a143f57
--- /dev/null
+++ b/tools/m4/enable_feature.m4
@@ -0,0 +1,13 @@
+AC_DEFUN([AX_ARG_ENABLE_AND_EXPORT],
+[AC_ARG_ENABLE([$1],
+ AS_HELP_STRING([--enable-$1], [$2]))
+
+AS_IF([test "x$enable_$1" = "xyes"], [
+ ax_cv_$1="y"
+], [test "x$enable_$1" = "xno"], [
+ ax_cv_$1="n"
+], [test -z $ax_cv_$1], [
+ ax_cv_$1="n"
+])
+$1=$ax_cv_$1
+AC_SUBST($1)])
diff --git a/tools/m4/ocaml.m4 b/tools/m4/ocaml.m4
new file mode 100644
index 0000000000..b067ee9427
--- /dev/null
+++ b/tools/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/tools/m4/path_or_fail.m4 b/tools/m4/path_or_fail.m4
new file mode 100644
index 0000000000..ece8cd4b3d
--- /dev/null
+++ b/tools/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/tools/m4/pkg.m4 b/tools/m4/pkg.m4
new file mode 100644
index 0000000000..9bb3e068cf
--- /dev/null
+++ b/tools/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/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
new file mode 100644
index 0000000000..a041c4a1e3
--- /dev/null
+++ b/tools/m4/python_devel.m4
@@ -0,0 +1,18 @@
+AC_DEFUN([AX_CHECK_PYTHON_DEVEL],
+[AC_MSG_CHECKING([for python devel])
+
+`$PYTHON -c '
+import os.path, sys
+for p in sys.path:
+ if os.path.exists(p + "/config/Makefile"):
+ sys.exit(0)
+sys.exit(1)
+' > /dev/null 2>&1`
+
+if test "$?" != "0"
+then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Python devel package not found])
+else
+ AC_MSG_RESULT([yes])
+fi])
diff --git a/tools/m4/python_version.m4 b/tools/m4/python_version.m4
new file mode 100644
index 0000000000..ced76aaf19
--- /dev/null
+++ b/tools/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; 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/tools/m4/python_xml.m4 b/tools/m4/python_xml.m4
new file mode 100644
index 0000000000..efd4be3468
--- /dev/null
+++ b/tools/m4/python_xml.m4
@@ -0,0 +1,10 @@
+AC_DEFUN([AX_CHECK_PYTHON_XML],
+[AC_MSG_CHECKING([for python xml.dom.minidom])
+`$PYTHON -c 'import xml.dom.minidom'`
+if test "$?" != "0"
+then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Unable to find xml.dom.minidom module])
+else
+ AC_MSG_RESULT([yes])
+fi])
diff --git a/tools/m4/set_cflags_ldflags.m4 b/tools/m4/set_cflags_ldflags.m4
new file mode 100644
index 0000000000..7e357ba6b4
--- /dev/null
+++ b/tools/m4/set_cflags_ldflags.m4
@@ -0,0 +1,20 @@
+AC_DEFUN([AX_SET_FLAGS],
+[for cflag in $PREPEND_INCLUDES
+do
+ PREPEND_CFLAGS+=" -I$cflag"
+done
+for ldflag in $PREPEND_LIB
+do
+ PREPEND_LDFLAGS+=" -L$ldflag"
+done
+for cflag in $APPEND_INCLUDES
+do
+ APPEND_CFLAGS+=" -I$cflag"
+done
+for ldflag in $APPEND_LIB
+do
+ APPEND_LDFLAGS+=" -L$ldflag"
+done
+CFLAGS="$PREPEND_CFLAGS $CFLAGS $APPEND_CFLAGS"
+LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"])
+
diff --git a/tools/m4/udev.m4 b/tools/m4/udev.m4
new file mode 100644
index 0000000000..31c838695f
--- /dev/null
+++ b/tools/m4/udev.m4
@@ -0,0 +1,32 @@
+AC_DEFUN([AX_CHECK_UDEV],
+[if test "x$host_os" == "xlinux-gnu"
+then
+ AC_PATH_PROG([UDEVADM], [udevadm], [no])
+ if test x"${UDEVADM}" == x"no"
+ then
+ AC_PATH_PROG([UDEVINFO], [udevinfo], [no])
+ if test x"${UDEVINFO}" == x"no"
+ then
+ AC_MSG_ERROR(
+ [Unable to find udevadm or udevinfo, please install udev])
+ fi
+ udevver=`${UDEVINFO} -V | awk '{print $NF}'`
+ else
+ udevver=`${UDEVADM} info -V | awk '{print $NF}'`
+ fi
+ if test ${udevver} -lt 59
+ then
+ AC_PATH_PROG([HOTPLUG], [hotplug], [no])
+ if test x"${HOTPLUG}" == x"no"
+ then
+ AC_MSG_ERROR([udev is too old, upgrade to version 59 or later])
+ fi
+ fi
+else
+ AC_PATH_PROG([VNCONFIG], [vnconfig], [no])
+ if test x"${VNCONFIG}" == x"no"
+ then
+ AC_MSG_ERROR([Not a Linux system and unable to find vnd])
+ fi
+fi
+])
diff --git a/tools/m4/uuid.m4 b/tools/m4/uuid.m4
new file mode 100644
index 0000000000..8e5cd31861
--- /dev/null
+++ b/tools/m4/uuid.m4
@@ -0,0 +1,10 @@
+AC_DEFUN([AX_CHECK_UUID],
+[if test "x$host_os" == "xlinux-gnu"
+then
+ AC_CHECK_HEADER([uuid/uuid.h],,
+ [AC_MSG_ERROR([cannot find uuid headers])])
+else
+ AC_CHECK_HEADER([uuid.h],,
+ [AC_MSG_ERROR([cannot find uuid headers])])
+fi
+])