immutable: Add tests.
[gnulib.git] / m4 / libtextstyle-optional.m4
blob2422de152890805504c83c6dc86b4a20e1ddc5c1
1 # libtextstyle-optional.m4 serial 2
2 dnl Copyright (C) 2019-2021 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 dnl From Bruno Haible.
9 dnl gl_LIBTEXTSTYLE_OPTIONAL([MINIMUM-VERSION])
10 dnl Searches for an installed libtextstyle with version >= MINIMUM-VERSION
11 dnl   MINIMUM-VERSION = 0.20      - the first release in 2019
12 dnl   MINIMUM-VERSION = 0.20.5    - adds hyperlink support and ostream_printf
13 dnl   MINIMUM-VERSION unspecified - the newest release
14 dnl or uses the included source code parts that define only part of the API
15 dnl and do not do any styling.
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_OPTIONAL],
24   gl_LIBTEXTSTYLE([$1])
25   if test $HAVE_LIBTEXTSTYLE = yes; then
26     TEXTSTYLE_H=
27   else
28     TEXTSTYLE_H=textstyle.h
29     AC_REQUIRE([AC_C_INLINE])
30     AC_CHECK_FUNCS_ONCE([tcdrain])
31   fi
32   AC_SUBST([TEXTSTYLE_H])
33   AM_CONDITIONAL([GL_GENERATE_TEXTSTYLE_H], [test -n "$TEXTSTYLE_H"])