I'm trying to cross-compile a Zabbix agent for an embedded Linux device (powerpc-8xx)
The configuration script fails on "checking for long long format..."
I've googled the issue and apparently Zabbix configure/configure.ac scripts are not cross-compile ready.
A guy proposed a nice patch here for configure.ac/configure.in file (added an extra AC_MSG_RESULT(no)
row):
AC_TRY_RUN(
[
#include <sys/types.h>
int main()
{
uint64_t i;
sscanf("200000000010020", "%qu", &i);
if (i == 200000000010020) return 0;
else return -1;
}
],
AC_DEFINE(HAVE_LONG_LONG_QU, 1 ,[Define to 1 if format '%qu' exists.])
AC_MSG_RESULT(yes),
+AC_MSG_RESULT(no),
AC_MSG_RESULT(no))
..but I cannot use autoconf/automake (because I'm using Debian Etch and it has an incompatible autoconf version, it's too old)
So I have to apply the same change, but with a different syntax to my ./configure file, specifically to these lines:
if ac_fn_c_try_run "$LINENO"; then :
$as_echo "#define HAVE_LONG_LONG_QU 1 " >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
How do I port those changes?
I have run ./bootstrap.sh for the latest Zabbix 2.2 and for the patched version.
Here is the diff between the two ./configure versions:
$ diff -U 4 configure-original configure-patched
--- configure-original 2014-08-07 16:42:27.228887386 +0300
+++ configure-patched 2014-08-07 16:43:23.404887379 +0300
@@ -7326,12 +7326,10 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long format" >&5
$as_echo_n "checking for long long format... " >&6; }
if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */