diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-10-02 21:00:20 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-10-02 21:00:20 +0000 |
commit | 36adc7cdd90f195013eb8e24a90ef40348787212 (patch) | |
tree | e91fc5837efd4ee879f3a22f80ff206629970059 /configure.in | |
parent | 14f9b537d124866bf67befc473ac5be04f457db4 (diff) | |
download | tor-36adc7cdd90f195013eb8e24a90ef40348787212.tar.gz tor-36adc7cdd90f195013eb8e24a90ef40348787212.zip |
r8844@totoro: nickm | 2006-10-02 16:32:44 -0400
Resolve an XXXX: make sure that we are actually on 2s-complement hardware.
svn:r8576
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/configure.in b/configure.in index 45a1ffc54f..6ea5dac07c 100644 --- a/configure.in +++ b/configure.in @@ -588,6 +588,27 @@ if test $tor_cv_malloc_zero_works = yes; then [Define to 1 iff malloc(0) returns a pointer]) fi +# whether we seem to be in a 2s-complement world. +if test -z "$CROSS_COMPILE"; then +AC_CACHE_CHECK([whether we are using 2s-complement arithmetic], tor_cv_twos_complement, +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[[int main () { int problem = ((-99) != (~99)+1); +return problem ? 1 : 0; }]])], + [tor_cv_twos_complement=yes], + [tor_cv_twos_complement=no], + [tor_cv_twos_complement=cross])]) + +else + # Cross-compiling; let's hope that the target isn't raving mad. + AC_MSG_NOTICE([Cross-compiling: we'll assume that NULL is represented as a sequence of 0-valued bytes.]) + tor_cv_twos_complement=yes +fi + +if test $tor_cv_twos_complement = yes; then + AC_DEFINE([USING_TWOS_COMPLEMENT], 1, + [Define to 1 iff we represent negative integers with two's complement]) +fi + # Whether we should use the dmalloc memory allocation debugging library. AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library)) AC_ARG_WITH(dmalloc, |