configure.in 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. AC_CHECK_TYPE(u_int32_t,unsigned int)
  36. if test "$ac_cv_type_u_int32_t" = no ; then
  37. if test "$ac_cv_sizeof_long" = 4 ; then
  38. AC_DEFINE(U_INT32_T_IS_ULONG)
  39. else
  40. if test "$ac_cv_sizeof_int" = 4 ; then
  41. AC_DEFINE(U_INT32_T_IS_UINT)
  42. else
  43. if test "$ac_cv_sizeof_short" = 4 ; then
  44. AC_DEFINE(U_INT32_T_IS_USHORT)
  45. fi
  46. fi
  47. fi
  48. fi
  49. dnl AC_CHECK_SIZEOF(int)
  50. dnl AC_CHECK_SIZEOF(short)
  51. dnl AC_CHECK_SIZEOF(long)
  52. dnl if test "$ac_cv_sizeof_int" = 4 ; then
  53. dnl AC_CHECK_TYPE(int32_t, int)
  54. dnl AC_CHECK_TYPE(u_int32_t, unsigned int)
  55. dnl elif test "$ac_cv_sizeof_short" = 4 ; then
  56. dnl AC_CHECK_TYPE(int32_t, short)
  57. dnl AC_CHECK_TYPE(u_int32_t, unsigned short)
  58. dnl elif test "$ac_cv_sizeof_long" = 4 ; then
  59. dnl AC_CHECK_TYPE(int32_t, long)
  60. dnl AC_CHECK_TYPE(u_int32_t, unsigned long)
  61. dnl else
  62. dnl AC_MSG_ERROR([Cannot find a type with size of 32 bits])
  63. dnl fi
  64. dnl Checks for library functions.
  65. AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
  66. AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
  67. AC_SUBST(SOCKETLIBS)
  68. AC_CHECK_FUNCS(strdup strstr strtoul initgroups)
  69. AC_MSG_CHECKING(for type of socket size)
  70. AC_TRY_COMPILE([#include <stdlib.h>
  71. #include <sys/types.h>
  72. #include <sys/socket.h>
  73. ],
  74. [int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);],
  75. [AC_DEFINE(SOCKET_SIZE_TYPE, size_t) AC_MSG_RESULT(size_t)],
  76. [AC_DEFINE(SOCKET_SIZE_TYPE, int) AC_MSG_RESULT(int)])
  77. dnl Does user want to check for SSL?
  78. AC_ARG_ENABLE(ssl,--enable-ssl enables native SSL support,[
  79. if test x$enableval = xyes; then
  80. check_for_ssl=yes
  81. else
  82. check_for_ssl=no
  83. fi
  84. ],check_for_ssl=yes)
  85. dnl Optional SSL library and include paths
  86. ssl_lib_dir=
  87. ssl_inc_dir=
  88. AC_ARG_WITH(ssl-lib,--with-ssl-lib=DIR sets location of the SSL library,[
  89. ssl_lib_dir=$withval
  90. ])
  91. AC_ARG_WITH(ssl-inc,--with-ssl-inc=DIR sets location of the SSL include files,[
  92. ssl_inc_dir=$withval
  93. ])
  94. dnl Check for SSL support
  95. dnl Modified version of Mark Ethan Trostler's macro <trostler@juniper.net>
  96. if test x$check_for_ssl = xyes; then
  97. AC_MSG_CHECKING(for SSL)
  98. found_ssl=no
  99. for dir in $ssl_inc_dir /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
  100. ssldir="$dir"
  101. if test -f "$dir/include/openssl/ssl.h"; then
  102. found_ssl=yes
  103. CFLAGS="$CFLAGS -I$ssldir/include/openssl"
  104. break
  105. fi
  106. if test -f "$dir/include/ssl.h"; then
  107. found_ssl=yes
  108. CFLAGS="$CFLAGS -I$ssldir/include"
  109. break
  110. fi
  111. done
  112. if test x_$found_ssl != x_yes; then
  113. AC_MSG_ERROR(Cannot find ssl libraries)
  114. else
  115. printf "SSL found in $ssldir\n";
  116. LIBS="$LIBS -lssl -lcrypto";
  117. if test x$ssl_lib_dir != x; then
  118. LDFLAGS="$LDFLAGS -L$ssl_lib_dir";
  119. else
  120. LDFLAGS="$LDFLAGS -L$ssldir/lib";
  121. fi
  122. AC_DEFINE_UNQUOTED(HAVE_SSL)
  123. AC_SUBST(HAVE_SSL)
  124. dnl Generate DH parameters
  125. echo ""
  126. echo "*** Generating DH Parameters for SSL/TLS ***"
  127. openssl dhparam -out /dev/null -C 512 > src/dh.h
  128. fi
  129. fi
  130. AC_ARG_WITH(nrpe_user,--with-nrpe-user=<user> sets user name to run NRPE,nrpe_user=$withval,nrpe_user=nagios)
  131. AC_ARG_WITH(nrpe_group,--with-nrpe-group=<group> sets group name to run NRPE,nrpe_grp=$withval,nrpe_grp=nagios)
  132. AC_ARG_WITH(nrpe_port,--with-nrpe-port=<port> sets port number for NRPE to listen on,nrpe_port=$withval,nrpe_port=5666)
  133. AC_SUBST(nrpe_user)
  134. AC_SUBST(nrpe_grp)
  135. AC_SUBST(nrpe_port)
  136. AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$nrpe_port)
  137. 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))
  138. AC_PATH_PROG(PERL,perl)
  139. AC_OUTPUT(Makefile src/Makefile subst)
  140. perl subst nrpe.cfg
  141. perl subst init-script
  142. perl subst init-script.debian
  143. perl subst init-script.freebsd
  144. perl subst nrpe.xinetd
  145. dnl Review options
  146. echo ""
  147. echo ""
  148. AC_MSG_RESULT([*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:])
  149. echo ""
  150. echo " General Options:"
  151. echo " -------------------------"
  152. AC_MSG_RESULT([ NRPE port: $nrpe_port])
  153. AC_MSG_RESULT([ NRPE user: $nrpe_user])
  154. AC_MSG_RESULT([ NRPE group: $nrpe_grp])
  155. echo ""
  156. echo ""
  157. echo "Review the options above for accuracy. If they look okay,"
  158. echo "type 'make all' to compile the NRPE daemon and client."
  159. echo ""