Loading Makefile.am +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ # 1.9 means we require automake vesion 1.9 AUTOMAKE_OPTIONS = foreign 1.9 subdir-objects ACLOCAL_AMFLAGS = -I m4 noinst_LIBRARIES= EXTRA_DIST= noinst_HEADERS= Loading autogen.sh +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ fi set -e # Run this to generate all the initial makefiles, etc. aclocal && \ aclocal -I m4 && \ autoheader && \ autoconf && \ automake --add-missing --copy changes/signof_enum 0 → 100644 +4 −0 Original line number Diff line number Diff line o Code simplifications and refactoring: - Use Ville Laurikari's implementation of AX_CHECK_SIGN() to determine the signs of types during autoconf. This is better than our old approach, which didn't work when cross-compiling. configure.ac +7 −21 Original line number Diff line number Diff line Loading @@ -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]) Loading Loading @@ -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 Loading @@ -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 Loading m4/ax_check_sign.m4 0 → 100644 +54 −0 Original line number Diff line number Diff line # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_sign.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_SIGN (TYPE, [ACTION-IF-SIGNED], [ACTION-IF-UNSIGNED], [INCLUDES]) # # DESCRIPTION # # Checks whether TYPE is signed or not. If no INCLUDES are specified, the # default includes are used. If ACTION-IF-SIGNED is given, it is # additional shell code to execute when the type is signed. If # ACTION-IF-UNSIGNED is given, it is executed when the type is unsigned. # # This macro assumes that the type exists. Therefore the existence of the # type should be checked before calling this macro. For example: # # AC_CHECK_HEADERS([wchar.h]) # AC_CHECK_TYPE([wchar_t],,[ AC_MSG_ERROR([Type wchar_t not found.]) ]) # AX_CHECK_SIGN([wchar_t], # [ AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ], # [ AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned]) ], [ # #ifdef HAVE_WCHAR_H # #include <wchar.h> # #endif # ]) # # LICENSE # # Copyright (c) 2008 Ville Laurikari <vl@iki.fi> # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 6 AU_ALIAS([VL_CHECK_SIGN], [AX_CHECK_SIGN]) AC_DEFUN([AX_CHECK_SIGN], [ typename=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"` AC_CACHE_CHECK([whether $1 is signed], ax_cv_decl_${typename}_signed, [ AC_TRY_COMPILE([$4], [ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ], [ eval "ax_cv_decl_${typename}_signed=\"yes\"" ], [ eval "ax_cv_decl_${typename}_signed=\"no\"" ])]) symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"` if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then $2 elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then $3 fi ])dnl Loading
Makefile.am +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ # 1.9 means we require automake vesion 1.9 AUTOMAKE_OPTIONS = foreign 1.9 subdir-objects ACLOCAL_AMFLAGS = -I m4 noinst_LIBRARIES= EXTRA_DIST= noinst_HEADERS= Loading
autogen.sh +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ fi set -e # Run this to generate all the initial makefiles, etc. aclocal && \ aclocal -I m4 && \ autoheader && \ autoconf && \ automake --add-missing --copy
changes/signof_enum 0 → 100644 +4 −0 Original line number Diff line number Diff line o Code simplifications and refactoring: - Use Ville Laurikari's implementation of AX_CHECK_SIGN() to determine the signs of types during autoconf. This is better than our old approach, which didn't work when cross-compiling.
configure.ac +7 −21 Original line number Diff line number Diff line Loading @@ -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]) Loading Loading @@ -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 Loading @@ -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 Loading
m4/ax_check_sign.m4 0 → 100644 +54 −0 Original line number Diff line number Diff line # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_sign.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_SIGN (TYPE, [ACTION-IF-SIGNED], [ACTION-IF-UNSIGNED], [INCLUDES]) # # DESCRIPTION # # Checks whether TYPE is signed or not. If no INCLUDES are specified, the # default includes are used. If ACTION-IF-SIGNED is given, it is # additional shell code to execute when the type is signed. If # ACTION-IF-UNSIGNED is given, it is executed when the type is unsigned. # # This macro assumes that the type exists. Therefore the existence of the # type should be checked before calling this macro. For example: # # AC_CHECK_HEADERS([wchar.h]) # AC_CHECK_TYPE([wchar_t],,[ AC_MSG_ERROR([Type wchar_t not found.]) ]) # AX_CHECK_SIGN([wchar_t], # [ AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ], # [ AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned]) ], [ # #ifdef HAVE_WCHAR_H # #include <wchar.h> # #endif # ]) # # LICENSE # # Copyright (c) 2008 Ville Laurikari <vl@iki.fi> # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 6 AU_ALIAS([VL_CHECK_SIGN], [AX_CHECK_SIGN]) AC_DEFUN([AX_CHECK_SIGN], [ typename=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"` AC_CACHE_CHECK([whether $1 is signed], ax_cv_decl_${typename}_signed, [ AC_TRY_COMPILE([$4], [ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ], [ eval "ax_cv_decl_${typename}_signed=\"yes\"" ], [ eval "ax_cv_decl_${typename}_signed=\"no\"" ])]) symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"` if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then $2 elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then $3 fi ])dnl