简体   繁体   中英

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:

#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 ?

You could check the GNU Autoconf Archive to see if someone has written a macro for foo already. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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