aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/configure.ac
blob: 38fb13d2b02b8df4e0699c2702cf429c65ee4872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_maj], [1])
m4_define([v_min], [2])
m4_define([v_mic], [0])
m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
##--   When released, remove the dnl on the below line
m4_undefine([v_rev])
##--   When doing snapshots - change soname. remove dnl on below line
dnl m4_define([relname], [ver-pre-svn-07])
dnl m4_define([v_rel], [-release relname])
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])], [m4_define([v_ver], [v_maj.v_min.v_mic])])
m4_define([lt_cur], m4_eval(v_maj + v_min))
m4_define([lt_rev], v_mic)
m4_define([lt_age], v_min)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##

AC_INIT([eina], [v_ver]-alpha, [enlightenment-devel@lists.sourceforge.net])
AC_PREREQ([2.59])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])

AC_CONFIG_HEADERS([config.h])
AH_TOP([
#ifndef EFL_CONFIG_H__
#define EFL_CONFIG_H__
])
AH_BOTTOM([
#endif /* EFL_CONFIG_H__ */
])

AM_INIT_AUTOMAKE([1.6 dist-bzip2])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_GNU_SOURCE
AC_SYS_LARGEFILE

AC_LIBTOOL_WIN32_DLL
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
AC_PROG_LIBTOOL

##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
m4_ifdef([v_rel], , [m4_define([v_rel], [])])
AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
version_info="lt_cur:lt_rev:lt_age"
release_info="v_rel"
AC_SUBST(version_info)
AC_SUBST(release_info)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
VMAJ=v_maj
AC_SUBST(VMAJ)


### Needed information

AC_CANONICAL_BUILD
AC_CANONICAL_HOST

requirement_eina=""

case "$host_os" in
   mingw32ce*)
      MODULE_ARCH="$host_os-$host_cpu"
      ;;
   *)
      MODULE_ARCH="$host_os-$host_cpu-v_maj.v_min.v_mic"
      ;;
esac
AC_SUBST(MODULE_ARCH)
AC_DEFINE_UNQUOTED(MODULE_ARCH, "${MODULE_ARCH}", "Module architecture")

case "$host_os" in
   mingw*)
      MODULE_EXT=".dll"
      ;;
   *)
      MODULE_EXT=".so"
      ;;
esac

AC_DEFINE_UNQUOTED(SHARED_LIB_SUFFIX, "${MODULE_EXT}", [Suffix for shared objects])

EFL_CHECK_CPU_MMX([have_mmx="yes"], [have_mmx="no"])
EFL_CHECK_CPU_SSE([have_sse="yes"], [have_sse="no"])
EFL_CHECK_CPU_SSE2([have_sse2="yes"], [have_sse2="no"])
EFL_CHECK_CPU_ALTIVEC([have_altivec="yes"], [have_altivec="no"])

EFL_CHECK_THREADS(
   [
    if test "x${_efl_have_posix_threads}" = "xyes" ; then
       have_threads="POSIX"
    else
       if test "x${_efl_have_win32_threads}" = "xyes" ; then
          have_threads="Win32"
       else
          have_threads="no"
       fi
    fi
   ],
   [have_threads="no"])
EFL_CHECK_SPINLOCK([have_posix_threads_spinlock="yes"], [have_posix_threads_spinlock="no"])

if ! test "x${have_threads}" = "xno" ; then
   EINA_CONFIGURE_HAVE_THREADS="#define EINA_HAVE_THREADS"
fi
AC_SUBST(EINA_CONFIGURE_HAVE_THREADS)
AM_CONDITIONAL([EINA_HAVE_THREADS], [! test "x${have_threads}" = "xno"])

if ! test "x${have_debug_threads}" = "xno"; then
   EINA_CONFIGURE_HAVE_DEBUG_THREADS="#define EINA_HAVE_DEBUG_THREADS"
fi
AC_SUBST(EINA_CONFIGURE_HAVE_DEBUG_THREADS)
AM_CONDITIONAL([EINA_DEBUG_THREADS], [! test "x${have_debug_threads}" = "xno"])

