From ef1cfe1aac42f68cc06b6aed72c457003cb3b51e Mon Sep 17 00:00:00 2001 From: dockes Date: Sat, 14 Jan 2006 11:48:03 +0000 Subject: [PATCH] do a better search for qt configuration --- src/Makefile | 7 ++-- src/configure | 106 +++++++++++++++++++++++++++++++++++++++++++++++ src/configure.ac | 57 +++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 5f3f0651..50e4b850 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,10 +1,10 @@ -# @(#$Id: Makefile,v 1.24 2006-01-10 12:58:39 dockes Exp $ (C) 2005 J.F.Dockes +# @(#$Id: Makefile,v 1.25 2006-01-14 11:48:03 dockes Exp $ (C) 2005 J.F.Dockes all: mk/sysconf common/rclversion.h cd lib; ${MAKE} cd bincimapmime; ${MAKE} cd index; ${MAKE} recollindex - cd qtgui; qmake recoll.pro; \ + cd qtgui; PATH=${PATH}:${QTDIR}/bin; export PATH; qmake recoll.pro; \ cat ../mk/sysconf Makefile | \ ${MAKE} -f - @@ -21,7 +21,8 @@ static: cd bincimapmime; ${MAKE} cd index; rm -f recollindex; \ ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic recollindex - cd qtgui; qmake recoll.pro; rm -f recoll; \ + cd qtgui; PATH=${PATH}:${QTDIR}/bin; export PATH; qmake recoll.pro; \ + rm -f recoll; \ cat ../mk/sysconf ../mk/localdefs Makefile | ${MAKE} -f - \ BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic diff --git a/src/configure b/src/configure index 6922101e..835a0965 100755 --- a/src/configure +++ b/src/configure @@ -2189,6 +2189,111 @@ XAPIANCXXFLAGS=`$XAPIAN_CONFIG --cxxflags` #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 < 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,@ac_ct_CC@,$ac_ct_CC,;t t 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 diff --git a/src/configure.ac b/src/configure.ac index 0a4075c4..83940b3b 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -60,6 +60,63 @@ XAPIANCXXFLAGS=`$XAPIAN_CONFIG --cxxflags` #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 +AC_PATH_PROG([QMAKE], [qmake], NOTFOUND) +if test X$QMAKE = XNOTFOUND ; then + AC_MSG_ERROR([Cannot find the qmake program. Maybe you need to install +it and/or set the QTDIR environment variable?]) +fi + +test -d tmp || mkdir tmp || exit 1 +cd tmp +cat > bogus.pro < bogus.cpp +${QMAKE} bogus.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 +rm -f bogus.pro bogus.cpp Makefile +cd .. + AC_SUBST(LIBXAPIAN) AC_SUBST(XAPIANCXXFLAGS) AC_SUBST(LIBICONV)