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