This patch add new option --with-regex

1) No option given. Tries to use system regex, falls back to sword.
2) --with-regex. Uses sword regex.
3) --without-regex. Uses system regex error's out if it can't find a
system regex.

Please test is on windows ;-)

-- 
With best regards


Dmitrijs Ledkovs (for short Dima),
Ледков Дмитрий Юрьевич

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
Index: tests/cppunit/Makefile.am
===================================================================
--- tests/cppunit/Makefile.am	(revision 1774)
+++ tests/cppunit/Makefile.am	(working copy)
@@ -8,9 +8,10 @@
 endif
 check_PROGRAMS = $(TESTS)
 LibSword_SOURCES = main.cpp stringmgr_test.cpp swbuf_test.cpp url_test.cpp versekey_test.cpp 
-LibSword_CXXFLAGS = $(CPPUNIT_CFLAGS) -I$(top_srcdir)/include
+LibSword_CXXFLAGS = $(CPPUNIT_CFLAGS)
 LibSword_LDFLAGS = $(CPPUNIT_LIBS)
 
 swcppunitpdir = $(top_srcdir)/tests/cppunit
 
+include $(top_srcdir)/include/Makefile.am
 #all: check

Index: src/utilfuns/Makefile.am
===================================================================
--- src/utilfuns/Makefile.am	(revision 2478)
+++ src/utilfuns/Makefile.am	(working copy)
@@ -29,10 +29,10 @@
 libsword_la_SOURCES += $(UNTGZ) 
 libsword_la_SOURCES += $(ftpsrc)
 
-if MINGW
+if SYSTEM_REGEX
+SWREGEX =
+else
 SWREGEX = $(utilfunsdir)/regex.c
-else
-SWREGEX =
 endif
 libsword_la_SOURCES += $(SWREGEX)
 

Index: utilities/Makefile.am
===================================================================
--- utilities/Makefile.am	(revision 2478)
+++ utilities/Makefile.am	(working copy)
@@ -1,6 +1,6 @@
 AUTOMAKE_OPTIONS = 1.6
 SUBDIRS = diatheke
-INCLUDES = -I $(top_srcdir)/include
+include $(top_srcdir)/include/Makefile.am
 LDADD = $(top_builddir)/lib/libsword.la
 noinst_PROGRAMS = cipherraw lexdump \
 stepdump step2vpl gbfidx modwrite addvs emptyvss \

Index: configure.ac
===================================================================
--- configure.ac	(revision 2488)
+++ configure.ac	(working copy)
@@ -19,8 +19,6 @@
 
 case $host_os in
      mingw*)
-	   # if we don't have system regex, use SWORD's copy
-           AC_CHECK_LIB(regex, regexec,,target_mingw32="yes")
 	   # both lines necessary to convince gcc to build dll
 	   LIBS="$LIBS -no-undefined";
 	   export lt_cv_deplibs_check_method=pass_all;
@@ -66,6 +64,8 @@
 	AC_HELP_STRING([--with-curl],[build install manager support using libcurl (default=yes)]),,with_curl=yes)
 #AC_ARG_WITH(lucene,
 #	AC_HELP_STRING([--with-lucene],[include lucene support for searching (default=no)]),,with_lucene=no)
+AC_ARG_WITH([regex],
+	AS_HELP_STRING([--with-regex], [Compile using internal copy of regex]))
 
 
 # ---------------------------------------------------------------------
@@ -123,6 +123,17 @@
 	AM_CXXFLAGS="$AM_CXXFLAGS -DEXCLUDEZLIB"
 fi
 
+AS_IF([test "x$with_regex" = "xyes"],
+      [have_systemregex=no],
+      [AC_CHECK_HEADER([regex.h], [have_systemregex=yes], [have_systemregex=no])])
+
+AS_IF([test "x$have_systemregex" = "xyes"],
+      [AC_MSG_NOTICE([Using system regex.h])],
+      [AS_IF([test "x$with_regex" = "xno"],
+      	[AC_MSG_ERROR([System regex forced but not found])],
+	[AC_MSG_NOTICE([Using internal regex.h])])])
+
+AM_CONDITIONAL(SYSTEM_REGEX, test "$have_systemregex")
 
 # ---------------------------------------------------------------------
 # Find CppUnit

Index: examples/cmdline/Makefile.am
===================================================================
--- examples/cmdline/Makefile.am	(revision 2263)
+++ examples/cmdline/Makefile.am	(working copy)
@@ -1,5 +1,5 @@
 AUTOMAKE_OPTIONS = 1.6
-INCLUDES = -I $(top_srcdir)/include
+include $(top_srcdir)/include/Makefile.am
 LDADD = $(top_builddir)/lib/libsword.la
 
 noinst_PROGRAMS = lookup search threaded_search listoptions verserangeparse outplain outrender

Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 2478)
+++ tests/Makefile.am	(working copy)
@@ -1,5 +1,5 @@
 AUTOMAKE_OPTIONS = 1.6
-INCLUDES = -I $(top_srcdir)/include
+include $(top_srcdir)/include/Makefile.am
 LDADD = $(top_builddir)/lib/libsword.la
 
 SUBDIRS = cppunit

Index: lib/Makefile.am
===================================================================
--- lib/Makefile.am	(revision 2478)
+++ lib/Makefile.am	(working copy)
@@ -1,6 +1,5 @@
 AUTOMAKE_OPTIONS = 1.6
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(includedir) 
-AM_CPPFLAGS += -DUSE_AUTOTOOLS -DUNIX -Dunix -D__unix__
+AM_CPPFLAGS = -DUSE_AUTOTOOLS -DUNIX -Dunix -D__unix__
 
 # Global config directory
 globalconfdir := @sysconfdir@

Index: include/config.h
===================================================================
--- include/config.h	(revision 2486)
+++ include/config.h	(working copy)
@@ -59,6 +59,9 @@
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "sword"
 
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
 /* Define to the version of this package. */
 #define PACKAGE_VERSION "1.6.0"
 

Index: include/Makefile.am
===================================================================
--- include/Makefile.am	(revision 2478)
+++ include/Makefile.am	(working copy)
@@ -75,7 +75,8 @@
 pkginclude_HEADERS += $(swincludedir)/rawstr4.h
 pkginclude_HEADERS += $(swincludedir)/rawtext.h
 pkginclude_HEADERS += $(swincludedir)/rawverse.h
-if MINGW
+if SYSTEM_REGEX
+else
 pkginclude_HEADERS += $(swincludedir)/regex.h
 endif
 pkginclude_HEADERS += $(swincludedir)/roman.h

_______________________________________________
sword-devel mailing list: [email protected]
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to