Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 21934 invoked from network); 3 Apr 2009 08:43:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Apr 2009 08:43:48 -0000 Received: (qmail 57504 invoked by uid 500); 3 Apr 2009 08:43:47 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 57431 invoked by uid 500); 3 Apr 2009 08:43:47 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 57420 invoked by uid 99); 3 Apr 2009 08:43:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Apr 2009 08:43:46 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [77.68.52.130] (HELO scaramanga.siterage.net) (77.68.52.130) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Apr 2009 08:43:37 +0000 Received: from localhost (scaramanga.siterage.net [127.0.0.1]) by localhost.akadia.com (SiteRage Mail Server) with ESMTP id F08503CB3F for ; Fri, 3 Apr 2009 09:43:16 +0100 (BST) X-Spam-Score: -4.335 X-Spam-Level: Received: from scaramanga.siterage.net ([127.0.0.1]) by localhost (scaramanga.siterage.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IT7oRjleNJAm for ; Fri, 3 Apr 2009 09:43:16 +0100 (BST) Received: from [192.168.201.2] (ip9.net195-72-173.ci-net.com [195.72.173.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by scaramanga.siterage.net (SiteRage Mail Server) with ESMTPSA id F3A813CB39 for ; Fri, 3 Apr 2009 09:43:15 +0100 (BST) Message-ID: <49D5CC23.8000700@dmi.me.uk> Date: Fri, 03 Apr 2009 09:43:15 +0100 From: Dave Ingram User-Agent: Thunderbird 2.0.0.21 (X11/20090302) MIME-Version: 1.0 To: modules-dev@httpd.apache.org Subject: Re: APR feature detection References: <49D4F9D1.6040006@dmi.me.uk> <20170a030904021159j7e614bfn38ea5a9ca2791b98@mail.gmail.com> In-Reply-To: <20170a030904021159j7e614bfn38ea5a9ca2791b98@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: multipart/alternative; boundary="------------050804060805070802050700" X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Flag: NO X-Old-Spam-Status: No, score=-4.335 required=6.31 tests=[ALL_TRUSTED=-1.8, AWL=0.063, BAYES_00=-2.599, HTML_MESSAGE=0.001] --------------050804060805070802050700 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sorin Manolache wrote: > On Thu, Apr 2, 2009 at 19:45, Dave Ingram wrote: > >> Hi guys, >> >> Is there any way that my module can detect which APR features are >> enabled in Apache? It relies on DBD, and if that's not available then my >> module just segfaults, which isn't very friendly. I'd prefer to give an >> error message to the user, telling them that DBD is required. >> >> Does anyone have any tips, or should I ask the APR list instead? >> > > dbd does this: > APR_REGISTER_OPTIONAL_FN(ap_dbd_prepare); > APR_REGISTER_OPTIONAL_FN(ap_dbd_open); > APR_REGISTER_OPTIONAL_FN(ap_dbd_close); > APR_REGISTER_OPTIONAL_FN(ap_dbd_acquire); > APR_REGISTER_OPTIONAL_FN(ap_dbd_cacquire); > > APR_RETRIEVE_OPTIONAL_FN(one of the functions above) should give you > NULL if DBD is absent. > > The two macros are declared in apr_optional.h. > Actually, that's not quite what I was after -- those are defined by mod_dbd, which I don't rely on (as it's initialised too late for my module's purposes). I do all of the DBD interaction myself. Is there any other way to be sure it's enabled? Would: if (apr_dbd_open != NULL) { // error... } work? Dave --------------050804060805070802050700--