Browse Source

Added support for generating Solaris package.

Eric Stanley 14 years ago
parent
commit
ad8a0f9323

+ 9 - 0
Makefile.in

@@ -62,13 +62,22 @@ install-daemon-config:
 	$(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)
 	$(INSTALL) -m 644 $(NRPE_INSTALL_OPTS) sample-config/nrpe.cfg $(DESTDIR)$(CFGDIR)
 
+solaris-package:
+	@if [ `uname -s` != "SunOS" ] ; then \
+		echo "It is recommended you be running on Solaris to build a Solaris package"; \
+	else \
+		cd package/solaris; $(MAKE) build ; $(MAKE) pkg ; cd ../..; \
+	fi
+
 clean:
 	cd $(SRC_BASE); $(MAKE) $@ ; cd ..
+	cd package/solaris; $(MAKE) $@ ; cd ../..
 	rm -f core
 	rm -f *~ */*~
 
 distclean: clean
 	cd $(SRC_BASE); $(MAKE) $@ ; cd ..
+	cd package/solaris; $(MAKE) $@ ; cd ../..
 	rm -f config.log config.status config.cache nrpe.cfg nrpe.xinetd subst $(SRC_INCLUDE)/config.h init-script init-script.debian init-script.freebsd init-script.suse
 	rm -f sample-config/*.cfg sample-config/*.xinetd
 	rm -f Makefile

+ 18 - 0
README.Solaris

@@ -0,0 +1,18 @@
+Compiling on Solaris
+
+Several changes may be necessary in order to compile NRPE on Solaris.
+This information is known to apply to Solaris 10 and may apply to other 
+verisions of Solaris. This has been tested on Solaris 10 x86.
+
+There are three things that you may need to compile NRPE on Solaris:
+
+	1. Add /usr/sfw/bin to your path
+		$ PATH="$PATH:/usr/sfw/bin"
+	2. Specify the binary to be used for make-ing
+		$ MAKE=gmake ./configure
+	3. Use gmake to build the code
+		$ gmake all
+
+Thanks to Kevin Pendleton at UtahSysAdmin.com 
+(http://www.utahsysadmin.com/2008/03/14/configuring-nagios-plugins-nrpe-on-solaris-10/)
+for the instructions on finding the SSL libraries.

+ 77 - 31
configure

@@ -1,6 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59.
+# Generated by GNU Autoconf 2.59 for nrpe 2.13.
+#
+# Report bugs to <nagios-users@lists.sourceforge.net>.
 #
 # Copyright (C) 2003 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
@@ -265,11 +267,11 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 : ${ac_max_here_lines=38}
 
 # Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
+PACKAGE_NAME='nrpe'
+PACKAGE_TARNAME='nrpe'
+PACKAGE_VERSION='2.13'
+PACKAGE_STRING='nrpe 2.13'
+PACKAGE_BUGREPORT='nagios-users@lists.sourceforge.net'
 
 ac_unique_file="src/nrpe.c"
 ac_default_prefix=/usr/local/nagios
@@ -310,7 +312,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PKG_NAME PKG_VERSION PKG_HOME_URL PKG_REL_DATE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE CPP EGREP SNPRINTF_O OTHERLIBS SOCKETLIBS LIBWRAPLIBS HAVE_SSL log_facility nrpe_user nrpe_group NRPE_INSTALL_OPTS nrpe_port nagios_user nagios_group NAGIOS_INSTALL_OPTS TARGET_VER TARGET_OS TARGET_ARCH PERL LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PKG_NAME PKG_VERSION PKG_HOME_URL PKG_REL_DATE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE CPP EGREP SNPRINTF_O OTHERLIBS SOCKETLIBS LIBWRAPLIBS HAVE_SSL log_facility nrpe_user nrpe_group NRPE_INSTALL_OPTS nrpe_port nagios_user nagios_group NAGIOS_INSTALL_OPTS TARGET_VER TARGET_OS TARGET_ARCH TARGET_PLATFORM PERL LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -779,7 +781,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
+\`configure' configures nrpe 2.13 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -839,7 +841,9 @@ _ACEOF
 fi
 
 if test -n "$ac_init_help"; then
-
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of nrpe 2.13:";;
+   esac
   cat <<\_ACEOF
 
 Optional Features:
@@ -874,6 +878,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
+Report bugs to <nagios-users@lists.sourceforge.net>.
 _ACEOF
 fi
 
@@ -969,6 +974,8 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
+nrpe configure 2.13
+generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -981,7 +988,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by $as_me, which was
+It was created by nrpe $as_me 2.13, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1285,6 +1292,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1295,6 +1311,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
           ac_config_headers="$ac_config_headers include/config.h"
 
+                                                                                          ac_config_files="$ac_config_files Makefile subst src/Makefile package/solaris/Makefile init-script init-script.debian init-script.suse sample-config/nrpe.cfg sample-config/nrpe.xinetd"
+
 
 
 PKG_NAME=nrpe
@@ -3198,9 +3216,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists.  ##
-## ------------------------------------------ ##
+## ------------------------------------------------- ##
+## Report this to nagios-users@lists.sourceforge.net ##
+## ------------------------------------------------- ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -5167,25 +5185,29 @@ fi
 
 if test "$ac_cv_type_u_int32_t" = no ; then
 	if test "$ac_cv_type_u_int32_t" = yes ; then
-		cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define U_INT32_T_IS_UINT32_T 1
 _ACEOF
 
 	else
 		if test "$ac_cv_sizeof_int" = 4 ; then
-			cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define U_INT32_T_IS_UINT 1
 _ACEOF
 
 		else
 			if test "$ac_cv_sizeof_long" = 4 ; then
-				cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define U_INT32_T_IS_ULONG 1
 _ACEOF
 
 			else
 				if test "$ac_cv_sizeof_short" = 4 ; then
-					cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define U_INT32_T_IS_USHORT 1
 _ACEOF
 
@@ -5263,19 +5285,22 @@ fi
 
 if test "$ac_cv_type_int32_t" = no ; then
 	if test "$ac_cv_sizeof_int" = 4 ; then
-		cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define INT32_T_IS_UINT 1
 _ACEOF
 
 	else
 		if test "$ac_cv_sizeof_long" = 4 ; then
-			cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define INT32_T_IS_ULONG 1
 _ACEOF
 
 		else
 			if test "$ac_cv_sizeof_short" = 4 ; then
-				cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define INT32_T_IS_USHORT 1
 _ACEOF
 
@@ -6238,7 +6263,8 @@ echo "${ECHO_T}$ac_cv_lib_wrap_main" >&6
 if test $ac_cv_lib_wrap_main = yes; then
 
 	LIBWRAPLIBS="$LIBWRAPLIBS -lwrap"
-	cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_LIBWRAP 1
 _ACEOF
 
@@ -6549,7 +6575,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define SOCKET_SIZE_TYPE size_t
 _ACEOF
  echo "$as_me:$LINENO: result: size_t" >&5
@@ -6558,6 +6585,7 @@ else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 cat >>confdefs.h <<\_ACEOF
 #define SOCKET_SIZE_TYPE int
 _ACEOF
@@ -6631,7 +6659,7 @@ if test x$check_for_ssl = xyes; then
 	echo "$as_me:$LINENO: checking for SSL headers" >&5
 echo $ECHO_N "checking for SSL headers... $ECHO_C" >&6
 	found_ssl=no
-	for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl; do
+	for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl /usr/sfw/include; do
 		ssldir="$dir"
 		if test -f "$dir/include/openssl/ssl.h"; then
 			found_ssl=yes
@@ -6672,7 +6700,7 @@ echo "$as_me: error: Cannot find ssl headers" >&2;}
 				echo "$as_me:$LINENO: checking for SSL libraries" >&5
 echo $ECHO_N "checking for SSL libraries... $ECHO_C" >&6
 		found_ssl=no
-		for dir in $ssl_lib_dir $ssl_dir /usr/lib64 /usr/lib /usr/local/lib /usr/lib/ssl /usr/ssl/lib /usr/openssl/lib /usr/pkg/lib  /usr/freeware/lib/openssl; do
+		for dir in $ssl_lib_dir $ssl_dir /usr/lib64 /usr/lib /usr/local/lib /usr/lib/ssl /usr/ssl/lib /usr/openssl/lib /usr/pkg/lib  /usr/freeware/lib/openssl /usr/sfw/lib; do
 			ssllibdir="$dir"
 			if test -f "$dir/libssl.so"; then
 				found_ssl=yes
@@ -6690,7 +6718,8 @@ echo "$as_me: error: Cannot find ssl libraries" >&2;}
 			LDFLAGS="$LDFLAGS -L$ssllibdir";
 		        LIBS="$LIBS -lssl -lcrypto";
 
-			cat >>confdefs.h <<_ACEOF
+
+cat >>confdefs.h <<_ACEOF
 #define HAVE_SSL 1
 _ACEOF
 
@@ -6716,7 +6745,8 @@ echo $ECHO_N "checking for Kerberos include files... $ECHO_C" >&6
 		if test -f "$dir/krb5.h"; then
 			found_kerberos=yes
 			CFLAGS="$CFLAGS -I$kerbdir"
-			cat >>confdefs.h <<_ACEOF
+
+cat >>confdefs.h <<_ACEOF
 #define HAVE_KRB5_H 1
 _ACEOF
 
@@ -6742,6 +6772,7 @@ else
   log_facility=daemon
 fi;
 
+
 cat >>confdefs.h <<_ACEOF
 #define NRPE_LOG_FACILITY "$log_facility"
 _ACEOF
@@ -6776,6 +6807,7 @@ fi;
 NRPE_INSTALL_OPTS="-o $nrpe_user -g $nrpe_group"
 
 
+
 cat >>confdefs.h <<_ACEOF
 #define DEFAULT_SERVER_PORT $nrpe_port
 _ACEOF
@@ -6821,11 +6853,19 @@ else
 	TARGET_ARCH=$target_cpu
 fi
 
+TARGET_PLATFORM=""
+if test "x$TARGET_OS" = "xSunOS" ; then
+	if test "x$TARGET_VER" = "x5.10" ; then
+		TARGET_PLATFORM="sol10"
+	fi
+fi
+
 
 # Check whether --enable-command-args or --disable-command-args was given.
 if test "${enable_command_args+set}" = set; then
   enableval="$enable_command_args"
-  cat >>confdefs.h <<_ACEOF
+
+cat >>confdefs.h <<_ACEOF
 #define ENABLE_COMMAND_ARGUMENTS 1
 _ACEOF
 
@@ -6871,7 +6911,6 @@ else
 echo "${ECHO_T}no" >&6
 fi
 
-                              ac_config_files="$ac_config_files Makefile src/Makefile subst"
 
 
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
@@ -7181,7 +7220,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by $as_me, which was
+This file was extended by nrpe $as_me 2.13, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7241,7 +7280,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-config.status
+nrpe config.status 2.13
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -7345,8 +7384,14 @@ do
   case "$ac_config_target" in
   # Handling of arguments.
   "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
   "subst" ) CONFIG_FILES="$CONFIG_FILES subst" ;;
+  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+  "package/solaris/Makefile" ) CONFIG_FILES="$CONFIG_FILES package/solaris/Makefile" ;;
+  "init-script" ) CONFIG_FILES="$CONFIG_FILES init-script" ;;
+  "init-script.debian" ) CONFIG_FILES="$CONFIG_FILES init-script.debian" ;;
+  "init-script.suse" ) CONFIG_FILES="$CONFIG_FILES init-script.suse" ;;
+  "sample-config/nrpe.cfg" ) CONFIG_FILES="$CONFIG_FILES sample-config/nrpe.cfg" ;;
+  "sample-config/nrpe.xinetd" ) CONFIG_FILES="$CONFIG_FILES sample-config/nrpe.xinetd" ;;
   "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -7474,6 +7519,7 @@ s,@NAGIOS_INSTALL_OPTS@,$NAGIOS_INSTALL_OPTS,;t t
 s,@TARGET_VER@,$TARGET_VER,;t t
 s,@TARGET_OS@,$TARGET_OS,;t t
 s,@TARGET_ARCH@,$TARGET_ARCH,;t t
+s,@TARGET_PLATFORM@,$TARGET_PLATFORM,;t t
 s,@PERL@,$PERL,;t t
 s,@LIBOBJS@,$LIBOBJS,;t t
 s,@LTLIBOBJS@,$LTLIBOBJS,;t t

+ 37 - 20
configure.in

@@ -4,8 +4,18 @@ dnl Disable caching
 define([AC_CACHE_LOAD],)
 define([AC_CACHE_SAVE],)
 
-AC_INIT(src/nrpe.c)
-AC_CONFIG_HEADER(include/config.h)
+AC_INIT([nrpe],[2.13],[nagios-users@lists.sourceforge.net],[nrpe],[http://www.nagios.org])
+AC_CONFIG_SRCDIR([src/nrpe.c])
+AC_CONFIG_HEADERS([include/config.h])
+AC_CONFIG_FILES([Makefile
+	subst
+	src/Makefile
+	package/solaris/Makefile
+	init-script
+	init-script.debian
+	init-script.suse
+	sample-config/nrpe.cfg
+	sample-config/nrpe.xinetd])
 AC_PREFIX_DEFAULT(/usr/local/nagios)
 
 PKG_NAME=nrpe
@@ -53,16 +63,16 @@ 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)
+		AC_DEFINE(U_INT32_T_IS_UINT32_T,[1],[u_int32_t is uint32_t])
 	else
 		if test "$ac_cv_sizeof_int" = 4 ; then
-			AC_DEFINE(U_INT32_T_IS_UINT)
+			AC_DEFINE(U_INT32_T_IS_UINT,[1],[u_int32_t is uint])
 		else
 			if test "$ac_cv_sizeof_long" = 4 ; then
-				AC_DEFINE(U_INT32_T_IS_ULONG)
+				AC_DEFINE(U_INT32_T_IS_ULONG,[1],[u_int32_t is ulong])
 			else
 				if test "$ac_cv_sizeof_short" = 4 ; then
-					AC_DEFINE(U_INT32_T_IS_USHORT)
+					AC_DEFINE(U_INT32_T_IS_USHORT,[1],[u_int32_t is ushort])
 				fi
 			fi
 		fi
@@ -73,13 +83,13 @@ 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)
+		AC_DEFINE(INT32_T_IS_UINT,[1],[int32_t is uint])
 	else
 		if test "$ac_cv_sizeof_long" = 4 ; then
-			AC_DEFINE(INT32_T_IS_ULONG)
+			AC_DEFINE(INT32_T_IS_ULONG,[1],[int32_t is ulong])
 		else
 			if test "$ac_cv_sizeof_short" = 4 ; then
-				AC_DEFINE(INT32_T_IS_USHORT)
+				AC_DEFINE(INT32_T_IS_USHORT,[1],[int32_t is ushort])
 			fi
 		fi
 	fi
@@ -153,7 +163,7 @@ AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
 AC_SUBST(SOCKETLIBS)
 AC_CHECK_LIB(wrap,main,[
 	LIBWRAPLIBS="$LIBWRAPLIBS -lwrap"
-	AC_DEFINE(HAVE_LIBWRAP)
+	AC_DEFINE(HAVE_LIBWRAP,[1],[Have the TCP wrappers library])
 	])
 AC_SUBST(LIBWRAPLIBS)
 AC_CHECK_FUNCS(strdup strstr strtoul initgroups closesocket)
@@ -204,8 +214,8 @@ AC_TRY_COMPILE([#include <stdlib.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)])
+[AC_DEFINE(SOCKET_SIZE_TYPE, size_t, [Socket Size Type]) AC_MSG_RESULT(size_t)],
+[AC_DEFINE(SOCKET_SIZE_TYPE, int, [Socket Size Type]) AC_MSG_RESULT(int)])
 
 dnl Stolen from Python code: loewis@users.sourceforge.net
 #AC_CHECK_TYPE(socklen_t,int,
@@ -250,7 +260,7 @@ 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 headers)
 	found_ssl=no
-	for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl; do
+	for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl /usr/sfw/include; do
 		ssldir="$dir"
 		if test -f "$dir/include/openssl/ssl.h"; then
 			found_ssl=yes
@@ -289,7 +299,7 @@ if test x$check_for_ssl = xyes; then
 		dnl Now try and find SSL libraries
 		AC_MSG_CHECKING(for SSL libraries)
 		found_ssl=no
-		for dir in $ssl_lib_dir $ssl_dir /usr/lib64 /usr/lib /usr/local/lib /usr/lib/ssl /usr/ssl/lib /usr/openssl/lib /usr/pkg/lib  /usr/freeware/lib/openssl; do
+		for dir in $ssl_lib_dir $ssl_dir /usr/lib64 /usr/lib /usr/local/lib /usr/lib/ssl /usr/ssl/lib /usr/openssl/lib /usr/pkg/lib  /usr/freeware/lib/openssl /usr/sfw/lib; do
 			ssllibdir="$dir"
 			if test -f "$dir/libssl.so"; then
 				found_ssl=yes
@@ -305,7 +315,7 @@ if test x$check_for_ssl = xyes; then
 			LDFLAGS="$LDFLAGS -L$ssllibdir";
 		        LIBS="$LIBS -lssl -lcrypto";
 
-			AC_DEFINE_UNQUOTED(HAVE_SSL)
+			AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support])
 			AC_SUBST(HAVE_SSL)
 	
 			dnl Generate DH parameters
@@ -329,7 +339,7 @@ if test x$check_for_ssl = xyes; then
 		if test -f "$dir/krb5.h"; then
 			found_kerberos=yes
 			CFLAGS="$CFLAGS -I$kerbdir"
-			AC_DEFINE_UNQUOTED(HAVE_KRB5_H)
+			AC_DEFINE_UNQUOTED(HAVE_KRB5_H,[1],[Have the krb5.h header file])
 			dnl AC_CHECK_HEADERS(krb5.h)
 			break
 		fi
@@ -346,7 +356,7 @@ fi
 
 AC_ARG_WITH(log_facility,--with-log-facility=<facility> sets NRPE syslog facility,log_facility=$withval,log_facility=daemon)
 AC_SUBST(log_facility)
-AC_DEFINE_UNQUOTED(NRPE_LOG_FACILITY,["$log_facility"])
+AC_DEFINE_UNQUOTED(NRPE_LOG_FACILITY,["$log_facility"],[NRPE syslog facility])
 
 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_group=$withval,nrpe_group=nagios)
@@ -356,7 +366,7 @@ AC_SUBST(nrpe_group)
 NRPE_INSTALL_OPTS="-o $nrpe_user -g $nrpe_group"
 AC_SUBST(NRPE_INSTALL_OPTS)
 AC_SUBST(nrpe_port)
-AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$nrpe_port)
+AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$nrpe_port,[Default port for NRPE daemon])
 
 AC_ARG_WITH(nagios_user,--with-nagios-user=<user> sets user name for file permissions,nagios_user=$withval,nagios_user=nagios)
 AC_ARG_WITH(nagios_group,--with-nagios-group=<grp> sets group name file permissions,nagios_group=$withval,nagios_group=nagios)
@@ -384,12 +394,19 @@ else
 	TARGET_ARCH=$target_cpu
 fi
 AC_SUBST(TARGET_ARCH)
+TARGET_PLATFORM=""
+if test "x$TARGET_OS" = "xSunOS" ; then
+	if test "x$TARGET_VER" = "x5.10" ; then
+		TARGET_PLATFORM="sol10"
+	fi
+fi
+AC_SUBST(TARGET_PLATFORM)
 
-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_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,[1],[Enable command-line arguments]))
 
 
 AC_PATH_PROG(PERL,perl)
-AC_OUTPUT(Makefile src/Makefile subst)
+AC_OUTPUT()
 
 perl subst init-script
 perl subst init-script.debian

+ 81 - 0
package/solaris/Makefile.in

@@ -0,0 +1,81 @@
+###################################
+# Makefile for NRPE Solaris Package
+#
+# Last Modified: 2 Dec 2011
+###################################
+
+TARGET_OS=@TARGET_OS@
+TARGET_VER=@TARGET_VER@
+TARGET_ARCH=@TARGET_ARCH@
+TARGET_PLATFORM=@TARGET_PLATFORM@
+
+SOLARIS_CONFIG_OPTS=--prefix=/opt/nagios --sysconfdir=/etc/nagios
+
+PKG_NAME=NGOSnrpe
+PKG_VERSION=@PKG_VERSION@
+PKG_FILE=@PACKAGE_NAME@-$(PKG_VERSION)-$(TARGET_PLATFORM)-$(TARGET_ARCH)-local
+
+TOPDIR=@top_builddir@
+PKGDIR=@builddir@/pkg
+SRCDIR=@builddir@/build/src
+INSTALLDIR=@builddir@/install
+ABSINSTALLDIR=@abs_builddir@/install
+
+build:
+	if [ ! -d build ] ; then mkdir build ; fi
+	if [ ! -d install ] ; then mkdir install ; fi
+	cd build; ../../../configure $(SOLARIS_CONFIG_OPTS); make all; DESTDIR=$(ABSINSTALLDIR) make install install-daemon-config
+
+prototype: $(PKGDIR)
+	@echo "i pkginfo" > $(PKGDIR)/prototype
+	@echo "i copyright=../$(TOPDIR)/LEGAL" >> $(PKGDIR)/prototype
+	@echo "i preinstall" >> $(PKGDIR)/prototype
+	@echo "i i.config" >> $(PKGDIR)/prototype
+	@echo "i r.config" >> $(PKGDIR)/prototype
+	@echo "i i.manifest=/usr/sadm/install/scripts/i.manifest" >> $(PKGDIR)/prototype
+	@echo "i r.manifest=/usr/sadm/install/scripts/r.manifest" >> $(PKGDIR)/prototype
+	@echo "d none /etc/nagios 0755 nagios nagios" >> $(PKGDIR)/prototype
+	@echo "f config /etc/nagios/nrpe.cfg=$(INSTALLDIR)/etc/nagios/nrpe.cfg 0600 nagios nagios" >> $(PKGDIR)/prototype
+	@echo "d none /opt/nagios/bin 0755 nagios bin" >> $(PKGDIR)/prototype
+	@echo "f none /opt/nagios/bin/nrpe=$(SRCDIR)/nrpe 0755 nagios bin" >> $(PKGDIR)/prototype
+	@echo "d none /opt/nagios/libexec 0755 nagios bin" >> $(PKGDIR)/prototype
+	@echo "f none /opt/nagios/libexec/check_nrpe=$(SRCDIR)/check_nrpe 0755 nagios bin" >> $(PKGDIR)/prototype
+	@echo "f none /lib/svc/method/nrpe=$(PKGDIR)/nrpe 0555 root bin" >> $(PKGDIR)/prototype
+	@echo "d none /var/svc/manifest/application/nagios 0755 root sys" >> $(PKGDIR)/prototype
+	@echo "f manifest /var/svc/manifest/application/nagios/nrpe.xml=$(PKGDIR)/nrpe.xml 0444 root sys" >> $(PKGDIR)/prototype
+
+pkginfo: $(PKGDIR)
+	@echo PKG="$(PKG_NAME)" > $(PKGDIR)/pkginfo
+	@echo NAME="Nagios Remote Plugin Executor $(PKG_VERSION)" >> $(PKGDIR)/pkginfo
+	@echo VERSION="$(PKG_VERSION)" >> $(PKGDIR)/pkginfo
+	@echo ARCH="$(TARGET_ARCH)" >> $(PKGDIR)/pkginfo
+	@echo CATEGORY="utility" >> $(PKGDIR)/pkginfo
+	@echo CLASSES="none config manifest" >> $(PKGDIR)/pkginfo
+	@echo VENDOR="www.nagios.org" >> $(PKGDIR)/pkginfo
+	@echo EMAIL="nagios-users@lists.sourceforge.net" >> $(PKGDIR)/pkginfo
+	@echo ISTATES="S s 1 2 3" >> $(PKGDIR)/pkginfo
+	@echo RSTATES="S s 1 2 3" >> $(PKGDIR)/pkginfo
+	@echo BASEDIR="/" >> $(PKGDIR)/pkginfo
+
+$(PKG_FILE): pkginfo prototype
+	pkgmk -o -d $(PKGDIR) -f $(PKGDIR)/prototype -r .
+	pkgtrans ./pkg $(PKG_FILE) $(PKG_NAME)
+
+pkg: $(PKG_FILE)
+
+all: pkg
+
+clean: 
+	rm -rf build install package
+	rm -rf $(PKGDIR)/$(PKG_NAME)
+	rm -f $(PKGDIR)/prototype $(PKGDIR)/pkginfo
+	rm -f $(PKGDIR)/$(PKG_FILE)
+	rm -f core
+	rm -f *~ */*~
+
+distclean: clean
+	rm -f Makefile
+	rm -f config.log
+
+devclean: distclean
+

