fix @dates in each header file
[framework/uifw/eet.git] / configure.ac
1 y##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
2 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
3 m4_define([v_maj], [1])
4 m4_define([v_min], [5])
5 m4_define([v_mic], [99])
6 m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || 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 >= 1.0.0])
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.1.0])
268 requirement_eet="eina >= 1.1.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 ### Checks for header files
335
336 AC_CHECK_HEADER([zlib.h],
337    [dummy="yes"],
338    [AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
339
340 AC_CHECK_HEADER([jpeglib.h],
341    [dummy="yes"],
342    [AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
343
344 AC_CHECK_HEADERS(netinet/in.h unistd.h)
345 EFL_CHECK_PATH_MAX
346
347 ### Checks for types
348
349
350 ### Checks for structures
351
352
353 ### Checks for compiler characteristics
354 AM_PROG_CC_C_O
355 AC_C_CONST
356 AC_C_INLINE
357 AC_PROG_CC_STDC
358 AC_C___ATTRIBUTE__
359
360 # Check whether the null pointer is zero on this arch
361 AC_TRY_RUN(
362    [
363 #include <stdlib.h>
364 #include <inttypes.h>
365 int main (int argc, char **argv) {
366   void *foo = NULL;
367   uintptr_t bar = (uintptr_t)foo;
368   return (uintptr_t)foo;
369 }
370    ],
371    [have_null="yes"],
372    [have_null="no"],
373    [
374     AC_MSG_WARN([Cannot check when cross-compiling -- assuming null is okay])
375     have_null="yes"
376    ])
377 AC_MSG_CHECKING([value of the null pointer])
378 AC_MSG_RESULT([${have_null}])
379
380 if test ! "x${have_null}" = "xyes" ; then
381    AC_MSG_WARN([Your system is a bit too funny, eet might not work properly])
382 fi
383
384 # These are needed for fmemopen/open_memstream
385 AC_DEFINE(_GNU_SOURCE, , [Enable GNU extensions])
386
387 EET_CPPFLAGS=""
388 EET_CFLAGS=""
389 case "$host_os" in
390    mingw32ce*)
391       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
392       ;;
393    mingw*)
394       EET_CPPFLAGS="-D_WIN32_WINNT=0x0501"
395       ;;
396 esac
397 AC_SUBST(EET_CPPFLAGS)
398 AC_SUBST(EET_CFLAGS)
399
400
401 ### Checks for linker characteristics
402
403 # use --enable-auto-import on Windows
404
405 lt_enable_auto_import=""
406 case "$host_os" in
407    mingw*)
408       lt_enable_auto_import="-Wl,--enable-auto-import"
409       ;;
410 esac
411 AC_SUBST(lt_enable_auto_import)
412
413 case "${host_os}" in
414    openbsd*)
415       ;;
416    *)
417       EFL_LINKER_FLAG([-Wl,--as-needed])
418       ;;
419 esac
420
421
422 ### Checks for library functions
423 AC_ISC_POSIX
424 AC_FUNC_ALLOCA
425
426 AC_CHECK_FUNCS(fmemopen open_memstream realpath)
427
428 EFL_CHECK_FNMATCH([], [AC_MSG_ERROR([Cannot find fnmatch()])])
429
430
431 AC_SUBST(requirement_eet)
432
433 AC_OUTPUT([
434 Makefile
435 eet.pc
436 doc/Makefile
437 doc/Doxyfile
438 doc/eet.dox
439 src/Makefile
440 src/lib/Makefile
441 src/bin/Makefile
442 src/tests/Makefile
443 src/examples/Makefile
444 eet.spec
445 ])
446
447
448 #####################################################################
449 ## Info
450
451 echo
452 echo
453 echo
454 echo "------------------------------------------------------------------------"
455 echo "$PACKAGE_NAME $PACKAGE_VERSION"
456 echo "------------------------------------------------------------------------"
457 echo
458 echo "Configuration Options Summary:"
459 echo
460 echo "  Amalgamation.........: ${do_amalgamation}"
461 echo "  Secure layer.........: ${secure_layer}"
462 if test "x${have_gnutls}" = "xyes" || test "x${have_openssl}" = "xyes" ; then
463    echo "    Cipher support.....: ${have_cipher}"
464    echo "    Signature..........: ${have_signature}"
465 fi
466 echo
467 echo "  Old eet file format..: ${old_eet_file_format}"
468 echo
469 echo "  Tests................: ${enable_tests}"
470 echo "  Coverage.............: ${enable_coverage}"
471 echo
472 echo "  Build eet............: $have_eet"
473 echo
474 echo "  Documentation........: ${build_doc}"
475 if test "x${build_doc}" = "xyes" ; then
476    echo "    Building...........: make doc"
477 fi
478 echo "  Examples.............: ${build_examples}"
479 if test "x${build_examples}" = "xyes" ; then
480    echo "    Install............: ${install_examples}"
481 fi
482 echo
483 echo "Compilation............: make (or gmake)"
484 echo "  CPPFLAGS.............: $CPPFLAGS"
485 echo "  CFLAGS...............: $CFLAGS"
486 echo "  LDFLAGS..............: $LDFLAGS"
487 echo
488 echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
489 echo "  prefix...............: $prefix"
490 echo