File: mm-pkg.m4

package info (click to toggle)
mm-common 0.9.7-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,840 kB
  • ctags: 44
  • sloc: sh: 603; perl: 235; makefile: 193; cpp: 26; xml: 2
file content (123 lines) | stat: -rw-r--r-- 3,967 bytes parent folder | download | duplicates (7)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
## Copyright (c) 2009  Openismus GmbH  <http://www.openismus.com/>
##
## This file is part of mm-common.
##
## mm-common is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation, either version 2 of the License,
## or (at your option) any later version.
##
## mm-common is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with mm-common.  If not, see <http://www.gnu.org/licenses/>.

#serial 20090822

## _MM_CHECK_GNU_MAKE
##
## Implementation of MM_CHECK_GNU_MAKE.
##
m4_define([_MM_CHECK_GNU_MAKE],
[dnl
AC_PROVIDE([$0])[]dnl
AC_MSG_CHECKING([whether [$]{MAKE-make} supports GNU make features])
cat >conftest.make <<'_MMEOF'
override reverse = [$](2)[$](subst ,, )[$](1)
override result := [$](word 2,[$](call reverse,success,failure))
all: ; test '[$](result)' = success
.PHONY: all
_MMEOF
AS_IF([[$]{MAKE-make} -f conftest.make >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD],
      [mm_gnu_make=yes], [mm_gnu_make=no])
rm -f conftest.make
AC_MSG_RESULT([$mm_gnu_make])
AS_IF([test "x$mm_gnu_make" != xyes],
      [AC_MSG_FAILURE([[The GNU make program is required to build $PACKAGE_NAME.]])])[]dnl
])

## MM_CHECK_GNU_MAKE
##
## Check whether the installed make program supports GNU make features.
## If the test fails, display an error message and abort.
##
AC_DEFUN([MM_CHECK_GNU_MAKE],
[dnl
AC_REQUIRE([_MM_PRE_INIT])[]dnl
AC_REQUIRE([_MM_CHECK_GNU_MAKE])[]dnl
])

## _MM_PATH_PERL
##
## Internal helper macro for MM_PATH_PERL.
##
m4_define([_MM_PATH_PERL],
[dnl
AC_PROVIDE([$0])[]dnl
AC_ARG_VAR([PERL], [path to Perl interpreter])[]dnl
AC_PATH_PROG([PERL], [perl], [perl])[]dnl
])

## MM_PATH_PERL
##
## Locate the Perl interpreter and set the substitution variable PERL
## to the full path to the perl executable if found, or to 'perl' if
## not found.  Also call AC_ARG_VAR() on the PERL variable.
##
AC_DEFUN([MM_PATH_PERL],
[dnl
AC_REQUIRE([_MM_PRE_INIT])[]dnl
AC_REQUIRE([_MM_PATH_PERL])[]dnl
])

## _MM_CHECK_PERL(min-version, [action-if-found], [action-if-not-found])
##
## Internal helper macro for MM_CHECK_PERL.
##
m4_define([_MM_CHECK_PERL],
[dnl
AS_IF([$PERL -e "require v$1; exit 0;" >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD],
      [$2], m4_ifval([$2$3], [[$3]],
            [[AC_MSG_FAILURE([[At least Perl ]$1[ is required to build $PACKAGE_NAME.]])]]))[]dnl
])

## MM_CHECK_PERL([min-version], [action-if-found], [action-if-not-found])
##
## Run MM_PATH_PERL and then check whether the Perl interpreter can be
## executed and whether it meets the version requirement of <min-version>
## or later.  Execute <action-if-found> on success, otherwise execute
## <action-if-not-found>.  The default value of <min-version> is 5.6.0
## if the argument is empty.
##
AC_DEFUN([MM_CHECK_PERL],
[dnl
AC_REQUIRE([_MM_PRE_INIT])[]dnl
AC_REQUIRE([_MM_PATH_PERL])[]dnl
_MM_CHECK_PERL(m4_ifval([$1], [[$1]], [[5.6.0]]), [$2], [$3])[]dnl
])

## MM_PKG_CONFIG_SUBST(variable, arguments, [action-if-found], [action-if-not-found])
##
## Run the pkg-config utility with the specified command-line <arguments>
## and capture its standard output in the named shell <variable>.  If the
## command exited successfully, execute <action-if-found> in the shell if
## specified.  If the command failed, run <action-if-not-found> if given,
## otherwise ignore the error.
##
AC_DEFUN([MM_PKG_CONFIG_SUBST],
[dnl
m4_assert([$# >= 2])[]dnl
AC_REQUIRE([_MM_PRE_INIT])[]dnl
AC_REQUIRE([PKG_PROG_PKG_CONFIG])[]dnl
AC_MSG_CHECKING([for $1])
dnl
AS_IF([test -z "[$]{$1+set}"],
      [$1=`$PKG_CONFIG $2 2>&AS_MESSAGE_LOG_FD`
       AS_IF([test "[$]?" -eq 0], [$3], [$4])])
dnl
AC_MSG_RESULT([[$]$1])
AC_SUBST([$1])[]dnl
])