aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 10ac963ed74a1c168858158315a0f70ff6f7f2ad (plain) (blame)
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
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_maj], [1])
m4_define([v_min], [8])
m4_define([v_mic], [1])
dnl m4_define([v_rev], m4_esyscmd([(git rev-list --count HEAD 2>/dev/null || echo 0) | tr -d '\n']))
##--   When released, remove the dnl on the below line
dnl m4_undefine([v_rev])
##--   When doing snapshots - change soname. remove dnl on below line
dnl m4_define([relname], [dev])
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_rev], m4_eval(v_maj + v_min))
m4_define([lt_cur], v_mic)
m4_define([lt_age], v_min)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##

AC_INIT([elementary], [v_ver], [enlightenment-devel@lists.sourceforge.net])
AC_PREREQ(2.52)
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST

AC_CONFIG_HEADERS([elementary_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_C_BIGENDIAN
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CC_STDC
AC_HEADER_STDC
AC_C_CONST
AC_C___ATTRIBUTE__
AC_FUNC_ALLOCA

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_rev:lt_cur:lt_age"
release_info="v_rel"
AC_SUBST(version_info)
AC_SUBST(release_info)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
VMAJ=v_maj
VMIN=v_min
AC_SUBST(VMAJ)
AC_SUBST(VMIN)
ELM_VERSION_MAJOR=v_maj
ELM_VERSION_MINOR=v_min
AC_SUBST(ELM_VERSION_MAJOR)
AC_SUBST(ELM_VERSION_MINOR)

# pkg-config
PKG_PROG_PKG_CONFIG

MODULE_EDJE=`pkg-config --variable=module_arch edje`
if test -z "$MODULE_EDJE"; then
   # Backward compatibility -- TODO: remove when EFL 1.8 is released.
   EDJE_VERSION=`$PKG_CONFIG edje --modversion | awk -F . '{printf("%s.%s.%s", $1, $2, $3);}'`
   case "$host_os" in
     mingw32ce* | cegcc*)
       MODULE_EDJE="$host_os-$host_cpu"
       ;;
     *)
       MODULE_EDJE="$host_os-$host_cpu-${EDJE_VERSION}"
       ;;
   esac
fi
AC_SUBST(MODULE_EDJE)
AC_DEFINE_UNQUOTED(MODULE_EDJE, "$MODULE_EDJE", "Edje module architecture")

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

EFL_SHARED_EXTENSION="${shrext_cmds}"
AC_DEFINE_UNQUOTED(EFL_SHARED_EXTENSION, "${EFL_SHARED_EXTENSION}", "Shared extension")

requirement_elm=""

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)

#================================================
if test "x${prefix}" = "xNONE"; then
  LOCALE_DIR="${ac_default_prefix}/share/locale"
else
  LOCALE_DIR="${prefix}/share/locale"
fi
AC_SUBST(LOCALE_DIR)
#================================================
elementary_icon_dir="${datadir}/icons"
AC_SUBST(elementary_icon_dir)

lt_enable_auto_import=""
ELM_UNIX_DEF="#undef"
ELM_WIN32_DEF="#undef"
ELM_WINCE_DEF="#undef"
have_windows="no"
have_dlopen="no"
case "$host_os" in
   mingw32ce*)
      PKG_CHECK_MODULES([EVIL], [evil])
      AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed.])
      lt_enable_auto_import="-Wl,--enable-auto-import"
      ELM_WINCE_DEF="#define"
      have_windows="yes"
dnl managed by evil
      AC_DEFINE(HAVE_DLADDR)
      have_dlopen="yes"
      dlopen_libs=-ldl
      requirement_elm="evil"
      have_socket="no"
    ;;
   mingw*)
      PKG_CHECK_MODULES([EVIL], [evil])
      AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed.])
      lt_enable_auto_import="-Wl,--enable-auto-import"
      ELM_WIN32_DEF="#define"
      have_windows="yes"
