Mercurial > dovecot > original-hg > dovecot-1.2
changeset 733:280c0952fa90 HEAD
AC_TYPEOF macro: with gcc we can check the type with printf() + -Werror
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 01 Dec 2002 19:08:57 +0200 |
parents | 890ee8db4f3e |
children | b89a43bd90c5 |
files | configure.in |
diffstat | 1 files changed, 60 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Sun Dec 01 18:38:14 2002 +0200 +++ b/configure.in Sun Dec 01 19:08:57 2002 +0200 @@ -198,24 +198,68 @@ result="" visible="unknown" + AC_MSG_CHECKING([type of $1]) - AC_MSG_CHECKING([type of $1]) - for type in $order; do - type="`echo $type|sed 's/-/ /g'`" - AC_TRY_COMPILE([ - #include <sys/types.h> - typedef $type $1; - ],, [ - if test "$result" != ""; then - dnl * compiler allows redefining to anything - result="" - visible="unknown" - break + if test "x$ac_cv_prog_gcc" = "xyes"; then + dnl * try with printf() + -Werror + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + + for type in $order; do + case "$type" in + int) + fmt="%d" + ;; + long) + fmt="%ld" + ;; + long-long) + fmt="%lld" + ;; + *) + fmt="" + ;; + esac + + if test "$fmt" != ""; then + AC_TRY_COMPILE([ + #include <sys/types.h> + #include <stdio.h> + ], [ + printf("$fmt", ($1)0); + ], [ + if test "$result" != ""; then + dnl * warning check isn't working + result="" + visible="unknown" + break + fi + result="`echo $type|sed 's/-/ /g'`" + visible="$result" + ]) fi - result="$type" - visible="$type" - ]) - done + done + CFLAGS="$old_CFLAGS" + fi + + if test "$result" = ""; then + for type in $order; do + type="`echo $type|sed 's/-/ /g'`" + AC_TRY_COMPILE([ + #include <sys/types.h> + typedef $type $1; + ],, [ + if test "$result" != ""; then + dnl * compiler allows redefining to anything + result="" + visible="unknown" + break + fi + result="$type" + visible="$type" + ]) + done + fi if test "$result" = ""; then dnl * check with sizes