diff --git a/booth.spec.in b/booth.spec.in
index 48ac14f..dc07345 100644
--- a/booth.spec.in
+++ b/booth.spec.in
@@ -1,268 +1,274 @@
# keep around ready for later user
@ALPHATAG@
@NUMCOMM@
@DIRTY@
%global gitver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
%global gittarver %{?numcomm:-%{numcomm}}%{?alphatag:-g%{alphatag}}%{?dirty:-%{dirty}}
%@bcond_html_man@ html_man
%@bcond_glue@ glue
%@bcond_python3@ python3
%@bcond_run_build_tests@ run_build_tests
## User and group to use for nonprivileged services (should be in sync with pacemaker)
%global uname @uname@
%global gname @gname@
# Defined on RHEL 8 and Fedora
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?__python3: %global __python3 /usr/bin/python3}
%if 0%{?with_python3}
%global __python_full_path %{__python3}
%else
%global __python_full_path %{__python2}
%endif
%if 0%{?suse_version}
%global booth_docdir %{_defaultdocdir}/%{name}
%else
# newer fedora distros have _pkgdocdir, rely on that when
# available
%{!?_pkgdocdir: %global _pkgdocdir %%{_docdir}/%{name}-%{version}}
# Directory where we install documentation
%global booth_docdir %{_pkgdocdir}
%endif
%global test_path %{_datadir}/booth/tests
%if 0%{?suse_version}
%define _libexecdir %{_libdir}
%define _fwdefdir %{_libexecdir}/firewalld/services
%endif
%define with_extra_warnings 0
%define with_debugging 0
%define without_fatal_warnings 1
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
%define pkg_group System Environment/Daemons
%else
%define pkg_group Productivity/Clustering/HA
%endif
Name: booth
Url: https://github.com/ClusterLabs/booth
Summary: Ticket Manager for Multi-site Clusters
%if 0%{?suse_version}
License: GPL-2.0+
%else
License: GPLv2+
%endif
Group: %{pkg_group}
Version: @version@
Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
Source: https://github.com/ClusterLabs/booth/archive/v%{version}%{?gittarver}/%{name}-%{version}%{?gitver}.tar.gz
Source1: %name-rpmlintrc
BuildRequires: @asciidoc@
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: pkgconfig
%if 0%{?suse_version}
BuildRequires: glib2-devel
# SuSEFirewall2 replaced by Firewalld (fate#323460)
BuildRequires: firewall-macros
%else
BuildRequires: pkgconfig(glib-2.0)
%endif
BuildRequires: libgcrypt-devel
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
BuildRequires: pacemaker-libs-devel
%else
BuildRequires: libpacemaker-devel
%endif
%if 0%{?with_glue}
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
BuildRequires: cluster-glue-libs-devel
%else
BuildRequires: libglue-devel
%endif
%else
# logging provider
BuildRequires: pkgconfig(libqb)
# random2range provider
BuildRequires: pkgconfig(glib-2.0)
# nametag provider
BuildRequires: pkgconfig(libsystemd)
%endif
BuildRequires: libxml2-devel
BuildRequires: zlib-devel
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
Requires: pacemaker >= 1.1.8
%if 0%{?with_glue}
Requires: cluster-glue-libs >= 1.0.6
%endif
%else
Requires: pacemaker-ticket-support >= 2.0
%endif
# for check scriptlet
%if 0%{?with_python3}
BuildRequires: python3-devel
%else
BuildRequires: python
%endif
# For Fedora compatibility
Provides: booth-core
Provides: booth-site
Provides: booth-arbitrator
%description
Booth manages tickets which authorize cluster sites located in
geographically dispersed locations to run resources. It
facilitates support of geographically distributed clustering in
Pacemaker.
%prep
%setup -q -n %{name}-%{version}%{?gitver}
%build
./autogen.sh
%configure \
--with-initddir=%{_initrddir} \
--docdir=%{booth_docdir} \
%{?with_html_man:--with-html_man} \
%{!?with_glue:--without-glue} \
PYTHON=%{__python_full_path}
make
%install
make DESTDIR=$RPM_BUILD_ROOT install docdir=%{booth_docdir}
mkdir -p %{buildroot}/%{_mandir}/man8/
gzip < docs/boothd.8 > %{buildroot}/%{_mandir}/man8/booth.8.gz
ln %{buildroot}/%{_mandir}/man8/booth.8.gz %{buildroot}/%{_mandir}/man8/boothd.8.gz
%if %{defined _unitdir}
# systemd
mkdir -p %{buildroot}/%{_unitdir}
cp -a conf/booth@.service %{buildroot}/%{_unitdir}/booth@.service
cp -a conf/booth-arbitrator.service %{buildroot}/%{_unitdir}/booth-arbitrator.service
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcbooth-arbitrator
%else
# sysV init
ln -s ../../%{_initddir}/booth-arbitrator %{buildroot}%{_sbindir}/rcbooth-arbitrator
%endif
#install test-parts
mkdir -p %{buildroot}/%{test_path}/conf
cp -a unit-tests/ script/unit-test.py test %{buildroot}/%{test_path}/
cp -a conf/booth.conf.example %{buildroot}/%{test_path}/conf/
chmod +x %{buildroot}/%{test_path}/test/booth_path
chmod +x %{buildroot}/%{test_path}/test/live_test.sh
mkdir -p %{buildroot}/%{test_path}/src/
ln -s %{_sbindir}/boothd %{buildroot}/%{test_path}/src/
rm -f %{buildroot}/%{test_path}/test/*.pyc
# Generate runtests.py and boothtestenv.py
sed -e 's#PYTHON_SHEBANG#%{__python_full_path} -Es#g' \
-e 's#TEST_SRC_DIR#%{test_path}/test#g' \
-e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
%{buildroot}/%{test_path}/test/runtests.py.in > %{buildroot}/%{test_path}/test/runtests.py
chmod +x %{buildroot}/%{test_path}/test/runtests.py
sed -e 's#PYTHON_SHEBANG#%{__python_full_path} -Es#g' \
-e 's#TEST_SRC_DIR#%{test_path}/test#g' \
-e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
%{buildroot}/%{test_path}/test/boothtestenv.py.in > %{buildroot}/%{test_path}/test/boothtestenv.py
%if 0%{?suse_version}
#Firewalld rule
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 644 contrib/geo-cluster.firewalld.xml $RPM_BUILD_ROOT/%{_fwdefdir}/booth.xml
#install -m 644 %{S:2} $RPM_BUILD_ROOT/%{_fwdefdir}/booth
%post
%firewalld_reload
%endif
%check
%if 0%{?with_run_build_tests}
echo "%%with_run_build_tests set to %with_run_build_tests; including tests"
make check
%else
echo "%%with_run_build_tests set to %with_run_build_tests; skipping tests"
%endif
%files
%{_sbindir}/booth
%{_sbindir}/boothd
%{_sbindir}/booth-keygen
%{_sbindir}/geostore
%{_mandir}/man8/booth.8.gz
%{_mandir}/man8/boothd.8.gz
%{_mandir}/man8/booth-keygen.8.gz
%{_mandir}/man8/geostore.8.gz
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/pacemaker
%dir /usr/lib/ocf/resource.d/booth
%dir /usr/lib/ocf/lib
%dir /usr/lib/ocf/lib/booth
%dir %{_sysconfdir}/booth
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/cores
%{_sbindir}/rcbooth-arbitrator
/usr/lib/ocf/resource.d/pacemaker/booth-site
/usr/lib/ocf/lib/booth/geo_attr.sh
/usr/lib/ocf/resource.d/booth/geostore
%config %{_sysconfdir}/booth/booth.conf.example
%if 0%{?suse_version}
%dir %{_libexecdir}/firewalld
%dir %{_fwdefdir}
%{_fwdefdir}/booth.xml
%endif
%if %{defined _unitdir}
%{_unitdir}/booth@.service
%{_unitdir}/booth-arbitrator.service
%exclude %{_initddir}/booth-arbitrator
%else
%{_initddir}/booth-arbitrator
%endif
%dir %{_datadir}/booth
%{_datadir}/booth/service-runnable
%doc AUTHORS README COPYING
%doc README.upgrade-from-v0.1
+%if 0%{?with_html_man}
+%{booth_docdir}/booth-keygen.8.html
+%{booth_docdir}/boothd.8.html
+%{booth_docdir}/geostore.8.html
+%endif
+
%package test
Summary: Test scripts for Booth
Group: %{pkg_group}
Requires: booth
Requires: gdb
Requires: %{__python_full_path}
%if 0%{?with_python3}
Requires: python3-pexpect
%else
Requires: python-pexpect
%endif
%description test
This package contains automated tests for Booth,
the Cluster Ticket Manager for Pacemaker.
%files test
%doc %{booth_docdir}/README-testing
%{test_path}
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/booth
/usr/lib/ocf/resource.d/booth/sharedrsc
%changelog
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index ff0c534..b27ada1 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,265 +1,270 @@
#!/bin/sh
# Print a version string.
scriptversion=2018-08-31.20; # UTC
# Copyright (C) 2012-2020 Red Hat, Inc.
# Copyright (C) 2007-2016 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
# It may be run two ways:
# - from a git repository in which the "git describe" command below
# produces useful output (thus requiring at least one signed tag)
# - from a non-git-repo directory containing a .tarball-version file, which
# presumes this script is invoked like "./git-version-gen .tarball-version".
# In order to use intra-version strings in your project, you will need two
# separate generated version string files:
#
# .tarball-version - present only in a distribution tarball, and not in
# a checked-out repository. Created with contents that were learned at
# the last time autoconf was run, and used by git-version-gen. Must not
# be present in either $(srcdir) or $(builddir) for git-version-gen to
# give accurate answers during normal development with a checked out tree,
# but must be present in a tarball when there is no version control system.
# Therefore, it cannot be used in any dependencies. GNUmakefile has
# hooks to force a reconfigure at distribution time to get the value
# correct, without penalizing normal development with extra reconfigures.
#
# .version - present in a checked-out repository and in a distribution
# tarball. Usable in dependencies, particularly for files that don't
# want to depend on config.h but do want to track version changes.
# Delete this file prior to any autoconf run where you want to rebuild
# files to pick up a version string change; and leave it stale to
# minimize rebuild time after unrelated changes to configure sources.
#
# As with any generated file in a VC'd directory, you should add
# /.version to .gitignore, so that you don't accidentally commit it.
# .tarball-version is never generated in a VC'd directory, so needn't
# be listed there.
#
# In order to use git archive versions another two files has to be presented:
#
# .gitarchive-version - present in checked-out repository and git
# archive tarball, but not in the distribution tarball. Used as a last
# option for version. File must contain special string $Format:%d$,
# which is substitued by git on archive operation.
#
# .gitattributes - present in checked-out repository and git archive
# tarball, but not in the distribution tarball. Must set export-subst
# attribute for .gitarchive-version file.
#
# Use the following line in your configure.ac, so that $(VERSION) will
# automatically be up-to-date each time configure is run (and note that
# since configure.ac no longer includes a version string, Makefile rules
# should not depend on configure.ac for version updates).
#
# AC_INIT([GNU project],
# m4_esyscmd([build-aux/git-version-gen .tarball-version]),
# [bug-project@example])
#
# Then use the following lines in your Makefile.am, so that .version
# will be present for dependencies, and so that .version and
# .tarball-version will exist in distribution tarballs.
#
# EXTRA_DIST = $(top_srcdir)/.version
# BUILT_SOURCES = $(top_srcdir)/.version
# $(top_srcdir)/.version:
# echo $(VERSION) > $@-t && mv $@-t $@
# dist-hook:
# echo $(VERSION) > $(distdir)/.tarball-version
me=$0
version="git-version-gen $scriptversion
Copyright 2011 Free Software Foundation, Inc.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
usage="\
Usage: $me [OPTION]... \$srcdir/.tarball-version [\$srcdir/.gitarchive-version] [TAG-NORMALIZATION-SED-SCRIPT]
Print a version string.
Options:
--prefix PREFIX prefix of git tags (default 'v')
--fallback VERSION
fallback version to use if \"git --version\" fails
--help display this help and exit
--version output version information and exit
Running without arguments will suffice in most cases."
prefix=v
fallback=
while test $# -gt 0; do
case $1 in
--help) echo "$usage"; exit 0;;
--version) echo "$version"; exit 0;;
--prefix) shift; prefix="$1";;
--fallback) shift; fallback="$1";;
-*)
echo "$0: Unknown option '$1'." >&2
echo "$0: Try '--help' for more information." >&2
exit 1;;
*)
if test "x$tarball_version_file" = x; then
tarball_version_file="$1"
elif test "x$gitarchive_version_file" = x; then
gitarchive_version_file="$1"
elif test "x$tag_sed_script" = x; then
tag_sed_script="$1"
else
echo "$0: extra non-option argument '$1'." >&2
exit 1
fi;;
esac
shift
done
if test "x$tarball_version_file" = x; then
echo "$usage"
exit 1
fi
tag_sed_script="${tag_sed_script:-s/x/x/}"
nl='
'
# Avoid meddling by environment variable of the same name.
v=
v_from_git=
# First see if there is a tarball-only version file.
# then try "git describe", then default.
if test -f $tarball_version_file
then
v=`cat $tarball_version_file` || v=
case $v in
*$nl*) v= ;; # reject multi-line output
[0-9]*) ;;
*) v= ;;
esac
test "x$v" = x \
&& echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2
fi
if test "x$v" != x
then
: # use $v
# Otherwise, if there is at least one git commit involving the working
# directory, and "git describe" output looks sensible, use that to
# derive a version string.
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
&& v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
|| git describe --abbrev=4 HEAD 2>/dev/null` \
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
&& case $v in
$prefix[0-9]*) ;;
*) (exit 1) ;;
esac
then
# Is this a new git that lists number of commits since the last
# tag or the previous older version that did not?
# Newer: v6.10-77-g0f8faeb
# Older: v6.10-g0f8faeb
case $v in
*-*-*) : git describe is okay three part flavor ;;
*-*)
: git describe is older two part flavor
# Recreate the number of commits and rewrite such that the
# result is the same as if we were using the newer version
# of git describe.
vtag=`echo "$v" | sed 's/-.*//'`
commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \
|| { commit_list=failed;
echo "$0: WARNING: git rev-list failed" 1>&2; }
numcommits=`echo "$commit_list" | wc -l`
v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
test "$commit_list" = failed && v=UNKNOWN
;;
esac
# Change the first '-' to a '.', so version-comparing tools work properly.
# Remove the "g" in git describe's output string, to save a byte.
v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
v_from_git=1
elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
if test -f $gitarchive_version_file
then
v=`sed "s/^.*tag: \($prefix[0-9)][^,)]*\).*\$/\1/" $gitarchive_version_file \
| sed "$tag_sed_script"` || exit 1
case $v in
*$nl*) v= ;; # reject multi-line output
$prefix[0-9]*) ;;
*) v= ;;
esac
- test -z "$v" \
- && echo "$0: WARNING: $gitarchive_version_file doesn't contain valid version tag" 1>&2 \
- && v=UNKNOWN
+ if test -z "$v"; then
+ if test "x$fallback" = x; then
+ echo "$0: WARNING: $gitarchive_version_file doesn't contain valid version tag" 1>&2
+ v=UNKNOWN
+ else
+ v=$fallback
+ fi
+ fi
elif test "x$fallback" = x; then
v=UNKNOWN
else
v=$fallback
fi
else
v=$fallback
fi
if test "x$fallback" = x -a "$v" = "UNKNOWN"
then
echo "$0: ERROR: Can't find valid version. Please use valid git repository," \
"released tarball or version tagged archive" 1>&2
exit 1
fi
v=`echo "$v" |sed "s/^$prefix//"`
# Test whether to append the "-dirty" suffix only if the version
# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
# or if it came from .tarball-version.
if test "x$v_from_git" != x; then
# Don't declare a version "dirty" merely because a time stamp has changed.
git update-index --refresh > /dev/null 2>&1
dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
case "$dirty" in
'') ;;
*) # Append the suffix only if there isn't one already.
case $v in
*-dirty) ;;
*) v="$v-dirty" ;;
esac ;;
esac
fi
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
printf %s "$v"
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
diff --git a/configure.ac b/configure.ac
index 6febdbe..db3d789 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,535 +1,534 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# bootstrap / init
AC_PREREQ([2.61])
AC_INIT([booth],
m4_esyscmd([build-aux/git-version-gen --fallback 1.0 .tarball-version .gitarchivever]),
[users@clusterlabs.org])
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([-Wno-portability subdir-objects])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADER([src/b_config.h src/booth_config.h])
AC_CANONICAL_HOST
AC_LANG([C])
AC_SUBST(WITH_LIST, [""])
dnl Fix default variables - "prefix" variable if not specified
if test "$prefix" = "NONE"; then
prefix="/usr"
dnl Fix "localstatedir" variable if not specified
if test "$localstatedir" = "\${prefix}/var"; then
localstatedir="/var"
fi
dnl Fix "sysconfdir" variable if not specified
if test "$sysconfdir" = "\${prefix}/etc"; then
sysconfdir="/etc"
fi
dnl Fix "libdir" variable if not specified
if test "$libdir" = "\${exec_prefix}/lib"; then
if test -e /usr/lib64; then
libdir="/usr/lib64"
else
libdir="/usr/lib"
fi
fi
fi
if test "x${prefix}" != "x/usr"; then
ocfdir="${prefix}/usr/lib/ocf"
else
ocfdir="${prefix}/lib/ocf"
fi
AC_SUBST([ocfdir])
if test "$srcdir" = "."; then
AC_MSG_NOTICE([building in place srcdir:$srcdir])
AC_DEFINE([BUILDING_IN_PLACE], 1, [building in place])
else
AC_MSG_NOTICE([building out of tree srcdir:$srcdir])
fi
# Checks for programs.
# check stolen from gnulib/m4/gnu-make.m4
if ! ${MAKE-make} --version /cannot/make/this >/dev/null 2>&1; then
AC_MSG_ERROR([you don't seem to have GNU make; it is required])
fi
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PATH_PROGS(PKGCONFIG, pkg-config)
AC_PATH_PROGS(ASCIIDOC, asciidoc)
AC_PATH_PROGS(ASCIIDOCTOR, asciidoctor)
AC_PATH_PROGS(A2X, a2x)
AM_CONDITIONAL(IS_ASCIIDOC, test x"${ASCIIDOC}" != x"")
AM_CONDITIONAL(IS_A2X, test x"${A2X}" != x"")
AM_CONDITIONAL(BUILD_ASCIIDOC, test x"${A2X}" != x"" || test x"${ASCIIDOCTOR}" != x"")
# libgcrypt or mhash for hmac
libgcrypt_installed="yes"
AC_CHECK_HEADERS(gcrypt.h, , [libgcrypt_installed="no"],)
AC_CHECK_LIB(gcrypt, gcry_md_open, , [libgcrypt_installed="no"])
AM_CONDITIONAL(BUILD_AUTH_C, test "x${libgcrypt_installed}" = "xyes")
if test "x$libgcrypt_installed" = "xno"; then
mhash_installed="yes"
AC_CHECK_HEADERS(mhash.h, , [mhash_installed="no"],)
AC_CHECK_LIB(mhash, mhash_init, , [mhash_installed="no"])
AM_CONDITIONAL(BUILD_AUTH_C, test "x${mhash_installed}" = "xyes")
fi
AC_CHECK_LIB([xml2], xmlReadDoc)
PKG_CHECK_MODULES(XML, [libxml-2.0])
PKG_CHECK_MODULES(GLIB, [glib-2.0])
PKG_CHECK_MODULES([PCMK], [pacemaker-service],,
[PKG_CHECK_MODULES([PCMK], [pcmk-service])])
# Python casing, prefer 3.3+ to 2.{6...}
if test "x$PYTHON" = "x"; then
AM_PATH_PYTHON([3.3],, [AM_PATH_PYTHON([2.6])])
else
# Just set Automake variables (mainly PYTHON_VERSION)
AM_PATH_PYTHON
fi
PYTHON_SHEBANG="$PYTHON ${PYTHON_OPTS--Es}"
AC_SUBST([PYTHON_SHEBANG])
AM_CONDITIONAL(PYTHON_IS_VERSION3, test "x${PYTHON_VERSION%%.*}" = "x3")
# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h \
stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h \
sys/time.h syslog.h unistd.h sys/types.h getopt.h malloc.h \
sys/sockio.h utmpx.h])
AC_CHECK_HEADERS(heartbeat/glue_config.h)
AC_CHECK_HEADERS(mhash.h)
AC_CHECK_HEADER([zlib.h],
[AC_SUBST(ZLIB_LIBS, ["-lz"])],
[AC_MSG_ERROR([zlib development files required])])
saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PCMK_CFLAGS} ${GLIB_CFLAGS}"
AC_CHECK_HEADER([crm/services.h], [],
[AC_MSG_ERROR([crm/services.h header required])])
CPPFLAGS="${saved_CPPFLAGS}"
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_HEADER_TIME
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_C_VOLATILE
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_REPLACE_FNMATCH
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm alphasort atexit bzero dup2 endgrent endpwent fcntl \
getcwd getpeerucred getpeereid gettimeofday inet_ntoa memmove \
memset mkdir scandir select socket strcasecmp strchr strdup \
strerror strrchr strspn strstr \
sched_get_priority_max sched_setscheduler])
AC_CONFIG_FILES([Makefile
src/Makefile
docs/Makefile
conf/Makefile])
AC_CONFIG_FILES([conf/booth-arbitrator.service conf/booth@.service])
AC_CONFIG_FILES([script/unit-test.py])
AC_CONFIG_FILES([script/service-runnable], [chmod +x script/service-runnable])
# ===============================================
# Helpers
# ===============================================
## helper for CC stuff
cc_supports_flag() {
local CFLAGS="-Werror $@"
AC_MSG_CHECKING(whether $CC supports "$@")
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(){return 0;}]])],
[RC=0; AC_MSG_RESULT(yes)],[RC=1; AC_MSG_RESULT(no)])
return $RC
}
## extract header or define
try_extract_header_define() {
AC_MSG_CHECKING(if $2 in $1 exists)
Cfile=$srcdir/extract_define.$2.${$}
printf "#include \n" > ${Cfile}.c
printf "#include <%s>\n" $1 >> ${Cfile}.c
printf "int main(int argc, char **argv) {\n" >> ${Cfile}.c
printf "#ifdef %s\n" $2 >> ${Cfile}.c
printf "printf(\"%%s\", %s);\n" $2 >> ${Cfile}.c
printf "#endif \n return 0; }\n" >> ${Cfile}.c
$CC $CFLAGS ${Cfile}.c -o ${Cfile} 2>/dev/null
value=
if test -x ${Cfile}; then
value=`${Cfile} 2>/dev/null`
fi
if test x"${value}" = x""; then
value=$3
AC_MSG_RESULT(default: $value)
else
AC_MSG_RESULT($value)
fi
printf $value
rm -rf ${Cfile}.c ${Cfile} ${Cfile}.dSYM ${Cfile}.gcno
}
## cleanup
AC_MSG_NOTICE(Sanitizing prefix: ${prefix})
case $prefix in
NONE) prefix=/usr/local;;
esac
AC_MSG_NOTICE(Sanitizing exec_prefix: ${exec_prefix})
case $exec_prefix in
dnl For consistency with Corosync, map NONE->$prefix
NONE) exec_prefix=$prefix;;
prefix) exec_prefix=$prefix;;
esac
## local defines
PACKAGE_FEATURES=""
LINT_FLAGS="-weak -unrecog +posixlib +ignoresigns -fcnuse \
-badflag -D__gnuc_va_list=va_list -D__attribute\(x\)="
# local options
AC_ARG_ENABLE([fatal-warnings],
[ --enable-fatal-warnings : enable fatal warnings. ],
[ default="no" ])
AC_ARG_ENABLE([debug],
[ --enable-debug : enable debug build. ],
[ default="no" ])
AC_ARG_ENABLE([user-flags],
[ --enable-user-flags : rely on user environment. ],
[ default="no" ])
AC_ARG_ENABLE([coverage],
[ --enable-coverage : coverage analysis of the codebase. ],
[ default="no" ])
AC_ARG_WITH([initddir],
[ --with-initddir=DIR : path to init script directory. ],
[ INITDDIR="$withval" ],
[ INITDDIR="$sysconfdir/init.d" ])
AC_ARG_WITH([html_man],
- [ --with-html_man : Enable generating man pages in HTML.],
- [with_html_man=yes],
- [])
+ [ --with-html_man : Enable generating man pages in HTML.])
+
AM_CONDITIONAL(BUILD_ASCIIDOC_HTML_MAN,
(test "x${ASCIIDOC}" != "x" || test x"${ASCIIDOCTOR}" != x"") && test "x$with_html_man" = "xyes")
AC_ARG_WITH([glue],
[ --without-glue : Avoid libraries from (cluster-)glue project.],
[],
[with_glue=yes])
AC_ARG_WITH([run_build_tests],
[ --with-run-build-tests : Enable running build tests when generating RPM],
[run_build_tests=yes],
[])
AM_CONDITIONAL([RUN_BUILD_TESTS], [test "x$run_build_tests" = "xyes"])
# figure out logging provider
logging_provider=""
if test "x$logging_provider" = "x" && test "x$with_glue" = "xyes"; then
AC_CHECK_LIB([plumb], [cl_log], [logging_provider="libplumb"])
fi
if test "x$logging_provider" = "x" && test "x$with_glue" = "xno"; then
AC_CHECK_LIB([qb], [qb_log_real_], [logging_provider="libqb"])
fi
case "$logging_provider" in
libplumb)
LOGGER="ha_logger"
;;
libqb)
PKG_CHECK_MODULES([LIBQB], [libqb])
AC_DEFINE([LOGGING_LIBQB], [], [use libqb as a logging provider])
PKG_CHECK_MODULES([LIBQB1], [libqb >= 1.0],
[AC_DEFINE([LOGGING_LIBQB_MAJOR], [1],
[libqb major version lower bound])],
[AC_MSG_WARN([[syslog identifier will not get changed]])])
LOGGER="logger -t booth-script"
;;
*)
AC_MSG_ERROR([logging provider required (libplumb, or libqb when --without-glue)])
;;
esac
AM_CONDITIONAL([LOGGING_LIBQB], [test "x$logging_provider" = "xlibqb"])
AC_SUBST([LOGGER])
# figure out range2random provider
range2random_provider=""
if test "x$range2random_provider" = "x" && test "x$with_glue" = "xyes"; then
AC_CHECK_LIB([plumb], [get_next_random], [range2random_provider="libplumb"])
AC_CHECK_DECL([cl_rand_from_interval], [], [range2random_provider=""],
[#include ])
fi
if test "x$range2random_provider" = "x" && test "x$with_glue" = "xno"; then
AC_CHECK_LIB([glib-2.0], [g_random_int_range], [range2random_provider="glib"])
fi
case "$range2random_provider" in
libplumb)
;;
glib)
PKG_CHECK_MODULES([GLIB], [glib-2.0])
AC_DEFINE([RANGE2RANDOM_GLIB], [], [use glib as a range2random provider])
;;
*)
AC_MSG_ERROR([range2random provider required (libplumb, or glib when --without-glue)])
;;
esac
AM_CONDITIONAL([RANGE2RANDOM_GLIB], [test "x$range2random_provider" = "xglib"])
# figure out nametag/distinguished-role provider
nametag_provider=""
if test "x$nametag_provider" = "x" && test "x$with_glue" != "xno"; then
AC_CHECK_LIB([plumbgpl], [set_proc_title], [nametag_provider="libplumbgpl"])
fi
if test "x$nametag_provider" = "x" && test "x$with_glue" = "xno"; then
AC_SEARCH_LIBS([sd_notify], [systemd systemd-daemon], [nametag_provider="libsystemd"])
fi
NOTIFY_ACCESS_SWITCH='# '
case "$nametag_provider" in
libplumbgpl)
;;
libsystemd)
PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],, [
PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd-daemon])
])
AC_DEFINE([NAMETAG_LIBSYSTEMD], [], [use libsystemd as a nametag provider])
NOTIFY_ACCESS_SWITCH=
;;
*)
AC_MSG_ERROR([nametag provider required (libplumbgpl, or libsystemd when --without-glue)])
;;
esac
AM_CONDITIONAL([NAMETAG_LIBSYSTEMD], [test "x$nametag_provider" = "xlibsystemd"])
AC_SUBST([NOTIFY_ACCESS_SWITCH])
# figure out if "coredump nursing" supported and desired
coredump_nursing="no"
if test "x$with_glue" != "xno"; then
AC_CHECK_LIB([plumb], [cl_enable_coredumps], [coredump_nursing="libplumb"])
fi
if test "x$coredump_nursing" != "xno"; then
AC_DEFINE(COREDUMP_NURSING, [], [eligible for coredump nursing])
fi
AM_CONDITIONAL([COREDUMP_NURSING], [test "x$coredump_nursing" != "xno"])
# define CRM daemon user & group
CRM_DAEMON_USER=`try_extract_header_define glue_config.h HA_CCMUSER hacluster`
AC_DEFINE_UNQUOTED(CRM_DAEMON_USER,"$CRM_DAEMON_USER", User to run Booth daemon as)
AC_SUBST(CRM_DAEMON_USER)
CRM_DAEMON_GROUP=`try_extract_header_define glue_config.h HA_APIGROUP haclient`
AC_DEFINE_UNQUOTED(CRM_DAEMON_GROUP,"$CRM_DAEMON_GROUP", Group to run Booth daemon as)
AC_SUBST(CRM_DAEMON_GROUP)
# *FLAGS handling goes here
ENV_CFLAGS="$CFLAGS"
ENV_CPPFLAGS="$CPPFLAGS"
ENV_LDFLAGS="$LDFLAGS"
# debug build stuff
if test "x${enable_debug}" = xyes; then
AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code])
OPT_CFLAGS="-O0 -U_FORTIFY_SOURCE"
PACKAGE_FEATURES="$PACKAGE_FEATURES debug"
else
OPT_CFLAGS="-O3"
fi
# gdb flags
if test "x${GCC}" = xyes; then
GDB_FLAGS="-ggdb3"
else
GDB_FLAGS="-g"
fi
dnl Check for POSIX clock_gettime
dnl
AC_CACHE_CHECK([have clock_gettime],ac_cv_HAVE_CLOCK_GETTIME,[
AC_TRY_COMPILE([
#include
],
[ struct timespec tv; clock_gettime(CLOCK_REALTIME, &tv); return 0;],
ac_cv_HAVE_CLOCK_GETTIME=yes,ac_cv_HAVE_CLOCK_GETTIME=no,ac_cv_HAVE_CLOCK_GETTIME=cross)])
AM_CONDITIONAL(BUILD_TIMER_C, test x"$ac_cv_HAVE_CLOCK_GETTIME" = x"yes")
# extra warnings
EXTRA_WARNINGS=""
WARNLIST="
all
shadow
missing-prototypes
missing-declarations
strict-prototypes
declaration-after-statement
pointer-arith
write-strings
bad-function-cast
missing-format-attribute
format=2
format-security
format-nonliteral
no-long-long
unsigned-char
gnu89-inline
no-strict-aliasing
"
for j in $WARNLIST; do
if cc_supports_flag -W$j; then
EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j";
fi
done
if test "x${enable_coverage}" = xyes && \
cc_supports_flag -ftest-coverage && \
cc_supports_flag -fprofile-arcs ; then
AC_MSG_NOTICE([Enabling Coverage (enable -O0 by default)])
OPT_CFLAGS="-O0"
COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
PACKAGE_FEATURES="$PACKAGE_FEATURES coverage"
else
COVERAGE_CFLAGS=""
COVERAGE_LDFLAGS=""
fi
if test "x${enable_ansi}" = xyes && \
cc_supports_flag -std=iso9899:199409 ; then
AC_MSG_NOTICE([Enabling ANSI Compatibility])
ANSI_CPPFLAGS="-ansi -D_GNU_SOURCE -DANSI_ONLY"
PACKAGE_FEATURES="$PACKAGE_FEATURES ansi"
else
ANSI_CPPFLAGS=""
fi
if test "x${enable_fatal_warnings}" = xyes && \
cc_supports_flag -Werror ; then
AC_MSG_NOTICE([Enabling Fatal Warnings (-Werror)])
WERROR_CFLAGS="-Werror"
PACKAGE_FEATURES="$PACKAGE_FEATURES fatal-warnings"
else
WERROR_CFLAGS=""
fi
# don't add addtional cflags
if test "x${enable_user_flags}" = xyes; then
OPT_CFLAGS=""
GDB_FLAGS=""
EXTRA_WARNINGS=""
fi
# final build of *FLAGS
CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS $OS_CFLAGS \
$COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS $NSS_CFLAGS"
CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS $GLIB_CFLAGS $RESMON_CFLAGS $XML_CFLAGS"
LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS"
LIBS="$LIBS $XML_LIBS"
# substitute what we need:
AC_SUBST([INITDDIR])
AC_SUBST([LINT_FLAGS])
BOOTH_LIB_DIR=${localstatedir}/lib/booth
BOOTH_CORE_DIR=${localstatedir}/lib/booth/cores
BOOTHSYSCONFDIR=${sysconfdir}/booth
AC_SUBST([HAVE_LOG_CIB_DIFF])
AC_SUBST([HAVE_XML_LOG_PATCHSET])
AC_SUBST([BOOTH_LIB_DIR])
AC_SUBST([BOOTH_CORE_DIR])
AC_SUBST([BOOTHSYSCONFDIR])
AC_DEFINE_UNQUOTED([BOOTH_LIB_DIR], "$(eval echo ${BOOTH_LIB_DIR})", [booth lib directory])
AC_DEFINE_UNQUOTED([BOOTH_CORE_DIR], "$(eval echo ${BOOTH_CORE_DIR})", [booth working directory])
AC_DEFINE_UNQUOTED([BOOTHSYSCONFDIR], "$(eval echo ${BOOTHSYSCONFDIR})", [booth config directory])
AC_DEFINE_UNQUOTED([PACKAGE_FEATURES], "${PACKAGE_FEATURES}", [booth built-in features])
AC_OUTPUT
AC_MSG_RESULT([])
AC_MSG_RESULT([$PACKAGE configuration:])
AC_MSG_RESULT([ Version = ${VERSION}])
AC_MSG_RESULT([ Prefix = ${prefix}])
AC_MSG_RESULT([ Executables = ${sbindir}])
AC_MSG_RESULT([ Man pages = ${mandir}])
AC_MSG_RESULT([ Doc dir = ${docdir}])
AC_MSG_RESULT([ Libraries = ${libdir}])
AC_MSG_RESULT([ Header files = ${includedir}])
AC_MSG_RESULT([ Arch-independent files = ${datadir}])
AC_MSG_RESULT([ State information = ${localstatedir}])
AC_MSG_RESULT([ System configuration = ${sysconfdir}])
AC_MSG_RESULT([ System init.d directory = ${INITDDIR}])
AC_MSG_RESULT([ booth config dir = ${BOOTHSYSCONFDIR}])
AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}])
AC_MSG_RESULT([ Logging provider = ${logging_provider}])
AC_MSG_RESULT([ Range2random provider = ${range2random_provider}])
AC_MSG_RESULT([ Nametag provider = ${nametag_provider}])
AC_MSG_RESULT([ Coredump nursing = ${coredump_nursing}])
AC_MSG_RESULT([ Working directory = ${BOOTH_CORE_DIR}])
AC_MSG_RESULT([ HA group name = ${CRM_DAEMON_GROUP}])
AC_MSG_RESULT([ HA user name = ${CRM_DAEMON_USER}])
AC_MSG_RESULT([])
AC_MSG_RESULT([$PACKAGE build info:])
AC_MSG_RESULT([ Default optimization = ${OPT_CFLAGS}])
AC_MSG_RESULT([ Default debug options = ${GDB_CFLAGS}])
AC_MSG_RESULT([ Extra compiler warnings = ${EXTRA_WARNING}])
AC_MSG_RESULT([ Env. defined CFLAG = ${ENV_CFLAGS}])
AC_MSG_RESULT([ Env. defined CPPFLAGS = ${ENV_CPPFLAGS}])
AC_MSG_RESULT([ Env. defined LDFLAGS = ${ENV_LDFLAGS}])
AC_MSG_RESULT([ ANSI defined CPPFLAGS = ${ANSI_CPPFLAGS}])
AC_MSG_RESULT([ Coverage CFLAGS = ${COVERAGE_CFLAGS}])
AC_MSG_RESULT([ Coverage LDFLAGS = ${COVERAGE_LDFLAGS}])
AC_MSG_RESULT([ Fatal War. CFLAGS = ${WERROR_CFLAGS}])
AC_MSG_RESULT([ Final CFLAGS = ${CFLAGS}])
AC_MSG_RESULT([ Final CPPFLAGS = ${CPPFLAGS}])
AC_MSG_RESULT([ Final LDFLAGS = ${LDFLAGS}])
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 11af73c..874a0e2 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -1,58 +1,62 @@
#
# docs: booth manual pages
#
# Copyright (C) 2014 Dejan Muhamedagic
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = boothd.8.txt booth-keygen.8.txt fsm-full.dot fsm-netfail.dot fsm-normal.dot geostore.8.txt
asciiman = boothd.8.txt booth-keygen.8.txt geostore.8.txt
doc_DATA = $(generated_docs)
generated_docs =
generated_mans =
HTML_GENERATOR =
MANPAGE_GENERATOR =
if BUILD_ASCIIDOC_HTML_MAN
generated_docs += $(ascii:%.txt=%.html) $(asciiman:%.txt=%.html)
endif
if BUILD_ASCIIDOC
generated_mans += $(asciiman:%.8.txt=%.8)
$(generated_mans): $(asciiman)
man8_MANS = $(generated_mans)
endif
if IS_ASCIIDOC
-HTML_GENERATOR += $(ASCIIDOC) --unsafe --backend=xhtml11 --destination-dir=$(abs_builddir)/
+HTML_GENERATOR += $(ASCIIDOC) --unsafe --backend=xhtml11
else
HTML_GENERATOR += $(ASCIIDOCTOR) -b xhtml5 --destination-dir=$(abs_builddir)/
endif
if IS_A2X
MANPAGE_GENERATOR += $(A2X) -f manpage --destination-dir=$(abs_builddir)/
else
MANPAGE_GENERATOR += $(ASCIIDOCTOR) -b manpage --destination-dir=$(abs_builddir)/
endif
%.html: %.txt
+if IS_ASCIIDOC
+ $(HTML_GENERATOR) -o $(abs_builddir)/$@ $<
+else
$(HTML_GENERATOR) $<
+endif
%.8: %.8.txt
$(MANPAGE_GENERATOR) $<
clean-local:
-rm -rf $(generated_docs) $(generated_mans)