synch with TL 38272
[luatex.git] / source / m4 / kpse-icu-flags.m4
blob337c6b6866055c9a35fa7b2b75a834955f7f56fd
1 # Public macros for the TeX Live (TL) tree.
2 # Copyright (C) 2009-2015 Peter Breitenlohner <tex-live@tug.org>
4 # This file is free software; the copyright holder
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 # KPSE_ICU_FLAGS([MORE-ICU-LIBS], [ICU_CONFIG_ARGS])
9 # --------------------------------------------------
10 # Provide the configure option '--with-system-icu' (if in the TL tree).
12 # ICU_CONFIG_ARGS: icu-config arguments for additional icu libraries. 
14 # Set the make variables ICU_INCLUDES and ICU_LIBS to the CPPFLAGS and
15 # LIBS required for the icu libraries in libs/icu/ of the TL tree.
16 AC_DEFUN([KPSE_ICU_FLAGS],
17 [m4_pushdef([kpse_icu_config_args], [$2])[]dnl
18 _KPSE_ICU_FLAGS([icuxxx], [], [$1])[]dnl
19 m4_popdef([kpse_icu_config_args])[]dnl
20 ]) # KPSE_ICU_FLAGS
22 # _KPSE_ICU_FLAGS(LIBNAME, OPTIONS, [MORE-ICU-LIBS])
23 # --------------------------------------------------
24 # Internal subroutine.
26 # LIBNAME and OPTIONS as for _KPSE_LIB_FLAGS().
27 # MORE-ICU-LIBS: icu libraries from the TL tree in addition to icuuc and icudata.
28 m4_define([_KPSE_ICU_FLAGS], [dnl
29 _KPSE_LIB_FLAGS([icu], [$1], [$2],
30                 [-DU_STATIC_IMPLEMENTATION -IBLD/libs/icu/include],
31                 m4_bpatsubst([$3 icuuc icudata],
32                              [icu\([18a-z]*\)],
33                              [BLD/libs/icu/icu-build/lib/libicu\1.a]),
34                 [],
35                 [], [${top_builddir}/../../libs/icu/include/unicode/uversion.h])[]dnl
36 ]) # _KPSE_ICU_FLAGS
38 # KPSE_ICU_OPTIONS([WITH-SYSTEM])
39 # -------------------------------
40 AC_DEFUN([KPSE_ICU_OPTIONS], [dnl
41 m4_ifval([$1],
42          [AC_ARG_WITH([system-icu],
43                       AS_HELP_STRING([--with-system-icu],
44                                      [use installed ICU headers and libraries (requires icu-config)]))])[]dnl
45 ]) # KPSE_ICU_OPTIONS
47 # KPSE_ICU_SYSTEM_FLAGS
48 # ---------------------
49 AC_DEFUN([KPSE_ICU_SYSTEM_FLAGS], [dnl
50 AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
51 AC_CHECK_TOOL([ICU_CONFIG], [icu-config], [false])[]dnl
52 if $ICU_CONFIG --version >/dev/null 2>&1; then
53   ICU_INCLUDES=`$ICU_CONFIG --cppflags`
54   ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath m4_ifset([kpse_icu_config_args],
55                                                       [kpse_icu_config_args ])--ldflags-libsonly --ldflags-system`
56 elif test "x$need_icu:$with_system_icu" = xyes:yes; then
57   AC_MSG_ERROR([did not find icu-config required for system icu libraries])
59 ]) # KPSE_ICU_SYSTEM_FLAGS