From: Andy Zhou Date: Fri, 5 Apr 2013 23:56:52 +0000 (-0700) Subject: sparse: Support recent distributions X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=32e96ab70304cb22b172a7b57bd3a1da97775a80 sparse: Support recent distributions sparse support seems to be broken on some recent Linux distributions. For example, ubuntu 12.04 with Linux 3.5 kernel, and Debian latest test distribution, running Linux 3.2 kernel. On both systems that sparse was broken, It was not able find the header files in the default system include directories. GCC finds them by default. This patch adds the required GCC default search path when running sparse. Tested on: Ubuntu 12.04 - w/ linux 3.5 kernel Debian-6 March test distribution - w/ linux 3.2 kernel Signed-off-by: Andy Zhou [blp@nicira.com also tested on Debian squeeze and wheezy (testing)] Signed-off-by: Ben Pfaff --- diff --git a/acinclude.m4 b/acinclude.m4 index 19a47dd44..911a23d54 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -478,13 +478,23 @@ AC_DEFUN([OVS_CHECK_SPARSE_TARGET], AC_SUBST([SPARSEFLAGS]) AC_SUBST([CGCCFLAGS])]) +dnl OVS_SPARSE_EXTRA_INCLUDES +dnl +dnl The cgcc script from "sparse" does not search gcc's default +dnl search path. Get the default search path from GCC and pass +dnl them to sparse. +AC_DEFUN([OVS_SPARSE_EXTRA_INCLUDES], + AC_SUBST([SPARSE_EXTRA_INCLUDES], + [`$CC -v -E - &1 >/dev/null | sed -n -e '/^#include.*search.*starts.*here:/,/^End.*of.*search.*list\./s/^ \(.*\)/-I \1/p' |grep -v /usr/lib | grep -x -v '\-I /usr/include' | tr \\\n ' ' `] )) + dnl OVS_ENABLE_SPARSE AC_DEFUN([OVS_ENABLE_SPARSE], [AC_REQUIRE([OVS_CHECK_SPARSE_TARGET]) AC_REQUIRE([OVS_CHECK_MAKE_IF]) + AC_REQUIRE([OVS_SPARSE_EXTRA_INCLUDES]) : ${SPARSE=sparse} AC_SUBST([SPARSE]) AC_CONFIG_COMMANDS_PRE( [if test $ovs_cv_gnu_make_if = yes; then - CC='$(if $(C),REAL_CC="'"$CC"'" CHECK="$(SPARSE) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS)" cgcc $(CGCCFLAGS),'"$CC"')' + CC='$(if $(C),REAL_CC="'"$CC"'" CHECK="$(SPARSE) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')' fi])])