changeset 1422:3cb802f6756f

Use syscmd, ifelse, and sysval. Mainly as an exercise to prove that this macro can be used in packages without regex.c.
author Jim Meyering <jim@meyering.net>
date Sat, 04 Jul 1998 16:45:18 +0000
parents 6ee707631fa8
children c7976d28d865
files m4/regex.m4
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,15 +1,23 @@
 #serial 1
 
-dnl From grep.
+dnl Derived from code in GNU grep.
 
 AC_DEFUN(jm_WITH_REGEX,
   [
-    AC_ARG_WITH(included-regex,
+    dnl Even packages that don't use regex.c can use this macro.
+    dnl Of course, for them it doesn't do anything.
+
+    syscmd([test -f lib/regex.c])
+    ifelse(sysval, 0,
+      [
+	AC_ARG_WITH(included-regex,
 	    [  --without-included-regex don't compile regex (use with caution)],
-		jm_with_regex=$withval,
-		jm_with_regex=yes)
-    if test "$jm_with_regex" = yes; then
-      LIBOBJS="$LIBOBJS regex.o"
-    fi
+		    jm_with_regex=$withval,
+		    jm_with_regex=yes)
+	if test "$jm_with_regex" = yes; then
+	  LIBOBJS="$LIBOBJS regex.o"
+	fi
+      ],
+    )
   ]
 )