Skip to content

Add an autoconf configure script for sagelib #29119

@embray

Description

@embray

The proposal is to have a configure script specific to sagelib itself. This can reuse most of the work already done and to be done for #27330 in order to detect sagelib's non-Python compilation dependencies at build time (spkg-configure.m4). src/configure.ac would be simpler than the configure.ac for sage-the-distribution, as it would not need to do anything related to SAGE_LOCAL, and (possibly) only needs to detect sagelib's direct dependencies.

This configure script can easily be included in source tarballs for sagelib, and can be called automatically by the setup.py.

For prior art on this, see cysignals which also runs a configure script to detect dependencies for its C sources. While I was at one time skeptical of cysignals' approach to this (it is unusual to make configure part of the build system for a Python package), over time I've found that it works very well in practice.

It uses standard tools that would already be available on systems capable of building sagelib in the first place, and does not introduce any new or out-of-the-ordinary concepts for packagers (aside from having a configure alongside setup.py).

It would explicitly check for sagelib's dependencies in a manner that can be used completely independently of sage-the-distribution.

  • Q: What files would be generated by this configure script?

  • Q: How does this impact pip install of sagelib?

    • A: In the default case it would "just work": If all of sagelib's dependencies are met by the system then they will be detected on the default paths. If any dependencies are missing that will be reported (hopefully clearly) and the build will fail. When pip-installing setuptools-based packages, it is possible to pass additional command-line flags to the underlying setup.py call (see e.g. the --global-option and --install-option flags to pip install). We could easily allow passing passing through additional flags to the underlying configure script if/when special customization is needed.
  • Q: How does this impact installing sagelib in a virtualenv/venv?

    • A: Basically not at all/trivially: If the dependencies are already met by the system then this proceeds just as installing directly into the system site-packages. If some of the dependencies are installed in the virtualenv itself, and we want to use them, it is necessary to pass additional C(PP)FLAGS and LDFLAGS so that the virtualenv is used as a header/library search path. This is true of any package that has dependencies in a non-standard prefix.
      • In the virtualenv case we could in principle handle CFLAGS and LDFLAGS automatically by checking for the VIRTUALENV environment variable, but this is a separate enhancement.

Related:

Depends on #29039

CC: @dimpase @mkoeppe @jdemeyer @orlitzky

Component: build: configure

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/29119

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions