19f00f3a1Smrg# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 29f00f3a1Smrg# 374835918Smrg# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software 4edce3322Smrg# Foundation, Inc. 59f00f3a1Smrg# Written by Gary V. Vaughan, 2004 69f00f3a1Smrg# 79f00f3a1Smrg# This file is free software; the Free Software Foundation gives 89f00f3a1Smrg# unlimited permission to copy and/or distribute it, with or without 99f00f3a1Smrg# modifications, as long as this notice is preserved. 109f00f3a1Smrg 119f00f3a1Smrg# serial 6 ltsugar.m4 129f00f3a1Smrg 139f00f3a1Smrg# This is to help aclocal find these macros, as it can't see m4_define. 149f00f3a1SmrgAC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 159f00f3a1Smrg 169f00f3a1Smrg 179f00f3a1Smrg# lt_join(SEP, ARG1, [ARG2...]) 189f00f3a1Smrg# ----------------------------- 199f00f3a1Smrg# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 209f00f3a1Smrg# associated separator. 219f00f3a1Smrg# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 229f00f3a1Smrg# versions in m4sugar had bugs. 239f00f3a1Smrgm4_define([lt_join], 249f00f3a1Smrg[m4_if([$#], [1], [], 259f00f3a1Smrg [$#], [2], [[$2]], 269f00f3a1Smrg [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 279f00f3a1Smrgm4_define([_lt_join], 289f00f3a1Smrg[m4_if([$#$2], [2], [], 299f00f3a1Smrg [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 309f00f3a1Smrg 319f00f3a1Smrg 329f00f3a1Smrg# lt_car(LIST) 339f00f3a1Smrg# lt_cdr(LIST) 349f00f3a1Smrg# ------------ 359f00f3a1Smrg# Manipulate m4 lists. 369f00f3a1Smrg# These macros are necessary as long as will still need to support 37edce3322Smrg# Autoconf-2.59, which quotes differently. 389f00f3a1Smrgm4_define([lt_car], [[$1]]) 399f00f3a1Smrgm4_define([lt_cdr], 409f00f3a1Smrg[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 419f00f3a1Smrg [$#], 1, [], 429f00f3a1Smrg [m4_dquote(m4_shift($@))])]) 439f00f3a1Smrgm4_define([lt_unquote], $1) 449f00f3a1Smrg 459f00f3a1Smrg 469f00f3a1Smrg# lt_append(MACRO-NAME, STRING, [SEPARATOR]) 479f00f3a1Smrg# ------------------------------------------ 48edce3322Smrg# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. 499f00f3a1Smrg# Note that neither SEPARATOR nor STRING are expanded; they are appended 509f00f3a1Smrg# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 519f00f3a1Smrg# No SEPARATOR is output if MACRO-NAME was previously undefined (different 529f00f3a1Smrg# than defined and empty). 539f00f3a1Smrg# 549f00f3a1Smrg# This macro is needed until we can rely on Autoconf 2.62, since earlier 559f00f3a1Smrg# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 569f00f3a1Smrgm4_define([lt_append], 579f00f3a1Smrg[m4_define([$1], 589f00f3a1Smrg m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 599f00f3a1Smrg 609f00f3a1Smrg 619f00f3a1Smrg 629f00f3a1Smrg# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 639f00f3a1Smrg# ---------------------------------------------------------- 649f00f3a1Smrg# Produce a SEP delimited list of all paired combinations of elements of 659f00f3a1Smrg# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 669f00f3a1Smrg# has the form PREFIXmINFIXSUFFIXn. 679f00f3a1Smrg# Needed until we can rely on m4_combine added in Autoconf 2.62. 689f00f3a1Smrgm4_define([lt_combine], 699f00f3a1Smrg[m4_if(m4_eval([$# > 3]), [1], 709f00f3a1Smrg [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 719f00f3a1Smrg[[m4_foreach([_Lt_prefix], [$2], 729f00f3a1Smrg [m4_foreach([_Lt_suffix], 739f00f3a1Smrg ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 749f00f3a1Smrg [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 759f00f3a1Smrg 769f00f3a1Smrg 779f00f3a1Smrg# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 789f00f3a1Smrg# ----------------------------------------------------------------------- 799f00f3a1Smrg# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 809f00f3a1Smrg# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 819f00f3a1Smrgm4_define([lt_if_append_uniq], 829f00f3a1Smrg[m4_ifdef([$1], 839f00f3a1Smrg [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 849f00f3a1Smrg [lt_append([$1], [$2], [$3])$4], 859f00f3a1Smrg [$5])], 869f00f3a1Smrg [lt_append([$1], [$2], [$3])$4])]) 879f00f3a1Smrg 889f00f3a1Smrg 899f00f3a1Smrg# lt_dict_add(DICT, KEY, VALUE) 909f00f3a1Smrg# ----------------------------- 919f00f3a1Smrgm4_define([lt_dict_add], 929f00f3a1Smrg[m4_define([$1($2)], [$3])]) 939f00f3a1Smrg 949f00f3a1Smrg 959f00f3a1Smrg# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 969f00f3a1Smrg# -------------------------------------------- 979f00f3a1Smrgm4_define([lt_dict_add_subkey], 989f00f3a1Smrg[m4_define([$1($2:$3)], [$4])]) 999f00f3a1Smrg 1009f00f3a1Smrg 1019f00f3a1Smrg# lt_dict_fetch(DICT, KEY, [SUBKEY]) 1029f00f3a1Smrg# ---------------------------------- 1039f00f3a1Smrgm4_define([lt_dict_fetch], 1049f00f3a1Smrg[m4_ifval([$3], 1059f00f3a1Smrg m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 1069f00f3a1Smrg m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 1079f00f3a1Smrg 1089f00f3a1Smrg 1099f00f3a1Smrg# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 1109f00f3a1Smrg# ----------------------------------------------------------------- 1119f00f3a1Smrgm4_define([lt_if_dict_fetch], 1129f00f3a1Smrg[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 1139f00f3a1Smrg [$5], 1149f00f3a1Smrg [$6])]) 1159f00f3a1Smrg 1169f00f3a1Smrg 1179f00f3a1Smrg# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 1189f00f3a1Smrg# -------------------------------------------------------------- 1199f00f3a1Smrgm4_define([lt_dict_filter], 1209f00f3a1Smrg[m4_if([$5], [], [], 1219f00f3a1Smrg [lt_join(m4_quote(m4_default([$4], [[, ]])), 1229f00f3a1Smrg lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 1239f00f3a1Smrg [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 1249f00f3a1Smrg]) 125