2 # Process this file with autoconf to produce a configure script.
4 dnl the gi version number
5 m4_define(gi_major_version, 1)
6 m4_define(gi_minor_version, 40)
7 m4_define(gi_micro_version, 0)
8 m4_define(gi_version, gi_major_version.gi_minor_version.gi_micro_version)
11 AC_INIT([gobject-introspection],
13 [http://bugzilla.gnome.org/enter_bug.cgi?product=glib&component=introspection],
14 [gobject-introspection])
16 AC_CONFIG_HEADER([config.h])
17 AC_CONFIG_MACRO_DIR([m4])
18 AC_CONFIG_AUX_DIR([build-aux])
20 AM_INIT_AUTOMAKE([1.11 tar-ustar dist-xz no-dist-gzip foreign -Wno-portability parallel-tests])
21 AM_MAINTAINER_MODE([enable])
23 AM_SILENT_RULES([yes])
25 # Used in docs/reference/version.xml
39 AM_CONDITIONAL(OS_WIN32, [test "x$os_win32" = "xyes"])
41 # Checks for programs.
53 if test "$LEX" = :; then
54 AC_MSG_ERROR([flex not found but required])
57 AC_CHECK_PROGS(YACC, 'bison -y', :)
58 if test "$YACC" = :; then
59 AC_MSG_ERROR([bison not found but required])
69 *[\ \ ]${flag}[\ \ ]*) ;;
70 *) result="${flag} ${result}" ;;
77 if test "$GCC" = "yes"; then
78 for flag in -Wall -Wchar-subscripts -Wmissing-declarations \
79 -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align \
80 -Wsign-compare -fno-strict-aliasing;
82 CFLAGS="$(ensureflag $flag $CFLAGS)"
86 # Checks for libraries.
87 AC_CHECK_LIB([dl], [dlopen])
89 AC_MSG_CHECKING(for the suffix of shared libraries)
90 # libtool variables are immediately available since 2.0, prior to that we need
91 # to call libtool --config explicitly
92 if test "x$shrext_cmds" = x; then
93 shrext_cmds=`SED=$SED ./libtool --config | grep '^shrext_cmds='`
96 eval std_shrext=$shrext_cmds
97 # chop the initial dot
98 SHLIB_SUFFIX=${std_shrext#.}
99 AC_MSG_RESULT(.$SHLIB_SUFFIX)
100 # any reason it may fail?
101 if test "x$SHLIB_SUFFIX" = x; then
102 AC_MSG_ERROR(Cannot determine shared library suffix from libtool)
104 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], "$SHLIB_SUFFIX", [Define to the platform's shared library suffix])
106 # Copied from dbus configure.in
107 #### find the actual value for $prefix that we'll end up with
108 ## (I know this is broken and should be done in the Makefile, but
109 ## that's a major pain and almost nobody actually seems to care)
110 AS_AC_EXPAND(EXPANDED_LOCALSTATEDIR, "$localstatedir")
111 AS_AC_EXPAND(EXPANDED_SYSCONFDIR, "$sysconfdir")
112 AS_AC_EXPAND(EXPANDED_BINDIR, "$bindir")
113 AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir")
114 AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir")
115 AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
117 #### Directory to install the libexec binaries
118 GOBJECT_INTROSPECTION_LIBDIR="$EXPANDED_LIBDIR"
119 AC_SUBST(GOBJECT_INTROSPECTION_LIBDIR)
120 AC_DEFINE_UNQUOTED(GOBJECT_INTROSPECTION_LIBDIR,"$GOBJECT_INTROSPECTION_LIBDIR", [Directory prefix for typelib installation])
122 #### Directory to install the gir files
125 AC_DEFINE_UNQUOTED(GIR_SUFFIX, "$GIR_SUFFIX", [Name of the gir directory])
127 GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX"
129 AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Director prefix for gir installation])
131 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.36.0])
132 PKG_CHECK_MODULES(GOBJECT, [gobject-2.0])
133 PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
134 PKG_CHECK_MODULES(GIO, [gio-2.0])
135 PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0], have_gio_unix=true, have_gio_unix=false)
136 AM_CONDITIONAL(HAVE_GIO_UNIX, test x$have_gio_unix = xtrue)
138 # Prefer cairo-gobject if we have it
140 AS_HELP_STRING([--with-cairo], [Use cairo @<:@default=maybe@:>@]),
141 [], [with_cairo=maybe])
143 AS_IF([test x${with_cairo} != xno], [
144 PKG_CHECK_MODULES(CAIRO, [cairo cairo-gobject], have_cairo=yes, have_cairo=no)
145 AS_IF([ test x$have_cairo = xno && test x$with_cairo = xyes ], [
146 AC_MSG_ERROR([cairo enabled but not found])
149 AM_CONDITIONAL(HAVE_CAIRO, test x$have_cairo = xyes)
153 CAIRO_SHARED_LIBRARY="libcairo-gobject.2.dylib"
156 CAIRO_SHARED_LIBRARY="libcairo-gobject-2.dll"
159 CAIRO_SHARED_LIBRARY="libcairo-gobject.so"
162 CAIRO_SHARED_LIBRARY="libcairo-gobject.so.2"
165 CAIRO_GIR_PACKAGE="cairo-gobject"
167 AC_SUBST(CAIRO_SHARED_LIBRARY)
168 AC_SUBST(CAIRO_GIR_PACKAGE)
171 PKG_CHECK_MODULES(SCANNER, [gobject-2.0 gio-2.0])
174 PKG_CHECK_MODULES(FFI, [libffi >= 3.0.0 ], have_ffi_pkgconfig=yes, have_ffi_pkgconfig=no)
178 if test x"$have_ffi_pkgconfig" = xyes ; then
179 FFI_PC_PACKAGES="libffi"
181 AC_MSG_CHECKING(for ffi.h)
183 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <ffi.h>]])],
184 [have_ffi_h=yes],[have_ffi_h=no])
185 if test x"$have_ffi_h" = x"yes"; then
188 if test x"$with_ffi" = x"yes" || test x"$with_ffi" = x"auto"; then
194 AC_SEARCH_LIBS(ffi_call,ffi,,AC_MSG_ERROR([libffi not found]),$other_LIBS)
195 if test x"$ac_cv_search_ffi_call" = x"none required" ; then
198 FFI_LIBS="$ac_cv_search_ffi_call $other_LIBS"
203 if test x"$have_ffi_h" != x"yes" ; then
204 AC_MSG_ERROR([ffi.h not found])
207 FFI_PC_LIBS=$FFI_LIBS
208 FFI_PC_CFLAGS=$FFI_CFLAGS
210 AC_MSG_RESULT([$have_ffi_h])
214 AC_SUBST(FFI_PC_CFLAGS)
215 AC_SUBST(FFI_PC_LIBS)
216 AC_SUBST(FFI_PC_PACKAGES)
218 AC_CHECK_SIZEOF(char)
219 AC_CHECK_SIZEOF(short)
221 AC_CHECK_SIZEOF(long)
223 PKG_CHECK_MODULES(GIREPO, [glib-2.0 >= 2.24.0 gobject-2.0 gmodule-2.0 gio-2.0])
225 # if we ever remove manual check for ffi and require .pc file, then
226 # just put libffi in the PKG_CHECK_MODULES(GIREPO) deps
227 GIREPO_LIBS="$GIREPO_LIBS $GCOV_LIBS $FFI_LIBS"
228 GIREPO_CFLAGS="$GIREPO_CFLAGS $FFI_CFLAGS"
230 GIREPO_CFLAGS="$GIREPO_CFLAGS $GCOV_CFLAGS"
233 # gtkdocize greps for ^GTK_DOC_CHECK and parses it, so you need to have
234 # it on it's own line.
235 m4_ifdef([GTK_DOC_CHECK], [
236 GTK_DOC_CHECK([1.19], [--flavour no-tmpl])
238 AM_CONDITIONAL([ENABLE_GTK_DOC],[false])
241 # Checks for header files.
243 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])
245 # Checks for typedefs, structures, and compiler characteristics.
248 # Checks for library functions.
250 AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull])
251 AC_CHECK_FUNCS([backtrace backtrace_symbols])
254 AM_PATH_PYTHON([2.6])
257 # Change backslashes to forward slashes in pyexecdir to avoid
259 pyexecdir=`echo $pyexecdir | tr '\\\\' '/'`
262 AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found]))
263 if test "x$os_win32" = "xyes"; then
264 AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
267 dnl Not enabled by default until 3.6 cycle when we can propose mako as
268 dnl an external dependency
269 AC_ARG_ENABLE(doctool,[ --disable-doctool disable g-ir-doctool ],,enable_doctool=auto)
270 AS_IF([ test x$enable_doctool != xno], [
271 AM_CHECK_PYMOD(mako,,have_python_mako=yes,have_python_mako=no)
273 AS_IF([ test x$enable_doctool = xauto && test x$have_python_mako = xyes ],
274 [ enable_doctool=yes ],
275 [ test x$enable_doctool = xauto && test x$have_python_mako = xno ],
276 [ enable_doctool=no ],
277 [ test x$enable_doctool = xyes && test x$have_python_mako = xno ],
278 [ AC_MSG_ERROR([Python mako module not found]) ])
279 AM_CONDITIONAL(BUILD_DOCTOOL, test x$enable_doctool != xno)
284 AC_MSG_CHECKING([for glib source directory to use for documentation])
286 AC_ARG_WITH(glib-src,
287 [ --with-glib-src=PATH Source directory for glib - needed to add docs to gir],
290 AM_CONDITIONAL(WITH_GLIBSRC, test x"$GLIBSRC" != x)
292 AC_MSG_RESULT([$GLIBSRC])
295 dnl Check for -Bsymbolic-functions linker flag used to avoid
296 dnl intra-library PLT jumps, if available.
298 AC_ARG_ENABLE(Bsymbolic,
299 [AS_HELP_STRING([--disable-Bsymbolic],
300 [avoid linking with -Bsymbolic])],,
301 [SAVED_LDFLAGS="${LDFLAGS}"
302 AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
303 LDFLAGS=-Wl,-Bsymbolic-functions
304 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int main (void) { return 0; }]])],
306 enable_Bsymbolic=yes],
308 enable_Bsymbolic=no])
309 LDFLAGS="${SAVED_LDFLAGS}"])
311 if test "x${enable_Bsymbolic}" = "xyes"; then
312 EXTRA_LINK_FLAGS=-Wl,-Bsymbolic-functions
315 AC_SUBST(EXTRA_LINK_FLAGS)
320 tests/offsets/Makefile
321 tests/scanner/Makefile
322 tests/scanner/annotationparser/Makefile
323 tests/repository/Makefile
326 docs/reference/Makefile
327 docs/reference/version.xml
328 gobject-introspection-1.0.pc
329 gobject-introspection-no-export-1.0.pc
333 build/win32/vs9/Makefile
334 build/win32/vs10/Makefile])