./configure and make:输出文件名是否有公共标志,--prefix有什么作用?

我有时需要直接从源头编译工具和应用程序。其中大多数(我使用的是Linux)需要运行configure-script:

./configure

在那之后:

make install

我基本上了解了这些命令的作用,但是有些细节对我来说还是非常不清楚的。

这两个步骤通常会导致最终创建一个二进制文件,该文件位于./src目录中(但并非总是如此)。我还注意到,我可以在配置脚本上使用“ --prefix = / path”来设置安装最终软件包的前缀目录(运行时:make install)。

  1. 这是全部或大多数配置脚本遵循的规范或约定吗?

我还注意到,很多时候运行make install时,都会在/ usr / local / bin(或类似文件)中创建一个指向安装位置中二进制文件的符号链接。

  1. 配置脚本是否还有一个公共标志,可以为此符号链接选择其他名称?
  2. 是否有公共标志来定义二进制文件的输出名称?
评论
  • wiusto
    wiusto 回复

    --prefix=/path relocates many components of the installation path. Typically prefix has a default value of /usr/local, leading to binary executables being installed into ${prefix}/bin. If you wanted them to be installed in the system path, you would set --prefix=/usr and then the executables would go into /usr/bin

    This is in accordance to the Automake / Autoconf packaging conventions, which is detailed in the GNU coding standards.

    As for the symlink, odds are it follows a naming pattern that is fixed within the install routines, either by code or by the linked library name. Often linked libraries have their names chosen based on the programs that load them moreso than the libraries they link to, so changing the name is not advisable. The linking is probably being done since you are probably installing into /usr/local/bin, and the libraries are also probably installing into a /usr/local/lib<something> path. Without further details (and a second question should be a second post) it's hard to comment on it. I'd say changing the name would probably not be good for the executables in /usr/local/bin

    Yes, you can alter the output names of the executables with the --program-prefix=value command, which in my example would install valuecp instead of cp.