Source: dovecot
Version: 1:2.2.33.2-1
Severity: wishlist
Tags: upstream patch
User: [email protected]
Usertags: rebootstrap

For cross building dovecot one has to set a significant pile of autoconf
cache variables to make all those AC_RUN_IFELSE checks work. For some of
those checks, there is no good alternative to providing the results.
However for determining signedness of standard types, AC_RUN_IFELSE is
not necessary. The signedness is a compile time constant and thus can be
determined using compile tests. The attached patch implements that for
two signedness tests and thus reduces the number of cache variables a
cross builder has to supply. Please consider applying it.

Helmut
Index: dovecot-2.2.33.2/configure.ac
===================================================================
--- dovecot-2.2.33.2.orig/configure.ac
+++ dovecot-2.2.33.2/configure.ac
@@ -843,12 +843,12 @@
 dnl * it's more likely vulnerable to buffer overflows. Anyway, C99 specifies
 dnl * that it's unsigned and only some old systems define it as signed.
 AC_CACHE_CHECK([whether size_t is signed],i_cv_signed_size_t,[
-  AC_RUN_IFELSE([AC_LANG_SOURCE([[
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
     #include <sys/types.h>
     #include <stdlib.h>
     int main() {
-      /* return 0 if we're signed */
-      exit((size_t)(int)-1 <= 0 ? 0 : 1);
+      char error_if_unsigned[(size_t)(int)-1 <= 0 ? 1 : -1];
+      return 0;
     }
   ]])],[
     i_cv_signed_size_t=yes
@@ -1000,12 +1000,12 @@
 AC_DEFINE_UNQUOTED(TIME_T_MAX_BITS, $i_cv_gmtime_max_time_t, [max. time_t bits gmtime() can handle])
 
 AC_CACHE_CHECK([whether time_t is signed],i_cv_signed_time_t,[
-  AC_RUN_IFELSE([AC_LANG_SOURCE([[
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
     #include <sys/types.h>
     #include <stdlib.h>
     int main() {
-      /* return 0 if we're signed */
-      exit((time_t)(int)-1 <= 0 ? 0 : 1);
+      char error_if_unsigned[(time_t)(int)-1 <= 0 ? 1 : -1];
+      return 0;
     }
   ]])],[
     i_cv_signed_time_t=yes

Reply via email to