Python and Autoconf

Glen Starchman glen at enabledventures.com
Wed May 23 13:13:06 EDT 2001


I am actually working on a whole suite of macros (listed below). None of
them are terribly complex, but due to time constraints, I am only
implementing them as a I actually *need* them. 

Any more idea?


AC_CHECK_PYTHON -- returns path to the interpreter, sets PYTHON_PATH

AC_PYTHON_LIB_PATH -- returns sys.path in a way sh can use it, sets
PYTHON_LIB_PATH

AC_PYTHON_VERSION -- sets PYTHON_VERSION to the, well, python version

AC_PYTHON_CHECK_LIB -- given the name of a module (called lib to be in
keeping with AC naming conventions), looks for it in PYTHON_LIB_PATH and
cwd, sets PYTHON_HAVE_LIB_{MOD_NAME}

AC_PYTHON_CHECK_BUILTIN -- given the name of a builtin, see if python
was compiled with support for it, sets PYTHON_HAVE_BUILTIN_{BUILTIN}

AC_PYTHON_CHECK_SHARED -- same as AC_PYTHON_CHECK_LIB but searches for
shared libraries, sets PYTHON_HAVE_SHARED_{SHARED_MOD}

AC_PYTHON_CHECK_ARG -- given a module name and a method, return the
number of args a method expects. Sets PYTHON_ARGCOUNT_{METHOD}. Searches
for module in PYTHON_LIB_PATH and cwd.

AC_PYTHON_CHECK_METHOD -- given a module name and a method, checks if
method is defined in module. Sets PYTHON_HAVE_{MODULE}_{METHOD}

AC_PYTHON_CHECK_CLASS -- same as AC_PYTHON_CHECK_METHOD buts checks if a
class named klass exists in module. Sets PYTHON_HAVE_{MODULE}_{KLASS}

AC_PYTHON_CHECK_IMPORT -- checks if module1 imports module2. Sets
PYTHON_{MODULE1}_IMPORTS_{MODULE2}

AC_PYTHON_SOURCE -- searches for a Python source tree, and sets
PYTHON_SOURCE_PATH 

AC_PYTHON_MOD_PATH -- given a module, return it's path. Sets
PYTHON_{MOD_NAME}_PATH

AC_PYTHON_TRY_COMPILE -- given a code block and a symbolic name, try to
execute code block. Sets PYTHON_TEST_{SYMBOLIC_NAME} to true|false

AC_PYTHON_EXT -- sets PYTHON_EXT to the extension python uses for files
interpreted with the -O option.




rs von Wedel wrote:
> 
> Hi,
> 
> Now, that's extremely useful. I'll give it a try during the next few
> days.
> 
> Lars
> 
> > Anyway, hopefully someone finds these macros useful... I will
> > (eventually) have them added to the autoconf repository.
> Or to the Python distribution?
> 
> > (for the uninitiated, you have to add these macros to a file called
> > aclocal.m4 in the same directory as your configure.in script in order to
> > use them in your configure.in)
> Off-topic, but: can I add several .m4 files in a config subdirectory?
> 
> A further idea might be to check the Python interpreter version and/or
> to ensure some minimum version. Such as
> 
>   AC_PY_VERSION(2.0)
> 
> Lars



More information about the Python-list mailing list