Changeset 1771


Ignore:
Timestamp:
26/07/2007 23:05:56 (5 years ago)
Author:
chris
Message:

Work around the fact that we may have regex support without having
regex.h (e.g. from pcreposix.h/libpcreposix) and disabuse HAVE_REGEX_H,
define and use HAVE_REGEX_SUPPORT instead, thanks Gary!
(refs #3, merges [1677] [1678] [1679])

Location:
box/chris/merge
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • box/chris/merge/configure.ac

    r1545 r1771  
    113113if test "$have_regex_h" = "yes"; then 
    114114  AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if regex.h is available]) 
    115   AC_SEARCH_LIBS([regcomp], ["pcreposix -lpcre"]) 
     115else 
     116  AC_CHECK_HEADER([pcreposix.h], [have_pcreposix_h=yes]) 
     117fi 
     118 
     119if test "$have_pcreposix_h" = "yes"; then 
     120  AC_SEARCH_LIBS([regcomp], ["pcreposix -lpcre"],,[have_pcreposix_h=no_regcomp]) 
     121fi 
     122 
     123if test "$have_pcreposix_h" = "yes"; then 
     124  AC_DEFINE([HAVE_PCREPOSIX_H], [1], [Define to 1 if pcreposix.h is available]) 
     125fi 
     126 
     127if test "$have_regex_h" = "yes" -o "$have_pcreposix_h" = "yes"; then 
     128  have_regex_support=yes 
     129  AC_DEFINE([HAVE_REGEX_SUPPORT], [1], [Define to 1 if regular expressions are supported]) 
     130else 
     131  have_regex_support=no 
    116132fi 
    117133 
     
    275291to the documentation for more information on each feature. 
    276292 
    277 Regular expressions: $have_regex_h 
     293Regular expressions: $have_regex_support 
    278294Large files:         $have_large_file_support 
    279295Berkeley DB:         $ax_path_bdb_ok 
  • box/chris/merge/docs/backup/win32_build_on_cygwin_using_mingw.txt

    r456 r1771  
    3636        ./configure 
    3737        make winshared 
    38         cp .libs/pcreposix.dll /bin 
    39         cp .libs/pcreposix.dll.a /usr/i686-pc-mingw32/lib 
    40         cp pcreposix.h /usr/i686-pc-mingw32/include/regex.h 
     38        cp .libs/libpcre.a .libs/libpcreposix.a /usr/lib/mingw 
     39        cp pcreposix.h /usr/include/mingw 
    4140 
    4241Now unpack the Box Backup sources, enter the source directory, 
    4342and configure like this: 
    4443 
    45         export CXX="g++ -mno-cygwin" 
    46         export LD="g++ -mno-cygwin" 
    47         export CFLAGS="-mno-cygwin -mthreads" 
    48         export CXXFLAGS="-mno-cygwin -mthreads" 
    49         export LDFLAGS="-mno-cygwin -mthreads" 
    50         export LIBS="-lcrypto -lws2_32 -lgdi32" 
    51         (if you don't have a "configure" file, run "./bootstrap") 
    52         ./configure --target=i686-pc-mingw32 
     44        ./infrastructure/mingw/configure.sh 
    5345        make 
    5446 
  • box/chris/merge/lib/common/BoxConfig-MSVC.h

    r1759 r1771  
    179179/* #undef HAVE_REGEX_H */ 
    180180#define HAVE_PCREPOSIX_H 1 
     181#define HAVE_REGEX_SUPPORT 1 
    181182 
    182183/* Define to 1 if you have the `setproctitle' function. */ 
  • box/chris/merge/lib/common/ExcludeList.cpp

    r1759 r1771  
    1010#include "Box.h" 
    1111 
    12 #ifdef HAVE_PCREPOSIX_H 
    13         #include <pcreposix.h> 
    14         #define EXCLUDELIST_IMPLEMENTATION_REGEX_T_DEFINED 
    15 #elif defined HAVE_REGEX_H 
    16         #include <regex.h> 
     12#ifdef HAVE_REGEX_SUPPORT 
     13        #ifdef HAVE_PCREPOSIX_H 
     14                #include <pcreposix.h> 
     15        #else 
     16                #include <regex.h> 
     17        #endif 
    1718        #define EXCLUDELIST_IMPLEMENTATION_REGEX_T_DEFINED 
    1819#endif 
     
    5051ExcludeList::~ExcludeList() 
    5152{ 
    52 #ifdef HAVE_REGEX_H 
     53#ifdef HAVE_REGEX_SUPPORT 
    5354        // free regex memory 
    5455        while(mRegex.size() > 0) 
     
    168169void ExcludeList::AddRegexEntries(const std::string &rEntries) 
    169170{ 
    170 #ifdef HAVE_REGEX_H 
     171#ifdef HAVE_REGEX_SUPPORT 
    171172 
    172173        // Split strings up 
     
    253254         
    254255        // Check against regular expressions 
    255 #ifdef HAVE_REGEX_H 
     256#ifdef HAVE_REGEX_SUPPORT 
    256257        for(std::vector<regex_t *>::const_iterator i(mRegex.begin()); i != mRegex.end(); ++i) 
    257258        { 
     
    309310        mDefinite.clear(); 
    310311 
    311 #ifdef HAVE_REGEX_H 
     312#ifdef HAVE_REGEX_SUPPORT 
    312313        // free regex memory 
    313314        while(mRegex.size() > 0) 
     
    350351        // 
    351352        // 
    352 #ifdef HAVE_REGEX_H 
     353#ifdef HAVE_REGEX_SUPPORT 
    353354        rArchive.Read(iCount); 
    354355 
     
    387388                } 
    388389        } 
    389 #endif // HAVE_REGEX_H 
     390#endif // HAVE_REGEX_SUPPORT 
    390391 
    391392        // 
     
    442443        // 
    443444        // 
    444 #ifdef HAVE_REGEX_H 
     445#ifdef HAVE_REGEX_SUPPORT 
    445446        // don't even try to save compiled regular expressions, 
    446447        // use string copies instead. 
     
    455456                rArchive.Write(*i); 
    456457        } 
    457 #endif // HAVE_REGEX_H 
     458#endif // HAVE_REGEX_SUPPORT 
    458459 
    459460        // 
  • box/chris/merge/lib/common/ExcludeList.h

    r1089 r1771  
    5151        unsigned int SizeOfDefiniteList() const {return mDefinite.size();} 
    5252        unsigned int SizeOfRegexList() const 
    53 #ifdef HAVE_REGEX_H 
     53#ifdef HAVE_REGEX_SUPPORT 
    5454                {return mRegex.size();} 
    5555#else 
     
    5959private: 
    6060        std::set<std::string> mDefinite; 
    61 #ifdef HAVE_REGEX_H 
     61#ifdef HAVE_REGEX_SUPPORT 
    6262        std::vector<regex_t *> mRegex; 
    6363        std::vector<std::string> mRegexStr;     // save original regular expression string-based source for Serialize 
Note: See TracChangeset for help on using the changeset viewer.