* eet: Add a faster way to compute signature. But currently need my pending patch...
[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 # Specific GNUTLS improvement
79
80 new_gnutls_api="no"
81 AC_ARG_ENABLE(new-gnutls-api,
82    [AC_HELP_STRING(
83       [--enable-new-gnutls-api],
84       [enable use of gnutls_x509_crt_verify_hash. [[default=disable]]]
85     )],
86    [new_gnutls_api=$enableval]
87 )
88 AC_MSG_CHECKING([whether to use gnutls_x509_crt_verify_hash])
89 AC_MSG_RESULT([${new_gnutls_api}])
90
91 if test "x${new_gnutls_api}" = "xyes" ; then
92    AC_DEFINE(EET_USE_NEW_GNUTLS_API, 1, [use gnutls_x509_crt_verify_hash])
93 else
94    AC_DEFINE(EET_USE_NEW_GNUTLS_API, 0, [don't use gnutls_x509_crt_verify_hash])
95 fi
96
97 # Openssl support
98
99 AC_ARG_ENABLE([openssl],
100    [AC_HELP_STRING([--disable-openssl], [disable openssl eet support])],
101    [want_openssl=$enableval]
102 )
103 AC_MSG_CHECKING([whether to use OpenSSL])
104 AC_MSG_RESULT([${want_openssl}])
105
106 # Cryptography support
107
108 AC_ARG_ENABLE([cipher],
109    [AC_HELP_STRING([--disable-cipher], [disable cipher support for eet API])],
110    [want_cipher=$enableval]
111 )
112 AC_MSG_CHECKING([whether to use cipher])
113 AC_MSG_RESULT([${want_cipher}])
114
115 AC_ARG_ENABLE([signature],
116    [AC_HELP_STRING([--disable-signature], [disable signature file support for eet])],
117    [want_signature=$enableval]
118 )
119 AC_MSG_CHECKING([whether to use signature])
120 AC_MSG_RESULT([${want_signature}])
121
122 # Assert or fail.
123 prefer_assert="no"
124 AC_ARG_ENABLE([assert],
125    [AC_HELP_STRING([--enable-assert], [enable assert, [[default=disabled]]])],
126    [prefer_assert=$enableval]
127 )
128
129 # Unit tests, coverage and benchmarking
130
131 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
132 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
133
134 if test "x${prefer_assert}" = "xno"; then
135    DEBUG_CFLAGS="-DNDEBUG"
136 else
137 # use debug symbols and set DEBUG if coverage support is enabled
138    DEBUG_CFLAGS="${EFL_DEBUG_CFLAGS}"
139 fi
140 AC_SUBST(DEBUG_CFLAGS)
141
142
143 ### Checks for programs
144 AC_PROG_CC
145
146 # doxygen program for documentation building
147
148 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
149
150
151 ### Checks for libraries
152
153 # Evil library for compilation on Windows
154
155 EFL_EET_BUILD=""
156 case "$host_os" in
157    mingw* | cegcc*)
158       PKG_CHECK_MODULES([EVIL], [evil])
159       AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
160       requirement_eet="evil ${requirement_eet}"
161       EFL_EET_BUILD="-DEFL_EET_BUILD"
162    ;;
163 esac
164 AC_SUBST(EFL_EET_BUILD)
165
166 EET_LIBS=""
167 case "$host_os" in
168    mingw32ce*)
169       EET_LIBS="-lws2"
170       ;;
171    cegcc*)
172       EET_LIBS="-lws2"
173       ;;
174    mingw*)
175       EET_LIBS="-lws2_32"
176       ;;
177 esac
178 AC_SUBST(EET_LIBS)
179
180 # Eina library
181
182 PKG_CHECK_MODULES(EINA, [eina-0])
183 requirement_eet="eina-0 ${requirement_eet}"
184
185 # Gnutls library
186 have_gnutls="no"
187 if test "x${want_gnutls}" = "xyes" -o "x${want_gnutls}" = "xauto" ; then
188    PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.7.6],
189       [
190        have_gnutls="yes"
191        want_openssl="no"
192        AC_DEFINE(HAVE_GNUTLS, 1, [Have Gnutls support])
193        requirement_eet="gnutls ${requirement_eet}"
194       ],
195       [
196        have_gnutls="no"
197       ])
198 fi
199
200 # Openssl library
201 have_openssl="no"
202 if test "x${want_openssl}" = "xyes" -o "x${want_openssl}" = "xauto" ; then
203    PKG_CHECK_MODULES(OPENSSL, openssl,
204       [
205        have_openssl="yes"
206        AC_DEFINE(HAVE_OPENSSL, 1, [Have Openssl support])
207        requirement_eet="openssl ${requirement_eet}"
208       ],
209       [have_openssl="no"])
210 fi
211
212 have_cipher="no"
213 if test "x${have_gnutls}" = "xyes" -a "x${want_cipher}" = "xyes" ; then
214    have_cipher="yes"
215    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
216 elif test "x${have_openssl}" = "xyes" -a "x${want_cipher}" = "xyes" ; then
217    have_cipher="yes"
218    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
219 fi
220
221 AC_MSG_CHECKING(whether to activate cipher support in eet)
222 AC_MSG_RESULT(${have_cipher})
223
224 have_signature="no"
225 if test "x${have_gnutls}" = "xyes" -a "x${want_signature}" = "xyes" ; then
226    have_signature="yes"
227    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
228 elif test "x${have_openssl}" = "xyes" -a "x${want_signature}" = "xyes" ; then
229    have_signature="yes"
230    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
231 fi
232
233 AC_MSG_CHECKING(whether to activate signature support in eet)
234 AC_MSG_RESULT(${have_signature})
235
236
237 ### Checks for header files
238
239 AC_CHECK_HEADER([zlib.h],
240    [dummy="yes"],
241    [AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
242
243 AC_CHECK_HEADER([jpeglib.h],
244    [dummy="yes"],
245    [AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
246
247 AC_CHECK_HEADERS(netinet/in.h)
248
249 AC_CHECK_HEADER([fnmatch.h],
250    [dummy="yes"],
251    [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])])
252
253
254 ### Checks for types
255
256
257 ### Checks for structures
258
259
260 ### Checks for compiler characteristics
261 AM_PROG_CC_C_O
262 AC_C_CONST
263 AC_C_INLINE
264 AC_PROG_CC_STDC
265 AC_C___ATTRIBUTE__
266
267 # Check whether the null pointer is zero on this arch
268 AC_TRY_RUN(
269    [
270 #include <stdlib.h>
271 int main (int argc, char **argv) {
272   void *foo = NULL;
273   int bar = (int)foo;
274   return (int)foo;
275 }
276    ],
277    [have_null="yes"],
278    [have_null="no"],
279    [
280     AC_MSG_WARN([Cannot check when cross-compiling -- assuming null is okay])
281     have_null="yes"
282    ])
283 AC_MSG_CHECKING([value of the null pointer])
284 AC_MSG_RESULT([${have_null}])
285
286 if test ! "x${have_null}" = "xyes" ; then
287    AC_MSG_WARN([Your system is a bit too funny, eet might not work properly])
288 fi
289
290 # These are needed for fmemopen/open_memstream
291 AC_DEFINE(_GNU_SOURCE, , [Enable GNU extensions])
292
293 EET_CPPFLAGS=""
294 EET_CFLAGS=""
295 case "$host_os" in
296    mingw32ce*)
297       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
298       ;;
299    cegcc*)
300       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
301       EET_CFLAGS="-mwin32"
302       ;;
303 esac
304 AC_SUBST(EET_CPPFLAGS)
305 AC_SUBST(EET_CFLAGS)
306
307
308 ### Checks for linker characteristics
309
310 # use --enable-auto-import on Windows
311
312 lt_enable_auto_import=""
313 case "$host_os" in
314    mingw* | cegcc*)
315       lt_enable_auto_import="-Wl,--enable-auto-import"
316       ;;
317 esac
318 AC_SUBST(lt_enable_auto_import)
319
320 # use --as-needed if supported
321
322 LDFLAGS_SAVE=${LDFLAGS}
323 LDFLAGS="${LDFLAGS} -Wl,--as-needed"
324
325 AC_LINK_IFELSE(
326    [AC_LANG_PROGRAM([[]], [])],
327    [ld_as_needed="-Wl,--as-needed"],
328    [ld_as_needed=""]
329 )
330
331 LDFLAGS=${LDFLAGS_SAVE}
332 AC_SUBST(ld_as_needed)
333
334
335 ### Checks for library functions
336 AC_FUNC_ALLOCA
337
338 AC_CHECK_FUNCS(fmemopen open_memstream realpath)
339
340 fnmatch_libs=""
341 AC_CHECK_FUNCS([fnmatch], [res="yes"], [res="no"])
342 if test "x$res" = "xno"; then
343    AC_SEARCH_LIBS([fnmatch],
344       [fnmatch evil iberty],
345       [res="yes"],
346       [res="no"])
347    if test "x$res" = "xno"; then
348       AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty, nor libevil])
349    fi
350    fnmatch_libs="${ac_cv_search_fnmatch}"
351 fi
352 AC_SUBST(fnmatch_libs)
353
354
355 AC_SUBST(requirement_eet)
356
357 AC_OUTPUT([
358 Makefile
359 eet.pc
360 doc/Makefile
361 doc/eet.dox
362 src/Makefile
363 src/lib/Makefile
364 src/bin/Makefile
365 src/tests/Makefile
366 README
367 eet.spec
368 ])
369
370
371 #####################################################################
372 ## Info
373
374 echo
375 echo
376 echo
377 echo "------------------------------------------------------------------------"
378 echo "$PACKAGE_NAME $PACKAGE_VERSION"
379 echo "------------------------------------------------------------------------"
380 echo
381 echo "Configuration Options Summary:"
382 echo
383 echo "  Gnutls...............: ${have_gnutls}"
384 echo "  Openssl..............: ${have_openssl}"
385 echo "    Cipher support.....: ${have_cipher}"
386 echo "    Signature..........: ${have_signature}"
387 echo
388 echo "  Documentation........: ${build_doc}"
389 echo "  Tests................: ${enable_tests}"
390 echo "  Coverage.............: ${enable_coverage}"
391 echo
392 echo "  Old eet file format..: ${old_eet_file_format}"
393 echo
394 echo "  Compilation..........: make"
395 echo
396 echo "  Installation.........: make install"
397 echo
398 echo "    prefix.............: $prefix"
399 echo