dnl Copyright (c) 2015 - present Facebook, Inc.
dnl All rights reserved.
dnl
dnl This source code is licensed under the BSD style license found in the
dnl LICENSE file in the root directory of this source tree. An additional grant
dnl of patent rights can be found in the PATENTS file in the same directory.

dnl AC_CHECK_PYTHON_MODULE([python],[module])
dnl
dnl checks if the given module is available from the given Python interpreter
AC_DEFUN([AC_CHECK_PYTHON_MODULE],
[dnl
  AC_MSG_CHECKING([for Python module $2])
  if printf "import %s" $2 | $1 - 1> /dev/null 2> /dev/null; then
    AC_MSG_RESULT([ok])
    AS_TR_SH([PYTHON_$2])=yes
  else
    AC_MSG_RESULT([unavailable])
    AS_TR_SH([PYTHON_$2])=no
  fi

  AC_SUBST(AS_TR_SH([PYTHON_$2]))
])