1 | ## --------------------------------- ## -*- Autoconf -*-
|
---|
2 | ## Check if --with-regex was given. ##
|
---|
3 | ## --------------------------------- ##
|
---|
4 | # Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
---|
5 | # Free Software Foundation, Inc.
|
---|
6 | #
|
---|
7 | # This file is free software; the Free Software Foundation
|
---|
8 | # gives unlimited permission to copy and/or distribute it,
|
---|
9 | # with or without modifications, as long as this notice is preserved.
|
---|
10 |
|
---|
11 | # serial 7
|
---|
12 |
|
---|
13 | # AM_WITH_REGEX
|
---|
14 | # -------------
|
---|
15 | #
|
---|
16 | # The idea is to distribute rx.[hc] and regex.[hc] together, for a
|
---|
17 | # while. The WITH_REGEX symbol is used to decide which of regex.h or
|
---|
18 | # rx.h should be included in the application. If `./configure
|
---|
19 | # --with-regex' is given (the default), the package will use gawk's
|
---|
20 | # regex. If `./configure --without-regex', a check is made to see if
|
---|
21 | # rx is already installed, as with newer Linux'es. If not found, the
|
---|
22 | # package will use the rx from the distribution. If found, the
|
---|
23 | # package will use the system's rx which, on Linux at least, will
|
---|
24 | # result in a smaller executable file.
|
---|
25 | #
|
---|
26 | # FIXME: This macro seems quite obsolete now since rx doesn't seem to
|
---|
27 | # be maintained, while regex is.
|
---|
28 | AC_DEFUN([AM_WITH_REGEX],
|
---|
29 | [AC_PREREQ(2.50)dnl
|
---|
30 | AC_LIBSOURCES([rx.h, rx.c, regex.c, regex.h])dnl
|
---|
31 | AC_MSG_CHECKING([which of GNU rx or gawk's regex is wanted])
|
---|
32 | AC_ARG_WITH([regex],
|
---|
33 | [ --without-regex use GNU rx in lieu of gawk's regex for matching],
|
---|
34 | [test "$withval" = yes && am_with_regex=1],
|
---|
35 | [am_with_regex=1])
|
---|
36 | if test -n "$am_with_regex"; then
|
---|
37 | AC_MSG_RESULT([regex])
|
---|
38 | AC_DEFINE([WITH_REGEX], 1, [Define if using GNU regex])
|
---|
39 | AC_CACHE_CHECK([for GNU regex in libc], [am_cv_gnu_regex],
|
---|
40 | [AC_TRY_LINK([],
|
---|
41 | [extern int re_max_failures; re_max_failures = 1],
|
---|
42 | [am_cv_gnu_regex=yes],
|
---|
43 | [am_cv_gnu_regex=no])])
|
---|
44 | if test $am_cv_gnu_regex = no; then
|
---|
45 | AC_LIBOBJ([regex])
|
---|
46 | fi
|
---|
47 | else
|
---|
48 | AC_MSG_RESULT([rx])
|
---|
49 | AC_CHECK_FUNC([re_rx_search], , [AC_LIBOBJ([rx])])
|
---|
50 | fi[]dnl
|
---|
51 | ])
|
---|
52 |
|
---|
53 | AU_DEFUN([fp_WITH_REGEX], [AM_WITH_REGEX])
|
---|