1*c43e99fdSEd Maste# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2*c43e99fdSEd Maste# 3*c43e99fdSEd Maste# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software 4*c43e99fdSEd Maste# Foundation, Inc. 5*c43e99fdSEd Maste# Written by Gary V. Vaughan, 2004 6*c43e99fdSEd Maste# 7*c43e99fdSEd Maste# This file is free software; the Free Software Foundation gives 8*c43e99fdSEd Maste# unlimited permission to copy and/or distribute it, with or without 9*c43e99fdSEd Maste# modifications, as long as this notice is preserved. 10*c43e99fdSEd Maste 11*c43e99fdSEd Maste# serial 6 ltsugar.m4 12*c43e99fdSEd Maste 13*c43e99fdSEd Maste# This is to help aclocal find these macros, as it can't see m4_define. 14*c43e99fdSEd MasteAC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 15*c43e99fdSEd Maste 16*c43e99fdSEd Maste 17*c43e99fdSEd Maste# lt_join(SEP, ARG1, [ARG2...]) 18*c43e99fdSEd Maste# ----------------------------- 19*c43e99fdSEd Maste# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 20*c43e99fdSEd Maste# associated separator. 21*c43e99fdSEd Maste# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 22*c43e99fdSEd Maste# versions in m4sugar had bugs. 23*c43e99fdSEd Mastem4_define([lt_join], 24*c43e99fdSEd Maste[m4_if([$#], [1], [], 25*c43e99fdSEd Maste [$#], [2], [[$2]], 26*c43e99fdSEd Maste [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 27*c43e99fdSEd Mastem4_define([_lt_join], 28*c43e99fdSEd Maste[m4_if([$#$2], [2], [], 29*c43e99fdSEd Maste [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 30*c43e99fdSEd Maste 31*c43e99fdSEd Maste 32*c43e99fdSEd Maste# lt_car(LIST) 33*c43e99fdSEd Maste# lt_cdr(LIST) 34*c43e99fdSEd Maste# ------------ 35*c43e99fdSEd Maste# Manipulate m4 lists. 36*c43e99fdSEd Maste# These macros are necessary as long as will still need to support 37*c43e99fdSEd Maste# Autoconf-2.59, which quotes differently. 38*c43e99fdSEd Mastem4_define([lt_car], [[$1]]) 39*c43e99fdSEd Mastem4_define([lt_cdr], 40*c43e99fdSEd Maste[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 41*c43e99fdSEd Maste [$#], 1, [], 42*c43e99fdSEd Maste [m4_dquote(m4_shift($@))])]) 43*c43e99fdSEd Mastem4_define([lt_unquote], $1) 44*c43e99fdSEd Maste 45*c43e99fdSEd Maste 46*c43e99fdSEd Maste# lt_append(MACRO-NAME, STRING, [SEPARATOR]) 47*c43e99fdSEd Maste# ------------------------------------------ 48*c43e99fdSEd Maste# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. 49*c43e99fdSEd Maste# Note that neither SEPARATOR nor STRING are expanded; they are appended 50*c43e99fdSEd Maste# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 51*c43e99fdSEd Maste# No SEPARATOR is output if MACRO-NAME was previously undefined (different 52*c43e99fdSEd Maste# than defined and empty). 53*c43e99fdSEd Maste# 54*c43e99fdSEd Maste# This macro is needed until we can rely on Autoconf 2.62, since earlier 55*c43e99fdSEd Maste# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 56*c43e99fdSEd Mastem4_define([lt_append], 57*c43e99fdSEd Maste[m4_define([$1], 58*c43e99fdSEd Maste m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 59*c43e99fdSEd Maste 60*c43e99fdSEd Maste 61*c43e99fdSEd Maste 62*c43e99fdSEd Maste# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 63*c43e99fdSEd Maste# ---------------------------------------------------------- 64*c43e99fdSEd Maste# Produce a SEP delimited list of all paired combinations of elements of 65*c43e99fdSEd Maste# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 66*c43e99fdSEd Maste# has the form PREFIXmINFIXSUFFIXn. 67*c43e99fdSEd Maste# Needed until we can rely on m4_combine added in Autoconf 2.62. 68*c43e99fdSEd Mastem4_define([lt_combine], 69*c43e99fdSEd Maste[m4_if(m4_eval([$# > 3]), [1], 70*c43e99fdSEd Maste [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 71*c43e99fdSEd Maste[[m4_foreach([_Lt_prefix], [$2], 72*c43e99fdSEd Maste [m4_foreach([_Lt_suffix], 73*c43e99fdSEd Maste ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 74*c43e99fdSEd Maste [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 75*c43e99fdSEd Maste 76*c43e99fdSEd Maste 77*c43e99fdSEd Maste# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 78*c43e99fdSEd Maste# ----------------------------------------------------------------------- 79*c43e99fdSEd Maste# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 80*c43e99fdSEd Maste# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 81*c43e99fdSEd Mastem4_define([lt_if_append_uniq], 82*c43e99fdSEd Maste[m4_ifdef([$1], 83*c43e99fdSEd Maste [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 84*c43e99fdSEd Maste [lt_append([$1], [$2], [$3])$4], 85*c43e99fdSEd Maste [$5])], 86*c43e99fdSEd Maste [lt_append([$1], [$2], [$3])$4])]) 87*c43e99fdSEd Maste 88*c43e99fdSEd Maste 89*c43e99fdSEd Maste# lt_dict_add(DICT, KEY, VALUE) 90*c43e99fdSEd Maste# ----------------------------- 91*c43e99fdSEd Mastem4_define([lt_dict_add], 92*c43e99fdSEd Maste[m4_define([$1($2)], [$3])]) 93*c43e99fdSEd Maste 94*c43e99fdSEd Maste 95*c43e99fdSEd Maste# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 96*c43e99fdSEd Maste# -------------------------------------------- 97*c43e99fdSEd Mastem4_define([lt_dict_add_subkey], 98*c43e99fdSEd Maste[m4_define([$1($2:$3)], [$4])]) 99*c43e99fdSEd Maste 100*c43e99fdSEd Maste 101*c43e99fdSEd Maste# lt_dict_fetch(DICT, KEY, [SUBKEY]) 102*c43e99fdSEd Maste# ---------------------------------- 103*c43e99fdSEd Mastem4_define([lt_dict_fetch], 104*c43e99fdSEd Maste[m4_ifval([$3], 105*c43e99fdSEd Maste m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 106*c43e99fdSEd Maste m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 107*c43e99fdSEd Maste 108*c43e99fdSEd Maste 109*c43e99fdSEd Maste# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 110*c43e99fdSEd Maste# ----------------------------------------------------------------- 111*c43e99fdSEd Mastem4_define([lt_if_dict_fetch], 112*c43e99fdSEd Maste[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 113*c43e99fdSEd Maste [$5], 114*c43e99fdSEd Maste [$6])]) 115*c43e99fdSEd Maste 116*c43e99fdSEd Maste 117*c43e99fdSEd Maste# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 118*c43e99fdSEd Maste# -------------------------------------------------------------- 119*c43e99fdSEd Mastem4_define([lt_dict_filter], 120*c43e99fdSEd Maste[m4_if([$5], [], [], 121*c43e99fdSEd Maste [lt_join(m4_quote(m4_default([$4], [[, ]])), 122*c43e99fdSEd Maste lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 123*c43e99fdSEd Maste [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 124*c43e99fdSEd Maste]) 125