+ 58 - 0
package/solaris/pkg/i.config

@@ -0,0 +1,58 @@
+#!/usr/bin/sh
+
+create_cksum_file() {
+	srcfile=$1
+	destfile=$2
+	cksumfile=$3
+
+	echo "# DO NOT EDIT OR REMOVE THIS FILE - It is used to determine whether to" > $cksumfile
+	echo "# overwrite $destfile on package update or to remove" >> $cksumfile
+	echo "# it on package deletion." >> $cksumfile
+	/usr/bin/cat $srcfile | /usr/bin/cksum >> $cksumfile
+	/usr/bin/chmod 400 $cksumfile
+}
+
+compare_cksum() {
+	destfile=$1
+	cksumfile=$2
+
+	installed_cksum=`/usr/bin/tail -1 $cksumfile | /usr/bin/awk '{print $1}'`
+	current_cksum=`/usr/bin/cksum $destfile | /usr/bin/awk '{print $1}'`
+	test $installed_cksum = $current_cksum
+}
+
+while read src dest ; do
+	destpath=`echo $dest | /usr/bin/sed -e 's/\/[^/]*$//'`
+	destbase=`/usr/bin/basename $dest`
+	cksumfile="${destpath}/.${destbase}.cksum"
+	if [ -f $dest ] ; then
+		if [ -f $cksumfile ] ; then
+			compare_cksum $dest $cksumfile
+			if [ $? -eq 0 ] ; then
+				/usr/bin/cp $src $dest
+				/usr/bin/chmod 600 $dest
+				/usr/bin/chown nagios:nagios $dest
+			else
+				echo "Existing $dest has been found --"
+				echo "    installing $destbase as $dest.pkgnew"
+				/usr/bin/cp $src $dest.pkgnew
+				/usr/bin/chmod 600 $dest.pkgnew
+				/usr/bin/chown nagios:nagios $dest.pkgnew
+			fi
+		else
+			echo "Existing $dest has been found --"
+			echo "    installing $destbase as $dest.pkgnew"
+			/usr/bin/cp $src $dest.pkgnew
+			/usr/bin/chmod 600 $dest.pkgnew
+			/usr/bin/chown nagios:nagios $dest.pkgnew
+		fi
+	else
+		create_cksum_file $src $dest $cksumfile
+		/usr/bin/cp $src $dest
+		/usr/bin/chmod 600 $dest
+		/usr/bin/chown nagios:nagios $dest
+	fi
+done
+if [ "$1" = "ENDOFCLASS" ] ; then
+	exit 0
+fi

