summaryrefslogtreecommitdiff
path: root/autoconf/configure.ac
diff options
context:
space:
mode:
authorTodd Fiala <tfiala@google.com>2014-02-05 05:04:36 +0000
committerTodd Fiala <tfiala@google.com>2014-02-05 05:04:36 +0000
commit9cd920856549e8078123ac062a7cf95efb30a5b7 (patch)
treeac77523361eb8bc840b37b9c2d62d3196ac7aa92 /autoconf/configure.ac
parent9e849c73120fd1efcbacc0d8506bfaa7207d6018 (diff)
downloadllvm-9cd920856549e8078123ac062a7cf95efb30a5b7.tar.gz
llvm-9cd920856549e8078123ac062a7cf95efb30a5b7.tar.bz2
llvm-9cd920856549e8078123ac062a7cf95efb30a5b7.tar.xz
Fix configure to find arc4random via header files.
ISSUE: On Ubuntu 12.04 LTS, arc4random is provided by libbsd.so, which is a transitive dependency of libedit. If a system had libedit on it that was implemented in terms of libbsd.so, then the arc4random test, previously implemented as a linker test, would succeed with -ledit. However, on Ubuntu this would also require a #include <bsd/stdlib.h>. This caused a build breakage on configure-based Ubuntu 12.04 with libedit installed. FIX: This fix changes configure to test for arc4random by searching for it in the standard header files. On Ubuntu 12.04, this test now properly fails to find arc4random as it is not defined in the default header locations. It also tweaks the #define names to match the output of the header check command, which is slightly different than the linker function check #defines. I tested the following scenarios: (1) Ubuntu 12.04 without the libedit package [did not find arc4random, as expected] (2) Ubuntu 12.04 with libedit package [properly did not find arc4random, as expected] (3) Ubuntu 12.04 with most recent libedit, custom built, and not dependent on libbsd.so [properly did not find arc4random, as expected]. (4) FreeBSD 10.0B1 [properly found arc4random, as expected] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200819 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'autoconf/configure.ac')
-rw-r--r--autoconf/configure.ac5
1 files changed, 4 insertions, 1 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 0368f80585..bffee5fad2 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -1757,13 +1757,16 @@ AC_CHECK_FUNCS([log log2 log10 exp exp2])
AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
AC_CHECK_FUNCS([mktemp posix_spawn pread realpath sbrk setrlimit ])
-AC_CHECK_FUNCS([strerror strerror_r setenv arc4random ])
+AC_CHECK_FUNCS([strerror strerror_r setenv ])
AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
AC_CHECK_FUNCS([futimes futimens])
AC_C_PRINTF_A
AC_FUNC_RAND48
+dnl Check for arc4random accessible via AC_INCLUDES_DEFAULT.
+AC_CHECK_DECLS([arc4random])
+
dnl Check the declaration "Secure API" on Windows environments.
AC_CHECK_DECLS([strerror_s])