AC_INIT(vidalia,0.0.11) AC_MSG_NOTICE([Configuring AC_PACKAGE_STRING...]) AC_PROG_CXX PROFILE="Vidalia.pro" AC_LANG(C++) # 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" 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.*|4.2.*) QTDIR=`$QMAKE -query QT_INSTALL_PREFIX` 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. You may need to install Qt development packages, or you can specify an explicit path using --with-qt-dir]) else AC_MSG_RESULT($QTVERSION) fi # Find out where Qt includes live AC_MSG_CHECKING([for Qt includes]) QTDATA=`$QMAKE -query QT_INSTALL_DATA` AC_MSG_RESULT($QTDATA) # 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 # Find chmod AC_PATH_PROG(CHMOD, chmod, chmod) # Save some compiler flags and set the ones we'll need to try some compiling saved_CXXFLAGS="$CXXFLAGS" CXXFLAGS="-I$QTDATA/include -I$QTDATA/include/QtCore -I$QTDATA/include/QtGui" os=`uname -s` if test $os = "Darwin"; then # On Mac, we need to see if Qt is built as a series of frameworks AC_CACHE_CHECK([if Qt is built as a framework], ac_cv_qt_is_framework, [ saved_LDFLAGS="$LDFLAGS" saved_LIBS="$LIBS" LDFLAGS="-F$QTDIR/lib" LIBS="-framework QtCore" AC_TRY_LINK([#include ], [int argc; char **argv; QCoreApplication(argc, argv);], [ac_cv_qt_is_framework=yes], [ac_cv_qt_is_framework=no]) LDFLAGS="$saved_LDFLAGS" LIBS="$saved_LIBS" ]) if test "$ac_cv_qt_is_framework" = yes; then framework=yes fi # Determine whether we are supposed to build a Universal binary AC_ARG_ENABLE(fat_binary, AC_HELP_STRING(--enable-fat-binary, Build a Mac OS X Universal binary)) AC_MSG_CHECKING([if we are building a Universal binary]) if test x$enable_fat_binary = xyes; then AC_MSG_RESULT(yes) QFLAGS="$QFLAGS UNIVERSAL_BINARY=yes" else AC_MSG_RESULT(no) fi fi # 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)) if test x$enable_debug = xno; then BUILDMODE="release" fi if test $BUILDMODE = "debug"; then # Make sure we really do have qt debug libs AC_CACHE_CHECK([for Qt debug libraries], ac_cv_qt_has_debug_libs, [ saved_LDFLAGS="$LDFLAGS" saved_LIBS="$LIBS" if test x$framework = x; then LDFLAGS="-L$QTDIR/lib" LIBS="-lQtCore_debug -framework AppKit -lz -liconv" else LDFLAGS="-L$QTDIR/lib/QtCore.framework" LIBS="$QTDIR/lib/QtCore.framework/QtCore_debug" fi AC_TRY_LINK([#include ], [int argc; char **argv; QCoreApplication app(argc, argv);], [ac_cv_qt_has_debug_libs=yes], [ac_cv_qt_has_debug_libs=no]) LDFLAGS="$saved_LDFLAGS" LIBS="$saved_LIBS" ]) if test "$ac_cv_qt_has_debug_libs" = no; then BUILDMODE="release" fi fi AC_MSG_NOTICE([Building in $BUILDMODE mode]) CXXFLAGS="$saved_CXXFLAGS" QFLAGS="$QFLAGS -config $BUILDMODE" # Clean out an existing Makefile AC_CHECK_FILE(Makefile, [rm Makefile]) # Substitute the version number in places that need it AC_SUBST(VERSION, AC_PACKAGE_VERSION) DOCS="doc" OSXPKG="pkg/osx" RPMPKG="pkg/rpm" AC_OUTPUT([$DOCS/vidalia.1 \ $DOCS/Doxyfile \ $RPMPKG/vidalia.spec \ $OSXPKG/builddmg.sh \ $OSXPKG/buildmpkg.sh \ $OSXPKG/VidaliaBundleDesc.plist \ $OSXPKG/VidaliaBundleInfo.plist \ $OSXPKG/VidaliaDesc.plist \ $OSXPKG/VidaliaInfo.plist]) # Make the mpkg and dmg scripts executable if test x$CHMOD != x; then $CHMOD u+x $OSXPKG/buildmpkg.sh $CHMOD u+x $OSXPKG/builddmg.sh fi # Build the translations AC_MSG_NOTICE([Processing language translations...]) $LRELEASE $PROFILE # Pass the installation prefix to qmake QFLAGS="$QFLAGS PREFIX=$prefix" # Make sure ${prefix} (which can be contained in $mandir) is evaluted # before passing it to qmake MANPAGEDIR=`eval echo $mandir` QFLAGS="$QFLAGS MANDIR=$MANPAGEDIR" # Run qmake to generate the Makefile AC_MSG_NOTICE([Running qmake...]) $QMAKE $QFLAGS $PROFILE