Don't require -lm everywhere
[platform/upstream/automake.git] / m4 / AM_WITH_REGEX.m4
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)
26   LIBOBJS="$LIBOBJS regex.o"
27 else
28   AC_MSG_RESULT(rx)
29   AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
30 fi
31 AC_SUBST(LIBOBJS)dnl
32 ])