Source: libapache-mod-musicindex Version: 1.4.1-3.1 Tags: patch upstream User: debian-cr...@lists.debian.org Usertags: ftcbfs
libapache-mod-musicindex fails to cross build from source for multiple reasons, all of which relate to its configure script. It determines the apache version by running a compiled C program. This of course does not work at all for cross building. Fortunately, what it needs here is the value of the MODULE_MAGIC_COOKIE macro and AC_COMPUTE_INT can determine that in a cross setting. It then uses apr1-config, which does not work for cross compilation. I suggest adding an alternate path that queries apr-1.pc using pkg-config. Likewise, mysql_config does not work and querying mysqlclient.pc using pkg-config works. The resulting patch is a bit lengthy, but should improve the situation in a generic way also applicable to distributions other than Debian. Helmut
--- libapache-mod-musicindex-1.4.1.orig/configure.ac +++ libapache-mod-musicindex-1.4.1/configure.ac @@ -85,75 +85,46 @@ AC_SUBST(APXS_INCLUDE) AC_MSG_CHECKING([for which version of Apache we should build]) - -################################ ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $APXS_INCLUDE" -cat >conftest.$ac_ext <<_ACEOF -#include <stdio.h> -#include <ap_mmn.h> - -int main(void) -{ -#if (MODULE_MAGIC_COOKIE == 0x41503133UL) - printf("AP13\n"); -#elif (MODULE_MAGIC_COOKIE == 0x41503230UL) - printf("AP20\n"); -#elif (MODULE_MAGIC_COOKIE == 0x41503232UL) - printf("AP22\n"); -#elif (MODULE_MAGIC_COOKIE == 0x41503234UL) - printf("AP24\n"); -#endif -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - apache_version=`./conftest$ac_exeext` -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_mad_mad_bit_init=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +AC_COMPUTE_INT([apache_version_magic],[MODULE_MAGIC_COOKIE],[#include <ap_mmn.h>]) CFLAGS=$ac_save_CFLAGS -################################ + +AC_MSG_RESULT([:$apache_version_magic:]) +case "$apache_version_magic" in + 1095774515) + apache_version=AP13 + ;; + 1095774768) + apache_version=AP20 + AC_DEFINE([AP20], [], ["AP20"]) + ;; + 1095774770) + apache_version=AP22 + AC_DEFINE([AP22], [], ["AP22"]) + ;; + 1095774772) + apache_version=AP24 + AC_DEFINE([AP24], [], ["AP24"]) + ;; +esac AC_MSG_RESULT([${apache_version}]) +PKG_CHECK_MODULES([APR],[apr-1],[ + AC_DEFINE([BUILD_FOR_APACHE2], [], ["apache2"]) + AM_CONDITIONAL(BUILD_FOR_APACHE2, true) + APR_INCLUDE= + AC_SUBST(APR_INCLUDE) + APR_CPPFLAGS= + AC_SUBST(APR_CPPFLAGS) +],[ if test x$apache_version = xAP20; then AC_CHECK_PROG(APR_CONFIG, apr-config, apr-config, [], [], [exit1]) - AC_DEFINE([AP20], [], ["AP20"]) fi -if test x$apache_version = xAP22; then - AC_CHECK_PROG(APR_CONFIG, apr-1-config, apr-1-config, [], [], [exit1]) - AC_DEFINE([AP22], [], ["AP22"]) -fi - -if test x$apache_version = xAP24; then +if test x$apache_version = xAP22 || test x$apache_version = AP24; then AC_CHECK_PROG(APR_CONFIG, apr-1-config, apr-1-config, [], [], [exit1]) - AC_DEFINE([AP24], [], ["AP24"]) fi if test "x$APR_CONFIG" != "x"; then @@ -173,6 +144,7 @@ else AM_CONDITIONAL(BUILD_FOR_APACHE2, false) fi +]) # Checks for libraries. ########################################################################## @@ -306,16 +278,20 @@ ########################################################################## -#check if the user has a prefered mysql_config tool. by default, use mysql_config +#check if the user has a prefered mysql_config tool. by default, use pkg-config AC_ARG_WITH([mysql_config], AC_HELP_STRING([--with-mysql_config=ARG], [mysql_config executable]), [MYSQL_CONFIG="${withval}"], - [MYSQL_CONFIG="mysql_config"]) + [MYSQL_CONFIG="pkg-config"]) + +AS_IF([test "x$MYSQL_CONFIG" = xpkg-config],[ + PKG_CHECK_MODULES([MYSQL],[mysqlclient],[],[MYSQL_CONFIG="mysql_config"]) +]) #check if the mysql_config tool actually exists -if test x$MYSQL_CONFIG != xnone; then +AS_IF([test "x$MYSQL_CONFIG" != xnone && test "x$MYSQL_CONFIG" != xpkg-config],[ AC_PATH_PROG([MYSQL_CONFIG], [$MYSQL_CONFIG], [], [$PATH:/usr/sbin:/usr/local/bin]) -fi +]) AC_ARG_ENABLE([mysqlcache], AC_HELP_STRING([--disable-mysqlcache], [MySQL cache support]), @@ -330,11 +306,15 @@ mysqlcache=false fi -if test x$mysqlcache = xtrue; then +if test "x$mysqlcache" = xtrue && test "x$MYSQL_CONFIG" != xpkg-config; then MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`" MYSQL_LIBS="`$MYSQL_CONFIG --libs`" MYSQL_INCLUDE="`$MYSQL_CONFIG --include`" fi +if test "x$mysqlcache" = xfalse; then + MYSQL_CFLAGS= + MYSQL_LIBS= +fi AC_SUBST(MYSQL_CFLAGS) AC_SUBST(MYSQL_LIBS)