2 # Copyright (C) 2012-2013 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)
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 <http://www.gnu.org/licenses/>.
17 # Test Automake-provided internal make macro $(am__relativize).
19 am_create_testdir=empty
30 cat >> configure.ac <<END
33 AC_CONFIG_FILES([Makefile])
37 cat > Makefile.am << 'END'
38 # The 'am__relitivize' definition is only brought in when
39 # SUBDIRS are defined.
44 @$(am__relativize); echo "result: '$$reldir'"; set -x; \
45 case $${reldir:-.} in "$$exp"|"$$exp/.") ;; *) exit 1;; esac
48 $ACLOCAL && $AUTOMAKE && $AUTOCONF && ./configure || fatal_ "setup failure"
52 case $1 in -x) directive=TODO; shift;; *) directive=;; esac
53 test $# -eq 4 && test x"$3" = x"=" || fatal_ "rel_: incorrect usage"
54 command_ok_ "$1/{$4} = $2" -D "$directive" \
55 env dir1=$1 dir2=$2 exp=$4 $MAKE test
60 # Computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
62 # - DIR1 relative pathname, relative to the current directory
63 # - DIR2 relative pathname, relative to the current directory
65 # - reldir relative pathname of DIR2, relative to DIR1
71 for d in x long-longer a/b 1/2/3/4/5; do
73 for d2 in . .. x r/s/t; do
81 rel_ a/b foo = ../../foo
82 rel_ a/b foo/bar = ../../foo/bar
84 rel_ a/b a/c/d = ../c/d
86 rel_ foo/bar/baz foo/bar/qux/zap = ../qux/zap
88 rel_ ../foo . = ../top
89 rel_ ../.. . = uber/top
90 rel_ ../../foo . = ../uber/top
91 rel_ ../../x ok = ../uber/top/ok
92 rel_ ../../x bo/ba = ../uber/top/bo/ba
93 rel_ ../../x ../ok2 = ../uber/top/../ok2
94 rel_ ../a/b/c/d/e . = ../../../../../top