|
| 1 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +index 0a279c8..8e771ee 100644 |
| 3 | +--- a/CMakeLists.txt |
| 4 | ++++ b/CMakeLists.txt |
| 5 | +@@ -136,7 +136,7 @@ if (NOT MSVC) |
| 6 | + check_include_files(fcntl.h HAVE_FCNTL_H) |
| 7 | + check_function_exists(fpclass HAVE_FPCLASS) |
| 8 | + check_function_exists(ftime HAVE_FTIME) |
| 9 | +- check_function_exists(getentropy HAVE_GETENTROPY) |
| 10 | ++ check_symbol_exists(getentropy "sys/random.h" HAVE_DECL_GETENTROPY) |
| 11 | + check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) |
| 12 | + check_library_exists(history append_history "" HAVE_LIBHISTORY) |
| 13 | + check_library_exists(readline readline "" HAVE_LIBREADLINE) |
| 14 | +@@ -149,7 +149,6 @@ if (NOT MSVC) |
| 15 | + check_function_exists(stat HAVE_STAT) |
| 16 | + check_include_files(stdint.h HAVE_STDINT_H) |
| 17 | + check_include_files(sys/mman.h HAVE_SYS_MMAN_H) |
| 18 | +- check_include_files(sys/random.h HAVE_SYS_RANDOM_H) |
| 19 | + check_include_files(sys/select.h HAVE_SYS_SELECT_H) |
| 20 | + check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) |
| 21 | + check_include_files(sys/stat.h HAVE_SYS_STAT_H) |
| 22 | +diff --git a/config.h.cmake.in b/config.h.cmake.in |
| 23 | +index 2f4aeba..79f1cdb 100644 |
| 24 | +--- a/config.h.cmake.in |
| 25 | ++++ b/config.h.cmake.in |
| 26 | +@@ -23,7 +23,7 @@ |
| 27 | + #cmakedefine HAVE_FTIME 1 |
| 28 | + |
| 29 | + /* Define to 1 if you have the `getentropy' function. */ |
| 30 | +-#cmakedefine HAVE_GETENTROPY 1 |
| 31 | ++#cmakedefine HAVE_DECL_GETENTROPY 1 |
| 32 | + |
| 33 | + /* Define to 1 if you have the `gettimeofday' function. */ |
| 34 | + #cmakedefine HAVE_GETTIMEOFDAY 1 |
| 35 | +@@ -69,9 +69,6 @@ |
| 36 | + /* Define to 1 if you have the <sys/mman.h> header file. */ |
| 37 | + #cmakedefine HAVE_SYS_MMAN_H 1 |
| 38 | + |
| 39 | +-/* Define to 1 if you have the <sys/random.h> header file. */ |
| 40 | +-#cmakedefine HAVE_SYS_RANDOM_H 1 |
| 41 | +- |
| 42 | + /* Define to 1 if you have the <sys/select.h> header file. */ |
| 43 | + #cmakedefine HAVE_SYS_SELECT_H 1 |
| 44 | + |
| 45 | +diff --git a/configure.ac b/configure.ac |
| 46 | +index 48cd2f0..0f09c61 100644 |
| 47 | +--- a/configure.ac |
| 48 | ++++ b/configure.ac |
| 49 | +@@ -304,7 +304,6 @@ AC_CHECK_HEADERS([stdint.h]) |
| 50 | + AC_CHECK_HEADERS([fcntl.h unistd.h sys/stat.h]) |
| 51 | + AC_CHECK_HEADERS([sys/mman.h]) |
| 52 | + AC_CHECK_HEADERS([sys/time.h sys/timeb.h]) |
| 53 | +-AC_CHECK_HEADERS([sys/random.h]) |
| 54 | + AC_CHECK_HEADERS([dl.h dlfcn.h]) |
| 55 | + AC_CHECK_HEADERS([glob.h]) |
| 56 | + AM_CONDITIONAL(WITH_GLOB, test "$ac_cv_header_glob_h" = "yes") |
| 57 | +@@ -317,9 +316,7 @@ AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */ |
| 58 | + # undef /**/ HAVE_MMAP |
| 59 | + #endif]) |
| 60 | + |
| 61 | +-AC_CHECK_DECL([getentropy], |
| 62 | +- [AC_DEFINE([HAVE_GETENTROPY], [1], [getentropy])], [], |
| 63 | +- [#include <sys/random.h>]) |
| 64 | ++AC_CHECK_DECLS([getentropy], [], [], [#include <sys/random.h>]) |
| 65 | + |
| 66 | + dnl |
| 67 | + dnl Checks for inet libraries |
| 68 | +diff --git a/dict.c b/dict.c |
| 69 | +index 49e1c6b..46bb4d4 100644 |
| 70 | +--- a/dict.c |
| 71 | ++++ b/dict.c |
| 72 | +@@ -928,13 +928,11 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) { |
| 73 | + #define WIN32_LEAN_AND_MEAN |
| 74 | + #include <windows.h> |
| 75 | + #include <bcrypt.h> |
| 76 | +-#elif defined(HAVE_GETENTROPY) |
| 77 | ++#elif HAVE_DECL_GETENTROPY |
| 78 | + #ifdef HAVE_UNISTD_H |
| 79 | + #include <unistd.h> |
| 80 | + #endif |
| 81 | +- #ifdef HAVE_SYS_RANDOM_H |
| 82 | +- #include <sys/random.h> |
| 83 | +- #endif |
| 84 | ++ #include <sys/random.h> |
| 85 | + #else |
| 86 | + #include <time.h> |
| 87 | + #endif |
| 88 | +@@ -965,7 +963,7 @@ xmlInitRandom(void) { |
| 89 | + "error code %lu\n", GetLastError()); |
| 90 | + abort(); |
| 91 | + } |
| 92 | +-#elif defined(HAVE_GETENTROPY) |
| 93 | ++#elif HAVE_DECL_GETENTROPY |
| 94 | + while (1) { |
| 95 | + if (getentropy(globalRngState, sizeof(globalRngState)) == 0) |
| 96 | + break; |
| 97 | +diff --git a/meson.build b/meson.build |
| 98 | +index b6939c7..bbee96d 100644 |
| 99 | +--- a/meson.build |
| 100 | ++++ b/meson.build |
| 101 | +@@ -314,13 +314,15 @@ xml_check_functions = [ |
| 102 | + ['gettimeofday', 'sys/time.h'], |
| 103 | + ['ftime', 'sys/timeb.h'], |
| 104 | + ['stat', 'sys/stat.h'], |
| 105 | +- ['mmap', 'sys/mman.h'], |
| 106 | +- ['munmap', 'sys/mman.h'], |
| 107 | ++ ['getentropy', 'sys/random.h', 'HAVE_DECL_GETENTROPY'], |
| 108 | ++ ['mmap', 'sys/mman.h', 'HAVE_MMAP'], |
| 109 | ++ ['munmap', 'sys/mman.h', 'HAVE_MUNMAP'], |
| 110 | ++ |
| 111 | + ] |
| 112 | + |
| 113 | + foreach function : xml_check_functions |
| 114 | + if cc.has_header_symbol(function[1], function[0]) |
| 115 | +- config_h.set10('HAVE_' + function[0].to_upper(), true) |
| 116 | ++ config_h.set10(function[2], true) |
| 117 | + endif |
| 118 | + endforeach |
| 119 | + |
0 commit comments