dnl managed by evil
      AC_DEFINE(HAVE_DLADDR)
      have_dlopen="yes"
      dlopen_libs=-ldl
      requirement_elm="evil"
      have_socket="no"
      ;;
   *solaris*)
      ELM_UNIX_DEF="#define"
      have_socket="yes"
      have_dlopen="yes"
      AC_CHECK_LIB([socket], [connect], [], [have_socket="no"])
      ;;
   darwin*)
      ELM_UNIX_DEF="#define"
      have_socket="yes"
      have_dlopen="yes"
      AC_CHECK_HEADERS([crt_externs.h])
      AC_DEFINE([environ], [(*_NSGetEnviron())], ["apple doesn't follow POSIX in this case."])
      ;;
   *)
      ELM_UNIX_DEF="#define"
      AC_CHECK_FUNCS(dlopen, res=yes, res=no)
      if test "x$res" = "xyes"; then
        AC_CHECK_FUNCS(dladdr, AC_DEFINE(HAVE_DLADDR))
        have_dlopen="yes"
      else
        AC_CHECK_LIB(dl, dlopen, res=yes, res=no)
        AC_CHECK_LIB(m, sincos)
        if test "x$res" = "xyes"; then
          AC_CHECK_LIB(dl, dladdr, AC_DEFINE(HAVE_DLADDR))
          dlopen_libs=-ldl
          have_dlopen="yes"
        fi
      fi
      have_socket="yes"
      ;;
esac
AM_CONDITIONAL([BUILD_RUN], [test "x$have_socket" = "xyes"])
AM_CONDITIONAL([BUILD_MODULES], [test "x$have_dlopen" = "xyes"])

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

have_fork="no"
want_quicklaunch="auto"
AC_ARG_ENABLE([quick-launch],
        [AC_HELP_STRING([--disable-quick-launch], [disable quick-launch support, @<:@default=detect@:>@])],
        [want_quicklaunch=$enableval], [])

# Check if we can build binary with quicklaunch support
ELM_QUICKLAUNCH

if test "x$want_quicklaunch" != "xno"; then
   AC_CHECK_FUNCS(fork, [
        have_fork="yes"
        AC_DEFINE(HAVE_FORK)
   ])
   AC_CHECK_FUNCS([clearenv])
fi
AM_CONDITIONAL([BUILD_QUICKLAUNCH], [test "x$have_fork" = "xyes" && test "x$have_dlopen" = "xyes"])

AC_SUBST(dlopen_libs)
AC_SUBST(lt_enable_auto_import)
AC_SUBST(ELM_UNIX_DEF)
AC_SUBST(ELM_WIN32_DEF)
AC_SUBST(ELM_WINCE_DEF)

AM_CONDITIONAL([ELEMENTARY_WINDOWS_BUILD], [test "x${have_windows}" = "xyes"])

efl_version="1.8.0"

PKG_CHECK_MODULES([ELEMENTARY],
   [
    eina >= ${efl_version}
    eet >= ${efl_version}
    evas >= ${efl_version}
    ecore >= ${efl_version}
    ecore-evas >= ${efl_version}
    ecore-file >= ${efl_version}
    ecore-input >= ${efl_version}
    edje >= ${efl_version}
    eo >= ${efl_version}
    ethumb_client >= ${efl_version}
    emotion >= ${efl_version}
    ecore-imf >= ${efl_version}
    ecore-con >= ${efl_version}
    eio >= ${efl_version}
    eldbus >= ${efl_version}
    efreet >= ${efl_version}
    efreet-mime >= ${efl_version}
    efreet-trash >= ${efl_version}
   ]
)

EFL_ENABLE_EO_API_SUPPORT
EFL_ENABLE_BETA_API_SUPPORT

requirement_elm="\
    eina >= ${efl_version} \
    eet >= ${efl_version} \
    evas >= ${efl_version} \
    ecore >= ${efl_version} \
    ecore-evas >= ${efl_version} \
    ecore-file >= ${efl_version} \
    ecore-input >= ${efl_version} \
    edje >= ${efl_version} \
    eo >= ${efl_version} \
    ethumb_client >= ${efl_version} \
    emotion >= ${efl_version} \
    ecore-imf >= ${efl_version} \
    ecore-con >= ${efl_version} \
    eio >= ${efl_version} \
    eldbus >= ${efl_version} \
    efreet >= ${efl_version} \
    efreet-mime >= ${efl_version} \
    efreet-trash >= ${efl_version} \
    "

