configure 脚本是编译源码前的一个辅助工具,主要用来和用户电脑中的库进行匹配,可以检测安装平台的目标特征,比如它会检测你是不是有CC或GCC,并不是需要CC或GCC,它是个shell脚本。
通过源码获取程序在Unix类系统中非常常见,常常分为三个步骤:
1. configure the makefile
2. compiling the code
3. installing the executable to standard locations
代码如下:
./configure
make
make install
其中./configure是告诉shell脚本文件是在当前目录下。
使用./configure --help可以查阅它的参数,这里对常用的--prefix参数说明:
./configure --prefix=/usr
意思是将该软件安装在 /usr 下面,执行文件就会安装在 /usr/bin (而不是默认的 /usr/local/bin),资源文件就会安装在 /usr/share(而不是默认的/usr/local/share)。同时一些软件的配置文件你可以通过指定 –sys-config= 参数进行设定。有一些软件还可以加上 –with、–enable、–without、–disable 等等参数对编译加以控制,你可以通过允许 ./configure –help 察看详细的说明帮助。