Source: dovecot
Version: 1:2.3.11.3+dfsg1-2
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs

Hi,

thank you for removing AC_RUN_IFELSE from configure.ac. Unfortunately,
they're not gone. Just moved to m4/*.m4. As such they still affect cross
building. That being said, dovecot (unlike many other users of
AC_RUN_IFELSE) uses AC_CACHE_CHECK, which enables seeding results. The
check for the signedness of size_t really doesn't have to be run as that
is a compile time property. I'm attaching a patch that reworks it
towards using AC_COMPUTE_INT.

Beyond that, dovecot uses mysql_config. I've looked into that and
mysql_config is unfixably broken during cross builds. It will not be
fixed. Instead, please use pkg-config. My patch implements that with a
fallback to mysql_config to avoid breaking other users.

Last but not least, src/lib-lua/Makefile.am adds $(LUA_LIBS) to
libdovecot_lua_la_DEPENDENCIES. As it happens, LUA_LIBS contains a -L
flag and when that flag shows up in a dependency, make gives up. I have
no clue why one would add LUA_LIBS to DEPENDENCIES as it already is
being correctly added to LIBADD. My patch suggests to quite simply drop
that.

Can you apply this patch as well?

Helmut
--- dovecot-2.3.11.3+dfsg1.orig/m4/size_t_signed.m4
+++ dovecot-2.3.11.3+dfsg1/m4/size_t_signed.m4
@@ -3,14 +3,11 @@
 dnl * that it's unsigned and only some old systems define it as signed.
 AC_DEFUN([DOVECOT_SIZE_T_SIGNED], [
   AC_CACHE_CHECK([whether size_t is signed],i_cv_signed_size_t,[
-    AC_RUN_IFELSE([AC_LANG_SOURCE([[
+    AC_COMPUTE_INT([i_cv_signed_size_t_num],[[(size_t)(int)-1 <= 0 ? 0 : 1]],[[
       #include <sys/types.h>
       #include <stdlib.h>
-      int main() {
-        /* return 0 if we're signed */
-        exit((size_t)(int)-1 <= 0 ? 0 : 1);
-      }
-    ]])],[
+    ]])
+    AS_IF([test "$i_cv_signed_size_t_num" = 0],[
       i_cv_signed_size_t=yes
   
       echo
@@ -25,7 +22,7 @@
       echo "..ignoring as requested.."
     ],[
       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
--- dovecot-2.3.11.3+dfsg1.orig/m4/want_mysql.m4
+++ dovecot-2.3.11.3+dfsg1/m4/want_mysql.m4
@@ -1,26 +1,28 @@
 AC_DEFUN([DOVECOT_WANT_MYSQL], [
   have_mysql=no
-  if test $want_mysql != no; then
-    AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, mysql_config, NO)
-    if test $MYSQL_CONFIG = NO; then
-  	# based on code from PHP
-  	MYSQL_LIBS="-lmysqlclient -lz -lm"
-  	for i in /usr /usr/local /usr/local/mysql; do
-  		for j in include include/mysql ""; do
-  			if test -r "$i/$j/mysql.h"; then
-  				MYSQL_INCLUDE="-I$i/$j"
-  			fi
-  		done
-  		for j in lib lib/mysql lib64 lib64/mysql ""; do
-  			if test -f "$i/$j/libmysqlclient.so" || test -f "$i/$j/libmysqlclient.a"; then
-  				MYSQL_LIBS="-L$i/$j -lmysqlclient -lz -lm"
-  			fi
-  		done
-  	done
-    else
-      MYSQL_INCLUDE="`$MYSQL_CONFIG --include`"
-      MYSQL_LIBS="`$MYSQL_CONFIG --libs`"
-    fi
+  AS_IF([test $want_mysql != no],[
+    PKG_CHECK_MODULES([MYSQL],[mysqlclient],,[
+      AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, mysql_config, NO)
+      if test $MYSQL_CONFIG = NO; then
+    	# based on code from PHP
+    	MYSQL_LIBS="-lmysqlclient -lz -lm"
+    	for i in /usr /usr/local /usr/local/mysql; do
+    		for j in include include/mysql ""; do
+    			if test -r "$i/$j/mysql.h"; then
+    				MYSQL_CFLAGS="-I$i/$j"
+    			fi
+    		done
+    		for j in lib lib/mysql lib64 lib64/mysql ""; do
+    			if test -f "$i/$j/libmysqlclient.so" || test -f "$i/$j/libmysqlclient.a"; then
+    				MYSQL_LIBS="-L$i/$j -lmysqlclient -lz -lm"
+    			fi
+    		done
+    	done
+      else
+        MYSQL_CFLAGS="`$MYSQL_CONFIG --include`"
+        MYSQL_LIBS="`$MYSQL_CONFIG --libs`"
+      fi
+    ])
   
     old_LIBS=$LIBS
     if test "$MYSQL_LIBS" != ""; then
@@ -31,14 +33,10 @@
     LIBS="$LIBS -lz -lm"
     AC_CHECK_LIB(mysqlclient, mysql_init, [
   		old_CPPFLAGS=$CPPFLAGS
-  		if test "$MYSQL_INCLUDE" != ""; then
-  			CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE"
+  		if test "$MYSQL_CFLAGS" != ""; then
+  			CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS"
   		fi
   		AC_CHECK_HEADER(mysql.h, [
-  			if test "$MYSQL_INCLUDE" != ""; then
-  				MYSQL_CFLAGS="$MYSQL_CFLAGS $MYSQL_INCLUDE"
-  			fi
-  
   			AC_CHECK_LIB(mysqlclient, mysql_ssl_set, [
   				AC_DEFINE(HAVE_MYSQL_SSL,, [Define if your MySQL library has SSL functions])
   				if test "x$have_openssl" = "yes"; then
@@ -85,5 +83,5 @@
       MYSQL_CFLAGS=
     fi
     LIBS=$old_LIBS
-  fi
+  ])
 ])
--- dovecot-2.3.11.3+dfsg1.orig/src/lib-lua/Makefile.am
+++ dovecot-2.3.11.3+dfsg1/src/lib-lua/Makefile.am
@@ -9,7 +9,7 @@
 	dlua-script.c \
 	dlua-dovecot.c \
 	dlua-compat.c
-libdovecot_lua_la_DEPENDENCIES = ../lib-dovecot/libdovecot.la $(LUA_LIBS)
+libdovecot_lua_la_DEPENDENCIES = ../lib-dovecot/libdovecot.la
 libdovecot_lua_la_LIBADD = ../lib-dovecot/libdovecot.la $(LUA_LIBS)
 
 headers = \

Reply via email to