diff --git a/ChangeLog b/ChangeLog
index 3475f6f0..42a096a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
 	* configure.ac: Use pkg-config to check for libuuid presence and
 	fallback to the previous code if that doesn't work.
 
+	* configure.ac: Use pkg-config to check for pcre presence and
+	fallback to the previous code if that doesn't work.
+
 2014-07-28  Ángel González <keisial@gmail.com>
 	* contrib: Created contrib folder.
 	* contrib/tsocked-wget: Added wrapper for usage with socks proxy.
diff --git a/configure.ac b/configure.ac
index ad88c597..1b5407dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -600,13 +600,24 @@ dnl
 dnl Check for PCRE
 dnl
 
-AC_CHECK_HEADER(pcre.h,
-                AC_CHECK_LIB(pcre, pcre_compile,
-                  [LIBS="${LIBS} -lpcre"
-                   AC_DEFINE([HAVE_LIBPCRE], 1,
-                             [Define if libpcre is available.])
-                  ])
-)
+AC_ARG_ENABLE(pcre, AC_HELP_STRING([--disable-pcre],
+                                   [Disable PCRE style regular expressions]))
+
+AS_IF([test "X$enable_pcre" != "Xno"],[
+  PKG_CHECK_MODULES([PCRE], libpcre, [
+    LIBS="$PCRE_LIBS $LIBS"
+    CFLAGS="$PCRE_CFLAGS $CFLAGS"
+    AC_DEFINE([HAVE_LIBPCRE], [1], [Define if using libpcre.])
+  ], [
+    AC_CHECK_HEADER(pcre.h,
+                    AC_CHECK_LIB(pcre, pcre_compile,
+                      [LIBS="${LIBS} -lpcre"
+                       AC_DEFINE([HAVE_LIBPCRE], 1,
+                                 [Define if libpcre is available.])
+                      ])
+    )
+  ])
+])
 
 
 dnl Needed by src/Makefile.am