configure.in 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_REVISION ($Revision$)
  3. AC_PREREQ(2.50)
  4. AC_INIT(nagios-plugins,1.4.0-alpha3)
  5. AC_CONFIG_SRCDIR(Helper.pm)
  6. AM_INIT_AUTOMAKE
  7. AM_CONFIG_HEADER(config.h)
  8. AC_CANONICAL_HOST
  9. RELEASE=1
  10. AC_SUBST(RELEASE)
  11. AC_PREFIX_DEFAULT(/usr/local/nagios)
  12. dnl Figure out how to invoke "install" and what install options to use.
  13. AC_PROG_INSTALL
  14. AC_SUBST(INSTALL)
  15. AC_GNU_SOURCE
  16. AC_PROG_CC
  17. AC_PROG_CPP
  18. AC_PROG_GCC_TRADITIONAL
  19. AC_PROG_RANLIB
  20. AC_AIX
  21. AC_MINIX
  22. AC_PROG_MAKE_SET
  23. AC_PROG_AWK
  24. AC_FUNC_MALLOC
  25. AC_FUNC_REALLOC
  26. jm_PREREQ_ERROR
  27. AC_FUNC_ERROR_AT_LINE
  28. AC_CONFIG_LIBOBJ_DIR(lib)
  29. AC_FUNC_GETLOADAVG([lib])
  30. ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
  31. dnl AM_WITH_REGEX
  32. PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
  33. AC_SUBST(PLUGIN_TEST)dnl
  34. SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
  35. AC_SUBST(SCRIPT_TEST)dnl
  36. WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
  37. AC_SUBST(WARRANTY)
  38. 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.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
  39. AC_SUBST(SUPPORT)
  40. dnl CGIURL has changed for Nagios with 1.0 beta
  41. AC_ARG_WITH(cgiurl,
  42. ACX_HELP_STRING([--with-cgiurl=DIR],
  43. [sets URL for cgi programs]),
  44. with_cgiurl=$withval,
  45. with_cgiurl=/nagios/cgi-bin)
  46. CGIURL="$with_cgiurl"
  47. AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
  48. AC_ARG_WITH(nagios_user,
  49. ACX_HELP_STRING([--with-nagios-user=USER],
  50. [set user name to run nagios]),
  51. with_nagios_user=$withval,
  52. with_nagios_user=nagios)
  53. AC_ARG_WITH(nagios_group,
  54. ACX_HELP_STRING([--with-nagios-group=GROUP],
  55. [set group name to run nagios]),
  56. with_nagios_group=$withval,
  57. with_nagios_group=nagios)
  58. AC_SUBST(with_nagios_user)
  59. AC_SUBST(with_nagios_group)
  60. INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
  61. AC_SUBST(INSTALL_OPTS)
  62. AC_ARG_WITH(trusted_path,
  63. ACX_HELP_STRING([--with-trusted-path=PATH],
  64. [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
  65. with_trusted_path=$withval,
  66. with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
  67. AC_SUBST(with_trusted_path)
  68. EXTRAS=
  69. dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
  70. LDFLAGS="$LDFLAGS -L."
  71. ac_cv_uname_m=`uname -m`
  72. ac_cv_uname_s=`uname -s`
  73. ac_cv_uname_r=`uname -r`
  74. ac_cv_uname_v=`uname -v`
  75. PKG_ARCH=`uname -p`
  76. REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
  77. REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
  78. AC_SUBST(PKG_ARCH)
  79. AC_SUBST(REV_DATESTAMP)
  80. AC_SUBST(REV_TIMESTAMP)
  81. dnl Checks for programs.
  82. AC_PATH_PROG(PYTHON,python)
  83. AC_PATH_PROG(PERL,perl)
  84. AC_PATH_PROG(SH,sh)
  85. AC_PATH_PROG(HOSTNAME,hostname)
  86. AC_PATH_PROG(BASENAME,basename)
  87. dnl
  88. dnl Check for miscellaneous stuff
  89. dnl
  90. case $host_vender-$host_os in
  91. sun*)
  92. AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
  93. ;;
  94. osf*)
  95. AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
  96. ;;
  97. esac
  98. dnl
  99. dnl Checks for libraries.
  100. dnl
  101. AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
  102. AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
  103. AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
  104. AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
  105. AC_SUBST(SOCKETLIBS)
  106. dnl Check for PostgreSQL libraries
  107. _SAVEDLIBS="$LIBS"
  108. _SAVEDCPPFLAGS="$CPPFLAGS"
  109. AC_ARG_WITH(pgsql,
  110. ACX_HELP_STRING([--with-pgsql=DIR],
  111. [sets path to pgsql installation]),
  112. PGSQL=$withval,)
  113. AC_CHECK_LIB(crypt,main)
  114. if test "$ac_cv_lib_crypt_main" = "yes"; then
  115. if test -n "$PGSQL"; then
  116. LDFLAGS="$LDFLAGS -L$PGSQL/lib"
  117. CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
  118. fi
  119. AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
  120. if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
  121. AC_CHECK_HEADERS(pgsql/libpq-fe.h)
  122. AC_CHECK_HEADERS(postgresql/libpq-fe.h)
  123. AC_CHECK_HEADERS(libpq-fe.h)
  124. if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
  125. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  126. PGINCLUDE="-I$PGSQL/include"
  127. elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
  128. PGLIBS="-lpq -lcrypt"
  129. PGINCLUDE="-I/usr/include/pgsql"
  130. elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
  131. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  132. PGINCLUDE="-I/usr/include/postgresql"
  133. elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
  134. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  135. PGINCLUDE="-I$PGSQL/include"
  136. fi
  137. if test -z "$PGINCLUDE"; then
  138. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  139. AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
  140. else
  141. AC_SUBST(PGLIBS)
  142. AC_SUBST(PGINCLUDE)
  143. EXTRAS="$EXTRAS check_pgsql"
  144. fi
  145. else
  146. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  147. AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
  148. AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
  149. fi
  150. else
  151. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  152. AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
  153. fi
  154. LIBS="$_SAVEDLIBS"
  155. CPPFLAGS="$_SAVEDCPPFLAGS"
  156. dnl Check for radius libraries
  157. _SAVEDLIBS="$LIBS"
  158. AC_CHECK_LIB(radiusclient,rc_read_config)
  159. if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
  160. EXTRAS="$EXTRAS check_radius"
  161. RADIUSLIBS="-lradiusclient"
  162. AC_SUBST(RADIUSLIBS)
  163. else
  164. AC_MSG_WARN([Skipping radius plugin])
  165. AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
  166. fi
  167. LIBS="$_SAVEDLIBS"
  168. dnl Check for LDAP libraries
  169. _SAVEDLIBS="$LIBS"
  170. AC_CHECK_LIB(ldap,main,,,-llber)
  171. if test "$ac_cv_lib_ldap_main" = "yes"; then
  172. LDAPLIBS="-lldap -llber"\
  173. LDAPINCLUDE="-I/usr/include/ldap"
  174. AC_SUBST(LDAPLIBS)
  175. AC_SUBST(LDAPINCLUDE)
  176. AC_CHECK_FUNCS(ldap_set_option)
  177. EXTRAS="$EXTRAS check_ldap"
  178. AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
  179. else
  180. AC_MSG_WARN([Skipping LDAP plugin])
  181. AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
  182. fi
  183. LIBS="$_SAVEDLIBS"
  184. dnl Check for mysql libraries
  185. _SAVEDLIBS="$LIBS"
  186. _SAVEDCPPFLAGS="$CPPFLAGS"
  187. AC_ARG_WITH(mysql,
  188. ACX_HELP_STRING([--with-mysql=DIR],
  189. [sets path to mysql installation (assumes lib/mysql and include subdirs]),
  190. MYSQL=$withval,)
  191. if test -n "$MYSQL"; then
  192. MYSQLLIBDIR=$MYSQL/lib/mysql
  193. CPPFLAGS="-I$MYSQL/include"
  194. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
  195. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
  196. elif test -f /usr/lib/libmysqlclient.so; then
  197. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
  198. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
  199. elif test -f /usr/lib/libmysqlclient.a; then
  200. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
  201. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
  202. elif test -f /usr/lib/mysql/libmysqlclient.so; then
  203. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
  204. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
  205. elif test -f /usr/lib/mysql/libmysqlclient.a; then
  206. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
  207. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
  208. fi
  209. if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
  210. AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
  211. if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
  212. EXTRAS="$EXTRAS check_mysql"
  213. AC_SUBST(MYSQLINCLUDE)
  214. AC_SUBST(MYSQLLIBS)
  215. AC_SUBST(check_mysql_LDFLAGS)
  216. else
  217. AC_MSG_WARN([Skipping mysql plugin])
  218. AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
  219. fi
  220. else
  221. AC_MSG_WARN([Skipping mysql plugin])
  222. AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
  223. fi
  224. CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
  225. LIBS="$_SAVEDLIBS"
  226. dnl Check for OpenSSL location
  227. dnl This whole check is inspired by curl 7.12.2's configure.ac
  228. OPT_OPENSSL=off
  229. AC_ARG_WITH(openssl,
  230. AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
  231. AC_HELP_STRING([--without-openssl], [disable openssl]),
  232. OPT_OPENSSL=$withval)
  233. if test X"$OPT_OPENSSL" = "Xno"; then
  234. AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
  235. with_openssl=no
  236. else
  237. dnl backup the pre-ssl variables
  238. CLEANLDFLAGS="$LDFLAGS"
  239. CLEANCPPFLAGS="$CPPFLAGS"
  240. CLEANLIBS="$LIBS"
  241. case "$OPT_OPENSSL" in
  242. yes)
  243. dnl --with-openssl (without path) used
  244. PKGTEST="yes"
  245. ;;
  246. off)
  247. dnl no --with-openssl given, check default places
  248. PKGTEST="yes"
  249. ;;
  250. *)
  251. dnl use the given area
  252. PKGTEST="no"
  253. OPENSSL=$OPT_OPENSSL
  254. LDFLAGS="$LDFLAGS -L$OPENSSL/lib"
  255. CPPFLAGS="$CPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
  256. ;;
  257. esac
  258. dnl Check usual areas for openssl
  259. if test "$PKGTEST" = "yes"; then
  260. AC_PATH_PROG(OPENSSL,openssl)
  261. # Don't think 2 tests below are necessary because /usr is always included
  262. # if test "$OPENSSL" = "/usr/bin/openssl"; then
  263. # OPENSSL=/usr
  264. #elif test "$OPENSSL" = "/usr/sbin/openssl"; then
  265. # OPENSSL=/usr
  266. if test "$OPENSSL" = "/opt/bin/openssl"; then
  267. OPENSSL=/opt
  268. elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
  269. OPENSSL=/opt/openssl
  270. elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
  271. OPENSSL=/usr/slocal
  272. elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
  273. OPENSSL=/usr/local
  274. elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
  275. OPENSSL=/usr/local/ssl
  276. fi
  277. fi
  278. AC_CHECK_LIB(crypto, CRYPTO_lock,[
  279. HAVECRYPTO="yes"
  280. ],[
  281. LDFLAGS="$CLEANLDFLAGS -L$OPENSSL/lib"
  282. CPPFLAGS="$CLEANCPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
  283. AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
  284. HAVECRYPTO="yes" ], [
  285. LDFLAGS="$CLEANLDFLAGS"
  286. CPPFLAGS="$CLEANCPPFLAGS"
  287. LIBS="$CLEANLIBS"
  288. ])
  289. ])
  290. if test "$HAVECRYPTO" = "yes"; then
  291. dnl This is only reasonable to do if crypto actually is there: check for
  292. dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
  293. dnl This is for Msys/Mingw
  294. AC_MSG_CHECKING([for gdi32])
  295. my_ac_save_LIBS=$LIBS
  296. LIBS="-lgdi32 $LIBS"
  297. AC_TRY_LINK([#include <windef.h>
  298. #include <wingdi.h>],
  299. [GdiFlush();],
  300. [ dnl worked!
  301. AC_MSG_RESULT([yes])],
  302. [ dnl failed, restore LIBS
  303. LIBS=$my_ac_save_LIBS
  304. AC_MSG_RESULT(no)]
  305. )
  306. AC_CHECK_LIB(crypto, CRYPTO_add_lock)
  307. AC_CHECK_LIB(ssl, SSL_connect)
  308. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  309. dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
  310. AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
  311. OLIBS=$LIBS
  312. LIBS="$LIBS -lRSAglue -lrsaref"
  313. AC_CHECK_LIB(ssl, SSL_connect)
  314. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  315. dnl still no SSL_connect
  316. AC_MSG_RESULT(no)
  317. LIBS=$OLIBS
  318. else
  319. AC_MSG_RESULT(yes)
  320. fi
  321. fi
  322. dnl Check for SSLeay headers
  323. AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
  324. openssl/pem.h openssl/ssl.h openssl/err.h,
  325. OPENSSL_ENABLED=1)
  326. if test $ac_cv_header_openssl_x509_h = no; then
  327. AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
  328. OPENSSL_ENABLED=1)
  329. fi
  330. dnl If the ENGINE library seems to be around, check for the OpenSSL engine
  331. dnl header, it is kind of "separated" from the main SSL check
  332. AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ])
  333. dnl AC_SUBST(OPENSSL_ENABLED)
  334. dnl these can only exist if openssl exists
  335. AC_CHECK_FUNCS( RAND_status \
  336. RAND_screen \
  337. RAND_egd \
  338. CRYPTO_cleanup_all_ex_data )
  339. fi
  340. if test "$OPENSSL_ENABLED" != "1"; then
  341. AC_MSG_WARN([OpenSSL libs and/or directories were not found where specified!])
  342. with_openssl="no"
  343. else
  344. check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
  345. AC_SUBST(check_tcp_ssl)
  346. AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
  347. with_openssl="yes"
  348. # Needed for subsequent compiled programs
  349. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSSL/lib$libsuff"
  350. export LD_LIBRARY_PATH
  351. fi
  352. fi
  353. AC_CHECK_HEADERS(unistd.h)
  354. dnl Check for AF_INET6 support - unistd.h required for Darwin
  355. AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
  356. AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
  357. #include <unistd.h>
  358. #endif
  359. #include <netinet/in.h>
  360. #include <sys/socket.h>],
  361. [struct sockaddr_in6 sin6;
  362. void *p;
  363. sin6.sin6_family = AF_INET6;
  364. sin6.sin6_port = 587;
  365. p = &sin6.sin6_addr;],
  366. [with_ipv6=yes],
  367. [with_ipv6=no])
  368. ])
  369. if test x"$with_ipv6" != xno ; then
  370. AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
  371. fi
  372. dnl #########################################################################
  373. dnl Check if Posix getaddrinfo() is available. It is also possible to use
  374. dnl the version from the lwres library distributed with BIND.
  375. dnl #########################################################################
  376. AC_ARG_ENABLE([emulate-getaddrinfo],
  377. ACX_HELP_STRING([--enable-emulate-getaddrinfo],
  378. [enable getaddrinfo emulation (default=no)]),
  379. ,
  380. enable_emulate_getaddrinfo=no)
  381. AC_ARG_WITH(lwres,
  382. ACX_HELP_STRING([--with-lwres=DIR],
  383. [use lwres library for getaddrinfo (default=no)]),
  384. ,
  385. with_lwres=no)
  386. dnl ## enable force to test getaddrinfo.c
  387. if test x$enable_emulate_getaddrinfo = xforce ; then
  388. enable_emulate_getaddrinfo=yes
  389. have_getaddrinfo=no
  390. else
  391. have_getaddrinfo=no
  392. if test x$with_lwres != xno ; then
  393. if test "$with_lwres" != yes ; then
  394. CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
  395. LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
  396. fi
  397. AC_CHECK_HEADERS(lwres/netdb.h, ,
  398. [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
  399. AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
  400. [AC_MSG_ERROR([cannot find the lwres library])],
  401. -lnsl -lpthread)
  402. have_getaddrinfo=yes
  403. fi
  404. if test x$have_getaddrinfo != xyes ; then
  405. AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
  406. fi
  407. dnl # Special nonsense for systems that actually have getaddrinfo but
  408. dnl # redefine the name to something else, e.g. OSF
  409. if test x$have_getaddrinfo != xyes ; then
  410. AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
  411. AC_TRY_LINK([
  412. # include <netdb.h>
  413. ], [
  414. struct addrinfo hints, *res;
  415. int err;
  416. err = getaddrinfo ("host", "service", &hints, &res);
  417. ], [
  418. have_getaddrinfo=yes
  419. AC_MSG_RESULT(yes)
  420. ], [AC_MSG_RESULT(no)])
  421. fi
  422. fi
  423. if test x$have_getaddrinfo != xno ; then
  424. if test x$enable_emulate_getaddrinfo != xno ; then
  425. AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
  426. fi
  427. AC_DEFINE(HAVE_GETADDRINFO, 1,
  428. [Does system provide RFC 2553/Posix getaddrinfo?])
  429. else
  430. if test x$enable_emulate_getaddrinfo != xyes ; then
  431. dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
  432. enable_emulate_getaddrinfo=yes
  433. AC_MSG_WARN([enabling getaddrinfo emulation])
  434. fi
  435. EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
  436. fi
  437. if test x"$enable_emulate_getaddrinfo" != xno ; then
  438. have_resolver=no
  439. dnl Try for getipnodebyname
  440. AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
  441. if test x"$have_resolver" != xno ; then
  442. AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
  443. [Set when getipnodebyname is available])
  444. fi
  445. dnl Try for gethostbyname_r
  446. if test x"$have_resolver" = xno ; then
  447. AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
  448. [have_resolver=yes
  449. ACX_WHICH_GETHOSTBYNAME_R])
  450. fi
  451. dnl Try for gethostbyname
  452. if test x"$have_resolver" = xno ; then
  453. if test x"$enable_pthreads" != xno ; then
  454. AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
  455. fi
  456. AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
  457. [AC_MSG_ERROR([cannot find gethostbyname])])
  458. fi
  459. EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
  460. fi
  461. AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
  462. if test "$FOUNDINCLUDE" = "no"; then
  463. _SAVEDCPPFLAGS="$CPPFLAGS"
  464. CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
  465. unset ac_cv_header_krb5_h
  466. AC_CHECK_HEADERS(krb5.h,
  467. KRB5INCLUDE="-I/usr/kerberos/include"
  468. FOUNDINCLUDE=yes,
  469. FOUNDINCLUDE=no)
  470. fi
  471. AC_SUBST(KRBINCLUDE)
  472. if test "$FOUNDINCLUDE" = "no"; then
  473. CPPFLAGS="$_SAVEDCPPFLAGS"
  474. fi
  475. dnl
  476. dnl Checks for header files.
  477. dnl
  478. AC_HEADER_STDC
  479. AC_HEADER_TIME
  480. AC_HEADER_SYS_WAIT
  481. 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)
  482. AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
  483. AC_CHECK_HEADERS(limits.h sys/param.h)
  484. AC_CHECK_HEADERS([sys/mount.h],[],[],[
  485. #ifdef HAVE_SYS_PARAM_H
  486. #include <sys/param.h>
  487. #endif
  488. ])
  489. AC_CHECK_HEADERS(sys/vfs.h sys/fs/s5param.h sys/filsys.h fcntl.h sys/statfs.h sys/dustat.h sys/statvfs.h)
  490. # glibc 2.3.2 stdlib.h does not define HUGE_VAL (see man strtod)
  491. AC_MSG_CHECKING([for HUGE_VAL in <stdlib.h>])
  492. AC_TRY_COMPILE([#include <stdlib.h>],
  493. [double x = HUGE_VAL;],
  494. [AC_MSG_RESULT(yes)],
  495. [AC_MSG_RESULT(no)
  496. AC_MSG_CHECKING([for HUGE_VAL in <math.h>])
  497. AC_TRY_COMPILE([#include <math.h>],
  498. [double x = HUGE_VAL;],
  499. [AC_MSG_RESULT(yes)
  500. AC_DEFINE_UNQUOTED(HUGE_VAL_NEEDS_MATH_H, 1,
  501. [Define if <math.h> is required for HUGE_VAL])],
  502. [AC_MSG_RESULT(no)])])
  503. # Define HAVE_INTTYPES_H if <inttypes.h> exists,
  504. # doesn't clash with <sys/types.h>, and declares uintmax_t.
  505. AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
  506. [AC_TRY_COMPILE(
  507. [#include <sys/types.h>
  508. #include <inttypes.h>],
  509. [uintmax_t i = (uintmax_t) -1;],
  510. jm_ac_cv_header_inttypes_h=yes,
  511. jm_ac_cv_header_inttypes_h=no)])
  512. if test $jm_ac_cv_header_inttypes_h = yes; then
  513. AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
  514. [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
  515. and declares uintmax_t. ])
  516. fi
  517. # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
  518. # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
  519. # enable the work-around code in fsusage.c.
  520. AC_MSG_CHECKING([for statfs that truncates block counts])
  521. AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
  522. [AC_TRY_COMPILE([
  523. #if !defined(sun) && !defined(__sun)
  524. choke -- this is a workaround for a Sun-specific problem
  525. #endif
  526. #include <sys/types.h>
  527. #include <sys/vfs.h>],
  528. [struct statfs t; long c = *(t.f_spare);],
  529. fu_cv_sys_truncating_statfs=yes
  530. AC_MSG_RESULT(yes),
  531. fu_cv_sys_truncating_statfs=no
  532. AC_MSG_RESULT(no),
  533. )])
  534. if test $fu_cv_sys_truncating_statfs = yes; then
  535. AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
  536. [ Define if the block counts reported by statfs may be truncated to 2GB
  537. and the correct values may be stored in the f_spare array.
  538. (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
  539. SunOS 4.1.1 seems not to be affected.)])
  540. fi
  541. dnl Checks for typedefs, structures, and compiler characteristics.
  542. AC_C_CONST
  543. AC_STRUCT_TM
  544. AC_TYPE_PID_T
  545. AC_TYPE_SIZE_T
  546. AC_TYPE_SIGNAL
  547. AC_CHECK_SIZEOF(int,cross)
  548. AC_CHECK_SIZEOF(long,cross)
  549. AC_CHECK_SIZEOF(short,cross)
  550. AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
  551. AC_TRY_RUN([#include <stdio.h>
  552. main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
  553. ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
  554. if test x"$ac_cv_have_longlong" = x"yes"; then
  555. AC_DEFINE(HAVE_LONGLONG,1,[Define if system has long long type])
  556. fi
  557. #
  558. # Check if the compiler supports the LL prefix on long long integers.
  559. # AIX needs this.
  560. AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
  561. AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
  562. ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
  563. if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
  564. AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Define if compiler support long long])
  565. fi
  566. AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
  567. AC_TRY_LINK([#include <stdarg.h>
  568. va_list ap1,ap2;], [va_copy(ap1,ap2);],
  569. ac_cv_HAVE_VA_COPY=yes,
  570. ac_cv_HAVE_VA_COPY=no)])
  571. if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
  572. AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
  573. else
  574. AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
  575. AC_TRY_LINK([#include <stdarg.h>
  576. va_list ap1,ap2;], [__va_copy(ap1,ap2);],
  577. ac_cv_HAVE___VA_COPY=yes,
  578. ac_cv_HAVE___VA_COPY=no)])
  579. if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
  580. AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
  581. fi
  582. fi
  583. AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
  584. AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
  585. AC_TRY_RUN([
  586. #include <sys/types.h>
  587. #include <stdarg.h>
  588. void foo(const char *format, ...) {
  589. va_list ap;
  590. int len;
  591. char buf[5];
  592. va_start(ap, format);
  593. len = vsnprintf(buf, 0, format, ap);
  594. va_end(ap);
  595. if (len != 5) exit(1);
  596. va_start(ap, format);
  597. len = vsnprintf(0, 0, format, ap);
  598. va_end(ap);
  599. if (len != 5) exit(1);
  600. if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
  601. exit(0);
  602. }
  603. main() { foo("hello"); }
  604. ],
  605. ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
  606. if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
  607. AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
  608. fi
  609. AC_TRY_COMPILE([#include <sys/time.h>],
  610. [struct timeval *tv;
  611. struct timezone *tz;],
  612. AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
  613. AC_TRY_COMPILE([#include <sys/time.h>],
  614. [struct timeval *tv;
  615. struct timezone *tz;
  616. gettimeofday(tv, tz);],
  617. AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
  618. AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
  619. dnl Checks for library functions.
  620. AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
  621. AC_MSG_CHECKING(return type of socket size)
  622. AC_TRY_COMPILE([#include <stdlib.h>
  623. #include <sys/types.h>
  624. #include <sys/socket.h>],
  625. [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
  626. ac_cv_socket_size_type=["size_t"]
  627. AC_MSG_RESULT(size_t),
  628. ac_cv_socket_size_type=["int"]
  629. AC_MSG_RESULT(int))
  630. AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
  631. [Define type of socket size])
  632. if test -f "/proc/loadavg"
  633. then
  634. AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
  635. AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
  636. fi
  637. dnl #### Process table test
  638. AC_PATH_PROG(PATH_TO_PS,ps)
  639. AC_MSG_CHECKING(for ps syntax)
  640. dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
  641. dnl STAT UCOMM VSZ RSS USER PPID COMMAND
  642. if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  643. egrep -i ["^ *STAT +UCOMM +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
  644. then
  645. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  646. ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
  647. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  648. ac_cv_ps_cols=8
  649. AC_MSG_RESULT([$ac_cv_ps_command])
  650. dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
  651. elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
  652. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
  653. then
  654. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
  655. ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
  656. ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
  657. ac_cv_ps_cols=9
  658. AC_MSG_RESULT([$ac_cv_ps_command])
  659. dnl FreeBSD
  660. elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
  661. egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
  662. then
  663. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  664. ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
  665. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  666. ac_cv_ps_cols=8
  667. AC_MSG_RESULT([$ac_cv_ps_command])
  668. dnl BSD-like mode in RH 6.1
  669. elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
  670. egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  671. then
  672. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  673. ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
  674. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  675. ac_cv_ps_cols=8
  676. AC_MSG_RESULT([$ac_cv_ps_command])
  677. dnl SunOS 4.1.3:
  678. dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
  679. dnl Need the head -1 otherwise test will work because arguments are found
  680. elif ps -laxnwww 2>/dev/null | head -1 | \
  681. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
  682. then
  683. ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
  684. ac_cv_ps_command="$PATH_TO_PS -laxnwww"
  685. ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
  686. ac_cv_ps_cols=8
  687. AC_MSG_RESULT([$ac_cv_ps_command])
  688. dnl Debian Linux / procps v1.2.9:
  689. dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
  690. dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
  691. dnl
  692. elif ps laxnwww 2>/dev/null | \
  693. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
  694. then
  695. ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
  696. ac_cv_ps_command="$PATH_TO_PS laxnwww"
  697. ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
  698. ac_cv_ps_cols=8
  699. AC_MSG_RESULT([$ac_cv_ps_command])
  700. dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
  701. elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  702. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  703. then
  704. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  705. ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
  706. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  707. ac_cv_ps_cols=8
  708. AC_MSG_RESULT([$ac_cv_ps_command])
  709. dnl Tru64 - needs %*[ +] in PS_FORMAT
  710. elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  711. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  712. then
  713. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  714. ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
  715. ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
  716. ac_cv_ps_cols=8
  717. AC_MSG_RESULT([$ac_cv_ps_command])
  718. elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
  719. egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  720. then
  721. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  722. ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
  723. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  724. ac_cv_ps_cols=8
  725. AC_MSG_RESULT([$ac_cv_ps_command])
  726. dnl AIX 4.3.3 and 5.1 do not have an rss field
  727. elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
  728. egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
  729. then
  730. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
  731. ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
  732. ac_cv_ps_format="%s %d %d %d %f %s %n"
  733. ac_cv_ps_cols=7
  734. AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
  735. dnl Solaris 2.6
  736. elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
  737. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  738. then
  739. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  740. ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
  741. # There must be no space between the %s and %n due to a wierd problem in sscanf where
  742. # it will return %n as longer than the line length
  743. ac_cv_ps_format="%s %d %d %d %d %f %s%n"
  744. ac_cv_ps_cols=8
  745. AC_MSG_RESULT([$ac_cv_ps_command])
  746. elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
  747. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  748. then
  749. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  750. ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
  751. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  752. ac_cv_ps_cols=8
  753. AC_MSG_RESULT([$ac_cv_ps_command])
  754. elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
  755. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  756. then
  757. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  758. ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
  759. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  760. ac_cv_ps_cols=8
  761. AC_MSG_RESULT([$ac_cv_ps_command])
  762. dnl wonder who takes state instead of stat
  763. elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
  764. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  765. then
  766. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  767. ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
  768. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  769. ac_cv_ps_cols=7
  770. AC_MSG_RESULT([$ac_cv_ps_command])
  771. dnl IRIX 53
  772. elif ps -el 2>/dev/null | \
  773. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  774. then
  775. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
  776. ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
  777. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
  778. ac_cv_ps_cols=7
  779. AC_MSG_RESULT([$ac_cv_ps_command])
  780. dnl IRIX 63
  781. elif ps -el 2>/dev/null | \
  782. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  783. then
  784. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  785. ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
  786. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  787. ac_cv_ps_cols=5
  788. AC_MSG_RESULT([$ac_cv_ps_command])
  789. dnl AIX 4.1:
  790. dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
  791. dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
  792. elif ps -el 2>/dev/null | \
  793. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  794. then
  795. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  796. ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
  797. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  798. ac_cv_ps_cols=5
  799. AC_MSG_RESULT([$ac_cv_ps_command])
  800. dnl AIX?
  801. elif ps glaxen 2>/dev/null | \
  802. egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
  803. then
  804. ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
  805. ac_cv_ps_command="$PATH_TO_PS glaxen"
  806. ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
  807. ac_cv_ps_cols=7
  808. AC_MSG_RESULT([$ac_cv_ps_command])
  809. dnl MacOSX / Darwin
  810. dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
  811. dnl Some truncation will happen in UCOMM column
  812. dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
  813. dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
  814. elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
  815. egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
  816. then
  817. ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
  818. ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
  819. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  820. ac_cv_ps_cols=7
  821. AC_MSG_RESULT([$ac_cv_ps_command])
  822. dnl UnixWare
  823. elif ps -Al 2>/dev/null | \
  824. egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
  825. then
  826. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  827. ac_cv_ps_command="$PATH_TO_PS -Al"
  828. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  829. ac_cv_ps_cols=7
  830. AC_MSG_RESULT([$ac_cv_ps_command])
  831. else
  832. AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
  833. fi
  834. if test -n "$ac_cv_ps_varlist" ; then
  835. AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
  836. [Variable list for sscanf of 'ps' output])
  837. AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
  838. [Verbatim command to execute for ps in check_procs])
  839. AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
  840. [Format string for scanning ps output in check_procs])
  841. AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
  842. [Number of columns in ps command])
  843. EXTRAS="$EXTRAS check_procs check_nagios"
  844. fi
  845. dnl jm_AFS
  846. jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
  847. jm_FSTYPENAME
  848. jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
  849. AC_PATH_PROG(PATH_TO_PING,ping)
  850. AC_PATH_PROG(PATH_TO_PING6,ping6)
  851. AC_ARG_WITH(ping_command,
  852. ACX_HELP_STRING([--with-ping-command=SYNTAX],
  853. [sets syntax for ICMP ping]),
  854. with_ping_command=$withval,)
  855. AC_MSG_CHECKING(for ICMP ping syntax)
  856. ac_cv_ping_packets_first=no
  857. ac_cv_ping_has_timeout=no
  858. if test -n "$with_ping_command"
  859. then
  860. AC_MSG_RESULT([(command-line) $with_ping_command])
  861. if test -n "$ac_cv_ping_packets_first"
  862. then
  863. ac_cv_ping_packets_first=yes
  864. fi
  865. elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  866. $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  867. egrep -i "^round-trip|^rtt" >/dev/null
  868. then
  869. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  870. ac_cv_ping_packets_first=yes
  871. AC_MSG_RESULT([$with_ping_command])
  872. elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
  873. egrep -i "^round-trip|^rtt" >/dev/null
  874. then
  875. with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
  876. ac_cv_ping_packets_first=yes
  877. ac_cv_ping_has_timeout=yes
  878. AC_MSG_RESULT([$with_ping_command])
  879. elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
  880. egrep -i "^round-trip|^rtt" >/dev/null
  881. then
  882. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  883. ac_cv_ping_packets_first=yes
  884. AC_MSG_RESULT([$with_ping_command])
  885. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  886. egrep -i "^round-trip|^rtt" >/dev/null
  887. then
  888. with_ping_command="$PATH_TO_PING -n -c %d %s"
  889. ac_cv_ping_packets_first=yes
  890. AC_MSG_RESULT([$with_ping_command])
  891. elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
  892. egrep -i "^round-trip|^rtt" >/dev/null
  893. then
  894. with_ping_command="$PATH_TO_PING -n %s -c %d"
  895. AC_MSG_RESULT([$with_ping_command])
  896. elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
  897. egrep -i "^round-trip|^rtt" >/dev/null
  898. then
  899. with_ping_command="$PATH_TO_PING %s -n %d"
  900. AC_MSG_RESULT([$with_ping_command])
  901. elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  902. egrep -i "^round-trip|^rtt" >/dev/null
  903. then
  904. with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
  905. AC_MSG_RESULT([$with_ping_command])
  906. elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
  907. egrep -i "^round-trip|^rtt" >/dev/null
  908. then
  909. with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
  910. AC_MSG_RESULT([$with_ping_command])
  911. elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
  912. egrep -i "^round-trip|^rtt" >/dev/null
  913. then
  914. with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
  915. ac_cv_ping_packets_first=yes
  916. AC_MSG_RESULT([$with_ping_command])
  917. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  918. egrep -i "^round-trip|^rtt" >/dev/null
  919. then
  920. with_ping_command="$PATH_TO_PING -n -c %d %s"
  921. ac_cv_ping_packets_first=yes
  922. AC_MSG_RESULT([$with_ping_command])
  923. else
  924. AC_MSG_WARN([unable to find usable ping syntax])
  925. fi
  926. AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
  927. [path and args for ICMP ping command])
  928. if test "x$ac_cv_ping_packets_first" != "xno"
  929. then
  930. AC_DEFINE(PING_PACKETS_FIRST,1,
  931. [Define if packet count must precede host])
  932. fi
  933. if test "x$ac_cv_ping_has_timeout" != "xno"
  934. then
  935. AC_DEFINE(PING_HAS_TIMEOUT,1,
  936. [Define if ping has its own timeout option that should be set])
  937. fi
  938. AC_ARG_WITH(ping6_command,
  939. ACX_HELP_STRING([--with-ping6-command=SYNTAX],
  940. [sets syntax for ICMPv6 ping]),
  941. with_ping6_command=$withval,)
  942. if test x"$with_ipv6" != xno ; then
  943. AC_MSG_CHECKING(for ICMPv6 ping syntax)
  944. ac_cv_ping6_packets_first=no
  945. if test -n "$with_ping6_command"
  946. then
  947. AC_MSG_RESULT([(command-line) $with_ping6_command])
  948. if test -n "$ac_cv_ping6_packets_first"
  949. then
  950. ac_cv_ping6_packets_first=yes
  951. fi
  952. elif test "x$PATH_TO_PING6" != "x"; then
  953. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  954. $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  955. egrep -i "^round-trip|^rtt" >/dev/null
  956. then
  957. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  958. ac_cv_ping6_packets_first=yes
  959. AC_MSG_RESULT([$with_ping6_command])
  960. elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
  961. egrep -i "^round-trip|^rtt" >/dev/null
  962. then
  963. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  964. ac_cv_ping6_packets_first=yes
  965. AC_MSG_RESULT([$with_ping6_command])
  966. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  967. egrep -i "^round-trip|^rtt" >/dev/null
  968. then
  969. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  970. ac_cv_ping6_packets_first=yes
  971. AC_MSG_RESULT([$with_ping6_command])
  972. elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
  973. egrep -i "^round-trip|^rtt" >/dev/null
  974. then
  975. with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
  976. AC_MSG_RESULT([$with_ping6_command])
  977. elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
  978. egrep -i "^round-trip|^rtt" >/dev/null
  979. then
  980. with_ping6_command="$PATH_TO_PING6 %s -n %d"
  981. AC_MSG_RESULT([$with_ping6_command])
  982. elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  983. egrep -i "^round-trip|^rtt" >/dev/null
  984. then
  985. with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
  986. AC_MSG_RESULT([$with_ping6_command])
  987. elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  988. egrep -i "^round-trip|^rtt" >/dev/null
  989. then
  990. with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
  991. AC_MSG_RESULT([$with_ping6_command])
  992. elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
  993. egrep -i "^round-trip|^rtt" >/dev/null
  994. then
  995. with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
  996. ac_cv_ping6_packets_first=yes
  997. AC_MSG_RESULT([$with_ping_command])
  998. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  999. egrep -i "^round-trip|^rtt" >/dev/null
  1000. then
  1001. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  1002. ac_cv_ping6_packets_first=yes
  1003. AC_MSG_RESULT([$with_ping6_command])
  1004. fi
  1005. elif test "x$PATH_TO_PING" != "x"; then
  1006. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  1007. $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  1008. egrep -i "^round-trip|^rtt" >/dev/null
  1009. then
  1010. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  1011. ac_cv_ping6_packets_first=yes
  1012. AC_MSG_RESULT([$with_ping6_command])
  1013. elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
  1014. egrep -i "^round-trip|^rtt" >/dev/null
  1015. then
  1016. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  1017. ac_cv_ping6_packets_first=yes
  1018. AC_MSG_RESULT([$with_ping6_command])
  1019. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  1020. egrep -i "^round-trip|^rtt" >/dev/null
  1021. then
  1022. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  1023. ac_cv_ping6_packets_first=yes
  1024. AC_MSG_RESULT([$with_ping6_command])
  1025. elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
  1026. egrep -i "^round-trip|^rtt" >/dev/null
  1027. then
  1028. with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
  1029. AC_MSG_RESULT([$with_ping6_command])
  1030. elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
  1031. egrep -i "^round-trip|^rtt" >/dev/null
  1032. then
  1033. with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
  1034. AC_MSG_RESULT([$with_ping6_command])
  1035. elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  1036. egrep -i "^round-trip|^rtt" >/dev/null
  1037. then
  1038. with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
  1039. AC_MSG_RESULT([$with_ping6_command])
  1040. elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  1041. egrep -i "^round-trip|^rtt" >/dev/null
  1042. then
  1043. with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
  1044. AC_MSG_RESULT([$with_ping6_command])
  1045. elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
  1046. egrep -i "^round-trip|^rtt" >/dev/null
  1047. then
  1048. with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
  1049. ac_cv_ping6_packets_first=yes
  1050. AC_MSG_RESULT([$with_ping_command])
  1051. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  1052. egrep -i "^round-trip|^rtt" >/dev/null
  1053. then
  1054. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  1055. ac_cv_ping6_packets_first=yes
  1056. AC_MSG_RESULT([$with_ping6_command])
  1057. fi
  1058. fi
  1059. if test "x$with_ping6_command" != "x"; then
  1060. AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
  1061. [path and args for ICMPv6 ping command])
  1062. else
  1063. AC_MSG_RESULT([none])
  1064. fi
  1065. if test "x$ac_cv_ping6_packets_first" != "xno"; then
  1066. AC_DEFINE(PING6_PACKETS_FIRST,1,
  1067. [Define if packet count must precede host])
  1068. fi
  1069. fi
  1070. AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
  1071. AC_MSG_CHECKING(for nslookup syntax)
  1072. if test -n "$PATH_TO_NSLOOKUP"
  1073. then
  1074. if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
  1075. then
  1076. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
  1077. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1078. else
  1079. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
  1080. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1081. fi
  1082. EXTRAS="$EXTRAS check_dns"
  1083. else
  1084. AC_MSG_WARN([nslookup command not found])
  1085. fi
  1086. AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
  1087. [path and args for nslookup])
  1088. AC_PATH_PROG(PATH_TO_HOST,host)
  1089. if test -n "$ac_cv_path_PATH_TO_HOST"
  1090. then
  1091. EXTRAS="$EXTRAS check_dns"
  1092. fi
  1093. AC_PATH_PROG(PATH_TO_UPTIME,uptime)
  1094. AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
  1095. AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
  1096. AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
  1097. AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
  1098. AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
  1099. AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
  1100. if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
  1101. then
  1102. AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
  1103. AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
  1104. else
  1105. AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
  1106. fi
  1107. AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
  1108. if test -x "$PATH_TO_LMSTAT"
  1109. then
  1110. AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
  1111. else
  1112. AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
  1113. fi
  1114. AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
  1115. if test -x "$PATH_TO_SMBCLIENT"
  1116. then
  1117. AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
  1118. else
  1119. AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
  1120. fi
  1121. AC_PATH_PROG(PATH_TO_WHO,who)
  1122. if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
  1123. then
  1124. ac_cv_path_to_who="$PATH_TO_WHO -q"
  1125. else
  1126. ac_cv_path_to_who="$PATH_TO_WHO"
  1127. fi
  1128. AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
  1129. [path and arguments for invoking 'who'])
  1130. AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
  1131. if test -x "$PATH_TO_SNMPGET"
  1132. then
  1133. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
  1134. EXTRAS="$EXTRAS check_hpjd check_snmp"
  1135. else
  1136. AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
  1137. fi
  1138. AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
  1139. if test -x "$PATH_TO_SNMPGETNEXT"
  1140. then
  1141. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
  1142. fi
  1143. if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
  1144. then
  1145. AC_MSG_CHECKING(for Net::SNMP perl module)
  1146. AC_MSG_RESULT([found])
  1147. else
  1148. AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
  1149. fi
  1150. AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
  1151. AC_PATH_PROG(PATH_TO_QSTAT,qstat)
  1152. if test -x "$PATH_TO_QUAKESTAT"
  1153. then
  1154. ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
  1155. EXTRAS="$EXTRAS check_game"
  1156. elif test -x "$PATH_TO_QSTAT"
  1157. then
  1158. ac_cv_path_to_qstat="$PATH_TO_QSTAT"
  1159. EXTRAS="$EXTRAS check_game"
  1160. else
  1161. AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
  1162. fi
  1163. if test $ac_cv_path_to_qstat
  1164. then
  1165. AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
  1166. [path to qstat/quakestat])
  1167. fi
  1168. AC_PATH_PROG(PATH_TO_FPING,fping)
  1169. if test -x "$PATH_TO_FPING"
  1170. then
  1171. AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
  1172. EXTRAS="$EXTRAS check_fping"
  1173. else
  1174. AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
  1175. fi
  1176. AC_PATH_PROG(PATH_TO_SSH,ssh)
  1177. if test -x "$PATH_TO_SSH"
  1178. then
  1179. AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
  1180. EXTRAS="$EXTRAS check_by_ssh"
  1181. else
  1182. AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
  1183. fi
  1184. AC_PATH_PROG(PATH_TO_MAILQ,mailq)
  1185. if test -x "$PATH_TO_MAILQ"
  1186. then
  1187. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
  1188. else
  1189. AC_MSG_WARN([Could not find mailq or eqivalent])
  1190. fi
  1191. AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
  1192. if test -x "$PATH_TO_QMAIL_QSTAT"
  1193. then
  1194. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
  1195. else
  1196. AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
  1197. fi
  1198. dnl SWAP info required is amount allocated/available and amount free
  1199. dnl The plugin works through all the swap devices and adds up the total swap
  1200. dnl available.
  1201. AC_PATH_PROG(PATH_TO_SWAP,swap)
  1202. if (test -n "$PATH_TO_SWAP")
  1203. then
  1204. AC_MSG_CHECKING([for $PATH_TO_SWAP format])
  1205. if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
  1206. then
  1207. ac_cv_have_swap=yes
  1208. ac_cv_swap_command="$PATH_TO_SWAP -l"
  1209. if [$PATH_TO_SWAP -l 2>/dev/null | \
  1210. egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
  1211. >/dev/null]
  1212. then
  1213. ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
  1214. ac_cv_swap_conv=2048
  1215. AC_MSG_RESULT([using IRIX format swap])
  1216. elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
  1217. then
  1218. ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
  1219. ac_cv_swap_conv=2048
  1220. AC_MSG_RESULT([using Unixware format swap])
  1221. else
  1222. dnl if we don't know what format swap's output is
  1223. dnl we might as well pretend we didn't see it
  1224. ac_cv_have_swap=""
  1225. ac_cv_swap_command=""
  1226. fi
  1227. fi
  1228. dnl end if for PATH_TO_SWAP
  1229. fi
  1230. AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
  1231. if (test -n "$PATH_TO_SWAPINFO")
  1232. then
  1233. AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
  1234. if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
  1235. then
  1236. ac_cv_have_swap=yes
  1237. ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
  1238. if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
  1239. then
  1240. ac_cv_swap_format=["%*s %d %*d %d"]
  1241. ac_cv_swap_conv=1024
  1242. AC_MSG_RESULT([using FreeBSD format swapinfo])
  1243. fi
  1244. elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
  1245. then
  1246. ac_cv_have_swap=yes
  1247. ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
  1248. ac_cv_swap_format=["%*s %d %*d %d"]
  1249. ac_cv_swap_conv=1024
  1250. AC_MSG_RESULT([using HP-UX format swapinfo])
  1251. fi
  1252. dnl end if for PATH_TO_SWAPINFO
  1253. fi
  1254. AC_PATH_PROG(PATH_TO_LSPS,lsps)
  1255. if (test -n "$PATH_TO_LSPS")
  1256. then
  1257. AC_MSG_CHECKING([for $PATH_TO_LSPS format])
  1258. if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
  1259. then
  1260. ac_cv_have_swap=yes
  1261. ac_cv_swap_command="$PATH_TO_LSPS -a"
  1262. ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
  1263. ac_cv_swap_conv=1
  1264. AC_MSG_RESULT([using AIX lsps])
  1265. fi
  1266. dnl end if for PATH_TO_SWAPINFO
  1267. fi
  1268. dnl
  1269. dnl test for swapctl system call, both the 2-arg and 3-arg variants
  1270. dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
  1271. dnl in the various BSD's
  1272. dnl
  1273. AC_CHECK_HEADERS([sys/swap.h], [], [], [
  1274. #ifdef HAVE_SYS_PARAM_H
  1275. #include <sys/param.h>
  1276. #endif
  1277. ])
  1278. AC_CHECK_HEADERS([sys/stat.h sys/param.h])
  1279. AC_CHECK_DECLS([swapctl],,,[
  1280. #include <unistd.h>
  1281. #include <sys/types.h>
  1282. #include <sys/param.h>
  1283. #include <sys/stat.h>
  1284. #include <sys/swap.h>
  1285. ])
  1286. AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
  1287. #include <sys/types.h>
  1288. #include <sys/param.h>
  1289. #include <sys/stat.h>
  1290. #include <sys/swap.h>
  1291. ])
  1292. AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
  1293. #include <unistd.h>
  1294. #include <sys/types.h>
  1295. #include <sys/param.h>
  1296. #include <sys/stat.h>
  1297. #include <sys/swap.h>
  1298. ])
  1299. if test "$ac_cv_have_decl_swapctl" = "yes";
  1300. then
  1301. EXTRAS="$EXTRAS check_swap"
  1302. AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
  1303. if test "$ac_cv_type_swaptbl_t" = "yes" -a \
  1304. "$ac_cv_type_swapent_t" = "yes";
  1305. then
  1306. AC_MSG_RESULT([yes])
  1307. ac_cv_check_swap_swapctl_svr4="1";
  1308. AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
  1309. [Define if 2-argument SVR4 swapctl exists])
  1310. else
  1311. AC_MSG_RESULT([no])
  1312. AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
  1313. if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
  1314. then
  1315. AC_MSG_RESULT([yes])
  1316. AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
  1317. [Define if 3-argument BSD swapctl exists])
  1318. else
  1319. AC_MSG_RESULT([no])
  1320. fi
  1321. fi
  1322. AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
  1323. if test "$ac_cv_check_swap_swapctl_svr4" = "1";
  1324. then
  1325. dnl
  1326. dnl the SVR4 spec returns values in pages
  1327. dnl
  1328. AC_MSG_RESULT([page])
  1329. AC_CHECK_DECLS([sysconf])
  1330. AC_MSG_CHECKING([for system page size])
  1331. if test "$ac_cv_have_decl_sysconf" = "yes";
  1332. then
  1333. AC_MSG_RESULT([determined by sysconf(3)])
  1334. ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
  1335. else
  1336. AC_MSG_WARN([don't know. guessing 4096k])
  1337. ac_cv_swap_conv=256
  1338. fi
  1339. else
  1340. dnl
  1341. dnl the BSD spec returns values in blocks
  1342. dnl
  1343. AC_MSG_RESULT([blocks (assuming 512b)])
  1344. ac_cv_swap_conv=2048
  1345. fi
  1346. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1347. [Conversion factor to MB])
  1348. fi
  1349. dnl
  1350. dnl end tests for the swapctl system calls
  1351. dnl
  1352. if test "x$ac_cv_have_swap" != "x"
  1353. then
  1354. AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
  1355. EXTRAS="$EXTRAS check_swap"
  1356. fi
  1357. if test "x$ac_cv_swap_command" != "x"
  1358. then
  1359. AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
  1360. [Path to swap/swapinfo binary, with any args])
  1361. AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
  1362. [Format string for parsing swap output])
  1363. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1364. [Conversion factor to MB])
  1365. fi
  1366. dnl dunno why this does not work below - use hack (kbd)
  1367. dnl fine on linux, broken on solaris
  1368. dnl if /bin/test -e "/proc/meminfo"
  1369. AC_MSG_CHECKING([for /proc/meminfo])
  1370. if [cat /proc/meminfo > /dev/null 2>&1]
  1371. then
  1372. AC_MSG_RESULT([found /proc/meminfo])
  1373. AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
  1374. AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
  1375. EXTRAS="$EXTRAS check_swap"
  1376. else
  1377. AC_MSG_RESULT([no])
  1378. fi
  1379. AC_PATH_PROG(PATH_TO_DIG,dig)
  1380. AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
  1381. if test -n "$PATH_TO_DIG"; then
  1382. EXTRAS="$EXTRAS check_dig"
  1383. fi
  1384. if test -f plugins/check_nt.c ; then
  1385. EXTRAS="$EXTRAS check_nt"
  1386. elif test -f ../plugins/check_nt.c ; then
  1387. EXTRAS="$EXTRAS check_nt"
  1388. fi
  1389. AC_MSG_CHECKING(for va_list)
  1390. AC_TRY_COMPILE([#ifdef __STDC__
  1391. #include <stdio.h>
  1392. #include <stdlib.h>
  1393. #include <stdarg.h>
  1394. #else
  1395. #include <sys/types.h>
  1396. #include <stdio.h>
  1397. #include <varargs.h>
  1398. #endif],
  1399. [va_list args;],
  1400. [AC_MSG_RESULT(yes)],
  1401. [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
  1402. AC_SUBST(EXTRAS)
  1403. AC_SUBST(EXTRA_NETOBJS)
  1404. AC_SUBST(DEPLIBS)
  1405. AM_GNU_GETTEXT_VERSION(0.11.5)
  1406. AM_GNU_GETTEXT([no-libtool], [need-ngettext])
  1407. 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 )
  1408. ACX_FEATURE([with],[cgiurl])
  1409. ACX_FEATURE([with],[nagios-user])
  1410. ACX_FEATURE([with],[nagios-group])
  1411. ACX_FEATURE([with],[trusted-path])
  1412. ACX_FEATURE([with],[ping-command])
  1413. ACX_FEATURE([with],[ping6-command])
  1414. ACX_FEATURE([with],[lwres])
  1415. ACX_FEATURE([with],[ipv6])
  1416. ACX_FEATURE([with],[openssl])
  1417. ACX_FEATURE([enable],[emulate-getaddrinfo])