eina: improve system header detection.
[framework/uifw/eina.git] / configure.ac
1 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
2 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
3 m4_define([v_maj], [1])
4 m4_define([v_min], [1])
5 m4_define([v_mic], [99])
6 m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
7 m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
8 ##--   When released, remove the dnl on the below line
9 dnl m4_undefine([v_rev])
10 ##--   When doing snapshots - change soname. remove dnl on below line
11 dnl m4_define([relname], [ver-pre-svn-07])
12 dnl m4_define([v_rel], [-release relname])
13 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
14 m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])], [m4_define([v_ver], [v_maj.v_min.v_mic])])
15 m4_define([lt_cur], m4_eval(v_maj + v_min))
16 m4_define([lt_rev], v_mic)
17 m4_define([lt_age], v_min)
18 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
19 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
20
21 AC_INIT([eina], [v_ver], [enlightenment-devel@lists.sourceforge.net])
22 AC_PREREQ([2.59])
23 AC_CONFIG_SRCDIR([configure.ac])
24 AC_CONFIG_MACRO_DIR([m4])
25
26 AC_CONFIG_HEADERS([config.h])
27 AH_TOP([
28 #ifndef EFL_CONFIG_H__
29 #define EFL_CONFIG_H__
30 ])
31 AH_BOTTOM([
32 #endif /* EFL_CONFIG_H__ */
33 ])
34
35 AM_INIT_AUTOMAKE([1.6 dist-bzip2])
36 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
37
38 AC_GNU_SOURCE
39 AC_SYS_LARGEFILE
40
41 AC_LIBTOOL_WIN32_DLL
42 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
43 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
44 AC_PROG_LIBTOOL
45
46 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
47 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
48 m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
49 m4_ifdef([v_rel], , [m4_define([v_rel], [])])
50 AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
51 AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
52 AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
53 AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
54 version_info="lt_cur:lt_rev:lt_age"
55 release_info="v_rel"
56 AC_SUBST(version_info)
57 AC_SUBST(release_info)
58 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
59 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
60 VMAJ=v_maj
61 AC_SUBST(VMAJ)
62
63
64 ### Needed information
65
66 AC_CANONICAL_BUILD
67 AC_CANONICAL_HOST
68
69 requirement_eina=""
70
71 case "$host_os" in
72    mingw32ce*)
73       MODULE_ARCH="$host_os-$host_cpu"
74       ;;
75    *)
76       MODULE_ARCH="$host_os-$host_cpu-v_maj.v_min.v_mic"
77       ;;
78 esac
79 AC_SUBST(MODULE_ARCH)
80 AC_DEFINE_UNQUOTED(MODULE_ARCH, "${MODULE_ARCH}", "Module architecture")
81
82 case "$host_os" in
83    mingw*)
84       MODULE_EXT=".dll"
85       ;;
86    *)
87       MODULE_EXT=".so"
88       ;;
89 esac
90
91 AC_DEFINE_UNQUOTED(SHARED_LIB_SUFFIX, "${MODULE_EXT}", [Suffix for shared objects])
92
93 EFL_CHECK_CPU_MMX([have_mmx="yes"], [have_mmx="no"])
94 EFL_CHECK_CPU_SSE([have_sse="yes"], [have_sse="no"])
95 EFL_CHECK_CPU_SSE2([have_sse2="yes"], [have_sse2="no"])
96 EFL_CHECK_CPU_ALTIVEC([have_altivec="yes"], [have_altivec="no"])
97
98 EFL_CHECK_THREADS(
99    [
100     if test "x${_efl_have_posix_threads}" = "xyes" ; then
101        have_threads="POSIX"
102     else
103        if test "x${_efl_have_win32_threads}" = "xyes" ; then
104           have_threads="Win32"
105        else
106           have_threads="no"
107        fi
108     fi
109    ],
110    [have_threads="no"])
111 EFL_CHECK_SPINLOCK([have_posix_threads_spinlock="yes"], [have_posix_threads_spinlock="no"])
112
113 if ! test "x${have_threads}" = "xno" ; then
114    EINA_CONFIGURE_HAVE_THREADS="#define EINA_HAVE_THREADS"
115 fi
116 AC_SUBST(EINA_CONFIGURE_HAVE_THREADS)
117 AM_CONDITIONAL([EINA_HAVE_THREADS], [! test "x${have_threads}" = "xno"])
118
119 if ! test "x${have_debug_threads}" = "xno"; then
120    EINA_CONFIGURE_HAVE_DEBUG_THREADS="#define EINA_HAVE_DEBUG_THREADS"
121 fi
122 AC_SUBST(EINA_CONFIGURE_HAVE_DEBUG_THREADS)
123 AM_CONDITIONAL([EINA_DEBUG_THREADS], [! test "x${have_debug_threads}" = "xno"])
124
125 if ! test "x${have_on_off_threads}" = "xno"; then
126    EINA_CONFIGURE_HAVE_ON_OFF_THREADS="#define EINA_HAVE_ON_OFF_THREADS"
127 fi
128 AC_SUBST(EINA_CONFIGURE_HAVE_ON_OFF_THREADS)
129 AM_CONDITIONAL([EINA_ON_OFF_THREADS], [! test "x${have_on_off_threads}" = "xno"])
130
131 ### Additional options to configure
132
133 # Magic debug
134 AC_ARG_ENABLE([magic-debug],
135    [AC_HELP_STRING([--disable-magic-debug], [disable magic debug of eina structure @<:@default=enabled@:>@])],
136    [
137     if test "x${enableval}" = "xyes" ; then
138        have_magic_debug="yes"
139     else
140        have_magic_debug="no"
141     fi
142    ],
143    [have_magic_debug="yes"])
144
145 AC_MSG_CHECKING([whether magic debug is enable])
146 AC_MSG_RESULT([${have_magic_debug}])
147
148 if test "x${have_magic_debug}" = "xyes" ; then
149    EINA_CONFIGURE_MAGIC_DEBUG="#define EINA_MAGIC_DEBUG"
150 fi
151 AC_SUBST(EINA_CONFIGURE_MAGIC_DEBUG)
152
153 # Safety checks (avoid crashes on wrong api usage)
154 AC_ARG_ENABLE(safety-checks,
155    [AC_HELP_STRING([--disable-safety-checks], [disable safety checks for NULL pointers and like. @<:@default=enabled@:>@])],
156    [
157     if test "x${enableval}" = "xyes" ; then
158        have_safety_checks="yes"
159     else
160        have_safety_checks="no"
161     fi
162    ],
163    [have_safety_checks="yes"])
164
165 AC_MSG_CHECKING(whether to do safety checking on api parameters)
166 AC_MSG_RESULT($have_safety_checks)
167
168 AM_CONDITIONAL(SAFETY_CHECKS, test "x$have_safety_checks" = "xyes")
169 if test "x$have_safety_checks" = "xyes"; then
170   AC_DEFINE(EINA_SAFETY_CHECKS, 1, [disable safety checks for NULL pointers and like.])
171   EINA_CONFIGURE_SAFETY_CHECKS="#define EINA_SAFETY_CHECKS"
172 fi
173 AC_SUBST(EINA_CONFIGURE_SAFETY_CHECKS)
174
175 with_max_log_level="<unset>"
176 AC_ARG_WITH(internal-maximum-log-level,
177    [AC_HELP_STRING([--with-internal-maximum-log-level=NUMBER],
178                    [limit eina internal log level to the given number, any call to EINA_LOG() with values greater than this will be compiled out, ignoring runtime settings, but saving function calls.])],
179    [
180     if test "x${withval}" != "xno"; then
181        if echo "${withval}" | grep -E '^[[0-9]]+$' >/dev/null 2>/dev/null; then
182           AC_MSG_NOTICE([ignoring any EINA_LOG() with level greater than ${withval}])
183           AC_DEFINE_UNQUOTED(EINA_LOG_LEVEL_MAXIMUM, ${withval}, [if set, logging is limited to this amount.])
184           with_max_log_level="${withval}"
185        else
186           AC_MSG_ERROR([--with-internal-maximum-log-level takes a decimal number, got "${withval}" instead.])
187        fi
188     fi
189     ], [:])
190
191 AC_ARG_ENABLE([amalgamation],
192    [AC_HELP_STRING([--enable-amalgamation], [enable generation of one single file with all source code in it, helps compiler optimizations.])],
193    [if test "x${enableval}" = "xyes"; then
194        do_amalgamation="yes"
195     else
196        do_amalgamation="no"
197     fi
198    ],
199    [do_amalgamation="no"]
200 )
201 AM_CONDITIONAL(EINA_AMALGAMATION, test "x${do_amalgamation}" = "xyes")
202
203 # Choose best memory pool
204 AC_ARG_ENABLE([default-mempool],
205    [AC_HELP_STRING([--enable-default-mempool], [Default memory allocator could be faster for some computer. @<:@default=disabled@:>@])],
206    [
207     if test "x${enableval}" = "xyes"; then
208        have_default_mempool="yes"
209     else
210        have_default_mempool="no"
211     fi
212    ],
213    [have_default_mempool="no"]
214 )
215 AC_MSG_CHECKING([whether to use default mempool allocator])
216 AC_MSG_RESULT([${have_default_mempool}])
217
218 if test "x${have_default_mempool}" = "xyes" ; then
219    EINA_CONFIGURE_DEFAULT_MEMPOOL="#define EINA_DEFAULT_MEMPOOL"
220 fi
221 AC_SUBST(EINA_CONFIGURE_DEFAULT_MEMPOOL)
222
223 # Report stringshare usage
224 AC_ARG_ENABLE([stringshare-usage],
225    [AC_HELP_STRING([--enable-stringshare-usage], [Report stringshare usage on stringshare shutdown. @<:@default=disabled@:>@])],
226    [
227     if test "x${enableval}" = "xyes"; then
228        have_stringshare_usage="yes"
229     else
230        have_stringshare_usage="no"
231     fi
232    ],
233    [have_stringshare_usage="no"]
234 )
235 AC_MSG_CHECKING([whether to report stringshare usage])
236 AC_MSG_RESULT([${have_stringshare_usage}])
237
238 if test "x${have_stringshare_usage}" = "xyes"; then
239    AC_DEFINE(EINA_STRINGSHARE_USAGE, 1, [Report Eina stringshare usage pattern])
240 fi
241
242 # Check if we want to benchmark on real data
243 enable_benchmark_e17="no"
244 AC_ARG_ENABLE([e17],
245    [AC_HELP_STRING([--enable-e17], [enable heavy benchmark @<:@default=no@:>@])],
246    [
247     if test "x${enableval}" = "xyes" ; then
248        enable_benchmark_e17="yes"
249     else
250        enable_benchmark_e17="no"
251     fi
252    ],
253    [enable_benchmark_e17="no"])
254
255 AC_MSG_CHECKING([whether e17 real data benchmark are built])
256 AC_MSG_RESULT([${enable_benchmark_e17}])
257
258 AM_CONDITIONAL(EINA_ENABLE_BENCHMARK_E17, test "x${enable_benchmark_e17}" = "xyes")
259
260
261 ### Checks for programs
262 AC_PROG_CC
263 AC_PROG_CXX
264
265 # pkg-config
266 PKG_PROG_PKG_CONFIG
267
268 # Check whether pkg-config supports Requires.private
269 if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
270    pkgconfig_requires_private="Requires.private"
271 else
272    pkgconfig_requires_private="Requires"
273 fi
274 AC_SUBST(pkgconfig_requires_private)
275
276 # doxygen program for documentation building
277
278 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
279
280
281 ### Checks for libraries
282
283 # Valgrind
284 want_valgrind="auto"
285 have_valgrind="no"
286
287 AC_ARG_ENABLE([valgrind],
288   [AC_HELP_STRING([--enable-valgrind], [improve valgrind support by hinting it of our memory usages, having it to report proper mempool leaks.])],
289   [want_valgrind=$enableval])
290
291 AC_MSG_CHECKING([whether to enable build with valgrind])
292 AC_MSG_RESULT([${want_valgrind}])
293
294 if test "x${want_valgrind}" = "xyes" || test "x${want_valgrind}" = "xauto"; then
295    PKG_CHECK_MODULES([VALGRIND],
296       [valgrind >= 2.4.0],
297       [
298        requirement_eina="valgrind ${requirement_eina}"
299        have_valgrind="yes"
300       ],
301       [
302        AC_DEFINE([NVALGRIND], [1], [Valgrind support disabled])
303        if test "x${want_valgrind}" = "xyes"; then
304           AC_MSG_ERROR([Valgrind >= 2.4.0 is required])
305        fi
306       ])
307 else
308     AC_DEFINE([NVALGRIND], [1], [Valgrind support disabled])
309 fi
310
311
312 # Evil library for compilation on Windows CE
313
314 EFL_EINA_BUILD=""
315 case "$host_os" in
316    mingw*)
317       PKG_CHECK_MODULES([EVIL], [evil >= 1.0.0])
318       AC_DEFINE([HAVE_EVIL], [1], [Set to 1 if evil package is installed])
319       requirement_eina="evil"
320       EFL_EINA_BUILD="-DEFL_EINA_BUILD"
321    ;;
322 esac
323 AC_SUBST([EFL_EINA_BUILD])
324
325 # Check ememoa memory pool library
326
327 AC_ARG_ENABLE([ememoa],
328    [AC_HELP_STRING([--enable-ememoa], [build ememoa memory pool module @<:@default=yes@:>@])],
329    [
330     if test "x${enableval}" = "xyes" ; then
331        enable_ememoa="yes"
332     else
333        enable_ememoa="no"
334     fi
335    ],
336    [enable_ememoa="yes"])
337
338 AC_MSG_CHECKING([whether to use ememoa for memory pool])
339 AC_MSG_RESULT([$enable_ememoa])
340
341 if test "x${enable_ememoa}" = "xyes" ; then
342    PKG_CHECK_MODULES([EMEMOA],
343       [ememoa >= 0.0.26 ],
344       [enable_ememoa="yes"],
345       [enable_ememoa="no"])
346 fi
347
348 PKG_CHECK_MODULES([ECORE_EVAS],
349    [ecore-evas ecore evas],
350    [build_tiler_example="yes"],
351    [build_tiler_example="no"])
352
353 AM_CONDITIONAL([BUILD_TILER_EXAMPLE], [test "x${build_tiler_example}" = "xyes"])
354
355
356 ### Checks for header files
357 AC_HEADER_ASSERT
358 AC_HEADER_TIME
359 EFL_CHECK_PATH_MAX
360 AC_CHECK_HEADERS([unistd.h libgen.h inttypes.h stdint.h sys/types.h siginfo.h strings.h sys/mman.h])
361
362 if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
363    EINA_CONFIGURE_HAVE_INTTYPES_H="#define EINA_HAVE_INTTYPES_H"
364    AC_DEFINE([HAVE_INTTYPES_H], [1], [Define to 1 if you have the <inttypes.h> header file.])
365 fi
366 AC_SUBST([EINA_CONFIGURE_HAVE_INTTYPES_H])
367
368 if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
369     EINA_CONFIGURE_HAVE_STDINT_H="#define EINA_HAVE_STDINT_H"
370     AC_DEFINE([HAVE_STDINT_H], [1], [Define to 1 if you have the <stdint.h> header file.])
371 fi
372 AC_SUBST([EINA_CONFIGURE_HAVE_STDINT_H])
373
374 if test "x${ac_cv_header_strings_h}" = "xyes" ; then
375     AC_DEFINE([HAVE_STRINGS_H], [1], [Define to 1 if you have the <strings.h> header file.])
376 fi
377
378 if test "x${ac_cv_header_sys_mman_h}" = "xyes" ; then
379     AC_DEFINE([HAVE_MMAN_H], [1], [Define to 1 if you have the <sys/mman.h> header file.])
380 fi
381
382 ### Checks for types
383
384 AC_CHECK_SIZEOF([wchar_t])
385 EINA_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
386 AC_SUBST([EINA_SIZEOF_WCHAR_T])
387 AC_CHECK_TYPES([siginfo_t], [], [],
388    [[#include <signal.h>
389      #if HAVE_SIGINFO_H
390      # include <siginfo.h>
391      #endif
392    ]])
393
394 ### Check if dirent.h is usable
395
396 AC_CHECK_TYPES([struct dirent], [have_dirent="yes"], [have_dirent="no"],
397    [[#include <dirent.h>
398    ]])
399
400 if test "x${have_dirent_h}" = "xyes" ; then
401     EINA_CONFIGURE_HAVE_DIRENT_H="#define EINA_HAVE_DIRENT_H"
402     AC_DEFINE([HAVE_DIRENT_H], [1], [Define to 1 if you have a valid <dirent.h> header file.])
403 fi
404 AC_SUBST([EINA_CONFIGURE_HAVE_DIRENT_H])
405
406 ### Checks for compiler characteristics
407 AC_C_CONST
408 AC_C_BIGENDIAN
409 AC_C_INLINE
410 AC_PROG_CC_STDC
411 EFL_ATTRIBUTE_UNUSED
412
413 have_wince="no"
414 have_win32="no"
415 EINA_CPPFLAGS=""
416 EINA_CFLAGS=""
417 case "$host_os" in
418    mingw32ce*)
419       EINA_CPPFLAGS="-D_WIN32_WCE=0x0420"
420       EINA_CFLAGS="${EVIL_CFLAGS}"
421       have_win32="yes"
422       have_wince="yes"
423       ;;
424    mingw*)
425       EINA_CPPFLAGS="-D_WIN32_WINNT=0x0501"
426       EINA_CFLAGS="${EVIL_CFLAGS}"
427       have_win32="yes"
428       ;;
429 esac
430 AM_CONDITIONAL([EINA_HAVE_WINCE], [test "x$have_wince" = "xyes"])
431 AM_CONDITIONAL([EINA_HAVE_WIN32], [test "x$have_win32" = "xyes"])
432
433 m4_ifdef([v_mic],
434    [
435     EFL_COMPILER_FLAG([-Wall])
436     EFL_COMPILER_FLAG([-W])
437    ])
438
439 EFL_COMPILER_FLAG([-Wshadow])
440
441 AC_SUBST([EINA_CPPFLAGS])
442 AC_SUBST([EINA_CFLAGS])
443
444
445 ### Checks for linker characteristics
446 EINA_LIBS=
447 lt_enable_auto_import=""
448 case "${host_os}" in
449    mingw*)
450       EINA_LIBS="-ldl ${EVIL_LIBS} -lm"
451       lt_enable_auto_import="-Wl,--enable-auto-import"
452    ;;
453    dragonfly*|openbsd*)
454       EINA_LIBS="-lm"
455    ;;
456    freebsd*|netbsd*)
457       EINA_LIBS="-lrt -lm"
458    ;;
459    darwin*)
460       EINA_LIBS="-lm"
461    ;;
462    cygwin*)
463       EINA_LIBS="-ldl -lm"
464    ;;
465    *)
466       EINA_LIBS="-ldl -lrt -lm"
467    ;;
468 esac
469 AC_SUBST([EINA_LIBS])
470 AC_SUBST([lt_enable_auto_import])
471
472 case "$host_vendor" in
473   ps3*)
474       PKG_CHECK_MODULES([ESCAPE], [escape])
475       AC_DEFINE(HAVE_ESCAPE, 1, [Set to 1 if evil package is installed])
476       requirement_eina="escape"
477       EINA_LIBS="${ESCAPE_LIBS}"
478       EINA_CFLAGS="${ESCAPE_CFLAGS} ${EINA_CFLAGS}"
479     ;;
480 esac
481
482 EFL_LINKER_FLAG([-fno-strict-aliasing])
483
484
485 ### Checks for library functions
486 AC_ISC_POSIX
487 AC_FUNC_ALLOCA
488 AC_CHECK_FUNCS([strlcpy openat fstatat fpathconf execvp])
489
490 AC_MSG_CHECKING([dirfd])
491 AC_LINK_IFELSE([
492
493 #include <dirent.h>
494
495 DIR *dirp;
496
497 int
498 main(void)
499 {
500         return dirfd(dirp);
501 }
502 ], [ AC_MSG_RESULT([yes])
503      AC_DEFINE([HAVE_DIRFD], 1, [ Define to 1 if you have the `dirfd' function or macro. ])
504    ],
505    [ AC_MSG_RESULT([no])]
506 )
507
508 # dlopen and dladdr
509 dlopen_libs=""
510 case "$host_os" in
511    mingw*)
512 # managed by evil
513       AC_DEFINE([HAVE_DLADDR])
514       AC_DEFINE([HAVE_DLOPEN])
515       ;;
516    *)
517       AC_CHECK_FUNCS([dlopen], [res="yes"], [res="no"])
518       if test "x${res}" = "xyes" ; then
519          AC_CHECK_FUNCS([dladdr], [AC_DEFINE([HAVE_DLADDR])])
520          AC_DEFINE([HAVE_DLOPEN])
521       else
522          AC_CHECK_LIB([dl], [dlopen], [res="yes"], [res="no"])
523          if test "x${res}" = "xyes" ; then
524             AC_CHECK_LIB([dl], [dladdr], [AC_DEFINE([HAVE_DLADDR])])
525             AC_DEFINE(HAVE_DLOPEN)
526             dlopen_libs="-ldl"
527          fi
528       fi
529       ;;
530 esac
531 AC_SUBST([dlopen_libs])
532
533 EFL_CHECK_FNMATCH([], [AC_MSG_ERROR([Cannot find fnmatch()])])
534
535 AC_CHECK_HEADERS([mcheck.h], [AC_DEFINE([HAVE_MCHECK], [1], [Have mcheck.h])])
536 AC_CHECK_FUNCS([mtrace], [AC_DEFINE([HAVE_MTRACE], [1], [Have mtrace])])
537
538 # iconv library
539 have_iconv="no"
540 AC_ARG_WITH([iconv-link],
541    AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]),
542    [
543     LIBS="$withval $LIBS"
544     have_iconv="yes"
545     iconv_libs=$withval
546    ])
547
548 AC_MSG_CHECKING(for explicit iconv link options)
549 if test "x${iconv_libs}" = "x" ; then
550    AC_MSG_RESULT([no explicit iconv link option])
551 else
552    AC_MSG_RESULT([$iconv_libs])
553 fi
554
555 if test "x${have_iconv}" = "xno" ; then
556    AC_CHECK_HEADERS([iconv.h], [have_iconv="yes"])
557
558    if test "x${have_iconv}" = "xyes" ; then
559       AC_MSG_CHECKING([whether iconv() is in libc])
560
561       AC_LINK_IFELSE(
562          [AC_LANG_PROGRAM(
563              [[
564 #include <stdlib.h>
565 #include <iconv.h>
566              ]],
567              [[
568 iconv_t ic;
569 size_t count = iconv(ic, NULL, NULL, NULL, NULL);
570              ]])],
571          [have_iconv="yes"],
572          [have_iconv="no"])
573
574       AC_MSG_RESULT([${have_iconv}])
575    fi
576
577    if test "x${have_iconv}" = "xno" ; then
578       AC_MSG_CHECKING([whether iconv() is in libiconv.a])
579
580       LIBS_save="${LIBS}"
581       LIBS="-liconv $LIBS"
582       AC_LINK_IFELSE(
583          [AC_LANG_PROGRAM(
584              [[
585 #include <stdlib.h>
586 #include <iconv.h>
587              ]],
588              [[
589 iconv_t ic;
590 size_t count;
591 count = iconv(ic, NULL, NULL, NULL, NULL);
592              ]])],
593          [
594           have_iconv="yes"
595           iconv_libs="-liconv"
596          ],
597          [
598           have_iconv="no"
599           LIBS=${LIBS_save}
600          ])
601
602       AC_MSG_RESULT([${have_iconv}])
603    fi
604
605    if test "x${have_iconv}" = "xno" ; then
606       AC_MSG_CHECKING([whether iconv() is in libiconv_plug.a])
607
608       LIBS_save="${LIBS}"
609       LIBS="-liconv_plug $LIBS"
610       AC_LINK_IFELSE(
611          [AC_LANG_PROGRAM(
612              [[
613 #include <stdlib.h>
614 #include <iconv.h>
615              ]],
616              [[
617 iconv_t ic;
618 size_t count = iconv(ic, NULL, NULL, NULL, NULL);
619              ]])],
620          [
621           have_iconv="yes"
622           iconv_libs="-liconv_plug"
623          ],
624          [
625           have_iconv="no"
626           LIBS=${LIBS_save}
627          ])
628
629       AC_MSG_RESULT([${have_iconv}])
630    fi
631 fi
632
633 AC_SUBST([iconv_libs])
634
635 if test "x${have_iconv}" = "xyes" ; then
636    AC_DEFINE([HAVE_ICONV], [1], [Set to 1 if iconv library is installed])
637 fi
638
639 # shmopen
640 have_shmopen=no
641 AC_MSG_CHECKING([for shm_open availability])
642
643 LIBS_save="${LIBS}"
644 LIBS="${LIBS} -lrt"
645 AC_LINK_IFELSE(
646    [AC_LANG_PROGRAM(
647        [[
648 #include <sys/mman.h>
649 #include <sys/stat.h>        /* For mode constants */
650 #include <fcntl.h>           /* For O_* constants */
651        ]],
652        [[
653 int fd;
654
655 fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
656        ]])],
657    [have_shmopen="yes"],
658    [have_shmopen="no"])
659
660 LIBS="${LIBS_save}"
661
662 AC_MSG_RESULT([${have_shmopen}])
663
664 if test "x${have_shmopen}" = "xyes"; then
665    AC_DEFINE([HAVE_SHMOPEN], [1], [Define to 1 if you have the `shm_open' function.])
666    rt_libs="-lrt"
667 fi
668
669 AC_SUBST([rt_libs])
670
671 # extended attribute
672
673 AC_MSG_CHECKING([for extended attributes])
674
675 AC_COMPILE_IFELSE(
676    [AC_LANG_PROGRAM(
677        [[
678 #include <stdlib.h>
679 #include <sys/types.h>
680 #include <sys/xattr.h>
681        ]],
682        [[
683 size_t tmp = listxattr("/", NULL, 0);
684 tmp = getxattr("/", "user.ethumb.md5", NULL, 0);
685 setxattr("/", "user.ethumb.md5", NULL, 0, 0);
686        ]])],
687    [
688     AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.])
689     have_xattr="yes"
690    ],
691    [have_xattr="no"])
692
693 AC_MSG_RESULT([${have_xattr}])
694
695 ### Modules
696
697 if test "x${have_default_mempool}" = "xyes" ; then
698    enable_chained_pool="no"
699    enable_pass_through="static"
700 else
701    enable_chained_pool="static"
702    enable_pass_through="no"
703 fi
704
705 enable_one_big="static"
706
707 EINA_CHECK_MODULE([chained-pool],   [${enable_chained_pool}], [chained pool])
708 EINA_CHECK_MODULE([ememoa-fixed],   [${enable_ememoa}],       [ememoa fixed])
709 EINA_CHECK_MODULE([ememoa-unknown], [${enable_ememoa}],       [ememoa unknown])
710 EINA_CHECK_MODULE([fixed-bitmap],   [no],                     [fixed bitmap])
711 EINA_CHECK_MODULE([pass-through],   [${enable_pass_through}], [pass through])
712 EINA_CHECK_MODULE([buddy],          [no],                     [buddy])
713 EINA_CHECK_MODULE([one-big],        [${enable_one_big}],      [one big])
714
715 ### Make the debug preprocessor configurable
716
717 ### Unit tests, coverage and benchmarking
718
719 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
720
721 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
722 EINA_CFLAGS="${EINA_CFLAGS} ${EFL_COVERAGE_CFLAGS}"
723 EINA_LIBS="${EINA_LIBS} ${EFL_COVERAGE_LIBS}"
724 if test "x$enable_coverage" = "xyes" ; then
725    EINA_CFLAGS="${EINA_CFLAGS} ${EFL_DEBUG_CFLAGS}"
726 fi
727
728 EFL_CHECK_BENCHMARK([enable_benchmark="yes"], [enable_benchmark="no"])
729 EINA_BENCH_MODULE([glib], [${enable_benchmark}], [glib-2.0], [enable_benchmark_glib="yes"], [enable_benchmark_glib="no"])
730 if test -n "$CXX" && test "x$enable_benchmark" = "xyes" ; then
731    AC_DEFINE_UNQUOTED([CITYHASH_BENCH], [1], [enable bench tests for google hash method])
732 fi
733 AM_CONDITIONAL([CITYHASH_BENCH], [test -n "$CXX" && test "x$enable_benchmark" = "xyes"])
734
735 AC_SUBST(requirement_eina)
736
737 ### Build and install examples
738 EFL_CHECK_BUILD_EXAMPLES([enable_build_examples="yes"], [enable_build_examples="no"])
739 EFL_CHECK_INSTALL_EXAMPLES([enable_install_examples="yes"], [enable_install_examples="no"])
740
741 AC_CONFIG_FILES([
742 Makefile
743 eina.pc
744 eina.spec
745 doc/Makefile
746 doc/Doxyfile
747 src/Makefile
748 src/include/Makefile
749 src/include/eina_config.h
750 src/lib/Makefile
751 src/modules/Makefile
752 src/modules/mp/Makefile
753 src/modules/mp/chained_pool/Makefile
754 src/modules/mp/ememoa_fixed/Makefile
755 src/modules/mp/ememoa_unknown/Makefile
756 src/modules/mp/pass_through/Makefile
757 src/modules/mp/fixed_bitmap/Makefile
758 src/modules/mp/buddy/Makefile
759 src/modules/mp/one_big/Makefile
760 src/tests/Makefile
761 src/examples/Makefile
762 ])
763
764 AC_OUTPUT
765
766 #####################################################################
767 ## Info
768
769 echo
770 echo
771 echo
772 echo "------------------------------------------------------------------------"
773 echo "$PACKAGE $VERSION"
774 echo "------------------------------------------------------------------------"
775 echo
776 echo
777 echo "Configuration Options Summary:"
778 echo
779 echo "  Magic debug..........: ${have_magic_debug}"
780 echo "  Safety checks........: ${have_safety_checks}"
781 echo "  Maximum log level....: ${with_max_log_level}"
782 echo "  Report string usage..: ${have_stringshare_usage}"
783 echo "  Valgrind support.....: ${have_valgrind}"
784 echo "  Default mempool......: ${have_default_mempool}"
785 echo "  Thread Support.......: ${have_threads}"
786 if test "${have_threads}" = "POSIX" ; then
787 echo "    spinlock...........: ${have_posix_threads_spinlock}"
788 echo "    debug usage........: ${have_debug_threads}"
789 echo "    on/off support.....: ${have_on_off_threads}"
790 fi
791 echo "  Amalgamation.........: ${do_amalgamation}"
792 echo "  Iconv support........: ${have_iconv}"
793 echo "  File dirfd...........: ${ac_cv_func_dirfd}"
794 echo "  File xattr...........: ${have_xattr}"
795 echo
796 echo "  Documentation........: ${build_doc}"
797 echo "  Tests................: ${enable_tests}"
798 echo "  Coverage.............: ${enable_coverage}"
799 echo "  Examples.............: ${enable_build_examples}"
800 echo "  Tiler Example........: ${build_tiler_example}"
801 echo "  Examples installed...: ${enable_install_examples}"
802 echo "  Benchmark............: ${enable_benchmark}"
803 if test "x${enable_benchmark}" = "xyes" ; then
804 echo "    Glib...............: ${enable_benchmark_glib}"
805 echo "    E17 real data......: ${enable_benchmark_e17}"
806 fi
807 echo
808 echo "  CPU Specific Extensions:"
809 echo "    MMX................: ${have_mmx}"
810 echo "    SSE................: ${have_sse}"
811 echo "    SSE2...............: ${have_sse2}"
812 echo "    ALTIVEC............: ${have_altivec}"
813 echo
814 echo "  Memory pools:"
815 echo "    Buddy..............: ${enable_buddy}"
816 echo "    Chained pool.......: ${enable_chained_pool}"
817 echo "    Ememoa fixed.......: ${enable_ememoa_fixed}"
818 echo "    Ememoa unknown.....: ${enable_ememoa_unknown}"
819 echo "    Fixed bitmap.......: ${enable_fixed_bitmap}"
820 echo "    One big............: ${enable_one_big}"
821 echo "    Pass through.......: ${enable_pass_through}"
822 echo
823 echo "Compilation............: make (or gmake)"
824 echo "  CPPFLAGS.............: $CPPFLAGS"
825 echo "  CFLAGS...............: $CFLAGS"
826 echo "  LDFLAGS..............: $LDFLAGS"
827 echo
828 echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
829 echo "  prefix...............: $prefix"
830 echo
831 EFL_FORM_VOLTRON