haskell / haskell/cabal

Run autoreconf when configure script is missing

Open
#4,903 5 comments 3 reactions 0 assignees View on GitHub
Cabal: cmd/configure type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

This comes up from a number of different issues:

* https://github.com/commercialhaskell/stack/issues/1543
* https://github.com/haskell/process/issues/106
* https://github.com/commercialhaskell/stack/issues/3534

Actions:

* Clone the `process` package, or any other package with `build-type: Configure` and no `configure` stored in its repo
* Run `cabal install` or `cabal configure`

Expected: the package builds

Actual: the package build fails because the `configure` script isn't available. You also get a very helpful warning:

```
Warning: The 'build-type' is 'Configure' but there is no 'configure' script.
You probably need to run 'autoreconf -i' to generate it.
```

However, as the linked issues point out: the warning isn't really sufficient in this case, for a few reasons:

1. People don't read warnings 🙂
2. People would like to be able to easily depend on the newest version of a package from Git, and this makes the build instructions significantly more complex
3. Including the `configure` script in the would "violate VCS/Autoconf conventions," and if a tool encourages that "I'd consider this a bug."

My recommendation: Cabal has already identified the course of action that the user is supposed to take: run `autoreconf -i`. Why not print a message indicating that you're going to try running it for the user, and treat any failure in running the command as non-fatal. At best: you turn a failing build into a successful one. At worst: you're back to the status quo, with a slightly longer error output.

FWIW, I just implemented this functionality in Stack with https://github.com/commercialhaskell/stack/pull/3598, so there's no pressure from downstream to implement this. But I do think it makes more sense to be handled by the Cabal library directly (where all tooling will benefit) instead of build-tool-specific workarounds.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a package whose build type is Configure and whose repository lacks a configure script, using cabal install or cabal configure. Read the existing warning about running autoreconf -i and verify that the package builds when autoreconf succeeds while failures remain non-fatal.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.