|
@@ -1033,6 +1033,30 @@ if test "$tor_cv_null_is_zero" != no; then
|
|
|
[Define to 1 iff memset(0) sets pointers to NULL])
|
|
|
fi
|
|
|
|
|
|
+AC_CACHE_CHECK([whether memset(0) sets doubles to 0.0], tor_cv_dbl0_is_zero,
|
|
|
+[AC_RUN_IFELSE([AC_LANG_SOURCE(
|
|
|
+[[#include <stdlib.h>
|
|
|
+#include <string.h>
|
|
|
+#include <stdio.h>
|
|
|
+#ifdef HAVE_STDDEF_H
|
|
|
+#include <stddef.h>
|
|
|
+#endif
|
|
|
+int main () { double d1,d2; d1=0; memset(&d2,0,sizeof(d2));
|
|
|
+return memcmp(&d1,&d2,sizeof(d1))?1:0; }]])],
|
|
|
+ [tor_cv_dbl0_is_zero=yes],
|
|
|
+ [tor_cv_dbl0_is_zero=no],
|
|
|
+ [tor_cv_dbl0_is_zero=cross])])
|
|
|
+
|
|
|
+if test "$tor_cv_dbl0_is_zero" = cross ; then
|
|
|
+ # Cross-compiling; let's hope that the target isn't raving mad.
|
|
|
+ AC_MSG_NOTICE([Cross-compiling: we'll assume that 0.0 can be represented as a sequence of 0-valued bytes.])
|
|
|
+fi
|
|
|
+
|
|
|
+if test "$tor_cv_dbl0_is_zero" != no; then
|
|
|
+ AC_DEFINE([DOUBLE_0_REP_IS_ZERO_BYTES], 1,
|
|
|
+ [Define to 1 iff memset(0) sets doubles to 0.0])
|
|
|
+fi
|
|
|
+
|
|
|
# And what happens when we malloc zero?
|
|
|
AC_CACHE_CHECK([whether we can malloc(0) safely.], tor_cv_malloc_zero_works,
|
|
|
[AC_RUN_IFELSE([AC_LANG_SOURCE(
|