diff --git a/src/Makefile.in b/src/Makefile.in index 1cd005c1..e0f20d18 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -14,7 +14,8 @@ QTGUI = @QTGUI@ all: mk/sysconf common/rclversion.h cd lib; ${MAKE} cd index; ${MAKE} recollindex - cd $(QTGUI); ${QMAKE} recoll.pro; ${MAKE} depth=.. + @NOQTMAKE@cd $(QTGUI); ${QMAKE} recoll.pro; ${MAKE} depth=.. + @NOCMDLINE@ cd query; ${MAKE} recollq mk/sysconf: @echo "You need to run configure first" ; exit 1 @@ -27,9 +28,9 @@ static: mk/sysconf common/rclversion.h cd lib; ${MAKE} cd index; rm -f recollindex; \ ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic recollindex - cd $(QTGUI); $(QMAKE) recoll.pro; \ - rm -f recoll; \ - ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic depth=.. + @NOQTMAKE@cd $(QTGUI); $(QMAKE) recoll.pro; \ + @NOQTMAKE@ rm -f recoll; \ + @NOQTMAKE@ ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic depth=.. clean: -cd common; ${MAKE} clean @@ -39,8 +40,9 @@ clean: -cd query; ${MAKE} clean -cd utils; ${MAKE} clean #cd doc/user; ${MAKE} clean - @-cd qtgui; ${MAKE} clean - @-cd qt4gui; ${MAKE} clean + @NOQTMAKE@@-cd qtgui; ${MAKE} clean + @NOQTMAKE@@-cd qt4gui; ${MAKE} clean + @NOCMDLINE@ cd query; ${MAKE} clean rm -f qtgui/Makefile qtgui/confgui/Makefile qtgui/recoll rm -f qt4gui/Makefile qt4gui/preview/Makefile qt4gui/recoll rm -f common/rclversion.h @@ -58,7 +60,7 @@ distclean: clean wasabi/Makefile wasabi/client/Makefile wasabi/server/Makefile rm -f index/alldeps lib/alldeps query/alldeps rm -rf autom4te.cache - (cd qt4gui; make -f uifrom3 distclean) + @NOQTMAKE@(cd qt4gui; make -f uifrom3 distclean) maintainer-clean: distclean rm -f doc/user/*.html* doc/user/*.txt doc/user/HTML.manifest diff --git a/src/common/autoconfig.h.in b/src/common/autoconfig.h.in index cb7ef19a..00b8109d 100644 --- a/src/common/autoconfig.h.in +++ b/src/common/autoconfig.h.in @@ -43,3 +43,6 @@ /* Use file extended attributes */ #undef RCL_USE_XATTR + +/* No X11 */ +#undef WITHOUT_X11 diff --git a/src/configure.ac b/src/configure.ac index ea5eb885..9b7d3d69 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -253,77 +253,100 @@ XAPIANCXXFLAGS=`$XAPIAN_CONFIG --cxxflags` # If QMAKESPEC is not set and needed, the qmake test at the previous test # will have failed, and we tell the user to check his environment. # +AC_ARG_WITH(gui, + AC_HELP_STRING([--without-gui], + [Disable the QT user interface and auxiliary x11 uses.]), + withQT=$withval, withQT="yes") -if test X$QTDIR != X ; then - PATH=$PATH:$QTDIR/bin - export PATH -fi - -if test X$QMAKE = X ; then - QMAKE=qmake -fi - -AC_PATH_PROG([QMAKEPATH], $QMAKE, NOTFOUND) -if test X$QMAKEPATH = XNOTFOUND ; then - AC_MSG_ERROR([Cannot find the qmake program. Maybe you need to install -qt development files and tools and/or set the QTDIR environment variable?]) -fi -QMAKE=$QMAKEPATH - -# MAC OS X: we don't support this (the native search tool is more than -# good enough), but we make things work just enough so that the program can -# be compiled and roughly installed (not as a .app, but to /usr/local), -# basically to enable using a Macbook for development -if test X$sys = XDarwin ; then - # The default is xcode - QMAKE="${QMAKE} -spec macx-g++" -fi - -# Discriminate qt3/4. Qt3 qmake prints its version on stderr but we don't -# depend on this. We try to detect the qt 4 version string instead. -qmakevers="`${QMAKE} --version 2>&1`" -#echo "qmake version: $qmakevers" -v4=`expr "$qmakevers" : '.*Qt[ ][ ]*version[ ][ ]*4.*'` -if test X$v4 = X0 ; then - AC_MSG_NOTICE([using qt version 3 user interface]) - QTGUI=qtgui +if test "$withQT" != "yes" ; then + AC_DEFINE(WIHOUT_X11) + NOQTMAKE="#" + NOCMDLINE="" else - AC_MSG_NOTICE([using qt version 4 user interface]) - QTGUI=qt4gui - AC_PATH_PROG([UIC3], [uic3], NOTFOUND) - if test X$UIC3 = XNOTFOUND ; then - AC_MSG_ERROR([Cannot find the uic3 program. Maybe you need to add - the qt3 compatibility libraries and tools to your qt4 installation ?]) + NOQTMAKE="" + NOCMDLINE="#" + + if test X$QTDIR != X ; then + PATH=$PATH:$QTDIR/bin + export PATH fi + + if test X$QMAKE = X ; then + QMAKE=qmake + fi + + AC_PATH_PROG([QMAKEPATH], $QMAKE, NOTFOUND) + if test X$QMAKEPATH = XNOTFOUND ; then + AC_MSG_ERROR([Cannot find the qmake program. Maybe you need to install + qt development files and tools and/or set the QTDIR environment variable?]) + fi + QMAKE=$QMAKEPATH + + # MAC OS X: we don't support this (the native search tool is more than + # good enough), but we make things work just enough so that the program can + # be compiled and roughly installed (not as a .app, but to /usr/local), + # basically to enable using a Macbook for development + if test X$sys = XDarwin ; then + # The default is xcode + QMAKE="${QMAKE} -spec macx-g++" + fi + + # Discriminate qt3/4. Qt3 qmake prints its version on stderr but we don't + # depend on this. We try to detect the qt 4 version string instead. + qmakevers="`${QMAKE} --version 2>&1`" + #echo "qmake version: $qmakevers" + v4=`expr "$qmakevers" : '.*Qt[ ][ ]*version[ ][ ]*4.*'` + if test X$v4 = X0 ; then + AC_MSG_NOTICE([using qt version 3 user interface]) + QTGUI=qtgui + else + AC_MSG_NOTICE([using qt version 4 user interface]) + QTGUI=qt4gui + AC_PATH_PROG([UIC3], [uic3], NOTFOUND) + if test X$UIC3 = XNOTFOUND ; then + AC_MSG_ERROR([Cannot find the uic3 program. Maybe you need to add + the qt3 compatibility libraries and tools to your qt4 installation ?]) + fi + fi + + cd $QTGUI + # We just want a .pro file: no problem with unsubstituted variables at + # this point. + test -f uifrom3 && make -f uifrom3 + test -f recoll.pro && chmod +w recoll.pro + cp recoll.pro.in recoll.pro + #echo QMAKE ${QMAKE} + ${QMAKE} recoll.pro + if test $? != 0 ; then + AC_MSG_ERROR([Cannot use qmake to generate a Makefile. Maybe you need to + check the QTDIR and QMAKESPEC environment variables?]) + fi + # is QTDIR set and do we actually need it ? + if test X$QTDIR = X ; then + QTDIRNEEDED=`grep INCPATH Makefile | grep = | grep QTDIR` + if test "X$QTDIRNEEDED" != "X" ; then + AC_MSG_ERROR([You need to set the QTDIR variable to point to the QT + installation. If there is no default mkspecs, you should also set QMAKESPEC]) + fi + fi + cd .. + + AC_CONFIG_FILES($QTGUI/recoll.pro) + ##################### End QT detection fi -cd $QTGUI -# We just want a .pro file: no problem with unsubstituted variables at -# this point. -test -f uifrom3 && make -f uifrom3 -test -f recoll.pro && chmod +w recoll.pro -cp recoll.pro.in recoll.pro -#echo QMAKE ${QMAKE} -${QMAKE} recoll.pro -if test $? != 0 ; then - AC_MSG_ERROR([Cannot use qmake to generate a Makefile. Maybe you need to -check the QTDIR and QMAKESPEC environment variables?]) -fi -# is QTDIR set and do we actually need it ? -if test X$QTDIR = X ; then - QTDIRNEEDED=`grep INCPATH Makefile | grep = | grep QTDIR` - if test "X$QTDIRNEEDED" != "X" ; then - AC_MSG_ERROR([You need to set the QTDIR variable to point to the QT -installation. If there is no default mkspecs, you should also set QMAKESPEC]) - fi -fi -cd .. - -##################### End QT detection ### X11: this is needed for the session monitoring code (in recollindex -m) -AC_PATH_XTRA -#echo X_CFLAGS "'$X_CFLAGS'" X_PRE_LIBS "'$X_PRE_LIBS'" X_LIBS "'$X_LIBS'" X_EXTRA_LIBS "'$X_EXTRA_LIBS'" +# We disable it if without-gui has been specified, but it could be separated +if test "$withQT" = "yes" ; then + AC_PATH_XTRA + X_LIBX11=-lX11 +else + X_LIBX11="" +fi +#echo X_CFLAGS "'$X_CFLAGS'" X_PRE_LIBS "'$X_PRE_LIBS'" X_LIBS \ +# "'$X_LIBS'" X_LIBX11 "'$X_LIBX11'" X_EXTRA_LIBS "'$X_EXTRA_LIBS'" + # We have to expand prefix in here, couldn't find a way to do it inside # the qt gui .pro file or Makefile. This just means that you can't change @@ -337,6 +360,7 @@ QTRECOLL_DATADIR=${m_datadir}/recoll AC_SUBST(X_CFLAGS) AC_SUBST(X_PRE_LIBS) AC_SUBST(X_LIBS) +AC_SUBST(X_LIBX11) AC_SUBST(X_EXTRA_LIBS) AC_SUBST(INCICONV) AC_SUBST(LIBICONV) @@ -347,11 +371,13 @@ AC_SUBST(QTGUI) AC_SUBST(QTRECOLL_DATADIR) AC_SUBST(XAPIANCXXFLAGS) AC_SUBST(HAVE_MKDTEMP) +AC_SUBST(NOQTMAKE) +AC_SUBST(NOCMDLINE) + AC_CONFIG_FILES(mk/localdefs) AC_CONFIG_FILES(recollinstall) AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(sampleconf/recoll.conf) -AC_CONFIG_FILES($QTGUI/recoll.pro) for d in bincimapmime index lib query do diff --git a/src/index/Makefile b/src/index/Makefile index 46d3b4f1..5e7998e6 100644 --- a/src/index/Makefile +++ b/src/index/Makefile @@ -11,7 +11,7 @@ recollindex : $(RECOLLINDEX_OBJS) $(CXX) $(ALL_CXXFLAGS) -o recollindex $(RECOLLINDEX_OBJS) \ $(BSTATIC) $(LIBXAPIAN) $(LIBICONV) $(BDYNAMIC) \ $(LIBFAM) \ - $(X_LIBS) $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS) \ + $(X_LIBS) $(X_PRE_LIBS) $(X_LIBX11) $(X_EXTRA_LIBS) \ $(LIBSYS) recollindex.o : recollindex.cpp $(CXX) $(ALL_CXXFLAGS) -c -o recollindex.o $< diff --git a/src/mk/localdefs.in b/src/mk/localdefs.in index 893cbfcc..a99c28ed 100644 --- a/src/mk/localdefs.in +++ b/src/mk/localdefs.in @@ -14,6 +14,7 @@ X_CFLAGS=@X_CFLAGS@ X_PRE_LIBS=@X_PRE_LIBS@ X_LIBS=@X_LIBS@ X_EXTRA_LIBS=@X_EXTRA_LIBS@ +X_LIBX11=@X_LIBX11@ prefix = @prefix@ exec_prefix = @exec_prefix@ diff --git a/src/utils/x11mon.cpp b/src/utils/x11mon.cpp index 9244eeb6..4a69c92e 100644 --- a/src/utils/x11mon.cpp +++ b/src/utils/x11mon.cpp @@ -3,7 +3,8 @@ static char rcsid[] = "@(#$Id: x11mon.cpp,v 1.1 2006-12-23 12:23:15 dockes Exp $ (C) 2006 J.F.Dockes"; #endif // Poll state of X11 connectibility (to detect end of user session). - +#include "autoconfig.h" +#ifndef WITHOUT_X11 #include #include #include @@ -58,7 +59,12 @@ bool x11IsAlive() XSynchronize(m_display, sync); return m_ok; } - +#else +bool x11IsAlive() +{ + return true; +} +#endif /* WITHOUT_X11 */ #else