Enable the pending show for the rotation process.
[platform/core/uifw/e17.git] / m4 / ac-plugins.m4
1 dnl _XTERM_COLORS
2 define([_XTERM_COLORS],
3 [
4         # Check for XTerm and define some colors
5         if test "x$TERM" = "xxterm" -o "x$TERM" = "xscreen"; then
6                 COLOR_PREF="\0033\0133"
7                 COLOR_H="${COLOR_PREF}1m"
8                 COLOR_HGREEN="${COLOR_PREF}1;32m"
9                 COLOR_HRED="${COLOR_PREF}1;31m"
10                 COLOR_GREEN="${COLOR_PREF}32m"
11                 COLOR_RED="${COLOR_PREF}31m"
12                 COLOR_YELLOW="${COLOR_PREF}1;33m"
13                 COLOR_END="${COLOR_PREF}0m"
14         else
15                 COLOR_H=""
16                 COLOR_HGREEN=""
17                 COLOR_HRED=""
18                 COLOR_GREEN=""
19                 COLOR_RED=""
20                 COLOR_YELLOW=""
21                 COLOR_END=""
22         fi
23 ])
24
25 dnl AC_E_CHECK_PKG(name, lib [>= version], [action-if, [action-not]])
26 dnl   improved version of PKG_CHECK_MODULES, it does the same checking
27 dnl   and defines HAVE_[name]=yes/no and also exports
28 dnl   [name]_CFLAGS and [name]_LIBS.
29 dnl
30 dnl   if action-not isn't provided, AC_MSG_ERROR will be used.
31 dnl
32 dnl   Checks:
33 dnl       lib >= version
34 dnl
35 dnl   Provides:
36 dnl       - HAVE_[name]=yes|no
37 dnl       - [name]_CFLAGS: if HAVE_[name]=yes
38 dnl       - [name]_LIBS: if HAVE_[name]=yes
39 dnl       - [name]_VERSION: if HAVE_[name]=yes
40 dnl
41 AC_DEFUN([AC_E_CHECK_PKG],
42 [
43 # ----------------------------------------------------------------------
44 # BEGIN: Check library with pkg-config: $1 (pkg-config=$2)
45 #
46
47         PKG_CHECK_MODULES([$1], [$2],
48                           [
49                                 HAVE_[$1]=yes
50                                 [pkg_name]=$(echo "[$2]" | cut -d\   -f1)
51                                 [$1]_VERSION=$($PKG_CONFIG --modversion $pkg_name)
52                                 AC_SUBST([$1]_VERSION)
53                                 ifelse([$3], , :, [$3])
54                           ],
55                           [
56                                 HAVE_[$1]=no
57                                 ifelse([$4], , AC_MSG_ERROR(you need [$2] development installed!), AC_MSG_RESULT(no); [$4])
58                           ])
59         AM_CONDITIONAL(HAVE_[$1], test x$HAVE_[$1] = xyes)
60         AC_SUBST(HAVE_[$1])
61         if test x$HAVE_[$1] = xyes; then
62                 AC_DEFINE_UNQUOTED(HAVE_[$1], 1, Package [$1] ($2) found.)
63         fi
64
65 #
66 # END: Check library with pkg-config: $1 (pkg-config=$2)
67 # ----------------------------------------------------------------------
68 ])
69
70 dnl AC_E_OPTIONAL_MODULE(name, [initial-status, [check-if-enabled]])
71 dnl   Defines configure argument --<enable|disable>-[name] to enable an
72 dnl   optional module called 'name'.
73 dnl
74 dnl   If initial-status is true, then it's enabled by default and option
75 dnl   will be called --disable-[name], otherwise it's disabled and option
76 dnl   is --enable-[name].
77 dnl
78 dnl   If module is enabled, then check-if-enabled will be executed. This
79 dnl   may change the contents of shell variable NAME (uppercase version of
80 dnl   name, with underscores instead of dashed) to something different than
81 dnl   "true" to disable module.
82 dnl
83 dnl Parameters:
84 dnl     - name: module name to use. It will be converted to have dashes (-)
85 dnl          instead of underscores, and will be in lowercase.
86 dnl     - initial-status: true or false, states if module is enabled or
87 dnl          disabled by default.
88 dnl     - check-if-enabled: macro to be expanded inside check for enabled
89 dnl           module.
90 dnl
91 dnl Provides:
92 dnl     - USE_MODULE_[name]=true|false [make, shell]
93 dnl     - USE_MODULE_[name]=1 if enabled [config.h]
94 dnl
95 AC_DEFUN([AC_E_OPTIONAL_MODULE],
96 [
97 # ----------------------------------------------------------------------
98 # BEGIN: Check for optional module: $1 (default: $2)
99 #
100         m4_pushdef([MODNAME], [m4_bpatsubst(m4_toupper([$1]), -, _)])dnl
101         m4_pushdef([modname_opt], [m4_bpatsubst(m4_tolower([$1]), _, -)])
102         m4_pushdef([INITVAL], [m4_default([$2], [false])])dnl
103         m4_pushdef([ENABLE_HELP], AS_HELP_STRING([--enable-modname_opt],
104                                [optional module modname_opt @<:@default=disabled@:>@]))dnl
105         m4_pushdef([DISABLE_HELP], AS_HELP_STRING([--disable-modname_opt],
106                                [optional module modname_opt @<:@default=enabled@:>@]))dnl
107         m4_pushdef([HELP_STR], m4_if(INITVAL, [true], [DISABLE_HELP], [ENABLE_HELP]))dnl
108         m4_pushdef([NOT_INITVAL], m4_if(INITVAL, [true], [false], [true]))dnl
109
110         USING_MODULES=1
111
112         MODNAME=INITVAL
113         AC_ARG_ENABLE(modname_opt, HELP_STR, [MODNAME=${enableval:-NOT_INITVAL}])
114         if test x[$]MODNAME = xyes || test x[$]MODNAME = x1; then
115                 MODNAME=true
116         fi
117         if test x[$]MODNAME = xno || test x[$]MODNAME = x0; then
118                 MODNAME=false
119         fi
120
121         USE_MODULE_[]MODNAME=[$]MODNAME
122
123         _XTERM_COLORS
124
125         # Check list for optional module $1
126         if test x[$]MODNAME = xtrue; then
127                 ifelse([$3], , , [
128 echo
129 echo "checking optional module modname_opt:"
130 # BEGIN: User checks
131 $3
132 # END: User checks
133 if test x[$]MODNAME = xfalse; then
134         echo -e "optional module modname_opt ${COLOR_HRED}failed${COLOR_END} checks."
135 else
136         echo -e "optional module modname_opt passed checks."
137 fi
138 echo
139 ])
140
141                 if test x[$]MODNAME = xfalse; then
142                         echo -e "${COLOR_YELLOW}Warning:${COLOR_END} optional module ${COLOR_H}modname_opt${COLOR_END} disabled by extra checks."
143                 fi
144         fi
145
146         # Check if user checks succeeded
147         if test x[$]MODNAME = xtrue; then
148                 [OPTIONAL_MODULES]="$[OPTIONAL_MODULES] modname_opt"
149                 AC_DEFINE_UNQUOTED(USE_MODULE_[]MODNAME, 1, Use module modname_opt)
150         else
151                 [UNUSED_OPTIONAL_MODULES]="$[UNUSED_OPTIONAL_MODULES] modname_opt"
152         fi
153
154         AM_CONDITIONAL(USE_MODULE_[]MODNAME, test x[$]MODNAME = xtrue)
155         AC_SUBST(USE_MODULE_[]MODNAME)
156
157         m4_popdef([HELP_STR])dnl
158         m4_popdef([DISABLE_HELP])dnl
159         m4_popdef([ENABLE_HELP])dnl
160         m4_popdef([INITVAL])dnl
161         m4_popdef([MODNAME])
162 #
163 # END: Check for optional module: $1 ($2)
164 # ----------------------------------------------------------------------
165 ])