Linux command
configure 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run with default options
./configure
Set installation prefix
./configure --prefix=[/usr/local]
Enable or disable feature
./configure --enable-[feature] --disable-[other]
With specific dependency path
./configure --with-[lib]=[/path/to/lib]
Show all options
./configure --help
Build for different host
./configure --host=[x86_64-linux-gnu]
Set compiler and flags
CC=[gcc] CFLAGS="[-O2]" ./configure
说明
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.
参数
- --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.
FAQ
What is the configure command used for?
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.
How do I run a basic configure example?
Run `./configure` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --prefix= _path_ do in configure?
Installation root directory.