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 <curses.h>
#elif defined(HAVE_NCURSES_H)
# include <ncurses.h>
#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"
# 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"