+ 32 - 0
package/solaris/pkg/nrpe

@@ -0,0 +1,32 @@
+#!/sbin/sh
+#
+
+NRPE=/opt/nagios/bin/nrpe
+CFGFILE=/etc/nagios/nrpe.cfg
+PIDFILE=/var/run/nrpe.pid
+
+case $1 in 
+'start')
+	$NRPE -c $CFGFILE -d
+	;;
+
+'restart')
+	if [ -f "$PIDFILE" ]; then
+		/usr/bin/kill -HUP `/usr/bin/cat $PIDFILE`
+	fi
+	;;
+
+'stop')
+	if [ -f "$PIDFILE" ]; then
+		/usr/bin/kill `/usr/bin/cat $PIDFILE`
+		/bin/rm -f $PIDFILE
+	fi
+	;;
+
+*)
+	echo "Usage: $0 { start | restart | stop }"
+	exit 1
+	;;
+esac	
+
+exit $?

+ 131 - 0
package/solaris/pkg/nrpe.xml

@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+
+	All source code, binaries, documentation, and information contained
+	in this distribution are provided AS IS with NO WARRANTY OF ANY KIND,
+	INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR
+	A PARTICULAR PURPOSE.
+
+	Nagios and the Nagios logo are registered trademarks of Nagios Enterprises.
+	All other trademarks, servicemarks, registered trademarks, and 
+	registered servicemarks are the property of their respective owner(s).
+
+-->
+
+<service_bundle type='manifest' name='NGOS:nrpe'>
+
+<service
+	name='application/nagios/nrpe'
+	type='service'
+	version='1'>
+
+	<create_default_instance enabled='false' />
+
+	<single_instance />
+
+	<dependency name='fs-local'
+		grouping='require_all'
+		restart_on='none'
+		type='service'>
+		<service_fmri
+			value='svc:/system/filesystem/local' />
+	</dependency>
+
+	<dependency name='fs-autofs'
+		grouping='optional_all'
+		restart_on='none'
+		type='service'>
+		<service_fmri value='svc:/system/filesystem/autofs' />
+	</dependency>
+
+	<dependency name='net-loopback'
+		grouping='require_all'
+		restart_on='none'
+		type='service'>
+		<service_fmri value='svc:/network/loopback' />
+	</dependency>
+
+	<dependency name='net-physical'
+		grouping='require_all'
+		restart_on='none'
+		type='service'>
+		<service_fmri value='svc:/network/physical' />
+	</dependency>
+
+	<dependency name='cryptosvc'
+		grouping='require_all'
+		restart_on='none'
+		type='service'>
+		<service_fmri value='svc:/system/cryptosvc' />
+	</dependency>
+
+	<dependency name='utmp'
+		grouping='require_all'
+		restart_on='none'
+		type='service'>
+		<service_fmri value='svc:/system/utmp' />
+	</dependency>
+
+	<dependency name='config_data'
+		grouping='require_all'
+		restart_on='restart'
+		type='path'>
+		<service_fmri
+		    value='file://localhost/etc/nagios/nrpe.cfg' />
+	</dependency>
+
+	<dependent
+		name='nrpe_multi-user-server'
+		grouping='optional_all'
+		restart_on='none'>
+			<service_fmri
+			    value='svc:/milestone/multi-user-server' />
+	</dependent>
+
+	<exec_method
+		type='method'
+		name='start'
+		exec='/lib/svc/method/nrpe start'
+		timeout_seconds='60'/>
+
+	<exec_method
+		type='method'
+		name='stop'
+		exec='/lib/svc/method/nrpe stop'
+		timeout_seconds='60' />
+
+	<exec_method
+		type='method'
+		name='refresh'
+		exec='/lib/svc/method/nrpe restart'
+		timeout_seconds='60' />
+
+	<property_group name='startd'
+		type='framework'>
+		<!-- sub-process core dumps shouldn't restart session -->
+		<propval name='ignore_error'
+		    type='astring' value='core,signal' />
+	</property_group>
+
+	<stability value='Unstable' />
+
+	<template>
+		<common_name>
+			<loctext xml:lang='C'>
+			NRPE daemon
+			</loctext>
+		</common_name>
+		<description>
+			<loctext xml:lang='C'>
+			Nagios Remote Plugin Executor Daemon
+			</loctext>
+		</description>
+		<!--documentation-->
+			<!--manpage title='sshd' section='1M' manpath='/usr/share/man' /-->
+		<!--/documentation-->
+	</template>
+
+</service>
+
+</service_bundle>

