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