--- /tmp/dovecot-1.2.beta1/configure.in 2009-02-11 01:16:54.000000000 +0100 +++ configure.in 2009-02-14 12:21:46.000000000 +0100 @@ -565,33 +565,11 @@ dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it. dnl * It may also be broken in AIX. -AC_CACHE_CHECK([whether posix_fallocate() works],i_cv_posix_fallocate_works,[ - AC_TRY_RUN([ - #define _XOPEN_SOURCE 600 - #include - #include - #include - #include - #if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7) - possibly broken posix_fallocate - #endif - int main() { - int fd = creat("conftest.temp", 0600); - int ret; - if (fd == -1) { - perror("creat()"); - return 2; - } - ret = posix_fallocate(fd, 1024, 1024) < 0 ? 1 : 0; - unlink("conftest.temp"); - return ret; - } - ], [ - i_cv_posix_fallocate_works=yes - ], [ - i_cv_posix_fallocate_works=no - ]) -]) + +dnl * This check doesn't work when cros compiling. +dnl * The glibc on unslung is to old so just set it to no. + +i_cv_posix_fallocate_works=no if test $i_cv_posix_fallocate_works = yes; then AC_DEFINE(HAVE_POSIX_FALLOCATE,, Define if you have a working posix_fallocate()) fi @@ -800,30 +778,11 @@ dnl * make sure size_t isn't signed. we'd probably work fine with it, but 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([[ - #include - int main() { - /* return 0 if we're signed */ - exit((size_t)(int)-1 <= 0 ? 0 : 1); - } - ]])],[ - i_cv_signed_size_t=yes - echo - echo "Your system's size_t is a signed integer, Dovecot isn't designed to" - echo "support it. It probably works just fine, but it's less resistant to" - echo "buffer overflows. If you're not worried about this and still want to" - echo "compile Dovecot, set ignore_signed_size=1 environment." - - if test "$ignore_signed_size" = ""; then - AC_MSG_ERROR([aborting]) - fi - echo "..ignoring as requested.." - ],[ - i_cv_signed_size_t=no - ],[]) -]) +dnl * This check doesn't work when cros compiling. + +i_cv_signed_size_t=no + dnl Note: we check size_t rather than ssize_t here, because on OSX 10.2 dnl ssize_t = int and size_t = unsigned long. We're mostly concerned about dnl printf format here, so check the size_t one. @@ -914,59 +873,17 @@ AC_MSG_RESULT($i_cv_field_tm_gmtoff) dnl * how large time_t values does gmtime() accept? -AC_CACHE_CHECK([how large time_t values gmtime() accepts],i_cv_gmtime_max_time_t,[ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ - #include - #include - int main() { - FILE *f; - int bits; - - for (bits = 1; bits < sizeof(time_t)*8; bits++) { - time_t t = ((time_t)1 << bits) - 1; - if (gmtime(&t) == NULL) { - bits--; - break; - } - } - if (bits > 40) { - /* Solaris 9 breaks after 55 bits. Perhaps other systems break earlier. - Let's just do the same as Cyrus folks and limit it to 40 bits. */ - bits = 40; - } - - f = fopen("conftest.temp", "w"); - if (f == NULL) { - perror("fopen()"); - return 1; - } - fprintf(f, "%d", bits); - fclose(f); - return 0; - } - ]])],[ - i_cv_gmtime_max_time_t=`cat conftest.temp` - rm -f conftest.temp - ], [ - printf "check failed, assuming " - i_cv_gmtime_max_time_t=31 - ],[]) -]) + +dnl * This check doesn't work when cros compiling. + +i_cv_gmtime_max_time_t=32 + 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([[ - #include - int main() { - /* return 0 if we're signed */ - exit((time_t)(int)-1 <= 0 ? 0 : 1); - } - ]])],[ - i_cv_signed_time_t=yes - ], [ - i_cv_signed_time_t=no - ]) -]) +dnl * This check doesn't work when cros compiling. + +i_cv_signed_time_t=yes + if test $i_cv_signed_time_t = yes; then AC_DEFINE(TIME_T_SIGNED,, Define if your time_t is signed) fi @@ -1072,122 +989,20 @@ ]) dnl * If mmap() plays nicely with write() -AC_CACHE_CHECK([whether shared mmaps get updated by write()s],i_cv_mmap_plays_with_write,[ - AC_TRY_RUN([ - #include - #include - #include - #include - #include - #include - int main() { - /* return 0 if we're signed */ - int f = open("conftest.mmap", O_RDWR|O_CREAT|O_TRUNC, 0600); - void *mem; - if (f == -1) { - perror("open()"); - return 1; - } - unlink("conftest.mmap"); - - write(f, "1", 2); - mem = mmap(NULL, 2, PROT_READ|PROT_WRITE, MAP_SHARED, f, 0); - if (mem == MAP_FAILED) { - perror("mmap()"); - return 1; - } - strcpy(mem, "2"); - msync(mem, 2, MS_SYNC); - lseek(f, 0, SEEK_SET); - write(f, "3", 2); - - return strcmp(mem, "3") == 0 ? 0 : 1; - } - ], [ - i_cv_mmap_plays_with_write=yes - ], [ - i_cv_mmap_plays_with_write=no - ]) -]) + +dnl * This check doesn't work when cros compiling. + +i_cv_mmap_plays_with_write=yes + if test $i_cv_mmap_plays_with_write = no; then AC_DEFINE(MMAP_CONFLICTS_WRITE,, [Define if shared mmaps don't get updated by write()s]) fi dnl * see if fd passing works -AC_CACHE_CHECK([whether fd passing works],i_cv_fd_passing,[ - for i in 1 2; do - old_cflags="$CFLAGS" - CFLAGS="$CFLAGS -I$srcdir/src/lib $srcdir/src/lib/fdpass.c" - if test $i = 2; then - CFLAGS="$CFLAGS -DBUGGY_CMSG_MACROS" - fi - - AC_TRY_RUN([ - #include - #include - #include - #include - #include - #include - #include "fdpass.h" - - int nopen(void) - { - int i, n; - struct stat sb; - for (i = n = 0; i < 256; i++) - if (fstat(i, &sb) == 0) n++; - return n; - } - int main(void) - { - int fd[2], send_fd, recv_fd, status, n1, n2; - struct stat st, st2; - char data; - - send_fd = creat("conftest.fdpass", 0600); - if (send_fd == -1) return 2; - unlink("conftest.fdpass"); - if (fstat(send_fd, &st) < 0) return 2; - if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) return 2; - n1 = nopen(); - - switch (fork()) { - case -1: - return 2; - case 0: - alarm(1); - if (fd_send(fd[0], send_fd, &data, 1) != 1) return 2; - return 0; - default: - alarm(2); - if (wait(&status) == -1) - return 2; - if (status != 0) - return status; - if (fd_read(fd[1], &data, 1, &recv_fd) != 1) return 1; - if (fstat(recv_fd, &st2) < 0) return 2; - /* nopen check is for making sure that only a single fd - was received */ - n2 = nopen(); - return st.st_ino == st2.st_ino && n2 == n1 + 1 ? 0 : 1; - } - } - ], [ - CFLAGS=$old_cflags - if test $i = 2; then - i_cv_fd_passing=buggy_cmsg_macros - else - i_cv_fd_passing=yes - fi - break - ], [ - dnl no, try with BUGGY_CMSG_MACROS - CFLAGS=$old_cflags - i_cv_fd_passing=no - ]) - done -]); + +dnl * This check doesn't work when cros compiling. + +i_cv_fd_passing=yes case "$host_os" in darwin[[1-9]].*) @@ -1393,26 +1208,10 @@ dnl *** C99 vsnprintf()? dnl *** -AC_CACHE_CHECK([for C99 vsnprintf()],i_cv_c99_vsnprintf,[ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ - #include - #include - static int f(const char *fmt, ...) { - va_list args; - char buf[13]; - int ret; - - va_start(args, fmt); - ret = vsnprintf(buf, 11, fmt, args) != 12 || buf[11-1] != '\0'; - va_end(args); - return ret; - } - int main() { - return f("hello %s%d", "world", 1); - }]])], - [i_cv_c99_vsnprintf=yes], - [i_cv_c99_vsnprintf=no]) -]) +dnl * This check doesn't work when cros compiling. + +i_cv_c99_vsnprintf=yes + if test $i_cv_c99_vsnprintf = no; then AC_DEFINE(HAVE_OLD_VSNPRINTF,, Define if you don't have C99 compatible vsnprintf() call) fi @@ -1421,42 +1220,11 @@ dnl *** va_copy checks (from GLIB) dnl *** -AC_CACHE_CHECK([for an implementation of va_copy()],lib_cv_va_copy,[ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ - #include - void f (int i, ...) { - va_list args1, args2; - va_start (args1, i); - va_copy (args2, args1); - if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) - exit (1); - va_end (args1); va_end (args2); - } - int main() { - f (0, 42); - return 0; - }]])], - [lib_cv_va_copy=yes], - [lib_cv_va_copy=no],[]) -]) -AC_CACHE_CHECK([for an implementation of __va_copy()],lib_cv___va_copy,[ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ - #include - void f (int i, ...) { - va_list args1, args2; - va_start (args1, i); - __va_copy (args2, args1); - if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) - exit (1); - va_end (args1); va_end (args2); - } - int main() { - f (0, 42); - return 0; - }]])], - [lib_cv___va_copy=yes], - [lib_cv___va_copy=no],[]) -]) +dnl * This check doesn't work when cros compiling. + +lib_cv_va_copy=yes +lib_cv___va_copy=yes +lib_cv_va_val_copy=yes if test "x$lib_cv_va_copy" = "xyes"; then va_copy_func=va_copy @@ -1469,25 +1237,6 @@ AC_DEFINE_UNQUOTED(VA_COPY,$va_copy_func,[A 'va_copy' style function]) fi -AC_CACHE_CHECK([whether va_lists can be copied by value],lib_cv_va_val_copy,[ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ - #include - void f (int i, ...) { - va_list args1, args2; - va_start (args1, i); - args2 = args1; - if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) - exit (1); - va_end (args1); va_end (args2); - } - int main() { - f (0, 42); - return 0; - }]])], - [lib_cv_va_val_copy=yes], - [lib_cv_va_val_copy=no],[]) -]) - if test "x$lib_cv_va_val_copy" = "xno"; then AC_DEFINE(VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values]) fi