if ! test "x${have_on_off_threads}" = "xno"; then
   EINA_CONFIGURE_HAVE_ON_OFF_THREADS="#define EINA_HAVE_ON_OFF_THREADS"
fi
AC_SUBST(EINA_CONFIGURE_HAVE_ON_OFF_THREADS)
AM_CONDITIONAL([EINA_ON_OFF_THREADS], [! test "x${have_on_off_threads}" = "xno"])

### Additional options to configure

# Magic debug
AC_ARG_ENABLE([magic-debug],
   [AC_HELP_STRING([--disable-magic-debug], [disable magic debug of eina structure @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_magic_debug="yes"
    else
       have_magic_debug="no"
    fi
   ],
   [have_magic_debug="yes"])

AC_MSG_CHECKING([whether magic debug is enable])
AC_MSG_RESULT([${have_magic_debug}])

if test "x${have_magic_debug}" = "xyes" ; then
   EINA_CONFIGURE_MAGIC_DEBUG="#define EINA_MAGIC_DEBUG"
fi
AC_SUBST(EINA_CONFIGURE_MAGIC_DEBUG)

# Safety checks (avoid crashes on wrong api usage)
AC_ARG_ENABLE(safety-checks,
   [AC_HELP_STRING([--disable-safety-checks], [disable safety checks for NULL pointers and like. @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_safety_checks="yes"
    else
       have_safety_checks="no"
    fi
   ],
   [have_safety_checks="yes"])

AC_MSG_CHECKING(whether to do safety checking on api parameters)
AC_MSG_RESULT($have_safety_checks)

AM_CONDITIONAL(SAFETY_CHECKS, test "x$have_safety_checks" = "xyes")
if test "x$have_safety_checks" = "xyes"; then
  AC_DEFINE(EINA_SAFETY_CHECKS, 1, [disable safety checks for NULL pointers and like.])
  EINA_CONFIGURE_SAFETY_CHECKS="#define EINA_SAFETY_CHECKS"
fi
AC_SUBST(EINA_CONFIGURE_SAFETY_CHECKS)

with_max_log_level="<unset>"
AC_ARG_WITH(internal-maximum-log-level,
   [AC_HELP_STRING([--with-internal-maximum-log-level=NUMBER],
                   [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.])],
   [
    if test "x${withval}" != "xno"; then
       if echo "${withval}" | grep -E '^[[0-9]]+$' >/dev/null 2>/dev/null; then
          AC_MSG_NOTICE([ignoring any EINA_LOG() with level greater than ${withval}])
          AC_DEFINE_UNQUOTED(EINA_LOG_LEVEL_MAXIMUM, ${withval}, [if set, logging is limited to this amount.])
          with_max_log_level="${withval}"
       else
          AC_MSG_ERROR([--with-internal-maximum-log-level takes a decimal number, got "${withval}" instead.])
       fi
    fi
    ], [:])

AC_ARG_ENABLE([amalgamation],
   [AC_HELP_STRING([--enable-amalgamation], [enable generation of one single file with all source code in it, helps compiler optimizations.])],
   [if test "x${enableval}" = "xyes"; then
       do_amalgamation="yes"
    else
       do_amalgamation="no"
    fi
   ],
   [do_amalgamation="no"]
)
AM_CONDITIONAL(EINA_AMALGAMATION, test "x${do_amalgamation}" = "xyes")

# Choose best memory pool
AC_ARG_ENABLE([default-mempool],
   [AC_HELP_STRING([--enable-default-mempool], [Default memory allocator could be faster for some computer. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes"; then
       have_default_mempool="yes"
    else
       have_default_mempool="no"
    fi
   ],
   [have_default_mempool="no"]
)
AC_MSG_CHECKING([whether to use default mempool allocator])
AC_MSG_RESULT([${have_default_mempool}])

if test "x${have_default_mempool}" = "xyes" ; then
   EINA_CONFIGURE_DEFAULT_MEMPOOL="#define EINA_DEFAULT_MEMPOOL"
fi
AC_SUBST(EINA_CONFIGURE_DEFAULT_MEMPOOL)

# Report stringshare usage
AC_ARG_ENABLE([stringshare-usage],
   [AC_HELP_STRING([--enable-stringshare-usage], [Report stringshare usage on stringshare shutdown. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes"; then
       have_stringshare_usage="yes"
    else
       have_stringshare_usage="no"
    fi
   ],
   [have_stringshare_usage="no"]
)
AC_MSG_CHECKING([whether to report stringshare usage])
AC_MSG_RESULT([${have_stringshare_usage}])

if test "x${have_stringshare_usage}" = "xyes"; then
   AC_DEFINE(EINA_STRINGSHARE_USAGE, 1, [Report Eina stringshare usage pattern])
fi

# Check if we want to benchmark on real data
enable_benchmark_e17="no"
AC_ARG_ENABLE([e17],
   [AC_HELP_STRING([--enable-e17], [enable heavy benchmark @<:@default=no@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       enable_benchmark_e17="yes"
    else
       enable_benchmark_e17="no"
    fi
   ],
   [enable_benchmark_e17="no"])

AC_MSG_CHECKING([whether e17 real data benchmark are built])
AC_MSG_RESULT([${enable_benchmark_e17}])

AM_CONDITIONAL(EINA_ENABLE_BENCHMARK_E17, test "x${enable_benchmark_e17}" = "xyes")


### Checks for programs
AC_PROG_CC
AC_PROG_CXX

# pkg-config
PKG_PROG_PKG_CONFIG

# Check whether pkg-config supports Requires.private
if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
   pkgconfig_requires_private="Requires.private"
else
   pkgconfig_requires_private="Requires"
fi
AC_SUBST(pkgconfig_requires_private)

# doxygen program for documentation building

EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])


### Checks for libraries

# Valgrind
want_valgrind="auto"
have_valgrind="no"

AC_ARG_ENABLE([valgrind],
  [AC_HELP_STRING([--enable-valgrind], [improve valgrind support by hinting it of our memory usages, having it to report proper mempool leaks.])],
  [want_valgrind=$enableval])

AC_MSG_CHECKING([whether to enable build with valgrind])
AC_MSG_RESULT([${want_valgrind}])

if test "x${want_valgrind}" = "xyes" || test "x${want_valgrind}" = "xauto"; then
   PKG_CHECK_MODULES([VALGRIND],
      [valgrind >= 2.4.0],
      [
       requirement_eina="valgrind ${requirement_eina}"
       have_valgrind="yes"
      ],
      [
       AC_DEFINE([NVALGRIND], [1], [Valgrind support disabled])
       if test "x${want_valgrind}" = "xyes"; then
          AC_MSG_ERROR([Valgrind >= 2.4.0 is required])
       fi
      ])
else
    AC_DEFINE([NVALGRIND], [1], [Valgrind support disabled])
fi


# Evil library for compilation on Windows CE

EFL_EINA_BUILD=""
case "$host_os" in
   mingw*)
      PKG_CHECK_MODULES([EVIL], [evil >= 1.0.0])
      AC_DEFINE([HAVE_EVIL], [1], [Set to 1 if evil package is installed])
      requirement_eina="${requirement_eina} evil"
      EFL_EINA_BUILD="-DEFL_EINA_BUILD"
   ;;
esac
AC_SUBST([EFL_EINA_BUILD])

# Check ememoa memory pool library

AC_ARG_ENABLE([ememoa],
   [AC_HELP_STRING([--enable-ememoa], [build ememoa memory pool module @<:@default=yes@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       enable_ememoa="yes"
    else
       enable_ememoa="no"
    fi
   ],
   [enable_ememoa="yes"])

AC_MSG_CHECKING([whether to use ememoa for memory pool])
AC_MSG_RESULT([$enable_ememoa])

if test "x${enable_ememoa}" = "xyes" ; then
   PKG_CHECK_MODULES([EMEMOA],
      [ememoa >= 0.0.26 ],
      [enable_ememoa="yes"],
      [enable_ememoa="no"])
fi

PKG_CHECK_MODULES([ECORE_EVAS],
   [ecore-evas ecore evas],
   [build_tiler_example="yes"],
   [build_tiler_example="no"])

AM_CONDITIONAL([BUILD_TILER_EXAMPLE], [test "x${build_tiler_example}" = "xyes"])

### Checks for compiler characteristics
AC_C_CONST
AC_C_BIGENDIAN
AC_C_INLINE
AC_PROG_CC_STDC
EFL_ATTRIBUTE_UNUSED

have_wince="no"
have_win32="no"
EINA_CFLAGS=""
case "$host_os" in
   mingw32ce*)
      EINA_CFLAGS="${EVIL_CFLAGS}"
      have_win32="yes"
      have_wince="yes"
      ;;
   mingw*)
      EINA_CFLAGS="${EVIL_CFLAGS}"
      have_win32="yes"
      ;;
esac
AM_CONDITIONAL([EINA_HAVE_WINCE], [test "x$have_wince" = "xyes"])
AM_CONDITIONAL([EINA_HAVE_WIN32], [test "x$have_win32" = "xyes"])

m4_ifdef([v_mic],
   [
    EFL_COMPILER_FLAG([-Wall])
    EFL_COMPILER_FLAG([-W])
   ])

EFL_COMPILER_FLAG([-Wshadow])

### Checks for portability layer

PKG_CHECK_MODULES([EXOTIC],
   [exotic],
   [enable_exotic="yes"],
   [enable_exotic="no"])

if test "x${enable_exotic}" = "xyes"; then
    requirement_eina="exotic ${requirement_eina}"
    EINA_CFLAGS="${EINA_CFLAGS} ${EXOTIC_CFLAGS}"
    EINA_LIBS="${EXOTIC_LIBS}"

    EINA_CONFIGURE_HAVE_EXOTIC="#define EINA_HAVE_EXOTIC"
    AC_DEFINE([HAVE_EXOTIC_H], [1], [Define to 1 if you have Exotic.])
fi
AM_CONDITIONAL([EINA_HAVE_EXOTIC], [test "x${enable_exotic}" = "xyes"])
AC_SUBST([EINA_CONFIGURE_HAVE_EXOTIC])

case "$host_vendor" in
  ps3*)
      PKG_CHECK_MODULES([ESCAPE], [escape])
      AC_DEFINE(HAVE_ESCAPE, 1, [Set to 1 if Escape package is installed])
      requirement_eina="${requirement_eina} escape"
      EINA_CFLAGS="${ESCAPE_CFLAGS} ${EINA_CFLAGS}"
    ;;
esac

AC_SUBST([EINA_CFLAGS])

### Checks for linker characteristics
EINA_LIBS=
lt_enable_auto_import=""
case "${host_os}" in
   mingw*)
      EINA_LIBS="${EINA_LIBS} -ldl ${EVIL_LIBS} -lm"
      lt_enable_auto_import="-Wl,--enable-auto-import"
   ;;
   dragonfly*|openbsd*)
      EINA_LIBS="${EINA_LIBS} -lm"
   ;;
   freebsd*|netbsd*)
      EINA_LIBS="${EINA_LIBS} -lrt -lm"
   ;;
   darwin*)
      EINA_LIBS="${EINA_LIBS} -lm"
   ;;
   cygwin*)
      EINA_LIBS="${EINA_LIBS} -ldl -lm"
   ;;
   *)
      EINA_LIBS="${EINA_LIBS} -lrt -ldl -lm"
   ;;
