changeset 8621:f1534e248260

configure.in: check for pcre_compile, don't check for other regex functions if pcre library is found
author John W. Eaton <jwe@octave.org>
date Wed, 28 Jan 2009 18:58:15 -0500
parents a2dd2ffc504d
children 640b5d25ac19
files ChangeLog configure.in
diffstat 2 files changed, 26 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jan 28 11:25:07 2009 -0500
+++ b/ChangeLog	Wed Jan 28 18:58:15 2009 -0500
@@ -1,10 +1,15 @@
 2009-01-28  John W. Eaton  <jwe@octave.org>
 
+	* configure.in: Check to see that pcre library has pcre_compile
+	function.  Don't check for other regex functions is pcre library
+	is found.
+
  	* configure.in (SHLLIBPRE, SHLBINPRE): New variables.  AC_SUBST them.
  	(*-*-cygwin*): Set LIBPRE and SHLBINPRE to cyg and SHLLIBPRE to lib.
 	Use SHLLIBPRE and SHLLIB in definition of SONAME_FLAGS.
 	(*-*-msdosmsvc): Make SHLBINPRE and SHLLIBPRE empty.
  	Adjust definition of SONAME_FLAGS for SHLLIBPRE.
+
 	* Makeconf.in (SHLLIBPRE, SHLBINPRE): Substitute new variables here.
 	From Marco Atzeri <marco_atzeri@yahoo.it>.
 
--- a/configure.in	Wed Jan 28 11:25:07 2009 -0500
+++ b/configure.in	Wed Jan 28 18:58:15 2009 -0500
@@ -457,30 +457,37 @@
 WITH_PCRE="$ac_cv_pcre_h_macros_present"
 
 REGEX_LIBS=
-if test $WITH_PCRE = yes; then
-  AC_DEFINE(HAVE_PCRE, 1, [Define if PCRE is available.])
-  if test $WITH_PCRE_CONFIG = yes; then
+using_pcre=no
+using_regex=no
+if test "$WITH_PCRE" = yes; then
+  if test "$WITH_PCRE_CONFIG" = yes; then
     REGEX_LIBS=$(pcre-config --libs)
   else
     REGEX_LIBS=-lpcre
   fi
+  save_LIBS="$LIBS"
+  LIBS="$REGEX_LIBS $LIBS"
+  AC_CHECK_FUNCS(pcre_compile, [using_pcre=yes
+    AC_DEFINE(HAVE_PCRE, 1, [Define if PCRE library is available.])], [
+      REGEX_LIBS=
+      warn_pcre="PCRE library not found.  This will result in some loss of functionality for the regular expression matching functions."
+      AC_MSG_WARN($warn_pcre)])
+  LIBS="$save_LIBS"
 else
   warn_pcre="PCRE library not found.  This will result in some loss of functionality for the regular expression matching functions."
   AC_MSG_WARN($warn_pcre)
 fi
 
-AC_CHECK_FUNCS(regexec, WITH_REGEX=yes , [
-  AC_CHECK_LIB(regex, regexec, WITH_REGEX=yes, WITH_REGEX=no)])
-if test $WITH_REGEX = yes ; then
-  AC_DEFINE(HAVE_REGEX, 1, [Define if regex is available.])
-    AC_CHECK_FUNCS(regexec, REGEX_LIBS= , [
-      AC_CHECK_LIB(regex, regexec, REGEX_LIBS="$REGEX_LIBS -lregex")])
+if test "$using_pcre" = no; then
+  AC_CHECK_FUNCS(regexec, [using_regex=yes], [
+    AC_CHECK_LIB(regex, regexec, [using_regex=yes
+      REGEX_LIBS="-lregex"], [
+      warn_regex="regular expression functions not found.  The regular expression matching functions will be disabled."
+      AC_MSG_WARN($warn_regex)])])
+  if test "$using_regex" = yes; then
+    AC_DEFINE(HAVE_REGEX, 1, [Define if regex library is available.])
+  fi
 fi
-if test $WITH_REGEX = no; then
-  warn_regex="regular expression functions not found.  The regular expression matching functions will be disabled."
-  AC_MSG_WARN($warn_regex)
-fi
-
 AC_SUBST(REGEX_LIBS)
 
 ### Check for ZLIB library.