diff mbox

check that sys/sdt.h can be used with the target

Message ID 537C9AC0.1020402@ubuntu.com
State New
Headers show

Commit Message

Matthias Klose May 21, 2014, 12:23 p.m. UTC
The HAVE_SYS_SDT_H define succeeds when the file sys/sdt.h is found. It doesn't
use the target compiler for that check, like AC_CHECK_HEADER does.  This patch
uses AC_COMPILE to check for the header and ensure that a dummy program succeeds
to build.

This is a different patch than the one proposed at
https://gcc.gnu.org/ml/gcc-patches/2012-12/msg01122.html

I think the conditional with the file check can be removed too, kept it for now.

Ok for the trunk?

  Matthias
PR other/61257
	* configure.ac: Build a test program before defining HAVE_SYS_SDT_H.
	* configure: Regenerate.
diff mbox

Patch

Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 210677)
+++ gcc/configure.ac	(working copy)
@@ -4971,9 +4971,13 @@ 
 AC_MSG_CHECKING(sys/sdt.h in the target C library)
 have_sys_sdt_h=no
 if test -f $target_header_dir/sys/sdt.h; then
-  have_sys_sdt_h=yes
-  AC_DEFINE(HAVE_SYS_SDT_H, 1,
-            [Define if your target C library provides sys/sdt.h])
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sdt.h>]],
+                                     [[DTRACE_PROBE(foo,bar); return 0;]])
+                    ],[
+                     have_sys_sdt_h=yes
+                     AC_DEFINE(HAVE_SYS_SDT_H, 1,
+                       [Define if your target C library provides sys/sdt.h])
+                    ])
 fi
 AC_MSG_RESULT($have_sys_sdt_h)