bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Raul E Rangel <rrangel@chromium.org>
To: bug-gnulib@gnu.org
Cc: Raul E Rangel <rrangel@chromium.org>
Subject: [PATCH v2] libtextstyle: Add --with-libtextstyle option
Date: Wed, 21 Feb 2024 16:01:22 -0700	[thread overview]
Message-ID: <20240221230121.1445281-2-rrangel@chromium.org> (raw)

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



                 reply	other threads:[~2024-02-21 23:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240221230121.1445281-2-rrangel@chromium.org \
    --to=rrangel@chromium.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).