hacking: update advice w.r.t. synced files
[automake.git] / m4 / regex.m4
blob93558408b709f9547502c0f5a7caab728732bfbf
1 ## --------------------------------- ##                     -*- Autoconf -*-
2 ## Check if --with-regex was given.  ##
3 ## --------------------------------- ##
4 # Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5 # 2010, 2011 Free Software Foundation, Inc.
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.
11 # serial 10
13 # AM_WITH_REGEX
14 # -------------
16 # THIS MACRO IS OBSOLETE now, since rx doesn't seem to be maintained,
17 # while regex is.  This macro should be removed in the next major
18 # automake version (1.12).
20 # The idea is to distribute rx.[hc] and regex.[hc] together, for a
21 # while.  The WITH_REGEX symbol is used to decide which of regex.h or
22 # rx.h should be included in the application.  If `./configure
23 # --with-regex' is given (the default), the package will use gawk's
24 # regex.  If `./configure --without-regex', a check is made to see if
25 # rx is already installed, as with newer Linux'es.  If not found, the
26 # package will use the rx from the distribution.  If found, the
27 # package will use the system's rx which, on Linux at least, will
28 # result in a smaller executable file.
30 AC_DEFUN([AM_WITH_REGEX],
31 [AC_PREREQ(2.50)dnl
32 m4_warn([obsolete], [$0 is obsolete, since GNU rx is unmantained now])dnl
33 AC_LIBSOURCES([rx.h, rx.c, regex.c, regex.h])dnl
34 AC_MSG_CHECKING([which of GNU rx or gawk's regex is wanted])
35 AC_ARG_WITH([regex],
36 [  --without-regex         use GNU rx in lieu of gawk's regex for matching],
37             [test "$withval" = yes && am_with_regex=1],
38             [am_with_regex=1])
39 if test -n "$am_with_regex"; then
40   AC_MSG_RESULT([regex])
41   AC_DEFINE([WITH_REGEX], 1, [Define if using GNU regex])
42   AC_CACHE_CHECK([for GNU regex in libc], [am_cv_gnu_regex],
43     [AC_TRY_LINK([],
44                  [extern int re_max_failures; re_max_failures = 1],
45                  [am_cv_gnu_regex=yes],
46                  [am_cv_gnu_regex=no])])
47   if test $am_cv_gnu_regex = no; then
48     AC_LIBOBJ([regex])
49   fi
50 else
51   AC_MSG_RESULT([rx])
52   AC_CHECK_FUNC([re_rx_search], , [AC_LIBOBJ([rx])])
53 fi[]dnl
56 AU_DEFUN([fp_WITH_REGEX], [AM_WITH_REGEX])