Debian Codegraph @

m4/kpse-icu-flags.m4

raw
1 # $Id: kpse-icu-flags.m4 49495 2018-12-24 23:17:30Z karl $
2 # ICU support in the TeX Live (TL) tree.
3 # Copyright 2017-2018 Karl Berry <[email protected]>
4 # Copyright 2009-2015 Peter Breitenlohner <[email protected]>
5 #
6 # This file is free software; the copyright holder
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
9
10 # KPSE_ICU_FLAGS([MORE-ICU-LIBS], [ICU-CONFIG-ARGS])
11 # --------------------------------------------------
12 # Provide the configure option '--with-system-icu' (if in the TL tree).
13 #
14 # MORE-ICU-LIBS: icu libraries from TL tree in addition to icuuc and icudata.
15 # ICU-CONFIG-ARGS: icu-config arguments for additional icu libraries.
16 #
17 # Set the make variables ICU_INCLUDES and ICU_LIBS to the CPPFLAGS and
18 # LIBS required for the icu libraries in libs/icu/ of the TL tree.
19 AC_DEFUN([KPSE_ICU_FLAGS],
20 [echo 'tldbg:[$0] called: more-icu-libs=[$1], icu-config-args=[$2].' >&AS_MESSAGE_LOG_FD
21 m4_pushdef([kpse_icu_config_args], [$2])[]dnl
22 _KPSE_ICU_FLAGS([icuxxx], [], [$1])[]dnl
23 m4_popdef([kpse_icu_config_args])[]dnl
24 ]) # KPSE_ICU_FLAGS
25
26 # _KPSE_ICU_FLAGS(LIBNAME, OPTIONS, [MORE-ICU-LIBS])
27 # --------------------------------------------------
28 # Internal subroutine.
29 #
30 # LIBNAME and OPTIONS as for _KPSE_LIB_FLAGS().
31 # MORE-ICU-LIBS: as above.
32 m4_define([_KPSE_ICU_FLAGS], [dnl
33 _KPSE_LIB_FLAGS([icu], [$1], [$2],
34 [-DU_STATIC_IMPLEMENTATION -IBLD/libs/icu/include],
35 m4_bpatsubst([$3 icuuc icudata],
36 [icu\([18a-z]*\)],
37 [BLD/libs/icu/icu-build/lib/libicu\1.a]),
38 [],
39 [], [${top_builddir}/../../libs/icu/include/unicode/uversion.h])[]dnl
40 # checking for openbsd to add -lpthread for icu.
41 case $build_os in
42 openbsd*)
43 eval AS_TR_CPP($1)_LIBS=\"$[]AS_TR_CPP($1)_LIBS -lpthread\"
44 ;;
45 esac
46 ]) # _KPSE_ICU_FLAGS
47
48 # KPSE_ICU_OPTIONS([WITH-SYSTEM])
49 # -------------------------------
50 AC_DEFUN([KPSE_ICU_OPTIONS], [dnl
51 m4_ifval([$1],
52 [AC_ARG_WITH([system-icu],
53 AS_HELP_STRING([--with-system-icu],
54 [use installed ICU headers and libraries (requires pkg-config or icu-config)]))])[]dnl
55 ]) # KPSE_ICU_OPTIONS
56
57 # KPSE_ICU_SYSTEM_FLAGS
58 # ---------------------
59 AC_DEFUN([KPSE_ICU_SYSTEM_FLAGS], [dnl
60 AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
61 echo 'tldbg:[$0] called.' >&AS_MESSAGE_LOG_FD
62 AC_CHECK_TOOL([ICU_CONFIG], [icu-config], [false])[]dnl
63 AC_CHECK_TOOL([PKG_CONFIG], [pkg-config], [false])[]dnl
64 if $ICU_CONFIG --version >/dev/null 2>&1; then
65 ICU_INCLUDES=`$ICU_CONFIG --cppflags`
66 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath m4_ifset([kpse_icu_config_args],
67 [kpse_icu_config_args ])--ldflags-libsonly --ldflags-system`
68 elif $PKG_CONFIG --libs icu-uc icu-io >/dev/null 2>&1; then
69 ICU_INCLUDES=`$PKG_CONFIG --cflags icu-uc icu-io`
70 ICU_LIBS=`$PKG_CONFIG --libs icu-uc icu-io`
71 elif test "x$need_icu:$with_system_icu" = xyes:yes; then
72 AC_MSG_ERROR([did not find either pkg-config or icu-config; one is required for system icu library support])
73 fi
74 ]) # KPSE_ICU_SYSTEM_FLAGS