esac
case "$host_vendor" in
  ps3*)
      # Escape had already been checked to exist
      EINA_LIBS="${ESCAPE_LIBS}"
    ;;
esac
AC_SUBST([EINA_LIBS])
AC_SUBST([lt_enable_auto_import])

EFL_LINKER_FLAG([-fno-strict-aliasing])

CFLAGS="${CFLAGS} ${EINA_CFLAGS}"
LDFLAGS="${LDFLAGS} ${EINA_LDFLAGS}"
LIBS="${LIBS} ${EINA_LIBS}"

### Checks for header files
AC_HEADER_ASSERT
AC_HEADER_TIME
EFL_CHECK_PATH_MAX
AC_CHECK_HEADERS([unistd.h libgen.h inttypes.h stdint.h sys/types.h siginfo.h strings.h sys/mman.h execinfo.h])

if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
   EINA_CONFIGURE_HAVE_INTTYPES_H="#define EINA_HAVE_INTTYPES_H"
   AC_DEFINE([HAVE_INTTYPES_H], [1], [Define to 1 if you have the <inttypes.h> header file.])
fi
AC_SUBST([EINA_CONFIGURE_HAVE_INTTYPES_H])

if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
    EINA_CONFIGURE_HAVE_STDINT_H="#define EINA_HAVE_STDINT_H"
    AC_DEFINE([HAVE_STDINT_H], [1], [Define to 1 if you have the <stdint.h> header file.])