have_elementary_x="no"
want_elementary_x="auto"
AC_ARG_ENABLE([ecore-x],
   [AC_HELP_STRING([--disable-ecore-x], [disable ecore-x support. @<:@default=detect@:>@])],
   [want_elementary_x=$enableval], [])

if test "x$want_elementary_x" != "xno"; then
   PKG_CHECK_MODULES([ELEMENTARY_X],
      [ecore-x >= ${efl_version}],
      [
       AC_DEFINE(HAVE_ELEMENTARY_X, 1, [X11 support for Elementary])
       have_elementary_x="yes"
       requirement_elm="ecore-x >= ${efl_version} ${requirement_elm}"
      ],
      [have_elementary_x="no"]
   )
else
    have_elementary_x="no"
fi
if test "x$want_elementary_x" = "xyes" -a "x$have_elementary_x" = "xno"; then
    AC_MSG_ERROR([ecore-x support requested, but ecore-x was not found by pkg-config.])
fi


have_elementary_fb="no"
want_elementary_fb="auto"
AC_ARG_ENABLE([ecore-fb],
   [AC_HELP_STRING([--disable-ecore-fb], [disable ecore-fb support. @<:@default=detect@:>@])],
   [want_elementary_fb=$enableval], [])

if test "x$want_elementary_fb" != "xno"; then
   PKG_CHECK_MODULES([ELEMENTARY_FB],
      [ecore-fb >= ${efl_version}],
      [
       AC_DEFINE(HAVE_ELEMENTARY_FB, 1, [FB support for Elementary])
       have_elementary_fb="yes"
       requirement_elm="ecore-fb >= ${efl_version} ${requirement_elm}"
      ],
      [have_elementary_fb="no"]
   )
else
    have_elementary_fb="no"
fi
if test "x$want_elementary_fb" = "xyes" -a "x$have_elementary_fb" = "xno"; then
    AC_MSG_ERROR([ecore-fb support requested, but ecore-fb was not found by pkg-config.])
fi

have_elementary_psl1ght="no"
want_elementary_psl1ght="auto"
AC_ARG_ENABLE([ecore-psl1ght],
   [AC_HELP_STRING([--disable-ecore-psl1ght], [disable ecore-psl1ght support. @<:@default=detect@:>@])],
   [want_elementary_psl1ght=$enableval], [])

if test "x$want_elementary_psl1ght" != "xno"; then
   PKG_CHECK_MODULES([ELEMENTARY_PSL1GHT],
      [ecore-psl1ght >= ${efl_version}],
      [
       AC_DEFINE(HAVE_ELEMENTARY_PSL1GHT, 1, [PSL1GHT support for Elementary])
       have_elementary_psl1ght="yes"
       requirement_elm="ecore-psl1ght >= ${efl_version} ${requirement_elm}"
      ],
      [have_elementary_psl1ght="no"]
   )
else
    have_elementary_psl1ght="no"
fi
if test "x$want_elementary_psl1ght" = "xyes" -a "x$have_elementary_psl1ght" = "xno"; then
    AC_MSG_ERROR([ecore-psl1ght support requested, but ecore-psl1ght was not found by pkg-config.])
fi

have_elementary_sdl="no"
want_elementary_sdl="auto"
AC_ARG_ENABLE([ecore-sdl],
   [AC_HELP_STRING([--disable-ecore-sdl], [disable ecore-sdl support. @<:@default=detect@:>@])],
   [want_elementary_sdl=$enableval], [])

if test "x$want_elementary_sdl" != "xno"; then
   PKG_CHECK_MODULES([ELEMENTARY_SDL],
      [ecore-sdl >= ${efl_version}],
      [
       AC_DEFINE(HAVE_ELEMENTARY_SDL, 1, [SDL support for Elementary])
       have_elementary_sdl="yes"
       requirement_elm="ecore-sdl >= ${efl_version} ${requirement_elm}"
      ],
      [have_elementary_sdl="no"]
   )
else
    have_elementary_sdl="no"
fi
if test "x$want_elementary_sdl" = "xyes" -a "x$have_elementary_sdl" = "xno"; then
    AC_MSG_ERROR([ecore-sdl support requested, but ecore-sdl was not found by pkg-config.])
fi

