首页 > 其他分享 >一个autoreconf的报错问题解决

一个autoreconf的报错问题解决

时间:2023-02-17 16:22:20浏览次数:31  
标签:AC pattern openssl autoreconf m4 报错 解决 autoconf CHECK

报错如下

configure.ac:36: error: possibly undefined macro: AC_CHECK_LIB
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:47: error: possibly undefined macro: AC_CHECK_HEADERS
configure.ac:48: error: possibly undefined macro: AC_MSG_ERROR
autoreconf: error: /usr/bin/autoconf failed with exit status: 1

解决方案

安装软件包autoconf-archive

原因

看下边的代码

AC_ARG_ENABLE(openssl,[  --disable-openssl  disables OpenSSL random number, etc],
   [   
      if test "x$enableval" = "xyes" ; then
            AX_CHECK_OPENSSL([
                    AC_CHECK_LIB(crypto, MD5_Init)
                    AC_CHECK_LIB(crypto, RAND_pseudo_bytes)
                    AC_CHECK_HEADERS([ openssl/md5.h openssl/rand.h])]
                  ,[AC_MSG_ERROR([No openssl found.])])
      fi  
    ],[ 
     AX_CHECK_OPENSSL(,[AC_MSG_ERROR([No openssl found. using builtin crypto])])
])

其原因是未找到AX_CHECK_OPENSSL的定义,但是报错却不够准确。

看下边的中间过程命令:

/usr/bin/autom4te --language=autoconf --output=configure /usr/share/autoconf/autoconf/trailer.m4 configure.ac

在文件/usr/share/autoconf/autoconf/autoconf.m4f中有如下的定义

m4_pattern_forbid([^_?A[CHUM]_])
m4_pattern_forbid([_AC_])
m4_pattern_forbid([^LIBOBJS$],
                  [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])

其基本原理就是将宏都展开,在展开的过程中,未定义的宏就原封不动copy到输出文件,已定义的宏就用m4_pattern_forbid包含的正则表达式表示,如果展开完成后还存在m4_pattern_forbid能匹配到的内容,说明有未展开的宏。

这种方法不够严谨,因为autoconf的开发人员假设宏都是以某些字母开头的,但是其他的开发人员可能定义了不以这些字母开头的宏。所以导出出错了不能正确报告错误。

标签:AC,pattern,openssl,autoreconf,m4,报错,解决,autoconf,CHECK
From: https://www.cnblogs.com/the-capricornus/p/17130580.html

相关文章