From: Antti Kantee Date: Tue, 26 Jan 2016 18:25:08 +0000 (+0000) Subject: Probe location of Xen headers. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=17fa1234ee62f485a7698288840c3353a796064f;p=osstest%2Frumprun.git Probe location of Xen headers. Throw an intelligent error if they're not found. XXX: would be nice to have a mechanism for providing a manual override, but that sort of parameter passing needs a general solution. related to #67 (which can now be closed) --- diff --git a/build-rr.sh b/build-rr.sh index b07d48c..6d19448 100755 --- a/build-rr.sh +++ b/build-rr.sh @@ -207,6 +207,34 @@ checksubmodules () fi } +# check that the necessary things are available on the build system +probeprereqs () +{ + + if [ "${PLATFORM}" = "xen" ]; then + # probe location of Xen headers + found=false + for loc in /usr/pkg/include/xen /usr/include/xen; do + if printf '#include \n#include \n'\ + | ${CC} -I${loc} -x c - -c -o /dev/null \ + >/dev/null 2>&1 ; then + found=true + break + fi + done + + if ${found}; then + echo "XEN_HEADERS=${loc}" >> ${RROBJ}/config.mk + echo "XEN_HEADERS=\"${loc}\"" >> ${RROBJ}/config.sh + else + echo '>> You need to provide Xen headers.' + echo '>> The exactly source depends on your system' + echo '>> (e.g. libxen-dev package on some systems)' + die Xen headers not found + fi + fi +} + checkprevbuilds () { @@ -297,6 +325,10 @@ export RUMPRUN_SHCONF="${RROBJ}/config.sh" EOF export RUMPRUN_MKCONF="${RROBJ}/config.mk" + . "${RROBJ}/config.sh" + + probeprereqs + cat >> ${RUMPTOOLS}/mk.conf << EOF .if defined(LIB) && \${LIB} == "pthread" .PATH: $(pwd)/lib/librumprun_base/pthread diff --git a/platform/xen/xen/Config.mk b/platform/xen/xen/Config.mk index aeebc16..f8c3aa7 100644 --- a/platform/xen/xen/Config.mk +++ b/platform/xen/xen/Config.mk @@ -5,13 +5,6 @@ $(error RUMPRUN_MKCONF missing) endif include ${RUMPRUN_MKCONF} -# Where to find xen headers from. XXX: this can probably be done better -ifeq ($(shell uname -s),NetBSD) -XEN_HEADERS ?= /usr/pkg/include/xen -else -XEN_HEADERS ?= /usr/include/xen -endif - # from Xen/Config.mk XEN_COMPILE_ARCH ?= $(patsubst amd64,x86_64,$(patsubst i386,x86_32,${MACHINE})) XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH)