4 # The version of python used is determined by the executable pointed to by
5 # the PYTHON environment variable. For instance if your system installs
6 # Python 3 as python3 to configure to compile pygobject under Python 3
8 # $> PYTHON=python3 ./configure
9 m4_define(python_min_ver, 2.5.2)
10 m4_define(python3_min_ver, 3.1)
12 dnl the pygobject version number
13 m4_define(pygobject_major_version, 2)
14 m4_define(pygobject_minor_version, 28)
15 m4_define(pygobject_micro_version, 7)
16 m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
18 dnl versions of packages we require ...
19 m4_define(introspection_required_version, 0.10.2)
20 m4_define(pycairo_required_version, 1.2.0)
21 m4_define(glib_required_version, 2.24.0)
22 m4_define(gio_required_version, 2.24.0)
23 m4_define(giounix_required_version, 2.22.4)
25 AC_INIT(pygobject, pygobject_version,
26 [http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject])
27 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .")
28 AC_CONFIG_MACRO_DIR([m4])
29 AC_CONFIG_SRCDIR([gobject/gobjectmodule.c])
31 AC_DEFINE(PYGOBJECT_MAJOR_VERSION, pygobject_major_version, [pygobject major version])
32 AC_SUBST(PYGOBJECT_MAJOR_VERSION, pygobject_major_version)
33 AC_DEFINE(PYGOBJECT_MINOR_VERSION, pygobject_minor_version, [pygobject minor version])
34 AC_SUBST(PYGOBJECT_MINOR_VERSION, pygobject_minor_version)
35 AC_DEFINE(PYGOBJECT_MICRO_VERSION, pygobject_micro_version, [pygobject micro version])
36 AC_SUBST(PYGOBJECT_MICRO_VERSION, pygobject_micro_version)
38 AM_CONFIG_HEADER(config.h)
39 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
40 AM_INIT_AUTOMAKE(foreign)
43 dnl put the ACLOCAL flags in the makefile
44 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
48 AC_MSG_CHECKING([for some Win32 platform])
50 *-*-mingw*|*-*-cygwin*)
57 AC_MSG_RESULT([$platform_win32])
58 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
60 AC_MSG_CHECKING([for native Win32])
69 AC_MSG_RESULT([$os_win32])
70 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
74 dnl XXXX hack to kill off all the libtool tags ...
75 dnl it isn't like we are using C++ or Fortran.
76 dnl (copied from libglade/configure.in)
77 m4_define([_LT_AC_TAGCONFIG],[])
81 dnl when using libtool 2.x create libtool early, because it's used in configure
82 m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
88 # check that we have the minimum version of python necessary to build
89 JD_PATH_PYTHON(python_min_ver)
91 # check if we are building for python 3
92 JD_PYTHON_CHECK_VERSION([$PYTHON], [3.0],
96 # if building for python 3 make sure we have the minimum version supported
97 if test $build_py3k = true ; then
98 AC_MSG_CHECKING([for $PYTHON >=] python3_min_ver)
99 JD_PYTHON_CHECK_VERSION([$PYTHON], python3_min_ver,
100 [AC_MSG_RESULT(yes)],
101 [AC_MSG_ERROR(too old)])
104 AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
106 AC_MSG_CHECKING([for PySignal_SetWakeupFd in Python.h])
107 old_CPPFLAGS=$CPPFLAGS
108 CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES"
109 AC_TRY_COMPILE([#include <Python.h>],
110 [PySignal_SetWakeupFd(0);],
113 AC_MSG_RESULT($setwakeupfd_ok)
114 if test "x$setwakeupfd_ok" != xno; then
115 AC_DEFINE(HAVE_PYSIGNAL_SETWAKEUPFD, 1,
116 [Define to 1 if PySignal_SetWakeupFd is available])
118 CPPFLAGS=$old_CPPFLAGS
120 PLATFORM=`$PYTHON -c "import sys; from distutils import util; sys.stdout.write(util.get_platform())"`
123 AC_ARG_ENABLE(thread,
124 AC_HELP_STRING([--disable-thread], [Disable pygobject threading support]),,
127 dnl Building documentation
129 AC_HELP_STRING([--enable-docs], [Enable documentation building]),enable_docs=$enableval,
131 if test "${enable_docs}" != no; then
133 dnl Check for xsltproc
135 AC_PATH_PROG([XSLTPROC], [xsltproc])
136 if test -z "$XSLTPROC"; then
140 dnl check for DocBook DTD and stylesheets in the local catalog.
141 dnl JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
142 dnl [DocBook XML DTD V4.1.2],,enable_docs=no)
143 dnl JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
144 dnl [DocBook XSL Stylesheets],,enable_docs=no)
147 AM_CONDITIONAL(ENABLE_DOCS, test x$enable_docs != xno)
149 AM_CHECK_PYMOD(thread,,,enable_thread=check_for_py3_module)
150 if test "x$enable_thread" = xcheck_for_py3_module; then
151 dnl Python 3 uses the _thread module so check for that
152 AM_CHECK_PYMOD(_thread,,,enable_thread=no)
155 AC_MSG_CHECKING(whether to enable threading in pygobject)
156 if test "x$enable_thread" != xno; then
162 THREADING_CFLAGS="-DDISABLE_THREADING"
165 AC_SUBST(THREADING_CFLAGS)
166 CPPFLAGS="${CPPFLAGS} $THREADING_CFLAGS"
168 dnl get rid of the -export-dynamic stuff from the configure flags ...
169 export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
172 AM_PATH_GLIB_2_0(glib_required_version,,[AC_MSG_ERROR(maybe you want the pygobject-2-4 branch?)],gobject $extra_mods)
173 if test -n "$export_dynamic"; then
174 GLIB_LIBS=`echo $GLIB_LIBS | sed -e "s/$export_dynamic//"`
176 PYTHON_BASENAME=`basename $PYTHON`
177 AC_SUBST([PYTHON_BASENAME])
179 pygobject_CODEGEN_DEFINES=""
180 AC_SUBST([pygobject_CODEGEN_DEFINES])
182 AS_AC_EXPAND(DATADIR, $datadir)
185 AC_MSG_CHECKING(for ffi)
187 AC_HELP_STRING([--without-ffi], [Disable libffi support]),
188 with_libffi=$withval,
190 if test x"$with_libffi" = xno ; then
193 PKG_CHECK_MODULES(FFI, libffi >= 3.0, have_libffi=yes, have_libffi=no)
195 if test x"$with_libffi" = xyes && test x"$have_libffi" = xno ; then
196 AC_MSG_ERROR([ffi requested, but not found])
198 if test x"$have_libffi" = xyes; then
199 AC_DEFINE(HAVE_FFI_H,1,[Have libffi include files])
202 AM_CONDITIONAL(HAVE_LIBFFI, test "$have_libffi" = "yes")
208 PKG_CHECK_MODULES(GIO, gio-2.0 >= gio_required_version,
209 have_gio=true, have_gio=false)
213 # Do not build GIO if the python version >= 3.0
214 # We use GI to access GIO in python 3
215 AM_CONDITIONAL(BUILD_GIO, test $have_gio = true -a $build_py3k = false)
217 if test -n "$export_dynamic"; then
218 GIO_LIBS=`echo $GIO_LIBS | sed -e "s/$export_dynamic//"`
222 PKG_CHECK_MODULES(GIOUNIX, gio-unix-2.0 >= giounix_required_version,
223 have_giounix=true, have_giounix=false)
224 AC_SUBST(GIOUNIX_CFLAGS)
225 AC_SUBST(GIOUNIX_LIBS)
226 AM_CONDITIONAL(BUILD_GIOUNIX, test $have_giounix = true -a $build_py3k = false)
227 if test -n "$export_dynamic"; then
228 GIOUNIX_LIBS=`echo $GIOUNIX_LIBS | sed -e "s/$export_dynamic//"`
232 AC_HELP_STRING([--enable-cairo], [Enable Cairo bindings using introspection information]),
233 enable_cairo=$enableval,
236 AC_ARG_ENABLE(introspection,
237 AC_HELP_STRING([--enable-introspection], [Use introspection information]),
238 enable_introspection=$enableval,
239 enable_introspection=no)
240 if test "$enable_introspection" != no; then
241 AC_DEFINE(ENABLE_INTROSPECTION,1,Use introspection information)
242 PKG_CHECK_MODULES(GI,
243 glib-2.0 >= glib_required_version
244 gobject-introspection-1.0 >= introspection_required_version
247 GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0)
250 if test "$enable_cairo" != no; then
251 PKG_CHECK_MODULES(PYCAIRO,
252 pycairo >= pycairo_required_version
256 AM_CONDITIONAL(ENABLE_INTROSPECTION, test "$enable_introspection" = "yes")
257 AM_CONDITIONAL(ENABLE_CAIRO, test "$enable_cairo" = "yes")
259 INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
260 INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
262 AC_SUBST(INTROSPECTION_SCANNER)
263 AC_SUBST(INTROSPECTION_COMPILER)
265 dnl Do not install codegen for Python 3.
266 AM_CONDITIONAL(ENABLE_CODEGEN, test $build_py3k = false)
268 dnl add required cflags ...
269 if test "x$GCC" = "xyes"; then
270 JH_ADD_CFLAG([-Wall])
271 JH_ADD_CFLAG([-fno-strict-aliasing])
277 JH_ADD_CFLAG([-std=c9x])
286 pygobject-2.0-uninstalled.pc
288 docs/reference/entities.docbook
291 gi/repository/Makefile
292 gi/overrides/Makefile
300 if test $build_py3k = false; then
303 codegen/pygobject-codegen-2.0)
309 echo "libffi support: $have_libffi"
310 echo "introspection support: $enable_introspection"