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