2 dnl Copyright (c) 2012-2017 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)
20 dnl need 2.63 for AS_VAR_IF and AS_VAR_COPY
23 dnl Irix build issue ... use the tools from the local filesystems
28 [AS_HELP_STRING([--with-64bit],
29 [turn on 64 bit compilation mode (default is platform dependent)])],
30 [use_64bit=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-64bit=$withval"])
34 [AS_HELP_STRING([--with-optimization],
35 [enable optimization for C/C++ code (default is yes)])],
36 [use_optimization=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-optimization=$withval"],
37 [use_optimizaton=yes])
41 [AC_HELP_STRING([--with-threads],
42 [enable support for multiple threads (default is on)])],
43 [do_threads=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-threads=$withval"],
48 [AC_HELP_STRING([--with-secure-sockets],
49 [enable support for secure sockets (default is on)])],
50 [do_secure=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-secure-sockets=$withval"],
55 [AC_HELP_STRING([--with-static-probes],
56 [enable support for static probes (default is on)])],
57 [do_probes=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-static-probes=$withval"],
62 [AC_HELP_STRING([--with-infiniband],
63 [enable support for Infiniband metrics (default is on)])],
64 [do_infiniband=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-infiniband=$withval"],
65 [do_infiniband=check])
69 [AS_HELP_STRING([--with-user],
70 [user account under which daemons run (default is pcp)])],
71 [pcp_user=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-user-account=$withval"],
77 [AS_HELP_STRING([--with-group],
78 [user group under which daemons run (default is pcp)])],
79 [pcp_group=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-group-account=$withval"],
83 AC_ARG_WITH([discovery],
84 [AC_HELP_STRING([--with-discovery],
85 [enable support for service discovery (default is on)])],
86 [do_discovery=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-discovery=$withval"],
89 AC_ARG_WITH([systemd],
90 [AC_HELP_STRING([--with-systemd],
91 [enable support for systemd services (default is on)])],
92 [do_systemd=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-systemd=$withval"],
96 [AC_HELP_STRING([--with-qt],
97 [enable support for tools requiring Qt (default is on)])],
98 [do_qt=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-qt=$withval"],
102 [AC_HELP_STRING([--with-qt3d],
103 [enable support for 3D scene graph API (default is on)])],
104 [do_qt3d=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-qt3d=$withval"],
107 AC_ARG_WITH([python],
108 [AC_HELP_STRING([--with-python],
109 [enable support for tools requiring Python (default is on)])],
110 [do_python=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-python=$withval"],
113 AC_ARG_WITH([python3],
114 [AC_HELP_STRING([--with-python3],
115 [enable support for tools requiring Python3 (default is on)])],
116 [do_python3=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-python3=$withval"],
120 [AC_HELP_STRING([--with-books],
121 [enable building of the PCP books (default is off)])],
122 [do_books=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-books=$withval"],
125 AC_ARG_WITH([books-brand],
126 [AC_HELP_STRING([--with-books-brand=BRAND],
127 [choose the docbook brand when building the PCP books (default is common)])],
128 [do_books_brand=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-books-brand=$withval"],
129 [do_books_brand=common])
132 [AC_HELP_STRING([--with-papi@<:@=DIR|=MODULE@:>@],
133 [enable performance api counter pmda (default is on)
134 The optional argument may be a full path of a PAPI installation prefix,
135 or a pkgconfig module name.])],
136 [do_papi=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-papi=$withval"],
139 AC_ARG_WITH([perfevent],
140 [AC_HELP_STRING([--with-perfevent],
141 [enable perfevent pmda (default is on)])],
142 [do_perfevent=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-perfevent=$withval"],
143 [do_perfevent=check])
145 AC_ARG_WITH([pmdajson],
146 [AC_HELP_STRING([--with-pmdajson],
147 [enable JSON pmda (default is on)])],
148 [do_pmdajson=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-pmdajson=$withval"],
151 AC_ARG_WITH([pmdasnmp],
152 [AC_HELP_STRING([--with-pmdasnmp],
153 [enable SNMP pmda (default is on)])],
154 [do_pmdasnmp=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-pmdasnmp=$withval"],
157 AC_ARG_WITH([manager],
158 [AC_HELP_STRING([--with-manager],
159 [enable daemon manager (default is on)])],
160 [do_manager=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-manager=$withval"],
163 AC_ARG_WITH([webapi],
164 [AC_HELP_STRING([--with-webapi],
165 [enable REST API daemon (default is on)])],
166 [do_webapi=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-webapi=$withval"],
170 [AC_HELP_STRING([--with-webjs],
171 [enable building of webjs packages (default is off)])],
172 [do_webjs=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-webjs=$withval"],
175 AC_ARG_WITH([vector],
176 [AC_HELP_STRING([--with-vector],
177 [enable building of vector package (default is off)])],
178 [do_vector=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-vector=$withval"],
181 AC_ARG_WITH([parfait],
182 [AC_HELP_STRING([--with-parfait],
183 [enable building of parfait package (default is off)])],
184 [do_parfait=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-parfait=$withval"],
187 AC_ARG_WITH([selinux],
188 [AC_HELP_STRING([--with-selinux],
189 [enable building of selinux package (default is on)])],
190 [do_selinux=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-selinux=$withval"],
192 dnl things set in the environment by Makepkgs never make it into an RPM
193 dnl build where the environment is stripped ... use a --with-foo=path
194 dnl construct to workaround this
197 [AC_HELP_STRING([--with-make],
198 [path to GNU compatible make(1) (default is empty for auto discovery)])],
199 [MAKE=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-make=$withval"],
203 [AC_HELP_STRING([--with-tar],
204 [path to GNU compatible tar(1) (default is empty for auto discovery)])],
205 [TAR=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-tar=$withval"],
209 [AC_HELP_STRING([--with-zip],
210 [path to GNU compatible zip(1) (default is empty for auto discovery)])],
211 [ZIP=$withval; PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --with-zip=$withval"],
215 dnl Note: the following environment variables may be set to override defaults:
216 dnl MAKE CC CPP LD LEX YACC INSTALL AWK SED ECHO
219 dnl Guess target platfrom
224 FATAL ERROR: Cannot guess your target, try explicit specification
225 using --target or mailto: pcp@groups.io to ask.'
226 rm -rf conftest conftest.*
229 dnl Remove 4th name component, if present, from target, target_os,
230 dnl build and build_os. Squash all x86 cpus into one LCD form - i386
231 target=`echo $target | sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'`
232 target_os=`echo $target_os | sed '[s/solaris2\..*/solaris/]'`
233 target_os=`echo $target_os | sed '[s/^\([^-][^-]*\)-.*$/\1/]' | sed '[s/[\.0-9]*//g]'`
235 build=`echo $build | sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'`
236 build_os=`echo $build_os | sed '[s/solaris2\..*/solaris/]'`
237 build_os=`echo $build_os | sed '[s/^\([^-][^-]*\)-.*$/\1/]'`
240 echo Building on $build for $target
241 echo "Build: os=$build_os cpu=$build_cpu"
242 echo "Target: os=$target_os cpu=$target_cpu"
244 if test "$cross_compiling" = "yes"; then
245 if test -f ./config.$target_os; then
246 . ./config.$target_os
250 FATAL ERROR: Cannot perform cross-compilation without a file to source
251 configuration information from (config.$target_os is missing)"
252 rm -rf conftest conftest.*
256 AC_SUBST(cross_compiling)
258 dnl CFLAGS setting is a co-dependency between here and PCFLAGS in
259 dnl src/include/builddefs.in ... need to be the same in both places
261 target_distro=$target_os
262 if test $target_os = linux
264 AC_DEFINE(IS_LINUX, [1], [Platform is Linux])
265 test -f /etc/SuSE-release && target_distro=suse
266 test -f /etc/fedora-release && target_distro=fedora
267 test -f /etc/redhat-release && target_distro=redhat
268 test -f /etc/debian_version && target_distro=debian
269 test -f /etc/slackware-version && target_distro=slackware
270 test -f /etc/gentoo-release && target_distro=gentoo
271 test -f /etc/mandriva-release && target_distro=mandriva
272 test -f /etc/arch-release && target_distro=arch
273 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE"
274 pcp_platform_paths='/usr/bin/X11:/usr/local/bin'
275 pcp_ps_all_flags=-efw
276 elif test $target_os = darwin
278 AC_DEFINE(IS_DARWIN, [1], [Platform is Darwin (Mac OS X)])
280 version=`sw_vers -productVersion | sed -e 's/\.//' -e 's/\..*//g'`
281 CFLAGS="-fPIC -no-cpp-precomp -fno-strict-aliasing -arch i386"
282 if test $version -ge 106
285 CFLAGS="$CFLAGS -arch x86_64"
288 pcp_platform_paths='/usr/local/bin'
289 pcp_ps_all_flags="-axw -o user,pid,ppid,cpu,stime,tty,time,command"
290 elif test $target_os = mingw
292 AC_DEFINE(IS_MINGW, [1], [Platform is MinGW (Windows)])
293 CFLAGS="-fno-strict-aliasing"
294 pcp_platform_paths=''
295 pcp_ps_all_flags=-efW
296 elif test $target_os = solaris
298 AC_DEFINE(IS_SOLARIS, [1], [Platform is Solaris])
299 export CFLAGS_IF_GCC="-fPIC -fno-strict-aliasing"
300 export CFLAGS_IF_SUNCC="-fPIC -xalias_level=any -D_XPG4_2 -D__EXTENSIONS__"
301 pcp_platform_paths='/usr/bin/X11:/usr/local/bin:/opt/sfw/bin:/opt/csw/bin'
303 elif test $target_os = aix
305 AC_DEFINE(IS_AIX, [1], [Platform is AIX])
306 export CFLAGS="-qcpluscmt"
307 pcp_platform_paths='/usr/bin/X11:/usr/local/bin'
309 elif test $target_os = freebsd || test $target_os = kfreebsd
311 AC_DEFINE(IS_FREEBSD, [1], [Platform is FreeBSD])
312 test -f /etc/debian_version && target_distro=debian
313 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE"
314 if test $target_os = kfreebsd
316 pcp_ps_all_flags=-efw
318 pcp_ps_all_flags=auxww
320 pcp_platform_paths='/usr/bin/X11'
321 test -d /usr/local/bin && pcp_platform_paths="$pcp_platform_paths:/usr/local/bin"
322 test -d /usr/bsd && pcp_platform_paths="$pcp_platform_paths:/usr/bsd"
323 elif test $target_os = gnu
325 AC_DEFINE(IS_GNU, [1], [Platform is GNU Hurd])
326 test -f /etc/debian_version && target_distro=debian
327 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE"
328 pcp_platform_paths='/usr/bin/X11:/usr/local/bin'
329 pcp_ps_all_flags=-efw
330 elif test $target_os = netbsdelf
333 AC_DEFINE(IS_NETBSD, [1], [Platform is NetBSD])
334 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE -D_NETBSD_SOURCE"
335 pcp_platform_paths='/usr/pkg/bin'
336 pcp_ps_all_flags=auxww
337 elif test $target_os = openbsd
340 AC_DEFINE(IS_OPENBSD, [1], [Platform is OpenBSD])
341 export CFLAGS="-fPIC -fno-strict-aliasing -D_GNU_SOURCE"
342 pcp_platform_paths='/usr/local/bin'
343 pcp_ps_all_flags=auxww
346 echo "FATAL ERROR: need platform-specific customization for \"$target_os\""
347 rm -rf conftest conftest.*
350 AC_SUBST(pcp_platform_paths)
351 AC_SUBST(pcp_ps_all_flags)
353 dnl default C and C++ compiler optimization to -O2 -g
354 if test "$use_optimization" = no
356 optimization="-O0 -g"
358 optimization="-O2 -g"
360 AC_SUBST(optimization)
363 if test -z "$PKG_CONFIG"; then
364 AC_MSG_ERROR([cannot find a 'pkg-config' command])
367 dnl check if user wants their own C compiler
369 AC_PROG_CC(suncc egcc gcc cc)
370 if test $target_os = solaris
372 AC_PATH_PROG(CCPATH,$CC,$CC)
374 if test "$GCC" = "yes"
376 CFLAGS="$CFLAGS $CFLAGS_IF_GCC"
378 CFLAGS="$CFLAGS $CFLAGS_IF_SUNCC"
380 if test "$use_64bit" = "no"
384 AC_MSG_CHECKING([for 64 bit Solaris host])
389 CFLAGS="$CFLAGS -m64"
390 LDFLAGS="$LDFLAGS -m64"
405 dnl these become CFLAGS and LDFLAGS for the build
409 if echo "$CFLAGS" | grep 'D_FORTIFY_SOURCE' >/dev/null
411 dnl for cc use locally in configure (not exported via $PCFLAGS),
412 dnl add -O in case -D_FORTIFY_SOURCE has been added to CFLAGS above,
413 dnl as -D_FORTIFY_SOURCE requires -O but we've separated optimization
414 dnl flags out into $CFLAGS_OPT for our build infrastructure
418 dnl some versions of gcc (e.g. version 4.8.4 on Gentoo Hardened) have added
419 dnl a predefined for _FORTIFY_SOURCE but only when -O is specified ... so
420 dnl to be safe we have -U_FORTIFY_SOURCE before -D_FORTIFY_SOURCE=2 below
422 dnl Add some security-related gcc flags
423 if echo "$CFLAGS" | grep stack-protector >/dev/null
425 dnl already set, probably from the environment
429 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
430 AS_IF([test "x$cc_is_gcc" = xyes -a "x$enable_ssp" != xno ],[
431 save_CFLAGS="$CFLAGS"
432 CFLAGS="$CFLAGS -O -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
433 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
434 AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.])
435 PCFLAGS="$PCFLAGS -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"],[
436 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
437 CFLAGS="$save_CFLAGS"
444 dnl Check for even more security-related gcc/linker flags, useful for daemons
446 [AS_HELP_STRING([--disable-pie], [disable position-independent-executable])])
447 AS_IF([test "x$cc_is_gcc" = xyes -a "x$enable_pie" != xno],[
449 PIELDFLAGS='-pie -Wl,-z,relro -Wl,-z,now'
450 save_CFLAGS="$CFLAGS"
451 save_LDFLAGS="$LDFLAGS"
452 CFLAGS="$CFLAGS $PIECFLAGS"
453 LDFLAGS="$LDFLAGS $PIELDFLAGS"
454 AC_LINK_IFELSE([AC_LANG_SOURCE([void main () {}])], [
455 AC_MSG_NOTICE([Compiling with gcc pie et al.])
457 AC_MSG_NOTICE([Compiler does not support -pie et al.])
461 CFLAGS="$save_CFLAGS"
462 LDFLAGS="$save_LDFLAGS"
467 dnl Check for support for symbol hiding via gcc flags
468 AC_ARG_ENABLE([visibility],
469 [AS_HELP_STRING([--disable-visibility], [disable gcc symbol visibility])])
470 AS_IF([test "x$cc_is_gcc" = xyes -a "$enable_visibility" != no],[
471 INVISIBILITY="-fvisibility=hidden"
472 save_CFLAGS="$CFLAGS"
473 CFLAGS="$CFLAGS -c $INVISIBILITY"
474 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int visible () { return 0; }])], [
475 AC_MSG_NOTICE([Compiling DSO PMDAs with gcc -fvisibility=hidden])
477 AC_MSG_NOTICE([Compiler does not support -fvisibility.])
480 CFLAGS="$save_CFLAGS"
482 AC_SUBST(INVISIBILITY)
484 AC_PROG_CXX(eg++ g++ c++)
487 AC_MSG_CHECKING([for working C++ compiler])
490 [AC_LANG_PROGRAM([[#include <cstdio>]],
491 [[const char gday[] = "G'day, world\n";]])],
492 [AC_MSG_RESULT([yes])],
497 dnl Prevent shared libraries from being built for libpcp and other core libraries
498 AC_ARG_ENABLE([shared],
499 [AS_HELP_STRING([--disable-shared], [disable core shared libary generation])],
500 [PACKAGE_CONFIGURE="$PACKAGE_CONFIGURE --disable-shared=$withval"])
501 AC_SUBST(enable_shared)
503 dnl check if user wants to use any of their own commands;
504 dnl ordering is important: some tests use earlier results
506 test -z "$AWK" && AC_PATH_PROGS(AWK, gawk awk, /usr/bin/awk)
518 if test -z "$SED"; then
519 AC_PATH_PROG(SED, sed, /bin/sed)
521 if test ! -x "$SED"; then
522 AC_MSG_ERROR([cannot find a valid 'sed' command.])
527 if test -z "$ECHO"; then
528 AC_PATH_PROG(ECHO, echo, /bin/echo)
530 if test ! -x "$ECHO"; then
531 AC_MSG_ERROR([cannot find a valid 'echo' command.])
536 if test -z "$FIND"; then
537 AC_PATH_PROG(FIND, find, /usr/bin/find)
539 if test ! -x "$FIND"; then
540 AC_MSG_ERROR([cannot find a valid 'find' command.])
545 if test -z "$WHICH"; then
546 AC_PATH_PROG(WHICH, which, /usr/bin/which)
548 if test ! -x "$WHICH"; then
549 AC_MSG_ERROR([cannot find a valid 'which' command.])
555 lex=`$echo $LEX | awk '{print $1}'`
557 if test ! -x "$lex"; then
558 AC_MSG_ERROR([cannot find a valid 'lex'/'flex' command.])
564 yacc=`$echo $YACC | awk '{print $1}'`
565 yacc=`$which "$yacc"`
566 if test ! -x "$yacc"; then
567 AC_MSG_ERROR([cannot find a valid 'yacc'/'bison' command.])
572 dnl check we don't get the Windows sort ...
573 AC_MSG_CHECKING([where unix-like sort(1) lives])
574 if test $target_os = mingw; then
575 for d in /bin /usr/bin /mingw/bin /mingw/usr/bin
577 if test -x $d/sort; then
590 echo "FATAL ERROR: $sort -n failed!"
591 rm -rf conftest conftest.*
596 dnl echo_n set to -n if echo understands -n to suppress newline
597 dnl echo_c set to \c if echo understands \c to suppress newline
598 AC_MSG_CHECKING([if echo uses -n or backslash-c to suppress newlines])
599 if ( $echo "testing\c"; $echo 1,2,3 ) | grep c >/dev/null
601 if ( $echo -n testing; $echo 1,2,3 ) | sed s/-n/xn/ | grep xn >/dev/null
604 AC_MSG_RESULT([neither?])
611 AC_MSG_RESULT([backslash-c])
616 dnl subsequent configure checks rely on $EGREP being set
619 dnl Check for static probes (dtrace, systemtap)
620 if test "$do_probes" = "check" -o "$do_probes" = "yes"
623 AC_CHECK_PROGS(DTRACE, dtrace, [])
626 if test "$do_probes" = "yes"
628 AC_MSG_ERROR([cannot enable static probes - no dtrace executable])
632 AC_CHECK_HEADERS([sys/sdt.h], [
633 if $enable_probes = true
635 if test $target_os = kfreebsd
638 elif test $target_os = freebsd
640 dnl dtrace support in FreeBSD depends on configuration of kernel
641 rm -f conftest.d conftest.h
642 cat <<End-of-File >conftest.d
647 if dtrace -s conftest.d -h >/dev/null 2>&1
649 if test ! -f conftest.h
652 if test "$do_probes" = "yes"
654 AC_MSG_ERROR([cannot enable static probes - no .h from dtrace -h])
659 if test "$do_probes" = "yes"
661 AC_MSG_ERROR([cannot enable static probes - dtrace failed])
668 if test "$do_probes" = "yes"
670 AC_MSG_ERROR([cannot enable static probes - no SDT header])
674 if test "$enable_probes" = "true"
676 AC_DEFINE(HAVE_STATIC_PROBES, [1], [Static probes (dtrace, systemtap)])
678 AC_SUBST(enable_probes)
682 dnl Check for service discovery mechanisms (DNS-SD, Avahi)
683 AS_IF([test "x$do_discovery" != "xno"], [
684 # on Mac OS X, dns_sd.h
686 # on Linux, aloha Avahi
688 PKG_CHECK_MODULES([avahi], [avahi-client],
689 [AC_CHECK_LIB(avahi-client, avahi_client_new,
690 [lib_for_avahi="-lavahi-common -lavahi-client"],
691 [enable_avahi=false])
692 ],[enable_avahi=false])
693 AC_CHECK_HEADERS([avahi-client/publish.h],, [enable_avahi=false])
694 AC_CHECK_HEADERS([avahi-common/alternative.h],, [enable_avahi=false])
696 if test "$enable_avahi" = "true"
698 AC_SUBST(lib_for_avahi)
699 AC_SUBST(avahi_CFLAGS)
700 AC_DEFINE(HAVE_AVAHI, [1], [Service discovery via Avahi])
701 enable_discovery=true
704 if test "$do_discovery" != "check" -a "$enable_discovery" != "true"
706 AC_MSG_ERROR([cannot enable service discovery - no supported mechanisms])
708 if test "$enable_discovery" = "true"
710 AC_DEFINE(HAVE_SERVICE_DISCOVERY, [1], [Service discovery mechanisms])
713 AC_SUBST(enable_discovery)
714 AC_SUBST(enable_avahi)
716 dnl Check for systemd services
718 AS_IF([test "x$do_systemd" != "xno"], [
721 PKG_CHECK_VAR([SYSTEMD_SYSTEMUNITDIR], [systemd], [systemdsystemunitdir],
722 [pcp_systemdunit_dir=$SYSTEMD_SYSTEMUNITDIR], [enable_systemd=false])
723 AC_SUBST(pcp_systemdunit_dir)
724 if test -z "$pcp_systemdunit_dir"
726 if test "$do_systemd" = "yes"
728 AC_MSG_ERROR([cannot enable systemd support - no systemunitdir path])
733 AC_SUBST(enable_systemd)
735 dnl NB: No AC_PREFIX_DEFAULT is needed, as the default configure invocation
736 dnl targets a build for non-system directories such as /usr/local.
737 dnl AC_PREFIX_DEFAULT([])
740 PACKAGE_VERSION=${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_REVISION}
741 AC_SUBST(PACKAGE_VERSION)
742 AC_SUBST(PACKAGE_MAJOR)
743 AC_SUBST(PACKAGE_MINOR)
744 AC_SUBST(PACKAGE_REVISION)
745 AC_SUBST(PACKAGE_BUILD)
747 if test -z "$PACKAGE_BUILD_DATE" ; then
748 PACKAGE_BUILD_DATE=`date +%Y-%m-%d`
750 AC_SUBST(PACKAGE_BUILD_DATE)
752 if test -z "$PACKAGE_DISTRIBUTION" ; then
753 PACKAGE_DISTRIBUTION=$target_distro
755 AC_SUBST(PACKAGE_DISTRIBUTION)
757 dnl generate PM_VERSION_CURRENT for header
758 pm_version_current=`awk </dev/null "BEGIN { print (${PACKAGE_MAJOR}*256+${PACKAGE_MINOR})*256+${PACKAGE_REVISION} }"`
759 AC_SUBST(pm_version_current)
761 dnl output header files with cpp defs HAVE_*, etc
762 AC_CONFIG_HEADERS(src/include/pcp/config.h src/include/pcp/configsz.h)
763 AC_OUTPUT(src/include/pcp/platform_defs.h src/include/pcp/platformsz.h)
765 AC_CHECK_PROGS(GIT, git)
768 dnl check if python available for the build and runtime
769 AC_CHECK_PROGS(PYTHON, python, python2.7)
772 dnl check if python3 available for the build and runtime
773 AC_CHECK_PROGS(PYTHON3, python3, python3.4)
776 dnl check if python tools/packages wanted (need python >= 2.6)
778 AS_IF([test "x$do_python" != "xno"], [
784 AC_MSG_CHECKING([Python version])
785 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 }'`
786 AC_MSG_RESULT([$PY_MAJOR.$PY_MINOR.$PY_POINT])
787 if test "$PY_MAJOR" -lt 2; then
788 echo WARNING: Python version 2.6 or later does not seem to be installed.
791 if test "$PY_MAJOR" -eq 2 -a "$PY_MINOR" -lt 6 ; then
792 echo WARNING: Python version 2.$PY_MINOR is too old.
793 echo Python version 2.6 or later is required for Python builds.
796 AC_CHECK_HEADERS([python${PY_MAJOR}.${PY_MINOR}/Python.h], [], [
797 echo WARNING: Python version $PY_MAJOR.$PY_MINOR header file missing.
798 echo Cannot proceed with the Python $PY_MAJOR installation found.
805 if test "$do_python" != "check" -a "$enable_python2" != "true"
807 AC_MSG_ERROR([cannot enable Python - no supported version found])
810 AC_SUBST(enable_python2)
812 dnl check if python3 tools/packages wanted (need python >= 3.3)
814 AS_IF([test "x$do_python3" != "xno"], [
816 if test -z "$PYTHON3"
820 AC_MSG_CHECKING([Python3 version])
821 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 }'`
822 AC_MSG_RESULT([$PY_MAJOR.$PY_MINOR.$PY_POINT])
823 if test "$PY_MAJOR" -lt 3; then
824 echo WARNING: Python version 3.3 or later does not seem to be installed.
827 if test "$PY_MAJOR" -eq 3 -a "$PY_MINOR" -lt 3 ; then
828 echo WARNING: Python version 3.$PY_MINOR is too old.
829 echo Python version 3.3 or later is required for Python builds.
832 AC_CHECK_HEADERS([python${PY_MAJOR}.${PY_MINOR}m/Python.h], [], [
833 echo WARNING: Python version $PY_MAJOR.$PY_MINOR header file missing.
834 echo Cannot proceed with the Python $PY_MAJOR installation found.
841 if test "$do_python3" != "check" -a "$enable_python3" != "true"
843 AC_MSG_ERROR([cannot enable Python3 - no supported version found])
846 AC_SUBST(enable_python3)
848 dnl convenience macro to determine if either python is available
849 AC_MSG_CHECKING([for any python version])
850 if test "$cross_compiling" = "yes"; then
852 echo "cross-compile -> \"$ans\"" >&5
853 elif test "$enable_python2" = "true" -o "$enable_python3" = "true"
859 AC_SUBST(have_python)
860 if $have_python; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
862 dnl choose the prefered python executable (py2 -> py3 transtion)
863 if test "$enable_python3" = "true"
865 pcp_python_prog=$PYTHON3
866 elif test "$enable_python2" = "true"
868 pcp_python_prog=$PYTHON
872 AC_SUBST(pcp_python_prog)
874 dnl check availability of some Python modules
875 dnl usage PCP_CHECK_PYTHON_MODULE(module_name) or
876 dnl PCP_CHECK_PYTHON_MODULE(module_name, <import string>)
877 dnl default <import string> is "import module_name"
879 dnl sets $have_python_<module_name> as true or false
881 AC_DEFUN(PCP_CHECK_PYTHON_MODULE,
882 [ AC_MSG_CHECKING(for Python module $1)
889 $pcp_python_prog -c 'import sys;
890 '"$txt" >>config.log 2>&1
894 eval have_python_$1=true
897 eval have_python_$1=false
900 PCP_CHECK_PYTHON_MODULE(jsonpointer)
901 AC_SUBST(have_python_jsonpointer)
902 PCP_CHECK_PYTHON_MODULE(setuptools)
903 AC_SUBST(have_python_setuptools)
904 PCP_CHECK_PYTHON_MODULE(requests)
905 AC_SUBST(have_python_requests)
906 PCP_CHECK_PYTHON_MODULE(six)
907 AC_SUBST(have_python_six)
909 AC_MSG_CHECKING([if the json PMDA should be included])
911 AS_IF([test "x$do_pmdajson" = "xyes"], [pmda_json=true])
912 AS_IF([test "x$do_pmdajson" = "xcheck"], [
913 dnl JSON PMDA needs both the six and jsonpointer Python modules
914 $have_python_jsonpointer && $have_python_six && pmda_json=true
916 AC_SUBST(PMDA_JSON, $pmda_json)
917 if $pmda_json; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
919 PCP_CHECK_PYTHON_MODULE(libvirt)
920 AC_SUBST(have_python_libvirt)
922 dnl check if perl available for the build and runtime
923 AC_CHECK_PROGS(PERL, perl)
926 AC_MSG_CHECKING([for any perl version])
927 if test "$cross_compiling" = "yes"; then
929 echo "cross-compile -> \"$ans\"" >&5
938 AC_SUBST(pcp_perl_prog)
940 AC_MSG_RESULT($pcp_perl_prog)
942 AC_MSG_CHECKING([if the SNMP PMDA should be included])
944 AS_IF([test "x$do_pmdasnmp" = "xyes"], [pmda_snmp=true])
945 AS_IF([test "x$do_pmdasnmp" = "xcheck"], [
946 dnl SNMP PMDA needs perl and the Net::SNMP module
947 if test "$have_perl" = true
949 if $pcp_perl_prog -e "use Net::SNMP" >/dev/null 2>&1
955 AC_SUBST(PMDA_SNMP, $pmda_snmp)
956 if $pmda_snmp; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
958 AC_MSG_CHECKING([if the mysql PMDA should be included])
960 if test "$have_perl" = true
962 dnl rpm build for mysql PMDA needs Perl DBI and DBD::mysql
963 if $pcp_perl_prog -e "use DBI" >/dev/null 2>&1
965 if $pcp_perl_prog -e "use DBD::mysql" >/dev/null 2>&1
971 AC_SUBST(PMDA_MYSQL, $pmda_mysql)
972 if $pmda_mysql; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
974 AC_MSG_CHECKING([if the postgresql PMDA should be included])
975 pmda_postgresql=false
976 if test "$have_perl" = true
978 dnl rpm build for postgresql PMDA needs Perl DBI and DBD::Pg
979 if $pcp_perl_prog -e "use DBI" >/dev/null 2>&1
981 if $pcp_perl_prog -e "use DBD::Pg" >/dev/null 2>&1
987 AC_SUBST(PMDA_POSTGRESQL, $pmda_postgresql)
988 if $pmda_postgresql; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
990 AC_MSG_CHECKING([if the oracle PMDA should be included])
992 if test "$have_perl" = true
994 dnl rpm build for oracle PMDA needs Perl DBI
995 if $pcp_perl_prog -e "use DBI" >/dev/null 2>&1
1000 AC_SUBST(PMDA_ORACLE, $pmda_oracle)
1001 if $pmda_oracle; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1003 AC_MSG_CHECKING([if the elasticsearch PMDA should be included])
1004 pmda_elasticsearch=false
1005 if test "$have_perl" = true
1007 dnl rpm build for elasticsearch PMDA needs Perl LWP::UserAgent
1008 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
1010 pmda_elasticsearch=true
1013 AC_SUBST(PMDA_ELASTICSEARCH, $pmda_elasticsearch)
1014 if $pmda_elasticsearch; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1016 AC_MSG_CHECKING([if the nginx PMDA should be included])
1018 if test "$have_perl" = true
1020 dnl rpm build for nginx PMDA needs Perl LWP::UserAgent
1021 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
1026 AC_SUBST(PMDA_NGINX, $pmda_nginx)
1027 if $pmda_nginx; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1029 AC_MSG_CHECKING([if the activemq PMDA should be included])
1031 if test "$have_perl" = true
1033 dnl rpm build for activemq PMDA needs Perl LWP::UserAgent
1034 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
1039 AC_SUBST(PMDA_ACTIVEMQ, $pmda_activemq)
1040 if $pmda_activemq; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1042 AC_MSG_CHECKING([if the bind2 PMDA should be included])
1044 if test "$have_perl" = true
1046 dnl rpm build for bind2 PMDA needs Perl LWP::UserAgent, XML::LibXML
1047 if $pcp_perl_prog -e "use LWP::UserAgent" >/dev/null 2>&1
1049 if $pcp_perl_prog -e "use XML::LibXML" >/dev/null 2>&1
1051 if $pcp_perl_prog -e "use File::Slurp" >/dev/null 2>&1
1058 AC_SUBST(PMDA_BIND2, $pmda_bind2)
1059 if $pmda_bind2; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1061 AC_MSG_CHECKING([if the nutcracker PMDA should be included])
1062 pmda_nutcracker=false
1063 if test "$have_perl" = true
1065 dnl rpm build for nutcracker PMDA needs Perl JSON YAML::XS
1066 if $pcp_perl_prog -e "use YAML::XS" >/dev/null 2>&1
1068 if $pcp_perl_prog -e "use JSON" >/dev/null 2>&1
1070 pmda_nutcracker=true
1074 AC_SUBST(PMDA_NUTCRACKER, $pmda_nutcracker)
1075 if $pmda_nutcracker; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1077 AC_MSG_CHECKING([if the libvirt PMDA should be included])
1079 if test "$have_python" = true
1081 dnl rpm build for libvirt PMDA needs Python libvirt and lxml modules
1082 if $pcp_python_prog -c "import libvirt" >/dev/null 2>&1
1084 if $pcp_python_prog -c "import lxml" >/dev/null 2>&1
1090 AC_SUBST(PMDA_LIBVIRT, $pmda_libvirt)
1091 if $pmda_libvirt; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1096 AS_IF([test "x$do_qt" != "xno"], [
1101 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:/usr/local/bin])
1102 test "x$cc_is_gcc" = xyes -a $target_os = solaris && QMAKE="$QMAKE -spec solaris-g++"
1109 AC_MSG_CHECKING([Qt version])
1110 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 }'`
1111 AC_MSG_RESULT([$QT_MAJOR.$QT_MINOR.$QT_POINT])
1112 if test "$QT_MAJOR" -lt 4; then
1113 echo WARNING: Qt version 4.4 or later does not seem to be installed.
1114 echo Cannot proceed with the Qt $QT_MAJOR installation found.
1117 if test "$QT_MAJOR" -eq 4 -a "$QT_MINOR" -lt 4 ; then
1118 echo WARNING: Qt version 4.$QT_MINOR is too old.
1119 echo Qt version 4.4 or later is required for Qt builds.
1124 if test "$do_qt" != "check" -a "$enable_qt" != "true"
1126 AC_MSG_ERROR([cannot enable Qt - no supported Qt installation found])
1127 elif test "$enable_qt" = "true" -a "x$cxx" = "x"
1130 test "$do_qt" != "check" && \
1131 AC_MSG_ERROR([C++ compiler unavailable, cannot build Qt components])
1132 elif test "$do_qt" = "debug"
1134 dnl Debug/release style build? (non-debug by default)
1139 AC_SUBST(qt_release)
1144 AS_IF([test "x$do_qt3d" != "xno"], [
1145 if test -f /usr/include/Coin3/Inventor/Qt/SoQt.h
1147 enable_qt3d=$enable_qt
1148 elif test -a "$do_qt3d" = "yes"
1150 AC_MSG_ERROR([cannot enable support for 3D scene graph API])
1153 AC_SUBST(enable_qt3d)
1155 dnl check if user wants their own make program
1156 dnl note: all makefiles in this package use the gmake syntax
1159 AC_PATH_PROG(MAKE, gmake)
1162 # look elsewhere ...
1163 AC_MSG_CHECKING([for GNU make elsewhere])
1164 for f in /usr/local/bin/gmake /usr/freeware/bin/gmake /usr/local/bin/make /opt/sfw/bin/gmake nowhere
1172 if test $f = nowhere
1174 # Check if /usr/bin/make is any good
1175 mver=`/usr/bin/make --version 2>/dev/null | sed -n -e1p | cut -c1-8`
1176 if test "$mver" != "GNU Make"
1179 echo "FATAL ERROR: could not find GNU make anywhere"
1180 echo "You need to set \$MAKE as the full path to GNU make "
1181 echo "in the environment."
1182 rm -rf conftest conftest.*
1188 AC_MSG_RESULT($MAKE)
1194 dnl check if users wants their own CPP
1195 if test -z "$CPP"; then
1201 dnl check if users wants their own linker
1202 if test -z "$LD"; then
1203 AC_PATH_PROG(LD, ld, /usr/bin/ld)
1208 dnl Provide ways to override owner and group for installed files
1209 if test -z "$PCP_USER_INSTALL" ; then
1210 pcp_user_install=root
1212 pcp_user_install="$PCP_USER_INSTALL"
1214 AC_SUBST(pcp_user_install)
1215 if test -z "$PCP_GROUP_INSTALL" ; then
1218 darwin|freebsd|netbsd|openbsd)
1219 pcp_group_install=wheel
1222 pcp_group_install=root
1226 pcp_group_install="$PCP_GROUP_INSTALL"
1228 AC_SUBST(pcp_group_install)
1230 dnl check if the tar program is available
1231 if test -z "$TAR"; then
1232 AC_PATH_PROGS(TAR, gtar tar, tar)
1234 if test $target_os = darwin -a -x /usr/bin/gnutar
1241 dnl check if the gzip program is available
1242 dnl (needed to gzip man pages on some platforms)
1243 if test -z "$ZIP"; then
1244 AC_PATH_PROG(ZIP, gzip, /bin/gzip)
1246 test ! -x "$ZIP" && ZIP=/usr/local/bin/gzip
1247 test ! -x "$ZIP" && ZIP=/usr/freeware/bin/gzip
1248 test ! -x "$ZIP" && ZIP=/usr/bin/gzip
1250 test -z "$gzip" && gzip=no-gzip
1253 dnl check if the bzip2 program is available
1254 dnl (needed to bzip2 man pages on some platforms)
1255 if test -z "$BZIP2"; then
1256 AC_PATH_PROG(BZIP2, bzip2, /bin/bzip2)
1258 test ! -x "$BZIP2" && BZIP2=/usr/bin/bzip2
1259 test ! -x "$BZIP2" && BZIP2=/usr/local/bin/bzip2
1260 test ! -x "$BZIP2" && BZIP2=/usr/freeware/bin/bzip2
1262 test -z "$bzip2" && bzip2=no-bzip2
1265 dnl check if the lzma program is available
1266 dnl (needed to lzma man pages on some platforms)
1267 if test -z "$LZMA"; then
1268 AC_PATH_PROG(LZMA, lzma, /bin/lzma)
1270 test ! -x "$LZMA" && LZMA=/usr/bin/lzma
1271 test ! -x "$LZMA" && LZMA=/usr/local/bin/lzma
1272 test ! -x "$LZMA" && LZMA=/usr/freeware/bin/lzma
1274 test -z "$lzma" && lzma=no-lzma
1277 dnl check if the xz program is available
1278 dnl (needed to xz man pages on some platforms)
1279 if test -z "$XZ"; then
1280 AC_PATH_PROG(XZ, xz, /bin/xz)
1282 test ! -x "$XZ" && XZ=/usr/bin/xz
1283 test ! -x "$XZ" && XZ=/usr/local/bin/xz
1284 test ! -x "$XZ" && XZ=/usr/freeware/bin/xz
1286 test -z "$xz" && xz=no-xz
1289 dnl Check for mac PackageMaker
1290 AC_MSG_CHECKING([for PackageMaker])
1291 if test -z "$PACKAGE_MAKER"
1293 if test $target_os = darwin
1295 if test -x /Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1296 then # local XCode extras install
1297 package_maker=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1298 AC_MSG_RESULT([ yes (local install)])
1299 elif test -x /Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1301 package_maker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1302 AC_MSG_RESULT([ yes (darwin 6.x)])
1303 elif test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
1305 AC_MSG_RESULT([ yes (darwin 7.x)])
1306 package_maker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
1308 AC_MSG_RESULT([ not found!])
1309 AC_MSG_WARN([PackageMaker not found, mac packages will not be made])
1312 AC_MSG_RESULT([ no])
1315 package_maker="$PACKAGE_MAKER"
1317 AC_SUBST(package_maker)
1319 dnl check if the hdiutil program is available
1320 if test -z "$HDIUTIL"; then
1321 AC_PATH_PROG(HDIUTIL, hdiutil)
1326 dnl check if the mkinstallp program is available (AIX)
1327 if test -z "$MKINSTALLP"; then
1328 AC_PATH_PROG(MKINSTALLP, mkinstallp)
1330 mkinstallp=$MKINSTALLP
1331 AC_SUBST(mkinstallp)
1333 dnl check for the Solaris pmgmk package maker
1334 if test -z "$PKGMK"; then
1335 AC_PATH_PROG(PKGMK, pkgmk)
1340 dnl check if the dlltool program is available
1341 if test -z "$DLLTOOL"; then
1342 AC_PATH_PROG(DLLTOOL, dlltool)
1347 dnl check if the rpmbuild program is available
1348 if test -z "$RPMBUILD"; then
1349 AC_PATH_PROG(RPMBUILD, rpmbuild)
1351 test $target_distro = slackware && RPMBUILD=''
1355 dnl check if the rpm program is available
1356 if test -z "$RPM"; then
1357 AC_PATH_PROG(RPM, rpm)
1359 test $target_distro = slackware && RPM=''
1363 dnl if rpmbuild exists, use it, otherwise use rpm
1364 if test -n "$RPMBUILD" -a -x "$RPMBUILD"
1372 dnl check if the pod2man program is available (perl man page builder)
1373 if test -z "$POD2MAN"; then
1374 AC_PATH_PROG(POD2MAN, pod2man)
1379 dnl extra check for the Perl MakeMaker package
1380 AC_MSG_CHECKING([if ExtUtils::MakeMaker is installed])
1381 perl -e "use ExtUtils::MakeMaker" 2>/dev/null
1384 AC_MSG_RESULT([ yes])
1386 AC_MSG_RESULT([ no])
1388 echo "FATAL ERROR: Perl ExtUtils::MakeMaker module missing."
1389 echo "You can either install this from your distribution, or"
1390 echo "download from CPAN (Comprehensive Perl Archive Network)."
1391 rm -rf conftest conftest.*
1395 AC_PATH_PROG(TRUEPROG, true)
1397 dnl check if the makedepend program is available
1398 if test -z "$MAKEDEPEND"; then
1399 AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUEPROG)
1401 makedepend=$MAKEDEPEND
1402 AC_SUBST(makedepend)
1404 dnl check if the md5sum program is available
1405 if test -z "$MD5SUM"; then
1406 AC_PATH_PROG(MD5SUM, md5sum, $TRUEPROG)
1411 dnl check if the Debian dpkg program is available
1412 if test -z "$DPKG"; then
1413 AC_PATH_PROG(DPKG, dpkg)
1418 dnl check for the Slackware makepkg packaging tool
1419 if test -z "$MAKEPKG"; then
1420 AC_PATH_PROG(MAKEPKG, makepkg)
1425 dnl check if a toolchain is available for the books
1426 test -z "$PUBLICAN" && AC_PATH_PROG(PUBLICAN, publican)
1429 test -z "$DBLATEX" && AC_PATH_PROG(DBLATEX, dblatex)
1432 test -z "$XMLTO" && AC_PATH_PROG(XMLTO, xmlto)
1437 if test "$do_books" = "check" -o "$do_books" = "yes"
1439 if test "$BOOK_TOOLCHAIN" != ""
1441 book_toolchain=$BOOK_TOOLCHAIN
1442 elif test "$DBLATEX" != ""
1444 book_toolchain=dblatex
1445 elif test "$PUBLICAN" != ""
1447 book_toolchain=publican
1448 elif test "$XMLTO" != ""
1450 book_toolchain=xmlto
1451 elif test "$do_books" = "yes"
1453 AC_MSG_ERROR([cannot enable books build - no toolchain found])
1456 AC_SUBST(book_toolchain)
1459 if test "$do_books_brand" != ""
1461 book_brand=$do_books_brand
1463 AC_SUBST(book_brand)
1465 dnl check if symbolic links are supported
1467 if test $target_os = mingw; then
1471 dnl if /proc is not mounted, try and mount it
1472 dnl before trying to run the ps style test below
1475 test -f /proc/stat || mount /proc >/dev/null 2>&1
1478 dnl set platform specific ps
1479 if test -n "$PROCPS"
1481 pcp_ps_prog="$PROCPS"
1485 AC_SUBST(pcp_ps_prog)
1487 dnl set platform specific event logger
1488 if test $target_os = mingw
1490 pcp_syslog_prog=pcp-eventlog
1492 pcp_syslog_prog=logger
1494 AC_SUBST(pcp_syslog_prog)
1497 if test $target_os = solaris
1499 test -f /usr/xpg4/bin/grep && grep=/usr/xpg4/bin/grep
1503 dnl checks for /proc pseudo file system
1504 AC_MSG_CHECKING([for /proc ])
1505 if test "$cross_compiling" = "yes"; then
1507 echo "cross-compile -> \"$ans\"" >&5
1517 AC_DEFINE(HAVE_PROCFS, [1], [Support for /proc pseudo-filesystem])
1522 dnl Checks for C header files.
1526 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h syslog.h)
1527 AC_CHECK_HEADERS(stddef.h sched.h dlfcn.h dl.h)
1528 AC_CHECK_HEADERS(sys/times.h sys/resource.h sys/prctl.h)
1529 AC_CHECK_HEADERS(sys/sysinfo.h sys/systeminfo.h)
1530 AC_CHECK_HEADERS(endian.h standards.h sys/byteorder.h)
1531 AC_CHECK_HEADERS(libgen.h sys/mman.h sys/un.h)
1532 AC_CHECK_HEADERS(values.h stdint.h ieeefp.h math.h)
1533 AC_CHECK_HEADERS(pwd.h grp.h regex.h sys/wait.h)
1534 AC_CHECK_HEADERS(termio.h termios.h sys/termios.h)
1535 AC_CHECK_HEADERS(sys/ioctl.h sys/select.h sys/socket.h)
1536 AC_CHECK_HEADERS(netdb.h)
1537 if test $target_os = darwin -o $target_os = openbsd
1539 AC_CHECK_HEADERS(net/if.h, [], [], [#include <sys/types.h>
1540 #include <sys/socket.h>])
1542 AC_CHECK_HEADERS(net/if.h)
1544 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h arpa/inet.h)
1545 AC_CHECK_HEADERS(windows.h winsock2.h ws2tcpip.h)
1546 AC_CHECK_HEADERS(execinfo.h bits/wordsize.h)
1547 AC_CHECK_HEADERS(iptypes.h, [], [], [#include <windows.h>])
1548 AC_CHECK_HEADERS(iphlpapi.h, [], [], [#include <winsock2.h>])
1549 AC_CHECK_HEADERS(fts.h libzfs.h)
1550 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/mount.h)
1552 dnl Check if we have <sys/endian.h> ... standard way
1553 AC_MSG_CHECKING([for sys/endian.h ])
1556 #include <sys/endian.h>
1559 ], AC_DEFINE(HAVE_SYS_ENDIAN_H, [1], [sys/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1561 dnl Check if we have <machine/endian.h> ... MacOSX way
1562 AC_MSG_CHECKING([for machine/endian.h ])
1565 #include <machine/endian.h>
1568 ], AC_DEFINE(HAVE_MACHINE_ENDIAN_H, [1], [machine/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1570 dnl Check if we have <sys/endian.h> ... IRIX strangeness
1571 AC_MSG_CHECKING([for sys/endian.h (IRIX variant) ])
1574 #include <standards.h>
1575 #include <sys/endian.h>
1578 ], AC_DEFINE(HAVE_SYS_ENDIAN_H, [1], [IRIX sys/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1580 dnl Checks for typedefs, structures, and compiler characteristics.
1589 dnl check if regex functions come from libregex (mingw)
1590 AC_CHECK_LIB(regex, regcomp)
1592 if test $ac_cv_lib_regex_regcomp = yes
1594 lib_for_regex="-lregex"
1596 AC_SUBST(lib_for_regex)
1598 PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=true], [have_ncurses=false])
1599 AC_SUBST(HAVE_NCURSES, [$have_ncurses])
1601 PKG_CHECK_MODULES([SYSTEMD], [libsystemd],
1602 [pmda_systemd=true], [pmda_systemd=false])
1607 dnl libsystemd-journal is an alternative for older distros
1608 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-journal],
1609 [pmda_systemd=true], [pmda_systemd=false])
1611 AC_MSG_CHECKING([if the systemd PMDA should be included])
1612 AC_SUBST(PMDA_SYSTEMD, $pmda_systemd)
1613 if $pmda_systemd; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1615 pmda_infiniband=false
1616 AS_IF([test "x$do_infiniband" != "xno"], [
1617 AC_CHECK_HEADERS([infiniband/umad.h], [
1618 AC_CHECK_HEADERS([infiniband/mad.h], [pmda_infiniband=true], [])
1622 AC_CHECK_LIB(ibmad, madrpc_init)
1623 AC_CHECK_LIB(ibumad, umad_init)
1624 if test $ac_cv_lib_ibmad_madrpc_init = yes -a $ac_cv_lib_ibumad_umad_init = yes
1626 IB_LIBS="-libmad -libumad"
1628 AC_MSG_CHECKING([for port_performance_query_via])
1629 AC_TRY_LINK_FUNC(port_performance_query_via,
1630 AC_DEFINE(HAVE_PORT_PERFORMANCE_QUERY_VIA, [1], [port_performance_query_via API])
1631 have_port_performance_query_via=true
1633 have_port_performance_query_via=false
1635 AC_MSG_CHECKING([for pma_query_via])
1636 AC_TRY_LINK_FUNC(pma_query_via,
1637 AC_DEFINE(HAVE_PMA_QUERY_VIA, [1], [pma_query_via API])
1638 have_pma_query_via=true
1640 have_pma_query_via=false
1643 if test $have_pma_query_via -o $have_port_performance_query_via
1647 pmda_infiniband=false
1650 pmda_infiniband=false
1655 AC_MSG_CHECKING([if the infiniband PMDA should be included])
1656 AC_SUBST(PMDA_INFINIBAND, $pmda_infiniband)
1657 if $pmda_infiniband; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1660 AS_IF([test "x$do_papi" != "xno"], [
1663 saved_LDFLAGS="$LDFLAGS"
1664 saved_CFLAGS="$CFLAGS"
1667 dnl potentially from the environment, else empty
1668 CFLAGS="$papi_CFLAGS"
1669 LDFLAGS="$papi_LIBS"
1675 PAPI_ROOTDIR=$do_papi;
1676 CFLAGS="-I$PAPI_ROOTDIR/include"
1677 LDFLAGS="-L$PAPI_ROOTDIR/lib"
1680 PKG_CHECK_MODULES(papi,[$do_papi],[
1681 CFLAGS="$papi_CFLAGS"
1682 LDFLAGS="$papi_LIBS"])
1686 # $papi_LIBS may include -lpapi harmlessly redudantly with AC_CHECK_LIB
1687 AC_CHECK_LIB([papi], [PAPI_library_init],
1688 [papi_libs="$LDFLAGS -lpapi"],
1689 [enable_papi=false])
1690 AC_CHECK_HEADERS([papi.h], [papi_cflags="$CFLAGS"], [enable_papi=false])
1691 if test "$do_papi" != "check" -a "$enable_papi" != "true"
1693 AC_MSG_ERROR([PAPI is not installed, cannot enable the PAPI PMDA])
1695 pmda_papi=$enable_papi
1698 CFLAGS="$saved_CFLAGS"
1699 LDFLAGS="$saved_LDFLAGS"
1700 AC_SUBST(PAPI_CFLAGS, $papi_cflags)
1701 AC_SUBST(PAPI_LIBS, $papi_libs)
1703 AC_MSG_CHECKING([if the papi PMDA should be included])
1704 AC_SUBST(PMDA_PAPI, $pmda_papi)
1705 if $pmda_papi; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1707 AS_IF([test "x$pmda_papi" = "xtrue"], [
1708 dnl check if struct PAPI_component_info_t has a disabled field
1709 AC_MSG_CHECKING([whether struct PAPI_component_info_t has a disabled field])
1710 cat <<End-of-File >conftest.c
1712 int main() { PAPI_component_info_t *c; c->disabled = 0; }
1714 (eval $ac_compile) 2>conftest.out
1715 cat conftest.out >&5
1716 if test -s conftest.out
1720 AC_DEFINE(HAVE_PAPI_DISABLED_COMP, [1], [PAPI_component_info_t field])
1727 pmda_perfevent=false
1728 AS_IF([test "x$do_perfevent" != "xno" ], [
1729 enable_perfevent=true
1732 AC_CHECK_LIB([pfm], [pfm_get_os_event_encoding],
1734 [enable_perfevent=false])
1735 AC_CHECK_HEADERS([perfmon/pfmlib_perf_event.h], [], [enable_perfevent=false])
1736 if test "$do_perfevent" != "check" -a "$enable_perfevent" != "true"
1738 AC_MSG_ERROR([libpfm is not installed, cannot enable the perfevent PMDA])
1740 pmda_perfevent=$enable_perfevent
1743 AC_SUBST(PFM_LIBS, $pfm_libs)
1745 AC_MSG_CHECKING([if the perfevent PMDA should be included])
1746 AC_SUBST(PMDA_PERFEVENT, $pmda_perfevent)
1747 if $pmda_perfevent; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1749 dnl Do you have RPM Package Manager libraries for pmdarpm?
1752 AC_MSG_CHECKING([for rpmlib > 4.4.2])
1754 [AC_LANG_PROGRAM([[#include <rpm/header.h>]],
1755 [[(void)HEADERGET_EXT;]])],
1756 [AC_MSG_RESULT([yes])
1758 [AC_MSG_RESULT([no])])
1759 AC_MSG_CHECKING([if the rpm PMDA should be included])
1760 AC_SUBST(PMDA_RPM,$pmda_rpm)
1761 if $pmda_rpm; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1764 dnl Do you have the required qshape script for the postfix PMDA
1765 dnl The logic here is copied from the PMDA's Install script
1767 AC_CHECK_PROGS(QSHAPE, qshape, [], path=[$PATH:/usr/sbin])
1768 AC_MSG_CHECKING([if the postfix PMDA should be included])
1769 if test -n "$QSHAPE"
1773 for script in /usr/share/doc/packages/postfix-doc/auxiliary/qshape/qshape.pl
1775 if test -f "$script"
1782 AC_SUBST(PMDA_POSTFIX,$pmda_postfix)
1783 if $pmda_postfix; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1785 dnl Do you have system microhttpd libraries for pmwebapi?
1786 PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd > 0.9.9], [have_libmicrohttpd=true], [have_libmicrohttpd=false])
1787 AC_SUBST(HAVE_LIBMICROHTTPD, [$have_libmicrohttpd])
1789 dnl Do you have graphics libraries for pmwebapi?
1790 PKG_CHECK_MODULES([cairo], [cairo >= 1.2, cairo-ft >= 1.2, cairo-png >= 1.2], [have_cairo=true], [have_cairo=false])
1791 AC_SUBST(HAVE_CAIRO, [$have_cairo])
1794 AS_IF([test "x$do_webapi" != "xno"], [
1797 if test "$have_libmicrohttpd" != "true"
1800 test "$do_webapi" != "check" && \
1801 AC_MSG_ERROR([libmicrohttpd is not installed, cannot enable the web API])
1802 elif test "$do_webapi" != "check" -a "x$cxx" = "x"
1805 test "$do_webapi" != "check" && \
1806 AC_MSG_ERROR([C++ compiler unavailable, cannot enable the web API])
1809 AC_SUBST(enable_webapi)
1811 enable_manager=false
1812 AS_IF([test "x$do_manager" != "xno"], [
1815 if test "$target_os" = "mingw"
1817 enable_manager=false
1818 test "$do_manager" != "check" && \
1819 AC_MSG_ERROR([MinGW build, cannot enable daemon manager])
1820 elif test "x$cxx" = "x"
1822 enable_manager=false
1823 test "$do_manager" != "check" && \
1824 AC_MSG_ERROR([C++ compiler unavailable, cannot enable daemon manager])
1826 AC_MSG_CHECKING([compilation features for daemon manager])
1828 [ #ifndef _XOPEN_SOURCE
1829 #define _XOPEN_SOURCE 600
1834 enable_manager=false
1837 AC_SUBST(enable_manager)
1839 enable_selinux=false
1840 AS_IF([test "x$do_selinux" != "xno"], [
1841 if test -f /usr/share/selinux/devel/Makefile
1848 AC_SUBST(enable_selinux)
1849 AC_SUBST(pcp_selinux_dir)
1852 dnl Checks for library functions.
1856 AC_CHECK_FUNCS(mktime nanosleep usleep unsetenv)
1857 AC_CHECK_FUNCS(select socket gethostname getpeerucred getpeereid)
1858 AC_CHECK_FUNCS(uname syslog __clone pipe2 fcntl ioctl)
1859 AC_CHECK_FUNCS(prctl setlinebuf waitpid atexit kill)
1860 AC_CHECK_FUNCS(chown fchmod getcwd scandir mkstemp)
1861 AC_CHECK_FUNCS(brk sbrk posix_memalign memalign valloc)
1862 AC_CHECK_FUNCS(signal sighold sigrelse tcgetattr)
1863 AC_CHECK_FUNCS(regex regcmp regexec regcomp)
1864 AC_CHECK_FUNCS(strtod strtol strtoll strtoull strndup strchrnul)
1865 AC_CHECK_FUNCS(getuid getgid)
1866 AC_CHECK_FUNCS(getgrent getgrent_r getgrnam getgrnam_r getgrgid getgrgid_r)
1867 AC_CHECK_FUNCS(getpwent getpwent_r getpwnam getpwnam_r getpwuid getpwuid_r)
1868 AC_CHECK_FUNCS(sysinfo trace_back_stack backtrace)
1869 AC_CHECK_FUNCS(sendmsg recvmsg setns)
1871 dnl only define readdir64 on non-linux platforms that support it
1872 if test $target_os != linux -a $target_os != freebsd -a $target_os != kfreebsd -a $target_os != netbsd; then
1873 AC_CHECK_FUNCS(readdir64)
1876 dnl typedefs missing from sys/types.h, stdlib.h or stddef.h
1877 if test $target_os = solaris
1879 AC_CHECK_TYPE(__int32_t, int32_t)
1880 AC_CHECK_TYPE(__uint32_t, uint32_t)
1881 AC_CHECK_TYPE(__int64_t, int64_t)
1882 AC_CHECK_TYPE(__uint64_t, uint64_t)
1883 AC_CHECK_TYPE(uint_t, u_int32_t)
1885 AC_CHECK_TYPE(__int32_t, int)
1886 AC_CHECK_TYPE(__uint32_t, unsigned int)
1887 AC_CHECK_TYPE(__int64_t, long long)
1888 AC_CHECK_TYPE(__uint64_t, unsigned long long)
1889 AC_CHECK_TYPE(uint_t, unsigned int)
1892 dnl check if we have a type for the pointer's size integer (__psint_t)
1893 AC_MSG_CHECKING([for __psint_t ])
1896 #include <sys/types.h>
1899 ], [ __psint_t psint; ],
1900 AC_DEFINE(HAVE___PSINT_T, [1], [__psint_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1902 dnl check if we have a type for pointer difference (ptrdiff_t)
1903 AC_MSG_CHECKING([for ptrdiff_t ])
1906 #ifdef HAVE_MALLOC_H
1909 ], [ ptrdiff_t ptrdiff; ],
1910 AC_DEFINE(HAVE_PTRDIFF_T, [1], [ptrdiff_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1912 dnl check if we have types for uid_t, gid_t (POSIX) or SID (Win32)
1913 AC_MSG_CHECKING([for uid_t ])
1915 #include <sys/types.h>
1920 AC_DEFINE(HAVE_UID_T, [1], [uid_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1921 AC_MSG_CHECKING([for gid_t ])
1923 #include <sys/types.h>
1928 AC_DEFINE(HAVE_GID_T, [1], [gid_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1929 AC_MSG_CHECKING([for SID ])
1931 #ifdef HAVE_WINDOWS_H
1932 #include <windows.h>
1935 AC_DEFINE(HAVE_SID, [1], [sid type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1937 dnl check if we have a type for socklen_t
1938 AC_MSG_CHECKING([for socklen_t ])
1940 #include <sys/types.h>
1941 #ifdef HAVE_SYS_SOCKET_H
1942 #include <sys/socket.h>
1944 ], [ socklen_t len; ],
1945 AC_DEFINE(HAVE_SOCKLEN_T, [1], [socklen_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1947 dnl check if LL suffix on constants is supported
1950 ], [ long long x = 0LL; ],
1951 AC_DEFINE(HAVE_CONST_LONGLONG, [1], [LL suffix on constants]))
1953 dnl check if _environ is declared globally
1957 ], [ char **x = _environ; ],
1958 AC_DEFINE(HAVE_UNDERBAR_ENVIRON, [1], [_environ declared globally]))
1960 dnl check for PR_TERMCHILD and PR_SET_PDEATHSIG in <sys/prctl.h>
1961 AC_MSG_CHECKING([for PR_TERMCHILD constant in sys/prctl.h])
1963 #ifdef HAVE_SYS_PRCTL_H
1964 #include <sys/prctl.h>
1966 ], [ int i = PR_TERMCHILD; ],
1967 AC_DEFINE(HAVE_PR_TERMCHILD, [1], [PR_TERMCHILD constant]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1969 AC_MSG_CHECKING([for PR_SET_PDEATHSIG constant in sys/prctl.h])
1971 #ifdef HAVE_SYS_PRCTL_H
1972 #include <sys/prctl.h>
1974 ], [ int i = PR_SET_PDEATHSIG; ],
1975 AC_DEFINE(HAVE_PR_SET_PDEATHSIG, [1], [PR_SET_PDEATHSIG constant]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1977 AC_HEADER_TIOCGWINSZ
1979 dnl check if linker needs -rdynamic for dynamically loaded shared
1980 dnl libraries to see the symbols in the process loading them.
1981 dnl This is e.g., needed on linux for pmcd loading pmda_pmcd.so.
1982 AC_MSG_CHECKING([if linker supports -rdynamic])
1983 save_CFLAGS="$CFLAGS"
1985 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1986 [AC_MSG_RESULT([yes])
1987 rdynamic_flag=-rdynamic],
1988 [AC_MSG_RESULT([no])
1991 CFLAGS="$save_CFLAGS"
1992 AC_SUBST([rdynamic_flag])
1995 dnl check if argument to user's select() method in scandir call is const
1996 AC_MSG_CHECKING([whether const arg for scandir() select method])
1997 cat <<End-of-File >conftest.c
2002 my_select(const struct dirent *foo) { return 0; }
2003 int main() { struct dirent **list; return scandir(".", &list, my_select, NULL); }
2005 (eval $ac_compile) 2>conftest.out
2006 cat conftest.out >&5
2007 if test -s conftest.out
2011 AC_DEFINE(HAVE_CONST_DIRENT, [1], [const arg for scandir() select method])
2016 dnl check if struct dirent has a d_off (directory offset) field
2017 AC_MSG_CHECKING([whether struct dirent has a d_off field])
2018 cat <<End-of-File >conftest.c
2022 int main() { struct dirent d; d.d_off = 0; }
2024 (eval $ac_compile) 2>conftest.out
2025 cat conftest.out >&5
2026 if test -s conftest.out
2030 AC_DEFINE(HAVE_DIRENT_D_OFF, [1], [struct dirent d_off field])
2035 dnl check if printf %p has 0x prefix
2036 AC_MSG_CHECKING([if printf %p produces 0x prefix])
2037 if test "$cross_compiling" = "yes"; then
2038 ans=$printf_p_prefix
2039 echo "cross-compile -> \"$ans\"" >&5
2041 cat <<End-of-File >conftest.c
2043 int main(int argc, char **argv) { printf("%p", argv); return(0); }
2045 (eval $ac_compile) 2>&5
2046 (eval $ac_link) 2>&5
2048 echo "./conftest -> \"$ans\"" >&5
2053 AC_DEFINE(HAVE_PRINTF_P_PFX, [1], [printf %p produces 0x])
2060 rm -rf conftest conftest.*
2064 # need to deal with this sort of cpp output ...
2065 # typedef long pid_t;
2066 # typedef unsigned int pid_t;
2067 # typedef unsigned int pid_t __attribute__ ((__mode__ (__SI__)));
2068 # __extension__ typedef int pid_t;
2075 # and chaining of the form
2076 # typedef long __pid_t;
2077 # typedef __pid_t pid_t;
2079 _raw=`$CPP conftest.c \
2081 -e 's/[[ ]]__attribute__ ((.*));/;/' \
2082 -e 's/__extension__[[ ]][[ ]]*//' \
2084 /bozo/ { print; next }
2085 $1 == "typedef" { printf "%s",$0
2091 if ($0 ~ /{/) depth = 1
2094 wantsemi == 1 { printf " %s",$0
2095 if ($0 ~ /{/) depth++
2097 if ($0 ~ /}/) depth--
2111 $1 == "typedef" { map[[$NF]] = ""
2112 for (i = 2; i < NF; i++) {
2116 map[[$NF]] = map[[$NF]] " " $i
2118 print $NF " -> " map[[$NF]] >"conftest.debug"
2121 $2 == "bozo" { t = $1
2122 printf "best guess: %s",t >"conftest.debug"
2123 while (map[[t]] != "") {
2125 printf " -> %s",t >"conftest.debug"
2127 print "" >"conftest.debug"
2136 unsigned|'unsigned int')
2142 'long long'|'long long int')
2143 if test $target_os = mingw; then
2149 'unsigned long'|'unsigned long int'|'long unsigned int')
2152 'unsigned long long'|'unsigned long long int')
2153 if test $target_os = mingw; then
2159 *\*) # pointer to a something
2162 struct\ *) # not much can be done here ...
2167 echo "FATAL ERROR: don't know what to do with type \"$_raw\""
2168 echo "... typedef mapping ..."
2170 rm -rf conftest conftest.*
2176 dnl printf type for pid_t
2177 AC_MSG_CHECKING([printf type for pid_t])
2178 if test "$cross_compiling" = "yes"; then
2180 echo "cross-compile -> \"$ans\"" >&5
2183 cat <<End-of-File >conftest.c
2184 #include <sys/types.h>
2191 AC_MSG_RESULT($fmt_pid)
2193 rm -rf conftest.c conftest.debug
2195 dnl printf type for int64_t
2196 AC_MSG_CHECKING([printf type for int64_t ])
2197 if test "$cross_compiling" = "yes"; then
2198 ans=$printf_fmt_int64
2199 echo "cross-compile -> \"$ans\"" >&5
2201 cat <<End-of-File >conftest.c
2204 #include <inttypes.h>
2207 printf("\"%s\"\n", __PRI64_PREFIX "d");
2212 (eval $ac_link) 2>&5
2213 if test -x ./conftest
2216 echo "./conftest -> \"$ans\"" >&5
2220 dnl have to try the hardway ...
2221 cat <<End-of-File >conftest.c
2228 int64_t bozo = 0x12345678abcdLL;
2229 sprintf(buf, "%lx", bozo);
2230 if (strcmp(buf, "12345678abcd") == 0)
2233 sprintf(buf, "%llx", bozo);
2234 if (strcmp(buf, "12345678abcd") == 0)
2235 printf("\"lld\"\n");
2240 (eval $ac_link) 2>&5
2241 if test -x ./conftest
2244 echo "./conftest -> \"$ans\"" >&5
2250 echo 'FATAL ERROR: Cannot determine printf format for int64_t type'
2251 rm -rf conftest conftest.*
2255 AC_MSG_RESULT("$fmt_int64")
2257 dnl and the unsigned version of this ...
2258 fmt_uint64=`echo $fmt_int64 | sed -e 's/d"/u"/'`
2259 AC_SUBST(fmt_uint64)
2260 rm -rf conftest.* conftest
2262 AC_MSG_CHECKING([strtol or strtoll for int64_t])
2263 if test "$cross_compiling" = "yes"; then
2265 echo "cross-compile -> \"$ans\"" >&5
2267 cat <<End-of-File >conftest.c
2272 long long int value = -1;
2273 value = strtol("1234567812345678", NULL, 16);
2274 if (value == 0x1234567812345678LL) {
2275 printf("strotol\n");
2278 value = strtoll("1234567812345678", NULL, 16);
2279 if (value == 0x1234567812345678LL) {
2280 printf("strtoll\n");
2286 (eval $ac_compile) 2>&5
2287 (eval $ac_link) 2>&5
2289 echo "./conftest -> \"$ans\"" >&5
2294 AC_DEFINE(strtoint64, strtol)
2295 AC_DEFINE(strtouint64, strtoul)
2296 AC_MSG_RESULT([strtol])
2299 AC_DEFINE(strtoint64, strtoll)
2300 AC_DEFINE(strtouint64, strtoull)
2301 AC_MSG_RESULT([strtoll])
2304 AC_DEFINE(strtoint64, strtoll)
2305 AC_DEFINE(strtouint64, strtoull)
2306 AC_MSG_RESULT([assuming strtoll])
2309 rm -rf conftest conftest.*
2311 if test "$do_threads" = "check" -o "$do_threads" = "yes"
2317 if test "$do_threads" = "yes"
2319 AC_MSG_ERROR([cannot enable multi-threaded mode - no pthread.h])
2323 dnl Check if pthread_mutex_t is defined in pthread.h
2324 dnl Ignore the fact that pthread.h could be missing - we don't
2325 dnl really care if this test fails because of missing pthread_mutex_t
2326 dnl or because of missing headers.
2327 AC_MSG_CHECKING([for pthread_mutex_t in pthread.h])
2329 [#include <pthread.h>], [pthread_mutex_t mymutex;],
2330 AC_DEFINE(HAVE_PTHREAD_MUTEX_T, [1], [pthread_mutex_t type]) AC_MSG_RESULT(yes),
2332 if test "$do_threads" = "yes"
2334 AC_MSG_ERROR([cannot enable multi-threaded mode - no mutexes])
2340 dnl Check which library provide pthread stuff
2341 AC_MSG_CHECKING([where pthread_create() is defined])
2342 for cand in "" pthreads pthread ; do
2346 LIBS=`echo $LIBS -l$cand`
2350 #include <pthread.h>
2353 pthread_create(NULL, NULL, NULL, NULL);
2354 ], AC_MSG_RESULT(lib${cand:-c})
2357 lib_for_pthreads="$cand"
2359 lib_for_pthreads="-l$cand"
2365 AC_SUBST(lib_for_pthreads)
2367 if test "$ac_cv_header_pthread_h" = "yes"
2369 dnl printf type for pthread_t
2370 AC_MSG_CHECKING([printf type for pthread_t])
2371 cat <<End-of-File >conftest.c
2372 #include <pthread.h>
2377 AC_MSG_RESULT($fmt_pthread)
2378 AC_SUBST(fmt_pthread)
2379 rm -rf conftest.c conftest.debug
2381 dnl check if gcc supports __thread for thread private data
2382 AC_MSG_CHECKING([if compiler supports __thread])
2383 dnl __thread support is broken in some places
2384 if test $target_os = netbsd
2386 AC_TRY_COMPILE([#include <pthread.h>
2387 #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 5 )
2392 AC_DEFINE(HAVE___THREAD, [1], [__thread private data]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2394 AC_TRY_COMPILE([#include <pthread.h>
2395 __thread int x;], [],
2396 AC_DEFINE(HAVE___THREAD, [1], [__thread private data]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2399 dnl Check if pthread_barrier_t is defined in pthread.h
2400 AC_MSG_CHECKING([for pthread_barrier_t in pthread.h])
2401 AC_TRY_COMPILE([#include <pthread.h>], [pthread_barrier_t mybarrier;],
2402 AC_DEFINE(HAVE_PTHREAD_BARRIER_T, [1], [pthread_barrier_t type]) AC_MSG_RESULT(yes),
2407 AC_MSG_CHECKING([sizeof suseconds_t])
2408 if test "$cross_compiling" = "yes"; then
2409 ans=$sizeof_suseconds_t
2410 echo "cross-compile -> \"$ans\"" >&5
2412 cat <<End-of-File >conftest.c
2413 #include <sys/time.h>
2414 main() { printf("%d", (int)sizeof(suseconds_t)); }
2416 (eval $ac_compile) 2>&5
2417 (eval $ac_link) 2>&5
2419 echo "./conftest -> \"$ans\"" >&5
2420 rm -rf conftest conftest.*
2423 AC_DEFINE_UNQUOTED(SIZEOF_SUSECONDS_T, $ans, [sizeof suseconds_t])
2425 AC_MSG_CHECKING([sizeof time_t])
2426 if test "$cross_compiling" = "yes"; then
2428 echo "cross-compile -> \"$ans\"" >&5
2430 cat <<End-of-File >conftest.c
2431 #include <sys/time.h>
2432 main() { printf("%d", (int)sizeof(time_t)); }
2434 (eval $ac_compile) 2>&5
2435 (eval $ac_link) 2>&5
2437 echo "./conftest -> \"$ans\"" >&5
2438 rm -rf conftest conftest.*
2441 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ans, [sizeof time_t])
2443 dnl check sizeof long
2444 AC_MSG_CHECKING([sizeof long])
2445 if test "$cross_compiling" = "yes"; then
2447 echo "cross-compile -> \"$ans\"" >&5
2449 cat <<End-of-File >conftest.c
2451 main() { printf("%d", (int)sizeof(long)); }
2453 (eval $ac_compile) 2>&5
2454 (eval $ac_link) 2>&5
2456 echo "./conftest -> \"$ans\"" >&5
2459 if test "$ans" = 4; then
2460 AC_DEFINE(HAVE_32BIT_LONG, [1], [sizeof long])
2461 elif test "$ans" = 8; then
2462 AC_DEFINE(HAVE_64BIT_LONG, [1], [sizeof long])
2465 echo "FATAL ERROR: size of long is not 32 or 64 bits, cannot proceed."
2466 echo "sizeof(char *) -> $ans"
2467 rm -rf conftest conftest.*
2470 rm -rf conftest conftest.*
2472 dnl check sizeof pointer
2473 AC_MSG_CHECKING([sizeof pointer])
2474 if test "$cross_compiling" = "yes"; then
2476 echo "cross-compile -> \"$ans\"" >&5
2478 cat <<End-of-File >conftest.c
2480 main() { printf("%d", (int)sizeof(char *)); }
2482 (eval $ac_compile) 2>&5
2483 (eval $ac_link) 2>&5
2485 echo "./conftest -> \"$ans\"" >&5
2488 if test "$ans" = 4; then
2489 AC_DEFINE(HAVE_32BIT_PTR, [1], [pointer size])
2491 elif test "$ans" = 8; then
2492 AC_DEFINE(HAVE_64BIT_PTR, [1], [pointer size])
2496 echo "FATAL ERROR: size of pointer is not 32 or 64 bits, cannot proceed."
2497 echo "sizeof(char *) -> $ans"
2498 rm -rf conftest conftest.*
2501 rm -rf conftest conftest.*
2503 dnl check sizeof int. If not 32, we die
2504 AC_MSG_CHECKING([sizeof int])
2505 if test "$cross_compiling" = "yes"; then
2507 echo "cross-compile -> \"$ans\"" >&5
2509 cat <<End-of-File >conftest.c
2511 main() { printf("%d", (int)sizeof(int)); }
2513 (eval $ac_compile) 2>&5
2514 (eval $ac_link) 2>&5
2516 echo "./conftest -> \"$ans\"" >&5
2522 echo "FATAL ERROR: sizeof(int) is not 32 bits, cannot proceed."
2523 echo "Note: 32-bit ints are assumed in the PCP external file formats and"
2524 echo " the over-the-wire PDU formats"
2525 rm -rf conftest conftest.*
2528 rm -rf conftest conftest.*
2530 dnl check bit field allocation order within a word
2531 AC_MSG_CHECKING([if bit fields allocated left-to-right])
2532 if test "$cross_compiling" = "yes"; then
2533 ans=$bit_field_scheme
2534 echo "cross-compile -> \"$ans\"" >&5
2536 cat <<End-of-File >conftest.c
2537 union { struct { unsigned int b:4; unsigned int c:4; } a; int p; } u;
2538 main() { u.a.b = 1; u.a.c = 2; printf("%0*x", 2*sizeof(int), u.p); }
2540 (eval $ac_compile) 2>&5
2541 (eval $ac_link) 2>&5
2543 echo "./conftest -> \"$ans\"" >&5
2548 # left-to-right starting from MSB (SGI cc on MIPS), or
2549 # left-to-right ending at LSB
2550 AC_DEFINE(HAVE_BITFIELDS_LTOR, [1], [left-to-right bitfield ordering])
2554 # right-to-left ending at MSB, or
2555 # right-to-left starting from LSB (gcc in Intel)
2559 AC_MSG_RESULT(unknown)
2560 echo "FATAL ERROR: could not fathom your compiler's bit field allocation scheme"
2561 rm -f conftest conftest.*
2565 rm -rf conftest conftest.*
2567 dnl check if compiler can cast __uint64_t to double
2575 double y = (double)x;
2576 ], AC_DEFINE(HAVE_CAST_U64_DOUBLE, [1], [compiler casts u64 to double]))
2578 dnl check if basename and dirname need -lgen, -lpcp or nothing to work
2579 dnl (assume both go together)
2580 AC_CHECK_FUNCS(basename)
2581 if test $ac_cv_func_basename = yes
2583 AC_DEFINE(HAVE_BASENAME, [1], [basename API])
2584 AC_DEFINE(HAVE_DIRNAME, [1], [dirname API])
2587 AC_CHECK_LIB(gen, basename)
2588 if test $ac_cv_lib_gen_basename = yes
2590 AC_DEFINE(HAVE_BASENAME, [1], [basename API])
2591 AC_DEFINE(HAVE_DIRNAME, [1], [dirname API])
2592 lib_for_basename="-lgen"
2594 lib_for_basename="-lpcp"
2597 AC_SUBST(lib_for_basename)
2599 dnl check if clock_gettime needs -lrt to work
2600 lib_for_clock_gettime=
2601 AC_CHECK_FUNCS(clock_gettime)
2602 if test $ac_cv_func_clock_gettime = no
2604 AC_CHECK_LIB(rt, clock_gettime)
2605 if test $ac_cv_lib_rt_clock_gettime = yes
2607 AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [clock_gettime API])
2611 AC_SUBST(lib_for_rt)
2613 dnl check if dlopen et al need -ldl to work
2615 AC_CHECK_FUNCS(dlopen)
2616 if test $ac_cv_func_dlopen = no
2618 AC_CHECK_LIB(dl, dlopen)
2619 if test $ac_cv_lib_dl_dlopen = yes
2621 AC_DEFINE(HAVE_DLOPEN, [1], [dlopen API])
2625 AC_SUBST(lib_for_dlopen)
2627 dnl check if flog10, pow, fpclassify and isnanf are available
2628 dnl in the maths library
2630 AC_CHECK_FUNCS(flog10)
2631 if test $ac_cv_func_flog10 = no
2633 AC_CHECK_LIB(m, flog10)
2634 if test $ac_cv_lib_m_flog10 = yes
2636 AC_DEFINE(HAVE_FLOG10, [1], [flog10 math API])
2640 AC_DEFINE(HAVE_FLOG10, [1], [flog10 math API])
2643 if test $ac_cv_func_pow = no
2645 AC_CHECK_LIB(m, pow)
2646 if test $ac_cv_lib_m_pow = yes
2648 AC_DEFINE(HAVE_POW, [1], [pow math API])
2652 AC_DEFINE(HAVE_POW, [1], [pow math API])
2654 AC_MSG_CHECKING([for fpclassify()])
2655 ac_cv_func_fpclassify=no
2662 if (fpclassify(x) == FP_NAN) exit(1);
2663 ], ac_cv_func_fpclassify=yes)
2664 AC_MSG_RESULT($ac_cv_func_fpclassify)
2665 if test $ac_cv_func_fpclassify = no
2668 AC_MSG_CHECKING([for fpclassify() with -lm])
2677 if (fpclassify(x) == FP_NAN) exit(1);
2678 ], ac_cv_func_fpclassify=yes)
2679 AC_MSG_RESULT($ac_cv_func_fpclassify)
2680 if test $ac_cv_func_fpclassify = yes
2686 if test $ac_cv_func_fpclassify = yes
2688 AC_DEFINE(HAVE_FPCLASSIFY, [1], [fpclassify math API])
2690 dnl prefer fpclassify() but will take isnan() and isnanf() as
2691 dnl possible alternates
2692 AC_CHECK_FUNCS(isnan)
2693 if test $ac_cv_func_isnan = no
2695 AC_CHECK_LIB(m, isnan)
2696 if test $ac_cv_lib_m_isnan = yes
2698 AC_DEFINE(HAVE_ISNAN, [1], [isnan math API])
2702 AC_CHECK_FUNCS(isnanf)
2703 if test $ac_cv_func_isnanf = no
2705 AC_CHECK_LIB(m, isnanf)
2706 if test $ac_cv_lib_m_isnanf = yes
2708 AC_DEFINE(HAVE_ISNANF, [1], [isnanf math API])
2713 AC_SUBST(lib_for_math)
2715 dnl check if we have the SIG_PF typedef
2716 AC_TRY_LINK([#include <signal.h>], [SIG_PF x;],
2717 AC_DEFINE(HAVE_SIGPF, [1], [SIG_PF typedef]))
2719 dnl check if we have the SA_SIGINFO #define
2720 AC_TRY_LINK([#include <signal.h>], [int x = SA_SIGINFO;],
2721 AC_DEFINE(HAVE_SA_SIGINFO, [1], [SA_SIGINFO macro]))
2723 dnl check if we support the SIGPIPE signal
2724 AC_TRY_LINK([#include <signal.h>], [int x = SIGPIPE;],
2725 AC_DEFINE(HAVE_SIGPIPE, [1], [SIGPIPE signal]))
2727 dnl check if we support the SIGHUP signal
2728 AC_TRY_LINK([#include <signal.h>], [int x = SIGHUP;],
2729 AC_DEFINE(HAVE_SIGHUP, [1], [SIGHUP signal]))
2731 dnl check if we support the SIGBUS signal
2732 AC_TRY_LINK([#include <signal.h>], [int x = SIGBUS;],
2733 AC_DEFINE(HAVE_SIGBUS, [1], [SIGBUS signal]))
2735 dnl check if we need to explicitly include signal.h
2736 AC_TRY_LINK([#include <sys/wait.h>],
2737 [ typedef void (*SIGRET)(int);
2739 ], AC_DEFINE(HAVE_WAIT_INCLUDES_SIGNAL, [1], [indirect signal.h]))
2741 dnl check for name and type of time fields in struct stat
2742 dnl IRIX example timespec_t st_mtim;
2743 dnl Linux example struct timespec st_mtim;
2744 dnl Darwin example struct timespec st_mtimespec;
2745 dnl Solaris example timestruc_t st_mtim;
2746 dnl FreeBSD (6.1) struct timespec st_mtimespec;
2747 dnl struct timespec {
2752 have_stat_type=false
2753 have_stat_name=false
2754 if test $have_stat_name = false
2757 changequote(<<, >>)<<[ ]st_mtimespec>>changequote([, ]),
2758 sys/stat.h, [ have_stat_name=true;
2759 AC_DEFINE(HAVE_ST_MTIME_WITH_SPEC, [1], [st_mtimespec stat field]) ])
2761 if test $have_stat_name = false -a $target_os != darwin -a $target_os != linux -a $target_os != kfreebsd -a $target_os != netbsd
2764 changequote(<<, >>)<<[ ]st_mtime>>changequote([, ]),
2765 sys/stat.h, [ have_stat_name=true;
2766 AC_DEFINE(HAVE_ST_MTIME_WITH_E, [1], [st_mtime stat field]) ])
2768 if test $have_stat_type = false
2771 changequote(<<, >>)<<timestruc_t[ ][ ]*st_mtim>>changequote([, ]),
2772 sys/stat.h, [ have_stat_type=true;
2773 AC_DEFINE(HAVE_STAT_TIMESTRUC, [1], [timestruc_t type]) ])
2775 if test $have_stat_type = false
2778 changequote(<<, >>)<<timespec_t[ ][ ]*st_mtim>>changequote([, ]),
2779 sys/stat.h, [ have_stat_type=true;
2780 AC_DEFINE(HAVE_STAT_TIMESPEC_T, [1], [timespec_t type]) ])
2782 if test $have_stat_type = false
2785 changequote(<<, >>)<<timespec[ ][ ]*st_mtim>>changequote([, ]),
2786 sys/stat.h, [ have_stat_type=true;
2787 AC_DEFINE(HAVE_STAT_TIMESPEC, [1], [timespec type]) ])
2789 if test $have_stat_type = false
2792 changequote(<<, >>)<<time_t[ ][ ]*st_mtim>>changequote([, ]),
2793 sys/stat.h, [ have_stat_type=true;
2794 AC_DEFINE(HAVE_STAT_TIME_T, [1], [time_t type]) ])
2796 if test $have_stat_type = false
2798 echo 'FATAL ERROR: Cannot determine struct stat time types.'
2799 rm -rf conftest conftest.*
2804 dnl Work out where to install stuff for this package
2805 dnl (and where to find stuff at run-time for add-on packages).
2809 dnl Predictable directory containing pcp.conf, or overridden
2810 dnl by the $PCP_CONF environment variable. If this is not set
2811 dnl (default /etc/pcp.conf), then $PCP_CONF must be set in
2812 dnl the environment.
2814 dnl The eval echo stuff is used to get around unfavourable
2815 dnl elements of the GNU standards, which cause embedding of
2816 dnl ${prefix} within many of these various $dirs.
2817 dnl http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables
2819 pcp_etc_dir=`eval echo $sysconfdir`
2820 pcp_etc_dir=`eval echo $pcp_etc_dir`
2821 AC_SUBST(pcp_etc_dir)
2822 pcp_saslconf_dir=`eval echo $sysconfdir/sasl2`
2823 pcp_saslconf_dir=`eval echo $pcp_saslconf_dir`
2824 AC_SUBST(pcp_saslconf_dir)
2825 pcp_sysconf_dir=`eval echo $sysconfdir/pcp`
2826 pcp_sysconf_dir=`eval echo $pcp_sysconf_dir`
2827 AC_SUBST(pcp_sysconf_dir)
2828 pcp_pmcdconf_path=$pcp_sysconf_dir/pmcd/pmcd.conf
2829 pcp_pmcdrclocal_path=$pcp_sysconf_dir/pmcd/rc.local
2830 pcp_pmcdoptions_path=$pcp_sysconf_dir/pmcd/pmcd.options
2831 pcp_pmwebdoptions_path=$pcp_sysconf_dir/pmwebd/pmwebd.options
2832 pcp_pmmgroptions_path=$pcp_sysconf_dir/pmmgr/pmmgr.options
2833 pcp_pmproxyoptions_path=$pcp_sysconf_dir/pmproxy/pmproxy.options
2834 pcp_pmiecontrol_path=$pcp_sysconf_dir/pmie/control
2835 pcp_pmsnapcontrol_path=$pcp_sysconf_dir/pmsnap/control
2836 pcp_pmloggercontrol_path=$pcp_sysconf_dir/pmlogger/control
2837 AC_SUBST(pcp_pmcdconf_path)
2838 AC_SUBST(pcp_pmcdoptions_path)
2839 AC_SUBST(pcp_pmcdrclocal_path)
2840 AC_SUBST(pcp_pmwebdoptions_path)
2841 AC_SUBST(pcp_pmmgroptions_path)
2842 AC_SUBST(pcp_pmproxyoptions_path)
2843 AC_SUBST(pcp_pmiecontrol_path)
2844 AC_SUBST(pcp_pmsnapcontrol_path)
2845 AC_SUBST(pcp_pmloggercontrol_path)
2847 dnl shared PCP files (shareable for diskless)
2848 pcp_share_dir=`eval echo $datarootdir/pcp`
2849 pcp_share_dir=`eval echo $pcp_share_dir`
2850 AC_SUBST(pcp_share_dir)
2852 dnl private PCP executables
2853 pcp_binadm_dir=`eval echo $libexecdir/pcp/bin`
2854 pcp_binadm_dir=`eval echo $pcp_binadm_dir`
2855 AC_SUBST(pcp_binadm_dir)
2857 dnl non-shared (i.e. system local) PCP files
2858 pcp_var_dir=`eval echo $localstatedir/lib/pcp`
2859 pcp_var_dir=`eval echo $pcp_var_dir`
2860 AC_SUBST(pcp_var_dir)
2862 dnl pmcd control and options files
2863 AC_ARG_WITH(configdir,[AC_HELP_STRING([--with-configdir],[configuration directory [LOCALSTATEDIR/pcp/config]])],
2864 [pcp_config_dir=$withval],
2865 [pcp_config_dir=$pcp_var_dir/config])
2867 pcp_pmdas_dir=$pcp_var_dir/pmdas
2868 AC_SUBST(pcp_pmdas_dir)
2870 pcp_selinux_dir=$pcp_var_dir/selinux
2871 AC_SUBST(pcp_selinux_dir)
2873 dnl runtime shared libraries
2874 pcp_lib_dir=`eval echo $libdir`
2875 pcp_lib_dir=`eval echo $pcp_lib_dir`
2876 pcp_lib32_dir=`echo $pcp_lib_dir | sed -e s,64,, -e s,//,/,`
2877 AC_SUBST(pcp_lib_dir)
2878 AC_SUBST(pcp_lib32_dir)
2881 AC_ARG_WITH(perl_installdirs,[AC_HELP_STRING([--with-perl_installdirs],[perl installdirs [vendor]])],
2882 [perl_installdirs=$withval],
2883 [perl_installdirs=vendor])
2884 perl_installdirs=`eval echo $perl_installdirs`
2885 perl_installdirs=`eval echo $perl_installdirs`
2886 AC_SUBST(perl_installdirs)
2887 AC_ARG_WITH(perl_install_base,[AC_HELP_STRING([--with-perl_install_base],[perl install_base [PREFIX]])],
2888 [perl_install_base=$withval],
2889 [perl_install_base=$prefix])
2890 perl_install_base=`eval echo $perl_install_base`
2891 perl_install_base=`eval echo $perl_install_base`
2892 AC_SUBST(perl_install_base)
2894 AC_ARG_WITH(python_prefix,[AC_HELP_STRING([--with-python_prefix],[python setup.py prefix [PREFIX]])],
2895 [python_prefix=$withval],
2896 [python_prefix=$prefix])
2897 python_prefix=`eval echo $python_prefix`
2898 python_prefix=`eval echo $python_prefix`
2899 AC_SUBST(python_prefix)
2902 pcp_x11_incflags=$X_CFLAGS
2903 AC_SUBST(pcp_x11_incflags)
2904 pcp_x11_libflags=$X_LIBS
2905 AC_SUBST(pcp_x11_libflags)
2906 pcp_x11_extra=$X_EXTRA_LIBS
2907 AC_SUBST(pcp_x11_extra)
2908 pcp_x11_pre=$X_PRE_LIBS
2909 AC_SUBST(pcp_x11_pre)
2911 dnl man pages (source)
2913 have_gzipped_manpages=false
2914 have_bzip2ed_manpages=false
2915 have_lzmaed_manpages=false
2916 have_xzed_manpages=false
2917 need_old_tbl_header=false
2919 pcp_man_dir=`eval echo $mandir`
2920 pcp_man_dir=`eval echo $pcp_man_dir`
2922 dnl guess compression in use
2923 for d in /usr/man /usr/share/man $pcp_man_dir
2925 for sd in man1 sman1
2927 if test -f $d/$sd/man.1.gz
2929 have_gzipped_manpages=true
2931 man_header=`$ZIP -d < $d/$sd/man.1.gz | head -1`
2933 elif test -f $d/$sd/man.1.bz2
2935 have_bzip2ed_manpages=true
2937 man_header=`$BZIP2 -d < $d/$sd/man.1.bz2 | head -1`
2939 elif test -f $d/$sd/man.1.lzma
2941 have_lzmaed_manpages=true
2943 man_header=`$LZMA -d < $d/$sd/man.1.lzma | head -1`
2945 elif test -f $d/$sd/man.1.xz
2947 have_xzed_manpages=true
2949 man_header=`$XZ -d < $d/$sd/man.1.xz | head -1`
2951 elif test -f $d/$sd/man.1
2953 man_header=`head -1 $d/$sd/man.1`
2959 if test x"$man_header" = "x'\\\" t" -o x"$man_header" = "x'\\\" te" ; then
2960 need_old_tbl_header=true
2962 AC_SUBST(pcp_man_dir)
2963 AC_SUBST(have_manpages)
2964 AC_SUBST(have_gzipped_manpages)
2965 AC_SUBST(have_bzip2ed_manpages)
2966 AC_SUBST(have_lzmaed_manpages)
2967 AC_SUBST(have_xzed_manpages)
2968 AC_SUBST(need_old_tbl_header)
2971 pcp_bin_dir=`eval echo $bindir`
2972 pcp_bin_dir=`eval echo $pcp_bin_dir`
2973 AC_SUBST(pcp_bin_dir)
2975 pcp_sbin_dir=`eval echo $sbindir`
2976 pcp_sbin_dir=`eval echo $pcp_sbin_dir`
2977 AC_SUBST(pcp_sbin_dir)
2980 pcp_inc_dir=`eval echo $includedir/pcp`
2981 pcp_inc_dir=`eval echo $pcp_inc_dir`
2982 AC_SUBST(pcp_inc_dir)
2984 dnl books - pdfs, html
2985 if test $target_os = linux; then
2986 pcp_books_dir=`eval echo $datarootdir/doc/pcp-doc`
2988 pcp_books_dir=`eval echo $datarootdir/doc/pcp`
2990 pcp_books_dir=`eval echo $pcp_books_dir`
2991 pcp_html_dir=`eval echo $pcp_books_dir/html`
2992 AC_SUBST(pcp_books_dir)
2993 AC_SUBST(pcp_html_dir)
2995 dnl icon pixmap files
2996 if test $target_os = linux; then
2997 pcp_icons_dir=`eval echo $datarootdir/pcp-gui/pixmaps`
2999 pcp_icons_dir=`eval echo $datarootdir/pcp/pixmaps`
3001 pcp_icons_dir=`eval echo $pcp_icons_dir`
3002 AC_SUBST(pcp_icons_dir)
3004 dnl desktop application entries
3005 pcp_desktop_dir=`eval echo $datarootdir/applications`
3006 pcp_desktop_dir=`eval echo $pcp_desktop_dir`
3007 AC_SUBST(pcp_desktop_dir)
3009 dnl rc/startup files
3010 AC_ARG_WITH(rcdir,[AC_HELP_STRING([--with-rcdir],[rc directory [SYSCONFDIR/rc.d]])],
3011 [pcp_rc_dir=$withval], [
3014 pcp_rc_dir="$pcp_share_dir/lib"
3016 pcp_rc_dir="$pcp_etc_dir/init.d"
3018 AC_SUBST(pcp_rc_dir)
3020 dnl rc sysconfig dir
3021 AC_ARG_WITH(sysconfigdir,[AC_HELP_STRING([--with-sysconfigdir],[sysconfig directory [SYSCONFDIR/sysconfig]])],
3022 [pcp_sysconfig_dir=$withval],
3023 [pcp_sysconfig_dir=$pcp_etc_dir/sysconfig])
3024 AC_SUBST(pcp_sysconfig_dir)
3027 AC_ARG_WITH(logdir,[AC_HELP_STRING([--with-logdir],[log directory [LOCALSTATEDIR/log/pcp]])],
3028 [pcp_log_dir=$withval],
3029 [pcp_log_dir=$localstatedir/log/pcp])
3030 pcp_log_dir=`eval echo $pcp_log_dir`
3031 pcp_log_dir=`eval echo $pcp_log_dir`
3032 AC_SUBST(pcp_log_dir)
3034 AC_ARG_WITH(rundir,[AC_HELP_STRING([--with-rundir],[run directory [LOCALSTATEDIR/run/pcp]])],
3035 [pcp_run_dir=$withval],
3036 [pcp_run_dir=$localstatedir/run/pcp])
3037 pcp_run_dir=`eval echo $pcp_run_dir`
3038 pcp_run_dir=`eval echo $pcp_run_dir`
3039 AC_SUBST(pcp_run_dir)
3041 dnl world-writeable temporary files directory
3042 AC_ARG_WITH(tmpdir,[AC_HELP_STRING([--with-tmpdir],[tmp directory [LOCALSTATEDIR/tmp]])],
3043 [pcp_tmpfile_dir=$withval],
3044 [pcp_tmpfile_dir=$localstatedir/tmp])
3045 pcp_tmpfile_dir=`eval echo $pcp_tmpfile_dir`
3046 pcp_tmpfile_dir=`eval echo $pcp_tmpfile_dir`
3047 AC_SUBST(pcp_tmpfile_dir)
3049 dnl non-world-writeable status files directory
3050 pcp_tmp_dir=`eval echo $pcp_var_dir/tmp`
3051 AC_SUBST(pcp_tmp_dir)
3054 AC_ARG_WITH(docdir,[AC_HELP_STRING([--with-docdir],[docs directory [DOCDIR/pcp-VERSION]])],
3055 [pcp_doc_dir=$withval],
3056 [PACKAGE=pcp-${PACKAGE_VERSION}; pcp_doc_dir=$docdir])
3057 pcp_doc_dir=`eval echo $pcp_doc_dir`
3058 pcp_doc_dir=`eval echo $pcp_doc_dir`
3059 AC_SUBST(pcp_doc_dir)
3062 AC_ARG_WITH(demosdir,[AC_HELP_STRING([--with-demosdir],[run directory [DATADIR/pcp/demos]])],
3063 [pcp_demos_dir=$withval],
3064 [pcp_demos_dir=$pcp_share_dir/demos])
3065 AC_SUBST(pcp_demos_dir)
3067 if test -z "$XCONFIRM"
3069 AC_PATH_PROG(ac_xconfirm_prog, xconfirm, $pcp_bin_dir/pmconfirm)
3071 ac_xconfirm_prog=$XCONFIRM
3073 AC_SUBST(ac_xconfirm_prog)
3075 dnl Check for FNDELAY defined in <fcntl.h>
3076 if test "$ac_cv_header_fcntl_h" = "yes"
3078 AC_MSG_CHECKING([for FNDELAY in fcntl.h])
3079 AC_TRY_COMPILE([#include <fcntl.h>],
3080 [ int i = FNDELAY; ],
3081 AC_DEFINE(HAVE_FNDELAY, [1], [FNDELAY macro])
3082 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3085 dnl check for zpool_vdev_name API style from <libzfs.h>
3086 if test "$ac_cv_header_libzfs_h" = "yes"
3088 AC_MSG_CHECKING([for 5-argument style zpool_vdev_name])
3089 AC_TRY_COMPILE([#include <libzfs.h>],
3090 [ libzfs_handle_t *zh;
3093 (void) zpool_vdev_name(zh, zp, np, B_FALSE, B_FALSE);
3095 AC_DEFINE(HAVE_ZPOOL_VDEV_NAME_5ARG, [1], [5-arg zpool_vdev_name])
3096 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3098 AC_MSG_CHECKING([for 4-argument style zpool_vdev_name])
3099 AC_TRY_COMPILE([#include <libzfs.h>],
3100 [ libzfs_handle_t *zh;
3103 (void) zpool_vdev_name(zh, zp, np, B_FALSE);
3105 AC_DEFINE(HAVE_ZPOOL_VDEV_NAME_4ARG, [1], [4-arg zpool_vdev_name])
3106 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3109 dnl Check for Network Security Services (NSS) and
3110 dnl Simple Authentication and Security Layer (SASL)
3111 if test "$do_secure" = "check" -o "$do_secure" = "yes"
3115 saved_CFLAGS="$CFLAGS"
3116 saved_CPPFLAGS="$CPPFLAGS"
3117 NSS_INC_DIRS="-I/usr/include/nss -I/usr/include/nss3"
3118 NSPR_INC_DIRS="-I/usr/include/nspr -I/usr/include/nspr4"
3119 CFLAGS="$CFLAGS $NSS_INC_DIRS $NSPR_INC_DIRS"
3120 CPPFLAGS="$CPPFLAGS $NSS_INC_DIRS $NSPR_INC_DIRS"
3122 AC_CHECK_HEADERS([nss/nss.h], [NSSCFLAGS=-I/usr/include/nss], [
3123 AC_CHECK_HEADERS([nss3/nss.h], [NSSCFLAGS=-I/usr/include/nss3], [
3125 if test "$do_secure" = "yes"
3127 AC_MSG_ERROR([cannot enable secure sockets mode - no NSS header])
3133 AC_CHECK_HEADERS([nspr/nspr.h], [NSPRCFLAGS=-I/usr/include/nspr], [
3134 AC_CHECK_HEADERS([nspr4/nspr.h], [NSPRCFLAGS=-I/usr/include/nspr4], [
3136 if test "$do_secure" = "yes"
3138 AC_MSG_ERROR([cannot enable secure sockets mode - no NSPR header])
3142 AC_SUBST(NSPRCFLAGS)
3144 AC_CHECK_HEADERS([sasl/sasl.h], [SASLCFLAGS=-I/usr/include/sasl], [
3146 if test "$do_secure" = "yes"
3148 AC_MSG_ERROR([cannot enable secure sockets mode - no SASL header])
3151 AC_SUBST(SASLCFLAGS)
3153 AC_CHECK_LIB(sasl2, sasl_server_init, [lib_for_sasl="-lsasl2"], [
3155 if test "$do_secure" = "yes"
3157 AC_MSG_ERROR([cannot enable secure sockets mode - no SASL library])
3160 AC_SUBST(lib_for_sasl)
3162 AC_CHECK_LIB(ssl, SSL_ImportFD, [lib_for_ssl="-lssl"], [
3163 AC_CHECK_LIB(ssl3, SSL_ImportFD, [lib_for_ssl="-lssl3"], [
3165 if test "$do_secure" = "yes"
3167 AC_MSG_ERROR([cannot enable secure sockets mode - no SSL library])
3171 AC_SUBST(lib_for_ssl)
3173 AC_CHECK_LIB(nss, NSS_Init, [lib_for_nss="-lnss"], [
3174 AC_CHECK_LIB(nss3, NSS_Init, [lib_for_nss="-lnss3"], [
3176 if test "$do_secure" = "yes"
3178 AC_MSG_ERROR([cannot enable secure sockets mode - no NSS library])
3182 AC_SUBST(lib_for_nss)
3184 AC_CHECK_LIB(nspr, PR_Init, [lib_for_nspr="-lnspr"], [
3185 AC_CHECK_LIB(nspr4, PR_Init, [lib_for_nspr="-lnspr4"], [
3187 if test "$do_secure" = "yes"
3189 AC_MSG_ERROR([cannot enable secure sockets mode - no NSPR library])
3193 AC_SUBST(lib_for_nspr)
3195 if test "$enable_secure" = "true"
3197 AC_DEFINE(HAVE_SECURE_SOCKETS, [1], [Encrypted sockets])
3199 AC_SUBST(enable_secure)
3201 CPPFLAGS="$saved_CPPFLAGS"
3202 CFLAGS="$saved_CFLAGS"
3205 dnl check for -latomic, needed for some -march=i386 builds with i686 c++ distro headers
3206 AC_CHECK_LIB(atomic, __atomic_fetch_add_4, [lib_for_atomic="-latomic"])
3207 AC_SUBST(lib_for_atomic)
3209 dnl check for array sessions
3210 if test -f /usr/include/sn/arsess.h
3212 pcp_mpi_dirs=libpcp_mpi\ libpcp_mpiread
3216 AC_SUBST(pcp_mpi_dirs)
3218 dnl check for Unix Domain socket family structure
3219 AC_MSG_CHECKING([for struct sockaddr_un in sys/un.h])
3221 #include <sys/types.h>
3222 #ifdef HAVE_SYS_SOCKET_H
3223 #include <sys/socket.h>
3225 #ifdef HAVE_SYS_UN_H
3228 ], [ struct sockaddr_un sa; sa.sun_family = AF_UNIX; ],
3229 AC_DEFINE(HAVE_STRUCT_SOCKADDR_UN, [1], [sockaddr_un type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3231 dnl check for Linux Unix Domain socket credential structure
3232 AC_MSG_CHECKING([for struct ucred in sys/socket.h])
3234 #include <sys/types.h>
3235 #ifdef HAVE_SYS_SOCKET_H
3236 #include <sys/socket.h>
3238 #ifdef HAVE_SYS_UN_H
3241 ], [ struct ucred ucred; ucred.uid = 0; ],
3242 AC_DEFINE(HAVE_STRUCT_UCRED, [1], [ucred type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3244 dnl check for struct timespec in <time.h>
3245 AC_MSG_CHECKING([for struct timespec in time.h])
3248 ], [ struct timespec foo; ],
3249 AC_DEFINE(HAVE_STRUCT_TIMESPEC, [1], [timespec type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3251 dnl check if we have IRIX style altzone
3252 AC_MSG_CHECKING([for altzone in time.h])
3255 ], [ time_t az = altzone; ],
3256 AC_DEFINE(HAVE_ALTZONE, [1], [altzone global]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3258 dnl If there is no altzone, check if strftime can handle %z
3259 AC_MSG_CHECKING([if strftime knows about %z])
3265 time_t t = time(NULL);
3266 struct tm * t1 = localtime (&t);
3267 if (strftime (b, 32, "%z", t1) < 3)
3269 if (strcmp(b, "%z") == 0)
3273 ], AC_DEFINE(HAVE_STRFTIME_z, [1], [strftime with %z]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
3275 dnl does strerror_r return char * a la GNU
3276 dnl (as opposed to the int return for XSI-compliant variants)
3277 AC_MSG_CHECKING([if strerror_r returns char *])
3279 [#include <string.h>], [strerror_r(0, NULL, 0)[0];],
3280 AC_DEFINE(HAVE_STRERROR_R_PTR, [1], [strerror_r return]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3282 dnl first check for readline on its own then with curses
3287 AC_CHECK_FUNC(readline,,
3289 AC_CHECK_LIB(readline, readline,,
3291 dnl AC seems to cache lib/func results
3292 dnl so use another readline func here
3293 AC_CHECK_LIB(readline, add_history,,,[-lcurses])
3296 if test $ac_cv_func_readline = yes
3298 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3299 elif test $ac_cv_lib_readline_readline = yes
3301 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3302 lib_for_readline=-lreadline
3303 elif test $ac_cv_lib_readline_add_history = yes
3305 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3306 lib_for_curses=-lcurses
3307 lib_for_readline=-lreadline
3309 AC_SUBST(lib_for_readline)
3310 AC_SUBST(lib_for_curses)
3314 PKG_CHECK_MODULES([zlib], [zlib >= 1.0.0], [have_zlib=true], [have_zlib=false])
3315 AC_SUBST(HAVE_ZLIB, [$have_zlib])
3317 dnl Check if we have AI_ADDRCONFIG
3318 AC_MSG_CHECKING([for AI_ADDRCONFIG])
3322 int test = AI_ADDRCONFIG;
3325 ], AC_DEFINE(HAVE_AI_ADDRCONFIG, [1], [AI_ADDRCONFIG macro]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3327 dnl Find external source tarballs for packaging
3330 if test -f ./build/tar/parfait.tar.gz
3332 AC_MSG_NOTICE([adding Parfait package to the build])
3335 AC_SUBST(have_parfait)
3338 if test -f ./build/tar/vector.tar.gz
3340 AC_MSG_NOTICE([adding Vector webapp to the build])
3343 AC_SUBST(have_vector)
3346 if test -f ./build/tar/webjs.tar.gz
3348 AC_MSG_NOTICE([adding webjs webapps to the build])
3351 AC_SUBST(have_webjs)
3353 dnl Capture special options passed to configure
3354 AC_SUBST(PACKAGE_CONFIGURE)
3361 dnl Build definitions for use in Makefiles
3362 src/include/builddefs
3363 dnl PCP paths and other defs
3364 src/include/pcp.conf
3365 dnl Linux Software Map entry
3367 dnl Preamble for deb install scripts
3368 debian/pcp.preinst.head
3369 debian/pcp.postinst.head
3370 dnl Preamble for tar install scripts
3371 build/tar/preinstall.head
3372 build/tar/postinstall.head
3373 dnl Build definitions for use in packaging
3375 build/mac/uninstall-pcp
3378 dnl verbose diagnostics
3380 dnl echo config.status: settings dump begin
3381 dnl grep '^S.".*=' config.status
3382 dnl echo config.status: settings dump end