$OpenBSD: patch-configure_ac,v 1.4 2019/09/07 16:46:01 ajacoutot Exp $

Index: configure.ac
--- configure.ac.orig
+++ configure.ac
@@ -38,14 +38,7 @@ m4_define(mym4_version_micro, [5])
 # processing is done by autoconf and not during the configure run.
 m4_define(mym4_version,
           [mym4_version_major.mym4_version_minor.mym4_version_micro])
-m4_define([mym4_revision],
-          m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
-m4_define([mym4_revision_dec],
-          m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
-m4_define([mym4_betastring],
-          m4_esyscmd_s([git describe --match 'libgcrypt-[0-9].*[0-9]' --long|\
-                        awk -F- '$3!=0{print"-beta"$3}']))
-m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
+m4_define([mym4_isgit], [no])
 m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
 
 AC_INIT([libgcrypt],[mym4_full_version],[http://bugs.gnupg.org])
@@ -205,7 +198,7 @@ available_kdfs="s2k pkdf2 scrypt"
 enabled_kdfs=""
 
 # Definitions for random modules.
-available_random_modules="linux egd unix"
+available_random_modules="arc4random linux egd unix"
 auto_random_modules="$available_random_modules"
 
 # Supported thread backends.
@@ -1729,6 +1722,7 @@ AC_CHECK_FUNCS(strtoul memmove stricmp atexit raise)
 AC_CHECK_FUNCS(strerror rand mmap getpagesize sysconf waitpid wait4)
 AC_CHECK_FUNCS(gettimeofday getrusage gethrtime clock_gettime syslog)
 AC_CHECK_FUNCS(syscall fcntl ftruncate flockfile)
+AC_CHECK_FUNCS(arc4random)
 
 GNUPG_CHECK_MLOCK
 
@@ -1801,7 +1795,9 @@ fi
 if test "$random" = "default"; then
 
     # Select default value.
-    if test "$ac_cv_have_dev_random" = yes; then
+    if test "$ac_cv_func_arc4random" = yes; then
+        random_modules="arc4random"
+    elif test "$ac_cv_have_dev_random" = yes; then
         # Try Linuxish random device.
         random_modules="linux"
     else
@@ -2464,6 +2460,12 @@ LIST_MEMBER(scrypt, $enabled_kdfs)
 if test "$found" = "1" ; then
    GCRYPT_KDFS="$GCRYPT_KDFS scrypt.lo"
    AC_DEFINE(USE_SCRYPT, 1, [Defined if this module should be included])
+fi
+
+LIST_MEMBER(arc4random, $random_modules)
+if test "$found" = "1" ; then
+   GCRYPT_RANDOM="$GCRYPT_RANDOM rndarc4random.lo"
+   AC_DEFINE(USE_RNDARC4RANDOM, 1, [Defined if arc4random RNG should be used.])
 fi
 
 LIST_MEMBER(linux, $random_modules)
