[sword-svn] r1995 - in trunk: . m4

dglassey at www.crosswire.org dglassey at www.crosswire.org
Thu Nov 23 16:03:00 MST 2006


Author: dglassey
Date: 2006-11-23 16:02:59 -0700 (Thu, 23 Nov 2006)
New Revision: 1995

Added:
   trunk/m4/acx_clucene.m4
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/sword.pc.in
Log:
Use acx_clucene.m4 from CLucene contribs to detect CLucene


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-11-20 20:24:06 UTC (rev 1994)
+++ trunk/ChangeLog	2006-11-23 23:02:59 UTC (rev 1995)
@@ -1,6 +1,9 @@
 API ChangeLog	(see the ChangeLog in each 'apps' directory for
 		app specific changes)
 
+23-Nov-2006	Daniel Glassey <dglassey at crosswire.org>
+	Use acx_clucene.m4 from CLucene contribs to detect CLucene
+
 20-Nov-2006	Troy A. Griffitts <scribe at crosswire.org>
 	Moved treekey and genbook tests to utilities
 	Finished first stable version of rewrite of imp2gbs

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2006-11-20 20:24:06 UTC (rev 1994)
+++ trunk/configure.ac	2006-11-23 23:02:59 UTC (rev 1995)
@@ -30,6 +30,8 @@
 
 AC_C_BIGENDIAN
 
+ACX_CLUCENE
+
 # ---------------------------------------------------------------------
 # With options
 # ---------------------------------------------------------------------
@@ -47,8 +49,8 @@
 #	(default=internal)]),,with_installmgr=internal)
 AC_ARG_WITH(curl,
 	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(lucene,
+#	AC_HELP_STRING([--with-lucene],[include lucene support for searching (default=no)]),,with_lucene=no)
 
 
 # ---------------------------------------------------------------------
@@ -203,13 +205,13 @@
 # ---------------------------------------------------------------------
 
 #FIXME: always make lucene available without checking for lib and headers
-if test x$with_lucene = xyes; then
+if test x$with_clucene = xyes; then
    echo "lucene found - lucene searching options available"
-   LUCENE_AM_CFLAGS=""
-   LUCENE_LIBS="-lclucene"
-   AM_CXXFLAGS="$AM_CXXFLAGS -DUSELUCENE"
+#   LUCENE_AM_CFLAGS=""
+#   LUCENE_LIBS="-lclucene"
+   AM_CXXFLAGS="$AM_CXXFLAGS $CLUCENE_CXXFLAGS -DUSELUCENE"
    AM_CFLAGS="$AM_CFLAGS -DUSELUCENE"
-   LIBS="$LIBS $LUCENE_LIBS"
+   LIBS="$LIBS $CLUCENE_LIBS"
 fi
 
 
@@ -234,7 +236,7 @@
 AC_SUBST(CC)
 AC_SUBST(CURL_AM_CFLAGS)
 AC_SUBST(CURL_LIBS)
-AC_SUBST(LUCENE_LIBS)
+#AC_SUBST(LUCENE_LIBS)
 AC_SUBST(ICU_LIBS)
 AC_SUBST(ICU_IOLIBS)
 AC_SUBST(ICU_VER)
@@ -257,7 +259,7 @@
 # ---------------------------------------------------------------------
 AM_CONDITIONAL(MINGW, test x$target_mingw32 = xyes)
 AM_CONDITIONAL(ICU, test x$with_icu = xyes)
-AM_CONDITIONAL(USELUCENE, test x$with_lucene = xyes)
+AM_CONDITIONAL(USELUCENE, test x$with_clucene = xyes)
 AM_CONDITIONAL(ICUSWORD, test x$with_icu = xsword)
 AM_CONDITIONAL(ZLIB, test x$with_zlib = xyes)
 AM_CONDITIONAL(INSTCONF, test x$with_conf = xyes)

Added: trunk/m4/acx_clucene.m4
===================================================================
--- trunk/m4/acx_clucene.m4	                        (rev 0)
+++ trunk/m4/acx_clucene.m4	2006-11-23 23:02:59 UTC (rev 1995)
@@ -0,0 +1,70 @@
+dnl CLucene detection m4
+AC_DEFUN([ACX_CLUCENE], [
+AC_LANG_SAVE
+AC_LANG(C++)
+
+
+# Ask user for path to clucene-core stuff:.
+AC_ARG_WITH(clucene,
+	AC_HELP_STRING([ --with-clucene=<path>],
+		[prefix of CLucene-Core installation. e.g. /usr/local or /usr]),,)
+
+#try some default locations
+if test -z "$with_clucene"; then
+	#use parent of this directory, and some common library paths
+	with_clucene=$(cd "../" && pwd)
+	with_clucene="$with_clucene /usr /usr/local"
+else
+	#use an absolute path
+	with_clucene=$(cd "$with_clucene" && pwd)
+fi
+clucene_set_failed=
+
+AC_MSG_CHECKING([how to include clucene])
+CLUCENE_CXXFLAGS=
+CLUCENE_LIBS=
+for flag in $with_clucene; do
+	if test -z "$clucene_set_failed"; then
+		if test -e "$flag/include/CLucene/StdHeader.h"; then
+			if test -e "$flag/lib/CLucene/clucene-config.h"; then
+				if test -e "$flag/lib/libclucene.la"; then
+					CLUCENE_LIBS="-L$flag/lib -lclucene"
+					CLUCENE_CXXFLAGS="-I$flag/include -I$flag/lib"
+					clucene_set_failed=$flag
+				fi
+			fi
+		fi
+	fi
+
+	if test -z "$clucene_set_failed"; then
+		if test -e "$flag/src/CLucene/StdHeader.h"; then
+			if test -e "$flag/src/libclucene.la"; then
+				CLUCENE_LIBS="-L$flag/src/ -lclucene"
+				CLUCENE_CXXFLAGS="-I$flag/src/"
+				clucene_set_failed=$flag/src/
+			fi
+		fi
+	fi
+done
+
+if test -z "$clucene_set_failed"; then
+	clucene_set_failed="true"
+	AC_MSG_RESULT("failed")
+else
+	AC_MSG_RESULT($clucene_set_failed)
+fi
+
+if test "$clucene_set_failed" = "true"; then
+	AC_MSG_ERROR([You must call configure with the --with-clucene option
+		or you must compile this package from a subdirectory of the clucene core.
+	    This tells configure where to find the CLucene Core library and headers.
+	    e.g. --with-clucene=/usr/local or --with-clucene=/usr])
+fi
+AC_SUBST(CLUCENE_LIBS)
+AC_SUBST(CLUCENE_CXXFLAGS)
+
+
+
+AC_LANG_RESTORE
+])dnl ACX_CLUCENE
+

Modified: trunk/sword.pc.in
===================================================================
--- trunk/sword.pc.in	2006-11-20 20:24:06 UTC (rev 1994)
+++ trunk/sword.pc.in	2006-11-23 23:02:59 UTC (rev 1995)
@@ -7,6 +7,6 @@
 Name: SWORD
 Description: Biblical Text Engine
 Version: @VERSION@
-Libs: -L${libdir} -lsword -lz @CURL_LIBS@ @LUCENE_LIBS@ @ICU_LIBS@ @ICU_IOLIBS@
+Libs: -L${libdir} -lsword -lz @CURL_LIBS@ @CLUCENE_LIBS@ @ICU_LIBS@ @ICU_IOLIBS@
 Cflags: -I${includedir}/sword
 




More information about the sword-cvs mailing list