1 | ## --------------------------------- ##
|
---|
2 | ## Check if --with-regex was given. ##
|
---|
3 | ## --------------------------------- ##
|
---|
4 |
|
---|
5 | # serial 1
|
---|
6 |
|
---|
7 | # The idea is to distribute rx.[hc] and regex.[hc] together, for a while.
|
---|
8 | # The WITH_REGEX symbol (which should also be documented in acconfig.h)
|
---|
9 | # is used to decide which of regex.h or rx.h should be included in the
|
---|
10 | # application. If `./configure --with-regex' is given (the default), the
|
---|
11 | # package will use gawk's regex. If `./configure --without-regex', a
|
---|
12 | # check is made to see if rx is already installed, as with newer Linux'es.
|
---|
13 | # If not found, the package will use the rx from the distribution.
|
---|
14 | # If found, the package will use the system's rx which, on Linux at least,
|
---|
15 | # will result in a smaller executable file.
|
---|
16 |
|
---|
17 | AC_DEFUN([AM_WITH_REGEX],
|
---|
18 | [AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
|
---|
19 | AC_ARG_WITH(regex,
|
---|
20 | [ --without-regex use GNU rx in lieu of gawk's regex for matching],
|
---|
21 | [test "$withval" = yes && am_with_regex=1],
|
---|
22 | [am_with_regex=1])
|
---|
23 | if test -n "$am_with_regex"; then
|
---|
24 | AC_MSG_RESULT(regex)
|
---|
25 | AC_DEFINE(WITH_REGEX,1,[Define if using GNU regex])
|
---|
26 | AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
|
---|
27 | AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
|
---|
28 | am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
|
---|
29 | if test $am_cv_gnu_regex = no; then
|
---|
30 | LIBOBJS="$LIBOBJS regex.o"
|
---|
31 | fi
|
---|
32 | else
|
---|
33 | AC_MSG_RESULT(rx)
|
---|
34 | AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
|
---|
35 | fi
|
---|
36 | AC_SUBST(LIBOBJS)dnl
|
---|
37 | ])
|
---|