tweak to random device detection

This commit is contained in:
Brian Cox 2019-08-05 08:45:10 -07:00
parent f3e3308968
commit e52b84518c
3 changed files with 104 additions and 64 deletions

View File

@ -27,15 +27,6 @@
/* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */
#undef HAVE_COMMONCRYPTO_COMMONDIGEST_H
/* Has /dev/arandom */
#undef HAVE_DEV_ARANDOM
/* Has /dev/random */
#undef HAVE_DEV_RANDOM
/* Has /dev/urandom */
#undef HAVE_DEV_URANDOM
/* Define to 1 if you have the `door_create' function. */
#undef HAVE_DOOR_CREATE
@ -243,6 +234,15 @@
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the file `/dev/arandom'. */
#undef HAVE__DEV_ARANDOM
/* Define to 1 if you have the file `/dev/random'. */
#undef HAVE__DEV_RANDOM
/* Define to 1 if you have the file `/dev/urandom'. */
#undef HAVE__DEV_URANDOM
/* Is byte aligned */
#undef IS_BYTE_ALIGNED

104
configure vendored
View File

@ -6502,15 +6502,15 @@ fi
done
if [ "${host_os}" == "darwin" ]; then
# Check whether --enable-commoncrypto was given.
# Check whether --enable-commoncrypto was given.
if test "${enable_commoncrypto+set}" = set; then :
enableval=$enable_commoncrypto;
fi
if test "x${enable_commoncrypto}" != "xno"
then
if test "x${enable_commoncrypto}" != "xno"
then
for ac_header in CommonCrypto/CommonDigest.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "CommonCrypto/CommonDigest.h" "ac_cv_header_CommonCrypto_CommonDigest_h" "$ac_includes_default"
@ -6523,11 +6523,9 @@ fi
done
fi
fi
if [ "${host_os}" == solaris* ]; then
for ac_header in door.h
for ac_header in door.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "door.h" "ac_cv_header_door_h" "$ac_includes_default"
if test "x$ac_cv_header_door_h" = xyes; then :
@ -6549,7 +6547,7 @@ fi
done
for ac_header in port.h
for ac_header in port.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "port.h" "ac_cv_header_port_h" "$ac_includes_default"
if test "x$ac_cv_header_port_h" = xyes; then :
@ -6571,7 +6569,7 @@ fi
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
@ -6646,27 +6644,79 @@ fi
if [ "${host_os}" != "aros" ]; then
case $host_os in
aros*)
;;
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/random" >&5
$as_echo_n "checking for /dev/random... " >&6; }
if ${ac_cv_file__dev_random+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/dev/random"; then
ac_cv_file__dev_random=yes
else
ac_cv_file__dev_random=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_random" >&5
$as_echo "$ac_cv_file__dev_random" >&6; }
if test "x$ac_cv_file__dev_random" = xyes; then :
if test -c "/dev/random"; then
$as_echo "#define HAVE_DEV_RANDOM 1" >>confdefs.h
fi
if test -c "/dev/urandom"; then
$as_echo "#define HAVE_DEV_URANDOM 1" >>confdefs.h
fi
if test -c "/dev/arandom"; then
$as_echo "#define HAVE_DEV_ARANDOM 1" >>confdefs.h
fi
cat >>confdefs.h <<_ACEOF
#define HAVE__DEV_RANDOM 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5
$as_echo_n "checking for /dev/urandom... " >&6; }
if ${ac_cv_file__dev_urandom+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/dev/urandom"; then
ac_cv_file__dev_urandom=yes
else
ac_cv_file__dev_urandom=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_urandom" >&5
$as_echo "$ac_cv_file__dev_urandom" >&6; }
if test "x$ac_cv_file__dev_urandom" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__DEV_URANDOM 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/arandom" >&5
$as_echo_n "checking for /dev/arandom... " >&6; }
if ${ac_cv_file__dev_arandom+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/dev/arandom"; then
ac_cv_file__dev_arandom=yes
else
ac_cv_file__dev_arandom=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_arandom" >&5
$as_echo "$ac_cv_file__dev_arandom" >&6; }
if test "x$ac_cv_file__dev_arandom" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__DEV_ARANDOM 1
_ACEOF
fi
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lc" >&5

View File

@ -246,23 +246,21 @@ AC_CHECK_FUNCS(readlinkat readlink)
dnl check for posix_fadvise
AC_CHECK_HEADERS(fcntl.h, [AC_CHECK_FUNCS(posix_fadvise)])
if [[ "${host_os}" == "darwin" ]]; then
dnl check for OSX builtin hash algorithms
AC_ARG_ENABLE(commoncrypto,
[ --disable-commoncrypto Don't use CommonCrypto hash implementations (OSX only)])
if test "x${enable_commoncrypto}" != "xno"
then
dnl check for OSX builtin hash algorithms
AC_ARG_ENABLE(commoncrypto,
[ --disable-commoncrypto Don't use CommonCrypto hash implementations (OSX only)])
if test "x${enable_commoncrypto}" != "xno"
then
AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h)
fi
fi
if [[ "${host_os}" == solaris* ]]; then
dnl check for door support (Solaris)
AC_CHECK_HEADERS(door.h, [AC_CHECK_FUNCS(door_create)])
dnl check for event port support (Solaris)
AC_CHECK_HEADERS(port.h, [AC_CHECK_FUNCS(port_create)])
fi
dnl check for door support (Solaris)
AC_CHECK_HEADERS(door.h, [AC_CHECK_FUNCS(door_create)])
dnl check for event port support (Solaris)
AC_CHECK_HEADERS(port.h, [AC_CHECK_FUNCS(port_create)])
dnl check for existence of fseeko() as well as ftello()
AC_FUNC_FSEEKO
@ -279,21 +277,13 @@ dnl if script looks for devices (which don't exist)
dnl so don't even try looking.
dnl ##############################################
if [[ "${host_os}" != "aros" ]]; then
if test -c "/dev/random"; then
AC_DEFINE(HAVE_DEV_RANDOM, [1], [Has /dev/random])
fi
if test -c "/dev/urandom"; then
AC_DEFINE(HAVE_DEV_URANDOM, [1], [Has /dev/urandom])
fi
if test -c "/dev/arandom"; then
AC_DEFINE(HAVE_DEV_ARANDOM, [1], [Has /dev/arandom])
fi
fi
case $host_os in
aros*)
;;
*)
AC_CHECK_FILES(/dev/random /dev/urandom /dev/arandom)
;;
esac
dnl ##############################################
dnl Checks for various platform specific libraries