006b3e78fb4f97d59ec8203cf4c2da7e046c4030
[framework/uifw/eet.git] / configure.ac
1 y##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
2 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
3 m4_define([v_maj], [1])
4 m4_define([v_min], [4])
5 m4_define([v_mic], [999])
6 m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
7 m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
8 ##--   When released, remove the dnl on the below line
9 dnl m4_undefine([v_rev])
10 ##--   When doing snapshots - change soname. remove dnl on below line
11 dnl m4_define([relname], [ver-pre-svn-05])
12 dnl m4_define([v_rel], [-release relname])
13 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
14 m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])], [m4_define([v_ver], [v_maj.v_min.v_mic])])
15 m4_define([lt_cur], m4_eval(v_maj + v_min))
16 m4_define([lt_rev], v_mic)
17 m4_define([lt_age], v_min)
18 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
19 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
20
21 AC_INIT([eet], [v_ver], [enlightenment-devel@lists.sourceforge.net])
22 AC_PREREQ([2.52])
23 AC_CONFIG_SRCDIR([configure.ac])
24 AC_CONFIG_MACRO_DIR([m4])
25
26 AC_CONFIG_HEADERS([config.h])
27 AH_TOP([
28 #ifndef EFL_CONFIG_H__
29 #define EFL_CONFIG_H__
30 ])
31 AH_BOTTOM([
32 #endif /* EFL_CONFIG_H__ */
33 ])
34
35 AM_INIT_AUTOMAKE([1.6 dist-bzip2])
36 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
37
38 AC_LIBTOOL_WIN32_DLL
39 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
40 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
41 AC_PROG_LIBTOOL
42
43 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
44 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
45 m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
46 m4_ifdef([v_rel], , [m4_define([v_rel], [])])
47 AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
48 AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
49 AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
50 AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
51 version_info="lt_cur:lt_rev:lt_age"
52 release_info="v_rel"
53 AC_SUBST(version_info)
54 AC_SUBST(release_info)
55 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
56 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
57 VMAJ=v_maj
58 AC_SUBST(VMAJ)
59
60
61 ### Needed information
62
63 AC_CANONICAL_BUILD
64 AC_CANONICAL_HOST
65
66 ### Default options with respect to host
67
68 want_gnutls="auto"
69 want_openssl="auto"
70 want_cipher="yes"
71 want_signature="yes"
72
73 requirement_eet=""
74
75
76 ### Additional options to configure
77
78 # Amalgamation
79
80 AC_ARG_ENABLE([amalgamation],
81    [AC_HELP_STRING([--enable-amalgamation], [enable generation of one single file with all source code in it, helps compiler optimizations.])],
82    [if test "x${enableval}" = "xyes"; then
83        do_amalgamation="yes"
84     else
85        do_amalgamation="no"
86     fi
87    ],
88    [do_amalgamation="no"]
89 )
90 AM_CONDITIONAL(EET_AMALGAMATION, test "x${do_amalgamation}" = "xyes")
91
92 EFL_ENABLE_BIN([eet])
93
94 # Old eet file format support
95
96 old_eet_file_format="yes"
97 AC_ARG_ENABLE(old-eet-file-format,
98    [AC_HELP_STRING(
99       [--disable-old-eet-file-format],
100       [disable old eet file format support. [[default=enabled]]]
101     )],
102    [old_eet_file_format=$enableval]
103 )
104 AC_MSG_CHECKING([whether to support old eet file format])
105 AC_MSG_RESULT([${old_eet_file_format}])
106
107 if test "x${old_eet_file_format}" = "xyes" ; then
108    AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 1, [support old eet file format])
109 else
110    AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 0, [support old eet file format])
111 fi
112
113 # Gnutls support
114
115 AC_ARG_ENABLE([gnutls],
116    [AC_HELP_STRING([--disable-gnutls], [disable gnutls eet support])],
117    [want_gnutls=$enableval]
118 )
119 AC_MSG_CHECKING([whether to use Gnutls])
120 AC_MSG_RESULT([${want_gnutls}])
121
122 # Specific GNUTLS improvement
123
124 new_gnutls_api="yes"
125 AC_ARG_ENABLE(new-gnutls-api,
126    [AC_HELP_STRING(
127       [--disable-new-gnutls-api],
128       [enable use of gnutls_x509_crt_verify_hash. [[default=enable]]]
129     )],
130    [new_gnutls_api=$enableval]
131 )
132 AC_MSG_CHECKING([whether to use gnutls_x509_crt_verify_hash])
133 AC_MSG_RESULT([${new_gnutls_api}])
134
135 if test "x${new_gnutls_api}" = "xyes" ; then
136    AC_CHECK_LIB(gnutls, gnutls_x509_crt_verify_hash,
137                 [ new_gnutls_api="yes" ],
138                 [ new_gnutls_api="no" ]
139                 )
140
141    if test "x${new_gnutls_api}" = "xyes"; then
142       AC_DEFINE(EET_USE_NEW_GNUTLS_API, 1, [use gnutls_x509_crt_verify_hash])
143    fi
144 fi
145
146 # Openssl support
147
148 AC_ARG_ENABLE([openssl],
149    [AC_HELP_STRING([--disable-openssl], [disable openssl eet support])],
150    [want_openssl=$enableval]
151 )
152 AC_MSG_CHECKING([whether to use OpenSSL])
153 AC_MSG_RESULT([${want_openssl}])
154
155 # Cryptography support
156
157 AC_ARG_ENABLE([cipher],
158    [AC_HELP_STRING([--disable-cipher], [disable cipher support for eet API])],
159    [want_cipher=$enableval]
160 )
161 AC_MSG_CHECKING([whether to use cipher])
162 AC_MSG_RESULT([${want_cipher}])
163
164 AC_ARG_ENABLE([signature],
165    [AC_HELP_STRING([--disable-signature], [disable signature file support for eet])],
166    [want_signature=$enableval]
167 )
168 AC_MSG_CHECKING([whether to use signature])
169 AC_MSG_RESULT([${want_signature}])
170
171 # Assert or fail.
172 prefer_assert="no"
173 AC_ARG_ENABLE([assert],
174    [AC_HELP_STRING([--enable-assert], [enable assert, [[default=disabled]]])],
175    [prefer_assert=$enableval]
176 )
177
178 # Examples
179
180 AC_ARG_ENABLE([install-examples],
181    [AC_HELP_STRING([--disable-install-examples],
182        [disable installing examples (compiled or just source). @<:@default==enabled@:>@])],
183    [
184     if test "x${enableval}" = "xyes" ; then
185        install_examples="yes"
186     else
187        install_examples="no"
188     fi
189    ],
190    [install_examples="yes"])
191 AM_CONDITIONAL([INSTALL_EXAMPLES], [test "x${install_examples}" = "xyes"])
192
193 AC_ARG_ENABLE([build-examples],
194    [AC_HELP_STRING([--enable-build-examples],
195        [enable building examples. @<:@default==disabled@:>@])],
196    [
197     if test "x${enableval}" = "xyes" ; then
198        build_examples="yes"
199     else
200        build_examples="no"
201     fi
202    ],
203    [build_examples="no"])
204 AM_CONDITIONAL([BUILD_EXAMPLES], [test "x${build_examples}" = "xyes"])
205
206 # Unit tests, coverage and benchmarking
207
208 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
209 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
210
211 if test "x${prefer_assert}" = "xno"; then
212    DEBUG_CFLAGS="-DNDEBUG"
213 else
214 # use debug symbols and set DEBUG if coverage support is enabled
215    DEBUG_CFLAGS="${EFL_DEBUG_CFLAGS}"
216 fi
217 AC_SUBST(DEBUG_CFLAGS)
218
219
220 ### Checks for programs
221 AC_PROG_CC
222
223 # pkg-config
224 PKG_PROG_PKG_CONFIG
225
226 # Check whether pkg-config supports Requires.private
227 if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
228    pkgconfig_requires_private="Requires.private"
229 else
230    pkgconfig_requires_private="Requires"
231 fi
232 AC_SUBST(pkgconfig_requires_private)
233
234
235 # doxygen program for documentation building
236
237 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
238
239 ### Checks for libraries
240
241 # Evil library for compilation on Windows
242
243 EFL_EET_BUILD=""
244 case "$host_os" in
245    mingw*)
246       PKG_CHECK_MODULES([EVIL], [evil])
247       AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
248       requirement_eet="evil ${requirement_eet}"
249       EFL_EET_BUILD="-DEFL_EET_BUILD"
250    ;;
251 esac
252 AC_SUBST(EFL_EET_BUILD)
253
254 EET_LIBS=""
255 case "$host_os" in
256    mingw32ce*)
257       EET_LIBS="-lws2"
258       ;;
259    mingw*)
260       EET_LIBS="-lws2_32"
261       ;;
262 esac
263 AC_SUBST(EET_LIBS)
264
265 # Eina library
266
267 PKG_CHECK_MODULES(EINA, [eina >= 1.0.0])
268 requirement_eet="eina >= 1.0.0 ${requirement_eet}"
269
270 # Gnutls library
271 have_gnutls="no"
272 if test "x${want_gnutls}" = "xyes" || test "x${want_gnutls}" = "xauto" ; then
273    PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.7.6],
274       [
275        have_gnutls="yes"
276        want_openssl="no"
277        AC_DEFINE(HAVE_GNUTLS, 1, [Have Gnutls support])
278        requirement_eet="gnutls ${requirement_eet}"
279       ],
280       [have_gnutls="no"])
281    if test "x${have_gnutls}" = "xyes" ; then
282       AC_PATH_GENERIC([libgcrypt], [], [have_gnutls="yes"], [have_gnutls="no"])
283       if test "x${have_gnutls}" = "xyes" ; then
284          GNUTLS_CFLAGS="${GNUTLS_CFLAGS} ${LIBGCRYPT_CFLAGS}"
285          GNUTLS_LIBS="${GNUTLS_LIBS} ${LIBGCRYPT_LIBS}"
286       fi
287    fi
288 fi
289
290 # Openssl library
291 have_openssl="no"
292 if test "x${want_openssl}" = "xyes" || test "x${want_openssl}" = "xauto" ; then
293    PKG_CHECK_MODULES(OPENSSL, openssl,
294       [
295        have_openssl="yes"
296        AC_DEFINE(HAVE_OPENSSL, 1, [Have Openssl support])
297        requirement_eet="openssl ${requirement_eet}"
298       ],
299       [have_openssl="no"])
300 fi
301
302 if test "x${have_gnutls}" = "xyes" ; then
303    secure_layer="GnuTLS"
304 elif test "x${have_openssl}" = "xyes" ; then
305    secure_layer="OpenSSL"
306 else
307    secure_layer="no"
308 fi
309
310 have_cipher="no"
311 if test "x${have_gnutls}" = "xyes" && test "x${want_cipher}" = "xyes" ; then
312    have_cipher="yes"
313    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
314 elif test "x${have_openssl}" = "xyes" && test "x${want_cipher}" = "xyes" ; then
315    have_cipher="yes"
316    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
317 fi
318
319 AC_MSG_CHECKING(whether to activate cipher support in eet)
320 AC_MSG_RESULT(${have_cipher})
321
322 have_signature="no"
323 if test "x${have_gnutls}" = "xyes" && test "x${want_signature}" = "xyes" ; then
324    have_signature="yes"
325    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
326 elif test "x${have_openssl}" = "xyes" && test "x${want_signature}" = "xyes" ; then
327    have_signature="yes"
328    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
329 fi
330
331 AC_MSG_CHECKING(whether to activate signature support in eet)
332 AC_MSG_RESULT(${have_signature})
333
334 # pthread library
335
336 EFL_CHECK_THREADS(["no"],
337    [
338     if test "x${_efl_have_posix_threads}" = "xyes" ; then
339        have_threads="POSIX"
340     else
341        if test "x${_efl_have_win32_threads}" = "xyes" ; then
342           have_threads="Win32"
343        else
344           have_threads="no"
345        fi
346     fi],
347    [have_threads="no"])
348
349
350 ### Checks for header files
351
352 AC_CHECK_HEADER([zlib.h],
353    [dummy="yes"],
354    [AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
355
356 AC_CHECK_HEADER([jpeglib.h],
357    [dummy="yes"],
358    [AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
359
360 AC_CHECK_HEADERS(netinet/in.h)
361 EFL_CHECK_PATH_MAX
362
363 ### Checks for types
364
365
366 ### Checks for structures
367
368
369 ### Checks for compiler characteristics
370 AM_PROG_CC_C_O
371 AC_C_CONST
372 AC_C_INLINE
373 AC_PROG_CC_STDC
374 AC_C___ATTRIBUTE__
375
376 # Check whether the null pointer is zero on this arch
377 AC_TRY_RUN(
378    [
379 #include <stdlib.h>
380 #include <inttypes.h>
381 int main (int argc, char **argv) {
382   void *foo = NULL;
383   uintptr_t bar = (uintptr_t)foo;
384   return (uintptr_t)foo;
385 }
386    ],
387    [have_null="yes"],
388    [have_null="no"],
389    [
390     AC_MSG_WARN([Cannot check when cross-compiling -- assuming null is okay])
391     have_null="yes"
392    ])
393 AC_MSG_CHECKING([value of the null pointer])
394 AC_MSG_RESULT([${have_null}])
395
396 if test ! "x${have_null}" = "xyes" ; then
397    AC_MSG_WARN([Your system is a bit too funny, eet might not work properly])
398 fi
399
400 # These are needed for fmemopen/open_memstream
401 AC_DEFINE(_GNU_SOURCE, , [Enable GNU extensions])
402
403 EET_CPPFLAGS=""
404 EET_CFLAGS=""
405 case "$host_os" in
406    mingw32ce*)
407       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
408       ;;
409    mingw*)
410       EET_CPPFLAGS="-D_WIN32_WINNT=0x0501"
411       ;;
412 esac
413 AC_SUBST(EET_CPPFLAGS)
414 AC_SUBST(EET_CFLAGS)
415
416
417 ### Checks for linker characteristics
418
419 # use --enable-auto-import on Windows
420
421 lt_enable_auto_import=""
422 case "$host_os" in
423    mingw*)
424       lt_enable_auto_import="-Wl,--enable-auto-import"
425       ;;
426 esac
427 AC_SUBST(lt_enable_auto_import)
428
429 EFL_LINKER_FLAG([-Wl,--as-needed])
430
431 ### Checks for library functions
432 AC_ISC_POSIX
433 AC_FUNC_ALLOCA
434
435 AC_CHECK_FUNCS(fmemopen open_memstream realpath)
436
437 EFL_CHECK_FNMATCH([], [AC_MSG_ERROR([Cannot find fnmatch()])])
438
439
440 AC_SUBST(requirement_eet)
441
442 AC_OUTPUT([
443 Makefile
444 eet.pc
445 doc/Makefile
446 doc/eet.dox
447 src/Makefile
448 src/lib/Makefile
449 src/bin/Makefile
450 src/tests/Makefile
451 src/examples/Makefile
452 README
453 eet.spec
454 ])
455
456
457 #####################################################################
458 ## Info
459
460 echo
461 echo
462 echo
463 echo "------------------------------------------------------------------------"
464 echo "$PACKAGE_NAME $PACKAGE_VERSION"
465 echo "------------------------------------------------------------------------"
466 echo
467 echo "Configuration Options Summary:"
468 echo
469 echo "  Amalgamation.........: ${do_amalgamation}"
470 echo "  Secure layer.........: ${secure_layer}"
471 if test "x${have_gnutls}" = "xyes" || test "x${have_openssl}" = "xyes" ; then
472    echo "    Cipher support.....: ${have_cipher}"
473    echo "    Signature..........: ${have_signature}"
474 fi
475 echo "  Thread Support.......: ${have_threads}"
476 echo
477 echo "  Old eet file format..: ${old_eet_file_format}"
478 echo
479 echo "  Tests................: ${enable_tests}"
480 echo "  Coverage.............: ${enable_coverage}"
481 echo
482 echo "  Build eet............: $have_eet"
483 echo
484 echo "  Documentation........: ${build_doc}"
485 if test "x${build_doc}" = "xyes" ; then
486    echo "    Building...........: make doc"
487 fi
488 echo "  Examples.............: ${build_examples}"
489 if test "x${build_examples}" = "xyes" ; then
490    echo "    Install............: ${install_examples}"
491 fi
492 echo
493 echo "Compilation............: make (or gmake)"
494 echo "  CPPFLAGS.............: $CPPFLAGS"
495 echo "  CFLAGS...............: $CFLAGS"
496 echo "  LDFLAGS..............: $LDFLAGS"
497 echo
498 echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
499 echo "  prefix...............: $prefix"
500 echo