summaryrefslogtreecommitdiff
path: root/legacy/ecore/configure.in
blob: 0c6d9b18a66bc0d2cabe0c36e9af4e32a058c222 (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
801
802
803
804
805
806
807
808
809
810
811
dnl Process this file with autoconf to produce a configure script.
rm -f config.cache

AC_INIT(ecore, 0.9.9.041, enlightenment-devel@lists.sourceforge.net)
AC_PREREQ(2.52)
AC_CONFIG_SRCDIR(configure.in)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_ISC_POSIX

AM_INIT_AUTOMAKE(1.6 dist-bzip2)
AM_CONFIG_HEADER(config.h)

AC_PROG_CXX
AC_C_BIGENDIAN
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_C_CONST
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_C___ATTRIBUTE__
AC_HEADER_SYS_WAIT

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

VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
AC_SUBST(version_info)

# define pkg-config requirements for all our submodules.
# only the trivial requirements go here.
requirements_ecore_con=""
requirements_ecore_config=""
requirements_ecore_desktop=""
requirements_ecore_directfb=""
requirements_ecore_evas="evas"
requirements_ecore_fb=""
requirements_ecore_file=""
requirements_ecore_ipc=""
requirements_ecore_job=""
requirements_ecore_txt=""
requirements_ecore_x=""
requirements_ecore_win32=""
requirements_ecore_sdl=""

dnl The first call to PKG_CHECK_MODULES is done conditionally,
dnl so we should include this here:
PKG_PROG_PKG_CONFIG

dnl check common functions and headers
AC_CHECK_FUNCS(gettimeofday)
AC_CHECK_FUNCS(strlcpy)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl)
AC_SUBST(dlopen_libs)

dnl openssl
want_openssl="yes"
have_openssl="no"
AC_ARG_ENABLE(openssl,
  AC_HELP_STRING(
    [--disable-openssl],
    [disable openssl support]
  ),
  [ want_openssl=$enableval ]
)

if test "x$want_openssl" = "xyes"; then
  PKG_CHECK_MODULES(SSL, openssl,
    [
       AC_DEFINE(USE_OPENSSL, 1, [Use OpenSSL])
       requirements_ecore_con="$requirements_ecore_con openssl"
       # no need to add it to req_ecore_ipc, since they
       # depends on ecore_con anyway.
       have_openssl="yes"
    ],
    [ have_openssl="no" ]
  )
fi

dnl curl
want_curl="yes"
have_curl="no"
AC_ARG_ENABLE(curl,
  AC_HELP_STRING(
    [--disable-curl],
    [disable curl support]
  ),
  [ want_curl=$enableval ]
)

if test "x$want_curl" = "xyes"; then
  PKG_CHECK_MODULES(CURL, libcurl,
    [
      AC_DEFINE(HAVE_CURL, 1, [ Downloading with CURL ])
      requirements_ecore_file="$requirements_ecore_file libcurl"
      requirements_ecore_con="$requirements_ecore_con libcurl"
      have_curl="yes"
    ],
    [ have_curl="no" ]
  )
fi

dnl abstract sockets
want_abstract_sockets="yes"
AC_ARG_ENABLE(abstract-sockets,
  AC_HELP_STRING(
    [--disable-abstract-sockets],
    [disable abstract sockets.]
  ),
  [ want_abstract_sockets=$enableval ]
)
if test "x$want_abstract_sockets" = "xyes"; then
  AC_DEFINE(HAVE_ABSTRACT_SOCKETS, 1, [Have abstract sockets namespace])
fi

dnl add windows requirements
winsock_libs=""
create_shared_lib=""
ecore_file_win32_lib=""
case "$host_os" in
	mingw|mingw32)
		winsock_libs="-lwsock32"
		create_shared_lib="-no-undefined"
		ecore_file_win32_lib="-lole32 -luuid"
		;;
esac

AC_SUBST(winsock_libs)
AC_SUBST(create_shared_lib)
AC_SUBST(ecore_file_win32_lib)

dnl ecore_job
ECORE_CHECK_MODULE([Job], [yes])

dnl ecore_con
ECORE_CHECK_MODULE([Con], [yes])

dnl ecore_ipc
ECORE_CHECK_MODULE([Ipc], [yes], [$have_ecore_con])

