]> git.lyx.org Git - lyx.git/blobdiff - config/qt4.m4
Math.lyx: fix a package loading logic mistake
[lyx.git] / config / qt4.m4
index 3114341051d374fdd5e64092370f3532e1dbc7c2..58edd85198cedc9db8477b83ec3df636fd2f1d07 100644 (file)
@@ -52,14 +52,28 @@ AC_DEFUN([QT4_CHECK_COMPILE],
 
        if test -z "$qt4_cv_libname"; then
                AC_MSG_RESULT([failed])
-               if test "$FATAL" = 1 ; then
-                       AC_MSG_ERROR([Cannot compile a simple Qt 4 executable. Check you have the right \$QT4DIR !])
-               fi
+               AC_MSG_ERROR([cannot compile a simple Qt 4 executable. Check you have the right \$QT4DIR.])
        else
                AC_MSG_RESULT([$qt4_cv_libname])
        fi
 ])
 
+
+AC_DEFUN([QT4_FIND_TOOL],
+[
+       $1=
+       if test -n "$qt4_cv_bin" ; then
+               AC_PATH_PROGS($1, [$2], [], $qt4_cv_bin)
+       fi
+       if test -z "$$1"; then
+               AC_PATH_PROGS($1, [$2-qt4 $2],[],$PATH)
+       fi
+       if test -z "$$1"; then
+               AC_MSG_ERROR([cannot find $2 binary.])
+       fi
+])
+
+
 dnl get Qt version we're using
 AC_DEFUN([QT4_GET_VERSION],
 [
@@ -92,10 +106,6 @@ AC_DEFUN([QT4_DO_IT_ALL],
        dnl this variable is precious
        AC_ARG_VAR(QT4DIR, [the place where the Qt 4 files are, e.g. /usr/lib/qt4])
 
-       dnl Please leave this alone. I use this file in
-       dnl oprofile.
-       FATAL=0
-
        AC_ARG_WITH(qt4-dir, [AC_HELP_STRING([--with-qt4-dir], [where the root of Qt 4 is installed])],
                [ qt4_cv_dir=`eval echo "$withval"/` ])
 
@@ -140,10 +150,19 @@ AC_DEFUN([QT4_DO_IT_ALL],
        if test "$pkg_failed" != "no" ; then
                QT4_DO_MANUAL_CONFIG
        fi
-       AC_PATH_PROGS(MOC4, [moc-qt4 moc],[],$qt4_cv_bin:$PATH)
-       AC_PATH_PROGS(UIC4, [uic-qt4 uic],[],$qt4_cv_bin:$PATH)
-       AC_PATH_PROGS(RCC4, [rcc-qt4 rcc],[],$qt4_cv_bin:$PATH)
-       AC_CHECK_PROG(bc_found,[bc],[yes],[no],$PATH)
+
+       if test -z "$QT4_LIB"; then
+         AC_MSG_ERROR([cannot find qt4 library.])
+       fi
+
+       dnl Check qt version
+       AS_VERSION_COMPARE($QT4_VERSION, $1,
+       [AC_MSG_ERROR([LyX requires at least version $1 of Qt. Only version $QT4_VERSION has been found.])
+       ])
+
+       QT4_FIND_TOOL([MOC4], [moc])
+       QT4_FIND_TOOL([UIC4], [uic])
+       QT4_FIND_TOOL([RCC4], [rcc])
 ])
 
 AC_DEFUN([QT4_DO_PKG_CONFIG],
@@ -174,9 +193,17 @@ AC_DEFUN([QT4_DO_PKG_CONFIG],
                AC_SUBST(QT4_VERSION)
                QT4_LIB=`$PKG_CONFIG --libs-only-l QtCore QtGui`
                AC_SUBST(QT4_LIB)
-               LIBS="$LIBS `$PKG_CONFIG --libs-only-other QtCore QtGui`"
+               dnl LIBS="$LIBS `$PKG_CONFIG --libs-only-other QtCore QtGui`"
        fi
        PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
+       dnl Actually, the values of QT4_LIB and QT4_CORE_LIB can be completely
+       dnl wrong on OS X, where everything goes to --libs-only-other.
+       dnl As a quick workaround, let us assign better values. A better patch
+       dnl exists for next cycle.
+       QT4_CORE_LIB=$QT4_CORE_LIBS
+       QT4_CORE_LDFLAGS=
+       QT4_LIB=$QT4_FRONTEND_LIBS
+       QT4_LDFLAGS=
 ])
 
 AC_DEFUN([QT4_DO_MANUAL_CONFIG],
@@ -187,7 +214,7 @@ AC_DEFUN([QT4_DO_MANUAL_CONFIG],
        case $have_x in
            yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
                 CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
-            no) LYX_ERROR([Cannot find X window libraries and/or headers.]);;
+            no) AC_MSG_ERROR([cannot find X window libraries and/or headers.]);;
        disable) ;;
        esac