File: configure.in

package info (click to toggle)
nagios-nrpe 2.5.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 584 kB
  • ctags: 132
  • sloc: sh: 3,044; ansic: 1,920; makefile: 114; perl: 37
file content (289 lines) | stat: -rw-r--r-- 8,440 bytes parent folder | download
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
dnl Process this -*-m4-*- file with autoconf to produce a configure script.

dnl Disable caching
define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)

AC_INIT(src/nrpe.c)
AC_CONFIG_HEADER(include/config.h)
AC_PREFIX_DEFAULT(/usr/local/nagios)

PKG_NAME=nrpe
PKG_VERSION="2.5.1"
PKG_HOME_URL="http://www.nagios.org/"
PKG_REL_DATE="04-09-2006"

dnl Figure out how to invoke "install" and what install options to use.
AC_PROG_INSTALL
AC_SUBST(INSTALL)

dnl What OS are we running?
AC_CANONICAL_HOST

dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(ctype.h dirent.h errno.h fcntl.h getopt.h grp.h inttypes.h netdb.h pwd.h signal.h stdint.h strings.h string.h syslog.h tcpd.h unistd.h arpa/inet.h netinet/in.h socket.h sys/types.h sys/time.h sys/resource.h sys/wait.h sys/socket.h sys/stat.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_TYPE_GETGROUPS

dnl Check lengths for later tests of u_int32_t and int32_t
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)

dnl Define u_int32_t if we don't have it already (Solaris, etc.)
AC_CHECK_TYPE(uint32_t,unsigned int)
AC_CHECK_TYPE(u_int32_t,unsigned int)
if test "$ac_cv_type_u_int32_t" = no ; then
	if test "$ac_cv_type_u_int32_t" = yes ; then
		AC_DEFINE(U_INT32_T_IS_UINT32_T)
	else
		if test "$ac_cv_sizeof_int" = 4 ; then
			AC_DEFINE(U_INT32_T_IS_UINT)
		else
			if test "$ac_cv_sizeof_long" = 4 ; then
				AC_DEFINE(U_INT32_T_IS_ULONG)
			else
				if test "$ac_cv_sizeof_short" = 4 ; then
					AC_DEFINE(U_INT32_T_IS_USHORT)
				fi
			fi
		fi
	fi
fi

dnl Define int32_t if we don't have it already
AC_CHECK_TYPE(int32_t,int)
if test "$ac_cv_type_int32_t" = no ; then
	if test "$ac_cv_sizeof_int" = 4 ; then
		AC_DEFINE(INT32_T_IS_UINT)
	else
		if test "$ac_cv_sizeof_long" = 4 ; then
			AC_DEFINE(INT32_T_IS_ULONG)
		else
			if test "$ac_cv_sizeof_short" = 4 ; then
				AC_DEFINE(INT32_T_IS_USHORT)
			fi
		fi
	fi
fi


dnl Check for getopt_long (Solaris)
AC_CHECK_FUNCS([getopt_long],,AC_CHECK_LIB([iberty],[getopt_long],OTHERLIBS="$OTHERLIBS -liberty"))
AC_SUBST(OTHERLIBS)

dnl Checks for library functions.
AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
AC_SUBST(SOCKETLIBS)
AC_CHECK_LIB(wrap,main,[
	LIBWRAPLIBS="$LIBWRAPLIBS -lwrap"
	AC_DEFINE(HAVE_LIBWRAP)
	])
AC_SUBST(LIBWRAPLIBS)
AC_CHECK_FUNCS(strdup strstr strtoul initgroups)

dnl socklen_t check - from curl
AC_CHECK_TYPE([socklen_t], ,[
       AC_MSG_CHECKING([for socklen_t equivalent])
       AC_CACHE_VAL([curl_cv_socklen_t_equiv],
       [
          # Systems have either "struct sockaddr *" or
          # "void *" as the second argument to getpeername
          curl_cv_socklen_t_equiv=
          for arg2 in "struct sockaddr" void; do
             for t in int size_t unsigned long "unsigned long"; do
                AC_TRY_COMPILE([
                   #ifdef HAVE_SYS_TYPES_H
                   #include <sys/types.h>
                   #endif 
                   #ifdef HAVE_SYS_SOCKET_H
                   #include <sys/socket.h>
                   #endif
                   
                   int getpeername (int, $arg2 *, $t *);
                ],[
                   $t len;
                   getpeername(0,0,&len);
                ],[
                   curl_cv_socklen_t_equiv="$t"
                   break
                ])
             done
          done
 
          if test "x$curl_cv_socklen_t_equiv" = x; then
             AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
          fi
       ])
       AC_MSG_RESULT($curl_cv_socklen_t_equiv)
       AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
                         [type to use in place of socklen_t if not defined])],
       [#include <sys/types.h>
#include <sys/socket.h>])


AC_MSG_CHECKING(for type of socket size)
AC_TRY_COMPILE([#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
],
[int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);],
[AC_DEFINE(SOCKET_SIZE_TYPE, size_t) AC_MSG_RESULT(size_t)],
[AC_DEFINE(SOCKET_SIZE_TYPE, int) AC_MSG_RESULT(int)])

