从.h.in生成的.h? [英] .h generated from .h.in?

查看:188
本文介绍了从.h.in生成的.h?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建.h文件后,.h文件中有一些结构定义,但是在对应的.h.in中找不到这些定义.有人可以告诉我这一切如何运作以及从何处获得额外信息吗?

There are struct definitions in the .h file that my library creates after I build it.. but I cannot find these in the corresponding .h.in. Can somebody tell me how all this works and where it gets the extra info from?

具体来说:我正在构建pth,即用户空间线程库.它具有pth_p.h.in,其中不包含我要查找的结构定义,但是当我构建库时,会出现pth_p.h并具有我需要的定义.

To be specific: I am building pth, the userspace threading library. It has pth_p.h.in, which doesn't contain the struct definition I am looking for, yet when I build the library, a pth_p.h appears and it has the definition I need.

实际上,在构建库之前,我已经搜索了库中的每个文件,但是找不到在哪里生成结构定义.

In fact, I have searched every single file in the library before it is built and cannot find where it is generating the struct definition.

推荐答案

Pth使用GNU Autoconf Automake m4 来检测一大堆不同的系统属性的存在并更改许多文件.

Pth uses GNU Autoconf, Automake, and Libtool. By running ./configure you'll be running a shell script which eventually runs m4 to detect the presence of a whole bunch of different system attributes and make changes to a number of files.

它看起来可以归结为 ./configure Makefile.in 生成 Makefile ,然后通过make触发 shtool 子命令 scpp :

It looks like it boils down to ./configure generating Makefile from Makefile.in and then running something via make that triggers the shtool subcommand scpp:

pth_p.h: $(S)pth_p.h.in
    $(SHTOOL) scpp -o pth_p.h -t $(S)pth_p.h.in -Dcpp -Cintern -M '==#==' $(HSRCS)

晦涩的链接,但这是一个 shtool-scpp联机帮助页,其描述为:

Obscure link, but here's an shtool-scpp manpage, which describes it as:

此命令是附加的ANSI C用于共享的源文件预处理器内部cpp(1)代码段变量和内部函数.这意图来自写作ANSI C中的库.这是常见的共享内部头文件通常是用于在之间共享信息库源文件.

This command is an additional ANSI C source file pre-processor for sharing cpp(1) code segments, internal variables and internal functions. The intention for this comes from writing libraries in ANSI C. Here a common shared internal header file is usually used for sharing information between the library source files.

操作是解析特殊在文件中构造,生成一些这些构造中的东西将它们插入tfile中的位置标记通过将输出写入ofile.此外,这些文件永远不会感动或修改.相反,构造会在以后被删除构建过程的cpp(1)阶段.这唯一的前提是每个文件在顶部.

The operation is to parse special constructs in files, generate a few things out of these constructs and insert them at position mark in tfile by writing the output to ofile. Additionally the files are never touched or modified. Instead the constructs are removed later by the cpp(1) phase of the build process. The only prerequisite is that every file has a ``"#include ""ofile"""'' at the top.

这篇关于从.h.in生成的.h?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