summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-09-11 16:04:21 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-09-11 16:04:21 +0000
commit59a9dfd11860888a35e96dfe51af63cea5cecfe1 (patch)
tree5577297b8bb6e1b299987c45eb0c0fa9a5669b0b /m4
parent0ca69d1f2d2f378223bed712c9cdcd7e6679e305 (diff)
merge: add infra for evil
SVN revision: 76463
Diffstat (limited to 'm4')
-rw-r--r--m4/efl_attribute.m456
-rw-r--r--m4/efl_compiler.m456
-rw-r--r--m4/efl_doxygen.m498
-rw-r--r--m4/efl_libraries.m4190
-rw-r--r--m4/evil_windows.m459
5 files changed, 459 insertions, 0 deletions
diff --git a/m4/efl_attribute.m4 b/m4/efl_attribute.m4
new file mode 100644
index 0000000000..78bff15679
--- /dev/null
+++ b/m4/efl_attribute.m4
@@ -0,0 +1,56 @@
1dnl Copyright (C) 2011 Vincent Torri <vtorri at univ-evry dot fr>
2dnl That code is public domain and can be freely used or copied.
3
4dnl Macros for checking if the compiler supports some __attribute__ uses
5
6dnl Usage: EFL_ATTRIBUTE_UNUSED
7dnl call AC_DEFINE for __UNUSED__ if __attribute__((unused)) is available
8
9AC_DEFUN([EFL_ATTRIBUTE_UNUSED],
10[
11AC_MSG_CHECKING([for __attribute__ ((unused))])
12AC_COMPILE_IFELSE(
13 [AC_LANG_PROGRAM(
14 [[
15void foo(int x __attribute__ ((unused))) {}
16 ]],
17 [[
18 ]])],
19 [have_attribute_unused="yes"],
20 [have_attribute_unused="no"])
21AC_MSG_RESULT([${have_attribute_unused}])
22
23if test "x${have_attribute_unused}" = "xyes" ; then
24 AC_DEFINE([__UNUSED__], [__attribute__ ((unused))], [Macro declaring a function argument to be unused.])
25else
26 AC_DEFINE([__UNUSED__], [], [__attribute__ ((unused)) is not supported.])
27fi
28])
29
30dnl Usage: EFL_ATTRIBUTE_VECTOR
31dnl call AC_DEFINE for HAVE_GCC_ATTRIBUTE_VECTOR if __attribute__((vector)) is available
32
33AC_DEFUN([EFL_ATTRIBUTE_VECTOR],
34[
35AC_MSG_CHECKING([for __attribute__ ((vector))])
36AC_COMPILE_IFELSE(
37 [AC_LANG_PROGRAM(
38 [[
39typedef int v4si __attribute__ ((vector_size (16)));
40 ]],
41 [[
42if (sizeof(v4si) == 16)
43 return 0;
44else
45 return -1;
46 ]])],
47 [have_attribute_vector="yes"],
48 [have_attribute_vector="no"])
49AC_MSG_RESULT([${have_attribute_vector}])
50
51if test "x${have_attribute_vector}" = "xyes" ; then
52 AC_DEFINE([HAVE_GCC_ATTRIBUTE_VECTOR], [1], [Define to 1 if your compiler supports __attribute__ ((vector)).])
53fi
54])
55
56dnl End of efl_attribute.m4
diff --git a/m4/efl_compiler.m4 b/m4/efl_compiler.m4
new file mode 100644
index 0000000000..5f17be499d
--- /dev/null
+++ b/m4/efl_compiler.m4
@@ -0,0 +1,56 @@
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 if compiler of linker flags are available
5
6
7dnl Macro that checks for a compiler flag availability
8dnl
9dnl EFL_CHECK_COMPILER_FLAG(EFL, FLAG[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
10dnl AC_SUBST : EFL_CFLAGS (EFL being replaced by its value)
11dnl AM_CONDITIONAL : EFL_HAVE_FLAG (FLAG being replaced by its value)
12
13AC_DEFUN([EFL_CHECK_COMPILER_FLAG],
14[
15m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
16m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z]))
17
18dnl store in options -Wfoo if -Wno-foo is passed
19option=m4_bpatsubst([[$2]], [-Wno-], [-W])
20
21CFLAGS_save="${CFLAGS}"
22CFLAGS="${CFLAGS} ${option}"
23
24AC_LANG_PUSH([C])
25AC_MSG_CHECKING([whether the compiler supports $2])
26
27AC_COMPILE_IFELSE(
28 [AC_LANG_PROGRAM([[]])],
29 [have_flag="yes"],
30 [have_flag="no"])
31AC_MSG_RESULT([${have_flag}])
32
33CFLAGS="${CFLAGS_save}"
34AC_LANG_POP([C])
35
36if test "x${have_flag}" = "xyes" ; then
37 UPEFL[_CFLAGS]="${UPEFL[_CFLAGS]} [$2]"
38fi
39AC_ARG_VAR(UPEFL[_CFLAGS], [preprocessor flags for $2])
40AC_SUBST(UPEFL[_CFLAGS])
41
42AM_CONDITIONAL([EFL_HAVE]UP, [test "x${have_flag}" = "xyes"])
43
44m4_popdef([UP])
45m4_popdef([UPEFL])
46])
47
48dnl Macro that iterates over a sequence of white separated flags
49dnl and that call EFL_CHECK_COMPILER_FLAG() for each of these flags
50dnl
51dnl EFL_CHECK_COMPILER_FLAGS(EFL, FLAGS)
52
53AC_DEFUN([EFL_CHECK_COMPILER_FLAGS],
54[
55m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))])
56])
diff --git a/m4/efl_doxygen.m4 b/m4/efl_doxygen.m4
new file mode 100644
index 0000000000..0c1452fee0
--- /dev/null
+++ b/m4/efl_doxygen.m4
@@ -0,0 +1,98 @@
1dnl Copyright (C) 2008 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 doxygen is available or not.
5
6dnl EFL_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
7dnl Test for the doxygen program
8dnl Defines efl_doxygen
9dnl Defines the automake conditionnal EFL_BUILD_DOC
10dnl
11AC_DEFUN([EFL_CHECK_DOXYGEN],
12[
13
14dnl
15dnl Disable the build of the documentation
16dnl
17AC_ARG_ENABLE([doc],
18 [AC_HELP_STRING(
19 [--disable-doc],
20 [Disable documentation build @<:@default=enabled@:>@])],
21 [
22 if test "x${enableval}" = "xyes" ; then
23 efl_enable_doc="yes"
24 else
25 efl_enable_doc="no"
26 fi
27 ],
28 [efl_enable_doc="yes"]
29)
30
31if test "x${efl_enable_doc}" = "xyes" ; then
32
33dnl
34dnl Specify the full file name, with path
35dnl
36
37 efl_doxygen="doxygen"
38
39 AC_ARG_WITH([doxygen],
40 [AC_HELP_STRING(
41 [--with-doxygen=FILE],
42 [doxygen program to use @<:@default=doxygen@:>@])],
43dnl
44dnl Check the given doxygen program.
45dnl
46 [efl_doxygen=${withval}
47 AC_CHECK_PROG([efl_have_doxygen],
48 [${efl_doxygen}],
49 [yes],
50 [no])
51 if test "x${efl_have_doxygen}" = "xno" ; then
52 echo "WARNING:"
53 echo "The doxygen program you specified:"
54 echo "$efl_doxygen"
55 echo "was not found. Please check the path and make sure "
56 echo "the program exists and is executable."
57 AC_MSG_WARN([Warning: no doxygen detected. Documentation will not be built])
58 fi
59 ],
60 [AC_CHECK_PROG([efl_have_doxygen],
61 [${efl_doxygen}],
62 [yes],
63 [no])
64 if test "x${efl_have_doxygen}" = "xno" ; then
65 echo "WARNING:"
66 echo "The doxygen program was not found in your execute"
67 echo "You may have doxygen installed somewhere not covered by your path."
68 echo ""
69 echo "If this is the case make sure you have the packages installed, AND"
70 echo "that the doxygen program is in your execute path (see your"
71 echo "shell manual page on setting the \$PATH environment variable), OR"
72 echo "alternatively, specify the program to use with --with-doxygen."
73 AC_MSG_WARN([Warning: no doxygen detected. Documentation will not be built])
74 fi
75 ]
76 )
77fi
78
79dnl
80dnl Substitution
81dnl
82AC_SUBST([efl_doxygen])
83
84if ! test "x${efl_have_doxygen}" = "xyes" ; then
85 efl_enable_doc="no"
86fi
87
88AM_CONDITIONAL(EFL_BUILD_DOC, test "x${efl_enable_doc}" = "xyes")
89
90if test "x${efl_enable_doc}" = "xyes" ; then
91 ifelse([$1], , :, [$1])
92else
93 ifelse([$2], , :, [$2])
94fi
95
96])
97
98dnl End of doxygen.m4
diff --git a/m4/efl_libraries.m4 b/m4/efl_libraries.m4
new file mode 100644
index 0000000000..e7a7009a51
--- /dev/null
+++ b/m4/efl_libraries.m4
@@ -0,0 +1,190 @@
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/evil_windows.m4 b/m4/evil_windows.m4
new file mode 100644
index 0000000000..be79b8296b
--- /dev/null
+++ b/m4/evil_windows.m4
@@ -0,0 +1,59 @@
1dnl Copyright (C) 2011 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 select the Windows version (XP (default), Vista, 7)
5
6dnl Usage: EFL_SELECT_WINDOWS_VERSION()
7dnl Update CPPFLAGS accordingly
8
9AC_DEFUN([EFL_SELECT_WINDOWS_VERSION],
10[
11
12dnl configure option
13
14AC_ARG_WITH([windows-version],
15 [AC_HELP_STRING([--with-windows-version], [select the target Windows version (xp, vista, win7 or ce) @<:@default=xp@:>@])],
16 [
17 if test "x${with_windows_version}" = "xvista" ; then
18 _winver="vista"
19 else
20 if test "x${with_windows_version}" = "xwin7" ; then
21 _winver="win7"
22 else
23 if test "x${with_windows_version}" = "ce" ; then
24 _winver="ce"
25 else
26 _winver="xp"
27 fi
28 fi
29 fi
30 ],
31 [_winver="xp"])
32
33AC_MSG_CHECKING([which Windows version to target])
34AC_MSG_RESULT([${_winver}])
35
36case "${_winver}" in
37 ce)
38 EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WCE=0x0420"
39 _efl_windows_version="Windows CE"
40 ;;
41 vista)
42 EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WINNT=0x0600"
43 _efl_windows_version="Windows Vista"
44 ;;
45 win7)
46 EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WINNT=0x0601"
47 _efl_windows_version="Windows 7"
48 ;;
49 *)
50 EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WINNT=0x0501"
51 _efl_windows_version="Windows XP"
52 ;;
53esac
54
55CPPFLAGS="${CPPFLAGS} ${EFL_WINDOWS_VERSION_CFLAGS}"
56AC_SUBST([EFL_WINDOWS_VERSION_CFLAGS])
57AC_SUBST([_efl_windows_version])
58
59])