Makefile.am | 3 ++-
configure.ac | 24 ++++++++++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index eefa10b..9732786 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-SUBDIRS = driver/linux tools doc
+driver_subdir=@driver_subdir@
+SUBDIRS = $(driver_subdir) tools doc
include_HEADERS = common/knem_io.h
diff --git a/configure.ac b/configure.ac
index 8778748..5c9ce23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,8 @@ test -z "$KCC" || KBUILD_ARGS="$KBUILD_ARGS CC=\"$KCC\""
test -z "$KARCH" || KBUILD_ARGS="$KBUILD_ARGS ARCH=\"$KARCH\""
AC_SUBST(KBUILD_ARGS)
+driver_sibdir=
+
linux_release_set=false
linux_build_set=false
AC_ARG_WITH(linux-release,
@@ -79,13 +81,24 @@ AC_ARG_WITH(linux-release,
LINUX_RELEASE=`uname -r`)
AC_ARG_WITH(linux,
[AS_HELP_STRING([--with-linux=
], [location of the Linux kernel source])],
- linux_build_set=true ; LINUX_SRC="$withval"; LINUX_BUILD="$withval"; AC_MSG_NOTICE(overriding kernel source and build dirs with $withval))
+ linux_build_set=true ; LINUX_SRC="$withval"; LINUX_BUILD="$withval"; AC_MSG_NOTICE(overriding kernel source and build dirs with $withval),
+ linux_build_set=false)
AC_ARG_WITH(linux-build,
[AS_HELP_STRING([--with-linux-build=], [location of the Linux kernel build tree])],
- linux_build_set=true ; LINUX_BUILD="$withval"; AC_MSG_NOTICE(overriding kernel build dir with $withval))
+ linux_build_set=true ; LINUX_BUILD="$withval"; AC_MSG_NOTICE(overriding kernel build dir with $withval),
+ linux_build_set=false)
+
+if test "x$linux_build_set" != "xfalse" ; then
+AC_ARG_WITH(linux-release,
+ [AS_HELP_STRING([--with-linux-release=], [release number of the target kernel])],
+ LINUX_RELEASE="$withval"; linux_release_set=true,
+ LINUX_RELEASE=`uname -r`)
+
test -z $LINUX_SRC && LINUX_SRC=/lib/modules/$LINUX_RELEASE/source
test -z $LINUX_BUILD && LINUX_BUILD=/lib/modules/$LINUX_RELEASE/build
+driver_sibdir=driver/linux
+
# Find where the headers are (to avoid grepping at both places).
# Do not check for autoconf.h or version.h since these are in
# both the source and the build directory.
@@ -221,6 +234,7 @@ if test x$enable_debug = xyes; then
else
AC_MSG_RESULT([no])
fi
+fi
AC_ARG_ENABLE(hwloc,
[AS_HELP_STRING([--disable-hwloc], [disable hwloc in the user-space tools])],
@@ -249,8 +263,10 @@ if test x$enable_hwloc = xyes; then
AC_DEFINE(KNEM_HAVE_HWLOC, 1, [Define to enable hwloc in user-space tools])
fi
+if test "x$linux_build_set" != "xfalse" ; then
AC_SUBST(CONFIG_STATUS_DEPENDENCIES,
'$(top_srcdir)/driver/linux/Kbuild.in $(top_srcdir)/driver/linux/check_kernel_headers.sh')
+fi
AC_CONFIG_COMMANDS(chmoding-check_wrapper, chmod ugo+x tools/check/wrapper)
AC_MSG_NOTICE(creating symlinks to wrapper in tools/check/ ...)
@@ -261,9 +277,12 @@ for i in $TEST_LIST ; do
ln -sf wrapper tools/check/$i
done
+AC_SUBST(driver_subdir)
+
AC_CONFIG_HEADER(common/knem_config.h)
AC_OUTPUT(driver/linux/Makefile driver/linux/Kbuild tools/Makefile tools/knem_local_install tools/check/Makefile tools/check/wrapper doc/Makefile Makefile)
+if test "x$linux_build_set" != "xfalse" ; then
cat <