forked from axel-download-accelerator/axel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacinclude.m4
70 lines (62 loc) · 2.3 KB
/
acinclude.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# TODO: we need a true replacement for AC_INIT...
# _AXEL_ntsinc(FILE) - sinclude not to be tracked by automake
# ---------------------------------------------------------------------
m4_define([_AXEL_ntsinc], defn([m4_sinclude]))
# _AXEL_READL(FILE, HARD-DEP?)
# ---------------------------------------------------------------------
m4_define([_AXEL_READL],
[m4_bpatsubst(m4_quote(m4_if([$2],,
[_AXEL_ntsinc([$1])],
[m4_apply([m4_include], [[$1]])])), [ *
])])
# _AXEL_GIT_HEAD
# ---------------------------------------------------------------------
m4_define([_AXEL_GIT_HEAD],
[m4_define([__HEAD], m4_quote(_AXEL_READL([.git/HEAD])))dnl
m4_if(m4_substr(m4_quote(__HEAD), 0, 4), [ref:],
[m4_quote(_AXEL_READL([.git/]m4_bpatsubst(__HEAD, [^ref: *])))],
[m4_quote(__HEAD)])[]dnl
m4_undefine([__HEAD])dnl
])
# _AXEL_GIT_TAG(TAG)
# ---------------------------------------------------------------------
m4_define([_AXEL_GIT_TAG],
[m4_quote(_AXEL_READL([.git/refs/tags/$1]))])
# AXEL_VER_READ(FILE)
# ---------------------------------------------------------------------
AC_DEFUN_ONCE([AXEL_VER_READ],
[_AC_INIT_LITERAL([$1])
m4_define([_AXEL_RELSTR],
m4_quote(_AXEL_READL([$1], 1)))
m4_define([_AXEL_RELDATE],
m4_quote(
m4_bpatsubst(
m4_quote(
m4_bpatsubst(
m4_quote(_AXEL_RELSTR),
[[^ ]* ])), [ .*])))
m4_define([_AXEL_VERSION],
m4_quote(m4_bpatsubst(m4_quote(_AXEL_RELSTR), [ .*])))
m4_define([_AXEL_COMMIT], m4_quote(_AXEL_GIT_HEAD))
m4_define([_AXEL_VERSUF],
[m4_if(m4_quote(_AXEL_COMMIT),,,
[m4_if(m4_quote(_AXEL_COMMIT), m4_quote(_AXEL_GIT_TAG([v]_AXEL_VERSION)),,
[[+g]m4_quote(m4_substr(_AXEL_COMMIT, 0, 6))])])])
m4_define([AC_PACKAGE_STRING], m4_quote(AC_PACKAGE_NAME AC_PACKAGE_VERSION))
m4_define([AC_PACKAGE_VERSION], m4_quote(_AXEL_VERSION[]_AXEL_VERSUF))
])
# AXEL_PKG(PACKAGE-NAME, BUG-REPORT, [TAR-NAME])
# ---------------------------------------------------------------------
AC_DEFUN_ONCE([AXEL_PKG],
[_AC_INIT_LITERAL([$1])
_AC_INIT_LITERAL([$2])
AC_BEFORE([AXEL_VER_READ])
m4_define([AC_PACKAGE_NAME], [$1])
m4_define([AC_PACKAGE_TARNAME],
m4_default([$3], [m4_bpatsubst(m4_tolower([$1]),
[[^_abcdefghijklmnopqrstuvwxyz0123456789]],
[-])]))
m4_define([AC_PACKAGE_BUGREPORT], [$2])
])
# MKINSTALLDIRS isn't needed; remove
AC_DEFUN([AM_MKINSTALLDIRS], [])