Next: , Previous: Required macros, Up: configure.ac


5.1.2 Verifying the Python version

As described in the previous section, PC_INIT finds the Python interpreter with the highest version that meets the provided requirements. You may wish to perform other tests on the version number yourself. There is a macro available to simplify this, PC_PYTHON_VERIFY_VERSION (indeed, PC_INIT uses this macro internally).

     m4_define(python_min_ver, 2.6.1)
     PC_PYTHON_VERIFY_VERSION([>=], python_min_ver, ,
                              [AC_MSG_ERROR(Python interpreter too old)])

In this example, we set the minimum version to 2.6.1 through the use of an M4 macro. We then check if the interpreter stored in the PYTHON variable (either set by the user or found by PC_INIT) is at least of that version. If it is not, the resulting configure script will exit with an appropriate error message. You may use any mathematical comparison operator that Python recognizes for the first argument (“==”, “<=”, “>”, etc.).