[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [VTPM v7 6/8] Add autoconf to stubdom



Please rerun autoconf after commiting this patch

Signed-off-by: Matthew Fioravante <matthew.fioravante@xxxxxxxxxx>
---
 autogen.sh                             |    2 +
 config/Stubdom.mk.in                   |   45 ++++++++++++++++
 {tools/m4 => m4}/curses.m4             |    0
 m4/depends.m4                          |   15 ++++++
 {tools/m4 => m4}/extfs.m4              |    0
 {tools/m4 => m4}/features.m4           |    0
 {tools/m4 => m4}/fetcher.m4            |    0
 {tools/m4 => m4}/ocaml.m4              |    0
 {tools/m4 => m4}/path_or_fail.m4       |    0
 {tools/m4 => m4}/pkg.m4                |    0
 {tools/m4 => m4}/pthread.m4            |    0
 {tools/m4 => m4}/ptyfuncs.m4           |    0
 {tools/m4 => m4}/python_devel.m4       |    0
 {tools/m4 => m4}/python_version.m4     |    0
 {tools/m4 => m4}/savevar.m4            |    0
 {tools/m4 => m4}/set_cflags_ldflags.m4 |    0
 m4/stubdom.m4                          |   89 ++++++++++++++++++++++++++++++++
 {tools/m4 => m4}/uuid.m4               |    0
 stubdom/Makefile                       |   55 +++++---------------
 stubdom/configure.ac                   |   58 +++++++++++++++++++++
 tools/configure.ac                     |   28 +++++-----
 21 files changed, 236 insertions(+), 56 deletions(-)
 create mode 100644 config/Stubdom.mk.in
 rename {tools/m4 => m4}/curses.m4 (100%)
 create mode 100644 m4/depends.m4
 rename {tools/m4 => m4}/extfs.m4 (100%)
 rename {tools/m4 => m4}/features.m4 (100%)
 rename {tools/m4 => m4}/fetcher.m4 (100%)
 rename {tools/m4 => m4}/ocaml.m4 (100%)
 rename {tools/m4 => m4}/path_or_fail.m4 (100%)
 rename {tools/m4 => m4}/pkg.m4 (100%)
 rename {tools/m4 => m4}/pthread.m4 (100%)
 rename {tools/m4 => m4}/ptyfuncs.m4 (100%)
 rename {tools/m4 => m4}/python_devel.m4 (100%)
 rename {tools/m4 => m4}/python_version.m4 (100%)
 rename {tools/m4 => m4}/savevar.m4 (100%)
 rename {tools/m4 => m4}/set_cflags_ldflags.m4 (100%)
 create mode 100644 m4/stubdom.m4
 rename {tools/m4 => m4}/uuid.m4 (100%)
 create mode 100644 stubdom/configure.ac

diff --git a/autogen.sh b/autogen.sh
index 58a71ce..ada482c 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,3 +2,5 @@
 cd tools
 autoconf
 autoheader
+cd ../stubdom
+autoconf
diff --git a/config/Stubdom.mk.in b/config/Stubdom.mk.in
new file mode 100644
index 0000000..432efd7
--- /dev/null
+++ b/config/Stubdom.mk.in
@@ -0,0 +1,45 @@
+# Prefix and install folder
+prefix              := @prefix@
+PREFIX              := $(prefix)
+exec_prefix         := @exec_prefix@
+libdir              := @libdir@
+LIBDIR              := $(libdir)
+
+# Path Programs
+CMAKE               := @CMAKE@
+WGET                := @WGET@ -c
+
+# A debug build of stubdom? //FIXME: Someone make this do something
+debug               := @debug@
+vtpm = @vtpm@
+
+STUBDOM_TARGETS     := @STUBDOM_TARGETS@
+STUBDOM_BUILD       := @STUBDOM_BUILD@
+STUBDOM_INSTALL     := @STUBDOM_INSTALL@
+
+ZLIB_VERSION        := @ZLIB_VERSION@
+ZLIB_URL            := @ZLIB_URL@
+
+LIBPCI_VERSION      := @LIBPCI_VERSION@
+LIBPCI_URL          := @LIBPCI_URL@
+
+NEWLIB_VERSION      := @NEWLIB_VERSION@
+NEWLIB_URL          := @NEWLIB_URL@
+
+LWIP_VERSION        := @LWIP_VERSION@
+LWIP_URL            := @LWIP_URL@
+
+GRUB_VERSION        := @GRUB_VERSION@
+GRUB_URL            := @GRUB_URL@
+
+OCAML_VERSION       := @OCAML_VERSION@
+OCAML_URL           := @OCAML_URL@
+
+GMP_VERSION         := @GMP_VERSION@
+GMP_URL             := @GMP_URL@
+
+POLARSSL_VERSION    := @POLARSSL_VERSION@
+POLARSSL_URL        := @POLARSSL_URL@
+
+TPMEMU_VERSION      := @TPMEMU_VERSION@
+TPMEMU_URL          := @TPMEMU_URL@
diff --git a/tools/m4/curses.m4 b/m4/curses.m4
similarity index 100%
rename from tools/m4/curses.m4
rename to m4/curses.m4
diff --git a/m4/depends.m4 b/m4/depends.m4
new file mode 100644
index 0000000..916e665
--- /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/tools/m4/extfs.m4 b/m4/extfs.m4
similarity index 100%
rename from tools/m4/extfs.m4
rename to m4/extfs.m4
diff --git a/tools/m4/features.m4 b/m4/features.m4
similarity index 100%
rename from tools/m4/features.m4
rename to m4/features.m4
diff --git a/tools/m4/fetcher.m4 b/m4/fetcher.m4
similarity index 100%
rename from tools/m4/fetcher.m4
rename to m4/fetcher.m4
diff --git a/tools/m4/ocaml.m4 b/m4/ocaml.m4
similarity index 100%
rename from tools/m4/ocaml.m4
rename to m4/ocaml.m4
diff --git a/tools/m4/path_or_fail.m4 b/m4/path_or_fail.m4
similarity index 100%
rename from tools/m4/path_or_fail.m4
rename to m4/path_or_fail.m4
diff --git a/tools/m4/pkg.m4 b/m4/pkg.m4
similarity index 100%
rename from tools/m4/pkg.m4
rename to m4/pkg.m4
diff --git a/tools/m4/pthread.m4 b/m4/pthread.m4
similarity index 100%
rename from tools/m4/pthread.m4
rename to m4/pthread.m4
diff --git a/tools/m4/ptyfuncs.m4 b/m4/ptyfuncs.m4
similarity index 100%
rename from tools/m4/ptyfuncs.m4
rename to m4/ptyfuncs.m4
diff --git a/tools/m4/python_devel.m4 b/m4/python_devel.m4
similarity index 100%
rename from tools/m4/python_devel.m4
rename to m4/python_devel.m4
diff --git a/tools/m4/python_version.m4 b/m4/python_version.m4
similarity index 100%
rename from tools/m4/python_version.m4
rename to m4/python_version.m4
diff --git a/tools/m4/savevar.m4 b/m4/savevar.m4
similarity index 100%
rename from tools/m4/savevar.m4
rename to m4/savevar.m4
diff --git a/tools/m4/set_cflags_ldflags.m4 b/m4/set_cflags_ldflags.m4
similarity index 100%
rename from tools/m4/set_cflags_ldflags.m4
rename to m4/set_cflags_ldflags.m4
diff --git a/m4/stubdom.m4 b/m4/stubdom.m4
new file mode 100644
index 0000000..0bf0d2c
--- /dev/null
+++ b/m4/stubdom.m4
@@ -0,0 +1,89 @@
+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_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/tools/m4/uuid.m4 b/m4/uuid.m4
similarity index 100%
rename from tools/m4/uuid.m4
rename to m4/uuid.m4
diff --git a/stubdom/Makefile b/stubdom/Makefile
index fc70d88..709b71e 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -6,44 +6,7 @@ export XEN_OS=MiniOS
 export stubdom=y
 export debug=y
 include $(XEN_ROOT)/Config.mk
-
-#ZLIB_URL?=http://www.zlib.net
-ZLIB_URL=$(XEN_EXTFILES_URL)
-ZLIB_VERSION=1.2.3
-
-#LIBPCI_URL?=http://www.kernel.org/pub/software/utils/pciutils
-LIBPCI_URL?=$(XEN_EXTFILES_URL)
-LIBPCI_VERSION=2.2.9
-
-#NEWLIB_URL?=ftp://sources.redhat.com/pub/newlib
-NEWLIB_URL?=$(XEN_EXTFILES_URL)
-NEWLIB_VERSION=1.16.0
-
-#LWIP_URL?=http://download.savannah.gnu.org/releases/lwip
-LWIP_URL?=$(XEN_EXTFILES_URL)
-LWIP_VERSION=1.3.0
-
-#GRUB_URL?=http://alpha.gnu.org/gnu/grub
-GRUB_URL?=$(XEN_EXTFILES_URL)
-GRUB_VERSION=0.97
-
-#OCAML_URL?=$(XEN_EXTFILES_URL)
-OCAML_URL?=http://caml.inria.fr/pub/distrib/ocaml-3.11
-OCAML_VERSION=3.11.0
-
-GMP_VERSION=4.3.2
-GMP_URL?=$(XEN_EXTFILES_URL)
-#GMP_URL?=ftp://ftp.gmplib.org/pub/gmp-$(GMP_VERSION)
-
-POLARSSL_VERSION=1.1.4
-POLARSSL_URL?=$(XEN_EXTFILES_URL)
-#POLARSSL_URL?=http://polarssl.org/code/releases
-
-TPMEMU_VERSION=0.7.4
-TPMEMU_URL?=$(XEN_EXTFILES_URL)
-#TPMEMU_URL?=http://download.berlios.de/tpm-emulator
-
-WGET=wget -c
+-include $(XEN_ROOT)/config/Stubdom.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
 ifeq ($(XEN_TARGET_ARCH),x86_32)
@@ -86,12 +49,12 @@ TARGET_CPPFLAGS += -I$(XEN_ROOT)/xen/include
 
 TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib
 
-TARGETS=ioemu c caml grub xenstore vtpm vtpmmgr
+TARGETS=$(STUBDOM_TARGETS)
 
 .PHONY: all
 all: build
 ifeq ($(STUBDOM_SUPPORTED),1)
-build: genpath ioemu-stubdom c-stubdom pv-grub xenstore-stubdom vtpm-stubdom 
vtpmmgrdom
+build: genpath $(STUBDOM_BUILD)
 else
 build: genpath
 endif
@@ -245,7 +208,7 @@ tpm_emulator-$(XEN_TARGET_ARCH): 
tpm_emulator-$(TPMEMU_VERSION).tar.gz
        mv tpm_emulator-$(TPMEMU_VERSION) $@
        patch -d $@ -p1 < tpmemu-$(TPMEMU_VERSION).patch;
        mkdir $@/build
-       cd $@/build; cmake .. -DCMAKE_C_COMPILER=${CC} 
-DCMAKE_C_FLAGS="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) 
-Wno-declaration-after-statement"
+       cd $@/build; $(CMAKE) .. -DCMAKE_C_COMPILER=${CC} 
-DCMAKE_C_FLAGS="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) 
-Wno-declaration-after-statement"
        touch $@
 
 TPMEMU_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libtpm.a
@@ -483,7 +446,7 @@ xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxc 
xenstore
 #########
 
 ifeq ($(STUBDOM_SUPPORTED),1)
-install: genpath install-readme install-ioemu install-grub install-xenstore 
install-vtpm install-vtpmmgr
+install: genpath install-readme $(STUBDOM_INSTALL)
 else
 install: genpath
 endif
@@ -503,6 +466,8 @@ install-grub: pv-grub
        $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
        $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz 
"$(DESTDIR)$(XENFIRMWAREDIR)/pv-grub-$(XEN_TARGET_ARCH).gz"
 
+install-caml: caml-stubdom
+
 install-xenstore: xenstore-stubdom
        $(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/boot"
        $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-xenstore/mini-os.gz 
"$(DESTDIR)/usr/lib/xen/boot/xenstore-stubdom.gz"
@@ -581,3 +546,9 @@ downloadclean: patchclean
 
 .PHONY: distclean
 distclean: downloadclean
+       -rm ../config/Stubdom.mk
+
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
+$(XEN_ROOT)/config/Stubdom.mk:
+       $(error You have to run ./configure before building or installing 
stubdom)
+endif
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
new file mode 100644
index 0000000..db44d4a
--- /dev/null
+++ b/stubdom/configure.ac
@@ -0,0 +1,58 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.67])
+AC_INIT([Xen Hypervisor Stub Domains], m4_esyscmd([../version.sh 
../xen/Makefile]),
+    [xen-devel@xxxxxxxxxxxxx], [xen], [http://www.xen.org/])
+AC_CONFIG_SRCDIR([../extras/mini-os/kernel.c])
+AC_CONFIG_FILES([../config/Stubdom.mk])
+AC_PREFIX_DEFAULT([/usr])
+AC_CONFIG_AUX_DIR([../])
+
+# M4 Macro includes
+m4_include([../m4/stubdom.m4])
+m4_include([../m4/features.m4])
+m4_include([../m4/path_or_fail.m4])
+m4_include([../m4/depends.m4])
+
+# Enable/disable stub domains
+AX_STUBDOM_DEFAULT_ENABLE([ioemu-stubdom], [ioemu])
+AX_STUBDOM_DEFAULT_DISABLE([c-stubdom], [c])
+AX_STUBDOM_DEFAULT_ENABLE([caml-stubdom], [caml])
+AX_STUBDOM_DEFAULT_ENABLE([pv-grub], [grub])
+AX_STUBDOM_DEFAULT_ENABLE([xenstore-stubdom], [xenstore])
+AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
+AX_STUBDOM_CONDITIONAL([vtpmmgrdom], [vtpmmgr])
+
+AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of stubdom])
+AX_ARG_DEFAULT_ENABLE([extfiles], [Use xen extfiles repository for libraries])
+
+AC_ARG_VAR([CMAKE], [Path to the cmake program])
+AC_ARG_VAR([WGET], [Path to wget program])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
+AX_PATH_PROG_OR_FAIL([WGET], [wget])
+
+# Checks for programs that depend on a feature
+AX_DEPENDS_PATH_PROG([vtpm], [CMAKE], [cmake])
+
+# Stubdom libraries version and url setup
+AX_STUBDOM_LIB([ZLIB], [zlib], [1.2.3], [http://www.zlib.net])
+AX_STUBDOM_LIB([LIBPCI], [libpci], [2.2.9], 
[http://www.kernel.org/pub/software/utils/pciutils])
+AX_STUBDOM_LIB([NEWLIB], [newlib], [1.16.0], 
[ftp://sources.redhat.com/pub/newlib])
+AX_STUBDOM_LIB([LWIP], [lwip], [1.3.0], 
[http://download.savannah.gnu.org/releases/lwip])
+AX_STUBDOM_LIB([GRUB], [grub], [0.97], [http://alpha.gnu.org/gnu/grub])
+AX_STUBDOM_LIB_NOEXT([OCAML], [ocaml], [3.11.0], 
[http://caml.inria.fr/pub/distrib/ocaml-3.11])
+AX_STUBDOM_LIB([GMP], [libgmp], [4.3.2], [ftp://ftp.gmplib.org/pub/gmp-4.3.2])
+AX_STUBDOM_LIB([POLARSSL], [polarssl], [1.1.4], 
[http://polarssl.org/code/releases])
+AX_STUBDOM_LIB([TPMEMU], [berlios tpm emulator], [0.7.4], 
[http://download.berlios.de/tpm-emulator])
+
+#Conditionally enable these stubdoms based on the presense of dependencies
+AX_STUBDOM_CONDITIONAL_FINISH([vtpm-stubdom], [vtpm])
+AX_STUBDOM_CONDITIONAL_FINISH([vtpmmgrdom], [vtpmmgr])
+
+AX_STUBDOM_FINISH
+AC_OUTPUT()
diff --git a/tools/configure.ac b/tools/configure.ac
index 586313d..971e3e9 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -22,20 +22,20 @@ APPEND_INCLUDES and APPEND_LIB instead when possible.])
 AC_CANONICAL_HOST
 
 # M4 Macro includes
-m4_include([m4/savevar.m4])
-m4_include([m4/features.m4])
-m4_include([m4/path_or_fail.m4])
-m4_include([m4/python_version.m4])
-m4_include([m4/python_devel.m4])
-m4_include([m4/ocaml.m4])
-m4_include([m4/set_cflags_ldflags.m4])
-m4_include([m4/uuid.m4])
-m4_include([m4/pkg.m4])
-m4_include([m4/curses.m4])
-m4_include([m4/pthread.m4])
-m4_include([m4/ptyfuncs.m4])
-m4_include([m4/extfs.m4])
-m4_include([m4/fetcher.m4])
+m4_include([../m4/savevar.m4])
+m4_include([../m4/features.m4])
+m4_include([../m4/path_or_fail.m4])
+m4_include([../m4/python_version.m4])
+m4_include([../m4/python_devel.m4])
+m4_include([../m4/ocaml.m4])
+m4_include([../m4/set_cflags_ldflags.m4])
+m4_include([../m4/uuid.m4])
+m4_include([../m4/pkg.m4])
+m4_include([../m4/curses.m4])
+m4_include([../m4/pthread.m4])
+m4_include([../m4/ptyfuncs.m4])
+m4_include([../m4/extfs.m4])
+m4_include([../m4/fetcher.m4])
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.