This repository has been archived by the owner on Jan 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
aclocal.m4
107 lines (92 loc) · 3.15 KB
/
aclocal.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
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
dnl ------------------------
dnl icinga configure helpers
dnl ------------------------
AC_DEFUN([ACICINGA_USER_GUESS],[
$2=$3
for x in $1; do
AC_MSG_CHECKING([if user $x exists])
AS_IF([ $GREP -q "^$x:" /etc/passwd ],
[ AC_MSG_RESULT([found]); $2=$x ; break],
[ AC_MSG_RESULT([not found]) ])
done
])
AC_DEFUN([ACICINGA_CHECK_PHP_MODULE],[
for x in $1;do
AC_MSG_CHECKING([if php has $x module])
AS_IF([ php -m | $GREP -iq "^$x$" ],
[ AC_MSG_RESULT([found]) ],
[ AC_MSG_ERROR([not found])])
done
])
AC_DEFUN([ACICINGA_GROUP_GUESS],[
$2=$3
for x in $1; do
AC_MSG_CHECKING([if group $x exists])
AS_IF([ $GREP -q "^$x:" /etc/group ],
[ AC_MSG_RESULT([found]); $2=$x ; break],
[ AC_MSG_RESULT([not found]) ])
done
])
AC_DEFUN([ACICINGA_CHECK_BIN], [
AC_PATH_PROG([$1],[$2],[not found])
AS_IF([ test "XX${$1}" == "XXnot found" ],
[ AC_MSG_WARN([binary $2 not found in PATH]) ])
test "XX${$1}" == "XXnot found" && $1=""
])
AC_DEFUN([ACICINGA_RESOURCE_EXISTS], [
AC_MSG_CHECKING([if resource $2 exists])
AS_IF([ test -e $2 -a -r $2 ],
[ AC_MSG_RESULT([found]) ],
[ AC_MSG_WARN([not found]) ])
])
AC_DEFUN([ACICINGA_CHECK_API], [
AC_MSG_CHECKING([for IcingaApi])
AS_IF([ test -e $1/IcingaApi.php && $GREP -q "class IcingaApi" $1/IcingaApi.php ],
[ AC_MSG_RESULT([found]) ],
[ AC_MSG_ERROR([not found]) ])
])
AC_DEFUN([ACICINGA_EXTRACT_VERSION], [
$1=`echo "$PACKAGE_VERSION" | $SED 's/^\([[0-9]]\+\)\.\([[0-9]]\+\)\.\([[0-9]]\+\)\(\-\(.\+\)\)\?$/\1/g'`
$2=`echo "$PACKAGE_VERSION" | $SED 's/^\([[0-9]]\+\)\.\([[0-9]]\+\)\.\([[0-9]]\+\)\(\-\(.\+\)\)\?$/\2/g'`
$3=`echo "$PACKAGE_VERSION" | $SED 's/^\([[0-9]]\+\)\.\([[0-9]]\+\)\.\([[0-9]]\+\)\(\-\(.\+\)\)\?$/\3/g'`
$4=`echo "$PACKAGE_VERSION" | $SED 's/^\([[0-9]]\+\)\.\([[0-9]]\+\)\.\([[0-9]]\+\)\(\-\(.\+\)\)\?$/\5/g'`
])
AC_DEFUN([ACICINGA_REMOVE_BLOCK], [
$SED -e "/###BEGIN_$2###/,/###END_$2###/d" $1 > $1.tmp
mv $1.tmp $1
])
AC_DEFUN([ACICINGA_CLEANUP_APICONFIG], [
FILE="$2"
BLOCKS=`echo "CONNECTION_IDO CONNECTION_LIFESTATUS CONNECTION_FILE" | $SED "s/\s*$1//g"`
AC_MSG_NOTICE([Create api config in $FILE])
for T in $BLOCKS; do
ACICINGA_REMOVE_BLOCK([$FILE],[$T])
done
])
AC_DEFUN([ACICINGA_DEVEL_MODE], [
AC_MSG_CHECKING([for devel-mode])
AS_IF([ test "$devel_mode" == "yes" ], [
flag_caching="false"
dnl Setting this to true cause errors
dnl for parrallel requests
flag_debug="false"
AC_MSG_RESULT([YES ... debug=false, jscache=false (!!)])
], [ AC_MSG_RESULT([no (good)]) ])
])
AC_DEFUN([ACICINGA_PATH_GUESS], [
$2=$3
for x in $1; do
AC_MSG_CHECKING([if path $x exists])
AS_IF([test -d $x],
[AC_MSG_RESULT([found]); $2=$x; break],
[AC_MSG_RESULT([not found])]
)
done
])
AC_DEFUN([ACICINGA_ESCAPE_DBNAME], [
NEW=`echo $$1 | $SED 's/\[-\]+/_/g'`
AS_IF([test "$$1" == "$NEW" ],
[ AC_MSG_NOTICE([Database name correct: $NEW]) ],
[ AC_MSG_WARN([Database name changed to: $NEW]) ])
$1=$NEW
]);