LinuxCommandLibrary

configure

TLDR

Run with default options

$ ./configure
copy
Set installation prefix
$ ./configure --prefix=[/usr/local]
copy
Enable or disable feature
$ ./configure --enable-[feature] --disable-[other]
copy
With specific dependency path
$ ./configure --with-[lib]=[/path/to/lib]
copy
Show all options
$ ./configure --help
copy
Build for different host
$ ./configure --host=[x86_64-linux-gnu]
copy
Set compiler and flags
$ CC=[gcc] CFLAGS="[-O2]" ./configure
copy

SYNOPSIS

./configure [options] [VAR=VALUE...]

DESCRIPTION

configure is a shell script generated by GNU Autotools that prepares software for building on the current system. It detects system capabilities, checks for dependencies, and generates Makefiles tailored to the environment.
The script probes for compilers, libraries, headers, and system features, storing results in config.h and substituting values into Makefile.in templates. This enables portable software building across different Unix-like systems.

PARAMETERS

--prefix= path

Installation root directory.
--exec-prefix= path
Architecture-dependent files location.
--bindir= path
User executables directory.
--libdir= path
Libraries directory.
--includedir= path
Header files directory.
--enable- feature
Enable optional feature.
--disable- feature
Disable feature.
--with- package
Use external package.
--without- package
Don't use package.
--host= triplet
Cross-compile for target.
--build= triplet
Build system type.
--help
Show available options.

ENVIRONMENT VARIABLES

CC: C compiler command
CXX: C++ compiler command
CFLAGS: C compiler flags
LDFLAGS: Linker flags
PKG_CONFIG_PATH: pkg-config search path

CAVEATS

Script must be regenerated if autoconf files change. Cross-compilation requires careful setup. Some packages have many options to navigate. Build may fail if dependencies are missing.

HISTORY

configure scripts are generated by GNU Autoconf, created by David MacKenzie starting in 1991. Autoconf addressed the challenge of portable software across diverse Unix systems. The configure/make/make install pattern became standard for Unix software distribution. While newer build systems exist, Autotools remains widely used.

SEE ALSO

make(1), autoconf(1), automake(1), pkg-config(1)

Copied to clipboard