+ 5 - 0
package/solaris/pkg/postinstall

@@ -0,0 +1,5 @@
+#!/usr/bin/sh
+
+echo "To begin using NRPE, first edit /etc/nagios/nrpe.cfg, update the"
+echo "allowed_hosts line and any command lines. Then start the nrpe service"
+echo "by running the command 'svcadm enable nrpe' as root."

+ 35 - 0
package/solaris/pkg/preinstall

@@ -0,0 +1,35 @@
+#!/usr/bin/sh
+
+user="nagios"
+uid=-1
+group="nagios"
+gid=-1
+
+/usr/bin/getent group $group > /dev/null 2> /dev/null
+result=$?
+if [ $result -eq 2 ] ; then
+	echo "Group $group does not exist. Creating..."
+	if [ $gid -ne -1 ] ; then
+		/usr/sbin/groupadd -g $gid $group
+	else
+		/usr/sbin/groupadd $group
+	fi
+elif [ $result -ne 0 ] ; then
+	echo "An error occurred determining the existence of the groug $group. Terminating."
+	exit 1;
+fi
+
+/usr/bin/getent passwd $user > /dev/null 2> /dev/null
+result=$?
+if [ $result -eq 2 ] ; then
+	echo "User $user does not exist. Creating..."
+	if [ $uid -ne -1 ] ; then
+		/usr/sbin/useradd -u $uid -g $group $user
+	else
+		/usr/sbin/useradd -g $group $user
+	fi
+elif [ $result -ne 0 ] ; then
+	echo "An error occurred determining the existence of the user $user. Terminating."
+	exit 1;
+fi
+

