2 dnl Copyright (c) 2012-2015 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"
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
315 echo "FATAL ERROR: need platform-specific customization for \"$target_os\""
316 rm -rf conftest conftest.*
319 AC_SUBST(pcp_platform_paths)
320 AC_SUBST(pcp_ps_all_flags)
322 dnl default C and C++ compiler optimization to -O2 -g
323 if test "$use_optimization" = no
325 optimization="-O0 -g"
327 optimization="-O2 -g"
329 AC_SUBST(optimization)
332 if test -z "$PKG_CONFIG"
335 echo "FATAL ERROR: did not find a pkg-config executable."
336 echo "You can either set \$PKG_CONFIG as the full path to pkg-config"
337 echo "in the environment, or install the pkgconfig package."
338 rm -rf conftest conftest.*
342 dnl check if user wants their own C compiler
344 AC_PROG_CC(suncc gcc cc)
345 if test $target_os = solaris
347 AC_PATH_PROG(CCPATH,$CC,$CC)
349 if test "$GCC" = "yes"
351 CFLAGS="$CFLAGS $CFLAGS_IF_GCC"
353 CFLAGS="$CFLAGS $CFLAGS_IF_SUNCC"
355 if test "$use_64bit" = "no"
359 AC_MSG_CHECKING([for 64 bit Solaris host])
364 CFLAGS="$CFLAGS -m64"
365 LDFLAGS="$LDFLAGS -m64"
380 dnl these become CFLAGS and LDFLAGS for the build
384 if echo "$CFLAGS" | grep 'D_FORTIFY_SOURCE' >/dev/null
386 dnl for cc use locally in configure (not exported via $PCFLAGS),
387 dnl add -O in case -D_FORTIFY_SOURCE has been added to CFLAGS above,
388 dnl as -D_FORTIFY_SOURCE requires -O but we've separated optimization
389 dnl flags out into $CFLAGS_OPT for our build infrastructure
393 dnl some versions of gcc (e.g. version 4.8.4 on Gentoo Hardened) have added
394 dnl a predefined for _FORTIFY_SOURCE but only when -O is specified ... so
395 dnl to be safe we have -U_FORTIFY_SOURCE before -D_FORTIFY_SOURCE=2 below
397 # Add some security-related gcc flags
398 if echo "$CFLAGS" | grep stack-protector >/dev/null
400 dnl already set, probably from the environment
404 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
405 AS_IF([test "x$cc_is_gcc" = xyes -a "x$enable_ssp" != xno ],[
406 save_CFLAGS="$CFLAGS"
407 CFLAGS="$CFLAGS -O -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
408 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
409 AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.])
410 PCFLAGS="$PCFLAGS -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"],[
411 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
412 CFLAGS="$save_CFLAGS"
419 # Check for even more security-related gcc/linker flags, useful for daemons
421 [AS_HELP_STRING([--disable-pie], [disable position-independent-executable])])
422 AS_IF([test "x$cc_is_gcc" = xyes -a "x$enable_pie" != xno],[
424 PIELDFLAGS='-pie -Wl,-z,relro -Wl,-z,now'
425 save_CFLAGS="$CFLAGS"
426 save_LDFLAGS="$LDFLAGS"
427 CFLAGS="$CFLAGS $PIECFLAGS"
428 LDFLAGS="$LDFLAGS $PIELDFLAGS"
429 AC_LINK_IFELSE([AC_LANG_SOURCE([void main () {}])], [
430 AC_MSG_NOTICE([Compiling with gcc pie et al.])
432 AC_MSG_NOTICE([Compiler does not support -pie et al.])
436 CFLAGS="$save_CFLAGS"
437 LDFLAGS="$save_LDFLAGS"
442 # Check for support for symbol hiding via gcc flags
443 AC_ARG_ENABLE([visibility],
444 [AS_HELP_STRING([--disable-visibility], [disable gcc symbol visibility])])
445 AS_IF([test "x$cc_is_gcc" = xyes -a "$enable_visibility" != no],[
446 INVISIBILITY="-fvisibility=hidden"
447 save_CFLAGS="$CFLAGS"
448 CFLAGS="$CFLAGS -c $INVISIBILITY"
449 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int visible () { return 0; }])], [
450 AC_MSG_NOTICE([Compiling DSO PMDAs with gcc -fvisibility=hidden])
452 AC_MSG_NOTICE([Compiler does not support -fvisibility.])
455 CFLAGS="$save_CFLAGS"
457 AC_SUBST(INVISIBILITY)
462 AC_MSG_CHECKING([for working C++ compiler])
465 [AC_LANG_PROGRAM([[#include <cstdio>]],
466 [[const char gday[] = "G'day, world\n";]])],
467 [AC_MSG_RESULT([yes])],
472 # Prevent shared libraries from being built for libpcp and other core libraries
473 AC_ARG_ENABLE([shared],
474 [AS_HELP_STRING([--disable-shared], [disable core shared libary generation])],
475 [PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --disable-shared=$withval"])
476 AC_SUBST(enable_shared)
478 dnl check if user wants their own lex, yacc
486 dnl extra check for lex and yacc as these are often not installed
487 AC_MSG_CHECKING([if yacc is executable])
488 binary=`echo $yacc | awk '{print $1}'`
489 binary=`which "$binary"`
492 AC_MSG_RESULT([ yes])
496 echo "FATAL ERROR: did not find a valid yacc executable."
497 echo "You can either set \$YACC as the full path to yacc"
498 echo "in the environment, or install a yacc/bison package."
499 rm -rf conftest conftest.*
502 AC_MSG_CHECKING([if lex is executable])
503 binary=`echo $lex | awk '{print $1}'`
504 binary=`which "$binary"`
507 AC_MSG_RESULT([ yes])
511 echo "FATAL ERROR: did not find a valid lex executable."
512 echo "You can either set \$LEX as the full path to lex"
513 echo "in the environment, or install a lex/flex package."
514 rm -rf conftest conftest.*
518 dnl check if user wants their own awk, sed and echo
519 if test -z "$AWK"; then
520 AC_PATH_PROGS(AWK, gawk awk, /usr/bin/awk)
532 if test -z "$SED"; then
533 AC_PATH_PROG(SED, sed, /bin/sed)
537 if test -z "$ECHO"; then
538 AC_PATH_PROG(ECHO, echo, /bin/echo)
542 if test -z "$WHICH"; then
543 AC_PATH_PROG(WHICH, which, /usr/bin/which)
548 dnl check we don't get the Windows sort ...
549 AC_MSG_CHECKING([where unix-like sort(1) lives])
550 if test $target_os = mingw; then
551 for d in /bin /usr/bin /mingw/bin /mingw/usr/bin
553 if test -x $d/sort; then
566 echo "FATAL ERROR: $sort -n failed!"
567 rm -rf conftest conftest.*
572 dnl echo_n set to -n if echo understands -n to suppress newline
573 dnl echo_c set to \c if echo understands \c to suppress newline
574 AC_MSG_CHECKING([if echo uses -n or backslash-c to suppress newlines])
575 if ( $echo "testing\c"; $echo 1,2,3 ) | grep c >/dev/null
577 if ( $echo -n testing; $echo 1,2,3 ) | sed s/-n/xn/ | grep xn >/dev/null
580 AC_MSG_RESULT([neither?])
587 AC_MSG_RESULT([backslash-c])
592 dnl subsequent configure checks rely on $EGREP being set
595 dnl Check for static probes (dtrace, systemtap)
596 if test "$do_probes" = "check" -o "$do_probes" = "yes"
599 AC_CHECK_PROGS(DTRACE, dtrace, [])
602 if test "$do_probes" = "yes"
604 AC_MSG_ERROR([cannot enable static probes - no dtrace executable])
608 AC_CHECK_HEADERS([sys/sdt.h], [
609 if $enable_probes = true
611 if test $target_os = kfreebsd
614 elif test $target_os = freebsd
616 dnl dtrace support in FreeBSD depends on configuration of kernel
617 rm -f conftest.d conftest.h
618 cat <<End-of-File >conftest.d
623 if dtrace -s conftest.d -h >/dev/null 2>&1
625 if test ! -f conftest.h
628 if test "$do_probes" = "yes"
630 AC_MSG_ERROR([cannot enable static probes - no .h from dtrace -h])
635 if test "$do_probes" = "yes"
637 AC_MSG_ERROR([cannot enable static probes - dtrace failed])
644 if test "$do_probes" = "yes"
646 AC_MSG_ERROR([cannot enable static probes - no SDT header])
650 if test "$enable_probes" = "true"
652 AC_DEFINE(HAVE_STATIC_PROBES, [1], [Static probes (dtrace, systemtap)])
654 AC_SUBST(enable_probes)
658 dnl Check for service discovery mechanisms (DNS-SD, Avahi)
659 AS_IF([test "x$do_discovery" != "xno"], [
660 # on Mac OS X, dns_sd.h
662 # on Linux, aloha Avahi
664 PKG_CHECK_MODULES([avahi], [avahi-client],
665 [AC_CHECK_LIB(avahi-client, avahi_client_new,
666 [lib_for_avahi="-lavahi-common -lavahi-client"],
667 [enable_avahi=false])
668 ],[enable_avahi=false])
669 AC_CHECK_HEADERS([avahi-client/publish.h],, [enable_avahi=false])
670 AC_CHECK_HEADERS([avahi-common/alternative.h],, [enable_avahi=false])
672 if test "$enable_avahi" = "true"
674 AC_SUBST(lib_for_avahi)
675 AC_SUBST(avahi_CFLAGS)
676 AC_DEFINE(HAVE_AVAHI, [1], [Service discovery via Avahi])
677 enable_discovery=true
680 if test "$do_discovery" != "check" -a "$enable_discovery" != "true"
682 AC_MSG_ERROR([cannot enable service discovery - no supported mechanisms])
684 if test "$enable_discovery" = "true"
686 AC_DEFINE(HAVE_SERVICE_DISCOVERY, [1], [Service discovery mechanisms])
689 AC_SUBST(enable_discovery)
690 AC_SUBST(enable_avahi)
692 dnl Check for systemd services
694 AS_IF([test "x$do_systemd" != "xno"], [
697 PKG_CHECK_VAR([SYSTEMD_SYSTEMUNITDIR], [systemd], [systemdsystemunitdir],
698 [pcp_systemdunit_dir=$SYSTEMD_SYSTEMUNITDIR], [enable_systemd=false])
699 AC_SUBST(pcp_systemdunit_dir)
700 if test -z "$pcp_systemdunit_dir"
702 if test "$do_systemd" = "yes"
704 AC_MSG_ERROR([cannot enable systemd support - no systemunitdir path])
709 AC_SUBST(enable_systemd)
711 # NB: No AC_PREFIX_DEFAULT is needed, as the default configure invocation
712 # targets a build for non-system directories such as /usr/local.
713 # AC_PREFIX_DEFAULT([])
716 PACKAGE_VERSION=${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_REVISION}
717 AC_SUBST(PACKAGE_VERSION)
718 AC_SUBST(PACKAGE_MAJOR)
719 AC_SUBST(PACKAGE_MINOR)
720 AC_SUBST(PACKAGE_REVISION)
721 AC_SUBST(PACKAGE_BUILD)
723 if test -z "$PACKAGE_BUILD_DATE" ; then
724 PACKAGE_BUILD_DATE=`date +%Y-%m-%d`
726 AC_SUBST(PACKAGE_BUILD_DATE)
728 if test -z "$PACKAGE_DISTRIBUTION" ; then
729 PACKAGE_DISTRIBUTION=$target_distro
731 AC_SUBST(PACKAGE_DISTRIBUTION)
733 dnl generate PM_VERSION_CURRENT for header
734 pm_version_current=`awk </dev/null "BEGIN { print (${PACKAGE_MAJOR}*256+${PACKAGE_MINOR})*256+${PACKAGE_REVISION} }"`
735 AC_SUBST(pm_version_current)
737 dnl output header files with cpp defs HAVE_*, etc
738 AC_CONFIG_HEADERS(src/include/pcp/config.h src/include/pcp/configsz.h)
739 AC_OUTPUT(src/include/pcp/platform_defs.h)
741 AC_CHECK_PROGS(GIT, git)
744 dnl check if python available for the build and runtime
745 AC_CHECK_PROGS(PYTHON, python)
748 dnl check if python3 available for the build and runtime
749 AC_CHECK_PROGS(PYTHON3, python3)
752 dnl check if python tools/packages wanted (need python >= 2.6)
754 AS_IF([test "x$do_python" != "xno"], [
760 AC_MSG_CHECKING([Python version])
761 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 }'`
762 AC_MSG_RESULT([$PY_MAJOR.$PY_MINOR.$PY_POINT])
763 if test "$PY_MAJOR" -lt 2; then
764 echo WARNING: Python version 2.6 or later does not seem to be installed.
765 echo Cannot proceed with the Python $PY_MAJOR installation found.
768 if test "$PY_MAJOR" -eq 2 -a "$PY_MINOR" -lt 6 ; then
769 echo WARNING: Python version 2.$PY_MINOR is too old.
770 echo Python version 2.6 or later is required for Python builds.
773 AC_CHECK_HEADERS([python${PY_MAJOR}.${PY_MINOR}/Python.h], [], [
774 echo WARNING: Python version $PY_MAJOR.$PY_MINOR header file missing.
775 echo Cannot proceed with the Python $PY_MAJOR installation found.
780 if test "$do_python" != "check" -a "$enable_python2" != "true"
782 AC_MSG_ERROR([cannot enable Python - no supported version found])
785 AC_SUBST(enable_python2)
787 dnl check if python3 tools/packages wanted (need python >= 3.3)
789 AS_IF([test "x$do_python3" != "xno"], [
791 if test -z "$PYTHON3"
795 AC_MSG_CHECKING([Python3 version])
796 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 }'`
797 AC_MSG_RESULT([$PY_MAJOR.$PY_MINOR.$PY_POINT])
798 if test "$PY_MAJOR" -lt 3; then
799 echo WARNING: Python version 3.3 or later does not seem to be installed.
800 echo Cannot proceed with the Python $PY_MAJOR installation found.
803 if test "$PY_MAJOR" -eq 3 -a "$PY_MINOR" -lt 3 ; then
804 echo WARNING: Python version 3.$PY_MINOR is too old.
805 echo Python version 3.3 or later is required for Python builds.
808 AC_CHECK_HEADERS([python${PY_MAJOR}.${PY_MINOR}m/Python.h], [], [
809 echo WARNING: Python version $PY_MAJOR.$PY_MINOR header file missing.
810 echo Cannot proceed with the Python $PY_MAJOR installation found.
815 if test "$do_python3" != "check" -a "$enable_python3" != "true"
817 AC_MSG_ERROR([cannot enable Python3 - no supported version found])
820 AC_SUBST(enable_python3)
822 dnl convenience macro to determine if either python is available
823 AC_MSG_CHECKING([for any python version])
824 if test "$cross_compiling" = "yes"; then
826 echo "cross-compile -> \"$ans\"" >&5
827 elif test "$enable_python2" = "true" -o "$enable_python3" = "true"
833 AC_SUBST(have_python)
834 if $have_python; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
836 dnl choose the prefered python executable (py2 -> py3 transtion)
837 if test "$enable_python3" = "true"
839 pcp_python_prog=$PYTHON3
840 elif test "$enable_python2" = "true"
842 pcp_python_prog=$PYTHON
846 AC_SUBST(pcp_python_prog)
848 dnl check availability of some Python modules
849 dnl usage PCP_CHECK_PYTHON_MODULE(module_name) or
850 dnl PCP_CHECK_PYTHON_MODULE(module_name, <import string>)
851 dnl default <import string> is "import module_name"
853 dnl sets $have_python_<module_name> as true or false
855 AC_DEFUN(PCP_CHECK_PYTHON_MODULE,
856 [ AC_MSG_CHECKING(for Python module $1)
863 $pcp_python_prog -c 'import sys;
864 '"$txt" >>config.log 2>&1
868 eval have_python_$1=true
871 eval have_python_$1=false
874 PCP_CHECK_PYTHON_MODULE(jsonpointer)
875 AC_SUBST(have_python_jsonpointer)
876 PCP_CHECK_PYTHON_MODULE(six)
877 AC_SUBST(have_python_six)
879 AC_MSG_CHECKING([if the json PMDA should be included])
881 AS_IF([test "x$do_pmdajson" = "xyes"], [pmda_json=true])
882 AS_IF([test "x$do_pmdajson" = "xcheck"], [
883 dnl JSON PMDA needs both the six and jsonpointer Python modules
884 $have_python_jsonpointer && $have_python_six && pmda_json=true
886 AC_SUBST(PMDA_JSON, $pmda_json)
887 if $pmda_json; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
889 dnl check if perl available for the build and runtime
890 AC_CHECK_PROGS(PERL, perl)
893 AC_MSG_CHECKING([for any perl version])
894 if test "$cross_compiling" = "yes"; then
896 echo "cross-compile -> \"$ans\"" >&5
905 AC_SUBST(pcp_perl_prog)
907 AC_MSG_RESULT($pcp_perl_prog)
909 AC_MSG_CHECKING([if the SNMP PMDA should be included])
911 if test "$have_perl" = true
913 dnl rpm built for SNMP PMDA needs Perl Net::SNMP
914 if $pcp_perl_prog -e "use Net::SNMP" >/dev/null 2>&1
919 AC_SUBST(PMDA_SNMP, $pmda_snmp)
920 if $pmda_snmp; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
922 AC_MSG_CHECKING([if the mysql PMDA should be included])
924 if test "$have_perl" = true
926 dnl rpm build for mysql PMDA needs Perl DBI and DBD::mysql
927 if $pcp_perl_prog -e "use DBI" >/dev/null 2>&1
929 if $pcp_perl_prog -e "use DBD::mysql" >/dev/null 2>&1
935 AC_SUBST(PMDA_MYSQL, $pmda_mysql)
936 if $pmda_mysql; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
938 AC_MSG_CHECKING([if the postgresql PMDA should be included])
939 pmda_postgresql=false
940 if test "$have_perl" = true
942 dnl rpm build for postgresql PMDA needs Perl DBI and DBD::Pg
943 if $pcp_perl_prog -e "use DBI" >/dev/null 2>&1
945 if $pcp_perl_prog -e "use DBD::Pg" >/dev/null 2>&1
951 AC_SUBST(PMDA_POSTGRESQL, $pmda_postgresql)
952 if $pmda_postgresql; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
954 AC_MSG_CHECKING([if the elasticsearch PMDA should be included])
955 pmda_elasticsearch=false
956 if test "$have_perl" = true
958 dnl rpm build for elasticsearch PMDA needs Perl LWP::UserAgent
959 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
961 pmda_elasticsearch=true
964 AC_SUBST(PMDA_ELASTICSEARCH, $pmda_elasticsearch)
965 if $pmda_elasticsearch; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
967 AC_MSG_CHECKING([if the nginx PMDA should be included])
969 if test "$have_perl" = true
971 dnl rpm build for nginx PMDA needs Perl LWP::UserAgent
972 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
977 AC_SUBST(PMDA_NGINX, $pmda_nginx)
978 if $pmda_nginx; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
980 AC_MSG_CHECKING([if the activemq PMDA should be included])
982 if test "$have_perl" = true
984 dnl rpm build for activemq PMDA needs Perl LWP::UserAgent
985 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
990 AC_SUBST(PMDA_ACTIVEMQ, $pmda_activemq)
991 if $pmda_activemq; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
996 AS_IF([test "x$do_qt" != "xno"], [
1001 AC_PATH_PROGS(QMAKE, [qmake-qt5 qmake-qt4 qmake],, [$QTDIR/bin:/usr/bin:/usr/lib64/qt5/bin:/usr/lib/qt5/bin:/usr/lib64/qt4/bin:/usr/lib/qt4/bin])
1002 test "x$cc_is_gcc" = xyes -a $target_os = solaris && QMAKE="$QMAKE -spec solaris-g++"
1009 AC_MSG_CHECKING([Qt version])
1010 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 }'`
1011 AC_MSG_RESULT([$QT_MAJOR.$QT_MINOR.$QT_POINT])
1012 if test "$QT_MAJOR" -lt 4; then
1013 echo WARNING: Qt version 4.4 or later does not seem to be installed.
1014 echo Cannot proceed with the Qt $QT_MAJOR installation found.
1017 if test "$QT_MAJOR" -eq 4 -a "$QT_MINOR" -lt 4 ; then
1018 echo WARNING: Qt version 4.$QT_MINOR is too old.
1019 echo Qt version 4.4 or later is required for Qt builds.
1024 if test "$do_qt" != "check" -a "$enable_qt" != "true"
1026 AC_MSG_ERROR([cannot enable Qt - no supported Qt installation found])
1027 elif test "$enable_qt" = "true" -a "x$cxx" = "x"
1030 test "$do_qt" != "check" && \
1031 AC_MSG_ERROR([C++ compiler unavailable, cannot build Qt components])
1032 elif test "$do_qt" = "debug"
1034 dnl Debug/release style build? (non-debug by default)
1039 AC_SUBST(qt_release)
1043 dnl check if user wants their own make program
1044 dnl note: all makefiles in this package use the gmake syntax
1047 AC_PATH_PROG(MAKE, gmake)
1050 # look elsewhere ...
1051 AC_MSG_CHECKING([for GNU make elsewhere])
1052 for f in /usr/local/bin/gmake /usr/freeware/bin/gmake /usr/local/bin/make /opt/sfw/bin/gmake nowhere
1060 if test $f = nowhere
1062 # Check if /usr/bin/make is any good
1063 mver=`/usr/bin/make --version 2>/dev/null | sed -n -e1p | cut -c1-8`
1064 if test "$mver" != "GNU Make"
1067 echo "FATAL ERROR: could not find GNU make anywhere"
1068 echo "You need to set \$MAKE as the full path to GNU make "
1069 echo "in the environment."
1070 rm -rf conftest conftest.*
1076 AC_MSG_RESULT($MAKE)
1082 dnl check if users wants their own CPP
1083 if test -z "$CPP"; then
1089 dnl check if users wants their own linker
1090 if test -z "$LD"; then
1091 AC_PATH_PROG(LD, ld, /usr/bin/ld)
1096 dnl Provide ways to override owner and group for installed files
1097 if test -z "$PCP_USER_INSTALL" ; then
1098 pcp_user_install=root
1100 pcp_user_install="$PCP_USER_INSTALL"
1102 AC_SUBST(pcp_user_install)
1103 if test -z "$PCP_GROUP_INSTALL" ; then
1106 darwin|freebsd|netbsd)
1107 pcp_group_install=wheel
1110 pcp_group_install=root
1114 pcp_group_install="$PCP_GROUP_INSTALL"
1116 AC_SUBST(pcp_group_install)
1118 dnl check if the tar program is available
1119 if test -z "$TAR"; then
1120 AC_PATH_PROGS(TAR, gtar tar, tar)
1122 if test $target_os = darwin -a -x /usr/bin/gnutar
1129 dnl check if the gzip program is available
1130 dnl (needed to gzip man pages on some platforms)
1131 if test -z "$ZIP"; then
1132 AC_PATH_PROG(ZIP, gzip, /bin/gzip)
1134 test ! -x "$ZIP" && ZIP=/usr/local/bin/gzip
1135 test ! -x "$ZIP" && ZIP=/usr/freeware/bin/gzip
1136 test ! -x "$ZIP" && ZIP=/usr/bin/gzip
1138 test -z "$gzip" && gzip=no-gzip
1141 dnl check if the bzip2 program is available
1142 dnl (needed to bzip2 man pages on some platforms)
1143 if test -z "$BZIP2"; then
1144 AC_PATH_PROG(BZIP2, bzip2, /bin/bzip2)
1146 test ! -x "$BZIP2" && BZIP2=/usr/bin/bzip2
1147 test ! -x "$BZIP2" && BZIP2=/usr/local/bin/bzip2
1148 test ! -x "$BZIP2" && BZIP2=/usr/freeware/bin/bzip2
1150 test -z "$bzip2" && bzip2=no-bzip2
1153 dnl check if the lzma program is available
1154 dnl (needed to lzma man pages on some platforms)
1155 if test -z "$LZMA"; then
1156 AC_PATH_PROG(LZMA, lzma, /bin/lzma)
1158 test ! -x "$LZMA" && LZMA=/usr/bin/lzma
1159 test ! -x "$LZMA" && LZMA=/usr/local/bin/lzma
1160 test ! -x "$LZMA" && LZMA=/usr/freeware/bin/lzma
1162 test -z "$lzma" && lzma=no-lzma
1165 dnl check if the xz program is available
1166 dnl (needed to xz man pages on some platforms)
1167 if test -z "$XZ"; then
1168 AC_PATH_PROG(XZ, xz, /bin/xz)
1170 test ! -x "$XZ" && XZ=/usr/bin/xz
1171 test ! -x "$XZ" && XZ=/usr/local/bin/xz
1172 test ! -x "$XZ" && XZ=/usr/freeware/bin/xz
1174 test -z "$xz" && xz=no-xz
1177 dnl Check for mac PackageMaker
1178 AC_MSG_CHECKING([for PackageMaker])
1179 if test -z "$PACKAGE_MAKER"
1181 if test $target_os = darwin
1183 if test -x /Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1184 then # local XCode extras install
1185 package_maker=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1186 AC_MSG_RESULT([ yes (local install)])
1187 elif test -x /Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1189 package_maker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1190 AC_MSG_RESULT([ yes (darwin 6.x)])
1191 elif test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
1193 AC_MSG_RESULT([ yes (darwin 7.x)])
1194 package_maker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
1196 AC_MSG_RESULT([ not found!])
1197 AC_MSG_WARN([PackageMaker not found, mac packages will not be made])
1200 AC_MSG_RESULT([ no])
1203 package_maker="$PACKAGE_MAKER"
1205 AC_SUBST(package_maker)
1207 dnl check if the hdiutil program is available
1208 if test -z "$HDIUTIL"; then
1209 AC_PATH_PROG(HDIUTIL, hdiutil)
1214 dnl check if the mkinstallp program is available (AIX)
1215 if test -z "$MKINSTALLP"; then
1216 AC_PATH_PROG(MKINSTALLP, mkinstallp)
1218 mkinstallp=$MKINSTALLP
1219 AC_SUBST(mkinstallp)
1221 dnl check for the Solaris pmgmk package maker
1222 if test -z "$PKGMK"; then
1223 AC_PATH_PROG(PKGMK, pkgmk)
1228 dnl check if the dlltool program is available
1229 if test -z "$DLLTOOL"; then
1230 AC_PATH_PROG(DLLTOOL, dlltool)
1235 dnl check if the rpmbuild program is available
1236 if test -z "$RPMBUILD"; then
1237 AC_PATH_PROG(RPMBUILD, rpmbuild)
1239 test $target_distro = slackware && RPMBUILD=''
1243 dnl check if the rpm program is available
1244 if test -z "$RPM"; then
1245 AC_PATH_PROG(RPM, rpm)
1247 test $target_distro = slackware && RPM=''
1251 dnl if rpmbuild exists, use it, otherwise use rpm
1252 if test -n "$RPMBUILD" -a -x "$RPMBUILD"
1260 dnl check if the pod2man program is available (perl man page builder)
1261 if test -z "$POD2MAN"; then
1262 AC_PATH_PROG(POD2MAN, pod2man)
1267 dnl extra check for the Perl MakeMaker package
1268 AC_MSG_CHECKING([if ExtUtils::MakeMaker is installed])
1269 perl -e "use ExtUtils::MakeMaker" 2>/dev/null
1272 AC_MSG_RESULT([ yes])
1274 AC_MSG_RESULT([ no])
1276 echo "FATAL ERROR: Perl ExtUtils::MakeMaker module missing."
1277 echo "You can either install this from your distribution, or"
1278 echo "download from CPAN (Comprehensive Perl Archive Network)."
1279 rm -rf conftest conftest.*
1283 AC_PATH_PROG(TRUEPROG, true)
1285 dnl check if the makedepend program is available
1286 if test -z "$MAKEDEPEND"; then
1287 AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUEPROG)
1289 makedepend=$MAKEDEPEND
1290 AC_SUBST(makedepend)
1292 dnl check if the md5sum program is available
1293 if test -z "$MD5SUM"; then
1294 AC_PATH_PROG(MD5SUM, md5sum, $TRUEPROG)
1299 dnl check if the Debian dpkg program is available
1300 if test -z "$DPKG"; then
1301 AC_PATH_PROG(DPKG, dpkg)
1306 dnl check for the Slackware makepkg packaging tool
1307 if test -z "$MAKEPKG"; then
1308 AC_PATH_PROG(MAKEPKG, makepkg)
1313 dnl check if a toolchain is available for the books
1314 test -z "$PUBLICAN" && AC_PATH_PROG(PUBLICAN, publican)
1317 test -z "$DBLATEX" && AC_PATH_PROG(DBLATEX, dblatex)
1320 test -z "$XMLTO" && AC_PATH_PROG(XMLTO, xmlto)
1325 if test "$do_books" = "check" -o "$do_books" = "yes"
1327 if test "$BOOK_TOOLCHAIN" != ""
1329 book_toolchain=$BOOK_TOOLCHAIN
1330 elif test "$DBLATEX" != ""
1332 book_toolchain=dblatex
1333 elif test "$PUBLICAN" != ""
1335 book_toolchain=publican
1336 elif test "$XMLTO" != ""
1338 book_toolchain=xmlto
1339 elif test "$do_books" = "yes"
1341 AC_MSG_ERROR([cannot enable books build - no toolchain found])
1344 AC_SUBST(book_toolchain)
1347 if test "$do_books_brand" != ""
1349 book_brand=$do_books_brand
1351 AC_SUBST(book_brand)
1353 dnl check if symbolic links are supported
1355 if test $target_os = mingw; then
1359 dnl if /proc is not mounted, try and mount it
1360 dnl before trying to run the ps style test below
1363 test -f /proc/stat || mount /proc >/dev/null 2>&1
1366 dnl set platform specific ps
1367 if test -n "$PROCPS"
1369 pcp_ps_prog="$PROCPS"
1373 AC_SUBST(pcp_ps_prog)
1375 dnl set platform specific event logger
1376 if test $target_os = mingw
1378 pcp_syslog_prog=pcp-eventlog
1380 pcp_syslog_prog=logger
1382 AC_SUBST(pcp_syslog_prog)
1385 if test $target_os = solaris
1387 test -f /usr/xpg4/bin/grep && grep=/usr/xpg4/bin/grep
1391 dnl checks for /proc pseudo file system
1392 AC_MSG_CHECKING([for /proc ])
1393 if test "$cross_compiling" = "yes"; then
1395 echo "cross-compile -> \"$ans\"" >&5
1405 AC_DEFINE(HAVE_PROCFS, [1], [Support for /proc pseudo-filesystem])
1410 dnl Checks for C header files.
1414 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h syslog.h)
1415 AC_CHECK_HEADERS(unistd.h stddef.h sched.h dlfcn.h dl.h)
1416 AC_CHECK_HEADERS(sys/time.h sys/times.h)
1417 AC_CHECK_HEADERS(sys/resource.h sys/prctl.h)
1418 AC_CHECK_HEADERS(sys/sysinfo.h sys/systeminfo.h)
1419 AC_CHECK_HEADERS(endian.h standards.h sys/byteorder.h)
1420 AC_CHECK_HEADERS(libgen.h sys/param.h sys/mman.h sys/un.h)
1421 AC_CHECK_HEADERS(values.h stdint.h ieeefp.h math.h)
1422 AC_CHECK_HEADERS(pwd.h grp.h regex.h sys/wait.h)
1423 AC_CHECK_HEADERS(termio.h termios.h sys/termios.h sys/ioctl.h sys/socket.h)
1424 AC_CHECK_HEADERS(netdb.h)
1425 if test $target_os = darwin
1427 AC_CHECK_HEADERS(net/if.h, [], [], [#include <sys/types.h>
1428 #include <sys/socket.h>])
1430 AC_CHECK_HEADERS(net/if.h)
1432 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h arpa/inet.h)
1433 AC_CHECK_HEADERS(windows.h winsock2.h ws2tcpip.h)
1434 AC_CHECK_HEADERS(execinfo.h bits/wordsize.h)
1435 AC_CHECK_HEADERS(iptypes.h, [], [], [#include <windows.h>])
1436 AC_CHECK_HEADERS(iphlpapi.h, [], [], [#include <winsock2.h>])
1437 AC_CHECK_HEADERS(fts.h libzfs.h)
1438 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/mount.h)
1440 dnl Check if we have <sys/endian.h> ... standard way
1441 AC_MSG_CHECKING([for sys/endian.h ])
1444 #include <sys/endian.h>
1447 ], AC_DEFINE(HAVE_SYS_ENDIAN_H, [1], [sys/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1449 dnl Check if we have <machine/endian.h> ... MacOSX way
1450 AC_MSG_CHECKING([for machine/endian.h ])
1453 #include <machine/endian.h>
1456 ], AC_DEFINE(HAVE_MACHINE_ENDIAN_H, [1], [machine/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1458 dnl Check if we have <sys/endian.h> ... IRIX strangeness
1459 AC_MSG_CHECKING([for sys/endian.h (IRIX variant) ])
1462 #include <standards.h>
1463 #include <sys/endian.h>
1466 ], AC_DEFINE(HAVE_SYS_ENDIAN_H, [1], [IRIX sys/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1468 dnl Checks for typedefs, structures, and compiler characteristics.
1477 dnl check if regex functions come from libregex (mingw)
1478 AC_CHECK_LIB(regex, regcomp)
1480 if test $ac_cv_lib_regex_regcomp = yes
1482 lib_for_regex="-lregex"
1484 AC_SUBST(lib_for_regex)
1486 PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=true], [have_ncurses=false])
1487 AC_SUBST(HAVE_NCURSES, [$have_ncurses])
1489 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-journal],
1490 [pmda_systemd=true], [pmda_systemd=false])
1491 AC_MSG_CHECKING([if the systemd PMDA should be included])
1492 AC_SUBST(PMDA_SYSTEMD, $pmda_systemd)
1493 if $pmda_systemd; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1495 pmda_infiniband=false
1496 AS_IF([test "x$do_infiniband" != "xno"], [
1497 AC_CHECK_HEADERS([infiniband/umad.h], [
1498 AC_CHECK_HEADERS([infiniband/mad.h], [pmda_infiniband=true], [])
1502 AC_CHECK_LIB(ibmad, madrpc_init)
1503 AC_CHECK_LIB(ibumad, umad_init)
1504 if test $ac_cv_lib_ibmad_madrpc_init = yes -a $ac_cv_lib_ibumad_umad_init = yes
1506 IB_LIBS="-libmad -libumad"
1508 AC_MSG_CHECKING([for port_performance_query_via])
1509 AC_TRY_LINK_FUNC(port_performance_query_via,
1510 AC_DEFINE(HAVE_PORT_PERFORMANCE_QUERY_VIA, [1], [port_performance_query_via API])
1511 have_port_performance_query_via=true
1513 have_port_performance_query_via=false
1515 AC_MSG_CHECKING([for pma_query_via])
1516 AC_TRY_LINK_FUNC(pma_query_via,
1517 AC_DEFINE(HAVE_PMA_QUERY_VIA, [1], [pma_query_via API])
1518 have_pma_query_via=true
1520 have_pma_query_via=false
1523 if test $have_pma_query_via -o $have_port_performance_query_via
1527 pmda_infiniband=false
1530 pmda_infiniband=false
1535 AC_MSG_CHECKING([if the infiniband PMDA should be included])
1536 AC_SUBST(PMDA_INFINIBAND, $pmda_infiniband)
1537 if $pmda_infiniband; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1540 AS_IF([test "x$do_papi" != "xno"], [
1543 saved_LDFLAGS="$LDFLAGS"
1544 saved_CFLAGS="$CFLAGS"
1547 dnl potentially from the environment, else empty
1548 CFLAGS="$papi_CFLAGS"
1549 LDFLAGS="$papi_LIBS"
1555 PAPI_ROOTDIR=$do_papi;
1556 CFLAGS="-I$PAPI_ROOTDIR/include"
1557 LDFLAGS="-L$PAPI_ROOTDIR/lib"
1560 PKG_CHECK_MODULES(papi,[$do_papi],[
1561 CFLAGS="$papi_CFLAGS"
1562 LDFLAGS="$papi_LIBS"])
1566 # $papi_LIBS may include -lpapi harmlessly redudantly with AC_CHECK_LIB
1567 AC_CHECK_LIB([papi], [PAPI_library_init],
1568 [papi_libs="$LDFLAGS -lpapi"],
1569 [enable_papi=false])
1570 AC_CHECK_HEADERS([papi.h], [papi_cflags="$CFLAGS"], [enable_papi=false])
1571 if test "$do_papi" != "check" -a "$enable_papi" != "true"
1573 AC_MSG_ERROR([PAPI is not installed, cannot enable the PAPI PMDA])
1575 pmda_papi=$enable_papi
1578 CFLAGS="$saved_CFLAGS"
1579 LDFLAGS="$saved_LDFLAGS"
1580 AC_SUBST(PAPI_CFLAGS, $papi_cflags)
1581 AC_SUBST(PAPI_LIBS, $papi_libs)
1583 AC_MSG_CHECKING([if the papi PMDA should be included])
1584 AC_SUBST(PMDA_PAPI, $pmda_papi)
1585 if $pmda_papi; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1587 AS_IF([test "x$pmda_papi" = "xtrue"], [
1588 dnl check if struct PAPI_component_info_t has a disabled field
1589 AC_MSG_CHECKING([whether struct PAPI_component_info_t has a disabled field])
1590 cat <<End-of-File >conftest.c
1592 int main() { PAPI_component_info_t *c; c->disabled = 0; }
1594 (eval $ac_compile) 2>conftest.out
1595 cat conftest.out >&5
1596 if test -s conftest.out
1600 AC_DEFINE(HAVE_PAPI_DISABLED_COMP, [1], [PAPI_component_info_t field])
1607 pmda_perfevent=false
1608 AS_IF([test "x$do_perfevent" != "xno" ], [
1609 enable_perfevent=true
1612 AC_CHECK_LIB([pfm], [pfm_get_os_event_encoding],
1614 [enable_perfevent=false])
1615 AC_CHECK_HEADERS([perfmon/pfmlib_perf_event.h], [], [enable_perfevent=false])
1616 if test "$do_perfevent" != "check" -a "$enable_papi" != "true"
1618 AC_MSG_ERROR([libpfm is not installed, cannot enable the perfevent PMDA])
1620 pmda_perfevent=$enable_perfevent
1623 AC_SUBST(PFM_LIBS, $pfm_libs)
1625 AC_MSG_CHECKING([if the perfevent PMDA should be included])
1626 AC_SUBST(PMDA_PERFEVENT, $pmda_perfevent)
1627 if $pmda_perfevent; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1629 dnl Do you have RPM Package Manager libraries for pmdarpm?
1632 AC_MSG_CHECKING([for rpmlib > 4.4.2])
1634 [AC_LANG_PROGRAM([[#include <rpm/header.h>]],
1635 [[(void)HEADERGET_EXT;]])],
1636 [AC_MSG_RESULT([yes])
1638 [AC_MSG_RESULT([no])])
1639 AC_MSG_CHECKING([if the rpm PMDA should be included])
1640 AC_SUBST(PMDA_RPM,$pmda_rpm)
1641 if $pmda_rpm; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1644 dnl Do you have the required qshape script for the postfix PMDA
1645 dnl The logic here is copied from the PMDA's Install script
1647 AC_CHECK_PROGS(QSHAPE, qshape, [], path=[$PATH:/usr/sbin])
1648 AC_MSG_CHECKING([if the postfix PMDA should be included])
1649 if test -n "$QSHAPE"
1653 for script in /usr/share/doc/packages/postfix-doc/auxiliary/qshape/qshape.pl
1655 if test -f "$script"
1662 AC_SUBST(PMDA_POSTFIX,$pmda_postfix)
1663 if $pmda_postfix; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1665 dnl Do you have system microhttpd libraries for pmwebapi?
1666 PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd > 0.9.9], [have_libmicrohttpd=true], [have_libmicrohttpd=false])
1667 AC_SUBST(HAVE_LIBMICROHTTPD, [$have_libmicrohttpd])
1669 dnl Do you have graphics libraries for pmwebapi?
1670 PKG_CHECK_MODULES([cairo], [cairo >= 1.2, cairo-ft >= 1.2, cairo-png >= 1.2], [have_cairo=true], [have_cairo=false])
1671 AC_SUBST(HAVE_CAIRO, [$have_cairo])
1674 AS_IF([test "x$do_webapi" != "xno"], [
1677 if test "$have_libmicrohttpd" != "true"
1680 test "$do_webapi" != "check" && \
1681 AC_MSG_ERROR([libmicrohttpd is not installed, cannot enable the web API])
1682 elif test "$do_webapi" != "check" -a "x$cxx" = "x"
1685 test "$do_webapi" != "check" && \
1686 AC_MSG_ERROR([C++ compiler unavailable, cannot enable the web API])
1689 AC_SUBST(enable_webapi)
1691 enable_manager=false
1692 AS_IF([test "x$do_manager" != "xno"], [
1695 if test "$target_os" = "mingw"
1697 enable_manager=false
1698 test "$do_manager" != "check" && \
1699 AC_MSG_ERROR([MinGW build, cannot enable daemon manager])
1700 elif test "x$cxx" = "x"
1702 enable_manager=false
1703 test "$do_manager" != "check" && \
1704 AC_MSG_ERROR([C++ compiler unavailable, cannot enable daemon manager])
1706 AC_MSG_CHECKING([compilation features for daemon manager])
1708 [ #ifndef _XOPEN_SOURCE
1709 #define _XOPEN_SOURCE 600
1714 enable_manager=false
1717 AC_SUBST(enable_manager)
1719 dnl Checks for library functions.
1723 AC_CHECK_FUNCS(mktime nanosleep usleep unsetenv)
1724 AC_CHECK_FUNCS(select socket gethostname getpeerucred getpeereid)
1725 AC_CHECK_FUNCS(uname syslog __clone pipe2 fcntl ioctl)
1726 AC_CHECK_FUNCS(prctl setlinebuf waitpid atexit kill)
1727 AC_CHECK_FUNCS(chown fchmod getcwd scandir mkstemp)
1728 AC_CHECK_FUNCS(brk sbrk posix_memalign memalign valloc)
1729 AC_CHECK_FUNCS(signal sighold sigrelse tcgetattr)
1730 AC_CHECK_FUNCS(regex regcmp regexec regcomp)
1731 AC_CHECK_FUNCS(strtod strtol strtoll strtoull strndup strchrnul)
1732 AC_CHECK_FUNCS(getuid getgid)
1733 AC_CHECK_FUNCS(getgrent getgrent_r getgrnam getgrnam_r getgrgid getgrgid_r)
1734 AC_CHECK_FUNCS(getpwent getpwent_r getpwnam getpwnam_r getpwuid getpwuid_r)
1735 AC_CHECK_FUNCS(sysinfo trace_back_stack backtrace)
1736 AC_CHECK_FUNCS(sendmsg recvmsg setns)
1738 dnl only define readdir64 on non-linux platforms that support it
1739 if test $target_os != linux -a $target_os != freebsd -a $target_os != kfreebsd -a $target_os != netbsd; then
1740 AC_CHECK_FUNCS(readdir64)
1743 dnl typedefs missing from sys/types.h, stdlib.h or stddef.h
1744 if test $target_os = solaris
1746 AC_CHECK_TYPE(__int32_t, int32_t)
1747 AC_CHECK_TYPE(__uint32_t, uint32_t)
1748 AC_CHECK_TYPE(__int64_t, int64_t)
1749 AC_CHECK_TYPE(__uint64_t, uint64_t)
1750 AC_CHECK_TYPE(uint_t, u_int32_t)
1752 AC_CHECK_TYPE(__int32_t, int)
1753 AC_CHECK_TYPE(__uint32_t, unsigned int)
1754 AC_CHECK_TYPE(__int64_t, long long)
1755 AC_CHECK_TYPE(__uint64_t, unsigned long long)
1756 AC_CHECK_TYPE(uint_t, unsigned int)
1759 dnl check if we have a type for the pointer's size integer (__psint_t)
1760 AC_MSG_CHECKING([for __psint_t ])
1763 #include <sys/types.h>
1766 ], [ __psint_t psint; ],
1767 AC_DEFINE(HAVE___PSINT_T, [1], [__psint_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1769 dnl check if we have a type for pointer difference (ptrdiff_t)
1770 AC_MSG_CHECKING([for ptrdiff_t ])
1773 #ifdef HAVE_MALLOC_H
1776 ], [ ptrdiff_t ptrdiff; ],
1777 AC_DEFINE(HAVE_PTRDIFF_T, [1], [ptrdiff_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1779 dnl check if we have types for uid_t, gid_t (POSIX) or SID (Win32)
1780 AC_MSG_CHECKING([for uid_t ])
1782 #include <sys/types.h>
1787 AC_DEFINE(HAVE_UID_T, [1], [uid_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1788 AC_MSG_CHECKING([for gid_t ])
1790 #include <sys/types.h>
1795 AC_DEFINE(HAVE_GID_T, [1], [gid_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1796 AC_MSG_CHECKING([for SID ])
1798 #ifdef HAVE_WINDOWS_H
1799 #include <windows.h>
1802 AC_DEFINE(HAVE_SID, [1], [sid type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1804 dnl check if we have a type for socklen_t
1805 AC_MSG_CHECKING([for socklen_t ])
1807 #include <sys/types.h>
1808 #ifdef HAVE_SYS_SOCKET_H
1809 #include <sys/socket.h>
1811 ], [ socklen_t len; ],
1812 AC_DEFINE(HAVE_SOCKLEN_T, [1], [socklen_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1814 dnl check if LL suffix on constants is supported
1817 ], [ long long x = 0LL; ],
1818 AC_DEFINE(HAVE_CONST_LONGLONG, [1], [LL suffix on constants]))
1820 dnl check if _environ is declared globally
1824 ], [ char **x = _environ; ],
1825 AC_DEFINE(HAVE_UNDERBAR_ENVIRON, [1], [_environ declared globally]))
1827 dnl check for PR_TERMCHILD and PR_SET_PDEATHSIG in <sys/prctl.h>
1828 AC_MSG_CHECKING([for PR_TERMCHILD constant in sys/prctl.h])
1830 #ifdef HAVE_SYS_PRCTL_H
1831 #include <sys/prctl.h>
1833 ], [ int i = PR_TERMCHILD; ],
1834 AC_DEFINE(HAVE_PR_TERMCHILD, [1], [PR_TERMCHILD constant]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1836 AC_MSG_CHECKING([for PR_SET_PDEATHSIG constant in sys/prctl.h])
1838 #ifdef HAVE_SYS_PRCTL_H
1839 #include <sys/prctl.h>
1841 ], [ int i = PR_SET_PDEATHSIG; ],
1842 AC_DEFINE(HAVE_PR_SET_PDEATHSIG, [1], [PR_SET_PDEATHSIG constant]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1844 AC_HEADER_TIOCGWINSZ
1846 dnl check if linker needs -rdynamic for dynamically loaded shared
1847 dnl libraries to see the symbols in the process loading them.
1848 dnl This is e.g., needed on linux for pmcd loading pmda_pmcd.so.
1849 AC_MSG_CHECKING([if linker supports -rdynamic])
1850 save_CFLAGS="$CFLAGS"
1852 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1853 [AC_MSG_RESULT([yes])
1854 rdynamic_flag=-rdynamic],
1855 [AC_MSG_RESULT([no])
1858 CFLAGS="$save_CFLAGS"
1859 AC_SUBST([rdynamic_flag])
1862 dnl check if argument to user's select() method in scandir call is const
1863 AC_MSG_CHECKING([whether const arg for scandir() select method])
1864 cat <<End-of-File >conftest.c
1869 my_select(const struct dirent *foo) { return 0; }
1870 int main() { struct dirent **list; return scandir(".", &list, my_select, NULL); }
1872 (eval $ac_compile) 2>conftest.out
1873 cat conftest.out >&5
1874 if test -s conftest.out
1878 AC_DEFINE(HAVE_CONST_DIRENT, [1], [const arg for scandir() select method])
1883 dnl check if struct dirent has a d_off (directory offset) field
1884 AC_MSG_CHECKING([whether struct dirent has a d_off field])
1885 cat <<End-of-File >conftest.c
1889 int main() { struct dirent d; d.d_off = 0; }
1891 (eval $ac_compile) 2>conftest.out
1892 cat conftest.out >&5
1893 if test -s conftest.out
1897 AC_DEFINE(HAVE_DIRENT_D_OFF, [1], [struct dirent d_off field])
1902 dnl check if printf %p has 0x prefix
1903 AC_MSG_CHECKING([if printf %p produces 0x prefix])
1904 if test "$cross_compiling" = "yes"; then
1905 ans=$printf_p_prefix
1906 echo "cross-compile -> \"$ans\"" >&5
1908 cat <<End-of-File >conftest.c
1910 int main(int argc, char **argv) { printf("%p", argv); return(0); }
1912 (eval $ac_compile) 2>&5
1913 (eval $ac_link) 2>&5
1915 echo "./conftest -> \"$ans\"" >&5
1920 AC_DEFINE(HAVE_PRINTF_P_PFX, [1], [printf %p produces 0x])
1927 rm -rf conftest conftest.*
1931 # need to deal with this sort of cpp output ...
1932 # typedef long pid_t;
1933 # typedef unsigned int pid_t;
1934 # typedef unsigned int pid_t __attribute__ ((__mode__ (__SI__)));
1935 # __extension__ typedef int pid_t;
1942 # and chaining of the form
1943 # typedef long __pid_t;
1944 # typedef __pid_t pid_t;
1946 _raw=`$CPP conftest.c \
1948 -e 's/[[ ]]__attribute__ ((.*));/;/' \
1949 -e 's/__extension__[[ ]][[ ]]*//' \
1951 /bozo/ { print; next }
1952 $1 == "typedef" { printf "%s",$0
1958 if ($0 ~ /{/) depth = 1
1961 wantsemi == 1 { printf " %s",$0
1962 if ($0 ~ /{/) depth++
1964 if ($0 ~ /}/) depth--
1978 $1 == "typedef" { map[[$NF]] = ""
1979 for (i = 2; i < NF; i++) {
1983 map[[$NF]] = map[[$NF]] " " $i
1985 print $NF " -> " map[[$NF]] >"conftest.debug"
1988 $2 == "bozo" { t = $1
1989 printf "best guess: %s",t >"conftest.debug"
1990 while (map[[t]] != "") {
1992 printf " -> %s",t >"conftest.debug"
1994 print "" >"conftest.debug"
2003 unsigned|'unsigned int')
2009 'long long'|'long long int')
2010 if test $target_os = mingw; then
2016 'unsigned long'|'unsigned long int'|'long unsigned int')
2019 'unsigned long long'|'unsigned long long int')
2020 if test $target_os = mingw; then
2026 *\*) # pointer to a something
2029 struct\ *) # not much can be done here ...
2034 echo "FATAL ERROR: don't know what to do with type \"$_raw\""
2035 echo "... typedef mapping ..."
2037 rm -rf conftest conftest.*
2043 dnl printf type for pid_t
2044 AC_MSG_CHECKING([printf type for pid_t])
2045 if test "$cross_compiling" = "yes"; then
2047 echo "cross-compile -> \"$ans\"" >&5
2050 cat <<End-of-File >conftest.c
2051 #include <sys/types.h>
2058 AC_MSG_RESULT($fmt_pid)
2060 rm -rf conftest.c conftest.debug
2062 dnl printf type for int64_t
2063 AC_MSG_CHECKING([printf type for int64_t ])
2064 if test "$cross_compiling" = "yes"; then
2065 ans=$printf_fmt_int64
2066 echo "cross-compile -> \"$ans\"" >&5
2068 cat <<End-of-File >conftest.c
2071 #include <inttypes.h>
2074 printf("\"%s\"\n", __PRI64_PREFIX "d");
2079 (eval $ac_link) 2>&5
2080 if test -x ./conftest
2083 echo "./conftest -> \"$ans\"" >&5
2087 dnl have to try the hardway ...
2088 cat <<End-of-File >conftest.c
2095 int64_t bozo = 0x12345678abcdLL;
2096 sprintf(buf, "%lx", bozo);
2097 if (strcmp(buf, "12345678abcd") == 0)
2100 sprintf(buf, "%llx", bozo);
2101 if (strcmp(buf, "12345678abcd") == 0)
2102 printf("\"lld\"\n");
2107 (eval $ac_link) 2>&5
2108 if test -x ./conftest
2111 echo "./conftest -> \"$ans\"" >&5
2117 echo 'FATAL ERROR: Cannot determine printf format for int64_t type'
2118 rm -rf conftest conftest.*
2122 AC_MSG_RESULT("$fmt_int64")
2124 rm -rf conftest.* conftest
2126 AC_MSG_CHECKING([strtol or strtoll for int64_t])
2127 if test "$cross_compiling" = "yes"; then
2129 echo "cross-compile -> \"$ans\"" >&5
2131 cat <<End-of-File >conftest.c
2136 long long int value = -1;
2137 value = strtol("1234567812345678", NULL, 16);
2138 if (value == 0x1234567812345678LL) {
2139 printf("strotol\n");
2142 value = strtoll("1234567812345678", NULL, 16);
2143 if (value == 0x1234567812345678LL) {
2144 printf("strtoll\n");
2150 (eval $ac_compile) 2>&5
2151 (eval $ac_link) 2>&5
2153 echo "./conftest -> \"$ans\"" >&5
2158 AC_DEFINE(strtoint64, strtol)
2159 AC_DEFINE(strtouint64, strtoul)
2160 AC_MSG_RESULT([strtol])
2163 AC_DEFINE(strtoint64, strtoll)
2164 AC_DEFINE(strtouint64, strtoull)
2165 AC_MSG_RESULT([strtoll])
2168 AC_DEFINE(strtoint64, strtoll)
2169 AC_DEFINE(strtouint64, strtoull)
2170 AC_MSG_RESULT([assuming strtoll])
2173 rm -rf conftest conftest.*
2175 if test "$do_threads" = "check" -o "$do_threads" = "yes"
2181 if test "$do_threads" = "yes"
2183 AC_MSG_ERROR([cannot enable multi-threaded mode - no pthread.h])
2187 dnl Check if pthread_mutex_t is defined in pthread.h
2188 dnl Ignore the fact that pthread.h could be missing - we don't
2189 dnl really care if this test fails because of missing pthread_mutex_t
2190 dnl or because of missing headers.
2191 AC_MSG_CHECKING([for pthread_mutex_t in pthread.h])
2193 [#include <pthread.h>], [pthread_mutex_t mymutex;],
2194 AC_DEFINE(HAVE_PTHREAD_MUTEX_T, [1], [pthread_mutex_t type]) AC_MSG_RESULT(yes),
2196 if test "$do_threads" = "yes"
2198 AC_MSG_ERROR([cannot enable multi-threaded mode - no mutexes])
2204 dnl Check which library provide pthread stuff
2205 AC_MSG_CHECKING([where pthread_create() is defined])
2206 for cand in "" pthreads pthread ; do
2210 LIBS=`echo $LIBS -l$cand`
2214 #include <pthread.h>
2217 pthread_create(NULL, NULL, NULL, NULL);
2218 ], AC_MSG_RESULT(lib${cand:-c})
2221 lib_for_pthreads="$cand"
2223 lib_for_pthreads="-l$cand"
2229 AC_SUBST(lib_for_pthreads)
2231 if test "$ac_cv_header_pthread_h" = "yes"
2233 dnl printf type for pthread_t
2234 AC_MSG_CHECKING([printf type for pthread_t])
2235 cat <<End-of-File >conftest.c
2236 #include <pthread.h>
2241 AC_MSG_RESULT($fmt_pthread)
2242 AC_SUBST(fmt_pthread)
2243 rm -rf conftest.c conftest.debug
2245 dnl check if gcc supports __thread for thread private data
2246 AC_MSG_CHECKING([if compiler supports __thread])
2247 dnl __thread support is broken in some places
2248 if test $target_os = netbsd
2250 AC_TRY_COMPILE([#include <pthread.h>
2251 #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 5 )
2256 AC_DEFINE(HAVE___THREAD, [1], [__thread private data]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2258 AC_TRY_COMPILE([#include <pthread.h>
2259 __thread int x;], [],
2260 AC_DEFINE(HAVE___THREAD, [1], [__thread private data]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2263 dnl Check if pthread_barrier_t is defined in pthread.h
2264 AC_MSG_CHECKING([for pthread_barrier_t in pthread.h])
2265 AC_TRY_COMPILE([#include <pthread.h>], [pthread_barrier_t mybarrier;],
2266 AC_DEFINE(HAVE_PTHREAD_BARRIER_T, [1], [pthread_barrier_t type]) AC_MSG_RESULT(yes),
2271 dnl check sizeof long
2272 AC_MSG_CHECKING([sizeof long])
2273 if test "$cross_compiling" = "yes"; then
2275 echo "cross-compile -> \"$ans\"" >&5
2277 cat <<End-of-File >conftest.c
2279 main() { printf("%d", (int)sizeof(long)); }
2281 (eval $ac_compile) 2>&5
2282 (eval $ac_link) 2>&5
2284 echo "./conftest -> \"$ans\"" >&5
2287 if test "$ans" = 4; then
2288 AC_DEFINE(HAVE_32BIT_LONG, [1], [sizeof long])
2289 elif test "$ans" = 8; then
2290 AC_DEFINE(HAVE_64BIT_LONG, [1], [sizeof long])
2293 echo "FATAL ERROR: size of long is not 32 or 64 bits, cannot proceed."
2294 echo "sizeof(char *) -> $ans"
2295 rm -rf conftest conftest.*
2298 rm -rf conftest conftest.*
2300 dnl check sizeof pointer
2301 AC_MSG_CHECKING([sizeof pointer])
2302 if test "$cross_compiling" = "yes"; then
2304 echo "cross-compile -> \"$ans\"" >&5
2306 cat <<End-of-File >conftest.c
2308 main() { printf("%d", (int)sizeof(char *)); }
2310 (eval $ac_compile) 2>&5
2311 (eval $ac_link) 2>&5
2313 echo "./conftest -> \"$ans\"" >&5
2316 if test "$ans" = 4; then
2317 AC_DEFINE(HAVE_32BIT_PTR, [1], [pointer size])
2319 elif test "$ans" = 8; then
2320 AC_DEFINE(HAVE_64BIT_PTR, [1], [pointer size])
2324 echo "FATAL ERROR: size of pointer is not 32 or 64 bits, cannot proceed."
2325 echo "sizeof(char *) -> $ans"
2326 rm -rf conftest conftest.*
2329 rm -rf conftest conftest.*
2331 dnl check sizeof int. If not 32, we die
2332 AC_MSG_CHECKING([sizeof int])
2333 if test "$cross_compiling" = "yes"; then
2335 echo "cross-compile -> \"$ans\"" >&5
2337 cat <<End-of-File >conftest.c
2339 main() { printf("%d", (int)sizeof(int)); }
2341 (eval $ac_compile) 2>&5
2342 (eval $ac_link) 2>&5
2344 echo "./conftest -> \"$ans\"" >&5
2350 echo "FATAL ERROR: sizeof(int) is not 32 bits, cannot proceed."
2351 echo "Note: 32-bit ints are assumed in the PCP external file formats and"
2352 echo " the over-the-wire PDU formats"
2353 rm -rf conftest conftest.*
2356 rm -rf conftest conftest.*
2358 dnl check bit field allocation order within a word
2359 AC_MSG_CHECKING([if bit fields allocated left-to-right])
2360 if test "$cross_compiling" = "yes"; then
2361 ans=$bit_field_scheme
2362 echo "cross-compile -> \"$ans\"" >&5
2364 cat <<End-of-File >conftest.c
2365 union { struct { unsigned int b:4; unsigned int c:4; } a; int p; } u;
2366 main() { u.a.b = 1; u.a.c = 2; printf("%0*x", 2*sizeof(int), u.p); }
2368 (eval $ac_compile) 2>&5
2369 (eval $ac_link) 2>&5
2371 echo "./conftest -> \"$ans\"" >&5
2376 # left-to-right starting from MSB (SGI cc on MIPS), or
2377 # left-to-right ending at LSB
2378 AC_DEFINE(HAVE_BITFIELDS_LTOR, [1], [left-to-right bitfield ordering])
2382 # right-to-left ending at MSB, or
2383 # right-to-left starting from LSB (gcc in Intel)
2387 AC_MSG_RESULT(unknown)
2388 echo "FATAL ERROR: could not fathom your compiler's bit field allocation scheme"
2389 rm -f conftest conftest.*
2393 rm -rf conftest conftest.*
2395 dnl check if compiler can cast __uint64_t to double
2403 double y = (double)x;
2404 ], AC_DEFINE(HAVE_CAST_U64_DOUBLE, [1], [compiler casts u64 to double]))
2406 dnl check if basename and dirname need -lgen, -lpcp or nothing to work
2407 dnl (assume both go together)
2408 AC_CHECK_FUNCS(basename)
2409 if test $ac_cv_func_basename = yes
2411 AC_DEFINE(HAVE_BASENAME, [1], [basename API])
2412 AC_DEFINE(HAVE_DIRNAME, [1], [dirname API])
2415 AC_CHECK_LIB(gen, basename)
2416 if test $ac_cv_lib_gen_basename = yes
2418 AC_DEFINE(HAVE_BASENAME, [1], [basename API])
2419 AC_DEFINE(HAVE_DIRNAME, [1], [dirname API])
2420 lib_for_basename="-lgen"
2422 lib_for_basename="-lpcp"
2425 AC_SUBST(lib_for_basename)
2427 dnl check if clock_gettime needs -lrt to work
2428 lib_for_clock_gettime=
2429 AC_CHECK_FUNCS(clock_gettime)
2430 if test $ac_cv_func_clock_gettime = no
2432 AC_CHECK_LIB(rt, clock_gettime)
2433 if test $ac_cv_lib_rt_clock_gettime = yes
2435 AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [clock_gettime API])
2439 AC_SUBST(lib_for_rt)
2441 dnl check if dlopen et al need -ldl to work
2443 AC_CHECK_FUNCS(dlopen)
2444 if test $ac_cv_func_dlopen = no
2446 AC_CHECK_LIB(dl, dlopen)
2447 if test $ac_cv_lib_dl_dlopen = yes
2449 AC_DEFINE(HAVE_DLOPEN, [1], [dlopen API])
2453 AC_SUBST(lib_for_dlopen)
2455 dnl check if flog10, pow, fpclassify and isnanf are available
2456 dnl in the maths library
2458 AC_CHECK_FUNCS(flog10)
2459 if test $ac_cv_func_flog10 = no
2461 AC_CHECK_LIB(m, flog10)
2462 if test $ac_cv_lib_m_flog10 = yes
2464 AC_DEFINE(HAVE_FLOG10, [1], [flog10 math API])
2468 AC_DEFINE(HAVE_FLOG10, [1], [flog10 math API])
2471 if test $ac_cv_func_pow = no
2473 AC_CHECK_LIB(m, pow)
2474 if test $ac_cv_lib_m_pow = yes
2476 AC_DEFINE(HAVE_POW, [1], [pow math API])
2480 AC_DEFINE(HAVE_POW, [1], [pow math API])
2482 AC_MSG_CHECKING([for fpclassify()])
2483 ac_cv_func_fpclassify=no
2490 if (fpclassify(x) == FP_NAN) exit(1);
2491 ], ac_cv_func_fpclassify=yes)
2492 AC_MSG_RESULT($ac_cv_func_fpclassify)
2493 if test $ac_cv_func_fpclassify = no
2496 AC_MSG_CHECKING([for fpclassify() with -lm])
2505 if (fpclassify(x) == FP_NAN) exit(1);
2506 ], ac_cv_func_fpclassify=yes)
2507 AC_MSG_RESULT($ac_cv_func_fpclassify)
2508 if test $ac_cv_func_fpclassify = yes
2514 if test $ac_cv_func_fpclassify = yes
2516 AC_DEFINE(HAVE_FPCLASSIFY, [1], [fpclassify math API])
2518 dnl prefer fpclassify() but will take isnan() and isnanf() as
2519 dnl possible alternates
2520 AC_CHECK_FUNCS(isnan)
2521 if test $ac_cv_func_isnan = no
2523 AC_CHECK_LIB(m, isnan)
2524 if test $ac_cv_lib_m_isnan = yes
2526 AC_DEFINE(HAVE_ISNAN, [1], [isnan math API])
2530 AC_CHECK_FUNCS(isnanf)
2531 if test $ac_cv_func_isnanf = no
2533 AC_CHECK_LIB(m, isnanf)
2534 if test $ac_cv_lib_m_isnanf = yes
2536 AC_DEFINE(HAVE_ISNANF, [1], [isnanf math API])
2541 AC_SUBST(lib_for_math)
2543 dnl check if we have the SIG_PF typedef
2544 AC_TRY_LINK([#include <signal.h>], [SIG_PF x;],
2545 AC_DEFINE(HAVE_SIGPF, [1], [SIG_PF typedef]))
2547 dnl check if we have the SA_SIGINFO #define
2548 AC_TRY_LINK([#include <signal.h>], [int x = SA_SIGINFO;],
2549 AC_DEFINE(HAVE_SA_SIGINFO, [1], [SA_SIGINFO macro]))
2551 dnl check if we support the SIGPIPE signal
2552 AC_TRY_LINK([#include <signal.h>], [int x = SIGPIPE;],
2553 AC_DEFINE(HAVE_SIGPIPE, [1], [SIGPIPE signal]))
2555 dnl check if we support the SIGHUP signal
2556 AC_TRY_LINK([#include <signal.h>], [int x = SIGHUP;],
2557 AC_DEFINE(HAVE_SIGHUP, [1], [SIGHUP signal]))
2559 dnl check if we support the SIGBUS signal
2560 AC_TRY_LINK([#include <signal.h>], [int x = SIGBUS;],
2561 AC_DEFINE(HAVE_SIGBUS, [1], [SIGBUS signal]))
2563 dnl check if we need to explicitly include signal.h
2564 AC_TRY_LINK([#include <sys/wait.h>],
2565 [ typedef void (*SIGRET)(int);
2567 ], AC_DEFINE(HAVE_WAIT_INCLUDES_SIGNAL, [1], [indirect signal.h]))
2569 dnl check for name and type of time fields in struct stat
2570 dnl IRIX example timespec_t st_mtim;
2571 dnl Linux example struct timespec st_mtim;
2572 dnl Darwin example struct timespec st_mtimespec;
2573 dnl Solaris example timestruc_t st_mtim;
2574 dnl FreeBSD (6.1) struct timespec st_mtimespec;
2575 dnl struct timespec {
2580 have_stat_type=false
2581 have_stat_name=false
2582 if test $have_stat_name = false
2585 changequote(<<, >>)<<[ ]st_mtimespec>>changequote([, ]),
2586 sys/stat.h, [ have_stat_name=true;
2587 AC_DEFINE(HAVE_ST_MTIME_WITH_SPEC, [1], [st_mtimespec stat field]) ])
2589 if test $have_stat_name = false -a $target_os != darwin -a $target_os != linux -a $target_os != kfreebsd -a $target_os != netbsd
2592 changequote(<<, >>)<<[ ]st_mtime>>changequote([, ]),
2593 sys/stat.h, [ have_stat_name=true;
2594 AC_DEFINE(HAVE_ST_MTIME_WITH_E, [1], [st_mtime stat field]) ])
2596 if test $have_stat_type = false
2599 changequote(<<, >>)<<timestruc_t[ ][ ]*st_mtim>>changequote([, ]),
2600 sys/stat.h, [ have_stat_type=true;
2601 AC_DEFINE(HAVE_STAT_TIMESTRUC, [1], [timestruc_t type]) ])
2603 if test $have_stat_type = false
2606 changequote(<<, >>)<<timespec_t[ ][ ]*st_mtim>>changequote([, ]),
2607 sys/stat.h, [ have_stat_type=true;
2608 AC_DEFINE(HAVE_STAT_TIMESPEC_T, [1], [timespec_t type]) ])
2610 if test $have_stat_type = false
2613 changequote(<<, >>)<<timespec[ ][ ]*st_mtim>>changequote([, ]),
2614 sys/stat.h, [ have_stat_type=true;
2615 AC_DEFINE(HAVE_STAT_TIMESPEC, [1], [timespec type]) ])
2617 if test $have_stat_type = false
2620 changequote(<<, >>)<<time_t[ ][ ]*st_mtim>>changequote([, ]),
2621 sys/stat.h, [ have_stat_type=true;
2622 AC_DEFINE(HAVE_STAT_TIME_T, [1], [time_t type]) ])
2624 if test $have_stat_type = false
2626 echo 'FATAL ERROR: Cannot determine struct stat time types.'
2627 rm -rf conftest conftest.*
2632 dnl Work out where to install stuff for this package
2633 dnl (and where to find stuff at run-time for add-on packages).
2637 dnl Predictable directory containing pcp.conf, or overridden
2638 dnl by the $PCP_CONF environment variable. If this is not set
2639 dnl (default /etc/pcp.conf), then $PCP_CONF must be set in
2640 dnl the environment.
2642 dnl The eval echo stuff is used to get around unfavourable
2643 dnl elements of the GNU standards, which cause embedding of
2644 dnl ${prefix} within many of these various $dirs.
2645 dnl http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables
2647 pcp_etc_dir=`eval echo $sysconfdir`
2648 pcp_etc_dir=`eval echo $pcp_etc_dir`
2649 AC_SUBST(pcp_etc_dir)
2650 pcp_saslconf_dir=`eval echo $sysconfdir/sasl2`
2651 pcp_saslconf_dir=`eval echo $pcp_saslconf_dir`
2652 AC_SUBST(pcp_saslconf_dir)
2653 pcp_sysconf_dir=`eval echo $sysconfdir/pcp`
2654 pcp_sysconf_dir=`eval echo $pcp_sysconf_dir`
2655 AC_SUBST(pcp_sysconf_dir)
2656 pcp_pmcdconf_path=$pcp_sysconf_dir/pmcd/pmcd.conf
2657 pcp_pmcdrclocal_path=$pcp_sysconf_dir/pmcd/rc.local
2658 pcp_pmcdoptions_path=$pcp_sysconf_dir/pmcd/pmcd.options
2659 pcp_pmwebdoptions_path=$pcp_sysconf_dir/pmwebd/pmwebd.options
2660 pcp_pmmgroptions_path=$pcp_sysconf_dir/pmmgr/pmmgr.options
2661 pcp_pmproxyoptions_path=$pcp_sysconf_dir/pmproxy/pmproxy.options
2662 pcp_pmiecontrol_path=$pcp_sysconf_dir/pmie/control
2663 pcp_pmsnapcontrol_path=$pcp_sysconf_dir/pmsnap/control
2664 pcp_pmloggercontrol_path=$pcp_sysconf_dir/pmlogger/control
2665 AC_SUBST(pcp_pmcdconf_path)
2666 AC_SUBST(pcp_pmcdoptions_path)
2667 AC_SUBST(pcp_pmcdrclocal_path)
2668 AC_SUBST(pcp_pmwebdoptions_path)
2669 AC_SUBST(pcp_pmmgroptions_path)
2670 AC_SUBST(pcp_pmproxyoptions_path)
2671 AC_SUBST(pcp_pmiecontrol_path)
2672 AC_SUBST(pcp_pmsnapcontrol_path)
2673 AC_SUBST(pcp_pmloggercontrol_path)
2675 dnl shared PCP files (shareable for diskless)
2676 pcp_share_dir=`eval echo $datarootdir/pcp`
2677 pcp_share_dir=`eval echo $pcp_share_dir`
2678 AC_SUBST(pcp_share_dir)
2680 dnl private PCP executables
2681 pcp_binadm_dir=`eval echo $libexecdir/pcp/bin`
2682 pcp_binadm_dir=`eval echo $pcp_binadm_dir`
2683 AC_SUBST(pcp_binadm_dir)
2685 dnl non-shared (i.e. system local) PCP files
2686 pcp_var_dir=`eval echo $localstatedir/lib/pcp`
2687 pcp_var_dir=`eval echo $pcp_var_dir`
2688 AC_SUBST(pcp_var_dir)
2690 dnl pmcd control and options files
2691 AC_ARG_WITH(configdir,[AC_HELP_STRING([--with-configdir],[configuration directory [LOCALSTATEDIR/pcp/config]])],
2692 [pcp_config_dir=$withval],
2693 [pcp_config_dir=$pcp_var_dir/config])
2695 pcp_pmdas_dir=$pcp_var_dir/pmdas
2696 AC_SUBST(pcp_pmdas_dir)
2698 dnl runtime shared libraries
2699 pcp_lib_dir=`eval echo $libdir`
2700 pcp_lib_dir=`eval echo $pcp_lib_dir`
2701 pcp_lib32_dir=`echo $pcp_lib_dir | sed -e s,64,, -e s,//,/,`
2702 AC_SUBST(pcp_lib_dir)
2703 AC_SUBST(pcp_lib32_dir)
2706 AC_ARG_WITH(perl_installdirs,[AC_HELP_STRING([--with-perl_installdirs],[perl installdirs [vendor]])],
2707 [perl_installdirs=$withval],
2708 [perl_installdirs=vendor])
2709 perl_installdirs=`eval echo $perl_installdirs`
2710 perl_installdirs=`eval echo $perl_installdirs`
2711 AC_SUBST(perl_installdirs)
2712 AC_ARG_WITH(perl_install_base,[AC_HELP_STRING([--with-perl_install_base],[perl install_base [PREFIX]])],
2713 [perl_install_base=$withval],
2714 [perl_install_base=$prefix])
2715 perl_install_base=`eval echo $perl_install_base`
2716 perl_install_base=`eval echo $perl_install_base`
2717 AC_SUBST(perl_install_base)
2719 AC_ARG_WITH(python_prefix,[AC_HELP_STRING([--with-python_prefix],[python setup.py prefix [PREFIX]])],
2720 [python_prefix=$withval],
2721 [python_prefix=$prefix])
2722 python_prefix=`eval echo $python_prefix`
2723 python_prefix=`eval echo $python_prefix`
2724 AC_SUBST(python_prefix)
2727 pcp_x11_incflags=$X_CFLAGS
2728 AC_SUBST(pcp_x11_incflags)
2729 pcp_x11_libflags=$X_LIBS
2730 AC_SUBST(pcp_x11_libflags)
2731 pcp_x11_extra=$X_EXTRA_LIBS
2732 AC_SUBST(pcp_x11_extra)
2733 pcp_x11_pre=$X_PRE_LIBS
2734 AC_SUBST(pcp_x11_pre)
2736 dnl man pages (source)
2737 have_gzipped_manpages=false
2738 have_bzip2ed_manpages=false
2739 have_lzmaed_manpages=false
2740 have_xzed_manpages=false
2741 need_old_tbl_header=false
2743 pcp_man_dir=`eval echo $mandir`
2744 pcp_man_dir=`eval echo $pcp_man_dir`
2746 dnl guess compression in use
2747 for d in /usr/man /usr/share/man $pcp_man_dir
2749 for sd in man1 sman1
2751 if test -f $d/$sd/man.1.gz
2753 have_gzipped_manpages=true
2754 man_header=`$ZIP -d < $d/$sd/man.1.gz | head -1`
2756 elif test -f $d/$sd/man.1.bz2
2758 have_bzip2ed_manpages=true
2759 man_header=`$BZIP2 -d < $d/$sd/man.1.bz2 | head -1`
2761 elif test -f $d/$sd/man.1.lzma
2763 have_lzmaed_manpages=true
2764 man_header=`$LZMA -d < $d/$sd/man.1.lzma | head -1`
2766 elif test -f $d/$sd/man.1.xz
2768 have_xzed_manpages=true
2769 man_header=`$XZ -d < $d/$sd/man.1.xz | head -1`
2771 elif test -f $d/$sd/man.1
2773 man_header=`head -1 $d/$sd/man.1`
2778 if test x"$man_header" = "x'\\\" t" -o x"$man_header" = "x'\\\" te" ; then
2779 need_old_tbl_header=true
2781 AC_SUBST(pcp_man_dir)
2782 AC_SUBST(have_gzipped_manpages)
2783 AC_SUBST(have_bzip2ed_manpages)
2784 AC_SUBST(have_lzmaed_manpages)
2785 AC_SUBST(have_xzed_manpages)
2786 AC_SUBST(need_old_tbl_header)
2789 pcp_bin_dir=`eval echo $bindir`
2790 pcp_bin_dir=`eval echo $pcp_bin_dir`
2791 AC_SUBST(pcp_bin_dir)
2793 pcp_sbin_dir=`eval echo $sbindir`
2794 pcp_sbin_dir=`eval echo $pcp_sbin_dir`
2795 AC_SUBST(pcp_sbin_dir)
2798 pcp_inc_dir=`eval echo $includedir/pcp`
2799 pcp_inc_dir=`eval echo $pcp_inc_dir`
2800 AC_SUBST(pcp_inc_dir)
2802 dnl books - pdfs, html
2803 if test $target_os = linux; then
2804 pcp_books_dir=`eval echo $datarootdir/doc/pcp-doc`
2806 pcp_books_dir=`eval echo $datarootdir/doc/pcp`
2808 pcp_books_dir=`eval echo $pcp_books_dir`
2809 pcp_html_dir=`eval echo $pcp_books_dir/html`
2810 AC_SUBST(pcp_books_dir)
2811 AC_SUBST(pcp_html_dir)
2813 dnl icon pixmap files
2814 if test $target_os = linux; then
2815 pcp_icons_dir=`eval echo $datarootdir/pcp-gui/pixmaps`
2817 pcp_icons_dir=`eval echo $datarootdir/pcp/pixmaps`
2819 pcp_icons_dir=`eval echo $pcp_icons_dir`
2820 AC_SUBST(pcp_icons_dir)
2822 dnl desktop application entries
2823 pcp_desktop_dir=`eval echo $datarootdir/applications`
2824 pcp_desktop_dir=`eval echo $pcp_desktop_dir`
2825 AC_SUBST(pcp_desktop_dir)
2827 dnl rc/startup files
2828 AC_ARG_WITH(rcdir,[AC_HELP_STRING([--with-rcdir],[rc directory [SYSCONFDIR/rc.d]])],
2829 [pcp_rc_dir=$withval], [
2832 pcp_rc_dir="$pcp_share_dir/lib"
2834 pcp_rc_dir="$pcp_etc_dir/init.d"
2836 AC_SUBST(pcp_rc_dir)
2838 dnl rc sysconfig dir
2839 AC_ARG_WITH(sysconfigdir,[AC_HELP_STRING([--with-sysconfigdir],[sysconfig directory [SYSCONFDIR/sysconfig]])],
2840 [pcp_sysconfig_dir=$withval],
2841 [pcp_sysconfig_dir=$pcp_etc_dir/sysconfig])
2842 AC_SUBST(pcp_sysconfig_dir)
2845 AC_ARG_WITH(logdir,[AC_HELP_STRING([--with-logdir],[log directory [LOCALSTATEDIR/log/pcp]])],
2846 [pcp_log_dir=$withval],
2847 [pcp_log_dir=$localstatedir/log/pcp])
2848 pcp_log_dir=`eval echo $pcp_log_dir`
2849 pcp_log_dir=`eval echo $pcp_log_dir`
2850 AC_SUBST(pcp_log_dir)
2852 AC_ARG_WITH(rundir,[AC_HELP_STRING([--with-rundir],[run directory [LOCALSTATEDIR/run/pcp]])],
2853 [pcp_run_dir=$withval],
2854 [pcp_run_dir=$localstatedir/run/pcp])
2855 pcp_run_dir=`eval echo $pcp_run_dir`
2856 pcp_run_dir=`eval echo $pcp_run_dir`
2857 AC_SUBST(pcp_run_dir)
2859 dnl world-writeable temporary files directory
2860 AC_ARG_WITH(tmpdir,[AC_HELP_STRING([--with-tmpdir],[tmp directory [LOCALSTATEDIR/tmp]])],
2861 [pcp_tmpfile_dir=$withval],
2862 [pcp_tmpfile_dir=$localstatedir/tmp])
2863 pcp_tmpfile_dir=`eval echo $pcp_tmpfile_dir`
2864 pcp_tmpfile_dir=`eval echo $pcp_tmpfile_dir`
2865 AC_SUBST(pcp_tmpfile_dir)
2867 dnl non-world-writeable status files directory
2868 pcp_tmp_dir=`eval echo $pcp_var_dir/tmp`
2869 AC_SUBST(pcp_tmp_dir)
2872 AC_ARG_WITH(docdir,[AC_HELP_STRING([--with-docdir],[docs directory [DOCDIR/pcp-VERSION]])],
2873 [pcp_doc_dir=$withval],
2874 [PACKAGE=pcp-${PACKAGE_VERSION}; pcp_doc_dir=$docdir])
2875 pcp_doc_dir=`eval echo $pcp_doc_dir`
2876 pcp_doc_dir=`eval echo $pcp_doc_dir`
2877 AC_SUBST(pcp_doc_dir)
2880 AC_ARG_WITH(demosdir,[AC_HELP_STRING([--with-demosdir],[run directory [DATADIR/pcp/demos]])],
2881 [pcp_demos_dir=$withval],
2882 [pcp_demos_dir=$pcp_share_dir/demos])
2883 AC_SUBST(pcp_demos_dir)
2885 if test -z "$XCONFIRM"
2887 AC_PATH_PROG(ac_xconfirm_prog, xconfirm, $pcp_bin_dir/pmconfirm)
2889 ac_xconfirm_prog=$XCONFIRM
2891 AC_SUBST(ac_xconfirm_prog)
2893 dnl Check for FNDELAY defined in <fcntl.h>
2894 if test "$ac_cv_header_fcntl_h" = "yes"
2896 AC_MSG_CHECKING([for FNDELAY in fcntl.h])
2897 AC_TRY_COMPILE([#include <fcntl.h>],
2898 [ int i = FNDELAY; ],
2899 AC_DEFINE(HAVE_FNDELAY, [1], [FNDELAY macro])
2900 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2903 dnl check for zpool_vdev_name API style from <libzfs.h>
2904 if test "$ac_cv_header_libzfs_h" = "yes"
2906 AC_MSG_CHECKING([for 5-argument style zpool_vdev_name])
2907 AC_TRY_COMPILE([#include <libzfs.h>],
2908 [ libzfs_handle_t *zh;
2911 (void) zpool_vdev_name(zh, zp, np, B_FALSE, B_FALSE);
2913 AC_DEFINE(HAVE_ZPOOL_VDEV_NAME_5ARG, [1], [5-arg zpool_vdev_name])
2914 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2916 AC_MSG_CHECKING([for 4-argument style zpool_vdev_name])
2917 AC_TRY_COMPILE([#include <libzfs.h>],
2918 [ libzfs_handle_t *zh;
2921 (void) zpool_vdev_name(zh, zp, np, B_FALSE);
2923 AC_DEFINE(HAVE_ZPOOL_VDEV_NAME_4ARG, [1], [4-arg zpool_vdev_name])
2924 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2927 dnl Check for Network Security Services (NSS) and
2928 dnl Simple Authentication and Security Layer (SASL)
2929 if test "$do_secure" = "check" -o "$do_secure" = "yes"
2933 saved_CFLAGS="$CFLAGS"
2934 saved_CPPFLAGS="$CPPFLAGS"
2935 NSS_INC_DIRS="-I/usr/include/nss -I/usr/include/nss3"
2936 NSPR_INC_DIRS="-I/usr/include/nspr -I/usr/include/nspr4"
2937 CFLAGS="$CFLAGS $NSS_INC_DIRS $NSPR_INC_DIRS"
2938 CPPFLAGS="$CPPFLAGS $NSS_INC_DIRS $NSPR_INC_DIRS"
2940 AC_CHECK_HEADERS([nss/nss.h], [NSSCFLAGS=-I/usr/include/nss], [
2941 AC_CHECK_HEADERS([nss3/nss.h], [NSSCFLAGS=-I/usr/include/nss3], [
2943 if test "$do_secure" = "yes"
2945 AC_MSG_ERROR([cannot enable secure sockets mode - no NSS header])
2951 AC_CHECK_HEADERS([nspr/nspr.h], [NSPRCFLAGS=-I/usr/include/nspr], [
2952 AC_CHECK_HEADERS([nspr4/nspr.h], [NSPRCFLAGS=-I/usr/include/nspr4], [
2954 if test "$do_secure" = "yes"
2956 AC_MSG_ERROR([cannot enable secure sockets mode - no NSPR header])
2960 AC_SUBST(NSPRCFLAGS)
2962 AC_CHECK_HEADERS([sasl/sasl.h], [SASLCFLAGS=-I/usr/include/sasl], [
2964 if test "$do_secure" = "yes"
2966 AC_MSG_ERROR([cannot enable secure sockets mode - no SASL header])
2969 AC_SUBST(SASLCFLAGS)
2971 AC_CHECK_LIB(sasl2, sasl_server_init, [lib_for_sasl="-lsasl2"], [
2973 if test "$do_secure" = "yes"
2975 AC_MSG_ERROR([cannot enable secure sockets mode - no SASL library])
2978 AC_SUBST(lib_for_sasl)
2980 AC_CHECK_LIB(ssl, SSL_ImportFD, [lib_for_ssl="-lssl"], [
2981 AC_CHECK_LIB(ssl3, SSL_ImportFD, [lib_for_ssl="-lssl3"], [
2983 if test "$do_secure" = "yes"
2985 AC_MSG_ERROR([cannot enable secure sockets mode - no SSL library])
2989 AC_SUBST(lib_for_ssl)
2991 AC_CHECK_LIB(nss, NSS_Init, [lib_for_nss="-lnss"], [
2992 AC_CHECK_LIB(nss3, NSS_Init, [lib_for_nss="-lnss3"], [
2994 if test "$do_secure" = "yes"
2996 AC_MSG_ERROR([cannot enable secure sockets mode - no NSS library])
3000 AC_SUBST(lib_for_nss)
3002 AC_CHECK_LIB(nspr, PR_Init, [lib_for_nspr="-lnspr"], [
3003 AC_CHECK_LIB(nspr4, PR_Init, [lib_for_nspr="-lnspr4"], [
3005 if test "$do_secure" = "yes"
3007 AC_MSG_ERROR([cannot enable secure sockets mode - no NSPR library])
3011 AC_SUBST(lib_for_nspr)
3013 if test "$enable_secure" = "true"
3015 AC_DEFINE(HAVE_SECURE_SOCKETS, [1], [Encrypted sockets])
3017 AC_SUBST(enable_secure)
3019 CPPFLAGS="$saved_CPPFLAGS"
3020 CFLAGS="$saved_CFLAGS"
3023 dnl check for -latomic, needed for some -march=i386 builds with i686 c++ distro headers
3024 AC_CHECK_LIB(atomic, __atomic_fetch_add_4, [lib_for_atomic="-latomic"])
3025 AC_SUBST(lib_for_atomic)
3027 dnl check for array sessions
3028 if test -f /usr/include/sn/arsess.h
3030 pcp_mpi_dirs=libpcp_mpi\ libpcp_mpiread
3034 AC_SUBST(pcp_mpi_dirs)
3036 dnl check for Unix Domain socket family structure
3037 AC_MSG_CHECKING([for struct sockaddr_un in sys/un.h])
3039 #include <sys/types.h>
3040 #ifdef HAVE_SYS_SOCKET_H
3041 #include <sys/socket.h>
3043 #ifdef HAVE_SYS_UN_H
3046 ], [ struct sockaddr_un sa; sa.sun_family = AF_UNIX; ],
3047 AC_DEFINE(HAVE_STRUCT_SOCKADDR_UN, [1], [sockaddr_un type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3049 dnl check for Linux Unix Domain socket credential structure
3050 AC_MSG_CHECKING([for struct ucred in sys/socket.h])
3052 #include <sys/types.h>
3053 #ifdef HAVE_SYS_SOCKET_H
3054 #include <sys/socket.h>
3056 #ifdef HAVE_SYS_UN_H
3059 ], [ struct ucred ucred; ucred.uid = 0; ],
3060 AC_DEFINE(HAVE_STRUCT_UCRED, [1], [ucred type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3062 dnl check for struct timespec in <time.h>
3063 AC_MSG_CHECKING([for struct timespec in time.h])
3066 ], [ struct timespec foo; ],
3067 AC_DEFINE(HAVE_STRUCT_TIMESPEC, [1], [timespec type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3069 dnl check if we have IRIX style altzone
3070 AC_MSG_CHECKING([for altzone in time.h])
3073 ], [ time_t az = altzone; ],
3074 AC_DEFINE(HAVE_ALTZONE, [1], [altzone global]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3076 dnl If there is no altzone, check if strftime can handle %z
3077 AC_MSG_CHECKING([if strftime knows about %z])
3083 time_t t = time(NULL);
3084 struct tm * t1 = localtime (&t);
3085 if (strftime (b, 32, "%z", t1) < 3)
3087 if (strcmp(b, "%z") == 0)
3091 ], AC_DEFINE(HAVE_STRFTIME_z, [1], [strftime with %z]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
3093 dnl does strerror_r return char * a la GNU
3094 dnl (as opposed to the int return for XSI-compliant variants)
3095 AC_MSG_CHECKING([if strerror_r returns char *])
3097 [#include <string.h>], [strerror_r(0, NULL, 0)[0];],
3098 AC_DEFINE(HAVE_STRERROR_R_PTR, [1], [strerror_r return]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3100 dnl first check for readline on its own then with curses
3105 AC_CHECK_FUNC(readline,,
3107 AC_CHECK_LIB(readline, readline,,
3109 dnl AC seems to cache lib/func results
3110 dnl so use another readline func here
3111 AC_CHECK_LIB(readline, add_history,,,[-lcurses])
3114 if test $ac_cv_func_readline = yes
3116 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3117 elif test $ac_cv_lib_readline_readline = yes
3119 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3120 lib_for_readline=-lreadline
3121 elif test $ac_cv_lib_readline_add_history = yes
3123 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3124 lib_for_curses=-lcurses
3125 lib_for_readline=-lreadline
3127 AC_SUBST(lib_for_readline)
3128 AC_SUBST(lib_for_curses)
3132 PKG_CHECK_MODULES([zlib], [zlib >= 1.0.0], [have_zlib=true], [have_zlib=false])
3133 AC_SUBST(HAVE_ZLIB, [$have_zlib])
3135 dnl Check if we have AI_ADDRCONFIG
3136 AC_MSG_CHECKING([for AI_ADDRCONFIG])
3140 int test = AI_ADDRCONFIG;
3143 ], AC_DEFINE(HAVE_AI_ADDRCONFIG, [1], [AI_ADDRCONFIG macro]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3145 dnl Find external source tarballs for packaging
3148 if test -f ./build/tar/vector.tar.gz
3150 AC_MSG_NOTICE([adding Vector webapp to the build])
3153 AC_SUBST(have_vector)
3156 if test -f ./build/tar/webjs.tar.gz
3158 AC_MSG_NOTICE([adding webjs webapps to the build])
3161 AC_SUBST(have_webjs)
3163 dnl Capture special options passed to configure
3164 AC_SUBST(PACKAGE_CONFIGURE)
3171 dnl Build definitions for use in Makefiles
3172 src/include/builddefs
3173 dnl PCP paths and other defs
3174 src/include/pcp.conf
3175 dnl Linux Software Map entry
3177 dnl Preamble for deb install scripts
3178 debian/pcp.preinst.head
3179 debian/pcp.postinst.head
3180 dnl Preamble for tar install scripts
3181 build/tar/preinstall.head
3182 build/tar/postinstall.head
3183 dnl Build definitions for use in packaging
3185 build/mac/uninstall-pcp
3188 dnl verbose diagnostics
3190 dnl echo config.status: settings dump begin
3191 dnl grep '^S.".*=' config.status
3192 dnl echo config.status: settings dump end