"Fossies" - the Fresh Open Source Software Archive

Member "pacemaker-Pacemaker-2.1.0/configure.ac" (8 Jun 2021, 81499 Bytes) of package /linux/misc/pacemaker-Pacemaker-2.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "configure.ac": 2.1.0-rc2_vs_2.1.0-rc3.

    1 dnl
    2 dnl autoconf for Pacemaker
    3 dnl
    4 dnl Copyright 2009-2021 the Pacemaker project contributors
    5 dnl
    6 dnl The version control history for this file may have further details.
    7 dnl
    8 dnl This source code is licensed under the GNU General Public License version 2
    9 dnl or later (GPLv2+) WITHOUT ANY WARRANTY.
   10 
   11 dnl ===============================================
   12 dnl Bootstrap
   13 dnl ===============================================
   14 AC_PREREQ(2.64)
   15 
   16 dnl AC_CONFIG_MACRO_DIR is deprecated as of autoconf 2.70 (2020-12-08).
   17 dnl Once we can require that version, we can simplify this, and no longer
   18 dnl need ACLOCAL_AMFLAGS in Makefile.am.
   19 m4_ifdef([AC_CONFIG_MACRO_DIRS],
   20          [AC_CONFIG_MACRO_DIRS([m4])],
   21          [AC_CONFIG_MACRO_DIR([m4])])
   22 
   23 AC_DEFUN([AC_DATAROOTDIR_CHECKED])
   24 
   25 dnl Suggested structure:
   26 dnl     information on the package
   27 dnl     checks for programs
   28 dnl     checks for libraries
   29 dnl     checks for header files
   30 dnl     checks for types
   31 dnl     checks for structures
   32 dnl     checks for compiler characteristics
   33 dnl     checks for library functions
   34 dnl     checks for system services
   35 
   36 m4_include([m4/version.m4])
   37 AC_INIT([pacemaker], VERSION_NUMBER, [users@clusterlabs.org], [pacemaker],
   38         PCMK_URL)
   39 
   40 PCMK_FEATURES=""
   41 
   42 LT_CONFIG_LTDL_DIR([libltdl])
   43 AC_CONFIG_AUX_DIR([libltdl/config])
   44 AC_CANONICAL_HOST
   45 
   46 dnl Where #defines that autoconf makes (e.g. HAVE_whatever) go
   47 dnl
   48 dnl Internal header: include/config.h
   49 dnl   - Contains ALL defines
   50 dnl   - include/config.h.in is generated automatically by autoheader
   51 dnl   - NOT to be included in any header files except crm_internal.h
   52 dnl     (which is also not to be included in any other header files)
   53 dnl
   54 dnl External header: include/crm_config.h
   55 dnl   - Contains a subset of defines checked here
   56 dnl   - Manually edit include/crm_config.h.in to have configure include
   57 dnl     new defines
   58 dnl   - Should not include HAVE_* defines
   59 dnl   - Safe to include anywhere
   60 AC_CONFIG_HEADERS([include/config.h include/crm_config.h])
   61 
   62 dnl 1.13:           minimum automake version required
   63 dnl foreign:        don't require GNU-standard top-level files
   64 dnl tar-ustar:      use (older) POSIX variant of generated tar rather than v7
   65 dnl subdir-objects: keep .o's with their .c's (no-op in 2.0+)
   66 AM_INIT_AUTOMAKE([1.13 foreign tar-ustar subdir-objects])
   67 
   68 dnl Require minimum version of pkg-config
   69 PKG_PROG_PKG_CONFIG(0.27)
   70 AS_IF([test "x${PKG_CONFIG}" != x], [],
   71       [AC_MSG_FAILURE([Could not find required build tool pkg-config (0.27 or later)])])
   72 PKG_INSTALLDIR
   73 PKG_NOARCH_INSTALLDIR
   74 
   75 dnl Example 2.4. Silent Custom Rule to Generate a File
   76 dnl %-bar.pc: %.pc
   77 dnl	$(AM_V_GEN)$(LN_S) $(notdir $^) $@
   78 
   79 dnl Versioned attributes implementation is not yet production-ready
   80 AC_DEFINE_UNQUOTED(ENABLE_VERSIONED_ATTRS, 0, [Enable versioned attributes])
   81 
   82 CC_IN_CONFIGURE=yes
   83 export CC_IN_CONFIGURE
   84 
   85 LDD=ldd
   86 
   87 GLIB_TESTS
   88 
   89 dnl ========================================================================
   90 dnl Compiler characteristics
   91 dnl ========================================================================
   92 
   93 dnl A particular compiler can be forced by setting the CC environment variable
   94 AC_PROG_CC
   95 
   96 dnl Use at least C99 if possible. This will generate an "obsolete" warning
   97 dnl since autoconf 2.70, but is needed for older versions.
   98 AC_PROG_CC_STDC
   99 
  100 dnl C++ is not needed for build, just maintainer utilities
  101 AC_PROG_CXX
  102 
  103 dnl We use md5.c from gnulib, which has its own m4 macros. Per its docs:
  104 dnl "The macro gl_EARLY must be called as soon as possible after verifying that
  105 dnl the C compiler is working. ... The core part of the gnulib checks are done
  106 dnl by the macro gl_INIT." In addition, prevent gnulib from introducing OpenSSL
  107 dnl as a dependency.
  108 gl_EARLY
  109 gl_SET_CRYPTO_CHECK_DEFAULT([no])
  110 gl_INIT
  111 
  112 # --enable-new-dtags: Use RUNPATH instead of RPATH.
  113 # It is necessary to have this done before libtool does linker detection.
  114 # See also: https://github.com/kronosnet/kronosnet/issues/107
  115 AX_CHECK_LINK_FLAG([-Wl,--enable-new-dtags],
  116                   [AM_LDFLAGS=-Wl,--enable-new-dtags],
  117                   [AC_MSG_ERROR(["Linker support for --enable-new-dtags is required"])])
  118 AC_SUBST([AM_LDFLAGS])
  119 
  120 saved_LDFLAGS="$LDFLAGS"
  121 LDFLAGS="$AM_LDFLAGS $LDFLAGS"
  122 LT_INIT([dlopen])
  123 LDFLAGS="$saved_LDFLAGS"
  124 LTDL_INIT([convenience])
  125 
  126 AC_TYPE_SIZE_T
  127 AC_CHECK_SIZEOF(char)
  128 AC_CHECK_SIZEOF(short)
  129 AC_CHECK_SIZEOF(int)
  130 AC_CHECK_SIZEOF(long)
  131 AC_CHECK_SIZEOF(long long)
  132 
  133 dnl ===============================================
  134 dnl Helpers
  135 dnl ===============================================
  136 cc_supports_flag() {
  137     local CFLAGS="-Werror $@"
  138     AC_MSG_CHECKING([whether $CC supports $@])
  139     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
  140                       [RC=0; AC_MSG_RESULT([yes])],
  141                       [RC=1; AC_MSG_RESULT([no])])
  142     return $RC
  143 }
  144 
  145 # Some tests need to use their own CFLAGS
  146 
  147 cc_temp_flags() {
  148     ac_save_CFLAGS="$CFLAGS"
  149     CFLAGS="$*"
  150 }
  151 
  152 cc_restore_flags() {
  153     CFLAGS=$ac_save_CFLAGS
  154 }
  155 
  156 # yes_no_try $user_response $default
  157 DISABLED=0
  158 REQUIRED=1
  159 OPTIONAL=2
  160 yes_no_try() {
  161     local value
  162     AS_IF([test x"$1" = x""], [value="$2"], [value="$1"])
  163     AS_CASE(["`echo "$value" | tr '[A-Z]' '[a-z]'`"],
  164             [0|no|false|disable], [return $DISABLED],
  165             [1|yes|true|enable], [return $REQUIRED],
  166             [try|check], [return $OPTIONAL]
  167     )
  168     AC_MSG_ERROR([Invalid option value "$value"])
  169 }
  170 
  171 check_systemdsystemunitdir() {
  172     AC_MSG_CHECKING([which system unit file directory to use])
  173     PKG_CHECK_VAR([systemdsystemunitdir], [systemd], [systemdsystemunitdir])
  174     AC_MSG_RESULT([${systemdsystemunitdir}])
  175     test x"$systemdsystemunitdir" != x""
  176     return $?
  177 }
  178 
  179 dnl ===============================================
  180 dnl Configure Options
  181 dnl ===============================================
  182 
  183 dnl Actual library checks come later, but pkg-config can be used here to grab
  184 dnl external values to use as defaults for configure options
  185 
  186 dnl --enable-* options: build process
  187 
  188 AC_ARG_ENABLE([quiet],
  189     [AS_HELP_STRING([--enable-quiet],
  190         [suppress make output unless there is an error @<:@no@:>@])]
  191 )
  192 yes_no_try "$enable_quiet" "no"
  193 enable_quiet=$?
  194 
  195 AC_ARG_ENABLE([fatal-warnings],
  196     [AS_HELP_STRING([--enable-fatal-warnings],
  197         [enable pedantic and fatal warnings for gcc @<:@try@:>@])],
  198 )
  199 yes_no_try "$enable_fatal_warnings" "try"
  200 enable_fatal_warnings=$?
  201 
  202 AC_ARG_ENABLE([hardening],
  203     [AS_HELP_STRING([--enable-hardening],
  204         [harden the resulting executables/libraries @<:@try@:>@])]
  205 )
  206 yes_no_try "$enable_hardening" "try"
  207 enable_hardening=$?
  208 
  209 dnl --enable-* options: features
  210 
  211 AC_ARG_ENABLE([systemd],
  212     [AS_HELP_STRING([--enable-systemd],
  213         [enable support for managing resources via systemd @<:@try@:>@])]
  214 )
  215 yes_no_try "$enable_systemd" "try"
  216 enable_systemd=$?
  217 
  218 AC_ARG_ENABLE([upstart],
  219     [AS_HELP_STRING([--enable-upstart],
  220         [enable support for managing resources via Upstart (deprecated) @<:@try@:>@])]
  221 )
  222 yes_no_try "$enable_upstart" "try"
  223 enable_upstart=$?
  224 
  225 dnl --enable-* options: compatibility
  226 
  227 AC_ARG_ENABLE([compat-2.0],
  228     [AS_HELP_STRING([--enable-compat-2.0], m4_normalize([
  229         preserve certain output as it was in 2.0; this option will be
  230         available only for the lifetime of the 2.1 series @<:@no@:>@]))]
  231 )
  232 yes_no_try "$enable_compat_2_0" "no"
  233 enable_compat_2_0=$?
  234 AS_IF([test $enable_compat_2_0 -ne $DISABLED],
  235       [
  236           AC_DEFINE_UNQUOTED([PCMK__COMPAT_2_0], [1],
  237                              [Keep certain output compatible with 2.0 release series])
  238           PCMK_FEATURES="$PCMK_FEATURES compat-2.0"
  239       ]
  240 )
  241 
  242 # Add an option to create symlinks at the pre-2.0.0 daemon name locations, so
  243 # that users and tools can continue to invoke those names directly (e.g., for
  244 # meta-data). This option will be removed in a future release.
  245 AC_ARG_ENABLE([legacy-links],
  246     [AS_HELP_STRING([--enable-legacy-links],
  247         [add symlinks for old daemon names (deprecated) @<:@no@:>@])]
  248 )
  249 yes_no_try "$enable_legacy_links" "no"
  250 enable_legacy_links=$?
  251 AM_CONDITIONAL([BUILD_LEGACY_LINKS], [test $enable_legacy_links -ne $DISABLED])
  252 
  253 dnl --with-* options: basic parameters
  254 
  255 dnl This argument is defined via an M4 macro so default can be a variable
  256 AC_DEFUN([VERSION_ARG],
  257     [AC_ARG_WITH([version],
  258         [AS_HELP_STRING([--with-version=VERSION],
  259             [override package version @<:@$1@:>@])],
  260         [ PACEMAKER_VERSION="$withval" ],
  261         [ PACEMAKER_VERSION="$PACKAGE_VERSION" ])]
  262 )
  263 VERSION_ARG(VERSION_NUMBER)
  264 
  265 # Redefine PACKAGE_VERSION and VERSION according to PACEMAKER_VERSION in case
  266 # the user used --with-version. Unfortunately, this can only affect the
  267 # substitution variables and later uses in this file, not the config.h
  268 # constants, so we have to be careful to use only PACEMAKER_VERSION in C code.
  269 PACKAGE_VERSION=$PACEMAKER_VERSION
  270 VERSION=$PACEMAKER_VERSION
  271 
  272 CRM_DAEMON_USER=""
  273 AC_ARG_WITH([daemon-user],
  274     [AS_HELP_STRING([--with-daemon-user=USER],
  275         [user to run unprivileged Pacemaker daemons as (advanced option: changing this may break other cluster components unless similarly configured) @<:@hacluster@:>@])],
  276     [ CRM_DAEMON_USER="$withval" ]
  277 )
  278 
  279 CRM_DAEMON_GROUP=""
  280 AC_ARG_WITH([daemon-group],
  281     [AS_HELP_STRING([--with-daemon-group=GROUP],
  282         [group to run unprivileged Pacemaker daemons as (advanced option: changing this may break other cluster components unless similarly configured) @<:@haclient@:>@])],
  283     [ CRM_DAEMON_GROUP="$withval" ]
  284 )
  285 
  286 BUG_URL=""
  287 AC_ARG_WITH([bug-url],
  288     [AS_HELP_STRING([--with-bug-url=DIR], m4_normalize([
  289         address where users should submit bug reports
  290         @<:@https://bugs.clusterlabs.org/enter_bug.cgi?product=Pacemaker@:>@]))],
  291     [ BUG_URL="$withval" ]
  292 )
  293 
  294 dnl --with-* options: features
  295 
  296 AC_ARG_WITH([cibsecrets],
  297     [AS_HELP_STRING([--with-cibsecrets],
  298         [support separate file for CIB secrets @<:@no@:>@])]
  299 )
  300 yes_no_try "$with_cibsecrets" "no"
  301 with_cibsecrets=$?
  302 
  303 AC_ARG_WITH([gnutls],
  304     [AS_HELP_STRING([--with-gnutls],
  305         [support Pacemaker Remote and remote-tls-port using GnuTLS @<:@try@:>@])]
  306 )
  307 yes_no_try "$with_gnutls" "try"
  308 with_gnutls=$?
  309 
  310 PCMK_GNUTLS_PRIORITIES="NORMAL"
  311 AC_ARG_WITH([gnutls-priorities],
  312     [AS_HELP_STRING([--with-gnutls-priorities],
  313         [default GnuTLS cipher priorities @<:@NORMAL@:>@])],
  314     [ test x"$withval" = x"no" || PCMK_GNUTLS_PRIORITIES="$withval" ]
  315 )
  316 
  317 AC_ARG_WITH([concurrent-fencing-default],
  318     [AS_HELP_STRING([--with-concurrent-fencing-default],
  319         [default value for concurrent-fencing cluster option @<:@false@:>@])],
  320 )
  321 AS_CASE([$with_concurrent_fencing_default],
  322         [""], [with_concurrent_fencing_default="false"],
  323         [false], [],
  324         [true], [PCMK_FEATURES="$PCMK_FEATURES default-concurrent-fencing"],
  325         [AC_MSG_ERROR([Invalid value "$with_concurrent_fencing_default" for --with-concurrent-fencing-default])]
  326 )
  327 AC_DEFINE_UNQUOTED([PCMK__CONCURRENT_FENCING_DEFAULT],
  328                    ["$with_concurrent_fencing_default"],
  329                    [Default value for concurrent-fencing cluster option])
  330 
  331 AC_ARG_WITH([sbd-sync-default],
  332     [AS_HELP_STRING([--with-sbd-sync-default], m4_normalize([
  333         default value used by sbd if SBD_SYNC_RESOURCE_STARTUP
  334         environment variable is not set @<:@false@:>@]))],
  335 )
  336 AS_CASE([$with_sbd_sync_default],
  337         [""], [with_sbd_sync_default=false],
  338         [false], [],
  339         [true], [PCMK_FEATURES="$PCMK_FEATURES default-sbd-sync"],
  340         [AC_MSG_ERROR([Invalid value "$with_sbd_sync_default" for --with-sbd-sync-default])]
  341 )
  342 AC_DEFINE_UNQUOTED([PCMK__SBD_SYNC_DEFAULT],
  343                    [$with_sbd_sync_default],
  344                    [Default value for SBD_SYNC_RESOURCE_STARTUP environment variable])
  345 
  346 AC_ARG_WITH([resource-stickiness-default],
  347     [AS_HELP_STRING([--with-resource-stickiness-default],
  348         [If positive, value to add to new CIBs as explicit resource default for resource-stickiness @<:@0@:>@])],
  349 )
  350 errmsg="Invalid value \"$with_resource_stickiness_default\" for --with-resource-stickiness-default"
  351 AS_CASE([$with_resource_stickiness_default],
  352         [0|""], [with_resource_stickiness_default="0"],
  353         [*[[!0-9]]*], [AC_MSG_ERROR([$errmsg])],
  354         [PCMK_FEATURES="$PCMK_FEATURES default-resource-stickiness"]
  355 )
  356 AC_DEFINE_UNQUOTED([PCMK__RESOURCE_STICKINESS_DEFAULT],
  357                    [$with_resource_stickiness_default],
  358                    [Default value for resource-stickiness resource meta-attribute])
  359 
  360 AC_ARG_WITH([corosync],
  361     [AS_HELP_STRING([--with-corosync],
  362         [support the Corosync messaging and membership layer @<:@try@:>@])]
  363 )
  364 yes_no_try "$with_corosync" "try"
  365 with_corosync=$?
  366 
  367 AC_ARG_WITH([nagios],
  368     [AS_HELP_STRING([--with-nagios], [support nagios resources])]
  369 )
  370 yes_no_try "$with_nagios" "try"
  371 with_nagios=$?
  372 
  373 dnl --with-* options: directory locations
  374 
  375 AC_ARG_WITH([nagios-plugin-dir],
  376     [AS_HELP_STRING([--with-nagios-plugin-dir=DIR],
  377         [directory for nagios plugins @<:@LIBEXECDIR/nagios/plugins@:>@])],
  378     [ NAGIOS_PLUGIN_DIR="$withval" ]
  379 )
  380 
  381 AC_ARG_WITH([nagios-metadata-dir],
  382     [AS_HELP_STRING([--with-nagios-metadata-dir=DIR],
  383         [directory for nagios plugins metadata @<:@DATADIR/nagios/plugins-metadata@:>@])],
  384     [ NAGIOS_METADATA_DIR="$withval" ]
  385 )
  386 
  387 INITDIR=""
  388 AC_ARG_WITH([initdir],
  389     [AS_HELP_STRING([--with-initdir=DIR],
  390         [directory for init (rc) scripts])],
  391     [ INITDIR="$withval" ]
  392 )
  393 
  394 systemdsystemunitdir="${systemdsystemunitdir-}"
  395 AC_ARG_WITH([systemdsystemunitdir],
  396     [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
  397         [directory for systemd unit files (advanced option: must match what systemd uses)])],
  398     [ systemdsystemunitdir="$withval" ]
  399 )
  400 
  401 CONFIGDIR=""
  402 AC_ARG_WITH([configdir],
  403     [AS_HELP_STRING([--with-configdir=DIR],
  404         [directory for Pacemaker configuration file @<:@SYSCONFDIR/sysconfig@:>@])],
  405     [ CONFIGDIR="$withval" ]
  406 )
  407 
  408 dnl --runstatedir is available as of autoconf 2.70 (2020-12-08). When users
  409 dnl have an older version, they can use our --with-runstatedir.
  410 pcmk_runstatedir=""
  411 AC_ARG_WITH([runstatedir],
  412     [AS_HELP_STRING([--with-runstatedir=DIR],
  413         [modifiable per-process data @<:@LOCALSTATEDIR/run@:>@ (ignored if --runstatedir is available)])],
  414     [ pcmk_runstatedir="$withval" ]
  415 )
  416 
  417 CRM_LOG_DIR=""
  418 AC_ARG_WITH([logdir],
  419     [AS_HELP_STRING([--with-logdir=DIR],
  420         [directory for Pacemaker log file @<:@LOCALSTATEDIR/log/pacemaker@:>@])],
  421     [ CRM_LOG_DIR="$withval" ]
  422 )
  423 
  424 CRM_BUNDLE_DIR=""
  425 AC_ARG_WITH([bundledir],
  426     [AS_HELP_STRING([--with-bundledir=DIR],
  427         [directory for Pacemaker bundle logs @<:@LOCALSTATEDIR/log/pacemaker/bundles@:>@])],
  428     [ CRM_BUNDLE_DIR="$withval" ]
  429 )
  430 
  431 dnl Get default from resource-agents if possible. Otherwise, the default uses
  432 dnl /usr/lib rather than libdir because it's determined by the OCF project and
  433 dnl not Pacemaker. Even if a user wants to install Pacemaker to /usr/local or
  434 dnl such, the OCF agents will be expected in their usual location. However, we
  435 dnl do give the user the option to override it.
  436 PKG_CHECK_VAR([OCF_ROOT_DIR], [resource-agents], [ocfrootdir], [],
  437               [OCF_ROOT_DIR="/usr/lib/ocf"])
  438 AC_ARG_WITH([ocfdir],
  439     [AS_HELP_STRING([--with-ocfdir=DIR], m4_normalize([
  440         OCF resource agent root directory (advanced option: changing this
  441         may break other cluster components unless similarly configured)
  442         @<:@value from resource-agents package if available otherwise
  443         /usr/lib/ocf@:>@]))],
  444     [ OCF_ROOT_DIR="$withval" ]
  445 )
  446 AC_SUBST(OCF_ROOT_DIR)
  447 AC_DEFINE_UNQUOTED([OCF_ROOT_DIR], ["$OCF_ROOT_DIR"],
  448                    [OCF root directory for resource agents and libraries])
  449 
  450 PKG_CHECK_VAR([OCF_RA_PATH], [resource-agents], [ocfrapath], [],
  451               [OCF_RA_PATH="$OCF_ROOT_DIR/resource.d"])
  452 AC_ARG_WITH([ocfrapath],
  453     [AS_HELP_STRING([--with-ocfrapath=DIR], m4_normalize([
  454         OCF resource agent directories (colon-separated) to search
  455         @<:@value from resource-agents package if available otherwise
  456         OCFDIR/resource.d@:>@]))],
  457     [ OCF_RA_PATH="$withval" ]
  458 )
  459 AC_SUBST(OCF_RA_PATH)
  460 AC_DEFINE_UNQUOTED([OCF_RA_PATH], ["$OCF_RA_PATH"],
  461                    [OCF directories to search for resource agents ])
  462 
  463 OCF_RA_INSTALL_DIR="$OCF_ROOT_DIR/resource.d"
  464 AC_ARG_WITH([ocfrainstalldir],
  465     [AS_HELP_STRING([--with-ocfrainstalldir=DIR], m4_normalize([
  466         OCF installation directory for Pacemakers resource agents
  467         @<:@OCFDIR/resource.d@:>@]))],
  468     [ OCF_RA_INSTALL_DIR="$withval" ]
  469 )
  470 AC_SUBST(OCF_RA_INSTALL_DIR)
  471 
  472 dnl Get default from fence-agents if available
  473 PKG_CHECK_VAR([FA_PREFIX], [fence-agents], [prefix],
  474               [PCMK__FENCE_BINDIR="${FA_PREFIX}/sbin"],
  475               [PCMK__FENCE_BINDIR="$sbindir"])
  476 AC_ARG_WITH([fence-bindir],
  477     [AS_HELP_STRING([--with-fence-bindir=DIR], m4_normalize([
  478         directory for executable fence agents @<:@value from fence-agents
  479         package if available otherwise SBINDIR@:>@]))],
  480     [ PCMK__FENCE_BINDIR="$withval" ]
  481 )
  482 AC_SUBST(PCMK__FENCE_BINDIR)
  483 
  484 dnl --with-* options: non-production testing
  485 
  486 AC_ARG_WITH([profiling],
  487     [AS_HELP_STRING([--with-profiling],
  488         [disable optimizations, for effective profiling @<:@no@:>@])]
  489 )
  490 yes_no_try "$with_profiling" "no"
  491 with_profiling=$?
  492 
  493 AC_ARG_WITH([coverage],
  494     [AS_HELP_STRING([--with-coverage],
  495         [disable optimizations, for effective profiling and coverage testing @<:@no@:>@])]
  496 )
  497 yes_no_try "$with_coverage" "no"
  498 with_coverage=$?
  499 
  500 AC_ARG_WITH([sanitizers],
  501   [AS_HELP_STRING([--with-sanitizers=...,...],
  502     [enable SANitizer build, do *NOT* use for production. Only ASAN/UBSAN/TSAN are currently supported])],
  503   [ SANITIZERS="$withval" ],
  504   [ SANITIZERS="" ])
  505 
  506 
  507 dnl ===============================================
  508 dnl General Processing
  509 dnl ===============================================
  510 
  511 AC_DEFINE_UNQUOTED(PACEMAKER_VERSION, "$VERSION",
  512                    [Version number of this Pacemaker build])
  513 
  514 PACKAGE_SERIES=`echo $VERSION | awk -F. '{ print $1"."$2 }'`
  515 AC_SUBST(PACKAGE_SERIES)
  516 
  517 AC_PROG_LN_S
  518 AC_PROG_MKDIR_P
  519 
  520 # Check for fatal warning support
  521 AS_IF([test $enable_fatal_warnings -ne $DISABLED && test "$GCC" = "yes" && cc_supports_flag -Werror],
  522       [WERROR="-Werror"],
  523       [
  524           WERROR=""
  525           AS_CASE([$enable_fatal_warnings],
  526                   [$REQUIRED], [AC_MSG_ERROR([Compiler does not support fatal warnings])],
  527                   [$OPTIONAL], [
  528                       AC_MSG_NOTICE([Compiler does not support fatal warnings])
  529                       enable_fatal_warnings=$DISABLED
  530                   ])
  531       ])
  532 
  533 AC_MSG_NOTICE([Sanitizing prefix: ${prefix}])
  534 AS_IF([test "$prefix" = "NONE"],
  535       [
  536           prefix=/usr
  537           dnl Fix default variables - "prefix" variable if not specified
  538           AS_IF([test "$localstatedir" = "\${prefix}/var"],
  539                 [localstatedir="/var"])
  540           AS_IF([test "$sysconfdir" = "\${prefix}/etc"],
  541                 [sysconfdir="/etc"])
  542       ])
  543 
  544 AC_MSG_NOTICE([Sanitizing exec_prefix: ${exec_prefix}])
  545 case $exec_prefix in
  546     prefix|NONE)
  547         exec_prefix=$prefix
  548         ;;
  549 esac
  550 
  551 AC_MSG_NOTICE([Sanitizing INITDIR: ${INITDIR}])
  552 case $INITDIR in
  553     prefix) INITDIR=$prefix;;
  554     "")
  555         AC_MSG_CHECKING([which init (rc) directory to use])
  556         for initdir in /etc/init.d /etc/rc.d/init.d /sbin/init.d \
  557             /usr/local/etc/rc.d /etc/rc.d
  558         do
  559             if
  560                 test -d $initdir
  561             then
  562                 INITDIR=$initdir
  563                 break
  564             fi
  565         done
  566         AC_MSG_RESULT([$INITDIR])
  567         ;;
  568 esac
  569 AC_SUBST(INITDIR)
  570 
  571 AC_MSG_NOTICE([Sanitizing libdir: ${libdir}])
  572 case $libdir in
  573     prefix|NONE)
  574         AC_MSG_CHECKING([which lib directory to use])
  575         for aDir in lib64 lib
  576         do
  577             trydir="${exec_prefix}/${aDir}"
  578             if
  579                 test -d ${trydir}
  580             then
  581                 libdir=${trydir}
  582                 break
  583             fi
  584         done
  585         AC_MSG_RESULT([$libdir]);
  586         ;;
  587 esac
  588 
  589 dnl Expand autoconf variables so that we don't end up with '${prefix}'
  590 dnl in #defines and python scripts
  591 dnl NOTE: Autoconf deliberately leaves them unexpanded to allow
  592 dnl    make exec_prefix=/foo install
  593 dnl No longer being able to do this seems like no great loss to me...
  594 
  595 eval prefix="`eval echo ${prefix}`"
  596 eval exec_prefix="`eval echo ${exec_prefix}`"
  597 eval bindir="`eval echo ${bindir}`"
  598 eval sbindir="`eval echo ${sbindir}`"
  599 eval libexecdir="`eval echo ${libexecdir}`"
  600 eval datadir="`eval echo ${datadir}`"
  601 eval sysconfdir="`eval echo ${sysconfdir}`"
  602 eval sharedstatedir="`eval echo ${sharedstatedir}`"
  603 eval localstatedir="`eval echo ${localstatedir}`"
  604 eval libdir="`eval echo ${libdir}`"
  605 eval includedir="`eval echo ${includedir}`"
  606 eval oldincludedir="`eval echo ${oldincludedir}`"
  607 eval infodir="`eval echo ${infodir}`"
  608 eval mandir="`eval echo ${mandir}`"
  609 
  610 dnl Home-grown variables
  611 
  612 if [ test "x${runstatedir}" = "x" ]; then
  613     if [ test "x${pcmk_runstatedir}" = "x" ]; then
  614         runstatedir="${localstatedir}/run"
  615     else
  616         runstatedir="${pcmk_runstatedir}"
  617     fi
  618 fi
  619 eval runstatedir="$(eval echo ${runstatedir})"
  620 AC_DEFINE_UNQUOTED([PCMK_RUN_DIR], ["$runstatedir"],
  621                    [Location for modifiable per-process data])
  622 AC_SUBST(runstatedir)
  623 
  624 eval INITDIR="${INITDIR}"
  625 eval docdir="`eval echo ${docdir}`"
  626 if test x"${docdir}" = x""; then
  627     docdir=${datadir}/doc/${PACKAGE}-${VERSION}
  628 fi
  629 AC_SUBST(docdir)
  630 if test x"${CONFIGDIR}" = x""; then
  631     CONFIGDIR="${sysconfdir}/sysconfig"
  632 fi
  633 AC_SUBST(CONFIGDIR)
  634 
  635 if test x"${CRM_LOG_DIR}" = x""; then
  636     CRM_LOG_DIR="${localstatedir}/log/pacemaker"
  637 fi
  638 AC_DEFINE_UNQUOTED(CRM_LOG_DIR,"$CRM_LOG_DIR", Location for Pacemaker log file)
  639 AC_SUBST(CRM_LOG_DIR)
  640 
  641 if test x"${CRM_BUNDLE_DIR}" = x""; then
  642     CRM_BUNDLE_DIR="${localstatedir}/log/pacemaker/bundles"
  643 fi
  644 AC_DEFINE_UNQUOTED(CRM_BUNDLE_DIR,"$CRM_BUNDLE_DIR", Location for Pacemaker bundle logs)
  645 AC_SUBST(CRM_BUNDLE_DIR)
  646 
  647 eval PCMK__FENCE_BINDIR="`eval echo ${PCMK__FENCE_BINDIR}`"
  648 AC_DEFINE_UNQUOTED(PCMK__FENCE_BINDIR,"$PCMK__FENCE_BINDIR",
  649                    [Location for executable fence agents])
  650 
  651 AS_IF([test x"${PCMK_GNUTLS_PRIORITIES}" != x""], [],
  652       [AC_MSG_ERROR([--with-gnutls-priorities value must not be empty])])
  653 AC_DEFINE_UNQUOTED([PCMK_GNUTLS_PRIORITIES], ["$PCMK_GNUTLS_PRIORITIES"],
  654                    [GnuTLS cipher priorities])
  655 
  656 if test x"${BUG_URL}" = x""; then
  657     BUG_URL="https://bugs.clusterlabs.org/enter_bug.cgi?product=Pacemaker"
  658 fi
  659 AC_SUBST(BUG_URL)
  660 
  661 for j in prefix exec_prefix bindir sbindir libexecdir datadir sysconfdir \
  662     sharedstatedir localstatedir libdir includedir oldincludedir infodir \
  663     mandir INITDIR docdir CONFIGDIR
  664 do
  665     dirname=`eval echo '${'${j}'}'`
  666     if
  667         test ! -d "$dirname"
  668     then
  669         AC_MSG_WARN([$j directory ($dirname) does not exist (yet)])
  670     fi
  671 done
  672 
  673 us_auth=
  674 AC_CHECK_HEADER([sys/socket.h], [
  675     AC_CHECK_DECL([SO_PEERCRED], [
  676         # Linux
  677         AC_CHECK_TYPE([struct ucred], [
  678             us_auth=peercred_ucred;
  679             AC_DEFINE([US_AUTH_PEERCRED_UCRED], [1],
  680                       [Define if Unix socket auth method is
  681                        getsockopt(s, SO_PEERCRED, &ucred, ...)])
  682         ], [
  683             # OpenBSD
  684             AC_CHECK_TYPE([struct sockpeercred], [
  685                 us_auth=localpeercred_sockepeercred;
  686                 AC_DEFINE([US_AUTH_PEERCRED_SOCKPEERCRED], [1],
  687                           [Define if Unix socket auth method is
  688                            getsockopt(s, SO_PEERCRED, &sockpeercred, ...)])
  689             ], [], [[#include <sys/socket.h>]])
  690         ], [[#define _GNU_SOURCE
  691              #include <sys/socket.h>]])
  692     ], [], [[#include <sys/socket.h>]])
  693 ])
  694 
  695 AS_IF([test -z "${us_auth}"], [
  696     # FreeBSD
  697     AC_CHECK_DECL([getpeereid], [
  698         us_auth=getpeereid;
  699         AC_DEFINE([US_AUTH_GETPEEREID], [1],
  700                   [Define if Unix socket auth method is
  701                    getpeereid(s, &uid, &gid)])
  702     ], [
  703         # Solaris/OpenIndiana
  704         AC_CHECK_DECL([getpeerucred], [
  705             us_auth=getpeerucred;
  706             AC_DEFINE([US_AUTH_GETPEERUCRED], [1],
  707                       [Define if Unix socket auth method is
  708                        getpeercred(s, &ucred)])
  709         ], [
  710             AC_MSG_FAILURE([No way to authenticate a Unix socket peer])
  711         ], [[#include <ucred.h>]])
  712     ])
  713 ])
  714 
  715 dnl OS-based decision-making is poor autotools practice; feature-based
  716 dnl mechanisms are strongly preferred. Keep this section to a bare minimum;
  717 dnl regard as a "necessary evil".
  718 INIT_EXT=""
  719 PROCFS=0
  720 case "$host_os" in
  721     dnl Solaris and some *BSD versions support procfs but not files we need
  722     *bsd*)
  723         INIT_EXT=".sh"
  724         ;;
  725     *linux*)
  726         PROCFS=1
  727         ;;
  728     darwin*)
  729         LIBS="$LIBS -L${prefix}/lib"
  730         CFLAGS="$CFLAGS -I${prefix}/include"
  731         ;;
  732 esac
  733 
  734 AC_SUBST(INIT_EXT)
  735 AC_DEFINE_UNQUOTED([SUPPORT_PROCFS], [$PROCFS],
  736                    [Define to 1 if procfs is supported])
  737 
  738 case "$host_cpu" in
  739     ppc64|powerpc64)
  740         case $CFLAGS in
  741          *powerpc64*)
  742              ;;
  743          *)
  744              if test "$GCC" = yes; then
  745                  CFLAGS="$CFLAGS -m64"
  746              fi
  747              ;;
  748         esac
  749         ;;
  750 esac
  751 
  752 # C99 doesn't guarantee uint64_t type and related format specifiers, but
  753 # prerequisites, corosync + libqb, use that widely, so the target platforms
  754 # are already pre-constrained to those "64bit-clean" (doesn't imply native
  755 # bit width) and hence we deliberately refrain from artificial surrogates
  756 # (sans manipulation through cached values).
  757 AC_CACHE_VAL(
  758     [pcmk_cv_decl_inttypes],
  759     [
  760         AC_CHECK_DECLS(
  761             [PRIu64, PRIu32, PRIx32,
  762              SCNu64],
  763             [pcmk_cv_decl_inttypes="PRIu64 PRIu32 PRIx32 SCNu64"],
  764             [
  765                 # test shall only react on "no" cached result & error out respectively
  766                 if test "x$ac_cv_have_decl_PRIu64" = xno; then
  767                     AC_MSG_ERROR([lack of inttypes.h based specifier serving uint64_t (PRIu64)])
  768                 elif test "x$ac_cv_have_decl_PRIu32" = xno; then
  769                     AC_MSG_ERROR([lack of inttypes.h based specifier serving uint32_t (PRIu32)])
  770                 elif test "x$ac_cv_have_decl_PRIx32" = xno; then
  771                     AC_MSG_ERROR([lack of inttypes.h based hexa specifier serving uint32_t (PRIx32)])
  772                 elif test "x$ac_cv_have_decl_SCNu64" = xno; then
  773                     AC_MSG_ERROR([lack of inttypes.h based specifier gathering uint64_t (SCNu64)])
  774                 fi
  775             ],
  776             [[#include <inttypes.h>]]
  777         )
  778     ]
  779 )
  780 (
  781     set $pcmk_cv_decl_inttypes
  782     AC_DEFINE_UNQUOTED([U64T],  [$1], [Correct format specifier for U64T])
  783     AC_DEFINE_UNQUOTED([U32T],  [$2], [Correct format specifier for U32T])
  784     AC_DEFINE_UNQUOTED([X32T],  [$3], [Correct format specifier for X32T])
  785     AC_DEFINE_UNQUOTED([U64TS], [$4], [Correct format specifier for U64TS])
  786 )
  787 
  788 dnl ===============================================
  789 dnl Program Paths
  790 dnl ===============================================
  791 
  792 PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin"
  793 export PATH
  794 
  795 dnl Replacing AC_PROG_LIBTOOL with AC_CHECK_PROG because LIBTOOL
  796 dnl was NOT being expanded all the time thus causing things to fail.
  797 AC_CHECK_PROGS(LIBTOOL, glibtool libtool libtool15 libtool13)
  798 AS_IF([test "x${LIBTOOL}" != "x"], [],
  799       [AC_MSG_FAILURE([Could not find required build tool libtool (or equivalent)])])
  800 
  801 dnl Pacemaker's executable python scripts will invoke the python specified by
  802 dnl configure's PYTHON variable. If not specified, AM_PATH_PYTHON will check a
  803 dnl built-in list with (unversioned) "python" having precedence. To configure
  804 dnl Pacemaker to use a specific python interpreter version, define PYTHON
  805 dnl when calling configure, for example: ./configure PYTHON=/usr/bin/python3.6
  806 
  807 dnl Ensure PYTHON is an absolute path
  808 AS_IF([test x"${PYTHON}" != x""], [AC_PATH_PROG([PYTHON], [$PYTHON])])
  809 
  810 dnl Require a minimum Python version
  811 AM_PATH_PYTHON([3.4])
  812 
  813 AC_PATH_PROGS([ASCIIDOC_CONV], [asciidoc asciidoctor])
  814 AC_PATH_PROG([HELP2MAN], [help2man])
  815 AC_PATH_PROG([SPHINX], [sphinx-build])
  816 AC_PATH_PROG([INKSCAPE], [inkscape])
  817 AC_PATH_PROG([XSLTPROC], [xsltproc])
  818 AC_PATH_PROG([XMLCATALOG], [xmlcatalog])
  819 
  820 dnl Bash is needed for building man pages and running regression tests.
  821 dnl BASH is already an environment variable, so use something else.
  822 AC_PATH_PROG([BASH_PATH], [bash])
  823 AS_IF([test "x${BASH_PATH}" != "x"], [],
  824       [AC_MSG_FAILURE([Could not find required build tool bash])])
  825 
  826 AC_PATH_PROGS(VALGRIND_BIN, valgrind, /usr/bin/valgrind)
  827 AC_DEFINE_UNQUOTED(VALGRIND_BIN, "$VALGRIND_BIN", Valgrind command)
  828 
  829 AM_CONDITIONAL(BUILD_HELP, test x"${HELP2MAN}" != x"")
  830 if test x"${HELP2MAN}" != x""; then
  831     PCMK_FEATURES="$PCMK_FEATURES generated-manpages"
  832 fi
  833 
  834 MANPAGE_XSLT=""
  835 if test x"${XSLTPROC}" != x""; then
  836     AC_MSG_CHECKING([for DocBook-to-manpage transform])
  837     # first try to figure out correct template using xmlcatalog query,
  838     # resort to extensive (semi-deterministic) file search if that fails
  839     DOCBOOK_XSL_URI='http://docbook.sourceforge.net/release/xsl/current'
  840     DOCBOOK_XSL_PATH='manpages/docbook.xsl'
  841     MANPAGE_XSLT=$(${XMLCATALOG} "" ${DOCBOOK_XSL_URI}/${DOCBOOK_XSL_PATH} \
  842                    | sed -n 's|^file://||p;q')
  843     if test x"${MANPAGE_XSLT}" = x""; then
  844         DIRS=$(find "${datadir}" -name $(basename $(dirname ${DOCBOOK_XSL_PATH})) \
  845                -type d | LC_ALL=C sort)
  846         XSLT=$(basename ${DOCBOOK_XSL_PATH})
  847         for d in ${DIRS}
  848         do
  849             if test -f "${d}/${XSLT}"; then
  850                  MANPAGE_XSLT="${d}/${XSLT}"
  851                  break
  852             fi
  853         done
  854     fi
  855 fi
  856 AC_MSG_RESULT([$MANPAGE_XSLT])
  857 AC_SUBST(MANPAGE_XSLT)
  858 
  859 AM_CONDITIONAL(BUILD_XML_HELP, test x"${MANPAGE_XSLT}" != x"")
  860 if test x"${MANPAGE_XSLT}" != x""; then
  861     PCMK_FEATURES="$PCMK_FEATURES agent-manpages"
  862 fi
  863 
  864 AM_CONDITIONAL([IS_ASCIIDOC], [echo "${ASCIIDOC_CONV}" | grep -Eq 'asciidoc$'])
  865 AM_CONDITIONAL([BUILD_ASCIIDOC], [test "x${ASCIIDOC_CONV}" != x])
  866 if test "x${ASCIIDOC_CONV}" != x; then
  867     PCMK_FEATURES="$PCMK_FEATURES ascii-docs"
  868 fi
  869 
  870 AM_CONDITIONAL([BUILD_SPHINX_DOCS],
  871                [test x"${SPHINX}" != x"" && test x"${INKSCAPE}" != x""])
  872 AM_COND_IF([BUILD_SPHINX_DOCS], [PCMK_FEATURES="$PCMK_FEATURES books"])
  873 
  874 dnl Pacemaker's shell scripts (and thus man page builders) rely on GNU getopt
  875 AC_MSG_CHECKING([for GNU-compatible getopt])
  876 IFS_orig=$IFS
  877 IFS=:
  878 for PATH_DIR in $PATH
  879 do
  880     IFS=$IFS_orig
  881     GETOPT_PATH="${PATH_DIR}/getopt"
  882     if test -f "$GETOPT_PATH" && test -x "$GETOPT_PATH" ; then
  883         $GETOPT_PATH -T >/dev/null 2>/dev/null
  884         if test $? -eq 4; then
  885             break
  886         fi
  887     fi
  888     GETOPT_PATH=""
  889 done
  890 IFS=$IFS_orig
  891 AS_IF([test -n "$GETOPT_PATH"], [AC_MSG_RESULT([$GETOPT_PATH])],
  892       [
  893           AC_MSG_RESULT([no])
  894           AC_MSG_ERROR([Could not find required build tool GNU-compatible getopt])
  895       ])
  896 AC_SUBST([GETOPT_PATH])
  897 
  898 dnl ========================================================================
  899 dnl checks for library functions to replace them
  900 dnl
  901 dnl     NoSuchFunctionName:
  902 dnl             is a dummy function which no system supplies.  It is here to make
  903 dnl             the system compile semi-correctly on OpenBSD which doesn't know
  904 dnl             how to create an empty archive
  905 dnl
  906 dnl     scandir: Only on BSD.
  907 dnl             System-V systems may have it, but hidden and/or deprecated.
  908 dnl             A replacement function is supplied for it.
  909 dnl
  910 dnl     strerror: returns a string that corresponds to an errno.
  911 dnl             A replacement function is supplied for it.
  912 dnl
  913 dnl     strnlen: is a gnu function similar to strlen, but safer.
  914 dnl            We wrote a tolerably-fast replacement function for it.
  915 dnl
  916 dnl     strndup: is a gnu function similar to strdup, but safer.
  917 dnl            We wrote a tolerably-fast replacement function for it.
  918 
  919 AC_REPLACE_FUNCS(alphasort NoSuchFunctionName scandir strerror strchrnul strnlen strndup)
  920 
  921 dnl ===============================================
  922 dnl Libraries
  923 dnl ===============================================
  924 AC_CHECK_LIB(socket, socket)                    dnl -lsocket
  925 AC_CHECK_LIB(c, dlopen)                         dnl if dlopen is in libc...
  926 AC_CHECK_LIB(dl, dlopen)                        dnl -ldl (for Linux)
  927 AC_CHECK_LIB(rt, sched_getscheduler)            dnl -lrt (for Tru64)
  928 AC_CHECK_LIB(gnugetopt, getopt_long)            dnl -lgnugetopt ( if available )
  929 AC_CHECK_LIB(pam, pam_start)                    dnl -lpam (if available)
  930 
  931 PKG_CHECK_MODULES([UUID], [uuid],
  932                   [CPPFLAGS="${CPPFLAGS} ${UUID_CFLAGS}"
  933                    LIBS="${LIBS} ${UUID_LIBS}"])
  934 
  935 AC_CHECK_FUNCS([sched_setscheduler])
  936 if test "$ac_cv_func_sched_setscheduler" != yes; then
  937         PC_LIBS_RT=""
  938 else
  939         PC_LIBS_RT="-lrt"
  940 fi
  941 AC_SUBST(PC_LIBS_RT)
  942 
  943 # Require minimum glib version
  944 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.42.0],
  945                   [CPPFLAGS="${CPPFLAGS} ${GLIB_CFLAGS}"
  946                    LIBS="${LIBS} ${GLIB_LIBS}"])
  947 
  948 # Check whether high-resolution sleep function is available
  949 AC_CHECK_FUNCS([nanosleep usleep])
  950 
  951 #
  952 # Where is dlopen?
  953 #
  954 if test "$ac_cv_lib_c_dlopen" = yes; then
  955     LIBADD_DL=""
  956 elif test "$ac_cv_lib_dl_dlopen" = yes; then
  957     LIBADD_DL=-ldl
  958 else
  959     LIBADD_DL=${lt_cv_dlopen_libs}
  960 fi
  961 
  962 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],
  963                   [CPPFLAGS="${CPPFLAGS} ${LIBXML2_CFLAGS}"
  964                    LIBS="${LIBS} ${LIBXML2_LIBS}"])
  965 
  966 REQUIRE_LIB([xslt], [xsltApplyStylesheet])
  967 
  968 dnl ========================================================================
  969 dnl Headers
  970 dnl ========================================================================
  971 
  972 # Some distributions insert #warnings into deprecated headers. If we will
  973 # enable fatal warnings for the build, then enable them for the header checks
  974 # as well, otherwise the build could fail even though the header check
  975 # succeeds. (We should probably be doing this in more places.)
  976 cc_temp_flags "$CFLAGS $WERROR"
  977 
  978 # Optional headers (inclusion of these should be conditional in C code)
  979 AC_CHECK_HEADERS([getopt.h])
  980 AC_CHECK_HEADERS([linux/swab.h])
  981 AC_CHECK_HEADERS([stddef.h])
  982 AC_CHECK_HEADERS([sys/signalfd.h])
  983 AC_CHECK_HEADERS([uuid/uuid.h])
  984 AC_CHECK_HEADERS([security/pam_appl.h pam/pam_appl.h])
  985 
  986 # Required headers
  987 REQUIRE_HEADER([arpa/inet.h])
  988 REQUIRE_HEADER([ctype.h])
  989 REQUIRE_HEADER([dirent.h])
  990 REQUIRE_HEADER([errno.h])
  991 REQUIRE_HEADER([glib.h])
  992 REQUIRE_HEADER([grp.h])
  993 REQUIRE_HEADER([limits.h])
  994 REQUIRE_HEADER([netdb.h])
  995 REQUIRE_HEADER([netinet/in.h])
  996 REQUIRE_HEADER([netinet/ip.h], [
  997     #include <sys/types.h>
  998     #include <netinet/in.h>
  999 ])
 1000 REQUIRE_HEADER([pwd.h])
 1001 REQUIRE_HEADER([signal.h])
 1002 REQUIRE_HEADER([stdio.h])
 1003 REQUIRE_HEADER([stdlib.h])
 1004 REQUIRE_HEADER([string.h])
 1005 REQUIRE_HEADER([strings.h])
 1006 REQUIRE_HEADER([sys/ioctl.h])
 1007 REQUIRE_HEADER([sys/param.h])
 1008 REQUIRE_HEADER([sys/reboot.h])
 1009 REQUIRE_HEADER([sys/resource.h])
 1010 REQUIRE_HEADER([sys/socket.h])
 1011 REQUIRE_HEADER([sys/stat.h])
 1012 REQUIRE_HEADER([sys/time.h])
 1013 REQUIRE_HEADER([sys/types.h])
 1014 REQUIRE_HEADER([sys/utsname.h])
 1015 REQUIRE_HEADER([sys/wait.h])
 1016 REQUIRE_HEADER([time.h])
 1017 REQUIRE_HEADER([unistd.h])
 1018 REQUIRE_HEADER([libxml/xpath.h])
 1019 REQUIRE_HEADER([libxslt/xslt.h])
 1020 
 1021 cc_restore_flags
 1022 
 1023 AC_CHECK_FUNCS([uuid_unparse], [],
 1024                [AC_MSG_FAILURE([Could not find required C function uuid_unparse()])])
 1025 
 1026 AC_CACHE_CHECK([whether __progname and __progname_full are available],
 1027                [pf_cv_var_progname], AC_LINK_IFELSE([
 1028                    AC_LANG_PROGRAM([[extern char *__progname, *__progname_full;]],
 1029                                    [[__progname = "foo"; __progname_full = "foo bar";]],
 1030                                    [pf_cv_var_progname="yes"],
 1031                                    [pf_cv_var_progname="no"])
 1032                ]))
 1033 AS_IF([test "$pf_cv_var_progname" = "yes"], [AC_DEFINE(HAVE___PROGNAME,1,[ ])])
 1034 
 1035 dnl ========================================================================
 1036 dnl Generic declarations
 1037 dnl ========================================================================
 1038 
 1039 AC_CHECK_DECLS([CLOCK_MONOTONIC], [PCMK_FEATURES="$PCMK_FEATURES monotonic"], [], [[
 1040     #include <time.h>
 1041 ]])
 1042 
 1043 dnl ========================================================================
 1044 dnl Structures
 1045 dnl ========================================================================
 1046 
 1047 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[[#include <time.h>]])
 1048 AC_CHECK_MEMBER([struct dirent.d_type],
 1049     AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE,1,[Define this if struct dirent has d_type]),,
 1050     [#include <dirent.h>])
 1051 
 1052 dnl ========================================================================
 1053 dnl Functions
 1054 dnl ========================================================================
 1055 
 1056 REQUIRE_FUNC([getopt])
 1057 REQUIRE_FUNC([setenv])
 1058 REQUIRE_FUNC([unsetenv])
 1059 
 1060 AC_CACHE_CHECK(whether sscanf supports %m,
 1061                pf_cv_var_sscanf,
 1062                AC_RUN_IFELSE([AC_LANG_SOURCE([[
 1063 #include <stdio.h>
 1064 const char *s = "some-command-line-arg";
 1065 int main(int argc, char **argv) {
 1066 char *name = NULL;
 1067 int n = sscanf(s, "%ms", &name);
 1068 return n == 1 ? 0 : 1;
 1069 }
 1070 ]])],
 1071                                  pf_cv_var_sscanf="yes", pf_cv_var_sscanf="no", pf_cv_var_sscanf="no"))
 1072 
 1073 AS_IF([test "$pf_cv_var_sscanf" = "yes"], [AC_DEFINE(SSCANF_HAS_M, 1, [ ])])
 1074 
 1075 dnl ========================================================================
 1076 dnl   bzip2
 1077 dnl ========================================================================
 1078 REQUIRE_HEADER([bzlib.h])
 1079 REQUIRE_LIB([bz2], [BZ2_bzBuffToBuffCompress])
 1080 
 1081 dnl ========================================================================
 1082 dnl sighandler_t is missing from Illumos, Solaris11 systems
 1083 dnl ========================================================================
 1084 
 1085 AC_MSG_CHECKING([for sighandler_t])
 1086 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[sighandler_t *f;]])],
 1087                   [
 1088                       AC_MSG_RESULT([yes])
 1089                       AC_DEFINE([HAVE_SIGHANDLER_T], [1],
 1090                                 [Define to 1 if sighandler_t is available])
 1091                   ],
 1092                   [AC_MSG_RESULT([no])])
 1093 
 1094 dnl ========================================================================
 1095 dnl   ncurses
 1096 dnl ========================================================================
 1097 dnl
 1098 dnl A few OSes (e.g. Linux) deliver a default "ncurses" alongside "curses".
 1099 dnl Many non-Linux deliver "curses"; sites may add "ncurses".
 1100 dnl
 1101 dnl However, the source-code recommendation for both is to #include "curses.h"
 1102 dnl (i.e. "ncurses" still wants the include to be simple, no-'n', "curses.h").
 1103 dnl
 1104 dnl ncurses takes precedence.
 1105 dnl
 1106 AC_CHECK_HEADERS([curses.h curses/curses.h ncurses.h ncurses/ncurses.h])
 1107 
 1108 dnl Although n-library is preferred, only look for it if the n-header was found.
 1109 CURSESLIBS=''
 1110 PC_NAME_CURSES=""
 1111 PC_LIBS_CURSES=""
 1112 AS_IF([test "$ac_cv_header_ncurses_h" = "yes"], [
 1113     AC_CHECK_LIB(ncurses, printw,
 1114                  [AC_DEFINE(HAVE_LIBNCURSES,1, have ncurses library)])
 1115     CURSESLIBS=`$PKG_CONFIG --libs ncurses` || CURSESLIBS='-lncurses'
 1116     PC_NAME_CURSES="ncurses"
 1117 ])
 1118 
 1119 AS_IF([test "$ac_cv_header_ncurses_ncurses_h" = "yes"], [
 1120     AC_CHECK_LIB(ncurses, printw,
 1121                  [AC_DEFINE(HAVE_LIBNCURSES,1, have ncurses library)])
 1122     CURSESLIBS=`$PKG_CONFIG --libs ncurses` || CURSESLIBS='-lncurses'
 1123     PC_NAME_CURSES="ncurses"
 1124 ])
 1125 
 1126 dnl Only look for non-n-library if there was no n-library.
 1127 AS_IF([test X"$CURSESLIBS" = X"" && test "$ac_cv_header_curses_h" = "yes"], [
 1128     AC_CHECK_LIB(curses, printw,
 1129                  [CURSESLIBS='-lcurses'; AC_DEFINE(HAVE_LIBCURSES,1, have curses library)])
 1130     PC_LIBS_CURSES="$CURSESLIBS"
 1131 ])
 1132 
 1133 dnl Only look for non-n-library if there was no n-library.
 1134 AS_IF([test X"$CURSESLIBS" = X"" && test "$ac_cv_header_curses_curses_h" = "yes"], [
 1135     AC_CHECK_LIB(curses, printw,
 1136                  [CURSESLIBS='-lcurses'; AC_DEFINE(HAVE_LIBCURSES,1, have curses library)])
 1137     PC_LIBS_CURSES="$CURSESLIBS"
 1138 ])
 1139 
 1140 if test "x$CURSESLIBS" != "x"; then
 1141     PCMK_FEATURES="$PCMK_FEATURES ncurses"
 1142 fi
 1143 
 1144 dnl Check for printw() prototype compatibility
 1145 AS_IF([test X"$CURSESLIBS" != X"" && cc_supports_flag -Wcast-qual], [
 1146     ac_save_LIBS=$LIBS
 1147     LIBS="$CURSESLIBS"
 1148     cc_temp_flags "-Wcast-qual $WERROR"
 1149     # avoid broken test because of hardened build environment in Fedora 23+
 1150     # - https://fedoraproject.org/wiki/Changes/Harden_All_Packages
 1151     # - https://bugzilla.redhat.com/1297985
 1152     AS_IF([cc_supports_flag -fPIC], [CFLAGS="$CFLAGS -fPIC"])
 1153 
 1154     AC_MSG_CHECKING([whether curses library is compatible])
 1155     AC_LINK_IFELSE(
 1156         [AC_LANG_PROGRAM([
 1157 #if defined(HAVE_NCURSES_H)
 1158 #  include <ncurses.h>
 1159 #elif defined(HAVE_NCURSES_NCURSES_H)
 1160 #  include <ncurses/ncurses.h>
 1161 #elif defined(HAVE_CURSES_H)
 1162 #  include <curses.h>
 1163 #endif
 1164                          ],
 1165                          [printw((const char *)"Test");]
 1166         )],
 1167         [AC_MSG_RESULT([yes])],
 1168         [
 1169             AC_MSG_RESULT([no])
 1170             AC_MSG_WARN(m4_normalize([Disabling curses because the printw()
 1171                                       function of your (n)curses library is old.
 1172                                       If you wish to enable curses, update to a
 1173                                       newer version (ncurses 5.4 or later is
 1174                                       recommended, available from
 1175                                       https://invisible-island.net/ncurses/)
 1176                                      ]))
 1177             AC_DEFINE([HAVE_INCOMPATIBLE_PRINTW], [1],
 1178                       [Define to 1 if curses library has incompatible printw()])
 1179         ]
 1180     )
 1181 
 1182     LIBS=$ac_save_LIBS
 1183     cc_restore_flags
 1184 ])
 1185 
 1186 AC_SUBST(CURSESLIBS)
 1187 AC_SUBST(PC_NAME_CURSES)
 1188 AC_SUBST(PC_LIBS_CURSES)
 1189 
 1190 dnl ========================================================================
 1191 dnl    Profiling and GProf
 1192 dnl ========================================================================
 1193 
 1194 CFLAGS_ORIG="$CFLAGS"
 1195 AS_IF([test $with_coverage -ne $DISABLED],
 1196       [
 1197         with_profiling=$REQUIRED
 1198         PCMK_FEATURES="$PCMK_FEATURES coverage"
 1199         CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
 1200         dnl During linking, make sure to specify -lgcov or -coverage
 1201       ]
 1202 )
 1203 
 1204 AS_IF([test $with_profiling -ne $DISABLED],
 1205       [
 1206           with_profiling=$REQUIRED
 1207           PCMK_FEATURES="$PCMK_FEATURES profile"
 1208 
 1209           dnl Disable various compiler optimizations
 1210           CFLAGS="$CFLAGS -fno-omit-frame-pointer -fno-inline -fno-builtin"
 1211           dnl CFLAGS="$CFLAGS -fno-inline-functions"
 1212           dnl CFLAGS="$CFLAGS -fno-default-inline"
 1213           dnl CFLAGS="$CFLAGS -fno-inline-functions-called-once"
 1214           dnl CFLAGS="$CFLAGS -fno-optimize-sibling-calls"
 1215 
 1216           dnl Turn off optimization so tools can get accurate line numbers
 1217           CFLAGS=`echo $CFLAGS | sed \
 1218                   -e 's/-O.\ //g' \
 1219                   -e 's/-Wp,-D_FORTIFY_SOURCE=.\ //g' \
 1220                   -e 's/-D_FORTIFY_SOURCE=.\ //g'`
 1221           CFLAGS="$CFLAGS -O0 -g3 -gdwarf-2"
 1222 
 1223           AC_MSG_NOTICE([CFLAGS before adding profiling options: $CFLAGS_ORIG])
 1224           AC_MSG_NOTICE([CFLAGS after: $CFLAGS])
 1225       ]
 1226 )
 1227 AC_DEFINE_UNQUOTED([SUPPORT_PROFILING], [$with_profiling], [Support profiling])
 1228 
 1229 dnl ========================================================================
 1230 dnl    Cluster infrastructure - LibQB
 1231 dnl ========================================================================
 1232 
 1233 PKG_CHECK_MODULES(libqb, libqb >= 0.17)
 1234 CPPFLAGS="$libqb_CFLAGS $CPPFLAGS"
 1235 LIBS="$libqb_LIBS $LIBS"
 1236 
 1237 dnl libqb 2.0.2+ (2020-10)
 1238 AC_CHECK_FUNCS(qb_ipcc_auth_get,
 1239                AC_DEFINE(HAVE_IPCC_AUTH_GET, 1,
 1240                          [Have qb_ipcc_auth_get function]))
 1241 
 1242 dnl libqb 2.0.0+ (2020-05)
 1243 CHECK_ENUM_VALUE([qb/qblog.h],[qb_log_conf],[QB_LOG_CONF_MAX_LINE_LEN])
 1244 CHECK_ENUM_VALUE([qb/qblog.h],[qb_log_conf],[QB_LOG_CONF_ELLIPSIS])
 1245 
 1246 dnl Support Linux-HA fence agents if available
 1247 if test "$cross_compiling" != "yes"; then
 1248     CPPFLAGS="$CPPFLAGS -I${prefix}/include/heartbeat"
 1249 fi
 1250 AC_CHECK_HEADERS([stonith/stonith.h],
 1251                  [
 1252                      AC_CHECK_LIB([pils], [PILLoadPlugin])
 1253                      AC_CHECK_LIB([plumb], [G_main_add_IPC_Channel])
 1254                      PCMK_FEATURES="$PCMK_FEATURES lha"
 1255                  ])
 1256 AM_CONDITIONAL([BUILD_LHA_SUPPORT], [test "$ac_cv_header_stonith_stonith_h" = "yes"])
 1257 
 1258 dnl ===============================================
 1259 dnl Variables needed for substitution
 1260 dnl ===============================================
 1261 CRM_SCHEMA_DIRECTORY="${datadir}/pacemaker"
 1262 AC_DEFINE_UNQUOTED(CRM_SCHEMA_DIRECTORY,"$CRM_SCHEMA_DIRECTORY", Location for the Pacemaker Relax-NG Schema)
 1263 AC_SUBST(CRM_SCHEMA_DIRECTORY)
 1264 
 1265 CRM_CORE_DIR="${localstatedir}/lib/pacemaker/cores"
 1266 AC_DEFINE_UNQUOTED(CRM_CORE_DIR,"$CRM_CORE_DIR", Location to store core files produced by Pacemaker daemons)
 1267 AC_SUBST(CRM_CORE_DIR)
 1268 
 1269 if test x"${CRM_DAEMON_USER}" = x""; then
 1270     CRM_DAEMON_USER="hacluster"
 1271 fi
 1272 AC_DEFINE_UNQUOTED(CRM_DAEMON_USER,"$CRM_DAEMON_USER", User to run Pacemaker daemons as)
 1273 AC_SUBST(CRM_DAEMON_USER)
 1274 
 1275 if test x"${CRM_DAEMON_GROUP}" = x""; then
 1276     CRM_DAEMON_GROUP="haclient"
 1277 fi
 1278 AC_DEFINE_UNQUOTED(CRM_DAEMON_GROUP,"$CRM_DAEMON_GROUP", Group to run Pacemaker daemons as)
 1279 AC_SUBST(CRM_DAEMON_GROUP)
 1280 
 1281 CRM_PACEMAKER_DIR=${localstatedir}/lib/pacemaker
 1282 AC_DEFINE_UNQUOTED(CRM_PACEMAKER_DIR,"$CRM_PACEMAKER_DIR", Location to store directory produced by Pacemaker daemons)
 1283 AC_SUBST(CRM_PACEMAKER_DIR)
 1284 
 1285 CRM_BLACKBOX_DIR=${localstatedir}/lib/pacemaker/blackbox
 1286 AC_DEFINE_UNQUOTED(CRM_BLACKBOX_DIR,"$CRM_BLACKBOX_DIR", Where to keep blackbox dumps)
 1287 AC_SUBST(CRM_BLACKBOX_DIR)
 1288 
 1289 PE_STATE_DIR="${localstatedir}/lib/pacemaker/pengine"
 1290 AC_DEFINE_UNQUOTED(PE_STATE_DIR,"$PE_STATE_DIR", Where to keep scheduler outputs)
 1291 AC_SUBST(PE_STATE_DIR)
 1292 
 1293 CRM_CONFIG_DIR="${localstatedir}/lib/pacemaker/cib"
 1294 AC_DEFINE_UNQUOTED(CRM_CONFIG_DIR,"$CRM_CONFIG_DIR", Where to keep configuration files)
 1295 AC_SUBST(CRM_CONFIG_DIR)
 1296 
 1297 CRM_CONFIG_CTS="${localstatedir}/lib/pacemaker/cts"
 1298 AC_DEFINE_UNQUOTED(CRM_CONFIG_CTS,"$CRM_CONFIG_CTS", Where to keep cts stateful data)
 1299 AC_SUBST(CRM_CONFIG_CTS)
 1300 
 1301 CRM_DAEMON_DIR="${libexecdir}/pacemaker"
 1302 AC_DEFINE_UNQUOTED(CRM_DAEMON_DIR,"$CRM_DAEMON_DIR", Location for Pacemaker daemons)
 1303 AC_SUBST(CRM_DAEMON_DIR)
 1304 
 1305 CRM_STATE_DIR="${runstatedir}/crm"
 1306 AC_DEFINE_UNQUOTED([CRM_STATE_DIR], ["$CRM_STATE_DIR"],
 1307                    [Where to keep state files and sockets])
 1308 AC_SUBST(CRM_STATE_DIR)
 1309 
 1310 CRM_RSCTMP_DIR="${runstatedir}/resource-agents"
 1311 AC_DEFINE_UNQUOTED(CRM_RSCTMP_DIR,"$CRM_RSCTMP_DIR", Where resource agents should keep state files)
 1312 AC_SUBST(CRM_RSCTMP_DIR)
 1313 
 1314 PACEMAKER_CONFIG_DIR="${sysconfdir}/pacemaker"
 1315 AC_DEFINE_UNQUOTED(PACEMAKER_CONFIG_DIR,"$PACEMAKER_CONFIG_DIR", Where to keep configuration files like authkey)
 1316 AC_SUBST(PACEMAKER_CONFIG_DIR)
 1317 
 1318 AC_DEFINE_UNQUOTED(SBIN_DIR,"$sbindir",[Location for system binaries])
 1319 
 1320 AC_PATH_PROGS(GIT, git false)
 1321 
 1322 AC_MSG_CHECKING([build version])
 1323 BUILD_VERSION=7c3f660707
 1324 if test $BUILD_VERSION != ":%h$"; then
 1325     AC_MSG_RESULT([$BUILD_VERSION (archive hash)])
 1326 elif test -x $GIT && test -d .git; then
 1327     BUILD_VERSION=`$GIT log --pretty="format:%h" -n 1`
 1328     AC_MSG_RESULT([$BUILD_VERSION (git hash)])
 1329 else
 1330     # The current directory name make a reasonable default
 1331     # Most generated archives will include the hash or tag
 1332     BASE=`basename $PWD`
 1333     BUILD_VERSION=`echo $BASE | sed s:.*[[Pp]]acemaker-::`
 1334     AC_MSG_RESULT([$BUILD_VERSION (directory name)])
 1335 fi
 1336 
 1337 AC_DEFINE_UNQUOTED(BUILD_VERSION, "$BUILD_VERSION", Build version)
 1338 AC_SUBST(BUILD_VERSION)
 1339 
 1340 HAVE_dbus=1
 1341 PKG_CHECK_MODULES([DBUS], [dbus-1],
 1342                   [CPPFLAGS="${CPPFLAGS} ${DBUS_CFLAGS}"],
 1343                   [HAVE_dbus=0])
 1344 AC_DEFINE_UNQUOTED(SUPPORT_DBUS, $HAVE_dbus, Support dbus)
 1345 AM_CONDITIONAL(BUILD_DBUS, test $HAVE_dbus = 1)
 1346 AC_CHECK_TYPES([DBusBasicValue],,,[[#include <dbus/dbus.h>]])
 1347 if test $HAVE_dbus = 0; then
 1348         PC_NAME_DBUS=""
 1349 else
 1350         PC_NAME_DBUS="dbus-1"
 1351 fi
 1352 AC_SUBST(PC_NAME_DBUS)
 1353 
 1354 AS_CASE([$enable_systemd],
 1355         [$REQUIRED], [
 1356             AS_IF([test $HAVE_dbus = 0],
 1357                   [AC_MSG_FAILURE([Cannot support systemd resources without DBus])])
 1358             AS_IF([test "$ac_cv_have_decl_CLOCK_MONOTONIC" = "no"],
 1359                   [AC_MSG_FAILURE([Cannot support systemd resources without monotonic clock])])
 1360             AS_IF([check_systemdsystemunitdir], [],
 1361                   [AC_MSG_FAILURE([Cannot support systemd resources without systemdsystemunitdir])])
 1362         ],
 1363         [$OPTIONAL], [
 1364             AS_IF([test $HAVE_dbus = 0 \
 1365                    || test "$ac_cv_have_decl_CLOCK_MONOTONIC" = "no"],
 1366                   [enable_systemd=$DISABLED],
 1367                   [
 1368                       AC_MSG_CHECKING([for systemd version (using dbus-send)])
 1369                       ret=$({ dbus-send --system --print-reply \
 1370                                   --dest=org.freedesktop.systemd1 \
 1371                                   /org/freedesktop/systemd1 \
 1372                                   org.freedesktop.DBus.Properties.Get \
 1373                                   string:org.freedesktop.systemd1.Manager \
 1374                                   string:Version 2>/dev/null \
 1375                               || echo "version unavailable"; } | tail -n1)
 1376                       # sanitize output a bit (interested just in value, not type),
 1377                       # ret is intentionally unenquoted so as to normalize whitespace
 1378                       ret=$(echo ${ret} | cut -d' ' -f2-)
 1379                       AC_MSG_RESULT([${ret}])
 1380                       AS_IF([test "$ret" != "unavailable" \
 1381                              || systemctl --version 2>/dev/null | grep -q systemd],
 1382                             [
 1383                                 AS_IF([check_systemdsystemunitdir],
 1384                                       [enable_systemd=$REQUIRED],
 1385                                       [enable_systemd=$DISABLED])
 1386                             ],
 1387                             [enable_systemd=$DISABLED]
 1388                       )
 1389                   ])
 1390         ],
 1391 )
 1392 AC_MSG_CHECKING([whether to enable support for managing resources via systemd])
 1393 AS_IF([test $enable_systemd -eq $DISABLED], [AC_MSG_RESULT([no])],
 1394       [
 1395           AC_MSG_RESULT([yes])
 1396           PCMK_FEATURES="$PCMK_FEATURES systemd"
 1397       ]
 1398 )
 1399 AC_SUBST([systemdsystemunitdir])
 1400 AC_DEFINE_UNQUOTED([SUPPORT_SYSTEMD], [$enable_systemd],
 1401                    [Support systemd resources])
 1402 AM_CONDITIONAL([BUILD_SYSTEMD], [test $enable_systemd = $REQUIRED])
 1403 AC_SUBST(SUPPORT_SYSTEMD)
 1404 
 1405 AS_CASE([$enable_upstart],
 1406         [$REQUIRED], [
 1407             AS_IF([test $HAVE_dbus = 0],
 1408                   [AC_MSG_FAILURE([Cannot support Upstart resources without DBus])])
 1409         ],
 1410         [$OPTIONAL], [
 1411             AS_IF([test $HAVE_dbus = 0], [enable_upstart=$DISABLED],
 1412                   [
 1413                       AC_MSG_CHECKING([for Upstart version (using dbus-send)])
 1414                       ret=$({ dbus-send --system --print-reply \
 1415                                   --dest=com.ubuntu.Upstart \
 1416                                   /com/ubuntu/Upstart org.freedesktop.DBus.Properties.Get \
 1417                                   string:com.ubuntu.Upstart0_6 string:version 2>/dev/null \
 1418                               || echo "version unavailable"; } | tail -n1)
 1419                       # sanitize output a bit (interested just in value, not type),
 1420                       # ret is intentionally unenquoted so as to normalize whitespace
 1421                       ret=$(echo ${ret} | cut -d' ' -f2-)
 1422                       AC_MSG_RESULT([${ret}])
 1423                       AS_IF([test "$ret" != "unavailable" \
 1424                              || initctl --version 2>/dev/null | grep -q upstart],
 1425                             [enable_upstart=$REQUIRED],
 1426                             [enable_upstart=$DISABLED]
 1427                       )
 1428                   ])
 1429         ],
 1430 )
 1431 AC_MSG_CHECKING([whether to enable support for managing resources via Upstart])
 1432 AS_IF([test $enable_upstart -eq $DISABLED], [AC_MSG_RESULT([no])],
 1433       [
 1434           AC_MSG_RESULT([yes])
 1435           PCMK_FEATURES="$PCMK_FEATURES upstart"
 1436       ]
 1437 )
 1438 AC_DEFINE_UNQUOTED([SUPPORT_UPSTART], [$enable_upstart],
 1439                    [Support Upstart resources])
 1440 AM_CONDITIONAL([BUILD_UPSTART], [test $enable_upstart -eq $REQUIRED])
 1441 AC_SUBST(SUPPORT_UPSTART)
 1442 
 1443 AS_CASE([$with_nagios],
 1444         [$REQUIRED], [
 1445             AS_IF([test "$ac_cv_have_decl_CLOCK_MONOTONIC" = "no"],
 1446                   [AC_MSG_FAILURE([Cannot support nagios resources without monotonic clock])])
 1447         ],
 1448         [$OPTIONAL], [
 1449             AS_IF([test "$ac_cv_have_decl_CLOCK_MONOTONIC" = "no"],
 1450                   [with_nagios=$DISABLED], [with_nagios=$REQUIRED])
 1451         ]
 1452 )
 1453 AS_IF([test $with_nagios -eq $REQUIRED], [PCMK_FEATURES="$PCMK_FEATURES nagios"])
 1454 AC_DEFINE_UNQUOTED([SUPPORT_NAGIOS], [$with_nagios], [Support nagios plugins])
 1455 AM_CONDITIONAL([BUILD_NAGIOS], [test $with_nagios -eq $REQUIRED])
 1456 
 1457 if test x"$NAGIOS_PLUGIN_DIR" = x""; then
 1458     NAGIOS_PLUGIN_DIR="${libexecdir}/nagios/plugins"
 1459 fi
 1460 
 1461 AC_DEFINE_UNQUOTED(NAGIOS_PLUGIN_DIR, "$NAGIOS_PLUGIN_DIR", Directory for nagios plugins)
 1462 AC_SUBST(NAGIOS_PLUGIN_DIR)
 1463 
 1464 if test x"$NAGIOS_METADATA_DIR" = x""; then
 1465     NAGIOS_METADATA_DIR="${datadir}/nagios/plugins-metadata"
 1466 fi
 1467 
 1468 AC_DEFINE_UNQUOTED(NAGIOS_METADATA_DIR, "$NAGIOS_METADATA_DIR", Directory for nagios plugins metadata)
 1469 AC_SUBST(NAGIOS_METADATA_DIR)
 1470 
 1471 STACKS=""
 1472 CLUSTERLIBS=""
 1473 PC_NAME_CLUSTER=""
 1474 
 1475 dnl ========================================================================
 1476 dnl    Cluster stack - Corosync
 1477 dnl ========================================================================
 1478 
 1479 COROSYNC_LIBS=""
 1480 
 1481 AS_CASE([$with_corosync],
 1482         [$REQUIRED], [
 1483             # These will be fatal if unavailable
 1484             PKG_CHECK_MODULES([cpg], [libcpg])
 1485             PKG_CHECK_MODULES([cfg], [libcfg])
 1486             PKG_CHECK_MODULES([cmap], [libcmap])
 1487             PKG_CHECK_MODULES([quorum], [libquorum])
 1488             PKG_CHECK_MODULES([libcorosync_common], [libcorosync_common])
 1489         ]
 1490         [$OPTIONAL], [
 1491             PKG_CHECK_MODULES([cpg], [libcpg], [], [with_corosync=$DISABLED])
 1492             PKG_CHECK_MODULES([cfg], [libcfg], [], [with_corosync=$DISABLED])
 1493             PKG_CHECK_MODULES([cmap], [libcmap], [], [with_corosync=$DISABLED])
 1494             PKG_CHECK_MODULES([quorum], [libquorum], [], [with_corosync=$DISABLED])
 1495             PKG_CHECK_MODULES([libcorosync_common], [libcorosync_common], [], [with_corosync=$DISABLED])
 1496             AS_IF([test $with_corosync -ne $DISABLED], [with_corosync=$REQUIRED])
 1497         ]
 1498 )
 1499 AS_IF([test $with_corosync -ne $DISABLED],
 1500       [
 1501           AC_MSG_CHECKING([for Corosync 2 or later])
 1502           AC_MSG_RESULT([yes])
 1503           CFLAGS="$CFLAGS $libqb_CFLAGS $cpg_CFLAGS $cfg_CFLAGS $cmap_CFLAGS $quorum_CFLAGS $libcorosync_common_CFLAGS"
 1504           COROSYNC_LIBS="$COROSYNC_LIBS $cpg_LIBS $cfg_LIBS $cmap_LIBS $quorum_LIBS $libcorosync_common_LIBS"
 1505           CLUSTERLIBS="$CLUSTERLIBS $COROSYNC_LIBS"
 1506           PC_NAME_CLUSTER="$PC_CLUSTER_NAME libcfg libcmap libcorosync_common libcpg libquorum"
 1507           STACKS="$STACKS corosync-ge-2"
 1508 
 1509           dnl Shutdown tracking added (back) to corosync Jan 2021
 1510           saved_LIBS="$LIBS"
 1511           LIBS="$LIBS $COROSYNC_LIBS"
 1512           AC_CHECK_FUNCS(corosync_cfg_trackstart,
 1513           AC_DEFINE(HAVE_COROSYNC_CFG_TRACKSTART, 1,
 1514                          [Have corosync_cfg_trackstart function]))
 1515           LIBS="$saved_LIBS"
 1516       ]
 1517 )
 1518 AC_DEFINE_UNQUOTED([SUPPORT_COROSYNC], [$with_corosync],
 1519                    [Support the Corosync messaging and membership layer])
 1520 AM_CONDITIONAL([BUILD_CS_SUPPORT], [test $with_corosync -eq $REQUIRED])
 1521 AC_SUBST([SUPPORT_COROSYNC])
 1522 
 1523 dnl
 1524 dnl    Cluster stack - Sanity
 1525 dnl
 1526 
 1527 AS_IF([test "x$STACKS" != "x"], [AC_MSG_NOTICE([Supported stacks:${STACKS}])],
 1528       [AC_MSG_FAILURE([At least one cluster stack must be supported])])
 1529 
 1530 PCMK_FEATURES="${PCMK_FEATURES}${STACKS}"
 1531 
 1532 AC_SUBST(CLUSTERLIBS)
 1533 AC_SUBST(PC_NAME_CLUSTER)
 1534 
 1535 dnl ========================================================================
 1536 dnl    CIB secrets
 1537 dnl ========================================================================
 1538 
 1539 AS_IF([test $with_cibsecrets -ne $DISABLED],
 1540       [
 1541           with_cibsecrets=$REQUIRED
 1542           PCMK_FEATURES="$PCMK_FEATURES cibsecrets"
 1543           LRM_CIBSECRETS_DIR="${localstatedir}/lib/pacemaker/lrm/secrets"
 1544           AC_DEFINE_UNQUOTED([LRM_CIBSECRETS_DIR], ["$LRM_CIBSECRETS_DIR"],
 1545                              [Location for CIB secrets])
 1546           AC_SUBST([LRM_CIBSECRETS_DIR])
 1547       ]
 1548 )
 1549 AC_DEFINE_UNQUOTED([SUPPORT_CIBSECRETS], [$with_cibsecrets], [Support CIB secrets])
 1550 AM_CONDITIONAL([BUILD_CIBSECRETS], [test $with_cibsecrets -eq $REQUIRED])
 1551 
 1552 dnl ========================================================================
 1553 dnl    GnuTLS
 1554 dnl ========================================================================
 1555 
 1556 dnl Require GnuTLS >=2.12.0 (2011-03) for Pacemaker Remote support
 1557 PC_NAME_GNUTLS=""
 1558 AS_CASE([$with_gnutls],
 1559         [$REQUIRED], [
 1560             REQUIRE_LIB([gnutls], [gnutls_sec_param_to_pk_bits])
 1561             REQUIRE_HEADER([gnutls/gnutls.h])
 1562         ],
 1563         [$OPTIONAL], [
 1564             AC_CHECK_LIB([gnutls], [gnutls_sec_param_to_pk_bits],
 1565                          [], [with_gnutls=$DISABLED])
 1566             AC_CHECK_HEADERS([gnutls/gnutls.h], [], [with_gnutls=$DISABLED])
 1567         ]
 1568 )
 1569 AS_IF([test $with_gnutls -ne $DISABLED],
 1570       [
 1571           PC_NAME_GNUTLS="gnutls"
 1572           PCMK_FEATURES="$PCMK_FEATURES remote"
 1573       ]
 1574 )
 1575 AC_SUBST([PC_NAME_GNUTLS])
 1576 AM_CONDITIONAL([BUILD_REMOTE], [test $with_gnutls -ne $DISABLED])
 1577 
 1578 dnl ========================================================================
 1579 dnl    System Health
 1580 dnl ========================================================================
 1581 
 1582 dnl Check if servicelog development package is installed
 1583 SERVICELOG=servicelog-1
 1584 SERVICELOG_EXISTS="no"
 1585 AC_MSG_CHECKING([for $SERVICELOG packages])
 1586 if
 1587     $PKG_CONFIG --exists $SERVICELOG
 1588 then
 1589     PKG_CHECK_MODULES([SERVICELOG], [servicelog-1])
 1590     SERVICELOG_EXISTS="yes"
 1591     PCMK_FEATURES="$PCMK_FEATURES servicelog"
 1592 fi
 1593 AC_MSG_RESULT([$SERVICELOG_EXISTS])
 1594 AM_CONDITIONAL(BUILD_SERVICELOG, test "$SERVICELOG_EXISTS" = "yes")
 1595 
 1596 dnl Check if OpenIMPI packages and servicelog are installed
 1597 OPENIPMI="OpenIPMI OpenIPMIposix"
 1598 OPENIPMI_SERVICELOG_EXISTS="no"
 1599 AC_MSG_CHECKING([for $SERVICELOG $OPENIPMI packages])
 1600 if
 1601     $PKG_CONFIG --exists $OPENIPMI $SERVICELOG
 1602 then
 1603     PKG_CHECK_MODULES([OPENIPMI_SERVICELOG],[OpenIPMI OpenIPMIposix])
 1604     REQUIRE_HEADER([malloc.h])
 1605     OPENIPMI_SERVICELOG_EXISTS="yes"
 1606     PCMK_FEATURES="$PCMK_FEATURES ipmiservicelogd"
 1607 fi
 1608 AC_MSG_RESULT([$OPENIPMI_SERVICELOG_EXISTS])
 1609 AM_CONDITIONAL(BUILD_OPENIPMI_SERVICELOG, test "$OPENIPMI_SERVICELOG_EXISTS" = "yes")
 1610 
 1611 # --- ASAN/UBSAN/TSAN (see man gcc) ---
 1612 # when using SANitizers, we need to pass the -fsanitize..
 1613 # to both CFLAGS and LDFLAGS. The CFLAGS/LDFLAGS must be
 1614 # specified as first in the list or there will be runtime
 1615 # issues (for example user has to LD_PRELOAD asan for it to work
 1616 # properly).
 1617 
 1618 AS_IF([test -n "${SANITIZERS}"], [
 1619   SANITIZERS=$(echo $SANITIZERS | sed -e 's/,/ /g')
 1620   for SANITIZER in $SANITIZERS
 1621   do
 1622     AS_CASE([$SANITIZER],
 1623             [asan|ASAN], [
 1624                 SANITIZERS_CFLAGS="$SANITIZERS_CFLAGS -fsanitize=address"
 1625                 SANITIZERS_LDFLAGS="$SANITIZERS_LDFLAGS -fsanitize=address -lasan"
 1626                 PCMK_FEATURES="$PCMK_FEATURES asan"
 1627                 REQUIRE_LIB([asan],[main])
 1628             ],
 1629             [ubsan|UBSAN], [
 1630                 SANITIZERS_CFLAGS="$SANITIZERS_CFLAGS -fsanitize=undefined"
 1631                 SANITIZERS_LDFLAGS="$SANITIZERS_LDFLAGS -fsanitize=undefined -lubsan"
 1632                 PCMK_FEATURES="$PCMK_FEATURES ubsan"
 1633                 REQUIRE_LIB([ubsan],[main])
 1634             ],
 1635             [tsan|TSAN], [
 1636                 SANITIZERS_CFLAGS="$SANITIZERS_CFLAGS -fsanitize=thread"
 1637                 SANITIZERS_LDFLAGS="$SANITIZERS_LDFLAGS -fsanitize=thread -ltsan"
 1638                 PCMK_FEATURES="$PCMK_FEATURES tsan"
 1639                 REQUIRE_LIB([tsan],[main])
 1640             ])
 1641   done
 1642 ])
 1643 
 1644 
 1645 dnl ========================================================================
 1646 dnl Compiler flags
 1647 dnl ========================================================================
 1648 
 1649 dnl Make sure that CFLAGS is not exported. If the user did
 1650 dnl not have CFLAGS in their environment then this should have
 1651 dnl no effect. However if CFLAGS was exported from the user's
 1652 dnl environment, then the new CFLAGS will also be exported
 1653 dnl to sub processes.
 1654 if export | fgrep " CFLAGS=" > /dev/null; then
 1655     SAVED_CFLAGS="$CFLAGS"
 1656     unset CFLAGS
 1657     CFLAGS="$SAVED_CFLAGS"
 1658     unset SAVED_CFLAGS
 1659 fi
 1660 
 1661 AC_ARG_VAR([CFLAGS_HARDENED_LIB], [extra C compiler flags for hardened libraries])
 1662 AC_ARG_VAR([LDFLAGS_HARDENED_LIB], [extra linker flags for hardened libraries])
 1663 
 1664 AC_ARG_VAR([CFLAGS_HARDENED_EXE], [extra C compiler flags for hardened executables])
 1665 AC_ARG_VAR([LDFLAGS_HARDENED_EXE], [extra linker flags for hardened executables])
 1666 
 1667 CC_EXTRAS=""
 1668 
 1669 AS_IF([test "$GCC" != yes], [CFLAGS="$CFLAGS -g"], [
 1670     CFLAGS="$CFLAGS -ggdb"
 1671 
 1672 dnl When we don't have diagnostic push / pull, we can't explicitly disable
 1673 dnl checking for nonliteral formats in the places where they occur on purpose
 1674 dnl thus we disable nonliteral format checking globally as we are aborting
 1675 dnl on warnings. 
 1676 dnl what makes the things really ugly is that nonliteral format checking is 
 1677 dnl obviously available as an extra switch in very modern gcc but for older
 1678 dnl gcc this is part of -Wformat=2 
 1679 dnl so if we have push/pull we can enable -Wformat=2 -Wformat-nonliteral
 1680 dnl if we don't have push/pull but -Wformat-nonliteral we can enable -Wformat=2
 1681 dnl otherwise none of both
 1682 
 1683     gcc_diagnostic_push_pull=no
 1684     cc_temp_flags "$CFLAGS $WERROR"
 1685     AC_MSG_CHECKING([for gcc diagnostic push / pull])
 1686     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 1687 #pragma GCC diagnostic push
 1688 #pragma GCC diagnostic pop
 1689                       ]])],
 1690                       [
 1691                           AC_MSG_RESULT([yes])
 1692                           gcc_diagnostic_push_pull=yes
 1693                       ], AC_MSG_RESULT([no]))
 1694     cc_restore_flags
 1695 
 1696     AS_IF([cc_supports_flag "-Wformat-nonliteral"],
 1697           [gcc_format_nonliteral=yes],
 1698           [gcc_format_nonliteral=no])
 1699         
 1700     # We had to eliminate -Wnested-externs because of libtool changes
 1701     # Make sure to order options so that the former stand for prerequisites
 1702     # of the latter (e.g., -Wformat-nonliteral requires -Wformat).
 1703     EXTRA_FLAGS="-fgnu89-inline"
 1704     EXTRA_FLAGS="$EXTRA_FLAGS -Wall"
 1705     EXTRA_FLAGS="$EXTRA_FLAGS -Waggregate-return"
 1706     EXTRA_FLAGS="$EXTRA_FLAGS -Wbad-function-cast"
 1707     EXTRA_FLAGS="$EXTRA_FLAGS -Wcast-align"
 1708     EXTRA_FLAGS="$EXTRA_FLAGS -Wdeclaration-after-statement"
 1709     EXTRA_FLAGS="$EXTRA_FLAGS -Wendif-labels"
 1710     EXTRA_FLAGS="$EXTRA_FLAGS -Wfloat-equal"
 1711     EXTRA_FLAGS="$EXTRA_FLAGS -Wformat-security"
 1712     EXTRA_FLAGS="$EXTRA_FLAGS -Wmissing-prototypes"
 1713     EXTRA_FLAGS="$EXTRA_FLAGS -Wmissing-declarations"
 1714     EXTRA_FLAGS="$EXTRA_FLAGS -Wnested-externs"
 1715     EXTRA_FLAGS="$EXTRA_FLAGS -Wno-long-long"
 1716     EXTRA_FLAGS="$EXTRA_FLAGS -Wno-strict-aliasing"
 1717     EXTRA_FLAGS="$EXTRA_FLAGS -Wpointer-arith"
 1718     EXTRA_FLAGS="$EXTRA_FLAGS -Wstrict-prototypes"
 1719     EXTRA_FLAGS="$EXTRA_FLAGS -Wwrite-strings"
 1720     EXTRA_FLAGS="$EXTRA_FLAGS -Wunused-but-set-variable"
 1721     EXTRA_FLAGS="$EXTRA_FLAGS -Wunsigned-char"
 1722 
 1723     AS_IF([test "x$gcc_diagnostic_push_pull" = "xyes"],
 1724           [
 1725               AC_DEFINE([GCC_FORMAT_NONLITERAL_CHECKING_ENABLED], [],
 1726                         [gcc can complain about nonliterals in format])
 1727               EXTRA_FLAGS="$EXTRA_FLAGS -Wformat=2 -Wformat-nonliteral"
 1728           ],
 1729           [test "x$gcc_format_nonliteral" = "xyes"],
 1730           [EXTRA_FLAGS="$EXTRA_FLAGS -Wformat=2"])
 1731 
 1732 # Additional warnings it might be nice to enable one day
 1733 #                -Wshadow
 1734 #                -Wunreachable-code
 1735     for j in $EXTRA_FLAGS
 1736     do
 1737         AS_IF([cc_supports_flag $CC_EXTRAS $j], [CC_EXTRAS="$CC_EXTRAS $j"])
 1738     done
 1739 
 1740     AC_MSG_NOTICE([Using additional gcc flags: ${CC_EXTRAS}])
 1741 ])
 1742 
 1743 dnl
 1744 dnl Hardening flags
 1745 dnl
 1746 dnl The prime control of whether to apply (targeted) hardening build flags and
 1747 dnl which ones is --{enable,disable}-hardening option passed to ./configure:
 1748 dnl
 1749 dnl --enable-hardening=try (default):
 1750 dnl     depending on whether any of CFLAGS_HARDENED_EXE, LDFLAGS_HARDENED_EXE,
 1751 dnl     CFLAGS_HARDENED_LIB or LDFLAGS_HARDENED_LIB environment variables
 1752 dnl     (see below) is set and non-null, all these custom flags (even if not
 1753 dnl     set) are used as are, otherwise the best effort is made to offer
 1754 dnl     reasonably strong hardening in several categories (RELRO, PIE,
 1755 dnl     "bind now", stack protector) according to what the selected toolchain
 1756 dnl     can offer
 1757 dnl
 1758 dnl --enable-hardening:
 1759 dnl     same effect as --enable-hardening=try when the environment variables
 1760 dnl     in question are suppressed
 1761 dnl
 1762 dnl --disable-hardening:
 1763 dnl     do not apply any targeted hardening measures at all
 1764 dnl
 1765 dnl The user-injected environment variables that regulate the hardening in
 1766 dnl default case are as follows:
 1767 dnl
 1768 dnl * CFLAGS_HARDENED_EXE, LDFLAGS_HARDENED_EXE
 1769 dnl    compiler and linker flags (respectively) for daemon programs
 1770 dnl    (pacemakerd, pacemaker-attrd, pacemaker-controld, pacemaker-execd,
 1771 dnl    cib, stonithd, pacemaker-remoted, pacemaker-schedulerd)
 1772 dnl
 1773 dnl * CFLAGS_HARDENED_LIB, LDFLAGS_HARDENED_LIB
 1774 dnl    compiler and linker flags (respectively) for libraries linked
 1775 dnl    with the daemon programs
 1776 dnl
 1777 dnl Note that these are purposedly targeted variables (addressing particular
 1778 dnl targets all over the scattered Makefiles) and have no effect outside of
 1779 dnl the predestined scope (e.g., CLI utilities).  For a global reach,
 1780 dnl use CFLAGS, LDFLAGS, etc. as usual.
 1781 dnl
 1782 dnl For guidance on the suitable flags consult, for instance:
 1783 dnl https://fedoraproject.org/wiki/Changes/Harden_All_Packages#Detailed_Harden_Flags_Description
 1784 dnl https://owasp.org/index.php/C-Based_Toolchain_Hardening#GCC.2FBinutils
 1785 dnl
 1786 
 1787 AS_IF([test $enable_hardening -eq $OPTIONAL],
 1788       [
 1789           AS_IF([test "$(env | grep -Ec '^(C|LD)FLAGS_HARDENED_(EXE|LIB)=.')" = 0],
 1790                 [enable_hardening=$REQUIRED],
 1791                 [AC_MSG_NOTICE([Hardening: using custom flags from environment])]
 1792           )
 1793       ],
 1794       [
 1795           unset CFLAGS_HARDENED_EXE
 1796           unset CFLAGS_HARDENED_LIB
 1797           unset LDFLAGS_HARDENED_EXE
 1798           unset LDFLAGS_HARDENED_LIB
 1799       ]
 1800 )
 1801 AS_CASE([$enable_hardening],
 1802         [$DISABLED], [AC_MSG_NOTICE([Hardening: explicitly disabled])],
 1803         [$REQUIRED], [
 1804             CFLAGS_HARDENED_EXE=
 1805             CFLAGS_HARDENED_LIB=
 1806             LDFLAGS_HARDENED_EXE=
 1807             LDFLAGS_HARDENED_LIB=
 1808             relro=0
 1809             pie=0
 1810             bindnow=0
 1811             stackprot="none"
 1812             # daemons incl. libs: partial RELRO
 1813             flag="-Wl,-z,relro"
 1814             CC_CHECK_LDFLAGS(["${flag}"],
 1815                              [
 1816                                  LDFLAGS_HARDENED_EXE="${LDFLAGS_HARDENED_EXE} ${flag}"
 1817                                  LDFLAGS_HARDENED_LIB="${LDFLAGS_HARDENED_LIB} ${flag}"
 1818                                  relro=1
 1819                              ])
 1820             # daemons: PIE for both CFLAGS and LDFLAGS
 1821             AS_IF([cc_supports_flag -fPIE],
 1822                   [
 1823                       flag="-pie"
 1824                       CC_CHECK_LDFLAGS(["${flag}"],
 1825                                        [
 1826                                            CFLAGS_HARDENED_EXE="${CFLAGS_HARDENED_EXE} -fPIE"
 1827                                            LDFLAGS_HARDENED_EXE="${LDFLAGS_HARDENED_EXE} ${flag}"
 1828                                            pie=1
 1829                                        ])
 1830                   ]
 1831             )
 1832             # daemons incl. libs: full RELRO if sensible + as-needed linking
 1833             #                     so as to possibly mitigate startup performance
 1834             #                     hit caused by excessive linking with unneeded
 1835             #                     libraries
 1836             AS_IF([test "${relro}" = 1 && test "${pie}" = 1],
 1837                   [
 1838                       flag="-Wl,-z,now"
 1839                       CC_CHECK_LDFLAGS(["${flag}"],
 1840                                        [
 1841                                            LDFLAGS_HARDENED_EXE="${LDFLAGS_HARDENED_EXE} ${flag}"
 1842                                            LDFLAGS_HARDENED_LIB="${LDFLAGS_HARDENED_LIB} ${flag}"
 1843                                            bindnow=1
 1844                                        ])
 1845                   ]
 1846             )
 1847             AS_IF([test "${bindnow}" = 1],
 1848                   [
 1849                       flag="-Wl,--as-needed"
 1850                       CC_CHECK_LDFLAGS(["${flag}"],
 1851                                        [
 1852                                            LDFLAGS_HARDENED_EXE="${LDFLAGS_HARDENED_EXE} ${flag}"
 1853                                            LDFLAGS_HARDENED_LIB="${LDFLAGS_HARDENED_LIB} ${flag}"
 1854                                        ])
 1855                   ])
 1856             # universal: prefer strong > all > default stack protector if possible
 1857             flag=
 1858             AS_IF([cc_supports_flag -fstack-protector-strong],
 1859                   [
 1860                       flag="-fstack-protector-strong"
 1861                       stackprot="strong"
 1862                   ],
 1863                   [cc_supports_flag -fstack-protector-all],
 1864                   [
 1865                       flag="-fstack-protector-all"
 1866                       stackprot="all"
 1867                   ],
 1868                   [cc_supports_flag -fstack-protector],
 1869                   [
 1870                       flag="-fstack-protector"
 1871                       stackprot="default"
 1872                   ]
 1873             )
 1874             AS_IF([test -n "${flag}"], [CC_EXTRAS="${CC_EXTRAS} ${flag}"])
 1875             # universal: enable stack clash protection if possible
 1876             AS_IF([cc_supports_flag -fstack-clash-protection],
 1877                   [
 1878                       CC_EXTRAS="${CC_EXTRAS} -fstack-clash-protection"
 1879                       AS_IF([test "${stackprot}" = "none"],
 1880                             [stackprot="clash-only"],
 1881                             [stackprot="${stackprot}+clash"]
 1882                       )
 1883                   ]
 1884             )
 1885             # Log a summary
 1886             AS_IF([test "${relro}" = 1 || test "${pie}" = 1 || test "${stackprot}" != "none"],
 1887                   [AC_MSG_NOTICE(m4_normalize([Hardening:
 1888                         relro=${relro}
 1889                         pie=${pie}
 1890                         bindnow=${bindnow}
 1891                         stackprot=${stackprot}]))
 1892                   ],
 1893                   [AC_MSG_WARN([Hardening: no suitable features in the toolchain detected])]
 1894             )
 1895         ],
 1896 )
 1897 
 1898 CFLAGS="$SANITIZERS_CFLAGS $CFLAGS $CC_EXTRAS"
 1899 LDFLAGS="$SANITIZERS_LDFLAGS $LDFLAGS"
 1900 CFLAGS_HARDENED_EXE="$SANITIZERS_CFLAGS $CFLAGS_HARDENED_EXE"
 1901 LDFLAGS_HARDENED_EXE="$SANITIZERS_LDFLAGS $LDFLAGS_HARDENED_EXE"
 1902 
 1903 NON_FATAL_CFLAGS="$CFLAGS"
 1904 AC_SUBST(NON_FATAL_CFLAGS)
 1905 
 1906 dnl
 1907 dnl We reset CFLAGS to include our warnings *after* all function
 1908 dnl checking goes on, so that our warning flags don't keep the
 1909 dnl AC_*FUNCS() calls above from working.  In particular, -Werror will
 1910 dnl *always* cause us troubles if we set it before here.
 1911 dnl
 1912 dnl
 1913 AS_IF([test $enable_fatal_warnings -ne $DISABLED], [
 1914     AC_MSG_NOTICE([Enabling fatal compiler warnings])
 1915     CFLAGS="$CFLAGS $WERROR"
 1916 ])
 1917 AC_SUBST(CFLAGS)
 1918 
 1919 dnl This is useful for use in Makefiles that need to remove one specific flag
 1920 CFLAGS_COPY="$CFLAGS"
 1921 AC_SUBST(CFLAGS_COPY)
 1922 
 1923 AC_SUBST(LIBADD_DL)        dnl extra flags for dynamic linking libraries
 1924 
 1925 AC_SUBST(LOCALE)
 1926 
 1927 dnl Options for cleaning up the compiler output
 1928 AS_IF([test $enable_quiet -ne $DISABLED],
 1929       [
 1930           AC_MSG_NOTICE([Suppressing make details])
 1931           QUIET_LIBTOOL_OPTS="--silent"
 1932           QUIET_MAKE_OPTS="-s"  # POSIX compliant
 1933       ],
 1934       [
 1935           QUIET_LIBTOOL_OPTS=""
 1936           QUIET_MAKE_OPTS=""
 1937       ]
 1938 )
 1939 
 1940 dnl Put the above variables to use
 1941 LIBTOOL="${LIBTOOL} --tag=CC \$(QUIET_LIBTOOL_OPTS)"
 1942 MAKEFLAGS="${MAKEFLAGS} ${QUIET_MAKE_OPTS}"
 1943 
 1944 # Make features list available (sorted alphabetically, without leading space)
 1945 PCMK_FEATURES=`echo "$PCMK_FEATURES" | sed -e 's/^ //' -e 's/ /\n/g' | sort | xargs`
 1946 AC_DEFINE_UNQUOTED(CRM_FEATURES, "$PCMK_FEATURES", Set of enabled features)
 1947 AC_SUBST(PCMK_FEATURES)
 1948 
 1949 AC_SUBST(CC)
 1950 AC_SUBST(MAKEFLAGS)
 1951 AC_SUBST(LIBTOOL)
 1952 AC_SUBST(QUIET_LIBTOOL_OPTS)
 1953 
 1954 dnl Files we output that need to be executable
 1955 CONFIG_FILES_EXEC([cts/cts-cli],
 1956                   [cts/cts-coverage],
 1957                   [cts/cts-exec],
 1958                   [cts/cts-fencing],
 1959                   [cts/cts-regression],
 1960                   [cts/cts-scheduler],
 1961                   [cts/lxc_autogen.sh],
 1962                   [cts/benchmark/clubench],
 1963                   [cts/lab/CTSlab.py],
 1964                   [cts/lab/OCFIPraTest.py],
 1965                   [cts/lab/cluster_test],
 1966                   [cts/lab/cts],
 1967                   [cts/lab/cts-log-watcher],
 1968                   [cts/support/LSBDummy],
 1969                   [cts/support/cts-support],
 1970                   [cts/support/fence_dummy],
 1971                   [cts/support/pacemaker-cts-dummyd],
 1972                   [daemons/fenced/fence_legacy],
 1973                   [doc/abi-check],
 1974                   [extra/resources/ClusterMon],
 1975                   [extra/resources/HealthSMART],
 1976                   [extra/resources/SysInfo],
 1977                   [extra/resources/ifspeed],
 1978                   [extra/resources/o2cb],
 1979                   [tools/crm_failcount],
 1980                   [tools/crm_master],
 1981                   [tools/crm_report],
 1982                   [tools/crm_standby],
 1983                   [tools/cibsecret],
 1984                   [tools/pcmk_simtimes])
 1985 
 1986 dnl Other files we output
 1987 AC_CONFIG_FILES(Makefile                                            \
 1988                 cts/Makefile                                        \
 1989                 cts/benchmark/Makefile                              \
 1990                 cts/lab/Makefile                                    \
 1991                 cts/lab/CTS.py                                      \
 1992                 cts/lab/CTSvars.py                                  \
 1993                 cts/scheduler/Makefile                              \
 1994                 cts/scheduler/dot/Makefile                          \
 1995                 cts/scheduler/exp/Makefile                          \
 1996                 cts/scheduler/scores/Makefile                       \
 1997                 cts/scheduler/stderr/Makefile                       \
 1998                 cts/scheduler/summary/Makefile                      \
 1999                 cts/scheduler/xml/Makefile                          \
 2000                 cts/support/Makefile                                \
 2001                 cts/support/pacemaker-cts-dummyd@.service           \
 2002                 daemons/Makefile                                    \
 2003                 daemons/attrd/Makefile                              \
 2004                 daemons/based/Makefile                              \
 2005                 daemons/controld/Makefile                           \
 2006                 daemons/execd/Makefile                              \
 2007                 daemons/execd/pacemaker_remote                      \
 2008                 daemons/execd/pacemaker_remote.service              \
 2009                 daemons/fenced/Makefile                             \
 2010                 daemons/pacemakerd/Makefile                         \
 2011                 daemons/pacemakerd/pacemaker.service                \
 2012                 daemons/pacemakerd/pacemaker.upstart                \
 2013                 daemons/pacemakerd/pacemaker.combined.upstart       \
 2014                 daemons/schedulerd/Makefile                         \
 2015                 devel/Makefile                                      \
 2016                 doc/Doxyfile                                        \
 2017                 doc/Makefile                                        \
 2018                 doc/sphinx/Makefile                                 \
 2019                 etc/Makefile                                        \
 2020                 etc/init.d/pacemaker                                \
 2021                 etc/logrotate.d/pacemaker                           \
 2022                 extra/Makefile                                      \
 2023                 extra/alerts/Makefile                               \
 2024                 extra/resources/Makefile                            \
 2025                 include/Makefile                                    \
 2026                 include/crm/Makefile                                \
 2027                 include/crm/cib/Makefile                            \
 2028                 include/crm/common/Makefile                         \
 2029                 include/crm/cluster/Makefile                        \
 2030                 include/crm/fencing/Makefile                        \
 2031                 include/crm/pengine/Makefile                        \
 2032                 include/pcmki/Makefile                              \
 2033                 replace/Makefile                                    \
 2034                 lib/Makefile                                        \
 2035                 lib/libpacemaker.pc                                 \
 2036                 lib/pacemaker.pc                                    \
 2037                 lib/pacemaker-cib.pc                                \
 2038                 lib/pacemaker-lrmd.pc                               \
 2039                 lib/pacemaker-service.pc                            \
 2040                 lib/pacemaker-pe_rules.pc                           \
 2041                 lib/pacemaker-pe_status.pc                          \
 2042                 lib/pacemaker-fencing.pc                            \
 2043                 lib/pacemaker-cluster.pc                            \
 2044                 lib/common/Makefile                                 \
 2045                 lib/common/tests/Makefile                           \
 2046                 lib/common/tests/agents/Makefile                    \
 2047                 lib/common/tests/cmdline/Makefile                   \
 2048                 lib/common/tests/flags/Makefile                     \
 2049                 lib/common/tests/operations/Makefile                \
 2050                 lib/common/tests/strings/Makefile                   \
 2051                 lib/common/tests/utils/Makefile                     \
 2052                 lib/common/tests/xpath/Makefile                     \
 2053                 lib/cluster/Makefile                                \
 2054                 lib/cib/Makefile                                    \
 2055                 lib/gnu/Makefile                                    \
 2056                 lib/pacemaker/Makefile                              \
 2057                 lib/pengine/Makefile                                \
 2058                 lib/pengine/tests/Makefile                          \
 2059                 lib/pengine/tests/rules/Makefile                    \
 2060                 lib/fencing/Makefile                                \
 2061                 lib/lrmd/Makefile                                   \
 2062                 lib/services/Makefile                               \
 2063                 maint/Makefile                                      \
 2064                 tests/Makefile                                      \
 2065                 tools/Makefile                                      \
 2066                 tools/report.collector                              \
 2067                 tools/report.common                                 \
 2068                 tools/crm_mon.service                               \
 2069                 tools/crm_mon.upstart                               \
 2070                 xml/Makefile                                        \
 2071                 xml/pacemaker-schemas.pc                            \
 2072 )
 2073 
 2074 dnl Now process the entire list of files added by previous
 2075 dnl  calls to AC_CONFIG_FILES()
 2076 AC_OUTPUT()
 2077 
 2078 dnl *****************
 2079 dnl Configure summary
 2080 dnl *****************
 2081 
 2082 AC_MSG_NOTICE([])
 2083 AC_MSG_NOTICE([$PACKAGE configuration:])
 2084 AC_MSG_NOTICE([  Version                  = ${VERSION} (Build: $BUILD_VERSION)])
 2085 AC_MSG_NOTICE([  Features                 = ${PCMK_FEATURES}])
 2086 AC_MSG_NOTICE([])
 2087 AC_MSG_NOTICE([  Prefix                   = ${prefix}])
 2088 AC_MSG_NOTICE([  Executables              = ${sbindir}])
 2089 AC_MSG_NOTICE([  Man pages                = ${mandir}])
 2090 AC_MSG_NOTICE([  Libraries                = ${libdir}])
 2091 AC_MSG_NOTICE([  Header files             = ${includedir}])
 2092 AC_MSG_NOTICE([  Arch-independent files   = ${datadir}])
 2093 AC_MSG_NOTICE([  State information        = ${localstatedir}])
 2094 AC_MSG_NOTICE([  System configuration     = ${sysconfdir}])
 2095 AC_MSG_NOTICE([  OCF agents               = ${OCF_ROOT_DIR}])
 2096 AC_MSG_NOTICE([])
 2097 AC_MSG_NOTICE([  HA group name            = ${CRM_DAEMON_GROUP}])
 2098 AC_MSG_NOTICE([  HA user name             = ${CRM_DAEMON_USER}])
 2099 AC_MSG_NOTICE([])
 2100 AC_MSG_NOTICE([  CFLAGS                   = ${CFLAGS}])
 2101 AC_MSG_NOTICE([  CFLAGS_HARDENED_EXE      = ${CFLAGS_HARDENED_EXE}])
 2102 AC_MSG_NOTICE([  CFLAGS_HARDENED_LIB      = ${CFLAGS_HARDENED_LIB}])
 2103 AC_MSG_NOTICE([  LDFLAGS_HARDENED_EXE     = ${LDFLAGS_HARDENED_EXE}])
 2104 AC_MSG_NOTICE([  LDFLAGS_HARDENED_LIB     = ${LDFLAGS_HARDENED_LIB}])
 2105 AC_MSG_NOTICE([  Libraries                = ${LIBS}])
 2106 AC_MSG_NOTICE([  Stack Libraries          = ${CLUSTERLIBS}])
 2107 AC_MSG_NOTICE([  Unix socket auth method  = ${us_auth}])