diff mbox

[libdrm,1/4] meson, configure: always define HAVE_OPEN_MEMSTREAM

Message ID 20180316171227.2968-1-eric.engestrom@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Engestrom March 16, 2018, 5:12 p.m. UTC
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 configure.ac        | 4 +++-
 intel/test_decode.c | 4 ++--
 meson.build         | 4 +---
 3 files changed, 6 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 5d3a20ffd3e7b38db5f1..5751a8113635ce6a1c48 100644
--- a/configure.ac
+++ b/configure.ac
@@ -189,7 +189,9 @@  AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
                              [AC_MSG_ERROR([Couldn't find clock_gettime])])])
 AC_SUBST([CLOCK_LIB])
 
-AC_CHECK_FUNCS([open_memstream], [HAVE_OPEN_MEMSTREAM=yes])
+AC_CHECK_FUNCS([open_memstream],
+               [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
+               [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
 dnl Use lots of warning flags with with gcc and compatible compilers
 
diff --git a/intel/test_decode.c b/intel/test_decode.c
index e25bbf10319b641e2c69..b9f5b92791d5ff0c8052 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -87,7 +87,7 @@  compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
 {
 	FILE *out = NULL;
 	void *ptr, *ref_ptr, *batch_ptr;
-#ifdef HAVE_OPEN_MEMSTREAM
+#if HAVE_OPEN_MEMSTREAM
 	size_t size;
 #endif
 	size_t ref_size, batch_size;
@@ -105,7 +105,7 @@  compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
 	 * figure out how to output to a file in a safe and sane way
 	 * inside of an automake project's test infrastructure.
 	 */
-#ifdef HAVE_OPEN_MEMSTREAM
+#if HAVE_OPEN_MEMSTREAM
 	out = open_memstream((char **)&ptr, &size);
 #else
 	fprintf(stderr, "platform lacks open_memstream, skipping.\n");
diff --git a/meson.build b/meson.build
index 5e0840750d2b3ff8c608..f7986af9bb5259be5da5 100644
--- a/meson.build
+++ b/meson.build
@@ -196,9 +196,7 @@  if cc.has_header_symbol('sys/sysmacros.h', 'major')
 elif cc.has_header_symbol('sys/mkdev.h', 'major')
   config.set10('MAJOR_IN_MKDEV', true)
 endif
-if cc.has_function('open_memstream')
-  config.set10('HAVE_OPEN_MEMSTREAM', true)
-endif
+config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream'))
 
 warn_c_args = []
 foreach a : ['-Wall', '-Wextra', '-Wsign-compare', '-Werror=undef',