diff --git a/configure.ac.orig b/configure.ac index 7f6133e..9fe92ad 100644 --- a/configure.ac.orig +++ b/configure.ac @@ -55,8 +55,45 @@ AC_PROG_CXX # Gnulib (early checks). gl_EARLY -# We want ostream_printf and hyperlink support. -gl_LIBTEXTSTYLE_OPTIONAL([0.20.5]) +AC_ARG_WITH([libtextstyle], + [AS_HELP_STRING([--with-libtextstyle], + [support fancy colors @<:@default=check@:>@])], + [], + [with_libtextstyle=check]) + +[echo "RX: with_libtextstyle: $with_libtextstyle"] + +AC_DEFUN([gl_LIBTEXTSTYLE_WITH], +[ + AS_IF([test "x$with_libtextstyle" = xyes -o "x$with_libtextstyle" = xcheck], + [gl_LIBTEXTSTYLE([$1])] + ) + + AS_IF([test "x$with_libtextstyle" = xyes], + AS_IF([test "x$HAVE_LIBTEXTSTYLE" != xyes], + AC_MSG_FAILURE( + [--with-libtextstyle was given, but test for libtextstyle failed]) + ) + ) + + [set -x] + # Copied from libtextstyle-optional.m4 + AS_IF([test $HAVE_LIBTEXTSTYLE = yes], + [TEXTSTYLE_H=], + [ + TEXTSTYLE_H=textstyle.h + AC_REQUIRE([AC_C_INLINE]) + AC_CHECK_FUNCS_ONCE([tcdrain]) + ] + ) + AC_SUBST([TEXTSTYLE_H]) + AM_CONDITIONAL([GL_GENERATE_TEXTSTYLE_H], [test -n "$TEXTSTYLE_H"]) + + [set +x] +]) + +# We want version 0.20.5 for ostream_printf and hyperlink support. +gl_LIBTEXTSTYLE_WITH(0.20.5) # Gnulib uses '#pragma GCC diagnostic push' to silence some # warnings, but older gcc doesn't support this.