AC_LANG_CPLUSPLUS
AC_MSG_CHECKING([for getentropy])
AC_CACHE_VAL(glibcxx_cv_getentropy, [
- AC_TRY_COMPILE(
+ GCC_TRY_COMPILE_OR_LINK(
[#include <unistd.h>],
[unsigned i;
::getentropy(&i, sizeof(i));],
AC_LANG_CPLUSPLUS
AC_MSG_CHECKING([for arc4random])
AC_CACHE_VAL(glibcxx_cv_arc4random, [
- AC_TRY_COMPILE(
+ GCC_TRY_COMPILE_OR_LINK(
[#include <stdlib.h>],
[unsigned i = ::arc4random();],
[glibcxx_cv_arc4random=yes], [glibcxx_cv_arc4random=no])
$as_echo_n "(cached) " >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ if test x$gcc_no_link = xyes; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
glibcxx_cv_getentropy=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+int
+main ()
+{
+unsigned i;
+ ::getentropy(&i, sizeof(i));
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ glibcxx_cv_getentropy=yes
+else
+ glibcxx_cv_getentropy=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
fi
$as_echo_n "(cached) " >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ if test x$gcc_no_link = xyes; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
int
glibcxx_cv_arc4random=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+int
+main ()
+{
+unsigned i = ::arc4random();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ glibcxx_cv_arc4random=yes
+else
+ glibcxx_cv_arc4random=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
fi