eina: be able to track and display our memory over head when using malloc.
[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\|Unversioned directory\)' || 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 ### Checks for compiler characteristics
356 AC_C_CONST
357 AC_C_BIGENDIAN
358 AC_C_INLINE
359 AC_PROG_CC_STDC
360 EFL_ATTRIBUTE_UNUSED
361
362 have_wince="no"
363 have_win32="no"
364 EINA_CPPFLAGS=""
365 EINA_CFLAGS=""
366 case "$host_os" in
367    mingw32ce*)
368       EINA_CPPFLAGS="-D_WIN32_WCE=0x0420"
369       EINA_CFLAGS="${EVIL_CFLAGS}"
370       have_win32="yes"
371       have_wince="yes"
372       ;;
373    mingw*)
374       EINA_CPPFLAGS="-D_WIN32_WINNT=0x0501"
375       EINA_CFLAGS="${EVIL_CFLAGS}"
376       have_win32="yes"
377       ;;
378 esac
379 AM_CONDITIONAL([EINA_HAVE_WINCE], [test "x$have_wince" = "xyes"])
380 AM_CONDITIONAL([EINA_HAVE_WIN32], [test "x$have_win32" = "xyes"])
381
382 m4_ifdef([v_mic],
383    [
384     EFL_COMPILER_FLAG([-Wall])
385     EFL_COMPILER_FLAG([-W])
386    ])
387
388 EFL_COMPILER_FLAG([-Wshadow])
389
390 case "$host_vendor" in
391   ps3*)
392       PKG_CHECK_MODULES([ESCAPE], [escape])
393       AC_DEFINE(HAVE_ESCAPE, 1, [Set to 1 if evil package is installed])
394       requirement_eina="escape"
395       EINA_CFLAGS="${ESCAPE_CFLAGS} ${EINA_CFLAGS}"
396     ;;
397 esac
398
399 AC_SUBST([EINA_CPPFLAGS])
400 AC_SUBST([EINA_CFLAGS])
401
402
403 ### Checks for linker characteristics
404 EINA_LIBS=
405 lt_enable_auto_import=""
406 case "${host_os}" in
407    mingw*)
408       EINA_LIBS="-ldl ${EVIL_LIBS} -lm"
409       lt_enable_auto_import="-Wl,--enable-auto-import"
410    ;;
411    dragonfly*|openbsd*)
412       EINA_LIBS="-lm"
413    ;;
414    freebsd*|netbsd*)
415       EINA_LIBS="-lrt -lm"
416    ;;
417    darwin*)
418       EINA_LIBS="-lm"
419    ;;
420    cygwin*)
421       EINA_LIBS="-ldl -lm"
422    ;;
423    *)
424       EINA_LIBS="-ldl -lrt -lm"
425    ;;
426 esac
427 case "$host_vendor" in
428   ps3*)
429       # Escape had already been checked to exist
430       EINA_LIBS="${ESCAPE_LIBS}"
431     ;;
432 esac
433 AC_SUBST([EINA_LIBS])
434 AC_SUBST([lt_enable_auto_import])
435
436 EFL_LINKER_FLAG([-fno-strict-aliasing])
437
438 CFLAGS="${CFLAGS} ${EINA_CFLAGS}"
439 LDFLAGS="${LDFLAGS} ${EINA_LDFLAGS}"
440 LIBS="${LIBS} ${EINA_LIBS}"
441
442 ### Checks for header files
443 AC_HEADER_ASSERT
444 AC_HEADER_TIME
445 EFL_CHECK_PATH_MAX
446 AC_CHECK_HEADERS([unistd.h libgen.h inttypes.h stdint.h sys/types.h siginfo.h strings.h sys/mman.h])
447
448 if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
449    EINA_CONFIGURE_HAVE_INTTYPES_H="#define EINA_HAVE_INTTYPES_H"
450    AC_DEFINE([HAVE_INTTYPES_H], [1], [Define to 1 if you have the <inttypes.h> header file.])
451 fi
452 AC_SUBST([EINA_CONFIGURE_HAVE_INTTYPES_H])
453
454 if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
455     EINA_CONFIGURE_HAVE_STDINT_H="#define EINA_HAVE_STDINT_H"
456     AC_DEFINE([HAVE_STDINT_H], [1], [Define to 1 if you have the <stdint.h> header file.])
457 fi
458 AC_SUBST([EINA_CONFIGURE_HAVE_STDINT_H])
459
460 ### Checks for types
461
462 AC_CHECK_SIZEOF([wchar_t])
463 EINA_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
464 AC_SUBST([EINA_SIZEOF_WCHAR_T])
465 AC_CHECK_TYPES([siginfo_t], [], [],
466    [[#include <signal.h>
467      #if HAVE_SIGINFO_H
468      # include <siginfo.h>
469      #endif
470    ]])
471
472 ### Check if dirent.h is usable
473
474 AC_CHECK_TYPES([struct dirent], [have_dirent="yes"], [have_dirent="no"],
475    [[#include <dirent.h>
476    ]])
477
478 if test "x${have_dirent}" = "xyes" ; then
479     EINA_CONFIGURE_HAVE_DIRENT_H="#define EINA_HAVE_DIRENT_H"
480     AC_DEFINE([HAVE_DIRENT_H], [1], [Define to 1 if you have a valid <dirent.h> header file.])
481 fi
482 AC_SUBST([EINA_CONFIGURE_HAVE_DIRENT_H])
483
484 ### Checks for library functions
485 AC_ISC_POSIX
486 AC_FUNC_ALLOCA
487 AC_CHECK_FUNCS([strlcpy openat fstatat fpathconf execvp])
488
489 AC_MSG_CHECKING([for dirfd])
490 AC_LINK_IFELSE(
491    [
492     AC_LANG_PROGRAM(
493        [[
494 #include <dirent.h>
495        ]],
496        [[
497 int main(void)
498 {
499   DIR *dirp;
500   return dirfd(dirp);
501 }
502        ]])
503    ],
504    [have_dirfd="yes"],
505    [have_dirfd="no"])
506
507 AC_MSG_RESULT([${have_dirfd}])
508
509 if test "x${have_dirfd}" = "xyes" ; then
510    AC_DEFINE([HAVE_DIRFD], [1], [ Define to 1 if you have the `dirfd' function or macro.])
511 fi
512
513 # check debug information for malloc
514 AC_CHECK_FUNCS([malloc_usable_size], [malloc_true_size="yes"], [malloc_true_size="no"])
515 if test "x${malloc_true_size}" = "xyes" ; then
516    AC_DEFINE([HAVE_MALLOC_USABLE_SIZE], [1], [We will be able to know the exact amount of wasted memory])
517 fi
518
519 want_debug_malloc="no"
520 AC_ARG_ENABLE([debug-malloc],
521    [AC_HELP_STRING([--enable-debug-malloc], [enable debugging of malloc usage overhead in our allocator @<:@default=enabled@:>@])],
522    [
523      if test "x${enableval}" = "xyes" ; then
524         want_debug_malloc="yes"
525      else
526         want_debug_malloc="no"
527      fi
528    ], [want_debug_malloc="no"])
529
530 if test "x${malloc_true_size}" = "xyes" -a "x${want_debug_malloc}" = "xyes"; then
531    AC_DEFINE([EINA_DEBUG_MALLOC], [1], [Turn on debugging overhead in mempool])
532 fi
533
534 # dlopen and dladdr
535 dlopen_libs=""
536 case "$host_os" in
537    mingw*)
538 # managed by evil
539       AC_DEFINE([HAVE_DLADDR])
540       AC_DEFINE([HAVE_DLOPEN])
541       ;;
542    *)
543       AC_CHECK_FUNCS([dlopen], [res="yes"], [res="no"])
544       if test "x${res}" = "xyes" ; then
545          AC_CHECK_FUNCS([dladdr], [AC_DEFINE([HAVE_DLADDR])])
546          AC_DEFINE([HAVE_DLOPEN])
547       else
548          AC_CHECK_LIB([dl], [dlopen], [res="yes"], [res="no"])
549          if test "x${res}" = "xyes" ; then
550             AC_CHECK_LIB([dl], [dladdr], [AC_DEFINE([HAVE_DLADDR])])
551             AC_DEFINE(HAVE_DLOPEN)
552             dlopen_libs="-ldl"
553          fi
554       fi
555       ;;
556 esac
557 AC_SUBST([dlopen_libs])
558
559 have_log="yes"
560 EFL_CHECK_FNMATCH([have_log="yes"], [have_log="no"])
561
562 want_log="yes"
563 AC_ARG_ENABLE([log],
564    [AC_HELP_STRING([--disable-log], [disable Eina_Log infrastructure completly @<:@default=enabled@:>@])],
565    [
566     if test "x${enableval}" = "xyes" ; then
567        want_log="yes"
568     else
569        want_log="no"
570     fi
571    ],
572    [want_log="yes"])
573
574 enable_log="no"
575 if test "x${have_log}" = xyes -a "x${want_log}" = xyes; then
576    enable_log="yes"
577 fi
578
579 AC_MSG_CHECKING([wether to build Eina_Log infrastructure])
580 AC_MSG_RESULT([${enable_log}])
581
582 if test "x${enable_log}" = "xyes"; then
583     EINA_CONFIGURE_ENABLE_LOG="#define EINA_ENABLE_LOG"
584     AC_DEFINE([HAVE_LOG], [1], [Define to 1 if we log support is on])
585 fi
586 AC_SUBST([EINA_CONFIGURE_ENABLE_LOG])
587
588 AC_CHECK_HEADERS([mcheck.h], [AC_DEFINE([HAVE_MCHECK], [1], [Have mcheck.h])])
589 AC_CHECK_FUNCS([mtrace], [AC_DEFINE([HAVE_MTRACE], [1], [Have mtrace])])
590
591 # iconv library
592 have_iconv="no"
593 AC_ARG_WITH([iconv-link],
594    AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]),
595    [
596     LIBS="$withval $LIBS"
597     have_iconv="yes"
598     iconv_libs=$withval
599    ])
600
601 AC_MSG_CHECKING(for explicit iconv link options)
602 if test "x${iconv_libs}" = "x" ; then
603    AC_MSG_RESULT([no explicit iconv link option])
604 else
605    AC_MSG_RESULT([$iconv_libs])
606 fi
607
608 if test "x${have_iconv}" = "xno" ; then
609    AC_CHECK_HEADERS([iconv.h], [have_iconv="yes"])
610
611    if test "x${have_iconv}" = "xyes" ; then
612       AC_MSG_CHECKING([whether iconv() is in libc])
613
614       AC_LINK_IFELSE(
615          [AC_LANG_PROGRAM(
616              [[
617 #include <stdlib.h>
618 #include <iconv.h>
619              ]],
620              [[
621 iconv_t ic;
622 size_t count = iconv(ic, NULL, NULL, NULL, NULL);
623              ]])],
624          [have_iconv="yes"],
625          [have_iconv="no"])
626
627       AC_MSG_RESULT([${have_iconv}])
628    fi
629
630    if test "x${have_iconv}" = "xno" ; then
631       AC_MSG_CHECKING([whether iconv() is in libiconv.a])
632
633       LIBS_save="${LIBS}"
634       LIBS="-liconv $LIBS"
635       AC_LINK_IFELSE(
636          [AC_LANG_PROGRAM(
637              [[
638 #include <stdlib.h>
639 #include <iconv.h>
640              ]],
641              [[
642 iconv_t ic;
643 size_t count;
644 count = iconv(ic, NULL, NULL, NULL, NULL);
645              ]])],
646          [
647           have_iconv="yes"
648           iconv_libs="-liconv"
649          ],
650          [
651           have_iconv="no"
652           LIBS=${LIBS_save}
653          ])
654
655       AC_MSG_RESULT([${have_iconv}])
656    fi
657
658    if test "x${have_iconv}" = "xno" ; then
659       AC_MSG_CHECKING([whether iconv() is in libiconv_plug.a])
660
661       LIBS_save="${LIBS}"
662       LIBS="-liconv_plug $LIBS"
663       AC_LINK_IFELSE(
664          [AC_LANG_PROGRAM(
665              [[
666 #include <stdlib.h>
667 #include <iconv.h>
668              ]],
669              [[
670 iconv_t ic;
671 size_t count = iconv(ic, NULL, NULL, NULL, NULL);
672              ]])],
673          [
674           have_iconv="yes"
675           iconv_libs="-liconv_plug"
676          ],
677          [
678           have_iconv="no"
679           LIBS=${LIBS_save}
680          ])
681
682       AC_MSG_RESULT([${have_iconv}])
683    fi
684 fi
685
686 AC_SUBST([iconv_libs])
687
688 if test "x${have_iconv}" = "xyes" ; then
689    AC_DEFINE([HAVE_ICONV], [1], [Set to 1 if iconv library is installed])
690 fi
691
692 # shmopen
693 have_shmopen=no
694 AC_MSG_CHECKING([for shm_open availability])
695
696 LIBS_save="${LIBS}"
697 LIBS="${LIBS} -lrt"
698 AC_LINK_IFELSE(
699    [AC_LANG_PROGRAM(
700        [[
701 #include <sys/mman.h>
702 #include <sys/stat.h>        /* For mode constants */
703 #include <fcntl.h>           /* For O_* constants */
704        ]],
705        [[
706 int fd;
707
708 fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
709        ]])],
710    [have_shmopen="yes"],
711    [have_shmopen="no"])
712
713 LIBS="${LIBS_save}"
714
715 AC_MSG_RESULT([${have_shmopen}])
716
717 if test "x${have_shmopen}" = "xyes"; then
718    AC_DEFINE([HAVE_SHMOPEN], [1], [Define to 1 if you have the `shm_open' function.])
719    rt_libs="-lrt"
720 fi
721
722 AC_SUBST([rt_libs])
723
724 # extended attribute
725
726 AC_MSG_CHECKING([for extended attributes])
727
728 AC_COMPILE_IFELSE(
729    [AC_LANG_PROGRAM(
730        [[
731 #include <stdlib.h>
732 #include <sys/types.h>
733 #include <sys/xattr.h>
734        ]],
735        [[
736 size_t tmp = listxattr("/", NULL, 0);
737 tmp = getxattr("/", "user.ethumb.md5", NULL, 0);
738 setxattr("/", "user.ethumb.md5", NULL, 0, 0);
739        ]])],
740    [
741     AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.])
742     have_xattr="yes"
743    ],
744    [have_xattr="no"])
745
746 AC_MSG_RESULT([${have_xattr}])
747
748 ### Modules
749
750 if test "x${have_default_mempool}" = "xyes" ; then
751    enable_chained_pool="no"
752    enable_pass_through="static"
753 else
754    enable_chained_pool="static"
755    enable_pass_through="no"
756 fi
757
758 enable_one_big="static"
759
760 EINA_CHECK_MODULE([chained-pool],   [${enable_chained_pool}], [chained pool])
761 EINA_CHECK_MODULE([ememoa-fixed],   [${enable_ememoa}],       [ememoa fixed])
762 EINA_CHECK_MODULE([ememoa-unknown], [${enable_ememoa}],       [ememoa unknown])
763 EINA_CHECK_MODULE([fixed-bitmap],   [no],                     [fixed bitmap])
764 EINA_CHECK_MODULE([pass-through],   [${enable_pass_through}], [pass through])
765 EINA_CHECK_MODULE([buddy],          [no],                     [buddy])
766 EINA_CHECK_MODULE([one-big],        [${enable_one_big}],      [one big])
767
768 ### Make the debug preprocessor configurable
769
770 ### Unit tests, coverage and benchmarking
771
772 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
773
774 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
775 EINA_CFLAGS="${EINA_CFLAGS} ${EFL_COVERAGE_CFLAGS}"
776 EINA_LIBS="${EINA_LIBS} ${EFL_COVERAGE_LIBS}"
777 if test "x$enable_coverage" = "xyes" ; then
778    EINA_CFLAGS="${EINA_CFLAGS} ${EFL_DEBUG_CFLAGS}"
779 fi
780
781 EFL_CHECK_BENCHMARK([enable_benchmark="yes"], [enable_benchmark="no"])
782 EINA_BENCH_MODULE([glib], [${enable_benchmark}], [glib-2.0], [enable_benchmark_glib="yes"], [enable_benchmark_glib="no"])
783 if test -n "$CXX" && test "x$enable_benchmark" = "xyes" ; then
784    AC_DEFINE_UNQUOTED([CITYHASH_BENCH], [1], [enable bench tests for google hash method])
785 fi
786 AM_CONDITIONAL([CITYHASH_BENCH], [test -n "$CXX" && test "x$enable_benchmark" = "xyes"])
787
788 AC_SUBST(requirement_eina)
789
790 ### Build and install examples
791 EFL_CHECK_BUILD_EXAMPLES([enable_build_examples="yes"], [enable_build_examples="no"])
792 EFL_CHECK_INSTALL_EXAMPLES([enable_install_examples="yes"], [enable_install_examples="no"])
793
794 AC_CONFIG_FILES([
795 Makefile
796 eina.pc
797 eina.spec
798 doc/Makefile
799 doc/Doxyfile
800 src/Makefile
801 src/include/Makefile
802 src/include/eina_config.h
803 src/lib/Makefile
804 src/modules/Makefile
805 src/modules/mp/Makefile
806 src/modules/mp/chained_pool/Makefile
807 src/modules/mp/ememoa_fixed/Makefile
808 src/modules/mp/ememoa_unknown/Makefile
809 src/modules/mp/pass_through/Makefile
810 src/modules/mp/fixed_bitmap/Makefile
811 src/modules/mp/buddy/Makefile
812 src/modules/mp/one_big/Makefile
813 src/tests/Makefile
814 src/examples/Makefile
815 ])
816
817 AC_OUTPUT
818
819 #####################################################################
820 ## Info
821
822 echo
823 echo
824 echo
825 echo "------------------------------------------------------------------------"
826 echo "$PACKAGE $VERSION"
827 echo "------------------------------------------------------------------------"
828 echo
829 echo
830 echo "Configuration Options Summary:"
831 echo
832 echo "  Magic debug..........: ${have_magic_debug}"
833 echo "  Safety checks........: ${have_safety_checks}"
834 echo "  Maximum log level....: ${with_max_log_level}"
835 echo "  Report string usage..: ${have_stringshare_usage}"
836 echo "  Valgrind support.....: ${have_valgrind}"
837 echo "  Default mempool......: ${have_default_mempool}"
838 echo "  Log support..........: ${enable_log}"
839 echo "  Thread Support.......: ${have_threads}"
840 if test "${have_threads}" = "POSIX" ; then
841 echo "    spinlock...........: ${have_posix_threads_spinlock}"
842 echo "    debug usage........: ${have_debug_threads}"
843 echo "    on/off support.....: ${have_on_off_threads}"
844 fi
845 echo "  Amalgamation.........: ${do_amalgamation}"
846 echo "  Iconv support........: ${have_iconv}"
847 echo "  File dirfd...........: ${have_dirfd}"
848 echo "  File xattr...........: ${have_xattr}"
849 echo
850 echo "  Documentation........: ${build_doc}"
851 echo "  Tests................: ${enable_tests}"
852 echo "  Coverage.............: ${enable_coverage}"
853 echo "  Examples.............: ${enable_build_examples}"
854 echo "  Tiler Example........: ${build_tiler_example}"
855 echo "  Examples installed...: ${enable_install_examples}"
856 echo "  Benchmark............: ${enable_benchmark}"
857 if test "x${enable_benchmark}" = "xyes" ; then
858 echo "    Glib...............: ${enable_benchmark_glib}"
859 echo "    E17 real data......: ${enable_benchmark_e17}"
860 fi
861 echo
862 echo "  CPU Specific Extensions:"
863 echo "    MMX................: ${have_mmx}"
864 echo "    SSE................: ${have_sse}"
865 echo "    SSE2...............: ${have_sse2}"
866 echo "    ALTIVEC............: ${have_altivec}"
867 echo
868 echo "  Memory pools:"
869 echo "    Buddy..............: ${enable_buddy}"
870 echo "    Chained pool.......: ${enable_chained_pool}"
871 echo "    Ememoa fixed.......: ${enable_ememoa_fixed}"
872 echo "    Ememoa unknown.....: ${enable_ememoa_unknown}"
873 echo "    Fixed bitmap.......: ${enable_fixed_bitmap}"
874 echo "    One big............: ${enable_one_big}"
875 echo "    Pass through.......: ${enable_pass_through}"
876 echo
877 echo "Compilation............: make (or gmake)"
878 echo "  CPPFLAGS.............: $CPPFLAGS"
879 echo "  CFLAGS...............: $CFLAGS"
880 echo "  LDFLAGS..............: $LDFLAGS"
881 echo
882 echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
883 echo "  prefix...............: $prefix"
884 echo
885 EFL_FORM_VOLTRON