Revert "[GIRPARSER] - tidy up of var args."
[gnome.gobject-introspection] / 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, 0)
6 m4_define(gi_minor_version, 6)
7 m4_define(gi_micro_version, 9)
8 m4_define(gi_version, gi_major_version.gi_minor_version.gi_micro_version)
9
10 AC_PREREQ(2.59)
11 AC_INIT(gobject-introspection, gi_version,
12         http://bugzilla.gnome.org/enter_bug.cgi?product=glib&component=introspection)
13 AM_INIT_AUTOMAKE([1.7 -Wno-portability])
14 AM_MAINTAINER_MODE
15
16 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
17
18 AC_CONFIG_HEADER([config.h])
19
20 AC_CONFIG_MACRO_DIR([m4])
21
22 # Check for Win32
23 AC_CANONICAL_HOST
24 AC_MSG_CHECKING([for Win32])
25 case "$host" in
26 *-*-mingw*)
27         os_win32=yes
28         ;;
29 *)
30         os_win32=no
31         ;;
32 esac
33 AC_MSG_RESULT([$os_win32])
34 AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
35
36 # Checks for programs.
37 AC_PROG_CC
38 AM_PROG_CC_C_O
39 AC_PROG_LIBTOOL
40 PKG_PROG_PKG_CONFIG
41
42 AC_PROG_LEX
43 if test "$LEX" = :; then
44         AC_MSG_ERROR([flex not found but required])
45 fi
46
47 AC_CHECK_PROGS(YACC, 'bison -y', :)
48 if test "$YACC" = :; then
49         AC_MSG_ERROR([bison not found but required])
50 fi
51
52
53 changequote(,)dnl
54 ensureflag() {
55   flag="$1"; shift
56   result="$@"
57
58   case " ${result} " in
59   *[\ \ ]${flag}[\ \    ]*) ;;
60   *) result="${flag} ${result}" ;;
61   esac
62
63   echo ${result}
64 }
65 changequote([,])dnl
66
67 if test "$GCC" = "yes"; then
68     for flag in -Wall -Wchar-subscripts -Wmissing-declarations \
69         -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align \
70         -Wsign-compare -fno-strict-aliasing;
71     do
72         CFLAGS="$(ensureflag $flag $CFLAGS)"
73     done
74 fi
75
76 # Checks for libraries.
77 GI_ENABLE_GCOV
78
79 AC_CHECK_LIB([dl], [dlopen])
80
81 AC_MSG_CHECKING(for the suffix of shared libraries)
82 # libtool variables are immediately available since 2.0, prior to that we need
83 # to call libtool --config explicitly
84 if test "x$shrext_cmds" = x; then
85     shrext_cmds=`SED=$SED ./libtool --config | grep '^shrext_cmds='`
86     eval $shrext_cmds
87 fi
88 eval std_shrext=$shrext_cmds
89 # chop the initial dot
90 SHLIB_SUFFIX=${std_shrext#.}
91 AC_MSG_RESULT(.$SHLIB_SUFFIX)
92 # any reason it may fail?
93 if test "x$SHLIB_SUFFIX" = x; then
94         AC_MSG_ERROR(Cannot determine shared library suffix from libtool)
95 fi
96 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], "$SHLIB_SUFFIX", [Define to the platform's shared library suffix])
97
98 # Copied from dbus configure.in
99 #### find the actual value for $prefix that we'll end up with
100 ##   (I know this is broken and should be done in the Makefile, but
101 ##    that's a major pain and almost nobody actually seems to care)
102 AS_AC_EXPAND(EXPANDED_LOCALSTATEDIR, "$localstatedir")
103 AS_AC_EXPAND(EXPANDED_SYSCONFDIR, "$sysconfdir")
104 AS_AC_EXPAND(EXPANDED_BINDIR, "$bindir")
105 AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir")
106 AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir")
107 AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
108
109 #### Directory to install the libexec binaries
110 GOBJECT_INTROSPECTION_LIBDIR="$EXPANDED_LIBDIR"
111 AC_SUBST(GOBJECT_INTROSPECTION_LIBDIR)
112 AC_DEFINE_UNQUOTED(GOBJECT_INTROSPECTION_LIBDIR,"$GOBJECT_INTROSPECTION_LIBDIR", [Directory prefix for typelib installation])
113
114 #### Directory to install the gir files
115 GIR_SUFFIX="gir-1.0"
116 AC_SUBST(GIR_SUFFIX)
117 AC_DEFINE_UNQUOTED(GIR_SUFFIX, "$GIR_SUFFIX", [Name of the gir directory])
118
119 GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX"
120 AC_SUBST(GIR_DIR)
121 AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Director prefix for gir installation])
122
123 PKG_CHECK_MODULES(GOBJECT, [gobject-2.0 gio-2.0])
124 PKG_CHECK_MODULES(GTHREAD, [gthread-2.0])
125 PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0], have_gio_unix=true, have_gio_unix=false)
126 AM_CONDITIONAL(HAVE_GIO_UNIX, test x$have_gio_unix = xtrue)
127
128 PKG_CHECK_MODULES(SCANNER, [gobject-2.0 gthread-2.0 gio-2.0])
129
130 dnl libffi
131 PKG_CHECK_MODULES(FFI, libffi, have_ffi_pkgconfig=yes, have_ffi_pkgconfig=no)
132 FFI_PC_CFLAGS=""
133 FFI_PC_LIBS=""
134 FFI_PC_PACKAGES=""
135 if test x"$have_ffi_pkgconfig" = xyes ; then
136     FFI_PC_PACKAGES="libffi"
137 else
138   AC_MSG_CHECKING(for ffi.h)
139
140   AC_TRY_CPP([#include <ffi.h>], have_ffi_h=yes, have_ffi_h=no)
141   if test x"$have_ffi_h" = x"yes"; then
142
143     save_LIBS=$LIBS
144     if test x"$with_ffi" = x"yes" || test x"$with_ffi" = x"auto"; then
145       other_LIBS=
146     else
147       other_LIBS=$with_ffi
148     fi
149
150     AC_SEARCH_LIBS(ffi_call,ffi,,AC_MSG_ERROR([libffi not found]),$other_LIBS)
151     if test x"$ac_cv_search_ffi_call" = x"none required" ; then
152       FFI_LIBS=$other_LIBS
153     else
154       FFI_LIBS="$ac_cv_search_ffi_call $other_LIBS"
155     fi
156
157     LIBS=$save_LIBS
158   fi
159   if test x"$have_ffi_h" != x"yes" ; then
160     AC_MSG_ERROR([ffi.h not found])
161   fi
162
163   FFI_PC_LIBS=$FFI_LIBS
164   FFI_PC_CFLAGS=$FFI_CFLAGS
165   FFI_CFLAGS=
166   AC_MSG_RESULT([$have_ffi_h])
167   AC_SUBST(FFI_LIBS)
168   AC_SUBST(FFI_CFLAGS)
169 fi
170 AC_SUBST(FFI_PC_CFLAGS)
171 AC_SUBST(FFI_PC_LIBS)
172 AC_SUBST(FFI_PC_PACKAGES)
173
174 AC_CHECK_SIZEOF(time_t, [], [#include <time.h>])
175
176 PKG_CHECK_MODULES(GIREPO, [glib-2.0 gobject-2.0 gmodule-2.0 gio-2.0])
177
178 # if we ever remove manual check for ffi and require .pc file, then 
179 # just put libffi in the PKG_CHECK_MODULES(GIREPO) deps
180 GIREPO_LIBS="$GIREPO_LIBS $GCOV_LIBS $FFI_LIBS"
181 GIREPO_CFLAGS="$GIREPO_CFLAGS $FFI_CFLAGS"
182
183 GIREPO_CFLAGS="$GIREPO_CFLAGS $GCOV_CFLAGS"
184
185 # gtk-doc
186 GTK_DOC_CHECK([1.12])
187
188 # Checks for header files.
189 AC_HEADER_STDC
190 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])
191
192 # Checks for typedefs, structures, and compiler characteristics.
193 AC_C_CONST
194
195 # Checks for library functions.
196 AC_FUNC_STRTOD
197 AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull])
198 AC_CHECK_FUNCS([backtrace backtrace_symbols])
199
200 # Python
201
202 AC_MSG_CHECKING([whether Python support is requested])
203
204 AM_PATH_PYTHON([2.5])
205 case "$host" in
206 *-*-mingw*)
207         # Change backslashes to forward slashes in pyexecdir to avoid
208         # quoting issues
209         pyexecdir=`echo $pyexecdir | tr '\\\\' '/'`
210         ;;
211 esac
212 AM_CHECK_PYTHON_HEADERS(,AC_MSG_ERROR([Python headers not found]))
213
214 # Glib documentation
215
216 GLIBSRC=
217 AC_MSG_CHECKING([for glib source directory to use for documentation])
218
219 AC_ARG_WITH(glib-src,
220         [  --with-glib-src=PATH    Source directory for glib - needed to add docs to gir],
221         GLIBSRC=$withval
222
223 AM_CONDITIONAL(WITH_GLIBSRC, test x"$GLIBSRC" != x)
224 AC_SUBST(GLIBSRC)
225 AC_MSG_RESULT([$GLIBSRC])
226
227
228
229 AC_CONFIG_FILES([
230 Makefile
231 gir/Makefile
232 girepository/Makefile
233 giscanner/Makefile
234 giscanner/config.py
235 m4/Makefile
236 tools/Makefile
237 tests/Makefile
238 tests/invoke/Makefile
239 tests/offsets/Makefile
240 tests/scanner/Makefile
241 tests/repository/Makefile
242 examples/Makefile
243 docs/Makefile
244 docs/reference/Makefile
245 gobject-introspection-1.0.pc
246 gobject-introspection-no-export-1.0.pc])
247 AC_OUTPUT