[or-cvs] Patch from Michael Mohr to fix cross-compilation. Backport ...

Nick Mathewson nickm at seul.org
Tue May 23 08:38:21 UTC 2006


Update of /home/or/cvsroot/tor
In directory moria:/tmp/cvs-serv10049

Modified Files:
	configure.in 
Log Message:
Patch from Michael Mohr to fix cross-compilation. Backport candidate.  Tweaked to use sensible defaults for NULL_REP_IS_ZERO_BYTES and TIME_T_IS_SIGNED.

Index: configure.in
===================================================================
RCS file: /home/or/cvsroot/tor/configure.in,v
retrieving revision 1.286
retrieving revision 1.287
diff -u -p -d -r1.286 -r1.287
--- configure.in	23 May 2006 08:23:03 -0000	1.286
+++ configure.in	23 May 2006 08:38:18 -0000	1.287
@@ -169,6 +169,7 @@ if test $ac_cv_libevent_dir != "(system)
   fi
 fi
 
+if test -z "$CROSS_COMPILE"; then
 AC_CACHE_CHECK([whether we need extra options to link libevent],
                ac_cv_libevent_linker_option, [
     saved_LDFLAGS="$LDFLAGS"
@@ -200,6 +201,7 @@ AC_CACHE_CHECK([whether we need extra op
 if test $ac_cv_libevent_linker_option != '(none)' ; then
    LDFLAGS="$ac_cv_libevent_linker_option $LDFLAGS"
 fi
+fi
 
 dnl ------------------------------------------------------
 dnl Where do you live, openssl?  And how do we call you?
@@ -266,6 +268,8 @@ if test "$ac_cv_openssl_dir" != "(system
   fi
 fi
 
+if test -z $CROSS_COMPILE
+then
 AC_CACHE_CHECK([whether we need extra options to link OpenSSL],
                ac_cv_openssl_linker_option, [
     saved_LDFLAGS="$LDFLAGS"
@@ -325,6 +329,7 @@ return (OPENSSL_VERSION_NUMBER == SSLeay
 if test "$ac_cv_openssl_linker_option" != '(none)' ; then
    LDFLAGS="$ac_cv_openssl_linker_option $LDFLAGS"
 fi
+fi
 
 dnl Make sure to enable support for large off_t if avalable.
 
@@ -377,11 +382,18 @@ AC_CHECK_SIZEOF(long long)
 AC_CHECK_SIZEOF(__int64)
 AC_CHECK_SIZEOF(void *)
 AC_CHECK_SIZEOF(time_t)
+
+if test -z "$CROSS_COMPILE"; then
 AC_CACHE_CHECK([whether time_t is signed], tor_cv_time_t_signed, [
 AC_TRY_RUN([
 int main(int c, char**v) { if (((time_t)-1)<0) return 1; else return 0; }],
   tor_cv_time_t_signed=no, tor_cv_time_t_signed=yes)
 ])
+else
+  # Cross-compiling; let's hope the target platform isn't loony.
+  AC_MSG_NOTICE([Cross compiling: assuming that time_t is signed.])
+  tor_cv_time_t_signed=yes
+fi
 
 if test $tor_cv_time_t_signed = yes; then
   AC_DEFINE([TIME_T_IS_SIGNED], 1,
@@ -399,6 +411,7 @@ AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDE
 AC_CHECK_SIZEOF(cell_t)
 
 # Now make sure that NULL can be represented as zero bytes.
+if test -z "$CROSS_COMPILE"; then
 AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
 [AC_RUN_IFELSE([AC_LANG_SOURCE(
 [[#include <stdlib.h>
@@ -413,6 +426,12 @@ return memcmp(&p1,&p2,sizeof(char*))?1:0
        [tor_cv_null_is_zero=no],
        [tor_cv_null_is_zero=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_null_is_zero=yes
+fi
+
 if test $tor_cv_null_is_zero = yes; then
   AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
             [Define to 1 iff memset(0) sets pointers to NULL])



More information about the tor-commits mailing list