Incredibly, somehow everyone else missed the canonical way to do this, which has been around since 2 years before this thread began. :-)

I wondered the same thing as the OP and was disappointed by the lack of proper (non-ugly) ways to do this when I read this thread.

A few days later, while idly browsing release notes for Autoconf, I reached the release notes for Autoconf 2.65. And would you believe it?

Major changes in Autoconf 2.65 (2009-11-21) [stable]

[...]

config.status now provides a --config option to produce the configuration.

So, just running ./config.status --config does precisely what the OP asked for.

Here is the corresponding reference in the documentation: 17 config.status invocation, and a quote:

--config

Print the configuration settings in reusable way, quoted for the shell, and exit. For example, for a debugging build that otherwise reuses the configuration from a different build directory build-dir of a package in src-dir, you could use the following:

args=`build-dir/config.status --config`
eval src-dir/configure "$args" CFLAGS=-g --srcdir=src-dir
Answer from underscore_d on Stack Overflow
🌐
GNU
gnu.org › prep › standards › html_node › Configuration.html
Configuration (GNU Coding Standards)
To make this possible, configure can add to the Makefile a variable named srcdir whose value is precisely the specified directory. In addition, the ‘configure’ script should take options corresponding to most of the standard directory variables (see Variables for Installation Directories).
Top answer
1 of 4
30

Incredibly, somehow everyone else missed the canonical way to do this, which has been around since 2 years before this thread began. :-)

I wondered the same thing as the OP and was disappointed by the lack of proper (non-ugly) ways to do this when I read this thread.

A few days later, while idly browsing release notes for Autoconf, I reached the release notes for Autoconf 2.65. And would you believe it?

Major changes in Autoconf 2.65 (2009-11-21) [stable]

[...]

config.status now provides a --config option to produce the configuration.

So, just running ./config.status --config does precisely what the OP asked for.

Here is the corresponding reference in the documentation: 17 config.status invocation, and a quote:

--config

Print the configuration settings in reusable way, quoted for the shell, and exit. For example, for a debugging build that otherwise reuses the configuration from a different build directory build-dir of a package in src-dir, you could use the following:

args=`build-dir/config.status --config`
eval src-dir/configure "$args" CFLAGS=-g --srcdir=src-dir
2 of 4
14

config.status has the options in it; ./config.status --recheck re-runs configure with the original options. You could interrupt that and reissue the command (which it will show you before running it), or you could edit config.status and add your new parameters to $ac_configure_extra_args.

I do kinda wish they'd made it easier to do this. Once upon a time head config.status would get you the original configure command. ./config.status --rerun extra args here would have been nice.

Discussions

gcc - Compiling from source: What are the options for config script "build"? - Unix & Linux Stack Exchange
Either in each configure script or on the internet. 2) Does making the answer more specific or more generic have much of an effect on the outcome? ... The --build and -host options are to configure scripts are standard configure options, and you very rarely need to specify them unless you are ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
September 20, 2014
When compiling, can I use a file for ./configure options? - Unix & Linux Stack Exchange
You might also want to look at Comfigure, it basically remembers configure options from previous runs for the same package. ... If you have already done the hard part of putting all the switches in a text file, just make it an executable shell script by adding a shebang line and run that. More on unix.stackexchange.com
🌐 unix.stackexchange.com
July 8, 2016
unix - Why always ./configure; make; make install; as 3 separate steps? - Stack Overflow
And every make has different actions to do. Some do building, some do tests after building, some do checkout from external SCM repositories. Usually you don't have to give any parameters, but again some packages execute them differently. ... This installs the package in the place specified with configure. If you want you can specify ./configure to point to your home directory. However, lots of configure options ... More on stackoverflow.com
🌐 stackoverflow.com
Newbie wondering about settings.
Here is a good guide on setting the options: https://www.nethack.org/v361/Guidebook.html#_TOCentry_41 This guy on NAO used to have the golden standard in config files that I always copied: https://nethackwiki.com/wiki/User:Eidolos however it looks like he hasn't updated it since 3.6.1 came out. Here is his 3.4.3 config file. There are likely things that do not work in here, but this config is one of the best of all time: https://alt.org/nethack/userdata/E/Eidolos/Eidolos.nh343rc I'm guessing it would take considerable tweaking to get it working, so if you do go through the trouble I bet a post here with your results would be appreciated. :) If you don't want to deal with all of the fancy features, there are some basics to get you started. First of all set a movement scheme up that works well for you, and that lets you move diagonally. Secondly, configure some autopickup options. Most importantly change it so that you do not autopickup things if it would make you become burdened. Then change it so that you only autopickup useful things like gold, potions, wands, scrolls, etc and not heavy things like armor, weapons, tools, corpses etc. Some things just to make the UI better are showexp, !cmdassist,!help,!legacy, and !news. More on reddit.com
🌐 r/nethack
8
2
August 10, 2018

