a7e00851ec1638bbf436e6c86c24f9c84994bc4b
[platform/upstream/efl.git] / m4 / evas_check_engine.m4
1 AC_DEFUN([REQUIRED_WAYLAND_VERSION], [1.11.0])
2
3 dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_XLIB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
4
5 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_XLIB],
6 [
7
8 EFL_FIND_X(evas_engine_[]$1,
9   [X11/X.h], [X11 XCreateImage Xext XShmCreateImage],
10   [
11     if test "x$3" = "xstatic"; then
12       requirements_libs_evas="$evas_engine_[]$1[]_libs $requirements_libs_evas"
13     fi
14     ifelse([$4], , :, [$4])
15   ],[
16     ifelse([$5], , :, [$5])
17   ])
18 ])
19
20 dnl use: EVAS_CHECK_ENGINE_DEP_GL_XLIB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
21
22 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_XLIB],
23 [
24
25 EFL_FIND_X(evas_engine_[]$1,
26   [X11/Xlib.h X11/Xatom.h X11/Xutil.h X11/extensions/Xrender.h X11/Xresource.h],
27   [X11 XCreateColormap Xrender XRenderCreatePicture],
28   [
29     CFLAGS_save="$CFLAGS"
30     CFLAGS="$evas_engine_[]$1[]_cflags $CFLAGS"
31     CPPFLAGS_save="$CPPFLAGS"
32     CPPFLAGS="$evas_engine_[]$1[]_cflags $CPPFLAGS"
33
34     AC_CHECK_HEADER([GL/gl.h],
35       [have_dep="yes"],
36       [have_dep="no"],
37       [
38 #include <GL/gl.h>
39 #include <GL/glext.h>
40 #include <GL/glx.h>
41 #include <X11/Xlib.h>
42 #include <X11/Xatom.h>
43 #include <X11/Xutil.h>
44 #include <X11/extensions/Xrender.h>
45 #include <X11/Xresource.h>
46       ])
47
48     gl_pt_lib=""
49     have_gl_pt="no"
50
51     AC_MSG_CHECKING([whether pthread_create() is supported])
52     CFLAGS_pt_save="$CFLAGS"
53     CFLAGS="$CFLAGS -pthread"
54     LIBS_pt_save="$LIBS"
55     LIBS="$LIBS -pthread"
56     AC_LINK_IFELSE(
57       [AC_LANG_PROGRAM([[
58 #include <pthread.h>
59                        ]],
60                        [[
61 pthread_create(NULL, NULL, NULL, NULL);
62                        ]])],
63       [have_gl_pt="yes"],
64       [have_gl_pt="no"])
65     CFLAGS=$CFLAGS_pt_save
66     LIBS=$LIBS_pt_save
67     AC_MSG_RESULT([$have_gl_pt])
68
69     if test "x$have_gl_pt" = "xyes" ; then
70       gl_pt_lib=" -pthread"
71     fi
72
73     if test "x$have_dep" = "xyes"; then
74       LIBS_save="$LIBS"
75       LIBS="$LIBS $evas_engine_[]$1[]_libs"
76       AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lm $gl_pt_lib])
77       LIBS="$LIBS_save"
78     fi
79
80     if test "x${with_opengl}" = "xes" ; then
81       have_dep=no
82     fi
83
84     if test "x$have_dep" = "xyes" ; then
85       evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs -lGL $gl_pt_lib"
86       evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGL $gl_pt_lib"
87     else
88       AC_CHECK_HEADER([GLES2/gl2.h],
89         [have_egl="yes"],
90         [have_egl="no"],
91         [
92 #include <GLES2/gl2.h>
93 #include <GLES2/gl2ext.h>
94 #include <EGL/egl.h>
95 #include <X11/Xlib.h>
96 #include <X11/Xatom.h>
97 #include <X11/Xutil.h>
98 #include <X11/extensions/Xrender.h>
99 #include <X11/Xresource.h>
100         ])
101       if test "x${have_egl}" = "xyes" ; then
102         AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lm $gl_pt_lib)
103         if test "x${have_glesv2}" = "xyes" ; then
104           evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs -lGLESv2 -lEGL -lm $gl_pt_lib"
105           evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm $gl_pt_lib"
106           have_dep="yes"
107           AC_DEFINE(GL_GLES, 1, [GLSL runtime shader GLES2 support])
108           gles_variety_sgx="yes"
109         fi
110       fi
111     fi
112
113     CPPFLAGS="$CPPFLAGS_save"
114     CFLAGS="$CFLAGS_save"
115
116     if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
117       requirements_libs_evas="$evas_engine_[]$1[]_libs $requirements_libs_evas"
118     fi
119
120     AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
121   ],[
122     ifelse([$5], , :, [$5])
123   ])
124 ])
125
126 dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_XCB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
127
128 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_XCB],
129 [
130
131 requirement=""
132 have_dep="no"
133 evas_engine_[]$1[]_cflags=""
134 evas_engine_[]$1[]_libs=""
135
136 PKG_CHECK_EXISTS([xcb xcb-shm xcb-image >= 0.2.1 pixman-1],
137    [
138     have_dep="yes"
139     requirement="xcb xcb-shm xcb-image >= 0.2.1 pixman-1"
140    ],
141    [have_dep="no"])
142
143 if test "x${have_dep}" = "xyes" ; then
144    if test "x$3" = "xstatic" ; then
145       requirements_pc_evas="${requirement} ${requirements_pc_evas}"
146       requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
147    else
148       PKG_CHECK_MODULES([XCB], [${requirement}])
149       evas_engine_[]$1[]_cflags="${XCB_CFLAGS}"
150       evas_engine_[]$1[]_libs="${XCB_LIBS}"
151    fi
152 fi
153
154 AC_SUBST([evas_engine_$1_cflags])
155 AC_SUBST([evas_engine_$1_libs])
156
157 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
158
159 ])
160
161
162 dnl use: EVAS_CHECK_ENGINE_DEP_GL_XCB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
163
164 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_XCB],
165 [
166
167 requirement=""
168
169 EFL_FIND_X(evas_engine_[]$1, [GL/gl.h],
170   [X11 XCreateColormap Xrender XRenderCreatePicture],
171   [
172     CFLAGS_save="$CFLAGS"
173     CFLAGS="$CFLAGS $evas_engine_[]$1[]_cflags"
174     CPPFLAGS_save="$CPPFLAGS"
175     CPPFLAGS="$CPPFLAGS $evas_engine_[]$1[]_cflags"
176     AC_CHECK_HEADER([GL/glext.h],
177       [have_dep="yes"],
178       [have_dep="no"],
179       [
180 #include <GL/gl.h>
181 #include <GL/glext.h>
182 #include <GL/glx.h>
183     ])
184     CPPFLAGS=$CPPFLAGS_save
185     CFLAGS=$CFLAGS_save
186
187     gl_pt_lib="";
188     have_gl_pt="no"
189
190     AC_MSG_CHECKING([whether pthread_create() is supported])
191     CFLAGS_save="${CFLAGS}"
192     CFLAGS="${CFLAGS} -pthread"
193     LIBS_save="${LIBS}"
194     LIBS="${LIBS} -pthread"
195     AC_LINK_IFELSE(
196       [AC_LANG_PROGRAM([[
197 #include <pthread.h>
198                        ]],
199                        [[
200 pthread_create(NULL, NULL, NULL, NULL);
201                        ]])],
202       [have_gl_pt="yes"],
203       [have_gl_pt="no"])
204     CFLAGS=${CFLAGS_save}
205     LIBS=${LIBS_save}
206     AC_MSG_RESULT([${have_gl_pt}])
207
208     if test "x$have_gl_pt" = "xyes" ; then
209       gl_pt_lib=" -pthread"
210     fi
211
212     if test "x$have_dep" = "xyes" ; then
213       LIBS_save="$LIBS"
214       LIBS="$LIBS $evas_engine_[]$1[]_libs"
215       AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lm $gl_pt_lib])
216       LIBS="$LIBS_save"
217     fi
218   ],[
219     have_dep=no
220   ])
221
222 PKG_CHECK_EXISTS([x11-xcb xcb xcb-glx xcb-render xcb-renderutil],
223   [
224     have_dep="yes"
225     requirement="x11-xcb xcb xcb-glx xcb-render xcb-renderutil"
226   ],
227   [have_dep="no"])
228
229 if test "x${have_dep}" = "xyes" ; then
230   if test "x$3" = "xstatic" ; then
231     requirements_pc_evas="${requirement} ${requirements_pc_evas}"
232     requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
233   else
234     PKG_CHECK_MODULES([XCB_GL], [${requirement}])
235   fi
236 fi
237
238 if test "x${with_opengl}" = "xes" ; then
239   have_dep=no
240 fi
241
242 if test "x${have_dep}" = "xyes" ; then
243   evas_engine_[]$1[]_cflags="$evas_engine_[]$1[]_cflags $XCB_GL_CFLAGS"
244   evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs $XCB_GL_LIBS -lGL $gl_pt_lib"
245   evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGL $gl_pt_lib"
246 else
247   CFLAGS_save="$CFLAGS"
248   CFLAGS="$CFLAGS $evas_engine_[]$1[]_cflags"
249   CPPFLAGS_save="$CPPFLAGS"
250   CPPFLAGS="$CPPFLAGS $evas_engine_[]$1[]_cflags"
251   AC_CHECK_HEADER([GLES2/gl2.h],
252     [have_egl="yes"],
253     [have_egl="no"],
254     [
255 #include <GLES2/gl2.h>
256 #include <GLES2/gl2ext.h>
257 #include <EGL/egl.h>
258     ])
259   CPPFLAGS=$CPPFLAGS_save
260   CFLAGS=$CFLAGS_save
261   if test "x${have_egl}" = "xyes" ; then
262     LIBS_save="$LIBS"
263     LIBS="$LIBS $evas_engine_[]$1[]_libs"
264     AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lm $gl_pt_lib)
265     if test "x${have_glesv2}" = "xyes" ; then
266       evas_engine_[]$1[]_cflags="$evas_engine_[]$1[]_cflags $XCB_GL_CFLAGS"
267       evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs $XCB_GL_LIBS -lGLESv2 -lEGL -lm $gl_pt_lib"
268       evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm $gl_pt_lib"
269       have_dep="yes"
270       AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support])
271       gles_variety_sgx="yes"
272     fi
273   fi
274 fi
275
276 if test "x$3" = "xstatic"  && test "x${have_dep}" = "xyes" ; then
277   requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
278   requirements_pc_evas="${requirement} ${requirements_pc_evas}"
279   requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
280 fi
281
282 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
283
284 ])
285
286
287 dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_GDI(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
288
289 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_GDI],
290 [
291
292 have_dep="no"
293 evas_engine_[]$1[]_cflags=""
294 evas_engine_[]$1[]_libs=""
295
296 AC_CHECK_HEADER([windows.h],
297    [
298     have_dep="yes"
299     evas_engine_[]$1[]_libs="-lgdi32"
300    ])
301
302 if test "x$3" = "xstatic"  && test "x${have_dep}" = "xyes" ; then
303    requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
304 fi
305
306 AC_SUBST([evas_engine_$1_cflags])
307 AC_SUBST([evas_engine_$1_libs])
308
309 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
310
311 ])
312
313 dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_DDRAW(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
314
315 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_DDRAW],
316 [
317
318 have_dep="no"
319 evas_engine_[]$1[]_cflags=""
320 evas_engine_[]$1[]_libs=""
321
322 AC_CHECK_HEADER([ddraw.h],
323    [
324     have_dep="yes"
325     evas_engine_[]$1[]_libs="-lddraw"
326    ])
327
328 if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
329    requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
330 fi
331
332 AC_SUBST([evas_engine_$1_cflags])
333 AC_SUBST([evas_engine_$1_libs])
334
335 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
336
337 ])
338
339 dnl use: EVAS_CHECK_ENGINE_DEP_DIRECT3D(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
340
341 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_DIRECT3D],
342 [
343
344 evas_engine_[]$1[]_cflags=""
345 evas_engine_[]$1[]_libs=""
346
347 AC_CHECK_HEADERS([d3d9.h d3dx9.h],
348    [
349     have_dep="yes"
350     evas_engine_[]$1[]_libs="-ld3d9 -ld3dx9 -lgdi32"
351    ],
352    [have_dep="no"; break])
353
354 if test "x$3" = "xstatic"  && test "x${have_dep}" = "xyes" ; then
355    requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
356 fi
357
358 AC_SUBST([evas_engine_$1_cflags])
359 AC_SUBST([evas_engine_$1_libs])
360
361 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
362
363 ])
364
365
366 dnl use: EVAS_CHECK_ENGINE_DEP_GL_COCOA(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
367
368 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_COCOA],
369 [
370
371 evas_engine_[]$1[]_cflags=""
372 evas_engine_[]$1[]_libs=""
373
374 AC_LANG_PUSH([Objective C])
375
376 LIBS_save="$LIBS"
377 LIBS="$LIBS -framework Cocoa"
378 AC_LINK_IFELSE(
379    [AC_LANG_PROGRAM(
380        [[
381 #include <Cocoa/Cocoa.h>
382        ]],
383        [[
384 NSWindow *window;
385 window = [[NSWindow alloc]
386            initWithContentRect:NSMakeRect(0, 0, 1, 1)
387            styleMask:(NSTitledWindowMask)
388            backing:NSBackingStoreBuffered
389            defer:NO
390            screen:nil
391          ];
392        ]])],
393    [
394     have_dep="yes"
395     evas_engine_[]$1[]_libs="-framework Cocoa -framework OpenGL"
396     evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs"
397    ],
398    [have_dep="no"])
399 LIBS="$LIBS_save"
400
401 AC_LANG_POP([Objective C])
402
403 if test "x$3" = "xstatic"  && test "x${have_dep}" = "xyes" ; then
404    requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
405 fi
406
407 AC_SUBST([evas_engine_$1_cflags])
408 AC_SUBST([evas_engine_$1_libs])
409
410 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
411
412 ])
413
414 dnl use: EVAS_CHECK_ENGINE_DEP_GL_SDL(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
415
416 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_SDL],
417 [
418
419 requirement=""
420 have_dep="no"
421 evas_engine_[]$1[]_cflags=""
422 evas_engine_[]$1[]_libs=""
423
424 PKG_CHECK_EXISTS([sdl2 >= 2.0.0],
425    [
426     have_dep="yes"
427     requirement="sdl2 >= 2.0.0"
428    ],
429    [have_dep="no"])
430
431 if test "x${have_dep}" = "xyes" ; then
432    if test "x$3" = "xstatic" ; then
433       requirements_pc_evas="${requirement} ${requirements_pc_evas}"
434       requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
435    else
436       PKG_CHECK_MODULES([SDL], [${requirement}])
437       evas_engine_[]$1[]_cflags="${SDL_CFLAGS}"
438       evas_engine_[]$1[]_libs="${SDL_LIBS}"
439    fi
440 fi
441
442 gl_pt_lib="";
443 have_gl_pt="no"
444
445 AC_MSG_CHECKING([whether pthread_create() is supported])
446 CFLAGS_save="${CFLAGS}"
447 CFLAGS="${CFLAGS} -pthread"
448 LIBS_save="${LIBS}"
449 LIBS="${LIBS} -pthread"
450 AC_LINK_IFELSE(
451   [AC_LANG_PROGRAM([[
452 #include <pthread.h>
453                    ]],
454                    [[
455 pthread_create(NULL, NULL, NULL, NULL);
456                    ]])],
457    [have_gl_pt="yes"],
458    [have_gl_pt="no"])
459 CFLAGS=${CFLAGS_save}
460 LIBS=${LIBS_save}
461 AC_MSG_RESULT([${have_gl_pt}])
462
463 if test "x$have_gl_pt" = "xyes" ; then
464    gl_pt_lib=" -pthread"
465 fi
466
467 AC_CHECK_HEADER([GL/gl.h],
468    [have_dep="yes"],
469    [have_dep="no"],
470    [
471 #include <GL/gl.h>
472 #include <GL/glext.h>
473    ])
474
475 if test "x${with_opengl}" = "xes" ; then
476   have_dep=no
477 fi
478
479 if test "x${have_dep}" = "xyes" ; then
480    evas_engine_[]$1[]_libs="${evas_engine_[]$1[]_libs} -lGL -lm $gl_pt_lib"
481    evas_engine_gl_common_libs="-lGL -lm $gl_pt_lib"
482 else
483    AC_CHECK_HEADER([SDL2/SDL_opengles.h],
484       [have_egl="yes"],
485       [have_egl="no"],
486       [
487 #include <SDL2/SDL_opengles.h>
488 #include <EGL/egl.h>
489       ])
490    if test "x${have_egl}" = "xyes" ; then
491       AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lm $gl_pt_lib)
492       if test "x${have_glesv2}" = "xyes" ; then
493          evas_engine_[]$1[]_libs="${evas_engine_[]$1[]_libs} -lGLESv2 -lEGL -lm $gl_pt_lib"
494          evas_engine_gl_common_libs="-lGLESv2 -lm $gl_pt_lib"
495          have_dep="yes"
496          AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support])
497          gles_variety_sgx="yes"
498       fi
499    fi
500 fi
501
502 AC_SUBST([evas_engine_$1_cflags])
503 AC_SUBST([evas_engine_$1_libs])
504
505 if test "x$3" = "xstatic" ; then
506    requirement_evas="${requirement} ${requirement_evas}"
507 fi
508
509 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
510
511 ])
512
513
514 dnl use: EVAS_CHECK_ENGINE_DEP_WAYLAND_SHM(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
515
516 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_WAYLAND_SHM],
517 [
518
519 requirement=""
520 have_dep="no"
521 evas_engine_[]$1[]_cflags=""
522 evas_engine_[]$1[]_libs=""
523
524 PKG_CHECK_EXISTS([wayland-client >= REQUIRED_WAYLAND_VERSION],
525    [
526     have_dep="yes"
527     requirement="wayland-client"
528    ],
529    [have_dep="no"])
530
531 if test "x${have_dep}" = "xyes" ; then
532    if test "x$3" = "xstatic" ; then
533       requirements_pc_evas="${requirement} ${requirements_pc_evas}"
534       requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
535    else
536       PKG_CHECK_MODULES([WAYLAND_SHM], [${requirement}])
537       evas_engine_[]$1[]_cflags="${WAYLAND_SHM_CFLAGS}"
538       evas_engine_[]$1[]_libs="${WAYLAND_SHM_LIBS}"
539    fi
540 fi
541
542 AC_SUBST([evas_engine_$1_cflags])
543 AC_SUBST([evas_engine_$1_libs])
544
545 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
546
547 ])
548
549 dnl use: EVAS_CHECK_ENGINE_DEP_WAYLAND_EGL(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
550
551 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_WAYLAND_EGL],
552 [
553
554 requirement=""
555 have_dep="no"
556 evas_engine_[]$1[]_cflags=""
557 evas_engine_[]$1[]_libs=""
558
559 if test "x${with_opengl}" = "xes" ; then
560     gl_library="glesv2"
561 else
562     gl_library="gl"
563 fi
564
565 PKG_CHECK_EXISTS([egl ${gl_library} wayland-client >= REQUIRED_WAYLAND_VERSION wayland-egl],
566    [
567     have_dep="yes"
568     requirement="egl ${gl_library} wayland-client wayland-egl"
569    ],
570    [have_dep="no"])
571
572 if test "x${have_dep}" = "xyes" ; then
573    if test "${gl_library}" != "gl" ; then
574       have_egl="yes"
575    fi
576    if test "x$3" = "xstatic" ; then
577       requirements_pc_evas="${requirement} ${requirements_pc_evas}"
578       requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
579    else
580       PKG_CHECK_MODULES([WAYLAND_EGL], [${requirement}])
581       evas_engine_[]$1[]_cflags="${WAYLAND_EGL_CFLAGS}"
582       evas_engine_[]$1[]_libs="${WAYLAND_EGL_LIBS}"
583       evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm -lEGL"
584    fi
585 fi
586
587 AC_SUBST([evas_engine_$1_cflags])
588 AC_SUBST([evas_engine_$1_libs])
589
590 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
591
592 ])
593
594
595 dnl use: EVAS_CHECK_ENGINE_DEP_DRM(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
596
597 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_DRM],
598 [
599
600 requirement=""
601 have_dep="no"
602 have_hw_dep="no"
603 evas_engine_[]$1[]_cflags=""
604 evas_engine_[]$1[]_libs=""
605
606 PKG_CHECK_EXISTS([libdrm],
607   [
608     have_dep="yes"
609     requirement="libdrm"
610   ], [have_dep="no"])
611
612 if test "x${have_dep}" = "xyes" ; then
613    if test "x$3" = "xstatic" ; then
614       requirements_pc_evas="${requirement} ${requirements_pc_evas}"
615       requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
616    else
617       PKG_CHECK_MODULES([DRM], [${requirement}])
618       evas_engine_[]$1[]_cflags="${DRM_CFLAGS}"
619       evas_engine_[]$1[]_libs="${DRM_LIBS}"
620    fi
621 fi
622
623 AC_SUBST([evas_engine_$1_cflags])
624 AC_SUBST([evas_engine_$1_libs])
625
626 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
627
628 ])
629
630 dnl use: EVAS_CHECK_ENGINE_DEP_GL_DRM(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
631
632 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_DRM],
633 [
634
635 requirement=""
636 have_dep="no"
637 have_hw_dep="no"
638 evas_engine_[]$1[]_cflags=""
639 evas_engine_[]$1[]_libs=""
640
641 if test "x${with_opengl}" = "xes" ; then
642    gl_library="glesv2"
643 else
644    AC_MSG_ERROR([We currently do not support GL DRM without OpenGL ES. Please consider OpenGL ES if you want to use it.])
645 fi
646
647 PKG_CHECK_EXISTS([egl ${gl_library} libdrm gbm wayland-client >= REQUIRED_WAYLAND_VERSION],
648    [
649     have_dep="yes"
650     requirement="egl ${gl_library} libdrm gbm wayland-client >= REQUIRED_WAYLAND_VERSION"
651    ],
652    [have_dep="no"])
653
654 if test "x${have_dep}" = "xyes" ; then
655    if test "x$3" = "xstatic" ; then
656       requirements_pc_evas="${requirement} ${requirements_pc_evas}"
657       requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
658    else
659       PKG_CHECK_MODULES([GL_DRM], [${requirement}])
660       evas_engine_[]$1[]_cflags="${GL_DRM_CFLAGS}"
661       evas_engine_[]$1[]_libs="${GL_DRM_LIBS}"
662       evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm -lEGL"
663    fi
664 fi
665
666 AC_SUBST([evas_engine_$1_cflags])
667 AC_SUBST([evas_engine_$1_libs])
668
669 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
670
671 ])
672
673 dnl use: EVAS_CHECK_ENGINE_DEP_EGLFS(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
674
675 AC_DEFUN([EVAS_CHECK_ENGINE_DEP_EGLFS],
676 [
677
678 requirement=""
679 have_dep="no"
680 have_hw_dep="no"
681 evas_engine_[]$1[]_cflags=""
682 evas_engine_[]$1[]_libs=""
683
684 if test "x${with_opengl}" = "xes" ; then
685    gl_library="glesv2"
686 else
687    AC_MSG_ERROR([We do not support Eglfs without OpenGL ES. Please consider OpenGL ES if you want to use it.])
688 fi
689
690 PKG_CHECK_EXISTS([egl >= 7.10 ${gl_library}],
691    [
692     have_dep="yes"
693     requirement="egl >= 7.10 ${gl_library}"
694    ],
695    [have_dep="no"])
696
697 if test "x${have_dep}" = "xyes" ; then
698    if test "x$3" = "xstatic" ; then
699       requirements_pc_evas="${requirement} ${requirements_pc_evas}"
700       requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
701    else
702       PKG_CHECK_MODULES([EGLFS], [${requirement}])
703       evas_engine_[]$1[]_cflags="${EGLFS_CFLAGS}"
704       evas_engine_[]$1[]_libs="${EGLFS_LIBS}"
705       evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm -lEGL"
706    fi
707 fi
708
709 AC_SUBST([evas_engine_$1_cflags])
710 AC_SUBST([evas_engine_$1_libs])
711
712 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
713
714 ])
715
716
717 dnl use: EVAS_ENGINE(name, want_engine, [DEPENDENCY-CHECK-CODE])
718 dnl
719 dnl defines BUILD_ENGINE_NAME if it should be built
720 dnl defines BUILD_STATIC_BUILD_NAME if should be built statically
721 dnl
722 dnl will call DEPENDENCY-CHECK-CODE if it should be built,
723 dnl if some dependency fail just call AC_MSG_ERROR() to abort.
724
725 AC_DEFUN([EVAS_ENGINE],
726 [dnl
727 m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
728 m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
729
730 want_engine="$2"
731 want_static_engine="no"
732 have_engine="no"
733 have_evas_engine_[]DOWN="no"
734
735 evas_engine_[]m4_defn([DOWN])[]_cflags=""
736 evas_engine_[]m4_defn([DOWN])[]_libs=""
737
738 if test "x${want_engine}" = "xyes" -o "x${want_engine}" = "xstatic"; then
739    $3
740
741    have_engine="yes"
742    if test "x${want_engine}" = "xstatic" ; then
743       have_evas_engine_[]DOWN="static"
744       want_static_engine="yes"
745    else
746       have_evas_engine_[]DOWN="yes"
747    fi
748 fi
749
750 AC_DEFINE_IF(BUILD_ENGINE_[]UP, [test "${have_engine}" = "yes"],
751   [1], [Build $1 Evas engine])
752 AM_CONDITIONAL(BUILD_ENGINE_[]UP, [test "${have_engine}" = "yes"])
753
754 AC_DEFINE_IF(EVAS_STATIC_BUILD_[]UP, [test "${want_static_engine}" = "yes"],
755   [1], [Build $1 Evas engine inside libevas])
756 AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "${want_static_engine}" = "yes"])
757
758 AC_SUBST([evas_engine_]m4_defn([DOWN])[_cflags])
759 AC_SUBST([evas_engine_]m4_defn([DOWN])[_libs])
760
761 EFL_ADD_FEATURE([EVAS_ENGINE], [$1], [${have_evas_engine_]DOWN[}])dnl
762 m4_popdef([UP])dnl
763 m4_popdef([DOWN])dnl
764 ])
765
766
767
768 dnl use: EVAS_CHECK_ENGINE(engine, want_engine, simple, description)
769 AC_DEFUN([EVAS_CHECK_ENGINE],
770 [dnl
771 m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
772 m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
773
774 want_engine="$2"
775 want_static_engine="no"
776 have_engine="no"
777 have_evas_engine_[]DOWN="no"
778
779 AC_MSG_CHECKING([whether to enable $4 rendering backend])
780 AC_MSG_RESULT([${want_engine}])
781
782 if test "x${want_engine}" = "xyes" -o "x${want_engine}" = "xstatic"; then
783    m4_default([EVAS_CHECK_ENGINE_DEP_]m4_defn([UP]))(DOWN, $3, ${want_engine}, [have_engine="yes"], [have_engine="no"])
784 fi
785
786 if test "x${have_engine}" = "xno" -a "x${want_engine}" = "xyes"; then
787    AC_MSG_ERROR([$4 dependencies not found])
788 fi
789
790 AC_MSG_CHECKING([whether $4 rendering backend will be built])
791 AC_MSG_RESULT([${have_engine}])
792
793 if test "x${have_engine}" = "xyes" ; then
794    if test "x${want_engine}" = "xstatic" ; then
795       have_evas_engine_[]DOWN="static"
796       want_static_engine="yes"
797    else
798       have_evas_engine_[]DOWN="yes"
799    fi
800 fi
801
802 if test "x${have_engine}" = "xyes" ; then
803    AC_DEFINE(BUILD_ENGINE_[]UP, [1], [$4 rendering backend])
804 fi
805
806 AM_CONDITIONAL(BUILD_ENGINE_[]UP, [test "x${have_engine}" = "xyes"])
807
808 if test "x${want_static_engine}" = "xyes" ; then
809    AC_DEFINE(EVAS_STATIC_BUILD_[]UP, [1], [Build $1 engine inside libevas])
810    have_static_module="yes"
811 fi
812
813 EFL_ADD_FEATURE([EVAS_ENGINE], [$1], [${have_evas_engine_]DOWN[}])
814 AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "x${want_static_engine}" = "xyes"])dnl
815 m4_popdef([UP])dnl
816 m4_popdef([DOWN])dnl
817 ])