+ 33 - 0
package/solaris/pkg/r.config

@@ -0,0 +1,33 @@
+#!/usr/bin/sh
+
+compare_cksum() {
+	destfile=$1
+	cksumfile=$2
+
+	installed_cksum=`/usr/bin/tail -1 $cksumfile | /usr/bin/awk '{print $1}'`
+	current_cksum=`/usr/bin/cksum $destfile | /usr/bin/awk '{print $1}'`
+	test $installed_cksum = $current_cksum
+}
+
+while read path ; do
+	destpath=`echo $path | /usr/bin/sed -e 's/\/[^/]*$//'`
+	destbase=`/usr/bin/basename $path`
+	cksumfile="${destpath}/.${destbase}.cksum"
+	if [ -f $path ] ; then
+		if [ -f $cksumfile ] ; then
+			compare_cksum $path $cksumfile
+			if [ $? -eq 0 ] ; then
+				/usr/bin/rm -f $path $cksumfile
+			else
+				echo "$path has been modified since it was installed -- "
+				echo "    leaving it in place."
+			fi
+		else
+			echo "$path may have been modified since it was installed -- "
+			echo "    leaving it in place."
+		fi
+	fi
+done
+if [ "$1" = "ENDOFCLASS" ] ; then
+	exit 0
+fi