dnl ecore_config
PKG_CHECK_MODULES(EET, [eet >= 0.9.10],
  [ have_eet="yes" ],
  [ have_eet="no" ]
)
ecore_config_deps="no"
if test "x$have_eet" = "xyes" -a "x$have_ecore_ipc" = "xyes" ; then
  ecore_config_deps="yes"
fi
ECORE_CHECK_MODULE([Config], [yes], [$ecore_config_deps],
  [requirements_ecore_config="$requirements_ecore_config ecore-ipc eet"])

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

if test "x$have_iconv" = "xno" ; then
  AC_CHECK_LIB(c, iconv,
    [ have_iconv="yes" ]
  )

  if test "x$have_iconv" != "xyes"; then
    AC_CHECK_LIB(iconv, iconv,
      [
       iconv_libs="-liconv"
       have_iconv="yes"
      ]
    )
  fi
fi
AC_MSG_CHECKING(for explicit iconv link options)
AC_MSG_RESULT($iconv_libs)

AC_SUBST(iconv_cflags)
AC_SUBST(iconv_libs)

ECORE_CHECK_MODULE([Txt], [yes], [$have_iconv],
  [ecore_txt_libs="$ecore_txt_libs $iconv_libs"])

dnl ecore_evas
PKG_CHECK_MODULES(EVAS, [evas >= 0.9.9],
  [ have_evas="yes" ],
  [ have_evas="no" ]
)

ECORE_CHECK_MODULE([Evas], [yes], [$have_evas])

dnl ecore_x{cb}
have_ecore_x="no"
have_ecore_x_xcb="no"

AC_ARG_ENABLE(ecore-x-xcb,
  AC_HELP_STRING(
    [--enable-ecore-x-xcb],
    [enable the ecore_x module with XCB backend. [[default=disabled]]]),
  [ want_ecore_x_xcb=$enableval ],
  [ want_ecore_x_xcb="no" ])

AC_MSG_CHECKING(whether ecore_x with XCB backend is to be built)
AC_MSG_RESULT($want_ecore_x_xcb)

if test "x$want_ecore_x_xcb" = "xyes" ; then
  PKG_CHECK_MODULES(XCB, xcb xcb-icccm xcb-image xcb-keysyms,
    [ have_ecore_x_xcb="yes" ],
    [ have_ecore_x_xcb="no" ])

  if test "x$have_ecore_x_xcb" = "xyes" ; then
    PKG_CHECK_MODULES(XCB_COMPOSITE, xcb-composite,
      [ have_ecore_x_xcb_composite="yes"
      AC_DEFINE(ECORE_XCB_COMPOSITE, 1, [Build support for XCB composite]) ],
      [ have_ecore_x_xcb_composite="no" ])

    PKG_CHECK_MODULES(XCB_DAMAGE, xcb-damage,
      [ have_ecore_x_xcb_damage="yes"
      AC_DEFINE(ECORE_XCB_DAMAGE, 1, [Build support for XCB damage]) ],
      [ have_ecore_x_xcb_damage="no" ])

    PKG_CHECK_MODULES(XCB_DPMS, xcb-dpms,
      [ have_ecore_x_xcb_dpms="yes"
      AC_DEFINE(ECORE_XCB_DPMS, 1, [Build support for XCB dpms]) ],
      [ have_ecore_x_xcb_dpms="no" ])

    PKG_CHECK_MODULES(XCB_RANDR, xcb-randr,
      [ have_ecore_x_xcb_randr="yes"
      AC_DEFINE(ECORE_XCB_RANDR, 1, [Build support for XCB randr]) ],
      [ have_ecore_x_xcb_randr="no" ])

    PKG_CHECK_MODULES(XCB_RENDER, xcb-render,
      [ have_ecore_x_xcb_render="yes"
      AC_DEFINE(ECORE_XCB_RENDER, 1, [Build support for XCB render]) ],
      [ have_ecore_x_xcb_render="no" ])

    PKG_CHECK_MODULES(XCB_SCREENSAVER, xcb-screensaver,
      [ have_ecore_x_xcb_screensaver="yes"
      AC_DEFINE(ECORE_XCB_SCREENSAVER, 1, [Build support for XCB screensaver]) ],
      [ have_ecore_x_xcb_screensaver="no" ])

    PKG_CHECK_MODULES(XCB_SHAPE, xcb-shape,
      [ have_ecore_x_xcb_shape="yes"
      AC_DEFINE(ECORE_XCB_SHAPE, 1, [Build support for XCB shape]) ],
      [ have_ecore_x_xcb_shape="no" ])

    PKG_CHECK_MODULES(XCB_SYNC, xcb-sync,
      [ have_ecore_x_xcb_sync="yes"
      AC_DEFINE(ECORE_XCB_SYNC, 1, [Build support for XCB sync]) ],
      [ have_ecore_x_xcb_sync="no" ])

    PKG_CHECK_MODULES(XCB_XFIXES, xcb-xfixes,
      [ have_ecore_x_xcb_xfixes="yes"
      AC_DEFINE(ECORE_XCB_FIXES, 1, [Build support for XCB xfixes]) ],
      [ have_ecore_x_xcb_xfixes="no" ])

    PKG_CHECK_MODULES(XCB_XINERAMA, xcb-xinerama,
      [ have_ecore_x_xcb_xinerama="yes"
      AC_DEFINE(ECORE_XCB_XINERAMA, 1, [Build support for XCB xinerama]) ],
      [ have_ecore_x_xcb_xinerama="no" ])

    PKG_CHECK_MODULES(XCB_XPRINT, xcb-xprint,
      [ have_ecore_x_xcb_xprint="yes"
      AC_DEFINE(ECORE_XCB_XPRINT, 1, [Build support for XCB xprint]) ],
      [ have_ecore_x_xcb_xprint="no" ])

    AC_DEFINE(BUILD_ECORE_X, 1, [Build Ecore_X Module (XCB backend)])
    AC_DEFINE(HAVE_ECORE_X_XCB, 1, [Defined to 1 if XCB backend is enabled.])

    have_ecore_x_xcb_define="-DHAVE_ECORE_X_XCB"
    have_ecore_x="yes"
    AC_SUBST(have_ecore_x_xcb_define)
  fi
