--foreach my $try ('/bin/pwd',
-- '/usr/bin/pwd',
-- '/QOpenSys/bin/pwd', # OS/400 PASE.
-+foreach my $try ('@TERMUX_PREFIX@/bin/pwd',
-+ '@TERMUX_PREFIX@/bin/applets/pwd'
- ) {
-
- if( -x $try ) {
+ if($^O ne 'MSWin32') {
+- foreach my $try ('/bin/pwd',
+- '/usr/bin/pwd',
+- '/QOpenSys/bin/pwd', # OS/400 PASE.
++ foreach my $try ('@TERMUX_PREFIX@/bin/applets/pwd',
++ '@TERMUX_PREFIX@/bin/pwd'
+ ) {
+ if( -x $try ) {
+ $pwd_cmd = $try;
+@@ -198,7 +197,7 @@
+ if ($^O =~ /android/) {
+ # If targetsh is executable, then we're either a full
+ # perl, or a miniperl for a native build.
+- if (-x $Config::Config{targetsh}) {
++ if (defined($Config::Config{targetsh}) && -x $Config::Config{targetsh}) {
+ $pwd_cmd = "$Config::Config{targetsh} -c pwd"
+ }
+ else {