Code

Convert tabs to spaces from dig's answer section (Randy O'Meara - 1107651)
[nagiosplug.git] / configure.in
index 4887257dfdd50639f612cc9a47b617f646d1fd7a..0002d61b90ab8e821ffdbf7a4d857d0774d072af 100644 (file)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_REVISION ($Revision$)
-AC_PREREQ(2.50)
-AC_INIT(nagios-plugins,1.4.0-alpha3)
+AC_PREREQ(2.58)
+AC_INIT(nagios-plugins,1.4-beta2)
 AC_CONFIG_SRCDIR(Helper.pm)
 AM_INIT_AUTOMAKE
 AM_CONFIG_HEADER(config.h)
@@ -16,20 +16,20 @@ dnl Figure out how to invoke "install" and what install options to use.
 AC_PROG_INSTALL
 AC_SUBST(INSTALL)
 
-AC_GNU_SOURCE
+dnl Must come very early on due to coreutils requirement
+dnl Takes care of AC_GNU_SOURCE, AC_AIX and AC_MINIX
+gl_USE_SYSTEM_EXTENSIONS
+
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_GCC_TRADITIONAL
 AC_PROG_RANLIB
-AC_AIX
-AC_MINIX
 
 AC_PROG_MAKE_SET
 AC_PROG_AWK
 
 AC_FUNC_MALLOC
 AC_FUNC_REALLOC
-jm_PREREQ_ERROR
 AC_FUNC_ERROR_AT_LINE
 
 AC_CONFIG_LIBOBJ_DIR(lib)
@@ -255,151 +255,6 @@ fi
 CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
 LIBS="$_SAVEDLIBS"
 
-dnl Check for OpenSSL location
-dnl This whole check is inspired by curl 7.12.2's configure.ac
-OPT_OPENSSL=off
-AC_ARG_WITH(openssl,
-AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
-AC_HELP_STRING([--without-openssl], [disable openssl]),
-OPT_OPENSSL=$withval)
-
-if test X"$OPT_OPENSSL" = "Xno"; then
-  AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
-  with_openssl=no
-else
-  dnl backup the pre-ssl variables
-  CLEANLDFLAGS="$LDFLAGS"
-  CLEANCPPFLAGS="$CPPFLAGS"
-  CLEANLIBS="$LIBS"
-
-  case "$OPT_OPENSSL" in
-  yes)
-    dnl --with-openssl (without path) used
-    PKGTEST="yes"
-    ;;
-  off)
-    dnl no --with-openssl given, check default places
-    PKGTEST="yes"
-    ;;
-  *)
-    dnl use the given area
-    PKGTEST="no"
-    OPENSSL=$OPT_OPENSSL
-    LDFLAGS="$LDFLAGS -L$OPENSSL/lib"
-    CPPFLAGS="$CPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
-  ;;
-  esac
-
-  dnl Check usual areas for openssl
-  if test "$PKGTEST" = "yes"; then
-    AC_PATH_PROG(OPENSSL,openssl)
-    # Don't think 2 tests below are necessary because /usr is always included
-    # if test "$OPENSSL" = "/usr/bin/openssl"; then
-    #  OPENSSL=/usr
-    #elif test "$OPENSSL" = "/usr/sbin/openssl"; then
-    #  OPENSSL=/usr
-    if test "$OPENSSL" = "/opt/bin/openssl"; then
-      OPENSSL=/opt
-    elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
-      OPENSSL=/opt/openssl
-    elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
-      OPENSSL=/usr/slocal
-    elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
-      OPENSSL=/usr/local
-    elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
-      OPENSSL=/usr/local/ssl
-    fi
-  fi
-
-  AC_CHECK_LIB(crypto, CRYPTO_lock,[
-     HAVECRYPTO="yes"
-     ],[
-     LDFLAGS="$CLEANLDFLAGS -L$OPENSSL/lib"
-     CPPFLAGS="$CLEANCPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
-     AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
-       HAVECRYPTO="yes" ], [
-       LDFLAGS="$CLEANLDFLAGS"
-       CPPFLAGS="$CLEANCPPFLAGS"
-       LIBS="$CLEANLIBS"
-       ])
-    ])
-
-  if test "$HAVECRYPTO" = "yes"; then
-    dnl This is only reasonable to do if crypto actually is there: check for
-    dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
-
-    dnl This is for Msys/Mingw
-    AC_MSG_CHECKING([for gdi32])
-    my_ac_save_LIBS=$LIBS
-    LIBS="-lgdi32 $LIBS"
-    AC_TRY_LINK([#include <windef.h>
-                 #include <wingdi.h>],
-               [GdiFlush();],
-               [ dnl worked!
-               AC_MSG_RESULT([yes])],
-               [ dnl failed, restore LIBS
-               LIBS=$my_ac_save_LIBS
-               AC_MSG_RESULT(no)]
-              )
-
-    AC_CHECK_LIB(crypto, CRYPTO_add_lock)
-    AC_CHECK_LIB(ssl, SSL_connect)
-
-    if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
-        dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
-        AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
-        OLIBS=$LIBS
-        LIBS="$LIBS -lRSAglue -lrsaref"
-        AC_CHECK_LIB(ssl, SSL_connect)
-        if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
-            dnl still no SSL_connect
-            AC_MSG_RESULT(no)
-            LIBS=$OLIBS
-        else
-            AC_MSG_RESULT(yes)
-        fi
-    fi
-
-
-    dnl Check for SSLeay headers
-    AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
-                     openssl/pem.h openssl/ssl.h openssl/err.h,
-      OPENSSL_ENABLED=1)
-
-    if test $ac_cv_header_openssl_x509_h = no; then
-      AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
-        OPENSSL_ENABLED=1)
-    fi
-
-    dnl If the ENGINE library seems to be around, check for the OpenSSL engine
-    dnl header, it is kind of "separated" from the main SSL check
-    AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ])
-
-    dnl AC_SUBST(OPENSSL_ENABLED)
-
-    dnl these can only exist if openssl exists
-    AC_CHECK_FUNCS( RAND_status \
-                    RAND_screen \
-                    RAND_egd \
-                    CRYPTO_cleanup_all_ex_data )
-
-  fi
-
-  if test "$OPENSSL_ENABLED" != "1"; then
-    AC_MSG_WARN([OpenSSL libs and/or directories were not found where specified!])
-    with_openssl="no"
-  else
-    check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
-    AC_SUBST(check_tcp_ssl)
-    AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
-    with_openssl="yes"
-
-    # Needed for subsequent compiled programs
-    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSSL/lib$libsuff"
-    export LD_LIBRARY_PATH
-  fi
-fi
-
 AC_CHECK_HEADERS(unistd.h)
 
 dnl Check for AF_INET6 support - unistd.h required for Darwin
