octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch for configure for pcre.h working with autoconf 2.59


From: Jskud
Subject: Re: patch for configure for pcre.h working with autoconf 2.59
Date: Wed, 14 Nov 2007 09:46:06 -0800

> It doesn't look like the patch will apply to the current sources

Sorry about that.  Here's an updated one, based on the lastest CVS
configure.in source, which properly caches the results and gives good
messages; I hope you will find it useful.

Note that it works by setting CPPFLAGS based on pcre-config, rather than
the explicit checks for pcre.h and pcre/pcre.h, since CPPFLAGS is what
AC_EGREP_CPP needs.  If you feel strongly that you don't want CPPFLAGS
to be set for all compiles, let me know, and I'll rework it (again).

/Jskud

================================================================

ChangeLog

2007-11-13  Joseph P. Skudlarek  <address@hidden>

        * configure.in: Rework pcre.h tests to work with autoconf 2.59,
        and avoid explicit pcre/pcre.h check by using pcre-config.

================================================================

src/ChangeLog

2007-11-13  Joseph P. Skudlarek  <address@hidden>

        * DLD-FUNCTIONS/regexp.cc: Simplify HAVE_PCRE and pcre.h usage.


================================================================

--- /home/Jskud/configure.in    2007-11-14 08:40:36.000000000 -0800
+++ configure.in        2007-11-14 09:30:04.000000000 -0800
@@ -29,7 +29,7 @@
 EXTERN_CXXFLAGS="$CXXFLAGS"
 
 AC_INIT
-AC_REVISION($Revision: 1.593 $)
+AC_REVISION($Revision: 1.572 $)
 AC_PREREQ(2.57)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -423,40 +423,39 @@
 AC_SUBST(TEXINFO_QHULL)
 
 ### Check for pcre/regex library.
-WITH_PCRE=no
-REGEX_LIBS=
-AC_CHECK_LIB(pcre, pcre_compile, [
-  m4_foreach_w([hdr], [pcre/pcre.h pcre.h],
-    [AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([hdr])),
-          [Define to 1 if you have the <]m4_defn([hdr])[>
-           header file, and it defines PCRE_INFO_NAMECOUNT,
-           PCRE_INFO_NAMEENTRYSIZE, and PCRE_INFO_NAMETABLE.])])
-  for hdr in pcre/pcre.h pcre.h; do
-    AC_MSG_CHECKING([whether $hdr defines the macros we need])
-    AC_EGREP_CPP([PCRE_HAS_MACROS_WE_NEED], [
-#include <$hdr>
+
+## check for pcre-config, and if so, set CPPFLAGS appropriately
+AC_CHECK_PROG(WITH_PCRE_CONFIG, pcre-config, yes, no)
+if test $WITH_PCRE_CONFIG = yes ; then
+  CPPFLAGS="$CPPFLAGS $(pcre-config --cflags)"
+fi
+
+## NB: no need to do separate check for pcre.h header -- checking macros is 
good enough
+AC_CACHE_CHECK([whether pcre.h defines the macros we need], 
[ac_cv_pcre_h_macros_present], [
+  AC_EGREP_CPP([PCRE_HAS_MACROS_WE_NEED], [
+#include <pcre.h>
 #if defined (PCRE_INFO_NAMECOUNT) \
   && defined (PCRE_INFO_NAMEENTRYSIZE) \
   && defined (PCRE_INFO_NAMETABLE)
 PCRE_HAS_MACROS_WE_NEED
-#endif], [
-dnl We check the header after the egrep to avoid defining HAVE_X_H macros
-dnl for headers that we can't use.
-      AC_MSG_RESULT([yes])
-      AC_CHECK_HEADER($hdr, [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$hdr), 1)])
-      AC_DEFINE(HAVE_PCRE, 1, [Define if PCRE is available.])
-      WITH_PCRE=yes
-      REGEX_LIBS=-lpcre
-      break
-    ], [AC_MSG_RESULT([no])])
-  done
-])
+#endif], ac_cv_pcre_h_macros_present=yes, ac_cv_pcre_h_macros_present=no)])
+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
+    REGEX_LIBS=$(pcre-config --libs)
+  else
+    REGEX_LIBS=-lpcre
+  fi
+fi
 if test $WITH_PCRE = no; then
   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
 
+## not sure why we need to check for regex like this if pcre is defined, but 
it was like this when I got here ...
 AC_CHECK_FUNCS(regexec, WITH_REGEX=yes , [
   AC_CHECK_LIB(regex, regexec, WITH_REGEX=yes, WITH_REGEX=no)])
 if test $WITH_REGEX = yes ; then
@@ -470,6 +469,7 @@
   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.
--- ../octave-2.9.17/src/DLD-FUNCTIONS/regexp.cc        2007-11-07 
10:48:01.000000000 -0800
+++ src/DLD-FUNCTIONS/regexp.cc 2007-11-13 22:54:57.000000000 -0800
@@ -40,9 +40,7 @@
 #include "quit.h"
 #include "parse.h"
 
-#if defined (HAVE_PCRE_PCRE_H)
-#include <pcre/pcre.h>
-#elif defined (HAVE_PCRE_H)
+#if defined (HAVE_PCRE)
 #include <pcre.h>
 #elif defined (HAVE_REGEX)
 #if defined (__MINGW32__)

[TheEnd]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]