* more quoting
[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 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
15
16 AC_LIBTOOL_WIN32_DLL
17 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
18 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
19 AC_PROG_LIBTOOL
20
21 VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
22 VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
23 VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
24 SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
25 version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
26 AC_SUBST(VMAJ)
27 AC_SUBST(version_info)
28
29
30 ### Needed information
31
32 requirement_eina=""
33
34 release="ver-pre-svn-04"
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([have_pthread="yes"], [have_pthread="no"])
54
55 if test "x${have_pthread}" = "xyes"; then
56    AC_CHECK_LIB(pthread, pthread_spin_init,
57                 [
58                   AC_DEFINE(EINA_PTHREAD_SPIN, 1, [Build eina_log lock using pthread_spin])
59                 ])
60 fi
61
62 ### Additional options to configure
63
64 # Magic debug
65 AC_ARG_ENABLE([magic-debug],
66    [AC_HELP_STRING([--disable-magic-debug], [disable magic debug of eina structure @<:@default=enabled@:>@])],
67    [
68     if test "x${enableval}" = "xyes" ; then
69        have_magic_debug="yes"
70     else
71        have_magic_debug="no"
72     fi
73    ],
74    [have_magic_debug="yes"])
75
76 AC_MSG_CHECKING([whether magic debug is enable])
77 AC_MSG_RESULT([${have_magic_debug}])
78
79 if test "x${have_magic_debug}" = "xyes" ; then
80    EINA_CONFIGURE_MAGIC_DEBUG="#define EINA_MAGIC_DEBUG"
81 fi
82 AC_SUBST(EINA_CONFIGURE_MAGIC_DEBUG)
83
84 # Safety checks (avoid crashes on wrong api usage)
85 AC_ARG_ENABLE(safety-checks,
86    [AC_HELP_STRING([--disable-safety-checks], [disable safety checks for NULL pointers and like. @<:@default=enabled@:>@])],
87    [
88     if test "x${enableval}" = "xyes" ; then
89        have_safety_checks="yes"
90     else
91        have_safety_checks="no"
92     fi
93    ],
94    [have_safety_checks="yes"])
95
96 AC_MSG_CHECKING(whether to do safety checking on api parameters)
97 AC_MSG_RESULT($have_safety_checks)
98
99 AM_CONDITIONAL(SAFETY_CHECKS, test "x$have_safety_checks" = "xyes")
100 if test "x$have_safety_checks" = "xyes"; then
101   AC_DEFINE(EINA_SAFETY_CHECKS, 1, [disable safety checks for NULL pointers and like.])
102   EINA_CONFIGURE_SAFETY_CHECKS="#define EINA_SAFETY_CHECKS"
103 fi
104 AC_SUBST(EINA_CONFIGURE_SAFETY_CHECKS)
105
106 with_max_log_level="<unset>"
107 AC_ARG_WITH(internal-maximum-log-level,
108    [AC_HELP_STRING([--with-internal-maximum-log-level=NUMBER],
109                    [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.])],
110    [
111     if test "x${withval}" != "xno"; then
112        if echo "${withval}" | grep '^[[0-9]]\+$' >/dev/null 2>/dev/null; then
113           AC_MSG_NOTICE([ignoring any EINA_LOG() with level greater than ${withval}])
114           AC_DEFINE_UNQUOTED(EINA_LOG_LEVEL_MAXIMUM, ${withval}, [if set, logging is limited to this amount.])
115           with_max_log_level="${withval}"
116        else
117           AC_MSG_ERROR([--with-internal-maximum-log-level takes a decimal number, got "${withval}" instead.])
118        fi
119     fi
120     ], [:])
121
122 AC_ARG_ENABLE([amalgamation],
123    [AC_HELP_STRING([--disable-amalgamation], [disable generation of one single file with all source code in it, helps compiler optimizations.])],
124    [if test "x${enableval}" = "xno"; then
125        do_amalgamation="no"
126     else
127        do_amalgamation="yes"
128     fi
129    ],
130    [do_amalgamation="yes"]
131 )
132 AM_CONDITIONAL(EINA_AMALGAMATION, test "x${do_amalgamation}" = "xyes")
133
134 # Choose best memory pool
135 AC_ARG_ENABLE([default-mempool],
136    [AC_HELP_STRING([--enable-default-mempool], [Default memory allocator could be faster for some computer. @<:@default=disabled@:>@])],
137    [
138     if test "x${enableval}" = "xyes"; then
139        have_default_mempool="yes"
140     else
141        have_default_mempool="no"
142     fi
143    ],
144    [have_default_mempool="no"]
145 )
146 AC_MSG_CHECKING([whether to use default mempool allocator])
147 AC_MSG_RESULT([${have_default_mempool}])
148
149 if test "x${have_default_mempool}" = "xyes" ; then
150    EINA_CONFIGURE_DEFAULT_MEMPOOL="#define EINA_DEFAULT_MEMPOOL"
151 fi
152 AC_SUBST(EINA_CONFIGURE_DEFAULT_MEMPOOL)
153
154 # Report stringshare usage
155 AC_ARG_ENABLE([stringshare-usage],
156    [AC_HELP_STRING([--enable-stringshare-usage], [Report stringshare usage on stringshare shutdown. @<:@default=disabled@:>@])],
157    [
158     if test "x${enableval}" = "xyes"; then
159        have_stringshare_usage="yes"
160     else
161        have_stringshare_usage="no"
162     fi
163    ],
164    [have_stringshare_usage="no"]
165 )
166 AC_MSG_CHECKING([whether to report stringshare usage])
167 AC_MSG_RESULT([${have_stringshare_usage}])
168
169 if test "x${have_stringshare_usage}" = "xyes"; then
170    AC_DEFINE(EINA_STRINGSHARE_USAGE, 1, [Report Eina stringshare usage pattern])
171 fi
172
173 # Check if we want to benchmark on real data
174 enable_benchmark_e17="no"
175 AC_ARG_ENABLE([e17],
176    [AC_HELP_STRING([--enable-e17], [enable heavy benchmark @<:@default=no@:>@])],
177    [
178     if test "x${enableval}" = "xyes" ; then
179        enable_benchmark_e17="yes"
180     else
181        enable_benchmark_e17="no"
182     fi
183    ],
184    [enable_benchmark_e17="no"])
185
186 AC_MSG_CHECKING([whether e17 real data benchmark are built])
187 AC_MSG_RESULT([${enable_benchmark_e17}])
188
189 AM_CONDITIONAL(EINA_ENABLE_BENCHMARK_E17, test "x${enable_benchmark_e17}" = "xyes")
190
191
192 ### Checks for programs
193 AC_PROG_CC
194
195 # pkg-config
196 PKG_PROG_PKG_CONFIG
197
198 # Check whether pkg-config supports Requires.private
199 if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
200    pkgconfig_requires_private="Requires.private"
201 else
202    pkgconfig_requires_private="Requires"
203 fi
204 AC_SUBST(pkgconfig_requires_private)
205
206 # doxygen program for documentation building
207
208 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
209
210
211 ### Checks for libraries
212
213 # Evil library for compilation on Windows CE
214
215 EFL_EINA_BUILD=""
216 case "$host_os" in
217    mingw* | cegcc*)
218       PKG_CHECK_MODULES([EVIL], [evil])
219       AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed])
220       requirement_eina="evil"
221       EFL_EINA_BUILD="-DEFL_EINA_BUILD"
222    ;;
223 esac
224 AC_SUBST(EFL_EINA_BUILD)
225
226 # Check ememoa memory pool library
227
228 AC_ARG_ENABLE([ememoa],
229    [AC_HELP_STRING([--enable-ememoa], [build ememoa memory pool module @<:@default=yes@:>@])],
230    [
231     if test "x${enableval}" = "xyes" ; then
232        enable_ememoa="yes"
233     else
234        enable_ememoa="no"
235     fi
236    ],
237    [enable_ememoa="yes"]
238 )
239 AC_MSG_CHECKING([whether to use ememoa for memory pool])
240 AC_MSG_RESULT([$enable_ememoa])
241
242 if test "x${enable_ememoa}" = "xyes" ; then
243    PKG_CHECK_MODULES([EMEMOA],
244       [ememoa >= 0.0.26 ],
245       [enable_ememoa="yes"],
246       [enable_ememoa="no"]
247    )
248 fi
249
250 AM_CONDITIONAL(EINA_ENABLE_EMEMOA, test "x${enable_ememoa}" = "xyes")
251 if test "x${enable_ememoa}" = "xyes"; then
252    AC_DEFINE(EINA_EMEMOA_SUPPORT, 1, [Use by the test suite to try ememoa mempool])
253 fi
254
255 ### Checks for header files
256 AC_HEADER_ASSERT
257 AC_HEADER_DIRENT
258 AC_HEADER_TIME
259
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 ### Modules
382
383 EINA_CHECK_MODULE([chained-pool], [yes], [chained pool])
384 EINA_CHECK_MODULE([ememoa-fixed], [${enable_ememoa}], [ememoa fixed])
385 EINA_CHECK_MODULE([ememoa-unknown], [${enable_ememoa}], [ememoa unknown])
386 EINA_CHECK_MODULE([fixed-bitmap], [yes], [fixed bitmap])
387 EINA_CHECK_MODULE([pass-through], [yes], [pass through])
388
389
390 ### Make the debug preprocessor configurable
391
392 ### Unit tests, coverage and benchmarking
393
394 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
395
396 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
397 EINA_CFLAGS="${EINA_CFLAGS} ${EFL_COVERAGE_CFLAGS}"
398 EINA_LIBS="${EINA_LIBS} ${EFL_COVERAGE_LIBS}"
399 if test "x$enable_coverage" = "xyes" ; then
400    EINA_CFLAGS="${EINA_CFLAGS} ${EFL_DEBUG_CFLAGS}"
401 fi
402
403 EFL_CHECK_BENCHMARK([enable_benchmark="yes"], [enable_benchmark="no"])
404 EINA_BENCH_MODULE([evas], [${enable_benchmark}], [evas], [enable_benchmark_evas="yes"], [enable_benchmark_evas="no"])
405 EINA_BENCH_MODULE([ecore], [${enable_benchmark}], [ecore], [enable_benchmark_ecore="yes"], [enable_benchmark_ecore="no"])
406 EINA_BENCH_MODULE([glib], [${enable_benchmark}], [glib-2.0], [enable_benchmark_glib="yes"], [enable_benchmark_glib="no"])
407
408 AC_SUBST(requirement_eina)
409
410 ### Create the .pc.in file according to the major version
411 #cat > ${srcdir}/eina-${VMAJ}.pc.in << EOF
412 #prefix=@prefix@
413 #exec_prefix=@exec_prefix@
414 #libdir=@libdir@
415 #includedir=@includedir@
416 #
417 #Name: Eina
418 #Description: A Library that implements fast data types and miscellaneous tools
419 #Requires:
420 #Version: @VERSION@
421 #Libs: -L${libdir} -leina
422 #Libs.private: -ldl
423 #Cflags: -I${includedir}/eina-@VMAJ@ -I${includedir}/eina-@VMAJ@/eina
424 #EOF
425
426 AC_CONFIG_FILES([
427 Makefile
428 eina-0.pc
429 eina.spec
430 doc/Makefile
431 src/Makefile
432 src/include/Makefile
433 src/include/eina_config.h
434 src/lib/Makefile
435 src/modules/Makefile
436 src/modules/mp/Makefile
437 src/modules/mp/chained_pool/Makefile
438 src/modules/mp/ememoa_fixed/Makefile
439 src/modules/mp/ememoa_unknown/Makefile
440 src/modules/mp/pass_through/Makefile
441 src/modules/mp/fixed_bitmap/Makefile
442 src/tests/Makefile
443 ])
444
445 AC_OUTPUT
446
447 #####################################################################
448 ## Info
449
450 echo
451 echo
452 echo
453 echo "------------------------------------------------------------------------"
454 echo "$PACKAGE $VERSION"
455 echo "------------------------------------------------------------------------"
456 echo
457 echo
458 echo "Configuration Options Summary:"
459 echo
460 echo "  Magic debug..........: ${have_magic_debug}"
461 echo "  Safety checks........: ${have_safety_checks}"
462 echo "  Maximum log level....: ${with_max_log_level}"
463 echo "  Report string usage..: ${have_stringshare_usage}"
464 echo "  Default mempool......: ${have_default_mempool}"
465 echo "  Thread Support.......: ${have_pthread}"
466 echo "  Amalgamation.........: ${do_amalgamation}"
467 echo
468 echo "  Documentation........: ${build_doc}"
469 echo "  Tests................: ${enable_tests}"
470 echo "  Coverage.............: ${enable_coverage}"
471 echo "  Benchmark............: ${enable_benchmark}"
472 if test "x${enable_benchmark}" = "xyes" ; then
473 echo "    Glib...............: ${enable_benchmark_glib}"
474 echo "    Evas...............: ${enable_benchmark_evas}"
475 echo "    Ecore..............: ${enable_benchmark_ecore}"
476 echo "    E17 real data......: ${enable_benchmark_e17}"
477 fi
478 echo
479 echo "CPU Specific Extensions:"
480 echo
481 echo "  MMX..................: ${have_mmx}"
482 echo "  SSE..................: ${have_sse}"
483 echo "  SSE2.................: ${have_sse2}"
484 echo "  ALTIVEC..............: ${have_altivec}"
485 echo
486 echo "  Memory pools:"
487 echo "    Chained pool.......: ${enable_chained_pool}"
488 echo "    Ememoa fixed.......: ${enable_ememoa_fixed}"
489 echo "    Ememoa unknown.....: ${enable_ememoa_unknown}"
490 echo "    Fixed bitmap.......: ${enable_fixed_bitmap}"
491 echo "    Pass through.......: ${enable_pass_through}"
492 echo
493 echo "  Installation.........: make install"
494 echo
495 echo "    prefix.............: $prefix"
496 echo
497 echo "Now type 'make' ('gmake' on some systems) to compile $PACKAGE,"
498 echo "and then afterwards as root (or the user who will install this), type"
499 echo "'make install'. Change users with 'su' or 'sudo' appropriately."
500 echo
501 if test "x${have_static_module}" = "xyes" ; then
502 echo -e "\0033\01331;31mWarning\0033\01331;0m: You are trying to link statically one or more modules to Eina."
503 echo "         You must know what you are doing, or else you will have a lot of problems."
504 echo "         And dolphins will disappear from the earth."
505 echo "         Think about that."
506 echo
507 fi