Incredibly, somehow everyone else missed the canonical way to do this, which has been around since 2 years before this thread began. :-)

I wondered the same thing as the OP and was disappointed by the lack of proper (non-ugly) ways to do this when I read this thread.

A few days later, while idly browsing release notes for Autoconf, I reached the release notes for Autoconf 2.65. And would you believe it?

Major changes in Autoconf 2.65 (2009-11-21) [stable]

[...]

config.status now provides a --config option to produce the configuration.

So, just running ./config.status --config does precisely what the OP asked for.

Here is the corresponding reference in the documentation: 17 config.status invocation, and a quote:

--config

Print the configuration settings in reusable way, quoted for the shell, and exit. For example, for a debugging build that otherwise reuses the configuration from a different build directory build-dir of a package in src-dir, you could use the following:

args=`build-dir/config.status --config`
eval src-dir/configure "$args" CFLAGS=-g --srcdir=src-dir
Answer from underscore_d on Stack Overflow
🌐
Wikipedia
en.wikipedia.org › wiki › Configure_script
configure script - Wikipedia
3 weeks ago - When installing a package on a Unix or Unix-like environment, a configure script is a shell script that generates build configuration files for a codebase to facilitate cross-platform support. It generates files tailoring for the host system – the environment on which the codebase is built ...
Top answer
1 of 1
3

The --build and -host options are to configure scripts are standard configure options, and you very rarely need to specify them unless you are doing a cross-build (that is, building a package on one system to run on a different system). The values of these options are called "triples" because they have the form cpu-vendor-os. (Sometimes, as in your case, os is actually kernel-os but it's still called a triple.)

The base configure script is quite capable of deducing the host triple, and you should let it do that unless you have some really good evidence that the results are incorrect. The script which does that is called config.guess, and you'll find it somewhere in the build bundle (it might be in a build-aux subdirectory). If you're doing a cross-build and you need to know the host triple, the first thing to try is to run config-guess on the host system.

The values supplied (or guessed) for --host and --build are passed through another script called config.sub, which will normalize the values. (According to the autoconf docs, if config.sub is not present, you can assume that the build doesn't care about the host triple.) The developers of a specific software package might customize the config.sub script for the particular needs of their build, and there are a lot of different versions of the standard config.sub script, so you shouldn't expect config.sub from one software package to work on another software package, or even on a different version of the same software package.

Despite all the above, autoconf'ed software packages really should not need to know the names of the host os and vendor, except for identifying default filesystem layout so that they provide the correct default file locations.

You can read through config.sub to get an idea of the range of options which will be recognized, but it is not so easy to figure out how the values are used, or even if the values are used. The first field -- the cpu -- is the most likely to be used.

You can get a list of all the options by typing:

./configure --help

or, better,

./configure --help | less

since there are always a lot of options.

Other than the standard options (--build, --host and --target as above, and the options which override file locations), the specific options allowed by each configure script are different. Since they also tend to change from version to version of the software package, you should always check the configure script itself rather than relying on external documentation.

Unfortunately, the contents of the configure script's help are not always 100% complete, because they rely on the package developers to maintain them. Sometimes unusual or developer-only options are not part of the ./configure --help output, but that is usually an indication that the option should not be used in a normal install.

🌐
Rensselaer Polytechnic Institute
rpi.edu › dept › cis › software › g77-mingw32 › info-html › configure.html
The GNU configure and build system
In the Cygnus tree at present, the info files are built and installed as a separate step. To build them, run make info. To install them, run make install-info. All configure scripts support a wide variety of options. The most interesting ones are --with and --enable options which are generally specific to particular tools.
🌐
Earthly
earthly.dev › blog › autoconf
Using Autotools to Configure, Make, and Install a Program - Earthly Blog
July 11, 2023 - Now that the generic options are initialized, you can get more specific with what you want. You need to specify what compiler you want the configure script to use. You do this by writing: ... This will tell the configure script to look for a C compiler. For other applications, you may need more dependencies to build your program. By using the AC_PATH_PROG macro, you can make autoconf look for specific programs in a user’s PATH.
Find elsewhere
🌐
Thoughtbot
thoughtbot.com › blog › the-magic-behind-configure-make-make-install
The magic behind configure, make, and make install
August 5, 2024 - Now we can run autoconf to turn our configure.ac into a configure script, and automake to turn our Makefile.am into a Makefile.in: ... The --add-missing option adds any missing files required to build the package, whenever possible.
🌐
Radekp
radekp.github.io › qtmoko › api › buildsystem › over-configure-options-1.html
configure Options
Usage: configure [options] The defaults (*) are usually acceptable. A plus (+) denotes a default value that needs to be evaluated. If the evaluation succeeds, the feature is included. Here is a short explanation of each option: -help .................. Print help and usage information.
🌐
IRISA
irisa.fr › polylib › DOC › node54.html
Options of the configure script
configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: ... You should run './configure -enable-gmpint-lib' to use gmp. As mentioned earlier you can build the Polylib if you don't have GMP, but it will fail when an overflow occurs.
🌐
University of Utah
math.utah.edu › docs › info › configure_3.html
Cygnus Configure - Using Configure
The choices and options available at configuration time generally have valid defaults, but the defaults do not cover all cases. The choices available include install locations, build directories, host, target, and local conventions. Install Locations: Where to install things once they are built ...
🌐
Qt
doc.qt.io › qt-5 › configure-options.html
Qt Configure Options | Qt 5.15
This page discusses some of the ... list of options, enter the command configure -h. Configure should be run from the main Qt source directory. Unless stated otherwise, the commands in this page are for the Linux platforms. On macOS and on Windows, the PATH and directory structure are different, ...
🌐
University of Illinois
ks.uiuc.edu › Research › vmd › doxygen › configure.html
The VMD configure script in detail
To specify which ones of the many optional components of VMD should be included in the final executable, and to include in the Makefile the necessary files for the selected options. To configure the VMD directories and source files to use the values for configurable parameters chosen by the user, i.e., the name of the final executable, the location for where the program is to be installed, etc.
🌐
PostgreSQL
postgresql.org › docs › current › install-make.html
PostgreSQL: Documentation: 18: 17.3. Building and Installation with Autoconf and Make
May 14, 2026 - Sometimes it is useful to add compiler flags after-the-fact to the set that were chosen by configure. An important example is that gcc's -Werror option cannot be included in the CFLAGS passed to configure, because it will break many of configure's built-in tests. To add such flags, include them in the COPT environment variable while running make.
🌐
University of Illinois
ks.uiuc.edu › Research › vmd › vmd-1.7.1 › ig › node12.html
Working with the Configure Script
./configure IRIX6 OPENGL TK FLTK This will save the options to the file ./configure.options so the next time you want to regenerate the Makefiles, you need but do
🌐
Python
docs.python.org › 3.11 › using › configure.html
3. Configure Python — Python 3.11.15 documentation
make profile-opt: build Python using Profile Guided Optimization (PGO). You can use the configure --enable-optimizations option to make this the default target of the make command (make all or just make).
🌐
Jlab
usqcd.jlab.org › usqcd-docs › chroma › HackLatt06 › Installation › html › node5.html
The configure, make, make install chain
generates Makefiles required for a build and performs various configuration actions (setting an install path, setting #defined variables, deciding which source files to compile, checking for various systems libraries and functions etc).
🌐
Python
docs.python.org › 3 › using › configure.html
3. Configure Python — Python 3.14.6 documentation
In addition to the work done by make clean, remove files created by the configure script. configure will have to be run before building again. [6] Build the all target and install Python. Build the all target and run the Python test suite with the --fast-ci option without GUI tests.
Top answer
1 of 4
130

Because each step does different things

Prepare(setup) environment for building

./configure

This script has lots of options that you should change. Like --prefix or --with-dir=/foo. That means every system has a different configuration. Also ./configure checks for missing libraries that should be installed. Anything wrong here causes not to build your application. That's why distros have packages that are installed on different places, because every distro thinks it's better to install certain libraries and files to certain directories. It is said to run ./configure, but in fact you should change it always.

For example have a look at the Arch Linux packages site. Here you'll see that any package uses a different configure parameter (assume they are using autotools for the build system).

Building the system

make

This is actually make all by default. And every make has different actions to do. Some do building, some do tests after building, some do checkout from external SCM repositories. Usually you don't have to give any parameters, but again some packages execute them differently.

Install to the system

make install

This installs the package in the place specified with configure. If you want you can specify ./configure to point to your home directory. However, lots of configure options are pointing to /usr or /usr/local. That means then you have to use actually sudo make install because only root can copy files to /usr and /usr/local.


Now you see that each step is a pre-requirement for next step. Each step is a preparation to make things work in a problemless flow. Distros use this metaphor to build packages (like RPM, deb, etc.).

Here you'll see that each step is actually a different state. That's why package managers have different wrappers. Below is an example of a wrapper that lets you build the whole package in one step. But remember that each application has a different wrapper (actually these wrappers have a name like spec, PKGBUILD, etc.):

def setup:
... #use ./configure if autotools is used

def build:
... #use make if autotools is used

def install:
... #use make all if autotools is used

Here one can use autotools, that means ./configure, make and make install. But another one can use SCons, Python related setup or something different.

As you see splitting each state makes things much easier for maintaining and deployment, especially for package maintainers and distros.

2 of 4
33

First, it should be ./configure && make && make install since each depends on the success of the former. Part of the reason is evolution and part of the reason is convenience for the development workflow.

Originally, most Makefiles would only contain the commands to compile a program and installation was left to the user. An extra rule allows make install to place the compiled output in a place that might be correct; there are still plenty of good reasons that you might not want to do this, including not being the system administrator, not want to install it at all. Moreover, if I am developing the software, I probably don't want to install it. I want to make some changes and test the version sitting in my directory. This becomes even more salient if I'm going to have multiple versions lying around.

./configure goes and detects what is available in the environment and/or is desired by the user to determine how to build the software. This is not something that needs to change very often and can often take some time. Again, if I am a developer, it's not worth the time to reconfigure constantly. More importantly, since make uses timestamps to rebuild modules, if I rerun configure there is a possibility that flags will change and now some of the components in my build will be compile with one set of flags and others with a different set of flags that might lead to different, incompatible behaviour. So long as I don't rerun configure, I know that my compilation environment remains the same even if I change my sources. If I rerun configure, I should make clean first, to remove any built sources to ensure things are built uniformly.

The only case where the three command are run in a row are when users install the program or a package is built (e.g., Debian's debuild or RedHat's rpmbuild). And that assumes that the package can be given a plain configure, which is not usually the case for packaging, where, at least, --prefix=/usr is desired. And pacakgers are like to have to deal with fake-roots when doing the make install part. Since there are lots of exceptions, making ./configure && make && make install the rule would be inconvenient for a lot of people who do it on a far more frequent basis!