fi

x_dir="";
x_includes="";
x_cflags="";
x_libs="";
if test "x$have_ecore_x_xcb" != "xyes" ; then
  have_x="no"
  AC_PATH_XTRA
  AC_CHECK_HEADER(X11/X.h,
    [
     have_x="yes"
     x_dir=${x_dir:-/usr/X11R6}
     x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
     x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
    ]
  )
  
  AC_SUBST(x_cflags)
  AC_SUBST(x_includes)
  AC_SUBST(x_libs)
  
  ECORE_CHECK_MODULE([X], [yes], [$have_x],
    [ecore_x_libs="$ecore_x_libs $x_libs"])
  
  if test "x$have_ecore_x" = "xyes"; then
    Xcursor_libs=""
    Xcursor_cflags=""
    use_Xcursor="no"
    PCFLAGS=$CFLAGS
    CFLAGS=$x_cflags" "$x_includes
    AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
      [
        AC_CHECK_LIB(Xcursor, XcursorImageLoadCursor,
          [
            AC_DEFINE(ECORE_XCURSOR, 1, [Build support for Xcursor])
            Xcursor_cflags=""
            Xcursor_libs="-lXcursor"
            use_Xcursor="yes"
          ], [
            Xcursor_cflags=""
            Xcursor_libs=""
            use_Xcursor="no"
          ], [
            $x_libs -lXrender
          ]
        )
      ], [
        Xcursor_cflags=""
        Xcursor_libs=""
        use_Xcursor="no"
      ], [
        #include <X11/Xlib.h>
      ]
    )
    CFLAGS=$PCFLAGS
  
    AC_SUBST(Xcursor_cflags)
    AC_SUBST(Xcursor_libs)
  
    ECORE_CHECK_X_EXTENSION([Xcomposite], [Xcomposite.h], [Xcomposite], [XCompositeQueryExtension])
    ECORE_CHECK_X_EXTENSION([Xdamage], [Xdamage.h], [Xdamage], [XDamageSubtract])
    ECORE_CHECK_X_EXTENSION([Xdpms], [dpms.h], [Xdpms], [DPMSQueryExtension])
    if test "x$use_xdpms" = "xno" ; then
      ECORE_CHECK_X_EXTENSION([Xdpms], [dpms.h], [Xext], [DPMSQueryExtension])
    fi
    ECORE_CHECK_X_EXTENSION([Xfixes], [Xfixes.h], [Xfixes], [XFixesExpandRegion])
    ECORE_CHECK_X_EXTENSION([Xinerama], [Xinerama.h], [Xinerama], [XineramaQueryScreens])
    ECORE_CHECK_X_EXTENSION([Xprint], [Print.h], [Xp], [XpQueryScreens])
    ECORE_CHECK_X_EXTENSION([Xrandr], [Xrandr.h], [Xrandr], [XRRSizes])
    ECORE_CHECK_X_EXTENSION([Xrender], [Xrender.h], [Xrender], [XRenderFindVisualFormat])
    ECORE_CHECK_X_EXTENSION([Xss], [scrnsaver.h], [Xss], [XScreenSaverSelectInput])
  fi
