The autotools plugin

The autotools plugin is useful for Automake/Autotools based parts.

Autotools-based projects are easy to recognise, as they’re typically built and installed with the following commands: ./configure && make && make install.

This plugin uses the common plugin keywords as well as those for sources. For more information, see Snapcraft parts metadata.

Additional features and syntax are dependent on which base is being used, as outlined below:

See C/C++ applications for a simple example, or search GitHub for projects already using the plugin.

ⓘ This is a snapcraft plugin. See Snapcraft plugins and Supported plugins for further details on how plugins are used.

base: core24 | core22

  1. the autotools plugin first attempts to build the project using ./configure
  2. if the configure script does not yet exist, it will attempt to run ./autoconf --install.
  • autotools-configure-parameters (list of strings) Configure flags to pass to the build such as those shown by running ./configure --help

Requires Snapcraft version 8.0+ for core24.

Requires Snapcraft version 7.0+ for core22.

base: core20

  1. the autotools plugin first attempts to build the project using ./configure
  2. if the configure script does not yet exist, it will attempt to run ./autoconf --install.

In addition, this plugin uses the following plugin-specific keywords:

  • autotools-configure-parameters (previously configflags) (list of strings) Configure flags to pass to the build such as those shown by running ./configure --help

Requires Snapcraft version 4.0+.

base: core18 | core

  1. the autotools plugin first attempts to build the project using ./configure.
  2. if the configure script does not yet exist, it will attempt to run ./autogen.
  3. if autogen doesn’t exist, the plugin will run autoreconf.

In addition, this plugin uses the following plugin-specific keywords:

  • configflags (list of strings) Configure flags to pass to the build such as those shown by running ./configure --help
  • install-via (enum, ‘destdir’ or ‘prefix’) Whether to install via DESTDIR or by using --prefix (default is ‘destdir’)

Requires Snapcraft version 3.x.

1 Like

The v1 autotools plugin still accepts configflags, but the v2 autotools plugin changed the name to autotools-configure-parameters and no longer accepts configflags (snapcraft 4.0.2).

Thanks for flagging these plugin v2 changes. We’re currently working through the plugin docs to update them for the imminent stable release of Snapcraft 4.

There is a small typo here - it should be autotools-configure-parameters

@ec0 fixed. Thanks for noticing :slight_smile:

You should be able to edit any of these documents, like I just did, as they’re all marked as “wiki” so freely editable by all. The edit button is at the bottom of the first post on the right-hand side. The etiquette is to allow @degville to maintain ownership of the bulk, though, because they’re the docs writer extraordinaire and are following team-defined processes to ensure accuracy of the concepts (even if typos get slipped-in to keep us on our toes :wink:).

1 Like

Great, thanks, good to know!

Is it possible to use autotools-configure-parameter and tell make to use more than two compiling threads (as it seems to be default)? If not, how can this be achieved effectively?

Best regards
Stefan

If you’re using multipass-based builds (the default) then the VM will only have 2 CPUs assigned, which is why you’re only using 2 threads, currently. To fix this, when you call snapcraft you should include SNAPCRAFT_BUILD_ENVIRONMENT_CPU=<num-cpus>. You might also want to be aware of the existence of another variable called SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY, which defines how much RAM is assigned to the VM:

export SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8 # only needs to be done once per shell
snapcraft

or you can assign the variable directly on the commandline:

SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8 snapcraft
1 Like

Thank you for this fine explanation! :slight_smile:

I think it should be autoreconf --install in this case and also for core20.