Fix build with LibreSSL / Detect missing RAND_egd. Patch from Bernard Spil.

This commit is contained in:
Bram Matthys 2015-04-06 10:44:56 +02:00
parent 506870ec86
commit 3b25ba5aed
5 changed files with 52 additions and 1 deletions

42
configure vendored
View file

@ -3874,6 +3874,48 @@ if test "x$ac_cv_lib_nsl_inet_ntoa" = xyes; then :
INETLIB="-lnsl"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RAND_egd in -lcrypto" >&5
$as_echo_n "checking for RAND_egd in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_RAND_egd+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char RAND_egd ();
int
main ()
{
return RAND_egd ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_crypto_RAND_egd=yes
else
ac_cv_lib_crypto_RAND_egd=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_RAND_egd" >&5
$as_echo "$ac_cv_lib_crypto_RAND_egd" >&6; }
if test "x$ac_cv_lib_crypto_RAND_egd" = xyes; then :
$as_echo "#define HAVE_RAND_EGD 1" >>confdefs.h
fi

View file

@ -93,6 +93,8 @@ AC_CHECK_LIB(socket, socket,
AC_CHECK_LIB(nsl, inet_ntoa,
[IRCDLIBS="$IRCDLIBS-lnsl "
INETLIB="-lnsl"])
AC_CHECK_LIB(crypto, RAND_egd,
AC_DEFINE(HAVE_RAND_EGD, 1, [Define if the libcrypto has RAND_egd]))
AC_SUBST(IRCDLIBS)
AC_SUBST(MKPASSWDLIBS)

View file

@ -204,7 +204,11 @@ extern MODVAR aConfiguration iConf;
#define SHOWCONNECTINFO iConf.show_connect_info
#define OPER_ONLY_STATS iConf.oper_only_stats
#define ANTI_SPAM_QUIT_MSG_TIME iConf.anti_spam_quit_message_time
#ifdef HAVE_RAND_EGD
#define USE_EGD iConf.use_egd
#else
#define USE_EGD 0
#endif
#define EGD_PATH iConf.egd_path
#define ircnetwork iConf.network.x_ircnetwork

View file

@ -109,6 +109,9 @@
/* Define if you have pstat */
#undef HAVE_PSTAT
/* Define if the libcrypto has RAND_egd */
#undef HAVE_RAND_EGD
/* Define if you have setproctitle */
#undef HAVE_SETPROCTITLE

View file

@ -187,7 +187,7 @@ MEMORYSTATUS mstat;
/* Grab non-OS specific "random" data */
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x000907000
#if OPENSSL_VERSION_NUMBER >= 0x000907000 && defined(HAVE_RAND_EGD)
if (EGD_PATH) {
n = RAND_query_egd_bytes(EGD_PATH, rdat.egd, sizeof(rdat.egd));
}