Forgot these files
[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, 5)
7 m4_define(gi_micro_version, 1)
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)
13 AM_INIT_AUTOMAKE([1.7 -Wno-portability])
14 AM_MAINTAINER_MODE
15 AC_CONFIG_HEADER([config.h])
16
17 AC_CONFIG_MACRO_DIR([m4])
18
19 # Check for Win32
20 AC_CANONICAL_HOST
21 AC_MSG_CHECKING([for Win32])
22 case "$host" in
23 *-*-mingw*)
24         os_win32=yes
25         ;;
26 *)
27         os_win32=no
28         ;;
29 esac
30 AC_MSG_RESULT([$os_win32])
31 AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
32
33 # Checks for programs.
34 AC_PROG_CC
35 AM_PROG_CC_C_O
36 AC_PROG_LIBTOOL
37 PKG_PROG_PKG_CONFIG
38
39 AC_PROG_LEX
40 if test "$LEX" = :; then
41         AC_MSG_ERROR([flex not found but required])
42 fi
43
44 AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc, :)
45 if test "$YACC" = :; then
46         AC_MSG_ERROR([bison not found but required])
47 fi
48
49 changequote(,)dnl
50 ensureflag() {
51   flag="$1"; shift
52   result="$@"
53
54   case " ${result} " in
55   *[\ \ ]${flag}[\ \    ]*) ;;
56   *) result="${flag} ${result}" ;;
57   esac
58
59   echo ${result}
60 }
61 changequote([,])dnl
62
63 if test "$GCC" = "yes"; then
64     for flag in -Wall -Wchar-subscripts -Wmissing-declarations \
65         -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align \
66         -Wsign-compare -fno-strict-aliasing;
67     do
68         CFLAGS="$(ensureflag $flag $CFLAGS)"
69     done
70 fi
71
72 # Checks for libraries.
73 GI_ENABLE_GCOV
74
75 AC_CHECK_LIB([dl], [dlopen])
76
77 AC_MSG_CHECKING(for the suffix of shared libraries)
78 export SED
79 shrext_cmds=`./libtool --config | grep '^shrext_cmds='`
80 eval $shrext_cmds
81 eval std_shrext=$shrext_cmds
82 # chop the initial dot
83 SHLIB_SUFFIX=`echo $std_shrext | sed 's/^\.//'`
84 AC_MSG_RESULT(.$SHLIB_SUFFIX)
85 # any reason it may fail?
86 if test "X$SHLIB_SUFFIX" = x; then
87         AC_MSG_ERROR(Cannot determine shared library suffix from libtool)
88 fi
89 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], "$SHLIB_SUFFIX", [Define to the platform's shared library suffix])
90
91 PKG_CHECK_MODULES(GOBJECT, [gobject-2.0])
92
93 PKG_CHECK_MODULES(SCANNER, [gobject-2.0 gthread-2.0])
94
95 dnl libffi
96 PKG_CHECK_MODULES(FFI, libffi, have_ffi_pkgconfig=yes, have_ffi_pkgconfig=no)
97
98 if test x"$have_ffi_pkgconfig" = xno ; then
99   AC_MSG_CHECKING(for ffi.h)
100
101   AC_TRY_CPP([#include <ffi.h>], have_ffi_h=yes, have_ffi_h=no)
102   if test x"$have_ffi_h" = x"yes"; then
103
104     save_LIBS=$LIBS
105     if test x"$with_ffi" = x"yes" || test x"$with_ffi" = x"auto"; then
106       other_LIBS=
107     else
108       other_LIBS=$with_ffi
109     fi
110
111     AC_SEARCH_LIBS(ffi_call,ffi,,AC_MSG_ERROR([libffi not found]),$other_LIBS)
112     if test x"$ac_cv_search_ffi_call" = x"none required" ; then
113       FFI_LIBS=$other_LIBS
114     else
115       FFI_LIBS="$ac_cv_search_ffi_call $other_LIBS"
116     fi
117
118     LIBS=$save_LIBS
119   fi
120   if test x"$have_ffi_h" != x"yes" ; then
121     AC_MSG_ERROR([ffi.h not found])
122   fi
123
124   FFI_CFLAGS=
125
126   AC_MSG_RESULT([$have_ffi_h])
127   AC_SUBST(FFI_LIBS)
128   AC_SUBST(FFI_CFLAGS)
129 fi
130
131 PKG_CHECK_MODULES(GIREPO, [glib-2.0 gobject-2.0 gmodule-2.0])
132
133 # if we ever remove manual check for ffi and require .pc file, then 
134 # just put libffi in the PKG_CHECK_MODULES(GIREPO) deps
135 GIREPO_LIBS="$GIREPO_LIBS $GCOV_LIBS $FFI_LIBS"
136 GIREPO_CFLAGS="$GIREPO_CFLAGS $FFI_CFLAGS"
137
138 GIREPO_CFLAGS="$GIREPO_CFLAGS $GCOV_CFLAGS"
139
140 # Checks for header files.
141 AC_HEADER_STDC
142 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])
143
144 # Checks for typedefs, structures, and compiler characteristics.
145 AC_C_CONST
146
147 # Checks for library functions.
148 AC_FUNC_STRTOD
149 AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull])
150 AC_CHECK_FUNCS([backtrace backtrace_symbols])
151
152 # Python
153
154 AC_MSG_CHECKING([whether Python support is requested])
155
156 AM_PATH_PYTHON([2.5])
157 case "$host" in
158 *-*-mingw*)
159         # Change backslashes to forward slashes in pyexecdir to avoid
160         # quoting issues
161         pyexecdir=`echo $pyexecdir | tr '\\\\' '/'`
162         ;;
163 esac
164 AM_CHECK_PYTHON_HEADERS
165
166 AC_CONFIG_FILES([
167 Makefile
168 gir/Makefile
169 girepository/Makefile
170 giscanner/Makefile
171 giscanner/config.py
172 m4/Makefile
173 tools/Makefile
174 tests/Makefile
175 tests/invoke/Makefile
176 tests/scanner/Makefile
177 tests/repository/Makefile
178 tests/types/Makefile
179 gobject-introspection-1.0.pc])
180 AC_OUTPUT