fi

dnl ecore_evas_x11
have_ecore_evas_x11="no"
have_ecore_evas_x11_gl="no";
have_ecore_evas_xrender="no";
have_ecore_evas_x11_16="no";
if test "x$have_ecore_x" = "xyes" -a "x$have_ecore_evas" = "xyes"; then
  dnl ecore_evas_x11
  want_ecore_evas_x11=yes
  dnl disabling this will make things go haywire
  #AC_ARG_ENABLE(ecore-evas-x11,
  #  AC_HELP_STRING(
  #    [--enable-ecore-evas-x11],
  #    [enable X11 support in the ecore_evas module.]
  #  ),
  #  [ want_ecore_evas_x11=$enableval ]
  #)
  AC_MSG_CHECKING(whether ecore_evas x11 support is to be built)
  AC_MSG_RESULT($want_ecore_evas_x11)
  
  if test "x$want_ecore_evas_x11" = "xyes"; then
    PKG_CHECK_EXISTS(evas-software-x11,
      [
        AC_DEFINE(BUILD_ECORE_EVAS_X11, 1, [Support for X11 Engine in Ecore_Evas])
        have_ecore_evas_x11="yes";
      ]
    )
  fi

  dnl ecore_evas_x11_gl
  want_ecore_evas_x11_gl=no
  AC_ARG_ENABLE(ecore-evas-x11-gl,
    AC_HELP_STRING(
      [--enable-ecore-evas-x11-gl],
      [enable X11 GL support in the ecore_evas module.]
    ),
    [ want_ecore_evas_x11_gl=$enableval ]
  )
  AC_MSG_CHECKING(whether ecore_evas x11 gl support is to be built)
  AC_MSG_RESULT($want_ecore_evas_x11_gl)
  
  if test "x$want_ecore_evas_x11_gl" = "xyes"; then
    PKG_CHECK_EXISTS(evas-opengl-x11,
      [
        AC_DEFINE(BUILD_ECORE_EVAS_X11_GL, 1, [Support for GL Engine in Ecore_Evas])
        have_ecore_evas_x11_gl="yes";
      ]
    )
  fi

  dnl ecore_evas_xrender
  want_ecore_evas_xrender=yes
  AC_ARG_ENABLE(ecore-evas-xrender,
    AC_HELP_STRING(
      [--disable-ecore-evas-xrender],
      [disable XRender support in the ecore_evas module. [[default=enabled]]]
    ),
    [ want_ecore_evas_xrender=$enableval ]
  )
  
  AC_MSG_CHECKING(whether ecore_evas xrender support is to be built)
  AC_MSG_RESULT($want_ecore_evas_xrender)
  
  if test "x$want_ecore_evas_xrender" = "xyes"; then
    PKG_CHECK_EXISTS(evas-xrender-x11,
      [
        AC_DEFINE(BUILD_ECORE_EVAS_XRENDER, 1, [Support for XRender Engine in Ecore_Evas])
        have_ecore_evas_xrender="yes";
      ]
    )
  fi

  dnl ecore_evas_x11_16
  want_ecore_evas_x11_16=no
  AC_ARG_ENABLE(ecore-evas-x11-16,
    AC_HELP_STRING(
      [--enable-ecore-evas-x11-16],
      [enable 16bpp optimized mode support in the ecore_evas module. [[default=disabled]]]
    ),
    [ want_ecore_evas_x11_16=$enableval ]
  )

  AC_MSG_CHECKING(whether ecore_evas x11-16 support is to be built)
  AC_MSG_RESULT($want_ecore_evas_x11_16)
  
  if test "x$want_ecore_evas_x11_16" = "xyes"; then
    PKG_CHECK_EXISTS(evas-software-16-x11,
      [
        AC_DEFINE(BUILD_ECORE_EVAS_X11_16, 1, [Support for X11 16bpp Engine in Ecore_Evas])
        have_ecore_evas_x11_16="yes";
      ]
    )
  fi
  if test "x$have_ecore_evas_x11" = "xyes" -o \
	  "x$have_ecore_evas_x11_gl" = "yes" -o \
	  "x$have_ecore_evas_xrender" = "yes" -o \
	  "x$have_ecore_evas_x11_16" = "yes"; then
    requirements_ecore_evas="$requirements_ecore_evas ecore-x"
  fi
