小编Kal*_*leb的帖子

使用Autoconf检测另一个库中的预处理器宏

我有一个已安装的库,我们称之为"custom_lib",我正在链接它.

我想检查该库是否安装了特定选项.

该库中的options.h头文件有一个预处理器宏列表,如下所示:

#undef THIS
#define THIS

#undef THAT
#define THAT

#undef WE_WANT_THIS_ONE
#define WE_WANT_THIS_ONE
Run Code Online (Sandbox Code Playgroud)

在我的configure.ac文件中的另一个项目中,这个测试:

 OPTION_FOUND="no"
 AC_CHECK_HEADERS(custom_lib/options.h)                                             
 AC_MSG_CHECKING([is libary configured with --enable-we_want_this_one])

 #AC_EGREP_HEADER([ string to match ],                                            
 #                [ header file ],                                               
 #                [ action if found ],                                           
 #                [ action if not found ])

 AC_EGREP_HEADER([[WE_WANT_THIS_ONE]],                                                      
                 [custom_lib/options.h],                                          
                 [OPTION_FOUND="yes"],                                    
                 [OPTION_FOUND="no"])                                     

 if test "$OPTION_FOUND" = "yes"                                            
 then                                                                            
     # If we have WE_WANT_THIS_ONE check to see which compiler is being used                
     if test "$GCC" = "yes"                                                      
     then                                                                        
         if test "$CC" != "icc" …
Run Code Online (Sandbox Code Playgroud)

autoconf gnu autotools configure autoreconf

4
推荐指数
1
解决办法
560
查看次数

标签 统计

autoconf ×1

autoreconf ×1

autotools ×1

configure ×1

gnu ×1