From owner-freebsd-hackers@FreeBSD.ORG Mon Jan 12 16:03:07 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DF7C106566C for ; Mon, 12 Jan 2009 16:03:07 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id EEC768FC1B for ; Mon, 12 Jan 2009 16:03:06 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 8ACC9FEF5; Tue, 13 Jan 2009 04:36:24 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lC8U++Knddg0; Tue, 13 Jan 2009 04:36:20 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Tue, 13 Jan 2009 04:36:20 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 503841142B; Tue, 13 Jan 2009 04:36:20 +1300 (NZDT) Date: Mon, 12 Jan 2009 07:36:20 -0800 From: Andrew Thompson To: Andrew Brampton Message-ID: <20090112153620.GA76347@citylink.fud.org.nz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Cc: hackers@freebsd.org Subject: Re: Determine if a kernel is built with a specific option? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jan 2009 16:03:07 -0000 On Mon, Jan 12, 2009 at 11:55:11AM +0000, Andrew Brampton wrote: > Hi, > I was wondering how a autoconf configure script can determine if the > kernel is built with a particular option. In this case the code I have > can make use of the FreeBSD polling driver, which by default isn't > built into a kernel. So I want my configure script to determine if the > kernel supports it, if so sets a #define, otherwise doesn't. > > In the past I have basically hacked my way though these configure > scripts by looking at other examples. One such example I found was for > Linux, which does something like this: > > AC_CACHE_CHECK(for device polling kernel extension, ac_cv_linux_poll_extension, > [if grep polling `find_linuxpath include/linux/netdevice.h` >/dev/null > 2>&1; then > ac_cv_linux_poll_extension=yes > else ac_cv_linux_poll_extension=no; fi]) > if test $ac_cv_linux_poll_extension = yes; then > AC_DEFINE(HAVE_LINUX_POLLING) > fi > > So I simply want to figure out an equalavant check I can do on FreeBSD. I believe the correct way is to read kern.features from sysctl and the appropriate code marks it with FEATURE(name, "description"); Having said that the polling code does not set this so would need to be added. Andrew