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