]> Savannah Git Hosting - gnulib.git/commitdiff
getrandom: Fix compilation error on native Windows (regression from 2020-06-28).
authorBruno Haible <bruno@clisp.org>
Sat, 4 Jul 2020 02:00:01 +0000 (04:00 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 4 Jul 2020 02:00:01 +0000 (04:00 +0200)
* lib/getrandom.c: Don't include <ntdef.h>. Instead, define NTSTATUS.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Include <windows.h> before
<bcrypt.h>.

ChangeLog
lib/getrandom.c
m4/getrandom.m4

index 080f9e8342e04a3a2e64c8a575aa6a179f0858af..59897eff6ac11d8e9099e59c7946d45e999fbbef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-07-03  Bruno Haible  <bruno@clisp.org>
+
+       getrandom: Fix compilation error on native Windows (regr. 2020-06-28).
+       * lib/getrandom.c: Don't include <ntdef.h>. Instead, define NTSTATUS.
+       * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Include <windows.h> before
+       <bcrypt.h>.
+
 2020-07-03  Bruno Haible  <bruno@clisp.org>
 
        dfa tests: Follow common file naming conventions.
index 030a78bb08d4ea09930449b2cb1c64c4752d281e..f8695abf30ad1572523cf70cadb171b0c98f62d8 100644 (file)
@@ -32,7 +32,7 @@
 # if HAVE_BCRYPT_H
 #  include <bcrypt.h>
 # else
-#  include <ntdef.h> /* NTSTATUS */
+#  define NTSTATUS LONG
 typedef void * BCRYPT_ALG_HANDLE;
 #  define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002
 #  if HAVE_LIB_BCRYPT
index 2a0034bf76c0c94eb549b6fdeadf569e248cf299..424c2fad3e3dd7ec8d302c47d1c7698da96d7e68 100644 (file)
@@ -1,4 +1,4 @@
-# getrandom.m4 serial 6
+# getrandom.m4 serial 7
 dnl Copyright 2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -36,7 +36,9 @@ AC_DEFUN([gl_FUNC_GETRANDOM],
 
   case "$host_os" in
     mingw*)
-      AC_CHECK_HEADERS([bcrypt.h])
+      AC_CHECK_HEADERS([bcrypt.h], [], [],
+        [[#include <windows.h>
+        ]])
       AC_CACHE_CHECK([whether the bcrypt library is guaranteed to be present],
         [gl_cv_lib_assume_bcrypt],
         [AC_COMPILE_IFELSE(