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