-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure.in
184 lines (156 loc) · 4.79 KB
/
configure.in
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
dnl
dnl $Id: configure.in,v 1.22 2010/10/16 02:28:55 rader Exp $
dnl
#----------------------------------------
# boiler-plate...
AC_INIT(Makefile.in)
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM
AC_PREREQ(2.12)
CNAGIOS_VERSION=`cat VERSION`
AC_SUBST(CNAGIOS_VERSION)
nagios_default_prefix=/usr/local/nagios
AC_PATH_PROG(CC, cc, NOT_FOUND)
if test "$CC" = "NOT_FOUND"; then
AC_MSG_ERROR([can not continue: cc not found])
fi
#----------------------------------------
# embeded perl...
AC_PATH_PROG(PERL, perl, NOT_FOUND)
if test "$PERL" = "NOT_FOUND"; then
AC_MSG_ERROR([can not continue: perl not found])
fi
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
if test "$PERL_CFLAGS" = "NOT_FOUND"; then
AC_MSG_ERROR([can not determine perl cc flags])
fi
AC_SUBST(PERL_CFLAGS)
PERL_LIBS=`perl -MConfig -e 'print $Config{libs}'`
if test "$PERL_LIBS" = "NOT_FOUND"; then
AC_MSG_ERROR([can not determine perl libs])
fi
AC_SUBST(PERL_LIBS)
PERL_LDFLAGS=`perl -MExtUtils::Embed -e ldopts`
if test "$PERL_LDFLAGS" = "NOT_FOUND"; then
AC_MSG_ERROR([can not determine perl ld flags])
fi
AC_SUBST(PERL_LDFLAGS)
#----------------------------------------
# nagios etc...
if test -d "/etc/nagios"; then
NAGIOS_ETC_DIR=/etc/nagios
fi
if test -d "$nagios_default_prefix/etc"; then
NAGIOS_ETC_DIR=$nagios_default_prefix/etc
fi
if test -d "$prefix/etc"; then
NAGIOS_ETC_DIR=$prefix/etc
fi
AC_ARG_WITH(etc-dir,[
Cnagios Options:
--with-etc-dir=DIR use cnagios.pl, cnagiosrc and cnagios.help in DIR], NAGIOS_ETC_DIR=$withval)
echo "nagios etc dir... $NAGIOS_ETC_DIR"
if test "X $NAGIOS_ETC_DIR" = "X "; then
echo
echo "FATAL ERROR: Nagios etc directory not found"
echo "Try ./configure --with-etc-dir=/path/to/nagios/etc"
echo
exit
fi
AC_SUBST(NAGIOS_ETC_DIR)
#----------------------------------------
# nagios var...
if test -d "/var/nagios"; then
NAGIOS_VAR_DIR=/var/nagios
fi
if test -d "/var/log/nagios"; then
NAGIOS_VAR_DIR=/var/log/nagios
fi
if test -d "$nagios_default_prefix/var"; then
NAGIOS_VAR_DIR=$nagios_default_prefix/var
fi
if test -d "$prefix/var"; then
NAGIOS_VAR_DIR=$prefix/var
fi
AC_ARG_WITH(var-dir,[ --with-var-dir=DIR use status.dat status file in DIR], NAGIOS_VAR_DIR=$withval)
echo "nagios var dir... $NAGIOS_VAR_DIR"
if test "X $NAGIOS_VAR_DIR" = "X "; then
echo
echo "FATAL ERROR: Nagios var directory not found"
echo "Try ./configure --with-var-dir=/path/to/nagios/var"
echo
exit
fi
AC_SUBST(NAGIOS_VAR_DIR)
#----------------------------------------
# nagios status data file and it's format...
NAGIOS_STATUS_LOG="$NAGIOS_VAR_DIR/status.log"
NAGIOS_STATUS_DAT="$NAGIOS_VAR_DIR/status.dat"
NAGIOS_MAX_SUPPORTED_VERSION=4
if test -f "$NAGIOS_STATUS_LOG" ; then
NAGIOS_STATUS_DATA_FILE=$NAGIOS_STATUS_LOG
fi
if test -f "$NAGIOS_STATUS_DAT" ; then
NAGIOS_STATUS_DATA_FILE=$NAGIOS_STATUS_DAT
fi
if test -f "$NAGIOS_STATUS_LOG" && test -f "$NAGIOS_STATUS_DAT" ; then
echo
echo "WARNING: detected status.log and status.dat in $NAGIOS_VAR_DIR"
echo "WARNING: using $NAGIOS_STATUS_DAT"
echo
fi
AC_ARG_WITH(status-file,[ --with-status-file=FILE expect to find status file at FILE], DATA_FILE=$withval)
if test "X $DATA_FILE" != "X "; then
NAGIOS_STATUS_DATA_FILE=$DATA_FILE
fi
if test "X $NAGIOS_STATUS_DATA_FILE" = "X "; then
echo
echo "FATAL ERROR: failed to find status.dat or status.log in $NAGIOS_VAR_DIR"
echo "It appears you do not have a working Nagios installation."
echo
exit
fi
AC_ARG_WITH(nagios-data,[ --with-nagios-data=VER expect status file to be in VER data format], DATA_VER=$withval)
if test "X $DATA_VER" != "X "; then
NAGIOS_STATUS_DATA_VERSION=$DATA_VER
else
# autodetect...
NAGIOS_STATUS_DATA_VERSION=`head -20 $NAGIOS_STATUS_DATA_FILE | perl -ane '
BEGIN { $v='UNKNOWN'; }
if ( $_ =~ /Nagios 1.*? Status File/ ) { $v="1"; last; }
if ( $_ =~ /version=(\d+)/ ) { $v="$1"; last; }
END { print $v; }
'`
fi
if test "$NAGIOS_STATUS_DATA_VERSION" = "UNKNOWN" ; then
echo
echo "FATAL ERROR: failed to detect data version in $NAGIOS_STATUS_DATA_FILE"
echo "It appears you do not have a working Nagios installation."
echo
exit
fi
if test "$NAGIOS_STATUS_DATA_VERSION" -gt $NAGIOS_MAX_SUPPORTED_VERSION ; then
echo
echo "FATAL ERROR: unsupported data version: $NAGIOS_STATUS_DATA_VERSION"
echo "You are using a version of nagios that isn't currently supported"
echo
exit
fi
echo "nagios status file... $NAGIOS_STATUS_DATA_FILE"
echo "nagios data version... $NAGIOS_STATUS_DATA_VERSION"
AC_SUBST(NAGIOS_STATUS_DATA_FILE)
AC_SUBST(NAGIOS_STATUS_DATA_VERSION)
#----------------------------------------
# defines...
if test $build_vendor = "sun"; then
DEFINES="-DSUN"
fi
AC_SUBST(DEFINES)
#----------------------------------------
# autoconf subs...
AC_OUTPUT( \
Makefile \
cnagios.h
)
echo "./configure is done"
echo "next do \"make\""