@@ -526,6 +381,7 @@ if test x"$enable_emulate_getaddrinfo" != xno ; then
 
 fi
 
+dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
 if test "$FOUNDINCLUDE" = "no"; then
   _SAVEDCPPFLAGS="$CPPFLAGS"
@@ -541,6 +397,91 @@ if test "$FOUNDINCLUDE" = "no"; then
   CPPFLAGS="$_SAVEDCPPFLAGS"
 fi
 
+dnl Check for OpenSSL location
+AC_PATH_PROG(OPENSSL,openssl)
+if test "$OPENSSL" = "/usr/bin/openssl"; then
+  OPENSSL=/usr
+elif test "$OPENSSL" = "/usr/sbin/openssl"; then
+  OPENSSL=/usr
+elif test "$OPENSSL" = "/opt/bin/openssl"; then
+  OPENSSL=/opt
+elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
+  OPENSSL=/opt/openssl
+elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
+  OPENSSL=/usr/slocal
+elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
+  OPENSSL=/usr/local
+elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
+  OPENSSL=/usr/local/ssl
+fi
+AC_ARG_WITH(openssl,
+AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
+AC_HELP_STRING([--without-openssl], [disable openssl]),
+OPENSSL=$withval)
+
+_SAVEDCPPFLAGS="$CPPFLAGS"
+_SAVEDLDFLAGS="$LDFLAGS"
+if test X"$OPENSSL" = "Xno"; then
+  AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
+  FOUNDSSL="dontbother"
+else
+  dnl Check for OpenSSL header files
+  unset FOUNDINCLUDE
+  if test "$OPENSSL" != "/usr"; then
+    CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
+    LDFLAGS="$LDFLAGS -R$OPENSSL/lib"
+  fi
+  AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
+                 SSLINCLUDE="-I$OPENSSL/include"
+                 FOUNDINCLUDE=yes,
+                 FOUNDINCLUDE=no)
+  if test "$FOUNDINCLUDE" = "no"; then
+    AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
+                   SSLINCLUDE="-I$OPENSSL/include"
+                   FOUNDINCLUDE=yes,
+                   FOUNDINCLUDE=no)
+  fi
+  AC_SUBST(SSLINCLUDE)
+  if test "$FOUNDINCLUDE" = "no"; then
+    CPPFLAGS="$_SAVEDCPPFLAGS"
+  fi
+
+  dnl Check for crypto lib
+  _SAVEDLIBS="$LIBS"
+  AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
+  if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
+    dnl Check for SSL lib
+    AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto",AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto"),-L$OPENSSL/lib -lcrypto)
+  fi
+  LIBS="$_SAVEDLIBS"
+
+  FOUNDSSL="no"
+  dnl test headers and libs to decide whether check_http should use SSL
+  if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
+    if test "$ac_cv_lib_ssl_main" = "yes"; then
+      if test "$FOUNDINCLUDE" = "yes"; then
+        FOUNDSSL="yes"
+      fi
+    fi
+  fi
+fi
+
+if test "$FOUNDSSL" = "yes"; then
+  check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
+  AC_SUBST(check_tcp_ssl)
+  AC_SUBST(SSLLIBS)
+  AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
+  with_openssl="yes"
+else
+  if test "$FOUNDSSL" = "no"; then
+    AC_MSG_WARN([OpenSSL libs could not be found])
+  dnl else deliberately disabled
+  fi
+  with_openssl="no"
+  CPPFLAGS="$_SAVEDCPPFLAGS"
+  LDFLAGS="$_SAVEDLDFLAGS"
+fi
+
 dnl
 dnl Checks for header files.
 dnl
