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