1dnl 2dnl 3dnl "Copyright (c) 2001 by Matt Massie and The Regents of the University 4dnl of California. All rights reserved." 5dnl 6dnl Permission to use, copy, modify, and distribute this software and its 7dnl documentation for any purpose, without fee, and without written agreement is 8dnl hereby granted, provided that the above copyright notice and the following 9dnl two paragraphs appear in all copies of this software. 10dnl 11dnl IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR 12dnl DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 13dnl OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF 14dnl CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 15dnl 16dnl THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 17dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 18dnl AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 19dnl ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO 20dnl PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 21dnl 22 23#AC_PREREQ(2.61) 24 25AC_REVISION([m4_esyscmd_s([git describe --always])]) 26AC_INIT(gmond/gmond.c) 27AC_CONFIG_AUX_DIR(build) 28 29### BEGIN RELEASE VARIABLES ############################ 30# On making a release... 31# If this release is just a minor bug fix release, increment 32# GANGLIA_MICRO_VERSION. 33# 34# If this release adds significant features or breaks backward compatibility, 35# increment GANGLIA_MINOR_VERSION and set GANGLIA_MICRO_VERSION to 0 (zero). 36# 37# If this release is a complete restructuring of 38# the overall architecture of ganglia, 39# increment GANGLIA_MAJOR_VERSION and set 40# GANGLIA_MINOR_VERSION and GANGLIA_MICRO_VERSION 41# to 0 (zero) 42GANGLIA_MAJOR_VERSION=3 43GANGLIA_MINOR_VERSION=7 44GANGLIA_MICRO_VERSION=2 45 46# REL is used for various packaging systems: 47# RHEL: 48# - it is the `Release:' parameter in the spec file 49# - appended after the version number, using a hyphen, e.g. X.X.X-REL 50# Solaris: 51# - it can be used as part of the VERSION= parameter in the 52# pkginfo file (man 4 pkginfo), e.g. VERSION=X.X.X,REV=@REL@ 53# appears to be consistent with the way Blastwave does things 54REL=1 55 56# If there are any changes to libganglia in this release, you need to... 57# LIBGANGLIA_MICRO_VERSION += 1; 58# LIBGANGLIA_INTERFACE_AGE += 1; 59# LIBGANGLIA_BINARY_AGE += 1; 60# if any functions have been added, set LIBGANGLIA_INTERFACE_AGE to 0. 61# if backwards compatibility has been broken, 62# set LIBGANGLIA_BINARY_AGE _and_ LIBGANGLIA_INTERFACE_AGE to 0. 63LIBGANGLIA_MICRO_VERSION=0 64LIBGANGLIA_INTERFACE_AGE=0 65LIBGANGLIA_BINARY_AGE=0 66### END RELEASE VARIABLES ############################# 67 68GANGLIA_VERSION=$GANGLIA_MAJOR_VERSION.$GANGLIA_MINOR_VERSION.$GANGLIA_MICRO_VERSION 69 70AM_INIT_AUTOMAKE(ganglia, $GANGLIA_VERSION) 71 72AC_SUBST(GANGLIA_MAJOR_VERSION) 73AC_SUBST(GANGLIA_MINOR_VERSION) 74AC_SUBST(GANGLIA_MICRO_VERSION) 75AC_SUBST(GANGLIA_VERSION) 76AC_SUBST(REL) 77 78AC_SUBST(LIBGANGLIA_INTERFACE_AGE) 79AC_SUBST(LIBGANGLIA_BINARY_AGE) 80 81# libtool versioning 82# the LT_RELEASE variable is passed with the --release option... it is just 83# a way to tie our internal package library with the release numbers of ganglia in general 84LT_RELEASE=$GANGLIA_VERSION 85# The most current libganglia interface is MICRO - INTERFACE 86LT_CURRENT=`expr $LIBGANGLIA_MICRO_VERSION - $LIBGANGLIA_INTERFACE_AGE` 87# The implementation number of the current interface is simply LIBGANGLIA_INTERFACE_AGE 88LT_REVISION=$LIBGANGLIA_INTERFACE_AGE 89# The different between the new and oldest interfaces this library implements is BINARY-INTERFACE 90LT_AGE=`expr $LIBGANGLIA_BINARY_AGE - $LIBGANGLIA_INTERFACE_AGE` 91 92AC_SUBST(LT_RELEASE) 93AC_SUBST(LT_CURRENT) 94AC_SUBST(LT_REVISION) 95AC_SUBST(LT_AGE) 96 97# Define version stuff 98AC_DEFINE_UNQUOTED(GANGLIA_MAJOR_VERSION, $GANGLIA_MAJOR_VERSION, GANGLIA_MAJOR_VERSION) 99AC_DEFINE_UNQUOTED(GANGLIA_MINOR_VERSION, $GANGLIA_MINOR_VERSION, GANGLIA_MINOR_VERSION) 100AC_DEFINE_UNQUOTED(GANGLIA_MICRO_VERSION, $GANGLIA_MICRO_VERSION, GANGLIA_MICRO_VERSION) 101 102AC_DEFINE_UNQUOTED(REL, $REL, REL) 103AC_DEFINE_UNQUOTED(GANGLIA_VERSION_FULL, "${VERSION}-${REL}", GANGLIA_VERSION_FULL) 104 105GWEB_VERSION=$GANGLIA_VERSION 106AC_SUBST(GWEB_VERSION) 107 108######################## 109AC_CANONICAL_HOST 110AM_CONFIG_HEADER(config.h) 111 112dnl The following cpu_vendor_os string goes into config.h. 113dnl 114AC_DEFINE_UNQUOTED(HOST_OS, "$host_os", HOST_OS) 115AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$host", CPU_VENDOR_OS) 116dnl AC_CYGWIN 117 118nl=' 119' 120dnl ################################################################## 121dnl Checks for programs. 122dnl 123AC_PROG_CC 124AC_PROG_CC_STDC 125AC_PROG_LIBTOOL 126m4_ifdef([AC_PROG_SED], 127 [AC_PROG_SED], 128 [ 129 SED="sed" 130 AC_SUBST([SED]) 131 ] 132) 133 134AC_ARG_ENABLE( static-build, 135[ --enable-static-build Statically link libGanglia, APR, Expat and Confuse libraries (may disable some metric modules) ], 136[ enable_static_build=yes ],[ enable_static_build=no ]) 137 138AC_SUBST(modpathstart) 139AM_CONDITIONAL(STATIC_BUILD, test x"$enable_static_build" = xyes) 140 141echo $ac_n "${nl}Configuring libmetrics ...${nl}" 142# This uses our command line and environment to run a nested 143# configure script in libmetrics 144# Using AC_CONFIG_SUBDIRS rather than just calling the configure script 145# directly is important to support cross-compiling. 146AC_CONFIG_SUBDIRS([libmetrics]) 147 148modpathstart="" 149if test x"$enable_static_build" = xyes; then 150 modpathstart="#" 151fi 152 153dnl ################################################################## 154dnl Special parameters 155dnl 156 157AC_ARG_WITH( static-modules, 158[ --with-static-modules link user-supplied static modules with gmond], 159if test x"$withval" != xno; then STATIC_USER_MODULES=$withval; fi) 160 161AC_ARG_WITH( gmetad, 162[ --with-gmetad compile and install the Ganglia Meta Daemon], 163if test x"$withval" = xyes; then gmetad="yes"; fi) 164 165AM_CONDITIONAL(BUILD_GMETAD, test x"$gmetad" = xyes) 166 167AC_ARG_WITH( python, 168[ --with-python=PATH Specify prefix for python or full path to interpreter], 169[if test x"$withval" != xno; then enable_python="yes"; PYTHON_BIN="$withval"; fi]) 170 171AC_ARG_WITH( perl, 172[ --with-perl=PATH Specify prefix for perl or full path to interpreter], 173[if test x"$withval" != xno; then enable_perl="yes"; PERL_BIN="$withval"; fi]) 174 175AC_ARG_WITH( librrd, 176[ --with-librrd=DIR Specify location for librrd], 177[if test x"$withval" != xno; then librrd="yes"; librrdpath="$withval"; fi]) 178 179AC_ARG_WITH( libapr, 180[ --with-libapr=PATH Specify location for libapr-1 or full path to apr-1-config], 181[if test x"$withval" != xno; then libapr="yes"; libaprpath="$withval"; fi]) 182 183AC_ARG_WITH( libexpat, 184[ --with-libexpat=DIR Specify location for libexpat], 185[if test x"$withval" != xno; then libexpat="yes"; libexpatpath="$withval"; fi]) 186 187AC_ARG_WITH( libconfuse, 188[ --with-libconfuse=DIR Specify location for libconfuse], 189[if test x"$withval" != xno; then libconfuse="yes"; libconfusepath="$withval"; fi]) 190 191AC_ARG_WITH( libpcre, 192[ --with-libpcre=DIR Specify location for libpcre], 193[if test x"$withval" != xno; then libpcre="yes"; libpcrepath="$withval"; fi], 194[libpcre=yes; libpcrepath=yes ]) 195 196AC_ARG_WITH( moduledir, 197[ --with-moduledir=DIR Base directory for dynamically loadable modules], 198 moduledir="$withval", 199 moduledir="$libdir/ganglia") 200 201AC_ARG_ENABLE(debug, 202[ 203 --enable-debug turn on debugging output and compile options], 204[ CFLAGS="$CFLAGS -ggdb -O0" 205 AC_DEFINE(DEBUG, 1, DEBUG)]) 206# Turn off optimizations when debugging. 207#[ CFLAGS="$CFLAGS -O2" 208# AC_DEFINE(DEBUG, 0, DEBUG)]) 209 210AC_ARG_ENABLE(gexec, 211[ --enable-gexec turn on gexec support (platform-specific) ], 212AC_DEFINE(SUPPORT_GEXEC, 1, SUPPORT_GEXEC), AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC)) 213 214setuid_user=nobody 215AC_ARG_ENABLE(setuid, 216[ --enable-setuid=USER turn on setuid support (default setuid=nobody) ], 217[if test x"$enableval" != xno; then no_setuid=0; setuid_user=$enableval ; fi], 218[ no_setuid=0 ]) 219AC_DEFINE_UNQUOTED(NO_SETUID, $no_setuid, NO_SETUID) 220AC_DEFINE_UNQUOTED(SETUID_USER, "$setuid_user", SETUID_USER) 221AC_SUBST(setuid_user) 222 223setgid_group=daemon 224AC_ARG_ENABLE(setgid, 225[ --enable-setgid=GROUP turn on setgid support (default setgid=no) ], 226[if test x"$enableval" != xno; then no_setgid=0; setgid_group=$enableval ; fi], 227[ no_setgid=1 ]) 228AC_DEFINE_UNQUOTED(NO_SETGID, $no_setgid, NO_SETGID) 229AC_DEFINE_UNQUOTED(SETGID_GROUP, "$setgid_group", SETGID_GROUP) 230AC_SUBST(setgid_group) 231 232AC_ARG_ENABLE(pedantic, 233[ --enable-pedantic turn on pedantic mode during compile], 234[ CFLAGS="$CFLAGS --pedantic" ],) 235 236AC_ARG_ENABLE(memcheck, 237[ --enable-memcheck turn on memory checking during compile 238 note: requires mpatrol from 239 http://www.cbmamiga.demon.co.uk/mpatrol/], 240[ enable_memcheck="yes" ]) 241 242AC_ARG_ENABLE( python, 243[ --disable-python exclude mod_python and support for metric modules written in python], 244[ if test x"$enableval" != xyes; then enable_python="no"; fi ], [ enable_python="yes" ] ) 245 246AC_ARG_ENABLE( perl, 247[ --enable-perl include mod_perl and support for metric modules written in perl], 248[ if test x"$enableval" != xno; then enable_perl="yes"; fi ], [ enable_perl="no" ] ) 249 250AC_ARG_ENABLE( status, 251[ --enable-status compile and install modgstatus to enable gmond status metric module support], 252[ enable_status="yes" 253 AC_DEFINE(GSTATUS, 1, GSTATUS)], 254[ enable_status="no" ] ) 255 256AM_CONDITIONAL(BUILD_STATUS, test x"$enable_status" = xyes) 257 258AC_ARG_ENABLE( sflow, 259[ --disable-sflow exclude sFlow gateway], 260[ if test x"$enableval" != xyes; then enable_sflow="no"; fi ], [ enable_sflow="yes" ] ) 261AM_CONDITIONAL(BUILD_SFLOW, test x"$enable_sflow" = xyes) 262 263dnl ################################################################## 264dnl Checks for libraries. 265dnl The order of these tests is the *reverse* order of the libraries in 266dnl the LIBS variable that is constructed: each new one gets prepended, 267dnl not appended. 268dnl 269AC_CHECK_LIB(pthread, pthread_create) 270dnl if test "$ac_cv_lib_pthread_pthread_create" = yes ; then 271dnl CFLAGS="$CFLAGS -D_REENTRANT" 272dnl else 273AC_CHECK_LIB(pthreads, pthread_create) 274dnl if test "$ac_cv_lib_pthreads_pthread_create" = yes ; then 275dnl CFLAGS="$CFLAGS -D_REENTRANT" 276dnl fi 277dnl fi 278 279if test x"$librrdpath" != x && test x"$librrdpath" != xyes; then 280 CFLAGS="$CFLAGS -I$librrdpath/include" 281 LDFLAGS="$LDFLAGS -L$librrdpath/lib" 282fi 283 284if test x"$gmetad" = xyes; then 285 AC_CHECK_HEADERS(rrd.h) 286 AC_CHECK_LIB(rrd, rrd_create, [echo "The ganglia graphs are created using RRDTool (http://www.rrdtool.org/)"], [], [-lm]) 287 if test x"$ac_cv_lib_rrd_rrd_create" != xyes; then 288 echo "Trying harder by including the X library path" 289 unset ac_cv_lib_rrd_rrd_create 290 LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/X11R6/lib" 291 AC_CHECK_LIB(rrd, rrd_create, [echo "The ganglia graphs are created using RRDTool (http://www.rrdtool.org/)"], [], [-lm]) 292 if test x"$ac_cv_lib_rrd_rrd_create" != xyes; then 293 echo 294 echo "The Ganglia Meta Daemon uses the Round-Robin Database Tool (rrdtool)" 295 echo "for storing historical information. You have chosen to compile the" 296 echo "monitoring core with gmetad but librrd could not be found. Please" 297 echo "visit http://www.rrdtool.org/, download rrdtool and then try again" 298 echo 299 exit 1; 300 fi 301 fi 302fi 303 304AC_SUBST(STATIC_USER_MODULES) 305 306if test x"$enable_python" = xyes; then 307 echo 308 echo Checking for python 309 310 # check for Python executable 311 if test -z "$PYTHON_BIN"; then 312 AC_PATH_PROG(PYTHON_BIN, python) 313 else 314 if test -d "$PYTHON_BIN"; then 315 PYTHON_BIN="$PYTHON_BIN/bin/python" 316 fi 317 fi 318 319 if test -n "$PYTHON_BIN"; then 320 # find out python version 321 AC_MSG_CHECKING(Python version) 322 PyVERSION=`$PYTHON_BIN -c ['import sys; print sys.version[:3]'`] 323 PyMAJVERSION=`$PYTHON_BIN -c ['import sys; print sys.version[:1]'`] 324 AC_MSG_RESULT($PyVERSION) 325 PYTHON_VERSION=$PyVERSION 326 AC_SUBST(PYTHON_VERSION) 327 328 PyEXEC_INSTALLDIR=`$PYTHON_BIN -c "import sys; print sys.exec_prefix"` 329 if test -f "$PyEXEC_INSTALLDIR/include/python/Python.h"; then 330 PYTHON_INCLUDES="-I$PyEXEC_INSTALLDIR/include/python" 331 else 332 if test -f "$PyEXEC_INSTALLDIR/include/python$PyVERSION/Python.h"; then 333 PYTHON_INCLUDES="-I$PyEXEC_INSTALLDIR/include/python$PyVERSION" 334 else 335 PYTHON_INCLUDES="" 336 enable_python="no" 337 fi 338 fi 339 AC_SUBST(PYTHON_INCLUDES) 340 else 341 enable_python="no" 342 fi 343fi 344 345AC_MSG_CHECKING(Python support) 346AC_MSG_RESULT($enable_python) 347AM_CONDITIONAL(BUILD_PYTHON, test x"$enable_python" = xyes) 348 349if test x"$enable_perl" = xyes; then 350 echo 351 echo Checking for perl 352 353 # check for Perl executable 354 if test -z "$PERL_BIN"; then 355 AC_PATH_PROG(PERL_BIN, perl) 356 else 357 if test -d "$PERL_BIN"; then 358 PERL_BIN="$PERL_BIN/bin/perl" 359 fi 360 fi 361 362 if test -n "$PERL_BIN" && test -x "$PERL_BIN"; then 363 # Check if perl has ExtUtils::Embed module installed 364 AC_MSG_CHECKING(for existence of ExtUtils::Embed module) 365 `$PERL_BIN -MExtUtils::Embed -e '' >/dev/null 2>&1` 366 if test $? -eq 0; then 367 AC_MSG_RESULT(yes) 368 PERL_INCLUDES=`$PERL_BIN -MExtUtils::Embed -e perl_inc` 369 AC_SUBST(PERL_INCLUDES) 370 PERL_CFLAGS=`$PERL_BIN -MExtUtils::Embed -e ccopts` 371 AC_SUBST(PERL_CFLAGS) 372 #CFLAGS="$CFLAGS $PERL_CFLAGS" 373 PERL_LDFLAGS=`$PERL_BIN -MExtUtils::Embed -e ldopts` 374 AC_SUBST(PERL_LDFLAGS) 375 else 376 AC_MSG_RESULT(no) 377 AC_MSG_ERROR(Module not found, please install or specify --disable-perl to disable mod_perl support) 378 exit 1 379 fi 380 else 381 enable_perl="no" 382 fi 383fi 384 385AC_MSG_CHECKING(Perl support) 386AC_MSG_RESULT($enable_perl) 387AM_CONDITIONAL(BUILD_PERL, test x"$enable_perl" = xyes) 388 389LIB_SUFFIX=lib 390case $host in 391x86_64*linux*) 392 LIB_SUFFIX=lib64 393 ;; 394esac 395 396PKG_PROG_PKG_CONFIG 397 398echo 399echo Checking for apr 400if test x"$libaprpath" != x && test x"$libaprpath" != xyes; then 401 if test -f "$libaprpath" ; then 402 APR_INCLUDES=`$libaprpath --includes` 403 AC_SUBST(APR_INCLUDES) 404 APR_LIBPATH=`$libaprpath --link-ld` 405 LDFLAGS="$LDFLAGS -L`expr "x$APR_LIBPATH" : '.*-L\(.*\) '`" 406 AC_CHECK_LIB(apr-1, apr_socket_send,,,[`$libaprpath --libs`]) 407 else 408 CFLAGS="$CFLAGS -I$libaprpath/include" 409 LDFLAGS="$LDFLAGS -L$libaprpath/${LIB_SUFFIX}" 410 echo "Added -I$libaprpath/include to CFLAGS" 411 echo "Added -L$libaprpath/${LIB_SUFFIX} to LDFLAGS" 412 AC_CHECK_LIB(apr-1, apr_socket_send) 413 fi 414 415 if test x"$ac_cv_lib_apr_1_apr_socket_send" = xyes; then 416 echo "The ganglia utilities use the Apache Portable Runtime functions (http://www.apache.org/)" 417 echo "Found a suitable libapr1 library" 418 else 419 echo "libapr not found" 420 exit 1; 421 fi 422else 423 PKG_CHECK_MODULES([APR],[apr-1]) 424 LDFLAGS="$LDFLAGS $LIBS $APR_LIBS" 425 APR_INCLUDES="$APR_CFLAGS" 426fi 427 428echo 429echo Checking for libmemcached 430AC_ARG_WITH( memcached, 431[ --with-memcached enable memcached metrics publishing], 432if test x"$withval" = xyes; then memcache="yes"; fi) 433 434if test x"$memcache" == xyes; then 435 PKG_CHECK_MODULES(DEPS, libmemcached >= 1.0.2) 436 AC_SUBST(DEPS_CFLAGS) 437 AC_SUBST(DEPS_LIBS) 438 CFLAGS="$CFLAGS -DWITH_MEMCACHED" 439fi 440 441AC_ARG_WITH( riemann, AS_HELP_STRING([--with-riemann], [enable riemann metric forwarding]), 442if test x"$withval" = xyes; then with_riemann="yes"; fi) 443 444if test x"$with_riemann" == xyes; then 445echo 446echo Checking for Protocol Buffers 447 448 PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c],[],[AC_MSG_WARN([No pkg-config for protobuf-c.])] ) 449 if test "x$PROTOBUF_C_CFLAGS" = x; then 450 echo "trying harder - bug your distro" 451 AC_CHECK_LIB([protobuf-c], [protobuf_c_message_pack]) 452 if test x"$ac_cv_lib_protobuf_c_protobuf_c_message_pack" = xyes; then 453 PROTOBUF_C_LIBS="-lprotobuf-c" 454 else 455 AC_MSG_ERROR([libprotobuf-c not found]) # package: libprotobuf-c0-dev 456 fi 457 fi 458 AC_SUBST([PROTOBUF_C_CFLAGS]) 459 AC_SUBST([PROTOBUF_C_LIBS]) 460 AC_CHECK_PROGS([PROTOC_C], [protoc-c], [:]) 461 if test "$PROTOC_C" = :; then 462 AC_MSG_ERROR([This package needs 'protoc-c' tool. Try installing the 'protobuf-c-compiler' package.]) 463 fi 464 AC_CONFIG_COMMANDS([riemann_pb-c.c], [protoc-c -Igmetad/ --c_out=./gmetad gmetad/riemann.proto]) 465 CFLAGS="$CFLAGS -DWITH_RIEMANN" 466fi 467AM_CONDITIONAL(BUILD_RIEMANN, test x"$with_riemann" = xyes) 468 469echo 470echo Checking for confuse 471if test x"$libconfusepath" != x && test x"$libconfusepath" != xyes; then 472 CFLAGS="$CFLAGS -I$libconfusepath/include" 473 LDFLAGS="$LDFLAGS -L$libconfusepath/${LIB_SUFFIX}" 474 echo "Added -I$libconfusepath/include to CFLAGS" 475 echo "Added -L$libconfusepath/${LIB_SUFFIX} to LDFLAGS" 476fi 477AC_CHECK_LIB(confuse, cfg_parse) 478if test x"$ac_cv_lib_confuse_cfg_parse" = xno; then 479 echo Trying harder including gettext 480 unset ac_cv_lib_confuse_cfg_parse 481 LDFLAGS="$LDFLAGS -lintl" 482 AC_CHECK_LIB(confuse, cfg_parse) 483 if test x"$ac_cv_lib_confuse_cfg_parse" = xno; then 484 echo Trying harder including iconv 485 unset ac_cv_lib_confuse_cfg_parse 486 LDFLAGS="$LDFLAGS -liconv" 487 AC_CHECK_LIB(confuse, cfg_parse) 488 if test x"$ac_cv_lib_confuse_cfg_parse" = xno; then 489 echo "libconfuse not found" 490 exit 1 491 fi 492 fi 493fi 494if test x"$ac_cv_lib_confuse_cfg_parse" = xyes; then 495 echo "Found a suitable Confuse library" 496fi 497 498echo 499echo Checking for expat 500if test x"$libexpatpath" != x && test x"$libexpatpath" != xyes; then 501 CFLAGS="$CFLAGS -I$libexpatpath/include" 502 LDFLAGS="$LDFLAGS -L$libexpatpath/${LIB_SUFFIX}" 503 echo "Added -I$libexpatpath/include to CFLAGS" 504 echo "Added -L$libexpatpath/${LIB_SUFFIX} to LDFLAGS" 505fi 506AC_CHECK_LIB(expat, XML_ParserCreate) 507if test x"$ac_cv_lib_expat_XML_ParserCreate" = xyes; then 508 echo "Found a suitable Expat library" 509else 510 echo "libexpat not found" 511 exit 1; 512fi 513 514echo 515echo Checking for pcre 516if test x"$libpcrepath" != x && test x"$libpcrepath" != xyes; then 517 CFLAGS="$CFLAGS -I$libpcrepath/include" 518 LDFLAGS="$LDFLAGS -L$libpcrepath/${LIB_SUFFIX}" 519 echo "Added -I$libpcrepath/include to CFLAGS" 520 echo "Added -L$libpcrepath/${LIB_SUFFIX} to LDFLAGS" 521fi 522if test x"$libpcre" == xyes ; then 523 AC_CHECK_HEADERS([pcre/pcre.h pcre.h]) 524 AC_CHECK_LIB(pcre, pcre_compile) 525 if test x"$ac_cv_lib_pcre_pcre_compile" = xyes; then 526 echo "Found a suitable pcre library" 527 else 528 echo "libpcre not found, specify --with-libpcre=no to build without PCRE support" 529 exit 1; 530 fi 531else 532 echo "building without PCRE support" 533fi 534echo 535 536echo 537echo Checking for systemd 538AC_ARG_WITH([systemdsystemunitdir], 539 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), 540 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) 541if test "x$with_systemdsystemunitdir" != xno; then 542 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) 543else 544 AC_SUBST([systemdsystemunitdir], [/usr/lib/systemd/system]) 545fi 546AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) 547 548echo 549echo Checking for zlib 550AC_ARG_WITH([zlib], 551 AS_HELP_STRING([--with-zlib=DIR], [Specify location for zlib]), 552 [if test x"$withval" != xno; then libzlib="yes"; libzlibpath="$withval"; fi]) 553if test x"$libzlibpath" != x && test x"$libzlibpath" != xyes; then 554 CFLAGS="$CFLAGS -I$libzlibpath/include" 555 CPPFLAGS="$CPPFLAGS -I$libzlibpath/include" 556 LDFLAGS="$LDFLAGS -L$libzlibpath/${LIB_SUFFIX}" 557 echo "Added -I$libzlibpath/include to CFLAGS and CPPFLAGS" 558 echo "Added -L$libzlibpath/${LIB_SUFFIX} to LDFLAGS" 559fi 560AC_CHECK_HEADERS([zlib.h]) 561AC_CHECK_LIB(z, deflate) 562if test x"$ac_cv_lib_z_deflate" != xyes; then 563 echo "zlib library not configured properly"; exit 1; 564fi 565echo "Found a suitable zlib" 566 567echo 568 569 570AC_CHECK_LIB(rpc, xdr_string) 571AC_CHECK_LIB(socket, socket) 572AC_CHECK_LIB(nsl, inet_addr) 573AC_CHECK_LIB(nsl, gethostbyaddr_r) 574AC_CHECK_FUNC(inet_aton, , [AC_CHECK_LIB(resolv, inet_aton)]) 575AC_CHECK_LIB(kstat, kstat_open) 576AC_CHECK_LIB(kvm, kvm_open) 577AC_CHECK_LIB(odm, odm_initialize) 578AC_CHECK_LIB(cfg, _system_configuration) 579AC_CHECK_LIB(perfstat, perfstat_cpu_total) 580AC_CHECK_LIB(dl, dlopen) 581dnl AC_CHECK_LIB(crypto, RSA_sign) 582dnl if test "$ac_cv_lib_crypto_RSA_sign" = no; then 583dnl echo "$PACKAGE $VERSION requires IPv4 OpenSSL." 584dnl echo "See http://www.openssl.org/." 585dnl exit 1; 586dnl fi 587 588dnl ################################################################## 589dnl Checks for header files. 590dnl 591 592dnl Check for stdlib.h stdarg.h string.h float.h 593AC_HEADER_STDC 594 595AC_CHECK_HEADERS(syslog.h pthread.h fcntl.h signal.h sys/time.h sys/types.h sys/stat.h sys/socket.h sys/ioctl.h netinet/in.h arpa/inet.h netinet/tcp.h unistd.h stropts.h sys/sockio.h ctype.h errno.h netdb.h stdio.h sys/uio.h sys/wait.h sys/un.h sys/select.h sys/filio.h getopt.h net/if_dl.h net/raw.h poll.h) 596AC_CHECK_HEADER([net/if.h], [], [], 597[#ifdef HAVE_SYS_SOCKET_H 598# include <sys/socket.h> 599#endif 600]) 601 602AC_CHECK_HEADERS(inttypes.h limits.h sys/param.h sys/vfs.h sys/statfs.h sys/statvfs.h) 603AC_CHECK_HEADER([sys/mount.h], [], [], 604[#ifdef HAVE_SYS_PARAM_H 605# include <sys/param.h> 606#endif 607]) 608 609AC_CHECK_HEADERS(rpc/types.h) 610AC_CHECK_HEADER([rpc/xdr.h], [], 611 [AC_MSG_ERROR([your system is missing the Sun RPC (ONC/RPC) libraries])], 612[#ifdef HAVE_RPC_TYPES_H 613# include <rpc/types.h> 614#endif 615]) 616 617dnl ################################################################## 618dnl Checks for typedefs. 619dnl 620dnl AC_TYPE_SIZE_T 621AC_HEADER_TIME 622dnl AC_SEARCH_TYPE is a custom macro in acinclude.m4 623AC_SEARCH_TYPE(uchar_t, unsigned char) 624AC_SEARCH_TYPE(int8_t, signed char) 625AC_SEARCH_TYPE(uint8_t, unsigned char) 626AC_SEARCH_TYPE(int16_t, signed short) 627AC_SEARCH_TYPE(uint16_t, unsigned short) 628AC_SEARCH_TYPE(int32_t, signed int) 629AC_SEARCH_TYPE(uint32_t, unsigned int) 630AC_SEARCH_TYPE(size_t, unsigned int) 631AC_SEARCH_TYPE(ssize_t, signed int) 632AC_SEARCH_TYPE(socklen_t, unsigned int) 633AC_SEARCH_TYPE(time_t, long) 634 635dnl AC_CHECK_SIZEOF(char) 636dnl AC_CHECK_SIZEOF(short) 637dnl AC_CHECK_SIZEOF(int) 638dnl AC_CHECK_SIZEOF(long) 639dnl AC_CHECK_SIZEOF(void *) 640 641dnl ################################################################## 642dnl Check for structure definitions. 643dnl 644 645dnl ################################################################## 646dnl Check the compiler characteristics 647dnl 648dnl Don't need this now that all data is send in XDR 649AC_C_BIGENDIAN 650 651dnl ################################################################## 652dnl Checks for library functions. 653dnl 654dnl AC_FUNC_MEMCMP 655AC_CHECK_FUNCS([snprintf vsnprintf strlcat]) 656 657dnl ################################################################## 658dnl Check for function prototypes in headers. 659dnl 660AC_CHECK_FUNCS(getopt_long inet_ntop strdup) 661dnl AC_CHECK_FUNC(getopt_long) 662dnl AC_CHECK_FUNC(pthread_rwlock_rdlock, 663dnl [AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1)]) 664 665dnl ################################################################## 666dnl Check for system services. 667 668dnl ################################################################## 669dnl If the compiler is gcc, enable all warnings. Main purpose is to 670dnl catch any function call where the function has not been prototyped. 671dnl 672dnl Add "-Wcast-qual again later"... 673dnl if test "$ac_cv_prog_gcc" = yes; then 674if test x"$ac_cv_gcc" = xyes; then 675 CFLAGS="$CFLAGS -Wall -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes" 676fi 677 678dnl disable type punning optimization until verified safe 679if test x"$ac_cv_c_compiler_gnu" = xyes; then 680 SAVE_CFLAGS="$CFLAGS" 681 CFLAGS="$CFLAGS -fno-strict-aliasing" 682 AC_MSG_CHECKING([whether disabling type punning in gcc is possible]) 683 AC_TRY_COMPILE([], [], type_punning="yes", type_punning="no") 684 if test x"$type_punning" = xno; then 685 CFLAGS="$SAVE_CFLAGS" 686 fi 687 AC_MSG_RESULT($type_punning) 688 unset type_punning 689 unset SAVE_CFLAGS 690 CFLAGS="$CFLAGS -Wall" 691fi 692 693if test x"$enable_memcheck" = xyes; then 694 echo "Setting up for memory checking via mpatrol" 695 CFLAGS="$CFLAGS -fcheck-memory-usage " 696 LDFLAGS="$LDFLAGS -lmpatrol -lbfd -liberty " 697fi 698 699AC_MSG_CHECKING([for __thread specifier]) 700AC_TRY_COMPILE([static __thread int a;],[int b = a;], 701 [AC_DEFINE(HAVE___THREAD, 1, HAVE___THREAD) 702 AC_MSG_RESULT([exists, using native TLS])], 703 [AC_MSG_RESULT([not found, defaulting to pthreads for TLS])]) 704 705dnl Some system-specific stuff ... 706dnl Some operating systems require additional flags in order to get all 707dnl the definitions that we're looking for in some system headers. 708 709dnl default VARSTATEDIR to /var/lib since that's the traditional location. 710dnl 711varstatedir="/var/lib" 712 713# Used when static linking requested 714EXPORT_SYMBOLS="-export-dynamic" 715# Used when dynamic linking requested 716EXPORT_SYMBOLS_DYNAMIC="-export-dynamic" 717case "$host" in 718*linux*) 719 CFLAGS="$CFLAGS -D_REENTRANT" 720 AC_DEFINE(LINUX, 1, LINUX) 721dnl 722dnl For fsusage.c - disk usage. 723dnl 724 AC_DEFINE(STAT_STATVFS, 1, STAT_STATVFS) 725 AC_DEFINE(SUPPORT_GEXEC, 1, SUPPORT_GEXEC) 726 if test x"$moduledir" = x"\${exec_prefix}/lib/ganglia"; then 727 if test x"$build_cpu" != xia64 && \ 728 test x"$build_cpu" != xalpha; then 729 if test x"$libdir" = x"\${exec_prefix}/lib"; then 730 if test x"$exec_prefix" = xNONE; then 731 if test x"$prefix" = xNONE; then 732 libroot="$ac_default_prefix" 733 else 734 libroot="$prefix" 735 fi 736 else 737 libroot="$exec_prefix" 738 fi 739 AC_TRY_COMPILE([], [], 740 [file conftest.$ac_objext > conftest.file]) 741 FILE=`cat conftest.file` 742 WIDTH_CPU=`expr "x$FILE" : '.*ELF \(.*\)-bit '` 743 rm -f conftest.file 744 if test x"$WIDTH_CPU" = x64; then 745 libdir="$libroot/lib64" 746 else 747 libdir="$libroot/lib" 748 fi 749 fi 750 moduledir="$libdir/ganglia" 751 fi 752 fi 753 ;; 754*ia64-*hpux*) CFLAGS="$CFLAGS -D_PSTAT64 -D_HPUX_SOURCE" 755 LIBS="-lpthread $LIBS" 756 EXPORT_SYMBOLS="-Wl,-E" 757 AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 758 AC_DEFINE(IA64,1,IA64) 759 AC_DEFINE(HPUX,1,HPUX) 760 ;; 761*aix*) CFLAGS="$CFLAGS -D_ALL_SOURCE -DAIX" 762 EXPORT_SYMBOLS="-Wl,-bexpfull" 763 AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 764 if test x"$ac_cv_lib_perfstat_perfstat_cpu_total" = xyes; then 765 CFLAGS="$CFLAGS -DHAVE_PERFSTAT" 766 else 767 echo "libperfstat not detected." 768 echo "For AIX 5 you need to install bos.perf.libperfstat" 769 fi 770 AC_DEFINE(AIX, 1, AIX) 771 LIBS="-lm $LIBS" 772 EXPORT_SYMBOLS_DYNAMIC="-Wl,-bexpfull" 773 ;; 774*hpux*) CFLAGS="$CFLAGS -D_HPUX_SOURCE" 775 LIBS="-lpthread $LIBS" 776 EXPORT_SYMBOLS="-Wl,-E" 777 AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 778 AC_DEFINE(HPUX,1,HPUX) 779 ;; 780*irix*) AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 781 CFLAGS="$CFLAGS -D_IRIX_SOURCE" 782 AC_DEFINE(IRIX,1,IRIX) 783 ;; 784*osf*) metric_source="osf.c" 785 CFLAGS="$CFLAGS -D_SOCKADDR_LEN" 786 AC_DEFINE(OSF,1,OSF) 787 ;; 788*darwin*) AC_DEFINE(DARWIN,1,DARWIN) 789 EXPORT_SYMBOLS="-export-all-symbols" 790 ;; 791*solaris*) AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 792 CFLAGS="$CFLAGS -D__EXTENSIONS__ -DHAVE_STRERROR" 793 if test x"$ac_cv_prog_cc_c99" = x -o x"$ac_cv_prog_cc_c99" = xno; then 794 CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199506L" 795 else 796 CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L" 797 fi 798 if test x"$ac_cv_prog_gcc" != xyes; then 799 LIBS="-lm $LIBS" 800 fi 801 AC_DEFINE(SOLARIS,1,SOLARIS) 802 ;; 803*freebsd*) CFLAGS="-pthread $CFLAGS -D_REENTRANT" 804 AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 805 varstatedir="/var/db" 806 osreldate=`awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $3 }' /usr/include/osreldate.h` 807 if test $osreldate -lt 502102; then 808 CFLAGS="-pthread $CFLAGS -D_REENTRANT" 809 fi 810 AC_DEFINE(FREEBSD, 1, FREEBSD) 811 ;; 812*dragonfly*) CFLAGS="-pthread $CFLAGS -D_REENTRANT" 813 AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 814 varstatedir="/var/db" 815 AC_DEFINE(DRAGONFLYBSD, 1, DRAGONFLYBSD) 816 ;; 817*netbsd*) AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 818 varstatedir="/var/db" 819 AC_DEFINE(NETBSD, 1, NETBSD) 820 ;; 821*openbsd*) AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC) 822 varstatedir="/var/db" 823 AC_DEFINE(OPENBSD, 1, OPENBSD) 824 ;; 825*cygwin*) LDFLAGS="-L/bin" 826 EXPORT_SYMBOLS="-export-all-symbols" 827 AC_DEFINE(CYGWIN, 1, CYGWIN) 828esac 829 830AC_SUBST(EXPORT_SYMBOLS) 831AC_SUBST(EXPORT_SYMBOLS_DYNAMIC) 832 833dnl Define VARSTATEDIR in config.h 834dnl 835AC_SUBST(varstatedir) 836AC_DEFINE_UNQUOTED(VARSTATEDIR, "$varstatedir", VARSTATEDIR) 837 838dnl Where to look for libraries (/usr/lib vs /usr/lib64) 839AC_SUBST(libdir) 840 841if test x"$moduledir" = x"\${exec_prefix}/lib/ganglia"; then 842 if test x"$exec_prefix" = xNONE; then 843 if test x"$prefix" = xNONE; then 844 exec_prefix="$ac_default_prefix" 845 else 846 exec_prefix="$prefix" 847 fi 848 fi 849 moduledir=`eval echo "$moduledir"` 850fi 851AC_DEFINE_UNQUOTED(GANGLIA_MODULE_DIR, "$moduledir", GANGLIA_MODULE_DIR) 852AC_SUBST(moduledir) 853 854dnl This is for gmetad-python, where @gsysconfdir@ needs to be 855dnl substituted into setup.py during the ./configure step as there is no 856dnl make install step 857dnl 858if test x"$sysconfdir" = x"\${prefix}/etc"; then 859 if test x"$prefix" = xNONE; then 860 prefix="$ac_default_prefix" 861 else 862 prefix="$prefix" 863 fi 864fi 865gsysconfdir=`eval echo "$sysconfdir"` 866AC_DEFINE_UNQUOTED(GSYSCONFDIR, "$gsysconfdir", GSYSCONFDIR) 867AC_SUBST(gsysconfdir) 868 869AC_CONFIG_FILES([scripts/fixconfig], [chmod +x scripts/fixconfig]) 870 871AC_OUTPUT(Makefile 872 tests/Makefile 873 ganglia.spec 874 gmetad/Makefile 875 lib/default_conf.h 876 lib/Makefile 877 gmond/Makefile 878 gstat/Makefile 879 gmond/modules/Makefile 880 gmond/modules/example/Makefile 881 gmond/modules/cpu/Makefile 882 gmond/modules/disk/Makefile 883 gmond/modules/memory/Makefile 884 gmond/modules/network/Makefile 885 gmond/modules/perl/Makefile 886 gmond/modules/python/Makefile 887 gmond/modules/status/Makefile 888 gmond/modules/system/Makefile 889 gmond/perl_modules/Makefile 890 gmond/perl_modules/example/Makefile 891 gmond/python_modules/Makefile 892 gmond/python_modules/apache_status/Makefile 893 gmond/python_modules/cpu/Makefile 894 gmond/python_modules/db/Makefile 895 gmond/python_modules/disk/Makefile 896 gmond/python_modules/example/Makefile 897 gmond/python_modules/memcached/Makefile 898 gmond/python_modules/memory/Makefile 899 gmond/python_modules/nfs/Makefile 900 gmond/python_modules/network/Makefile 901 gmond/python_modules/process/Makefile 902 gmond/python_modules/ssl/Makefile 903 gmond/python_modules/varnish/Makefile 904 gmond/python_modules/vm_stats/Makefile 905 gmond/python_modules/xen/Makefile 906 gmetad/conf.c 907 gmetad-python/setup.py 908 gmetad-python/Gmetad/gmetad_config.py 909 gmetad-python/gmetad-python.conf 910 gmetad-python/plugins/rrd_plugin.py 911 gmetric/Makefile 912 include/Makefile 913 mans/Makefile 914 ) 915 916echo "" 917echo "Welcome to.." 918echo " ______ ___" 919echo " / ____/___ _____ ____ _/ (_)___ _" 920echo " / / __/ __ \`/ __ \/ __ \`/ / / __ \`/" 921echo " / /_/ / /_/ / / / / /_/ / / / /_/ /" 922echo " \____/\__,_/_/ /_/\__, /_/_/\__,_/" 923echo " /____/" 924echo "" 925echo "Copyright (c) 2005 University of California, Berkeley" 926echo "" 927echo "Version: $GANGLIA_VERSION" 928echo "Library: Release $LT_RELEASE $LT_CURRENT:$LT_REVISION:$LT_AGE" 929echo "" 930echo "Type \"make\" to compile." 931