[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r1303: Make our configure.in smarter at finding Qt if it's not in t (trunk)



Author: edmanm
Date: 2006-10-06 20:12:11 -0400 (Fri, 06 Oct 2006)
New Revision: 1303

Modified:
   trunk/configure.in
Log:
Make our configure.in smarter at finding Qt if it's not in the user's path and
check the version of Qt that we find. Also add --with-qt-dir switch to specify
a particular Qt location.


Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2006-10-06 15:11:31 UTC (rev 1302)
+++ trunk/configure.in	2006-10-07 00:12:11 UTC (rev 1303)
@@ -3,22 +3,72 @@
 AC_PROG_CXX
 PROFILE="Vidalia.pro"
 
-dnl Find qmake
-AC_PATH_PROG(QMAKE, qmake)
-if test x$QMAKE = x; then
-  AC_MSG_ERROR([qmake must be in your path])
+# Find Qt or use one specified to ./configure
+AC_ARG_WITH([qt-dir],
+  AC_HELP_STRING([--with-qt-dir=/path/to/Qt],
+                 [Path to Qt 4.1.0 or later.]),
+  [QTPATHS="$withval"],
+  [ # There can be multiple versions of Qt under these directories
+    QTPATHS="/usr/local/Trolltech /usr/Trolltech /usr"
+    VERLIST=`ls -rm /usr/local/Trolltech/ 2> /dev/null | sed -e s/,//`
+    for ver in $VERLIST; do
+      QTPATHS="$QTPATHS /usr/local/Trolltech/$ver"
+    done
+    VERLIST=`ls -rm /usr/Trolltech/ 2> /dev/null | sed -e s/,//`
+    for ver in $VERLIST; do
+      QTPATHS="$QTPATHS /usr/Trolltech/$ver"
+    done
+  ])
+
+AC_MSG_CHECKING([for Qt >= 4.1.0])
+for path in $QTPATHS; do
+  # "qmake" is sometimes spelled "qmake-qt4"
+  # QMAKE=""
+  if test -x $path/bin/qmake; then
+    QMAKE=$path/bin/qmake
+  else
+    if test -x $path/bin/qmake-qt4; then
+      QMAKE=$path/bin/qmake-qt4
+    fi
+  fi
+  if test x$QMAKE != x; then
+    # Ask qmake if we have the right version
+    QTVERSION=`$QMAKE -query QT_VERSION`
+    case $QTVERSION in
+      4.1.*)
+        QTDIR=$path
+        break
+        ;;
+      *);;
+    esac
+  fi
+done
+if test x$QTDIR = x; then
+  AC_MSG_RESULT([no])
+  AC_MSG_ERROR([Vidalia requires Qt 4.1.0 or greater.])
+else
+ AC_MSG_RESULT($QTVERSION)
 fi
 
-dnl Find lrelease
-AC_PATH_PROG(LRELEASE, lrelease)
-if test x$LRELEASE = x; then
-  AC_MSG_ERROR([lrelease must be in your path])
+# Check for lrelease
+AC_MSG_CHECKING([for lrelease])
+if test -x $QTDIR/bin/lrelease; then
+  LRELEASE=$QTDIR/bin/lrelease
+  AC_MSG_RESULT([$LRELEASE])
+else
+  # lrelease wasn't in our $QTSIR, so check our path
+  AC_PATH_PROG(LRELEASE, lrelease)
+  if test x$LRELEASE = x; then
+    AC_MSG_ERROR([lrelease not found])
+  else
+    AC_MSG_NOTICE([no lrelease found in $QTDIR/bin. Using $LRELEASE.])
+  fi
 fi
 
-dnl Find chmod
+# Find chmod
 AC_PATH_PROG(CHMOD, chmod, chmod)
 
-dnl Determine whether we should link to the debug versions of Qt or not
+# Determine whether we should link to the debug versions of Qt or not
 BUILDMODE="debug"
 AC_ARG_ENABLE(debug,
     AC_HELP_STRING(--disable-debug, Disable debugging support))
@@ -27,10 +77,10 @@
 fi
 AC_MSG_NOTICE([Building in $BUILDMODE mode])
 
-dnl Clean out an existing Makefile
+# Clean out an existing Makefile
 AC_CHECK_FILE(Makefile, [rm Makefile])
 
-dnl Substitute the version number in places that need it
+# Substitute the version number in places that need it
 AC_SUBST(VERSION, AC_PACKAGE_VERSION)
 DOCS="doc"
 OSXBUNDLE="pkg/osx/bundle"
@@ -44,7 +94,7 @@
            $OSXBUNDLE/VidaliaDesc.plist       \
            $OSXBUNDLE/VidaliaInfo.plist])
 
-dnl Make the mpkg and dmg scripts executable
+# Make the mpkg and dmg scripts executable
 if test x$CHMOD != x; then
   $CHMOD u+x $OSXBUNDLE/buildmpkg.sh
 fi
@@ -52,15 +102,15 @@
   $CHMOD u+x $OSXDMG/builddmg.sh
 fi
 
-dnl Build the translations
+# Build the translations
 AC_MSG_NOTICE([Processing language translations...])
 $LRELEASE $PROFILE
 
-dnl Make sure ${prefix} (which can be contained in $mandir) is evaluted 
-dnl before passing it to qmake
+# Make sure ${prefix} (which can be contained in $mandir) is evaluted 
+# before passing it to qmake
 MANPAGEDIR=`eval echo $mandir`
 
-dnl Run qmake to generate the Makefile
+# Run qmake to generate the Makefile
 AC_MSG_NOTICE([Running qmake...])
 $QMAKE -config $BUILDMODE PREFIX=$prefix MANDIR=$MANPAGEDIR $PROFILE