@@ -550,69 +491,6 @@ AC_HEADER_TIME
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h uio.h errno.h regex.h sys/types.h sys/time.h sys/socket.h sys/loadavg.h)
 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
-AC_CHECK_HEADERS(limits.h sys/param.h)
-AC_CHECK_HEADERS([sys/mount.h],[],[],[
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-])
-AC_CHECK_HEADERS(sys/vfs.h sys/fs/s5param.h sys/filsys.h fcntl.h sys/statfs.h sys/dustat.h sys/statvfs.h)
-
-# glibc 2.3.2 stdlib.h does not define HUGE_VAL (see man strtod)
-AC_MSG_CHECKING([for HUGE_VAL in <stdlib.h>])
-AC_TRY_COMPILE([#include <stdlib.h>],
-               [double x = HUGE_VAL;],
-               [AC_MSG_RESULT(yes)],
-               [AC_MSG_RESULT(no)
-                AC_MSG_CHECKING([for HUGE_VAL in <math.h>])
-                AC_TRY_COMPILE([#include <math.h>],
-                               [double x = HUGE_VAL;],
-                               [AC_MSG_RESULT(yes)
-                                AC_DEFINE_UNQUOTED(HUGE_VAL_NEEDS_MATH_H, 1,
-                                                  [Define if <math.h> is required for HUGE_VAL])],
-                               [AC_MSG_RESULT(no)])])
-
-# Define HAVE_INTTYPES_H if <inttypes.h> exists,
-# doesn't clash with <sys/types.h>, and declares uintmax_t.
-
-AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
-[AC_TRY_COMPILE(
-  [#include <sys/types.h>
-#include <inttypes.h>],
-  [uintmax_t i = (uintmax_t) -1;],
-  jm_ac_cv_header_inttypes_h=yes,
-  jm_ac_cv_header_inttypes_h=no)])
-
-if test $jm_ac_cv_header_inttypes_h = yes; then
-  AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
-[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
-   and declares uintmax_t. ])
-fi
-
-# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
-# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
-# enable the work-around code in fsusage.c.
-AC_MSG_CHECKING([for statfs that truncates block counts])
-AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
-[AC_TRY_COMPILE([
-#if !defined(sun) && !defined(__sun)
-choke -- this is a workaround for a Sun-specific problem
-#endif
-#include <sys/types.h>
-#include <sys/vfs.h>],
-[struct statfs t; long c = *(t.f_spare);],
-fu_cv_sys_truncating_statfs=yes
-AC_MSG_RESULT(yes),
-fu_cv_sys_truncating_statfs=no
-AC_MSG_RESULT(no),
-)])
-if test $fu_cv_sys_truncating_statfs = yes; then
-  AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
-[  Define if the block counts reported by statfs may be truncated to 2GB
-   and the correct values may be stored in the f_spare array.
-   (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
-   SunOS 4.1.1 seems not to be affected.)])
-fi
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -621,29 +499,6 @@ AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_TYPE_SIGNAL
 
