dovecot-2.0: configure: Use cache for more checks.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Oct 9 22:08:54 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/e7f8f15f1c4c
changeset: 10014:e7f8f15f1c4c
user: Timo Sirainen <tss at iki.fi>
date: Fri Oct 09 15:08:46 2009 -0400
description:
configure: Use cache for more checks.
diffstat:
1 file changed, 409 insertions(+), 321 deletions(-)
configure.in | 730 ++++++++++++++++++++++++++++++++--------------------------
diffs (truncated from 888 to 300 lines):
diff -r 22fe48dbed89 -r e7f8f15f1c4c configure.in
--- a/configure.in Fri Oct 09 14:09:01 2009 -0400
+++ b/configure.in Fri Oct 09 15:08:46 2009 -0400
@@ -357,29 +357,35 @@ AC_CHECK_LIB(rt, clock_gettime, [
dnl strtoimax and strtoumax are macros in HP-UX, so inttypes.h must be included
dnl Link instead of just compiling since there's something wrong with Tru64
-AC_MSG_CHECKING([for strtoimax])
-AC_TRY_LINK([
- #include <inttypes.h>
-], [
- strtoimax(0, 0, 0);
-], [
+AC_CACHE_CHECK([for strtoimax],i_cv_have_strtoimax,[
+ AC_TRY_LINK([
+ #include <inttypes.h>
+ ], [
+ strtoimax(0, 0, 0);
+ ], [
+ i_cv_have_strtoimax=yes
+ ], [
+ i_cv_have_strtoimax=no
+ ])
+])
+if test $i_cv_have_strtoimax = yes; then
AC_DEFINE(HAVE_STRTOIMAX,, Define if you have strtoimax function)
- AC_MSG_RESULT(yes)
-], [
- AC_MSG_RESULT(no)
-])
-
-AC_MSG_CHECKING([for strtoumax])
-AC_TRY_LINK([
- #include <inttypes.h>
-], [
- strtoumax(0, 0, 0);
-], [
+fi
+
+AC_CACHE_CHECK([for strtoumax],i_cv_have_strtoumax,[
+ AC_TRY_LINK([
+ #include <inttypes.h>
+ ], [
+ strtoumax(0, 0, 0);
+ ], [
+ i_cv_have_strtoumax=yes
+ ], [
+ i_cv_have_strtoumax=no
+ ])
+])
+if test $i_cv_have_strtoumax = yes; then
AC_DEFINE(HAVE_STRTOUMAX,, Define if you have strtoumax function)
- AC_MSG_RESULT(yes)
-], [
- AC_MSG_RESULT(no)
-])
+fi
dnl * I/O loop function
have_ioloop=no
@@ -489,8 +495,8 @@ fi
fi
if (test "$notify" = "" && test "$ioloop" = kqueue) || test "$notify" = "kqueue"; then
- AC_MSG_CHECKING([if we can use BSD kqueue() notify])
dnl * BSD kqueue() notify
+ AC_MSG_CHECKING([whether we can use BSD kqueue() notify])
if test "$ac_cv_func_kqueue" = yes && test "$ac_cv_func_kevent" = yes ; then
have_notify=kqueue
notify=kqueue
@@ -499,7 +505,7 @@ if (test "$notify" = "" && test "$ioloop
Use BSD kqueue directory changes notificaton)
else
AC_MSG_RESULT("no")
- if test "$notfify" = "kqueue" ; then
+ if test "$notify" = "kqueue" ; then
AC_MSG_ERROR([kqueue notify requested but kqueue() is not available])
notify=""
fi
@@ -507,42 +513,52 @@ fi
fi
if test "$notify" = "" || test "$notify" = "dnotify"; then
- AC_MSG_CHECKING([whether we can use dnotify])
dnl * dnotify?
- AC_TRY_COMPILE([
- #define _GNU_SOURCE
- #include <fcntl.h>
- #include <signal.h>
- #include <unistd.h>
- ], [
- fcntl(0, F_SETSIG, SIGRTMIN);
- fcntl(0, F_NOTIFY, DN_CREATE | DN_DELETE | DN_RENAME | DN_MULTISHOT);
- ], [
- AC_MSG_RESULT(yes)
+ AC_CACHE_CHECK([whether we can use dnotify],i_cv_have_dnotify,[
+ AC_TRY_COMPILE([
+ #define _GNU_SOURCE
+ #include <fcntl.h>
+ #include <signal.h>
+ #include <unistd.h>
+ ], [
+ fcntl(0, F_SETSIG, SIGRTMIN);
+ fcntl(0, F_NOTIFY, DN_CREATE | DN_DELETE | DN_RENAME | DN_MULTISHOT);
+ ], [
+ i_cv_have_dnotify=yes
+ ], [
+ i_cv_have_dnotify=no
+ ])
+ ])
+ if test $i_cv_have_dnotify = yes; then
AC_DEFINE(IOLOOP_NOTIFY_DNOTIFY,, Use Linux dnotify)
have_notify=dnotify
notify=dnotify
- ], [
- AC_MSG_RESULT(no)
+ else
if test "$notify" = "dnotify"; then
AC_MSG_ERROR([dnotify requested but not available])
fi
- ])
+ fi
fi
if test "$have_notify" = "none"; then
AC_DEFINE(IOLOOP_NOTIFY_NONE,, No special notify support)
fi
-dnl * GLIBC?
-AC_TRY_COMPILE([
- #include <stdlib.h>
- #ifdef __GLIBC__
- we have glibc
- #endif
-],,, [
+AC_CACHE_CHECK([whether we have glibc],i_cv_have_glibc,[
+ AC_TRY_COMPILE([
+ #include <stdlib.h>
+ #ifdef __GLIBC__
+ we have glibc
+ #endif
+ ],, [
+ i_cv_have_glibc=no
+ ], [
+ i_cv_have_glibc=yes
+ ])
+])
+if test "$i_cv_have_glibc" = "yes"; then
AC_DEFINE(PREAD_WRAPPERS,, Define if pread/pwrite needs _XOPEN_SOURCE 500)
-])
+fi
dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
dnl * It may also be broken in AIX.
@@ -606,7 +622,7 @@ AC_DEFUN([AC_TYPEOF], [
result=""
visible="unknown"
AC_MSG_CHECKING([type of $1])
-
+ AC_CACHE_VAL(i_cv_typeof_$1,[
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
dnl * try with printf() + -Werror
old_CFLAGS="$CFLAGS"
@@ -708,8 +724,11 @@ AC_DEFUN([AC_TYPEOF], [
fi
],[],[])
fi
-
- typeof_$1=$result
+ i_cv_typeof_$1=$result/$visible
+ ])
+
+ typeof_$1=`echo $i_cv_typeof_$1 | sed s,/.*$,,`
+ visible=`echo $i_cv_typeof_$1 | sed s,^.*/,,`
AC_MSG_RESULT($visible)
])
@@ -964,21 +983,26 @@ fi
dnl Our implementation of AC_C_FLEXIBLE_ARRAY_MEMBER.
dnl Use it until autoconf 2.61+ becomes more widely used
-AC_MSG_CHECKING([if we can use C99-like flexible array members])
-AC_TRY_COMPILE([
- struct foo {
- int x;
- char y[];
- };
-], [
- struct foo foo;
-], [
- flexible_value=""
- AC_MSG_RESULT(yes)
-], [
+AC_CACHE_CHECK([if we can use C99-like flexible array members],i_cv_c99_flex_arrays,[
+ AC_TRY_COMPILE([
+ struct foo {
+ int x;
+ char y[];
+ };
+ ], [
+ struct foo foo;
+ ], [
+ i_cv_c99_flex_arrays=yes
+ ], [
+ i_cv_c99_flex_arrays=no
+ ])
+])
+
+if test $i_cv_c99_flex_arrays = yes; then
flexible_value=1
- AC_MSG_RESULT(no)
-])
+else
+ flexible_value=
+fi
AC_DEFINE_UNQUOTED(FLEXIBLE_ARRAY_MEMBER, $flexible_value, How to define flexible array members in structs)
dnl * do we have struct iovec
@@ -998,81 +1022,114 @@ AC_MSG_RESULT($i_cv_struct_iovec)
AC_MSG_RESULT($i_cv_struct_iovec)
dnl * is dev_t an integer or something else?
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <sys/types.h>
- struct test { dev_t a; };
- static struct test t = { 0 };
-]], [[]])],[],[
+AC_CACHE_CHECK([whether dev_t is struct],i_cv_dev_t_struct,[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+ struct test { dev_t a; };
+ static struct test t = { 0 };
+ ]],
+ [[ ]])], [
+ i_cv_dev_t_struct=no
+ ],[
+ i_cv_dev_t_struct=yes
+ ])
+])
+if test $i_cv_dev_t_struct = yes; then
AC_DEFINE(DEV_T_STRUCT,, Define if your dev_t is a structure instead of integer type)
-
- dnl we can't initialize structures, so don't warn about them either
- if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
- CFLAGS=`echo $CFLAGS|sed 's/ -W\b//'`
- fi
-])
+fi
dnl * Do we have RLIMIT_AS?
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <sys/types.h>
- #include <sys/time.h>
- #include <sys/resource.h>
-]], [[
- struct rlimit r;
- getrlimit(RLIMIT_AS, &r);
-]])],[
+AC_CACHE_CHECK([whether RLIMIT_AS exists],i_cv_have_rlimit_as,[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
+ ]], [[
+ struct rlimit r;
+ getrlimit(RLIMIT_AS, &r);
+ ]])],[
+ i_cv_have_rlimit_as=yes
+ ], [
+ i_cv_have_rlimit_as=no
+ ])
+])
+
+if test $i_cv_have_rlimit_as = yes; then
AC_DEFINE(HAVE_RLIMIT_AS,, Define if you have RLIMIT_AS for setrlimit())
-],[])
+fi
dnl * Do we have RLIMIT_NPROC?
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <sys/types.h>
- #include <sys/time.h>
- #include <sys/resource.h>
-]], [[
- struct rlimit r;
- getrlimit(RLIMIT_NPROC, &r);
-]])],[
+AC_CACHE_CHECK([whether RLIMIT_NPROC exists],i_cv_have_rlimit_nproc,[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
+ ]], [[
+ struct rlimit r;
+ getrlimit(RLIMIT_NPROC, &r);
+ ]])],[
+ i_cv_have_rlimit_nproc=yes
+ ],[
+ i_cv_have_rlimit_nproc=no
+ ])
More information about the dovecot-cvs
mailing list