2004-06-30 09:30:41 +00:00
|
|
|
dnl Detect QGIS
|
|
|
|
dnl
|
|
|
|
dnl AQ_CHECK_QGIS
|
2004-04-21 14:14:41 +00:00
|
|
|
|
|
|
|
# Check for QGIS compiler and linker flags
|
2004-04-18 23:44:41 +00:00
|
|
|
# Jens Oberender <j.obi@troja.net> 2004
|
|
|
|
|
|
|
|
AC_DEFUN([AQ_CHECK_QGIS],
|
|
|
|
[
|
|
|
|
dnl
|
|
|
|
dnl Get the cflags and libraries from qgis-config
|
|
|
|
dnl
|
|
|
|
AC_ARG_WITH([qgis],
|
|
|
|
AC_HELP_STRING([--with-qgis=path],
|
2004-04-21 14:14:41 +00:00
|
|
|
[Full path to 'qgis-config', e.g. --with-qgis=/usr/local/bin/qgis-config]),
|
2004-04-18 23:44:41 +00:00
|
|
|
[ac_qgis_config_path=$withval])
|
|
|
|
|
|
|
|
if test x"$ac_qgis_config_path" = x ; then
|
|
|
|
ac_qgis_config_path=`which qgis-config`
|
|
|
|
fi
|
|
|
|
|
2004-04-21 14:14:41 +00:00
|
|
|
ac_qgis_config_path=`dirname $ac_qgis_config_path 2> /dev/null`
|
2004-04-18 23:44:41 +00:00
|
|
|
AC_PATH_PROG(QGIS_CONFIG, qgis-config, no, $ac_qgis_config_path)
|
|
|
|
|
|
|
|
if test x"$QGIS_CONFIG" = xno ; then
|
|
|
|
if test x"$ac_qgis_config_path" = x ; then
|
|
|
|
AC_MSG_ERROR([qgis-config not found in $ac_qgis_config_path! Supply a path with --with-qgis=PATH])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([qgis-config not found! Supply a path with --with-qgis=PATH])
|
|
|
|
fi
|
|
|
|
else
|
2004-04-21 14:14:41 +00:00
|
|
|
AC_MSG_CHECKING([QGIS_CXXFLAGS])
|
|
|
|
QGIS_CXXFLAGS=`$QGIS_CONFIG --cflags`
|
|
|
|
AC_MSG_RESULT($QGIS_CXXFLAGS)
|
2004-04-18 23:44:41 +00:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([QGIS_LDADD])
|
|
|
|
QGIS_LDADD=`$QGIS_CONFIG --libs`
|
|
|
|
AC_MSG_RESULT($QGIS_LDADD)
|
|
|
|
|
|
|
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
|
|
|
ac_save_LDFLAGS="$LDFLAGS"
|
2004-04-21 14:14:41 +00:00
|
|
|
CXXFLAGS="$CXXFLAGS $QGIS_CXXFLAGS $QT_CXXFLAGS"
|
|
|
|
LDFLAGS="$LDFLAGS $QGIS_LDADD $QT_LDADD $GDAL_LDADD"
|
2004-04-18 23:44:41 +00:00
|
|
|
|
|
|
|
case "${host}" in
|
|
|
|
*darwin*)
|
|
|
|
LDFLAGS="$LDFALGS -flat_namespace -undefined suppress"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
AC_LINK_IFELSE([
|
|
|
|
#include <qgsfeature.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
QgsFeature * myQgsFeature = new QgsFeature(1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
], [ac_qgis_linked='yes'], [ac_qgis_linked='no'])
|
|
|
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
|
|
|
LDFLAGS="$ac_save_LDFLAGS"
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if linking with QGIS works])
|
|
|
|
if test x$ac_qgis_linked = xyes ; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2004-04-21 14:14:41 +00:00
|
|
|
AC_SUBST(QGIS_CXXFLAGS)
|
2004-04-18 23:44:41 +00:00
|
|
|
AC_SUBST(QGIS_LDADD)
|
|
|
|
])
|