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