Source: kannel
Version: 1.4.5-7
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs

kannel fails to cross build from source for two reasons. One is its use
of AC_CHECK_FILE. The macro is meant to check for files on the host
system, but kannel exclusively uses it for checking build system files.
For that task, a simple test -e is the solution. The other issue is that
it misdetects presence of mysql. During cross compilation mysql_config
does not work. Please use pkg-config instead. When applying the patch,
you need to add pkg-config to Build-Depends. Please consider applying
it.

Helmut
--- kannel-1.4.5.orig/configure.in
+++ kannel-1.4.5/configure.in
@@ -494,7 +494,7 @@
         ${loc}/share/sgml/dsssl/docbook-dsssl-nwalsh/html/docbook.dsl \
         ${loc}/share/dsssl/docbook-dsssl/html/docbook.dsl ; do
       if test "x$found" = "x" ; then 
-	AC_CHECK_FILE($file,HTML_DSL=$file; found=1)
+	AS_IF([test -e "$file"],HTML_DSL=$file; found=1)
       fi
     done
   fi
@@ -512,7 +512,7 @@
         ${loc}/share/sgml/dsssl/docbook-dsssl-nwalsh/print/docbook.dsl \
         ${loc}/share/dsssl/docbook-dsssl/print/docbook.dsl ; do
       if test "x$found" = "x" ; then 
-	AC_CHECK_FILE($file,TEX_DSL=$file; found=1)
+	AS_IF([test -e "$file"],TEX_DSL=$file; found=1)
       fi
     done
   fi    
@@ -531,7 +531,7 @@
         ${loc}/share/sgml/dsssl/docbook-dsssl-nwalsh/dtds/decls/xml.dcl \
         ${loc}/share/dsssl/docbook-dsssl/dtds/decls/xml.dcl ; do
       if test "x$found" = "x" ; then 
-    AC_CHECK_FILE($file,XML_DCL=$file; found=1)
+        AS_IF([test -e "$file"],XML_DCL=$file; found=1)
       fi
     done
   fi
@@ -993,6 +993,16 @@
     ])
     
     AC_MSG_RESULT(searching)
+    mysql_found=no
+    AS_IF([test "x$mysqlloc" = x],,[
+      PKG_CHECK_MODULES([MYSQLCLIENT],[mysqlclient],[
+        CFLAGS="$CFLAGS $MYSQLCLIENT_CFLAGS"
+        LIBS="$LIBS $MYSQLCLIENT_LIBS"
+	mysql_found=yes
+      ])
+    ])
+
+    if test "$mysql_found" = no; then
     AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, [$PATH:$mysqlloc/bin:$mysqlloc])
     dnl check for MySQL 4.x style mysql_config information
     if test "$MYSQL_CONFIG" = "no"; then
@@ -1001,9 +1011,9 @@
         if test "x$found" = "x" ; then
             AC_MSG_CHECKING([for MySQL client support in])
             AC_MSG_RESULT($loc)
-            AC_CHECK_FILE("$loc/include/mysql/mysql.h",
+            AS_IF([test -e "$loc/include/mysql/mysql.h"],
             [CFLAGS="$CFLAGS -I$loc/include/mysql"; LIBS="$LIBS -L$loc/lib/mysql -lmysqlclient"]; found=1,
-            [AC_CHECK_FILE("$loc/include/mysql.h",
+            [AS_IF([test -e "$loc/include/mysql.h"],
                 [CFLAGS="$CFLAGS -I$loc/include"; LIBS="$LIBS -L$loc/lib -lmysqlclient"]; found=1
             )]
             )
@@ -1043,6 +1053,7 @@
         CFLAGS="$CFLAGS $MYSQL_CFLAGS"
         AC_MSG_RESULT([$MYSQL_CFLAGS])
     fi
+    fi
     AC_CHECK_HEADERS(mysql/mysql.h mysql/mysql_version.h)
     AC_CHECK_LIB(mysqlclient_r, mysql_stmt_init, [],
 		AC_CHECK_LIB(mysqlclient, mysql_stmt_init, [], [AC_MSG_ERROR([Unable to find MySQL client libraries version >= 4.1])])
@@ -1241,11 +1252,11 @@
     		if test "x$found" = "x" ; then
     			AC_MSG_CHECKING([for PostgresSQL include files in])
     			AC_MSG_RESULT($loc)
-    			AC_CHECK_FILE("$loc/include/postgresql/libpq-fe.h",
+    			AS_IF([test -e "$loc/include/postgresql/libpq-fe.h"],
             	  [CFLAGS="$CFLAGS -I$loc/include/postgresql"; LIBS="$LIBS -L$loc/lib/postgresql -lpq"]; found=1,
-            	  [AC_CHECK_FILE("$loc/include/pgsql/libpq-fe.h",
+            	  [AS_IF([test -e "$loc/include/pgsql/libpq-fe.h"],
             	    [CFLAGS="$CFLAGS -I$loc/include/pgsql"; LIBS="$LIBS -L$loc/lib/pgsql -lpq"]; found=1,
-            	    [AC_CHECK_FILE("$loc/pgsql/include/libpq-fe.h",
+            	    [AS_IF([test -e "$loc/pgsql/include/libpq-fe.h"],
             	    [CFLAGS="$CFLAGS -I$loc/pgsql/include"; LIBS="$LIBS -L$loc/pgsql/lib -lpq"]; found=1,
                   )]
                 )])
@@ -1314,9 +1325,9 @@
             if test "x$found" = "x" ; then
                 AC_MSG_CHECKING([for Redis include files in])
                 AC_MSG_RESULT($loc)
-                AC_CHECK_FILE("$loc/hiredis.h",
+                AS_IF([test -e "$loc/hiredis.h"],
                   [CFLAGS="$CFLAGS -I$loc"; LIBS="$LIBS -L$loc -lhiredis"]; found=1,
-                  [AC_CHECK_FILE("$loc/include/hiredis/hiredis.h",
+                  [AS_IF([test -e "$loc/include/hiredis/hiredis.h"],
                     [CFLAGS="$CFLAGS -I$loc/include/hiredis"; LIBS="$LIBS -L$loc/lib -lhiredis"]; found=1
                   )]
                 )
@@ -1412,7 +1423,7 @@
         if test "x$found" = "x" ; then
             AC_MSG_CHECKING([for Cassandra include files in])
             AC_MSG_RESULT($loc)
-            AC_CHECK_FILE("$loc/include/cassandra.h",
+            AS_IF([test -e "$loc/include/cassandra.h"],
               [CFLAGS="$CFLAGS -I$loc/include"; LIBS="$LIBS -L$loc/lib -lcassandra"]; found=1
             )
         fi

Reply via email to