1 ## --------------------------------- ## -*- Autoconf -*-
2 ## Check if --with-regex was given. ##
3 ## --------------------------------- ##
5 # Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 # The idea is to distribute rx.[hc] and regex.[hc] together, for a
29 # while. The WITH_REGEX symbol is used to decide which of regex.h or
30 # rx.h should be included in the application. If `./configure
31 # --with-regex' is given (the default), the package will use gawk's
32 # regex. If `./configure --without-regex', a check is made to see if
33 # rx is already installed, as with newer Linux'es. If not found, the
34 # package will use the rx from the distribution. If found, the
35 # package will use the system's rx which, on Linux at least, will
36 # result in a smaller executable file.
38 # FIXME: This macro seems quite obsolete now since rx doesn't seem to
39 # be maintained, while regex is.
40 AC_DEFUN([AM_WITH_REGEX],
41 [AC_LIBSOURCES([rx.h, rx.c, regex.c, regex.h])dnl
42 AC_MSG_CHECKING([which of GNU rx or gawk's regex is wanted])
44 [ --without-regex use GNU rx in lieu of gawk's regex for matching],
45 [test "$withval" = yes && am_with_regex=1],
47 if test -n "$am_with_regex"; then
49 AC_DEFINE(WITH_REGEX, 1, [Define if using GNU regex])
50 AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
52 [extern int re_max_failures; re_max_failures = 1],
53 [am_cv_gnu_regex=yes],
54 [am_cv_gnu_regex=no])])
55 if test $am_cv_gnu_regex = no; then
60 AC_CHECK_FUNC(re_rx_search, , [AC_LIBOBJ([rx])])
65 AU_DEFUN([fp_WITH_REGEX], [AM_WITH_REGEX])