diff --git a/m4/libtextstyle.m4.orig b/m4/libtextstyle.m4 index 6ae5261..26e15db 100644 --- a/m4/libtextstyle.m4.orig +++ b/m4/libtextstyle.m4 @@ -21,6 +21,15 @@ AC_DEFUN([gl_LIBTEXTSTYLE], [ AC_REQUIRE([gl_LIBTEXTSTYLE_INITIALIZE]) AC_REQUIRE([gl_LIBTEXTSTYLE_SEARCH]) + + AC_MSG_CHECKING([whether to link against libtextstyle]) + AC_ARG_WITH([libtextstyle], + [AS_HELP_STRING([--with-libtextstyle], + [support fancy colors @<:@default=check@:>@])], + [], + [with_libtextstyle=check]) + AC_MSG_RESULT([$with_libtextstyle]) + pushdef([MINVERSION], m4_if([$1], [], [gl_LIBTEXTSTYLE_NEWEST_VERSION], [$1])) dnl Signal a fatal error if MINVERSION is not among the allowed values. m4_if(m4_if(MINVERSION, [0.20], [x], [])m4_if(MINVERSION, [0.20.5], [x], []), [], @@ -53,7 +62,18 @@ AC_DEFUN([gl_LIBTEXTSTYLE_SEARCH], snippet='term_styled_ostream_create(1,"",TTYCTL_AUTO,"");' ;; esac - AC_LIB_HAVE_LINKFLAGS([textstyle], [], - [#include ], [$snippet], - [no]) + + AS_IF( + [test "x$with_libtextstyle" != xno], + [AC_LIB_HAVE_LINKFLAGS([textstyle], [], + [#include ], [$snippet], + [no]) + ] + ) + + AS_IF( + [test "x$with_libtextstyle" = xyes -a "x$HAVE_LIBTEXTSTYLE" != xyes], + [AC_MSG_FAILURE( + [--with-libtextstyle was given, but test for libtextstyle failed])] + ) ])