1 ## --------------------------------- ##
2 ## Check if --with-regex was given. ##
3 ## --------------------------------- ##
10 # The idea is to distribute rx.[hc] and regex.[hc] together, for a
11 # while. The WITH_REGEX symbol is used to decide which of regex.h or
12 # rx.h should be included in the application. If `./configure
13 # --with-regex' is given (the default), the package will use gawk's
14 # regex. If `./configure --without-regex', a check is made to see if
15 # rx is already installed, as with newer Linux'es. If not found, the
16 # package will use the rx from the distribution. If found, the
17 # package will use the system's rx which, on Linux at least, will
18 # result in a smaller executable file.
20 # FIXME: This macro seems quite obsolete now since rx doesn't seem to
21 # be maintained, while regex is.
22 AC_DEFUN([AM_WITH_REGEX],
23 [ifdef([AC_LIBSOURCES],
24 [AC_LIBSOURCES([rx.h, rx.c, regex.c, regex.h])])dnl
25 AC_MSG_CHECKING([which of GNU rx or gawk's regex is wanted])
27 [ --without-regex use GNU rx in lieu of gawk's regex for matching],
28 [test "$withval" = yes && am_with_regex=1],
30 if test -n "$am_with_regex"; then
32 AC_DEFINE(WITH_REGEX, 1, [Define if using GNU regex])
33 AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
35 [extern int re_max_failures; re_max_failures = 1],
36 [am_cv_gnu_regex=yes],
37 [am_cv_gnu_regex=no])])
38 if test $am_cv_gnu_regex = no; then
39 LIBOBJS="$LIBOBJS regex.$ac_objext"
43 AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.$ac_objext"])