fi
AC_SUBST([EINA_CONFIGURE_HAVE_STDINT_H])

### Checks for types

AC_CHECK_SIZEOF([wchar_t])
EINA_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
AC_SUBST([EINA_SIZEOF_WCHAR_T])
AC_CHECK_TYPES([siginfo_t], [], [],
   [[#include <signal.h>
     #if HAVE_SIGINFO_H
     # include <siginfo.h>
     #endif
   ]])

### Check if dirent.h is usable

AC_CHECK_TYPES([struct dirent], [have_dirent="yes"], [have_dirent="no"],
   [[#include <dirent.h>
   ]])

if test "x${have_dirent}" = "xyes" ; then
    EINA_CONFIGURE_HAVE_DIRENT_H="#define EINA_HAVE_DIRENT_H"
    AC_DEFINE([HAVE_DIRENT_H], [1], [Define to 1 if you have a valid <dirent.h> header file.])
fi
AC_SUBST([EINA_CONFIGURE_HAVE_DIRENT_H])

### Checks for library functions
AC_ISC_POSIX
AC_FUNC_ALLOCA
AC_CHECK_FUNCS([strlcpy openat fstatat fpathconf execvp backtrace backtrace_symbols])

AC_MSG_CHECKING([for dirfd])
AC_LINK_IFELSE(
   [
    AC_LANG_PROGRAM(
       [[
#include <dirent.h>
       ]],
       [[
int main(void)
{
  DIR *dirp;
  return dirfd(dirp);
}
       ]])
   ],
   [have_dirfd="yes"],
   [have_dirfd="no"])

