bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH v2] libtextstyle: Add --with-libtextstyle option
@ 2024-02-21 23:01 Raul E Rangel
  0 siblings, 0 replies; only message in thread
From: Raul E Rangel @ 2024-02-21 23:01 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Raul E Rangel

libtextstyle is currently treated as an automagic dependency. It gets
linked if it is present, and doesn't if it's not. This change adds a
--with-libtextstyle option so that the dependency can be explicitly
enabled or disabled.

See: https://bugs.gentoo.org/925100
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
---
v2: fixed some unexpected white space on the ac_cv_libtextstyle
    assignment.
---
 m4/libtextstyle-optional.m4 |  2 +-
 m4/libtextstyle.m4          | 25 ++++++++++++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/m4/libtextstyle-optional.m4 b/m4/libtextstyle-optional.m4
index 0976a5d2c0..71852dcad2 100644
--- a/m4/libtextstyle-optional.m4
+++ b/m4/libtextstyle-optional.m4
@@ -22,7 +22,7 @@ dnl LTLIBTEXTSTYLE to empty.
 AC_DEFUN([gl_LIBTEXTSTYLE_OPTIONAL],
 [
   gl_LIBTEXTSTYLE([$1])
-  if test $HAVE_LIBTEXTSTYLE = yes; then
+  if test "x$HAVE_LIBTEXTSTYLE" = xyes; then
     GL_GENERATE_TEXTSTYLE_H=false
   else
     GL_GENERATE_TEXTSTYLE_H=true
diff --git a/m4/libtextstyle.m4 b/m4/libtextstyle.m4
index 435207ffd4..3044b08719 100644
--- a/m4/libtextstyle.m4
+++ b/m4/libtextstyle.m4
@@ -38,6 +38,14 @@ AC_DEFUN([gl_LIBTEXTSTYLE_NEWEST_VERSION], [0.20.5])
 AC_DEFUN([gl_LIBTEXTSTYLE_INITIALIZE],
 [
   m4_divert_text([DEFAULTS], [gl_libtextstyle_minversion=' 0.20 '])
+
+  AC_MSG_CHECKING([whether to link against libtextstyle])
+  AC_ARG_WITH([libtextstyle],
+    [AS_HELP_STRING([--with-libtextstyle],
+      [support fancy colors @<:@default=auto@:>@])],
+    [],
+    [with_libtextstyle=auto])
+  AC_MSG_RESULT([$with_libtextstyle])
 ])
 
 AC_DEFUN([gl_LIBTEXTSTYLE_SEARCH],
@@ -53,7 +61,18 @@ AC_DEFUN([gl_LIBTEXTSTYLE_SEARCH],
       snippet='term_styled_ostream_create(1,"",TTYCTL_AUTO,"");'
       ;;
   esac
-  AC_LIB_HAVE_LINKFLAGS([textstyle], [],
-    [#include <textstyle.h>], [$snippet],
-    [no])
+
+  AS_IF(
+    [test "x$with_libtextstyle" != xno],
+    [AC_LIB_HAVE_LINKFLAGS([textstyle], [],
+      [#include <textstyle.h>], [$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]
+    )]
+  )
 ])
-- 
2.44.0.rc0.258.g7320e95886-goog



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-21 23:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 23:01 [PATCH v2] libtextstyle: Add --with-libtextstyle option Raul E Rangel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).