在 Linux 系统上,我配置了一个软件包(llvm),autoconf 找到了arc4random
功能。这里是配置期间输出的提取:
checking for strerror... yes
checking for strerror_r... yes
checking for setenv... yes
checking for arc4random... yes
checking for strtoll... yes
checking for strtoq... yes
checking for sysconf... yes
配置一切顺利。后来,在构建包时,我收到有关未声明说明符的错误arc4random
:
[removed]/lib/Support/Unix/Process.inc:368:10: error: use of undeclared identifier
'arc4random'
return arc4random();
^
这里提到的位置:
367 #if defined(HAVE_ARC4RANDOM)
368 return arc4random();
369 #else
370 static int x = (::srand(GetRandomNumberSeed()), 0);
371 (void)x;
372 return ::rand();
373 #endif
它受到妥善保护,这里configure.ac
piece:
AC_CHECK_FUNCS([strerror strerror_r setenv arc4random ])
看起来一切都很好。我想知道为什么配置过程检测到该功能可用。
自动配置(GNU Autoconf)2.63
这里摘录自config.log
:
configure --prefix=[removed] --host=powerpc64-bgq-linux --disable-terminfo --disable-zlib --enable-targets=powerpc CXX=bgclang++ CXXFLAGS=-O3 -fPIC CC=bgclang CFLAGS=-O3 -fPIC LDFLAGS=-shared