11cb0ef41Sopenharmony_ci# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
21cb0ef41Sopenharmony_ci#
31cb0ef41Sopenharmony_ci# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software
41cb0ef41Sopenharmony_ci# Foundation, Inc.
51cb0ef41Sopenharmony_ci# Written by Gary V. Vaughan, 2004
61cb0ef41Sopenharmony_ci#
71cb0ef41Sopenharmony_ci# This file is free software; the Free Software Foundation gives
81cb0ef41Sopenharmony_ci# unlimited permission to copy and/or distribute it, with or without
91cb0ef41Sopenharmony_ci# modifications, as long as this notice is preserved.
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci# serial 6 ltsugar.m4
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci# This is to help aclocal find these macros, as it can't see m4_define.
141cb0ef41Sopenharmony_ciAC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci# lt_join(SEP, ARG1, [ARG2...])
181cb0ef41Sopenharmony_ci# -----------------------------
191cb0ef41Sopenharmony_ci# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
201cb0ef41Sopenharmony_ci# associated separator.
211cb0ef41Sopenharmony_ci# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
221cb0ef41Sopenharmony_ci# versions in m4sugar had bugs.
231cb0ef41Sopenharmony_cim4_define([lt_join],
241cb0ef41Sopenharmony_ci[m4_if([$#], [1], [],
251cb0ef41Sopenharmony_ci       [$#], [2], [[$2]],
261cb0ef41Sopenharmony_ci       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
271cb0ef41Sopenharmony_cim4_define([_lt_join],
281cb0ef41Sopenharmony_ci[m4_if([$#$2], [2], [],
291cb0ef41Sopenharmony_ci       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
301cb0ef41Sopenharmony_ci
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci# lt_car(LIST)
331cb0ef41Sopenharmony_ci# lt_cdr(LIST)
341cb0ef41Sopenharmony_ci# ------------
351cb0ef41Sopenharmony_ci# Manipulate m4 lists.
361cb0ef41Sopenharmony_ci# These macros are necessary as long as will still need to support
371cb0ef41Sopenharmony_ci# Autoconf-2.59, which quotes differently.
381cb0ef41Sopenharmony_cim4_define([lt_car], [[$1]])
391cb0ef41Sopenharmony_cim4_define([lt_cdr],
401cb0ef41Sopenharmony_ci[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
411cb0ef41Sopenharmony_ci       [$#], 1, [],
421cb0ef41Sopenharmony_ci       [m4_dquote(m4_shift($@))])])
431cb0ef41Sopenharmony_cim4_define([lt_unquote], $1)
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci# lt_append(MACRO-NAME, STRING, [SEPARATOR])
471cb0ef41Sopenharmony_ci# ------------------------------------------
481cb0ef41Sopenharmony_ci# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
491cb0ef41Sopenharmony_ci# Note that neither SEPARATOR nor STRING are expanded; they are appended
501cb0ef41Sopenharmony_ci# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
511cb0ef41Sopenharmony_ci# No SEPARATOR is output if MACRO-NAME was previously undefined (different
521cb0ef41Sopenharmony_ci# than defined and empty).
531cb0ef41Sopenharmony_ci#
541cb0ef41Sopenharmony_ci# This macro is needed until we can rely on Autoconf 2.62, since earlier
551cb0ef41Sopenharmony_ci# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
561cb0ef41Sopenharmony_cim4_define([lt_append],
571cb0ef41Sopenharmony_ci[m4_define([$1],
581cb0ef41Sopenharmony_ci	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
591cb0ef41Sopenharmony_ci
601cb0ef41Sopenharmony_ci
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ci# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
631cb0ef41Sopenharmony_ci# ----------------------------------------------------------
641cb0ef41Sopenharmony_ci# Produce a SEP delimited list of all paired combinations of elements of
651cb0ef41Sopenharmony_ci# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
661cb0ef41Sopenharmony_ci# has the form PREFIXmINFIXSUFFIXn.
671cb0ef41Sopenharmony_ci# Needed until we can rely on m4_combine added in Autoconf 2.62.
681cb0ef41Sopenharmony_cim4_define([lt_combine],
691cb0ef41Sopenharmony_ci[m4_if(m4_eval([$# > 3]), [1],
701cb0ef41Sopenharmony_ci       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
711cb0ef41Sopenharmony_ci[[m4_foreach([_Lt_prefix], [$2],
721cb0ef41Sopenharmony_ci	     [m4_foreach([_Lt_suffix],
731cb0ef41Sopenharmony_ci		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
741cb0ef41Sopenharmony_ci	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ci# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
781cb0ef41Sopenharmony_ci# -----------------------------------------------------------------------
791cb0ef41Sopenharmony_ci# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
801cb0ef41Sopenharmony_ci# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
811cb0ef41Sopenharmony_cim4_define([lt_if_append_uniq],
821cb0ef41Sopenharmony_ci[m4_ifdef([$1],
831cb0ef41Sopenharmony_ci	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
841cb0ef41Sopenharmony_ci		 [lt_append([$1], [$2], [$3])$4],
851cb0ef41Sopenharmony_ci		 [$5])],
861cb0ef41Sopenharmony_ci	  [lt_append([$1], [$2], [$3])$4])])
871cb0ef41Sopenharmony_ci
881cb0ef41Sopenharmony_ci
891cb0ef41Sopenharmony_ci# lt_dict_add(DICT, KEY, VALUE)
901cb0ef41Sopenharmony_ci# -----------------------------
911cb0ef41Sopenharmony_cim4_define([lt_dict_add],
921cb0ef41Sopenharmony_ci[m4_define([$1($2)], [$3])])
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ci
951cb0ef41Sopenharmony_ci# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
961cb0ef41Sopenharmony_ci# --------------------------------------------
971cb0ef41Sopenharmony_cim4_define([lt_dict_add_subkey],
981cb0ef41Sopenharmony_ci[m4_define([$1($2:$3)], [$4])])
991cb0ef41Sopenharmony_ci
1001cb0ef41Sopenharmony_ci
1011cb0ef41Sopenharmony_ci# lt_dict_fetch(DICT, KEY, [SUBKEY])
1021cb0ef41Sopenharmony_ci# ----------------------------------
1031cb0ef41Sopenharmony_cim4_define([lt_dict_fetch],
1041cb0ef41Sopenharmony_ci[m4_ifval([$3],
1051cb0ef41Sopenharmony_ci	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
1061cb0ef41Sopenharmony_ci    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
1071cb0ef41Sopenharmony_ci
1081cb0ef41Sopenharmony_ci
1091cb0ef41Sopenharmony_ci# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
1101cb0ef41Sopenharmony_ci# -----------------------------------------------------------------
1111cb0ef41Sopenharmony_cim4_define([lt_if_dict_fetch],
1121cb0ef41Sopenharmony_ci[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
1131cb0ef41Sopenharmony_ci	[$5],
1141cb0ef41Sopenharmony_ci    [$6])])
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_ci
1171cb0ef41Sopenharmony_ci# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
1181cb0ef41Sopenharmony_ci# --------------------------------------------------------------
1191cb0ef41Sopenharmony_cim4_define([lt_dict_filter],
1201cb0ef41Sopenharmony_ci[m4_if([$5], [], [],
1211cb0ef41Sopenharmony_ci  [lt_join(m4_quote(m4_default([$4], [[, ]])),
1221cb0ef41Sopenharmony_ci           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
1231cb0ef41Sopenharmony_ci		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
1241cb0ef41Sopenharmony_ci])
125