$ GOSUB inlibc
$ d_fcntl = tmp
$!
+$! Check for fcntl locking capability
+$!
+$ echo4 "Checking if fcntl-based file locking works... "
+$ tmp = "undef"
+$ IF d_fcntl .EQS. "define"
+$ THEN
+$ OS
+$ WS "#include <stdio.h>"
+$ WS "#if defined(__DECC) || defined(__DECCXX)"
+$ WS "#include <stdlib.h>"
+$ WS "#endif"
+$ WS "#include <fcntl.h>"
+$ WS "#include <unistd.h>"
+$ WS "int main() {"
+$ WS "#if defined(F_SETLK) && defined(F_SETLKW)"
+$ WS " struct flock flock;"
+$ WS " int retval, fd;"
+$ WS " fd = open(""try.c"", O_RDONLY);"
+$ WS " flock.l_type = F_RDLCK;"
+$ WS " flock.l_whence = SEEK_SET;"
+$ WS " flock.l_start = flock.l_len = 0;"
+$ WS " retval = fcntl(fd, F_SETLK, &flock);"
+$ WS " close(fd);"
+$ WS " (retval < 0 ? printf(""undef\n"") : printf(""define\n""));"
+$ WS "#else"
+$ WS " printf(""undef\n"");"
+$ WS "#endif"
+$ WS "}"
+$ CS
+$ GOSUB link_ok
+$ IF compile_status .EQ. good_compile .AND. link_status .EQ. good_link
+$ THEN
+$ GOSUB just_mcr_it
+$ IF tmp .EQS. "define"
+$ THEN
+$ echo4 "Yes, it seems to work."
+$ ELSE
+$ echo4 "Nope, it didn't work."
+$ ENDIF
+$ ELSE
+$ echo4 "I'm unable to compile the test program, so I'll assume not."
+$ tmp = "undef"
+$ ENDIF
+$ ELSE
+$ echo4 "Nope, since you don't even have fcntl()."
+$ ENDIF
+$ d_fcntl_can_lock = tmp
+$!
$! Check for memchr
$!
$ OS
print "1..0 # Skip: Storable was not built\n";
exit 0;
}
- if (!$Config{'d_flock'} && !$Config{'d_fcntl'} && !$Config{'d_lockf'}) {
+ if (!$Config{'d_flock'} &&
+ !$Config{'d_fcntl_can_lock'} &&
+ !$Config{'d_lockf'}) {
print "1..0 # Skip: no flock or flock emulation on this platform\n";
exit 0;
}