One great benefit of Autoconf is the ability to embed test programs inside configure. The pyconfigure macros allow for this by defining Python as a language within Autoconf. You then would proceed to write test programs as you would in any other language that Autoconf supports like C.
AC_LANG_PUSH(Python) AC_RUN_IFELSE([AC_LANG_PROGRAM([dnl # some code here import foo ], [dnl # some more code here foo.bar() ])], [ACTION-IF-SUCCESSFUL], [ACTION-IF-FAILED]) AC_LANG_POP(Python)
The first argument to
AC_LANG_PROGRAM is the so-called
“prolog”, and typically will contain your
or function definitions. The second argument contains the main body of
the program, which will be in the scope of an
block. So, you must be sure to indent the code appropriately.