简体   繁体   English

Autoconf,如何发现lib函数的参数数量?

[英]Autoconf, how to discover the numbers of parameters for a lib function?

Suppose I've a portability problem caused by this function foo that can take one or two parameters depending on the system: 假设我有此功能foo引起的可移植性问题,根据系统的不同,该函数可以采用一个或两个参数:

#include "config.h"
#ifdef FOO_ONEPARAM
    #define FOO(a) foo(a)
#else
    #define FOO(a) foo(a,b)
#endif

How do I set properly FOO_ONEPARAM after disconvering it with AC_SEARCH_LIBS ? AC_SEARCH_LIBS FOO_ONEPARAM后,如何正确设置AC_SEARCH_LIBS

You could check the GNU Autoconf Archive to see if someone has written a macro for foo already. 您可以检查GNU Autoconf存档以查看是否有人已经为foo编写了宏。 If not, you can use the method used by this macro at the GNU Autoconf Archive to write your own, which is superficially similar to what you're already doing. 如果没有,您可以使用GNU Autoconf档案库中此宏使用的方法来编写自己的方法,从表面上看,这与您已经在做的事情类似。 There's probably several macros at the archive that do something like this (for old functions mostly), this was just the first one I ran across. 存档中可能有几个宏,它们的功能大致相同(主要用于旧功能),这只是我遇到的第一个宏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM