Implement a workaround for wayland_egl, allowing to raise
[platform/upstream/ecore.git] / m4 / ecore_check_module.m4
1 dnl use: ECORE_CHECK_MODULE(Foo, default-enabled, description[, dependency[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
2 AC_DEFUN([ECORE_CHECK_MODULE],
3 [
4 m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
5 m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl
6
7 have_ecore_[]m4_defn([DOWN])=no
8 ecore_[]m4_defn([DOWN])[]_cflags=
9 ecore_[]m4_defn([DOWN])[]_libs=
10 want_module=$2
11
12 AC_ARG_ENABLE(ecore-$1,
13    [AC_HELP_STRING(
14        [--enable-ecore-$1],
15        [enable the ecore_]m4_defn([DOWN])[ module])],
16    [
17     if test "x${enableval}" = "xyes" ; then
18        want_module="yes"
19     else
20        want_module="no"
21     fi
22    ],
23    [])
24
25 AC_MSG_CHECKING([whether Ecore_$3 module is to be built])
26
27 if test "x${want_module}" = "xyes" ; then
28    if test "x$4" = "x" || test "x$4" = "xyes" ; then
29       AC_DEFINE([BUILD_ECORE_]m4_defn([UP]), [1], [Build Ecore_$3 Module])
30       have_ecore_[]m4_defn([DOWN])="yes"
31       ecore_[]m4_defn([DOWN])[]_libs="-lecore_[]m4_defn([DOWN])"
32       AC_MSG_RESULT([yes])
33    else
34       AC_MSG_RESULT([no (dependency failed)])
35    fi
36 else
37    AC_MSG_RESULT([no])
38 fi
39
40 AM_CONDITIONAL([BUILD_ECORE_]UP, [test "x$have_ecore_]DOWN[" = "xyes"])
41
42 AS_IF([test "x$have_ecore_[]m4_defn([DOWN])" = "xyes"], [$5], [$6])
43
44 AC_SUBST(ecore_[]m4_defn([DOWN])[]_cflags)
45 AC_SUBST(ecore_[]m4_defn([DOWN])[]_libs)
46
47 m4_popdef([UP])
48 m4_popdef([DOWN])
49 ])
50
51 dnl use: ECORE_EVAS_CHECK_MODULE_FULL(foo-bar, evas-module, want, description, backend[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
52 AC_DEFUN([ECORE_EVAS_CHECK_MODULE_FULL],
53 [
54 m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
55 m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl
56
57 have_ecore_evas_[]m4_defn([DOWN])="no"
58 want_module="$3"
59
60 AC_ARG_ENABLE(ecore-evas-$1,
61    [AC_HELP_STRING(
62        [--enable-ecore-evas-$1],
63        [enable $4 support in the ecore_evas module.])],
64    [
65     if test "x${enableval}" = "xyes" ; then
66        want_module="yes"
67     else
68        want_module="no"
69     fi
70    ],
71    [])
72
73 AC_MSG_CHECKING([whether ecore_evas $4 support is to be built])
74 AC_MSG_RESULT([${want_module}])
75
76 if test "x$5" = "xyes" && \
77    test "x$have_ecore_evas" = "xyes" && \
78    test "x$want_module" = "xyes" ; then
79    PKG_CHECK_EXISTS([evas-$2],
80       [
81        AC_DEFINE([BUILD_ECORE_EVAS_]m4_defn([UP]), [1], [Support for $4 Engine in Ecore_Evas])
82        have_ecore_evas_[]m4_defn([DOWN])="yes"
83       ])
84 fi
85
86 AC_MSG_CHECKING([whether ecore_evas $4 support is built])
87 AC_MSG_RESULT([$have_ecore_evas_]m4_defn([DOWN]))
88
89 AS_IF([test "x$have_ecore_evas_[]m4_defn([DOWN])" = "xyes"], [$6], [$7])
90
91 m4_popdef([UP])
92 m4_popdef([DOWN])
93 ])
94
95 dnl use: ECORE_EVAS_CHECK_MODULE(foo-bar, want, description, backend[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
96 AC_DEFUN([ECORE_EVAS_CHECK_MODULE],
97 [ECORE_EVAS_CHECK_MODULE_FULL([$1], [$1], [$2], [$3], [$4], [$5], [$6])])