From 0e429a976b349334d4ba48fe852f4a5c574a5bc0 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Fri, 9 May 2003 21:59:09 +0000 Subject: [PATCH] * configure.ac: Simpler implementation for the 64-bit question - we don't need to verify compiler support with a test program since we just cast everything to the proper type. This also means that cross compiling doesn't become a problem. --- ChangeLog | 5 +++++ configure.ac | 62 +++++++++++----------------------------------------- 2 files changed, 18 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64c0bfe37..c5cf951a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2003-05-09 David Shaw + * configure.ac: Simpler implementation for the 64-bit question - + we don't need to verify compiler support with a test program since + we just cast everything to the proper type. This also means that + cross compiling doesn't become a problem. + * configure.ac: Check for 64-bit types, and how well the compiler supports them (LL) before enabling TIGER/192, SHA-384, or SHA-512. diff --git a/configure.ac b/configure.ac index dc3cfac46..e3320dcb0 100644 --- a/configure.ac +++ b/configure.ac @@ -572,64 +572,28 @@ if test "$ac_cv_sizeof_unsigned_short" = "0" \ fi if test "$use_tiger" = yes || test "$use_new_tiger" = yes || test "$use_sha512" = yes ; then - # Do we have any 64-bit data types at all? AC_CHECK_SIZEOF(uint64_t) + # Do we have any 64-bit data types at all? if test "$ac_cv_sizeof_unsigned_int" != "8" \ && test "$ac_cv_sizeof_unsigned_long" != "8" \ && test "$ac_cv_sizeof_unsigned_long_long" != "8" \ && test "$ac_cv_sizeof_uint64_t" != "8"; then AC_MSG_WARN([No 64-bit types. Disabling TIGER/192, SHA-384, and SHA-512]) else - AC_MSG_CHECKING([whether the compiler can handle 64-bit integers]) + if test "$use_tiger" = yes ; then + AC_SUBST(TIGER_O,tiger.o) + AC_DEFINE(USE_TIGER,1,[Define to include nonstandard TIGER/192 digest support]) + AC_DEFINE(USE_OLD_TIGER,1,[Define to use the old fake OID for TIGER/192 digest support]) + fi - # The logic here is: + if test "$use_new_tiger" = yes ; then + AC_SUBST(TIGER_O,tiger.o) + AC_DEFINE(USE_TIGER,1,[Define to include nonstandard TIGER/192 digest support]) + fi - # 1) c89 does not guarantee that 64-bit ints are available, and - # does not support LL. - - # 2) c99 does guarantee 64-bit ints, and does support LL. - - # 3) Some/many supposedly "c89" compilers support 64-bit ints - # and LL anyway as an extension. - - # So the answer is to always use LL in the code, and try and - # weed out any compilers that don't support LL here in - # configure. This will work on all c99 compilers, and any c89 - # compilers that support 64-bit ints. If it is a pure c89 - # compiler (and therefore doesn't support 64-bit ints), it - # doesn't matter if it supports LL or not. The only thing this - # test won't handle is a c89 compiler that does support 64-bit - # ints, but does not support LL. I can live with that, - # especially since the digest code in question is optional - # anyway. - - AC_RUN_IFELSE(AC_LANG_PROGRAM(,[ - if((0x6a09e667f3bcc908LL != 0x6a09e667f3bcc908LL) || - (0x6a09e667f3bcc908LL == 0x7a09e667f3bcc908LL)) - return 1;]), - use_64bit=yes,use_64bit=no) - - AC_MSG_RESULT($use_64bit) - - if test "$use_64bit" = yes ; then - - if test "$use_tiger" = yes ; then - AC_SUBST(TIGER_O,tiger.o) - AC_DEFINE(USE_TIGER,1,[Define to include nonstandard TIGER/192 digest support]) - AC_DEFINE(USE_OLD_TIGER,1,[Define to use the old fake OID for TIGER/192 digest support]) - fi - - if test "$use_new_tiger" = yes ; then - AC_SUBST(TIGER_O,tiger.o) - AC_DEFINE(USE_TIGER,1,[Define to include nonstandard TIGER/192 digest support]) - fi - - if test "$use_sha512" = yes ; then - AC_SUBST(SHA512_O,sha512.o) - AC_DEFINE(USE_SHA512,1,[Define to include read-only SHA-384 and SHA-512 digest support]) - fi - else - AC_MSG_WARN([Compiler cannot handle 64-bit types. Disabling TIGER/192, SHA-384, and SHA-512]) + if test "$use_sha512" = yes ; then + AC_SUBST(SHA512_O,sha512.o) + AC_DEFINE(USE_SHA512,1,[Define to include read-only SHA-384 and SHA-512 digest support]) fi fi fi