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