2009-03-15 20:08:31 -04:00
|
|
|
dnl # Append or prepend items to a variable, but keep the items in the
|
|
|
|
dnl # variable unique.
|
|
|
|
dnl # Re-implemented from scratch after seeing XIPH_VAR_[PRE,AP]PEND, written
|
|
|
|
dnl # by Karl Heyes of the Icecast project, in action. The end result turned
|
|
|
|
dnl # out to be quite similar ...
|
|
|
|
|
|
|
|
|
2009-06-21 10:21:32 -04:00
|
|
|
dnl # Copyright (c) 2008, 2009 Moritz Grimm <mgrimm@mrsserver.net>
|
2009-03-15 20:08:31 -04:00
|
|
|
dnl #
|
|
|
|
dnl # Permission to use, copy, modify, and distribute this software for any
|
|
|
|
dnl # purpose with or without fee is hereby granted, provided that the above
|
|
|
|
dnl # copyright notice and this permission notice appear in all copies.
|
|
|
|
dnl #
|
|
|
|
dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
dnl # AX_UNIQVAR_APPEND([VARIABLE], [ITEM-LIST])
|
|
|
|
dnl # AX_UNIQVAR_PREPEND([VARIABLE], [ITEM-LIST])
|
|
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([AX_UNIQVAR_APPEND],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([AC_PROG_FGREP])
|
|
|
|
for arg in $2
|
|
|
|
do
|
|
|
|
if `echo " ${$1} x" | ${FGREP} -v -e " ${arg} " > /dev/null`; then
|
|
|
|
if test -z "${$1}"; then
|
|
|
|
$1="${arg}"
|
|
|
|
else
|
|
|
|
$1="${$1} ${arg}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
])
|
|
|
|
|
2009-06-21 10:21:32 -04:00
|
|
|
|
2009-03-15 20:08:31 -04:00
|
|
|
AC_DEFUN([AX_UNIQVAR_PREPEND],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([AC_PROG_FGREP])
|
2009-03-28 07:14:54 -04:00
|
|
|
_prepend_args=""
|
2009-03-15 20:08:31 -04:00
|
|
|
for arg in $2
|
2009-03-28 07:14:54 -04:00
|
|
|
do
|
|
|
|
_prepend_args="${arg} ${_prepend_args}"
|
|
|
|
done
|
|
|
|
for arg in ${_prepend_args}
|
2009-03-15 20:08:31 -04:00
|
|
|
do
|
|
|
|
if `echo " ${$1} x" | ${FGREP} -v -e " ${arg} " > /dev/null`; then
|
|
|
|
if test -z "${$1}"; then
|
|
|
|
$1="${arg}"
|
|
|
|
else
|
|
|
|
$1="${arg} ${$1}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
])
|