AC_MSG_RESULT([${have_dirfd}])

if test "x${have_dirfd}" = "xyes" ; then
   AC_DEFINE([HAVE_DIRFD], [1], [ Define to 1 if you have the `dirfd' function or macro.])
fi

# check debug information for malloc
AC_CHECK_FUNCS([malloc_usable_size], [malloc_true_size="yes"], [malloc_true_size="no"])
if test "x${malloc_true_size}" = "xyes" ; then
   AC_DEFINE([HAVE_MALLOC_USABLE_SIZE], [1], [We will be able to know the exact amount of wasted memory])
fi

want_debug_malloc="no"
AC_ARG_ENABLE([debug-malloc],
   [AC_HELP_STRING([--enable-debug-malloc], [enable debugging of malloc usage overhead in our allocator @<:@default=enabled@:>@])],
   [
     if test "x${enableval}" = "xyes" ; then
     	want_debug_malloc="yes"
     else
	want_debug_malloc="no"
     fi
   ], [want_debug_malloc="no"])

if test "x${malloc_true_size}" = "xyes" -a "x${want_debug_malloc}" = "xyes"; then
   AC_DEFINE([EINA_DEBUG_MALLOC], [1], [Turn on debugging overhead in mempool])
fi

# dlopen and dladdr
dlopen_libs=""
case "$host_os" in
   mingw*)
# managed by evil
      AC_DEFINE([HAVE_DLADDR])
      AC_DEFINE([HAVE_DLOPEN])
      ;;
   *)
      AC_CHECK_FUNCS([dlopen], [res="yes"], [res="no"])
      if test "x${res}" = "xyes" ; then
         AC_CHECK_FUNCS([dladdr], [AC_DEFINE([HAVE_DLADDR])])
         AC_DEFINE([HAVE_DLOPEN])
      else
         AC_CHECK_LIB([dl], [dlopen], [res="yes"], [res="no"])
         if test "x${res}" = "xyes" ; then
            AC_CHECK_LIB([dl], [dladdr], [AC_DEFINE([HAVE_DLADDR])])
            AC_DEFINE(HAVE_DLOPEN)
            dlopen_libs="-ldl"
         fi
      fi
      ;;
esac
AC_SUBST([dlopen_libs])

have_log="yes"
EFL_CHECK_FNMATCH([have_log="yes"], [have_log="no"])

want_log="yes"
AC_ARG_ENABLE([log],
   [AC_HELP_STRING([--disable-log], [disable Eina_Log infrastructure completly @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_log="yes"
    else
       want_log="no"
    fi
   ],
   [want_log="yes"])

enable_log="no"
if test "x${have_log}" = xyes -a "x${want_log}" = xyes; then
   enable_log="yes"
fi

AC_MSG_CHECKING([wether to build Eina_Log infrastructure])
AC_MSG_RESULT([${enable_log}])

if test "x${enable_log}" = "xyes"; then
    EINA_CONFIGURE_ENABLE_LOG="#define EINA_ENABLE_LOG"
    AC_DEFINE([HAVE_LOG], [1], [Define to 1 if we log support is on])
fi
AC_SUBST([EINA_CONFIGURE_ENABLE_LOG])

AC_CHECK_HEADERS([mcheck.h], [AC_DEFINE([HAVE_MCHECK], [1], [Have mcheck.h])])
AC_CHECK_FUNCS([mtrace], [AC_DEFINE([HAVE_MTRACE], [1], [Have mtrace])])

# iconv library
have_iconv="no"
AC_ARG_WITH([iconv-link],
   AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]),
   [
    LIBS="$withval $LIBS"
    have_iconv="yes"
    iconv_libs=$withval
   ])

AC_MSG_CHECKING(for explicit iconv link options)
if test "x${iconv_libs}" = "x" ; then
   AC_MSG_RESULT([no explicit iconv link option])
else
   AC_MSG_RESULT([$iconv_libs])
fi

if test "x${have_iconv}" = "xno" ; then
   AC_CHECK_HEADERS([iconv.h], [have_iconv="yes"])

   if test "x${have_iconv}" = "xyes" ; then
      AC_MSG_CHECKING([whether iconv() is in libc])

      AC_LINK_IFELSE(
         [AC_LANG_PROGRAM(
             [[
#include <stdlib.h>
#include <iconv.h>
             ]],
             [[
iconv_t ic;
size_t count = iconv(ic, NULL, NULL, NULL, NULL);
             ]])],
         [have_iconv="yes"],
         [have_iconv="no"])

      AC_MSG_RESULT([${have_iconv}])
   fi

   if test "x${have_iconv}" = "xno" ; then
      AC_MSG_CHECKING([whether iconv() is in libiconv.a])

      LIBS_save="${LIBS}"
      LIBS="-liconv $LIBS"
      AC_LINK_IFELSE(
         [AC_LANG_PROGRAM(
             [[
#include <stdlib.h>
#include <iconv.h>
             ]],
             [[
iconv_t ic;
size_t count;
count = iconv(ic, NULL, NULL, NULL, NULL);
             ]])],
         [
          have_iconv="yes"
          iconv_libs="-liconv"
         ],
         [
          have_iconv="no"
          LIBS=${LIBS_save}
         ])

      AC_MSG_RESULT([${have_iconv}])
   fi

   if test "x${have_iconv}" = "xno" ; then
      AC_MSG_CHECKING([whether iconv() is in libiconv_plug.a])

      LIBS_save="${LIBS}"
      LIBS="-liconv_plug $LIBS"
      AC_LINK_IFELSE(
         [AC_LANG_PROGRAM(
             [[
#include <stdlib.h>
#include <iconv.h>
             ]],
             [[
iconv_t ic;
size_t count = iconv(ic, NULL, NULL, NULL, NULL);
             ]])],
         [
          have_iconv="yes"
          iconv_libs="-liconv_plug"
         ],
         [
          have_iconv="no"
          LIBS=${LIBS_save}
         ])

      AC_MSG_RESULT([${have_iconv}])
   fi
fi

AC_SUBST([iconv_libs])

if test "x${have_iconv}" = "xyes" ; then
   AC_DEFINE([HAVE_ICONV], [1], [Set to 1 if iconv library is installed])
fi

# shmopen
have_shmopen=no
AC_MSG_CHECKING([for shm_open availability])

LIBS_save="${LIBS}"
LIBS="${LIBS} -lrt"
AC_LINK_IFELSE(
   [AC_LANG_PROGRAM(
       [[
#include <sys/mman.h>
#include <sys/stat.h>        /* For mode constants */
#include <fcntl.h>           /* For O_* constants */
       ]],
       [[
int fd;

fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
       ]])],
   [have_shmopen="yes"],
   [have_shmopen="no"])

LIBS="${LIBS_save}"

AC_MSG_RESULT([${have_shmopen}])

if test "x${have_shmopen}" = "xyes"; then
   AC_DEFINE([HAVE_SHMOPEN], [1], [Define to 1 if you have the `shm_open' function.])
   rt_libs="-lrt"
fi

AC_SUBST([rt_libs])

# extended attribute

AC_MSG_CHECKING([for extended attributes])

AC_COMPILE_IFELSE(
   [AC_LANG_PROGRAM(
       [[
#include <stdlib.h>
#include <sys/types.h>
#include <sys/xattr.h>
       ]],
       [[
size_t tmp = listxattr("/", NULL, 0);
tmp = getxattr("/", "user.ethumb.md5", NULL, 0);
setxattr("/", "user.ethumb.md5", NULL, 0, 0);
       ]])],
   [
    AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.])
    have_xattr="yes"
   ],
   [have_xattr="no"])

