+# -------------------------------------------
+# bat (default off)
+# -------------------------------------------
+AC_ARG_ENABLE(bat,
+ [ --enable-bat enable build of bat Qt4 GUI [disabled]],
+ [if test x$enableval = xyes; then
+ AC_DEFINE(HAVE_BAT, 1, [Set if Bacula bat Qt4 GUI support enabled])
+ support_bat=yes
+ fi])
+
+BAT_DIR=
+if test x$support_bat = xyes; then
+ abc=`$PKGCONFIG --atleast-version=4.2 QtGui`
+ pkg=$?
+ if test $pkg = 0; then
+ BAT_DIR=src/qt-console
+ else
+ AC_MSG_ERROR(Unable to find Qt4 installation needed by bat)
+ fi
+fi
+
+#
+# If bat is enabled, we need the qwt library
+got_qwt=no
+QWT_INC=
+QWT_LDFLAGS=
+if test x$support_bat = xyes; then
+ AC_MSG_CHECKING(for qwt support)
+ AC_ARG_WITH(qwt,
+ [ --with-qwt@<:@=DIR@:>@ specify qwt library directory],
+ [
+ case "$with_qwt" in
+ no)
+ ;;
+ yes|*)
+ if test -f ${with_qwt}/include/qwt.h; then
+ QWT_INC="${with_qwt}/include"
+ QWT_LDFLAGS="-L${with_qwt}/lib"
+ fi
+ ;;
+ esac
+ ]
+ )
+#
+# Search in standard places, or --with-qwt not specified
+#
+ if test x$QWT_INC = x; then
+ for root in /usr /usr/local; do
+ for ver in qwt qwt5 qwt-qt4; do
+ if test -f ${root}/include/${ver}/qwt.h; then
+ QWT_INC="${root}/include/${ver}"
+ if test -d ${root}/lib64/; then
+ QWT_LDFLAGS="-L${root}/lib64"
+ else
+ QWT_LDFLAGS="-L${root}/lib"
+ fi
+ got_qwt=yes
+ break;
+ fi
+ done
+ done
+ fi
+ if test x$QWT_INC = x; then
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(Unable to find qwt package needed by bat)
+ BAT_DIR=
+ support_bat=no
+ else
+ AC_MSG_RESULT(yes)
+ fi
+fi
+
+AC_SUBST(BAT_DIR)
+AC_SUBST(QWT_INC)
+AC_SUBST(QWT_LDFLAGS)
+