Skip to content

libstdc++: Do not check getentropy and arc4random for cross builds #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
300 changes: 150 additions & 150 deletions libstdc++-v3/configure
Original file line number Diff line number Diff line change
Expand Up @@ -28088,6 +28088,156 @@ $as_echo "#define _GLIBCXX_USE_RANDOM_TR1 1" >>confdefs.h



# Check for other random number APIs



ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getentropy" >&5
$as_echo_n "checking for getentropy... " >&6; }
if ${glibcxx_cv_getentropy+:} false; then :
$as_echo_n "(cached) " >&6
else

if test x$gcc_no_link = xyes; then
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_compile "$LINENO"; then :
glibcxx_cv_getentropy=yes
else
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 "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_getentropy" >&5
$as_echo "$glibcxx_cv_getentropy" >&6; }

if test $glibcxx_cv_getentropy = yes; then

$as_echo "#define HAVE_GETENTROPY 1" >>confdefs.h

fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu





ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for arc4random" >&5
$as_echo_n "checking for arc4random... " >&6; }
if ${glibcxx_cv_arc4random+:} false; then :
$as_echo_n "(cached) " >&6
else

if test x$gcc_no_link = xyes; then
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_compile "$LINENO"; then :
glibcxx_cv_arc4random=yes
else
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_arc4random" >&5
$as_echo "$glibcxx_cv_arc4random" >&6; }

if test $glibcxx_cv_arc4random = yes; then

$as_echo "#define HAVE_ARC4RANDOM 1" >>confdefs.h

fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu



# For TLS support.


Expand Down Expand Up @@ -75519,156 +75669,6 @@ $as_echo "#define _GLIBCXX_X86_RDSEED 1" >>confdefs.h
fi


# Check for other random number APIs



ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getentropy" >&5
$as_echo_n "checking for getentropy... " >&6; }
if ${glibcxx_cv_getentropy+:} false; then :
$as_echo_n "(cached) " >&6
else

if test x$gcc_no_link = xyes; then
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_compile "$LINENO"; then :
glibcxx_cv_getentropy=yes
else
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 "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_getentropy" >&5
$as_echo "$glibcxx_cv_getentropy" >&6; }

if test $glibcxx_cv_getentropy = yes; then

$as_echo "#define HAVE_GETENTROPY 1" >>confdefs.h

fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu





ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for arc4random" >&5
$as_echo_n "checking for arc4random... " >&6; }
if ${glibcxx_cv_arc4random+:} false; then :
$as_echo_n "(cached) " >&6
else

if test x$gcc_no_link = xyes; then
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_compile "$LINENO"; then :
glibcxx_cv_arc4random=yes
else
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_arc4random" >&5
$as_echo "$glibcxx_cv_arc4random" >&6; }

if test $glibcxx_cv_arc4random = yes; then

$as_echo "#define HAVE_ARC4RANDOM 1" >>confdefs.h

fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu



# This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.

# Do checks for resource limit functions.
Expand Down
8 changes: 4 additions & 4 deletions libstdc++-v3/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ if $GLIBCXX_IS_NATIVE; then
# For /dev/random and /dev/urandom for std::random_device.
GLIBCXX_CHECK_DEV_RANDOM

# Check for other random number APIs
GLIBCXX_CHECK_GETENTROPY
GLIBCXX_CHECK_ARC4RANDOM

# For TLS support.
GCC_CHECK_TLS

Expand Down Expand Up @@ -474,10 +478,6 @@ GLIBCXX_CHECK_X86_RDRAND
# Check if assembler supports rdseed opcode.
GLIBCXX_CHECK_X86_RDSEED

# Check for other random number APIs
GLIBCXX_CHECK_GETENTROPY
GLIBCXX_CHECK_ARC4RANDOM

# This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
GLIBCXX_CONFIGURE_TESTSUITE

Expand Down