octave-maintainers
[Top][All Lists]
Advanced

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

patch for configure for pcre.h working with autoconf 2.59


From: Jskud
Subject: patch for configure for pcre.h working with autoconf 2.59
Date: Wed, 14 Nov 2007 00:01:03 -0800

Here are two ChangeLog entries, and a patch to rework configure.in and
regexp.cc to handle pcre.h more gracefully; this patch is built on top
of the most recent patch.

FYI, prior version also did not work for me -- the check for the header
did not update the CPPFLAGS, and so could not find pcre.h or the macros.

/Jskud

--- ChangeLog   Tue Nov 13 23:14:38 2007
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       Tue Nov 13 23:16:22 2007
2007-11-13  Joseph P. Skudlarek  <address@hidden>

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

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

*** ../octave-2.9.17/configure.in       Fri Nov  9 21:17:27 2007
--- configure.in        Tue Nov 13 23:00:31 2007
*************** fi
*** 423,462 ****
  AC_SUBST(TEXINFO_QHULL)
  
  ### Check for pcre/regex library.
! AC_SUBST(REGEX_LIBS)
! WITH_PCRE_CONFIG=no
! AC_CHECK_HEADERS([pcre/pcre.h pcre.h], WITH_PCRE=yes, WITH_PCRE=no)
! if test $WITH_PCRE = no ; then
!   AC_CHECK_PROG(WITH_PCRE_CONFIG, pcre-config, yes, no)
!   if test $WITH_PCRE_CONFIG = yes ; then
!     WITH_PCRE=yes
!   fi
  fi
! AC_CACHE_CHECK([whether pcre.h has 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], ac_cv_pcre_h_macros_present=yes, ac_cv_pcre_h_macros_present=no)])
  WITH_PCRE="$ac_cv_pcre_h_macros_present"
! if test $WITH_PCRE = yes ; then
!   AC_CHECK_LIB(pcre, pcre_compile, WITH_PCRE=yes, WITH_PCRE=no)
!   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 --cflags --libs`
!     else
!       REGEX_LIBS="-lpcre"
!     fi
    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
  AC_CHECK_FUNCS(regexec, WITH_REGEX=yes , [
    AC_CHECK_LIB(regex, regexec, WITH_REGEX=yes, WITH_REGEX=no)])
  if test $WITH_REGEX = yes ; then
--- 423,457 ----
  AC_SUBST(TEXINFO_QHULL)
  
  ### Check for pcre/regex library.
! ## 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
! ## check to see if pcre.h (exists and) has macros we need
! 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], 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
*************** if test $WITH_REGEX = no; then
*** 470,475 ****
--- 465,471 ----
    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        Wed Nov  7 10:48:01 2007
--- src/DLD-FUNCTIONS/regexp.cc Tue Nov 13 22:54:57 2007
*************** along with Octave; see the file COPYING.
*** 40,48 ****
  #include "quit.h"
  #include "parse.h"
  
! #if defined (HAVE_PCRE_PCRE_H)
! #include <pcre/pcre.h>
! #elif defined (HAVE_PCRE_H)
  #include <pcre.h>
  #elif defined (HAVE_REGEX)
  #if defined (__MINGW32__)
--- 40,46 ----
  #include "quit.h"
  #include "parse.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]