summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-16 17:24:36 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-16 17:24:36 +0000
commitad1417713b564bf28605077220b86794b9dbbcd6 (patch)
tree4dcf44b5c9e5e9e53e0b5e1fde460bc707f04329 /m4
parent09f342fdebd1889c3c6e401cb2a6c5799a6c20ed (diff)
simplify efl version and initialization in a macro, fixes libtool version-info.
Introduces EFL_VERSION() to make it simpler to define our version. The last parameter is the release status, defaults to 'dev' for development purposes and may be set to something else to be a snapshot. It non-empty will be given to libtool's -release. As EFL_VERSION() must be done *before* AC_INIT(), we need to create another macro to do the AC_SUBST() and AC_DEFINE(). This is EFL_INIT. And no, we can't just call AC_INIT() from inside EFL_INIT(). Last but not least, we had a problem with our libtool version-info. It was being calculated as MAJOR + MINOR, right now 1 + 7 = 8. But as soon as we get to MAJOR=2 and MINOR=0, we get into problems. This was fixed by rewriting as (MAJOR * 100 + MINOR), but this is still problematic. According to libtool's manual (info libtool), we shouldn't bind the version-info with package info, instead doing the 'release' field. Pretty likely we'll do worse than expected by distros and binary packages in future :-/ SVN revision: 82891
Diffstat (limited to 'm4')
-rw-r--r--m4/efl.m474
1 files changed, 74 insertions, 0 deletions
diff --git a/m4/efl.m4 b/m4/efl.m4
index eaa9f29..cbd3791 100644
--- a/m4/efl.m4
+++ b/m4/efl.m4
@@ -1,5 +1,79 @@
1dnl file to manage modules in efl 1dnl file to manage modules in efl
2 2
3dnl EFL_VERSION(major, minor, micro, release)
4dnl This setup EFL version information and should be called BEFORE AC_INIT().
5dnl
6dnl release parameter is 'dev' to use from SVN or libtool -release field.
7dnl It may be empty if not dev (svn/live build) and no -release is to be used.
8dnl
9dnl Examples:
10dnl EFL_VERSION(1, 7, 99, dev)
11dnl EFL_VERSION(1, 7, 99, ver-1234)
12dnl This will define couple of m4 symbols:
13dnl v_maj = given major number (first parameter)
14dnl v_min = given minor number (second parameter)
15dnl v_mic = given micro number (third parameter)
16dnl v_rev = if release, it's 0, otherwise it's dev_version.
17dnl v_rel = if release, it's -release followed by fourth parameter,
18dnl otherwise it's empty. (mostly for libtool)
19dnl efl_version = if release, it's major.minor.micro, otherwise it's
20dnl major.minor.micro.dev_version
21dnl dev_version = development version (svn revision).
22dnl def_build_profile = dev or release based on 'dev' release parameter.
23AC_DEFUN([EFL_VERSION],
24[dnl
25m4_define([v_maj], [$1])dnl
26m4_define([v_min], [$2])dnl
27m4_define([v_mic], [$3])dnl
28m4_define([dev_version], m4_esyscmd([(LC_ALL=C svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || echo 0) | cut -d: -f2 | tr -d ' :MSP\n']))dnl
29m4_if(dev_version, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])dnl
30m4_define([v_rev], m4_if($4, dev, [dev_version], [0]))dnl
31m4_define([v_rel], m4_if($4, dev, [], m4_ifblank($4, [], [-release $4])))dnl
32m4_define([def_build_profile], m4_if($4, dev, [dev], [release]))dnl
33m4_define([efl_version], m4_if($4, dev, [v_maj.v_min.v_mic.v_rev], [v_maj.v_min.v_mic]))dnl
34])
35
36dnl EFL_INIT()
37dnl Will AC_DEFINE() the following:
38dnl VMAJ = v_maj
39dnl VMIN = v_min
40dnl VMIC = v_mic
41dnl VREV = v_rev
42dnl Will AC_SUBST() the following:
43dnl VMAJ = v_maj
44dnl VMIN = v_min
45dnl EFL_LTLIBRARY_FLAGS="-no-undefined -version-info ..."
46dnl EFL_LTMODULE_FLAGS="-no-undefined -avoid-version"
47dnl Will define the following m4:
48dnl lt_cur = libtool 'current' field of libtool's -version-info
49dnl lt_rev = libtool 'revision' field of libtool's -version-info
50dnl lt_age = libtool 'age' field of libtool's -version-info
51AC_DEFUN([EFL_INIT],
52[dnl
53AC_DEFINE_UNQUOTED([VMAJ], [v_maj], [Major version])dnl
54AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])dnl
55AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])dnl
56AC_DEFINE_UNQUOTED([VREV], [v_rev], [Revison])dnl
57VMAJ=v_maj
58VMIN=v_min
59AC_SUBST([VMAJ])dnl
60AC_SUBST([VMIN])dnl
61dnl
62dnl TODO: warning - lt_cur:
63dnl the previous code assumed v_maj + v_min, but this will be a problem when
64dnl we bump v_maj and reset v_min. 1 + 7 == 7 + 1, so if v_maj is bumped
65dnl we multiply it by 100.
66m4_define([lt_cur], m4_if(m4_cmp(v_maj, 1), 0, m4_eval(v_maj + v_min), m4_eval(v_maj * 100 + v_min)))dnl
67m4_define([lt_rev], v_mic)dnl
68m4_define([lt_age], v_min)dnl
69dnl
70EFL_LTLIBRARY_FLAGS="-no-undefined -version-info lt_cur:lt_rev:lt_age v_rel"
71AC_SUBST(EFL_LTLIBRARY_FLAGS)dnl
72EFL_LTMODULE_FLAGS="-no-undefined -avoid-version"
73AC_SUBST([EFL_LTMODULE_FLAGS])dnl
74AC_MSG_NOTICE([Initialized AC_PACKAGE_NAME (AC_PACKAGE_VERSION) development=dev_version v_rel])
75])
76
3dnl EFL_EVAL_PKGS(EFL) 77dnl EFL_EVAL_PKGS(EFL)
4dnl does PKG_CHECK_MODULES() for given EFL 78dnl does PKG_CHECK_MODULES() for given EFL
5AC_DEFUN([EFL_EVAL_PKGS], 79AC_DEFUN([EFL_EVAL_PKGS],