aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-02-07 16:23:48 -0500
committerNick Mathewson <nickm@torproject.org>2013-02-07 16:23:48 -0500
commit0e597471aff206460f02999d6ea9e1e3243ef945 (patch)
tree28c3d1ea48ab46b37f409a2d8ac9ae25b79ab8dd /configure.ac
parente5b07ba17947ba4782cbac8f12de7024b2969c99 (diff)
downloadtor-0e597471aff206460f02999d6ea9e1e3243ef945.tar
tor-0e597471aff206460f02999d6ea9e1e3243ef945.tar.gz
Use a nicely written autoconf macro to determine the sign of a type
This beats our old implementation, which wouldn't work when cross-compiling
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 7 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index c27cbd2c8..e80e6f612 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,7 @@ dnl See LICENSE for licensing information
AC_INIT([tor],[0.2.4.10-alpha-dev])
AC_CONFIG_SRCDIR([src/or/main.c])
+AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_HEADERS([orconfig.h])
@@ -957,8 +958,9 @@ AC_CHECK_TYPES([rlim_t], , ,
#endif
])
-AC_CACHE_CHECK([whether time_t is signed], tor_cv_time_t_signed, [
-AC_RUN_IFELSE([AC_LANG_SOURCE([
+AX_CHECK_SIGN([time_t],
+ [ AC_DEFINE(TIME_T_IS_SIGNED, 1, [Define if time_t is signed]) ],
+ [ : ], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -968,32 +970,16 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([
#ifdef HAVE_TIME_H
#include <time.h>
#endif
-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, tor_cv_time_t_signed=cross)
])
-if test "$tor_cv_time_t_signed" = cross; then
- AC_MSG_NOTICE([Cross compiling: assuming that time_t is signed.])
-fi
-
-if test "$tor_cv_time_t_signed" != no; then
- AC_DEFINE([TIME_T_IS_SIGNED], 1,
- [Define to 1 iff time_t is signed])
-fi
-
-AC_CACHE_CHECK([whether size_t is signed], tor_cv_size_t_signed, [
-AC_RUN_IFELSE([AC_LANG_SOURCE([
+AX_CHECK_SIGN([size_t],
+ [ tor_cv_size_t_signed=yes ],
+ [ tor_cv_size_t_signed=no ], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-int main(int c, char**v) { if (((size_t)-1)<0) return 1; else return 0; }])],
- tor_cv_size_t_signed=no, tor_cv_size_t_signed=yes, tor_cv_size_t_signed=cross)
])
-if test "$tor_cv_size_t_signed" = cross; then
- AC_MSG_NOTICE([Cross compiling: assuming that size_t is not signed.])
-fi
-
if test "$tor_cv_size_t_signed" = yes; then
AC_MSG_ERROR([You have a signed size_t; that's grossly nonconformant.])
fi