-AC_CHECK_SIZEOF(int,cross)
-AC_CHECK_SIZEOF(long,cross)
-AC_CHECK_SIZEOF(short,cross)
-
-AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
-AC_TRY_RUN([#include <stdio.h>
-main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
-ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
-if test x"$ac_cv_have_longlong" = x"yes"; then
-    AC_DEFINE(HAVE_LONGLONG,1,[Define if system has long long type])
-fi
-
-#
-# Check if the compiler supports the LL prefix on long long integers.
-# AIX needs this.
-
-AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
-    AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
-        ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
-if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
-   AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Define if compiler support long long])
-fi
-
 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
 AC_TRY_LINK([#include <stdarg.h>
 va_list ap1,ap2;], [va_copy(ap1,ap2);],
@@ -732,9 +587,10 @@ AC_PATH_PROG(PATH_TO_PS,ps)
 
 AC_MSG_CHECKING(for ps syntax)
 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
+dnl Should also work for FreeBSD 5.2.1 and 5.3
 dnl  STAT UCOMM              VSZ   RSS USER      PPID COMMAND
 if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
-       egrep -i ["^ *STAT +UCOMM +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
+       egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
 then
        ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
        ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
@@ -742,6 +598,18 @@ then
        ac_cv_ps_cols=8
        AC_MSG_RESULT([$ac_cv_ps_command])
 
+dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4. 
+dnl Limitation: Only first 16 chars returned for ucomm field
+dnl Must come before ps -weo
+elif ps -axwo 'stat uid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
+       egrep -i ["^ *STAT +UID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
+then
+       ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
+       ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu ucomm command'"
+       ac_cv_ps_format="%s %d %d %d %d %f %s %n"
+       ac_cv_ps_cols=8
+       AC_MSG_RESULT([$ac_cv_ps_command])
+
 dnl  STAT UCOMM              VSZ   RSS USER       UID  PPID COMMAND
 elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
        egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
@@ -958,11 +826,6 @@ if test -n "$ac_cv_ps_varlist" ; then
        EXTRAS="$EXTRAS check_procs check_nagios"
 fi
 
-dnl jm_AFS
-jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
-jm_FSTYPENAME
-jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
-
 AC_PATH_PROG(PATH_TO_PING,ping)
 AC_PATH_PROG(PATH_TO_PING6,ping6)
 
@@ -1398,13 +1261,13 @@ then
                egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
                >/dev/null]
        then
-               ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
+               ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
                ac_cv_swap_conv=2048
                AC_MSG_RESULT([using IRIX format swap])
 
        elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
        then
-               ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
+               ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
                ac_cv_swap_conv=2048
                AC_MSG_RESULT([using Unixware format swap])
        else
@@ -1428,7 +1291,7 @@ then
 
        if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
        then
-               ac_cv_swap_format=["%*s %d %*d %d"]
+               ac_cv_swap_format=["%*s %f %*d %f"]
                ac_cv_swap_conv=1024
                AC_MSG_RESULT([using FreeBSD format swapinfo])
        fi
@@ -1437,7 +1300,7 @@ elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >
 then
        ac_cv_have_swap=yes
        ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
-       ac_cv_swap_format=["%*s %d %*d %d"]
+       ac_cv_swap_format=["%*s %f %*d %f"]
        ac_cv_swap_conv=1024
        AC_MSG_RESULT([using HP-UX format swapinfo])
 fi
@@ -1452,7 +1315,7 @@ if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
 then
        ac_cv_have_swap=yes
        ac_cv_swap_command="$PATH_TO_LSPS -a"
-       ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
+       ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
        ac_cv_swap_conv=1
        AC_MSG_RESULT([using AIX lsps])
 fi
@@ -1465,12 +1328,12 @@ dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
 dnl in the various BSD's
 dnl
 
+AC_CHECK_HEADERS([sys/stat.h sys/param.h])
 AC_CHECK_HEADERS([sys/swap.h], [], [], [
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
 ])
-AC_CHECK_HEADERS([sys/stat.h sys/param.h])
 AC_CHECK_DECLS([swapctl],,,[
                #include <unistd.h>
                #include <sys/types.h>
@@ -1602,14 +1465,47 @@ AC_TRY_COMPILE([#ifdef __STDC__
                [AC_MSG_RESULT(yes)],
                [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
 
+case $host in
+       *bsd*)
+               AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
+       ;;
+       *linux*)
+               AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
+       ;;
+       *sun* | solaris*)
+               AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
+       ;;
+       *hpux*)  
+               AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
+       ;;
+esac
+
 AC_SUBST(EXTRAS)
 AC_SUBST(EXTRA_NETOBJS)
 AC_SUBST(DEPLIBS)
 
-AM_GNU_GETTEXT_VERSION(0.11.5)
 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
+AM_GNU_GETTEXT_VERSION(0.11.5)
 
-AC_OUTPUT(Makefile lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl pkg/solaris/pkginfo intl/Makefile po/Makefile.in )
+dnl External libraries - see ACKNOWLEDGEMENTS
+np_COREUTILS
+np_CURL
+
+AC_OUTPUT(
+  Makefile 
+  lib/Makefile 
+  m4/Makefile 
+  plugins/Makefile 
+  plugins-scripts/Makefile 
+  plugins-scripts/subst 
+  plugins-scripts/utils.pm 
+  plugins-scripts/utils.sh 
+  command.cfg 
+  test.pl 
+  pkg/solaris/pkginfo 
+  intl/Makefile
+  po/Makefile.in 
+)
 
 ACX_FEATURE([with],[cgiurl])
 ACX_FEATURE([with],[nagios-user])