From owner-freebsd-hackers Fri Feb 27 14:51:52 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA16502 for freebsd-hackers-outgoing; Fri, 27 Feb 1998 14:51:52 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from opus.cts.cwu.edu (skynyrd@opus.cts.cwu.edu [198.104.92.71]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA16428 for ; Fri, 27 Feb 1998 14:51:38 -0800 (PST) (envelope-from skynyrd@opus.cts.cwu.edu) Received: from localhost (skynyrd@localhost) by opus.cts.cwu.edu (8.8.8/8.8.8) with SMTP id OAA28795 for ; Fri, 27 Feb 1998 14:51:37 -0800 (PST) (envelope-from skynyrd@opus.cts.cwu.edu) Date: Fri, 27 Feb 1998 14:51:36 -0800 (PST) From: Chris Timmons To: freebsd-hackers@FreeBSD.ORG Subject: detecting regexp implementations with gnu autoconf Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm making some adjustments to a program which currently uses (linux?) regular expression processing: #include Call compile() then step() A solaris machine I have uses: #include char *compile(char *instring, char *expbuf, const char *endbuf); int step(const char *string, const char *expbuf); It looks like *BSD supports POSIX regular expressions: #include #include int regcomp(regex_t *preg, const char *pattern, int cflags); int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size); void regfree(regex_t *preg); What would the best way to dance around this in the application program? I want to submit source changes to the maintainers which will allow the program to compile and run on *BSD. Right now the plan is to have autoconf look for regex.h, regcomp(), regexc(), regerror() and regfree() as the signature for the POSIX implementation. Otherwise use compile() and step() if they are present. #if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP) \ && defined(HAVE_REGEXEC) && defined(HAVE_REGERROR) \ && defined(HAVE_REGFREE) #define USE_POSIX_REGEX 1 #elif defined(HAVE_COMPILE) && defined(HAVE_STEP) #define USE_SYSV_REGEX 1 #else #error "Need either POSIX or SYSV (compile/step) regex support." #endif Suggestions? -Chris To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message