CLion 2021.2 Help

GNU Autotools

In CLion, you can work with projects that require preconfiguration steps to prepare the actual Makefile. The scripts of GNU Autotools, Kbuild, and PERL MakeMaker are detected automatically and executed to get the Makefile and load the project.

Instructions below cover the case of GNU Autotools.

Autotools project

When you open a project folder, CLion recognizes it as an Autotools project in the following cases:

  • There is a configure.ac or configure.in file (but not both at the same time) under the project root.

  • There is a Makefile.in and/or Makefile.am.

The presence of an already generated Makefile or a configure script does not affect this.

Pre-configuration (GNU Autoconf)

If GNU Autoconf is installed on your system (autoreconf should be in the system PATH), CLion will call it first.

Pre-configuring the project with autoreconf

By default, CLion uses the following commands to configure an Autotools project:

which autoreconf && autoreconf --install --symlink --force --verbose; /bin/sh configure

You can change this set of commands as needed (see below).

Control preconfigure parameters

If required, you can adjust the pre-configuration commands.

  1. Go to Settings / Preferences | Build, Execution, Deployment | Makefile.

  2. Make necessary changes in the Commands field:

    Pre-configuration commands

    For example, to run an additional pre-configuration script like bootstrap, add the following command:

    ./bootstrap <args>

    Also notice the very first line in the default set of commands, #!/bin/sh. It explicitly specifies the POSIX default interpreter /bin/sh. You can leave this command as is or change it to use another interpreter, for example #!/usr/bin/python for Python.

Change the toolchain

  • When executing Autotools scripts, CLion fetches the compilers from the toolchain specified in Settings / Preferences | Build, Execution, Deployment | Makefile.

    If you open the project for the first time, CLion will use the default toolchain.

    Note that you can specify a remote toolchain here as well.

    Selecting the toolchain for a Makefile project
Last modified: 27 July 2021