X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=acinclude.m4;h=0af7fd0fc9ec7aaae5ee7dbfcfbf329123e245f7;hb=7507ec485f72c2ec56731ee5c9790a20d6d694fd;hp=cabe7d3a74cafee3f4a175d854c183646372916f;hpb=2158888d8d8f3b4c00dcf979390a19fa7fcf7942;p=sliver-openvswitch.git diff --git a/acinclude.m4 b/acinclude.m4 index cabe7d3a7..0af7fd0fc 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -20,8 +20,14 @@ dnl Configure linux kernel source tree AC_DEFUN([OVS_CHECK_LINUX26], [ AC_ARG_WITH([l26], [AC_HELP_STRING([--with-l26=/path/to/linux-2.6], - [Specify the linux 2.6 kernel sources])], + [Specify the linux 2.6 kernel build directory])], [KBUILD26="$withval"], [KBUILD26=])dnl + AC_ARG_WITH([l26-source], + [AC_HELP_STRING([--with-l26-source=/path/to/linux-2.6-source], + [Specify the linux 2.6 kernel source directory + (usually figured out automatically from build + directory)])], + [KSRC26="$withval"], [KSRC26=])dnl if test -n "$KBUILD26"; then KBUILD26=`eval echo "$KBUILD26"` case $KBUILD26 in @@ -44,18 +50,29 @@ AC_DEFUN([OVS_CHECK_LINUX26], [ # We want the source headers, but $KBUILD26 gives us the "build" headers. # Use heuristics to find the source headers. AC_MSG_CHECKING([for Linux 2.6 source directory]) - KSRC26=$KBUILD26 - if test ! -e $KSRC26/include/linux/kernel.h; then - case `echo "$KBUILD26" | sed 's,/*$,,'` in # ( - */build) - KSRC26=`echo "$KBUILD26" | sed 's,/build/*$,/source,'` - ;; # ( - *) - KSRC26=`(cd $KBUILD26 && pwd -P) | sed 's,-[[^-]]*$,-common,'` - ;; + if test -n "$KSRC26"; then + KSRC26=`eval echo "$KSRC26"` + case $KSRC26 in + /*) ;; + *) KSRC26=`pwd`/$KSRC26 ;; esac if test ! -e $KSRC26/include/linux/kernel.h; then - AC_MSG_ERROR([cannot find source directory]) + AC_MSG_ERROR([$KSRC26 is not a kernel source directory)]) + fi + else + KSRC26=$KBUILD26 + if test ! -e $KSRC26/include/linux/kernel.h; then + case `echo "$KBUILD26" | sed 's,/*$,,'` in # ( + */build) + KSRC26=`echo "$KBUILD26" | sed 's,/build/*$,/source,'` + ;; # ( + *) + KSRC26=`(cd $KBUILD26 && pwd -P) | sed 's,-[[^-]]*$,-common,'` + ;; + esac + fi + if test ! -e $KSRC26/include/linux/kernel.h; then + AC_MSG_ERROR([cannot find source directory (please use --with-l26-source)]) fi fi AC_MSG_RESULT([$KSRC26]) @@ -80,6 +97,8 @@ AC_DEFUN([OVS_CHECK_LINUX26], [ AC_MSG_ERROR([Linux kernel source in $KBUILD26 is not configured]) fi OVS_CHECK_LINUX26_COMPAT + elif test -n "$KSRC26"; then + AC_MSG_ERROR([--with-l26-source may not be specified without --with-l26]) fi AM_CONDITIONAL(L26_ENABLED, test -n "$KBUILD26") ]) @@ -89,21 +108,26 @@ dnl dnl Greps FILE for REGEX. If it matches, runs IF-MATCH, otherwise IF-NO-MATCH. AC_DEFUN([OVS_GREP_IFELSE], [ AC_MSG_CHECKING([whether $2 matches in $1]) - grep '$2' $1 >/dev/null 2>&1 - status=$? - case $status in - 0) - AC_MSG_RESULT([yes]) - $3 - ;; - 1) - AC_MSG_RESULT([no]) - $4 - ;; - *) - AC_MSG_ERROR([grep exited with status $status]) - ;; - esac + if test -f $1; then + grep '$2' $1 >/dev/null 2>&1 + status=$? + case $status in + 0) + AC_MSG_RESULT([yes]) + $3 + ;; + 1) + AC_MSG_RESULT([no]) + $4 + ;; + *) + AC_MSG_ERROR([grep exited with status $status]) + ;; + esac + else + AC_MSG_RESULT([file not found]) + $4 + fi ]) dnl OVS_DEFINE(NAME) @@ -157,8 +181,8 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [ OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [skb_copy_from_linear_data_offset], [OVS_DEFINE([HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET])]) - OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [skb_cow], - [OVS_DEFINE([HAVE_SKB_COW])]) + OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [skb_cow_head], + [OVS_DEFINE([HAVE_SKB_COW_HEAD])]) OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [skb_transport_header], [OVS_DEFINE([HAVE_SKBUFF_HEADER_HELPERS])]) OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [skb_warn_if_lro], @@ -169,6 +193,8 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [ OVS_GREP_IFELSE([$KSRC26/include/linux/types.h], [bool], [OVS_DEFINE([HAVE_BOOL_TYPE])]) + OVS_GREP_IFELSE([$KSRC26/include/linux/types.h], [__wsum], + [OVS_DEFINE([HAVE_CSUM_TYPES])]) OVS_GREP_IFELSE([$KSRC26/include/net/checksum.h], [csum_unfold], [OVS_DEFINE([HAVE_CSUM_UNFOLD])])