1

After cloning an open-source project (with Git), I want to build it.

Additionally, I want to be able to start from scratch and try again (for use with git-bisect).

A clean checkout contains Makefile.in and configure.ac, but does not contain configure.

Assuming there aren't any easy-to-find instructions with the project, what is the secret sauce to do these things? Is this pretty standard? Are there common variants that might sometimes be needed?

Brent Bradburn
  • 51,587
  • 17
  • 154
  • 173
  • 2
    There's also often a shell script called `bootstrap`, `bootstrap.sh` or `autogen.sh` that gets the checkout to the ready to `configure` state. These scripts usually just wrap `autoreconf`/`autoconf` with any additional steps that need to happen. – ldav1s Oct 24 '14 at 06:10

3 Answers3

2

If you are using Git, then you should be able to bypass the autotools entirely and just do git clean -xdf in between bisect steps.

ptomato
  • 56,175
  • 13
  • 112
  • 165
1

Although I have seen some posts advise the use of autoreconf -fi, I am getting a better result using just autoconf because the make step fails with the former (see autoconf and autoreconf for basic descriptions). Maybe in the general case, if one doesn't work, then try the other -- be sure to clean up in between so that the results aren't contaminated.

Here are some common steps:

## clean...
make maintainer-clean ## clean up most stuff after you have run ./configure
git status --ignored ## see what still needs to be cleaned up
git clean -fdX ## remove ignored files
git clean -fdx ## remove all extra files -- including your own work (if any)
git reset --hard ## revert all remaining files (may be destructive)

## build...
autoconf && ./configure && make -s ## build everything
Community
  • 1
  • 1
Brent Bradburn
  • 51,587
  • 17
  • 154
  • 173
  • Useful?: http://stackoverflow.com/questions/19263899/why-is-autoreconf-not-used-often – Brent Bradburn Apr 20 '15 at 00:47
  • 1
    Running only `autoconf` is unlikely to work if `autoreconf` doesn't work. If a package can't be built straight after running `autoreconf` (notably, this is the case with Intltool), then usually the maintainer will have provided a script called something like `autogen.sh` or `bootstrap.sh` that runs `autoreconf` plus does whatever other steps must be done. – ptomato Jun 28 '15 at 01:27
0

As others have already indicated in the comments, a configure.ac file is usually accompanied by an autogen.sh or bootstrap.sh script to generate the configure script.

For instance, the GNOME project tends to rely on an autogen.sh script by convention, so projects can be built with the following set of commands (feel free to take a look at GNOME's gtk+ source code to see what the root build directory might normally looks like under that convention):

./autogen.sh --prefix=$PREFIX && make && make install

After running the ./autogen.sh script you would then see configure script which got generated in the build root directory.

If in your particular project there is no such script and that doesn't answer the question for you, then it would probably be useful if you were able to provide a link to the source of the project which your query is about specifically.

Magpie
  • 607
  • 2
  • 7
  • 26