/[mailutils]/mailutils/m4/regex.m4
ViewVC logotype

Diff of /mailutils/m4/regex.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by alainm, Sun Aug 12 01:54:14 2001 UTC revision 1.2 by jbailey, Mon Aug 5 16:41:43 2002 UTC
# Line 1  Line 1 
1  #serial 5001  #serial 12
2    
3  dnl Initially derived from code in GNU grep.  dnl Initially derived from code in GNU grep.
4  dnl Mostly written by Jim Meyering.  dnl Mostly written by Jim Meyering.
5    
6  dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])  dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
7  dnl  dnl
8  AC_DEFUN(jm_INCLUDED_REGEX,  AC_DEFUN([jm_INCLUDED_REGEX],
9    [    [
10      dnl Even packages that don't use regex.c can use this macro.      dnl Even packages that don't use regex.c can use this macro.
11      dnl Of course, for them it doesn't do anything.      dnl Of course, for them it doesn't do anything.
# Line 21  AC_DEFUN(jm_INCLUDED_REGEX, Line 21  AC_DEFUN(jm_INCLUDED_REGEX,
21      AC_CACHE_CHECK([for working re_compile_pattern],      AC_CACHE_CHECK([for working re_compile_pattern],
22                     jm_cv_func_working_re_compile_pattern,                     jm_cv_func_working_re_compile_pattern,
23        AC_TRY_RUN(        AC_TRY_RUN(
24          changequote(<<, >>)dnl  [#include <stdio.h>
         <<  
 #include <stdio.h>  
25  #include <regex.h>  #include <regex.h>
26            int            int
27            main ()            main ()
28            {            {
29              static struct re_pattern_buffer regex;              static struct re_pattern_buffer regex;
30              const char *s;              const char *s;
31                struct re_registers regs;
32              re_set_syntax (RE_SYNTAX_POSIX_EGREP);              re_set_syntax (RE_SYNTAX_POSIX_EGREP);
33              /* Add this third left square bracket, [, to balance the              [s = re_compile_pattern ("a[[:@:>@:]]b\n", 9, &regex);]
                three right ones below.  Otherwise autoconf-2.14 chokes.  */  
             s = re_compile_pattern ("a[[:]:]]b\n", 9, &regex);  
34              /* This should fail with _Invalid character class name_ error.  */              /* This should fail with _Invalid character class name_ error.  */
35              if (!s)              if (!s)
36                exit (1);                exit (1);
# Line 41  AC_DEFUN(jm_INCLUDED_REGEX, Line 38  AC_DEFUN(jm_INCLUDED_REGEX,
38              /* This should succeed, but doesn't for e.g. glibc-2.1.3.  */              /* This should succeed, but doesn't for e.g. glibc-2.1.3.  */
39              s = re_compile_pattern ("{1", 2, &regex);              s = re_compile_pattern ("{1", 2, &regex);
40    
41             exit (s ? 1 : 0);              if (s)
42            }                exit (1);
43          >>,  
44          changequote([, ])dnl              /* The following example is derived from a problem report
45                   against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>.  */
46                s = re_compile_pattern ("[[anù]]*n", 7, &regex);
47                if (s)
48                  exit (1);
49    
50                /* This should match, but doesn't for e.g. glibc-2.2.1.  */
51                if (re_match (&regex, "an", 2, 0, &regs) != 2)
52                  exit (1);
53    
54                exit (0);
55              }
56            ],
57                 jm_cv_func_working_re_compile_pattern=yes,                 jm_cv_func_working_re_compile_pattern=yes,
58                 jm_cv_func_working_re_compile_pattern=no,                 jm_cv_func_working_re_compile_pattern=no,
59                 dnl When crosscompiling, assume it's broken.                 dnl When crosscompiling, assume it's broken.
# Line 55  AC_DEFUN(jm_INCLUDED_REGEX, Line 63  AC_DEFUN(jm_INCLUDED_REGEX,
63      fi      fi
64    
65      test -n "$1" || AC_MSG_ERROR([missing argument])      test -n "$1" || AC_MSG_ERROR([missing argument])
66      syscmd([test -f $1])      m4_syscmd([test -f $1])
67      ifelse(sysval, 0,      ifelse(m4_sysval, 0,
68        [        [
   
69          AC_ARG_WITH(included-regex,          AC_ARG_WITH(included-regex,
70          [  --without-included-regex don't compile regex; this is the default on          [  --without-included-regex don't compile regex; this is the default on
71                            systems with version 2 of the GNU C library                            systems with version 2 of the GNU C library
# Line 66  AC_DEFUN(jm_INCLUDED_REGEX, Line 73  AC_DEFUN(jm_INCLUDED_REGEX,
73                      jm_with_regex=$withval,                      jm_with_regex=$withval,
74                      jm_with_regex=$ac_use_included_regex)                      jm_with_regex=$ac_use_included_regex)
75          if test "$jm_with_regex" = yes; then          if test "$jm_with_regex" = yes; then
76            AC_SUBST(LIBOBJS)            AC_LIBOBJ(regex)
           LIBOBJS="$LIBOBJS regex.$ac_objext"  
77          fi          fi
78        ],        ],
79      )      )

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26