fi

dnl ecore_win32
# TODO: We should first check if we have win32 available before checking for win32 evas
# TODO: Need to check if we have evas before testing win32 evas engines
AC_MSG_CHECKING(for Evas Software DirectDraw engine)
PKG_CHECK_EXISTS(evas-software-ddraw >= 0.9.9.41,
  [ have_ddraw="yes"
    AC_DEFINE(HAVE_DIRECTDRAW, 1, [Build Ecore_Win32 with DirectDraw Code])
    ddraw_libs="-lddraw -ldxguid" ],
  [ have_ddraw="no" ]
)
AC_MSG_RESULT($have_ddraw)
AC_SUBST(ddraw_libs)

AC_MSG_CHECKING(for Evas 16bpp Software DirectDraw engine)
PKG_CHECK_EXISTS(evas-software-16-ddraw >= 0.9.9.41,
  [ have_ddraw_16="yes"
    AC_DEFINE(HAVE_DIRECTDRAW_16, 1, [Build Ecore_Win32 with 16 bpp DirectDraw Code])
    ddraw_16_libs="-lddraw -ldxguid" ],
  [ have_ddraw_16="no" ]
)
AC_MSG_RESULT($have_ddraw_16)
AC_SUBST(ddraw_16_libs)

AC_MSG_CHECKING(for Evas Direct3D engine)
PKG_CHECK_EXISTS(evas-direct3d >= 0.9.9.41,
  [ have_direct3d="yes"
    AC_DEFINE(HAVE_DIRECT3D, 1, [Build Ecore_Win32 with Direct3D Code])
    direct3d_libs="-ld3d9 -ld3dx9d" ],
  [ have_direct3d="no" ]
)
AC_MSG_RESULT($have_direct3d)
AC_SUBST(direct3d_libs)

have_win32="no"
if test "x${have_ddraw}" = "xyes" -o "x${have_ddraw_16}" = "xyes" -o "x${have_direct3d}" = "xyes"; then
  have_win32="yes"
fi

ECORE_CHECK_MODULE([Win32], [no], [$have_win32],
  [ecore_win32_libs="$ecore_win32_libs $ddraw_libs $ddraw_16_libs $direct3d_libs"])

if test "x$have_ecore_win32" = "xyes"; then
  requirements_ecore_evas="$requirements_ecore_evas ecore-win32"
fi

if test "x${have_ecore_win32}" = "xyes" -a "x${have_ddraw}" = "xyes"; then
  AC_DEFINE(BUILD_ECORE_EVAS_DIRECTDRAW, 1, [Support for DirectDraw Engine in Ecore_Evas])
fi

if test "x${have_ecore_win32}" = "xyes" -a "x${have_ddraw_16}" = "xyes"; then
  AC_DEFINE(BUILD_ECORE_EVAS_DIRECTDRAW_16, 1, [Support for 16 bpp DirectDraw Engine in Ecore_Evas])
fi

if test "x${have_ecore_win32}" = "xyes" -a "x${have_direct3d}" = "xyes"; then
  AC_DEFINE(BUILD_ECORE_EVAS_DIRECT3D, 1, [Support for Direct3D Engine in Ecore_Evas])
fi

dnl ecore_dfb
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
  [ have_directfb="yes" ],
  [ have_directfb="no" ]
)

ECORE_CHECK_MODULE([DirectFB], [no], [$have_directfb],
  [requirements_ecore_directfb="directfb"])

