1
1

- Ditch the header, replace it with $HEADER$ (to be filled in later)

- Add LAM_UNIQ m4 macro

This commit was SVN r31.
Этот коммит содержится в:
Jeff Squyres 2004-01-07 07:46:37 +00:00
родитель 0e776a68d4
Коммит c7dbe45fa6

Просмотреть файл

@ -1,13 +1,8 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2003 The Trustees of Indiana University.
dnl All rights reserved.
dnl $HEADER$
dnl
dnl This file is part of the LAM software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl LAM source distribution.
dnl
dnl $Id: lam_functions.m4,v 1.1 2003/12/22 16:29:11 twoodall Exp $
dnl $Id: lam_functions.m4,v 1.2 2004/01/07 07:46:37 jsquyres Exp $
dnl
AC_DEFUN(LAM_CONFIGURE_SETUP,[
@ -47,3 +42,76 @@ LAM_CONFIGURE_DATE="`date`"
CLEANFILES="*~ .\#*"
AC_SUBST(CLEANFILES)])dnl
dnl #######################################################################
AC_DEFUN(LAM_UNIQ,[
# 1 is the variable name to be uniq-ized
lam_name=$1
# Go through each item in the variable and only keep the unique ones
lam_count=0
for val in ${$1}; do
lam_done=0
lam_i=1
lam_found=0
# Loop over every token we've seen so far
lam_done="`expr $lam_i \> $lam_count`"
while test "$lam_found" = "0" -a "$lam_done" = "0"; do
# Have we seen this token already? Prefix the comparison with
# "x" so that "-Lfoo" values won't be cause an error.
lam_eval="expr x$val = x\$lam_array_$lam_i"
lam_found=`eval $lam_eval`
# Check the ending condition
lam_done="`expr $lam_i \>= $lam_count`"
# Increment the counter
lam_i="`expr $lam_i + 1`"
done
# If we didn't find the token, add it to the "array"
if test "$lam_found" = "0"; then
lam_eval="lam_array_$lam_i=$val"
eval $lam_eval
lam_count="`expr $lam_count + 1`"
else
lam_i="`expr $lam_i - 1`"
fi
done
# Take all the items in the "array" and assemble them back into a
# single variable
lam_i=1
lam_done="`expr $lam_i \> $lam_count`"
lam_newval=
while test "$lam_done" = "0"; do
lam_eval="lam_newval=\"$lam_newval \$lam_array_$lam_i\""
eval $lam_eval
lam_eval="unset lam_array_$lam_i"
eval $lam_eval
lam_done="`expr $lam_i \>= $lam_count`"
lam_i="`expr $lam_i + 1`"
done
# Done; do the assignment
lam_newval="`echo $lam_newval`"
lam_eval="$lam_name=\"$lam_newval\""
eval $lam_eval
# Clean up
unset lam_name lam_i lam_done lam_newval lam_eval lam_count])dnl