3 dnl Copyright (C) 2019-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
11 dnl gl_LIBTEXTSTYLE([MINIMUM-VERSION])
12 dnl Searches for an installed libtextstyle with version >= MINIMUM-VERSION.
13 dnl MINIMUM-VERSION = 0.20 - the first release in 2019
14 dnl MINIMUM-VERSION = 0.20.5 - adds hyperlink support and ostream_printf
15 dnl MINIMUM-VERSION unspecified - the newest release
16 dnl If found, it sets and AC_SUBSTs HAVE_LIBTEXTSTYLE=yes and the LIBTEXTSTYLE
17 dnl and LTLIBTEXTSTYLE variables, and augments the CPPFLAGS variable, and
18 dnl #defines HAVE_LIBTEXTSTYLE to 1.
19 dnl Otherwise, it sets and AC_SUBSTs HAVE_LIBTEXTSTYLE=no and LIBTEXTSTYLE and
20 dnl LTLIBTEXTSTYLE to empty.
22 AC_DEFUN([gl_LIBTEXTSTYLE],
24 AC_REQUIRE([gl_LIBTEXTSTYLE_INITIALIZE])
25 AC_REQUIRE([gl_LIBTEXTSTYLE_SEARCH])
26 pushdef([MINVERSION], m4_if([$1], [], [gl_LIBTEXTSTYLE_NEWEST_VERSION], [$1]))
27 dnl Signal a fatal error if MINVERSION is not among the allowed values.
28 m4_if(m4_if(MINVERSION, [0.20], [x], [])m4_if(MINVERSION, [0.20.5], [x], []), [],
29 [m4_fatal([The argument to gl_LIBTEXTSTYLE or gl_LIBTEXTSTYLE_OPTIONAL is not one of the expected values.])])
30 dnl Store the specified minimum version in gl_libtextstyle_minversion.
31 dnl (This needs to be outside the m4_if. m4_divert_text inside m4_if does
32 dnl not work reliably in Autoconf 2.69.)
33 m4_divert_text([INIT_PREPARE],
34 [gl_libtextstyle_minversion="$gl_libtextstyle_minversion MINVERSION "])
38 AC_DEFUN([gl_LIBTEXTSTYLE_NEWEST_VERSION], [0.20.5])
40 AC_DEFUN([gl_LIBTEXTSTYLE_INITIALIZE],
42 m4_divert_text([DEFAULTS], [gl_libtextstyle_minversion=' 0.20 '])
45 AC_DEFUN([gl_LIBTEXTSTYLE_SEARCH],
47 dnl $gl_libtextstyle_minversion evaluates to a space-separated list of
48 dnl specified minimum versions. The maximum of these requirement matters.
49 case "$gl_libtextstyle_minversion" in
51 snippet='styled_ostream_t s = term_styled_ostream_create(1,"",TTYCTL_AUTO,"");
52 ostream_printf(s,"%d",42);'
55 snippet='term_styled_ostream_create(1,"",TTYCTL_AUTO,"");'
58 AC_LIB_HAVE_LINKFLAGS([textstyle], [],
59 [#include <textstyle.h>], [$snippet],