Next: , Previous: Checking for a module or function, Up:

5.1.4 Writing test programs

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.

     # some code here
     import foo
     ], [dnl
         # some more code here

The first argument to AC_LANG_PROGRAM is the so-called “prolog”, and typically will contain your import statements or function definitions. The second argument contains the main body of the program, which will be in the scope of an if __name__=="__main__": block. So, you must be sure to indent the code appropriately.