[dovecot-cvs] dovecot configure.in,1.64,1.65

cras at procontrol.fi cras at procontrol.fi
Sun Dec 1 19:08:59 EET 2002


Update of /home/cvs/dovecot
In directory danu:/tmp/cvs-serv19057

Modified Files:
	configure.in 
Log Message:
AC_TYPEOF macro: with gcc we can check the type with printf() + -Werror



Index: configure.in
===================================================================
RCS file: /home/cvs/dovecot/configure.in,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- configure.in	1 Dec 2002 16:38:14 -0000	1.64
+++ configure.in	1 Dec 2002 17:08:57 -0000	1.65
@@ -198,24 +198,68 @@
 
   result=""
   visible="unknown"
-
   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




More information about the dovecot-cvs mailing list