3 $description = "Test proper handling of SHELL.";
5 # If we don't have a POSIX shell available, never mind
6 $is_posix_sh or return -1;
8 # On Windows, shell names might not match
9 if ($port_type eq 'W32') {
15 # According to POSIX, the value of SHELL in the environment has no impact on
16 # the value in the makefile.
18 $ENV{SHELL} = '/dev/null';
19 run_make_test('all:;@echo "$(SHELL)"', '', $mshell);
21 # According to POSIX, any value of SHELL set in the makefile should not be
22 # exported to the subshell. A more portable option might be to set SHELL to
23 # be $^X (perl) in the makefile, and set .SHELLFLAGS to -e.
25 $ENV{SHELL} = $mshell;
27 my $altshell = "/./$mshell";
28 my $altshell2 = "/././$mshell";
30 if ($mshell =~ m,^([a-zA-Z]:)([\\/])(.*),) {
31 $altshell = "$1$2.$2$3";
32 $altshell2 = "$1$2.$2.$2$3";
35 run_make_test("SHELL := $altshell\n".'
36 all:;@echo "$(SHELL) $$SHELL"
37 ', '', "$altshell $mshell");
39 # As a GNU make extension, if make's SHELL variable is explicitly exported,
40 # then we really _DO_ export it.
42 $ENV{SHELL} = $mshell;
44 run_make_test("export SHELL := $altshell\n".'
45 all:;@echo "$(SHELL) $$SHELL"
46 ', '', "$altshell $altshell");
49 # Test out setting of SHELL, both exported and not, as a target-specific
52 $ENV{SHELL} = $mshell;
54 run_make_test("all: SHELL := $altshell\n".'
55 all:;@echo "$(SHELL) $$SHELL"
56 ', '', "$altshell $mshell");
58 $ENV{SHELL} = $mshell;
63 two: export SHELL := $altshell\n".'
64 one two:;@echo "$@: $(SHELL) $$SHELL"
65 ', '', "two: $altshell $altshell\none: $altshell2 $mshell\n");
69 # We don't know the output here: on Solaris for example, every line printed
70 # by the shell in -x mode has a trailing space (!!)
71 my $script = 'true; true';
73 my $out = `$sh_name $flags '$script' 2>&1`;
81 # Do it again but add spaces to SHELLFLAGS
83 # Some shells (*shakes fist at Solaris*) cannot handle multiple flags in
85 my $t = `$sh_name -e -c true 2>/dev/null`;
86 my $multi_ok = $? == 0;
97 # We can't just use "false" because on different systems it provides a
98 # different exit code--once again Solaris: false exits with 255 not 1
99 $script = 'true; false; true';
101 $out = `$sh_name $flags '$script' 2>&1`;
108 '', "$out#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512);