diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile b/Makefile deleted file mode 100644 index 0176557..0000000 --- a/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -INIT_DIR=/etc/init.d -RSC_DIR=/usr/lib/ocf/resource.d/pacemaker -CONF_DIR=/etc/booth -BOOTH_SITE=./script/ocf/booth-site -BOOTH_ARBITRATOR=./script/lsb/booth-arbitrator -BOOTH_CONF=./conf/booth.conf.example - -INSTALL=$(shell which install) - -all: - ${MAKE} -C ./src - -install: - ${MAKE} -C ./src install - mkdir -p $(DESTDIR)/$(RSC_DIR) - mkdir -p $(DESTDIR)/$(INIT_DIR) - mkdir -p $(DESTDIR)/$(CONF_DIR) - $(INSTALL) -c -m 755 $(BOOTH_SITE) $(DESTDIR)/$(RSC_DIR) - $(INSTALL) -c -m 755 $(BOOTH_ARBITRATOR) $(DESTDIR)/$(INIT_DIR) - $(INSTALL) -c -m 755 $(BOOTH_CONF) $(DESTDIR)/$(CONF_DIR) - -clean: - ${MAKE} -C ./src clean diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..cb55fac --- /dev/null +++ b/Makefile.am @@ -0,0 +1,134 @@ +# Copyright (c) 2009 Red Hat, Inc. +# +# Authors: Andrew Beekhof +# Steven Dake (sdake@redhat.com) +# +# This software licensed under BSD license, the text of which follows: +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# - Neither the name of the MontaVista Software, Inc. nor the names of its +# contributors may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +SPEC = $(PACKAGE_NAME).spec + +TARFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz + +EXTRA_DIST = autogen.sh conf/booth.conf.example + +AUTOMAKE_OPTIONS = foreign + +MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \ + config.guess config.sub missing install-sh \ + autoheader automake autoconf test_lense.sh + +dist_doc_DATA = README COPYING + +boothconfdir = ${BOOTHCONFDIR} + +boothconf_DATA = conf/booth.conf.example + +SUBDIRS = src + +coverity: + cov-build --dir=cov make + cov-analyze --dir cov --concurrency --wait-for-license + cov-format-errors --dir cov + +install-exec-local: + $(INSTALL) -d $(DESTDIR)/${BOOTHCONFDIR}/service.d + $(INSTALL) -d $(DESTDIR)/${BOOTHCONFDIR}/uidgid.d + $(INSTALL) -d $(DESTDIR)/${localstatedir}/lib/corosync + $(INSTALL) -d $(DESTDIR)/${localstatedir}/log/cluster + $(INSTALL) -d $(DESTDIR)/${SOCKETDIR} + +uninstall-local: + rmdir $(DESTDIR)/${BOOTHCONFDIR}/service.d || :; + rmdir $(DESTDIR)/${BOOTHCONFDIR}/uidgid.d || :; + rmdir $(DESTDIR)/${localstatedir}/lib/corosync || :; + rmdir $(DESTDIR)/${localstatedir}/log/cluster || :; + rmdir $(DESTDIR)/${SOCKETDIR} || :; + +lint: + for dir in src; do make -C $$dir lint; done + +dist-clean-local: + rm -f autoconf automake autoheader + +## make rpm/srpm section. + +$(SPEC): $(SPEC).in + rm -f $@-t $@ + date="$(shell LC_ALL=C date "+%a %b %d %Y")" && \ + if [ -f .tarball-version ]; then \ + gitver="$(shell cat .tarball-version)" && \ + rpmver=$$gitver && \ + alphatag="" && \ + dirty="" && \ + numcomm="0"; \ + else \ + gitver="$(shell git describe --abbrev=4 --match='v*' HEAD 2>/dev/null)" && \ + rpmver=`echo $$gitver | sed -e "s/^v//" -e "s/-.*//g"` && \ + alphatag=`echo $$gitver | sed -e "s/.*-//" -e "s/^g//"` && \ + vtag=`echo $$gitver | sed -e "s/-.*//g"` && \ + numcomm=`git rev-list $$vtag..HEAD | wc -l` && \ + git update-index --refresh > /dev/null 2>&1 || true && \ + dirty=`git diff-index --name-only HEAD 2>/dev/null`; \ + fi && \ + if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \ + if [ "$$numcomm" = "0" ]; then \ + sed \ + -e "s#@version@#$$rpmver#g" \ + -e "s#%glo.*alpha.*##g" \ + -e "s#%glo.*numcomm.*##g" \ + -e "s#@dirty@#$$dirty#g" \ + -e "s#@date@#$$date#g" \ + $< > $@-t; \ + else \ + sed \ + -e "s#@version@#$$rpmver#g" \ + -e "s#@alphatag@#$$alphatag#g" \ + -e "s#@numcomm@#$$numcomm#g" \ + -e "s#@dirty@#$$dirty#g" \ + -e "s#@date@#$$date#g" \ + $< > $@-t; \ + fi; \ + if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi + chmod a-w $@-t + mv $@-t $@ + +$(TARFILE): + $(MAKE) dist + +RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \ + --define "_specdir $(abs_builddir)" \ + --define "_builddir $(abs_builddir)" \ + --define "_srcrpmdir $(abs_builddir)" \ + --define "_rpmdir $(abs_builddir)" + +srpm: clean + $(MAKE) $(SPEC) $(TARFILE) + rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC) + +rpm: clean + $(MAKE) $(SPEC) $(TARFILE) + rpmbuild $(RPMBUILDOPTS) -ba $(SPEC) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..83770a1 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +echo Building configuration system... +autoreconf -i && echo Now run ./configure and make diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..037f0a9 --- /dev/null +++ b/configure.ac @@ -0,0 +1,420 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +# bootstrap / init +AC_PREREQ([2.61]) + +AC_INIT([booth], 0.1.0, [notsure@notsure.org]) + +AM_INIT_AUTOMAKE([-Wno-portability]) + +AC_CONFIG_SRCDIR([src/main.c]) +AC_CONFIG_HEADER([src/b_config.h src/booth_config.h]) + +AC_CANONICAL_HOST + +AC_LANG([C]) + +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 "$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 + +# Checks for libraries. +AC_CHECK_LIB([dl], [dlopen]) +AC_CHECK_LIB([pthread], [pthread_create]) +AC_CHECK_LIB([socket], [socket]) +AC_CHECK_LIB([nsl], [t_open]) +AC_CHECK_LIB([rt], [sched_getscheduler]) + +# 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]) + +# 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 pthread_setschedparam \ + sched_get_priority_max sched_setscheduler]) + +AC_CONFIG_FILES([Makefile + src/Makefile]) + +# =============================================== +# Helpers +# =============================================== + +## helper for CC stuff +cc_supports_flag() { + local CPPFLAGS="$CPPFLAGS $@" + AC_MSG_CHECKING([whether $CC supports "$@"]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], + [RC=0; AC_MSG_RESULT([yes])], + [RC=1; AC_MSG_RESULT([no])]) + return $RC +} + +## 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_ENABLE([small-memory-footprint], + [ --enable-small-memory-footprint : Use small message queues and small messages sizes. ], + [ default="no" ]) + +AC_ARG_WITH([initddir], + [ --with-initddir=DIR : path to init script directory. ], + [ INITDDIR="$withval" ], + [ INITDDIR="$sysconfdir/init.d" ]) + +# OS detection +# THIS SECTION MUST DIE! +CP=cp +OS_LDL="-ldl" +have_linux="no" +case "$host_os" in + *linux*) + AC_DEFINE_UNQUOTED([BOOTH_LINUX], [1], + [Compiling for Linux platform]) + OS_CFLAGS="" + OS_CPPFLAGS="-D_GNU_SOURCE" + OS_LDFLAGS="" + OS_DYFLAGS="-rdynamic" + DARWIN_OPTS="" + have_linux="yes" + ;; + darwin*) + AC_DEFINE_UNQUOTED([BOOTH_DARWIN], [1], + [Compiling for Darwin platform]) + CP=rsync + OS_CFLAGS="" + OS_CPPFLAGS="" + OS_LDFLAGS="" + OS_DYFLAGS="" + DARWIN_OPTS="-dynamiclib -bind_at_load \ + -current_version ${SONAME} \ + -compatibility_version ${SONAME} -install_name \$(libdir)/\$(@)" + AC_DEFINE_UNQUOTED([MAP_ANONYMOUS], [MAP_ANON], + [Shared memory define for Darwin platform]) + AC_DEFINE_UNQUOTED([PATH_MAX], [4096], + [Number of chars in a path name including nul]) + AC_DEFINE_UNQUOTED([NAME_MAX], [255], + [Number of chars in a file name]) + ;; + *bsd*) + AC_DEFINE_UNQUOTED([BOOTH_BSD], [1], + [Compiling for BSD platform]) + AC_DEFINE_UNQUOTED([MAP_ANONYMOUS], [MAP_ANON], + [Shared memory define for Darwin platform]) + OS_CFLAGS="" + OS_CPPFLAGS="-I/usr/local/include" + OS_LDFLAGS="-L/usr/local/lib" + OS_DYFLAGS="-export-dynamic" + DARWIN_OPTS="" + OS_LDL="" + case "$host_os" in + *freebsd[[234567]]*) + ;; + *freebsd*) + AC_DEFINE_UNQUOTED([BOOTH_FREEBSD_GE_8], [1], + [Compiling for FreeBSD >= 8 platform]) + ;; + esac + ;; + *solaris*) + AC_DEFINE_UNQUOTED([BOOTH_SOLARIS], [1], + [Compiling for Solaris platform]) + AC_DEFINE_UNQUOTED([TS_CLASS], [1], + [Prevent being scheduled RR]) + AC_DEFINE_UNQUOTED([_SEM_SEMUN_UNDEFINED], [1], + [The semun structure is undefined]) + CP=rsync + OS_CFLAGS="" + OS_CPPFLAGS="-D_REENTRANT" + OS_LDFLAGS="" + OS_DYFLAGS="-Wl,-z,lazyload" + DARWIN_OPTS="" + SOLARIS_OPTS=" " + ;; + *) + AC_MSG_ERROR([Unsupported OS? hmmmm]) + ;; +esac + +AC_SUBST(CP) +# *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" + 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 + +# extra warnings +EXTRA_WARNINGS="" + +WARNLIST=" + all + shadow + missing-prototypes + missing-declarations + strict-prototypes + declaration-after-statement + pointer-arith + write-strings + cast-align + 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" + COVERAGE_LCRSO_EXTRA_LDFLAGS="-rdynamic" + PACKAGE_FEATURES="$PACKAGE_FEATURES coverage" +else + COVERAGE_CFLAGS="" + COVERAGE_LDFLAGS="" + COVERAGE_LCRSO_EXTRA_LDFLAGS="" +fi + + +if test "x${enable_small_memory_footprint}" = xyes ; then + AC_DEFINE_UNQUOTED([HAVE_SMALL_MEMORY_FOOTPRINT], 1, [have small_memory_footprint]) + PACKAGE_FEATURES="$PACKAGE_FEATURES small-memory-footprint" +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" +LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS" + +# substitute what we need: +AC_SUBST([INITDDIR]) + +AC_SUBST([COVERAGE_LCRSO_EXTRA_LDFLAGS]) +AC_SUBST([OS_DYFLAGS]) + +AC_SUBST([OS_LDL]) + +AM_CONDITIONAL(BUILD_DARWIN, test -n "${DARWIN_OPTS}") +AM_CONDITIONAL(BUILD_SOLARIS, test -n "${SOLARIS_OPTS}") +AC_SUBST([DARWIN_OPTS]) +AC_SUBST([SOLARIS_OPTS]) + +AM_CONDITIONAL(BUILD_HTML_DOCS, test -n "${GROFF}") + +AC_SUBST([LINT_FLAGS]) + +AC_DEFINE_UNQUOTED([LCRSODIR], "$(eval echo ${LCRSODIR})", [LCRSO directory]) +AC_DEFINE_UNQUOTED([SOCKETDIR], "$(eval echo ${SOCKETDIR})", [Socket directory]) +AC_DEFINE_UNQUOTED([LOCALSTATEDIR], "$(eval echo ${localstatedir})", [localstate directory]) + +BOOTHSYSCONFDIR=${sysconfdir}/booth +AC_SUBST([BOOTHSYSCONFDIR]) +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([ SOCKETDIR = ${SOCKETDIR}]) +AC_MSG_RESULT([ Features =${PACKAGE_FEATURES}]) +AC_MSG_RESULT([]) +AC_MSG_RESULT([$PACKAGE build info:]) +AC_MSG_RESULT([ Library SONAME = ${SONAME}]) +LIB_MSG_RESULT(m4_shift(local_soname_list))dnl +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([ OS defined CFLAGS = ${OS_CFLAGS}]) +AC_MSG_RESULT([ OS defined CPPFLAGS = ${OS_CPPFLAGS}]) +AC_MSG_RESULT([ OS defined LDFLAGS = ${OS_LDFLAGS}]) +AC_MSG_RESULT([ OS defined LDL = ${OS_LDL}]) +AC_MSG_RESULT([ OS defined DYFLAGS = ${OS_DYFLAGS}]) +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/src/Makefile b/src/Makefile index 4348c7d..2b44548 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,54 +1,529 @@ -BIN_TARGET = booth - -HEADER_TARGET = booth.h config.h list.h log.h pacemaker.h paxos.h paxos_lease.h ticket.h timer.h transport.h - -BIN_SOURCE = config.c log.c main.c pacemaker.c paxos.c paxos_lease.c ticket.c timer.c transport.c - -CFLAGS += -D_GNU_SOURCE -g \ - -Wall \ - -Wformat \ - -Wformat-security \ - -Wmissing-prototypes \ - -Wnested-externs \ - -Wpointer-arith \ - -Wextra -Wshadow \ - -Wcast-align \ - -Wwrite-strings \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Winline \ - -Wredundant-decls \ - -Wno-sign-compare \ - -Wp,-D_FORTIFY_SOURCE=2 \ - -fexceptions \ - -fasynchronous-unwind-tables \ - -fdiagnostics-show-option - -BIN_LDFLAGS = -lpthread - -$(BIN_TARGET): $(BIN_SOURCE) - $(CC) $(CFLAGS) $(BIN_LDFLAGS) $(BIN_SOURCE) -o $@ - -clean: - rm -f $(BIN_TARGET) - rm -f cscope.* - -INSTALL=$(shell which install) - -BIN_DIR=/usr/sbin -HEADER_DIR=/usr/include - -.PHONY: install -install: $(BIN_TARGET) - mkdir -p $(DESTDIR)/$(BIN_DIR) - mkdir -p $(DESTDIR)/$(HEADER_DIR) - $(INSTALL) -c -m 755 $(BIN_TARGET) $(DESTDIR)/$(BIN_DIR) - $(INSTALL) -c -m 644 $(HEADER_TARGET) $(DESTDIR)/$(HEADER_DIR) - -.PHONY: cscope -cscope: - rm -f cscope.* - echo "-k" >> cscope.files - find . -name '*.[ch]' >> cscope.files - cscope -b +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# src/Makefile. Generated from Makefile.in by configure. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +pkgdatadir = $(datadir)/booth +pkgincludedir = $(includedir)/booth +pkglibdir = $(libdir)/booth +pkglibexecdir = $(libexecdir)/booth +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +sbin_PROGRAMS = boothd$(EXEEXT) +subdir = src +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/b_config.h.in \ + $(srcdir)/booth_config.h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = b_config.h booth_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(sbindir)" +PROGRAMS = $(sbin_PROGRAMS) +am_boothd_OBJECTS = config.$(OBJEXT) main.$(OBJEXT) paxos.$(OBJEXT) \ + ticket.$(OBJEXT) transport.$(OBJEXT) log.$(OBJEXT) \ + pacemaker.$(OBJEXT) paxos_lease.$(OBJEXT) timer.$(OBJEXT) +boothd_OBJECTS = $(am_boothd_OBJECTS) +boothd_DEPENDENCIES = +boothd_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(boothd_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(boothd_SOURCES) +DIST_SOURCES = $(boothd_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/sdake/repos/booth/missing --run aclocal-1.11 +ALLOCA = +AMTAR = ${SHELL} /home/sdake/repos/booth/missing --run tar +AUTOCONF = ${SHELL} /home/sdake/repos/booth/missing --run autoconf +AUTOHEADER = ${SHELL} /home/sdake/repos/booth/missing --run autoheader +AUTOMAKE = ${SHELL} /home/sdake/repos/booth/missing --run automake-1.11 +AWK = gawk +BOOTHSYSCONFDIR = /etc/booth +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 -O3 -ggdb3 -Wall -Wshadow -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-arith -Wwrite-strings -Wcast-align -Wbad-function-cast -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing +COVERAGE_LCRSO_EXTRA_LDFLAGS = +CP = cp +CPP = gcc -E +CPPFLAGS = -D_GNU_SOURCE +CYGPATH_W = echo +DARWIN_OPTS = +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +GREP = /bin/grep +INITDDIR = /etc/init.d +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = -lrt -lpthread -ldl +LINT_FLAGS = -weak -unrecog +posixlib +ignoresigns -fcnuse -badflag -D__gnuc_va_list=va_list -D__attribute\(x\)= +LN_S = ln -s +LTLIBOBJS = +MAKEINFO = ${SHELL} /home/sdake/repos/booth/missing --run makeinfo +MKDIR_P = /bin/mkdir -p +OBJEXT = o +OS_DYFLAGS = -rdynamic +OS_LDL = -ldl +PACKAGE = booth +PACKAGE_BUGREPORT = notsure@notsure.org +PACKAGE_NAME = booth +PACKAGE_STRING = booth 0.1.0 +PACKAGE_TARNAME = booth +PACKAGE_URL = +PACKAGE_VERSION = 0.1.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/sh +SOLARIS_OPTS = +STRIP = +VERSION = 0.1.0 +abs_builddir = /home/sdake/repos/booth/src +abs_srcdir = /home/sdake/repos/booth/src +abs_top_builddir = /home/sdake/repos/booth +abs_top_srcdir = /home/sdake/repos/booth +ac_ct_CC = gcc +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = /usr +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/sdake/repos/booth/install-sh +libdir = /usr/lib64 +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = /var +mandir = ${datarootdir}/man +mkdir_p = /bin/mkdir -p +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = /etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +MAINTAINERCLEANFILES = Makefile.in +AM_CFLAGS = -fPIC +INCLUDES = -I$(top_builddir)/include +boothd_SOURCES = config.c main.c paxos.c ticket.c transport.c \ + log.c pacemaker.c paxos_lease.c timer.c + +boothd_LDADD = -lpthread +boothd_LDFLAGS = $(OS_DYFLAGS) -L./ +noinst_HEADERS = booth.h list.h pacemaker.h paxos_lease.h timer.h \ + config.h log.h paxos.h ticket.h transport.h + +all: b_config.h booth_config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +b_config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/b_config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/b_config.h +$(srcdir)/b_config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +booth_config.h: stamp-h2 + @if test ! -f $@; then \ + rm -f stamp-h2; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h2; \ + else :; fi + +stamp-h2: $(srcdir)/booth_config.h.in $(top_builddir)/config.status + @rm -f stamp-h2 + cd $(top_builddir) && $(SHELL) ./config.status src/booth_config.h + +distclean-hdr: + -rm -f b_config.h stamp-h1 booth_config.h stamp-h2 +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(sbindir)" && rm -f $$files + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) +boothd$(EXEEXT): $(boothd_OBJECTS) $(boothd_DEPENDENCIES) + @rm -f boothd$(EXEEXT) + $(boothd_LINK) $(boothd_OBJECTS) $(boothd_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/config.Po +include ./$(DEPDIR)/log.Po +include ./$(DEPDIR)/main.Po +include ./$(DEPDIR)/pacemaker.Po +include ./$(DEPDIR)/paxos.Po +include ./$(DEPDIR)/paxos_lease.Po +include ./$(DEPDIR)/ticket.Po +include ./$(DEPDIR)/timer.Po +include ./$(DEPDIR)/transport.Po + +.c.o: + $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) b_config.h.in booth_config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) b_config.h.in booth_config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) b_config.h.in booth_config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) b_config.h.in booth_config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) b_config.h booth_config.h +installdirs: + for dir in "$(DESTDIR)$(sbindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-sbinPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-sbinPROGRAMS + +.MAKE: all install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-sbinPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-hdr distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-sbinPROGRAMS + + +lint: + -splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..4a4f32d --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,19 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CFLAGS = -fPIC + +INCLUDES = -I$(top_builddir)/include + +sbin_PROGRAMS = boothd + +boothd_SOURCES = config.c main.c paxos.c ticket.c transport.c \ + log.c pacemaker.c paxos_lease.c timer.c + +boothd_LDADD = -lpthread +boothd_LDFLAGS = $(OS_DYFLAGS) -L./ + +noinst_HEADERS = booth.h list.h pacemaker.h paxos_lease.h timer.h \ + config.h log.h paxos.h ticket.h transport.h + +lint: + -splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c diff --git a/src/booth_config.h.in b/src/booth_config.h.in new file mode 100644 index 0000000..e69de29