+ 6 - 5
src/Makefile.in

@@ -4,9 +4,10 @@
 # Last Modified: 08-13-2007
 ###############################
 
+srcdir=@srcdir@
 
 # Source code directories
-SRC_INCLUDE=../include
+SRC_INCLUDE=@srcdir@/../include
 
 CC=@CC@
 CFLAGS=@CFLAGS@ @DEFS@
@@ -33,11 +34,11 @@ SNPRINTF_O=@SNPRINTF_O@
 
 all: nrpe check_nrpe
 
-nrpe: nrpe.c utils.c acl.c $(SRC_INCLUDE)/nrpe.h $(SRC_INCLUDE)/utils.h $(SRC_INCLUDE)/common.h $(SRC_INCLUDE)/config.h $(SRC_INCLUDE)/acl.h $(SNPRINTF_O)
-	$(CC) $(CFLAGS) -o $@ nrpe.c utils.c acl.c $(LDFLAGS) $(SOCKETLIBS) $(LIBWRAPLIBS) $(SNPRINTF_O) $(OTHERLIBS)
+nrpe: $(srcdir)/nrpe.c $(srcdir)/utils.c $(srcdir)/acl.c $(SRC_INCLUDE)/nrpe.h $(SRC_INCLUDE)/utils.h $(SRC_INCLUDE)/common.h $(SRC_INCLUDE)/config.h $(SRC_INCLUDE)/acl.h $(SNPRINTF_O)
+	$(CC) $(CFLAGS) -o $@ $(srcdir)/nrpe.c $(srcdir)/utils.c $(srcdir)/acl.c $(LDFLAGS) $(SOCKETLIBS) $(LIBWRAPLIBS) $(SNPRINTF_O) $(OTHERLIBS)
 
