summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-06 23:19:35 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-06 23:19:35 +0000
commit4476601805b687d59ffd69e3ea05b0197c17460e (patch)
tree0ac881c41a2f867a2b2de70b6d7a47b8ff294ea2 /m4
parentd338bcac632280a8742741dd840a3c5a6cf852c4 (diff)
efl: m4 is a macro-expansion language, use that.
instead of replicating common patterns all around, let's use the common patterns as m4 macros. EFL_DEPEND_PKG() will use pkg-config and add the dependency. EFL_OPTIONAL_DEPEND_PKG() will use the former, but also defines have_XYZ and does the if statement for you. SVN revision: 80402
Diffstat (limited to 'm4')
-rw-r--r--m4/efl.m442
-rw-r--r--m4/efl_pkg_config.m45
2 files changed, 44 insertions, 3 deletions
diff --git a/m4/efl.m4 b/m4/efl.m4
new file mode 100644
index 0000000..d4a4d1a
--- /dev/null
+++ b/m4/efl.m4
@@ -0,0 +1,42 @@
1dnl file to manage modules in efl
2
3dnl EFL_DEPEND_PKG(EFL, NAME, PACKAGE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
4dnl Adds a pkg-config dependency to an efl, AC_DEFINE() HAVE_NAME,
5dnl and inserts dependencies in proper variables
6AC_DEFUN([EFL_DEPEND_PKG],
7[
8m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
9m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
10m4_pushdef([UPNAME], m4_translit([$2], [-a-z], [_A-Z]))dnl
11m4_pushdef([DOWNNAME], m4_translit([$2], [-A-Z], [_a-z]))dnl
12
13 have_[]m4_defn([DOWNNAME])="no"
14
15 EFL_PKG_CHECK_STRICT([$3], [
16 AC_DEFINE([HAVE_]m4_defn([UPNAME]), [1], [Have `]m4_defn([DOWNNAME])[' pkg-config installed.])
17 requirements_pc_[]m4_defn([DOWNEFL])="$3 ${requirements_pc_[][]m4_defn([DOWNEFL])}"
18 requirements_pc_deps_[]m4_defn([DOWNEFL])="$3 ${requirements_pc_deps_[]m4_defn([DOWNEFL])}"
19 have_[]m4_defn([DOWNNAME])="yes"
20
21 $4
22
23 ], [$5])
24
25m4_popdef([DOWNNAME])
26m4_popdef([UPNAME])
27m4_popdef([DOWNEFL])
28m4_popdef([UPEFL])
29])
30
31dnl EFL_OPTIONAL_DEPEND_PKG(EFL, VARIABLE, NAME, PACKAGE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
32AC_DEFUN([EFL_OPTIONAL_DEPEND_PKG],
33[
34m4_pushdef([DOWN], m4_translit([$3], [-A-Z], [_a-z]))dnl
35
36 have_[]m4_defn([DOWN])="no"
37 if test "x$2" = "xyes"; then
38 EFL_DEPEND_PKG([$1], [$3], [$4], [$5], [$6])
39 fi
40
41m4_popdef([DOWN])
42])
diff --git a/m4/efl_pkg_config.m4 b/m4/efl_pkg_config.m4
index c4f3c1e..13a9516 100644
--- a/m4/efl_pkg_config.m4
+++ b/m4/efl_pkg_config.m4
@@ -4,8 +4,7 @@ dnl EFL_PKG_CHECK_STRICT(MODULE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
4dnl similar to PKG_CHECK_EXISTS() that will AC_MSG_ERROR() if not found 4dnl similar to PKG_CHECK_EXISTS() that will AC_MSG_ERROR() if not found
5AC_DEFUN([EFL_PKG_CHECK_STRICT], 5AC_DEFUN([EFL_PKG_CHECK_STRICT],
6[ 6[
7 PKG_CHECK_EXISTS([$1], 7 PKG_CHECK_EXISTS([$1], [$2],
8 [m4_if([$2], [$2], [:])], 8 [m4_ifval([$3], [$3], [AC_MSG_ERROR([pkg-config missing $1])])]
9 [m4_if([$3], [$3], [AC_MSG_ERROR([pkg-config missing $1])])]
10 ) 9 )
11]) 10])