summaryrefslogtreecommitdiff
path: root/autogen.sh
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2020-10-04 19:07:41 +0300
committerTor Lillqvist <tml@collabora.com>2020-10-04 21:16:22 +0200
commitd1b399b687193951978500056ce461a921575d3e (patch)
tree75f70389feb5d36541ff112ec5c65fe218969bb8 /autogen.sh
parentb36df65bb2393f8f46eea68c861d7570e7a772a1 (diff)
Step towards building for Windows on WSL: ProgramFiles(x86) handling
autogen.sh is a Perl script. When running Perl on WSL, weirdly named environment variables like the "ProgramFiles(x86)" one don't seem to get imported to a shell child process of the Perl process. So export it as PROGRAMFILESX86 instead. configure.ac will look for that on WSL. (Changes to configure.ac will be coming in small careful steps.) Change-Id: I572c3b1e2f2fab3629d1856d33fcf0dda51217d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103921 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'autogen.sh')
-rwxr-xr-xautogen.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/autogen.sh b/autogen.sh
index 49835ff27e25..beda712747ce 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -296,6 +296,18 @@ if (defined $ENV{NOCONFIGURE}) {
push @args, "--enable-option-checking=$option_checking";
print "Running ./configure with '" . join (" ", @args), "'\n";
+
+ # When running a shell script from Perl on WSL, weirdly named
+ # environment variables like the "ProgramFiles(x86)" one don't get
+ # imported by the shell. So export it as PROGRAMFILESX86 instead.
+ if (`wslsys 2>/dev/null` ne "") {
+ if (!$ENV{"ProgramFiles(x86)"}) {
+ print STDERR "To build on WSL, you need to set the WSLENV environment variable in the Control Panel to 'ProgramFiles(x86)'\n";
+ exit (1);
+ }
+ $ENV{"PROGRAMFILESX86"} = $ENV{"ProgramFiles(x86)"};
+ }
+
system ("./configure", @args) && die "Error running configure";
}