Source: openhpi
Version: 3.6.1-3.1
Tags: patch upstream
User: helm...@debian.org
Usertags: rebootstrap
Control: block -1 by 899152

openhpi fails to cross build from source for a number of reasons. The
first issue is that it determines sizeof int as "" during cross
compilation. configure.ac as a separate code path for cross compilation
and that code path is broken as it fails calling AC_CHECK_SIZEOF.

Then it fails finding libraries with pkg-config as it uses the build
architecture pkg-config rather than the host one. Using
PKG_PROG_PKG_CONFIG mostly fixes that. Except that configure.ac also
sets PKG_CONFIG_PATH in a few cases and that breaks pkg-config's cross
wrapper.

Finally the cross build fails the same way as a native build: #899152.

The attached patch fixes the cross issues mentioned above. Please
consider applying it.

Helmut
From: Helmut Grohne <hel...@subdivi.de>
Subject: fix cross compilation

The OH_SET_SIZES macro relies on the usual autoconf sizeof cache variables
during cross compilation, but it never ensure that they are initialized.

pkg-config must be called with $ac_tool_prefix and PKG_PROG_PKG_CONFIG takes
care of that. Setting PKG_CONFIG_PATH breaks the pkg-config-cross-wrapper.
Don't do that.

Index: openhpi-3.6.1/acinclude.m4
===================================================================
--- openhpi-3.6.1.orig/acinclude.m4
+++ openhpi-3.6.1/acinclude.m4
@@ -22,30 +22,39 @@
 
     if test "x$cross_compiling" != "xno"; then
         if test "x$OH_SIZEOF_UCHAR" = x; then
+	    AC_CHECK_SIZEOF([unsigned char])
             OH_SIZEOF_UCHAR=$ac_cv_sizeof_uchar
         fi
         if test "x$OH_SIZEOF_USHORT" = x; then
+	    AC_CHECK_SIZEOF([unsigned short])
             OH_SIZEOF_USHORT=$ac_cv_sizeof_ushort
         fi
         if test "x$OH_SIZEOF_UINT" = x; then
+	    AC_CHECK_SIZEOF([unsigned int])
             OH_SIZEOF_UINT=$ac_cv_sizeof_uint
         fi
         if test "x$OH_SIZEOF_CHAR" = x; then
+	    AC_CHECK_SIZEOF([char])
             OH_SIZEOF_CHAR=$ac_cv_sizeof_char
         fi
         if test "x$OH_SIZEOF_SHORT" = x; then
+	    AC_CHECK_SIZEOF([short])
             OH_SIZEOF_SHORT=$ac_cv_sizeof_short
         fi
         if test "x$OH_SIZEOF_INT" = x; then
+	    AC_CHECK_SIZEOF([int])
             OH_SIZEOF_INT=$ac_cv_sizeof_int
         fi
         if test "x$OH_SIZEOF_LLONG" = x; then
+	    AC_CHECK_SIZEOF([long long])
             OH_SIZEOF_LLONG=$ac_cv_sizeof_longlong
         fi
         if test "x$OH_SIZEOF_FLOAT" = x; then
+	    AC_CHECK_SIZEOF([float])
             OH_SIZEOF_FLOAT=$ac_cv_sizeof_float
         fi
         if test "x$OH_SIZEOF_DOUBLE" = x; then
+	    AC_CHECK_SIZEOF([double])
             OH_SIZEOF_DOUBLE=$ac_cv_sizeof_double
         fi
     else
Index: openhpi-3.6.1/configure.ac
===================================================================
--- openhpi-3.6.1.orig/configure.ac
+++ openhpi-3.6.1/configure.ac
@@ -85,9 +85,9 @@
 
 dnl Check for GLIB
 
-AC_CHECK_PROG([found_pkg_config],[pkg-config],[yes])
+PKG_PROG_PKG_CONFIG
 
-if test "x$found_pkg_config" != "xyes"; then
+if test "x$PKG_CONFIG" = "x"; then
     OH_CHECK_FAIL(pkg-config,pkg-config)
 fi
 PKG_CFG_SETPATH
@@ -103,7 +103,7 @@
 GTHREAD=gthread-2.0
 GMODULE=gmodule-2.0
 
-if pkg-config --atleast-version $GLIB_REQUIRED_VERSION $GLIB; then
+if $PKG_CONFIG --atleast-version $GLIB_REQUIRED_VERSION $GLIB; then
    :
 else
    AC_MSG_ERROR([
@@ -111,15 +111,15 @@
 *** GLIB is always available from ftp://ftp.gtk.org/.])
 fi
 
-exact_version=`pkg-config --modversion $GLIB`;
-GLIB_CFLAGS=`pkg-config --cflags $GLIB`
-GLIB_LIBS=`pkg-config --libs $GLIB`
-GLIB_ONLY_CFLAGS=`pkg-config --cflags $GLIB`
-GLIB_ONLY_LIBS=`pkg-config --libs $GLIB`
-GMODULE_ONLY_CFLAGS=`pkg-config --cflags $GMODULE`
-GMODULE_ONLY_LIBS=`pkg-config --libs $GMODULE`
-GTHREAD_CFLAGS=`pkg-config --cflags $GTHREAD`
-GTHREAD_LIBS=`pkg-config --libs $GTHREAD`
+exact_version=`$PKG_CONFIG --modversion $GLIB`;
+GLIB_CFLAGS=`$PKG_CONFIG --cflags $GLIB`
+GLIB_LIBS=`$PKG_CONFIG --libs $GLIB`
+GLIB_ONLY_CFLAGS=`$PKG_CONFIG --cflags $GLIB`
+GLIB_ONLY_LIBS=`$PKG_CONFIG --libs $GLIB`
+GMODULE_ONLY_CFLAGS=`$PKG_CONFIG --cflags $GMODULE`
+GMODULE_ONLY_LIBS=`$PKG_CONFIG --libs $GMODULE`
+GTHREAD_CFLAGS=`$PKG_CONFIG --cflags $GTHREAD`
+GTHREAD_LIBS=`$PKG_CONFIG --libs $GTHREAD`
 
 
 # On some versions of Solaris the pkg-config file for gthread-2.0 contains a
@@ -258,12 +258,12 @@
 dnl We really need to make ipmi enablement be contigent on OpenIPMI
 dnl
 
-if PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig pkg-config --atleast-version 1.4.20 OpenIPMI; then
+if $PKG_CONFIG --atleast-version 1.4.20 OpenIPMI; then
     have_openipmi=yes
     AC_CHECK_LIB([OpenIPMI], [ipmi_smi_setup_con], [have_openipmi=yes])
-    OPENIPMI_CFLAGS=`PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig pkg-config --cflags OpenIPMI`
+    OPENIPMI_CFLAGS=`$PKG_CONFIG --cflags OpenIPMI`
     AC_SUBST(OPENIPMI_CFLAGS)
-    OPENIPMI_LIBS=`PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig pkg-config --libs OpenIPMI`
+    OPENIPMI_LIBS=`$PKG_CONFIG --libs OpenIPMI`
     AC_SUBST(OPENIPMI_LIBS)
 fi
 

Reply via email to