summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-09-16 10:57:48 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-09-16 10:57:48 +0000
commit785f2a6b3a70454ecfe94addc6480ebf20c44c13 (patch)
tree17a195d2c1f022cd480fd0e0b95be5035ad915e2 /m4
parentdfc0331373c3f98df7cb996abc588c7dcf44af0a (diff)
merge : add eina
currently, examples, tests and benchmark are not set. That's the next things i'll do SVN revision: 76710
Diffstat (limited to 'm4')
-rw-r--r--m4/efl_check_funcs.m4436
-rw-r--r--m4/efl_compiler.m449
-rw-r--r--m4/efl_libraries.m4190
-rw-r--r--m4/efl_path_max.m436
-rw-r--r--m4/efl_tests.m449
-rw-r--r--m4/efl_threads.m4149
-rw-r--r--m4/eina_check.m450
7 files changed, 769 insertions, 190 deletions
diff --git a/m4/efl_check_funcs.m4 b/m4/efl_check_funcs.m4
new file mode 100644
index 0000000000..d72fb34344
--- /dev/null
+++ b/m4/efl_check_funcs.m4
@@ -0,0 +1,436 @@
1dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com>
2dnl This code is public domain and can be freely used or copied.
3
4dnl Macros that check functions availability for the EFL:
5
6dnl dirfd
7dnl dladdr
8dnl dlopen
9dnl fnmatch
10dnl iconv
11dnl setxattr (an al.)
12dnl shm_open
13
14
15dnl _EFL_CHECK_FUNC_DIRFD is for internal use
16dnl _EFL_CHECK_FUNC_DIRFD(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
17
18AC_DEFUN([_EFL_CHECK_FUNC_DIRFD],
19[
20AC_LINK_IFELSE(
21 [
22 AC_LANG_PROGRAM(
23 [[
24#ifdef HAVE_DIRENT_H
25# include <dirent.h>
26#endif
27 ]],
28 [[
29int main(void)
30{
31 DIR *dirp;
32 return dirfd(dirp);
33}
34 ]])
35 ],
36 [_efl_have_fct="yes"],
37 [_efl_have_fct="no"])
38
39AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
40])
41
42dnl _EFL_CHECK_FUNC_DLADDR_PRIV is for internal use
43dnl _EFL_CHECK_FUNC_DLADDR_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
44
45AC_DEFUN([_EFL_CHECK_FUNC_DLADDR_PRIV],
46[
47m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
48m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
49
50LIBS_save="${LIBS}"
51LIBS="${LIBS} $2"
52AC_LINK_IFELSE(
53 [AC_LANG_PROGRAM(
54 [[
55#define _GNU_SOURCE
56#include <dlfcn.h>
57 ]],
58 [[
59int res = dladdr(0, 0);
60 ]])],
61 [
62 m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
63 requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
64 _efl_have_fct="yes"
65 ],
66 [_efl_have_fct="no"])
67
68LIBS="${LIBS_save}"
69
70AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
71
72m4_popdef([DOWNEFL])
73m4_popdef([UPEFL])
74])
75
76dnl _EFL_CHECK_FUNC_DLADDR is for internal use
77dnl _EFL_CHECK_FUNC_DLADDR(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
78
79AC_DEFUN([_EFL_CHECK_FUNC_DLADDR],
80[
81m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
82m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
83
84case "$host_os" in
85 mingw*)
86 _efl_have_fct="yes"
87 requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ldl"
88 m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} -ldl"
89 ;;
90 *)
91 _efl_have_fct="no"
92
93dnl Check is dladdr is in libc
94 _EFL_CHECK_FUNC_DLADDR_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
95
96dnl Check is dlopen is in libdl
97 if test "x${_efl_have_fct}" = "xno" ; then
98 _EFL_CHECK_FUNC_DLADDR_PRIV([$1], [-ldl], [_efl_have_fct="yes"], [_efl_have_fct="no"])
99 fi
100 ;;
101esac
102
103AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
104
105m4_popdef([DOWNEFL])
106m4_popdef([UPEFL])
107])
108
109dnl _EFL_CHECK_FUNC_DLOPEN_PRIV is for internal use
110dnl _EFL_CHECK_FUNC_DLOPEN_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
111
112AC_DEFUN([_EFL_CHECK_FUNC_DLOPEN_PRIV],
113[
114m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
115m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
116
117LIBS_save="${LIBS}"
118LIBS="${LIBS} $2"
119AC_LINK_IFELSE(
120 [AC_LANG_PROGRAM(
121 [[
122#include <dlfcn.h>
123 ]],
124 [[
125void *h = dlopen(0, 0);
126 ]])],
127 [
128 m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
129 requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
130 _efl_have_fct="yes"
131 ],
132 [_efl_have_fct="no"])
133
134LIBS="${LIBS_save}"
135
136AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
137
138m4_popdef([DOWNEFL])
139m4_popdef([UPEFL])
140])
141
142dnl _EFL_CHECK_FUNC_DLOPEN is for internal use
143dnl _EFL_CHECK_FUNC_DLOPEN(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
144
145AC_DEFUN([_EFL_CHECK_FUNC_DLOPEN],
146[
147m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
148m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
149
150case "$host_os" in
151 mingw*)
152 _efl_have_fct="yes"
153 requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ldl"
154 m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} -ldl"
155 ;;
156 *)
157 _efl_have_fct="no"
158
159dnl Check is dlopen is in libc
160 _EFL_CHECK_FUNC_DLOPEN_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
161
162dnl Check is dlopen is in libdl
163 if test "x${_efl_have_fct}" = "xno" ; then
164 _EFL_CHECK_FUNC_DLOPEN_PRIV([$1], [-ldl], [_efl_have_fct="yes"], [_efl_have_fct="no"])
165 fi
166 ;;
167esac
168
169AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
170
171m4_popdef([DOWNEFL])
172m4_popdef([UPEFL])
173])
174
175dnl _EFL_CHECK_FUNC_FNMATCH_PRIV is for internal use
176dnl _EFL_CHECK_FUNC_FNMATCH_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
177
178AC_DEFUN([_EFL_CHECK_FUNC_FNMATCH_PRIV],
179[
180m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
181m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
182
183LIBS_save="${LIBS}"
184LIBS="${LIBS} $2"
185AC_LINK_IFELSE(
186 [AC_LANG_PROGRAM(
187 [[
188#include <stdlib.h>
189#include <fnmatch.h>
190 ]],
191 [[
192int g = fnmatch(NULL, NULL, 0);
193 ]])],
194 [
195 m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
196 requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
197 _efl_have_fct="yes"
198 ],
199 [_efl_have_fct="no"])
200
201LIBS="${LIBS_save}"
202
203AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
204
205m4_popdef([DOWNEFL])
206m4_popdef([UPEFL])
207])
208
209dnl _EFL_CHECK_FUNC_FNMATCH is for internal use
210dnl _EFL_CHECK_FUNC_FNMATCH(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
211
212AC_DEFUN([_EFL_CHECK_FUNC_FNMATCH],
213[
214case "$host_os" in
215 mingw*)
216 _efl_have_fct="yes"
217 ;;
218 *)
219dnl Check is fnmatch is in libc
220 _EFL_CHECK_FUNC_FNMATCH_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
221
222dnl Check is fnmatch is in libfnmatch
223 if test "x${_efl_have_fct}" = "xno" ; then
224 _EFL_CHECK_FUNC_FNMATCH_PRIV([$1], [-lfnmatch], [_efl_have_fct="yes"], [_efl_have_fct="no"])
225 fi
226
227dnl Check is fnmatch is in libiberty
228 if test "x${_efl_have_fct}" = "xno" ; then
229 _EFL_CHECK_FUNC_FNMATCH_PRIV([$1], [-liberty], [_efl_have_fct="yes"], [_efl_have_fct="no"])
230 fi
231 ;;
232esac
233
234AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
235])
236
237dnl _EFL_CHECK_FUNC_ICONV_PRIV is for internal use
238dnl _EFL_CHECK_FUNC_ICONV_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
239
240AC_DEFUN([_EFL_CHECK_FUNC_ICONV_PRIV],
241[
242m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
243m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
244
245LIBS_save="${LIBS}"
246LIBS="${LIBS} $2"
247AC_LINK_IFELSE(
248 [AC_LANG_PROGRAM(
249 [[
250#include <stdlib.h>
251#include <iconv.h>
252 ]],
253 [[
254iconv_t ic;
255size_t count = iconv(ic, NULL, NULL, NULL, NULL);
256 ]])],
257 [
258 m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
259 requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
260 _efl_have_fct="yes"
261 ],
262 [_efl_have_fct="no"])
263
264LIBS="${LIBS_save}"
265
266AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
267
268m4_popdef([DOWNEFL])
269m4_popdef([UPEFL])
270])
271
272dnl _EFL_CHECK_FUNC_ICONV is for internal use
273dnl _EFL_CHECK_FUNC_ICONV(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
274
275AC_DEFUN([_EFL_CHECK_FUNC_ICONV],
276[
277AC_ARG_WITH([iconv-link],
278 AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]),
279 [
280 _efl_have_fct="yes"
281 iconv_libs=${withval}
282 ],
283 [_efl_have_fct="no"])
284
285AC_MSG_CHECKING([for explicit iconv link options])
286if test "x${iconv_libs}" = "x" ; then
287 AC_MSG_RESULT([no explicit iconv link option])
288else
289 AC_MSG_RESULT([${iconv_libs}])
290fi
291
292dnl Check is iconv is in libc
293if test "x${_efl_have_fct}" = "xno" ; then
294 _EFL_CHECK_FUNC_ICONV_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
295fi
296
297dnl Check is iconv is in libiconv
298if test "x${_efl_have_fct}" = "xno" ; then
299 _EFL_CHECK_FUNC_ICONV_PRIV([$1], [-liconv], [_efl_have_fct="yes"], [_efl_have_fct="no"])
300fi
301
302dnl Check is iconv is in libiconv_plug
303if test "x${_efl_have_fct}" = "xno" ; then
304 _EFL_CHECK_FUNC_ICONV_PRIV([$1], [-liconv_plug], [_efl_have_fct="yes"], [_efl_have_fct="no"])
305fi
306
307AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
308])
309
310dnl _EFL_CHECK_FUNC_SETXATTR is for internal use
311dnl _EFL_CHECK_FUNC_SETXATTR(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
312
313AC_DEFUN([_EFL_CHECK_FUNC_SETXATTR],
314[
315AC_COMPILE_IFELSE(
316 [AC_LANG_PROGRAM(
317 [[
318#include <stdlib.h>
319#include <sys/types.h>
320#include <sys/xattr.h>
321 ]],
322 [[
323size_t tmp = listxattr("/", NULL, 0);
324tmp = getxattr("/", "user.ethumb.md5", NULL, 0);
325setxattr("/", "user.ethumb.md5", NULL, 0, 0);
326 ]])],
327 [_efl_have_fct="yes"],
328 [_efl_have_fct="no"])
329
330AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
331])
332
333dnl _EFL_CHECK_FUNC_SHM_OPEN_PRIV is for internal use
334dnl _EFL_CHECK_FUNC_SHM_OPEN_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
335
336AC_DEFUN([_EFL_CHECK_FUNC_SHM_OPEN_PRIV],
337[
338m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
339m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
340
341LIBS_save="${LIBS}"
342LIBS="${LIBS} $2"
343AC_LINK_IFELSE(
344 [AC_LANG_PROGRAM(
345 [[
346#include <sys/mman.h>
347#include <sys/stat.h> /* For mode constants */
348#include <fcntl.h> /* For O_* constants */
349 ]],
350 [[
351int fd;
352
353fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
354 ]])],
355 [
356 m4_defn([UPEFL])[]_LIBS="$m4_defn([UPEFL])[]_LIBS $2"
357 requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
358 _efl_have_fct="yes"
359 ],
360 [_efl_have_fct="no"])
361
362LIBS="${LIBS_save}"
363
364AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
365
366m4_popdef([DOWNEFL])
367m4_popdef([UPEFL])
368])
369
370dnl _EFL_CHECK_FUNC_SHM_OPEN is for internal use
371dnl _EFL_CHECK_FUNC_SHM_OPEN(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
372
373AC_DEFUN([_EFL_CHECK_FUNC_SHM_OPEN],
374[
375_efl_have_fct="no"
376
377dnl Check is shm_open is in libc
378_EFL_CHECK_FUNC_SHM_OPEN_PRIV([$1], [],
379 [_efl_have_fct="yes"],
380 [_efl_have_fct="no"])
381
382dnl Check is shm_open is in librt
383if test "x${_efl_have_fct}" = "xno" ; then
384 _EFL_CHECK_FUNC_SHM_OPEN_PRIV([$1], [-lrt],
385 [_efl_have_fct="yes"],
386 [_efl_have_fct="no"])
387fi
388
389AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
390])
391
392dnl Macro that checks function availability
393dnl
394dnl EFL_CHECK_FUNC(EFL, FUNCTION)
395dnl AC_SUBST : EFL_CFLAGS and EFL_LIBS (EFL being replaced by its value)
396dnl AC_DEFINE : EFL_HAVE_FUNCTION (FUNCTION being replaced by its value)
397dnl result in efl_func_function (function being replaced by its value)
398
399AC_DEFUN([EFL_CHECK_FUNC],
400[
401m4_pushdef([UP], m4_translit([$2], [-a-z], [_A-Z]))dnl
402m4_pushdef([DOWN], m4_translit([$2], [-A-Z], [_a-z]))dnl
403
404m4_default([_EFL_CHECK_FUNC_]m4_defn([UP]))($1, [have_fct="yes"], [have_fct="no"])
405
406if test "x$2" = "xsetxattr" ; then
407 AC_MSG_CHECKING([for extended attributes])
408else
409 AC_MSG_CHECKING([for ]m4_defn([DOWN]))
410fi
411
412AC_MSG_RESULT([${have_fct}])
413
414if test "x${have_fct}" = "xyes" ; then
415 if test "x$2" = "xsetxattr" ; then
416 AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.])
417 else
418 AC_DEFINE([HAVE_]m4_defn([UP]), [1], [Define to 1 if you have the `]m4_defn([DOWN])[' function.])
419 fi
420fi
421
422efl_func_[]m4_defn([DOWN])="${have_fct}"
423
424m4_popdef([DOWN])
425m4_popdef([UP])
426])
427
428dnl Macro that iterates over a sequence of space separated functions
429dnl and that calls EFL_CHECK_FUNC() for each of these functions
430dnl
431dnl EFL_CHECK_FUNCS(EFL, FUNCTIONS)
432
433AC_DEFUN([EFL_CHECK_FUNCS],
434[
435m4_foreach_w([fct], [$2], [EFL_CHECK_FUNC($1, m4_defn([fct]))])
436])
diff --git a/m4/efl_compiler.m4 b/m4/efl_compiler.m4
index 5f17be499d..be6a753e07 100644
--- a/m4/efl_compiler.m4
+++ b/m4/efl_compiler.m4
@@ -54,3 +54,52 @@ AC_DEFUN([EFL_CHECK_COMPILER_FLAGS],
54[ 54[
55m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))]) 55m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))])
56]) 56])
57
58
59dnl Macro that checks for a linker flag availability
60dnl
61dnl EFL_CHECK_LINKER_FLAG(EFL, FLAG[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
62dnl AC_SUBST : EFL_LIBS (EFL being replaced by its value)
63dnl AM_CONDITIONAL : EFL_HAVE_FLAG (FLAG being replaced by its value)
64
65AC_DEFUN([EFL_CHECK_LINKER_FLAG],
66[
67m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
68m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z]))
69
70LDFLAGS_save="${LDFLAGS}"
71LDFLAGS="${LDFLAGS} $2"
72
73AC_LANG_PUSH([C])
74AC_MSG_CHECKING([whether the linker supports $2])
75
76AC_LINK_IFELSE(
77 [AC_LANG_PROGRAM([[]])],
78 [have_flag="yes"],
79 [have_flag="no"])
80AC_MSG_RESULT([${have_flag}])
81
82LDFLAGS="${LDFLAGS_save}"
83AC_LANG_POP([C])
84
85if test "x${have_flag}" = "xyes" ; then
86 UPEFL[_LIBS]="${UPEFL[_LIBS]} [$2]"
87fi
88AC_ARG_VAR(UPEFL[_LIBS], [preprocessor flags for $2])
89AC_SUBST(UPEFL[_LIBS])
90
91AM_CONDITIONAL([EFL_HAVE]UP, [test "x${have_flag}" = "xyes"])
92
93m4_popdef([UP])
94m4_popdef([UPEFL])
95])
96
97dnl Macro that iterates over a sequence of white separated flags
98dnl and that call EFL_CHECK_LINKER_FLAG() for each of these flags
99dnl
100dnl EFL_CHECK_LINKER_FLAGS(EFL, FLAGS)
101
102AC_DEFUN([EFL_CHECK_LINKER_FLAGS],
103[
104m4_foreach_w([flag], [$2], [EFL_CHECK_LINKER_FLAG([$1], m4_defn([flag]))])
105])
diff --git a/m4/efl_libraries.m4 b/m4/efl_libraries.m4
deleted file mode 100644
index e7a7009a51..0000000000
--- a/m4/efl_libraries.m4
+++ /dev/null
@@ -1,190 +0,0 @@
1dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com>
2dnl This code is public domain and can be freely used or copied.
3
4dnl Macro that check dependencies libraries for the EFL
5
6dnl _EFL_CHECK_LIB_ICONV is for internal use
7dnl _EFL_CHECK_LIB_ICONV(libname, lib, ACTION-IF-FOUND ,ACTION-IF-NOT-FOUND)
8
9AC_DEFUN([_EFL_CHECK_LIB_ICONV],
10[
11AC_MSG_CHECKING([whether iconv() is in $1])
12
13LIBS_save="${LIBS}"
14LIBS="$2 ${LIBS}"
15AC_LINK_IFELSE([AC_LANG_PROGRAM(
16 [[
17#include <stdlib.h>
18#include <iconv.h>
19 ]],
20 [[
21iconv_t ic;
22size_t count = iconv(ic, NULL, NULL, NULL, NULL);
23 ]])],
24 [
25 have_dep="yes"
26 ICONV_LIBS=$2
27 ],
28 [
29 have_dep="no"
30 ])
31LIBS=${LIBS_save}
32
33AC_MSG_RESULT([${have_dep}])
34
35AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4])
36])
37
38dnl Macro that checks for iconv library in libc, libiconv and libiconv_plug
39dnl
40dnl EFL_CHECK_LIB_ICONV(EFL[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
41dnl update requirements
42
43AC_DEFUN([EFL_CHECK_LIB_ICONV],
44[
45m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
46
47AC_ARG_WITH([iconv-link],
48 AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]),
49 [
50 have_dep="yes"
51 ICONV_LIBS=${withval}
52 ],
53 [have_dep="no"])
54
55AC_MSG_CHECKING([for explicit iconv link options])
56if test "x${ICONV_LIBS}" = "x" ; then
57 AC_MSG_RESULT([no explicit iconv link option])
58else
59 AC_MSG_RESULT([${ICONV_LIBS}])
60fi
61
62if test "x${have_dep}" = "xno" ; then
63 AC_CHECK_HEADERS([iconv.h], [have_dep="yes"])
64
65 if test "x${have_dep}" = "xyes" ; then
66 _EFL_CHECK_LIB_ICONV([libc], [], [have_dep="yes"], [have_dep="no"])
67 fi
68
69 if test "x${have_dep}" = "xno" ; then
70 _EFL_CHECK_LIB_ICONV([libiconv], [-liconv],
71 [
72 have_dep="yes"
73 m4_defn([DOWN])[]_requirements_libs="$m4_defn([DOWN])[]_requirements_libs -liconv"
74 ],
75 [have_dep="no"])
76 fi
77
78 if test "x${have_dep}" = "xno" ; then
79 _EFL_CHECK_LIB_ICONV([libiconv_plug], [-liconv_plug],
80 [
81 have_dep="yes"
82 m4_defn([DOWN])[]_requirements_libs="$m4_defn([DOWN])[]_requirements_libs -liconv_plug"
83 ],
84 [have_dep="no"])
85 fi
86fi
87
88AS_IF([test "x${have_dep}" = "xyes"], [$2], [$3])
89
90m4_popdef([DOWN])
91])
92
93dnl Macro that checks for zlib
94dnl
95dnl EFL_CHECK_LIB_ZLIB(EFL[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
96dnl update requirements
97
98AC_DEFUN([EFL_CHECK_LIB_ZLIB],
99[
100m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
101
102PKG_CHECK_MODULES([ZLIB], [zlib],
103 [
104 have_dep="yes"
105 m4_defn([DOWN])[]_requirements_pc="$m4_defn([DOWN])[]_requirements_pc zlib"
106 ],
107 [have_dep="no"])
108
109if test "x${have_dep}" = "xno" ; then
110 AC_CHECK_HEADER([zlib.h], [have_dep="yes"], [have_dep="no"])
111
112 if test "x${have_dep}" = "xyes" ; then
113 AC_CHECK_LIB([z], [zlibVersion],
114 [
115 have_dep="yes"
116 ZLIB_CFLAGS=
117 ZLIB_LIBS="-lz"
118 m4_defn([DOWN])[]_requirements_libs="$m4_defn([DOWN])[]_requirements_libs -lz"
119 ],
120 [have_dep="no"])
121 fi
122fi
123
124AS_IF([test "x${have_dep}" = "xyes"], [$2], [$3])
125
126m4_popdef([DOWN])
127])
128
129dnl Macro that checks for libjpeg
130dnl
131dnl EFL_CHECK_LIB_LIBJPEG(EFL[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
132dnl update requirements
133
134AC_DEFUN([EFL_CHECK_LIB_LIBJPEG],
135[
136m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
137
138AC_CHECK_HEADER([jpeglib.h], [have_dep="yes"], [have_dep="no"])
139
140if test "x${have_dep}" = "xyes" ; then
141 AC_CHECK_LIB([jpeg], [jpeg_std_error],
142 [
143 have_dep="yes"
144 LIBJPEG_CFLAGS=
145 LIBJPEG_LIBS="-ljpeg"
146 m4_defn([DOWN])[]_requirements_libs="$m4_defn([DOWN])[]_requirements_libs -ljpeg"
147 ],
148 [have_dep="no"])
149fi
150
151AS_IF([test "x${have_dep}" = "xyes"], [$2], [$3])
152
153m4_popdef([DOWN])
154])
155
156dnl Macro that checks for a library
157dnl
158dnl EFL_CHECK_LIB(EFL, LIBRARY-FILE[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
159dnl AC_SUBST : EFL_CFLAGS and EFL_LIBS (EFL being replaced by its value)
160dnl AM_CONDITIONAL : EFL_HAVE_EFL (the 2nd EFL being replaced by its value)
161
162AC_DEFUN([EFL_CHECK_LIB],
163[
164m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
165m4_pushdef([UP], m4_translit([$2], [-a-z], [_A-Z]))dnl
166m4_pushdef([DOWN], m4_translit([$2], [-A-Z], [_a-z]))dnl
167
168m4_default([EFL_CHECK_LIB_]m4_defn([UP]))($1, [have_lib="yes"], [have_lib="no"])
169
170AC_ARG_VAR(UP[_CFLAGS], [preprocessor flags for $2])
171AC_SUBST(UP[_CFLAGS])
172AC_ARG_VAR(UP[_LIBS], [linker flags for $2])
173AC_SUBST(UP[_LIBS])
174
175AM_CONDITIONAL([EFL_HAVE_]UPEFL, [test "x${have_lib}" = "xyes"])
176
177m4_popdef([DOWN])
178m4_popdef([UP])
179m4_popdef([UPEFL])
180])
181
182dnl Macro that iterates over a sequence of white separated libraries
183dnl and that call EFL_CHECK_LIB() for each of these libraries
184dnl
185dnl EFL_CHECK_LIBS(EFL, LIBRARY-FILE)
186
187AC_DEFUN([EFL_CHECK_LIBS],
188[
189m4_foreach_w([lib], [$2], [EFL_CHECK_LIB($1, m4_defn([lib]))])
190]) \ No newline at end of file
diff --git a/m4/efl_path_max.m4 b/m4/efl_path_max.m4
new file mode 100644
index 0000000000..f57bfd2ab5
--- /dev/null
+++ b/m4/efl_path_max.m4
@@ -0,0 +1,36 @@
1dnl Check for PATH_MAX in limits.h, and define a default value if not found
2dnl This is a workaround for systems not providing PATH_MAX, like GNU/Hurd
3
4dnl EFL_CHECK_PATH_MAX([DEFAULT_VALUE_IF_NOT_FOUND])
5dnl
6dnl If PATH_MAX is not defined in <limits.h>, defines it
7dnl to DEFAULT_VALUE_IF_NOT_FOUND if it exists, or fallback
8dnl to using 4096
9
10AC_DEFUN([EFL_CHECK_PATH_MAX],
11[
12
13default_max=m4_default([$1], "4096")
14AC_LANG_PUSH([C])
15
16AC_MSG_CHECKING([for PATH_MAX in limits.h])
17AC_COMPILE_IFELSE(
18 [AC_LANG_PROGRAM(
19 [[
20#include <limits.h>
21 ]],
22 [[
23int i = PATH_MAX;
24 ]])],
25 [AC_MSG_RESULT([yes])],
26 [
27 AC_DEFINE_UNQUOTED([PATH_MAX],
28 [${default_max}],
29 [default value since PATH_MAX is not defined])
30 AC_MSG_RESULT([no: using ${default_max}])
31 ])
32
33AC_LANG_POP([C])
34
35])
36dnl end of efl_path_max.m4
diff --git a/m4/efl_tests.m4 b/m4/efl_tests.m4
new file mode 100644
index 0000000000..612baa0e8e
--- /dev/null
+++ b/m4/efl_tests.m4
@@ -0,0 +1,49 @@
1dnl Copyright (C) 2008-2012 Vincent Torri <vtorri at univ-evry dot fr>
2dnl That code is public domain and can be freely used or copied.
3
4dnl Macro that check if tests programs are wanted and if yes, if
5dnl the Check library is available.
6dnl the lcov program is available.
7
8dnl Usage: EFL_CHECK_TESTS(EFL[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
9dnl Define the automake conditionnal EFL_ENABLE_TESTS
10
11AC_DEFUN([EFL_CHECK_TESTS],
12[
13m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
14
15dnl configure option
16
17AC_REQUIRE([PKG_PROG_PKG_CONFIG])
18
19PKG_CHECK_MODULES([CHECK],
20 [check >= 0.9.5],
21 [_efl_enable_tests="yes"],
22 [_efl_enable_tests="no"])
23
24AM_CONDITIONAL([EFL_ENABLE_TESTS], [test "x${_efl_enable_tests}" = "xyes"])
25
26_efl_enable_coverage="no"
27AC_CHECK_PROG(have_lcov, [lcov], [yes], [no])
28if test "x$have_lcov" = "xyes" ; then
29 m4_defn([UPEFL])[]_CFLAGS="${m4_defn([UPEFL])[]_CFLAGS} -fprofile-arcs -ftest-coverage"
30 m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} -lgcov"
31# remove any optimisation flag and force debug symbols
32 if test "x${prefer_assert}" = "xno"; then
33 m4_defn([UPEFL])[]_CFLAGS="${m4_defn([UPEFL])[]_CFLAGS} -DNDEBUG"
34 else
35 m4_defn([UPEFL])[]_CFLAGS="${m4_defn([UPEFL])[]_CFLAGS} -g -O0 -DDEBUG"
36 fi
37 _efl_enable_coverage="yes"
38else
39 AC_MSG_WARN([lcov is not found, disable profiling instrumentation])
40fi
41
42AM_CONDITIONAL([EFL_ENABLE_COVERAGE], [test "x${_efl_enable_coverage}" = "xyes"])
43
44AS_IF([test "x$_efl_enable_tests" = "xyes"], [$2], [$3])
45
46m4_popdef([UPEFL])
47])
48
49dnl End of efl_tests.m4
diff --git a/m4/efl_threads.m4 b/m4/efl_threads.m4
new file mode 100644
index 0000000000..ae296069d8
--- /dev/null
+++ b/m4/efl_threads.m4
@@ -0,0 +1,149 @@
1dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
2dnl rwlock code added by Mike Blumenkrantz <mike at zentific dot com>
3dnl This code is public domain and can be freely used or copied.
4
5dnl Macro that check if POSIX or Win32 threads library is available or not.
6
7dnl Usage: EFL_CHECK_THREADS(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
8dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS)
9dnl Call AC_SUBST(EFL_PTHREAD_LIBS)
10dnl Defines EFL_HAVE_POSIX_THREADS or EFL_HAVE_WIN32_THREADS, and EFL_HAVE_THREADS
11
12AC_DEFUN([EFL_CHECK_THREADS],
13[
14
15dnl Generic thread detection
16
17EFL_PTHREAD_CFLAGS=""
18EFL_PTHREAD_LIBS=""
19
20_efl_enable_posix_threads="no"
21_efl_have_posix_threads="no"
22_efl_have_win32_threads="no"
23
24case "$host_os" in
25 mingw*)
26 _efl_have_win32_threads="yes"
27 AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 threads are supported])
28 AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
29 ;;
30 solaris*)
31 _efl_enable_posix_threads="yes"
32 _efl_threads_cflags="-mt"
33 _efl_threads_libs="-mt"
34 ;;
35 *)
36 _efl_enable_posix_threads="yes"
37 _efl_threads_cflags="-pthread"
38 _efl_threads_libs="-pthread"
39 ;;
40esac
41
42dnl check if the compiler supports POSIX threads
43
44
45if test "x${_efl_enable_posix_threads}" = "xyes" ; then
46
47 SAVE_CFLAGS=${CFLAGS}
48 CFLAGS="${CFLAGS} ${_efl_threads_cflags}"
49 SAVE_LIBS=${LIBS}
50 LIBS="${LIBS} ${_efl_threads_libs}"
51 AC_LINK_IFELSE(
52 [AC_LANG_PROGRAM([[
53#include <pthread.h>
54 ]],
55 [[
56pthread_t id;
57id = pthread_self();
58 ]])],
59 [
60 _efl_have_posix_threads="yes"
61 AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX threads are supported])
62 AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
63 EFL_PTHREAD_CFLAGS=${_efl_threads_cflags}
64 EFL_PTHREAD_LIBS=${_efl_threads_libs}
65 ],
66 [_efl_have_posix_threads="no"])
67 CFLAGS=${SAVE_CFLAGS}
68 LIBS=${SAVE_LIBS}
69
70fi
71
72AC_MSG_CHECKING([which threads API is used])
73if test "x${_efl_have_posix_threads}" = "xyes" ; then
74 efl_have_threads="POSIX"
75else
76 if test "x${_efl_have_win32_threads}" = "xyes" ; then
77 efl_have_threads="Windows"
78 else
79 efl_have_threads="no"
80 fi
81fi
82AC_MSG_RESULT([${efl_have_threads}])
83
84AC_SUBST(EFL_PTHREAD_CFLAGS)
85AC_SUBST(EFL_PTHREAD_LIBS)
86
87dnl check if the compiler supports pthreads spinlock
88
89efl_have_posix_threads_spinlock="no"
90
91if test "x${_efl_have_posix_threads}" = "xyes" ; then
92
93 SAVE_CFLAGS=${CFLAGS}
94 CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
95 SAVE_LIBS=${LIBS}
96 LIBS="${LIBS} ${EFL_PTHREAD_LIBS}"
97 AC_LINK_IFELSE(
98 [AC_LANG_PROGRAM([[
99#include <pthread.h>
100 ]],
101 [[
102pthread_spinlock_t lock;
103int res;
104res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
105 ]])],
106 [efl_have_posix_threads_spinlock="yes"],
107 [efl_have_posix_threads_spinlock="no"])
108 CFLAGS=${SAVE_CFLAGS}
109 LIBS=${SAVE_LIBS}
110
111fi
112
113AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
114AC_MSG_RESULT([${efl_have_posix_threads_spinlock}])
115
116if test "x${efl_have_posix_threads_spinlock}" = "xyes" ; then
117 AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported])
118fi
119
120dnl Check ON-OFF threads
121
122_efl_enable_on_off_threads="no"
123AC_ARG_ENABLE([on-off-threads],
124 [AC_HELP_STRING([--enable-on-off-threads], [only turn this on if you know what you are doing, and do not complain if the world freeze])],
125 [_efl_enable_on_off_threads="${enableval}"])
126
127efl_have_on_off_threads="no"
128if test "x${_efl_have_posix_threads}" = "xyes" && test "x${_efl_enable_on_off_threads}" = "xyes"; then
129 efl_have_on_off_threads="yes"
130 AC_DEFINE([EFL_ON_OFF_THREADS], [1], [make it possible to disable all locks])
131fi
132AC_MSG_CHECKING([whether to turn on/off threads lock on demand])
133AC_MSG_RESULT([${efl_have_on_off_threads}])
134
135dnl Check debug threads
136
137_efl_enable_debug_threads="no"
138AC_ARG_ENABLE([debug-threads],
139 [AC_HELP_STRING([--enable-debug-threads], [disable assert when you forgot to call eina_threads_init])],
140 [_efl_enable_debug_threads="${enableval}"])
141
142efl_have_debug_threads="no"
143if test "x${_efl_have_posix_threads}" = "xyes" && test "x${_efl_enable_debug_threads}" = "xyes"; then
144 efl_have_debug_threads="yes"
145 AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init])
146fi
147
148AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2])
149])
diff --git a/m4/eina_check.m4 b/m4/eina_check.m4
new file mode 100644
index 0000000000..9f4ffcedc2
--- /dev/null
+++ b/m4/eina_check.m4
@@ -0,0 +1,50 @@
1dnl use: EINA_CHECK_MODULE(foo-bar, have_dependency, description)
2AC_DEFUN([EINA_CHECK_MODULE],
3[
4m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
5m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
6
7default_value=$2
8
9AC_ARG_ENABLE([mempool-$1],
10 [AC_HELP_STRING([--enable-mempool-$1], [enable build of $3 @<:@default=$@:>@])],
11 [
12 if test "x${enableval}" = "xyes" ; then
13 enable_module="yes"
14 else
15 if test "x${enableval}" = "xstatic" ; then
16 enable_module="static"
17 else
18 enable_module="no"
19 fi
20 fi
21 ],
22 [enable_module=$2])
23
24have_module="no"
25if test "x${enable_module}" = "xyes" || test "x${enable_module}" = "xstatic" ; then
26 have_module="yes"
27fi
28
29AC_MSG_CHECKING([whether to enable $3 built])
30AC_MSG_RESULT([${have_module}])
31
32static_module="no"
33if test "x${enable_module}" = "xstatic" ; then
34 static_module="yes"
35 have_static_module="yes"
36 AC_DEFINE(EINA_STATIC_BUILD_[]UP, 1, [Set to 1 if $2 is statically built])
37fi
38
39if ! test "x${enable_module}" = "xno" ; then
40 AC_DEFINE(EINA_BUILD_[]UP, 1, [Set to 1 if $2 is built])
41fi
42
43AM_CONDITIONAL(EINA_BUILD_[]UP, [test "x${have_module}" = "xyes"])
44AM_CONDITIONAL(EINA_STATIC_BUILD_[]UP, [test "x${static_module}" = "xyes"])
45
46enable_[]DOWN=${enable_module}
47
48m4_popdef([UP])
49m4_popdef([DOWN])
50])