have_elementary_cocoa="no"
want_elementary_cocoa="auto"
AC_ARG_ENABLE([ecore-cocoa],
   [AC_HELP_STRING([--disable-ecore-cocoa], [disable ecore-cocoa support. @<:@default=detect@:>@])],
   [want_elementary_cocoa=$enableval], [])

if test "x$want_elementary_cocoa" != "xno"; then
   PKG_CHECK_MODULES([ELEMENTARY_COCOA],
      [ecore-cocoa >= ${efl_version}],
      [
       AC_DEFINE(HAVE_ELEMENTARY_COCOA, 1, [COCOA support for Elementary])
       have_elementary_cocoa="yes"
       requirement_elm="ecore-cocoa >= ${efl_version} ${requirement_elm}"
      ],
      [have_elementary_cocoa="no"]
   )
else
    have_elementary_cocoa="no"
fi
if test "x$want_elementary_cocoa" = "xyes" -a "x$have_elementary_cocoa" = "xno"; then
    AC_MSG_ERROR([ecore-cocoa support requested, but ecore-cocoa was not found by pkg-config.])
fi

have_elementary_win32="no"
want_elementary_win32="auto"
AC_ARG_ENABLE([ecore-win32],
   [AC_HELP_STRING([--disable-ecore-win32], [disable ecore-win32 support. @<:@default=detect@:>@])],
   [want_elementary_win32=$enableval], [])

if test "x$want_elementary_win32" != "xno"; then
   PKG_CHECK_MODULES([ELEMENTARY_WIN32],
      [ecore-win32 >= ${efl_version}],
      [
       AC_DEFINE(HAVE_ELEMENTARY_WIN32, 1, [Windows XP support for Elementary])
       have_elementary_win32="yes"
       requirement_elm="ecore-win32 >= ${efl_version} ${requirement_elm}"
      ],
      [have_elementary_win32="no"]
   )
else
    have_elementary_win32="no"
fi
if test "x$want_elementary_win32" = "xyes" -a "x$have_elementary_win32" = "xno"; then
    AC_MSG_ERROR([ecore-win32 support requested, but ecore-win32 was not found by pkg-config.])
fi

have_elementary_wince="no"
want_elementary_wince="auto"
AC_ARG_ENABLE([ecore-wince],
   [AC_HELP_STRING([--disable-ecore-wince], [disable ecore-wince support. @<:@default=detect@:>@])],
   [want_elementary_wince=$enableval], [])

if test "x$want_elementary_wince" != "xno"; then
   PKG_CHECK_MODULES([ELEMENTARY_WINCE],
      [ecore-wince >= ${efl_version}],
      [
       AC_DEFINE(HAVE_ELEMENTARY_WINCE, 1, [Windows CE support for Elementary])
       have_elementary_wince="yes"
       requirement_elm="ecore-wince >= ${efl_version} ${requirement_elm}"
      ],
      [have_elementary_wince="no"]
   )
else
    have_elementary_wince="no"
fi
if test "x$want_elementary_wince" = "xyes" -a "x$have_elementary_wince" = "xno"; then
    AC_MSG_ERROR([ecore-wince support requested, but ecore-wince was not found by pkg-config.])
fi

have_elementary_wayland="no"
want_elementary_wayland="auto"
AC_ARG_ENABLE([ecore-wayland],
   [AC_HELP_STRING([--disable-ecore-wayland], [disable ecore-wayland support. @<:@default=detect@:>@])],
   [want_elementary_wayland=$enableval], [])

if test "x$want_elementary_wayland" != "xno"; then
   PKG_CHECK_MODULES([ELEMENTARY_WAYLAND],
      [ecore-wayland],
      [
       AC_DEFINE(HAVE_ELEMENTARY_WAYLAND, 1, [Wayland support for Elementary])
       have_elementary_wayland="yes"
       requirement_elm="ecore-wayland ${requirement_elm}"
      ],
      [have_elementary_wayland="no"]
   )
else
    have_elementary_wayland="no"
fi
if test "x$want_elementary_wayland" = "xyes" -a "x$have_elementary_wayland" = "xno"; then
    AC_MSG_ERROR([ecore-wayland support requested, but ecore-wayland was not found by pkg-config.])
fi

