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