move to uses no []'s as it works for me, but for belem... inconsistent []'s
[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.0, 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
15 AC_LIBTOOL_WIN32_DLL
16 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
17 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
18 AC_PROG_LIBTOOL
19
20 VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
21 VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
22 VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
23 SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
24 version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
25 #release="ver-pre-svn-00"
26 #release_info="-release $release"
27 release_info=""
28 AC_SUBST(version_info)
29 AC_SUBST(release_info)
30
31 ### Default options with respect to host
32
33 case "$host_os" in
34    mingw* | cegcc*)
35       want_gnutls="no"
36       want_openssl="no"
37       want_cipher="no"
38       want_signature="no"
39       ;;
40    *)
41       want_gnutls="auto"
42       want_openssl="auto"
43       want_cipher="yes"
44       want_signature="yes"
45       ;;
46 esac
47
48 requirement_eet=""
49
50
51 ### Additional options to configure
52
53 # Old eet file format support
54
55 old_eet_file_format="yes"
56 AC_ARG_ENABLE(old-eet-file-format,
57    [AC_HELP_STRING(
58       [--disable-old-eet-file-format],
59       [disable old eet file format support. [[default=enabled]]]
60     )],
61    [old_eet_file_format=$enableval]
62 )
63 AC_MSG_CHECKING([whether to support old eet file format])
64 AC_MSG_RESULT([${old_eet_file_format}])
65
66 if test "x${old_eet_file_format}" = "xyes" ; then
67    AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 1, [support old eet file format])
68 else
69    AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 0, [support old eet file format])
70 fi
71
72 # Gnutls support
73
74 AC_ARG_ENABLE([gnutls],
75    [AC_HELP_STRING([--disable-gnutls], [disable gnutls eet support])],
76    [want_gnutls=$enableval]
77 )
78 AC_MSG_CHECKING([whether to use Gnutls])
79 AC_MSG_RESULT([${want_gnutls}])
80
81 # Specific GNUTLS improvement
82
83 new_gnutls_api="no"
84 AC_ARG_ENABLE(new-gnutls-api,
85    [AC_HELP_STRING(
86       [--enable-new-gnutls-api],
87       [enable use of gnutls_x509_crt_verify_hash. [[default=disable]]]
88     )],
89    [new_gnutls_api=$enableval]
90 )
91 AC_MSG_CHECKING([whether to use gnutls_x509_crt_verify_hash])
92 AC_MSG_RESULT([${new_gnutls_api}])
93
94 if test "x${new_gnutls_api}" = "xyes" ; then
95    AC_DEFINE(EET_USE_NEW_GNUTLS_API, 1, [use gnutls_x509_crt_verify_hash])
96 else
97    AC_DEFINE(EET_USE_NEW_GNUTLS_API, 0, [don't use gnutls_x509_crt_verify_hash])
98 fi
99
100 # Openssl support
101
102 AC_ARG_ENABLE([openssl],
103    [AC_HELP_STRING([--disable-openssl], [disable openssl eet support])],
104    [want_openssl=$enableval]
105 )
106 AC_MSG_CHECKING([whether to use OpenSSL])
107 AC_MSG_RESULT([${want_openssl}])
108
109 # Cryptography support
110
111 AC_ARG_ENABLE([cipher],
112    [AC_HELP_STRING([--disable-cipher], [disable cipher support for eet API])],
113    [want_cipher=$enableval]
114 )
115 AC_MSG_CHECKING([whether to use cipher])
116 AC_MSG_RESULT([${want_cipher}])
117
118 AC_ARG_ENABLE([signature],
119    [AC_HELP_STRING([--disable-signature], [disable signature file support for eet])],
120    [want_signature=$enableval]
121 )
122 AC_MSG_CHECKING([whether to use signature])
123 AC_MSG_RESULT([${want_signature}])
124
125 # Assert or fail.
126 prefer_assert="no"
127 AC_ARG_ENABLE([assert],
128    [AC_HELP_STRING([--enable-assert], [enable assert, [[default=disabled]]])],
129    [prefer_assert=$enableval]
130 )
131
132 # Unit tests, coverage and benchmarking
133
134 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
135 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
136
137 if test "x${prefer_assert}" = "xno"; then
138    DEBUG_CFLAGS="-DNDEBUG"
139 else
140 # use debug symbols and set DEBUG if coverage support is enabled
141    DEBUG_CFLAGS="${EFL_DEBUG_CFLAGS}"
142 fi
143 AC_SUBST(DEBUG_CFLAGS)
144
145
146 ### Checks for programs
147 AC_PROG_CC
148
149 # doxygen program for documentation building
150
151 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
152
153
154 ### Checks for libraries
155
156 # Evil library for compilation on Windows
157
158 EFL_EET_BUILD=""
159 case "$host_os" in
160    mingw* | cegcc*)
161       PKG_CHECK_MODULES([EVIL], [evil])
162       AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
163       requirement_eet="evil ${requirement_eet}"
164       EFL_EET_BUILD="-DEFL_EET_BUILD"
165    ;;
166 esac
167 AC_SUBST(EFL_EET_BUILD)
168
169 EET_LIBS=""
170 case "$host_os" in
171    mingw32ce*)
172       EET_LIBS="-lws2"
173       ;;
174    cegcc*)
175       EET_LIBS="-lws2"
176       ;;
177    mingw*)
178       EET_LIBS="-lws2_32"
179       ;;
180 esac
181 AC_SUBST(EET_LIBS)
182
183 # Eina library
184
185 PKG_CHECK_MODULES(EINA, [eina-0])
186 requirement_eet="eina-0 ${requirement_eet}"
187
188 # Gnutls library
189 have_gnutls="no"
190 if test "x${want_gnutls}" = "xyes" -o "x${want_gnutls}" = "xauto" ; then
191    PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.7.6],
192       [
193        have_gnutls="yes"
194        want_openssl="no"
195        AC_DEFINE(HAVE_GNUTLS, 1, [Have Gnutls support])
196        requirement_eet="gnutls ${requirement_eet}"
197       ],
198       [
199        have_gnutls="no"
200       ])
201 fi
202
203 # Openssl library
204 have_openssl="no"
205 if test "x${want_openssl}" = "xyes" -o "x${want_openssl}" = "xauto" ; then
206    PKG_CHECK_MODULES(OPENSSL, openssl,
207       [
208        have_openssl="yes"
209        AC_DEFINE(HAVE_OPENSSL, 1, [Have Openssl support])
210        requirement_eet="openssl ${requirement_eet}"
211       ],
212       [have_openssl="no"])
213 fi
214
215 have_cipher="no"
216 if test "x${have_gnutls}" = "xyes" -a "x${want_cipher}" = "xyes" ; then
217    have_cipher="yes"
218    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
219 elif test "x${have_openssl}" = "xyes" -a "x${want_cipher}" = "xyes" ; then
220    have_cipher="yes"
221    AC_DEFINE(HAVE_CIPHER, 1, [Have cipher support built in eet])
222 fi
223
224 AC_MSG_CHECKING(whether to activate cipher support in eet)
225 AC_MSG_RESULT(${have_cipher})
226
227 have_signature="no"
228 if test "x${have_gnutls}" = "xyes" -a "x${want_signature}" = "xyes" ; then
229    have_signature="yes"
230    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
231 elif test "x${have_openssl}" = "xyes" -a "x${want_signature}" = "xyes" ; then
232    have_signature="yes"
233    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
234 fi
235
236 AC_MSG_CHECKING(whether to activate signature support in eet)
237 AC_MSG_RESULT(${have_signature})
238
239
240 ### Checks for header files
241
242 AC_CHECK_HEADER([zlib.h],
243    [dummy="yes"],
244    [AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
245
246 AC_CHECK_HEADER([jpeglib.h],
247    [dummy="yes"],
248    [AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
249
250 AC_CHECK_HEADERS(netinet/in.h)
251
252 AC_CHECK_HEADER([fnmatch.h],
253    [dummy="yes"],
254    [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])])
255
256
257 ### Checks for types
258
259
260 ### Checks for structures
261
262
263 ### Checks for compiler characteristics
264 AM_PROG_CC_C_O
265 AC_C_CONST
266 AC_C_INLINE
267 AC_PROG_CC_STDC
268 AC_C___ATTRIBUTE__
269
270 # Check whether the null pointer is zero on this arch
271 AC_TRY_RUN(
272    [
273 #include <stdlib.h>
274 int main (int argc, char **argv) {
275   void *foo = NULL;
276   int bar = (int)foo;
277   return (int)foo;
278 }
279    ],
280    [have_null="yes"],
281    [have_null="no"],
282    [
283     AC_MSG_WARN([Cannot check when cross-compiling -- assuming null is okay])
284     have_null="yes"
285    ])
286 AC_MSG_CHECKING([value of the null pointer])
287 AC_MSG_RESULT([${have_null}])
288
289 if test ! "x${have_null}" = "xyes" ; then
290    AC_MSG_WARN([Your system is a bit too funny, eet might not work properly])
291 fi
292
293 # These are needed for fmemopen/open_memstream
294 AC_DEFINE(_GNU_SOURCE, , [Enable GNU extensions])
295
296 EET_CPPFLAGS=""
297 EET_CFLAGS=""
298 case "$host_os" in
299    mingw32ce*)
300       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
301       ;;
302    cegcc*)
303       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
304       EET_CFLAGS="-mwin32"
305       ;;
306 esac
307 AC_SUBST(EET_CPPFLAGS)
308 AC_SUBST(EET_CFLAGS)
309
310
311 ### Checks for linker characteristics
312
313 # use --enable-auto-import on Windows
314
315 lt_enable_auto_import=""
316 case "$host_os" in
317    mingw* | cegcc*)
318       lt_enable_auto_import="-Wl,--enable-auto-import"
319       ;;
320 esac
321 AC_SUBST(lt_enable_auto_import)
322
323 # use --as-needed if supported
324
325 LDFLAGS_SAVE=${LDFLAGS}
326 LDFLAGS="${LDFLAGS} -Wl,--as-needed"
327
328 AC_LINK_IFELSE(
329    [AC_LANG_PROGRAM([[]], [])],
330    [ld_as_needed="-Wl,--as-needed"],
331    [ld_as_needed=""]
332 )
333
334 LDFLAGS=${LDFLAGS_SAVE}
335 AC_SUBST(ld_as_needed)
336
337
338 ### Checks for library functions
339 AC_FUNC_ALLOCA
340
341 AC_CHECK_FUNCS(fmemopen open_memstream realpath)
342
343 fnmatch_libs=""
344 AC_CHECK_FUNCS([fnmatch], [res="yes"], [res="no"])
345 if test "x$res" = "xno"; then
346    AC_SEARCH_LIBS([fnmatch],
347       [fnmatch evil iberty],
348       [res="yes"],
349       [res="no"])
350    if test "x$res" = "xno"; then
351       AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty, nor libevil])
352    fi
353    fnmatch_libs="${ac_cv_search_fnmatch}"
354 fi
355 AC_SUBST(fnmatch_libs)
356
357
358 AC_SUBST(requirement_eet)
359
360 AC_OUTPUT([
361 Makefile
362 eet.pc
363 doc/Makefile
364 doc/eet.dox
365 src/Makefile
366 src/lib/Makefile
367 src/bin/Makefile
368 src/tests/Makefile
369 README
370 eet.spec
371 ])
372
373
374 #####################################################################
375 ## Info
376
377 echo
378 echo
379 echo
380 echo "------------------------------------------------------------------------"
381 echo "$PACKAGE_NAME $PACKAGE_VERSION"
382 echo "------------------------------------------------------------------------"
383 echo
384 echo "Configuration Options Summary:"
385 echo
386 echo "  Gnutls...............: ${have_gnutls}"
387 echo "  Openssl..............: ${have_openssl}"
388 echo "    Cipher support.....: ${have_cipher}"
389 echo "    Signature..........: ${have_signature}"
390 echo
391 echo "  Documentation........: ${build_doc}"
392 echo "  Tests................: ${enable_tests}"
393 echo "  Coverage.............: ${enable_coverage}"
394 echo
395 echo "  Old eet file format..: ${old_eet_file_format}"
396 echo
397 echo "  Compilation..........: make"
398 echo
399 echo "  Installation.........: make install"
400 echo
401 echo "    prefix.............: $prefix"
402 echo