-check_nrpe: check_nrpe.c utils.c $(SRC_INCLUDE)/utils.h $(SRC_INCLUDE)/common.h $(SRC_INCLUDE)/config.h
-	$(CC) $(CFLAGS) -o $@ check_nrpe.c utils.c $(LDFLAGS) $(SOCKETLIBS) $(OTHERLIBS)
+check_nrpe: $(srcdir)/check_nrpe.c $(srcdir)/utils.c $(SRC_INCLUDE)/utils.h $(SRC_INCLUDE)/common.h $(SRC_INCLUDE)/config.h
+	$(CC) $(CFLAGS) -o $@ $(srcdir)/check_nrpe.c $(srcdir)/utils.c $(LDFLAGS) $(SOCKETLIBS) $(OTHERLIBS)
 
 install:
 	$(MAKE) install-plugin

+ 51 - 37
subst.in

@@ -1,47 +1,61 @@
 #!/usr/bin/perl -w
 
-my ${exec_prefix};
-my ${prefix};
-
-${prefix}="@prefix@";
-${exec_prefix}="@exec_prefix@";
-while ($f = shift @ARGV) {
-
-	if (-x "/bin/mktemp") { 
-		$TEMP = `/bin/mktemp $f.$$.XXXXXX`;
-		die 'Cannot make temporary file $TEMP' if($?);
-		chomp $TEMP;
-	} else {
-		$XXXXXX = rand;
-		$TEMP = "$f.$$.$XXXXXX";
+# This script finishes the job started by config.status by replacing the variables
+# of the form ${...} which were inserted into the file(s) by config.status.
+
+# Read all files with a single read statement
+$/ = undef;
+
+# List of variables to replace
+my %configvars = (
+	"prefix" => { "value" => '@prefix@'},
+	"exec_prefix" => { "value" => '@exec_prefix@'},
+);
+
+sub replace_var {
+	my $filep = shift;
+	my $cvp = shift;
+	my $varname = shift;
+
+	return if( $cvp->{ $varname}->{ "replaced"});
+	if( defined( $cvp->{ $varname}->{ "dependency"})) {
+		if( !$cvp->{ $cvp->{ $varname}->{ "dependency"}}->{ "replaced"}) {
+			# If a dependency exists and it is not already replaced, replace it
+			replace_var( $filep, $cvp, $cvp->{ $varname}->{ "dependency"});
+		}
 	}
+	my $replacement = $cvp->{ $varname}->{ "value"};
+	$$filep =~ s/\${$varname}/$replacement/g;
+	$cvp->{ $varname}->{ "replaced"} = 1;
+}
 
-	open(IN,"<$f.in");
-	open(OUT,">$TEMP") || die 'Cannot make temporary file $TEMP';
-
-	while (<IN>) {
-		s|\@nrpe_user\@|@nrpe_user@|g;
-		s|\@nrpe_group\@|@nrpe_group@|g;
-		s|\@nrpe_port\@|@nrpe_port@|g;
-		s|\@log_facility\@|@log_facility@|g;
-		s|\@libexecdir\@|@libexecdir@|g; # put all --with-vars before directories
-		s|\@localstatedir\@|@localstatedir@|g;
-		s|\@sysconfdir\@|@sysconfdir@|g;
-		s|\@datadir\@|@datadir@|g;
-		s|\@sbindir\@|@sbindir@|g;
-		s|\@bindir\@|@bindir@|g;
-		s|\$\{exec_prefix\}|@exec_prefix@|g; # must be next to last
-		s|\$\{prefix\}|@prefix@|g; # must be last
-		print OUT $_;
+# Figure out the dependencies.
+foreach my $cv ( keys %configvars ) {
+	if( $configvars{ $cv}->{ "value"} =~ /\${([^}]+)}/) {
+		my $dependency = $1;
+		if( exists( $configvars{ $dependency})) {
+			$configvars{ $dependency}->{ "dependency"} = $cv;
+		}
+		$configvars{ $cv}->{ "replaced"} = 0;
 	}
+}
+
+# Process each file
+while ($f = shift @ARGV) {
 
-	close IN;
-	close OUT;
+	# Read in the file
+	open( FILE, $f) || die "Unable to open $f for reading";
+	my $file = <FILE>;
+	close( FILE) || die "Unable to close $f after reading";
 
-	if ((! -e $f) || (`diff $f $TEMP`)) {
-		`mv $TEMP $f`;
-	} else {
-	         unlink $TEMP;
+	# Replace each of the variables we know about
+	foreach $cv ( keys %configvars ) {
+		replace_var( \$file, \%configvars, $cv);
 	}
 
+	# Write out the replacements
+	open( FILE, ">$f") || die "Unable to open $f for writing";
+	print FILE $file;
+	close( FILE) || die "Unable to close $f after writing";
+
 }

+ 1 - 0
update-version

@@ -48,6 +48,7 @@ perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/check_n
 # Update version number and release date in configure script and configure.in
 perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$1\"/;" configure
 perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure
+perl -i -p -e "if( /^AC_INIT/) { s/$CURRENT_VERSION/$1/; }" configure.in
 perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$1\"/;" configure.in
 perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.in