ELM_ELOCATION_DEF="#undef"
have_elementary_elocation="no"
want_elementary_elocation="auto"
AC_ARG_ENABLE([elocation],
   [AC_HELP_STRING([--disable-elocation], [disable elocation support. @<:@default=detect@:>@])],
   [want_elementary_elocation=$enableval], [])

if test "x$want_elementary_elocation" != "xno"; then
    PKG_CHECK_MODULES([ELEMENTARY_ELOCATION],
       [
        elocation >= 0.1.0
       ],
       [
        AC_DEFINE(HAVE_ELEMENTARY_ELOCATION, 1, [Elocation support for Elementary])
        have_elementary_elocation="yes"
        ELM_ELOCATION_DEF="#define"
        requirement_elm="elocation >= 0.1.0 ${requirement_elm}"
       ],
       [have_elementary_elocation="no"]
    )
else
    have_elementary_elocation="no"
fi
if test "x$want_elementary_elocation" = "xyes" -a "x$have_elementary_elocation" = "xno"; then
    AC_MSG_ERROR([elocation support requested, but elocation was not found by pkg-config.])
fi
AC_SUBST(ELM_ELOCATION_DEF)

ELM_EWEATHER_DEF="#undef"
have_elementary_eweather="no"
want_elementary_eweather="auto"
AC_ARG_ENABLE([eweather],
   [AC_HELP_STRING([--disable-eweather], [disable eweather support. @<:@default=detect@:>@])],
   [want_elementary_eweather=$enableval], [])

if test "x$want_elementary_eweather" != "xno"; then
    PKG_CHECK_MODULES([ELEMENTARY_EWEATHER],
       [
        eweather
       ],
       [
        AC_DEFINE(HAVE_ELEMENTARY_EWEATHER, 1, [EWeather support for Elementary])
        have_elementary_eweather="yes"
        ELM_EWEATHER_DEF="#define"
        requirement_elm="eweather ${requirement_elm}"
       ],
       [have_elementary_eweather="no"]
    )
else
    have_elementary_eweather="no"
fi
if test "x$want_elementary_eweather" = "xyes" -a "x$have_elementary_eweather" = "xno"; then
    AC_MSG_ERROR([Eweather support requested, but eweather was not found by pkg-config.])
fi
AC_SUBST(ELM_EWEATHER_DEF)

ELM_EMAP_DEF="#undef"
have_elementary_emap="no"
want_elementary_emap="auto"
AC_ARG_ENABLE([emap],
   [AC_HELP_STRING([--disable-emap], [disable emap support. @<:@default=detect@:>@])],
   [want_elementary_emap=$enableval], [])

if test "x$want_elementary_emap" != "xno"; then
    PKG_CHECK_MODULES([ELEMENTARY_EMAP],
       [
        emap
       ],
       [
        AC_DEFINE(HAVE_ELEMENTARY_EMAP, 1, [EMap support for Elementary])
        have_elementary_emap="yes"
        ELM_EMAP_DEF="#define"
        requirement_elm="emap ${requirement_elm}"
       ],
       [have_elementary_emap="no"]
    )
else
    have_elementary_emap="no"
fi
if test "x$want_elementary_emap" = "xyes" -a "x$have_elementary_emap" = "xno"; then
    AC_MSG_ERROR([Emap support requested, but emap was not found by pkg-config.])
fi
AC_SUBST(ELM_EMAP_DEF)

ELM_WEB_DEF="#undef"

elementary_web_backend="detect"
elementary_web="no"
want_elementary_web=""
AC_ARG_WITH([elementary-web-backend],
   [AC_HELP_STRING([--with-elementary-web-backend=@<:@ewebkit/ewebkit2/detect/none@:>@], [Select the WebKit backend for Elementary to support web @<:@default=detect@:>@])],
   [
    elementary_web_backend=${withval}
   ],
   [elementary_web_backend="detect"])

case "$elementary_web_backend" in
    ewebkit|ewebkit2|detect|none) ;;
    *) AC_MSG_ERROR([Invalid web backend: must be ewebkit, ewebkit2, detect or none]) ;;
esac

if test "x$elementary_web_backend" = "xdetect"; then
    # FIXME : detect option should check both ewebkit and ewebkit2.
    want_elementary_web="ewebkit"
