HostConf

The goal of this package is to be a replacement for GNU autoconf support for a package which needs to “inspect” the local host system to see if it needs some special local configurations to make it work.

The idea is to replace the ‘configure’ script generated by an assortment of autoconf tools (… along with all of the dependencies of sed, gawk, make, … which generally must be the GNU versions) with a pure Python implementation. Ideally, it is basically an extension of the functionality in distutils, and relies heavily on that infrastructure.

Hostconf now only relies on the necessary items in distutils which would be used to build the extensions anyway (cc, c++, ld, …)

Origin

It has been developed during the porting of pyeditline. That package requires libedit (ala NetBSD), and the main, multiplatform, distro of it uses autoconf. This is pretty handy, but even by itself, it carries a lot of baggage and can be quite a pain on some platforms to build.

PyEditline now relies only on Python and the compiler available to do all of the host detection (libraries, header files, types, …)

Current Support

The module contains a Configure class which does the bulk of the work, the mapping functionality implemented so far is:

AutoConf Member
AC_CHECK_STDC check_stdc()
AC_CHECK_MSG check_msg()
AC_CHECK_MSG_RESULT check_msg_result()
AC_CHECK_TOOL check_tool()
AC_CHECK_HEADERS check_headers()
AC_CHECK_HEADER check_header()
AC_CHECK_DECL check_decl()
AC_CHECK_LIB check_lib()
AC_CHECK_TYPE check_type()
AC_CHECK_MEMBER check_member()
AC_CHECK_HEADER_DIRENT check_header_dirent()
AC_CHECK_HEADER_SYS_WAIT check_header_sys_wait()
AC_CHECK_TYPE_SIGNAL check_type_signal()
AC_CHECK_TYPE_PID_T check_type_pid_t()
AC_CHECK_TYPE_SIZE_T check_type_size_t()
AC_CHECK_FUNC_FORK check_func_fork() and check_func_vfork()
AC_CHECK_FUNC_STAT check_func_stat()
AC_CHECK_FUNC_LSTAT check_func_lstat()

The eventual goal in mind is to be able to, more or less, suck in the autoconf.ac file of a distro and just “run” it. For now, you have to hand-write a method to call the collection of tests required.

Benefits

The class is setup in such a way to try to leverage all available information provided by the sysconfig Python class provided with the distro, which is, more or less, cooked-up by the actual autoconf/configure utility run to build Python itself. This helps do (ok, avoid) some of the nastier checks, because it already has the answer.

Notes

If/When you are developing additional support based on this, or for this, remember that distutils often adds more “options” to the compile infra than the normal autoconf.

Indices and tables