orc.m4: cross-compile search for orcc.
authorMaarten Bosmans <mkbosmans@gmail.com>
Thu, 23 Jun 2011 18:23:53 +0000 (11:23 -0700)
committerDavid Schleef <ds@schleef.org>
Thu, 23 Jun 2011 18:23:53 +0000 (11:23 -0700)
Search for orcc in the path when cross-compiling and the orcc
found by pkg-config doesn't work.

Signed-off-by: David Schleef <ds@schleef.org>
m4/orc.m4

index 3b2c6b5..26b2459 100644 (file)
--- a/m4/orc.m4
+++ b/m4/orc.m4
@@ -21,17 +21,19 @@ AC_DEFUN([ORC_CHECK],
   if test "x$enable_orc" != "xno" ; then
     PKG_CHECK_MODULES(ORC, orc-0.4 >= $ORC_REQ, [
       AC_DEFINE(HAVE_ORC, 1, [Use Orc])
+      HAVE_ORC=yes
       if test "x$ORCC" = "x" ; then
+        AC_MSG_CHECKING(for usable orcc)
         ORCC=`$PKG_CONFIG --variable=orcc orc-0.4`
+        dnl check whether the orcc found by pkg-config can be run from the build environment
+        dnl if this is not the case (e.g. when cross-compiling) fall back to orcc from PATH
+        AS_IF([$ORCC --version 1> /dev/null 2> /dev/null], [], [ORCC=`which orcc`])
+        AC_MSG_RESULT($ORCC)
       fi
       AC_SUBST(ORCC)
       ORCC_FLAGS="--compat $ORC_REQ"
       AC_SUBST(ORCC_FLAGS)
-      HAVE_ORC=yes
-      HAVE_ORCC=yes
-      if test "x$cross_compiling" = "xyes" ; then
-        HAVE_ORCC=no
-      fi
+      AS_IF([test "x$ORCC" = "x"], [HAVE_ORCC=no], [HAVE_ORCC=yes])
     ], [
       if test "x$enable_orc" = "xyes" ; then
         AC_MSG_ERROR([--enable-orc specified, but Orc >= $ORC_REQ not found])