else
    want_elementary_web=$elementary_web_backend
fi

if test "x$want_elementary_web" != "xnone"; then
    PKG_CHECK_MODULES([ELEMENTARY_WEB],
       [$want_elementary_web],
       [
        AC_DEFINE(HAVE_ELEMENTARY_WEB, 1, [Web support for Elementary])
        webkit_datadir=$($PKG_CONFIG $want_elementary_web --variable=datadir)
        AC_DEFINE_UNQUOTED(WEBKIT_DATADIR,
                           "$webkit_datadir",
                           "WebKit's data dir")
        if test "x$elementary_web_backend" = "xewebkit2"; then
            AC_DEFINE(USE_WEBKIT2, 1, [Use ewebkit2 as Elementary web backend])
        fi

        elementary_web=$want_elementary_web
        ELM_WEB_DEF="#define"
        requirement_elm="${want_elementary_web} ${requirement_elm}"
       ],
       [elementary_web="no"]
    )
else
    elementary_web="no"
fi

if test "x$elementary_web_backend" = "xewebkit" -o "x$elementary_web_backend" = "xewebkit2"; then
    if test "x$elementary_web" = "xnone"; then
        AC_MSG_ERROR([Web support requested, but no $elementary_web_backend found by pkg-config.])
    fi
fi
AC_SUBST(ELM_WEB_DEF)

ELM_DEBUG_DEF="#undef"
want_elementary_debug="no"
AC_ARG_ENABLE([debug],
   [AC_HELP_STRING([--enable-debug], [enable elementary debug support. @<:@default=disabled@:>@])],
   [want_elementary_debug=$enableval], [])

if test "x$want_elementary_debug" = "xyes"; then
        AC_DEFINE(HAVE_ELEMENTARY_DEBUG, 1, [Elementary debug.])
        ELM_DEBUG_DEF="#define"
fi
AC_SUBST(ELM_DEBUG_DEF)

AC_ARG_WITH([tests],
   [AC_HELP_STRING([--with-tests=none|regular],
                   [choose elementary testing method: regular or none.(coverage will be supported)@<:@default=none@:>@])],
   [build_tests=${withval}],
   [build_tests=none])

if test "${build_tests}" = "regular"; then
   PKG_CHECK_MODULES([CHECK], [check >= 0.9.5])
fi
AM_CONDITIONAL([ENABLE_ELEMENTARY_TESTS], [test "${build_tests}" = "regular"])

ELM_ALLOCA_H_DEF="#undef"
AC_CHECK_HEADER(alloca.h, [ELM_ALLOCA_H_DEF="#define"])
AC_SUBST(ELM_ALLOCA_H_DEF)

ELM_LIBINTL_H_DEF="#undef"
AC_CHECK_HEADER(libintl.h, [ELM_LIBINTL_H_DEF="#define"])
AC_SUBST(ELM_LIBINTL_H_DEF)

ELM_DIRENT_H_DEF="#undef"
AC_CHECK_HEADER(dirent.h, [ELM_DIRENT_H_DEF="#define"])
AC_SUBST(ELM_DIRENT_H_DEF)

AC_CHECK_HEADER(sys/mman.h, [have_mman="yes"], [have_mman="no"])
if test "x${have_mman}" = "xyes"; then
   AC_DEFINE(HAVE_MMAN_H, 1, [Have sys/mman.h header file])
fi

AC_CHECK_HEADERS([locale.h langinfo.h sys/times.h])

my_libs="-lm"
AC_SUBST(my_libs)
AC_SUBST(requirement_elm)

EFL_WITH_BIN([eet], [eet-eet], [eet])
EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
EFL_WITH_BIN([elementary], [elementary-codegen], [elementary_codegen])
EFL_WITH_BIN([elementary], [elm-prefs-cc], [elm_prefs_cc])

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

EFL_ENABLE_BIN([elementary-test])
EFL_ENABLE_BIN([elementary-codegen])
EFL_ENABLE_BIN([elm-prefs-cc])
EFL_ENABLE_BIN([elementary-config])

m4_ifdef([AM_GNU_GETTEXT_VERSION], [
AM_GNU_GETTEXT_VERSION([0.17])
])

