diff --git a/configure.in b/configure.in index 7f9c60a96..cda40d0cb 100644 --- a/configure.in +++ b/configure.in @@ -1,2961 +1,2973 @@ dnl dnl autoconf for heartbeat dnl Started by David Lee December 2000 dnl automake stuff dnl added by Michael Moerz February 2001 dnl dnl License: GNU General Public License (GPL) dnl Initialiase, with sanity check of a unique file in the hierarchy AC_INIT(heartbeat.spec.in) AC_PREREQ(2.53) AC_CONFIG_AUX_DIR(.) AC_REVISION($Revision: 1.552 $) dnl cvs revision AC_CANONICAL_HOST dnl Where #defines go (e.g. `AC_CHECK_HEADERS' below) dnl dnl Internal header: include/config.h dnl - Contains ALL defines dnl - include/config.h.in is generated automatically by autoheader dnl - NOT to be included in any header files except lha_internal.h dnl (which is also not to be included in any other header files) dnl dnl External header: include/hb_config.h dnl - Contains a subset of defines checked here dnl - Manually edit include/hb_config.h.in to have configure include dnl new defines dnl - Should not include HAVE_* defines dnl - Safe to include anywhere AM_CONFIG_HEADER(include/config.h include/hb_config.h) ALL_LINGUAS="en fr" AC_ARG_WITH(hapkgversion, [ --with-hapkgversion=name Override package version (if you're a packager needing to pretend) ], [ HAPKGVERSION="$withval" ], [ HAPKGVERSION="" ], ) if test -z "$HAPKGVERSION" ; then HAPKGVERSION="2.1.2" fi AM_INIT_AUTOMAKE(heartbeat, $HAPKGVERSION) RPMREL=1 AC_SUBST(RPMREL) HB_PKG=heartbeat AC_SUBST(HB_PKG) DISTDIR=$HB_PKG-$VERSION TARFILE=$DISTDIR.tar.gz AC_SUBST(DISTDIR) AC_SUBST(TARFILE) CC_IN_CONFIGURE=yes export CC_IN_CONFIGURE INIT_EXT="" USE_MODULES=0 echo Our Host OS: $host_os/$host dnl This OS-based decision-making is poor autotools practice; dnl feature-based mechanisms are strongly preferred. dnl dnl So keep this section to a bare minimum; regard as a "necessary evil". pf_argv_set="" case "$host_os" in *bsd*) LIBS="-L/usr/local/lib" CPPFLAGS="$CPPFLAGS -I/usr/local/include" INIT_EXT=".sh" REBOOT_OPTIONS="-f" POWEROFF_OPTIONS="-f" ;; *solaris*) pf_argv_set="PF_ARGV_NONE" REBOOT_OPTIONS="-n" POWEROFF_OPTIONS="-n" ;; *linux*) USE_MODULES=1 REBOOT_OPTIONS="-nf" POWEROFF_OPTIONS="-nf" ;; dnl anything? darwin*) AC_DEFINE_UNQUOTED(ON_DARWIN, 1, Compiling for Darwin platform) LIBS="$LIBS -L${prefix}/lib" CFLAGS="$CFLAGS -I${prefix}/include" REBOOT_OPTIONS="-f" POWEROFF_OPTIONS="-f" ;; esac AC_SUBST(INIT_EXT) AC_SUBST(USE_MODULES) AC_SUBST(REBOOT_OPTIONS) AC_SUBST(POWEROFF_OPTIONS) AC_DEFINE_UNQUOTED(REBOOT_OPTIONS, "$REBOOT_OPTIONS", reboot options) AC_DEFINE_UNQUOTED(POWEROFF_OPTIONS, "$POWEROFF_OPTIONS", poweroff options) dnl Info for building/packaging systems. dnl dnl "pkg" (typically Solaris) generally suggests package names of the form: dnl COMPname dnl where: dnl COMP: (upper case) resembles a four character company "stock ticker"; dnl name: (lower case) is short-form (few character) product name. dnl dnl It is also conventional for the name to be closely related to the dnl installation location, typically "/opt/COMPname". dnl dnl See "linux-ha-dev" discussion, "heartbeat package name", from 12/Oct/2005. dnl "LXHAhb" seems the least evil compromise for a default. dnl Any site or packager may, of course, override this. dnl AC_ARG_WITH(pkgname, [ --with-pkgname=name name for pkg (typically for Solaris) ], [ PKGNAME="$withval" ], [ PKGNAME="LXHAhb" ], ) AC_SUBST(PKGNAME) MISSINGTHINGS="" MISSINGOPTIONALS="" FatalMissingThing() { if test X"$MISSINGTHINGS" = X; then MISSINGTHINGS="$MISSINGTHINGS $1" else MISSINGTHINGS="$MISSINGTHINGS, $1" fi shift AC_MSG_RESULT(configure: ERROR: $1 ====================) shift for j in "$@" do if test "X$j" != X-; then AC_MSG_RESULT(configure: $j ==) fi done } WarnMissingThing() { if test X"$MISSINGOPTIONALS" = X; then MISSINGOPTIONALS="$MISSINGOPTIONALS $1" else MISSINGOPTIONALS="$MISSINGOPTIONALS, $1" fi shift AC_MSG_RESULT(configure: WARNING: $1 ====================) shift for j in "$@" do if test "X$j" != X-; then AC_MSG_RESULT(configure: $j ==) fi done } CheckMissingThings() { if test "X$MISSINGOPTIONALS" != "X" then AC_MSG_WARN(The following recommended components noted earlier are missing: $MISSINGOPTIONALS We will continue but you may have lost some non-critical functionality.) fi if test "X$MISSINGTHINGS" != "X" then AC_MSG_ERROR(The following required components noted earlier are missing: $MISSINGTHINGS Please supply them and try again.) fi } dnl dnl dnl Don't ya just hate working around buggy code? dnl dnl At least code that doesn't do what you want... dnl dnl This is to make substitutions work right in RPM specfiles. dnl dnl Horms says "This is pretty ugly". dnl Alanr says: "It works. s/ ugly//" dnl dnl Patches are being accepted... dnl dnl Keep copy of original (default) prefix prefix_orig="$prefix" prefix=`eval echo "$prefix"` case $prefix in NONE) prefix=/usr/local;; esac var() { case $1 in *'${'*) res=`eval echo "$1"`;; *) res="$1";; esac case "$res" in ""|NONE) echo "$2";; *) echo "$res";; esac } dnl Keep copy of original (default) localstatedir localstatedir_orig="$localstatedir" exec_prefix=`var "$exec_prefix" "$prefix"` bindir=`var "$bindir" "$exec_prefix/bin"` sbindir=`var "$sbindir" "$exec_prefix/sbin"` datarootdir=`var "$datarootdir" "$prefix/share"` datadir=`var "$datadir" "$prefix/share"` sysconfdir=`var "$sysconfdir" "$prefix/etc"` sharedstatedir=`var "$sharedstatedir" "$prefix/com"` localstatedir=`var "$localstatedir" "$prefix/var"` includedir=`var "$includedir" "$exec_prefix/include"` oldincludedir=`var "$oldincludedir" "$exec_prefix/include"` infodir=`var "$infodir" "$prefix/info"` mandir=`var "$mandir" "$exec_prefix/man"` docdir=${datadir}/doc/${HB_PKG}-${VERSION} libdir=`var "$libdir" "$exec_prefix/lib"` libexecdir=`var "$libexecdir" "$exec_prefix/libexec"` noarchlibdir=`var "$noarchlibdir" "$prefix/lib"` for var in libdir libexecdir do dir=`eval echo '${'${var}'}'` case $dir in *64) if test ! -d "$dir" then newdir=`echo "$dir" | sed 's%64$%%'` if test -d "$newdir" then eval $var="$newdir" AC_MSG_WARN([$var value now set to $newdir since $dir doesn't exist]) fi fi;; esac done for j in exec_prefix bindir sbindir datadir sysconfdir localstatedir \ includedir oldincludedir mandir docdir libdir noarchlibdir do dirname=`eval echo '${'${j}'}'` if test ! -d "$dirname" then AC_MSG_WARN([$j directory ($dirname) does not exist!]) fi done dnl The GNU conventions for installation directories don't always dnl sit well with this software. In particular, GNU's stated: dnl dnl '$(localstatedir)' should normally be '/usr/local/var', ... dnl dnl is poor for us: much better would be somewhere under '/var'. dnl dnl Here within "configure" it would be poor practice for us to interfere dnl with such values, irrespective of our opinion: dnl 1. user perspective: we would have gone behind their back; dnl 2. autoconf perspective: autoconf should avoid any OS-specific mindset. dnl dnl So if localstatedir still has its default value, we issue an advisory dnl warning and inform folk of our own "ConfigureMe", which is ideally dnl suited for setting such aspects (by user, and per-OS). dnl dnl [ Another option would be to detect, and to warn of, (post-expansion) dnl non-"/var/[...]" values: something like: dnl if test `expr "$localstatedir" : '^/var/.*'` -ge '5' \ dnl -o `expr "$localstatedir" : '^/var.*'` -eq '4' dnl then else fi dnl ] # If original localstatedir had defaulted then sanity-check the result. if test "x$localstatedir_orig" = 'x${prefix}/var' && # Note quote types test "x$prefix_orig" = xNONE then SNOOZING=10 AC_MSG_WARN(value/default "--localstatedir=$localstatedir" is poor.) AC_MSG_WARN("/var/something" is strongly recommended.) AC_MSG_WARN(We also recommend using "ConfigureMe".) AC_MSG_WARN(Sleeping for $SNOOZING seconds.) sleep $SNOOZING fi AC_DEFINE_UNQUOTED(HA_SYSCONFDIR, "$sysconfdir", Location of system configuration files) HA_URLBASE="http://linux-ha.org/" AC_SUBST(HA_URLBASE) AC_DEFINE_UNQUOTED(HA_URLBASE, "$HA_URLBASE", Web site base URL) HA_LIBDIR="${libdir}" AC_SUBST(HA_LIBDIR) AC_DEFINE_UNQUOTED(HA_LIBDIR,"$HA_LIBDIR", lib directory) HA_DATADIR="${datadir}" AC_SUBST(HA_DATADIR) AC_DEFINE_UNQUOTED(HA_DATADIR,"$HA_DATADIR", data (arch-independent) directory) HA_NOARCHDATAHBDIR="$HA_DATADIR/${HB_PKG}" AC_SUBST(HA_NOARCHDATAHBDIR) AC_DEFINE_UNQUOTED(HA_NOARCHDATAHBDIR,"$HA_NOARCHDATAHBDIR", $HB_PKG noarch data directory) HA_LIBHBDIR="$HA_LIBDIR/${HB_PKG}" AC_SUBST(HA_LIBHBDIR) AC_DEFINE_UNQUOTED(HA_LIBHBDIR,"$HA_LIBHBDIR", $HB_PKG lib directory) HA_VARRUNDIR="${localstatedir}/run" AC_SUBST(HA_VARRUNDIR) AC_DEFINE_UNQUOTED(HA_VARRUNDIR,"$HA_VARRUNDIR", var run directory) HA_VARRUNHBDIR="$HA_VARRUNDIR/${HB_PKG}" AC_SUBST(HA_VARRUNHBDIR) AC_DEFINE_UNQUOTED(HA_VARRUNHBDIR,"$HA_VARRUNHBDIR", var run heartbeat directory) HA_VARRUNHBRSCDIR="$HA_VARRUNHBDIR/rsctmp" AC_SUBST(HA_VARRUNHBRSCDIR) AC_DEFINE_UNQUOTED(HA_VARRUNHBRSCDIR,"$HA_VARRUNHBRSCDIR", var run heartbeat rsctmp directory) dnl Test the default first (priority) and last (to make sure some value is set) AC_MSG_CHECKING(for the location of the lock directory) for HA_VARLOCKDIR in ${localstatedir}/lock ${localstatedir}/spool/lock ${localstatedir}/spool/locks ${localstatedir}/lock do if test -d "$HA_VARLOCKDIR" then AC_MSG_RESULT($HA_VARLOCKDIR) break fi done AC_SUBST(HA_VARLOCKDIR) AC_DEFINE_UNQUOTED(HA_VARLOCKDIR,"$HA_VARLOCKDIR", System lock directory) HA_VARLIBDIR="${localstatedir}/lib" AC_SUBST(HA_VARLIBDIR) AC_DEFINE_UNQUOTED(HA_VARLIBDIR,"$HA_VARLIBDIR", var lib directory) HA_VARLIBHBDIR="${HA_VARLIBDIR}/${HB_PKG}" AC_SUBST(HA_VARLIBHBDIR) AC_DEFINE_UNQUOTED(HA_VARLIBHBDIR,"$HA_VARLIBHBDIR", var lib heartbeat directory) HA_COREDIR="${HA_VARLIBHBDIR}/cores" AC_SUBST(HA_COREDIR) AC_DEFINE_UNQUOTED(HA_COREDIR,"$HA_COREDIR", top directory of area to drop core files in) HA_LOGDAEMON_IPC="${HA_VARLIBDIR}/log_daemon" AC_SUBST(HA_LOGDAEMON_IPC) AC_DEFINE_UNQUOTED(HA_LOGDAEMON_IPC, "$HA_LOGDAEMON_IPC", Logging Daemon IPC socket name) dnl This IS a default but we should make sure we can override it for any dnl odd OS requirements. HA_VARLOGDIR="/var/log" AC_SUBST(HA_VARLOGDIR) AC_DEFINE_UNQUOTED(HA_VARLOGDIR,"$HA_VARLOGDIR", var log directory) STONITHPKG=stonith AC_SUBST(STONITHPKG) PILSPKG=pils AC_SUBST(PILSPKG) pils_includedir="${includedir}/${PILSPKG}" pils_plugindir="${libdir}/${PILSPKG}/plugins" stonith_includedir="${includedir}/${STONITHPKG}" stonith_plugindir="${libdir}/${STONITHPKG}/plugins" stonith_ext_plugindir="${stonith_plugindir}/external" base_includedir="${includedir}" saf_includedir="${includedir}/saf" AC_SUBST(pils_includedir) AC_SUBST(pils_plugindir) AC_SUBST(stonith_includedir) AC_SUBST(stonith_plugindir) AC_SUBST(stonith_ext_plugindir) AC_DEFINE_UNQUOTED(STONITH_EXT_PLUGINDIR, "$stonith_ext_plugindir", directory for the external stonith plugins) AC_SUBST(base_includedir) AC_SUBST(saf_includedir) AC_SUBST(docdir) # # Other interesting variables: ${host_vendor} and ${host_os} # sample values: suse linux # dnl We use this in the RPM specfile... AC_SUBST(ac_configure_args) dnl ************************************************************************* PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin" export PATH dnl checks for programs dnl dnl Which C compiler? dnl Defaults to GNU C compiler if available. dnl Always tries to set the compiler to ANSI C via options (AM) dnl Can force other with environment variable "CC". AC_PROG_CC AC_PROG_CC_STDC AC_PROG_YACC AC_DECL_YYTEXT AM_PROG_LEX AM_PATH_PYTHON AC_LIBTOOL_DLOPEN dnl Enable dlopen support... AC_LIBLTDL_CONVENIENCE dnl make libltdl a convenience lib AC_PROG_LIBTOOL dnl Replacing AC_PROG_LIBTOOL with AC_CHECK_PROG because LIBTOOL dnl was NOT being expanded all the time thus causing things to fail. AC_CHECK_PROGS(LIBTOOL, glibtool libtool libtool15 libtool13) AC_MSG_CHECKING(for glibtool or libtool*) if test x"${LIBTOOL}" = x""; then FatalMissingThing "libtool" "You need libtool to build heartbeat." \ "You can get the source from ftp://www.gnu.org/pub/gnu/" \ "or you can locate it via http://www.gnu.org/software/libtool" else AC_MSG_RESULT($LIBTOOL has been found.) fi AC_CHECK_PROGS(MAKE, gmake make) AC_MSG_CHECKING(for gmake or make) if test x"${MAKE}" = x""; then FatalMissingThing "gmake" "You need gmake to build heartbeat." \ "You can get the source from ftp://www.gnu.org/pub/gnu/" \ "or you can locate it via http://www.gnu.org/software/make/" else AC_MSG_RESULT($MAKE has been found.) fi AC_SYS_LARGEFILE AC_PATH_PROGS(HTML2TXT, lynx w3m) case $HTML2TXT in */*) ;; *) HTML2TXT="";; esac AC_PATH_PROGS(POD2MAN, pod2man, pod2man) AC_PATH_PROGS(ROUTE, route) AC_PATH_PROGS(RPM, rpmbuild) if test x"${RPM}" = x""; then AC_PATH_PROGS(RPM, rpm) fi AC_DEFINE_UNQUOTED(ROUTE, "$ROUTE", path to route command) AC_PATH_PROGS(NETSTAT, netstat, /sbin/netstat) AC_DEFINE_UNQUOTED(NETSTAT, "$NETSTAT", path to the netstat command) AC_PATH_PROGS(PING, ping, /bin/ping) AC_PATH_PROGS(IFCONFIG, ifconfig, /sbin/ifconfig) AC_PATH_PROGS(SSH, ssh, /usr/bin/ssh) AC_PATH_PROGS(SCP, scp, /usr/bin/scp) AC_PATH_PROGS(PYTHON, python) dnl - Determine which mail program exists. Mailx is Solaris AC_PATH_PROGS(MAILCMD, mail, mailx) AC_SUBST(MAILCMD) AC_DEFINE_UNQUOTED(IFCONFIG, "$IFCONFIG", path to the ifconfig command) AC_PATH_PROGS(LIBNETCONFIG, libnet-config) AC_PATH_PROGS(GETENT, getent) AC_PATH_PROGS(IP2UTIL, ip, /sbin/ip) AC_PATH_PROGS(XML2CONFIG, xml2-config) AC_PATH_PROGS(REBOOT, reboot, /sbin/reboot) AC_PATH_PROGS(POWEROFF_CMD, poweroff, /sbin/poweroff) AC_SUBST(REBOOT) AC_SUBST(POWEROFF_CMD) AC_DEFINE_UNQUOTED(REBOOT, "$REBOOT", path to the reboot command) AC_DEFINE_UNQUOTED(POWEROFF_CMD, "$POWEROFF_CMD", path to the poweroff command) dnl "whoami", if it exists, may be hidden away on some System-V (e.g. Solaris) AC_PATH_PROGS(WHOAMI, whoami, , ${PATH}:/usr/ucb) AC_PATH_PROGS(SWIG, swig) AC_SUBST(SWIG) AC_PATH_PROGS(EGREP, egrep) AC_SUBST(EGREP) AC_PATH_PROGS(MSGFMT, msgfmt, [msgfmt not found],) AC_SUBST(MSGFMT) AC_PATH_PROGS(HG, hg, /usr/local/hg) AC_SUBST(HG) AC_PATH_PROGS(GZIP_PROG, gzip) AC_PATH_PROGS(TAR, tar) AC_PATH_PROGS(MD5, md5) AC_SUBST(GZIP_PROG) AC_SUBST(TAR) AC_SUBST(MD5) dnl The "test" program can be different from the "sh" builtin. AC_PATH_PROGS(TEST, test) AC_PATH_PROGS(PKGCONFIG, pkg-config) dnl ************************************************************************ dnl Check whether non-root user can chown. dnl ************************************************************************ AC_PATH_PROGS(MKTEMP, mktemp) if test -n "$WHOAMI"; then IAM=`$WHOAMI` fi AC_MSG_CHECKING(if chown works for non-root) dnl Prefer "mktemp" command. But some OSes lack it; they can "touch". if test -n "$MKTEMP"; then F=`$MKTEMP "./.chown-testXXXXX"` else F="./.chown-test.$$" touch $F fi if case "$IAM" in root) chown nobody $F; su nobody -c "chown root $F";; *) chown root $F esac >/dev/null 2>&1 then nonroot_chown=yes AC_MSG_RESULT(yes) else nonroot_chown=no AC_MSG_RESULT(no) fi rm -f $F AM_CONDITIONAL(NONROOT_CHOWN, test "$nonroot_chown" = yes ) dnl ************************************************************************ dnl checks for libraries dnl Needed for libnet test. dnl ************************************************************************ AC_CHECK_LIB(nsl, t_open) dnl -lnsl AC_CHECK_LIB(socket, socket) dnl -lsocket AC_CHECK_LIB(posix4, sched_getscheduler) dnl -lposix4 AC_CHECK_LIB(c, dlopen) dnl if dlopen is in libc... AC_CHECK_LIB(dl, dlopen) dnl -ldl (for Linux) AC_CHECK_LIB(rt, sched_getscheduler) dnl -lrt (for Tru64) AC_CHECK_LIB(gnugetopt, getopt_long) dnl -lgnugetopt ( if available ) AC_CHECK_LIB(pam, pam_start) dnl -lpam (if available) # Not sure what OSes need this... Linux and AIX don't... # and AIX barfs on it... if test "$DLPREOPEN" = yes; then DLOPEN_FORCE_FLAGS="-dlpreopen force -dlopen-self" AC_DEFINE(DLPREOPEN, 1, [enable -dlpreopen flag]) else DLOPEN_FORCE_FLAGS="" fi AC_SUBST(DLOPEN_FORCE_FLAGS) dnl ************ uuid ********************** AC_ARG_WITH(uuid, [ --with-uuid=UUID mechanism for uuid {e2fsprogs|ossp|any|no} "e2fsprogs": e2fsprogs, typically Linux "ossp": not yet implemented "any": (default) any of the above, fallback to inbuilt "no": use inbuilt ], [ uuidimpl="$withval" ], [ uuidimpl="any" ], ) case $uuidimpl in e2fsprogs) AC_CHECK_LIB(uuid, uuid_parse,, AC_MSG_ERROR([e2fsprogs uuid library was explicitly requested but not found]) ) ;; ossp) AC_CHECK_LIB(uuid, uuid_create,, AC_MSG_ERROR([ossp uuid library was explicitly requested but not found]) ) ;; no) # Do not define anything; so use inbuilt (replace) implementation. ;; any) # Default: try to discover an implementation that we can use. AC_CHECK_LIB(uuid, uuid_parse) dnl e2fsprogs dnl AC_CHECK_LIB(uuid, uuid_create) dnl ossp ;; *) AC_MSG_ERROR([An invalid uuid library was explicitly requested]) ;; esac case "$host_os" in darwin*) dnl Recent Darwin versions do not need to link against a uuid library dnl Maybe this can be moved up into the previous block but it also might dnl break things (ie. the later check for uuid_parse) AC_CHECK_FUNCS(uuid_parse) esac AC_MSG_CHECKING(uuid implementation:) if test "$ac_cv_lib_uuid_uuid_parse" = yes; then AC_MSG_RESULT(e2fsprogs) elif test "$ac_cv_func_uuid_parse" = yes; then AC_MSG_RESULT(native) elif test "$ac_cv_lib_uuid_uuid_create" = yes; then AC_MSG_RESULT(ossp) AC_MSG_ERROR([heartbeat does not yet support ossp implementation of uuid]) else AC_MSG_RESULT(inbuilt) if test x"$uuidimpl" != x"no"; then WarnMissingThing "uuid library" \ "e2fsprogs uuid library is recommended" \ "On Linux this is the e2fsprogs-devel package" \ "See also http://sourceforge.net/projects/e2fsprogs/" fi fi dnl ************ uuid ********************** EXTRAGLIBMSG="-" if test "X${PKGCONFIG}" = "X"; then AC_MSG_RESULT(not found) FatalMissingThing "pkgconfig" "Package pkgconfig is required" \ "See http://pkgconfig.sourceforge.net/" EXTRALIBMSG="(this message might be bogus because pkgconfig is missing)" fi if test "x${enable_thread_safe}" = "xyes"; then GPKGNAME="gthread-2.0" else GPKGNAME="glib-2.0" fi if test "X${PKGCONFIG}" != "X" && $PKGCONFIG --exists $GPKGNAME; then GLIBCONFIG="$PKGCONFIG $GPKGNAME" else set -x echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH $PKGCONFIG --exists $GPKGNAME; echo $? $PKGCONFIG --cflags $GPKGNAME; echo $? $PKGCONFIG $GPKGNAME; echo $? set +x FatalMissingThing "glib2-devel" \ "Package glib2-devel is missing." \ "You can get the source from ftp://ftp.gtk.org/pub/gtk/" \ "or you can locate it via http://www.gtk.org/download/" "$EXTRALIBMSG" fi AC_MSG_RESULT(using $GLIBCONFIG) AC_MSG_CHECKING(which libnet version is installed) if test x"${LIBNETCONFIG}" = x""; then AC_MSG_RESULT(using old version of API) dnl The old version of the API REQUIRES $LIBNETCONFIG dnl so we can only deal with new API unless we have it. AC_CHECK_LIB(net, libnet_get_hwaddr, [], [FatalMissingThing "libnet" "You need libnet to continue." \ "You can get libnet from http://www.packetfactory.net/libnet" \ "Note that some RPMs split libnet up into libnet and libnet-devel." \ "In this case you have to install libnet-devel"]) LIBNETDEFINES="" LIBNETLIBS=" -lnet" if test "$ac_cv_lib_nsl_t_open" = yes; then LIBNETLIBS="-lnsl $LIBNETLIBS" fi if test "$ac_cv_lib_socket_socket" = yes; then LIBNETLIBS="-lsocket $LIBNETLIBS" fi libnet=net else LIBNETDEFINES="`$LIBNETCONFIG --defines` `$LIBNETCONFIG --cflags`"; LIBNETLIBS="`$LIBNETCONFIG --libs`"; AC_MSG_RESULT(using $LIBNETCONFIG) case $LIBNETLIBS in *-l*) libnet=`echo $LIBNETLIBS | sed 's%.*-l%%'`;; *) libnet=$LIBNETLIBS;; esac dnl Add any libnet definitions to the compiler flags. CPPFLAGS="$CPPFLAGS $LIBNETDEFINES" AC_CHECK_HEADERS(libnet.h) if test "$ac_cv_header_libnet_h" = no; then FatalMissingThing "libnet" "You need libnet (headers) to continue." \ "You can get libnet from http://www.packetfactory.net/libnet" \ "Note that some RPMs split libnet up into libnet and libnet-devel." \ "In this case you have to install libnet-devel" fi fi AC_SUBST(LIBNETDEFINES) AC_SUBST(LIBNETLIBS) AC_CHECK_LIB($libnet,libnet_init, [new_libnet=yes; AC_DEFINE(HAVE_LIBNET_1_1_API, 1, Libnet 1.1 API)], [new_libnet=no; AC_DEFINE(HAVE_LIBNET_1_0_API, 1, Libnet 1.0 API)],$LIBNETLIBS) AC_MSG_CHECKING(where is python installed) if test "x${PYTHON}" = x; then PYTHON="/usr/bin/env python"; fi AC_MSG_RESULT(using $PYTHON); AC_MSG_CHECKING(if netstat supports -f inet flag) $NETSTAT -rn -f inet > /dev/null 2>&1 if test x"$?" = x"0"; then AC_DEFINE(NETSTATPARM, "-rn -f inet ", parameters to netstat to retrieve route information) AC_MSG_RESULT(yes) else AC_DEFINE(NETSTATPARM, "-rn ", parameters to netstat to retrieve route information) AC_MSG_RESULT(no) fi if test X${PING} = X then FatalMissingThing "ping" "ping command is mandantory" fi dnl Determine if we use -w1 or -t1 for ping (in PYTHON Scripts) AC_MSG_CHECKING(ping option for timeout - w or t) for PING_TIMEOUT_OPT in "-w1" "-t1" do $PING -nq -c1 $PING_TIMEOUT_OPT localhost > /dev/null 2>&1 if test "$?" = 0 then AC_DEFINE_UNQUOTED(PING_TIMEOUT_OPT, "$PING_TIMEOUT_OPT", option for ping timeout) AC_MSG_RESULT($PING_TIMEOUT_OPT) break fi done AC_SUBST(PING_TIMEOUT_OPT) dnl Determining a route (particularly for "findif"). dnl There are various mechanisms on different systems. dnl Some mechanisms require root access to evaluate, but configure is often dnl (indeed, some say should be always) running non-root. dnl dnl Therefore much of the determination has to be run-time. dnl So the principle here, at configure time, is to explore what might be dnl available, and offer as much as possible to run-time. dnl AC_DEFINE(ROUTEPARM, "-n get", paramters for route to retrieve route information) AC_DEFINE(PROCROUTE, "/proc/net/route", path were to find route information in proc) AC_MSG_CHECKING(ifconfig option to list interfaces) for IFCONFIG_A_OPT in "" "-A" "-a" do $IFCONFIG $IFCONFIG_A_OPT > /dev/null 2>&1 if test "$?" = 0 then AC_DEFINE_UNQUOTED(IFCONFIG_A_OPT, "$IFCONFIG_A_OPT", option for ifconfig command) AC_MSG_RESULT($IFCONFIG_A_OPT) break fi done AC_SUBST(IFCONFIG_A_OPT) AC_SUBST(WHOAMI) AC_SUBST(HTML2TXT) AC_SUBST(POD2MAN) AC_SUBST(ROUTEPARM) AC_SUBST(PROCROUTE) dnl Locales check - is a real ugly workaround for now til I find dnl something more useful dnl dnl "Eric Z. Ayers" wrote: dnl > dnl > Here are some more data points: dnl > dnl > SUN: /usr/lib/locale/ dnl > HP : /usr/lib/nls/loc/ dnl > OSF: /usr/lib/nls/loc/ dnl > LINUX: /usr/share/locale/ dnl > UNIXWARE: /usr/lib/locale/ dnl > FREEBSD: /usr/share/locale dnl > VMS: just kidding dnl FindADir() { type="$1" whatfor="$2" shift; shift; AC_MSG_CHECKING(for $whatfor directory) for dir do if test -d "$dir" then AC_MSG_RESULT($dir) echo $dir return 0 fi done AC_MSG_RESULT(not found) return 1 } locale_locations="/usr/share/locale /usr/lib/locale /usr/lib/nls/loc" LOCALE=`FindADir error "locale" $locale_locations` if test "X$LOCALE" = X then FatalMissingThing "Locale directory" "Locale directory is mandantory." fi RPMDIR=`FindADir warn "RPM" /usr/src/packages /usr/src/redhat` if test x"${HAVE_LIBRT}" = x""; then LIBRT="" else LIBRT=-lrt fi AC_SUBST(LIBRT) # # Where is dlopen? # if test "$ac_cv_lib_c_dlopen" = yes; then LIBADD_DL="" elif test "$ac_cv_lib_dl_dlopen" = yes; then LIBADD_DL=-ldl else LIBADD_DL=${lt_cv_dlopen_libs} fi dnl dnl Check for location of gettext dnl dnl On at least Solaris 2.x, where it is in libc, specifying lintl causes dnl grief. Ensure minimal result, not the sum of all possibilities. dnl And do libc first. dnl Known examples: dnl c: Linux, Solaris 2.6+ dnl intl: BSD, AIX FunIsInLib() { fun=$1 lib=$2 lib_var1="ac_cv_lib_${lib}_$fun" lib_var2="ac_cv_lib_${lib}___$fun" for v in $lib_var1 $lib_var2 do var=`eval echo '${'${v}'}'` case $var in yes) return 0;; no) return 1;; esac done return 0 } for gt_test_lib in c intl do AC_CHECK_LIB($gt_test_lib, gettext) if FunIsInLib gettext $gt_test_lib; then break fi done # # Where is gettext()? # if FunIsInLib gettext c ; then LIBADD_INTL="" elif FunIsInLib gettext intl ; then LIBADD_INTL=-lintl elif test -f /usr/local/lib/libintl.so -a -s /usr/local/lib/libintl.so; then # This was added for FreeBSD LIBADD_INTL="-lintl" elif test -f /sw/lib/libintl.a -a -s /sw/lib/libintl.la -a -s /sw/lib/libintl.dylib; then # This was added for Darwin + Fink LIBADD_INTL="-lintl" else FatalMissingThing "gettext function" "no library providing gettext found" fi dnl dnl Glib allows its headers/libraries to be installed anywhere. dnl And they provide a command to let you know where they are. dnl This is nice, but having them in standard places is nice too ;-) dnl if test "X$GLIBCONFIG" != X; then AC_MSG_CHECKING(for special glib includes: ) GLIBHEAD=`$GLIBCONFIG --cflags` AC_MSG_RESULT($GLIBHEAD) CPPFLAGS="$CPPFLAGS $GLIBHEAD" AC_SUBST(GLIBHEAD) dnl Note: Not bundling "GLIBLIB" with general "LIBS". dnl 1. Only very few programs require GLIBLIB dnl (This isn't true anymore -- AlanR) dnl 2. Danger of creating run-time dependency on build-time LD_LIBRARY_PATH AC_MSG_CHECKING(for glib library flags) GLIBLIB=`$GLIBCONFIG --libs` AC_MSG_RESULT($GLIBLIB) AC_SUBST(GLIBLIB) fi dnl ************************************************************************ dnl checks for header files dnl dnl check for ANSI *.h files first dnl asm/page.h: Linux, for system PAGE_SIZE AC_HEADER_STDC AC_CHECK_HEADERS(db.h) AC_CHECK_HEADERS(asm/page.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(stdarg.h) AC_CHECK_HEADERS(tcpd.h) AC_CHECK_HEADERS(uuid.h) AC_CHECK_HEADERS(uuid/uuid.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(netinet/in.h) AC_CHECK_HEADERS([stdint.h unistd.h]) AC_CHECK_HEADERS(sys/termios.h) AC_CHECK_HEADERS(termios.h) dnl ************************************************************************ dnl FreeBSD requires sys/param.h and in.h to compile test netinet headers. dnl ************************************************************************ if test "$ac_cv_header_sys_param_h" -a "$ac_cv_header_netinet_in_h" = no; then AC_CHECK_HEADERS(netinet/in_systm.h) AC_CHECK_HEADERS(netinet/ip.h) AC_CHECK_HEADERS(netinet/ip_var.h) AC_CHECK_HEADERS(netinet/ip_compat.h) AC_CHECK_HEADERS(netinet/ip_fw.h) else AC_CHECK_HEADERS(netinet/in_systm.h,[],[],[#include #include ]) if test "$ac_cv_header_in_systm_h" = no; then AC_CHECK_HEADERS(netinet/ip.h,[],[],[#include #include ]) else AC_CHECK_HEADERS(netinet/ip.h,[],[],[#include #include #include ]) fi AC_CHECK_HEADERS(netinet/ip_var.h,[],[],[#include #include ]) AC_CHECK_HEADERS(netinet/ip_compat.h,[],[],[#include #include ]) AC_CHECK_HEADERS(netinet/ip_fw.h,[],[],[#include #include ]) fi AC_CHECK_HEADERS(sys/sockio.h) AC_CHECK_HEADERS(libintl.h) AC_CHECK_HEADERS(sys/types.h) AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(arpa/inet.h) AC_CHECK_HEADERS(net/ethernet.h) AC_CHECK_HEADERS(malloc.h) AC_CHECK_HEADERS(termio.h) AC_CHECK_HEADERS(getopt.h) AC_CHECK_HEADERS(sys/prctl.h) AC_CHECK_HEADERS(linux/watchdog.h,[],[],[#include ]) dnl Sockets are our preferred and supported comms mechanism. But the dnl implementation needs to be able to convey credentials: some don't. dnl So on a few OSes, credentials-carrying streams might be a better choice. dnl dnl Solaris releases up to and including "9" fall into this category dnl (its sockets don't carry credentials; streams do). dnl dnl At Solaris 10, "getpeerucred()" is available, for both sockets and dnl streams, so it should probably use (preferred) socket mechanism. AC_CHECK_HEADERS(stropts.h) dnl streams available (fallback option) AC_CHECK_HEADERS(ucred.h) dnl e.g. Solaris 10 decl. of "getpeerucred()" AC_CHECK_FUNCS(getpeerucred) dnl ************************************************************************ dnl checks for headers needed by clplumbing On BSD AC_CHECK_HEADERS(sys/syslimits.h) if test "$ac_cv_header_sys_param_h" = no; then AC_CHECK_HEADERS(sys/ucred.h) else AC_CHECK_HEADERS(sys/ucred.h,[],[],[#include ]) fi dnl ************************************************************************ dnl checks for headers needed by clplumbing On Solaris AC_CHECK_HEADERS(sys/cred.h xti.h) dnl ************************************************************************ dnl checks for headers needed by clplumbing On FreeBSD/Solaris AC_CHECK_HEADERS(sys/filio.h) dnl dnl These next two are used to help us figure out whether to include dnl some optional STONITH plugins... dnl AC_CHECK_HEADERS(vacmclient_api.h) AC_CHECK_HEADERS(curl/curl.h) AC_CHECK_HEADERS(openhpi/SaHpi.h) -AC_MSG_CHECKING(For libOpenIPMI version 2 or greater) -AC_TRY_COMPILE([#include ], -[ #if (OPENIPMI_VERSION_MAJOR < 2 ) - #error "Too Old" - #endif ], - AC_MSG_RESULT("yes") - AM_CONDITIONAL(USE_OPENIPMI, true), - AC_MSG_RESULT("no") - AM_CONDITIONAL(USE_OPENIPMI, false)) - AC_MSG_CHECKING(for special libxml2 includes) if test "x$XML2CONFIG" = "x"; then AC_MSG_RESULT(libxml2 config not found) else XML2HEAD=`$XML2CONFIG --cflags` AC_MSG_RESULT($XML2HEAD) AC_CHECK_LIB(xml2, xmlReadMemory) fi CPPFLAGS="$CPPFLAGS $XML2HEAD" dnl ************************************************************************ dnl * Check for linux/icmpv6.h to make enable the IPv6addr resource agent AC_CHECK_HEADERS(linux/icmpv6.h,[],[],[#include ]) AM_CONDITIONAL(USE_IPV6ADDR, test "$ac_cv_header_linux_icmpv6_h" = yes -a $new_libnet = yes ) AC_CHECK_HEADERS(libxml/xpath.h) dnl dnl Could check for the libraries, but if you have the headers, dnl you're a dolt for not having installed the libs ;-) dnl AM_CONDITIONAL(USE_VACM, test "$ac_cv_header_vacmclient_api_h" = yes) AM_CONDITIONAL(USE_DRAC3, test "$ac_cv_header_curl_curl_h" = yes -a "$ac_cv_header_libxml_xpath_h" = yes) AM_CONDITIONAL(USE_OPENHPI, test "$ac_cv_header_openhpi_SaHpi_h" = yes) dnl dnl SNMP checks dnl SNMPLIB="" SNMPAGENTLIB="" SNMPCONFIG="" ENABLE_SNMP="yes" if test "x${enable_snmp}" = "xno"; then ENABLE_SNMP="no" enable_snmp_subagent="no" fi AC_CHECK_HEADERS(ucd-snmp/snmp.h,[],[],[#include #include ]) AC_CHECK_HEADERS(net-snmp/net-snmp-config.h) if test "x${ENABLE_SNMP}" = "xno"; then # nothing : elif test "x${ac_cv_header_net_snmp_net_snmp_config_h}" = "xyes"; then AC_PATH_PROGS(SNMPCONFIG, net-snmp-config) if test "X${SNMPCONFIG}" = "X"; then AC_MSG_RESULT(You need the net_snmp development package to continue.) ENABLE_SNMP="no" else AC_MSG_CHECKING(for special snmp libraries) SNMPLIB=`net-snmp-config --libs` SNMPAGENTLIB=`net-snmp-config --agent-libs` # KLUDGE!! # Apparently some versions of SUSE Linux don't include -lwrap in $SNMPAGENTLIB case $SNMPAGENTLIB in *wrap*) ;; *) SNMPAGENTLIB="$SNMPAGENTLIB -lwrap";; esac AC_MSG_RESULT($SNMPLIB) fi elif test "x${ac_cv_header_ucd_snmp_snmp_h}" = "xyes"; then # UCD SNMP # ucd-snmp-config does not seem to exist, so just # rely on people having their LDFLAGS set to the path where AC_CHECK_LIB(snmp, init_snmp, SNMPLIB="-lsnmp") if test "X${SNMPLIB}" = "X"; then AC_CHECK_LIB(ucdsnmp, init_snmp, SNMPLIB="-lucdsnmp") fi SNMPAGENTLIB="$SNMPLIB" if test "X${SNMPLIB}" = "X"; then ENABLE_SNMP="no" AC_MSG_RESULT("Could not find ucdsnmp libary." "Please make sure that libsnmp or libucdsnmp" "are in your library path. Or the path to LDFLAGS") fi else ENABLE_SNMP="no" fi if test "$ENABLE_SNMP" = "no" -a "x${enable_snmp_subagent}" = "xyes"; then FatalMissingThing "SNMP Development package" "Missing SNMP development libraries and/or headers" "" "Install net-snmp-devel to enable SNMP features" fi if test "$ENABLE_SNMP" = "no" -o "x${enable_snmp_subagent}" != "xyes"; then enable_snmp_subagent="no" RPM_ENABLE_SNMP_SUBAGENT="0" else RPM_ENABLE_SNMP_SUBAGENT="1" fi check_snmp_libs () { OLDLIBS="$LIBS" LIBS="$LIBS $@" AC_MSG_CHECKING(snmp libraries: $LIBS) AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], , AC_MSG_ERROR(cannot link with requested libraries ($LIBS). Reported errors follow: $(cat conftest.err))) AC_MSG_RESULT(ok) LIBS="$OLDLIBS" } if test "$ENABLE_SNMP" = "yes"; then check_snmp_libs $SNMPLIB fi if test "$enable_snmp_subagent" = "yes"; then check_snmp_libs $SNMPAGENTLIB fi AC_ARG_WITH(mibsdir, [ --with-miBsdir=DIR directory for mib files. ], [ MIBS_DIR="$withval" ]) if test "x${enable_snmp_subagent}" = "xyes" -a "X${MIBS_DIR}" = "X"; then AC_MSG_CHECKING(which MIB directory to use) for mibs_dir in /usr/share/snmp/mibs \ /usr/local/share/snmp/mibs; do if test -d "$mibs_dir"; then MIBS_DIR="$mibs_dir" fi done if test "X${MIBS_DIR}" = "X"; then AC_MSG_ERROR(Could not find mibs directory, please specify with --with-mibsdir); fi AC_MSG_RESULT($MIBS_DIR); fi AC_SUBST(MIBS_DIR) AC_SUBST(SNMPCONFIG) AC_SUBST(SNMPLIB) AC_SUBST(SNMPAGENTLIB) AC_SUBST(RPM_ENABLE_SNMP_SUBAGENT) AM_CONDITIONAL(USE_APC_SNMP, test "$ENABLE_SNMP" = "yes") AM_CONDITIONAL(SNMP_SUBAGENT_BUILD, test "x${enable_snmp_subagent}" = "xyes") +dnl +dnl OpenIMPI checks +dnl + +if test "x${enable_ipmilan}" = "xyes" -o "x${enable_ipmilan}" = "xtry"; then + AC_MSG_CHECKING(For libOpenIPMI version 2 or greater) + AC_TRY_COMPILE([#include ], + [ #if (OPENIPMI_VERSION_MAJOR < 2 ) + #error "Too Old" + #endif ], + AC_MSG_RESULT("yes"); enable_ipmilan="yes", + AC_MSG_RESULT("no"); enable_ipmilan="no") +else + enable_ipmilan="no" +fi +AM_CONDITIONAL(IPMILAN_BUILD, test "X$enable_ipmilan" = "Xyes") + if test x"$VERSION" \> x"1.9"; then AC_DEFINE(HAVE_NEW_HB_API, 1, [have new heartbeat api]) fi dnl dnl On many systems libcrypto is needed when linking against libsnmp. dnl Check to see if it exists, and if so use it. dnl AC_CHECK_LIB(crypto, CRYPTO_free, CRYPTOLIB="-lcrypto",) AC_SUBST(CRYPTOLIB) dnl *************************************************************************** dnl TIPC communication module dnl *************************************************************************** AC_ARG_ENABLE([tipc], [ --enable-tipc Enable TIPC Communication module, [default=try]], [], [enable_tipc=try]) AC_ARG_WITH([tipc], [ --with-tipc-source TIPC source code directory], [], []) TIPC_DEV_ROOT=${with_tipc_source} tipc_headers_found=yes if test "x${TIPC_DEV_ROOT}" != "x"; then dnl checking tipc.h in specified directory TIPC_HEADER_DIR=${TIPC_DEV_ROOT}/include AC_CHECK_HEADER([${TIPC_HEADER_DIR}/net/tipc/tipc.h], [], \ [tipc_headers_found=no] ) TIPC_INCLUDE="-I${TIPC_HEADER_DIR}" else dnl checking tipc.h in standard include directory AC_CHECK_HEADERS(net/tipc/tipc.h, [], [tipc_headers_found=no]) fi AC_SUBST(TIPC_INCLUDE) AM_CONDITIONAL(BUILD_TIPC_MODULE, test "x${tipc_headers_found}" = "xyes" && test "x${enable_tipc}" != "xno") dnl *************************************************************************** dnl CIM provider configuration dnl *************************************************************************** AC_ARG_ENABLE([cim-provider], [ --enable-cim-provider Enable CIM providers. [default=no]]) AC_ARG_WITH([cimom], [ --with-cimom Specify CIM server], [], []) AC_ARG_WITH([cmpiheader], [ --with-cmpi-headers Specify CMPI header files], [], []) AC_ARG_WITH([cmpiprovider], [ --with-provider-dir Specify CMPI providers directory], [], []) CMPI_HEADER_PATH=${with_cmpi_headers} CIMOM=${with_cimom} CMPI_PROVIDER_DIR=${with_provider_dir} if test "x${enable_cim_provider}" != "xyes"; then enable_cim_provider="no" fi if test "x${CIMOM}" = "x"; then if test "x${CIMOM}" = "x"; then AC_CHECK_PROG([CIMOM], [cimserver], [pegasus]) fi if test "x${CIMOM}" = "x"; then AC_CHECK_PROG([CIMOM], [sfcbd], [sfcb]) fi if test "x${CIMOM}" = "x"; then AC_CHECK_PROG([CIMOM], [owcimomd], [openwbem]) fi if test "x${CIMOM}" = "x"; then AC_MSG_WARN([Cimom not found, MOF will not be installed!]) fi fi if test "x${enable_cim_provider}" = "xyes"; then if test "x${CMPI_HEADER_PATH}" != "x"; then CPPFLAGS="$CPPFLAGS -I${CMPI_HEADER_PATH}" fi for header in cmpidt.h cmpift.h cmpimacs.h do AC_CHECK_HEADER([${header}], [], [AC_MSG_ERROR([Sorry, can't find CMPI header files, \ specify CMPI header files with --with-cmpi-headers please.])] ) done if test "x${CMPI_PROVIDER_DIR}" = "x"; then case ${CIMOM} in sfcbd) SFCBD_PREFIX=`which sfcbd` SFCBD_PREFIX=`dirname ${SFCBD_PREFIX}` SFCBD_PREFIX=`dirname ${SFCBD_PREFIX}` CMPI_PROVIDER_DIR=${SFCBD_PREFIX}/lib/cmpi;; openwbem) OPENWBEM_PREFIX=`which owcimomd` OPENWBEM_PREFIX=`dirname ${OPENWBEM_PREFIX}` OPENWBEM_PREFIX=`dirname ${OPENWBEM_PREFIX}` OPENWBEM_CONFIG=${OPENWBEM_PREFIX}/etc/openwbem/openwbem.conf OPENWBEM_CMPI_DIR=`grep -e "cmpiprovifc.prov_location.*=" \ ${OPENWBEM_CONFIG} | sed -e 's/.*=\s*\(\.*\)/\1/'` if test "x${OPENWBEM_CMPI_DIR}" != "x"; then CMPI_PROVIDER_DIR=${OPENWBEM_CMPI_DIR} echo cmpi provider dir set, using openwbem config file: \ ${OPENWBEM_CONFIG}. else CMPI_PROVIDER_DIR=${OPENWBEM_PREFIX}/lib/openwbem/cmpiproviders echo openwbem config not found, cmpi provider dir set to \ $(CMPI_PROVIDER_DIR) by default. fi;; pegasus) CMPI_PROVIDER_DIR=/opt/tog-pegasus/providers/lib;; *);; esac if test x"$CMPI_PROVIDER_DIR" = x ; then CMPI_PROVIDER_DIR="$libdir"/cmpi AC_MSG_RESULT(default directory: $CMPI_PROVIDER_DIR) fi fi fi AM_CONDITIONAL(CIM_PROVIDER_BUILD, test "x${enable_cim_provider}" = "xyes") AC_SUBST(CMPI_PROVIDER_DIR) AC_SUBST(CIMOM) AC_SUBST(CMPI_HEADER_PATH) dnl *************************************************************************** dnl Thread safe configuration dnl *************************************************************************** AM_CONDITIONAL(ENABLE_THREAD_SAFE, test "x${enable_thread_safe}" = "xyes") dnl ************************************************************************ dnl Handy function for checking for typedefs or struct defs dnl ************************************************************************ check_for_type() { type="$1" headers="" shift for arg do headers="${headers}${arg} " done program="if ((${type} *) 0) return 0; if (sizeof(${type})) return 0; return 0;" have="HAVE_`echo "$type" | tr ' ' '_' | dd conv=ucase 2>/dev/null`" varhave="heartbeat_cv_$have" AC_CACHE_CHECK([for type $type ],$varhave,[ AC_TRY_COMPILE([$headers], [$program], eval $varhave=yes, eval $varhave=no , eval $varhave=cross) ]) if test x"`eval echo '${'$varhave'}'`" = xyes; then return 0 fi return 1 } check_for_type_member() { type="$1" member="$2" headers="" shift shift for arg do headers="${headers}${arg} " done program="${type} foo; if ((${type} *) 0) return 0; if (sizeof(${type})) return 0; if (sizeof(foo)) return 0; (void*)foo.${member}; return 0;" have="HAVE_`echo "$type" | tr ' ' '_' | dd conv=ucase 2>/dev/null`" varhave="heartbeat_cv_$have" AC_CACHE_CHECK([for type $type ],$varhave,[ AC_TRY_COMPILE([$headers], [$program], eval $varhave=yes, eval $varhave=no , eval $varhave=cross) ]) if test x"`eval echo '${'$varhave'}'`" = xyes; then return 0 fi return 1 } dnl ************************************************************************ dnl checks for typedefs dnl dnl if not known on this system, #define size_t unsigned AC_TYPE_SIZE_T dnl dnl Check poll.h for nfds_t (Linux Only), if not define it as an unsigned long int. dnl if check_for_type "nfds_t" "#include "; then AC_DEFINE(HAVE_NFDS_T,1,[Do we have nfds_t?]) fi dnl ************************************************************************ dnl checks for structures dnl # # Look for all the variants of local/UNIX socket credentials # # Include all of these headers that we can find... # headers="" for hdr in "sys/param.h" "sys/socket.h" "sys/ucred.h" do hdrvar=ac_cv_header_`echo $hdr | sed -e 's%\.%_%' -e 's%/%_%'` if test x"`eval echo '${'$hdrvar'}'`" = xyes; then headers="$headers #include <$hdr>" fi done if check_for_type_member "struct ucred" "cr_ref" "$headers"; then AC_DEFINE(HAVE_STRUCT_UCRED_DARWIN,1,[Do we have the Darwin version of struct ucred?]) fi if check_for_type "struct ucred" "$headers"; then AC_DEFINE(HAVE_STRUCT_UCRED,1,[Do we have struct ucred?]) fi if check_for_type "struct cmsgcred" "$headers" ; then AC_DEFINE(HAVE_STRUCT_CMSGCRED,1,[Do we have struct cmsgcred?]) fi if check_for_type "struct fcred" "$headers"; then AC_DEFINE(HAVE_STRUCT_FCRED,1,[Do we have struct fcred?]) fi if check_for_type "struct cred" "$headers"; then AC_DEFINE(HAVE_STRUCT_CRED,1,[Do we have struct cred?]) fi if check_for_type "struct sockcred" "$headers"; then AC_DEFINE(HAVE_STRUCT_SOCKCRED,1,[Do we have struct sockcred?]) fi dnl Check TERMIOS for components (e.g. c_line not present on Solaris) dnl AC_CACHE_CHECK([for c_line in termios],samba_cv_HAVE_TERMIOS_C_LINE,[ AC_TRY_COMPILE([#include #include ], [struct termios ti; ti.c_line = 'a';], samba_cv_HAVE_TERMIOS_C_LINE=yes,samba_cv_HAVE_TERMIOS_C_LINE=no,samba_cv_HAVE_TERMIOS_C_LINE=cross)]) if test x"$samba_cv_HAVE_TERMIOS_C_LINE" = x"yes"; then AC_DEFINE(HAVE_TERMIOS_C_LINE,1,[ ]) fi dnl Check sockaddr_in for components (e.g. sin_len not present on Solaris) dnl AC_CACHE_CHECK([for sin_len in sockaddr_in],samba_cv_HAVE_SOCKADDR_IN_SIN_LEN,[ AC_TRY_COMPILE([#include #include ], [struct sockaddr_in si; si.sin_len = 1;], samba_cv_HAVE_SOCKADDR_IN_SIN_LEN=yes,samba_cv_HAVE_SOCKADDR_IN_SIN_LEN=no,samba_cv_HAVE_SOCKADDR_IN_SIN_LEN=cross)]) if test x"$samba_cv_HAVE_SOCKADDR_IN_SIN_LEN" = x"yes"; then AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN,1,[ ]) fi dnl Check msghdr for components (e.g. msg_control/msg_controlen not present on Solaris) dnl AC_CACHE_CHECK([for msg_control in msghdr],samba_cv_HAVE_MSG_CONTROL_MSGHDR,[ AC_TRY_COMPILE([#include #include ], [struct msghdr mh; mh.msg_control = (void *)0;], samba_cv_HAVE_MSG_CONTROL_MSGHDR=yes,samba_cv_HAVE_MSG_CONTROL_MSGHDR=no,samba_cv_HAVE_MSG_CONTROL_MSGHDR=cross)]) if test x"$samba_cv_HAVE_MSG_CONTROL_MSGHDR" = x"yes"; then MSGHDR_TYPE="msghdr" IPCSOCKET_C="ipcsocket.c" IPCSOCKET_LO="ipcsocket.lo" else MSGHDR_TYPE="nmsghdr" IPCSOCKET_C="" IPCSOCKET_LO="" fi dnl Check syslog.h for 'facilitynames' table dnl AC_CACHE_CHECK([for facilitynames in syslog.h],ac_cv_HAVE_SYSLOG_FACILITYNAMES,[ AC_TRY_COMPILE([ #define SYSLOG_NAMES #include #include ], [ void *fnames; fnames = facilitynames; ], ac_cv_HAVE_SYSLOG_FACILITYNAMES=yes,ac_cv_HAVE_SYSLOG_FACILITYNAMES=no,ac_cv_HAVE_SYSLOG_FACILITYNAMES=cross)]) if test x"$ac_cv_HAVE_SYSLOG_FACILITYNAMES" = x"yes"; then AC_DEFINE(HAVE_SYSLOG_FACILITYNAMES,1,[ ]) fi dnl dnl Check for ALIGN in /sys/param.h dnl AC_MSG_CHECKING("for ALIGN in sys/param.h") AC_EGREP_CPP(FoundAlign, [#include #ifdef ALIGN FoundAlign #endif ], [ ALIGN="ALIGN" AC_MSG_RESULT(Yes) ], AC_MSG_RESULT("No")) AC_MSG_CHECKING("for T_ALIGN in xti.h") AC_EGREP_CPP(FoundAlign, [#include #ifdef T_ALIGN FoundAlign #endif ], [ ALIGN="T_ALIGN" AC_MSG_RESULT(Yes) ], AC_MSG_RESULT(No)) AC_SUBST(IPCSOCKET_C) AC_SUBST(IPCSOCKET_LO) AC_SUBST(ALIGN) AC_SUBST(MSGHDR_TYPE) dnl ************************************************************************ dnl checks for compiler characteristics dnl dnl Warnings for C compilers. Note: generic, portable warnings only. dnl Things likely to be specific to a particular OS or module should be dnl carefully handled afterwards. AC_C_STRINGIZE dnl ********************************************************************** dnl time-related declarations etc. AC_STRUCT_TIMEZONE if check_for_type_member "struct tm" "tm_gmtoff" "#include "; then AC_DEFINE(HAVE_TM_GMTOFF,1,[Do we have structure member tm_gmtoff?]) fi dnl ********************************************************************** dnl Check the size of the integer types dnl So we can have integers of known sizes as needed dnl AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) AC_ARG_ENABLE([all], [ --enable-all Activate ALL features [default=no]]) AC_ARG_ENABLE([rpath], [ --enable-rpath Enable RPATH in libtool [default=yes]]) AC_ARG_ENABLE([ansi], [ --enable-ansi force GCC to compile to ANSI/ANSI standard for older compilers. [default=yes]]) AC_ARG_ENABLE([fatal-warnings], [ --enable-fatal-warnings very pedantic and fatal warnings for gcc [default=yes]], [], [enable_fatal_warnings=unknown]) AC_ARG_ENABLE([times-kludge], [ --enable-times-kludge enables a kludge to workaround a bug in glibc's times(2) call [default=yes]], [], [enable_times_kludge=unknown]) AC_ARG_ENABLE([no-long-long], [ --enable-no-long-long removes no long long warning for gcc [default=yes]], [], [enable_no_long_long=yes]) AC_ARG_ENABLE([traditional-warnings], [ --enable-traditional-warnings enable traditional warnings gcc (-Wtraditional) [default=no]]) AC_ARG_ENABLE([pretty], [ --enable-pretty Pretty-print compiler output unless there is an error [default=no]]) AC_ARG_ENABLE([quiet], [ --enable-quiet Supress make output unless there is an error [default=no]]) AC_ARG_ENABLE([ldirectord], -[ --enable-ldirectord enable Linix Director Daemon for use with LVS +[ --enable-ldirectord Enable Linix Director Daemon for use with LVS [default=yes]], [], [enable_ldirectord=yes]) AM_CONDITIONAL(LDIRECTORD_BUILD, test "X$enable_ldirectord" = "Xyes") AC_ARG_ENABLE([thread-safe], [ --enable-thread-safe Enable some client libraries to be thread safe. [default=no]]) AC_ARG_ENABLE([snmp], [ --enable-snmp Enable building of SNMP related functionality. [default=yes]]) AC_ARG_ENABLE([snmp-subagent], [ --enable-snmp-subagent Enable building of our SNMP subagent (lots of dependencies). [default=try]]) +AC_ARG_ENABLE([ipmilan], +[ --enable-ipmilan enable IPMILan Stonith Plugin + [default=no]]) + CC_WARNINGS="" dnl - If requested, enable ALL subsystems. if test "${enable_all}" = "yes" ; then echo "Enabling all optional features." enable_ansi=yes; enable_crm=yes; enable_fatal_warnings=yes; enable_lrm=yes; enable_snmp_subagent=try; enable_mgmt=try; enable_quorumd=try; enable_cim_provider=try; - + enable_ipmilan=try fi AC_ARG_ENABLE([bundled-ltdl], [ --enable-bundled-ltdl Configure, build and install the standalone ltdl library bundled with Heartbeat [default=no]]) LTDL_LIBS="" dnl Check before we enable -Wstrict-prototypes as it causes the test to fail AC_CHECK_LIB(ltdl, lt_dlopen, [LTDL_foo=1]) if test "x${enable_bundled_ltdl}" = "xyes"; then if test $ac_cv_lib_ltdl_lt_dlopen = yes; then AC_MSG_NOTICE([Disabling usage of installed ltdl]) fi ac_cv_lib_ltdl_lt_dlopen=no fi LIBLTDL_DIR="" if test $ac_cv_lib_ltdl_lt_dlopen != yes ; then AC_MSG_NOTICE([Installing local ltdl]) LIBLTDL_DIR=libltdl ( cd $srcdir ; $TAR -xvf libltdl.tar ) if test "$?" -ne 0; then AC_MSG_ERROR([$TAR of libltdl.tar in $srcdir failed]) fi AC_CONFIG_SUBDIRS(libltdl) else LIBS="$LIBS -lltdl" AC_MSG_NOTICE([Using installed ltdl]) INCLTDL="" LIBLTDL="" fi dnl libltdl additions AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) AC_SUBST(LIBLTDL_DIR) dnl ************ curses ********************** dnl A few OSes (e.g. Linux) deliver a default "ncurses" alongside "curses". dnl Many non-Linux deliver "curses"; sites may add "ncurses". dnl dnl However, the source-code recommendation for both is to #include "curses.h" dnl (i.e. "ncurses" still wants the include to be simple, no-'n', "curses.h"). dnl dnl Andrew Beekhof (author of heartbeat code that uses this functionality) dnl wishes "ncurses" to take precedence. So the following ordering has dnl been devised to implement this. dnl dnl Look first for the headers, then set the libraries accordingly. dnl (Normally autoconf suggests looking for libraries first.) dnl AC_CHECK_HEADERS(curses.h) AC_CHECK_HEADERS(curses/curses.h) AC_CHECK_HEADERS(ncurses.h) AC_CHECK_HEADERS(ncurses/ncurses.h) dnl Although n-library is preferred, only look for it if the n-header was found. CURSESLIBS='' if test "$ac_cv_header_ncurses_h" = "yes"; then AC_CHECK_LIB(ncurses, printw, [CURSESLIBS='-lncurses'; AC_DEFINE(HAVE_LIBNCURSES,1, have ncurses library)] ) fi if test "$ac_cv_header_ncurses_ncurses_h" = "yes"; then AC_CHECK_LIB(ncurses, printw, [CURSESLIBS='-lncurses'; AC_DEFINE(HAVE_LIBNCURSES,1, have ncurses library)] ) fi dnl Only look for non-n-library if there was no n-library. if test X"$CURSESLIBS" = X"" -a "$ac_cv_header_curses_h" = "yes"; then AC_CHECK_LIB(curses, printw, [CURSESLIBS='-lcurses'; AC_DEFINE(HAVE_LIBCURSES,1, have curses library)] ) fi dnl Only look for non-n-library if there was no n-library. if test X"$CURSESLIBS" = X"" -a "$ac_cv_header_curses_curses_h" = "yes"; then AC_CHECK_LIB(curses, printw, [CURSESLIBS='-lcurses'; AC_DEFINE(HAVE_LIBCURSES,1, have curses library)] ) fi AC_SUBST(CURSESLIBS) dnl ************ curses ********************** if test "$GCC" = yes; then dnl dnl We make sure warnings are carefully scrubbed out of the output if dnl you're running on some platforms. You can enable that behavior with dnl the option "fatal-warnings", by specifying --enable-fatal-warnings. dnl Or, you can disable it with --disable-fatal-warnings. dnl dnl Horms 10th August 2001 dnl Don't do this, it seems to cause configure in dnl the libltdl/ directory to die under Debian Woody dnl I'm suspecting it will be a problem on other systems too. dnl For this reason it now defaults to off. dnl AlanR 11 August 2001 dnl Show no mercy to broken OSes and other software. If you have broken dnl software, turn this feature off. dnl NO warnings WHATSOVER will be tolerated without good reason. dnl A distribution being broken isn't a good reason. dnl The cure for that is fix the distribution, not destroy the integrity dnl of the entire project by defaulting it to "off". dnl In my experience, there are ways of making individual warnings go dnl away. dnl The only way I know to keep them out is to make them an absolute dnl pain to deal with. Otherwise they're a pain to fix. dnl This policy is not an accident, nor was it chosen without significant dnl thought and experience. dnl cc_supports_flag() { AC_MSG_CHECKING(whether $CC supports "$@") Cfile=/tmp/foo${$} touch ${Cfile}.c $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1 rc=$? rm -f ${Cfile}.c ${Cfile}.o case $rc in 0) AC_MSG_RESULT(yes);; *) AC_MSG_RESULT(no);; esac return $rc } dnl ************ printw ********************** if test X"$CURSESLIBS" != X"" && cc_supports_flag -Wcast-qual \ && cc_supports_flag -Werror; then dnl Check for printw() prototype compatibility dnl FIXME: We can check che prototype compatibility only if $CC supports dnl -Wcast-qual and -Werror AC_MSG_CHECKING(whether printw() requires argument of "const char *") ac_save_LIBS=$LIBS LIBS="$CURSESLIBS $LIBS" ac_save_CFLAGS=$CFLAGS CFLAGS="-Wcast-qual -Werror" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #if defined(HAVE_CURSES_H) # include #elif defined(HAVE_NCURSES_H) # include #endif ], [printw((const char *)"Test");] )], [ac_cv_compatible_printw=yes], [ac_cv_compatible_printw=no] ) LIBS=$ac_save_LIBS CFLAGS=$ac_save_CFLAGS AC_MSG_RESULT([$ac_cv_compatible_printw]) if test "$ac_cv_compatible_printw" = no; then AC_MSG_WARN([The printw() function of your ncurses or curses library is old, we will disable usage of the library. If you want to use this library anyway, please update to newer version of the library, ncurses 5.4 or later is recommended. You can get the library from http://www.gnu.org/software/ncurses/.]) AC_MSG_NOTICE([Disabling curses]) AC_DEFINE(HAVE_INCOMPATIBLE_PRINTW, 1, [Do we have incompatible printw() in curses library?]) dnl AC_DEFINE(HAVE_CURSES_H, 0) dnl AC_DEFINE(HAVE_NCURSES_H, 0) fi fi dnl ************ printw ********************** EXTRA_WARNINGS="" # We had to eliminate -Wnested-externs because of libtool changes WARNLIST="all missing-prototypes missing-declarations strict-prototypes declaration-after-statement pointer-arith write-strings cast-qual cast-align bad-function-cast inline missing-format-attribute format=2 format-security format-nonliteral no-long-long no-strict-aliasing" for j in $WARNLIST do if cc_supports_flag -W$j then case $j in "no-long-long") if test "${enable_no_long_long}" = "yes"; then EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j" fi;; *) EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j";; esac fi done dnl Add any system specific options here. if test "${enable_ansi}" = "unknown"; then enable_ansi=yes fi case "$host_os" in *linux*|*bsd*) if test "${enable_fatal_warnings}" = "unknown"; then enable_fatal_warnings=yes fi ;; *solaris*) ;; esac case "$host_os" in *linux*) if test "${enable_times_kludge}" = "unknown"; then enable_times_kludge=yes fi ;; esac if test "${enable_ansi}" = yes && cc_supports_flag -std=iso9899:199409 ; then echo "Enabling ANSI Compatibility on this platform" ANSI="-ansi -D_GNU_SOURCE -DANSI_ONLY" fi if test "${enable_fatal_warnings}" = yes && cc_supports_flag -Werror ; then echo "Enabling Fatal Warnings (-Werror) on this platform" FATAL_WARNINGS="-Werror" fi if test "$enable_traditional_warning" = yes && \ cc_supports_flag -Wtraditional; then echo "Enabling traditional warnings" EXTRA_WARNINGS="$EXTRA_WARNINGS -Wtraditional" fi CC_WARNINGS="$EXTRA_WARNINGS $FATAL_WARNINGS $ANSI" NON_FATAL_CC_WARNINGS="$EXTRA_WARNINGS" fi if test "${enable_times_kludge}" = no; then echo "Disabling times(2) kludge" AC_DEFINE(DISABLE_TIMES_KLUDGE, 1, [disable times(2) kludge]) fi AC_SUBST(DISABLE_TIMES_KLUDGE) AC_MSG_CHECKING(which init (rc) directory to use) INITDIR="" for initdir in /etc/init.d /etc/rc.d/init.d /sbin/init.d \ /usr/local/etc/rc.d /etc/rc.d do if test -d $initdir then INITDIR=$initdir AC_MSG_RESULT($INITDIR); break fi done AC_ARG_WITH(initdir, [ --with-initdir=DIR directory for init (rc) scripts [${INITDIR}]], [ if test x"$withval" = xprefix; then INITDIR=${prefix}; else INITDIR="$withval"; fi ]) if test "X$INITDIR" = X then FatalMissingThing "init directory" "Could not locate init directory" fi AC_SUBST(INITDIR) dnl ********************************************************************** dnl checks for group to install fifos as dnl dnl These checks aren't right. We need to locate the lowest dnl unused group id if haclient isn't in the /etc/group file dnl and no one has overridden group-id with a --with-group-id dnl option. dnl AC_ARG_WITH( group-name, [ --with-group-name=GROUP_NAME GROUP_NAME to run our programs as. [default=haclient] ], [ HA_APIGROUP="$withval" ], [ HA_APIGROUP="haclient" ], ) AC_SUBST(HA_APIGROUP) AC_DEFINE_UNQUOTED(HA_APIGROUP, "$HA_APIGROUP", group for our programs) if test -z "${GETENT}" -o ! -x "${GETENT}" then GETENT=getent getent() { grep "^${2}:" /etc/$1 } fi if test -z "${IP2UTIL}" -o ! -x "${IP2UTIL}" then IP2UTIL=/sbin/ip fi AC_ARG_WITH( group-id, [ --with-group-id=GROUP_ID GROUP_ID to run our programs as. [default=60] ], [ HA_APIGID="$withval" ], [ HA_APIGID=65 ], ) if getent group "$HA_APIGROUP" > /dev/null then HA_APIGID=`getent group "$HA_APIGROUP" | cut -d: -f3` fi AC_SUBST(HA_APIGID) AC_DEFINE_UNQUOTED(HA_APIGID, "$HA_APIGID", id for api group) AC_ARG_WITH( ccmuser-name, [ --with-ccmuser-name=HA_CCMUSER_NAME HA_CCMUSER_NAME to run privileged non-root things as. [default=hacluster] ], [ HA_CCMUSER="$withval" ], [ HA_CCMUSER="hacluster" ], ) AC_SUBST(HA_CCMUSER) AC_DEFINE_UNQUOTED(HA_CCMUSER, "$HA_CCMUSER", user to run privileged non-root things as) AC_ARG_WITH( ccmuser-id, [ --with-ccmuser-id=HA_HA_CCMUSER_ID USER_ID to run privileged non-root things as. [default=17] ], [ HA_CCMUID="$withval" ], [ HA_CCMUID=17 ], ) if getent passwd "$HA_CCMUSER" >/dev/null then HA_CCMUID=`getent passwd "$HA_CCMUSER" | cut -d: -f3` fi AC_SUBST(HA_CCMUID) AC_DEFINE_UNQUOTED(HA_CCMUID, "$HA_CCMUID", id for ccm user) # # Priority for starting via init startup scripts # AC_ARG_WITH( start-init-priority, [ --with-start-init-priority=number Init start priority. [default=75] ], [ HB_INITSTARTPRI="$withval" ], [ HB_INITSTARTPRI=75 ], ) AC_SUBST(HB_INITSTARTPRI) AC_DEFINE_UNQUOTED(HB_INITSTARTPRI,"$HB_INITSTARTPRI", init start priority) # # Priority for stopping via init shutdown scripts # AC_ARG_WITH( stop-init-priority, [ --with-stop-init-priority=number Init stop priority. [default=5] ], [ HB_INITSTOPPRI="$withval" ], [ HB_INITSTOPPRI=05 ], ) AC_SUBST(HB_INITSTOPPRI) AC_DEFINE_UNQUOTED(HB_INITSTOPPRI,"$HB_INITSTOPPRI", init stop priority) # # Name of UCD-SNMP development package # AC_ARG_WITH( ucd-snmp-devel, [ --with-snmp-name=name Name of ucd snmp developemnt RPM. [default=ucd-snmp-devel] ], [ UCDSNMPDEVEL=$withval ], [ UCDSNMPDEVEL=ucd-snmp-devel ], ) if test "$ac_cv_header_ucd_snmp_snmp_h" = no; then UCDSNMPDEVEL="" fi AC_SUBST(UCDSNMPDEVEL) AC_DEFINE_UNQUOTED(UCDSNMPDEVEL, $UCDSNMPDEVEL, Name of UCD SNMP development package) dnl ************************************************************************ dnl checks for library functions to replace them dnl dnl alphasort: Only on BSD. dnl System-V systems may have it, but hidden and/or deprecated. dnl A replacement function is supplied for it. dnl dnl NoSuchFunctionName: dnl is a dummy function which no system supplies. It is here to make dnl the system compile semi-correctly on OpenBSD which doesn't know dnl how to create an empty archive dnl dnl scandir: Only on BSD. dnl System-V systems may have it, but hidden and/or deprecated. dnl A replacement function is supplied for it. dnl dnl setenv: is some bsdish function that should also be avoided (use dnl putenv instead) dnl On the other hand, putenv doesn't provide the right API for the dnl code and has memory leaks designed in (sigh...) Fortunately this dnl A replacement function is supplied for it. dnl dnl setproctitle: sets the process title to a given string dnl dnl strerror: returns a string that corresponds to an errno. dnl A replacement function is supplied for it. dnl dnl unsetenv: is some bsdish function that should also be avoided (No dnl replacement) dnl A replacement function is supplied for it. dnl dnl strnlen: is a gnu function similar to strlen, but safer. dnl We wrote a tolearably-fast replacement function for it. dnl dnl strndup: is a gnu function similar to strdup, but safer. dnl We wrote a tolearably-fast replacement function for it. dnl dnl daemon: is a GNU function. The daemon() function is for programs wishing to dnl detach themselves from the controlling terminal and run in the dnl background as system daemon dnl A replacement function is supplied for it. dnl dnl Check Only dnl dnl getopt: If this is valid, define HAVE_DECL_GETOPT to make the getopt.h header compile cleanly. dnl AC_REPLACE_FUNCS(alphasort inet_pton NoSuchFunctionName scandir setenv strerror unsetenv strnlen strndup daemon uuid_parse strlcpy strlcat) dnl AC_CHECK_FUNCS(alphasort inet_pton NoSuchFunctionName scandir setenv strerror unsetenv strnlen strndup daemon uuid_parse) AC_CHECK_FUNCS(getopt, AC_DEFINE(HAVE_DECL_GETOPT, 1, [Have getopt function])) AC_SUBST(HA_HAVE_ALPHASORT) AC_SUBST(HA_HAVE_INET_PTON) AC_SUBST(HA_HAVE_SCANDIR) AC_SUBST(HA_HAVE_SETENV) AC_SUBST(HA_HAVE_STRERROR) AC_SUBST(HA_HAVE_UNSETENV) AC_SUBST(HA_HAVE_STRNLEN) AC_SUBST(HA_HAVE_STRNDUP) AC_SUBST(HA_HAVE_DAEMON) AC_SUBST(HA_HAVE_UUID_PARSE) AC_SUBST(HAVE_STRLCPY) AC_SUBST(HAVE_DECL_GETOPT) AC_CHECK_FUNCS(fcntl) AC_CHECK_FUNCS(flock) AC_CHECK_FUNCS(inet_aton) AC_CHECK_FUNCS(mallinfo) AC_CHECK_FUNCS(mallopt) AC_CHECK_FUNCS(__default_morecore) AC_CHECK_FUNCS(seteuid) AC_CHECK_FUNCS(setegid) AC_CHECK_FUNCS(getpeereid) dnl ********************************************************************** dnl Check for various argv[] replacing functions on various OSs dnl dnl Borrowed from Proftpd dnl Proftpd is Licenced under the terms of the GNU General Public Licence dnl and is available from http://www.proftpd.org/ dnl AC_CHECK_FUNCS(setproctitle) AC_CHECK_HEADERS(libutil.h) AC_CHECK_LIB(util, setproctitle, [AC_DEFINE(HAVE_SETPROCTITLE,1,[ ]) ac_cv_func_setproctitle="yes" ; LIBS="$LIBS -lutil"]) if test "$ac_cv_func_setproctitle" = "yes"; then pf_argv_set="PF_ARGV_NONE" fi if test "$pf_argv_set" = ""; then AC_CHECK_HEADERS(sys/pstat.h) if test "$ac_cv_header_pstat_h" = "yes"; then AC_CHECK_FUNCS(pstat) if test "$ac_cv_func_pstat" = "yes"; then pf_argv_set="PF_ARGV_PSTAT" else pf_argv_set="PF_ARGV_WRITEABLE" fi fi if test "$pf_argv_set" = ""; then AC_EGREP_HEADER([#define.*PS_STRINGS.*],sys/exec.h, have_psstrings="yes",have_psstrings="no") if test "$have_psstrings" = "yes"; then pf_argv_set="PF_ARGV_PSSTRINGS" fi fi if test "$pf_argv_set" = ""; then AC_CACHE_CHECK(whether __progname and __progname_full are available, pf_cv_var_progname, AC_TRY_LINK([extern char *__progname, *__progname_full;], [__progname = "foo"; __progname_full = "foo bar";], pf_cv_var_progname="yes", pf_cv_var_progname="no")) if test "$pf_cv_var_progname" = "yes"; then AC_DEFINE(HAVE___PROGNAME,1,[ ]) fi AC_CACHE_CHECK(which argv replacement method to use, pf_cv_argv_type, AC_EGREP_CPP(yes,[ #if defined(__GNU_HURD__) yes #endif ],pf_cv_argv_type="new", pf_cv_argv_type="writeable")) if test "$pf_cv_argv_type" = "new"; then pf_argv_set="PF_ARGV_NEW" fi if test "$pf_argv_set" = ""; then pf_argv_set="PF_ARGV_WRITEABLE" fi fi fi AC_DEFINE_UNQUOTED(PF_ARGV_TYPE, $pf_argv_set, mechanism to pretty-print ps output: setproctitle-equivalent) dnl End of tests borrowed from Proftpd dnl check if header file and lib are there for hbaping hbaping_build="yes" AC_CHECK_HEADERS(time.h hbaapi.h, , [hbaping_build="no"],[[#if HAVE_TIME_H #include #endif]]) AC_CHECK_LIB(HBAAPI, HBA_SendScsiInquiry, , [hbaping_build="no"]) AM_CONDITIONAL(HBAAPI_BUILD, test "x${hbaping_build}" = "xyes") dnl check if header file and lib are there for zlib zlib_installed="yes" AC_CHECK_HEADERS(zlib.h, , [zlib_installed="no"],) AC_CHECK_LIB(z, compress , , [zlib_intalled="no"]) AM_CONDITIONAL(BUILD_ZLIB_COMPRESS_MODULE, test "x${zlib_installed}" = "xyes") dnl check if header file and lib are there for zlib bz2_installed="yes" AC_CHECK_HEADERS(bzlib.h, , [bz2_installed="no"],) AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress , , [bz2_intalled="no"]) AM_CONDITIONAL(BUILD_BZ2_COMPRESS_MODULE, test "x${bz2_installed}" = "xyes") dnl check if header file and lib are there for openais module openais_installed="yes" AC_CHECK_HEADERS(evs.h, , [openais_installed="no"],) AC_CHECK_LIB(evs, evs_initialize , , [openais_intalled="no"]) AM_CONDITIONAL(BUILD_OPENAIS_MODULE, test "x${openais_installed}" = "xyes") AC_MSG_CHECKING(if clock_t is long enough) if test $ac_cv_sizeof_long -ge 8; then AC_MSG_RESULT(yes) AC_DEFINE(CLOCK_T_IS_LONG_ENOUGH, 1, [Set if CLOCK_T is adequate by itself for the "indefinite future" (>= 100 years)]) else AC_MSG_RESULT(no) fi dnl check if there are getpid() inconsistency dnl Note: reduce LIBS; in particular, ltdl can cause confusion. dnl Possibly better: move 'LIBS="$LIBS -lltdl"' from above to beyond here. dnl AC_MSG_CHECKING(for getpid() consistency in multi-process/threads program) ac_save_LIBS=$LIBS LIBS="-lpthread" AC_TRY_RUN(`cat $srcdir/config/pidtest.c`, AC_MSG_RESULT(ok), [AC_MSG_RESULT(fail); AC_DEFINE(GETPID_INCONSISTENT, 1 , [pid inconsistent])],) LIBS=$ac_save_LIBS dnl check byte order AC_MSG_CHECKING(for byteorder) AC_TRY_RUN(`cat $srcdir/config/byteorder_test.c`, [AC_MSG_RESULT(little-endian); AC_DEFINE(CONFIG_LITTLE_ENDIAN, 1, [little-endian])], [AC_MSG_RESULT(big-endian); AC_DEFINE(CONFIG_BIG_ENDIAN, 1, [big-endian])],) dnl dnl Lex and yacc can't be trusted to produce code that won't produce dnl warnings dnl NON_FATAL_CFLAGS="$CFLAGS $NON_FATAL_CC_WARNINGS" AC_SUBST(NON_FATAL_CFLAGS) dnl dnl We reset CFLAGS to include our warnings *after* all function dnl checking goes on, so that our warning flags don't keep the dnl AC_*FUNCS() calls above from working. In particular, -Werror will dnl *always* cause us troubles if we set it before here. dnl dnl CFLAGS="$CFLAGS $CC_WARNINGS" dnl NOTE: dnl This check should only be done after CFLAGS is set. Otherwise dnl linux box will complain because of a warning of the undefined dnl function sigignore(). dnl dnl In theory, all function checks should be done after the CFLAGS is dnl set since we are enforcing the -Werror. But this would have a big dnl impact on the whole source tree so I am only moving the dnl sigignore for now. A bit of a hack. dnl dnl sigignore: Only on Solaris. dnl it is a solaris replacement for signal(s,SIG_IGN). dnl AC_CHECK_FUNCS(sigignore) dnl dnl Make sure that CFLAGS is not exported. If the user did dnl not have CFLAGS in their environment then this should have dnl no effect. However if CFLAGS was exported from the user's dnl environment, then the new CFLAGS will also be exported dnl to sub processes. This causes a problem when configure dnl is run in the libltdl directory. Horms 16th July 2002 dnl if export | fgrep " CFLAGS=" > /dev/null; then export -n CFLAGS || true # We don't want to bomb out if this fails fi if test "$GCC" = yes; then CFLAGS="$CFLAGS -ggdb3" if cc_supports_flag -funsigned-char then CFLAGS="$CFLAGS -funsigned-char" fi else CFLAGS="$CFLAGS -g" fi dnl AC_SUBST(CC_WARNINGS) dnl ************************************************************************ dnl pre AC_OUTPUT stuff dnl dnl th aux dir (for holding config & autogenerated stuff) dnl AC_SUBST(ac_aux_dir) AC_SUBST(LIBADD_DL) dnl extra flags for dynamic linking libraries AC_SUBST(LIBADD_INTL) dnl extra flags for GNU gettext stuff... AC_SUBST(LOCALE) HA_HBCONF_DIR=$sysconfdir/ha.d AC_SUBST(HA_HBCONF_DIR) AC_DEFINE_UNQUOTED(HA_HBCONF_DIR,"$HA_HBCONF_DIR", Heartbeat configuration directory) HA_RC_DIR=$HA_HBCONF_DIR/rc.d AC_SUBST(HA_RC_DIR) AC_DEFINE_UNQUOTED(HA_RC_DIR,"$HA_RC_DIR", heartbeat v1 script directory) AC_ARG_ENABLE([crm], [ --enable-crm Compile the Version 2 Cluster Resource Manager. [default=yes]], [], [enable_crm=yes]) CRM_DIR="" if test "x${enable_crm}" = "xyes"; then CRM_ENABLED=1 CRM_DIR=crm AC_DEFINE_UNQUOTED(WITH_CRM, 1, Use the new Cluster Resource Manager) else if test -z "${enable_crm}"; then enable_crm="no" fi dnl None of the following items build without the CRM available enable_mgmt=no enable_dopd=no enable_cim_provider=no fi AC_SUBST(CRM_DIR) AC_MSG_NOTICE([whether to enable the Cluster Resource Manager... ${enable_crm}]) AM_CONDITIONAL(CRM_BUILD, test "x${enable_crm}" = "xyes") AC_SUBST(CRM_ENABLED) dnl lrm configuration AC_ARG_ENABLE([lrm], [ --enable-lrm Compile the new Local Resource Manager. [default=yes]], [], [enable_lrm=yes]) LRM_ENABLED=0 if test "x${enable_crm}" = "xyes"; then if test "x${enable_lrm}" = "xno"; then AC_MSG_WARN([crm enabled, overriding --enable-lrm=no with --enable-lrm=yes]) elif test -z "${enable_lrm}"; then AC_MSG_WARN([crm enabled, defaulting to --enable-lrm=yes]) fi enable_lrm="yes" elif test -z "${enable_lrm}"; then enable_lrm="no" fi if test "x${enable_lrm}" = "xyes"; then LRM_ENABLED=1 fi if test -h /proc/$$/exe then AC_MSG_NOTICE("/proc/{pid}/exe link is supported") AC_DEFINE_UNQUOTED(HAVE_PROC_PID, 1, Define to 1 if /proc/{pid} is supported.) fi AC_SUBST(LRM_ENABLED) AM_CONDITIONAL(LRM_BUILD, test "x${enable_lrm}" = "xyes") AC_MSG_NOTICE([whether to enable the Local Resource Manager... ${enable_lrm}]) dnl ************************************************************************ dnl management and quorum daemons. AC_CHECK_HEADERS(gnutls/gnutls.h) AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h) dnl GNUTLS library: Attempt to determine by 'libgnutls-config' program. dnl If no 'libgnutls-config', try traditional autoconf means. AC_PATH_PROGS(LIBGNUTLS_CONFIG, libgnutls-config) if test -n "$LIBGNUTLS_CONFIG"; then AC_MSG_CHECKING(for gnutls header flags) GNUTLSHEAD="`$LIBGNUTLS_CONFIG --cflags`"; AC_MSG_RESULT($GNUTLSHEAD) AC_MSG_CHECKING(for gnutls library flags) GNUTLSLIBS="`$LIBGNUTLS_CONFIG --libs`"; AC_MSG_RESULT($GNUTLSLIBS) else AC_CHECK_LIB(gnutls, gnutls_init) fi AC_SUBST(GNUTLSHEAD) AC_SUBST(GNUTLSLIBS) dnl management tool configuration AC_ARG_ENABLE([mgmt], [ --enable-mgmt Compile the management tool. [default=try]], [], [enable_mgmt=try]) if test "x${enable_mgmt}" != "xno"; then if test "x${enable_mgmt}" = "xtry"; then MISSING_FN="WarnMissingThing" else MISSING_FN="FatalMissingThing" fi enable_mgmt="yes" MGMT_ENABLED=1 AM_CHECK_PYTHON_HEADERS(,PYTHON_INCLUDES='') AC_SUBST(PYTHON_INCLUDES) if test "x${PYTHON_INCLUDES}" = "x"; then $MISSING_FN "Python.h" \ "The GUI managment module needs Python.h (Linux: python-devel package)" enable_mgmt="no" MGMT_ENABLED=0 fi if test "$ac_cv_header_security_pam_appl_h" = "no" -a "$ac_cv_header_pam_pam_appl_h" = "no"; then $MISSING_FN "security/pam_appl.h" \ "The GUI managment module needs the pam-devel package" enable_mgmt="no" MGMT_ENABLED=0 fi if test "$ac_cv_header_gnutls_gnutls_h" = "no"; then $MISSING_FN "gnutls/gnutls.h" \ "The GUI managment module needs GNU/TLS header files" enable_mgmt="no" MGMT_ENABLED=0 fi if test -z "$SWIG"; then $MISSING_FN "swig" \ "The GUI managment module needs swig" \ "You can get it from http://swig.org/" enable_mgmt="no" MGMT_ENABLED=0 fi fi if test "x${enable_mgmt}" != "xno"; then RPM_ENABLE_MGMT_CONFIG=1 else RPM_ENABLE_MGMT_CONFIG=0 fi AC_SUBST(RPM_ENABLE_MGMT_CONFIG) AM_CONDITIONAL(MGMT_BUILD, test "x${enable_mgmt}" != "xno") if test "x${enable_mgmt}" != "xno"; then AC_DEFINE_UNQUOTED(MGMT_ENABLED, 1, Define to 1 if the mgmt-daemon and friends are enabled.) dnl If this system might be RPM-based, then adjust some RPM-build details if test x"${RPM}" != x""; then dnl FIXME: a flawy solution but no better one now if rpm -q python-gtk > /dev/null; then RPM_MGMT_RUNTIME_REQUIRES="libglade2, python-gtk"; else RPM_MGMT_RUNTIME_REQUIRES="libglade2, pygtk2"; fi else RPM_MGMT_RUNTIME_REQUIRES= fi else RPM_MGMT_RUNTIME_REQUIRES= fi AC_SUBST(RPM_MGMT_RUNTIME_REQUIRES) AC_MSG_NOTICE([whether to enable the management tool... ${enable_mgmt}]) dnl quorum server configuration AC_ARG_ENABLE([quorumd], [ --enable-quorumd Compile the quorum server. [default=try]], [], [enable_quorumd=try]) if test "x${enable_quorumd}" != "xno"; then if test "x${enable_quorumd}" = "xtry"; then MISSING_FN="WarnMissingThing" else MISSING_FN="FatalMissingThing" fi enable_quorumd="yes" QUORUMD_ENABLED=1 if test "$ac_cv_header_gnutls_gnutls_h" = "no"; then $MISSING_FN "gnutls/gnutls.h" \ "The quorum server module needs GNU/TLS header files" enable_quorumd="no" QUORUMD_ENABLED=0 fi fi AC_SUBST(QUORUMD_ENABLED) AM_CONDITIONAL(QUORUMD_BUILD, test "x${enable_quorumd}" != "xno") AC_MSG_NOTICE([whether to enable the quorum server... ${enable_quorumd}]) dnl ********************************************** dnl TSA plugin configuration dnl ********************************************** AC_ARG_ENABLE([tsa-plugin], [ --enable-tsa-plugin Enable TSA plugin. [default=no]], [], [enable_tsa_plugin=no]) AC_ARG_WITH([JAVA_HOME], [ --with-java-home JAVA_HOME dir], [], []) AC_ARG_WITH([TSA_DIR], [ --with-tsa-dir TSA diretory, default = /opt/IBM/tsamp/], [], []) JAVA_HOME=${with_java_home} TSA_DIR=${with_tsa_dir} if test "x${enable_tsa_plugin}" != "xno"; then if test "x${JAVA_HOME}" = "x"; then JAVA_BIN=`which java` JAVA_BIN_DIR=`dirname ${JAVA_BIN}` JAVA_HOME=`dirname ${JAVA_BIN_DIR}` fi if test "x${TSA_DIR}" = "x"; then TSA_DIR="/opt/IBM/tsamp/" fi fi AC_SUBST(JAVA_HOME) AC_SUBST(TSA_DIR) AM_CONDITIONAL(TSA_PLUGIN_BUILD, test "x${enable_tsa_plugin}" != "xno") dnl ********************************************** dnl drbd peer outdate plugin configuration dnl ********************************************** case "$host_os" in *linux*) AC_ARG_ENABLE([dopd], [ --enable-dopd Compile the Drbd Outdate Peer Daemon and tools. [default=yes]], [], [enable_dopd=yes]) ;; *) enable_dopd=no ;; esac AM_CONDITIONAL(BUILD_DRBD_OUTDATE_PEER, test "x${enable_dopd}" != "xno") hb_libdir="${libdir}/${HB_PKG}" AC_SUBST(hb_libdir) HA_PLUGIN_DIR="${hb_libdir}/plugins" AC_SUBST(HA_PLUGIN_DIR) AC_DEFINE_UNQUOTED(HA_PLUGIN_DIR,"$HA_PLUGIN_DIR", PILS plugin dir) LRM_PLUGIN_DIR="${hb_libdir}/plugins/RAExec" AC_SUBST(LRM_PLUGIN_DIR) AC_DEFINE_UNQUOTED(LRM_PLUGIN_DIR,"$LRM_PLUGIN_DIR", LRM plugin dir) HB_RA_DIR="${sysconfdir}/ha.d/resource.d/" AC_SUBST(HB_RA_DIR) AC_DEFINE_UNQUOTED(HB_RA_DIR,"$HB_RA_DIR", Location for v1 Heartbeat v1 RAs) dnl ************ OCF (Open Cluster Framework) ********************** dnl Should be consistent with the OCF standard fixed pathname /usr/lib/ocf dnl Changing it from this value violates the OCF standard. dnl This is why it is not affected by the PREFIX setting. dnl We do not recommend changing it. dnl OCF_ROOT_DIR="/usr/lib/ocf" AC_ARG_WITH(ocf-root, [ --with-ocf-root=DIR directory for OCF scripts [${OCF_ROOT_DIR}]], [ if test x"$withval" = xprefix; then OCF_ROOT_DIR=${prefix}; else OCF_ROOT_DIR="$withval"; fi ]) if test "X$OCF_ROOT_DIR" = X; then FatalMissingThing "OCF directory" "Could not locate OCF directory" fi AC_SUBST(OCF_ROOT_DIR) AC_DEFINE_UNQUOTED(OCF_ROOT_DIR,"$OCF_ROOT_DIR", OCF root directory - specified by the OCF standard) OCF_RA_DIR="${OCF_ROOT_DIR}/resource.d/" AC_SUBST(OCF_RA_DIR) AC_DEFINE_UNQUOTED(OCF_RA_DIR,"$OCF_RA_DIR", Location for OCF RAs) LSB_RA_DIR="${INITDIR}" AC_SUBST(LSB_RA_DIR) AC_DEFINE_UNQUOTED(LSB_RA_DIR,"$LSB_RA_DIR", Location for LSB RAs) STONITH_RA_DIR="${hb_libdir}/stonith.d/" AC_SUBST(STONITH_RA_DIR) AC_DEFINE_UNQUOTED(STONITH_RA_DIR,"$STONITH_RA_DIR", Location for STONITH RAs) AC_ARG_ENABLE([valgrind], [ --enable-valgrind "Run selected heartbeat components using Valgrind." [default=no]], [], [enable_valgrind=no]) AC_ARG_WITH(valgrind-log, [ --with-valgrind-log=options Logging options to pass to valgrind], [ VALGRIND_LOG="$withval" ], []) AC_ARG_WITH(valgrind-suppress, [ --with-valgrind-suppress=file Name of a suppression file to pass to Valgrind [default=/dev/null]], [ VALGRIND_SUPP="$withval" ], [ VALGRIND_SUPP="/dev/null" ]) if test "x" = "x$VALGRIND_LOG"; then VALGRIND_LOG="--log-socket=127.0.0.1:1234" AC_MSG_NOTICE(Set default Valgrind options to: $VALGRIND_OPTS) AC_MSG_NOTICE(Remember to start a receiver on localhost:1234) fi AC_PATH_PROG(VALGRIND_BIN, valgrind) if test "xyes" = "x$enable_valgrind" -a "x$VALGRIND_BIN" != "x"; then enable_libc_malloc=yes fi AC_DEFINE_UNQUOTED(VALGRIND_BIN, "$VALGRIND_BIN", Valgrind command) AC_DEFINE_UNQUOTED(VALGRIND_LOG, "$VALGRIND_LOG", Valgrind logging options) AC_DEFINE_UNQUOTED(VALGRIND_SUPP, "$VALGRIND_SUPP", Name of a suppression file to pass to Valgrind) AC_ARG_ENABLE([libc-malloc], [ --enable-libc-malloc Use libc malloc instead of Heartbeat's custom one. [default=no]], [], [enable_libc_malloc=no]) if test "xyes" = "x$enable_libc_malloc" -o "x1" = "x$enable_libc_malloc"; then AC_DEFINE_UNQUOTED(CL_USE_LIBC_MALLOC, 1, Use libc malloc instead of Heartbeat's custom one.) fi dnl ********************************************************************** dnl 'AWK' had been determined via 'aclocal.m4' as the simple name, using dnl the current PATH (i.e. in the context of 'configure'). dnl dnl Things within heartbeat will use 'AWK', but from a different context, dnl so we should determine, and substitute, the full path. dnl dnl Note: Even that may have a flaw, e.g. if 'configure' finds (say) 'gawk', dnl which we here convert to '/path/to/gawk', but the run-time machine lacks it. dnl We won't worry about that for now. dnl (David Lee; March 2007) AC_PATH_PROGS([AWK], $AWK) dnl ********************************************************************** dnl Enable optional, experimental directories here... dnl XPERIMENTALDIRS="" AC_SUBST(XPERIMENTALDIRS) CheckMissingThings dnl Options for cleaning up the compiler output PRETTY_CC="" QUIET_LIBTOOL_OPTS="" QUIET_MAKE_OPTS="" if test x"${enable_pretty}" = "xyes"; then enable_quiet="yes" echo "install_sh: ${install_sh}" PRETTY_CC="`pwd`/tools/ccdv" dnl It would be nice if this was rebuilt when needed too... mkdir `pwd`/tools/ 2>/dev/null gcc $CFLAGS -o `pwd`/tools/ccdv ${srcdir}/tools/ccdv.c CC="\$(PRETTY_CC) ${CC}" fi if test "x${enable_quiet}" = "xyes"; then QUIET_LIBTOOL_OPTS="--quiet" QUIET_MAKE_OPTS="--quiet" fi AC_MSG_RESULT(Supressing make details: ${enable_quiet}) AC_MSG_RESULT(Pretty printing of compiler output: ${enable_pretty}) dnl Put the above variables to use LIBTOOL="${LIBTOOL} --tag=CC \$(QUIET_LIBTOOL_OPTS)" MAKE="${MAKE} \$(QUIET_MAKE_OPTS)" AC_SUBST(CC) AC_SUBST(MAKE) AC_SUBST(LIBTOOL) AC_SUBST(PRETTY_CC) AC_SUBST(QUIET_MAKE_OPTS) AC_SUBST(QUIET_LIBTOOL_OPTS) dnl *** "echo" adjustments (begin) *** dnl Some run-time scripts require options to "echo". dnl This configure is already determining and using "ac_n" and "ac_c" dnl for internal use, so make available externally. dnl (Not sure how "future proof" this is, but it at least seems clean.) dnl dnl This must be close to the end of "configure.in" otherwise it interferes dnl with output from the AC_MSG_*() macros. ECHO_N="$ac_n" ECHO_C="$ac_c" case $ac_n in -n) ECHO_E="-e";; *) ECHO_E="";; esac ECHO_CMD="echo" if test -x /usr/linux/bin/echo then # This is for AIX. I'm not sure it's necessary... ECHO_CMD="/usr/linux/bin/echo" ECHO_N="-n" ECHO_E="-e" fi AC_SUBST(ECHO_N) AC_SUBST(ECHO_C) AC_SUBST(ECHO_E) AC_SUBST(ECHO_CMD) dnl *** "echo" adjustments (end) *** dnl The Makefiles and shell scripts we output AC_CONFIG_FILES(heartbeat.spec \ Makefile \ README \ logd/Makefile \ config/Makefile \ cts/Makefile \ cts/CM_fs.py \ cts/CM_hb.py \ cts/CTS.py \ cts/CTSaudits.py \ cts/CTSlab.py \ cts/CTStests.py \ cts/CM_LinuxHAv2.py \ cts/CTSproxy.py \ cts/extracttests.py \ cts/getpeinputs.sh \ cts/OCFIPraTest.py \ cts/CIB.py \ cts/LSBDummy \ crm/Makefile \ crm/cib/Makefile \ crm/crmd/Makefile \ crm/pengine/Makefile \ crm/tengine/Makefile \ crm/admin/Makefile \ crm/admin/crm_primitive.py \ crm/admin/crm_sh \ crm/admin/crm_utils.py \ crm/admin/crm_commands.py \ debian/Makefile \ doc/Makefile \ doc/startstop \ doc/cibadmin.8 \ doc/crm_resource.8 \ contrib/Makefile \ contrib/ipfail/Makefile \ contrib/mlock/Makefile \ contrib/drbd-outdate-peer/Makefile \ include/Makefile \ include/clplumbing/Makefile \ include/crm/Makefile \ include/crm/common/Makefile \ include/crm/pengine/Makefile \ include/lrm/Makefile \ include/mgmt/Makefile \ include/ocf/Makefile \ include/pils/Makefile \ include/pils/plugin.h \ include/saf/Makefile \ include/stonith/Makefile \ include/fencing/Makefile \ replace/Makefile \ lib/Makefile \ lib/apphb/Makefile \ lib/clplumbing/Makefile \ lib/hbclient/Makefile \ lib/crm/Makefile \ lib/crm/common/Makefile \ lib/crm/cib/Makefile \ lib/crm/pengine/Makefile \ lib/crm/transition/Makefile \ lib/lrm/Makefile \ lib/mgmt/Makefile \ lib/pils/Makefile \ lib/plugins/Makefile \ lib/plugins/InterfaceMgr/Makefile \ lib/plugins/HBauth/Makefile \ lib/plugins/HBcomm/Makefile \ lib/plugins/lrm/Makefile \ lib/plugins/stonith/Makefile \ lib/plugins/stonith/ribcl.py \ lib/plugins/stonith/external/Makefile \ lib/plugins/stonith/external/ibmrsa \ lib/plugins/stonith/external/riloe \ lib/plugins/stonith/external/ssh \ lib/plugins/AppHBNotification/Makefile \ lib/plugins/HBcompress/Makefile \ lib/plugins/quorum/Makefile \ lib/plugins/quorumd/Makefile \ lib/plugins/tiebreaker/Makefile \ lib/recoverymgr/Makefile \ lib/stonith/Makefile \ lib/fencing/Makefile \ lrm/Makefile \ lrm/lrmd/Makefile \ lrm/admin/Makefile \ lrm/test/LRMBasicSanityCheck \ lrm/test/Makefile \ lrm/test/simple_ops \ mgmt/Makefile \ mgmt/daemon/Makefile \ mgmt/client/Makefile \ mgmt/client/haclient.py \ mgmt/client/mgmtcmd.py \ heartbeat/Makefile \ heartbeat/shellfuncs \ heartbeat/rc.d/Makefile \ heartbeat/rc.d/ask_resources \ heartbeat/rc.d/hb_takeover \ heartbeat/init.d/Makefile \ heartbeat/init.d/heartbeat \ heartbeat/lib/Makefile \ heartbeat/lib/BasicSanityCheck \ heartbeat/lib/ha_config \ heartbeat/lib/ha_propagate \ heartbeat/lib/hb_standby \ heartbeat/lib/mach_down \ heartbeat/lib/req_resource \ heartbeat/lib/ResourceManager \ heartbeat/lib/TestHeartbeatComm \ heartbeat/lib/hb_takeover \ heartbeat/lib/hb_addnode \ heartbeat/lib/hb_delnode \ heartbeat/lib/hb_setweight \ heartbeat/lib/hb_setsite \ heartbeat/libnet_util/Makefile \ heartbeat/logrotate.d/Makefile \ ldirectord/Makefile \ ldirectord/ldirectord \ ldirectord/init.d/Makefile \ ldirectord/init.d/ldirectord \ ldirectord/init.d/ldirectord.debian \ ldirectord/init.d/ldirectord.debian.default \ ldirectord/logrotate.d/Makefile \ ldirectord/OCF/Makefile \ ldirectord/OCF/ldirectord \ membership/Makefile \ membership/ccm/Makefile \ membership/quorumd/Makefile \ pkg/Makefile \ pkg/InfoFiles/pkginfo \ pkg/InfoFiles/preinstall \ pkg/InfoFiles/postinstall \ port/Makefile \ port/portMakefile \ port/heartbeat/pkg-deinstall \ port/heartbeat/pkg-descr \ port/heartbeat/pkg-install \ port/heartbeat/pkg-plist \ snmp_subagent/Makefile \ snmp_subagent/SNMPAgentSanityCheck \ cim/Makefile \ cim/mof/Makefile \ cim/mof/register_providers.sh \ cim/mof/unregister_providers.sh \ tsa_plugin/Makefile \ tsa_plugin/testrun.sh \ tsa_plugin/linuxha-adapter \ telecom/Makefile \ telecom/apphbd/Makefile \ telecom/recoverymgrd/Makefile \ fencing/Makefile \ fencing/stonithd/Makefile \ fencing/test/Makefile \ fencing/test/STONITHDBasicSanityCheck \ tools/Makefile \ tools/haresources2cib.py \ tools/ocf-tester \ resources/Makefile \ resources/OCF/Makefile \ resources/OCF/.ocf-binaries \ resources/OCF/.ocf-directories \ resources/OCF/.ocf-shellfuncs \ resources/OCF/ocf-returncodes \ resources/OCF/ocf-shellfuncs \ resources/heartbeat/Makefile \ resources/heartbeat/apache \ resources/heartbeat/AudibleAlarm \ resources/heartbeat/Delay \ resources/heartbeat/db2 \ resources/heartbeat/Filesystem \ resources/heartbeat/hto-mapfuncs \ resources/heartbeat/ids \ resources/heartbeat/ICP \ resources/heartbeat/IPaddr \ resources/heartbeat/IPaddr2 \ resources/heartbeat/IPsrcaddr \ resources/heartbeat/IPv6addr \ resources/heartbeat/LinuxSCSI \ resources/heartbeat/LVM \ resources/heartbeat/LVSSyncDaemonSwap \ resources/heartbeat/MailTo \ resources/heartbeat/OCF \ resources/heartbeat/portblock \ resources/heartbeat/Raid1 \ resources/heartbeat/ServeRAID \ resources/heartbeat/SendArp \ resources/heartbeat/WAS \ resources/heartbeat/WinPopup \ resources/heartbeat/Xinetd \ ) dnl Now process the entire list of files added by previous dnl calls to AC_CONFIG_FILES() AC_OUTPUT() dnl subpackages configuration - perhaps configure it properly some other time dnl when it has been discussed at linux-ha-dev dnl AC_CONFIG_SUBDIRS(stonith heartbeat) dnl ***************** dnl Configure summary dnl ***************** eval my_datadir="`eval echo ${datadir}`" eval my_includedir="`eval echo ${includedir}`" eval my_initdir="${INITDIR}" eval my_libdir="`eval echo ${libdir}`" eval my_localstatedir="`eval echo ${localstatedir}`" eval my_mandir="`eval echo ${mandir}`" eval my_sbindir="`eval echo ${sbindir}`" eval my_sysconfdir="`eval echo ${sysconfdir}`" AC_MSG_RESULT([]) AC_MSG_RESULT([$PACKAGE configuration:]) AC_MSG_RESULT([ Version = "$VERSION"]) AC_MSG_RESULT([ Executables = "$my_sbindir"]) AC_MSG_RESULT([ Man pages = "$my_mandir"]) AC_MSG_RESULT([ Libraries = "$my_libdir"]) AC_MSG_RESULT([ Header files = "$my_includedir"]) AC_MSG_RESULT([ Arch-independent files = "$my_datadir"]) AC_MSG_RESULT([ State information = "$my_localstatedir"]) AC_MSG_RESULT([ System configuration = "$my_sysconfdir"]) AC_MSG_RESULT([ Init (rc) scripts = "$my_initdir"]) AC_MSG_RESULT([ Use system LTDL = "${ac_cv_lib_ltdl_lt_dlopen}"]) AC_MSG_RESULT([ HA group name = "${HA_APIGROUP}"]) AC_MSG_RESULT([ HA group id = "${HA_APIGID}"]) AC_MSG_RESULT([ HA user name = "${HA_CCMUSER}"]) AC_MSG_RESULT([ HA user user id = "${HA_CCMUID}"]) AC_MSG_RESULT([ Build snmp subagent = "${enable_snmp_subagent}"]) if test "x${enable_snmp_subagent}" = "xyes"; then AC_MSG_RESULT([ SNMP MIB directory = "${MIBS_DIR}"]) AC_MSG_RESULT([ SNMP agent libraries = "${SNMPAGENTLIB}"]) fi AC_MSG_RESULT([ SNMP libraries = "${SNMPLIB}"]) AC_MSG_RESULT([ ucd_snmp_devel name = "${UCDSNMPDEVEL}"]) AC_MSG_RESULT([ Build New CRM = "${enable_crm}"]) AC_MSG_RESULT([ Build New LRM = "${enable_lrm}"]) AC_MSG_RESULT([ Build Ldirectord = "${enable_ldirectord}"]) +AC_MSG_RESULT([ Build IPMILan Plugin = "${enable_ipmilan}"]) AC_MSG_RESULT([ Build CIM providers = "${enable_cim_provider}"]) if test "x${enable_cim_provider}" = "xyes"; then AC_MSG_RESULT([ CIM server = "${CIMOM}"]) AC_MSG_RESULT([ CIM providers dir = "${CMPI_PROVIDER_DIR}"]) AC_MSG_RESULT([ CMPI header files = "${CMPI_HEADER_PATH}"]) fi AC_MSG_RESULT([ Build TSA plugin = "${enable_tsa_plugin}"]) if test "x${enable_tsa_plugin}" != "xno"; then AC_MSG_RESULT([ JAVA_HOME = "${JAVA_HOME}"]) AC_MSG_RESULT([ TSA_DIR = "${TSA_DIR}"]) fi AC_MSG_RESULT([ Build dopd plugin = "${enable_dopd}"]) AC_MSG_RESULT([ Enable times kludge = "${enable_times_kludge}"]) AC_SUBST(DISABLE_TIMES_KLUDGE) AC_MSG_RESULT([ CC_WARNINGS = "${CC_WARNINGS}"]) AC_MSG_RESULT([ Mangled CFLAGS = "${CFLAGS}"]) AC_MSG_RESULT([ Libraries = "${LIBS}"]) AC_MSG_RESULT([ RPATH enabled = "${enable_rpath}"]) AC_MSG_RESULT([ ]) AC_MSG_RESULT([Note: If you use the 'make install' method for installation you]) AC_MSG_RESULT([also need to adjust '/etc/passwd' and '/etc/group' manually.]) AC_MSG_RESULT([ ]) diff --git a/heartbeat/eDir88 b/heartbeat/eDir88 index f93b2f23e..dcc9e8422 100644 --- a/heartbeat/eDir88 +++ b/heartbeat/eDir88 @@ -1,438 +1,439 @@ #!/bin/sh # # eDirectory Resource Agent (RA) for Heartbeat. # This script is only compatible with eDirectory 8.8 and later # # Copyright (c) 2007 Novell Inc, Yan Fitterer # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Further, this software is distributed without any warranty that it is # free of the rightful claim of any third person regarding infringement # or the like. Any license provided herein, whether implied or # otherwise, applies only to this software file. Patent licenses, if # any, provided herein do not apply to combinations of this program with # other software, or any other product whatsoever. # # You should have received a copy of the GNU General Public License # along with this program; if not, write the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # # # OCF parameters: # OCF_RESKEY_eDir_config_file - full filename to instance configuration file # OCF_RESKEY_eDir_monitor_ldap - Should we monitor LDAP (0/1 - 1 is true) # OCF_RESKEY_eDir_monitor_idm - Should we monitor IDM (0/1 - 1 is true) # OCF_RESKEY_eDir_jvm_initial_heap - Value of the DHOST_INITIAL_HEAP java env var # OCF_RESKEY_eDir_jvm_max_heap - Value of the DHOST_MAX_HEAP java env var # OCF_RESKEY_eDir_jvm_options - Value of the DHOST_OPTIONS java env var ############################################################################### ####################################################################### # Initialization: . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs -. /opt/novell/eDirectory/bin/ndspath 2>/dev/null >/dev/null +test -f /opt/novell/eDirectory/bin/ndspath && + . /opt/novell/eDirectory/bin/ndspath 2>/dev/null >/dev/null ####################################################################### usage() { ME=$(basename "$0") cat <<-EOFA usage: $ME start|stop|status|monitor|validate-all $ME manages an eDirectory instance as an HA resource. The 'start' operation starts the instance. The 'stop' operation stops the instance. The 'status' operation reports if the instance is running. The 'monitor' operation reports if the instance is running, and runs additional checks. The 'validate-all' operation checks the validity of the arguments (environment variables). EOFA } eDir_meta_data() { cat <<-EOFB 1.0 Resource script for managing an eDirectory instance. Manages a single instance of eDirectory as an HA resource. The "multiple instances" feature or eDirectory has been added in version 8.8. This script will not work for any version of eDirectory prior to 8.8. This RA can be used to load multiple eDirectory instances on the same host. It is very strongly recommended to put eDir configuration files (as per the eDir_config_file parameter) on local storage on each node. This is necessary for this RA to be able to handle situations where the shared storage has become unavailable. If the eDir configuration file is not available, this RA will fail, and heartbeat will be unable to manage the resource. Side effects include STONITH actions, unmanageable resources, etc... Setting a high action timeout value is _very_ _strongly_ recommended. eDir with IDM can take in excess of 10 minutes to start. If heartbeat times out before eDir has had a chance to start properly, mayhem _WILL ENSUE_. The LDAP module seems to be one of the very last to start. So this script will take even longer to start on installations with IDM and LDAP if the monitoring of IDM and/or LDAP is enabled, as the start command will wait for IDM and LDAP to be available. eDirectory resource agent Path to configuration file for eDirectory instance. eDir config file Should we monitor if LDAP is running for the eDirectory instance? eDir monitor ldap Should we monitor if IDM is running for the eDirectory instance? eDir monitor IDM Value for the DHOST_INITIAL_HEAP java environment variable. If unset, java defaults will be used. DHOST_INITIAL_HEAP value Value for the DHOST_MAX_HEAP java environment variable. If unset, java defaults will be used. DHOST_MAX_HEAP value Value for the DHOST_OPTIONS java environment variable. If unset, original values will be used. DHOST_OPTIONS value EOFB return $OCF_SUCCESS } # # eDir_start: Start eDirectory instance # eDir_start() { if eDir_status ; then ocf_log info "eDirectory is already running ($NDSCONF)." return $OCF_SUCCESS fi # Start eDirectory instance if [ -n "$OCF_RESKEY_eDir_jvm_initial_heap" ]; then DHOST_JVM_INITIAL_HEAP=$OCF_RESKEY_eDir_jvm_initial_heap export DHOST_JVM_INITIAL_HEAP fi if [ -n "$OCF_RESKEY_eDir_jvm_max_heap" ]; then DHOST_JVM_MAX_HEAP=$OCF_RESKEY_eDir_jvm_max_heap export DHOST_JVM_MAX_HEAP fi if [ -n "$OCF_RESKEY_eDir_jvm_options" ]; then DHOST_JVM_OPTIONS=$OCF_RESKEY_eDir_jvm_options export DHOST_JVM_OPTIONS fi $NDSMANAGE start --config-file "$NDSCONF" > /dev/null 2>&1 if [ $? -eq 0 ]; then ocf_log info "eDir start command sent for $NDSCONF." else echo "ERROR: Can't start eDirectory for $NDSCONF." return $OCF_ERR_GENERIC fi CNT=0 while ! eDir_monitor ; do # Apparently, LDAP will only start after all other services # Startup time can be in excess of 10 minutes. # Leave a very long heartbeat timeout on the start action # We're relying on heartbeat to bail us out... let CNT=$CNT+1 ocf_log info "eDirectory start waiting for ${CNT}th retry for $NDSCONF." sleep 10 done ocf_log info "eDirectory start verified for $NDSCONF." return $OCF_SUCCESS } # # eDir_stop: Stop eDirectory instance # This action is written in such a way that even when run # on a node were things are broken (no binaries, no config # etc...) it will try to stop any running ndsd processes # and report success if none are running. # eDir_stop() { if ! eDir_status ; then return $OCF_SUCCESS fi $NDSMANAGE stop --config-file "$NDSCONF" >/dev/null 2>&1 if eDir_status ; then # eDir failed to stop. ocf_log err "eDirectory instance failed to stop for $NDSCONF" return $OCF_ERR_GENERIC else ocf_log info "eDirectory stop verified for $NDSCONF." return $OCF_SUCCESS fi } # # eDir_status: is eDirectory instance up ? # eDir_status() { if [ ! -r "$NDSCONF" ] ; then ocf_log err "Config file missing ($NDSCONF)." exit $OCF_ERR_GENERIC fi # Find how many ndsd processes have open listening sockets # with the IP of this eDir instance IFACE=$(grep -i "n4u.server.interfaces" $NDSCONF | cut -f2 -d= | tr '@' ':') if [ -z "$IFACE" ] ; then ocf_log err "Cannot retrieve interfaces from $NDSCONF. eDirectory may not be correctly configured." exit $OCF_ERR_GENERIC fi NDSD_SOCKS=$(netstat -ntlp | grep -ce "$IFACE.*ndsd") if [ "$NDSD_SOCKS" -eq 1 ] ; then # Correct ndsd instance is definitely running # Further checks are superfluous (I think...) return 0 elif [ "$NDSD_SOCKS" -gt 1 ] ; then ocf_log err "More than 1 ndsd listening socket matched. Likely misconfiguration of eDirectory." exit $OCF_ERR_GENERIC fi # No listening socket. Make sure we don't have the process running... PIDDIR=$(grep -i "n4u.server.vardir" "$NDSCONF" | cut -f2 -d=) if [ -z "$PIDDIR" ] ; then ocf_log err "Cannot get vardir from nds config ($NDSCONF). Probable eDir configuration error." exit $OCF_ERR_GENERIC fi NDSD_PID=$(cat $PIDDIR/ndsd.pid 2>/dev/null) if [ -z "$NDSD_PID" ] ; then # PID file unavailable or empty. # This will happen if the PIDDIR is not available # on this node at this time. return 1 fi RC=$(ps -p "$NDSD_PID" | grep -c ndsd) if [ "$RC" -gt 0 ] ; then # process found but no listening socket. ndsd likely not operational ocf_log err "ndsd process found, but no listening socket. Something's gone wrong ($NDSCONF)" exit $OCF_ERR_GENERIC fi # Instance is not running, but no other error detected. return 1 } # # eDir_monitor: Do more in-depth checks to ensure that eDirectory is fully functional # LDAP and IDM checks are only done if reqested. # # eDir_monitor() { if ! eDir_status ; then ocf_log info "eDirectory instance is down ($NDSCONF)" return $OCF_NOT_RUNNING fi # We know the right ndsd is running locally, check health $NDSSTAT --config-file "$NDSCONF" >/dev/null 2>&1 if [ $? -ne 0 ] ; then return 1 fi # Monitor IDM first, as it will start before LDAP if [ $MONITOR_IDM -eq 1 ]; then RET=$($NDSTRACE --config-file "$NDSCONF" -c modules | egrep -i '^vrdim.*Running' | awk '{print $1}') if [ "$RET" != "vrdim" ]; then ocf_log err "eDirectory IDM engine isn't running ($NDSCONF)." return $OCF_ERR_GENERIC fi fi if [ $MONITOR_LDAP -eq 1 ] ; then $NDSNLDAP -c --config-file "$NDSCONF" >/dev/null 2>&1 if [ $? -ne 0 ]; then ocf_log err "eDirectory LDAP server isn't running ($NDSCONF)." return $OCF_ERR_GENERIC fi fi ocf_log debug "eDirectory monitor success ($NDSCONF)" return $OCF_SUCCESS } # # eDir_validate: Validate environment # eDir_validate() { declare rc=$OCF_SUCCESS # Script must be run as root if ! ocf_is_root ; then ocf_log err "$0 must be run as root" rc=$OCF_ERR_GENERIC fi # ndsmanage must be available and runnable check_binary $NDSMANAGE # ndsstat must be available and runnable check_binary $NDSSTAT # Config file must be readable if [ ! -r "$NDSCONF" ] ; then ocf_log err "eDirectory configuration file [$NDSCONF] is not readable" rc=$OCF_ERR_ARGS fi # monitor_ldap must be unambiguously resolvable to a truth value MONITOR_LDAP=$(echo "$MONITOR_LDAP" | tr [A-Z] [a-z]) case "$MONITOR_LDAP" in yes|true|1) MONITOR_LDAP=1;; no|false|0) MONITOR_LDAP=0;; *) ocf_log err "Configuration parameter eDir_monitor_ldap has invalid value [$MONITOR_LDAP]" rc=$OCF_ERR_ARGS;; esac # monitor_idm must be unambiguously resolvable to a truth value MONITOR_IDM=$(echo "$MONITOR_IDM" | tr [A-Z] [a-z]) case "$MONITOR_IDM" in yes|true|1) MONITOR_IDM=1;; no|false|0) MONITOR_IDM=0;; *) ocf_log err "Configuration parameter eDir_monitor_idm has invalid value [$MONITOR_IDM]" rc=$OCF_ERR_ARGS;; esac # eDir_jvm_initial_heap must be blank or numeric if [ -n "$OCF_RESKEY_eDir_jvm_initial_heap" ] ; then if ! ocf_is_decimal "$OCF_RESKEY_eDir_jvm_initial_heap" ; then ocf_log err "Configuration parameter eDir_jvm_initial_heap has invalid" \ "value [$OCF_RESKEY_eDir_jvm_initial_heap]" rc=$OCF_ERR_ARGS fi fi # eDir_jvm_max_heap must be blank or numeric if [ -n "$OCF_RESKEY_eDir_jvm_max_heap" ] ; then if ! ocf_is_decimal "$OCF_RESKEY_eDir_jvm_max_heap" ; then ocf_log err "Configuration parameter eDir_jvm_max_heap has invalid" \ "value [$OCF_RESKEY_eDir_jvm_max_heap]" rc=$OCF_ERR_ARGS fi fi if [ $rc -ne $OCF_SUCCESS ] ; then ocf_log err "Invalid environment" fi return $rc } # # Start of main logic # ocf_log debug "$0 started with arguments \"$@\"" NDSBASE=/opt/novell/eDirectory NDSNLDAP=$NDSBASE/sbin/nldap NDSMANAGE=$NDSBASE/bin/ndsmanage NDSSTAT=$NDSBASE/bin/ndsstat NDSTRACE=$NDSBASE/bin/ndstrace NDSCONF=${OCF_RESKEY_eDir_config_file:-/etc/opt/novell/eDirectory/conf/nds.conf} MONITOR_LDAP=${OCF_RESKEY_eDir_monitor_ldap:-0} MONITOR_IDM=${OCF_RESKEY_eDir_monitor_idm:-0} # What kind of method was invoked? case "$1" in validate-all) eDir_validate; exit $?;; meta-data) eDir_meta_data; exit $OCF_SUCCESS;; status) if eDir_status ; then ocf_log info "eDirectory instance is up ($NDSCONF)" exit $OCF_SUCCESS else ocf_log info "eDirectory instance is down ($NDSCONF)" exit $OCF_NOT_RUNNING fi;; start) : skip;; stop) : skip;; monitor) : skip;; usage) usage; exit $OCF_SUCCESS;; *) ocf_log err "Invalid argument [$1]" usage; exit $OCF_ERR_ARGS;; esac # From now on we must have a valid environment to continue. # stop goes in the list above as it should ideally be able to # clean up after a start that failed due to bad args eDir_validate RC=$? if [ $RC -ne $OCF_SUCCESS ]; then exit $RC fi case "$1" in start) eDir_start;; stop) eDir_stop;; monitor) eDir_monitor;; esac exit $? diff --git a/heartbeat/ids b/heartbeat/ids index 88613f4a6..ce1496720 100644 --- a/heartbeat/ids +++ b/heartbeat/ids @@ -1,716 +1,736 @@ #!/bin/sh # # # ids # # Description: -# OCF resource agent that manages an -# IBM Informix Dynamic Server (IDS) instance -# as an High-Availability resource. # +# OCF resource agent that manages an +# IBM Informix Dynamic Server (IDS) instance +# as an High-Availability resource. +#### # -# Author: Lars D. Forseth, or -# Created: May 25th 2007 -# Modified: June 18th 2007 -# Support: linux-ha@lists.linux-ha.org -# License: GNU General Public License (GPL) -# Copyright: (C) 2002 - 2007 International Business Machines, Inc. +# Author: Lars D. Forseth, or +# Created: May 25th 2007 +# Last Modified: July 30th 2007 +# Support: linux-ha@lists.linux-ha.org +# License: GNU General Public License (GPL), Version 2 or later +# Copyright: (c) 2002 - 2007 International Business Machines, Inc. # -# This code inspired by the db2 OCF resource agent -# written by Alan Robertson, +# This code is inspired by the db2 OCF resource agent +# written by Alan Robertson, +#### # +# 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 would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. +#### # # Example usage as it would appear in /etc/ha.d/haresources: # node1 192.168.0.1 ids::/informix::ids1::onconfig.ids1 # +# # --> Note that passing dbname and sqltestquery in heartbeat version 1 style is not supported! # # See usage() function below for more details... -# +#### # # OCF instance parameters: # OCF_RESKEY_informixdir # OCF_RESKEY_informixserver # OCF_RESKEY_onconfig # OCF_RESKEY_dbname # OCF_RESKEY_sqltestquery +#### # -# Include general OCF functions and variables (such as OCF returncodes). +# Include general OCF functions and variables (such as OCF return codes). # . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs # # Function that displays the usage of this script. # ids_usage() { methods=`ids_methods` methods=`echo $methods | tr ' ' '|'` echo " usage: $0 ($methods) $0 manages an IBM Informix Dynamic Server (IDS) instance as an High-Availability resource. The 'start' operation starts the database. The 'stop' operation stops the database. The 'status' operation reports whether the database is running The 'monitor' operation reports whether the database seems to be working The 'validate-all' operation reports whether the parameters are valid The 'methods' operation lists the methods $0 supports The 'usage' operation displays this text The 'meta-data' operation returns the meta-data (in XML) of this resource script " } # -# Function that displays the possible methods (= commands) this script supports +# Function that displays the possible methods this script supports. # ids_methods() { echo " start stop status monitor validate-all methods usage meta-data " } # -# Function that displays the meta-data of this ids OCF resource agent +# Function that displays the meta-data of this OCF resource agent. # ids_meta_data() { cat <<-! 1.0 -OCF resource agent that manages an IBM Informix Dynamic Server (IDS) instance as an High-Availability resource. +OCF resource agent to manage an IBM Informix Dynamic Server (IDS) instance as an High-Availability resource. -ids resource agent for IBM Informix +OCF resource agent for the IBM's database server called Informix Dynamic Server (IDS) The value the environment variable INFORMIXDIR has after a typical installation of IDS. Or in other words: the path (without trailing '/') where IDS was installed to. -If this parameter is unspecified the script will try to get the value from the shell environment, -otherwise the script will use its three optional parameters to set the environment variables IDS needs by itself. +If this parameter is unspecified the script will try to get the value from the shell environment. INFORMIXDIR environment variable The value the environment variable INFORMIXSERVER has after a typical installation of IDS. -Or in other words: the name of the IDS server instance that should be managed. -If this parameter is unspecified the script will try to get the value from the shell environment, -otherwise the script will use its three optional parameters to set the environment variables IDS needs by itself. +Or in other words: the name of the IDS server instance to manage. +If this parameter is unspecified the script will try to get the value from the shell environment. INFORMIXSERVER environment variable The value the environment variable ONCONFIG has after a typical installation of IDS. -Or in other words: the name of the configuration file for the IDS instance defined by INFORMIXSERVER. -The named configuration file will be searched at '$INFORMIXDIR/etc/$ONCONFIG'. -If this parameter is unspecified the script will try to get the value from the shell environment, -otherwise the script will use its three optional parameters to set the environment variables IDS needs by itself. +Or in other words: the name of the configuration file for the IDS instance specified in INFORMIXSERVER. +The specified configuration file will be searched at '$INFORMIXDIR/etc/$ONCONFIG'. +If this parameter is unspecified the script will try to get the value from the shell environment. ONCONFIG environment variable This parameter defines which database to use in order to monitor the IDS instance. -If this parameter is unspecified the script will use the "sysmaster" database as a default. +If this parameter is unspecified the script will use the 'sysmaster' database as a default. -database to use for monitoring, defaults to "sysmaster" +database to use for monitoring, defaults to 'sysmaster' -SQL test query to run on the database specified by the parameter "dbname" +SQL test query to run on the database specified by the parameter 'dbname' in order to monitor the IDS instance and determine if it's functional or not. -If this parameter is unspecified the script will use "SELECT COUNT(*) FROM systables;" as a default. +If this parameter is unspecified the script will use 'SELECT COUNT(*) FROM systables;' as a default. -SQL test query to use for monitoring, defaults to "SELECT COUNT(*) FROM systables;" +SQL test query to use for monitoring, defaults to 'SELECT COUNT(*) FROM systables;' ! } # # Function that either forwards log messages to the ocf_log function # provided by heartbeat or simply prints them to standard out via echo. -# The setting of the variable "idslogger" determines this by checking -# for the values "echo" or "ocf" (default). +# This is determined by setting the variable "idslogger" to "echo" or "ocf". +# The default for "idslogger" is "ocf". # ids_log() { # Where should the passed log messages be passed to, # to the standard output via the echo command ("echo") # or to the ocf_log function provided by heartbeat ("ocf") ? - # Default is "ocf" + # Default is "ocf". idslogger="ocf" # When the variable "idsdebug" is not set to "true" # this function (ids_log) will not print any info message # that has been forwarded to it! - # This is done like this in order so spare if-statements - # within the other functions and to centralize the decision + # This is done in order to spare if-statements within the + # other functions in this script and to centralize the decision # whether to have a chatty resource script or not... ;) # Nevertheless, error messages will always be printed! idsdebug=false - # only continue if the two expected parameters + # Only continue if the two expected parameters # are not empty and "idsdebug" is set to "true" - # or the message is of type "error" + # or the message is of type "error". if [ $# -eq 2 -a -n "$1" -a -n "$2" ]; then if [ "$idsdebug" = "true" -o "$1" = "error" ]; then case $idslogger in - # print messages to stdout via echo command + # Print messages to stdout via echo command. echo) echo "`date +'%b %d %H:%M:%S'`: [$1] $2";; - # pass messages to ocf_log function + # Pass messages to ocf_log function. ocf|*) ocf_log "$1" "$2";; esac fi fi } # # Function that prints the current values of important environment variables -# needed by the script and the IDS instance itself. The variables hereby are: +# needed by the script and the IDS instance itself. The just mentioned variables are: # - INFORMIXDIR # - INFORMIXSERVER # - ONCONFIG # - PATH # - LD_LIBRARY_PATH # ids_debug() { ids_log info "called ids_debug" ids_log info "INFORMIXDIR=$INFORMIXDIR" ids_log info "OCF_RESKEY_informixdir=$OCF_RESKEY_informixdir" ids_log info "INFORMIXSERVER=$INFORMIXSERVER" ids_log info "OCF_RESKEY_informixserver=$OCF_RESKEY_informixserver" ids_log info "ONCONFIG=$ONCONFIG" ids_log info "OCF_RESKEY_onconfig=$OCF_RESKEY_onconfig" ids_log info "PATH=$PATH" ids_log info "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" ids_log info "dbname=$OCF_RESKEY_dbname" ids_log info "sqltestquery=$OCF_RESKEY_sqltestquery" ids_log info "this script is run as user: `id`" ids_log info "...in the current working directory: `pwd`" } # # Function that validates if the passed parameters are valid and sets them if valid. # If the first three parameters have not been passed, -# this function checks whether they have been already set in the parent shell. +# this function checks whether they have been already set in the parent's shell environment. # The variables that are checked and set (only the capitalized ones are set) are: # - INFORMIXDIR # - INFORMIXSERVER # - ONCONFIG # - PATH # - LD_LIBRARY_PATH # - dbname # - sqltestquery # ids_validate() { ids_log info "called ids_validate" rc=$OCF_SUCCESS - # check if INFORMIX, INFORMIXSERVER and ONCONFIG - # have been passed or set and validate them + # Check if INFORMIX, INFORMIXSERVER and ONCONFIG + # have been passed or set and validate them. - # OCF vars not passed, vars empty - set and export them to shell + # OCF vars not passed, vars empty - set and export them to the shell environment. if [ -n "$OCF_RESKEY_informixdir" -a -n "$OCF_RESKEY_informixserver" -a -n "$OCF_RESKEY_onconfig" ]; then ids_log info "ids_validate: passed vars not empty" INFORMIXDIR=$OCF_RESKEY_informixdir export INFORMIXDIR INFORMIXSERVER=$OCF_RESKEY_informixserver export INFORMIXSERVER ONCONFIG=$OCF_RESKEY_onconfig export ONCONFIG fi - # check if INFORMIXDIR is non-empty and a dir (and if there was an error so far) + # Check if INFORMIXDIR is non-empty and a directory (and if there was an error so far). if [ $rc -eq $OCF_SUCCESS -a -n "$INFORMIXDIR" -a -d "$INFORMIXDIR" ]; then ids_log info "ids_validate: INFORMIXDIR is valid: $INFORMIXDIR" rc=$OCF_SUCCESS else ids_log error "ids_validate: INFORMIXDIR is invalid: $INFORMIXDIR" rc=$OCF_ERR_ARGS fi - # check if INFORMIXSERVER is non-empty (and if there was an error so far) + # Check if INFORMIXSERVER is non-empty (and if there was an error so far). if [ $rc -eq $OCF_SUCCESS -a -n "$INFORMIXSERVER" ]; then ids_log info "ids_validate: INFORMIXSERVER is valid: $INFORMIXSERVER" rc=$OCF_SUCCESS else ids_log error "ids_validate: INFORMIXSERVER is invalid: $INFORMIXSERVER" rc=$OCF_ERR_ARGS fi - # check if ONCONFIG is non-empty and a non-empty file (and if there was an error so far) + # Check if ONCONFIG is non-empty and a non-empty file (and if there was an error so far). if [ $rc -eq $OCF_SUCCESS -a -n "$ONCONFIG" -a -s "$INFORMIXDIR/etc/$ONCONFIG" ]; then ids_log info "ids_validate: ONCONFIG is a non-empty file in: \$INFORMIXDIR/etc/\$ONCONFIG where ONCONFIG=$ONCONFIG" rc=$OCF_SUCCESS else if [ -z "$ONCONFIG" -a -s "$INFORMIXDIR/etc/onconfig" ]; then ONCONFIG="onconfig" export ONCONFIG ids_log info "ids_validate: ONCONFIG is a non-empty file in: \$INFORMIXDIR/etc/\$ONCONFIG where ONCONFIG=$ONCONFIG" rc=$OCF_SUCCESS else if [ -z "$ONCONFIG" -a -s "$INFORMIXDIR/etc/onconfig.std" ]; then ONCONFIG="onconfig.std" export ONCONFIG ids_log info "ids_validate: ONCONFIG is a non-empty file in: \$INFORMIXDIR/etc/\$ONCONFIG where ONCONFIG=$ONCONFIG" rc=$OCF_SUCCESS else ids_log error "ids_validate: ONCONFIG is invalid, searched for it in: \$INFORMIXDIR/etc/\$ONCONFIG where ONCONFIG=$ONCONFIG" rc=$OCF_ERR_ARGS fi fi fi - # check if the commands oninit, onstat and dbaccess exist in INFORMIXDIR/bin/ - # and whether they are executable (do this only if there wasn't an error so far) - if [ $rc -eq $OCF_SUCCESS -a -x "$INFORMIXDIR/bin/oninit" -a \ - -x "$INFORMIXDIR/bin/onstat" -a -x "$INFORMIXDIR/bin/onmode" -a \ - -x "$INFORMIXDIR/bin/dbaccess" ]; then + # Check if the commands oninit, onstat, onmode and dbaccess exist in INFORMIXDIR/bin/ + # and whether they are executable (do this only if there wasn't an error so far). + if [ $rc -eq $OCF_SUCCESS -a -x "$INFORMIXDIR/bin/oninit" -a -x "$INFORMIXDIR/bin/onstat" -a -x "$INFORMIXDIR/bin/onmode" -a -x "$INFORMIXDIR/bin/dbaccess" ]; then ids_log info "ids_validate: oninit, onstat and dbaccess exist and are executable in: \$INFORMIXDIR/bin/" rc=$OCF_SUCCESS else ids_log error "ids_validate: oninit, onstat or dbacces don't exist or they are not executable in: \$INFORMIXDIR/bin/" rc=$OCF_ERR_PERM fi - # extend PATH and LD_LIBRARY_PATH as needed for the IDS instance to run properly + # Extend PATH and LD_LIBRARY_PATH as needed for the IDS instance to run properly # BUT: only do this if it hasn't been done before! Otherwise PATH and LD_LIBRARY_PATH will - # keep on growing every time heartbeat calls the ids resource agent script! ;) + # keep on growing every time heartbeat calls the IDS resource agent script! ;) echo $PATH | grep $INFORMIXDIR > /dev/null 2>&1 inpath=$? if [ $rc -eq $OCF_SUCCESS -a $inpath -ne 0 ]; then PATH="${INFORMIXDIR}/bin":${PATH} export PATH ids_log info "ids_validate: PATH did not contain INFORMIXDIR, added \$INFORMIXDIR/bin" else ids_log info "ids_validate: INFORMIXDIR already in PATH, where PATH=$PATH" fi echo $LD_LIBRARY_PATH | grep $INFORMIXDIR > /dev/null 2>&1 inldlibpath=$? if [ $rc -eq $OCF_SUCCESS -a $inldlibpath -ne 0 ]; then LD_LIBRARY_PATH="${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql" export LD_LIBRARY_PATH ids_log info "ids_validate: LD_LIBRARY_PATH did not contain INFORMIXDIR, added \$INFORMIXDIR/lib and \$INFORMIXDIR/lib/esql, added them" else ids_log info "ids_validate: INFORMIXDIR already in LD_LIBRARY_PATH, where LD_LIBRARY_PATH=$LD_LIBRARY_PATH" fi - # check if dbname is empty (and if there was an error so far) - # if it is empty, assign default + # Check if dbname is empty (and if there was an error so far) + # if it is empty, assign default. if [ $rc -eq $OCF_SUCCESS -a -n "$OCF_RESKEY_dbname" ]; then ids_log info "ids_validate: dbname is valid: $OCF_RESKEY_dbname" rc=$OCF_SUCCESS else ids_log info "ids_validate: dbname is invalid: $OCF_RESKEY_dbname" ids_log info "ids_validate: using 'sysmaster' as default..." OCF_RESKEY_dbname="sysmaster" export OCF_RESKEY_dbname rc=$OCF_SUCCESS fi - # check if sqltestquery is empty (and if there was an error so far) - # if it is empty, assign default + # Check if sqltestquery is empty (and if there was an error so far) + # if it is empty, assign default. if [ $rc -eq $OCF_SUCCESS -a -n "$OCF_RESKEY_sqltestquery" ]; then ids_log info "ids_validate: sqltestquery is valid: $OCF_RESKEY_sqltestquery" rc=$OCF_SUCCESS else ids_log info "ids_validate: sqltestquery is invalid: $OCF_RESKEY_sqltestquery" ids_log info "ids_validate: using 'SELECT COUNT(*) FROM systables;' as default..." OCF_RESKEY_sqltestquery="SELECT COUNT(*) FROM systables;" export OCF_RESKEY_sqltestquery rc=$OCF_SUCCESS fi - # return exit status code to caller + # Return exit status code. return $rc } # # Function that start the IDS instance and reports any error that -# may occur while starting +# may occur while starting. # ids_start() { ids_log info "called ids_start" - # get current status of IDS instance + # Get current status of IDS instance. ids_status stat=$? case $stat in - # IDS instance already running - exit with success + # IDS instance already running - exit with success. $OCF_SUCCESS) ids_log info "ids_start: IDS instance already running: $stat" rc=$OCF_SUCCESS;; - # IDS instance in undefined state - exit with error + # IDS instance in undefined state - exit with error. $OCF_ERR_GENERIC) ids_log error "ids_start: IDS instance in undefined state: $stat" ids_debug rc=$OCF_ERR_GENERIC;; - # IDS instance not running - try to start it + # IDS instance not running - try to start it. $OCF_NOT_RUNNING) ids_log info "ids_start: executing 'oninit' now..." oninit stat=$? ids_log info "ids_start: done executing 'oninit': $stat" - # oninit terminated successfully - check new state of IDS instance + # The oninit command terminated successfully - check new state of IDS instance. if [ $stat -eq 0 ]; then - # initialize stat with failure exit status code + # Initialize stat with failure exit status code. stat=$OCF_ERR_GENERIC - # endless loop that waits until IDS is completely online - # if IDS takes too long to achieve this or even hangs + # Endless loop that waits until IDS is completely online. + # If IDS takes too long to achieve this or even hangs, # the timeout settings of heartbeat will cancel the starting - # of the ids resource and therefore terminate the loop + # of the IDS resource and therefore terminate the loop. while [ $stat -ne $OCF_SUCCESS ]; do ids_status stat=$? done - # new state is running now - success + # IDS is running now - success. ids_log info "ids_start: IDS instance successfully started: $stat" rc=$OCF_SUCCESS - # oninit terminated with an error - starting IDS resource failed! + # The oninit command terminated with an error - starting the IDS resource failed! else ids_log error "ids_start: starting IDS instance failed: $stat" ids_debug rc=$OCF_ERR_GENERIC fi ;; - # unexpected state - return OCF_ERR_UNIMPLEMENTED error + # Unexpected state - return OCF_ERR_UNIMPLEMENTED error. *) ids_log error "ids_start: unexpected state returned from ids_status: $stat" ids_debug rc=$OCF_ERR_UNIMPLEMENTED;; esac - # return exit status code to caller + # Return exit status code. return $rc } # # Function that stops the IDS instance and reports any error that -# may occur while stopping +# may occur while stopping. # ids_stop() { ids_log info "caled ids_stop" ids_status stat=$? case $stat in - # IDS instance not running - success stopping it + # IDS instance is not running - success stopping it. $OCF_NOT_RUNNING) ids_log info "ids_stop: IDS instance is not running: $stat" rc=$OCF_SUCCESS;; - # IDS instance in undefined state - exit with error + # IDS instance is in an undefined state - exit with error. $OCF_ERR_GENERIC) ids_log error "ids_stop: IDS instance in undefined state: $stat" ids_debug rc=$OCF_ERR_GENERIC;; - # IDS instance is running - try to stop it + # IDS instance is running - try to stop it. $OCF_SUCCESS) ids_log info "ids_stop: running 'onmode -kuy' now..." onmode -kuy stat=$? ids_log info "ids_stop: done running 'onmode -kuy' now: $stat" - # onmode terminated successfully - check new state of IDS instance + # The onmode command terminated successfully - check new state of the IDS instance. if [ $stat -eq 0 ]; then ids_status stat=$? - # new state is: not running - success + # New state is: not running - success. if [ $stat -eq $OCF_NOT_RUNNING ]; then ids_log info "ids_stop: IDS instance successfully stopped: $stat" rc=$OCF_SUCCESS - # new state is: running or even undefined - failure! + # New state is: running or even undefined - failure! else ids_log error "ids_stop: stopping IDS instance failed: $stat" ids_debug rc=$OCF_ERR_GENERIC fi - # onmode terminated with an error - stopping IDS resource failed! + # The onmode command terminated with an error - stopping the IDS resource failed! else ids_log error "ids_stop: stopping IDS instance (by executing 'onmode -kuy') failed: $stat" ids_debug rc=$OCF_ERR_GENERIC fi ;; - # unexpected state - return OCF_ERR_UNIMPLEMENTED error + # Unexpected state - return OCF_ERR_UNIMPLEMENTED error. *) ids_log error "ids_stop: unexpected state returned from ids_status: $stat" ids_debug rc=$OCF_ERR_UNIMPLEMENTED;; esac - # return exit status code to caller (whether IDS was successfully stopped or not) + # Return exit status code indicating whether IDS was successfully stopped or not. return $rc } # -# Function that determines the current status of the IDS instance, -# meaning whether it is running (output of "onstat -" contains "On-Line"), -# not running (output of "onstat -" contains "shared memory not initialized") -# or in an undefined state (output of "onstat -" contains "Quiescent", "Single-User", or other). -# If the instance is declared running, the exit status code will indicate succes otherwise failure. +# Function that determines the current status/state of the IDS instance, +# meaning whether it is running (the case when output of "onstat -" contains "On-Line"), +# not running (the case when output of "onstat -" contains "shared memory not initialized") +# or in an undefined state (the case output of "onstat -" contains "Quiescent", "Single-User", or other). +# If the IDS instance is declared running the exit status code will indicate succes, otherwise failure of course. # ids_status() { ids_log info "called ids_status" - # get current status from the onstat tool and store it + # Get current status from the onstat tool and store it. stat=`onstat -` case $stat in - # IDS instance is running + # IDS instance is running. *"On-Line"*) ids_log info "ids_status: IDS instance running: $stat" rc=$OCF_SUCCESS;; - # IDS instance is not running + # IDS instance is not running. *"shared memory not initialized"*) ids_log info "ids_status: IDS instance not running: $stat" rc=$OCF_NOT_RUNNING;; - # IDS instance is undefined + # IDS instance is in an undefined state! *) ids_log error "ids_status: IDS instance status undefined: $stat" rc=$OCF_ERR_GENERIC;; esac - # return exit status code (ergo current status of the IDS instance) to caller + # Return exit status code (ergo current status of the IDS instance) to caller return $rc } # -# Function that monitors the current status and funtionality of the IDS instance. -# First the state of the instance is determined, if it is running a sql test query is +# Function that monitors the current status _and_ funtionality of the IDS instance. +# First the state of the instance is determined. If it is running, a sql test query is # executed on the database. If the sql test query executes sucessfully, the instance's # status is rechecked and if it is still running, the script terminates with an exit # status code indicating success. If any of the above described steps fails, # the script terminates with an error. # ids_monitor() { ids_log info "called ids_monitor" ids_status stat=$? case $stat in - # IDS instance not running - monitoring failed + # IDS instance is not running - monitoring failed. $OCF_NOT_RUNNING) ids_log info "ids_monitor: IDS instance is not running: $stat" rc=$OCF_NOT_RUNNING;; - # IDS instance in undefined state - exit with error + # IDS instance in an undefined state - exit with error. $OCF_ERR_GENERIC) ids_log error "ids_monitor: IDS instance in undefined state: $stat" ids_debug rc=$OCF_ERR_GENERIC;; - # IDS instance is running - try to execute sql test query and recheck state + # IDS instance is running - try to execute the sql test query and recheck state. $OCF_SUCCESS) ids_log info "ids_monitor: IDS instance is running (before executing sql test query)" ids_log info "ids_monitor: running sql test query now..." echo $OCF_RESKEY_sqltestquery | dbaccess $OCF_RESKEY_dbname - > /dev/null 2>&1 stat=$? ids_log info "ids_monitor: done running sql test query now: $stat" - # sql test query terminated successfully - check new state of IDS instance + # The sql test query terminated successfully - check the new state of the IDS instance. if [ $stat -eq 0 ]; then ids_status stat=$? - # new state is: running - success + # New state is: running - success. if [ $stat -eq $OCF_SUCCESS ]; then ids_log info "ids_monitor: successfully ran sql test query on IDS instance: $stat" rc=$OCF_SUCCESS - # new state is: not running or even undefined - failure! + # New state is: not running or even undefined - failure! else ids_log error "ids_monitor: running sql test query on IDS instance failed: $stat" ids_debug rc=$OCF_ERR_GENERIC fi - # sql test query terminated with an error - exit with error + # The sql test query terminated with an error - exit with error! else ids_log error "ids_monitor: running sql test query on IDS instance failed: $stat" ids_debug rc=$OCF_ERR_GENERIC fi ;; - # unexpected state - return OCF_ERR_UNIMPLEMENTED error + # Unexpected state - return OCF_ERR_UNIMPLEMENTED error! *) ids_log error "ids_monitor: unexpected state returned from ids_status: $stat" ids_debug rc=$OCF_ERR_UNIMPLEMENTED;; esac - # return exit status code to caller (whether IDS was successfully stopped or not) + # Return exit status code indicating whether IDS is running and functional or not. return $rc } ### # -# main section +# M A I N S E C T I O N # ### -# validate configuration (parameters and such) -# of this ids resource agent script and only process -# command if configuration is valid! Otherwise exit with OCF_ERR_ARGS error code. -# exception: when command is "validate-all" +# Validate configuration (parameters and such) +# passed to this script and only process the method parameter +# if the configuration is valid! Otherwise exit with OCF_ERR_ARGS error code. -# only check configuration when given command is not "validate-all" +# Only check configuration when given method is not "validate-all", # as in case of "validate-all" the configuration will be checked anyway! ;) if [ "$1" != "validate-all" ]; then ids_validate valid=$? ids_log info "main section: validated ids RA configuration, result: $valid" - # configuration invalid - terminate with error message + # Configuration invalid - terminate with error message. if [ $valid -ne $OCF_SUCCESS ]; then ids_log error "main section: terminating script due to invalid configuration" ids_debug exit $OCF_ERR_ARGS fi fi -# configuration valid or "validate-all" was requested - react depending on called method +# Configuration valid or method equals to "validate-all" - react depending on called method. case "$1" in start) ids_start exit $?;; stop) ids_stop exit $?;; status) ids_status exit $?;; monitor) ids_monitor exit $?;; validate-all) ids_validate exit $?;; methods) ids_methods exit $?;; usage) ids_usage exit $?;; meta-data) ids_meta_data exit $?;; *) ids_log error "mainsection: no or invalid command supplied: $1" exit $OCF_ERR_UNIMPLEMENTED;; esac +###############################################################################