Browse code

changed libpcre dependency from opt-in to opt-out

Kevin Lin authored on 2015/05/28 07:30:09
Showing 1 changed files
... ...
@@ -1,47 +1,53 @@
1 1
 dnl Check for PCRE
2 2
 
3
-dnl determine the home of pcre
4 3
 PCRE_HOME=""
4
+dnl handle the --with-pcre flag
5 5
 AC_ARG_WITH([pcre],
6 6
 [AS_HELP_STRING([--with-pcre@<:@=DIR@:>@], [path to directory containing libpcre library
7 7
                 @<:@default=/usr/local or /usr if not found in /usr/local@:>@])],
8 8
 [
9
-  AC_MSG_CHECKING([for libpcre installation])
10
-  case "$withval" in
11
-  no)
12
-    AC_MSG_RESULT([no])
13
-    ;;
14
-  yes)
15
-    PCRE_HOME=/usr/local
16
-    if test ! -x "$PCRE_HOME/bin/pcre-config"; then
17
-      PCRE_HOME=/usr
18
-      if test ! -x "$PCRE_HOME/bin/pcre-config"; then
19
-        PCRE_HOME=""
20
-        AC_MSG_ERROR([cannot locate libpcre at /usr/local or /usr])
21
-      fi
22
-    fi
23
-    ;;
24
-  "")
25
-    AC_MSG_ERROR([cannot assign blank value to --with-pcre])
26
-    ;;
27
-  *)
28
-    PCRE_HOME="$withval"
9
+  PCRE_HOME=$withval
10
+],
11
+[
12
+dnl default ON if present
13
+  PCRE_HOME="yes"
14
+])
15
+
16
+dnl detemine if specified (or default) is valid
17
+AC_MSG_CHECKING([for libpcre installation])
18
+case "$PCRE_HOME" in
19
+no)
20
+  PCRE_HOME=""
21
+  AC_MSG_RESULT([no])
22
+  ;;
23
+yes)
24
+  PCRE_HOME=/usr/local
25
+  if test ! -x "$PCRE_HOME/bin/pcre-config"; then
26
+    PCRE_HOME=/usr
29 27
     if test ! -x "$PCRE_HOME/bin/pcre-config"; then
30 28
       PCRE_HOME=""
31
-      AC_MSG_ERROR([cannot locate libpcre at $withval])
29
+      AC_MSG_RESULT([no])
30
+      AC_MSG_NOTICE([cannot locate libpcre at /usr/local or /usr])
32 31
     fi
33
-    ;;
34
-  esac
35
-
36
-  if test "x$PCRE_HOME" != "x"; then
37
-    AC_MSG_RESULT([using $PCRE_HOME])
38
-  else
32
+  fi
33
+  ;;
34
+"")
35
+  AC_MSG_RESULT([])
36
+  AC_MSG_ERROR([cannot assign blank value to --with-pcre])
37
+  ;;
38
+*)
39
+  PCRE_HOME="$withval"
40
+  if test ! -x "$PCRE_HOME/bin/pcre-config"; then
41
+    PCRE_HOME=""
39 42
     AC_MSG_RESULT([not found])
43
+    AC_MSG_ERROR([cannot locate libpcre at $withval])
40 44
   fi
41
-],[
42
-dnl --with-pcre not specified
43
-  PCRE_HOME=""
44
-])
45
+  ;;
46
+esac
47
+
48
+if test "x$PCRE_HOME" != "x"; then
49
+  AC_MSG_RESULT([using $PCRE_HOME])
50
+fi
45 51
 
46 52
 dnl if pcre has a home, then check if it is valid and get flags
47 53
 found_pcre="no"
... ...
@@ -52,7 +58,7 @@ if test "x$PCRE_HOME" != "x"; then
52 52
   AC_MSG_CHECKING([pcre-config version])
53 53
   PCRECONF_VERSION="`$PCRE_HOME/bin/pcre-config --version`"
54 54
   if test "x%PCRECONF_VERSION" != "x"; then
55
-    AC_MSG_RESULT([$PCRECONF_VERSION"])
55
+    AC_MSG_RESULT([$PCRECONF_VERSION])
56 56
     found_pcre="yes"
57 57
     PCRE_CPPFLAGS="`$PCRE_HOME/bin/pcre-config --cflags`"
58 58
     PCRE_LIBS="`$PCRE_HOME/bin/pcre-config --libs`"