From f14c468579f538c93faa9d137825282df1f4b61a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 4 Feb 2012 13:49:44 +0100 Subject: [PATCH] Improve --with-qt configure flag. It now accepts `yes' and `no'; consequently, --without-qt works as expected too. Signed-off-by: Benoit Sigoure --- build-aux/autotroll.m4 | 60 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/build-aux/autotroll.m4 b/build-aux/autotroll.m4 index 518e2f0..e0005c4 100644 --- a/build-aux/autotroll.m4 +++ b/build-aux/autotroll.m4 @@ -38,17 +38,23 @@ # DOCUMENTATION # # ------------- # -# Disclaimer: Never tested with anything else than Qt 4.2! Feedback welcome. +# Disclaimer: Tested with Qt 4.2 and 4.8 only. Feedback welcome. # Simply invoke AT_WITH_QT in your configure.ac. AT_WITH_QT can take # arguments which are documented in depth below. The default arguments are # equivalent to the default .pro file generated by qmake. # # Invoking AT_WITH_QT will do the following: -# - Add a --with-qt option to your configure -# - Find qmake, moc and uic and save them in the make variables $(QMAKE), -# $(MOC), $(UIC). -# - Save the path to Qt in $(QT_PATH) -# - Find the flags to use Qt, that is: +# - Add option `--with-qt[=ARG]' to your configure script. Possible +# values for ARG are `yes' (which is the default) and `no' to +# enable and disable Qt support, respectively, or a path to the +# directory which contains the Qt binaries in case you have a +# non-stardard location. +# - Add option `--without-qt', which is equivalent to `--with-qt=no'. +# - If Qt support is enabled, define C preprocessor macro HAVE_QT. +# - Find the programs `qmake', `moc', `uic', and `rcc' and save them +# in the make variables $(QMAKE), $(MOC), $(UIC), and $(RCC). +# - Save the path to Qt binaries in $(QT_PATH). +# - Find the flags necessary to compile and link Qt, that is: # * $(QT_DEFINES): -D's defined by qmake. # * $(QT_CFLAGS): CFLAGS as defined by qmake (C?!) # * $(QT_CXXFLAGS): CXXFLAGS as defined by qmake. @@ -84,7 +90,7 @@ # them automagically for you (using implicit rules defined in autotroll.mk). m4_define([_AUTOTROLL_SERIAL], [m4_translit([ -# serial 6 +# serial 7 ], [# ], [])]) @@ -136,15 +142,29 @@ echo "$as_me: this is autotroll.m4[]_AUTOTROLL_SERIAL" >&AS_MESSAGE_LOG_FD dnl Memo: AC_ARG_WITH(package, help-string, [if-given], [if-not-given]) AC_ARG_WITH([qt], - [AS_HELP_STRING([--with-qt], - [Path to Qt @<:@Look in PATH and /usr/local/Trolltech@:>@])], - [QT_PATH=$withval]) + AS_HELP_STRING([--with-qt@<:@=ARG@:>@], + [Qt support. ARG can be `yes' (the default), `no', + or a path to Qt binaries; if `yes' or empty, + use PATH and some default directories to find Qt binaries])) + + if test x"$with_qt" = x"no"; then + break + else + AC_DEFINE([HAVE_QT],[1], + [Define if the Qt framework is available.]) + fi + + if test x"$with_qt" = x"yes"; then + QT_PATH= + else + QT_PATH=$with_qt + fi # this is a hack to get decent flow control with 'break' for _qt_ignored in once; do # Find Qt. - AC_ARG_VAR([QT_PATH], [Path to the Qt installation]) + AC_ARG_VAR([QT_PATH], [Path to the Qt binaries]) if test -d /usr/local/Trolltech; then # Try to find the latest version. tmp_qt_paths=`echo /usr/local/Trolltech/*/bin | tr ' ' '\n' | sort -nr \ @@ -159,7 +179,7 @@ dnl Memo: AC_ARG_WITH(package, help-string, [if-given], [if-not-given]) AC_PATH_TOOL([QMAKE], [qmake qmake-qt4 qmake-qt3], [missing], [$QT_DIR:$QT_PATH:$PATH:$tmp_qt_paths]) if test x"$QMAKE" = xmissing; then - AX_INSTEAD_IF([$4], [Cannot find qmake in your PATH. Try using --with-qt.]) + AX_INSTEAD_IF([$4], [Cannot find qmake. Try --with-qt=PATH.]) break fi @@ -169,7 +189,7 @@ dnl Memo: AC_ARG_WITH(package, help-string, [if-given], [if-not-given]) [$QT_PATH:$PATH:$tmp_qt_paths]) if test x"$MOC" = xmissing; then AX_INSTEAD_IF([$4], - [Cannot find moc (Meta Object Compiler) in your PATH. Try using --with-qt.]) + [Cannot find moc (Meta Object Compiler). Try --with-qt=PATH.]) break fi @@ -179,7 +199,7 @@ dnl Memo: AC_ARG_WITH(package, help-string, [if-given], [if-not-given]) [$QT_PATH:$PATH:$tmp_qt_paths]) if test x"$UIC" = xmissing; then AX_INSTEAD_IF([$4], -[Cannot find uic (User Interface Compiler) in your PATH. Try using --with-qt.]) +[Cannot find uic (User Interface Compiler). Try --with-qt=PATH.]) break fi @@ -187,8 +207,7 @@ dnl Memo: AC_ARG_WITH(package, help-string, [if-given], [if-not-given]) AC_ARG_VAR([RCC], [Qt Resource Compiler command]) AC_PATH_TOOL([RCC], [rcc], [false], [$QT_PATH:$PATH:$tmp_qt_paths]) if test x"$UIC" = xfalse; then - AC_MSG_WARN([Cannot find rcc (Qt Resource Compiler) in your PATH.\ - Try using --with-qt.]) + AC_MSG_WARN([Cannot find rcc (Qt Resource Compiler). Try --with-qt=PATH.]) fi AC_MSG_CHECKING([whether host operating system is Darwin]) @@ -208,7 +227,7 @@ dnl Memo: AC_ARG_WITH(package, help-string, [if-given], [if-not-given]) fi if test x"$QT_PATH" = x; then AX_INSTEAD_IF([$4], - [Cannot find the path to your Qt install. Use --with-qt.]) + [Cannot find your Qt installation. Try --with-qt=PATH.]) break fi AC_SUBST([QT_PATH]) @@ -506,6 +525,9 @@ instead" >&AS_MESSAGE_LOG_FD # Check (using qmake) that Qt's version "matches" QT_version. # Must be run AFTER AT_WITH_QT. Requires autoconf 2.60. # +# This macro is ignored if Qt support has been disabled (using +# `--with-qt=no' or `--without-qt'). +# # RUN-IF-FAILED is arbitrary code to execute if Qt cannot be found or if any # problem happens. If this argument is omitted, then AC_MSG_ERROR will be # called. RUN-IF-OK is arbitrary code to execute if Qt was successfully found. @@ -514,6 +536,10 @@ AC_DEFUN([AT_REQUIRE_QT_VERSION], # this is a hack to get decent flow control with 'break' for _qt_ignored in once; do + if test x"$with_qt" = x"no"; then + break + fi + if test x"$QMAKE" = x; then AX_INSTEAD_IF([$2], [\$QMAKE is empty.\ -- 2.11.4.GIT