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