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, 59)
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=gobject-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 subdir-objects])
21 AM_MAINTAINER_MODE([enable])
23 AM_SILENT_RULES([yes])
25 # Used in docs/reference/version.xml
29 GI_MAJOR_VERSION=gi_major_version
30 GI_MINOR_VERSION=gi_minor_version
31 GI_MICRO_VERSION=gi_micro_version
32 AC_SUBST(GI_MAJOR_VERSION)
33 AC_SUBST(GI_MINOR_VERSION)
34 AC_SUBST(GI_MICRO_VERSION)
46 AM_CONDITIONAL(OS_WIN32, [test "x$os_win32" = "xyes"])
48 # Checks for programs.
60 if test "$LEX" = :; then
61 AC_MSG_ERROR([flex not found but required])
64 AC_CHECK_PROGS(YACC, 'bison -y', :)
65 if test "$YACC" = :; then
66 AC_MSG_ERROR([bison not found but required])
69 # Default compiler warnings
70 m4_ifndef([AX_COMPILER_FLAGS], [AC_MSG_ERROR(['autoconf-archive' missing])])
71 AX_COMPILER_FLAGS(,, [yes])
72 # These get triggered a lot, not worth it imo, but feel free to fix them
73 AX_APPEND_COMPILE_FLAGS([-Wno-duplicated-branches -Wno-switch-enum])
75 WARN_CFLAGS_PYTHON="$WARN_CFLAGS"
76 AX_APPEND_COMPILE_FLAGS([-Wno-discarded-qualifiers], [WARN_CFLAGS_PYTHON])
77 AC_SUBST(WARN_CFLAGS_PYTHON)
79 WARN_CFLAGS_FLEX="$WARN_CFLAGS"
80 AX_APPEND_COMPILE_FLAGS([-Wno-sign-compare -Wno-switch-default -Wno-redundant-decls], [WARN_CFLAGS_FLEX])
81 AC_SUBST(WARN_CFLAGS_FLEX)
83 # Checks for libraries.
84 AC_CHECK_LIB([dl], [dlopen])
86 AC_MSG_CHECKING(for the suffix of shared libraries)
87 # libtool variables are immediately available since 2.0, prior to that we need
88 # to call libtool --config explicitly
89 if test "x$shrext_cmds" = x; then
90 shrext_cmds=`SED=$SED ./libtool --config | grep '^shrext_cmds='`
93 eval std_shrext=$shrext_cmds
94 # chop the initial dot
95 SHLIB_SUFFIX=${std_shrext#.}
96 AC_MSG_RESULT(.$SHLIB_SUFFIX)
97 # any reason it may fail?
98 if test "x$SHLIB_SUFFIX" = x; then
99 AC_MSG_ERROR(Cannot determine shared library suffix from libtool)
101 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], "$SHLIB_SUFFIX", [Define to the platform's shared library suffix])
103 # Copied from dbus configure.in
104 #### find the actual value for $prefix that we'll end up with
105 ## (I know this is broken and should be done in the Makefile, but
106 ## that's a major pain and almost nobody actually seems to care)
107 AS_AC_EXPAND(EXPANDED_LOCALSTATEDIR, "$localstatedir")
108 AS_AC_EXPAND(EXPANDED_SYSCONFDIR, "$sysconfdir")
109 AS_AC_EXPAND(EXPANDED_BINDIR, "$bindir")
110 AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir")
111 AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir")
112 AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
114 #### Directory to install the libexec binaries
115 GOBJECT_INTROSPECTION_LIBDIR="$EXPANDED_LIBDIR"
116 AC_SUBST(GOBJECT_INTROSPECTION_LIBDIR)
117 AC_DEFINE_UNQUOTED(GOBJECT_INTROSPECTION_LIBDIR,"$GOBJECT_INTROSPECTION_LIBDIR", [Directory prefix for typelib installation])
119 #### Directory to install the gir files
122 AC_DEFINE_UNQUOTED(GIR_SUFFIX, "$GIR_SUFFIX", [Name of the gir directory])
124 AC_ARG_WITH([gir-dir-prefix],
125 [AS_HELP_STRING([--with-gir-dir-prefix], [Directory prefix for gir installation])],
126 [GIR_DIR_PREFIX="$withval"], [])
128 if test -z $GIR_DIR_PREFIX; then
129 GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX"
130 GIR_PC_DIR="\${datadir}/$GIR_SUFFIX"
132 GIR_DIR="$GIR_DIR_PREFIX/$GIR_SUFFIX"
133 GIR_PC_DIR="$GIR_DIR_PREFIX/$GIR_SUFFIX"
138 AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Directory prefix for gir installation])
140 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.58.0])
142 PKG_CHECK_MODULES(GOBJECT, [gobject-2.0])
143 PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
144 PKG_CHECK_MODULES(GIO, [gio-2.0])
145 PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0], have_gio_unix=true, have_gio_unix=false)
146 AM_CONDITIONAL(HAVE_GIO_UNIX, test x$have_gio_unix = xtrue)
148 # Prefer cairo-gobject if we have it
150 AS_HELP_STRING([--with-cairo], [Use cairo @<:@default=maybe@:>@]),
151 [], [with_cairo=maybe])
153 AS_IF([test x${with_cairo} != xno], [
154 PKG_CHECK_MODULES(CAIRO, [cairo cairo-gobject], have_cairo=yes, have_cairo=no)
155 AS_IF([ test x$have_cairo = xno && test x$with_cairo = xyes ], [
156 AC_MSG_ERROR([cairo enabled but not found])
159 AM_CONDITIONAL(HAVE_CAIRO, test x$have_cairo = xyes)
163 CAIRO_SHARED_LIBRARY="libcairo-gobject.2.dylib"
166 CAIRO_SHARED_LIBRARY="libcairo-gobject-2.dll"
169 CAIRO_SHARED_LIBRARY="libcairo-gobject.so"
172 CAIRO_SHARED_LIBRARY="libcairo-gobject.so.2"
175 CAIRO_GIR_PACKAGE="cairo-gobject"
177 AC_SUBST(CAIRO_SHARED_LIBRARY)
178 AC_SUBST(CAIRO_GIR_PACKAGE)
181 PKG_CHECK_MODULES(SCANNER, [gobject-2.0 gio-2.0])
184 PKG_CHECK_MODULES(FFI, [libffi >= 3.0.0 ], have_ffi_pkgconfig=yes, have_ffi_pkgconfig=no)
188 if test x"$have_ffi_pkgconfig" = xyes ; then
189 FFI_PC_PACKAGES="libffi"
191 AC_MSG_CHECKING(for ffi.h)
193 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <ffi.h>]])],
194 [have_ffi_h=yes],[have_ffi_h=no])
195 if test x"$have_ffi_h" = x"yes"; then
198 if test x"$with_ffi" = x"yes" || test x"$with_ffi" = x"auto"; then
204 AC_SEARCH_LIBS(ffi_call,ffi,,AC_MSG_ERROR([libffi not found]),$other_LIBS)
205 if test x"$ac_cv_search_ffi_call" = x"none required" ; then
208 FFI_LIBS="$ac_cv_search_ffi_call $other_LIBS"
213 if test x"$have_ffi_h" != x"yes" ; then
214 AC_MSG_ERROR([ffi.h not found])
217 FFI_PC_LIBS=$FFI_LIBS
218 FFI_PC_CFLAGS=$FFI_CFLAGS
220 AC_MSG_RESULT([$have_ffi_h])
224 AC_SUBST(FFI_PC_CFLAGS)
225 AC_SUBST(FFI_PC_LIBS)
226 AC_SUBST(FFI_PC_PACKAGES)
228 AC_CHECK_SIZEOF(char)
229 AC_CHECK_SIZEOF(short)
231 AC_CHECK_SIZEOF(long)
233 PKG_CHECK_MODULES(GIREPO, [glib-2.0 >= 2.24.0 gobject-2.0 gmodule-2.0 gio-2.0])
235 # if we ever remove manual check for ffi and require .pc file, then
236 # just put libffi in the PKG_CHECK_MODULES(GIREPO) deps
237 GIREPO_LIBS="$GIREPO_LIBS $GCOV_LIBS $FFI_LIBS"
238 GIREPO_CFLAGS="$GIREPO_CFLAGS $FFI_CFLAGS"
240 GIREPO_CFLAGS="$GIREPO_CFLAGS $GCOV_CFLAGS"
243 # gtkdocize greps for ^GTK_DOC_CHECK and parses it, so you need to have
244 # it on it's own line.
245 m4_ifdef([GTK_DOC_CHECK], [
246 GTK_DOC_CHECK([1.19], [--flavour no-tmpl])
248 AM_CONDITIONAL([ENABLE_GTK_DOC],[false])
251 # Checks for header files.
253 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])
255 # Checks for typedefs, structures, and compiler characteristics.
258 # Checks for library functions.
260 AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull])
261 AC_CHECK_FUNCS([backtrace backtrace_symbols])
264 # option to specify python interpreter to use; this just sets $PYTHON, so that
265 # we will fallback to reading $PYTHON if --with-python is not given, and
266 # python.m4 will get the expected input
268 AS_HELP_STRING([--with-python=PATH],[Path to Python interpreter; searches $PATH if only a program name, such as "python3" or "python3.4", is given; if not given, searches for a few standard names]),
269 [PYTHON="$withval"], [])
270 if test x"$PYTHON" = xyes; then
271 AC_MSG_ERROR([--with-python option requires a path or program argument])
273 AM_PATH_PYTHON(3.4,,[AC_MSG_ERROR([Requires Python >=3.4])])
277 # Change backslashes to forward slashes in pyexecdir to avoid
279 pyexecdir=`echo $pyexecdir | tr '\\\\' '/'`
282 AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found]))
283 if test "x$os_win32" = "xyes"; then
284 AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
287 PYTHON_SO=`$PYTHON -c "import sysconfig, sys; get = sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"`
290 dnl Not enabled by default until 3.6 cycle when we can propose mako as
291 dnl an external dependency
292 AC_ARG_ENABLE(doctool,[ --disable-doctool disable g-ir-doc-tool ],,enable_doctool=auto)
293 AS_IF([ test x$enable_doctool != xno], [
294 AM_CHECK_PYMOD(mako,,have_python_mako=yes,have_python_mako=no)
295 AM_CHECK_PYMOD(markdown,,have_python_markdown=yes,have_python_markdown=no)
297 AS_IF([ test x$enable_doctool = xauto &&
298 test x$have_python_mako = xyes &&
299 test x$have_python_markdown = xyes ],
300 [ enable_doctool=yes ],
301 [ test x$enable_doctool = xauto &&
302 (test x$have_python_mako = xno ||
303 test x$have_python_markdown = xno) ],
304 [ enable_doctool=no ],
305 [ test x$enable_doctool = xyes && test x$have_python_mako = xno ],
306 [ AC_MSG_ERROR([Python mako module not found]) ],
307 [ test x$enable_doctool = xyes && test x$have_python_markdown = xno ],
308 [ AC_MSG_ERROR([Python markdown module not found]) ])
309 AM_CONDITIONAL(BUILD_DOCTOOL, test x$enable_doctool != xno)
314 AC_MSG_CHECKING([for glib source directory to use for documentation])
316 AC_ARG_WITH(glib-src,
317 [ --with-glib-src=PATH Source directory for glib - needed to add docs to gir],
320 AM_CONDITIONAL(WITH_GLIBSRC, test x"$GLIBSRC" != x)
322 AC_MSG_RESULT([$GLIBSRC])
325 dnl Check for -fvisibility=hidden to determine if we can do GNU-style
326 dnl visibility attributes for symbol export control
328 GI_HIDDEN_VISIBILITY_CFLAGS=""
331 dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
332 AC_DEFINE([_GI_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
333 [defines how to decorate public symbols while building])
334 CFLAGS="${CFLAGS} -fvisibility=hidden"
337 dnl on other compilers, check if we can do -fvisibility=hidden
338 SAVED_CFLAGS="${CFLAGS}"
339 CFLAGS="-fvisibility=hidden"
340 AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
341 AC_TRY_COMPILE([], [return 0],
343 enable_fvisibility_hidden=yes,
345 enable_fvisibility_hidden=no)
346 CFLAGS="${SAVED_CFLAGS}"
348 AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
349 AC_DEFINE([_GI_EXTERN], [__attribute__((visibility("default"))) extern],
350 [defines how to decorate public symbols while building])
351 GI_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
355 AC_SUBST(GI_HIDDEN_VISIBILITY_CFLAGS)
358 dnl Check for -Bsymbolic-functions linker flag used to avoid
359 dnl intra-library PLT jumps, if available.
361 AC_ARG_ENABLE(Bsymbolic,
362 [AS_HELP_STRING([--disable-Bsymbolic],
363 [avoid linking with -Bsymbolic])],,
364 [SAVED_LDFLAGS="${LDFLAGS}"
365 AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
366 LDFLAGS=-Wl,-Bsymbolic-functions
367 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0]])],
369 enable_Bsymbolic=yes],
371 enable_Bsymbolic=no])
372 LDFLAGS="${SAVED_LDFLAGS}"])
374 if test "x${enable_Bsymbolic}" = "xyes"; then
375 EXTRA_LINK_FLAGS=-Wl,-Bsymbolic-functions
378 AC_SUBST(EXTRA_LINK_FLAGS)
381 dnl Check whether MSVC toolset is explicitly set
383 AM_CONDITIONAL(MSVC_BASE_NO_TOOLSET_SET, [test x$MSVC_BASE_TOOLSET = x])
384 AM_CONDITIONAL(MSVC_NO_TOOLSET_SET, [test x$MSVC_TOOLSET = x])
389 tests/offsets/Makefile
390 tests/scanner/Makefile
391 tests/scanner/annotationparser/Makefile
392 tests/repository/Makefile
395 docs/reference/Makefile
396 docs/reference/version.xml
397 giscanner/_version.py
398 girepository/giversion.h
399 gobject-introspection-1.0.pc
400 gobject-introspection-no-export-1.0.pc])