tagging release
[dasher.git] / m4 / regex.m4
bloba8fd3aad5ebe7a9f3813c8bf7bb11e6f9459ecd2
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)
10 # any later version.
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
20 # 02111-1307, USA.
22 # serial 4
23 AC_PREREQ(2.50)
25 # AM_WITH_REGEX
26 # -------------
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])
43 AC_ARG_WITH(regex,
44 [  --without-regex         use GNU rx in lieu of gawk's regex for matching],
45             [test "$withval" = yes && am_with_regex=1],
46             [am_with_regex=1])
47 if test -n "$am_with_regex"; then
48   AC_MSG_RESULT(regex)
49   AC_DEFINE(WITH_REGEX, 1, [Define if using GNU regex])
50   AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
51     [AC_TRY_LINK([],
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
56     AC_LIBOBJ([regex])
57   fi
58 else
59   AC_MSG_RESULT(rx)
60   AC_CHECK_FUNC(re_rx_search, , [AC_LIBOBJ([rx])])
62 AC_SUBST(LIBOBJS)dnl
65 AU_DEFUN([fp_WITH_REGEX], [AM_WITH_REGEX])