summaryrefslogtreecommitdiffstats
path: root/src/external/python.m4
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2015-04-24 17:08:48 +0300
committerJakub Hrozek <jhrozek@redhat.com>2015-05-28 13:55:42 +0200
commit9c5e4ae08ea41f9b1cdb3b3d0e9c35056baeab86 (patch)
tree7016a562b8c4a827db602c03cb4ab17ca8f5623a /src/external/python.m4
parent772464c842968d6e544118ae1aa7c49a7cda2ad6 (diff)
downloadsssd-9c5e4ae08ea41f9b1cdb3b3d0e9c35056baeab86.tar.gz
sssd-9c5e4ae08ea41f9b1cdb3b3d0e9c35056baeab86.tar.xz
sssd-9c5e4ae08ea41f9b1cdb3b3d0e9c35056baeab86.zip
BUILD: Add AM_PYTHON2_MODULE macro
Add AM_PYTHON2_MODULE - an autoconf macro checking for presence of Python 2 modules. This is for use with the upcoming integration tests configuration, but can be used by other code as well. Reviewed-by: Michal Židek <mzidek@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/external/python.m4')
-rw-r--r--src/external/python.m449
1 files changed, 49 insertions, 0 deletions
diff --git a/src/external/python.m4 b/src/external/python.m4
index c91e8df17..691e600b7 100644
--- a/src/external/python.m4
+++ b/src/external/python.m4
@@ -68,3 +68,52 @@ AC_DEFUN([SSS_CLEAN_PYTHON_VARIABLES],
unset am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
unset ac_cv_path_PYTHON_CONFIG
])
+
+dnl ===========================================================================
+dnl http://www.gnu.org/software/autoconf-archive/ax_python_module.html
+dnl ===========================================================================
+dnl
+dnl SYNOPSIS
+dnl
+dnl AM_PYTHON2_MODULE(modname[, fatal])
+dnl
+dnl DESCRIPTION
+dnl
+dnl Checks for Python 2 module.
+dnl
+dnl If fatal is non-empty then absence of a module will trigger an error.
+dnl
+dnl LICENSE
+dnl
+dnl Copyright (c) 2008 Andrew Collier
+dnl
+dnl Copying and distribution of this file, with or without modification, are
+dnl permitted in any medium without royalty provided the copyright notice
+dnl and this notice are preserved. This file is offered as-is, without any
+dnl warranty.
+AC_DEFUN([AM_PYTHON2_MODULE],[
+ if test x"$PYTHON2" = x; then
+ if test -n "$2"; then
+ AC_MSG_ERROR([cannot look for $1 module: Python 2 not found])
+ else
+ AC_MSG_NOTICE([cannot look for $1 module: Python 2 not found])
+ eval AS_TR_CPP(HAVE_PY2MOD_$1)=no
+ fi
+ else
+ AC_MSG_CHECKING($(basename $PYTHON2) module: $1)
+ $PYTHON2 -c "import $1" 2>/dev/null
+ if test $? -eq 0; then
+ AC_MSG_RESULT(yes)
+ eval AS_TR_CPP(HAVE_PY2MOD_$1)=yes
+ else
+ AC_MSG_RESULT(no)
+ eval AS_TR_CPP(HAVE_PY2MOD_$1)=no
+ #
+ if test -n "$2"
+ then
+ AC_MSG_ERROR(failed to find required module $1)
+ exit 1
+ fi
+ fi
+ fi
+])