check fnmatch in evil before iberty (for mingw users)
[framework/uifw/eet.git] / configure.ac
1 # get rid of that stupid cache mechanism
2 rm -f config.cache
3
4 AC_INIT([eet], [1.1.0], [enlightenment-devel@lists.sourceforge.net])
5 AC_PREREQ([2.52])
6 AC_CONFIG_SRCDIR([configure.ac])
7 AC_CONFIG_MACRO_DIR([m4])
8 AC_CANONICAL_BUILD
9 AC_CANONICAL_HOST
10 AC_ISC_POSIX
11
12 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
13 AM_CONFIG_HEADER(config.h)
14
15 AC_LIBTOOL_WIN32_DLL
16 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
17 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
18 AC_PROG_LIBTOOL
19
20 VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
21 VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
22 VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
23 SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
24 version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
25 AC_SUBST(version_info)
26
27
28 ### Default options with respect to host
29
30 case "$host_os" in
31    mingw* | cegcc*)
32       want_gnutls="no"
33       want_openssl="no"
34       want_cipher="no"
35       want_signature="no"
36       ;;
37    *)
38       want_gnutls="auto"
39       want_openssl="auto"
40       want_cipher="yes"
41       want_signature="yes"
42       ;;
43 esac
44
45 requirement_eet=""
46
47
48 ### Additional options to configure
49
50 # Old eet file format support
51
52 old_eet_file_format="yes"
53 AC_ARG_ENABLE(old-eet-file-format,
54    [AC_HELP_STRING(
55       [--disable-old-eet-file-format],
56       [disable old eet file format support. [[default=enabled]]]
57     )],
58    [old_eet_file_format=$enableval]
59 )
60 AC_MSG_CHECKING([whether to support old eet file format])
61 AC_MSG_RESULT([${old_eet_file_format}])
62
63 if test "x${old_eet_file_format}" = "xyes" ; then
64    AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 1, [support old eet file format])
65 else
66    AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 0, [support old eet file format])
67 fi
68
69 # Gnutls support
70
71 AC_ARG_ENABLE([gnutls],
72    [AC_HELP_STRING([--disable-gnutls], [disable gnutls eet support])],
73    [want_gnutls=$enableval]
74 )
75 AC_MSG_CHECKING([whether to use Gnutls])
76 AC_MSG_RESULT([${want_gnutls}])
77
78 # Openssl support
79
80 AC_ARG_ENABLE([openssl],
81    [AC_HELP_STRING([--disable-openssl], [disable openssl eet support])],
82    [want_openssl=$enableval]
83 )
84 AC_MSG_CHECKING([whether to use OpenSSL])
85 AC_MSG_RESULT([${want_openssl}])
86
87 # Cryptography support
88
89 AC_ARG_ENABLE([cipher],
90    [AC_HELP_STRING([--disable-cipher], [disable cipher support for eet API])],
91    [want_cipher=$enableval]
92 )
93 AC_MSG_CHECKING([whether to use cipher])
94 AC_MSG_RESULT([${want_cipher}])
95
96 AC_ARG_ENABLE([signature],
97    [AC_HELP_STRING([--disable-signature], [disable signature file support for eet])],
98    [want_signature=$enableval]
99 )
100 AC_MSG_CHECKING([whether to use signature])
101 AC_MSG_RESULT([${want_signature}])
102
103 # Assert or fail.
104 prefer_assert="no"
105 AC_ARG_ENABLE([assert],
106    [AC_HELP_STRING([--enable-assert], [enable assert, [[default=disabled]]])],
107    [prefer_assert=$enableval]
108 )
109
110 # Unit tests, coverage and benchmarking
111
112 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
113 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
114
115 if test "x${prefer_assert}" = "xno"; then
116    DEBUG_CFLAGS="-DNDEBUG"
117 else
118 # use debug symbols and set DEBUG if coverage support is enabled
119    DEBUG_CFLAGS="${EFL_DEBUG_CFLAGS}"
120 fi
121 AC_SUBST(DEBUG_CFLAGS)
122
123
124 ### Checks for programs
125 AC_PROG_CC
126
127 # doxygen program for documentation building
128
129 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
130
131
132 ### Checks for libraries
133
134 # Evil library for compilation on Windows
135
136 EFL_EET_BUILD=""
137 case "$host_os" in
138    mingw* | cegcc*)
139       PKG_CHECK_MODULES([EVIL], [evil])
140       AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
141       requirement_eet="evil ${requirement_eet}"
142       EFL_EET_BUILD="-DEFL_EET_BUILD"
143    ;;
144 esac
145 AC_SUBST(EFL_EET_BUILD)
146
147 EET_LIBS=""
148 case "$host_os" in
149    mingw32ce*)
150       EET_LIBS="-lws2"
151       ;;
152    cegcc*)
153       EET_LIBS="-lws2"
154       ;;
155    mingw*)
156       EET_LIBS="-lws2_32"
157       ;;
158 esac
159 AC_SUBST(EET_LIBS)
160
161 # Eina library
162
163 PKG_CHECK_MODULES(EINA, [eina-0])
164 requirement_eet="eina-0 ${requirement_eet}"
165
166 # Gnutls library
167 have_gnutls="no"
168 if test "x${want_gnutls}" = "xyes" -o "x${want_gnutls}" = "xauto" ; then
169    PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.7.6],
170       [
171        have_gnutls="yes"
172        AC_DEFINE(HAVE_GNUTLS, 1, [Have Gnutls support])
173        requirement_eet="gnutls ${requirement_eet}"
174       ],
175       [
176        have_gnutls="no"
177       ])
178 fi
179
180 # Openssl library
181 have_openssl="no"
182 if test "x${want_openssl}" = "xyes" -o "x${want_openssl}" = "xauto" ; then
183    PKG_CHECK_MODULES(OPENSSL, openssl,
184       [
185        have_openssl="yes"
186        AC_DEFINE(HAVE_OPENSSL, 1, [Have Openssl support])
187        requirement_eet="openssl ${requirement_eet}"
188       ],
189       [have_openssl="no"])
190 fi
191
192 have_cipher="no"
193 if test "x${have_gnutls}" = "xyes" -a "x${want_cipher}" = "xyes" ; then
194    have_cipher="yes"
195    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
196 elif test "x${have_openssl}" = "xyes" -a "x${want_cipher}" = "xyes" ; then
197    have_cipher="yes"
198    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
199 fi
200
201 AC_MSG_CHECKING(whether to activate cipher support in eet)
202 AC_MSG_RESULT(${have_cipher})
203
204 have_signature="no"
205 if test "x${have_gnutls}" = "xyes" -a "x${want_signature}" = "xyes" ; then
206    have_signature="yes"
207    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
208 elif test "x${have_openssl}" = "xyes" -a "x${want_signature}" = "xyes" ; then
209    have_signature="yes"
210    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
211 fi
212
213 AC_MSG_CHECKING(whether to activate signature support in eet)
214 AC_MSG_RESULT(${have_signature})
215
216
217 ### Checks for header files
218
219 AC_CHECK_HEADER([zlib.h],
220    [dummy="yes"],
221    [AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
222
223 AC_CHECK_HEADER([jpeglib.h],
224    [dummy="yes"],
225    [AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
226
227 AC_CHECK_HEADERS(netinet/in.h)
228
229 AC_CHECK_HEADER([fnmatch.h],
230    [dummy="yes"],
231    [AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file. MinGW users: see the INSTALL file])])
232
233
234 ### Checks for types
235
236
237 ### Checks for structures
238
239
240 ### Checks for compiler characteristics
241 AM_PROG_CC_C_O
242 AC_C_CONST
243 AC_C_INLINE
244 AC_PROG_CC_STDC
245 AC_C___ATTRIBUTE__
246
247 # Check whether the null pointer is zero on this arch
248 AC_TRY_RUN(
249    [
250 #include <stdlib.h>
251 int main (int argc, char **argv) {
252   void *foo = NULL;
253   int bar = (int)foo;
254   return (int)foo;
255 }
256    ],
257    [have_null="yes"],
258    [have_null="no"],
259    [
260     AC_MSG_WARN([Cannot check when cross-compiling -- assuming null is okay])
261     have_null="yes"
262    ])
263 AC_MSG_CHECKING([value of the null pointer])
264 AC_MSG_RESULT([${have_null}])
265
266 if test ! "x${have_null}" = "xyes" ; then
267    AC_MSG_WARN([Your system is a bit too funny, eet might not work properly])
268 fi
269
270 # These are needed for fmemopen/open_memstream
271 AC_DEFINE(_GNU_SOURCE, , [Enable GNU extensions])
272
273 EET_CPPFLAGS=""
274 EET_CFLAGS=""
275 case "$host_os" in
276    mingw32ce*)
277       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
278       ;;
279    cegcc*)
280       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
281       EET_CFLAGS="-mwin32"
282       ;;
283 esac
284 AC_SUBST(EET_CPPFLAGS)
285 AC_SUBST(EET_CFLAGS)
286
287
288 ### Checks for linker characteristics
289
290 lt_enable_auto_import=""
291 case "$host_os" in
292    mingw* | cegcc*)
293       lt_enable_auto_import="-Wl,--enable-auto-import"
294       ;;
295 esac
296 AC_SUBST(lt_enable_auto_import)
297
298
299 ### Checks for library functions
300 AC_FUNC_ALLOCA
301
302 AC_CHECK_FUNCS(fmemopen open_memstream realpath)
303
304 fnmatch_libs=""
305 AC_CHECK_FUNCS([fnmatch], [res="yes"], [res="no"])
306 if test "x$res" = "xno"; then
307    AC_SEARCH_LIBS([fnmatch],
308       [fnmatch evil iberty],
309       [res="yes"],
310       [res="no"])
311    if test "x$res" = "xno"; then
312       AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty, nor libevil])
313    fi
314    fnmatch_libs="${ac_cv_search_fnmatch}"
315 fi
316 AC_SUBST(fnmatch_libs)
317
318
319 AC_SUBST(requirement_eet)
320
321 AC_OUTPUT([
322 Makefile
323 eet.pc
324 doc/Makefile
325 doc/eet.dox
326 src/Makefile
327 src/lib/Makefile
328 src/bin/Makefile
329 src/tests/Makefile
330 README
331 eet.spec
332 ])
333
334
335 #####################################################################
336 ## Info
337
338 echo
339 echo
340 echo
341 echo "------------------------------------------------------------------------"
342 echo "$PACKAGE_NAME $PACKAGE_VERSION"
343 echo "------------------------------------------------------------------------"
344 echo
345 echo "Configuration Options Summary:"
346 echo
347 echo "  Gnutls...............: ${have_gnutls}"
348 echo "  Openssl..............: ${have_openssl}"
349 echo "    Cipher support.....: ${have_cipher}"
350 echo "    Signature..........: ${have_signature}"
351 echo
352 echo "  Documentation........: ${enable_doc}"
353 echo "  Tests................: ${enable_tests}"
354 echo "  Coverage.............: ${enable_coverage}"
355 echo
356 echo "  Old eet file format..: ${old_eet_file_format}"
357 echo
358 echo "  Compilation..........: make"
359 echo
360 echo "  Installation.........: make install"
361 echo
362 echo "    prefix.............: $prefix"
363 echo