dnl Copyright (c) 1999 - 2001 Phil Thompson <phil@river-bank.demon.co.uk>

dnl configure.in for PyQt.


dnl Initialise.

AC_INIT(qt/qt.py)
AM_INIT_AUTOMAKE(PyQt,2.5)
AM_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR(.)


dnl The programs needed.

AC_PROG_INSTALL
AC_PROG_CXX
AC_PROG_CXXCPP

AM_DISABLE_STATIC
AM_PROG_LIBTOOL


dnl Set the flags.

SIP_SET_COMMONFLAGS
SIP_SET_QTFLAGS
SIP_GET_SIPINSTALLDIR(qt)
SIP_GET_DOCINSTALLDIR(PyQt)


dnl Check the Qt version against what the generated code can handle.

SIP_CHECK_QT_VERSION_RANGE(231,300)


dnl Enable pyuic if we have Qt v2.2 or later.

SIP_CHECK_QT_VERSION(220,SIP_PYUIC_OK)
AM_CONDITIONAL(SIP_PYUIC_ENABLED,test $SIP_PYUIC_OK = yes)


dnl Enable the debugger if we have Qt v2.2 or later.

SIP_CHECK_QT_VERSION(220,SIP_DEBUGGER_OK)
AM_CONDITIONAL(SIP_DEBUGGER_ENABLED,test $SIP_DEBUGGER_OK = yes)


dnl Enable qtgl if we can link a Qt program that calls a Qt OpenGL function.

AC_MSG_CHECKING([for OpenGL support in Qt])

AC_LANG_SAVE
AC_LANG_CPLUSPLUS

save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$SIP_CPPFLAGS"
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$SIP_CXXFLAGS"
save_LIBS="$LIBS"
LIBS="-lqt $SIP_LDXFLAGS"
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$SIP_LDLIBDIRS"

AC_TRY_LINK([#include <qgl.h>],[
	qGLVersion();
], opengl=yes,
   opengl=no)

CPPFLAGS="$save_CPPFLAGS"
CXXFLAGS="$save_CXXFLAGS"
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"

AC_LANG_RESTORE

if test $opengl = "yes"
then
	SIP_OPENGL=yes
	AC_MSG_RESULT([yes])
else
	SIP_OPENGL=
	AC_MSG_RESULT([no - qtgl module will not be built])
fi

AC_SUBST(SIP_OPENGL)

AM_CONDITIONAL(SIP_PYQTGL_ENABLED,test -n "$SIP_OPENGL")


dnl Generate the output.

AC_OUTPUT(Makefile qt/Makefile qtgl/Makefile examples/Makefile doc/Makefile sip/Makefile pyuic/Makefile debugger/Makefile debugger/eric)
