configure.in 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl Disable caching
  3. define([AC_CACHE_LOAD],)
  4. define([AC_CACHE_SAVE],)
  5. AC_INIT(src/nrpe.c)
  6. AC_CONFIG_HEADER(common/config.h)
  7. AC_PREFIX_DEFAULT(/usr/local/nagios)
  8. PKG_NAME=nrpe
  9. PKG_VERSION="2.0a1"
  10. PKG_HOME_URL="http://www.nagios.org/"
  11. PKG_REL_DATE="01-30-2003"
  12. dnl Figure out how to invoke "install" and what install options to use.
  13. AC_PROG_INSTALL
  14. AC_SUBST(INSTALL)
  15. dnl Checks for programs.
  16. AC_PROG_CC
  17. AC_PROG_MAKE_SET
  18. dnl Checks for header files.
  19. AC_HEADER_STDC
  20. AC_HEADER_TIME
  21. AC_HEADER_SYS_WAIT
  22. AC_CHECK_HEADERS(ctype.h dirent.h errno.h fcntl.h getopt.h grp.h netdb.h pwd.h signal.h strings.h string.h syslog.h unistd.h arpa/inet.h netinet/in.h sys/types.h sys/time.h sys/resource.h sys/wait.h sys/socket.h sys/stat.h)
  23. dnl Checks for typedefs, structures, and compiler characteristics.
  24. AC_C_CONST
  25. AC_STRUCT_TM
  26. AC_TYPE_MODE_T
  27. AC_TYPE_PID_T
  28. AC_TYPE_SIZE_T
  29. AC_TYPE_SIGNAL
  30. AC_TYPE_GETGROUPS
  31. dnl Define u_int32_t if we don't have it already (Solaris)
  32. AC_CHECK_SIZEOF(int)
  33. AC_CHECK_SIZEOF(short)
  34. AC_CHECK_SIZEOF(long)
  35. if test "$ac_cv_sizeof_int" = 4 ; then
  36. AC_CHECK_TYPE(int32_t, int)
  37. AC_CHECK_TYPE(u_int32_t, unsigned int)
  38. elif test "$ac_cv_sizeof_short" = 4 ; then
  39. AC_CHECK_TYPE(int32_t, short)
  40. AC_CHECK_TYPE(u_int32_t, unsigned short)
  41. elif test "$ac_cv_sizeof_long" = 4 ; then
  42. AC_CHECK_TYPE(int32_t, long)
  43. AC_CHECK_TYPE(u_int32_t, unsigned long)
  44. else
  45. AC_MSG_ERROR([Cannot find a type with size of 32 bits])
  46. fi
  47. dnl Checks for library functions.
  48. AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
  49. AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
  50. AC_SUBST(SOCKETLIBS)
  51. AC_CHECK_FUNCS(strdup strstr strtoul initgroups)
  52. AC_MSG_CHECKING(for type of socket size)
  53. AC_TRY_COMPILE([#include <stdlib.h>
  54. #include <sys/types.h>
  55. #include <sys/socket.h>
  56. ],
  57. [int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);],
  58. [AC_DEFINE(SOCKET_SIZE_TYPE, size_t) AC_MSG_RESULT(size_t)],
  59. [AC_DEFINE(SOCKET_SIZE_TYPE, int) AC_MSG_RESULT(int)])
  60. dnl Does user want to check for SSL?
  61. AC_ARG_ENABLE(ssl,--enable-ssl enables native SSL support,[
  62. if test x$enableval = xyes; then
  63. check_for_ssl=yes
  64. else
  65. check_for_ssl=no
  66. fi
  67. ],check_for_ssl=yes)
  68. dnl Optional SSL library and include paths
  69. ssl_lib_dir=
  70. ssl_inc_dir=
  71. AC_ARG_WITH(ssl-lib,--with-ssl-lib=DIR sets location of the SSL library,[
  72. ssl_lib_dir=$withval
  73. ])
  74. AC_ARG_WITH(ssl-inc,--with-ssl-inc=DIR sets location of the SSL include files,[
  75. ssl_inc_dir=$withval
  76. ])
  77. dnl Check for SSL support
  78. dnl Modified version of Mark Ethan Trostler's macro <trostler@juniper.net>
  79. if test x$check_for_ssl = xyes; then
  80. AC_MSG_CHECKING(for SSL)
  81. found_ssl=no
  82. for dir in $ssl_inc_dir /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
  83. ssldir="$dir"
  84. if test -f "$dir/include/openssl/ssl.h"; then
  85. found_ssl=yes
  86. CFLAGS="$CFLAGS -I$ssldir/include/openssl"
  87. break
  88. fi
  89. if test -f "$dir/include/ssl.h"; then
  90. found_ssl=yes
  91. CFLAGS="$CFLAGS -I$ssldir/include"
  92. break
  93. fi
  94. done
  95. if test x_$found_ssl != x_yes; then
  96. AC_MSG_ERROR(Cannot find ssl libraries)
  97. else
  98. printf "SSL found in $ssldir\n";
  99. LIBS="$LIBS -lssl -lcrypto";
  100. if test x$ssl_lib_dir != x; then
  101. LDFLAGS="$LDFLAGS -L$ssl_lib_dir";
  102. else
  103. LDFLAGS="$LDFLAGS -L$ssldir/lib";
  104. fi
  105. AC_DEFINE_UNQUOTED(HAVE_SSL)
  106. AC_SUBST(HAVE_SSL)
  107. fi
  108. fi
  109. AC_ARG_WITH(nrpe_user,--with-nrpe-user=<user> sets user name to run NRPE,nrpe_user=$withval,nrpe_user=nagios)
  110. AC_ARG_WITH(nrpe_group,--with-nrpe-group=<group> sets group name to run NRPE,nrpe_grp=$withval,nrpe_grp=nagios)
  111. AC_ARG_WITH(nrpe_port,--with-nrpe-port=<port> sets port number for NRPE to listen on,nrpe_port=$withval,nrpe_port=5666)
  112. AC_SUBST(nrpe_user)
  113. AC_SUBST(nrpe_grp)
  114. AC_SUBST(nrpe_port)
  115. AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$nrpe_port)
  116. 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))
  117. AC_PATH_PROG(PERL,perl)
  118. AC_OUTPUT(Makefile src/Makefile subst)
  119. perl subst nrpe.cfg
  120. perl subst init-script
  121. perl subst init-script.debian
  122. perl subst init-script.freebsd
  123. perl subst nrpe.xinetd
  124. dnl Review options
  125. echo ""
  126. echo ""
  127. AC_MSG_RESULT([*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:])
  128. echo ""
  129. echo " General Options:"
  130. echo " -------------------------"
  131. AC_MSG_RESULT([ NRPE port: $nrpe_port])
  132. AC_MSG_RESULT([ NRPE user: $nrpe_user])
  133. AC_MSG_RESULT([ NRPE group: $nrpe_grp])
  134. echo ""
  135. echo ""
  136. echo "Review the options above for accuracy. If they look okay,"
  137. echo "type 'make all' to compile the NRPE daemon and client."
  138. echo ""