dnl Stolen from Python code: loewis@users.sourceforge.net
#AC_CHECK_TYPE(socklen_t,int,
#	AC_DEFINE(socklen_t,int,
#	Define to `int' if <sys/socket.h> does not define.),[
#	#ifdef HAVE_SYS_TYPES_H
#	#include <sys/types.h>
#	#endif
#	#ifdef HAVE_SYS_SOCKET_H
#	#include <sys/socket.h>
#	#endif
#	])

dnl Does user want to check for SSL?
AC_ARG_ENABLE(ssl,--enable-ssl enables native SSL support,[
	if test x$enableval = xyes; then
		check_for_ssl=yes
	else
		check_for_ssl=no
	fi
	],check_for_ssl=yes)

dnl Optional SSL library and include paths
ssl_lib_dir=
ssl_inc_dir=
AC_ARG_WITH(ssl-lib,--with-ssl-lib=DIR sets location of the SSL library,[
	ssl_lib_dir=$withval
	])
AC_ARG_WITH(ssl-inc,--with-ssl-inc=DIR sets location of the SSL include files,[
	ssl_inc_dir=$withval
	])
AC_ARG_WITH(kerberos-inc,--with-kerberos-inc=DIR sets location of the Kerberos include files,[
	kerberos_inc_dir=$withval
	])

dnl Check for SSL support
dnl Modified version of Mark Ethan Trostler's macro <trostler@juniper.net>
if test x$check_for_ssl = xyes; then
	AC_MSG_CHECKING(for SSL)
	found_ssl=no
	for dir in $ssl_inc_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl; do
		ssldir="$dir"
		if test -f "$dir/include/openssl/ssl.h"; then
			found_ssl=yes
			CFLAGS="$CFLAGS -I$ssldir/include/openssl -I$ssldir/include"
		        break
		fi
		if test -f "$dir/include/ssl.h"; then
			found_ssl=yes
			CFLAGS="$CFLAGS -I$ssldir/include"
		        break
		fi
	done

	if test x_$found_ssl != x_yes; then
        	AC_MSG_ERROR(Cannot find ssl libraries)
	else
	        printf "SSL found in $ssldir\n";
	        LIBS="$LIBS -lssl -lcrypto";
		if test x$ssl_lib_dir != x; then
	        	LDFLAGS="$LDFLAGS -L$ssl_lib_dir";
		else 
	        	LDFLAGS="$LDFLAGS -L$ssldir/lib";
		fi
		AC_DEFINE_UNQUOTED(HAVE_SSL)
		AC_SUBST(HAVE_SSL)
		
		dnl Generate DH parameters
		echo ""
		echo "*** Generating DH Parameters for SSL/TLS ***"
		if test -f "$ssldir/sbin/openssl"; then
			sslbin=$ssldir/sbin/openssl
		else
			sslbin=$ssldir/bin/openssl
		fi
		# awk to strip off meta data at bottom of dhparam output
		$sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h
	fi

	dnl RedHat 8.0 and 9.0 include openssl compiled with kerberos, so we must include header file
	AC_MSG_CHECKING(for Kerberos include files)
	found_kerberos=no
	for dir in $kerberos_inc_dir /usr/kerberos/include; do
		kerbdir="$dir"
		if test -f "$dir/krb5.h"; then
			found_kerberos=yes
			CFLAGS="$CFLAGS -I$kerbdir"
			AC_DEFINE_UNQUOTED(HAVE_KRB5_H)
			dnl AC_CHECK_HEADERS(krb5.h)
			break
		fi
	done

	if test x_$found_kerberos != x_yes; then
		printf "could not find include files\n";
	else
		printf "found Kerberos include files in $kerbdir\n";
	fi
	

fi

AC_ARG_WITH(nrpe_user,--with-nrpe-user=<user> sets user name to run NRPE,nrpe_user=$withval,nrpe_user=nagios)
AC_ARG_WITH(nrpe_group,--with-nrpe-group=<group> sets group name to run NRPE,nrpe_grp=$withval,nrpe_grp=nagios)
AC_ARG_WITH(nrpe_port,--with-nrpe-port=<port> sets port number for NRPE to listen on,nrpe_port=$withval,nrpe_port=5666)
AC_SUBST(nrpe_user)
AC_SUBST(nrpe_grp)
AC_SUBST(nrpe_port)
AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$nrpe_port)

AC_ARG_ENABLE(command-args,--enable-command-args allows clients to specify command arguments.  *** THIS IS A SECURITY RISK! *** Read the SECURITY file before using this option!,AC_DEFINE_UNQUOTED(ENABLE_COMMAND_ARGUMENTS))


AC_PATH_PROG(PERL,perl)
AC_OUTPUT(Makefile src/Makefile subst)

perl subst init-script
perl subst init-script.debian
perl subst init-script.suse
perl subst sample-config/nrpe.cfg
perl subst sample-config/nrpe.xinetd


dnl Review options
echo ""
echo ""
AC_MSG_RESULT([*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:])

echo ""
echo " General Options:"
echo " -------------------------"

AC_MSG_RESULT([ NRPE port:  $nrpe_port])
AC_MSG_RESULT([ NRPE user:  $nrpe_user])
AC_MSG_RESULT([ NRPE group: $nrpe_grp])


echo ""
echo ""
echo "Review the options above for accuracy.  If they look okay,"
echo "type 'make all' to compile the NRPE daemon and client."
echo ""