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, 35)
7 m4_define(gi_micro_version, 3)
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])
21 AM_MAINTAINER_MODE([enable])
23 AM_SILENT_RULES([yes])
35 AM_CONDITIONAL(OS_WIN32, [test "x$os_win32" = "xyes"])
37 # Checks for programs.
49 if test "$LEX" = :; then
50 AC_MSG_ERROR([flex not found but required])
53 AC_CHECK_PROGS(YACC, 'bison -y', :)
54 if test "$YACC" = :; then
55 AC_MSG_ERROR([bison not found but required])
65 *[\ \ ]${flag}[\ \ ]*) ;;
66 *) result="${flag} ${result}" ;;
73 if test "$GCC" = "yes"; then
74 for flag in -Wall -Wchar-subscripts -Wmissing-declarations \
75 -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align \
76 -Wsign-compare -fno-strict-aliasing;
78 CFLAGS="$(ensureflag $flag $CFLAGS)"
82 # Checks for libraries.
83 AC_CHECK_LIB([dl], [dlopen])
85 AC_MSG_CHECKING(for the suffix of shared libraries)
86 # libtool variables are immediately available since 2.0, prior to that we need
87 # to call libtool --config explicitly
88 if test "x$shrext_cmds" = x; then
89 shrext_cmds=`SED=$SED ./libtool --config | grep '^shrext_cmds='`
92 eval std_shrext=$shrext_cmds
93 # chop the initial dot
94 SHLIB_SUFFIX=${std_shrext#.}
95 AC_MSG_RESULT(.$SHLIB_SUFFIX)
96 # any reason it may fail?
97 if test "x$SHLIB_SUFFIX" = x; then
98 AC_MSG_ERROR(Cannot determine shared library suffix from libtool)
100 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], "$SHLIB_SUFFIX", [Define to the platform's shared library suffix])
102 # Copied from dbus configure.in
103 #### find the actual value for $prefix that we'll end up with
104 ## (I know this is broken and should be done in the Makefile, but
105 ## that's a major pain and almost nobody actually seems to care)
106 AS_AC_EXPAND(EXPANDED_LOCALSTATEDIR, "$localstatedir")
107 AS_AC_EXPAND(EXPANDED_SYSCONFDIR, "$sysconfdir")
108 AS_AC_EXPAND(EXPANDED_BINDIR, "$bindir")
109 AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir")
110 AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir")
111 AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
113 #### Directory to install the libexec binaries
114 GOBJECT_INTROSPECTION_LIBDIR="$EXPANDED_LIBDIR"
115 AC_SUBST(GOBJECT_INTROSPECTION_LIBDIR)
116 AC_DEFINE_UNQUOTED(GOBJECT_INTROSPECTION_LIBDIR,"$GOBJECT_INTROSPECTION_LIBDIR", [Directory prefix for typelib installation])
118 #### Directory to install the gir files
121 AC_DEFINE_UNQUOTED(GIR_SUFFIX, "$GIR_SUFFIX", [Name of the gir directory])
123 GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX"
125 AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Director prefix for gir installation])
127 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.35.0])
128 PKG_CHECK_MODULES(GOBJECT, [gobject-2.0])
129 PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
130 PKG_CHECK_MODULES(GIO, [gio-2.0])
131 PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0], have_gio_unix=true, have_gio_unix=false)
132 AM_CONDITIONAL(HAVE_GIO_UNIX, test x$have_gio_unix = xtrue)
134 # Prefer cairo-gobject if we have it
136 AS_HELP_STRING([--with-cairo], [Use cairo @<:@default=maybe@:>@]),
137 [], [with_cairo=maybe])
139 AS_IF([test x${with_cairo} != xno], [
140 PKG_CHECK_MODULES(CAIRO, [cairo cairo-gobject], have_cairo=yes, have_cairo=no)
141 AS_IF([ test x$have_cairo = xno && test x$with_cairo = xyes ], [
142 AC_MSG_ERROR([cairo enabled but not found])
145 AM_CONDITIONAL(HAVE_CAIRO, test x$have_cairo = xyes)
149 CAIRO_SHARED_LIBRARY="libcairo-gobject.2.dylib"
152 CAIRO_SHARED_LIBRARY="libcairo-gobject-2.dll"
155 CAIRO_SHARED_LIBRARY="libcairo-gobject.so"
158 CAIRO_SHARED_LIBRARY="libcairo-gobject.so.2"
161 CAIRO_GIR_PACKAGE="cairo-gobject"
163 AC_SUBST(CAIRO_SHARED_LIBRARY)
164 AC_SUBST(CAIRO_GIR_PACKAGE)
167 PKG_CHECK_MODULES(SCANNER, [gobject-2.0 gio-2.0])
170 PKG_CHECK_MODULES(FFI, libffi, have_ffi_pkgconfig=yes, have_ffi_pkgconfig=no)
174 if test x"$have_ffi_pkgconfig" = xyes ; then
175 FFI_PC_PACKAGES="libffi"
177 AC_MSG_CHECKING(for ffi.h)
179 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <ffi.h>]])],
180 [have_ffi_h=yes],[have_ffi_h=no])
181 if test x"$have_ffi_h" = x"yes"; then
184 if test x"$with_ffi" = x"yes" || test x"$with_ffi" = x"auto"; then
190 AC_SEARCH_LIBS(ffi_call,ffi,,AC_MSG_ERROR([libffi not found]),$other_LIBS)
191 if test x"$ac_cv_search_ffi_call" = x"none required" ; then
194 FFI_LIBS="$ac_cv_search_ffi_call $other_LIBS"
199 if test x"$have_ffi_h" != x"yes" ; then
200 AC_MSG_ERROR([ffi.h not found])
203 FFI_PC_LIBS=$FFI_LIBS
204 FFI_PC_CFLAGS=$FFI_CFLAGS
206 AC_MSG_RESULT([$have_ffi_h])
210 AC_SUBST(FFI_PC_CFLAGS)
211 AC_SUBST(FFI_PC_LIBS)
212 AC_SUBST(FFI_PC_PACKAGES)
214 AC_CHECK_SIZEOF(char)
215 AC_CHECK_SIZEOF(short)
217 AC_CHECK_SIZEOF(long)
219 PKG_CHECK_MODULES(GIREPO, [glib-2.0 >= 2.24.0 gobject-2.0 gmodule-2.0 gio-2.0])
221 # if we ever remove manual check for ffi and require .pc file, then
222 # just put libffi in the PKG_CHECK_MODULES(GIREPO) deps
223 GIREPO_LIBS="$GIREPO_LIBS $GCOV_LIBS $FFI_LIBS"
224 GIREPO_CFLAGS="$GIREPO_CFLAGS $FFI_CFLAGS"
226 GIREPO_CFLAGS="$GIREPO_CFLAGS $GCOV_CFLAGS"
229 # gtkdocize greps for ^GTK_DOC_CHECK and parses it, so you need to have
230 # it on it's own line.
231 m4_ifdef([GTK_DOC_CHECK], [
232 GTK_DOC_CHECK([1.15], [--flavour no-tmpl])
234 AM_CONDITIONAL([ENABLE_GTK_DOC],[false])
237 # Checks for header files.
239 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])
241 # Checks for typedefs, structures, and compiler characteristics.
244 # Checks for library functions.
246 AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull])
247 AC_CHECK_FUNCS([backtrace backtrace_symbols])
250 AM_PATH_PYTHON([2.5])
253 # Change backslashes to forward slashes in pyexecdir to avoid
255 pyexecdir=`echo $pyexecdir | tr '\\\\' '/'`
258 AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found]))
259 if test "x$os_win32" = "xyes"; then
260 AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
263 dnl Not enabled by default until 3.6 cycle when we can propose mako as
264 dnl an external dependency
265 AC_ARG_ENABLE(doctool,[ --enable-doctool enable g-ir-doctool ], enable_doctool=$enableval,enable_doctool=no)
266 if test x$enable_doctool != xno; then
267 AM_CHECK_PYMOD(mako,,,[AC_MSG_ERROR(Could not find python module: mako)])
269 AM_CONDITIONAL(BUILD_DOCTOOL, test x$enable_doctool != xno)
274 AC_MSG_CHECKING([for glib source directory to use for documentation])
276 AC_ARG_WITH(glib-src,
277 [ --with-glib-src=PATH Source directory for glib - needed to add docs to gir],
280 AM_CONDITIONAL(WITH_GLIBSRC, test x"$GLIBSRC" != x)
282 AC_MSG_RESULT([$GLIBSRC])
285 dnl Check for -Bsymbolic-functions linker flag used to avoid
286 dnl intra-library PLT jumps, if available.
288 AC_ARG_ENABLE(Bsymbolic,
289 [AS_HELP_STRING([--disable-Bsymbolic],
290 [avoid linking with -Bsymbolic])],,
291 [SAVED_LDFLAGS="${LDFLAGS}"
292 AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
293 LDFLAGS=-Wl,-Bsymbolic-functions
294 AC_TRY_LINK([], [int main (void) { return 0; }],
296 enable_Bsymbolic=yes,
299 LDFLAGS="${SAVED_LDFLAGS}"])
301 if test "x${enable_Bsymbolic}" = "xyes"; then
302 EXTRA_LINK_FLAGS=-Wl,-Bsymbolic-functions
305 AC_SUBST(EXTRA_LINK_FLAGS)
311 tests/offsets/Makefile
312 tests/scanner/Makefile
313 tests/repository/Makefile
315 tests/doctool/Makefile
317 docs/reference/Makefile
318 gobject-introspection-1.0.pc
319 gobject-introspection-no-export-1.0.pc
323 build/win32/vs9/Makefile
324 build/win32/vs10/Makefile])
328 gobject-introspection $VERSION
331 tests: ${enable_tests}