]> xenbits.xensource.com Git - osstest/rumprun.git/commitdiff
Probe location of Xen headers.
authorAntti Kantee <pooka@iki.fi>
Tue, 26 Jan 2016 18:25:08 +0000 (18:25 +0000)
committerAntti Kantee <pooka@iki.fi>
Tue, 26 Jan 2016 18:25:08 +0000 (18:25 +0000)
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)

build-rr.sh
platform/xen/xen/Config.mk

index b07d48c32f1cd33a693aa02247a1c430db61d379..6d19448d23a80183d8ada945ed4f5953caf05a45 100755 (executable)
@@ -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 <stdint.h>\n#include <xen.h>\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
index aeebc165b2627a880e6854b03d09f9872b11e121..f8c3aa7654d4f0b95485d304a5f471d27b359368 100644 (file)
@@ -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)