AC_MSG_RESULT([${have_xattr}])

### Modules

if test "x${have_default_mempool}" = "xyes" ; then
   enable_chained_pool="no"
   enable_pass_through="static"
else
   enable_chained_pool="static"
   enable_pass_through="no"
fi

enable_one_big="static"

EINA_CHECK_MODULE([chained-pool],   [${enable_chained_pool}], [chained pool])
EINA_CHECK_MODULE([ememoa-fixed],   [${enable_ememoa}],       [ememoa fixed])
EINA_CHECK_MODULE([ememoa-unknown], [${enable_ememoa}],       [ememoa unknown])
EINA_CHECK_MODULE([fixed-bitmap],   [no],                     [fixed bitmap])
EINA_CHECK_MODULE([pass-through],   [${enable_pass_through}], [pass through])
EINA_CHECK_MODULE([buddy],          [no],                     [buddy])
EINA_CHECK_MODULE([one-big],        [${enable_one_big}],      [one big])

### Make the debug preprocessor configurable

### Unit tests, coverage and benchmarking

EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])

EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
EINA_CFLAGS="${EINA_CFLAGS} ${EFL_COVERAGE_CFLAGS}"
EINA_LIBS="${EINA_LIBS} ${EFL_COVERAGE_LIBS}"
if test "x$enable_coverage" = "xyes" ; then
   EINA_CFLAGS="${EINA_CFLAGS} ${EFL_DEBUG_CFLAGS}"
