2 dnl Copyright (c) 2012-2016 Red Hat.
3 dnl Copyright (c) 2008 Aconex. All Rights Reserved.
4 dnl Copyright (c) 2000-2004,2008 Silicon Graphics, Inc. All Rights Reserved.
6 dnl This program is free software; you can redistribute it and/or modify it
7 dnl under the terms of the GNU General Public License as published by the
8 dnl Free Software Foundation; either version 2 of the License, or (at your
9 dnl option) any later version.
11 dnl This program is distributed in the hope that it will be useful, but
12 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 dnl unpacking check - this file must exist
18 AC_INIT(src/include/pcp/pmapi.h)
21 dnl Irix build issue ... use the tools from the local filesystems
26 [AS_HELP_STRING([--with-64bit],
27 [turn on 64 bit compilation mode (default is platform dependent)])],
28 [use_64bit=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-64bit=$withval"])
32 [AS_HELP_STRING([--with-optimization],
33 [enable optimization for C/C++ code (default is yes)])],
34 [use_optimization=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-optimization=$withval"],
35 [use_optimizaton=yes])
39 [AC_HELP_STRING([--with-threads],
40 [enable support for multiple threads (default is on)])],
41 [do_threads=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-threads=$withval"],
46 [AC_HELP_STRING([--with-secure-sockets],
47 [enable support for secure sockets (default is on)])],
48 [do_secure=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-secure-sockets=$withval"],
53 [AC_HELP_STRING([--with-static-probes],
54 [enable support for static probes (default is on)])],
55 [do_probes=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-static-probes=$withval"],
60 [AC_HELP_STRING([--with-infiniband],
61 [enable support for Infiniband metrics (default is on)])],
62 [do_infiniband=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-infiniband=$withval"],
63 [do_infiniband=check])
67 [AS_HELP_STRING([--with-user],
68 [user account under which daemons run (default is pcp)])],
69 [pcp_user=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-user-account=$withval"],
75 [AS_HELP_STRING([--with-group],
76 [user group under which daemons run (default is pcp)])],
77 [pcp_group=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-group-account=$withval"],
81 AC_ARG_WITH([discovery],
82 [AC_HELP_STRING([--with-discovery],
83 [enable support for service discovery (default is on)])],
84 [do_discovery=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-discovery=$withval"],
87 AC_ARG_WITH([systemd],
88 [AC_HELP_STRING([--with-systemd],
89 [enable support for systemd services (default is on)])],
90 [do_systemd=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-systemd=$withval"],
94 [AC_HELP_STRING([--with-qt],
95 [enable support for tools requiring Qt (default is on)])],
96 [do_qt=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-qt=$withval"],
100 [AC_HELP_STRING([--with-python],
101 [enable support for tools requiring Python (default is on)])],
102 [do_python=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-python=$withval"],
105 AC_ARG_WITH([python3],
106 [AC_HELP_STRING([--with-python3],
107 [enable support for tools requiring Python3 (default is on)])],
108 [do_python3=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-python3=$withval"],
112 [AC_HELP_STRING([--with-books],
113 [enable building of the PCP books (default is off)])],
114 [do_books=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-books=$withval"],
117 AC_ARG_WITH([books-brand],
118 [AC_HELP_STRING([--with-books-brand=BRAND],
119 [choose the docbook brand when building the PCP books (default is common)])],
120 [do_books_brand=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-books-brand=$withval"],
121 [do_books_brand=common])
124 [AC_HELP_STRING([--with-papi@<:@=DIR|=MODULE@:>@],
125 [enable performance api counter pmda (default is on)
126 The optional argument may be a full path of a PAPI installation prefix,
127 or a pkgconfig module name.])],
128 [do_papi=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-papi=$withval"],
131 AC_ARG_WITH([perfevent],
132 [AC_HELP_STRING([--with-perfevent],
133 [enable perfevent pmda (default is on)])],
134 [do_perfevent=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-perfevent=$withval"],
135 [do_perfevent=check])
137 AC_ARG_WITH([pmdajson],
138 [AC_HELP_STRING([--with-pmdajson],
139 [enable JSON pmda (default is on)])],
140 [do_pmdajson=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-pmdajson=$withval"],
143 AC_ARG_WITH([manager],
144 [AC_HELP_STRING([--with-manager],
145 [enable daemon manager (default is on)])],
146 [do_manager=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-manager=$withval"],
149 AC_ARG_WITH([webapi],
150 [AC_HELP_STRING([--with-webapi],
151 [enable REST API daemon (default is on)])],
152 [do_webapi=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-webapi=$withval"],
156 [AC_HELP_STRING([--with-webjs],
157 [enable building of webjs packages (default is off)])],
158 [do_webjs=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-webjs=$withval"],
161 AC_ARG_WITH([vector],
162 [AC_HELP_STRING([--with-vector],
163 [enable building of vector package (default is off)])],
164 [do_vector=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-vector=$withval"],
167 dnl things set in the environment by Makepkgs never make it into an RPM
168 dnl build where the environment is stripped ... use a --with-foo=path
169 dnl construct to workaround this
172 [AC_HELP_STRING([--with-make],
173 [path to GNU compatible make(1) (default is empty for auto discovery)])],
174 [MAKE=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-make=$withval"],
178 [AC_HELP_STRING([--with-tar],
179 [path to GNU compatible tar(1) (default is empty for auto discovery)])],
180 [TAR=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-tar=$withval"],
184 [AC_HELP_STRING([--with-zip],
185 [path to GNU compatible zip(1) (default is empty for auto discovery)])],
186 [ZIP=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-zip=$withval"],
190 # Note: the following environment variables may be
191 # set to override the defaults.
193 # MAKE CC CPP LD LEX YACC INSTALL AWK SED ECHO
196 dnl Guess target platfrom
201 FATAL ERROR: Cannot guess your target, try explicit specification
202 using --target or mailto: pcp@oss.sgi.com to ask.'
203 rm -rf conftest conftest.*
206 dnl Remove 4th name component, if present, from target, target_os,
207 dnl build and build_os. Squash all x86 cpus into one LCD form - i386
208 target=`echo $target | sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'`
209 target_os=`echo $target_os | sed '[s/solaris2\..*/solaris/]'`
210 target_os=`echo $target_os | sed '[s/^\([^-][^-]*\)-.*$/\1/]' | sed '[s/[\.0-9]*//g]'`
212 build=`echo $build | sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'`
213 build_os=`echo $build_os | sed '[s/solaris2\..*/solaris/]'`
214 build_os=`echo $build_os | sed '[s/^\([^-][^-]*\)-.*$/\1/]'`
217 echo Building on $build for $target
218 echo "Build: os=$build_os cpu=$build_cpu"
219 echo "Target: os=$target_os cpu=$target_cpu"
221 if test "$cross_compiling" = "yes"; then
222 if test -f ./config.$target_os; then
223 . ./config.$target_os
227 FATAL ERROR: Cannot perform cross-compilation without a file to source
228 configuration information from (config.$target_os is missing)"
229 rm -rf conftest conftest.*
233 AC_SUBST(cross_compiling)
235 dnl CFLAGS setting is a co-dependency between here and PCFLAGS in
236 dnl src/include/builddefs.in ... need to be the same in both places
238 target_distro=$target_os
239 if test $target_os = linux
241 AC_DEFINE(IS_LINUX, [1], [Platform is Linux])
242 test -f /etc/SuSE-release && target_distro=suse
243 test -f /etc/fedora-release && target_distro=fedora
244 test -f /etc/redhat-release && target_distro=redhat
245 test -f /etc/debian_version && target_distro=debian
246 test -f /etc/slackware-version && target_distro=slackware
247 test -f /etc/gentoo-release && target_distro=gentoo
248 test -f /etc/mandriva-release && target_distro=mandriva
249 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE"
250 pcp_platform_paths='/usr/bin/X11:/usr/local/bin'
251 pcp_ps_all_flags=-efw
252 elif test $target_os = darwin
254 AC_DEFINE(IS_DARWIN, [1], [Platform is Darwin (Mac OS X)])
256 version=`sw_vers -productVersion | sed -e 's/\.//' -e 's/\..*//g'`
257 CFLAGS="-fPIC -no-cpp-precomp -fno-strict-aliasing -arch i386"
258 if test $version -ge 106
261 CFLAGS="$CFLAGS -arch x86_64"
264 pcp_platform_paths='/usr/local/bin'
265 pcp_ps_all_flags=auxww
266 elif test $target_os = mingw
268 AC_DEFINE(IS_MINGW, [1], [Platform is MinGW (Windows)])
269 CFLAGS="-fno-strict-aliasing"
270 pcp_platform_paths=''
271 pcp_ps_all_flags=-efW
272 elif test $target_os = solaris
274 AC_DEFINE(IS_SOLARIS, [1], [Platform is Solaris])
275 export CFLAGS_IF_GCC="-fPIC -fno-strict-aliasing"
276 export CFLAGS_IF_SUNCC="-fPIC -xalias_level=any -D_XPG4_2 -D__EXTENSIONS__"
277 pcp_platform_paths='/usr/bin/X11:/usr/local/bin:/opt/sfw/bin:/opt/csw/bin'
279 elif test $target_os = aix
281 AC_DEFINE(IS_AIX, [1], [Platform is AIX])
282 export CFLAGS="-qcpluscmt"
283 pcp_platform_paths='/usr/bin/X11:/usr/local/bin'
285 elif test $target_os = freebsd || test $target_os = kfreebsd
287 AC_DEFINE(IS_FREEBSD, [1], [Platform is FreeBSD])
288 test -f /etc/debian_version && target_distro=debian
289 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE"
290 if test $target_os = kfreebsd
292 pcp_ps_all_flags=-efw
294 pcp_ps_all_flags=auxww
296 pcp_platform_paths='/usr/bin/X11'
297 test -d /usr/local/bin && pcp_platform_paths="$pcp_platform_paths:/usr/local/bin"
298 test -d /usr/bsd && pcp_platform_paths="$pcp_platform_paths:/usr/bsd"
299 elif test $target_os = gnu
301 AC_DEFINE(IS_GNU, [1], [Platform is GNU Hurd])
302 test -f /etc/debian_version && target_distro=debian
303 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE"
304 pcp_platform_paths='/usr/bin/X11:/usr/local/bin'
305 pcp_ps_all_flags=-efw
306 elif test $target_os = netbsdelf
309 AC_DEFINE(IS_NETBSD, [1], [Platform is NetBSD])
310 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE -D_NETBSD_SOURCE"
311 pcp_platform_paths='/usr/pkg/bin'
312 pcp_ps_all_flags=auxww
313 elif test $target_os = openbsd
316 AC_DEFINE(IS_OPENBSD, [1], [Platform is OpenBSD])
317 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE"
318 pcp_platform_paths='/usr/local/bin'
319 pcp_ps_all_flags=auxww
322 echo "FATAL ERROR: need platform-specific customization for \"$target_os\""
323 rm -rf conftest conftest.*
326 AC_SUBST(pcp_platform_paths)
327 AC_SUBST(pcp_ps_all_flags)
329 dnl default C and C++ compiler optimization to -O2 -g
330 if test "$use_optimization" = no
332 optimization="-O0 -g"
334 optimization="-O2 -g"
336 AC_SUBST(optimization)
339 if test -z "$PKG_CONFIG"
342 echo "FATAL ERROR: did not find a pkg-config executable."
343 echo "You can either set \$PKG_CONFIG as the full path to pkg-config"
344 echo "in the environment, or install the pkgconfig package."
345 rm -rf conftest conftest.*
349 dnl check if user wants their own C compiler
351 AC_PROG_CC(suncc egcc gcc cc)
352 if test $target_os = solaris
354 AC_PATH_PROG(CCPATH,$CC,$CC)
356 if test "$GCC" = "yes"
358 CFLAGS="$CFLAGS $CFLAGS_IF_GCC"
360 CFLAGS="$CFLAGS $CFLAGS_IF_SUNCC"
362 if test "$use_64bit" = "no"
366 AC_MSG_CHECKING([for 64 bit Solaris host])
371 CFLAGS="$CFLAGS -m64"
372 LDFLAGS="$LDFLAGS -m64"
387 dnl these become CFLAGS and LDFLAGS for the build
391 if echo "$CFLAGS" | grep 'D_FORTIFY_SOURCE' >/dev/null
393 dnl for cc use locally in configure (not exported via $PCFLAGS),
394 dnl add -O in case -D_FORTIFY_SOURCE has been added to CFLAGS above,
395 dnl as -D_FORTIFY_SOURCE requires -O but we've separated optimization
396 dnl flags out into $CFLAGS_OPT for our build infrastructure
400 dnl some versions of gcc (e.g. version 4.8.4 on Gentoo Hardened) have added
401 dnl a predefined for _FORTIFY_SOURCE but only when -O is specified ... so
402 dnl to be safe we have -U_FORTIFY_SOURCE before -D_FORTIFY_SOURCE=2 below
404 # Add some security-related gcc flags
405 if echo "$CFLAGS" | grep stack-protector >/dev/null
407 dnl already set, probably from the environment
411 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
412 AS_IF([test "x$cc_is_gcc" = xyes -a "x$enable_ssp" != xno ],[
413 save_CFLAGS="$CFLAGS"
414 CFLAGS="$CFLAGS -O -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
415 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
416 AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.])
417 PCFLAGS="$PCFLAGS -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"],[
418 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
419 CFLAGS="$save_CFLAGS"
426 # Check for even more security-related gcc/linker flags, useful for daemons
428 [AS_HELP_STRING([--disable-pie], [disable position-independent-executable])])
429 AS_IF([test "x$cc_is_gcc" = xyes -a "x$enable_pie" != xno],[
431 PIELDFLAGS='-pie -Wl,-z,relro -Wl,-z,now'
432 save_CFLAGS="$CFLAGS"
433 save_LDFLAGS="$LDFLAGS"
434 CFLAGS="$CFLAGS $PIECFLAGS"
435 LDFLAGS="$LDFLAGS $PIELDFLAGS"
436 AC_LINK_IFELSE([AC_LANG_SOURCE([void main () {}])], [
437 AC_MSG_NOTICE([Compiling with gcc pie et al.])
439 AC_MSG_NOTICE([Compiler does not support -pie et al.])
443 CFLAGS="$save_CFLAGS"
444 LDFLAGS="$save_LDFLAGS"
449 # Check for support for symbol hiding via gcc flags
450 AC_ARG_ENABLE([visibility],
451 [AS_HELP_STRING([--disable-visibility], [disable gcc symbol visibility])])
452 AS_IF([test "x$cc_is_gcc" = xyes -a "$enable_visibility" != no],[
453 INVISIBILITY="-fvisibility=hidden"
454 save_CFLAGS="$CFLAGS"
455 CFLAGS="$CFLAGS -c $INVISIBILITY"
456 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int visible () { return 0; }])], [
457 AC_MSG_NOTICE([Compiling DSO PMDAs with gcc -fvisibility=hidden])
459 AC_MSG_NOTICE([Compiler does not support -fvisibility.])
462 CFLAGS="$save_CFLAGS"
464 AC_SUBST(INVISIBILITY)
466 AC_PROG_CXX(eg++ g++ c++)
469 AC_MSG_CHECKING([for working C++ compiler])
472 [AC_LANG_PROGRAM([[#include <cstdio>]],
473 [[const char gday[] = "G'day, world\n";]])],
474 [AC_MSG_RESULT([yes])],
479 # Prevent shared libraries from being built for libpcp and other core libraries
480 AC_ARG_ENABLE([shared],
481 [AS_HELP_STRING([--disable-shared], [disable core shared libary generation])],
482 [PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --disable-shared=$withval"])
483 AC_SUBST(enable_shared)
485 dnl check if user wants their own lex, yacc
493 dnl extra check for lex and yacc as these are often not installed
494 AC_MSG_CHECKING([if yacc is executable])
495 binary=`echo $yacc | awk '{print $1}'`
496 binary=`which "$binary"`
499 AC_MSG_RESULT([ yes])
503 echo "FATAL ERROR: did not find a valid yacc executable."
504 echo "You can either set \$YACC as the full path to yacc"
505 echo "in the environment, or install a yacc/bison package."
506 rm -rf conftest conftest.*
509 AC_MSG_CHECKING([if lex is executable])
510 binary=`echo $lex | awk '{print $1}'`
511 binary=`which "$binary"`
514 AC_MSG_RESULT([ yes])
518 echo "FATAL ERROR: did not find a valid lex executable."
519 echo "You can either set \$LEX as the full path to lex"
520 echo "in the environment, or install a lex/flex package."
521 rm -rf conftest conftest.*
525 dnl check if user wants their own awk, sed and echo
526 if test -z "$AWK"; then
527 AC_PATH_PROGS(AWK, gawk awk, /usr/bin/awk)
539 if test -z "$SED"; then
540 AC_PATH_PROG(SED, sed, /bin/sed)
544 if test -z "$ECHO"; then
545 AC_PATH_PROG(ECHO, echo, /bin/echo)
549 if test -z "$WHICH"; then
550 AC_PATH_PROG(WHICH, which, /usr/bin/which)
555 dnl check we don't get the Windows sort ...
556 AC_MSG_CHECKING([where unix-like sort(1) lives])
557 if test $target_os = mingw; then
558 for d in /bin /usr/bin /mingw/bin /mingw/usr/bin
560 if test -x $d/sort; then
573 echo "FATAL ERROR: $sort -n failed!"
574 rm -rf conftest conftest.*
579 dnl echo_n set to -n if echo understands -n to suppress newline
580 dnl echo_c set to \c if echo understands \c to suppress newline
581 AC_MSG_CHECKING([if echo uses -n or backslash-c to suppress newlines])
582 if ( $echo "testing\c"; $echo 1,2,3 ) | grep c >/dev/null
584 if ( $echo -n testing; $echo 1,2,3 ) | sed s/-n/xn/ | grep xn >/dev/null
587 AC_MSG_RESULT([neither?])
594 AC_MSG_RESULT([backslash-c])
599 dnl subsequent configure checks rely on $EGREP being set
602 dnl Check for static probes (dtrace, systemtap)
603 if test "$do_probes" = "check" -o "$do_probes" = "yes"
606 AC_CHECK_PROGS(DTRACE, dtrace, [])
609 if test "$do_probes" = "yes"
611 AC_MSG_ERROR([cannot enable static probes - no dtrace executable])
615 AC_CHECK_HEADERS([sys/sdt.h], [
616 if $enable_probes = true
618 if test $target_os = kfreebsd
621 elif test $target_os = freebsd
623 dnl dtrace support in FreeBSD depends on configuration of kernel
624 rm -f conftest.d conftest.h
625 cat <<End-of-File >conftest.d
630 if dtrace -s conftest.d -h >/dev/null 2>&1
632 if test ! -f conftest.h
635 if test "$do_probes" = "yes"
637 AC_MSG_ERROR([cannot enable static probes - no .h from dtrace -h])
642 if test "$do_probes" = "yes"
644 AC_MSG_ERROR([cannot enable static probes - dtrace failed])
651 if test "$do_probes" = "yes"
653 AC_MSG_ERROR([cannot enable static probes - no SDT header])
657 if test "$enable_probes" = "true"
659 AC_DEFINE(HAVE_STATIC_PROBES, [1], [Static probes (dtrace, systemtap)])
661 AC_SUBST(enable_probes)
665 dnl Check for service discovery mechanisms (DNS-SD, Avahi)
666 AS_IF([test "x$do_discovery" != "xno"], [
667 # on Mac OS X, dns_sd.h
669 # on Linux, aloha Avahi
671 PKG_CHECK_MODULES([avahi], [avahi-client],
672 [AC_CHECK_LIB(avahi-client, avahi_client_new,
673 [lib_for_avahi="-lavahi-common -lavahi-client"],
674 [enable_avahi=false])
675 ],[enable_avahi=false])
676 AC_CHECK_HEADERS([avahi-client/publish.h],, [enable_avahi=false])
677 AC_CHECK_HEADERS([avahi-common/alternative.h],, [enable_avahi=false])
679 if test "$enable_avahi" = "true"
681 AC_SUBST(lib_for_avahi)
682 AC_SUBST(avahi_CFLAGS)
683 AC_DEFINE(HAVE_AVAHI, [1], [Service discovery via Avahi])
684 enable_discovery=true
687 if test "$do_discovery" != "check" -a "$enable_discovery" != "true"
689 AC_MSG_ERROR([cannot enable service discovery - no supported mechanisms])
691 if test "$enable_discovery" = "true"
693 AC_DEFINE(HAVE_SERVICE_DISCOVERY, [1], [Service discovery mechanisms])
696 AC_SUBST(enable_discovery)
697 AC_SUBST(enable_avahi)
699 dnl Check for systemd services
701 AS_IF([test "x$do_systemd" != "xno"], [
704 PKG_CHECK_VAR([SYSTEMD_SYSTEMUNITDIR], [systemd], [systemdsystemunitdir],
705 [pcp_systemdunit_dir=$SYSTEMD_SYSTEMUNITDIR], [enable_systemd=false])
706 AC_SUBST(pcp_systemdunit_dir)
707 if test -z "$pcp_systemdunit_dir"
709 if test "$do_systemd" = "yes"
711 AC_MSG_ERROR([cannot enable systemd support - no systemunitdir path])
716 AC_SUBST(enable_systemd)
718 # NB: No AC_PREFIX_DEFAULT is needed, as the default configure invocation
719 # targets a build for non-system directories such as /usr/local.
720 # AC_PREFIX_DEFAULT([])
723 PACKAGE_VERSION=${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_REVISION}
724 AC_SUBST(PACKAGE_VERSION)
725 AC_SUBST(PACKAGE_MAJOR)
726 AC_SUBST(PACKAGE_MINOR)
727 AC_SUBST(PACKAGE_REVISION)
728 AC_SUBST(PACKAGE_BUILD)
730 if test -z "$PACKAGE_BUILD_DATE" ; then
731 PACKAGE_BUILD_DATE=`date +%Y-%m-%d`
733 AC_SUBST(PACKAGE_BUILD_DATE)
735 if test -z "$PACKAGE_DISTRIBUTION" ; then
736 PACKAGE_DISTRIBUTION=$target_distro
738 AC_SUBST(PACKAGE_DISTRIBUTION)
740 dnl generate PM_VERSION_CURRENT for header
741 pm_version_current=`awk </dev/null "BEGIN { print (${PACKAGE_MAJOR}*256+${PACKAGE_MINOR})*256+${PACKAGE_REVISION} }"`
742 AC_SUBST(pm_version_current)
744 dnl output header files with cpp defs HAVE_*, etc
745 AC_CONFIG_HEADERS(src/include/pcp/config.h src/include/pcp/configsz.h)
746 AC_OUTPUT(src/include/pcp/platform_defs.h)
748 AC_CHECK_PROGS(GIT, git)
751 dnl check if python available for the build and runtime
752 AC_CHECK_PROGS(PYTHON, python, python2.7)
755 dnl check if python3 available for the build and runtime
756 AC_CHECK_PROGS(PYTHON3, python3, python3.4)
759 dnl check if python tools/packages wanted (need python >= 2.6)
761 AS_IF([test "x$do_python" != "xno"], [
767 AC_MSG_CHECKING([Python version])
768 eval `$PYTHON -V 2>&1 | awk '/^Python/ { ver=2; print $ver }' | awk -F. '{ major=1; minor=2; point=3; printf "export PY_MAJOR=%d PY_MINOR=%d PY_POINT=%d\n",$major,$minor,$point }'`
769 AC_MSG_RESULT([$PY_MAJOR.$PY_MINOR.$PY_POINT])
770 if test "$PY_MAJOR" -lt 2; then
771 echo WARNING: Python version 2.6 or later does not seem to be installed.
772 echo Cannot proceed with the Python $PY_MAJOR installation found.
775 if test "$PY_MAJOR" -eq 2 -a "$PY_MINOR" -lt 6 ; then
776 echo WARNING: Python version 2.$PY_MINOR is too old.
777 echo Python version 2.6 or later is required for Python builds.
780 AC_CHECK_HEADERS([python${PY_MAJOR}.${PY_MINOR}/Python.h], [], [
781 echo WARNING: Python version $PY_MAJOR.$PY_MINOR header file missing.
782 echo Cannot proceed with the Python $PY_MAJOR installation found.
787 if test "$do_python" != "check" -a "$enable_python2" != "true"
789 AC_MSG_ERROR([cannot enable Python - no supported version found])
792 AC_SUBST(enable_python2)
794 dnl check if python3 tools/packages wanted (need python >= 3.3)
796 AS_IF([test "x$do_python3" != "xno"], [
798 if test -z "$PYTHON3"
802 AC_MSG_CHECKING([Python3 version])
803 eval `$PYTHON3 -V 2>&1 | awk '/^Python/ { ver=2; print $ver }' | awk -F. '{ major=1; minor=2; point=3; printf "export PY_MAJOR=%d PY_MINOR=%d PY_POINT=%d\n",$major,$minor,$point }'`
804 AC_MSG_RESULT([$PY_MAJOR.$PY_MINOR.$PY_POINT])
805 if test "$PY_MAJOR" -lt 3; then
806 echo WARNING: Python version 3.3 or later does not seem to be installed.
807 echo Cannot proceed with the Python $PY_MAJOR installation found.
810 if test "$PY_MAJOR" -eq 3 -a "$PY_MINOR" -lt 3 ; then
811 echo WARNING: Python version 3.$PY_MINOR is too old.
812 echo Python version 3.3 or later is required for Python builds.
815 AC_CHECK_HEADERS([python${PY_MAJOR}.${PY_MINOR}m/Python.h], [], [
816 echo WARNING: Python version $PY_MAJOR.$PY_MINOR header file missing.
817 echo Cannot proceed with the Python $PY_MAJOR installation found.
822 if test "$do_python3" != "check" -a "$enable_python3" != "true"
824 AC_MSG_ERROR([cannot enable Python3 - no supported version found])
827 AC_SUBST(enable_python3)
829 dnl convenience macro to determine if either python is available
830 AC_MSG_CHECKING([for any python version])
831 if test "$cross_compiling" = "yes"; then
833 echo "cross-compile -> \"$ans\"" >&5
834 elif test "$enable_python2" = "true" -o "$enable_python3" = "true"
840 AC_SUBST(have_python)
841 if $have_python; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
843 dnl choose the prefered python executable (py2 -> py3 transtion)
844 if test "$enable_python3" = "true"
846 pcp_python_prog=$PYTHON3
847 elif test "$enable_python2" = "true"
849 pcp_python_prog=$PYTHON
853 AC_SUBST(pcp_python_prog)
855 dnl check availability of some Python modules
856 dnl usage PCP_CHECK_PYTHON_MODULE(module_name) or
857 dnl PCP_CHECK_PYTHON_MODULE(module_name, <import string>)
858 dnl default <import string> is "import module_name"
860 dnl sets $have_python_<module_name> as true or false
862 AC_DEFUN(PCP_CHECK_PYTHON_MODULE,
863 [ AC_MSG_CHECKING(for Python module $1)
870 $pcp_python_prog -c 'import sys;
871 '"$txt" >>config.log 2>&1
875 eval have_python_$1=true
878 eval have_python_$1=false
881 PCP_CHECK_PYTHON_MODULE(jsonpointer)
882 AC_SUBST(have_python_jsonpointer)
883 PCP_CHECK_PYTHON_MODULE(six)
884 AC_SUBST(have_python_six)
886 AC_MSG_CHECKING([if the json PMDA should be included])
888 AS_IF([test "x$do_pmdajson" = "xyes"], [pmda_json=true])
889 AS_IF([test "x$do_pmdajson" = "xcheck"], [
890 dnl JSON PMDA needs both the six and jsonpointer Python modules
891 $have_python_jsonpointer && $have_python_six && pmda_json=true
893 AC_SUBST(PMDA_JSON, $pmda_json)
894 if $pmda_json; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
896 dnl check if perl available for the build and runtime
897 AC_CHECK_PROGS(PERL, perl)
900 AC_MSG_CHECKING([for any perl version])
901 if test "$cross_compiling" = "yes"; then
903 echo "cross-compile -> \"$ans\"" >&5
912 AC_SUBST(pcp_perl_prog)
914 AC_MSG_RESULT($pcp_perl_prog)
916 AC_MSG_CHECKING([if the SNMP PMDA should be included])
918 if test "$have_perl" = true
920 dnl rpm built for SNMP PMDA needs Perl Net::SNMP
921 if $pcp_perl_prog -e "use Net::SNMP" >/dev/null 2>&1
926 AC_SUBST(PMDA_SNMP, $pmda_snmp)
927 if $pmda_snmp; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
929 AC_MSG_CHECKING([if the mysql PMDA should be included])
931 if test "$have_perl" = true
933 dnl rpm build for mysql PMDA needs Perl DBI and DBD::mysql
934 if $pcp_perl_prog -e "use DBI" >/dev/null 2>&1
936 if $pcp_perl_prog -e "use DBD::mysql" >/dev/null 2>&1
942 AC_SUBST(PMDA_MYSQL, $pmda_mysql)
943 if $pmda_mysql; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
945 AC_MSG_CHECKING([if the postgresql PMDA should be included])
946 pmda_postgresql=false
947 if test "$have_perl" = true
949 dnl rpm build for postgresql PMDA needs Perl DBI and DBD::Pg
950 if $pcp_perl_prog -e "use DBI" >/dev/null 2>&1
952 if $pcp_perl_prog -e "use DBD::Pg" >/dev/null 2>&1
958 AC_SUBST(PMDA_POSTGRESQL, $pmda_postgresql)
959 if $pmda_postgresql; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
961 AC_MSG_CHECKING([if the oracle PMDA should be included])
963 if test "$have_perl" = true
965 dnl rpm build for oracle PMDA needs Perl DBI
966 if $pcp_perl_prog -e "use DBI" >/dev/null 2>&1
971 AC_SUBST(PMDA_ORACLE, $pmda_oracle)
972 if $pmda_oracle; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
974 AC_MSG_CHECKING([if the elasticsearch PMDA should be included])
975 pmda_elasticsearch=false
976 if test "$have_perl" = true
978 dnl rpm build for elasticsearch PMDA needs Perl LWP::UserAgent
979 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
981 pmda_elasticsearch=true
984 AC_SUBST(PMDA_ELASTICSEARCH, $pmda_elasticsearch)
985 if $pmda_elasticsearch; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
987 AC_MSG_CHECKING([if the nginx PMDA should be included])
989 if test "$have_perl" = true
991 dnl rpm build for nginx PMDA needs Perl LWP::UserAgent
992 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
997 AC_SUBST(PMDA_NGINX, $pmda_nginx)
998 if $pmda_nginx; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1000 AC_MSG_CHECKING([if the activemq PMDA should be included])
1002 if test "$have_perl" = true
1004 dnl rpm build for activemq PMDA needs Perl LWP::UserAgent
1005 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
1010 AC_SUBST(PMDA_ACTIVEMQ, $pmda_activemq)
1011 if $pmda_activemq; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1016 AS_IF([test "x$do_qt" != "xno"], [
1021 dnl qmake-qt5 [/usr/lib64/qt5/bin:/usr/lib/qt5/bin]
1022 AC_PATH_PROGS(QMAKE, [qmake-qt4 qmake],, [$QTDIR/bin:/usr/bin:/usr/lib64/qt4/bin:/usr/lib/qt4/bin])
1023 test "x$cc_is_gcc" = xyes -a $target_os = solaris && QMAKE="$QMAKE -spec solaris-g++"
1030 AC_MSG_CHECKING([Qt version])
1031 eval `$qmake --version | awk '/Using Qt version/ { ver=4; print $ver }' | awk -F. '{ major=1; minor=2; point=3; printf "export QT_MAJOR=%d QT_MINOR=%d QT_POINT=%d\n",$major,$minor,$point }'`
1032 AC_MSG_RESULT([$QT_MAJOR.$QT_MINOR.$QT_POINT])
1033 if test "$QT_MAJOR" -lt 4; then
1034 echo WARNING: Qt version 4.4 or later does not seem to be installed.
1035 echo Cannot proceed with the Qt $QT_MAJOR installation found.
1038 if test "$QT_MAJOR" -eq 4 -a "$QT_MINOR" -lt 4 ; then
1039 echo WARNING: Qt version 4.$QT_MINOR is too old.
1040 echo Qt version 4.4 or later is required for Qt builds.
1045 if test "$do_qt" != "check" -a "$enable_qt" != "true"
1047 AC_MSG_ERROR([cannot enable Qt - no supported Qt installation found])
1048 elif test "$enable_qt" = "true" -a "x$cxx" = "x"
1051 test "$do_qt" != "check" && \
1052 AC_MSG_ERROR([C++ compiler unavailable, cannot build Qt components])
1053 elif test "$do_qt" = "debug"
1055 dnl Debug/release style build? (non-debug by default)
1060 AC_SUBST(qt_release)
1064 dnl check if user wants their own make program
1065 dnl note: all makefiles in this package use the gmake syntax
1068 AC_PATH_PROG(MAKE, gmake)
1071 # look elsewhere ...
1072 AC_MSG_CHECKING([for GNU make elsewhere])
1073 for f in /usr/local/bin/gmake /usr/freeware/bin/gmake /usr/local/bin/make /opt/sfw/bin/gmake nowhere
1081 if test $f = nowhere
1083 # Check if /usr/bin/make is any good
1084 mver=`/usr/bin/make --version 2>/dev/null | sed -n -e1p | cut -c1-8`
1085 if test "$mver" != "GNU Make"
1088 echo "FATAL ERROR: could not find GNU make anywhere"
1089 echo "You need to set \$MAKE as the full path to GNU make "
1090 echo "in the environment."
1091 rm -rf conftest conftest.*
1097 AC_MSG_RESULT($MAKE)
1103 dnl check if users wants their own CPP
1104 if test -z "$CPP"; then
1110 dnl check if users wants their own linker
1111 if test -z "$LD"; then
1112 AC_PATH_PROG(LD, ld, /usr/bin/ld)
1117 dnl Provide ways to override owner and group for installed files
1118 if test -z "$PCP_USER_INSTALL" ; then
1119 pcp_user_install=root
1121 pcp_user_install="$PCP_USER_INSTALL"
1123 AC_SUBST(pcp_user_install)
1124 if test -z "$PCP_GROUP_INSTALL" ; then
1127 darwin|freebsd|netbsd|openbsd)
1128 pcp_group_install=wheel
1131 pcp_group_install=root
1135 pcp_group_install="$PCP_GROUP_INSTALL"
1137 AC_SUBST(pcp_group_install)
1139 dnl check if the tar program is available
1140 if test -z "$TAR"; then
1141 AC_PATH_PROGS(TAR, gtar tar, tar)
1143 if test $target_os = darwin -a -x /usr/bin/gnutar
1150 dnl check if the gzip program is available
1151 dnl (needed to gzip man pages on some platforms)
1152 if test -z "$ZIP"; then
1153 AC_PATH_PROG(ZIP, gzip, /bin/gzip)
1155 test ! -x "$ZIP" && ZIP=/usr/local/bin/gzip
1156 test ! -x "$ZIP" && ZIP=/usr/freeware/bin/gzip
1157 test ! -x "$ZIP" && ZIP=/usr/bin/gzip
1159 test -z "$gzip" && gzip=no-gzip
1162 dnl check if the bzip2 program is available
1163 dnl (needed to bzip2 man pages on some platforms)
1164 if test -z "$BZIP2"; then
1165 AC_PATH_PROG(BZIP2, bzip2, /bin/bzip2)
1167 test ! -x "$BZIP2" && BZIP2=/usr/bin/bzip2
1168 test ! -x "$BZIP2" && BZIP2=/usr/local/bin/bzip2
1169 test ! -x "$BZIP2" && BZIP2=/usr/freeware/bin/bzip2
1171 test -z "$bzip2" && bzip2=no-bzip2
1174 dnl check if the lzma program is available
1175 dnl (needed to lzma man pages on some platforms)
1176 if test -z "$LZMA"; then
1177 AC_PATH_PROG(LZMA, lzma, /bin/lzma)
1179 test ! -x "$LZMA" && LZMA=/usr/bin/lzma
1180 test ! -x "$LZMA" && LZMA=/usr/local/bin/lzma
1181 test ! -x "$LZMA" && LZMA=/usr/freeware/bin/lzma
1183 test -z "$lzma" && lzma=no-lzma
1186 dnl check if the xz program is available
1187 dnl (needed to xz man pages on some platforms)
1188 if test -z "$XZ"; then
1189 AC_PATH_PROG(XZ, xz, /bin/xz)
1191 test ! -x "$XZ" && XZ=/usr/bin/xz
1192 test ! -x "$XZ" && XZ=/usr/local/bin/xz
1193 test ! -x "$XZ" && XZ=/usr/freeware/bin/xz
1195 test -z "$xz" && xz=no-xz
1198 dnl Check for mac PackageMaker
1199 AC_MSG_CHECKING([for PackageMaker])
1200 if test -z "$PACKAGE_MAKER"
1202 if test $target_os = darwin
1204 if test -x /Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1205 then # local XCode extras install
1206 package_maker=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1207 AC_MSG_RESULT([ yes (local install)])
1208 elif test -x /Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1210 package_maker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1211 AC_MSG_RESULT([ yes (darwin 6.x)])
1212 elif test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
1214 AC_MSG_RESULT([ yes (darwin 7.x)])
1215 package_maker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
1217 AC_MSG_RESULT([ not found!])
1218 AC_MSG_WARN([PackageMaker not found, mac packages will not be made])
1221 AC_MSG_RESULT([ no])
1224 package_maker="$PACKAGE_MAKER"
1226 AC_SUBST(package_maker)
1228 dnl check if the hdiutil program is available
1229 if test -z "$HDIUTIL"; then
1230 AC_PATH_PROG(HDIUTIL, hdiutil)
1235 dnl check if the mkinstallp program is available (AIX)
1236 if test -z "$MKINSTALLP"; then
1237 AC_PATH_PROG(MKINSTALLP, mkinstallp)
1239 mkinstallp=$MKINSTALLP
1240 AC_SUBST(mkinstallp)
1242 dnl check for the Solaris pmgmk package maker
1243 if test -z "$PKGMK"; then
1244 AC_PATH_PROG(PKGMK, pkgmk)
1249 dnl check if the dlltool program is available
1250 if test -z "$DLLTOOL"; then
1251 AC_PATH_PROG(DLLTOOL, dlltool)
1256 dnl check if the rpmbuild program is available
1257 if test -z "$RPMBUILD"; then
1258 AC_PATH_PROG(RPMBUILD, rpmbuild)
1260 test $target_distro = slackware && RPMBUILD=''
1264 dnl check if the rpm program is available
1265 if test -z "$RPM"; then
1266 AC_PATH_PROG(RPM, rpm)
1268 test $target_distro = slackware && RPM=''
1272 dnl if rpmbuild exists, use it, otherwise use rpm
1273 if test -n "$RPMBUILD" -a -x "$RPMBUILD"
1281 dnl check if the pod2man program is available (perl man page builder)
1282 if test -z "$POD2MAN"; then
1283 AC_PATH_PROG(POD2MAN, pod2man)
1288 dnl extra check for the Perl MakeMaker package
1289 AC_MSG_CHECKING([if ExtUtils::MakeMaker is installed])
1290 perl -e "use ExtUtils::MakeMaker" 2>/dev/null
1293 AC_MSG_RESULT([ yes])
1295 AC_MSG_RESULT([ no])
1297 echo "FATAL ERROR: Perl ExtUtils::MakeMaker module missing."
1298 echo "You can either install this from your distribution, or"
1299 echo "download from CPAN (Comprehensive Perl Archive Network)."
1300 rm -rf conftest conftest.*
1304 AC_PATH_PROG(TRUEPROG, true)
1306 dnl check if the makedepend program is available
1307 if test -z "$MAKEDEPEND"; then
1308 AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUEPROG)
1310 makedepend=$MAKEDEPEND
1311 AC_SUBST(makedepend)
1313 dnl check if the md5sum program is available
1314 if test -z "$MD5SUM"; then
1315 AC_PATH_PROG(MD5SUM, md5sum, $TRUEPROG)
1320 dnl check if the Debian dpkg program is available
1321 if test -z "$DPKG"; then
1322 AC_PATH_PROG(DPKG, dpkg)
1327 dnl check for the Slackware makepkg packaging tool
1328 if test -z "$MAKEPKG"; then
1329 AC_PATH_PROG(MAKEPKG, makepkg)
1334 dnl check if a toolchain is available for the books
1335 test -z "$PUBLICAN" && AC_PATH_PROG(PUBLICAN, publican)
1338 test -z "$DBLATEX" && AC_PATH_PROG(DBLATEX, dblatex)
1341 test -z "$XMLTO" && AC_PATH_PROG(XMLTO, xmlto)
1346 if test "$do_books" = "check" -o "$do_books" = "yes"
1348 if test "$BOOK_TOOLCHAIN" != ""
1350 book_toolchain=$BOOK_TOOLCHAIN
1351 elif test "$DBLATEX" != ""
1353 book_toolchain=dblatex
1354 elif test "$PUBLICAN" != ""
1356 book_toolchain=publican
1357 elif test "$XMLTO" != ""
1359 book_toolchain=xmlto
1360 elif test "$do_books" = "yes"
1362 AC_MSG_ERROR([cannot enable books build - no toolchain found])
1365 AC_SUBST(book_toolchain)
1368 if test "$do_books_brand" != ""
1370 book_brand=$do_books_brand
1372 AC_SUBST(book_brand)
1374 dnl check if symbolic links are supported
1376 if test $target_os = mingw; then
1380 dnl if /proc is not mounted, try and mount it
1381 dnl before trying to run the ps style test below
1384 test -f /proc/stat || mount /proc >/dev/null 2>&1
1387 dnl set platform specific ps
1388 if test -n "$PROCPS"
1390 pcp_ps_prog="$PROCPS"
1394 AC_SUBST(pcp_ps_prog)
1396 dnl set platform specific event logger
1397 if test $target_os = mingw
1399 pcp_syslog_prog=pcp-eventlog
1401 pcp_syslog_prog=logger
1403 AC_SUBST(pcp_syslog_prog)
1406 if test $target_os = solaris
1408 test -f /usr/xpg4/bin/grep && grep=/usr/xpg4/bin/grep
1412 dnl checks for /proc pseudo file system
1413 AC_MSG_CHECKING([for /proc ])
1414 if test "$cross_compiling" = "yes"; then
1416 echo "cross-compile -> \"$ans\"" >&5
1426 AC_DEFINE(HAVE_PROCFS, [1], [Support for /proc pseudo-filesystem])
1431 dnl Checks for C header files.
1435 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h syslog.h)
1436 AC_CHECK_HEADERS(unistd.h stddef.h stdlib.h sched.h dlfcn.h dl.h)
1437 AC_CHECK_HEADERS(sys/time.h sys/times.h)
1438 AC_CHECK_HEADERS(sys/resource.h sys/prctl.h)
1439 AC_CHECK_HEADERS(sys/sysinfo.h sys/systeminfo.h)
1440 AC_CHECK_HEADERS(endian.h standards.h sys/byteorder.h)
1441 AC_CHECK_HEADERS(libgen.h sys/param.h sys/mman.h sys/un.h)
1442 AC_CHECK_HEADERS(values.h stdint.h ieeefp.h math.h)
1443 AC_CHECK_HEADERS(pwd.h grp.h regex.h sys/wait.h)
1444 AC_CHECK_HEADERS(termio.h termios.h sys/termios.h)
1445 AC_CHECK_HEADERS(sys/ioctl.h sys/select.h sys/socket.h)
1446 AC_CHECK_HEADERS(netdb.h)
1447 if test $target_os = darwin -o $target_os = openbsd
1449 AC_CHECK_HEADERS(net/if.h, [], [], [#include <sys/types.h>
1450 #include <sys/socket.h>])
1452 AC_CHECK_HEADERS(net/if.h)
1454 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h arpa/inet.h)
1455 AC_CHECK_HEADERS(windows.h winsock2.h ws2tcpip.h)
1456 AC_CHECK_HEADERS(execinfo.h bits/wordsize.h)
1457 AC_CHECK_HEADERS(iptypes.h, [], [], [#include <windows.h>])
1458 AC_CHECK_HEADERS(iphlpapi.h, [], [], [#include <winsock2.h>])
1459 AC_CHECK_HEADERS(fts.h libzfs.h)
1460 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/mount.h)
1462 dnl Check if we have <sys/endian.h> ... standard way
1463 AC_MSG_CHECKING([for sys/endian.h ])
1466 #include <sys/endian.h>
1469 ], AC_DEFINE(HAVE_SYS_ENDIAN_H, [1], [sys/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1471 dnl Check if we have <machine/endian.h> ... MacOSX way
1472 AC_MSG_CHECKING([for machine/endian.h ])
1475 #include <machine/endian.h>
1478 ], AC_DEFINE(HAVE_MACHINE_ENDIAN_H, [1], [machine/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1480 dnl Check if we have <sys/endian.h> ... IRIX strangeness
1481 AC_MSG_CHECKING([for sys/endian.h (IRIX variant) ])
1484 #include <standards.h>
1485 #include <sys/endian.h>
1488 ], AC_DEFINE(HAVE_SYS_ENDIAN_H, [1], [IRIX sys/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1490 dnl Checks for typedefs, structures, and compiler characteristics.
1499 dnl check if regex functions come from libregex (mingw)
1500 AC_CHECK_LIB(regex, regcomp)
1502 if test $ac_cv_lib_regex_regcomp = yes
1504 lib_for_regex="-lregex"
1506 AC_SUBST(lib_for_regex)
1508 PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=true], [have_ncurses=false])
1509 AC_SUBST(HAVE_NCURSES, [$have_ncurses])
1511 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-journal],
1512 [pmda_systemd=true], [pmda_systemd=false])
1513 AC_MSG_CHECKING([if the systemd PMDA should be included])
1514 AC_SUBST(PMDA_SYSTEMD, $pmda_systemd)
1515 if $pmda_systemd; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1517 pmda_infiniband=false
1518 AS_IF([test "x$do_infiniband" != "xno"], [
1519 AC_CHECK_HEADERS([infiniband/umad.h], [
1520 AC_CHECK_HEADERS([infiniband/mad.h], [pmda_infiniband=true], [])
1524 AC_CHECK_LIB(ibmad, madrpc_init)
1525 AC_CHECK_LIB(ibumad, umad_init)
1526 if test $ac_cv_lib_ibmad_madrpc_init = yes -a $ac_cv_lib_ibumad_umad_init = yes
1528 IB_LIBS="-libmad -libumad"
1530 AC_MSG_CHECKING([for port_performance_query_via])
1531 AC_TRY_LINK_FUNC(port_performance_query_via,
1532 AC_DEFINE(HAVE_PORT_PERFORMANCE_QUERY_VIA, [1], [port_performance_query_via API])
1533 have_port_performance_query_via=true
1535 have_port_performance_query_via=false
1537 AC_MSG_CHECKING([for pma_query_via])
1538 AC_TRY_LINK_FUNC(pma_query_via,
1539 AC_DEFINE(HAVE_PMA_QUERY_VIA, [1], [pma_query_via API])
1540 have_pma_query_via=true
1542 have_pma_query_via=false
1545 if test $have_pma_query_via -o $have_port_performance_query_via
1549 pmda_infiniband=false
1552 pmda_infiniband=false
1557 AC_MSG_CHECKING([if the infiniband PMDA should be included])
1558 AC_SUBST(PMDA_INFINIBAND, $pmda_infiniband)
1559 if $pmda_infiniband; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1562 AS_IF([test "x$do_papi" != "xno"], [
1565 saved_LDFLAGS="$LDFLAGS"
1566 saved_CFLAGS="$CFLAGS"
1569 dnl potentially from the environment, else empty
1570 CFLAGS="$papi_CFLAGS"
1571 LDFLAGS="$papi_LIBS"
1577 PAPI_ROOTDIR=$do_papi;
1578 CFLAGS="-I$PAPI_ROOTDIR/include"
1579 LDFLAGS="-L$PAPI_ROOTDIR/lib"
1582 PKG_CHECK_MODULES(papi,[$do_papi],[
1583 CFLAGS="$papi_CFLAGS"
1584 LDFLAGS="$papi_LIBS"])
1588 # $papi_LIBS may include -lpapi harmlessly redudantly with AC_CHECK_LIB
1589 AC_CHECK_LIB([papi], [PAPI_library_init],
1590 [papi_libs="$LDFLAGS -lpapi"],
1591 [enable_papi=false])
1592 AC_CHECK_HEADERS([papi.h], [papi_cflags="$CFLAGS"], [enable_papi=false])
1593 if test "$do_papi" != "check" -a "$enable_papi" != "true"
1595 AC_MSG_ERROR([PAPI is not installed, cannot enable the PAPI PMDA])
1597 pmda_papi=$enable_papi
1600 CFLAGS="$saved_CFLAGS"
1601 LDFLAGS="$saved_LDFLAGS"
1602 AC_SUBST(PAPI_CFLAGS, $papi_cflags)
1603 AC_SUBST(PAPI_LIBS, $papi_libs)
1605 AC_MSG_CHECKING([if the papi PMDA should be included])
1606 AC_SUBST(PMDA_PAPI, $pmda_papi)
1607 if $pmda_papi; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1609 AS_IF([test "x$pmda_papi" = "xtrue"], [
1610 dnl check if struct PAPI_component_info_t has a disabled field
1611 AC_MSG_CHECKING([whether struct PAPI_component_info_t has a disabled field])
1612 cat <<End-of-File >conftest.c
1614 int main() { PAPI_component_info_t *c; c->disabled = 0; }
1616 (eval $ac_compile) 2>conftest.out
1617 cat conftest.out >&5
1618 if test -s conftest.out
1622 AC_DEFINE(HAVE_PAPI_DISABLED_COMP, [1], [PAPI_component_info_t field])
1629 pmda_perfevent=false
1630 AS_IF([test "x$do_perfevent" != "xno" ], [
1631 enable_perfevent=true
1634 AC_CHECK_LIB([pfm], [pfm_get_os_event_encoding],
1636 [enable_perfevent=false])
1637 AC_CHECK_HEADERS([perfmon/pfmlib_perf_event.h], [], [enable_perfevent=false])
1638 if test "$do_perfevent" != "check" -a "$enable_papi" != "true"
1640 AC_MSG_ERROR([libpfm is not installed, cannot enable the perfevent PMDA])
1642 pmda_perfevent=$enable_perfevent
1645 AC_SUBST(PFM_LIBS, $pfm_libs)
1647 AC_MSG_CHECKING([if the perfevent PMDA should be included])
1648 AC_SUBST(PMDA_PERFEVENT, $pmda_perfevent)
1649 if $pmda_perfevent; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1651 dnl Do you have RPM Package Manager libraries for pmdarpm?
1654 AC_MSG_CHECKING([for rpmlib > 4.4.2])
1656 [AC_LANG_PROGRAM([[#include <rpm/header.h>]],
1657 [[(void)HEADERGET_EXT;]])],
1658 [AC_MSG_RESULT([yes])
1660 [AC_MSG_RESULT([no])])
1661 AC_MSG_CHECKING([if the rpm PMDA should be included])
1662 AC_SUBST(PMDA_RPM,$pmda_rpm)
1663 if $pmda_rpm; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1666 dnl Do you have the required qshape script for the postfix PMDA
1667 dnl The logic here is copied from the PMDA's Install script
1669 AC_CHECK_PROGS(QSHAPE, qshape, [], path=[$PATH:/usr/sbin])
1670 AC_MSG_CHECKING([if the postfix PMDA should be included])
1671 if test -n "$QSHAPE"
1675 for script in /usr/share/doc/packages/postfix-doc/auxiliary/qshape/qshape.pl
1677 if test -f "$script"
1684 AC_SUBST(PMDA_POSTFIX,$pmda_postfix)
1685 if $pmda_postfix; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1687 dnl Do you have system microhttpd libraries for pmwebapi?
1688 PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd > 0.9.9], [have_libmicrohttpd=true], [have_libmicrohttpd=false])
1689 AC_SUBST(HAVE_LIBMICROHTTPD, [$have_libmicrohttpd])
1691 dnl Do you have graphics libraries for pmwebapi?
1692 PKG_CHECK_MODULES([cairo], [cairo >= 1.2, cairo-ft >= 1.2, cairo-png >= 1.2], [have_cairo=true], [have_cairo=false])
1693 AC_SUBST(HAVE_CAIRO, [$have_cairo])
1696 AS_IF([test "x$do_webapi" != "xno"], [
1699 if test "$have_libmicrohttpd" != "true"
1702 test "$do_webapi" != "check" && \
1703 AC_MSG_ERROR([libmicrohttpd is not installed, cannot enable the web API])
1704 elif test "$do_webapi" != "check" -a "x$cxx" = "x"
1707 test "$do_webapi" != "check" && \
1708 AC_MSG_ERROR([C++ compiler unavailable, cannot enable the web API])
1711 AC_SUBST(enable_webapi)
1713 enable_manager=false
1714 AS_IF([test "x$do_manager" != "xno"], [
1717 if test "$target_os" = "mingw"
1719 enable_manager=false
1720 test "$do_manager" != "check" && \
1721 AC_MSG_ERROR([MinGW build, cannot enable daemon manager])
1722 elif test "x$cxx" = "x"
1724 enable_manager=false
1725 test "$do_manager" != "check" && \
1726 AC_MSG_ERROR([C++ compiler unavailable, cannot enable daemon manager])
1728 AC_MSG_CHECKING([compilation features for daemon manager])
1730 [ #ifndef _XOPEN_SOURCE
1731 #define _XOPEN_SOURCE 600
1736 enable_manager=false
1739 AC_SUBST(enable_manager)
1741 dnl Checks for library functions.
1745 AC_CHECK_FUNCS(mktime nanosleep usleep unsetenv)
1746 AC_CHECK_FUNCS(select socket gethostname getpeerucred getpeereid)
1747 AC_CHECK_FUNCS(uname syslog __clone pipe2 fcntl ioctl)
1748 AC_CHECK_FUNCS(prctl setlinebuf waitpid atexit kill)
1749 AC_CHECK_FUNCS(chown fchmod getcwd scandir mkstemp)
1750 AC_CHECK_FUNCS(brk sbrk posix_memalign memalign valloc)
1751 AC_CHECK_FUNCS(signal sighold sigrelse tcgetattr)
1752 AC_CHECK_FUNCS(regex regcmp regexec regcomp)
1753 AC_CHECK_FUNCS(strtod strtol strtoll strtoull strndup strchrnul)
1754 AC_CHECK_FUNCS(getuid getgid)
1755 AC_CHECK_FUNCS(getgrent getgrent_r getgrnam getgrnam_r getgrgid getgrgid_r)
1756 AC_CHECK_FUNCS(getpwent getpwent_r getpwnam getpwnam_r getpwuid getpwuid_r)
1757 AC_CHECK_FUNCS(sysinfo trace_back_stack backtrace)
1758 AC_CHECK_FUNCS(sendmsg recvmsg setns)
1760 dnl only define readdir64 on non-linux platforms that support it
1761 if test $target_os != linux -a $target_os != freebsd -a $target_os != kfreebsd -a $target_os != netbsd; then
1762 AC_CHECK_FUNCS(readdir64)
1765 dnl typedefs missing from sys/types.h, stdlib.h or stddef.h
1766 if test $target_os = solaris
1768 AC_CHECK_TYPE(__int32_t, int32_t)
1769 AC_CHECK_TYPE(__uint32_t, uint32_t)
1770 AC_CHECK_TYPE(__int64_t, int64_t)
1771 AC_CHECK_TYPE(__uint64_t, uint64_t)
1772 AC_CHECK_TYPE(uint_t, u_int32_t)
1774 AC_CHECK_TYPE(__int32_t, int)
1775 AC_CHECK_TYPE(__uint32_t, unsigned int)
1776 AC_CHECK_TYPE(__int64_t, long long)
1777 AC_CHECK_TYPE(__uint64_t, unsigned long long)
1778 AC_CHECK_TYPE(uint_t, unsigned int)
1781 dnl check if we have a type for the pointer's size integer (__psint_t)
1782 AC_MSG_CHECKING([for __psint_t ])
1785 #include <sys/types.h>
1788 ], [ __psint_t psint; ],
1789 AC_DEFINE(HAVE___PSINT_T, [1], [__psint_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1791 dnl check if we have a type for pointer difference (ptrdiff_t)
1792 AC_MSG_CHECKING([for ptrdiff_t ])
1795 #ifdef HAVE_MALLOC_H
1798 ], [ ptrdiff_t ptrdiff; ],
1799 AC_DEFINE(HAVE_PTRDIFF_T, [1], [ptrdiff_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1801 dnl check if we have types for uid_t, gid_t (POSIX) or SID (Win32)
1802 AC_MSG_CHECKING([for uid_t ])
1804 #include <sys/types.h>
1809 AC_DEFINE(HAVE_UID_T, [1], [uid_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1810 AC_MSG_CHECKING([for gid_t ])
1812 #include <sys/types.h>
1817 AC_DEFINE(HAVE_GID_T, [1], [gid_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1818 AC_MSG_CHECKING([for SID ])
1820 #ifdef HAVE_WINDOWS_H
1821 #include <windows.h>
1824 AC_DEFINE(HAVE_SID, [1], [sid type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1826 dnl check if we have a type for socklen_t
1827 AC_MSG_CHECKING([for socklen_t ])
1829 #include <sys/types.h>
1830 #ifdef HAVE_SYS_SOCKET_H
1831 #include <sys/socket.h>
1833 ], [ socklen_t len; ],
1834 AC_DEFINE(HAVE_SOCKLEN_T, [1], [socklen_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1836 dnl check if LL suffix on constants is supported
1839 ], [ long long x = 0LL; ],
1840 AC_DEFINE(HAVE_CONST_LONGLONG, [1], [LL suffix on constants]))
1842 dnl check if _environ is declared globally
1846 ], [ char **x = _environ; ],
1847 AC_DEFINE(HAVE_UNDERBAR_ENVIRON, [1], [_environ declared globally]))
1849 dnl check for PR_TERMCHILD and PR_SET_PDEATHSIG in <sys/prctl.h>
1850 AC_MSG_CHECKING([for PR_TERMCHILD constant in sys/prctl.h])
1852 #ifdef HAVE_SYS_PRCTL_H
1853 #include <sys/prctl.h>
1855 ], [ int i = PR_TERMCHILD; ],
1856 AC_DEFINE(HAVE_PR_TERMCHILD, [1], [PR_TERMCHILD constant]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1858 AC_MSG_CHECKING([for PR_SET_PDEATHSIG constant in sys/prctl.h])
1860 #ifdef HAVE_SYS_PRCTL_H
1861 #include <sys/prctl.h>
1863 ], [ int i = PR_SET_PDEATHSIG; ],
1864 AC_DEFINE(HAVE_PR_SET_PDEATHSIG, [1], [PR_SET_PDEATHSIG constant]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1866 AC_HEADER_TIOCGWINSZ
1868 dnl check if linker needs -rdynamic for dynamically loaded shared
1869 dnl libraries to see the symbols in the process loading them.
1870 dnl This is e.g., needed on linux for pmcd loading pmda_pmcd.so.
1871 AC_MSG_CHECKING([if linker supports -rdynamic])
1872 save_CFLAGS="$CFLAGS"
1874 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1875 [AC_MSG_RESULT([yes])
1876 rdynamic_flag=-rdynamic],
1877 [AC_MSG_RESULT([no])
1880 CFLAGS="$save_CFLAGS"
1881 AC_SUBST([rdynamic_flag])
1884 dnl check if argument to user's select() method in scandir call is const
1885 AC_MSG_CHECKING([whether const arg for scandir() select method])
1886 cat <<End-of-File >conftest.c
1891 my_select(const struct dirent *foo) { return 0; }
1892 int main() { struct dirent **list; return scandir(".", &list, my_select, NULL); }
1894 (eval $ac_compile) 2>conftest.out
1895 cat conftest.out >&5
1896 if test -s conftest.out
1900 AC_DEFINE(HAVE_CONST_DIRENT, [1], [const arg for scandir() select method])
1905 dnl check if struct dirent has a d_off (directory offset) field
1906 AC_MSG_CHECKING([whether struct dirent has a d_off field])
1907 cat <<End-of-File >conftest.c
1911 int main() { struct dirent d; d.d_off = 0; }
1913 (eval $ac_compile) 2>conftest.out
1914 cat conftest.out >&5
1915 if test -s conftest.out
1919 AC_DEFINE(HAVE_DIRENT_D_OFF, [1], [struct dirent d_off field])
1924 dnl check if printf %p has 0x prefix
1925 AC_MSG_CHECKING([if printf %p produces 0x prefix])
1926 if test "$cross_compiling" = "yes"; then
1927 ans=$printf_p_prefix
1928 echo "cross-compile -> \"$ans\"" >&5
1930 cat <<End-of-File >conftest.c
1932 int main(int argc, char **argv) { printf("%p", argv); return(0); }
1934 (eval $ac_compile) 2>&5
1935 (eval $ac_link) 2>&5
1937 echo "./conftest -> \"$ans\"" >&5
1942 AC_DEFINE(HAVE_PRINTF_P_PFX, [1], [printf %p produces 0x])
1949 rm -rf conftest conftest.*
1953 # need to deal with this sort of cpp output ...
1954 # typedef long pid_t;
1955 # typedef unsigned int pid_t;
1956 # typedef unsigned int pid_t __attribute__ ((__mode__ (__SI__)));
1957 # __extension__ typedef int pid_t;
1964 # and chaining of the form
1965 # typedef long __pid_t;
1966 # typedef __pid_t pid_t;
1968 _raw=`$CPP conftest.c \
1970 -e 's/[[ ]]__attribute__ ((.*));/;/' \
1971 -e 's/__extension__[[ ]][[ ]]*//' \
1973 /bozo/ { print; next }
1974 $1 == "typedef" { printf "%s",$0
1980 if ($0 ~ /{/) depth = 1
1983 wantsemi == 1 { printf " %s",$0
1984 if ($0 ~ /{/) depth++
1986 if ($0 ~ /}/) depth--
2000 $1 == "typedef" { map[[$NF]] = ""
2001 for (i = 2; i < NF; i++) {
2005 map[[$NF]] = map[[$NF]] " " $i
2007 print $NF " -> " map[[$NF]] >"conftest.debug"
2010 $2 == "bozo" { t = $1
2011 printf "best guess: %s",t >"conftest.debug"
2012 while (map[[t]] != "") {
2014 printf " -> %s",t >"conftest.debug"
2016 print "" >"conftest.debug"
2025 unsigned|'unsigned int')
2031 'long long'|'long long int')
2032 if test $target_os = mingw; then
2038 'unsigned long'|'unsigned long int'|'long unsigned int')
2041 'unsigned long long'|'unsigned long long int')
2042 if test $target_os = mingw; then
2048 *\*) # pointer to a something
2051 struct\ *) # not much can be done here ...
2056 echo "FATAL ERROR: don't know what to do with type \"$_raw\""
2057 echo "... typedef mapping ..."
2059 rm -rf conftest conftest.*
2065 dnl printf type for pid_t
2066 AC_MSG_CHECKING([printf type for pid_t])
2067 if test "$cross_compiling" = "yes"; then
2069 echo "cross-compile -> \"$ans\"" >&5
2072 cat <<End-of-File >conftest.c
2073 #include <sys/types.h>
2080 AC_MSG_RESULT($fmt_pid)
2082 rm -rf conftest.c conftest.debug
2084 dnl printf type for int64_t
2085 AC_MSG_CHECKING([printf type for int64_t ])
2086 if test "$cross_compiling" = "yes"; then
2087 ans=$printf_fmt_int64
2088 echo "cross-compile -> \"$ans\"" >&5
2090 cat <<End-of-File >conftest.c
2093 #include <inttypes.h>
2096 printf("\"%s\"\n", __PRI64_PREFIX "d");
2101 (eval $ac_link) 2>&5
2102 if test -x ./conftest
2105 echo "./conftest -> \"$ans\"" >&5
2109 dnl have to try the hardway ...
2110 cat <<End-of-File >conftest.c
2117 int64_t bozo = 0x12345678abcdLL;
2118 sprintf(buf, "%lx", bozo);
2119 if (strcmp(buf, "12345678abcd") == 0)
2122 sprintf(buf, "%llx", bozo);
2123 if (strcmp(buf, "12345678abcd") == 0)
2124 printf("\"lld\"\n");
2129 (eval $ac_link) 2>&5
2130 if test -x ./conftest
2133 echo "./conftest -> \"$ans\"" >&5
2139 echo 'FATAL ERROR: Cannot determine printf format for int64_t type'
2140 rm -rf conftest conftest.*
2144 AC_MSG_RESULT("$fmt_int64")
2146 rm -rf conftest.* conftest
2148 AC_MSG_CHECKING([strtol or strtoll for int64_t])
2149 if test "$cross_compiling" = "yes"; then
2151 echo "cross-compile -> \"$ans\"" >&5
2153 cat <<End-of-File >conftest.c
2158 long long int value = -1;
2159 value = strtol("1234567812345678", NULL, 16);
2160 if (value == 0x1234567812345678LL) {
2161 printf("strotol\n");
2164 value = strtoll("1234567812345678", NULL, 16);
2165 if (value == 0x1234567812345678LL) {
2166 printf("strtoll\n");
2172 (eval $ac_compile) 2>&5
2173 (eval $ac_link) 2>&5
2175 echo "./conftest -> \"$ans\"" >&5
2180 AC_DEFINE(strtoint64, strtol)
2181 AC_DEFINE(strtouint64, strtoul)
2182 AC_MSG_RESULT([strtol])
2185 AC_DEFINE(strtoint64, strtoll)
2186 AC_DEFINE(strtouint64, strtoull)
2187 AC_MSG_RESULT([strtoll])
2190 AC_DEFINE(strtoint64, strtoll)
2191 AC_DEFINE(strtouint64, strtoull)
2192 AC_MSG_RESULT([assuming strtoll])
2195 rm -rf conftest conftest.*
2197 if test "$do_threads" = "check" -o "$do_threads" = "yes"
2203 if test "$do_threads" = "yes"
2205 AC_MSG_ERROR([cannot enable multi-threaded mode - no pthread.h])
2209 dnl Check if pthread_mutex_t is defined in pthread.h
2210 dnl Ignore the fact that pthread.h could be missing - we don't
2211 dnl really care if this test fails because of missing pthread_mutex_t
2212 dnl or because of missing headers.
2213 AC_MSG_CHECKING([for pthread_mutex_t in pthread.h])
2215 [#include <pthread.h>], [pthread_mutex_t mymutex;],
2216 AC_DEFINE(HAVE_PTHREAD_MUTEX_T, [1], [pthread_mutex_t type]) AC_MSG_RESULT(yes),
2218 if test "$do_threads" = "yes"
2220 AC_MSG_ERROR([cannot enable multi-threaded mode - no mutexes])
2226 dnl Check which library provide pthread stuff
2227 AC_MSG_CHECKING([where pthread_create() is defined])
2228 for cand in "" pthreads pthread ; do
2232 LIBS=`echo $LIBS -l$cand`
2236 #include <pthread.h>
2239 pthread_create(NULL, NULL, NULL, NULL);
2240 ], AC_MSG_RESULT(lib${cand:-c})
2243 lib_for_pthreads="$cand"
2245 lib_for_pthreads="-l$cand"
2251 AC_SUBST(lib_for_pthreads)
2253 if test "$ac_cv_header_pthread_h" = "yes"
2255 dnl printf type for pthread_t
2256 AC_MSG_CHECKING([printf type for pthread_t])
2257 cat <<End-of-File >conftest.c
2258 #include <pthread.h>
2263 AC_MSG_RESULT($fmt_pthread)
2264 AC_SUBST(fmt_pthread)
2265 rm -rf conftest.c conftest.debug
2267 dnl check if gcc supports __thread for thread private data
2268 AC_MSG_CHECKING([if compiler supports __thread])
2269 dnl __thread support is broken in some places
2270 if test $target_os = netbsd
2272 AC_TRY_COMPILE([#include <pthread.h>
2273 #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 5 )
2278 AC_DEFINE(HAVE___THREAD, [1], [__thread private data]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2280 AC_TRY_COMPILE([#include <pthread.h>
2281 __thread int x;], [],
2282 AC_DEFINE(HAVE___THREAD, [1], [__thread private data]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2285 dnl Check if pthread_barrier_t is defined in pthread.h
2286 AC_MSG_CHECKING([for pthread_barrier_t in pthread.h])
2287 AC_TRY_COMPILE([#include <pthread.h>], [pthread_barrier_t mybarrier;],
2288 AC_DEFINE(HAVE_PTHREAD_BARRIER_T, [1], [pthread_barrier_t type]) AC_MSG_RESULT(yes),
2293 dnl check sizeof long
2294 AC_MSG_CHECKING([sizeof long])
2295 if test "$cross_compiling" = "yes"; then
2297 echo "cross-compile -> \"$ans\"" >&5
2299 cat <<End-of-File >conftest.c
2301 main() { printf("%d", (int)sizeof(long)); }
2303 (eval $ac_compile) 2>&5
2304 (eval $ac_link) 2>&5
2306 echo "./conftest -> \"$ans\"" >&5
2309 if test "$ans" = 4; then
2310 AC_DEFINE(HAVE_32BIT_LONG, [1], [sizeof long])
2311 elif test "$ans" = 8; then
2312 AC_DEFINE(HAVE_64BIT_LONG, [1], [sizeof long])
2315 echo "FATAL ERROR: size of long is not 32 or 64 bits, cannot proceed."
2316 echo "sizeof(char *) -> $ans"
2317 rm -rf conftest conftest.*
2320 rm -rf conftest conftest.*
2322 dnl check sizeof pointer
2323 AC_MSG_CHECKING([sizeof pointer])
2324 if test "$cross_compiling" = "yes"; then
2326 echo "cross-compile -> \"$ans\"" >&5
2328 cat <<End-of-File >conftest.c
2330 main() { printf("%d", (int)sizeof(char *)); }
2332 (eval $ac_compile) 2>&5
2333 (eval $ac_link) 2>&5
2335 echo "./conftest -> \"$ans\"" >&5
2338 if test "$ans" = 4; then
2339 AC_DEFINE(HAVE_32BIT_PTR, [1], [pointer size])
2341 elif test "$ans" = 8; then
2342 AC_DEFINE(HAVE_64BIT_PTR, [1], [pointer size])
2346 echo "FATAL ERROR: size of pointer is not 32 or 64 bits, cannot proceed."
2347 echo "sizeof(char *) -> $ans"
2348 rm -rf conftest conftest.*
2351 rm -rf conftest conftest.*
2353 dnl check sizeof int. If not 32, we die
2354 AC_MSG_CHECKING([sizeof int])
2355 if test "$cross_compiling" = "yes"; then
2357 echo "cross-compile -> \"$ans\"" >&5
2359 cat <<End-of-File >conftest.c
2361 main() { printf("%d", (int)sizeof(int)); }
2363 (eval $ac_compile) 2>&5
2364 (eval $ac_link) 2>&5
2366 echo "./conftest -> \"$ans\"" >&5
2372 echo "FATAL ERROR: sizeof(int) is not 32 bits, cannot proceed."
2373 echo "Note: 32-bit ints are assumed in the PCP external file formats and"
2374 echo " the over-the-wire PDU formats"
2375 rm -rf conftest conftest.*
2378 rm -rf conftest conftest.*
2380 dnl check bit field allocation order within a word
2381 AC_MSG_CHECKING([if bit fields allocated left-to-right])
2382 if test "$cross_compiling" = "yes"; then
2383 ans=$bit_field_scheme
2384 echo "cross-compile -> \"$ans\"" >&5
2386 cat <<End-of-File >conftest.c
2387 union { struct { unsigned int b:4; unsigned int c:4; } a; int p; } u;
2388 main() { u.a.b = 1; u.a.c = 2; printf("%0*x", 2*sizeof(int), u.p); }
2390 (eval $ac_compile) 2>&5
2391 (eval $ac_link) 2>&5
2393 echo "./conftest -> \"$ans\"" >&5
2398 # left-to-right starting from MSB (SGI cc on MIPS), or
2399 # left-to-right ending at LSB
2400 AC_DEFINE(HAVE_BITFIELDS_LTOR, [1], [left-to-right bitfield ordering])
2404 # right-to-left ending at MSB, or
2405 # right-to-left starting from LSB (gcc in Intel)
2409 AC_MSG_RESULT(unknown)
2410 echo "FATAL ERROR: could not fathom your compiler's bit field allocation scheme"
2411 rm -f conftest conftest.*
2415 rm -rf conftest conftest.*
2417 dnl check if compiler can cast __uint64_t to double
2425 double y = (double)x;
2426 ], AC_DEFINE(HAVE_CAST_U64_DOUBLE, [1], [compiler casts u64 to double]))
2428 dnl check if basename and dirname need -lgen, -lpcp or nothing to work
2429 dnl (assume both go together)
2430 AC_CHECK_FUNCS(basename)
2431 if test $ac_cv_func_basename = yes
2433 AC_DEFINE(HAVE_BASENAME, [1], [basename API])
2434 AC_DEFINE(HAVE_DIRNAME, [1], [dirname API])
2437 AC_CHECK_LIB(gen, basename)
2438 if test $ac_cv_lib_gen_basename = yes
2440 AC_DEFINE(HAVE_BASENAME, [1], [basename API])
2441 AC_DEFINE(HAVE_DIRNAME, [1], [dirname API])
2442 lib_for_basename="-lgen"
2444 lib_for_basename="-lpcp"
2447 AC_SUBST(lib_for_basename)
2449 dnl check if clock_gettime needs -lrt to work
2450 lib_for_clock_gettime=
2451 AC_CHECK_FUNCS(clock_gettime)
2452 if test $ac_cv_func_clock_gettime = no
2454 AC_CHECK_LIB(rt, clock_gettime)
2455 if test $ac_cv_lib_rt_clock_gettime = yes
2457 AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [clock_gettime API])
2461 AC_SUBST(lib_for_rt)
2463 dnl check if dlopen et al need -ldl to work
2465 AC_CHECK_FUNCS(dlopen)
2466 if test $ac_cv_func_dlopen = no
2468 AC_CHECK_LIB(dl, dlopen)
2469 if test $ac_cv_lib_dl_dlopen = yes
2471 AC_DEFINE(HAVE_DLOPEN, [1], [dlopen API])
2475 AC_SUBST(lib_for_dlopen)
2477 dnl check if flog10, pow, fpclassify and isnanf are available
2478 dnl in the maths library
2480 AC_CHECK_FUNCS(flog10)
2481 if test $ac_cv_func_flog10 = no
2483 AC_CHECK_LIB(m, flog10)
2484 if test $ac_cv_lib_m_flog10 = yes
2486 AC_DEFINE(HAVE_FLOG10, [1], [flog10 math API])
2490 AC_DEFINE(HAVE_FLOG10, [1], [flog10 math API])
2493 if test $ac_cv_func_pow = no
2495 AC_CHECK_LIB(m, pow)
2496 if test $ac_cv_lib_m_pow = yes
2498 AC_DEFINE(HAVE_POW, [1], [pow math API])
2502 AC_DEFINE(HAVE_POW, [1], [pow math API])
2504 AC_MSG_CHECKING([for fpclassify()])
2505 ac_cv_func_fpclassify=no
2512 if (fpclassify(x) == FP_NAN) exit(1);
2513 ], ac_cv_func_fpclassify=yes)
2514 AC_MSG_RESULT($ac_cv_func_fpclassify)
2515 if test $ac_cv_func_fpclassify = no
2518 AC_MSG_CHECKING([for fpclassify() with -lm])
2527 if (fpclassify(x) == FP_NAN) exit(1);
2528 ], ac_cv_func_fpclassify=yes)
2529 AC_MSG_RESULT($ac_cv_func_fpclassify)
2530 if test $ac_cv_func_fpclassify = yes
2536 if test $ac_cv_func_fpclassify = yes
2538 AC_DEFINE(HAVE_FPCLASSIFY, [1], [fpclassify math API])
2540 dnl prefer fpclassify() but will take isnan() and isnanf() as
2541 dnl possible alternates
2542 AC_CHECK_FUNCS(isnan)
2543 if test $ac_cv_func_isnan = no
2545 AC_CHECK_LIB(m, isnan)
2546 if test $ac_cv_lib_m_isnan = yes
2548 AC_DEFINE(HAVE_ISNAN, [1], [isnan math API])
2552 AC_CHECK_FUNCS(isnanf)
2553 if test $ac_cv_func_isnanf = no
2555 AC_CHECK_LIB(m, isnanf)
2556 if test $ac_cv_lib_m_isnanf = yes
2558 AC_DEFINE(HAVE_ISNANF, [1], [isnanf math API])
2563 AC_SUBST(lib_for_math)
2565 dnl check if we have the SIG_PF typedef
2566 AC_TRY_LINK([#include <signal.h>], [SIG_PF x;],
2567 AC_DEFINE(HAVE_SIGPF, [1], [SIG_PF typedef]))
2569 dnl check if we have the SA_SIGINFO #define
2570 AC_TRY_LINK([#include <signal.h>], [int x = SA_SIGINFO;],
2571 AC_DEFINE(HAVE_SA_SIGINFO, [1], [SA_SIGINFO macro]))
2573 dnl check if we support the SIGPIPE signal
2574 AC_TRY_LINK([#include <signal.h>], [int x = SIGPIPE;],
2575 AC_DEFINE(HAVE_SIGPIPE, [1], [SIGPIPE signal]))
2577 dnl check if we support the SIGHUP signal
2578 AC_TRY_LINK([#include <signal.h>], [int x = SIGHUP;],
2579 AC_DEFINE(HAVE_SIGHUP, [1], [SIGHUP signal]))
2581 dnl check if we support the SIGBUS signal
2582 AC_TRY_LINK([#include <signal.h>], [int x = SIGBUS;],
2583 AC_DEFINE(HAVE_SIGBUS, [1], [SIGBUS signal]))
2585 dnl check if we need to explicitly include signal.h
2586 AC_TRY_LINK([#include <sys/wait.h>],
2587 [ typedef void (*SIGRET)(int);
2589 ], AC_DEFINE(HAVE_WAIT_INCLUDES_SIGNAL, [1], [indirect signal.h]))
2591 dnl check for name and type of time fields in struct stat
2592 dnl IRIX example timespec_t st_mtim;
2593 dnl Linux example struct timespec st_mtim;
2594 dnl Darwin example struct timespec st_mtimespec;
2595 dnl Solaris example timestruc_t st_mtim;
2596 dnl FreeBSD (6.1) struct timespec st_mtimespec;
2597 dnl struct timespec {
2602 have_stat_type=false
2603 have_stat_name=false
2604 if test $have_stat_name = false
2607 changequote(<<, >>)<<[ ]st_mtimespec>>changequote([, ]),
2608 sys/stat.h, [ have_stat_name=true;
2609 AC_DEFINE(HAVE_ST_MTIME_WITH_SPEC, [1], [st_mtimespec stat field]) ])
2611 if test $have_stat_name = false -a $target_os != darwin -a $target_os != linux -a $target_os != kfreebsd -a $target_os != netbsd
2614 changequote(<<, >>)<<[ ]st_mtime>>changequote([, ]),
2615 sys/stat.h, [ have_stat_name=true;
2616 AC_DEFINE(HAVE_ST_MTIME_WITH_E, [1], [st_mtime stat field]) ])
2618 if test $have_stat_type = false
2621 changequote(<<, >>)<<timestruc_t[ ][ ]*st_mtim>>changequote([, ]),
2622 sys/stat.h, [ have_stat_type=true;
2623 AC_DEFINE(HAVE_STAT_TIMESTRUC, [1], [timestruc_t type]) ])
2625 if test $have_stat_type = false
2628 changequote(<<, >>)<<timespec_t[ ][ ]*st_mtim>>changequote([, ]),
2629 sys/stat.h, [ have_stat_type=true;
2630 AC_DEFINE(HAVE_STAT_TIMESPEC_T, [1], [timespec_t type]) ])
2632 if test $have_stat_type = false
2635 changequote(<<, >>)<<timespec[ ][ ]*st_mtim>>changequote([, ]),
2636 sys/stat.h, [ have_stat_type=true;
2637 AC_DEFINE(HAVE_STAT_TIMESPEC, [1], [timespec type]) ])
2639 if test $have_stat_type = false
2642 changequote(<<, >>)<<time_t[ ][ ]*st_mtim>>changequote([, ]),
2643 sys/stat.h, [ have_stat_type=true;
2644 AC_DEFINE(HAVE_STAT_TIME_T, [1], [time_t type]) ])
2646 if test $have_stat_type = false
2648 echo 'FATAL ERROR: Cannot determine struct stat time types.'
2649 rm -rf conftest conftest.*
2654 dnl Work out where to install stuff for this package
2655 dnl (and where to find stuff at run-time for add-on packages).
2659 dnl Predictable directory containing pcp.conf, or overridden
2660 dnl by the $PCP_CONF environment variable. If this is not set
2661 dnl (default /etc/pcp.conf), then $PCP_CONF must be set in
2662 dnl the environment.
2664 dnl The eval echo stuff is used to get around unfavourable
2665 dnl elements of the GNU standards, which cause embedding of
2666 dnl ${prefix} within many of these various $dirs.
2667 dnl http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables
2669 pcp_etc_dir=`eval echo $sysconfdir`
2670 pcp_etc_dir=`eval echo $pcp_etc_dir`
2671 AC_SUBST(pcp_etc_dir)
2672 pcp_saslconf_dir=`eval echo $sysconfdir/sasl2`
2673 pcp_saslconf_dir=`eval echo $pcp_saslconf_dir`
2674 AC_SUBST(pcp_saslconf_dir)
2675 pcp_sysconf_dir=`eval echo $sysconfdir/pcp`
2676 pcp_sysconf_dir=`eval echo $pcp_sysconf_dir`
2677 AC_SUBST(pcp_sysconf_dir)
2678 pcp_pmcdconf_path=$pcp_sysconf_dir/pmcd/pmcd.conf
2679 pcp_pmcdrclocal_path=$pcp_sysconf_dir/pmcd/rc.local
2680 pcp_pmcdoptions_path=$pcp_sysconf_dir/pmcd/pmcd.options
2681 pcp_pmwebdoptions_path=$pcp_sysconf_dir/pmwebd/pmwebd.options
2682 pcp_pmmgroptions_path=$pcp_sysconf_dir/pmmgr/pmmgr.options
2683 pcp_pmproxyoptions_path=$pcp_sysconf_dir/pmproxy/pmproxy.options
2684 pcp_pmiecontrol_path=$pcp_sysconf_dir/pmie/control
2685 pcp_pmsnapcontrol_path=$pcp_sysconf_dir/pmsnap/control
2686 pcp_pmloggercontrol_path=$pcp_sysconf_dir/pmlogger/control
2687 AC_SUBST(pcp_pmcdconf_path)
2688 AC_SUBST(pcp_pmcdoptions_path)
2689 AC_SUBST(pcp_pmcdrclocal_path)
2690 AC_SUBST(pcp_pmwebdoptions_path)
2691 AC_SUBST(pcp_pmmgroptions_path)
2692 AC_SUBST(pcp_pmproxyoptions_path)
2693 AC_SUBST(pcp_pmiecontrol_path)
2694 AC_SUBST(pcp_pmsnapcontrol_path)
2695 AC_SUBST(pcp_pmloggercontrol_path)
2697 dnl shared PCP files (shareable for diskless)
2698 pcp_share_dir=`eval echo $datarootdir/pcp`
2699 pcp_share_dir=`eval echo $pcp_share_dir`
2700 AC_SUBST(pcp_share_dir)
2702 dnl private PCP executables
2703 pcp_binadm_dir=`eval echo $libexecdir/pcp/bin`
2704 pcp_binadm_dir=`eval echo $pcp_binadm_dir`
2705 AC_SUBST(pcp_binadm_dir)
2707 dnl non-shared (i.e. system local) PCP files
2708 pcp_var_dir=`eval echo $localstatedir/lib/pcp`
2709 pcp_var_dir=`eval echo $pcp_var_dir`
2710 AC_SUBST(pcp_var_dir)
2712 dnl pmcd control and options files
2713 AC_ARG_WITH(configdir,[AC_HELP_STRING([--with-configdir],[configuration directory [LOCALSTATEDIR/pcp/config]])],
2714 [pcp_config_dir=$withval],
2715 [pcp_config_dir=$pcp_var_dir/config])
2717 pcp_pmdas_dir=$pcp_var_dir/pmdas
2718 AC_SUBST(pcp_pmdas_dir)
2720 dnl runtime shared libraries
2721 pcp_lib_dir=`eval echo $libdir`
2722 pcp_lib_dir=`eval echo $pcp_lib_dir`
2723 pcp_lib32_dir=`echo $pcp_lib_dir | sed -e s,64,, -e s,//,/,`
2724 AC_SUBST(pcp_lib_dir)
2725 AC_SUBST(pcp_lib32_dir)
2728 AC_ARG_WITH(perl_installdirs,[AC_HELP_STRING([--with-perl_installdirs],[perl installdirs [vendor]])],
2729 [perl_installdirs=$withval],
2730 [perl_installdirs=vendor])
2731 perl_installdirs=`eval echo $perl_installdirs`
2732 perl_installdirs=`eval echo $perl_installdirs`
2733 AC_SUBST(perl_installdirs)
2734 AC_ARG_WITH(perl_install_base,[AC_HELP_STRING([--with-perl_install_base],[perl install_base [PREFIX]])],
2735 [perl_install_base=$withval],
2736 [perl_install_base=$prefix])
2737 perl_install_base=`eval echo $perl_install_base`
2738 perl_install_base=`eval echo $perl_install_base`
2739 AC_SUBST(perl_install_base)
2741 AC_ARG_WITH(python_prefix,[AC_HELP_STRING([--with-python_prefix],[python setup.py prefix [PREFIX]])],
2742 [python_prefix=$withval],
2743 [python_prefix=$prefix])
2744 python_prefix=`eval echo $python_prefix`
2745 python_prefix=`eval echo $python_prefix`
2746 AC_SUBST(python_prefix)
2749 pcp_x11_incflags=$X_CFLAGS
2750 AC_SUBST(pcp_x11_incflags)
2751 pcp_x11_libflags=$X_LIBS
2752 AC_SUBST(pcp_x11_libflags)
2753 pcp_x11_extra=$X_EXTRA_LIBS
2754 AC_SUBST(pcp_x11_extra)
2755 pcp_x11_pre=$X_PRE_LIBS
2756 AC_SUBST(pcp_x11_pre)
2758 dnl man pages (source)
2759 have_gzipped_manpages=false
2760 have_bzip2ed_manpages=false
2761 have_lzmaed_manpages=false
2762 have_xzed_manpages=false
2763 need_old_tbl_header=false
2765 pcp_man_dir=`eval echo $mandir`
2766 pcp_man_dir=`eval echo $pcp_man_dir`
2768 dnl guess compression in use
2769 for d in /usr/man /usr/share/man $pcp_man_dir
2771 for sd in man1 sman1
2773 if test -f $d/$sd/man.1.gz
2775 have_gzipped_manpages=true
2776 man_header=`$ZIP -d < $d/$sd/man.1.gz | head -1`
2778 elif test -f $d/$sd/man.1.bz2
2780 have_bzip2ed_manpages=true
2781 man_header=`$BZIP2 -d < $d/$sd/man.1.bz2 | head -1`
2783 elif test -f $d/$sd/man.1.lzma
2785 have_lzmaed_manpages=true
2786 man_header=`$LZMA -d < $d/$sd/man.1.lzma | head -1`
2788 elif test -f $d/$sd/man.1.xz
2790 have_xzed_manpages=true
2791 man_header=`$XZ -d < $d/$sd/man.1.xz | head -1`
2793 elif test -f $d/$sd/man.1
2795 man_header=`head -1 $d/$sd/man.1`
2800 if test x"$man_header" = "x'\\\" t" -o x"$man_header" = "x'\\\" te" ; then
2801 need_old_tbl_header=true
2803 AC_SUBST(pcp_man_dir)
2804 AC_SUBST(have_gzipped_manpages)
2805 AC_SUBST(have_bzip2ed_manpages)
2806 AC_SUBST(have_lzmaed_manpages)
2807 AC_SUBST(have_xzed_manpages)
2808 AC_SUBST(need_old_tbl_header)
2811 pcp_bin_dir=`eval echo $bindir`
2812 pcp_bin_dir=`eval echo $pcp_bin_dir`
2813 AC_SUBST(pcp_bin_dir)
2815 pcp_sbin_dir=`eval echo $sbindir`
2816 pcp_sbin_dir=`eval echo $pcp_sbin_dir`
2817 AC_SUBST(pcp_sbin_dir)
2820 pcp_inc_dir=`eval echo $includedir/pcp`
2821 pcp_inc_dir=`eval echo $pcp_inc_dir`
2822 AC_SUBST(pcp_inc_dir)
2824 dnl books - pdfs, html
2825 if test $target_os = linux; then
2826 pcp_books_dir=`eval echo $datarootdir/doc/pcp-doc`
2828 pcp_books_dir=`eval echo $datarootdir/doc/pcp`
2830 pcp_books_dir=`eval echo $pcp_books_dir`
2831 pcp_html_dir=`eval echo $pcp_books_dir/html`
2832 AC_SUBST(pcp_books_dir)
2833 AC_SUBST(pcp_html_dir)
2835 dnl icon pixmap files
2836 if test $target_os = linux; then
2837 pcp_icons_dir=`eval echo $datarootdir/pcp-gui/pixmaps`
2839 pcp_icons_dir=`eval echo $datarootdir/pcp/pixmaps`
2841 pcp_icons_dir=`eval echo $pcp_icons_dir`
2842 AC_SUBST(pcp_icons_dir)
2844 dnl desktop application entries
2845 pcp_desktop_dir=`eval echo $datarootdir/applications`
2846 pcp_desktop_dir=`eval echo $pcp_desktop_dir`
2847 AC_SUBST(pcp_desktop_dir)
2849 dnl rc/startup files
2850 AC_ARG_WITH(rcdir,[AC_HELP_STRING([--with-rcdir],[rc directory [SYSCONFDIR/rc.d]])],
2851 [pcp_rc_dir=$withval], [
2854 pcp_rc_dir="$pcp_share_dir/lib"
2856 pcp_rc_dir="$pcp_etc_dir/init.d"
2858 AC_SUBST(pcp_rc_dir)
2860 dnl rc sysconfig dir
2861 AC_ARG_WITH(sysconfigdir,[AC_HELP_STRING([--with-sysconfigdir],[sysconfig directory [SYSCONFDIR/sysconfig]])],
2862 [pcp_sysconfig_dir=$withval],
2863 [pcp_sysconfig_dir=$pcp_etc_dir/sysconfig])
2864 AC_SUBST(pcp_sysconfig_dir)
2867 AC_ARG_WITH(logdir,[AC_HELP_STRING([--with-logdir],[log directory [LOCALSTATEDIR/log/pcp]])],
2868 [pcp_log_dir=$withval],
2869 [pcp_log_dir=$localstatedir/log/pcp])
2870 pcp_log_dir=`eval echo $pcp_log_dir`
2871 pcp_log_dir=`eval echo $pcp_log_dir`
2872 AC_SUBST(pcp_log_dir)
2874 AC_ARG_WITH(rundir,[AC_HELP_STRING([--with-rundir],[run directory [LOCALSTATEDIR/run/pcp]])],
2875 [pcp_run_dir=$withval],
2876 [pcp_run_dir=$localstatedir/run/pcp])
2877 pcp_run_dir=`eval echo $pcp_run_dir`
2878 pcp_run_dir=`eval echo $pcp_run_dir`
2879 AC_SUBST(pcp_run_dir)
2881 dnl world-writeable temporary files directory
2882 AC_ARG_WITH(tmpdir,[AC_HELP_STRING([--with-tmpdir],[tmp directory [LOCALSTATEDIR/tmp]])],
2883 [pcp_tmpfile_dir=$withval],
2884 [pcp_tmpfile_dir=$localstatedir/tmp])
2885 pcp_tmpfile_dir=`eval echo $pcp_tmpfile_dir`
2886 pcp_tmpfile_dir=`eval echo $pcp_tmpfile_dir`
2887 AC_SUBST(pcp_tmpfile_dir)
2889 dnl non-world-writeable status files directory
2890 pcp_tmp_dir=`eval echo $pcp_var_dir/tmp`
2891 AC_SUBST(pcp_tmp_dir)
2894 AC_ARG_WITH(docdir,[AC_HELP_STRING([--with-docdir],[docs directory [DOCDIR/pcp-VERSION]])],
2895 [pcp_doc_dir=$withval],
2896 [PACKAGE=pcp-${PACKAGE_VERSION}; pcp_doc_dir=$docdir])
2897 pcp_doc_dir=`eval echo $pcp_doc_dir`
2898 pcp_doc_dir=`eval echo $pcp_doc_dir`
2899 AC_SUBST(pcp_doc_dir)
2902 AC_ARG_WITH(demosdir,[AC_HELP_STRING([--with-demosdir],[run directory [DATADIR/pcp/demos]])],
2903 [pcp_demos_dir=$withval],
2904 [pcp_demos_dir=$pcp_share_dir/demos])
2905 AC_SUBST(pcp_demos_dir)
2907 if test -z "$XCONFIRM"
2909 AC_PATH_PROG(ac_xconfirm_prog, xconfirm, $pcp_bin_dir/pmconfirm)
2911 ac_xconfirm_prog=$XCONFIRM
2913 AC_SUBST(ac_xconfirm_prog)
2915 dnl Check for FNDELAY defined in <fcntl.h>
2916 if test "$ac_cv_header_fcntl_h" = "yes"
2918 AC_MSG_CHECKING([for FNDELAY in fcntl.h])
2919 AC_TRY_COMPILE([#include <fcntl.h>],
2920 [ int i = FNDELAY; ],
2921 AC_DEFINE(HAVE_FNDELAY, [1], [FNDELAY macro])
2922 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2925 dnl check for zpool_vdev_name API style from <libzfs.h>
2926 if test "$ac_cv_header_libzfs_h" = "yes"
2928 AC_MSG_CHECKING([for 5-argument style zpool_vdev_name])
2929 AC_TRY_COMPILE([#include <libzfs.h>],
2930 [ libzfs_handle_t *zh;
2933 (void) zpool_vdev_name(zh, zp, np, B_FALSE, B_FALSE);
2935 AC_DEFINE(HAVE_ZPOOL_VDEV_NAME_5ARG, [1], [5-arg zpool_vdev_name])
2936 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2938 AC_MSG_CHECKING([for 4-argument style zpool_vdev_name])
2939 AC_TRY_COMPILE([#include <libzfs.h>],
2940 [ libzfs_handle_t *zh;
2943 (void) zpool_vdev_name(zh, zp, np, B_FALSE);
2945 AC_DEFINE(HAVE_ZPOOL_VDEV_NAME_4ARG, [1], [4-arg zpool_vdev_name])
2946 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2949 dnl Check for Network Security Services (NSS) and
2950 dnl Simple Authentication and Security Layer (SASL)
2951 if test "$do_secure" = "check" -o "$do_secure" = "yes"
2955 saved_CFLAGS="$CFLAGS"
2956 saved_CPPFLAGS="$CPPFLAGS"
2957 NSS_INC_DIRS="-I/usr/include/nss -I/usr/include/nss3"
2958 NSPR_INC_DIRS="-I/usr/include/nspr -I/usr/include/nspr4"
2959 CFLAGS="$CFLAGS $NSS_INC_DIRS $NSPR_INC_DIRS"
2960 CPPFLAGS="$CPPFLAGS $NSS_INC_DIRS $NSPR_INC_DIRS"
2962 AC_CHECK_HEADERS([nss/nss.h], [NSSCFLAGS=-I/usr/include/nss], [
2963 AC_CHECK_HEADERS([nss3/nss.h], [NSSCFLAGS=-I/usr/include/nss3], [
2965 if test "$do_secure" = "yes"
2967 AC_MSG_ERROR([cannot enable secure sockets mode - no NSS header])
2973 AC_CHECK_HEADERS([nspr/nspr.h], [NSPRCFLAGS=-I/usr/include/nspr], [
2974 AC_CHECK_HEADERS([nspr4/nspr.h], [NSPRCFLAGS=-I/usr/include/nspr4], [
2976 if test "$do_secure" = "yes"
2978 AC_MSG_ERROR([cannot enable secure sockets mode - no NSPR header])
2982 AC_SUBST(NSPRCFLAGS)
2984 AC_CHECK_HEADERS([sasl/sasl.h], [SASLCFLAGS=-I/usr/include/sasl], [
2986 if test "$do_secure" = "yes"
2988 AC_MSG_ERROR([cannot enable secure sockets mode - no SASL header])
2991 AC_SUBST(SASLCFLAGS)
2993 AC_CHECK_LIB(sasl2, sasl_server_init, [lib_for_sasl="-lsasl2"], [
2995 if test "$do_secure" = "yes"
2997 AC_MSG_ERROR([cannot enable secure sockets mode - no SASL library])
3000 AC_SUBST(lib_for_sasl)
3002 AC_CHECK_LIB(ssl, SSL_ImportFD, [lib_for_ssl="-lssl"], [
3003 AC_CHECK_LIB(ssl3, SSL_ImportFD, [lib_for_ssl="-lssl3"], [
3005 if test "$do_secure" = "yes"
3007 AC_MSG_ERROR([cannot enable secure sockets mode - no SSL library])
3011 AC_SUBST(lib_for_ssl)
3013 AC_CHECK_LIB(nss, NSS_Init, [lib_for_nss="-lnss"], [
3014 AC_CHECK_LIB(nss3, NSS_Init, [lib_for_nss="-lnss3"], [
3016 if test "$do_secure" = "yes"
3018 AC_MSG_ERROR([cannot enable secure sockets mode - no NSS library])
3022 AC_SUBST(lib_for_nss)
3024 AC_CHECK_LIB(nspr, PR_Init, [lib_for_nspr="-lnspr"], [
3025 AC_CHECK_LIB(nspr4, PR_Init, [lib_for_nspr="-lnspr4"], [
3027 if test "$do_secure" = "yes"
3029 AC_MSG_ERROR([cannot enable secure sockets mode - no NSPR library])
3033 AC_SUBST(lib_for_nspr)
3035 if test "$enable_secure" = "true"
3037 AC_DEFINE(HAVE_SECURE_SOCKETS, [1], [Encrypted sockets])
3039 AC_SUBST(enable_secure)
3041 CPPFLAGS="$saved_CPPFLAGS"
3042 CFLAGS="$saved_CFLAGS"
3045 dnl check for -latomic, needed for some -march=i386 builds with i686 c++ distro headers
3046 AC_CHECK_LIB(atomic, __atomic_fetch_add_4, [lib_for_atomic="-latomic"])
3047 AC_SUBST(lib_for_atomic)
3049 dnl check for array sessions
3050 if test -f /usr/include/sn/arsess.h
3052 pcp_mpi_dirs=libpcp_mpi\ libpcp_mpiread
3056 AC_SUBST(pcp_mpi_dirs)
3058 dnl check for Unix Domain socket family structure
3059 AC_MSG_CHECKING([for struct sockaddr_un in sys/un.h])
3061 #include <sys/types.h>
3062 #ifdef HAVE_SYS_SOCKET_H
3063 #include <sys/socket.h>
3065 #ifdef HAVE_SYS_UN_H
3068 ], [ struct sockaddr_un sa; sa.sun_family = AF_UNIX; ],
3069 AC_DEFINE(HAVE_STRUCT_SOCKADDR_UN, [1], [sockaddr_un type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3071 dnl check for Linux Unix Domain socket credential structure
3072 AC_MSG_CHECKING([for struct ucred in sys/socket.h])
3074 #include <sys/types.h>
3075 #ifdef HAVE_SYS_SOCKET_H
3076 #include <sys/socket.h>
3078 #ifdef HAVE_SYS_UN_H
3081 ], [ struct ucred ucred; ucred.uid = 0; ],
3082 AC_DEFINE(HAVE_STRUCT_UCRED, [1], [ucred type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3084 dnl check for struct timespec in <time.h>
3085 AC_MSG_CHECKING([for struct timespec in time.h])
3088 ], [ struct timespec foo; ],
3089 AC_DEFINE(HAVE_STRUCT_TIMESPEC, [1], [timespec type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3091 dnl check if we have IRIX style altzone
3092 AC_MSG_CHECKING([for altzone in time.h])
3095 ], [ time_t az = altzone; ],
3096 AC_DEFINE(HAVE_ALTZONE, [1], [altzone global]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3098 dnl If there is no altzone, check if strftime can handle %z
3099 AC_MSG_CHECKING([if strftime knows about %z])
3105 time_t t = time(NULL);
3106 struct tm * t1 = localtime (&t);
3107 if (strftime (b, 32, "%z", t1) < 3)
3109 if (strcmp(b, "%z") == 0)
3113 ], AC_DEFINE(HAVE_STRFTIME_z, [1], [strftime with %z]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
3115 dnl does strerror_r return char * a la GNU
3116 dnl (as opposed to the int return for XSI-compliant variants)
3117 AC_MSG_CHECKING([if strerror_r returns char *])
3119 [#include <string.h>], [strerror_r(0, NULL, 0)[0];],
3120 AC_DEFINE(HAVE_STRERROR_R_PTR, [1], [strerror_r return]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3122 dnl first check for readline on its own then with curses
3127 AC_CHECK_FUNC(readline,,
3129 AC_CHECK_LIB(readline, readline,,
3131 dnl AC seems to cache lib/func results
3132 dnl so use another readline func here
3133 AC_CHECK_LIB(readline, add_history,,,[-lcurses])
3136 if test $ac_cv_func_readline = yes
3138 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3139 elif test $ac_cv_lib_readline_readline = yes
3141 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3142 lib_for_readline=-lreadline
3143 elif test $ac_cv_lib_readline_add_history = yes
3145 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3146 lib_for_curses=-lcurses
3147 lib_for_readline=-lreadline
3149 AC_SUBST(lib_for_readline)
3150 AC_SUBST(lib_for_curses)
3154 PKG_CHECK_MODULES([zlib], [zlib >= 1.0.0], [have_zlib=true], [have_zlib=false])
3155 AC_SUBST(HAVE_ZLIB, [$have_zlib])
3157 dnl Check if we have AI_ADDRCONFIG
3158 AC_MSG_CHECKING([for AI_ADDRCONFIG])
3162 int test = AI_ADDRCONFIG;
3165 ], AC_DEFINE(HAVE_AI_ADDRCONFIG, [1], [AI_ADDRCONFIG macro]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3167 dnl Find external source tarballs for packaging
3170 if test -f ./build/tar/vector.tar.gz
3172 AC_MSG_NOTICE([adding Vector webapp to the build])
3175 AC_SUBST(have_vector)
3178 if test -f ./build/tar/webjs.tar.gz
3180 AC_MSG_NOTICE([adding webjs webapps to the build])
3183 AC_SUBST(have_webjs)
3185 dnl Capture special options passed to configure
3186 AC_SUBST(PACKAGE_CONFIGURE)
3193 dnl Build definitions for use in Makefiles
3194 src/include/builddefs
3195 dnl PCP paths and other defs
3196 src/include/pcp.conf
3197 dnl Linux Software Map entry
3199 dnl Preamble for deb install scripts
3200 debian/pcp.preinst.head
3201 debian/pcp.postinst.head
3202 dnl Preamble for tar install scripts
3203 build/tar/preinstall.head
3204 build/tar/postinstall.head
3205 dnl Build definitions for use in packaging
3207 build/mac/uninstall-pcp
3210 dnl verbose diagnostics
3212 dnl echo config.status: settings dump begin
3213 dnl grep '^S.".*=' config.status
3214 dnl echo config.status: settings dump end