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