Next: , Previous: Verifying the Python version, Up: Using pyconfigure


2.3 Checking for a module or function

It's reasonable to assume that many Python packages will have dependencies on other, external modules. With the provided pyconfigure macros, this is simple. All you have to do is use the PC_PYTHON_CHECK_MODULE macro as follows:

     PC_PYTHON_CHECK_MODULE([foo])

If the module is a hard requirement, you may provide actions to do if it is not present:

     PC_PYTHON_CHECK_MODULE([foo], , AC_MSG_ERROR([Module foo is not installed]))

If you need more fine-grained control, you can also test for a specific function:

     PC_PYTHON_CHECK_FUNC([foo], [bar], [arg1, arg2])

Remember that you may omit arguments to Autoconf macros: in the above example, the final two arguments, which correspond to the action to take if the test is successful and if it fails simply are not present in the argument list. Similarly, if you do not need to pass arguments to the test function, you can entirely omit the third argument to the macro:

     PC_PYTHON_CHECK_FUNC([foo], [bar])