Hello list,

the following snippet generates invalid shell code (and a cryptic error message) because of the line break right before the closing parenthesis.

AM_CONDITIONAL([HAVE_LIBXML2],
    [test "x$with_libxml2" != xno &&
     test "x$ac_cv_lib_xml2_xmlFirstElementChild" = xyes]
)


Generated code (semi-colon at beginning of line creates problems):

 if test "x$with_libxml2" != xno &&
     test "x$ac_cv_lib_xml2_xmlFirstElementChild" = xyes
; then
  HAVE_LIBXML2_TRUE=
  HAVE_LIBXML2_FALSE='#'
else
  HAVE_LIBXML2_TRUE='#'
  HAVE_LIBXML2_FALSE=
fi


The attached patch attempts to fix the issue, do you think it is the right approach?


Thanks in advance,
Dimitris
--- cond.m4	2014-07-17 17:46:37.741723897 +0200
+++ cond.2.m4	2014-07-17 17:50:43.456076469 +0200
@@ -13,17 +13,18 @@
 [AC_PREREQ([2.52])dnl
  m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
 _AM_SUBST_NOTMAKE([$1_FALSE])dnl
 m4_define([_AM_COND_VALUE_$1], [$2])dnl
-if $2; then
+if $2
+then
   $1_TRUE=
   $1_FALSE='#'
 else
   $1_TRUE='#'
   $1_FALSE=
 fi
 AC_CONFIG_COMMANDS_PRE(
 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then

Reply via email to