fi

EFL_CHECK_BENCHMARK([enable_benchmark="yes"], [enable_benchmark="no"])
EINA_BENCH_MODULE([glib], [${enable_benchmark}], [glib-2.0], [enable_benchmark_glib="yes"], [enable_benchmark_glib="no"])
if test -n "$CXX" && test "x$enable_benchmark" = "xyes" ; then
   AC_DEFINE_UNQUOTED([CITYHASH_BENCH], [1], [enable bench tests for google hash method])
fi
AM_CONDITIONAL([CITYHASH_BENCH], [test -n "$CXX" && test "x$enable_benchmark" = "xyes"])

AC_SUBST([requirement_eina])

### Build and install examples
EFL_CHECK_BUILD_EXAMPLES([enable_build_examples="yes"], [enable_build_examples="no"])
EFL_CHECK_INSTALL_EXAMPLES([enable_install_examples="yes"], [enable_install_examples="no"])

AC_CONFIG_FILES([
Makefile
eina.pc
eina.spec
doc/Makefile
doc/Doxyfile
src/Makefile
src/include/Makefile
src/include/eina_config.h
src/lib/Makefile
src/modules/Makefile
src/modules/mp/Makefile
src/modules/mp/chained_pool/Makefile
src/modules/mp/ememoa_fixed/Makefile
src/modules/mp/ememoa_unknown/Makefile
src/modules/mp/pass_through/Makefile
src/modules/mp/fixed_bitmap/Makefile
src/modules/mp/buddy/Makefile
src/modules/mp/one_big/Makefile
src/tests/Makefile
src/examples/Makefile
])

