Source: apr-util Version: 1.6.1-5 Tags: patch upstream User: debian-cr...@lists.debian.org Usertags: ftcbfs
apr-utils fails to cross build from source, because it uses mysql_config and mysql_config does never work during cross compilation. A good alternative is using pkg-config. I'm attaching an upstreamable patch to update configure to use pkg-config. Since it uses the standard PKG_CHECK_MODULES macro, it requires pkg.m4 from pkg-config. In apr-util, doing so requires an appropriate sinclude directive. Very likely, upstream would want a vendor copy of pkg.m4, which is not included in my patch. Beyond this, pkg-config only kicks in when passing yes to --with-mysql, otherwise it keeps using mysql_config for maximum backwards compatibility. Please consider applying the patch. Helmut
--- apr-util-1.6.1.orig/build/dbd.m4 +++ apr-util-1.6.1/build/dbd.m4 @@ -167,23 +167,32 @@ AC_ARG_WITH([mysql], APR_HELP_STRING([--with-mysql=DIR], [enable MySQL DBD driver]), [ - if test "$withval" = "yes"; then - AC_PATH_PROG([MYSQL_CONFIG],[mysql_config]) - if test "x$MYSQL_CONFIG" = "x"; then - AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config]) - fi - if test "x$MYSQL_CONFIG" != 'x'; then - mysql_CPPFLAGS="`$MYSQL_CONFIG --include`" - mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`" - mysql_LIBS="`$MYSQL_CONFIG --libs_r`" + AS_IF([test "$withval" = "yes"],[ + PKG_CHECK_MODULES([MYSQLCLIENT],[mysqlclient],[ + APR_ADDTO(CPPFLAGS,[$MYSQLCLIENT_CFLAGS]) + APR_ADDTO(LIBS,[$MYSQLCLIENT_LIBS]) - APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS]) - APR_ADDTO(LIBS, [$mysql_LIBS]) + if echo "$MYSQLCLIENT_LIBS" | grep -q mariadb; then + my_library=mariadb + fi + ],[ + AC_PATH_PROG([MYSQL_CONFIG],[mysql_config]) + if test "x$MYSQL_CONFIG" = "x"; then + AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config]) + fi + if test "x$MYSQL_CONFIG" != 'x'; then + mysql_CPPFLAGS="`$MYSQL_CONFIG --include`" + mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`" + mysql_LIBS="`$MYSQL_CONFIG --libs_r`" - if $MYSQL_CONFIG --libs_r | grep -q mariadb; then - my_library="mariadb" - fi - fi + APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS]) + APR_ADDTO(LIBS, [$mysql_LIBS]) + + if $MYSQL_CONFIG --libs_r | grep -q mariadb; then + my_library="mariadb" + fi + fi + ]) AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break]) if test "$apr_have_mysql" = "0"; then @@ -193,7 +202,9 @@ AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h]) AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0]) fi - if test "$apu_have_mysql" = "1" && test "x$MYSQL_CONFIG" != 'x'; then + if test "$apu_have_mysql" = 1 && test "x$MYSQLCLIENT_CFLAGS" != x; then + APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$MYSQLCLIENT_CFLAGS]) + elif test "$apu_have_mysql" = "1" && test "x$MYSQL_CONFIG" != 'x'; then APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS]) fi elif test "$withval" = "no"; then @@ -231,7 +242,7 @@ if test "$apu_have_mysql" = "1"; then APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS]) fi - fi + ]) ]) AC_SUBST(apu_have_mysql)