diff --git a/src/common/autoconfig.h.in b/src/common/autoconfig.h.in index 82bf7f7a..de0ba20d 100644 --- a/src/common/autoconfig.h.in +++ b/src/common/autoconfig.h.in @@ -8,3 +8,13 @@ /* Path to the aspell program */ #undef ASPELL_PROG + +/* Real time monitoring option */ +#undef RCL_MONITOR + +/* Compile the fam interface */ +#undef RCL_USE_FAM + +/* Path to the fam api include file */ +#undef FAM_INCLUDE + diff --git a/src/configure b/src/configure index 013f4b4e..3ad763ca 100755 --- a/src/configure +++ b/src/configure @@ -790,6 +790,10 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-aspell Use aspell spelling package to provide term expansion to other spellings + --with-fam Use File Alteration Monitor for almost real time + indexing of modified files. Give directory where fam + library lives as argument if this is not found by + configure. Some influential environment variables: CC C compiler command @@ -1269,6 +1273,57 @@ _ACEOF fi fi +# Real time monitoring with FAM + +# Check whether --with-fam or --without-fam was given. +if test "${with_fam+set}" = set; then + withval="$with_fam" + withFam=$withval +else + withFam=no +fi; +case $withFam in + no);; + yes) + for dir in /usr/local/lib /usr/lib;do + if test -f $dir/libfam.so ; then famLibDir=$dir;break;fi + done + ;; + *) # The argument should be the path to the fam library + famLibDir=$withFam + ;; +esac + +if test X$withFam != Xno ; then + +cat >>confdefs.h <<\_ACEOF +#define RCL_MONITOR 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define RCL_USE_FAM 1 +_ACEOF + + if test X$famLibDir != X ; then + famBase=`dirname $famLibDir` + if test ! -f $famBase/include/fam.h ; then + { { echo "$as_me:$LINENO: error: fam.h not found in $famBase/include. Specify --with-fam=no to disable fam support" >&5 +echo "$as_me: error: fam.h not found in $famBase/include. Specify --with-fam=no to disable fam support" >&2;} + { (exit 1); exit 1; }; } + fi + LIBFAM="-L$famLibDir -lfam" + +cat >>confdefs.h <<_ACEOF +#define FAM_INCLUDE "$famBase/include/fam.h" +_ACEOF + + else + { { echo "$as_me:$LINENO: error: fam library not found" >&5 +echo "$as_me: error: fam library not found" >&2;} + { (exit 1); exit 1; }; } + fi +fi ##### Look for iconv. We first look for libiconv in /usr/local/lib:/usr/lib ## then in libc (Linux, solaris) @@ -2296,7 +2351,7 @@ LIBXAPIAN=`$XAPIAN_CONFIG --libs` # libstdc++.la in the lib list for i in $LIBXAPIAN ; do case $i in - *stdc++*|-lm|-lgcc_s);; + *stdc++*|-lm|-lgcc_s|-lc);; *) tmpxaplib="$tmpxaplib $i";; esac done @@ -2444,6 +2499,7 @@ QTRECOLL_DATADIR=${m_datadir}/recoll + ac_config_files="$ac_config_files mk/localdefs" ac_config_files="$ac_config_files recollinstall" @@ -3030,12 +3086,13 @@ s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@XAPIAN_CONFIG@,$XAPIAN_CONFIG,;t t s,@QMAKE@,$QMAKE,;t t -s,@LIBXAPIAN@,$LIBXAPIAN,;t t -s,@XAPIANCXXFLAGS@,$XAPIANCXXFLAGS,;t t -s,@LIBICONV@,$LIBICONV,;t t s,@INCICONV@,$INCICONV,;t t -s,@QTRECOLL_DATADIR@,$QTRECOLL_DATADIR,;t t +s,@LIBICONV@,$LIBICONV,;t t +s,@LIBXAPIAN@,$LIBXAPIAN,;t t +s,@LIBFAM@,$LIBFAM,;t t s,@QTGUI@,$QTGUI,;t t +s,@QTRECOLL_DATADIR@,$QTRECOLL_DATADIR,;t t +s,@XAPIANCXXFLAGS@,$XAPIANCXXFLAGS,;t t CEOF _ACEOF diff --git a/src/configure.ac b/src/configure.ac index 92af523a..8b6955ce 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -52,6 +52,38 @@ if test X$withAspell != Xno ; then fi fi +# Real time monitoring with FAM +AC_ARG_WITH(fam, + AC_HELP_STRING([--with-fam], + [Use File Alteration Monitor for almost real time indexing of modified files. Give directory where fam library lives as argument if this is not found by configure.]), + withFam=$withval, withFam=no) +case $withFam in + no);; + yes) + for dir in /usr/local/lib /usr/lib;do + if test -f $dir/libfam.so ; then famLibDir=$dir;break;fi + done + ;; + *) # The argument should be the path to the fam library + famLibDir=$withFam + ;; +esac + +if test X$withFam != Xno ; then + AC_DEFINE(RCL_MONITOR, 1, [Real time monitoring option]) + AC_DEFINE(RCL_USE_FAM, 1, [Compile the fam interface]) + if test X$famLibDir != X ; then + famBase=`dirname $famLibDir` + if test ! -f $famBase/include/fam.h ; then + AC_MSG_ERROR([fam.h not found in $famBase/include. Specify --with-fam=no to disable fam support]) + fi + LIBFAM="-L$famLibDir -lfam" + AC_DEFINE_UNQUOTED(FAM_INCLUDE, "$famBase/include/fam.h", + [Path to the fam api include file]) + else + AC_MSG_ERROR([fam library not found]) + fi +fi ##### Look for iconv. We first look for libiconv in /usr/local/lib:/usr/lib ## then in libc (Linux, solaris) @@ -185,13 +217,14 @@ test "X$m_prefix" = "XNONE" && m_prefix=/usr/local m_datadir=${m_prefix}/share QTRECOLL_DATADIR=${m_datadir}/recoll -AC_SUBST(LIBXAPIAN) -AC_SUBST(XAPIANCXXFLAGS) -AC_SUBST(LIBICONV) AC_SUBST(INCICONV) -AC_SUBST(QTRECOLL_DATADIR) +AC_SUBST(LIBICONV) +AC_SUBST(LIBXAPIAN) +AC_SUBST(LIBFAM) AC_SUBST(QMAKE) AC_SUBST(QTGUI) +AC_SUBST(QTRECOLL_DATADIR) +AC_SUBST(XAPIANCXXFLAGS) AC_CONFIG_FILES(mk/localdefs) AC_CONFIG_FILES(recollinstall) diff --git a/src/index/rclmon.h b/src/index/rclmon.h index 06e33e0d..abdc7c53 100644 --- a/src/index/rclmon.h +++ b/src/index/rclmon.h @@ -1,6 +1,8 @@ #ifndef _RCLMON_H_INCLUDED_ #define _RCLMON_H_INCLUDED_ -/* @(#$Id: rclmon.h,v 1.1 2006-10-16 15:33:08 dockes Exp $ (C) 2006 J.F.Dockes */ +#include "autoconfig.h" +#ifdef RCL_MONITOR +/* @(#$Id: rclmon.h,v 1.2 2006-10-17 14:41:59 dockes Exp $ (C) 2006 J.F.Dockes */ /** * Definitions for the real-time monitoring recoll. * We're interested in file modifications, deletions and renaming. @@ -61,5 +63,5 @@ class RclMonEventQueue { extern RclMonEventQueue rclEQ; extern bool startMonitor(RclConfig *conf, bool nofork); - +#endif // RCL_MONITOR #endif /* _RCLMON_H_INCLUDED_ */ diff --git a/src/index/rclmonprc.cpp b/src/index/rclmonprc.cpp index 0993b145..319f4105 100644 --- a/src/index/rclmonprc.cpp +++ b/src/index/rclmonprc.cpp @@ -1,5 +1,8 @@ +#include "autoconfig.h" + +#ifdef RCL_MONITOR #ifndef lint -static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.1 2006-10-16 15:33:08 dockes Exp $ (C) 2006 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.2 2006-10-17 14:41:59 dockes Exp $ (C) 2006 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -195,3 +198,4 @@ bool startMonitor(RclConfig *conf, bool nofork) LOGERR(("start_monitoring: rclEQ::wait() failed\n")); return false; } +#endif // RCL_MONITOR diff --git a/src/index/rclmonrcv.cpp b/src/index/rclmonrcv.cpp index 601db83c..2bb81d20 100644 --- a/src/index/rclmonrcv.cpp +++ b/src/index/rclmonrcv.cpp @@ -1,5 +1,7 @@ +#include "autoconfig.h" +#ifdef RCL_MONITOR #ifndef lint -static char rcsid[] = "@(#$Id: rclmonrcv.cpp,v 1.1 2006-10-16 15:33:08 dockes Exp $ (C) 2006 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclmonrcv.cpp,v 1.2 2006-10-17 14:41:59 dockes Exp $ (C) 2006 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -282,3 +284,4 @@ static RclMonitor *makeMonitor() { return new RclFAM; } +#endif // RCL_MONITOR diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index b61f5fdb..9f0c2a63 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.23 2006-10-16 15:33:08 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.24 2006-10-17 14:41:59 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -173,8 +173,10 @@ static const char usage [] = "recollindex [-z] \n" " Index everything according to configuration file\n" " -z : reset database before starting indexation\n" +#ifdef RCL_MONITOR "recollindex -m [-D]\n" " Perform real time indexation. Don't become a daemon if -D is set\n" +#endif "recollindex -i \n" " Index individual files. No database purge or stem database updates\n" "recollindex -s \n" @@ -210,10 +212,14 @@ int main(int argc, const char **argv) case 'c': op_flags |= OPT_c; if (argc < 2) Usage(); a_config = *(++argv); argc--; goto b1; +#ifdef RCL_MONITOR case 'D': op_flags |= OPT_D; break; +#endif case 'h': op_flags |= OPT_h; break; case 'i': op_flags |= OPT_i; break; +#ifdef RCL_MONITOR case 'm': op_flags |= OPT_m; break; +#endif case 's': op_flags |= OPT_s; break; #ifdef RCL_USE_ASPELL case 'S': op_flags |= OPT_S; break; @@ -256,6 +262,8 @@ int main(int argc, const char **argv) Usage(); string lang = *argv++; argc--; exit(!createstemdb(config, lang)); + +#ifdef RCL_MONITOR } else if (op_flags & OPT_m) { if (argc != 0) Usage(); @@ -266,6 +274,8 @@ int main(int argc, const char **argv) if (startMonitor(config, (op_flags&OPT_D)!=0)) exit(0); exit(1); +#endif // MONITOR + #ifdef RCL_USE_ASPELL } else if (op_flags & OPT_S) { makeDbIndexer(config); @@ -273,7 +283,8 @@ int main(int argc, const char **argv) exit(!dbindexer->createAspellDict()); else exit(1); -#endif +#endif // ASPELL + } else { confindexer = new ConfIndexer(config, &updater); bool rezero(op_flags & OPT_z);