require gnutls 2.10.2 since earlier versions don't work
[framework/uifw/ecore.git] / m4 / ecore_check_options.m4
1 dnl use: ECORE_CHECK_POLL(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
2 AC_DEFUN([ECORE_CHECK_POLL],
3 [
4 _ecore_want_poll=$1
5 _ecore_have_poll="no"
6
7 AC_ARG_ENABLE(poll,
8    [AC_HELP_STRING([--disable-poll], [disable poll in the ecore_file module])],
9    [
10     if test "x${enableval}" = "xyes" ; then
11        _ecore_want_poll="yes"
12     else
13        _ecore_want_poll="no"
14     fi
15    ])
16
17 AC_MSG_CHECKING(whether polling is to be used for filemonitoring)
18 AC_MSG_RESULT(${_ecore_want_poll})
19
20 if test "x${_ecore_want_poll}" = "xyes" ; then
21    AC_DEFINE([HAVE_POLL], [1], [ File monitoring with polling ])
22    _ecore_have_poll="yes"
23 fi
24
25 if test "x${_ecore_have_poll}" = "xyes" ; then
26    m4_default([$2], [:])
27 else
28    m4_default([$3], [:])
29 fi
30 ])
31
32 dnl use: ECORE_CHECK_INOTIFY(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
33 AC_DEFUN([ECORE_CHECK_INOTIFY],
34 [
35 _ecore_want_inotify=$1
36 _ecore_have_inotify="no"
37
38 dnl We need to check if the right inotify version is accessible
39 _ecore_want_inotify="yes"
40 AC_ARG_ENABLE(inotify,
41    [AC_HELP_STRING([--disable-inotify], [disable inotify in the ecore_file module])],
42    [
43     if test "x${enableval}" = "xyes" ; then
44        _ecore_want_inotify="yes"
45     else
46        _ecore_want_inotify="no"
47     fi
48    ])
49
50 AC_MSG_CHECKING(whether inotify is to be used for filemonitoring)
51 AC_MSG_RESULT($_ecore_want_inotify)
52
53 dnl It is hard to find a good test on how to check the correct
54 dnl inotify version. They changed the headers a lot.
55 dnl in kernel 2.6.13 __NR_inotify_init was added to the defined syscalls
56 dnl in asm/unistd.h and IN_MOVE_SELF was added to linux/inotify.h
57 dnl so with this check you need a very new kernel and kernel-headers!
58
59 if test "x${_ecore_want_inotify}" = "xyes" ; then
60    AC_CHECK_LIB([c], [inotify_init],
61       [
62        AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ])
63        AC_DEFINE(HAVE_SYS_INOTIFY, 1, [ File monitoring with Inotify - sys/inotify.h ])
64        _ecore_have_inotify="yes"
65       ],
66       [
67        AC_TRY_COMPILE(
68           [
69            #include <asm/unistd.h>
70            #include <linux/inotify.h>
71           ],
72           [int a = __NR_inotify_init; int b = IN_MOVE_SELF;],
73           [
74            AC_DEFINE([HAVE_INOTIFY], [1], [ File monitoring with Inotify ])
75            _ecore_have_inotify="yes"
76           ],
77           [_ecore_have_inotify="no"])
78       ])
79 fi
80
81 if test "x$_ecore_have_inotify" = "xyes" ; then
82    m4_default([$2], [:])
83 else
84    m4_default([$3], [:])
85 fi
86 ])
87  
88 dnl use: ECORE_CHECK_NOTIFY_WIN32(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
89 AC_DEFUN([ECORE_CHECK_NOTIFY_WIN32],
90 [
91 _ecore_want_notify_win32=$1
92 _ecore_have_notify_win32="no"
93
94 AC_ARG_ENABLE(notify-win32,
95    [AC_HELP_STRING([--disable-notify-win32], [disable Windows notification in the ecore_file module])],
96    [
97     if test "x${enableval}" = "xyes" ; then
98        _ecore_want_notify_win32="yes"
99     else
100        _ecore_want_notify_win32="no"
101     fi
102    ])
103
104 AC_MSG_CHECKING(whether Windows notification is to be used for filemonitoring)
105 AC_MSG_RESULT(${_ecore_want_notify_win32})
106
107 if test "x${_ecore_want_notify_win32}" = "xyes" ; then
108    AC_DEFINE([HAVE_NOTIFY_WIN32], [1], [ File monitoring with Windows notification ])
109    _ecore_have_notify_win32="yes"
110 fi
111
112 if test "x${_ecore_have_notify_win32}" = "xyes" ; then
113    m4_default([$2], [:])
114 else
115    m4_default([$3], [:])
116 fi
117 ])
118
119 dnl use: ECORE_CHECK_CURL(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
120 AC_DEFUN([ECORE_CHECK_CURL],
121 [
122 _ecore_want_curl=$1
123 _ecore_have_curl="no"
124
125 AC_ARG_ENABLE([curl],
126    [AC_HELP_STRING([--disable-curl], [disable curl support])],
127    [
128     if test "x${enableval}" = "xyes" ; then
129        _ecore_want_curl="yes"
130     else
131        _ecore_want_curl="no"
132     fi
133    ])
134
135 if test "x${_ecore_want_curl}" = "xyes" ; then
136    PKG_CHECK_MODULES(CURL, libcurl,
137       [
138        AC_DEFINE(HAVE_CURL, 1, [ Downloading with CURL ])
139        _ecore_have_curl="yes"
140       ],
141       [_ecore_have_curl="no"])
142 fi
143
144 if test "x$_ecore_have_curl" = "xyes" ; then
145    m4_default([$2], [:])
146 else
147    m4_default([$3], [:])
148 fi
149 ])
150
151 dnl use: ECORE_CHECK_GNUTLS(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
152 AC_DEFUN([ECORE_CHECK_GNUTLS],
153 [
154 _ecore_want_gnutls=$1
155 _ecore_have_gnutls="no"
156
157 AC_ARG_ENABLE([gnutls],
158    [AC_HELP_STRING([--disable-gnutls], [disable gnutls support])],
159    [
160     if test "x${enableval}" = "xyes" ; then
161        _ecore_want_gnutls="yes"
162     else
163        _ecore_want_gnutls="no"
164     fi
165    ])
166
167 if test "x${_ecore_want_gnutls}" = "xyes" -o "x${_ecore_want_gnutls}" = "xauto" ; then
168    PKG_CHECK_MODULES([TLS], [gnutls >= 2.10.2],
169       [
170        AC_DEFINE([USE_GNUTLS], [1], [Use GnuTLS])
171        _ecore_have_gnutls="yes"
172       ],
173       [_ecore_have_gnutls="no"])
174    # for ecore_con_ssl.c
175    PKG_CHECK_MODULES([TLS2], [gnutls >= 2.10.2],
176       [AC_DEFINE(USE_GNUTLS2, 1, [Use GnuTLS 2 or higher])],
177       [dummy="no"])
178    PKG_CHECK_MODULES([TLSTICKET], [gnutls >= 2.10.2],
179       [AC_DEFINE(USE_GNUTLS2_10, 1, [Use GnuTLS 2.10])],
180       [dummy="no"])
181    PKG_CHECK_MODULES([TLSSTRERROR], [gnutls >= 2.10.2],
182       [AC_DEFINE(USE_GNUTLS2_6, 1, [Use GnuTLS 2.6])],
183       [dummy="no"])
184    if test "x$_ecore_have_gnutls" = "xyes";then
185      AC_PATH_GENERIC([libgcrypt], [], [_ecore_have_gnutls="yes"], [_ecore_have_gnutls="no"])
186         if test "x${_ecore_have_gnutls}" = "xyes" ; then
187            TLS_CFLAGS+=" ${LIBGCRYPT_CFLAGS}"
188            TLS_LIBS+=" ${LIBGCRYPT_LIBS}"
189         fi
190    fi
191
192 fi
193
194 if test "x$_ecore_have_gnutls" = "xyes" ; then
195   ifelse([$2], , :, [$2])
196 else
197   ifelse([$3], , :, [$3])
198 fi
199 ])
200
201 dnl use: ECORE_CHECK_OPENSSL(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
202 AC_DEFUN([ECORE_CHECK_OPENSSL],
203 [
204 _ecore_want_openssl=$1
205 _ecore_have_openssl="no"
206
207 AC_ARG_ENABLE(openssl,
208   [AC_HELP_STRING([--disable-openssl], [disable openssl support])],
209   [
210     if test "x${enableval}" = "xyes" ; then
211        _ecore_want_openssl="yes"
212     else
213        _ecore_want_openssl="no"
214     fi
215   ])
216
217 if test "x${_ecore_have_gnutls}" = "xyes";then
218   _ecore_want_openssl=no
219 fi
220
221 if test "x${_ecore_want_openssl}" = "xyes" -o "x${_ecore_want_openssl}" = "xauto"; then
222    PKG_CHECK_MODULES([SSL],
223       [openssl],
224       [
225        AC_DEFINE(USE_OPENSSL, 1, [Use OpenSSL])
226        _ecore_have_openssl="yes"
227       ],
228       [_ecore_have_openssl="no"])
229 fi
230
231 if test "x$_ecore_have_openssl" = "xyes" ; then
232    m4_default([$2], [:])
233 else
234    m4_default([$3], [:])
235 fi
236 ])
237
238 dnl use: ECORE_CHECK_TSLIB(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
239 AC_DEFUN([ECORE_CHECK_TSLIB],
240 [
241 _tslib_requirement=""
242 _ecore_want_tslib=$1
243 _ecore_have_tslib="no"
244 TSLIB_LIBS=""
245 TSLIB_CFLAGS=""
246
247 AC_ARG_ENABLE([tslib],
248    [AC_HELP_STRING([--disable-tslib],
249        [disable the tslib support in ecore (currently ecore-fb).
250         @<:@default=detect@:>@])],
251    [
252     if test "x${enableval}" = "xyes" ; then
253        _ecore_want_tslib="yes"
254     else
255        _ecore_want_tslib="no"
256     fi
257    ])
258
259 if test "x${_ecore_want_tslib}" = "xyes" -o "x${_ecore_want_tslib}" = "xauto" ; then
260    PKG_CHECK_MODULES([TSLIB], [tslib-1.0],
261      [
262       AC_DEFINE(HAVE_TSLIB, 1, [Build Ecore_FB Touchscreen Code])
263       _ecore_have_tslib="yes"
264       _tslib_requirement="tslib-1.0"
265      ],[
266       PKG_CHECK_MODULES([TSLIB], [tslib],
267         [
268          AC_DEFINE(HAVE_TSLIB, 1, [Build Ecore_FB Touchscreen Code])
269          _ecore_have_tslib="yes"
270          _tslib_requirement="tslib"
271         ],[
272          AC_CHECK_HEADER([tslib.h],
273            [
274             AC_CHECK_LIB([ts], [ts_open], 
275               [
276                TSLIB_LIBS="-lts" 
277                TSLIB_CFLAGS=""
278                AC_DEFINE(HAVE_TSLIB, 1, [Build Ecore_FB Touchscreen Code])
279                _ecore_have_tslib="yes"
280               ],[
281                AC_CHECK_LIB([tslib], [ts_open],
282                  [
283                   TSLIB_LIBS="-ltslib"
284                   TSLIB_CFLAGS=""
285                   AC_DEFINE(HAVE_TSLIB, 1, [Build Ecore_FB Touchscreen Code])
286                   _ecore_have_tslib="yes"
287                  ],[
288                   _ecore_have_tslib="no"
289                  ])
290               ])
291            ])
292         ])
293      ])
294 fi
295
296 AC_SUBST(TSLIB_LIBS)
297 AC_SUBST(TSLIB_CFLAGS)
298
299 if test "x$_ecore_have_tslib" = "xyes" ; then
300    m4_default([$2], [:])
301 else
302    m4_default([$3], [:])
303 fi
304 ])
305
306 dnl use: ECORE_CHECK_CARES(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
307 AC_DEFUN([ECORE_CHECK_CARES],
308 [
309 _ecore_want_cares=$1
310 _ecore_have_cares="no"
311
312 AC_ARG_ENABLE(cares,
313   [AC_HELP_STRING([--disable-cares], [disable cares support])],
314   [
315     if test "x${enableval}" = "xyes" ; then
316        _ecore_want_cares="yes"
317     else
318        _ecore_want_cares="no"
319     fi
320   ])
321
322 if test "x${_ecore_want_cares}" = "xyes" -o "x${_ecore_want_cares}" = "xauto" ; then
323    PKG_CHECK_MODULES([CARES], [libcares >= 1.6.1],
324      [_ecore_have_cares="yes"],
325      [_ecore_have_cares="no"])
326 fi
327
328 if test "x${_ecore_have_cares}" = "xyes" ; then
329    AC_DEFINE([HAVE_CARES], [1], [Build Ecore_Con_Info with c-ares support])
330 fi
331
332 if test "x$_ecore_have_cares" = "xyes" ; then
333    m4_default([$2], [:])
334 else
335    m4_default([$3], [:])
336 fi
337 ])