You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdeedu/kig/configure.in.in

272 lines
9.7 KiB

kig_version=0.10.7
kde_save_LIBS=$LIBS
LIBS="$LIBS -lm"
KDE_CHECK_FUNC_EXT(trunc)
LIBS="$kde_save_LIBS"
KDE_LANG_CPLUSPLUS
# this variable is set to true if we need to warn the user that Python
# scripting support has been disabled due to missing headers or libs
# or whatever.. It's not set if the user explicitly disabled python
# scripting ( "./configure --disable-kig-python-scripting" ). We
# complain about this at the end of the ./configure script. Check out
# configure.in.bot for the code..
kig_warn_about_disabling_python="no"
# this var is set to yes if we want to compile python scripting, and to
# no otherwise
kig_enable_python_scripting="yes"
# this var is set to no if we want to disable support for compressed files
# (for compatibility reasons with kde 3.1)
kig_enable_compressed_files="yes"
AC_DEFUN([KIG_PYTHON_NOT_FOUND], [
AC_MSG_WARN(
[[Kig needs the Python and Boost.Python libraries and their headers \
installed for its Python scripting support. One of both was not \
found, or the versions were incompatible, and Python scripting will be disabled.]] );
kig_warn_about_disabling_python="yes"
kig_enable_python_scripting="no" ] )
AC_ARG_ENABLE( kig-python-scripting,
[ --disable-kig-python-scripting Disable Kig Python Scripting support],
[ kig_enable_python_scripting=$enableval ],
[ kig_enable_python_scripting=yes] )
AC_ARG_ENABLE( kig-compressed-files,
[ --disable-kig-compressed-files Disable Kig Compressed Files support],
[ kig_enable_compressed_files=$enableval ],
[ kig_enable_compressed_files=yes] )
dnl domi: we use some macro's by Ben Burton from the Regina program,
dnl to check for the availability of a good python+boost.python
dnl combination. They are included here, the end is marked at the
dnl bottom. I have changed it only by removing some macro's, and by
dnl making the other call KIG_PYTHON_NOT_FOUND instead of
dnl REGINA_DO_NOT_COMPILE, and REGINA_WARN_*.
dnl
dnl Regina - A Normal Surface Theory Calculator
dnl Configure Script Macros
dnl
dnl Copyright (c) 2002-2003, Ben Burton
dnl For further details contact Ben Burton (bab@debian.org).
dnl
dnl This file is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
dnl published by the Free Software Foundation; either version 2 of the
dnl License, or (at your option) any later version.
dnl
dnl This file is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public
dnl License along with this program; if not, write to the Free
dnl Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
dnl MA 02110-1301, USA.
dnl
dnl Note that this copyright notice applies only to macros beginning
dnl with REGINA_. Other macros found in acinclude.m4 have been taken
dnl from external sources; these macros are stored in separate files
dnl in the admin/ subdirectory and copyright notices can be found in
dnl these separate files (and in the comments provided with the macros
dnl themselves).
dnl
dnl -----------------------------------------------------------------
dnl
dnl Macros written for Regina
dnl
dnl -----------------------------------------------------------------
dnl
dnl REGINA_LIB_BOOST_PYTHON(TARGET-LIST, REQUIRED-BY)
dnl
dnl Checks for a usable boost.python installation.
dnl Issues a warning and adds <TARGET-LIST> (which may consist of
dnl several targets) to $DO_NOT_COMPILE if boost.python is missing.
dnl
dnl AC_SUBST()s the following variables:
dnl
dnl BOOST_PYTHON_INCLUDES: The compiler flags required for
dnl building against boost.python,
dnl including flags for building against
dnl python itself.
dnl BOOST_PYTHON_LIBS: The linker flags required for building
dnl against boost.python.
dnl PYTHON_LIBS: The linker flags required for building against
dnl python itself.
dnl
dnl AC_DEFINE()s the following variables:
dnl
dnl HAVE_BOOST_PYTHON: Defined as 1 if we have a usable boost.python
dnl installation, or remains undefined otherwise.
dnl
dnl Example: REGINA_LIB_BOOST_PYTHON(PYTHON, [the Python interface])
dnl
AC_DEFUN([REGINA_LIB_BOOST_PYTHON], [
AC_LANG_PUSH(C++)
KDE_CHECK_HEADERS([boost/shared_ptr.hpp], [
__regina_py_save_cxxflags="$CXXFLAGS"
__regina_py_save_ldflags="$LDFLAGS"
__regina_py_save_libs="$LIBS"
__regina_py_ok=0
for pyver in python python2.7 python2.6 python2.5 python2.4 python2.3 python2.2; do
for incdir in "/usr/include/$pyver" "/usr/local/include/$pyver" \
"/usr/$pyver/include" "/usr/local/$pyver/include" \
"$prefix/include/$pyver" "$prefix/$pyver/include"; do
CXXFLAGS="$__regina_py_save_cxxflags -I$incdir"
LDFLAGS="$__regina_py_save_ldflags -shared"
if test -z "$qt_libraries"; then
LDFLAGS="$LDFLAGS"
else
LDFLAGS="$LDFLAGS -L$qt_libraries"
fi
LDFLAGS="$LDFLAGS -ltqt"
# Check for python includes.
AC_TRY_COMPILE([
#include <Python.h>
], [
PyObject obj;
], [
# Check for compatibility with boost.python.
AC_MSG_CHECKING([for boost.python with $incdir/Python.h])
AC_TRY_COMPILE([
#include <boost/python.hpp>
const char* greet() { return "Hello world!"; }
BOOST_PYTHON_MODULE(hello) { boost::python::def("greet", greet); }
], [
/* No main body. */
], [
AC_MSG_RESULT([yes])
# Check for -lpython.
for pylib in "$pyver" python python2.7 python2.6 python2.3 python2.2; do
for pylibdir in "/usr/lib" "/usr/local/lib" "/usr/lib/$pyver/config" \
"/usr/local/lib/$pyver/config"; do
for extralibs in "" "-lpthread -lm -lutil -ldl"; do
AC_MSG_CHECKING([for $pylibdir/lib$pylib and $extralibs with $incdir/Python.h])
LDFLAGS="$__regina_py_save_ldflags -L$pylibdir"
if test -z "$qt_libraries"; then
LDFLAGS="$LDFLAGS"
else
LDFLAGS="$LDFLAGS -L$qt_libraries"
fi
LDFLAGS="$LDFLAGS -ltqt"
LIBS="-l$pylib $extralibs"
PYVERSHORT=${pyver#python}
PYVERSUFFIX=py${PYVERSHORT%.*}${PYVERSHORT#*.}
AC_TRY_LINK([
#include <Python.h>
], [
Py_Initialize(); Py_Finalize();
], [
AC_MSG_RESULT([yes])
for bplib in "-lboost_python-mt-$PYVERSUFFIX" "-lboost_python-mt" "-lboost_python-gcc-mt-1_32" "-lboost_python-gcc-mt-1_31" "-lboost_python-gcc-mt" "-lboost_python-$PYVERSUFFIX" "-lboost_python"; do
AC_MSG_CHECKING([compilation of a boost.python program with $bplib])
LDFLAGS="$__regina_py_save_ldflags -L$pylibdir"
if test -z "$qt_libraries"; then
LDFLAGS="$LDFLAGS"
else
LDFLAGS="$LDFLAGS -L$qt_libraries"
fi
LDFLAGS="$LDFLAGS -ltqt"
LIBS="-l$pylib $bplib $extralibs"
AC_TRY_LINK([
#include <boost/python.hpp>
const char* greet() { return "Hello world!"; }
BOOST_PYTHON_MODULE(hello) { boost::python::def("greet", greet); }
], [
/* No main body. */
], [
AC_MSG_RESULT([yes])
# And we're done!
BOOST_PYTHON_INCLUDES="-I$incdir"
BOOST_PYTHON_LIBS="$bplib"
PYTHON_LIBS="-l$pylib $extralibs"
PYTHON_LDFLAGS="-L$pylibdir"
__regina_py_ok=1
], [
AC_MSG_RESULT([no])
])
if test "$__regina_py_ok" = "1"; then break; fi
done
], [
AC_MSG_RESULT([no])
])
if test "$__regina_py_ok" = "1"; then break; fi
done
if test "$__regina_py_ok" = "1"; then break; fi
done
if test "$__regina_py_ok" = "1"; then break; fi
done
], [
AC_MSG_RESULT([no])
])
])
if test "$__regina_py_ok" = "1"; then break; fi
done
if test "$__regina_py_ok" = "1"; then break; fi
done
CXXFLAGS="$__regina_py_save_cxxflags"
LDFLAGS="$__regina_py_save_ldflags"
LIBS="$__regina_py_save_libs"
if test "$__regina_py_ok" = "1"; then
AC_DEFINE(HAVE_BOOST_PYTHON, 1,
[Define to 1 if you have a usable boost.python installation.])
else
BOOST_PYTHON_INCLUDES=
BOOST_PYTHON_LIBS=
KIG_PYTHON_NOT_FOUND
fi
], [
KIG_PYTHON_NOT_FOUND
])
AC_LANG_POP(C++)
AC_SUBST(BOOST_PYTHON_INCLUDES)
AC_SUBST(BOOST_PYTHON_LIBS)
AC_SUBST(PYTHON_LDFLAGS)
AC_SUBST(PYTHON_LIBS)
])
dnl This is the end of the macro's copied from Ben Burton's Regina
dnl program.
if test "x$kig_enable_python_scripting" != xno; then
kig_enable_python_scripting="yes" # either yes or no..
kig_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-fno-exceptions//g'`
REGINA_LIB_BOOST_PYTHON( PYTHON, Kig Python Scripting )
CXXFLAGS="$kig_save_CXXFLAGS"
fi
if test "x$kig_enable_python_scripting" != xno; then
AC_DEFINE( KIG_ENABLE_PYTHON_SCRIPTING, 1, [Defined if Kig Python scripting is enabled] )
fi
AM_CONDITIONAL(KIG_COMPILE_PYTHON_SCRIPTING, test x$kig_enable_python_scripting != xno)
if test "x$kig_enable_compressed_files" = xno; then
CXXFLAGS="$CXXFLAGS -DKIG_NO_COMPRESSED_FILES"
fi
AC_SUBST( KIGVERSION, $kig_version )
AC_DEFINE_UNQUOTED( KIGVERSION, "$kig_version", [The current Kig version as a string] )
KDE_CHECK_HEADERS([ieeefp.h])
# apparently the KDE build system wants to see "dnl AC_OUTPUT( ... )",
# not a normal AC_OUTPUT
dnl AC_OUTPUT( kig/kig.lsm )
dnl AC_OUTPUT( kig/README )
dnl AC_OUTPUT( kig/package-kig.sh )
dnl AC_OUTPUT( kig/VERSION )