maint: Update HACKING
[automake.git] / t / ax / is
blobba6ea4445d81f2e55b62810e05c5098154e5bcaf
1 #! /bin/sh
2 # Copyright (C) 2012-2017 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Test that two whitespace-separated lists are equal.
18 # Assumes the two lists are passed on the command line separated by
19 # a '==' string.
20 # This script is useful to test equality of lists in makefile rules,
21 # in the face of variables defined through line-continuations,
22 # automake rewrites and expansions of empty variables.
24 # NOTE: keep this file Bourne-compatible, for the sake of systems with
25 # non-POSIX /bin/sh (like Solaris).
27 set -e
28 set -u
30 # Initialize before unsetting, for shells (like older bash or Solaris
31 # ksh) that fail to unset variables that are already unset.
32 exp= got=; unset exp got
33 seen_eqeq=no
34 while test $# -gt 0; do
35 if test x"$1" = x"=="; then
36 if test $seen_eqeq = no; then
37 seen_eqeq=yes
38 else
39 echo "$0: more than one '==' argument seen on command line" >&2
40 exit 2
42 else
43 if test $seen_eqeq = no; then
44 got=${got+"$got "}$1
45 else
46 exp=${exp+"$exp "}$1
49 shift
50 done
52 if test $seen_eqeq = no; then
53 echo "$0: no '==' argument seen on command line" >&2
54 exit 2
57 test x"${exp-}" = x"${got-}"