* update configure.ac so that default options are chosen according to the host
[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_CURL(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
89 AC_DEFUN([ECORE_CHECK_CURL],
90 [
91 _ecore_want_curl=$1
92 _ecore_have_curl="no"
93
94 AC_ARG_ENABLE([curl],
95    [AC_HELP_STRING([--disable-curl], [disable curl support])],
96    [
97     if test "x${enableval}" = "xyes" ; then
98        _ecore_want_curl="yes"
99     else
100        _ecore_want_curl="no"
101     fi
102    ])
103
104 if test "x${_ecore_want_curl}" = "xyes" ; then
105    PKG_CHECK_MODULES(CURL, libcurl,
106       [
107        AC_DEFINE(HAVE_CURL, 1, [ Downloading with CURL ])
108        _ecore_have_curl="yes"
109       ],
110       [_ecore_have_curl="no"])
111 fi
112
113 if test "x$_ecore_have_curl" = "xyes" ; then
114    m4_default([$2], [:])
115 else
116    m4_default([$3], [:])
117 fi
118 ])
119
120 dnl use: ECORE_CHECK_GNUTLS(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
121 AC_DEFUN([ECORE_CHECK_GNUTLS],
122 [
123 _ecore_want_gnutls=$1
124 _ecore_have_gnutls="no"
125
126 AC_ARG_ENABLE([gnutls],
127    [AC_HELP_STRING([--disable-gnutls], [disable gnutls support])],
128    [
129     if test "x${enableval}" = "xyes" ; then
130        _ecore_want_gnutls="yes"
131     else
132        _ecore_want_gnutls="no"
133     fi
134    ])
135
136 if test "x${_ecore_want_gnutls}" = "xyes" -o "x${_ecore_want_gnutls}" = "xauto" ; then
137    PKG_CHECK_MODULES([TLS], [gnutls],
138       [
139        AC_DEFINE([USE_GNUTLS], [1], [Use GnuTLS])
140        _ecore_have_gnutls="yes"
141       ],
142       [_ecore_have_gnutls="no"])
143    # for ecore_con_ssl.c
144    PKG_CHECK_MODULES([TLS2], [gnutls >= 2.0.0],
145       [AC_DEFINE(USE_GNUTLS2, 1, [Use GnuTLS 2 or higher])],
146       [dummy="no"])
147 fi
148
149 if test "x$_ecore_have_gnutls" = "xyes" ; then
150   ifelse([$2], , :, [$2])
151 else
152   ifelse([$3], , :, [$3])
153 fi
154 ])
155
156 dnl use: ECORE_CHECK_OPENSSL(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
157 AC_DEFUN([ECORE_CHECK_OPENSSL],
158 [
159 _ecore_want_openssl=$1
160 _ecore_have_openssl="no"
161
162 AC_ARG_ENABLE(openssl,
163   [AC_HELP_STRING([--disable-openssl], [disable openssl support])],
164   [
165     if test "x${enableval}" = "xyes" ; then
166        _ecore_want_openssl="yes"
167     else
168        _ecore_want_openssl="no"
169     fi
170   ])
171
172 if test "x${_ecore_want_openssl}" = "xyes" -o "x${_ecore_want_openssl}" = "xauto"; then
173    PKG_CHECK_MODULES([SSL],
174       [openssl],
175       [
176        AC_DEFINE(USE_OPENSSL, 1, [Use OpenSSL])
177        _ecore_have_openssl="yes"
178       ],
179       [_ecore_have_openssl="no"])
180 fi
181
182 if test "x$_ecore_have_openssl" = "xyes" ; then
183    m4_default([$2], [:])
184 else
185    m4_default([$3], [:])
186 fi
187 ])
188
189 dnl use: ECORE_CHECK_TSLIB(default-enabled[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
190 AC_DEFUN([ECORE_CHECK_TSLIB],
191 [
192 _ecore_want_tslib=$1
193 _ecore_have_tslib="no"
194 tslib_libs=""
195
196 if test "x${_ecore_want_tslib}" = "xyes" -o "x${_ecore_want_tslib}" = "xauto" ; then
197    AC_CHECK_HEADER([tslib.h],
198       [
199        AC_CHECK_LIB([ts], [ts_open], [tslib_libs="-lts", tslib_libs="-ltslib"])
200        AC_DEFINE(HAVE_TSLIB, 1, [Build Ecore_FB Touchscreen Code])
201        _ecore_have_ts="yes"
202       ])
203 fi
204
205 AC_SUBST(tslib_libs)
206
207 if test "x$_ecore_have_tslib" = "xyes" ; then
208    m4_default([$2], [:])
209 else
210    m4_default([$3], [:])
211 fi
212 ])