1dnl pkg-config-based checks for Orc
2
3dnl specific:
4dnl ORC_CHECK([REQUIRED_VERSION])
5
6AC_DEFUN([ORC_CHECK],
7[
8  ORC_REQ=ifelse([$1], , "0.4.6", [$1])
9
10  AC_ARG_ENABLE(orc,
11  AC_HELP_STRING([--enable-orc],[use Orc if installed]),
12  [case "${enableval}" in
13    auto) enable_orc=auto ;;
14    yes) enable_orc=yes ;;
15    no)  enable_orc=no ;;
16    *) AC_MSG_ERROR(bad value ${enableval} for --enable-orc) ;;
17  esac
18  ],
19  [enable_orc=auto]) dnl Default value
20
21  if test "x$enable_orc" != "xno" ; then
22    PKG_CHECK_MODULES(ORC, orc-0.4 >= $ORC_REQ, [
23      AC_DEFINE(HAVE_ORC, 1, [Use Orc])
24      HAVE_ORC=yes
25      if test "x$ORCC" = "x" ; then
26        AC_MSG_CHECKING(for usable orcc)
27        ORCC=`$PKG_CONFIG --variable=orcc orc-0.4`
28        dnl check whether the orcc found by pkg-config can be run from the build environment
29        dnl if this is not the case (e.g. when cross-compiling) fall back to orcc from PATH
30        AS_IF([$ORCC --version 1> /dev/null 2> /dev/null], [], [ORCC=`which orcc`])
31        AC_MSG_RESULT($ORCC)
32      fi
33      AC_SUBST(ORCC)
34      ORCC_FLAGS="--compat $ORC_REQ"
35      AC_SUBST(ORCC_FLAGS)
36      AS_IF([test "x$ORCC" = "x"], [HAVE_ORCC=no], [HAVE_ORCC=yes])
37    ], [
38      if test "x$enable_orc" = "xyes" ; then
39        AC_MSG_ERROR([--enable-orc specified, but Orc >= $ORC_REQ not found])
40      fi
41      AC_DEFINE(DISABLE_ORC, 1, [Disable Orc])
42      HAVE_ORC=no
43      HAVE_ORCC=no
44    ])
45  else
46    AC_DEFINE(DISABLE_ORC, 1, [Disable Orc])
47    HAVE_ORC=no
48    HAVE_ORCC=no
49  fi
50  AM_CONDITIONAL(HAVE_ORC, [test "x$HAVE_ORC" = "xyes"])
51  AM_CONDITIONAL(HAVE_ORCC, [test "x$HAVE_ORCC" = "xyes"])
52
53]))
54
55AC_DEFUN([ORC_OUTPUT],
56[
57  if test "$HAVE_ORC" = yes ; then
58    printf "configure: *** Orc acceleration enabled.\n"
59  else
60    if test "x$enable_orc" = "xno" ; then
61      printf "configure: *** Orc acceleration disabled by --disable-orc.  Slower code paths\n"
62      printf "               will be used.\n"
63    else
64      printf "configure: *** Orc acceleration disabled.  Requires Orc >= $ORC_REQ, which was\n"
65      printf "               not found.  Slower code paths will be used.\n"
66    fi
67  fi
68  printf "\n"
69])
70
71