m4_ifdef([AM_GNU_GETTEXT], [
AM_GNU_GETTEXT([external])
po_makefile_in=po/Makefile.in
have_po="yes"
],[
have_po="no"
])
AC_SUBST(LTLIBINTL)

if test "x${POSUB}" = "x" ; then
   have_po="no"
fi

AM_CONDITIONAL([HAVE_PO], [test "x${have_po}" = "xyes"])

EFL_CHECK_PATH_MAX

elementary_base_dir=".elementary"
AC_ARG_WITH([elementary-base-dir],
   [AC_HELP_STRING([--with-elementary-base-dir=PATH], [specify the subdirectory for all elementary data @<:@default=${elementary_base_dir}@:>@])],
   [elementary_base_dir=${withval}],
   [elementary_base_dir=".elementary"])

AC_MSG_NOTICE([ELEMENTARY_BASE_DIR set to ${elementary_base_dir}])
AC_DEFINE_UNQUOTED(ELEMENTARY_BASE_DIR, "${elementary_base_dir}", "subdirectory for all elementary data")

### 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_TRY_COMPILE([
# define _GNU_SOURCE 1
#include <unistd.h>
], [
extern char **environ;
], [
  AC_DEFINE(HAVE_ENVIRON, 1, [extern environ exists])
])

AC_CONFIG_FILES([
Makefile
elementary.spec
elementary.pc
doc/Makefile
doc/Doxyfile
doc/widgets/Makefile
src/Makefile
src/lib/Makefile
src/lib/Elementary.h
src/bin/Makefile
src/modules/Makefile
src/modules/prefs/Makefile
src/modules/access_output/Makefile
src/modules/datetime_input_ctxpopup/Makefile
src/modules/test_entry/Makefile
src/modules/test_map/Makefile
src/edje_externals/Makefile
src/examples/Makefile
src/tests/Makefile
data/Makefile
data/themes/Makefile
data/images/Makefile
data/objects/Makefile
data/desktop/Makefile
data/edje_externals/Makefile
config/Makefile
config/default/Makefile
config/standard/Makefile
config/mobile/Makefile
$po_makefile_in
cmakeconfig/ElementaryConfig.cmake
cmakeconfig/ElementaryConfigVersion.cmake
pkgbuild/PKGBUILD
])

AC_OUTPUT

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

echo
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo "Configuration Options Summary:"
echo
echo "  Engines:"
echo "    X11....................: ${have_elementary_x}"
echo "    Framebuffer............: ${have_elementary_fb}"
echo "    PSL1GHT................: ${have_elementary_psl1ght}"
echo "    SDL....................: ${have_elementary_sdl}"
echo "    Cocoa..................: ${have_elementary_cocoa}"
echo "    Windows XP.............: ${have_elementary_win32}"
echo "    Windows CE.............: ${have_elementary_wince}"
echo "    Wayland................: ${have_elementary_wayland}"
echo
echo "  Features:"
echo "    EWeather...............: ${have_elementary_eweather}"
echo "    EMap...................: ${have_elementary_emap}"
echo "    Web (WebKit)...........: ${elementary_web}"
echo "    Quick Launch...........: ${have_fork}"
echo "    Elocation..............: ${have_elementary_elocation}"
echo
echo "  eet......................: ${eet_eet}"
echo "  edje_cc..................: ${edje_cc}"
echo
echo "  Build elementary_test....: ${have_elementary_test}"
echo "  Build elementary_codegen.: ${have_elementary_codegen}"
echo "  Build elm_prefs_cc.......: ${have_elm_prefs_cc}"
echo "  Examples.................: ${enable_build_examples}"
echo "  Examples installed.......: ${enable_install_examples}"
echo "  Build elementary_config..: ${have_elementary_config}"
echo "  Enable debug.............: ${want_elementary_debug}"
echo
echo "Compilation................: make (or gmake)"
echo "  CPPFLAGS.................: $CPPFLAGS"
echo "  CFLAGS...................: $CFLAGS"
echo "  LDFLAGS..................: $LDFLAGS"
echo
if test "${build_tests}" = "none"; then
echo "Tests......................: no"
else
echo "Tests......................: make check"
fi
echo
echo "Installation...............: make install (as root if needed, with 'su' or 'sudo')"
echo "  prefix...................: $prefix"
echo