configure.ac: Do not generate template files
[platform/upstream/gobject-introspection.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 dnl the gi version number
5 m4_define(gi_major_version, 1)
6 m4_define(gi_minor_version, 29)
7 m4_define(gi_micro_version, 17)
8 m4_define(gi_version, gi_major_version.gi_minor_version.gi_micro_version)
9
10 AC_PREREQ([2.63])
11 AC_INIT([gobject-introspection],
12         [gi_version],
13         [http://bugzilla.gnome.org/enter_bug.cgi?product=glib&component=introspection],
14         [gobject-introspection])
15
16 AC_CONFIG_HEADER([config.h])
17 AC_CONFIG_MACRO_DIR([m4])
18 AC_CONFIG_AUX_DIR([build-aux])
19
20 AM_INIT_AUTOMAKE([1.11 tar-ustar dist-xz no-dist-gzip foreign -Wno-portability])
21 AM_MAINTAINER_MODE([enable])
22
23 AM_SILENT_RULES([yes])
24
25 # Check for Win32
26 AC_CANONICAL_HOST
27 AC_MSG_CHECKING([for Win32])
28 case "$host" in
29 *-*-mingw*)
30         os_win32=yes
31         ;;
32 *)
33         os_win32=no
34         ;;
35 esac
36 AC_MSG_RESULT([$os_win32])
37 AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
38
39 # Checks for programs.
40 AC_PROG_CC
41 AM_PROG_CC_C_O
42
43 # Initialize libtool
44 LT_PREREQ([2.2])
45 LT_INIT
46
47 PKG_PROG_PKG_CONFIG
48
49 AC_PROG_LEX
50 if test "$LEX" = :; then
51         AC_MSG_ERROR([flex not found but required])
52 fi
53
54 AC_CHECK_PROGS(YACC, 'bison -y', :)
55 if test "$YACC" = :; then
56         AC_MSG_ERROR([bison not found but required])
57 fi
58
59
60 changequote(,)dnl
61 ensureflag() {
62   flag="$1"; shift
63   result="$@"
64
65   case " ${result} " in
66   *[\ \ ]${flag}[\ \    ]*) ;;
67   *) result="${flag} ${result}" ;;
68   esac
69
70   echo ${result}
71 }
72 changequote([,])dnl
73
74 if test "$GCC" = "yes"; then
75     for flag in -Wall -Wchar-subscripts -Wmissing-declarations \
76         -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align \
77         -Wsign-compare -fno-strict-aliasing;
78     do
79         CFLAGS="$(ensureflag $flag $CFLAGS)"
80     done
81 fi
82
83 # Checks for libraries.
84 AC_CHECK_LIB([dl], [dlopen])
85
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='`
91     eval $shrext_cmds
92 fi
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)
100 fi
101 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], "$SHLIB_SUFFIX", [Define to the platform's shared library suffix])
102
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")
113
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])
118
119 #### Directory to install the gir files
120 GIR_SUFFIX="gir-1.0"
121 AC_SUBST(GIR_SUFFIX)
122 AC_DEFINE_UNQUOTED(GIR_SUFFIX, "$GIR_SUFFIX", [Name of the gir directory])
123
124 GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX"
125 AC_SUBST(GIR_DIR)
126 AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Director prefix for gir installation])
127
128 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.29.7])
129 PKG_CHECK_MODULES(GOBJECT, [gobject-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)
133
134 AC_ARG_ENABLE(tests,[  --disable-tests           disable test libraries ], enable_tests=$enableval,enable_tests=yes)
135 have_cairo=no
136 PKG_CHECK_MODULES(CAIRO, [cairo], have_cairo=yes, have_cairo=no)
137 if test x$have_cairo != xyes && test x$enable_tests != xno; then
138   AC_MSG_ERROR([Tests enabled but cairo not found; pass --disable-tests or install cairo])
139 fi
140
141 have_cairo_gobject=no
142 if test x$have_cairo = xyes; then
143   PKG_CHECK_MODULES(CAIRO_GOBJECT, [cairo-gobject], have_cairo_gobject=yes, have_cairo_gobject=no)
144 fi
145
146 if test x$have_cairo_gobject = xyes; then
147   case "$host" in
148     *-*-darwin*)
149       CAIRO_SHARED_LIBRARY="libcairo-gobject.2.dylib"
150       ;;
151     *)
152       CAIRO_SHARED_LIBRARY="libcairo-gobject.so.2"
153       ;;
154   esac
155   CAIRO_GIR_PACKAGE="cairo-gobject"
156 elif test x$have_cairo = xyes; then
157   case "$host" in
158     *-*-darwin*)
159       CAIRO_SHARED_LIBRARY="libcairo.2.dylib"
160       ;;
161     *)
162       CAIRO_SHARED_LIBRARY="libcairo.so.2"
163       ;;
164   esac
165   CAIRO_GIR_PACKAGE="cairo"
166 fi
167 AC_SUBST(CAIRO_SHARED_LIBRARY)
168 AC_SUBST(CAIRO_GIR_PACKAGE)
169
170 AM_CONDITIONAL(BUILD_TESTS, test x$enable_tests != xno)
171 AM_CONDITIONAL(HAVE_CAIRO, test x$have_cairo != xno)
172 AM_CONDITIONAL(HAVE_CAIRO_GOBJECT, test x$have_cairo_gobject != xno)
173
174 PKG_CHECK_MODULES(SCANNER, [gobject-2.0 gthread-2.0 gio-2.0])
175
176 dnl libffi
177 PKG_CHECK_MODULES(FFI, libffi, have_ffi_pkgconfig=yes, have_ffi_pkgconfig=no)
178 FFI_PC_CFLAGS=""
179 FFI_PC_LIBS=""
180 FFI_PC_PACKAGES=""
181 if test x"$have_ffi_pkgconfig" = xyes ; then
182     FFI_PC_PACKAGES="libffi"
183 else
184   AC_MSG_CHECKING(for ffi.h)
185
186   AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <ffi.h>]])],
187                     [have_ffi_h=yes],[have_ffi_h=no])
188   if test x"$have_ffi_h" = x"yes"; then
189
190     save_LIBS=$LIBS
191     if test x"$with_ffi" = x"yes" || test x"$with_ffi" = x"auto"; then
192       other_LIBS=
193     else
194       other_LIBS=$with_ffi
195     fi
196
197     AC_SEARCH_LIBS(ffi_call,ffi,,AC_MSG_ERROR([libffi not found]),$other_LIBS)
198     if test x"$ac_cv_search_ffi_call" = x"none required" ; then
199       FFI_LIBS=$other_LIBS
200     else
201       FFI_LIBS="$ac_cv_search_ffi_call $other_LIBS"
202     fi
203
204     LIBS=$save_LIBS
205   fi
206   if test x"$have_ffi_h" != x"yes" ; then
207     AC_MSG_ERROR([ffi.h not found])
208   fi
209
210   FFI_PC_LIBS=$FFI_LIBS
211   FFI_PC_CFLAGS=$FFI_CFLAGS
212   FFI_CFLAGS=
213   AC_MSG_RESULT([$have_ffi_h])
214   AC_SUBST(FFI_LIBS)
215   AC_SUBST(FFI_CFLAGS)
216 fi
217 AC_SUBST(FFI_PC_CFLAGS)
218 AC_SUBST(FFI_PC_LIBS)
219 AC_SUBST(FFI_PC_PACKAGES)
220
221 AC_CHECK_SIZEOF(char)
222 AC_CHECK_SIZEOF(short)
223 AC_CHECK_SIZEOF(int)
224 AC_CHECK_SIZEOF(long)
225
226 PKG_CHECK_MODULES(GIREPO, [glib-2.0 >= 2.24.0 gobject-2.0 gmodule-2.0 gio-2.0])
227
228 # if we ever remove manual check for ffi and require .pc file, then
229 # just put libffi in the PKG_CHECK_MODULES(GIREPO) deps
230 GIREPO_LIBS="$GIREPO_LIBS $GCOV_LIBS $FFI_LIBS"
231 GIREPO_CFLAGS="$GIREPO_CFLAGS $FFI_CFLAGS"
232
233 GIREPO_CFLAGS="$GIREPO_CFLAGS $GCOV_CFLAGS"
234
235 # gtk-doc
236 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
237
238 # Checks for header files.
239 AC_HEADER_STDC
240 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])
241
242 # Checks for typedefs, structures, and compiler characteristics.
243 AC_C_CONST
244
245 # Checks for library functions.
246 AC_FUNC_STRTOD
247 AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull])
248 AC_CHECK_FUNCS([backtrace backtrace_symbols])
249
250 # Python
251
252 AC_MSG_CHECKING([whether Python support is requested])
253
254 AM_PATH_PYTHON([2.5])
255 case "$host" in
256 *-*-mingw*)
257         # Change backslashes to forward slashes in pyexecdir to avoid
258         # quoting issues
259         pyexecdir=`echo $pyexecdir | tr '\\\\' '/'`
260         ;;
261 esac
262 AM_CHECK_PYTHON_HEADERS(,AC_MSG_ERROR([Python headers not found]))
263
264 # Glib documentation
265
266 GLIBSRC=
267 AC_MSG_CHECKING([for glib source directory to use for documentation])
268
269 AC_ARG_WITH(glib-src,
270         [  --with-glib-src=PATH    Source directory for glib - needed to add docs to gir],
271         GLIBSRC=$withval
272
273 AM_CONDITIONAL(WITH_GLIBSRC, test x"$GLIBSRC" != x)
274 AC_SUBST(GLIBSRC)
275 AC_MSG_RESULT([$GLIBSRC])
276
277
278
279 AC_CONFIG_FILES([
280 Makefile
281 m4/Makefile
282 tests/Makefile
283 tests/offsets/Makefile
284 tests/scanner/Makefile
285 tests/repository/Makefile
286 tests/warn/Makefile
287 tests/doctool/Makefile
288 docs/Makefile
289 docs/reference/Makefile
290 gobject-introspection-1.0.pc
291 gobject-introspection-no-export-1.0.pc])
292 AC_OUTPUT