Switch to side-by-side view

--- a/src/configure
+++ b/src/configure
@@ -2189,6 +2189,111 @@
 #echo LIBXAPIAN $LIBXAPIAN
 #echo XAPIANCXXFLAGS $XAPIANCXXFLAGS
 
+#### QT
+# The way qt and its tools (qmake especially) are installed is very
+# different between systems (and maybe qt versions)
+#
+# In general we need QTDIR to be set, because it is used inside the
+# qmake-generated makefiles. But there are exceptions: ie on debian3.1 (at
+# least on the sourceforge compile farm), QTDIR is not needed because qmake
+# generates hard paths (and is installed in /usr/bin). We don't want to
+# force the user to set QTDIR if it is not needed.
+#
+# The logic is then to first look for qmake, possibly using QTDIR if it is
+# set.
+#
+# If QTDIR is not set, we then generate a bogus qt project and check if
+# QTDIR is needed in the Makefile, in which case we complain.
+#
+# QMAKESPEC: on most Linux system, there is a 'default' link inside the
+# mkspecs directory, so that QMAKESPEC is not needed.
+# 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.
+
+if test X$QTDIR != X ; then
+   PATH=$QTDIR/bin:$PATH
+   export PATH
+fi
+echo $PATH
+# Extract the first word of "qmake", so it can be a program name with args.
+set dummy qmake; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_QMAKE+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $QMAKE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_QMAKE="$QMAKE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_QMAKE="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_QMAKE" && ac_cv_path_QMAKE="NOTFOUND"
+  ;;
+esac
+fi
+QMAKE=$ac_cv_path_QMAKE
+
+if test -n "$QMAKE"; then
+  echo "$as_me:$LINENO: result: $QMAKE" >&5
+echo "${ECHO_T}$QMAKE" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test X$QMAKE = XNOTFOUND ; then
+   { { echo "$as_me:$LINENO: error: Cannot find the qmake program. Maybe you need to install
+it and/or set the QTDIR environment variable?" >&5
+echo "$as_me: error: Cannot find the qmake program. Maybe you need to install
+it and/or set the QTDIR environment variable?" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+test -d tmp || mkdir tmp || exit 1
+cd tmp
+cat > bogus.pro <<EOF
+TEMPLATE        = app
+LANGUAGE        = C++
+CONFIG  += qt warn_on thread release debug
+SOURCES += bogus.cpp
+EOF
+echo " " > bogus.cpp
+${QMAKE} bogus.pro
+if test $? != 0 ; then
+   { { echo "$as_me:$LINENO: error: Cannot use qmake to generate a Makefile. Maybe you need to
+check the QTDIR and QMAKESPEC environment variables?" >&5
+echo "$as_me: error: Cannot use qmake to generate a Makefile. Maybe you need to
+check the QTDIR and QMAKESPEC environment variables?" >&2;}
+   { (exit 1); exit 1; }; }
+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
+       { { echo "$as_me:$LINENO: 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" >&5
+echo "$as_me: 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" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+fi
+rm -f bogus.pro bogus.cpp Makefile
+cd ..
+
 
 
 
@@ -2794,6 +2899,7 @@
 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