From 8e4edfc1ab2b38b0e82cbd28da9f56b04325775a Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Wed, 16 Oct 2002 04:41:06 +0000 Subject: [PATCH] work with newer automake, begin swithc to asprintf git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@111 f882894a-f735-0410-b71e-b25c423dba1c --- configure.in | 69 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/configure.in b/configure.in index 2341b25..ca890f7 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,6 @@ dnl Process this file with autoconf to produce a configure script. include(`aclocal.m4') +include(`getloadavg.m4') AC_REVISION ($Revision$) AC_INIT(Helper.pm) PACKAGE_VERSION="1.3.0" @@ -35,14 +36,14 @@ AC_SUBST(WARRANTY) SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net\n" AC_SUBST(SUPPORT) -AC_ARG_PROGRAM +dnl AC_ARG_PROGRAM dnl AC_ARG_WITH(nonposix_state_defs,--with-nonposix-state-defs uses POSIXLY incorrect states for netsaint < 0.0.7b2,,AC_DEFINE(POSIX_STATE_DEFS)) dnl CGIURL has changed for Nagios with 1.0 beta AC_ARG_WITH(cgiurl,--with-cgiurl= sets URL for cgi programs,cgiurl=$withval,cgiurl=/nagios/cgi-bin) CGIURL="$cgiurl" -AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL") +AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs]) AC_ARG_WITH(nagios_user,--with-nagios-user= sets user name to run nagios,nagios_usr=$withval,nagios_usr=nagios) AC_ARG_WITH(nagios_group,--with-nagios-group= sets group name to run nagios,nagios_grp=$withval,nagios_grp=nagios) @@ -76,7 +77,7 @@ dnl dnl Checks for libraries. dnl -AC_FUNC_GETLOADAVG +AC_FUNC_GETLOADAVG(plugins) AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce") AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl") @@ -246,7 +247,7 @@ if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then if test "$ac_cv_lib_ssl_main" = "yes"; then if test "$FOUNDINCLUDE" = "yes"; then AC_SUBST(SSLLIBS) - AC_DEFINE(HAVE_SSL) + AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found]) fi fi fi @@ -268,6 +269,8 @@ AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SIGNAL +dnl AC_CHECK_MEMBER(struct timeb.millitm,[AC_DEFINE(HAVE_STRUCT_TIMEB_MILLITM)],,[#include ]) + dnl EXTRA_LIBRARIES="libgetopt.a libsnprintf.a" dnl noinst_LIBRARIES="libgetopt.a libsnprintf.a" dnl libgetopt_a_SOURCES="getopt.c getopt1.c" @@ -278,35 +281,43 @@ dnl AC_SUBST(libgetopt_a_SOURCES) dnl AC_SUBST(libgetopt_a_DEPENDENCIES) dnl AC_SUBST(libsnprintf_a_SOURCES) +dnl We used to not do long options unless a compatible lib was found +dnl Now we provide code and make libgetopt if native is not suitable AC_MSG_CHECKING(for getopt_long) AC_TRY_COMPILE([#include -#include ], -[int option_index=0; -static struct option *long_options; -getopt_long(0,NULL,"+h",long_options,&option_index);], -[AC_DEFINE(HAVE_GETOPT_H) AC_DEFINE(HAVE_GETOPT_LONG) AC_MSG_RESULT(yes)], -[AC_DEFINE(HAVE_GETOPT_H) AC_DEFINE(HAVE_GETOPT_LONG) AC_MSG_RESULT(no) import_sources=getopt]) + #include ], + [int option_index=0; + static struct option *long_options; + getopt_long(0,NULL,"+h",long_options,&option_index);], + [AC_DEFINE(HAVE_GETOPT_H,1,[Define if getopt headers are found]) + AC_DEFINE(HAVE_GETOPT_LONG,1,[Define if getopt_long_only() is found]) + AC_MSG_RESULT(yes)], + [AC_DEFINE(HAVE_GETOPT_H,1,[Define if getopt headers are found]) + AC_DEFINE(HAVE_GETOPT_LONG,1,[Define if getopt_long_only() is found]) + AC_MSG_RESULT(no) + import_sources=getopt]) AC_CHECK_FUNCS(getopt_long_only,,LIBS="$LIBS -lgetopt" DEPLIBS="$DEPLIBS libgetopt.a") -AC_CHECK_FUNC(vsnprintf,,LIBS="$LIBS -lsnprintf" DEPLIBS="$DEPLIBS libsnprintf.a") +AC_CHECK_FUNC(asprintf,,LIBS="$LIBS -lsnprintf" DEPLIBS="$DEPLIBS libsnprintf.a") dnl Checks for library functions. -AC_CHECK_FUNCS(select socket strdup strstr strtod strtol strtoul) +AC_CHECK_FUNCS(select socket strdup strstr strtod strtol strtoul gettimeofday) AC_MSG_CHECKING(for type of socket size) AC_TRY_COMPILE([#include -#include -#include -], -[int a = send(1, (const void *) buffer, (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)]) + #include + #include ], + [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);], + [AC_DEFINE(SOCKET_SIZE_TYPE, size_t, [Define type of socket size]) + AC_MSG_RESULT(size_t)], + [AC_DEFINE(SOCKET_SIZE_TYPE, int, [Define type of socket size]) + AC_MSG_RESULT(int)]) if test -f "/proc/loadavg" then - AC_DEFINE(HAVE_PROC_LOADAVG) - AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg") + AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists]) + AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg"[Location of /proc/loadavg]) fi AC_PATH_PROG(PATH_TO_PS,ps) @@ -760,35 +771,35 @@ then elif [swap -l 2>&1 | egrep -i "swapfile" >/dev/null] then echo "found swap command" - AC_DEFINE(HAVE_SWAP) + AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found]) AC_PATH_PROG(PATH_TO_SWAP,swap) - AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$PATH_TO_SWAP -l") + AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$PATH_TO_SWAP -l"[Path to swap/swapinfo binary, with any args]) if [swap -l 2>/dev/null | egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" >/dev/null] then - AC_DEFINE_UNQUOTED(SWAP_FORMAT,[" %*d %*s %*d,%*d %*d %*d %d %d"]) + AC_DEFINE_UNQUOTED(SWAP_FORMAT,[" %*d %*s %*d,%*d %*d %*d %d %d"],[Format string for parsing swap output]) echo " using IRIX format" elif [swap -l 2>/dev/null | egrep -i "^swapfile +dev +swaplo +blocks +free" >/dev/null] then - AC_DEFINE_UNQUOTED(SWAP_FORMAT,["%*s %*[[0-9,-]] %*d %d %d"]) + AC_DEFINE_UNQUOTED(SWAP_FORMAT,["%*s %*[[0-9,-]] %*d %d %d"],[Format string for parsing swap output]) echo " using Solaris format" fi EXTRAS="$EXTRAS check_swap" elif [swapinfo -k 2>&1 | egrep -i "Device" >/dev/null] then echo "found swapinfo command" - AC_DEFINE(HAVE_SWAP) + AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found]) AC_PATH_PROG(PATH_TO_SWAP,swapinfo) - AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$PATH_TO_SWAP -k") + AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$PATH_TO_SWAP -k",[Path to swap/swapinfo binary, with any args]) if [swapinfo -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null] then - AC_DEFINE_UNQUOTED(SWAP_FORMAT,["%*s %d %*d %d"]) + AC_DEFINE_UNQUOTED(SWAP_FORMAT,["%*s %d %*d %d"],[Format string for parsing swap output]) echo " using FreeBSD format" fi EXTRAS="$EXTRAS check_swap" fi AC_PATH_PROG(PATH_TO_DIG,dig) -AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG") +AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present]) if test -n "$PATH_TO_DIG"; then EXTRAS="$EXTRAS check_dig" fi @@ -816,6 +827,6 @@ AC_TRY_COMPILE([#ifdef __STDC__ AC_SUBST(EXTRAS) AC_SUBST(DEPLIBS) -AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}") +AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version]) AC_OUTPUT(Makefile subst plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl,echo timestamp > plugins/stamp-h1;echo timestamp > plugins/stamp-h2;echo timestamp > plugins/stamp-h3;echo timestamp > plugins/stamp-h4;echo timestamp > plugins/stamp-h5;echo timestamp > plugins/stamp-h6;PATH=.:..:$PATH subst.sh command.cfg) -- 2.30.2