6ddfd2ec6f91a82eb5143aab592897324ef733f9
[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 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 # Unit tests, coverage and benchmarking
155
156 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
157 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
158
159 if test "x${prefer_assert}" = "xno"; then
160    DEBUG_CFLAGS="-DNDEBUG"
161 else
162 # use debug symbols and set DEBUG if coverage support is enabled
163    DEBUG_CFLAGS="${EFL_DEBUG_CFLAGS}"
164 fi
165 AC_SUBST(DEBUG_CFLAGS)
166
167
168 ### Checks for programs
169 AC_PROG_CC
170
171 # pkg-config
172 PKG_PROG_PKG_CONFIG
173
174 # Check whether pkg-config supports Requires.private
175 if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
176    pkgconfig_requires_private="Requires.private"
177 else
178    pkgconfig_requires_private="Requires"
179 fi
180 AC_SUBST(pkgconfig_requires_private)
181
182
183 # doxygen program for documentation building
184
185 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
186
187 ### Checks for libraries
188
189 # Evil library for compilation on Windows
190
191 EFL_EET_BUILD=""
192 case "$host_os" in
193    mingw* | cegcc*)
194       PKG_CHECK_MODULES([EVIL], [evil])
195       AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
196       requirement_eet="evil ${requirement_eet}"
197       EFL_EET_BUILD="-DEFL_EET_BUILD"
198    ;;
199 esac
200 AC_SUBST(EFL_EET_BUILD)
201
202 EET_LIBS=""
203 case "$host_os" in
204    mingw32ce*)
205       EET_LIBS="-lws2"
206       ;;
207    cegcc*)
208       EET_LIBS="-lws2"
209       ;;
210    mingw*)
211       EET_LIBS="-lws2_32"
212       ;;
213 esac
214 AC_SUBST(EET_LIBS)
215
216 # Eina library
217
218 PKG_CHECK_MODULES(EINA, [eina-0])
219 requirement_eet="eina-0 ${requirement_eet}"
220
221 # Gnutls library
222 have_gnutls="no"
223 if test "x${want_gnutls}" = "xyes" -o "x${want_gnutls}" = "xauto" ; then
224    PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.7.6],
225       [
226        have_gnutls="yes"
227        want_openssl="no"
228        AC_DEFINE(HAVE_GNUTLS, 1, [Have Gnutls support])
229        requirement_eet="gnutls ${requirement_eet}"
230       ],
231       [have_gnutls="no"])
232    if test "x${have_gnutls}" = "xyes" ; then
233       AC_PATH_GENERIC([libgcrypt], [], [have_gnutls="yes"], [have_gnutls="no"])
234       if test "x${have_gnutls}" = "xyes" ; then
235          GNUTLS_CFLAGS="${GNUTLS_CFLAGS} ${LIBGCRYPT_CFLAGS}"
236          GNUTLS_LIBS="${GNUTLS_LIBS} ${LIBGCRYPT_LIBS}"
237       fi
238    fi
239 fi
240
241 # Openssl library
242 have_openssl="no"
243 if test "x${want_openssl}" = "xyes" -o "x${want_openssl}" = "xauto" ; then
244    PKG_CHECK_MODULES(OPENSSL, openssl,
245       [
246        have_openssl="yes"
247        AC_DEFINE(HAVE_OPENSSL, 1, [Have Openssl support])
248        requirement_eet="openssl ${requirement_eet}"
249       ],
250       [have_openssl="no"])
251 fi
252
253 have_cipher="no"
254 if test "x${have_gnutls}" = "xyes" -a "x${want_cipher}" = "xyes" ; then
255    have_cipher="yes"
256    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
257 elif test "x${have_openssl}" = "xyes" -a "x${want_cipher}" = "xyes" ; then
258    have_cipher="yes"
259    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
260 fi
261
262 AC_MSG_CHECKING(whether to activate cipher support in eet)
263 AC_MSG_RESULT(${have_cipher})
264
265 have_signature="no"
266 if test "x${have_gnutls}" = "xyes" -a "x${want_signature}" = "xyes" ; then
267    have_signature="yes"
268    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
269 elif test "x${have_openssl}" = "xyes" -a "x${want_signature}" = "xyes" ; then
270    have_signature="yes"
271    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
272 fi
273
274 AC_MSG_CHECKING(whether to activate signature support in eet)
275 AC_MSG_RESULT(${have_signature})
276
277 # pthread library
278
279 EFL_CHECK_PTHREAD(["no"], [have_pthread="yes"], [have_pthread="no"])
280
281
282 ### Checks for header files
283
284 AC_CHECK_HEADER([zlib.h],
285    [dummy="yes"],
286    [AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
287
288 AC_CHECK_HEADER([jpeglib.h],
289    [dummy="yes"],
290    [AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
291
292 AC_CHECK_HEADERS(netinet/in.h)
293
294 AC_CHECK_HEADER([fnmatch.h],
295    [dummy="yes"],
296    [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])])
297
298
299 ### Checks for types
300
301
302 ### Checks for structures
303
304
305 ### Checks for compiler characteristics
306 AM_PROG_CC_C_O
307 AC_C_CONST
308 AC_C_INLINE
309 AC_PROG_CC_STDC
310 AC_C___ATTRIBUTE__
311
312 # Check whether the null pointer is zero on this arch
313 AC_TRY_RUN(
314    [
315 #include <stdlib.h>
316 int main (int argc, char **argv) {
317   void *foo = NULL;
318   int bar = (int)foo;
319   return (int)foo;
320 }
321    ],
322    [have_null="yes"],
323    [have_null="no"],
324    [
325     AC_MSG_WARN([Cannot check when cross-compiling -- assuming null is okay])
326     have_null="yes"
327    ])
328 AC_MSG_CHECKING([value of the null pointer])
329 AC_MSG_RESULT([${have_null}])
330
331 if test ! "x${have_null}" = "xyes" ; then
332    AC_MSG_WARN([Your system is a bit too funny, eet might not work properly])
333 fi
334
335 # These are needed for fmemopen/open_memstream
336 AC_DEFINE(_GNU_SOURCE, , [Enable GNU extensions])
337
338 EET_CPPFLAGS=""
339 EET_CFLAGS=""
340 case "$host_os" in
341    mingw32ce*)
342       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
343       ;;
344    cegcc*)
345       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
346       EET_CFLAGS="-mwin32"
347       ;;
348    mingw*)
349       EET_CPPFLAGS="-D_WIN32_WINNT=0x0500"
350       ;;
351 esac
352 AC_SUBST(EET_CPPFLAGS)
353 AC_SUBST(EET_CFLAGS)
354
355
356 ### Checks for linker characteristics
357
358 # use --enable-auto-import on Windows
359
360 lt_enable_auto_import=""
361 case "$host_os" in
362    mingw* | cegcc*)
363       lt_enable_auto_import="-Wl,--enable-auto-import"
364       ;;
365 esac
366 AC_SUBST(lt_enable_auto_import)
367
368 # use --as-needed if supported
369
370 LDFLAGS_SAVE=${LDFLAGS}
371 LDFLAGS="${LDFLAGS} -Wl,--as-needed"
372
373 AC_LINK_IFELSE(
374    [AC_LANG_PROGRAM([[]], [])],
375    [ld_as_needed="-Wl,--as-needed"],
376    [ld_as_needed=""]
377 )
378
379 LDFLAGS=${LDFLAGS_SAVE}
380 AC_SUBST(ld_as_needed)
381
382
383 ### Checks for library functions
384 AC_FUNC_ALLOCA
385
386 AC_CHECK_FUNCS(fmemopen open_memstream realpath)
387
388 fnmatch_libs=""
389 AC_CHECK_FUNCS([fnmatch], [res="yes"], [res="no"])
390 if test "x$res" = "xno"; then
391    AC_SEARCH_LIBS([fnmatch],
392       [fnmatch evil iberty],
393       [res="yes"],
394       [res="no"])
395    if test "x$res" = "xno"; then
396       AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty, nor libevil])
397    fi
398    fnmatch_libs="${ac_cv_search_fnmatch}"
399 fi
400 AC_SUBST(fnmatch_libs)
401
402
403 AC_SUBST(requirement_eet)
404
405 AC_OUTPUT([
406 Makefile
407 eet.pc
408 doc/Makefile
409 doc/eet.dox
410 src/Makefile
411 src/lib/Makefile
412 src/bin/Makefile
413 src/tests/Makefile
414 README
415 eet.spec
416 ])
417
418
419 #####################################################################
420 ## Info
421
422 echo
423 echo
424 echo
425 echo "------------------------------------------------------------------------"
426 echo "$PACKAGE_NAME $PACKAGE_VERSION"
427 echo "------------------------------------------------------------------------"
428 echo
429 echo "Configuration Options Summary:"
430 echo
431 echo "  Amalgamation.........: ${do_amalgamation}"
432 echo "  Gnutls...............: ${have_gnutls}"
433 echo "  Openssl..............: ${have_openssl}"
434 echo "    Cipher support.....: ${have_cipher}"
435 echo "    Signature..........: ${have_signature}"
436 echo "  Thread Support.......: ${have_pthread}"
437 echo
438 echo "  Old eet file format..: ${old_eet_file_format}"
439 echo
440 echo "  Tests................: ${enable_tests}"
441 echo "  Coverage.............: ${enable_coverage}"
442 echo
443 echo "  Build eet............: $have_eet"
444 echo
445 echo "  Documentation........: ${build_doc}"
446 echo
447 echo "Compilation............: make (or gmake)"
448 echo "  CPPFLAGS.............: $CPPFLAGS"
449 echo "  CFLAGS...............: $CFLAGS"
450 echo "  LDFLAGS..............: $LDFLAGS"
451 echo
452 echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
453 echo "  prefix...............: $prefix"
454 echo