From bc75b6559bf79ac05ae13f0994e5a8030a4050e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dav=C3=AD=C3=B0=20Steinn=20Geirsson?= Date: Mon, 21 Apr 2014 01:14:32 +0000 Subject: [PATCH] Use xenstore.h when xen >= 4.2 --- qmemman/Makefile | 6 ++++++ qmemman/meminfo-writer.c | 4 ++++ qrexec-lib/Makefile | 6 ++++++ qrexec-lib/txrx-vchan.c | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/qmemman/Makefile b/qmemman/Makefile index 59e485a..c9d3949 100644 --- a/qmemman/Makefile +++ b/qmemman/Makefile @@ -1,6 +1,12 @@ CC=gcc CFLAGS=-Wall -Wextra -Werror -g -O3 all: meminfo-writer + +_XENSTORE_H=$(shell ls /usr/include/xenstore.h) +ifneq "$(_XENSTORE_H)" "" + CFLAGS+= -DUSE_XENSTORE_H +endif + meminfo-writer: meminfo-writer.o $(CC) -g -o meminfo-writer meminfo-writer.o -lxenstore install: diff --git a/qmemman/meminfo-writer.c b/qmemman/meminfo-writer.c index 8569273..249c820 100644 --- a/qmemman/meminfo-writer.c +++ b/qmemman/meminfo-writer.c @@ -2,7 +2,11 @@ #include #include #include +#ifdef USE_XENSTORE_H /* Xen >= 4.2 */ +#include +#else #include +#endif #include #include #include diff --git a/qrexec-lib/Makefile b/qrexec-lib/Makefile index 9130b4b..c9b5fe7 100644 --- a/qrexec-lib/Makefile +++ b/qrexec-lib/Makefile @@ -5,6 +5,12 @@ COMMONIOALL=ioall.o SO_VER=1 LDFLAGS=-shared +_XENSTORE_H=$(shell ls /usr/include/xenstore.h) +ifneq "$(_XENSTORE_H)" "" + CFLAGS+= -DUSE_XENSTORE_H +endif + + all: libqrexec-utils.so.$(SO_VER) libqubes-rpc-filecopy.so.$(SO_VER) libqrexec-utils.so.$(SO_VER): unix-server.o ioall.o buffer.o write-stdin.o exec.o txrx-vchan.o $(CC) $(LDFLAGS) -Wl,-soname,$@ -o $@ $^ $(XENLIBS) diff --git a/qrexec-lib/txrx-vchan.c b/qrexec-lib/txrx-vchan.c index 4cca3f0..2f976eb 100644 --- a/qrexec-lib/txrx-vchan.c +++ b/qrexec-lib/txrx-vchan.c @@ -24,7 +24,11 @@ #include #include #include +#ifdef USE_XENSTORE_H +#include +#else #include +#endif #include static struct libvchan *ctrl;