dnl ecore_evas_dfb
have_ecore_evas_dfb="no"
if test "x$have_ecore_directfb" = "xyes" -a "x$have_ecore_evas" = "xyes"; then
  want_ecore_evas_dfb="yes"
  AC_MSG_CHECKING(whether ecore_evas DirectFB support is to be built)
  AC_ARG_ENABLE(ecore-evas-dfb,
    AC_HELP_STRING([--disable-ecore-evas-dfb], [disable DirectFB in the ecore_evas module]),
    [ want_ecore_evas_dfb=$enableval ]
  )
  AC_MSG_RESULT($want_ecore_evas_dfb)
  
  if test "x$want_ecore_evas_dfb" = "xyes" -a "x$have_ecore_directfb" = "xyes" ; then
    save_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $DIRECTFB_CFLAGS"
    PKG_CHECK_EXISTS(evas-directfb,
      [
        AC_DEFINE(BUILD_ECORE_EVAS_DIRECTFB, 1, [Support for DirectFB in Ecore_Evas])
        have_ecore_evas_dfb="yes"
        requirements_ecore_evas="$requirements_ecore_evas ecore-directfb"
      ]
    )
    CFLAGS="$save_CFLAGS"
  fi
fi

dnl ecore_fb
have_fb="no"
AC_CHECK_HEADER(linux/fb.h,
  [ AC_CHECK_HEADER(linux/input.h, [ have_fb="yes" ]) ]
)
ECORE_CHECK_MODULE([FB], [no], [$have_fb])

tslib_libs=""
if test "x$have_ecore_fb" = "xyes" ; then
AC_CHECK_HEADER(tslib.h,
  [
   tslib_libs="-lts"
   AC_DEFINE(HAVE_TSLIB, 1, [Build Ecore_FB Touchscreen Code])
  ]
)
fi
AC_SUBST(tslib_libs)

dnl ecore_evas_fb
have_ecore_evas_fb="no";
if test "x$have_ecore_fb" = "xyes" -a "x$have_ecore_evas" = "xyes"; then
  want_ecore_evas_fb="yes";
  AC_MSG_CHECKING(whether ecore_evas fb support is to be built)
  AC_ARG_ENABLE(ecore-evas-fb,
    AC_HELP_STRING([--disable-ecore-evas-fb], [disable fb in the ecore_evas module]),
    [ want_ecore_evas_fb=$enableval ]
  )
  AC_MSG_RESULT($want_ecore_evas_fb)
  
  if test "x$want_ecore_evas_fb" = "xyes"; then
    PKG_CHECK_EXISTS(evas-framebuffer,
      [
        AC_DEFINE(BUILD_ECORE_EVAS_FB, 1, [Support for Linux FB in Ecore_Evas])
        have_ecore_evas_fb="yes"
        requirements_ecore_evas="$requirements_ecore_evas ecore-fb"
      ]
    )
  fi
fi

dnl ecore_sdl
PKG_CHECK_MODULES(SDL, sdl >= 1.2.0,
    [ have_sdl="yes" ],
    [ have_sdl="no" ])

ECORE_CHECK_MODULE([SDL], [no], [$have_sdl])

dnl ecore_evas_sdl
have_ecore_evas_sdl="no";
if test "x$have_sdl" = "xyes" -a "x$have_ecore_evas" = "xyes"; then
  want_ecore_evas_sdl="yes";
  AC_MSG_CHECKING(whether ecore_evas sdl support is to be built)
  AC_ARG_ENABLE(ecore-evas-sdl,
    AC_HELP_STRING([--disable-ecore-evas-sdl], [disable sdl in the ecore_evas module]),
    [ want_ecore_evas_sdl=$enableval ]
  )
  AC_MSG_RESULT($want_ecore_evas_sdl)
  
  if test "x$want_ecore_evas_sdl" = "xyes"; then
    save_CFLAGS=$CFLAGS
    CFLAGS="$CFLAGS $SDL_CFLAGS"
    PKG_CHECK_EXISTS(evas-sdl,
      [
        AC_DEFINE(BUILD_ECORE_EVAS_SDL, 1, [Support for SDL in Ecore_Evas])
        have_ecore_evas_sdl="yes"
        requirements_ecore_evas="$requirements_ecore_evas ecore-sdl"
        PKG_CHECK_MODULES(SDL, sdl >= 1.3.0,
          [ AC_DEFINE(BUILD_ECORE_EVAS_SDL_130, 1, [Support for SVN SDL]) ],
	  [ dummy="no" ])
      ]
    )
    CFLAGS=$save_CFLAGS
  fi
fi

dnl ecore_evas_buffer
want_ecore_evas_buffer="yes";
have_ecore_evas_buffer="no";
AC_MSG_CHECKING(whether ecore_evas buffer support is to be built)
AC_ARG_ENABLE(ecore-evas-buffer,
  AC_HELP_STRING([--disable-ecore-evas-buffer], [disable buffer in the ecore_evas module]),
  [ want_ecore_evas_buffer=$enableval ]
)
AC_MSG_RESULT($want_ecore_evas_buffer)

