use new spinlock detection
[profile/ivi/eina.git] / configure.ac
1 # get rid of that stupid cache mechanism
2 rm -f config.cache
3
4 AC_INIT([eina], [0.9.9.063], [enlightenment-devel@lists.sourceforge.net])
5 release="ver-pre-svn-05"
6 AC_PREREQ([2.60])
7 AC_CONFIG_SRCDIR([configure.ac])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CANONICAL_BUILD
10 AC_CANONICAL_HOST
11 AC_ISC_POSIX
12
13 AM_INIT_AUTOMAKE([1.6 dist-bzip2])
14 AM_CONFIG_HEADER([config.h])
15 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
16
17 AC_LIBTOOL_WIN32_DLL
18 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
19 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
20 AC_PROG_LIBTOOL
21
22 VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
23 VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
24 VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
25 SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
26 version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
27 AC_SUBST(VMAJ)
28 AC_SUBST(version_info)
29
30
31 ### Needed information
32
33 requirement_eina=""
34
35 case "$host_os" in
36    mingw32ce* | cegcc*)
37       MODULE_ARCH="$host_os-$host_cpu"
38       ;;
39    *)
40       release_info="-release $release"
41       MODULE_ARCH="$host_os-$host_cpu-$release"
42       ;;
43 esac
44 AC_SUBST(release_info)
45 AC_SUBST(MODULE_ARCH)
46 AC_DEFINE_UNQUOTED(MODULE_ARCH, "${MODULE_ARCH}", "Module architecture")
47
48 EFL_CHECK_CPU_MMX([have_mmx="yes"], [have_mmx="no"])
49 EFL_CHECK_CPU_SSE([have_sse="yes"], [have_sse="no"])
50 EFL_CHECK_CPU_SSE2([have_sse2="yes"], [have_sse2="no"])
51 EFL_CHECK_CPU_ALTIVEC([have_altivec="yes"], [have_altivec="no"])
52
53 EFL_CHECK_PTHREAD(["yes"],
54    [have_pthread="yes"],
55    [have_pthread="no"],
56    [have_pthread_spinlock="yes"],
57    [have_pthread_spinlock="no"])
58
59 ### Additional options to configure
60
61 # Magic debug
62 AC_ARG_ENABLE([magic-debug],
63    [AC_HELP_STRING([--disable-magic-debug], [disable magic debug of eina structure @<:@default=enabled@:>@])],
64    [
65     if test "x${enableval}" = "xyes" ; then
66        have_magic_debug="yes"
67     else
68        have_magic_debug="no"
69     fi
70    ],
71    [have_magic_debug="yes"])
72
73 AC_MSG_CHECKING([whether magic debug is enable])
74 AC_MSG_RESULT([${have_magic_debug}])
75
76 if test "x${have_magic_debug}" = "xyes" ; then
77    EINA_CONFIGURE_MAGIC_DEBUG="#define EINA_MAGIC_DEBUG"
78 fi
79 AC_SUBST(EINA_CONFIGURE_MAGIC_DEBUG)
80
81 # Safety checks (avoid crashes on wrong api usage)
82 AC_ARG_ENABLE(safety-checks,
83    [AC_HELP_STRING([--disable-safety-checks], [disable safety checks for NULL pointers and like. @<:@default=enabled@:>@])],
84    [
85     if test "x${enableval}" = "xyes" ; then
86        have_safety_checks="yes"
87     else
88        have_safety_checks="no"
89     fi
90    ],
91    [have_safety_checks="yes"])
92
93 AC_MSG_CHECKING(whether to do safety checking on api parameters)
94 AC_MSG_RESULT($have_safety_checks)
95
96 AM_CONDITIONAL(SAFETY_CHECKS, test "x$have_safety_checks" = "xyes")
97 if test "x$have_safety_checks" = "xyes"; then
98   AC_DEFINE(EINA_SAFETY_CHECKS, 1, [disable safety checks for NULL pointers and like.])
99   EINA_CONFIGURE_SAFETY_CHECKS="#define EINA_SAFETY_CHECKS"
100 fi
101 AC_SUBST(EINA_CONFIGURE_SAFETY_CHECKS)
102
103 with_max_log_level="<unset>"
104 AC_ARG_WITH(internal-maximum-log-level,
105    [AC_HELP_STRING([--with-internal-maximum-log-level=NUMBER],
106                    [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.])],
107    [
108     if test "x${withval}" != "xno"; then
109        if echo "${withval}" | grep '^[[0-9]]\+$' >/dev/null 2>/dev/null; then
110           AC_MSG_NOTICE([ignoring any EINA_LOG() with level greater than ${withval}])
111           AC_DEFINE_UNQUOTED(EINA_LOG_LEVEL_MAXIMUM, ${withval}, [if set, logging is limited to this amount.])
112           with_max_log_level="${withval}"
113        else
114           AC_MSG_ERROR([--with-internal-maximum-log-level takes a decimal number, got "${withval}" instead.])
115        fi
116     fi
117     ], [:])
118
119 AC_ARG_ENABLE([amalgamation],
120    [AC_HELP_STRING([--enable-amalgamation], [enable generation of one single file with all source code in it, helps compiler optimizations.])],
121    [if test "x${enableval}" = "xyes"; then
122        do_amalgamation="yes"
123     else
124        do_amalgamation="no"
125     fi
126    ],
127    [do_amalgamation="no"]
128 )
129 AM_CONDITIONAL(EINA_AMALGAMATION, test "x${do_amalgamation}" = "xyes")
130
131 # Choose best memory pool
132 AC_ARG_ENABLE([default-mempool],
133    [AC_HELP_STRING([--enable-default-mempool], [Default memory allocator could be faster for some computer. @<:@default=disabled@:>@])],
134    [
135     if test "x${enableval}" = "xyes"; then
136        have_default_mempool="yes"
137     else
138        have_default_mempool="no"
139     fi
140    ],
141    [have_default_mempool="no"]
142 )
143 AC_MSG_CHECKING([whether to use default mempool allocator])
144 AC_MSG_RESULT([${have_default_mempool}])
145
146 if test "x${have_default_mempool}" = "xyes" ; then
147    EINA_CONFIGURE_DEFAULT_MEMPOOL="#define EINA_DEFAULT_MEMPOOL"
148 fi
149 AC_SUBST(EINA_CONFIGURE_DEFAULT_MEMPOOL)
150
151 # Report stringshare usage
152 AC_ARG_ENABLE([stringshare-usage],
153    [AC_HELP_STRING([--enable-stringshare-usage], [Report stringshare usage on stringshare shutdown. @<:@default=disabled@:>@])],
154    [
155     if test "x${enableval}" = "xyes"; then
156        have_stringshare_usage="yes"
157     else
158        have_stringshare_usage="no"
159     fi
160    ],
161    [have_stringshare_usage="no"]
162 )
163 AC_MSG_CHECKING([whether to report stringshare usage])
164 AC_MSG_RESULT([${have_stringshare_usage}])
165
166 if test "x${have_stringshare_usage}" = "xyes"; then
167    AC_DEFINE(EINA_STRINGSHARE_USAGE, 1, [Report Eina stringshare usage pattern])
168 fi
169
170 # Check if we want to benchmark on real data
171 enable_benchmark_e17="no"
172 AC_ARG_ENABLE([e17],
173    [AC_HELP_STRING([--enable-e17], [enable heavy benchmark @<:@default=no@:>@])],
174    [
175     if test "x${enableval}" = "xyes" ; then
176        enable_benchmark_e17="yes"
177     else
178        enable_benchmark_e17="no"
179     fi
180    ],
181    [enable_benchmark_e17="no"])
182
183 AC_MSG_CHECKING([whether e17 real data benchmark are built])
184 AC_MSG_RESULT([${enable_benchmark_e17}])
185
186 AM_CONDITIONAL(EINA_ENABLE_BENCHMARK_E17, test "x${enable_benchmark_e17}" = "xyes")
187
188
189 ### Checks for programs
190 AC_PROG_CC
191
192 # pkg-config
193 PKG_PROG_PKG_CONFIG
194
195 # Check whether pkg-config supports Requires.private
196 if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
197    pkgconfig_requires_private="Requires.private"
198 else
199    pkgconfig_requires_private="Requires"
200 fi
201 AC_SUBST(pkgconfig_requires_private)
202
203 # doxygen program for documentation building
204
205 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
206
207
208 ### Checks for libraries
209
210 # Evil library for compilation on Windows CE
211
212 EFL_EINA_BUILD=""
213 case "$host_os" in
214    mingw* | cegcc*)
215       PKG_CHECK_MODULES([EVIL], [evil])
216       AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed])
217       requirement_eina="evil"
218       EFL_EINA_BUILD="-DEFL_EINA_BUILD"
219    ;;
220 esac
221 AC_SUBST(EFL_EINA_BUILD)
222
223 # Check ememoa memory pool library
224
225 AC_ARG_ENABLE([ememoa],
226    [AC_HELP_STRING([--enable-ememoa], [build ememoa memory pool module @<:@default=yes@:>@])],
227    [
228     if test "x${enableval}" = "xyes" ; then
229        enable_ememoa="yes"
230     else
231        enable_ememoa="no"
232     fi
233    ],
234    [enable_ememoa="yes"]
235 )
236 AC_MSG_CHECKING([whether to use ememoa for memory pool])
237 AC_MSG_RESULT([$enable_ememoa])
238
239 if test "x${enable_ememoa}" = "xyes" ; then
240    PKG_CHECK_MODULES([EMEMOA],
241       [ememoa >= 0.0.26 ],
242       [enable_ememoa="yes"],
243       [enable_ememoa="no"]
244    )
245 fi
246
247 AM_CONDITIONAL(EINA_ENABLE_EMEMOA, test "x${enable_ememoa}" = "xyes")
248 if test "x${enable_ememoa}" = "xyes"; then
249    AC_DEFINE(EINA_EMEMOA_SUPPORT, 1, [Use by the test suite to try ememoa mempool])
250 fi
251
252 ### Checks for header files
253 AC_HEADER_ASSERT
254 AC_HEADER_DIRENT
255 AC_HEADER_TIME
256
257 AC_CHECK_HEADER([fnmatch.h],
258    [dummy="yes"],
259    [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])])
260
261 ### Checks for types
262
263
264 ### Checks for structures
265
266
267 ### Checks for compiler characteristics
268 AC_C_CONST
269 AC_C_BIGENDIAN
270 AC_C_INLINE
271 AC_C___ATTRIBUTE__
272 AC_PROG_CC_STDC
273
274 EINA_CPPFLAGS=""
275 case "$host_os" in
276    mingw32ce* | cegcc*)
277       EINA_CPPFLAGS="-D_WIN32_WCE=0x0420"
278       ;;
279    mingw*)
280       EINA_CPPFLAGS="-D_WIN32_WINNT=0x0500"
281       ;;
282 esac
283
284 EINA_CFLAGS=
285 case "${host_os}" in
286    cegcc*)
287       EINA_CFLAGS="${EVIL_CFLAGS} -mwin32"
288    ;;
289    mingw*)
290       EINA_CFLAGS="${EVIL_CFLAGS}"
291    ;;
292 esac
293
294 if ! test "x${VMIC}" = "x" ; then
295    CFLAGS_save="${CFLAGS}"
296    CFLAGS="${CFLAGS} -Wall -W"
297    AC_COMPILE_IFELSE(
298       [AC_LANG_PROGRAM([[]])],
299       [have_Wall="yes"],
300       [have_Wall="no"])
301    AC_MSG_CHECKING([whether the compiler supports -Wall])
302    AC_MSG_RESULT([${have_Wall}])
303    CFLAGS="${CFLAGS_save}"
304    if test "x${have_Wall}" = "xyes" ; then
305       EINA_CFLAGS="${EINA_CFLAGS} -Wall -W" # -Werror
306    fi
307 fi
308
309 CFLAGS_save="${CFLAGS}"
310 CFLAGS="${CFLAGS} -fno-strict-aliasing"
311 AC_COMPILE_IFELSE(
312    [AC_LANG_PROGRAM([[]])],
313    [have_no_strict_aliasing="yes"],
314    [have_no_strict_aliasing="no"])
315 AC_MSG_CHECKING([whether the compiler supports -fno-strict-aliasing])
316 AC_MSG_RESULT([${have_no_strict_aliasing}])
317 CFLAGS="${CFLAGS_save}"
318 if test "x${have_no_strict_aliasing}" = "xyes" ; then
319    EINA_CFLAGS="${EINA_CFLAGS} -fno-strict-aliasing"
320 fi
321
322 AC_SUBST(EINA_CPPFLAGS)
323 AC_SUBST(EINA_CFLAGS)
324
325
326 ### Checks for linker characteristics
327 EINA_LIBS=
328 lt_enable_auto_import=""
329 case "${host_os}" in
330    mingw* | cegcc*)
331       EINA_LIBS="-ldl ${EVIL_LIBS} -lm"
332       lt_enable_auto_import="-Wl,--enable-auto-import"
333    ;;
334    dragonfly*|openbsd*)
335       EINA_LIBS="-lm"
336    ;;
337    freebsd*|netbsd*)
338       EINA_LIBS="-lrt -lm"
339    ;;
340    darwin*)
341       EINA_LIBS="-lm"
342    ;;
343    cygwin*)
344       EINA_LIBS="-ldl -lm"
345    ;;
346    *)
347       EINA_LIBS="-ldl -lrt -lm"
348    ;;
349 esac
350 AC_SUBST(EINA_LIBS)
351 AC_SUBST(lt_enable_auto_import)
352
353
354 ### Checks for library functions
355 AC_FUNC_ALLOCA
356
357 #dlopen and dladdr
358 dlopen_libs=""
359 case "$host_os" in
360    mingw* | cegcc*)
361 # managed by evil
362       AC_DEFINE(HAVE_DLADDR)
363       ;;
364    *)
365       AC_CHECK_FUNCS([dlopen], [res="yes"], [res="no"])
366       if test "x${res}" = "xyes" ; then
367          AC_CHECK_FUNCS([dladdr], [AC_DEFINE(HAVE_DLADDR)])
368       else
369          AC_CHECK_LIB([dl], [dlopen], [res="yes"], [res="no"])
370          if test "x${res}" = "xyes" ; then
371             AC_CHECK_LIB([dl], [dladdr], [AC_DEFINE(HAVE_DLADDR)])
372             dlopen_libs="-ldl"
373          else
374             AC_MSG_ERROR([Cannot find dlopen])
375          fi
376       fi
377       ;;
378 esac
379 AC_SUBST(dlopen_libs)
380
381 fnmatch_libs=""
382 AC_CHECK_FUNCS([fnmatch], [res="yes"], [res="no"])
383 if test "x$res" = "xno"; then
384    AC_SEARCH_LIBS([fnmatch],
385       [fnmatch evil iberty],
386       [res="yes"],
387       [res="no"])
388    if test "x$res" = "xno"; then
389       AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty, nor libevil])
390    fi
391    fnmatch_libs="${ac_cv_search_fnmatch}"
392 fi
393 AC_SUBST(fnmatch_libs)
394
395 ### Modules
396
397 EINA_CHECK_MODULE([chained-pool], [yes], [chained pool])
398 EINA_CHECK_MODULE([ememoa-fixed], [${enable_ememoa}], [ememoa fixed])
399 EINA_CHECK_MODULE([ememoa-unknown], [${enable_ememoa}], [ememoa unknown])
400 EINA_CHECK_MODULE([fixed-bitmap], [yes], [fixed bitmap])
401 EINA_CHECK_MODULE([pass-through], [yes], [pass through])
402
403
404 ### Make the debug preprocessor configurable
405
406 ### Unit tests, coverage and benchmarking
407
408 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
409
410 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
411 EINA_CFLAGS="${EINA_CFLAGS} ${EFL_COVERAGE_CFLAGS}"
412 EINA_LIBS="${EINA_LIBS} ${EFL_COVERAGE_LIBS}"
413 if test "x$enable_coverage" = "xyes" ; then
414    EINA_CFLAGS="${EINA_CFLAGS} ${EFL_DEBUG_CFLAGS}"
415 fi
416
417 EFL_CHECK_BENCHMARK([enable_benchmark="yes"], [enable_benchmark="no"])
418 EINA_BENCH_MODULE([evas], [${enable_benchmark}], [evas], [enable_benchmark_evas="yes"], [enable_benchmark_evas="no"])
419 EINA_BENCH_MODULE([ecore], [${enable_benchmark}], [ecore], [enable_benchmark_ecore="yes"], [enable_benchmark_ecore="no"])
420 EINA_BENCH_MODULE([glib], [${enable_benchmark}], [glib-2.0], [enable_benchmark_glib="yes"], [enable_benchmark_glib="no"])
421
422 AC_SUBST(requirement_eina)
423
424 ### Create the .pc.in file according to the major version
425 #cat > ${srcdir}/eina-${VMAJ}.pc.in << EOF
426 #prefix=@prefix@
427 #exec_prefix=@exec_prefix@
428 #libdir=@libdir@
429 #includedir=@includedir@
430 #
431 #Name: Eina
432 #Description: A Library that implements fast data types and miscellaneous tools
433 #Requires:
434 #Version: @VERSION@
435 #Libs: -L${libdir} -leina
436 #Libs.private: -ldl
437 #Cflags: -I${includedir}/eina-@VMAJ@ -I${includedir}/eina-@VMAJ@/eina
438 #EOF
439
440 AC_CONFIG_FILES([
441 Makefile
442 eina-0.pc
443 eina.spec
444 doc/Makefile
445 src/Makefile
446 src/include/Makefile
447 src/include/eina_config.h
448 src/lib/Makefile
449 src/modules/Makefile
450 src/modules/mp/Makefile
451 src/modules/mp/chained_pool/Makefile
452 src/modules/mp/ememoa_fixed/Makefile
453 src/modules/mp/ememoa_unknown/Makefile
454 src/modules/mp/pass_through/Makefile
455 src/modules/mp/fixed_bitmap/Makefile
456 src/tests/Makefile
457 ])
458
459 AC_OUTPUT
460
461 #####################################################################
462 ## Info
463
464 echo
465 echo
466 echo
467 echo "------------------------------------------------------------------------"
468 echo "$PACKAGE $VERSION"
469 echo "------------------------------------------------------------------------"
470 echo
471 echo
472 echo "Configuration Options Summary:"
473 echo
474 echo "  Magic debug..........: ${have_magic_debug}"
475 echo "  Safety checks........: ${have_safety_checks}"
476 echo "  Maximum log level....: ${with_max_log_level}"
477 echo "  Report string usage..: ${have_stringshare_usage}"
478 echo "  Default mempool......: ${have_default_mempool}"
479 echo "  Thread Support.......: ${have_pthread} (spinlock: ${have_pthread_spinlock})"
480 echo "  Amalgamation.........: ${do_amalgamation}"
481 echo
482 echo "  Documentation........: ${build_doc}"
483 echo "  Tests................: ${enable_tests}"
484 echo "  Coverage.............: ${enable_coverage}"
485 echo "  Benchmark............: ${enable_benchmark}"
486 if test "x${enable_benchmark}" = "xyes" ; then
487 echo "    Glib...............: ${enable_benchmark_glib}"
488 echo "    Evas...............: ${enable_benchmark_evas}"
489 echo "    Ecore..............: ${enable_benchmark_ecore}"
490 echo "    E17 real data......: ${enable_benchmark_e17}"
491 fi
492 echo
493 echo "  CPU Specific Extensions:"
494 echo "    MMX................: ${have_mmx}"
495 echo "    SSE................: ${have_sse}"
496 echo "    SSE2...............: ${have_sse2}"
497 echo "    ALTIVEC............: ${have_altivec}"
498 echo
499 echo "  Memory pools:"
500 echo "    Chained pool.......: ${enable_chained_pool}"
501 echo "    Ememoa fixed.......: ${enable_ememoa_fixed}"
502 echo "    Ememoa unknown.....: ${enable_ememoa_unknown}"
503 echo "    Fixed bitmap.......: ${enable_fixed_bitmap}"
504 echo "    Pass through.......: ${enable_pass_through}"
505 echo
506 echo "Compilation............: make (or gmake)"
507 echo "  CPPFLAGS.............: $CPPFLAGS"
508 echo "  CFLAGS...............: $CFLAGS"
509 echo "  LDFLAGS..............: $LDFLAGS"
510 echo
511 echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
512 echo "  prefix...............: $prefix"
513 echo
514 if test "x${have_static_module}" = "xyes" ; then
515 echo -e "\0033\01331;31mWarning\0033\01331;0m: You are trying to link statically one or more modules to Eina."
516 echo "         You must know what you are doing, or else you will have a lot of problems."
517 echo "         And dolphins will disappear from the earth."
518 echo "         Think about that."
519 echo
520 fi