--- a/configure.ac 2019-03-30 12:47:15.935627522 +0000 +++ b/configure.ac 2019-03-30 12:47:55.590028792 +0000 @@ -272,8 +272,7 @@ AC_ARG_ENABLE(Werror, [AS_HELP_STRING([--enable-Werror], [compile with warnings being errors])]) AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), - [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])]) # Set the kernel headers path if test -n "$kernel_src_path"; then @@ -551,7 +550,7 @@ do eval $LOCAL_WARN_VAR=yes add_to_var([KA_CFLAGS], [-W$WARN]) AC_DEFINE_UNQUOTED([$WARN_VAR], [ 1 ]) - AS_IF([test -z $WARN_VAR_SHORT], [], + AS_IF([test -z "$WARN_VAR_SHORT"], [], [AC_DEFINE_UNQUOTED([$WARN_VAR_SHORT], [ 1 ])] ) ], @@ -2451,41 +2450,39 @@ AM_CONDITIONAL([RPM_BIP], [test $RPM_NO_ dnl ----[ Determine system init type]---- INIT_TYPE= -if test -z $init_type; then +AS_IF( + [test -n "$init_type"], [INIT_TYPE=$init_type], + [test -n "$with_systemdsystemunitdir"], [INIT_TYPE=systemd], + [ /sbin/init --version 2>/dev/null | grep -q upstart - if test $? -eq 0; then - INIT_TYPE=upstart - else + AS_IF( + [test $? -eq 0], [INIT_TYPE=upstart], + [ init_path=`which systemctl 2>/dev/null` - if test \( $? -eq 0 -a -x "$init_path" \); then + AS_IF([test \( $? -eq 0 -a -x "$init_path" \)], + [ systemctl | grep -q -- "-\.mount" - if test $? -eq 0; then - INIT_TYPE=systemd - fi - fi - if test \( -z "$INIT_TYPE" -a -f /etc/init.d/networking \); then + AS_IF([test $? -eq 0], [INIT_TYPE=systemd]) + ]) + AS_IF([test \( -z "$INIT_TYPE" -a -f /etc/init.d/networking \)], + [ init_path=`which openrc-run 2>/dev/null` - if test \( $? -eq 0 -a -x "$init_path" \); then + AS_IF([test \( $? -eq 0 -a -x "$init_path" \)], + [ head -1 /etc/init.d/networking | grep -q "^#! */.*/openrc-run$" - if test $? -eq 0; then - INIT_TYPE=openrc - fi - fi - fi - if test \( -z "$INIT_TYPE" -a -f /etc/init.d/cron -a ! -h /etc/init.d/cron \); then - INIT_TYPE=SYSV - fi - fi -else - INIT_TYPE=$init_type -fi + AS_IF([test $? -eq 0], [INIT_TYPE=openrc]) + ]) + ]) + AS_IF([test \( -z "$INIT_TYPE" -a -f /etc/init.d/cron -a ! -h /etc/init.d/cron \)], [INIT_TYPE=SYSV]) + ]) + ]) +AS_IF([test \( .$INIT_TYPE = .systemd -a -z "$with_systemdsystemunitdir" \)], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) dnl ----[Default keepalived configuration file]---- AS_IF([test $default_config_file], [ AS_IF([test $default_config_file = yes -o $default_config_file = no], - AC_MSG_ERROR([A filename must be specified for default-config-file]) - ]) + [AC_MSG_ERROR([A filename must be specified for default-config-file])]) CONFIG_FILE=$default_config_file add_config_opt([DEFAULT_CONFIG_FILE=${default_config_file}]) ], @@ -2493,7 +2490,7 @@ AS_IF([test $default_config_file], AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_FILE], ["$default_config_file"], [The default configuration file]) AC_SUBST([DEFAULT_CONFIG_FILE], [$default_config_file]) -if test -z $INIT_TYPE; then +if test -z "$INIT_TYPE"; then INIT_TYPE=undetected elif test $INIT_TYPE = systemd; then AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) --- a/configure 2019-03-30 12:47:25.313485929 +0000 +++ b/configure 2019-03-30 12:48:08.009841269 +0000 @@ -1631,7 +1631,7 @@ Optional Packages: --with-default-config-file=FILE Default configuration file --with-systemdsystemunitdir=DIR - Directory for systemd service files + Directory for systemd service files] Some influential environment variables: PKG_CONFIG path to pkg-config utility @@ -3858,8 +3858,6 @@ fi # Check whether --with-systemdsystemunitdir was given. if test "${with_systemdsystemunitdir+set}" = set; then : withval=$with_systemdsystemunitdir; -else - with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) fi @@ -5931,7 +5929,7 @@ $as_echo "yes" >&6; } #define $WARN_VAR 1 _ACEOF - if test -z $WARN_VAR_SHORT; then : + if test -z "$WARN_VAR_SHORT"; then : else cat >>confdefs.h <<_ACEOF @@ -12520,44 +12518,58 @@ fi INIT_TYPE= -if test -z $init_type; then +if test -n "$init_type"; then : + INIT_TYPE=$init_type +elif test -n "$with_systemdsystemunitdir"; then : + INIT_TYPE=systemd +else + /sbin/init --version 2>/dev/null | grep -q upstart - if test $? -eq 0; then + if test $? -eq 0; then : INIT_TYPE=upstart - else +else + init_path=`which systemctl 2>/dev/null` - if test \( $? -eq 0 -a -x "$init_path" \); then + if test \( $? -eq 0 -a -x "$init_path" \); then : + systemctl | grep -q -- "-\.mount" - if test $? -eq 0; then + if test $? -eq 0; then : INIT_TYPE=systemd - fi - fi - if test \( -z "$INIT_TYPE" -a -f /etc/init.d/networking \); then +fi + +fi + if test \( -z "$INIT_TYPE" -a -f /etc/init.d/networking \); then : + init_path=`which openrc-run 2>/dev/null` - if test \( $? -eq 0 -a -x "$init_path" \); then + if test \( $? -eq 0 -a -x "$init_path" \); then : + head -1 /etc/init.d/networking | grep -q "^#! */.*/openrc-run$" - if test $? -eq 0; then + if test $? -eq 0; then : INIT_TYPE=openrc - fi - fi - fi - if test \( -z "$INIT_TYPE" -a -f /etc/init.d/cron -a ! -h /etc/init.d/cron \); then +fi + +fi + +fi + if test \( -z "$INIT_TYPE" -a -f /etc/init.d/cron -a ! -h /etc/init.d/cron \); then : INIT_TYPE=SYSV - fi - fi -else - INIT_TYPE=$init_type +fi + +fi + +fi +if test \( .$INIT_TYPE = .systemd -a -z "$with_systemdsystemunitdir" \); then : + with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) fi if test $default_config_file; then : if test $default_config_file = yes -o $default_config_file = no; then : as_fn_error $? "A filename must be specified for default-config-file" "$LINENO" 5 - fi CONFIG_FILE=$default_config_file CONFIG_OPTIONS="$CONFIG_OPTIONS DEFAULT_CONFIG_FILE=${default_config_file}" - ] + else default_config_file="/etc/$PACKAGE/$PACKAGE.conf" fi @@ -12569,7 +12581,7 @@ _ACEOF DEFAULT_CONFIG_FILE=$default_config_file -if test -z $INIT_TYPE; then +if test -z "$INIT_TYPE"; then INIT_TYPE=undetected elif test $INIT_TYPE = systemd; then systemdsystemunitdir=$with_systemdsystemunitdir