if test "x$want_ecore_evas_buffer" = "xyes" -a "x$have_ecore_evas" = "xyes"; then
  PKG_CHECK_EXISTS(evas-software-buffer,
    [
      AC_DEFINE(BUILD_ECORE_EVAS_BUFFER, 1, [Support for Buffers in Ecore_Evas])
      have_ecore_evas_buffer="yes"
    ]
  )
fi

dnl ecore_file
ECORE_CHECK_MODULE([File], [yes])
have_inotify="no"
have_poll="no"
if test "x$have_ecore_file" = "xyes"; then

  dnl We need to check if the right inotify version is accessible
  want_inotify="yes"
  AC_MSG_CHECKING(whether inotify is to be used for filemonitoring)
  AC_ARG_ENABLE(inotify,
    AC_HELP_STRING([--disable-inotify], [disable inotify in the ecore_file module]),
    [ want_inotify=$enableval ]
  )
  AC_MSG_RESULT($want_inotify)

  dnl It's hard to find a good test on how to check the correct
  dnl inotify version. They changed the headers a lot.
  dnl in kernel 2.6.13 __NR_inotify_init was added to the defined syscalls
  dnl in asm/unistd.h and IN_MOVE_SELF was added to linux/inotify.h
  dnl so with this check you need a very new kernel and kernel-headers!
  if test "x$want_inotify" = "xyes"; then
    AC_CHECK_LIB(c, inotify_init, [
        AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ])
        AC_DEFINE(HAVE_SYS_INOTIFY, 1, [ File monitoring with Inotify - sys/inotify.h ])
	have_inotify="yes"
      ],
      [
        AC_TRY_COMPILE(
          [
            #include <asm/unistd.h>
            #include <linux/inotify.h>
          ],
          [ int a = __NR_inotify_init; int b = IN_MOVE_SELF; ],
          [
            AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ])
	    have_inotify="yes"
          ], [
            have_inotify="no"
          ]
	)
      ]
    )
  fi

  want_poll="yes"
  AC_MSG_CHECKING(whether polling is to be used for filemonitoring)
  AC_ARG_ENABLE(poll,
    AC_HELP_STRING([--disable-poll], [disable poll in the ecore_file module]),
    [ want_poll=$enableval ]
  )
  AC_MSG_RESULT($want_poll)

  if test "x$want_poll" = "xyes"; then
    AC_DEFINE(HAVE_POLL, 1, [ File monitoring with polling ])
    have_poll="yes"
  fi
fi

dnl ecore_desktop
ECORE_CHECK_MODULE([Desktop], [no], [$have_ecore_file],
  [requirements_ecore_desktop="ecore-file"])

dnl ecore_imf
ECORE_CHECK_MODULE([IMF], [yes], [$have_evas])

dnl requirements
AC_SUBST(requirements_ecore_con)
AC_SUBST(requirements_ecore_config)
AC_SUBST(requirements_ecore_desktop)
AC_SUBST(requirements_ecore_directfb)
AC_SUBST(requirements_ecore_evas)
AC_SUBST(requirements_ecore_fb)
AC_SUBST(requirements_ecore_file)
AC_SUBST(requirements_ecore_ipc)
AC_SUBST(requirements_ecore_job)
AC_SUBST(requirements_ecore_txt)
AC_SUBST(requirements_ecore_x)
AC_SUBST(requirements_ecore_sdl)

# set up conditionals
AM_CONDITIONAL(BUILD_ECORE_X, test $have_ecore_x = yes -a $have_ecore_x_xcb = no)
AM_CONDITIONAL(BUILD_ECORE_X_XCB, test $have_ecore_x_xcb = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_X11, test $have_ecore_evas_x11 = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_X11_GL, test $have_ecore_evas_x11_gl = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_XRENDER, test $have_ecore_evas_xrender = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_X11_16, test $have_ecore_evas_x11_16 = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_DIRECTFB, test $have_ecore_evas_dfb = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_FB, test $have_ecore_evas_fb = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_BUFFER, test $have_ecore_evas_buffer = yes)

