For simplicity, I think we should just verify whether 'linux/random.h'
is valid, here if it's valid, that means such codes will be compiled correctly.

  #include <linux/random.h>
  int main(void)
  {
        getrandom(NULL, 100, 0);
        return 0;
  }
Signed-off-by: Xiaoguang Wang <wangxg.f...@cn.fujitsu.com>
---
 m4/ltp-linuxrandom.m4 | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/m4/ltp-linuxrandom.m4 b/m4/ltp-linuxrandom.m4
index 30c099e..4b7e585 100644
--- a/m4/ltp-linuxrandom.m4
+++ b/m4/ltp-linuxrandom.m4
@@ -16,6 +16,20 @@ dnl
 dnl LTP_CHECK_LINUXRANDOM
 dnl ----------------------------
 dnl
-AC_DEFUN([LTP_CHECK_LINUXRANDOM],[
-AC_CHECK_HEADERS(linux/random.h, [], [], [])]
-)
+
+AC_DEFUN([LTP_CHECK_LINUXRANDOM],[dnl
+       AC_MSG_CHECKING([for linux/random.h])
+       AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+
+#include <linux/random.h>
+int main(void) {
+       return 0;
+}])],[has_linux_random_h="yes"])
+
+if test "x$has_linux_random_h" = xyes; then
+       AC_DEFINE(HAVE_LINUX_RANDOM_H,1,[Define to 1 if having a valid 
linux/random.h])
+       AC_MSG_RESULT(yes)
+else
+       AC_MSG_RESULT(no)
+fi
+])
-- 
1.8.2.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to