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


5.1.1 Required macros

Several macros are required in configure.ac to use pyconfigure. These are:

     AC_INIT([project_name], [project_version], [project-email])

This initializes Autoconf and also substitutes your project name and version in any output that it generates. The initial argument values are automatically generated by pyconfigure when you first run the pyconf script. Note that the arguments are surrounded by braces in all cases. This is to prevent M4 from trying to expand the arguments using whatever macros it knows.

     AC_CONFIG_MACRO_DIR([m4])

This macro imports all of the Python Autoconf macros. If you choose to write your own macros for other purposes, you should include them in the m4 directory as well.

     PC_INIT([2.5], [3.3.1])

This is the key macro. It finds a Python interpreter available on the system that meets optional version requirements specified in its arguments and saves its path in the PYTHON variable. Generally speaking, the highest-version Python interpreter found within the given version range (inclusive) will be used. Note, however, that minor version differences may cause discrepancies. For example, the user may have Python 3.3.1 installed but a slight difference in its release may cause the interpreter to internally report a slightly higher version, causing this interpreter to not pass the version check. To be safe, set the maximum version one bugfix release higher (i.e. “3.3.2” in this case).

     PC_PYTHON_SITE_PACKAGE_DIR
     PC_PYTHON_EXEC_PACKAGE_DIR

These two macros figure out where Python expects packages to be installed (i.e. /usr/lib/python2.7/site-packages/) and saves them in the variables pkgpythondir and pkgpyexecdir, respectively, for use in Makefile.in. These macros are only required if you will be writing your installation logic in Make.