1 AC_INIT(reinteract, 0.5.9)
3 AC_CONFIG_AUX_DIR(config)
5 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
8 dnl When changing this, make sure to update main.py as well
9 m4_define([min_python_version], [2.6.1])
10 AM_PATH_PYTHON(min_python_version)
12 AC_CONFIG_HEADERS(config.h)
17 AC_DEFINE(MIN_PYTHON_VERSION, ["min_python_version"],
18 [Minimum version of Python we require])
21 if test "x$GCC" = "xyes"; then
23 *[\ \ ]-Wall[\ \ ]*) ;;
24 *) CFLAGS="$CFLAGS -Wall" ;;
27 case " $OBJCFLAGS " in
28 *[\ \ ]-Wall[\ \ ]*) ;;
29 *) OBJCFLAGS="$OBJCFLAGS -Wall" ;;
36 [AC_HELP_STRING([--with-appdir=APPDIR],
37 [On OS X, install Reinteract.app into APPDIR])],
38 [if test x$withval = xyes ; then
39 AC_MSG_ERROR([Directory must be specified as argument to --with-appdir])
40 elif test x$withval = xno ; then
46 AM_CONDITIONAL(INSTALL_APP, test "x$APPDIR" != x)
49 use_python_thunks=false
50 AC_ARG_ENABLE(python-thunks,
51 [AC_HELP_STRING([--enable-python-thunks],
52 [On OS X, lazily locate Python at run-time (default is no)])],
53 [if test "x$enableval" != xno ; then use_python_thunks=true ; fi])
55 if $use_python_thunks ; then
56 AC_DEFINE(USE_PYTHON_THUNKS, 1,
57 [Define to locate Python lazily at runtime])
60 AM_CONDITIONAL(USE_PYTHON_THUNKS, $use_python_thunks)
62 dnl A macro to get a variable from distutils.sysconfig
63 dnl reinteract_GET_CONFIG_VAR(SHELL_NAME, SYSCONFIG_NAME)
65 AC_DEFUN([reinteract_GET_CONFIG_VAR],
66 [$1=`$PYTHON -c "import sys; import distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('$2'))"`])
73 # This will break if someone wants to build the X11 version of reinteract
74 # on OS X. They can just use bin/uninst.py, or they can figure out how
77 PKG_CHECK_MODULES(WRAPPER, [pygobject-2.0 >= 2.16 gtk+-2.0 >= 2.12])
78 JD_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
80 if $use_python_thunks ; then : ; else
81 # Need to figure out how to link against Python at compile time
82 AC_MSG_CHECKING([how to link against Python])
83 reinteract_GET_CONFIG_VAR(python_framework_prefix, PYTHONFRAMEWORKPREFIX)
84 if test x$python_framework_prefix = x ; then
85 reinteract_GET_CONFIG_VAR(python_libdir, LIBDIR)
86 PYTHON_LIBS="-L$python_libdir -lpython$PYTHON_VERSION"
88 PYTHON_LIBS="-F$python_framework_prefix -framework Python"
90 AC_MSG_RESULT($PYTHON_LIBS)
93 # Test to see if what we found actually works
95 CFLAGS="$CFLAGS $PYTHON_INCLUDES"
97 LIBS="$LIBS $PYTHON_LIBS"
98 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],
100 [AC_MSG_ERROR([Linking against Python didn't work; see config.log for details])])
101 CFLAGS="$save_CFLAGS"
106 AM_CONDITIONAL(PLATFORM_OSX, $platform_osx)
108 REINTERACT_PACKAGE_DIR=${pythondir}/$PACKAGE_NAME
109 AC_SUBST(REINTERACT_PACKAGE_DIR)