From 6ed05bf30690ff1841442b6330d2a81ca26e82d6 Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine <Claus-Justus.Heine@IANS.Uni-Stuttgart.DE> Date: Wed, 18 Jun 2003 11:42:11 +0000 Subject: [PATCH] Make QGL optional. --- m4/check-qt.m4 | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/m4/check-qt.m4 b/m4/check-qt.m4 index d084281..6b50c07 100644 --- a/m4/check-qt.m4 +++ b/m4/check-qt.m4 @@ -1,3 +1,7 @@ +dnl +dnl $1 == required: bail out on error +dnl $1 == optional: just issue a warning. +dnl AC_DEFUN([ALBERT_CHECK_QT], [AC_ARG_WITH([qtdir], [ --with-qtdir=QTDIR Attempt to use the QT toolkit located in QTDIR. @@ -6,7 +10,7 @@ AC_DEFUN([ALBERT_CHECK_QT], yes) ;; no) - AC_MSG_ERROR([Nope, we _need_ QT]) + test "$1" = required && AC_MSG_ERROR([Nope, we _need_ QT]) ;; *) QTDIR=${withval} @@ -21,7 +25,7 @@ done ]) AC_LANG_PUSH([C++]) ALBERT_CHECK_PACKAGE(Qt, qt-mt, ${QTDIR}/lib, ${X_LIBS} -lX11, - qgl.h, ${QTDIR}/include, required) + qgl.h, ${QTDIR}/include, $1) AC_LANG_POP dnl dnl check for QGLWidget @@ -37,7 +41,11 @@ AC_CACHE_CHECK([whether class QGLWidget compiles and links], #endif]], [[QGLWidget qgl;]])], [ac_cv_qglwidget_links=yes], - [AC_MSG_FAILURE([Unable to compile and link a "QGLWidget"]) + [if test "$1" = required; then + AC_MSG_FAILURE([Unable to compile and link a "QGLWidget"]) + else + AC_MSG_RESULT([Unable to compile and link a "QGLWidget"]) + fi ]) AC_LANG_POP LDFLAGS="${ac_save_LDFLAGS}" @@ -51,13 +59,19 @@ AC_ARG_WITH([moc], yes) ;; no) - AC_MSG_ERROR([Nope, we need moc]) + test "$1" = required && AC_MSG_ERROR([Nope, we need moc]) ;; *) MOCPATH=${withval} ;; esac], [MOCPATH=${QTDIR}/bin]) -AC_PATH_PROG([MOC], moc, , [$MOCPATH:$QTDIR/bin:$PATH]) +AC_PATH_PROG([MOC], moc, + [test "$1" == required && AC_MSG_ERROR(["moc" not found])], + [$MOCPATH:$QTDIR/bin:$PATH]) +if test -n "$Qt_LIB" -a -n "$MOC" -a "$ac_cv_qglwidget_links" = yes; then + AC_DEFINE([HAVE_QGL_WIDGET], 1, + [Define to "1" if Qt's QGLWidget is present and compiles]) +fi ]) -- GitLab