summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-07-26 22:05:56 +0000
committerChris Wilson <chris+github@qwirx.com>2007-07-26 22:05:56 +0000
commit8bc9c724d51312906be6e965b45a7bc071cfb931 (patch)
tree0211f7c63d26f89ba02b13903e7eeeeba95ae2de
parent4a3627d5b883c0f66c9f2b770a427c18df51203f (diff)
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])
-rw-r--r--configure.ac20
-rw-r--r--docs/backup/win32_build_on_cygwin_using_mingw.txt14
-rw-r--r--lib/common/BoxConfig-MSVC.h1
-rw-r--r--lib/common/ExcludeList.cpp27
-rw-r--r--lib/common/ExcludeList.h4
5 files changed, 38 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac
index e52ba99f..cab2ee97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,7 +112,23 @@ AC_CHECK_HEADER([regex.h], [have_regex_h=yes])
if test "$have_regex_h" = "yes"; then
AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if regex.h is available])
- AC_SEARCH_LIBS([regcomp], ["pcreposix -lpcre"])
+else
+ AC_CHECK_HEADER([pcreposix.h], [have_pcreposix_h=yes])
+fi
+
+if test "$have_pcreposix_h" = "yes"; then
+ AC_SEARCH_LIBS([regcomp], ["pcreposix -lpcre"],,[have_pcreposix_h=no_regcomp])
+fi
+
+if test "$have_pcreposix_h" = "yes"; then
+ AC_DEFINE([HAVE_PCREPOSIX_H], [1], [Define to 1 if pcreposix.h is available])
+fi
+
+if test "$have_regex_h" = "yes" -o "$have_pcreposix_h" = "yes"; then
+ have_regex_support=yes
+ AC_DEFINE([HAVE_REGEX_SUPPORT], [1], [Define to 1 if regular expressions are supported])
+else
+ have_regex_support=no
fi
AC_SEARCH_LIBS([dlsym], ["dl"])
@@ -274,7 +290,7 @@ A summary of the build configuration is below. Box Backup will function
without these features, but will work better where they are present. Refer
to the documentation for more information on each feature.
-Regular expressions: $have_regex_h
+Regular expressions: $have_regex_support
Large files: $have_large_file_support
Berkeley DB: $ax_path_bdb_ok
Readline: $have_libreadline
diff --git a/docs/backup/win32_build_on_cygwin_using_mingw.txt b/docs/backup/win32_build_on_cygwin_using_mingw.txt
index c35764bb..d93c2bce 100644
--- a/docs/backup/win32_build_on_cygwin_using_mingw.txt
+++ b/docs/backup/win32_build_on_cygwin_using_mingw.txt
@@ -35,20 +35,12 @@ Configure PCRE for MinGW compilation, and build and install it:
export CFLAGS="-mno-cygwin"
./configure
make winshared
- cp .libs/pcreposix.dll /bin
- cp .libs/pcreposix.dll.a /usr/i686-pc-mingw32/lib
- cp pcreposix.h /usr/i686-pc-mingw32/include/regex.h
+ cp .libs/libpcre.a .libs/libpcreposix.a /usr/lib/mingw
+ cp pcreposix.h /usr/include/mingw
Now unpack the Box Backup sources, enter the source directory,
and configure like this:
- export CXX="g++ -mno-cygwin"
- export LD="g++ -mno-cygwin"
- export CFLAGS="-mno-cygwin -mthreads"
- export CXXFLAGS="-mno-cygwin -mthreads"
- export LDFLAGS="-mno-cygwin -mthreads"
- export LIBS="-lcrypto -lws2_32 -lgdi32"
- (if you don't have a "configure" file, run "./bootstrap")
- ./configure --target=i686-pc-mingw32
+ ./infrastructure/mingw/configure.sh
make
diff --git a/lib/common/BoxConfig-MSVC.h b/lib/common/BoxConfig-MSVC.h
index 0f84f964..6ce496f5 100644
--- a/lib/common/BoxConfig-MSVC.h
+++ b/lib/common/BoxConfig-MSVC.h
@@ -178,6 +178,7 @@
/* Define to 1 if you have the <regex.h> header file. */
/* #undef HAVE_REGEX_H */
#define HAVE_PCREPOSIX_H 1
+#define HAVE_REGEX_SUPPORT 1
/* Define to 1 if you have the `setproctitle' function. */
/* #undef HAVE_SETPROCTITLE */
diff --git a/lib/common/ExcludeList.cpp b/lib/common/ExcludeList.cpp
index a8d07dcc..b9f41634 100644
--- a/lib/common/ExcludeList.cpp
+++ b/lib/common/ExcludeList.cpp
@@ -9,11 +9,12 @@
#include "Box.h"
-#ifdef HAVE_PCREPOSIX_H
- #include <pcreposix.h>
- #define EXCLUDELIST_IMPLEMENTATION_REGEX_T_DEFINED
-#elif defined HAVE_REGEX_H
- #include <regex.h>
+#ifdef HAVE_REGEX_SUPPORT
+ #ifdef HAVE_PCREPOSIX_H
+ #include <pcreposix.h>
+ #else
+ #include <regex.h>
+ #endif
#define EXCLUDELIST_IMPLEMENTATION_REGEX_T_DEFINED
#endif
@@ -49,7 +50,7 @@ ExcludeList::ExcludeList()
// --------------------------------------------------------------------------
ExcludeList::~ExcludeList()
{
-#ifdef HAVE_REGEX_H
+#ifdef HAVE_REGEX_SUPPORT
// free regex memory
while(mRegex.size() > 0)
{
@@ -167,7 +168,7 @@ void ExcludeList::AddDefiniteEntries(const std::string &rEntries)
// --------------------------------------------------------------------------
void ExcludeList::AddRegexEntries(const std::string &rEntries)
{
-#ifdef HAVE_REGEX_H
+#ifdef HAVE_REGEX_SUPPORT
// Split strings up
std::vector<std::string> ens;
@@ -252,7 +253,7 @@ bool ExcludeList::IsExcluded(const std::string &rTest) const
}
// Check against regular expressions
-#ifdef HAVE_REGEX_H
+#ifdef HAVE_REGEX_SUPPORT
for(std::vector<regex_t *>::const_iterator i(mRegex.begin()); i != mRegex.end(); ++i)
{
// Test against this expression
@@ -308,7 +309,7 @@ void ExcludeList::Deserialize(Archive & rArchive)
//
mDefinite.clear();
-#ifdef HAVE_REGEX_H
+#ifdef HAVE_REGEX_SUPPORT
// free regex memory
while(mRegex.size() > 0)
{
@@ -349,7 +350,7 @@ void ExcludeList::Deserialize(Archive & rArchive)
//
//
//
-#ifdef HAVE_REGEX_H
+#ifdef HAVE_REGEX_SUPPORT
rArchive.Read(iCount);
if (iCount > 0)
@@ -386,7 +387,7 @@ void ExcludeList::Deserialize(Archive & rArchive)
}
}
}
-#endif // HAVE_REGEX_H
+#endif // HAVE_REGEX_SUPPORT
//
//
@@ -441,7 +442,7 @@ void ExcludeList::Serialize(Archive & rArchive) const
//
//
//
-#ifdef HAVE_REGEX_H
+#ifdef HAVE_REGEX_SUPPORT
// don't even try to save compiled regular expressions,
// use string copies instead.
ASSERT(mRegex.size() == mRegexStr.size());
@@ -454,7 +455,7 @@ void ExcludeList::Serialize(Archive & rArchive) const
{
rArchive.Write(*i);
}
-#endif // HAVE_REGEX_H
+#endif // HAVE_REGEX_SUPPORT
//
//
diff --git a/lib/common/ExcludeList.h b/lib/common/ExcludeList.h
index 522ee370..3c41bd11 100644
--- a/lib/common/ExcludeList.h
+++ b/lib/common/ExcludeList.h
@@ -50,7 +50,7 @@ public:
// Mainly for tests
unsigned int SizeOfDefiniteList() const {return mDefinite.size();}
unsigned int SizeOfRegexList() const
-#ifdef HAVE_REGEX_H
+#ifdef HAVE_REGEX_SUPPORT
{return mRegex.size();}
#else
{return 0;}
@@ -58,7 +58,7 @@ public:
private:
std::set<std::string> mDefinite;
-#ifdef HAVE_REGEX_H
+#ifdef HAVE_REGEX_SUPPORT
std::vector<regex_t *> mRegex;
std::vector<std::string> mRegexStr; // save original regular expression string-based source for Serialize
#endif