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 LIO PMDA should be included])
1079 if test "$have_python" = true
1081 dnl rpm build for LIO PMDA needs Python rtslib module
1082 if $pcp_python_prog -c "import rtslib" >/dev/null 2>&1
1087 AC_SUBST(PMDA_LIO, $pmda_lio)
1088 if $pmda_lio; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1090 AC_MSG_CHECKING([if the libvirt PMDA should be included])
1092 if test "$have_python" = true
1094 dnl rpm build for libvirt PMDA needs Python libvirt and lxml modules
1095 if $pcp_python_prog -c "import libvirt" >/dev/null 2>&1
1097 if $pcp_python_prog -c "import lxml" >/dev/null 2>&1
1103 AC_SUBST(PMDA_LIBVIRT, $pmda_libvirt)
1104 if $pmda_libvirt; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1109 AS_IF([test "x$do_qt" != "xno"], [
1114 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])
1115 test "x$cc_is_gcc" = xyes -a $target_os = solaris && QMAKE="$QMAKE -spec solaris-g++"
1122 AC_MSG_CHECKING([Qt version])
1123 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 }'`
1124 AC_MSG_RESULT([$QT_MAJOR.$QT_MINOR.$QT_POINT])
1125 if test "$QT_MAJOR" -lt 4; then
1126 echo WARNING: Qt version 4.4 or later does not seem to be installed.
1127 echo Cannot proceed with the Qt $QT_MAJOR installation found.
1130 if test "$QT_MAJOR" -eq 4 -a "$QT_MINOR" -lt 4 ; then
1131 echo WARNING: Qt version 4.$QT_MINOR is too old.
1132 echo Qt version 4.4 or later is required for Qt builds.
1137 if test "$do_qt" != "check" -a "$enable_qt" != "true"
1139 AC_MSG_ERROR([cannot enable Qt - no supported Qt installation found])
1140 elif test "$enable_qt" = "true" -a "x$cxx" = "x"
1143 test "$do_qt" != "check" && \
1144 AC_MSG_ERROR([C++ compiler unavailable, cannot build Qt components])
1145 elif test "$do_qt" = "debug"
1147 dnl Debug/release style build? (non-debug by default)
1152 AC_SUBST(qt_release)
1157 AS_IF([test "x$do_qt3d" != "xno"], [
1158 if test -f /usr/include/Coin3/Inventor/Qt/SoQt.h
1160 enable_qt3d=$enable_qt
1161 elif test -a "$do_qt3d" = "yes"
1163 AC_MSG_ERROR([cannot enable support for 3D scene graph API])
1166 AC_SUBST(enable_qt3d)
1168 dnl check if user wants their own make program
1169 dnl note: all makefiles in this package use the gmake syntax
1172 AC_PATH_PROG(MAKE, gmake)
1175 # look elsewhere ...
1176 AC_MSG_CHECKING([for GNU make elsewhere])
1177 for f in /usr/local/bin/gmake /usr/freeware/bin/gmake /usr/local/bin/make /opt/sfw/bin/gmake nowhere
1185 if test $f = nowhere
1187 # Check if /usr/bin/make is any good
1188 mver=`/usr/bin/make --version 2>/dev/null | sed -n -e1p | cut -c1-8`
1189 if test "$mver" != "GNU Make"
1192 echo "FATAL ERROR: could not find GNU make anywhere"
1193 echo "You need to set \$MAKE as the full path to GNU make "
1194 echo "in the environment."
1195 rm -rf conftest conftest.*
1201 AC_MSG_RESULT($MAKE)
1207 dnl check if users wants their own CPP
1208 if test -z "$CPP"; then
1214 dnl check if users wants their own linker
1215 if test -z "$LD"; then
1216 AC_PATH_PROG(LD, ld, /usr/bin/ld)
1221 dnl Provide ways to override owner and group for installed files
1222 if test -z "$PCP_USER_INSTALL" ; then
1223 pcp_user_install=root
1225 pcp_user_install="$PCP_USER_INSTALL"
1227 AC_SUBST(pcp_user_install)
1228 if test -z "$PCP_GROUP_INSTALL" ; then
1231 darwin|freebsd|netbsd|openbsd)
1232 pcp_group_install=wheel
1235 pcp_group_install=root
1239 pcp_group_install="$PCP_GROUP_INSTALL"
1241 AC_SUBST(pcp_group_install)
1243 dnl check if the tar program is available
1244 if test -z "$TAR"; then
1245 AC_PATH_PROGS(TAR, gtar tar, tar)
1247 if test $target_os = darwin -a -x /usr/bin/gnutar
1254 dnl check if the gzip program is available
1255 dnl (needed to gzip man pages on some platforms)
1256 if test -z "$ZIP"; then
1257 AC_PATH_PROG(ZIP, gzip, /bin/gzip)
1259 test ! -x "$ZIP" && ZIP=/usr/local/bin/gzip
1260 test ! -x "$ZIP" && ZIP=/usr/freeware/bin/gzip
1261 test ! -x "$ZIP" && ZIP=/usr/bin/gzip
1263 test -z "$gzip" && gzip=no-gzip
1266 dnl check if the bzip2 program is available
1267 dnl (needed to bzip2 man pages on some platforms)
1268 if test -z "$BZIP2"; then
1269 AC_PATH_PROG(BZIP2, bzip2, /bin/bzip2)
1271 test ! -x "$BZIP2" && BZIP2=/usr/bin/bzip2
1272 test ! -x "$BZIP2" && BZIP2=/usr/local/bin/bzip2
1273 test ! -x "$BZIP2" && BZIP2=/usr/freeware/bin/bzip2
1275 test -z "$bzip2" && bzip2=no-bzip2
1278 dnl check if the lzma program is available
1279 dnl (needed to lzma man pages on some platforms)
1280 if test -z "$LZMA"; then
1281 AC_PATH_PROG(LZMA, lzma, /bin/lzma)
1283 test ! -x "$LZMA" && LZMA=/usr/bin/lzma
1284 test ! -x "$LZMA" && LZMA=/usr/local/bin/lzma
1285 test ! -x "$LZMA" && LZMA=/usr/freeware/bin/lzma
1287 test -z "$lzma" && lzma=no-lzma
1290 dnl check if the xz program is available
1291 dnl (needed to xz man pages on some platforms)
1292 if test -z "$XZ"; then
1293 AC_PATH_PROG(XZ, xz, /bin/xz)
1295 test ! -x "$XZ" && XZ=/usr/bin/xz
1296 test ! -x "$XZ" && XZ=/usr/local/bin/xz
1297 test ! -x "$XZ" && XZ=/usr/freeware/bin/xz
1299 test -z "$xz" && xz=no-xz
1302 dnl Check for mac PackageMaker
1303 AC_MSG_CHECKING([for PackageMaker])
1304 if test -z "$PACKAGE_MAKER"
1306 if test $target_os = darwin
1308 if test -x /Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1309 then # local XCode extras install
1310 package_maker=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1311 AC_MSG_RESULT([ yes (local install)])
1312 elif test -x /Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1314 package_maker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
1315 AC_MSG_RESULT([ yes (darwin 6.x)])
1316 elif test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
1318 AC_MSG_RESULT([ yes (darwin 7.x)])
1319 package_maker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
1321 AC_MSG_RESULT([ not found!])
1322 AC_MSG_WARN([PackageMaker not found, mac packages will not be made])
1325 AC_MSG_RESULT([ no])
1328 package_maker="$PACKAGE_MAKER"
1330 AC_SUBST(package_maker)
1332 dnl check if the hdiutil program is available
1333 if test -z "$HDIUTIL"; then
1334 AC_PATH_PROG(HDIUTIL, hdiutil)
1339 dnl check if the mkinstallp program is available (AIX)
1340 if test -z "$MKINSTALLP"; then
1341 AC_PATH_PROG(MKINSTALLP, mkinstallp)
1343 mkinstallp=$MKINSTALLP
1344 AC_SUBST(mkinstallp)
1346 dnl check for the Solaris pmgmk package maker
1347 if test -z "$PKGMK"; then
1348 AC_PATH_PROG(PKGMK, pkgmk)
1353 dnl check if the dlltool program is available
1354 if test -z "$DLLTOOL"; then
1355 AC_PATH_PROG(DLLTOOL, dlltool)
1360 dnl check if the rpmbuild program is available
1361 if test -z "$RPMBUILD"; then
1362 AC_PATH_PROG(RPMBUILD, rpmbuild)
1364 test $target_distro = slackware && RPMBUILD=''
1368 dnl check if the rpm program is available
1369 if test -z "$RPM"; then
1370 AC_PATH_PROG(RPM, rpm)
1372 test $target_distro = slackware && RPM=''
1376 dnl if rpmbuild exists, use it, otherwise use rpm
1377 if test -n "$RPMBUILD" -a -x "$RPMBUILD"
1385 dnl check if the pod2man program is available (perl man page builder)
1386 if test -z "$POD2MAN"; then
1387 AC_PATH_PROG(POD2MAN, pod2man)
1392 dnl extra check for the Perl MakeMaker package
1393 AC_MSG_CHECKING([if ExtUtils::MakeMaker is installed])
1394 perl -e "use ExtUtils::MakeMaker" 2>/dev/null
1397 AC_MSG_RESULT([ yes])
1399 AC_MSG_RESULT([ no])
1401 echo "FATAL ERROR: Perl ExtUtils::MakeMaker module missing."
1402 echo "You can either install this from your distribution, or"
1403 echo "download from CPAN (Comprehensive Perl Archive Network)."
1404 rm -rf conftest conftest.*
1408 AC_PATH_PROG(TRUEPROG, true)
1410 dnl check if the makedepend program is available
1411 if test -z "$MAKEDEPEND"; then
1412 AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUEPROG)
1414 makedepend=$MAKEDEPEND
1415 AC_SUBST(makedepend)
1417 dnl check if the md5sum program is available
1418 if test -z "$MD5SUM"; then
1419 AC_PATH_PROG(MD5SUM, md5sum, $TRUEPROG)
1424 dnl check if the Debian dpkg program is available
1425 if test -z "$DPKG"; then
1426 AC_PATH_PROG(DPKG, dpkg)
1431 dnl check for the Slackware makepkg packaging tool
1432 if test -z "$MAKEPKG"; then
1433 AC_PATH_PROG(MAKEPKG, makepkg)
1438 dnl check if a toolchain is available for the books
1439 test -z "$PUBLICAN" && AC_PATH_PROG(PUBLICAN, publican)
1442 test -z "$DBLATEX" && AC_PATH_PROG(DBLATEX, dblatex)
1445 test -z "$XMLTO" && AC_PATH_PROG(XMLTO, xmlto)
1450 if test "$do_books" = "check" -o "$do_books" = "yes"
1452 if test "$BOOK_TOOLCHAIN" != ""
1454 book_toolchain=$BOOK_TOOLCHAIN
1455 elif test "$DBLATEX" != ""
1457 book_toolchain=dblatex
1458 elif test "$PUBLICAN" != ""
1460 book_toolchain=publican
1461 elif test "$XMLTO" != ""
1463 book_toolchain=xmlto
1464 elif test "$do_books" = "yes"
1466 AC_MSG_ERROR([cannot enable books build - no toolchain found])
1469 AC_SUBST(book_toolchain)
1472 if test "$do_books_brand" != ""
1474 book_brand=$do_books_brand
1476 AC_SUBST(book_brand)
1478 dnl check if symbolic links are supported
1480 if test $target_os = mingw; then
1484 dnl if /proc is not mounted, try and mount it
1485 dnl before trying to run the ps style test below
1488 test -f /proc/stat || mount /proc >/dev/null 2>&1
1491 dnl set platform specific ps
1492 if test -n "$PROCPS"
1494 pcp_ps_prog="$PROCPS"
1498 AC_SUBST(pcp_ps_prog)
1500 dnl set platform specific event logger
1501 if test $target_os = mingw
1503 pcp_syslog_prog=pcp-eventlog
1505 pcp_syslog_prog=logger
1507 AC_SUBST(pcp_syslog_prog)
1510 if test $target_os = solaris
1512 test -f /usr/xpg4/bin/grep && grep=/usr/xpg4/bin/grep
1516 dnl checks for /proc pseudo file system
1517 AC_MSG_CHECKING([for /proc ])
1518 if test "$cross_compiling" = "yes"; then
1520 echo "cross-compile -> \"$ans\"" >&5
1530 AC_DEFINE(HAVE_PROCFS, [1], [Support for /proc pseudo-filesystem])
1535 dnl Checks for C header files.
1539 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h syslog.h)
1540 AC_CHECK_HEADERS(stddef.h sched.h dlfcn.h dl.h)
1541 AC_CHECK_HEADERS(sys/times.h sys/resource.h sys/prctl.h)
1542 AC_CHECK_HEADERS(sys/sysinfo.h sys/systeminfo.h)
1543 AC_CHECK_HEADERS(endian.h standards.h sys/byteorder.h)
1544 AC_CHECK_HEADERS(libgen.h sys/mman.h sys/un.h)
1545 AC_CHECK_HEADERS(values.h stdint.h ieeefp.h math.h)
1546 AC_CHECK_HEADERS(pwd.h grp.h regex.h sys/wait.h)
1547 AC_CHECK_HEADERS(termio.h termios.h sys/termios.h)
1548 AC_CHECK_HEADERS(sys/ioctl.h sys/select.h sys/socket.h)
1549 AC_CHECK_HEADERS(netdb.h)
1550 if test $target_os = darwin -o $target_os = openbsd
1552 AC_CHECK_HEADERS(net/if.h, [], [], [#include <sys/types.h>
1553 #include <sys/socket.h>])
1555 AC_CHECK_HEADERS(net/if.h)
1557 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h arpa/inet.h)
1558 AC_CHECK_HEADERS(windows.h winsock2.h ws2tcpip.h)
1559 AC_CHECK_HEADERS(execinfo.h bits/wordsize.h)
1560 AC_CHECK_HEADERS(iptypes.h, [], [], [#include <windows.h>])
1561 AC_CHECK_HEADERS(iphlpapi.h, [], [], [#include <winsock2.h>])
1562 AC_CHECK_HEADERS(fts.h libzfs.h)
1563 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/mount.h)
1565 dnl Check if we have <sys/endian.h> ... standard way
1566 AC_MSG_CHECKING([for sys/endian.h ])
1569 #include <sys/endian.h>
1572 ], AC_DEFINE(HAVE_SYS_ENDIAN_H, [1], [sys/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1574 dnl Check if we have <machine/endian.h> ... MacOSX way
1575 AC_MSG_CHECKING([for machine/endian.h ])
1578 #include <machine/endian.h>
1581 ], AC_DEFINE(HAVE_MACHINE_ENDIAN_H, [1], [machine/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1583 dnl Check if we have <sys/endian.h> ... IRIX strangeness
1584 AC_MSG_CHECKING([for sys/endian.h (IRIX variant) ])
1587 #include <standards.h>
1588 #include <sys/endian.h>
1591 ], AC_DEFINE(HAVE_SYS_ENDIAN_H, [1], [IRIX sys/endian.h]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1593 dnl Checks for typedefs, structures, and compiler characteristics.
1602 dnl check if regex functions come from libregex (mingw)
1603 AC_CHECK_LIB(regex, regcomp)
1605 if test $ac_cv_lib_regex_regcomp = yes
1607 lib_for_regex="-lregex"
1609 AC_SUBST(lib_for_regex)
1611 PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=true], [have_ncurses=false])
1612 AC_SUBST(HAVE_NCURSES, [$have_ncurses])
1614 PKG_CHECK_MODULES([SYSTEMD], [libsystemd],
1615 [pmda_systemd=true], [pmda_systemd=false])
1620 dnl libsystemd-journal is an alternative for older distros
1621 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-journal],
1622 [pmda_systemd=true], [pmda_systemd=false])
1624 AC_MSG_CHECKING([if the systemd PMDA should be included])
1625 AC_SUBST(PMDA_SYSTEMD, $pmda_systemd)
1626 if $pmda_systemd; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1628 pmda_infiniband=false
1629 AS_IF([test "x$do_infiniband" != "xno"], [
1630 AC_CHECK_HEADERS([infiniband/umad.h], [
1631 AC_CHECK_HEADERS([infiniband/mad.h], [pmda_infiniband=true], [])
1635 AC_CHECK_LIB(ibmad, madrpc_init)
1636 AC_CHECK_LIB(ibumad, umad_init)
1637 if test $ac_cv_lib_ibmad_madrpc_init = yes -a $ac_cv_lib_ibumad_umad_init = yes
1639 IB_LIBS="-libmad -libumad"
1641 AC_MSG_CHECKING([for port_performance_query_via])
1642 AC_TRY_LINK_FUNC(port_performance_query_via,
1643 AC_DEFINE(HAVE_PORT_PERFORMANCE_QUERY_VIA, [1], [port_performance_query_via API])
1644 have_port_performance_query_via=true
1646 have_port_performance_query_via=false
1648 AC_MSG_CHECKING([for pma_query_via])
1649 AC_TRY_LINK_FUNC(pma_query_via,
1650 AC_DEFINE(HAVE_PMA_QUERY_VIA, [1], [pma_query_via API])
1651 have_pma_query_via=true
1653 have_pma_query_via=false
1656 if test $have_pma_query_via -o $have_port_performance_query_via
1660 pmda_infiniband=false
1663 pmda_infiniband=false
1668 AC_MSG_CHECKING([if the infiniband PMDA should be included])
1669 AC_SUBST(PMDA_INFINIBAND, $pmda_infiniband)
1670 if $pmda_infiniband; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1673 AS_IF([test "x$do_papi" != "xno"], [
1676 saved_LDFLAGS="$LDFLAGS"
1677 saved_CFLAGS="$CFLAGS"
1680 dnl potentially from the environment, else empty
1681 CFLAGS="$papi_CFLAGS"
1682 LDFLAGS="$papi_LIBS"
1688 PAPI_ROOTDIR=$do_papi;
1689 CFLAGS="-I$PAPI_ROOTDIR/include"
1690 LDFLAGS="-L$PAPI_ROOTDIR/lib"
1693 PKG_CHECK_MODULES(papi,[$do_papi],[
1694 CFLAGS="$papi_CFLAGS"
1695 LDFLAGS="$papi_LIBS"])
1699 # $papi_LIBS may include -lpapi harmlessly redudantly with AC_CHECK_LIB
1700 AC_CHECK_LIB([papi], [PAPI_library_init],
1701 [papi_libs="$LDFLAGS -lpapi"],
1702 [enable_papi=false])
1703 AC_CHECK_HEADERS([papi.h], [papi_cflags="$CFLAGS"], [enable_papi=false])
1704 if test "$do_papi" != "check" -a "$enable_papi" != "true"
1706 AC_MSG_ERROR([PAPI is not installed, cannot enable the PAPI PMDA])
1708 pmda_papi=$enable_papi
1711 CFLAGS="$saved_CFLAGS"
1712 LDFLAGS="$saved_LDFLAGS"
1713 AC_SUBST(PAPI_CFLAGS, $papi_cflags)
1714 AC_SUBST(PAPI_LIBS, $papi_libs)
1716 AC_MSG_CHECKING([if the papi PMDA should be included])
1717 AC_SUBST(PMDA_PAPI, $pmda_papi)
1718 if $pmda_papi; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1720 AS_IF([test "x$pmda_papi" = "xtrue"], [
1721 dnl check if struct PAPI_component_info_t has a disabled field
1722 AC_MSG_CHECKING([whether struct PAPI_component_info_t has a disabled field])
1723 cat <<End-of-File >conftest.c
1725 int main() { PAPI_component_info_t *c; c->disabled = 0; }
1727 (eval $ac_compile) 2>conftest.out
1728 cat conftest.out >&5
1729 if test -s conftest.out
1733 AC_DEFINE(HAVE_PAPI_DISABLED_COMP, [1], [PAPI_component_info_t field])
1740 pmda_perfevent=false
1741 AS_IF([test "x$do_perfevent" != "xno" ], [
1742 enable_perfevent=true
1745 AC_CHECK_LIB([pfm], [pfm_get_os_event_encoding],
1747 [enable_perfevent=false])
1748 AC_CHECK_HEADERS([perfmon/pfmlib_perf_event.h], [], [enable_perfevent=false])
1749 if test "$do_perfevent" != "check" -a "$enable_perfevent" != "true"
1751 AC_MSG_ERROR([libpfm is not installed, cannot enable the perfevent PMDA])
1753 pmda_perfevent=$enable_perfevent
1756 AC_SUBST(PFM_LIBS, $pfm_libs)
1758 AC_MSG_CHECKING([if the perfevent PMDA should be included])
1759 AC_SUBST(PMDA_PERFEVENT, $pmda_perfevent)
1760 if $pmda_perfevent; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1762 dnl Do you have RPM Package Manager libraries for pmdarpm?
1765 AC_MSG_CHECKING([for rpmlib > 4.4.2])
1767 [AC_LANG_PROGRAM([[#include <rpm/header.h>]],
1768 [[(void)HEADERGET_EXT;]])],
1769 [AC_MSG_RESULT([yes])
1771 [AC_MSG_RESULT([no])])
1772 AC_MSG_CHECKING([if the rpm PMDA should be included])
1773 AC_SUBST(PMDA_RPM,$pmda_rpm)
1774 if $pmda_rpm; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1777 dnl Do you have the required qshape script for the postfix PMDA
1778 dnl The logic here is copied from the PMDA's Install script
1780 AC_CHECK_PROGS(QSHAPE, qshape, [], path=[$PATH:/usr/sbin])
1781 AC_MSG_CHECKING([if the postfix PMDA should be included])
1782 if test -n "$QSHAPE"
1786 for script in /usr/share/doc/packages/postfix-doc/auxiliary/qshape/qshape.pl
1788 if test -f "$script"
1795 AC_SUBST(PMDA_POSTFIX,$pmda_postfix)
1796 if $pmda_postfix; then AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); fi
1798 dnl Do you have system microhttpd libraries for pmwebapi?
1799 PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd > 0.9.9], [have_libmicrohttpd=true], [have_libmicrohttpd=false])
1800 AC_SUBST(HAVE_LIBMICROHTTPD, [$have_libmicrohttpd])
1802 dnl Do you have graphics libraries for pmwebapi?
1803 PKG_CHECK_MODULES([cairo], [cairo >= 1.2, cairo-ft >= 1.2, cairo-png >= 1.2], [have_cairo=true], [have_cairo=false])
1804 AC_SUBST(HAVE_CAIRO, [$have_cairo])
1807 AS_IF([test "x$do_webapi" != "xno"], [
1810 if test "$have_libmicrohttpd" != "true"
1813 test "$do_webapi" != "check" && \
1814 AC_MSG_ERROR([libmicrohttpd is not installed, cannot enable the web API])
1815 elif test "$do_webapi" != "check" -a "x$cxx" = "x"
1818 test "$do_webapi" != "check" && \
1819 AC_MSG_ERROR([C++ compiler unavailable, cannot enable the web API])
1822 AC_SUBST(enable_webapi)
1824 enable_manager=false
1825 AS_IF([test "x$do_manager" != "xno"], [
1828 if test "$target_os" = "mingw"
1830 enable_manager=false
1831 test "$do_manager" != "check" && \
1832 AC_MSG_ERROR([MinGW build, cannot enable daemon manager])
1833 elif test "x$cxx" = "x"
1835 enable_manager=false
1836 test "$do_manager" != "check" && \
1837 AC_MSG_ERROR([C++ compiler unavailable, cannot enable daemon manager])
1839 AC_MSG_CHECKING([compilation features for daemon manager])
1841 [ #ifndef _XOPEN_SOURCE
1842 #define _XOPEN_SOURCE 600
1847 enable_manager=false
1850 AC_SUBST(enable_manager)
1852 AC_CHECK_PROGS(SEINFO, seinfo)
1854 enable_selinux=false
1855 AS_IF([test "x$do_selinux" != "xno"], [
1856 for makefile in /usr/share/selinux/devel/Makefile
1858 if test -f "$makefile" -a "x$SEINFO" != "x"
1864 AC_SUBST(enable_selinux)
1865 AC_SUBST(pcp_selinux_dir)
1868 dnl Checks for library functions.
1872 AC_CHECK_FUNCS(mktime nanosleep usleep unsetenv)
1873 AC_CHECK_FUNCS(select socket gethostname getpeerucred getpeereid)
1874 AC_CHECK_FUNCS(uname syslog __clone pipe2 fcntl ioctl)
1875 AC_CHECK_FUNCS(prctl setlinebuf waitpid atexit kill)
1876 AC_CHECK_FUNCS(chown fchmod getcwd scandir mkstemp)
1877 AC_CHECK_FUNCS(brk sbrk posix_memalign memalign valloc)
1878 AC_CHECK_FUNCS(signal sighold sigrelse tcgetattr)
1879 AC_CHECK_FUNCS(regex regcmp regexec regcomp)
1880 AC_CHECK_FUNCS(strtod strtol strtoll strtoull strndup strchrnul)
1881 AC_CHECK_FUNCS(getuid getgid)
1882 AC_CHECK_FUNCS(getgrent getgrent_r getgrnam getgrnam_r getgrgid getgrgid_r)
1883 AC_CHECK_FUNCS(getpwent getpwent_r getpwnam getpwnam_r getpwuid getpwuid_r)
1884 AC_CHECK_FUNCS(sysinfo trace_back_stack backtrace)
1885 AC_CHECK_FUNCS(sendmsg recvmsg setns)
1887 dnl only define readdir64 on non-linux platforms that support it
1888 if test $target_os != linux -a $target_os != freebsd -a $target_os != kfreebsd -a $target_os != netbsd; then
1889 AC_CHECK_FUNCS(readdir64)
1892 dnl typedefs missing from sys/types.h, stdlib.h or stddef.h
1893 if test $target_os = solaris
1895 AC_CHECK_TYPE(__int32_t, int32_t)
1896 AC_CHECK_TYPE(__uint32_t, uint32_t)
1897 AC_CHECK_TYPE(__int64_t, int64_t)
1898 AC_CHECK_TYPE(__uint64_t, uint64_t)
1899 AC_CHECK_TYPE(uint_t, u_int32_t)
1901 AC_CHECK_TYPE(__int32_t, int)
1902 AC_CHECK_TYPE(__uint32_t, unsigned int)
1903 AC_CHECK_TYPE(__int64_t, long long)
1904 AC_CHECK_TYPE(__uint64_t, unsigned long long)
1905 AC_CHECK_TYPE(uint_t, unsigned int)
1908 dnl check if we have a type for the pointer's size integer (__psint_t)
1909 AC_MSG_CHECKING([for __psint_t ])
1912 #include <sys/types.h>
1915 ], [ __psint_t psint; ],
1916 AC_DEFINE(HAVE___PSINT_T, [1], [__psint_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1918 dnl check if we have a type for pointer difference (ptrdiff_t)
1919 AC_MSG_CHECKING([for ptrdiff_t ])
1922 #ifdef HAVE_MALLOC_H
1925 ], [ ptrdiff_t ptrdiff; ],
1926 AC_DEFINE(HAVE_PTRDIFF_T, [1], [ptrdiff_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1928 dnl check if we have types for uid_t, gid_t (POSIX) or SID (Win32)
1929 AC_MSG_CHECKING([for uid_t ])
1931 #include <sys/types.h>
1936 AC_DEFINE(HAVE_UID_T, [1], [uid_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1937 AC_MSG_CHECKING([for gid_t ])
1939 #include <sys/types.h>
1944 AC_DEFINE(HAVE_GID_T, [1], [gid_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1945 AC_MSG_CHECKING([for SID ])
1947 #ifdef HAVE_WINDOWS_H
1948 #include <windows.h>
1951 AC_DEFINE(HAVE_SID, [1], [sid type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1953 dnl check if we have a type for socklen_t
1954 AC_MSG_CHECKING([for socklen_t ])
1956 #include <sys/types.h>
1957 #ifdef HAVE_SYS_SOCKET_H
1958 #include <sys/socket.h>
1960 ], [ socklen_t len; ],
1961 AC_DEFINE(HAVE_SOCKLEN_T, [1], [socklen_t type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1963 dnl check if LL suffix on constants is supported
1966 ], [ long long x = 0LL; ],
1967 AC_DEFINE(HAVE_CONST_LONGLONG, [1], [LL suffix on constants]))
1969 dnl check if _environ is declared globally
1973 ], [ char **x = _environ; ],
1974 AC_DEFINE(HAVE_UNDERBAR_ENVIRON, [1], [_environ declared globally]))
1976 dnl check for PR_TERMCHILD and PR_SET_PDEATHSIG in <sys/prctl.h>
1977 AC_MSG_CHECKING([for PR_TERMCHILD constant in sys/prctl.h])
1979 #ifdef HAVE_SYS_PRCTL_H
1980 #include <sys/prctl.h>
1982 ], [ int i = PR_TERMCHILD; ],
1983 AC_DEFINE(HAVE_PR_TERMCHILD, [1], [PR_TERMCHILD constant]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1985 AC_MSG_CHECKING([for PR_SET_PDEATHSIG constant in sys/prctl.h])
1987 #ifdef HAVE_SYS_PRCTL_H
1988 #include <sys/prctl.h>
1990 ], [ int i = PR_SET_PDEATHSIG; ],
1991 AC_DEFINE(HAVE_PR_SET_PDEATHSIG, [1], [PR_SET_PDEATHSIG constant]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1993 AC_HEADER_TIOCGWINSZ
1995 dnl check if linker needs -rdynamic for dynamically loaded shared
1996 dnl libraries to see the symbols in the process loading them.
1997 dnl This is e.g., needed on linux for pmcd loading pmda_pmcd.so.
1998 AC_MSG_CHECKING([if linker supports -rdynamic])
1999 save_CFLAGS="$CFLAGS"
2001 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
2002 [AC_MSG_RESULT([yes])
2003 rdynamic_flag=-rdynamic],
2004 [AC_MSG_RESULT([no])
2007 CFLAGS="$save_CFLAGS"
2008 AC_SUBST([rdynamic_flag])
2011 dnl check if argument to user's select() method in scandir call is const
2012 AC_MSG_CHECKING([whether const arg for scandir() select method])
2013 cat <<End-of-File >conftest.c
2018 my_select(const struct dirent *foo) { return 0; }
2019 int main() { struct dirent **list; return scandir(".", &list, my_select, NULL); }
2021 (eval $ac_compile) 2>conftest.out
2022 cat conftest.out >&5
2023 if test -s conftest.out
2027 AC_DEFINE(HAVE_CONST_DIRENT, [1], [const arg for scandir() select method])
2032 dnl check if struct dirent has a d_off (directory offset) field
2033 AC_MSG_CHECKING([whether struct dirent has a d_off field])
2034 cat <<End-of-File >conftest.c
2038 int main() { struct dirent d; d.d_off = 0; }
2040 (eval $ac_compile) 2>conftest.out
2041 cat conftest.out >&5
2042 if test -s conftest.out
2046 AC_DEFINE(HAVE_DIRENT_D_OFF, [1], [struct dirent d_off field])
2051 dnl check if printf %p has 0x prefix
2052 AC_MSG_CHECKING([if printf %p produces 0x prefix])
2053 if test "$cross_compiling" = "yes"; then
2054 ans=$printf_p_prefix
2055 echo "cross-compile -> \"$ans\"" >&5
2057 cat <<End-of-File >conftest.c
2059 int main(int argc, char **argv) { printf("%p", argv); return(0); }
2061 (eval $ac_compile) 2>&5
2062 (eval $ac_link) 2>&5
2064 echo "./conftest -> \"$ans\"" >&5
2069 AC_DEFINE(HAVE_PRINTF_P_PFX, [1], [printf %p produces 0x])
2076 rm -rf conftest conftest.*
2080 # need to deal with this sort of cpp output ...
2081 # typedef long pid_t;
2082 # typedef unsigned int pid_t;
2083 # typedef unsigned int pid_t __attribute__ ((__mode__ (__SI__)));
2084 # __extension__ typedef int pid_t;
2091 # and chaining of the form
2092 # typedef long __pid_t;
2093 # typedef __pid_t pid_t;
2095 _raw=`$CPP conftest.c \
2097 -e 's/[[ ]]__attribute__ ((.*));/;/' \
2098 -e 's/__extension__[[ ]][[ ]]*//' \
2100 /bozo/ { print; next }
2101 $1 == "typedef" { printf "%s",$0
2107 if ($0 ~ /{/) depth = 1
2110 wantsemi == 1 { printf " %s",$0
2111 if ($0 ~ /{/) depth++
2113 if ($0 ~ /}/) depth--
2127 $1 == "typedef" { map[[$NF]] = ""
2128 for (i = 2; i < NF; i++) {
2132 map[[$NF]] = map[[$NF]] " " $i
2134 print $NF " -> " map[[$NF]] >"conftest.debug"
2137 $2 == "bozo" { t = $1
2138 printf "best guess: %s",t >"conftest.debug"
2139 while (map[[t]] != "") {
2141 printf " -> %s",t >"conftest.debug"
2143 print "" >"conftest.debug"
2152 unsigned|'unsigned int')
2158 'long long'|'long long int')
2159 if test $target_os = mingw; then
2165 'unsigned long'|'unsigned long int'|'long unsigned int')
2168 'unsigned long long'|'unsigned long long int')
2169 if test $target_os = mingw; then
2175 *\*) # pointer to a something
2178 struct\ *) # not much can be done here ...
2183 echo "FATAL ERROR: don't know what to do with type \"$_raw\""
2184 echo "... typedef mapping ..."
2186 rm -rf conftest conftest.*
2192 dnl printf type for pid_t
2193 AC_MSG_CHECKING([printf type for pid_t])
2194 if test "$cross_compiling" = "yes"; then
2196 echo "cross-compile -> \"$ans\"" >&5
2199 cat <<End-of-File >conftest.c
2200 #include <sys/types.h>
2207 AC_MSG_RESULT($fmt_pid)
2209 rm -rf conftest.c conftest.debug
2211 dnl printf type for int64_t
2212 AC_MSG_CHECKING([printf type for int64_t ])
2213 if test "$cross_compiling" = "yes"; then
2214 ans=$printf_fmt_int64
2215 echo "cross-compile -> \"$ans\"" >&5
2217 cat <<End-of-File >conftest.c
2220 #include <inttypes.h>
2223 printf("\"%s\"\n", __PRI64_PREFIX "d");
2228 (eval $ac_link) 2>&5
2229 if test -x ./conftest
2232 echo "./conftest -> \"$ans\"" >&5
2236 dnl have to try the hardway ...
2237 cat <<End-of-File >conftest.c
2244 int64_t bozo = 0x12345678abcdLL;
2245 sprintf(buf, "%lx", bozo);
2246 if (strcmp(buf, "12345678abcd") == 0)
2249 sprintf(buf, "%llx", bozo);
2250 if (strcmp(buf, "12345678abcd") == 0)
2251 printf("\"lld\"\n");
2256 (eval $ac_link) 2>&5
2257 if test -x ./conftest
2260 echo "./conftest -> \"$ans\"" >&5
2266 echo 'FATAL ERROR: Cannot determine printf format for int64_t type'
2267 rm -rf conftest conftest.*
2271 AC_MSG_RESULT("$fmt_int64")
2273 dnl and the unsigned version of this ...
2274 fmt_uint64=`echo $fmt_int64 | sed -e 's/d"/u"/'`
2275 AC_SUBST(fmt_uint64)
2276 rm -rf conftest.* conftest
2278 AC_MSG_CHECKING([strtol or strtoll for int64_t])
2279 if test "$cross_compiling" = "yes"; then
2281 echo "cross-compile -> \"$ans\"" >&5
2283 cat <<End-of-File >conftest.c
2288 long long int value = -1;
2289 value = strtol("1234567812345678", NULL, 16);
2290 if (value == 0x1234567812345678LL) {
2291 printf("strotol\n");
2294 value = strtoll("1234567812345678", NULL, 16);
2295 if (value == 0x1234567812345678LL) {
2296 printf("strtoll\n");
2302 (eval $ac_compile) 2>&5
2303 (eval $ac_link) 2>&5
2305 echo "./conftest -> \"$ans\"" >&5
2310 AC_DEFINE(strtoint64, strtol)
2311 AC_DEFINE(strtouint64, strtoul)
2312 AC_MSG_RESULT([strtol])
2315 AC_DEFINE(strtoint64, strtoll)
2316 AC_DEFINE(strtouint64, strtoull)
2317 AC_MSG_RESULT([strtoll])
2320 AC_DEFINE(strtoint64, strtoll)
2321 AC_DEFINE(strtouint64, strtoull)
2322 AC_MSG_RESULT([assuming strtoll])
2325 rm -rf conftest conftest.*
2327 if test "$do_threads" = "check" -o "$do_threads" = "yes"
2333 if test "$do_threads" = "yes"
2335 AC_MSG_ERROR([cannot enable multi-threaded mode - no pthread.h])
2339 dnl Check if pthread_mutex_t is defined in pthread.h
2340 dnl Ignore the fact that pthread.h could be missing - we don't
2341 dnl really care if this test fails because of missing pthread_mutex_t
2342 dnl or because of missing headers.
2343 AC_MSG_CHECKING([for pthread_mutex_t in pthread.h])
2345 [#include <pthread.h>], [pthread_mutex_t mymutex;],
2346 AC_DEFINE(HAVE_PTHREAD_MUTEX_T, [1], [pthread_mutex_t type]) AC_MSG_RESULT(yes),
2348 if test "$do_threads" = "yes"
2350 AC_MSG_ERROR([cannot enable multi-threaded mode - no mutexes])
2356 dnl Check which library provide pthread stuff
2357 AC_MSG_CHECKING([where pthread_create() is defined])
2358 for cand in "" pthreads pthread ; do
2362 LIBS=`echo $LIBS -l$cand`
2366 #include <pthread.h>
2369 pthread_create(NULL, NULL, NULL, NULL);
2370 ], AC_MSG_RESULT(lib${cand:-c})
2373 lib_for_pthreads="$cand"
2375 lib_for_pthreads="-l$cand"
2381 AC_SUBST(lib_for_pthreads)
2383 if test "$ac_cv_header_pthread_h" = "yes"
2385 dnl printf type for pthread_t
2386 AC_MSG_CHECKING([printf type for pthread_t])
2387 cat <<End-of-File >conftest.c
2388 #include <pthread.h>
2393 AC_MSG_RESULT($fmt_pthread)
2394 AC_SUBST(fmt_pthread)
2395 rm -rf conftest.c conftest.debug
2397 dnl check if gcc supports __thread for thread private data
2398 AC_MSG_CHECKING([if compiler supports __thread])
2399 dnl __thread support is broken in some places
2400 if test $target_os = netbsd
2402 AC_TRY_COMPILE([#include <pthread.h>
2403 #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 5 )
2408 AC_DEFINE(HAVE___THREAD, [1], [__thread private data]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2410 AC_TRY_COMPILE([#include <pthread.h>
2411 __thread int x;], [],
2412 AC_DEFINE(HAVE___THREAD, [1], [__thread private data]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2415 dnl Check if pthread_barrier_t is defined in pthread.h
2416 AC_MSG_CHECKING([for pthread_barrier_t in pthread.h])
2417 AC_TRY_COMPILE([#include <pthread.h>], [pthread_barrier_t mybarrier;],
2418 AC_DEFINE(HAVE_PTHREAD_BARRIER_T, [1], [pthread_barrier_t type]) AC_MSG_RESULT(yes),
2423 AC_MSG_CHECKING([sizeof suseconds_t])
2424 if test "$cross_compiling" = "yes"; then
2425 ans=$sizeof_suseconds_t
2426 echo "cross-compile -> \"$ans\"" >&5
2428 cat <<End-of-File >conftest.c
2429 #include <sys/time.h>
2430 main() { printf("%d", (int)sizeof(suseconds_t)); }
2432 (eval $ac_compile) 2>&5
2433 (eval $ac_link) 2>&5
2435 echo "./conftest -> \"$ans\"" >&5
2436 rm -rf conftest conftest.*
2439 AC_DEFINE_UNQUOTED(SIZEOF_SUSECONDS_T, $ans, [sizeof suseconds_t])
2441 AC_MSG_CHECKING([sizeof time_t])
2442 if test "$cross_compiling" = "yes"; then
2444 echo "cross-compile -> \"$ans\"" >&5
2446 cat <<End-of-File >conftest.c
2447 #include <sys/time.h>
2448 main() { printf("%d", (int)sizeof(time_t)); }
2450 (eval $ac_compile) 2>&5
2451 (eval $ac_link) 2>&5
2453 echo "./conftest -> \"$ans\"" >&5
2454 rm -rf conftest conftest.*
2457 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ans, [sizeof time_t])
2459 dnl check sizeof long
2460 AC_MSG_CHECKING([sizeof long])
2461 if test "$cross_compiling" = "yes"; then
2463 echo "cross-compile -> \"$ans\"" >&5
2465 cat <<End-of-File >conftest.c
2467 main() { printf("%d", (int)sizeof(long)); }
2469 (eval $ac_compile) 2>&5
2470 (eval $ac_link) 2>&5
2472 echo "./conftest -> \"$ans\"" >&5
2475 if test "$ans" = 4; then
2476 AC_DEFINE(HAVE_32BIT_LONG, [1], [sizeof long])
2477 elif test "$ans" = 8; then
2478 AC_DEFINE(HAVE_64BIT_LONG, [1], [sizeof long])
2481 echo "FATAL ERROR: size of long is not 32 or 64 bits, cannot proceed."
2482 echo "sizeof(char *) -> $ans"
2483 rm -rf conftest conftest.*
2486 rm -rf conftest conftest.*
2488 dnl check sizeof pointer
2489 AC_MSG_CHECKING([sizeof pointer])
2490 if test "$cross_compiling" = "yes"; then
2492 echo "cross-compile -> \"$ans\"" >&5
2494 cat <<End-of-File >conftest.c
2496 main() { printf("%d", (int)sizeof(char *)); }
2498 (eval $ac_compile) 2>&5
2499 (eval $ac_link) 2>&5
2501 echo "./conftest -> \"$ans\"" >&5
2504 if test "$ans" = 4; then
2505 AC_DEFINE(HAVE_32BIT_PTR, [1], [pointer size])
2507 elif test "$ans" = 8; then
2508 AC_DEFINE(HAVE_64BIT_PTR, [1], [pointer size])
2512 echo "FATAL ERROR: size of pointer is not 32 or 64 bits, cannot proceed."
2513 echo "sizeof(char *) -> $ans"
2514 rm -rf conftest conftest.*
2517 rm -rf conftest conftest.*
2519 dnl check sizeof int. If not 32, we die
2520 AC_MSG_CHECKING([sizeof int])
2521 if test "$cross_compiling" = "yes"; then
2523 echo "cross-compile -> \"$ans\"" >&5
2525 cat <<End-of-File >conftest.c
2527 main() { printf("%d", (int)sizeof(int)); }
2529 (eval $ac_compile) 2>&5
2530 (eval $ac_link) 2>&5
2532 echo "./conftest -> \"$ans\"" >&5
2538 echo "FATAL ERROR: sizeof(int) is not 32 bits, cannot proceed."
2539 echo "Note: 32-bit ints are assumed in the PCP external file formats and"
2540 echo " the over-the-wire PDU formats"
2541 rm -rf conftest conftest.*
2544 rm -rf conftest conftest.*
2546 dnl check bit field allocation order within a word
2547 AC_MSG_CHECKING([if bit fields allocated left-to-right])
2548 if test "$cross_compiling" = "yes"; then
2549 ans=$bit_field_scheme
2550 echo "cross-compile -> \"$ans\"" >&5
2552 cat <<End-of-File >conftest.c
2553 union { struct { unsigned int b:4; unsigned int c:4; } a; int p; } u;
2554 main() { u.a.b = 1; u.a.c = 2; printf("%0*x", 2*sizeof(int), u.p); }
2556 (eval $ac_compile) 2>&5
2557 (eval $ac_link) 2>&5
2559 echo "./conftest -> \"$ans\"" >&5
2564 # left-to-right starting from MSB (SGI cc on MIPS), or
2565 # left-to-right ending at LSB
2566 AC_DEFINE(HAVE_BITFIELDS_LTOR, [1], [left-to-right bitfield ordering])
2570 # right-to-left ending at MSB, or
2571 # right-to-left starting from LSB (gcc in Intel)
2575 AC_MSG_RESULT(unknown)
2576 echo "FATAL ERROR: could not fathom your compiler's bit field allocation scheme"
2577 rm -f conftest conftest.*
2581 rm -rf conftest conftest.*
2583 dnl check if compiler can cast __uint64_t to double
2591 double y = (double)x;
2592 ], AC_DEFINE(HAVE_CAST_U64_DOUBLE, [1], [compiler casts u64 to double]))
2594 dnl check if basename and dirname need -lgen, -lpcp or nothing to work
2595 dnl (assume both go together)
2596 AC_CHECK_FUNCS(basename)
2597 if test $ac_cv_func_basename = yes
2599 AC_DEFINE(HAVE_BASENAME, [1], [basename API])
2600 AC_DEFINE(HAVE_DIRNAME, [1], [dirname API])
2603 AC_CHECK_LIB(gen, basename)
2604 if test $ac_cv_lib_gen_basename = yes
2606 AC_DEFINE(HAVE_BASENAME, [1], [basename API])
2607 AC_DEFINE(HAVE_DIRNAME, [1], [dirname API])
2608 lib_for_basename="-lgen"
2610 lib_for_basename="-lpcp"
2613 AC_SUBST(lib_for_basename)
2615 dnl check if clock_gettime needs -lrt to work
2616 lib_for_clock_gettime=
2617 AC_CHECK_FUNCS(clock_gettime)
2618 if test $ac_cv_func_clock_gettime = no
2620 AC_CHECK_LIB(rt, clock_gettime)
2621 if test $ac_cv_lib_rt_clock_gettime = yes
2623 AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [clock_gettime API])
2627 AC_SUBST(lib_for_rt)
2629 dnl check if dlopen et al need -ldl to work
2631 AC_CHECK_FUNCS(dlopen)
2632 if test $ac_cv_func_dlopen = no
2634 AC_CHECK_LIB(dl, dlopen)
2635 if test $ac_cv_lib_dl_dlopen = yes
2637 AC_DEFINE(HAVE_DLOPEN, [1], [dlopen API])
2641 AC_SUBST(lib_for_dlopen)
2643 dnl check if flog10, pow, fpclassify and isnanf are available
2644 dnl in the maths library
2646 AC_CHECK_FUNCS(flog10)
2647 if test $ac_cv_func_flog10 = no
2649 AC_CHECK_LIB(m, flog10)
2650 if test $ac_cv_lib_m_flog10 = yes
2652 AC_DEFINE(HAVE_FLOG10, [1], [flog10 math API])
2656 AC_DEFINE(HAVE_FLOG10, [1], [flog10 math API])
2659 if test $ac_cv_func_pow = no
2661 AC_CHECK_LIB(m, pow)
2662 if test $ac_cv_lib_m_pow = yes
2664 AC_DEFINE(HAVE_POW, [1], [pow math API])
2668 AC_DEFINE(HAVE_POW, [1], [pow math API])
2670 AC_MSG_CHECKING([for fpclassify()])
2671 ac_cv_func_fpclassify=no
2678 if (fpclassify(x) == FP_NAN) exit(1);
2679 ], ac_cv_func_fpclassify=yes)
2680 AC_MSG_RESULT($ac_cv_func_fpclassify)
2681 if test $ac_cv_func_fpclassify = no
2684 AC_MSG_CHECKING([for fpclassify() with -lm])
2693 if (fpclassify(x) == FP_NAN) exit(1);
2694 ], ac_cv_func_fpclassify=yes)
2695 AC_MSG_RESULT($ac_cv_func_fpclassify)
2696 if test $ac_cv_func_fpclassify = yes
2702 if test $ac_cv_func_fpclassify = yes
2704 AC_DEFINE(HAVE_FPCLASSIFY, [1], [fpclassify math API])
2706 dnl prefer fpclassify() but will take isnan() and isnanf() as
2707 dnl possible alternates
2708 AC_CHECK_FUNCS(isnan)
2709 if test $ac_cv_func_isnan = no
2711 AC_CHECK_LIB(m, isnan)
2712 if test $ac_cv_lib_m_isnan = yes
2714 AC_DEFINE(HAVE_ISNAN, [1], [isnan math API])
2718 AC_CHECK_FUNCS(isnanf)
2719 if test $ac_cv_func_isnanf = no
2721 AC_CHECK_LIB(m, isnanf)
2722 if test $ac_cv_lib_m_isnanf = yes
2724 AC_DEFINE(HAVE_ISNANF, [1], [isnanf math API])
2729 AC_SUBST(lib_for_math)
2731 dnl check if we have the SIG_PF typedef
2732 AC_TRY_LINK([#include <signal.h>], [SIG_PF x;],
2733 AC_DEFINE(HAVE_SIGPF, [1], [SIG_PF typedef]))
2735 dnl check if we have the SA_SIGINFO #define
2736 AC_TRY_LINK([#include <signal.h>], [int x = SA_SIGINFO;],
2737 AC_DEFINE(HAVE_SA_SIGINFO, [1], [SA_SIGINFO macro]))
2739 dnl check if we support the SIGPIPE signal
2740 AC_TRY_LINK([#include <signal.h>], [int x = SIGPIPE;],
2741 AC_DEFINE(HAVE_SIGPIPE, [1], [SIGPIPE signal]))
2743 dnl check if we support the SIGHUP signal
2744 AC_TRY_LINK([#include <signal.h>], [int x = SIGHUP;],
2745 AC_DEFINE(HAVE_SIGHUP, [1], [SIGHUP signal]))
2747 dnl check if we support the SIGBUS signal
2748 AC_TRY_LINK([#include <signal.h>], [int x = SIGBUS;],
2749 AC_DEFINE(HAVE_SIGBUS, [1], [SIGBUS signal]))
2751 dnl check if we need to explicitly include signal.h
2752 AC_TRY_LINK([#include <sys/wait.h>],
2753 [ typedef void (*SIGRET)(int);
2755 ], AC_DEFINE(HAVE_WAIT_INCLUDES_SIGNAL, [1], [indirect signal.h]))
2757 dnl check for name and type of time fields in struct stat
2758 dnl IRIX example timespec_t st_mtim;
2759 dnl Linux example struct timespec st_mtim;
2760 dnl Darwin example struct timespec st_mtimespec;
2761 dnl Solaris example timestruc_t st_mtim;
2762 dnl FreeBSD (6.1) struct timespec st_mtimespec;
2763 dnl struct timespec {
2768 have_stat_type=false
2769 have_stat_name=false
2770 if test $have_stat_name = false
2773 changequote(<<, >>)<<[ ]st_mtimespec>>changequote([, ]),
2774 sys/stat.h, [ have_stat_name=true;
2775 AC_DEFINE(HAVE_ST_MTIME_WITH_SPEC, [1], [st_mtimespec stat field]) ])
2777 if test $have_stat_name = false -a $target_os != darwin -a $target_os != linux -a $target_os != kfreebsd -a $target_os != netbsd
2780 changequote(<<, >>)<<[ ]st_mtime>>changequote([, ]),
2781 sys/stat.h, [ have_stat_name=true;
2782 AC_DEFINE(HAVE_ST_MTIME_WITH_E, [1], [st_mtime stat field]) ])
2784 if test $have_stat_type = false
2787 changequote(<<, >>)<<timestruc_t[ ][ ]*st_mtim>>changequote([, ]),
2788 sys/stat.h, [ have_stat_type=true;
2789 AC_DEFINE(HAVE_STAT_TIMESTRUC, [1], [timestruc_t type]) ])
2791 if test $have_stat_type = false
2794 changequote(<<, >>)<<timespec_t[ ][ ]*st_mtim>>changequote([, ]),
2795 sys/stat.h, [ have_stat_type=true;
2796 AC_DEFINE(HAVE_STAT_TIMESPEC_T, [1], [timespec_t type]) ])
2798 if test $have_stat_type = false
2801 changequote(<<, >>)<<timespec[ ][ ]*st_mtim>>changequote([, ]),
2802 sys/stat.h, [ have_stat_type=true;
2803 AC_DEFINE(HAVE_STAT_TIMESPEC, [1], [timespec type]) ])
2805 if test $have_stat_type = false
2808 changequote(<<, >>)<<time_t[ ][ ]*st_mtim>>changequote([, ]),
2809 sys/stat.h, [ have_stat_type=true;
2810 AC_DEFINE(HAVE_STAT_TIME_T, [1], [time_t type]) ])
2812 if test $have_stat_type = false
2814 echo 'FATAL ERROR: Cannot determine struct stat time types.'
2815 rm -rf conftest conftest.*
2820 dnl Work out where to install stuff for this package
2821 dnl (and where to find stuff at run-time for add-on packages).
2825 dnl Predictable directory containing pcp.conf, or overridden
2826 dnl by the $PCP_CONF environment variable. If this is not set
2827 dnl (default /etc/pcp.conf), then $PCP_CONF must be set in
2828 dnl the environment.
2830 dnl The eval echo stuff is used to get around unfavourable
2831 dnl elements of the GNU standards, which cause embedding of
2832 dnl ${prefix} within many of these various $dirs.
2833 dnl http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables
2835 pcp_etc_dir=`eval echo $sysconfdir`
2836 pcp_etc_dir=`eval echo $pcp_etc_dir`
2837 AC_SUBST(pcp_etc_dir)
2838 pcp_saslconf_dir=`eval echo $sysconfdir/sasl2`
2839 pcp_saslconf_dir=`eval echo $pcp_saslconf_dir`
2840 AC_SUBST(pcp_saslconf_dir)
2841 pcp_sysconf_dir=`eval echo $sysconfdir/pcp`
2842 pcp_sysconf_dir=`eval echo $pcp_sysconf_dir`
2843 AC_SUBST(pcp_sysconf_dir)
2844 pcp_pmcdconf_path=$pcp_sysconf_dir/pmcd/pmcd.conf
2845 pcp_pmcdrclocal_path=$pcp_sysconf_dir/pmcd/rc.local
2846 pcp_pmcdoptions_path=$pcp_sysconf_dir/pmcd/pmcd.options
2847 pcp_pmwebdoptions_path=$pcp_sysconf_dir/pmwebd/pmwebd.options
2848 pcp_pmmgroptions_path=$pcp_sysconf_dir/pmmgr/pmmgr.options
2849 pcp_pmproxyoptions_path=$pcp_sysconf_dir/pmproxy/pmproxy.options
2850 pcp_pmiecontrol_path=$pcp_sysconf_dir/pmie/control
2851 pcp_pmsnapcontrol_path=$pcp_sysconf_dir/pmsnap/control
2852 pcp_pmloggercontrol_path=$pcp_sysconf_dir/pmlogger/control
2853 AC_SUBST(pcp_pmcdconf_path)
2854 AC_SUBST(pcp_pmcdoptions_path)
2855 AC_SUBST(pcp_pmcdrclocal_path)
2856 AC_SUBST(pcp_pmwebdoptions_path)
2857 AC_SUBST(pcp_pmmgroptions_path)
2858 AC_SUBST(pcp_pmproxyoptions_path)
2859 AC_SUBST(pcp_pmiecontrol_path)
2860 AC_SUBST(pcp_pmsnapcontrol_path)
2861 AC_SUBST(pcp_pmloggercontrol_path)
2863 dnl shared PCP files (shareable for diskless)
2864 pcp_share_dir=`eval echo $datarootdir/pcp`
2865 pcp_share_dir=`eval echo $pcp_share_dir`
2866 AC_SUBST(pcp_share_dir)
2868 dnl private PCP executables
2869 pcp_binadm_dir=`eval echo $libexecdir/pcp/bin`
2870 pcp_binadm_dir=`eval echo $pcp_binadm_dir`
2871 AC_SUBST(pcp_binadm_dir)
2873 dnl non-shared (i.e. system local) PCP files
2874 pcp_var_dir=`eval echo $localstatedir/lib/pcp`
2875 pcp_var_dir=`eval echo $pcp_var_dir`
2876 AC_SUBST(pcp_var_dir)
2878 dnl pmcd control and options files
2879 AC_ARG_WITH(configdir,[AC_HELP_STRING([--with-configdir],[configuration directory [LOCALSTATEDIR/pcp/config]])],
2880 [pcp_config_dir=$withval],
2881 [pcp_config_dir=$pcp_var_dir/config])
2883 pcp_pmdas_dir=$pcp_var_dir/pmdas
2884 AC_SUBST(pcp_pmdas_dir)
2886 pcp_selinux_dir=$pcp_var_dir/selinux
2887 AC_SUBST(pcp_selinux_dir)
2889 dnl runtime shared libraries
2890 pcp_lib_dir=`eval echo $libdir`
2891 pcp_lib_dir=`eval echo $pcp_lib_dir`
2892 pcp_lib32_dir=`echo $pcp_lib_dir | sed -e s,64,, -e s,//,/,`
2893 AC_SUBST(pcp_lib_dir)
2894 AC_SUBST(pcp_lib32_dir)
2897 AC_ARG_WITH(perl_installdirs,[AC_HELP_STRING([--with-perl_installdirs],[perl installdirs [vendor]])],
2898 [perl_installdirs=$withval],
2899 [perl_installdirs=vendor])
2900 perl_installdirs=`eval echo $perl_installdirs`
2901 perl_installdirs=`eval echo $perl_installdirs`
2902 AC_SUBST(perl_installdirs)
2903 AC_ARG_WITH(perl_install_base,[AC_HELP_STRING([--with-perl_install_base],[perl install_base [PREFIX]])],
2904 [perl_install_base=$withval],
2905 [perl_install_base=$prefix])
2906 perl_install_base=`eval echo $perl_install_base`
2907 perl_install_base=`eval echo $perl_install_base`
2908 AC_SUBST(perl_install_base)
2910 AC_ARG_WITH(python_prefix,[AC_HELP_STRING([--with-python_prefix],[python setup.py prefix [PREFIX]])],
2911 [python_prefix=$withval],
2912 [python_prefix=$prefix])
2913 python_prefix=`eval echo $python_prefix`
2914 python_prefix=`eval echo $python_prefix`
2915 AC_SUBST(python_prefix)
2918 pcp_x11_incflags=$X_CFLAGS
2919 AC_SUBST(pcp_x11_incflags)
2920 pcp_x11_libflags=$X_LIBS
2921 AC_SUBST(pcp_x11_libflags)
2922 pcp_x11_extra=$X_EXTRA_LIBS
2923 AC_SUBST(pcp_x11_extra)
2924 pcp_x11_pre=$X_PRE_LIBS
2925 AC_SUBST(pcp_x11_pre)
2927 dnl man pages (source)
2929 have_gzipped_manpages=false
2930 have_bzip2ed_manpages=false
2931 have_lzmaed_manpages=false
2932 have_xzed_manpages=false
2933 need_old_tbl_header=false
2935 pcp_man_dir=`eval echo $mandir`
2936 pcp_man_dir=`eval echo $pcp_man_dir`
2938 dnl guess compression in use
2939 for d in /usr/man /usr/share/man $pcp_man_dir
2941 for sd in man1 sman1
2943 if test -f $d/$sd/man.1.gz
2945 have_gzipped_manpages=true
2947 man_header=`$ZIP -d < $d/$sd/man.1.gz | head -1`
2949 elif test -f $d/$sd/man.1.bz2
2951 have_bzip2ed_manpages=true
2953 man_header=`$BZIP2 -d < $d/$sd/man.1.bz2 | head -1`
2955 elif test -f $d/$sd/man.1.lzma
2957 have_lzmaed_manpages=true
2959 man_header=`$LZMA -d < $d/$sd/man.1.lzma | head -1`
2961 elif test -f $d/$sd/man.1.xz
2963 have_xzed_manpages=true
2965 man_header=`$XZ -d < $d/$sd/man.1.xz | head -1`
2967 elif test -f $d/$sd/man.1
2969 man_header=`head -1 $d/$sd/man.1`
2975 if test x"$man_header" = "x'\\\" t" -o x"$man_header" = "x'\\\" te" ; then
2976 need_old_tbl_header=true
2978 AC_SUBST(pcp_man_dir)
2979 AC_SUBST(have_manpages)
2980 AC_SUBST(have_gzipped_manpages)
2981 AC_SUBST(have_bzip2ed_manpages)
2982 AC_SUBST(have_lzmaed_manpages)
2983 AC_SUBST(have_xzed_manpages)
2984 AC_SUBST(need_old_tbl_header)
2987 pcp_bin_dir=`eval echo $bindir`
2988 pcp_bin_dir=`eval echo $pcp_bin_dir`
2989 AC_SUBST(pcp_bin_dir)
2991 pcp_sbin_dir=`eval echo $sbindir`
2992 pcp_sbin_dir=`eval echo $pcp_sbin_dir`
2993 AC_SUBST(pcp_sbin_dir)
2996 pcp_inc_dir=`eval echo $includedir/pcp`
2997 pcp_inc_dir=`eval echo $pcp_inc_dir`
2998 AC_SUBST(pcp_inc_dir)
3000 dnl books - pdfs, html
3001 if test $target_os = linux; then
3002 pcp_books_dir=`eval echo $datarootdir/doc/pcp-doc`
3004 pcp_books_dir=`eval echo $datarootdir/doc/pcp`
3006 pcp_books_dir=`eval echo $pcp_books_dir`
3007 pcp_html_dir=`eval echo $pcp_books_dir/html`
3008 AC_SUBST(pcp_books_dir)
3009 AC_SUBST(pcp_html_dir)
3011 dnl icon pixmap files
3012 if test $target_os = linux; then
3013 pcp_icons_dir=`eval echo $datarootdir/pcp-gui/pixmaps`
3015 pcp_icons_dir=`eval echo $datarootdir/pcp/pixmaps`
3017 pcp_icons_dir=`eval echo $pcp_icons_dir`
3018 AC_SUBST(pcp_icons_dir)
3020 dnl desktop application entries
3021 pcp_desktop_dir=`eval echo $datarootdir/applications`
3022 pcp_desktop_dir=`eval echo $pcp_desktop_dir`
3023 AC_SUBST(pcp_desktop_dir)
3025 dnl rc/startup files
3026 AC_ARG_WITH(rcdir,[AC_HELP_STRING([--with-rcdir],[rc directory [SYSCONFDIR/rc.d]])],
3027 [pcp_rc_dir=$withval], [
3030 pcp_rc_dir="$pcp_share_dir/lib"
3032 pcp_rc_dir="$pcp_etc_dir/init.d"
3034 AC_SUBST(pcp_rc_dir)
3036 dnl rc sysconfig dir
3037 AC_ARG_WITH(sysconfigdir,[AC_HELP_STRING([--with-sysconfigdir],[sysconfig directory [SYSCONFDIR/sysconfig]])],
3038 [pcp_sysconfig_dir=$withval],
3039 [pcp_sysconfig_dir=$pcp_etc_dir/sysconfig])
3040 AC_SUBST(pcp_sysconfig_dir)
3043 AC_ARG_WITH(logdir,[AC_HELP_STRING([--with-logdir],[log directory [LOCALSTATEDIR/log/pcp]])],
3044 [pcp_log_dir=$withval],
3045 [pcp_log_dir=$localstatedir/log/pcp])
3046 pcp_log_dir=`eval echo $pcp_log_dir`
3047 pcp_log_dir=`eval echo $pcp_log_dir`
3048 AC_SUBST(pcp_log_dir)
3050 AC_ARG_WITH(rundir,[AC_HELP_STRING([--with-rundir],[run directory [LOCALSTATEDIR/run/pcp]])],
3051 [pcp_run_dir=$withval],
3052 [pcp_run_dir=$localstatedir/run/pcp])
3053 pcp_run_dir=`eval echo $pcp_run_dir`
3054 pcp_run_dir=`eval echo $pcp_run_dir`
3055 AC_SUBST(pcp_run_dir)
3057 dnl world-writeable temporary files directory
3058 AC_ARG_WITH(tmpdir,[AC_HELP_STRING([--with-tmpdir],[tmp directory [LOCALSTATEDIR/tmp]])],
3059 [pcp_tmpfile_dir=$withval],
3060 [pcp_tmpfile_dir=$localstatedir/tmp])
3061 pcp_tmpfile_dir=`eval echo $pcp_tmpfile_dir`
3062 pcp_tmpfile_dir=`eval echo $pcp_tmpfile_dir`
3063 AC_SUBST(pcp_tmpfile_dir)
3065 dnl non-world-writeable status files directory
3066 pcp_tmp_dir=`eval echo $pcp_var_dir/tmp`
3067 AC_SUBST(pcp_tmp_dir)
3070 AC_ARG_WITH(docdir,[AC_HELP_STRING([--with-docdir],[docs directory [DOCDIR/pcp-VERSION]])],
3071 [pcp_doc_dir=$withval],
3072 [PACKAGE=pcp-${PACKAGE_VERSION}; pcp_doc_dir=$docdir])
3073 pcp_doc_dir=`eval echo $pcp_doc_dir`
3074 pcp_doc_dir=`eval echo $pcp_doc_dir`
3075 AC_SUBST(pcp_doc_dir)
3078 AC_ARG_WITH(demosdir,[AC_HELP_STRING([--with-demosdir],[run directory [DATADIR/pcp/demos]])],
3079 [pcp_demos_dir=$withval],
3080 [pcp_demos_dir=$pcp_share_dir/demos])
3081 AC_SUBST(pcp_demos_dir)
3083 if test -z "$XCONFIRM"
3085 AC_PATH_PROG(ac_xconfirm_prog, xconfirm, $pcp_bin_dir/pmconfirm)
3087 ac_xconfirm_prog=$XCONFIRM
3089 AC_SUBST(ac_xconfirm_prog)
3091 dnl Check for FNDELAY defined in <fcntl.h>
3092 if test "$ac_cv_header_fcntl_h" = "yes"
3094 AC_MSG_CHECKING([for FNDELAY in fcntl.h])
3095 AC_TRY_COMPILE([#include <fcntl.h>],
3096 [ int i = FNDELAY; ],
3097 AC_DEFINE(HAVE_FNDELAY, [1], [FNDELAY macro])
3098 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3101 dnl check for zpool_vdev_name API style from <libzfs.h>
3102 if test "$ac_cv_header_libzfs_h" = "yes"
3104 AC_MSG_CHECKING([for 5-argument style zpool_vdev_name])
3105 AC_TRY_COMPILE([#include <libzfs.h>],
3106 [ libzfs_handle_t *zh;
3109 (void) zpool_vdev_name(zh, zp, np, B_FALSE, B_FALSE);
3111 AC_DEFINE(HAVE_ZPOOL_VDEV_NAME_5ARG, [1], [5-arg zpool_vdev_name])
3112 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3114 AC_MSG_CHECKING([for 4-argument style zpool_vdev_name])
3115 AC_TRY_COMPILE([#include <libzfs.h>],
3116 [ libzfs_handle_t *zh;
3119 (void) zpool_vdev_name(zh, zp, np, B_FALSE);
3121 AC_DEFINE(HAVE_ZPOOL_VDEV_NAME_4ARG, [1], [4-arg zpool_vdev_name])
3122 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3125 dnl Check for Network Security Services (NSS) and
3126 dnl Simple Authentication and Security Layer (SASL)
3127 if test "$do_secure" = "check" -o "$do_secure" = "yes"
3131 saved_CFLAGS="$CFLAGS"
3132 saved_CPPFLAGS="$CPPFLAGS"
3133 NSS_INC_DIRS="-I/usr/include/nss -I/usr/include/nss3"
3134 NSPR_INC_DIRS="-I/usr/include/nspr -I/usr/include/nspr4"
3135 CFLAGS="$CFLAGS $NSS_INC_DIRS $NSPR_INC_DIRS"
3136 CPPFLAGS="$CPPFLAGS $NSS_INC_DIRS $NSPR_INC_DIRS"
3138 AC_CHECK_HEADERS([nss/nss.h], [NSSCFLAGS=-I/usr/include/nss], [
3139 AC_CHECK_HEADERS([nss3/nss.h], [NSSCFLAGS=-I/usr/include/nss3], [
3141 if test "$do_secure" = "yes"
3143 AC_MSG_ERROR([cannot enable secure sockets mode - no NSS header])
3149 AC_CHECK_HEADERS([nspr/nspr.h], [NSPRCFLAGS=-I/usr/include/nspr], [
3150 AC_CHECK_HEADERS([nspr4/nspr.h], [NSPRCFLAGS=-I/usr/include/nspr4], [
3152 if test "$do_secure" = "yes"
3154 AC_MSG_ERROR([cannot enable secure sockets mode - no NSPR header])
3158 AC_SUBST(NSPRCFLAGS)
3160 AC_CHECK_HEADERS([sasl/sasl.h], [SASLCFLAGS=-I/usr/include/sasl], [
3162 if test "$do_secure" = "yes"
3164 AC_MSG_ERROR([cannot enable secure sockets mode - no SASL header])
3167 AC_SUBST(SASLCFLAGS)
3169 AC_CHECK_LIB(sasl2, sasl_server_init, [lib_for_sasl="-lsasl2"], [
3171 if test "$do_secure" = "yes"
3173 AC_MSG_ERROR([cannot enable secure sockets mode - no SASL library])
3176 AC_SUBST(lib_for_sasl)
3178 AC_CHECK_LIB(ssl, SSL_ImportFD, [lib_for_ssl="-lssl"], [
3179 AC_CHECK_LIB(ssl3, SSL_ImportFD, [lib_for_ssl="-lssl3"], [
3181 if test "$do_secure" = "yes"
3183 AC_MSG_ERROR([cannot enable secure sockets mode - no SSL library])
3187 AC_SUBST(lib_for_ssl)
3189 AC_CHECK_LIB(nss, NSS_Init, [lib_for_nss="-lnss"], [
3190 AC_CHECK_LIB(nss3, NSS_Init, [lib_for_nss="-lnss3"], [
3192 if test "$do_secure" = "yes"
3194 AC_MSG_ERROR([cannot enable secure sockets mode - no NSS library])
3198 AC_SUBST(lib_for_nss)
3200 AC_CHECK_LIB(nspr, PR_Init, [lib_for_nspr="-lnspr"], [
3201 AC_CHECK_LIB(nspr4, PR_Init, [lib_for_nspr="-lnspr4"], [
3203 if test "$do_secure" = "yes"
3205 AC_MSG_ERROR([cannot enable secure sockets mode - no NSPR library])
3209 AC_SUBST(lib_for_nspr)
3211 if test "$enable_secure" = "true"
3213 AC_DEFINE(HAVE_SECURE_SOCKETS, [1], [Encrypted sockets])
3215 AC_SUBST(enable_secure)
3217 CPPFLAGS="$saved_CPPFLAGS"
3218 CFLAGS="$saved_CFLAGS"
3221 dnl check for -latomic, needed for some -march=i386 builds with i686 c++ distro headers
3222 AC_CHECK_LIB(atomic, __atomic_fetch_add_4, [lib_for_atomic="-latomic"])
3223 AC_SUBST(lib_for_atomic)
3225 dnl check for array sessions
3226 if test -f /usr/include/sn/arsess.h
3228 pcp_mpi_dirs=libpcp_mpi\ libpcp_mpiread
3232 AC_SUBST(pcp_mpi_dirs)
3234 dnl check for Unix Domain socket family structure
3235 AC_MSG_CHECKING([for struct sockaddr_un in sys/un.h])
3237 #include <sys/types.h>
3238 #ifdef HAVE_SYS_SOCKET_H
3239 #include <sys/socket.h>
3241 #ifdef HAVE_SYS_UN_H
3244 ], [ struct sockaddr_un sa; sa.sun_family = AF_UNIX; ],
3245 AC_DEFINE(HAVE_STRUCT_SOCKADDR_UN, [1], [sockaddr_un type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3247 dnl check for Linux Unix Domain socket credential structure
3248 AC_MSG_CHECKING([for struct ucred in sys/socket.h])
3250 #include <sys/types.h>
3251 #ifdef HAVE_SYS_SOCKET_H
3252 #include <sys/socket.h>
3254 #ifdef HAVE_SYS_UN_H
3257 ], [ struct ucred ucred; ucred.uid = 0; ],
3258 AC_DEFINE(HAVE_STRUCT_UCRED, [1], [ucred type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3260 dnl check for struct timespec in <time.h>
3261 AC_MSG_CHECKING([for struct timespec in time.h])
3264 ], [ struct timespec foo; ],
3265 AC_DEFINE(HAVE_STRUCT_TIMESPEC, [1], [timespec type]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3267 dnl check if we have IRIX style altzone
3268 AC_MSG_CHECKING([for altzone in time.h])
3271 ], [ time_t az = altzone; ],
3272 AC_DEFINE(HAVE_ALTZONE, [1], [altzone global]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3274 dnl If there is no altzone, check if strftime can handle %z
3275 AC_MSG_CHECKING([if strftime knows about %z])
3281 time_t t = time(NULL);
3282 struct tm * t1 = localtime (&t);
3283 if (strftime (b, 32, "%z", t1) < 3)
3285 if (strcmp(b, "%z") == 0)
3289 ], AC_DEFINE(HAVE_STRFTIME_z, [1], [strftime with %z]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
3291 dnl does strerror_r return char * a la GNU
3292 dnl (as opposed to the int return for XSI-compliant variants)
3293 AC_MSG_CHECKING([if strerror_r returns char *])
3295 [#include <string.h>], [strerror_r(0, NULL, 0)[0];],
3296 AC_DEFINE(HAVE_STRERROR_R_PTR, [1], [strerror_r return]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3298 dnl first check for readline on its own then with curses
3303 AC_CHECK_FUNC(readline,,
3305 AC_CHECK_LIB(readline, readline,,
3307 dnl AC seems to cache lib/func results
3308 dnl so use another readline func here
3309 AC_CHECK_LIB(readline, add_history,,,[-lcurses])
3312 if test $ac_cv_func_readline = yes
3314 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3315 elif test $ac_cv_lib_readline_readline = yes
3317 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3318 lib_for_readline=-lreadline
3319 elif test $ac_cv_lib_readline_add_history = yes
3321 AC_DEFINE(HAVE_READLINE, [1], [readline API])
3322 lib_for_curses=-lcurses
3323 lib_for_readline=-lreadline
3325 AC_SUBST(lib_for_readline)
3326 AC_SUBST(lib_for_curses)
3330 PKG_CHECK_MODULES([zlib], [zlib >= 1.0.0], [have_zlib=true], [have_zlib=false])
3331 AC_SUBST(HAVE_ZLIB, [$have_zlib])
3333 dnl Check if we have AI_ADDRCONFIG
3334 AC_MSG_CHECKING([for AI_ADDRCONFIG])
3338 int test = AI_ADDRCONFIG;
3341 ], AC_DEFINE(HAVE_AI_ADDRCONFIG, [1], [AI_ADDRCONFIG macro]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3343 dnl Find external source tarballs for packaging
3346 if test -f ./build/tar/parfait.tar.gz
3348 AC_MSG_NOTICE([adding Parfait package to the build])
3351 AC_SUBST(have_parfait)
3354 if test -f ./build/tar/vector.tar.gz
3356 AC_MSG_NOTICE([adding Vector webapp to the build])
3359 AC_SUBST(have_vector)
3362 if test -f ./build/tar/webjs.tar.gz
3364 AC_MSG_NOTICE([adding webjs webapps to the build])
3367 AC_SUBST(have_webjs)
3369 dnl Capture special options passed to configure
3370 AC_SUBST(PACKAGE_CONFIGURE)
3377 dnl Build definitions for use in Makefiles
3378 src/include/builddefs
3379 dnl PCP paths and other defs
3380 src/include/pcp.conf
3381 dnl Linux Software Map entry
3383 dnl Preamble for deb install scripts
3384 debian/pcp.preinst.head
3385 debian/pcp.postinst.head
3386 dnl Preamble for tar install scripts
3387 build/tar/preinstall.head
3388 build/tar/postinstall.head
3389 dnl Build definitions for use in packaging
3391 build/mac/uninstall-pcp
3394 dnl verbose diagnostics
3396 dnl echo config.status: settings dump begin
3397 dnl grep '^S.".*=' config.status
3398 dnl echo config.status: settings dump end