AC_OUTPUT

#####################################################################
## Info

echo
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo
echo "Configuration Options Summary:"
echo
echo "  Magic debug..........: ${have_magic_debug}"
echo "  Safety checks........: ${have_safety_checks}"
echo "  Maximum log level....: ${with_max_log_level}"
echo "  Report string usage..: ${have_stringshare_usage}"
echo "  Valgrind support.....: ${have_valgrind}"
echo "  Default mempool......: ${have_default_mempool}"
echo "  Log support..........: ${enable_log}"
echo "  Thread Support.......: ${have_threads}"
if test "${have_threads}" = "POSIX" ; then
echo "    spinlock...........: ${have_posix_threads_spinlock}"
echo "    debug usage........: ${have_debug_threads}"
echo "    on/off support.....: ${have_on_off_threads}"
fi
echo "  Amalgamation.........: ${do_amalgamation}"
echo "  Iconv support........: ${have_iconv}"
echo "  File dirfd...........: ${have_dirfd}"
echo "  File xattr...........: ${have_xattr}"
echo
echo "  Documentation........: ${build_doc}"
echo "  Tests................: ${enable_tests}"
echo "  Coverage.............: ${enable_coverage}"
echo "  Examples.............: ${enable_build_examples}"
echo "  Tiler Example........: ${build_tiler_example}"
echo "  Examples installed...: ${enable_install_examples}"
echo "  Benchmark............: ${enable_benchmark}"
if test "x${enable_benchmark}" = "xyes" ; then
echo "    Glib...............: ${enable_benchmark_glib}"
echo "    E17 real data......: ${enable_benchmark_e17}"
fi
echo
echo "  CPU Specific Extensions:"
echo "    MMX................: ${have_mmx}"
echo "    SSE................: ${have_sse}"
echo "    SSE2...............: ${have_sse2}"
echo "    ALTIVEC............: ${have_altivec}"
echo
echo "  Memory pools:"
echo "    Buddy..............: ${enable_buddy}"
echo "    Chained pool.......: ${enable_chained_pool}"
echo "    Ememoa fixed.......: ${enable_ememoa_fixed}"
echo "    Ememoa unknown.....: ${enable_ememoa_unknown}"
echo "    Fixed bitmap.......: ${enable_fixed_bitmap}"
echo "    One big............: ${enable_one_big}"
echo "    Pass through.......: ${enable_pass_through}"
echo
echo "Compilation............: make (or gmake)"
echo "  CPPFLAGS.............: $CPPFLAGS"
echo "  CFLAGS...............: $CFLAGS"
echo "  LDFLAGS..............: $LDFLAGS"
echo
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
echo "  prefix...............: $prefix"
echo
EFL_FORM_VOLTRON