AC_OUTPUT([
Makefile
ecore-con.pc
ecore-config.pc
ecore-desktop.pc
ecore-directfb.pc
ecore-evas.pc
ecore-fb.pc
ecore-file.pc
ecore-imf.pc
ecore-ipc.pc
ecore-job.pc
ecore-txt.pc
ecore-x.pc
ecore-win32.pc
ecore-sdl.pc
ecore.pc
src/Makefile
src/bin/Makefile
src/lib/Makefile
src/lib/ecore/Makefile
src/lib/ecore_job/Makefile
src/lib/ecore_x/Makefile
src/lib/ecore_fb/Makefile
src/lib/ecore_sdl/Makefile
src/lib/ecore_evas/Makefile
src/lib/ecore_con/Makefile
src/lib/ecore_imf/Makefile
src/lib/ecore_ipc/Makefile
src/lib/ecore_txt/Makefile
src/lib/ecore_config/Makefile
src/lib/ecore_file/Makefile
src/lib/ecore_desktop/Makefile
src/lib/ecore_directfb/Makefile
src/lib/ecore_win32/Makefile
README
ecore.spec
])

echo
echo "$PACKAGE $VERSION"
echo
echo "Optional Modules:"
echo
echo "  Ecore_Job....................: $have_ecore_job"
echo "  Ecore_Con....................: $have_ecore_con (OpenSSL: $have_openssl) (CURL: $have_curl)"
echo "  Ecore_Ipc....................: $have_ecore_ipc (OpenSSL: $have_openssl)"
echo "  Ecore_Config.................: $have_ecore_config"
echo "  Ecore_Txt....................: $have_ecore_txt"

echo "  Ecore_Evas...................: $have_ecore_evas"
if test "x$have_ecore_x_xcb" = "xyes" ; then
  echo "  Ecore_X (XCB backend)........: $have_ecore_x_xcb (Xprint: $have_ecore_x_xcb_xprint) (Xinerama: $have_ecore_x_xcb_xinerama) (Xrandr: $have_ecore_x_xcb_randr) (Xscreensaver: $have_ecore_x_xcb_screensaver) (Xshape: $have_ecore_x_xcb_shape) (Xsync: $have_ecore_x_xcb_sync) (Xrender: $have_ecore_x_xcb_render) (Xfixes: $have_ecore_x_xcb_xfixes) (Xcomposite: $have_ecore_x_xcb_composite) (Xdamage: $have_ecore_x_xcb_damage) (Xdpms: $have_ecore_x_xcb_dpms)"
else
  echo "  Ecore_X (Xlib backend).......: $have_ecore_x (Xcursor: $use_Xcursor) (Xprint: $use_xprint) (Xinerama: $use_xinerama) (Xrandr: $use_xrandr) (Xscreensaver: $use_xss) (Xrender: $use_xrender) (Xcomposite: $use_xcomposite) (Xfixes: $use_xfixes) (Xdamage: $use_xdamage) (Xdpms: $use_xdpms)"
fi
echo "  Ecore_Evas X11 Support.......: $have_ecore_evas_x11"
echo "  Ecore_Evas X11 GL Support....: $have_ecore_evas_x11_gl"
echo "  Ecore_Evas XRender Support...: $have_ecore_evas_xrender"
echo "  Ecore_Evas X11 16bpp Support.: $have_ecore_evas_x11_16"

echo "  Ecore_Win32..................: $have_ecore_win32 (DirectDraw: ${have_ddraw}) (16bpp DirectDraw: ${have_ddraw_16}) (Direct3D: ${have_direct3d})"
echo "  Ecore_DFB....................: $have_ecore_directfb"
echo "  Ecore_Evas DFB Support.......: $have_ecore_evas_dfb"
echo "  Ecore_FB.....................: $have_ecore_fb"
echo "  Ecore_Evas FB Support........: $have_ecore_evas_fb"
echo "  Ecore_SDL....................: $have_ecore_sdl"
echo "  Ecore_Evas SDL Support.......: $have_ecore_evas_sdl"
echo "  Ecore_Evas Buffer Support....: $have_ecore_evas_buffer"

echo "  Ecore_File...................: $have_ecore_file (Inotify: $have_inotify) (Poll: $have_poll) (CURL: $have_curl)"
echo "  Ecore_Desktop................: $have_ecore_desktop"

echo "  Ecore_IMF....................: $have_ecore_imf"
echo
echo "Now type 'make' ('gmake' on some systems) to compile $PACKAGE."
echo