Skip to contentSkip to conversation

meson, configure: always define HAVE_OPEN_MEMSTREAM

PATCH In review Eric Engestrom 4 participants 7 messages Mar 16, 2018 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 meson, configure: always define HAVE_OPEN_MEMSTREAM

---
 configure.ac        | 4 +++-
 intel/test_decode.c | 4 ++--
 meson.build         | 4 +---
 3 files changed, 6 insertions(+), 6 deletions(-)
configure.ac +3 -1
index 5d3a20ffd3e7b38db5f1..5751a8113635ce6a1c48 100644
@@ -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
 
intel/test_decode.c +2 -2
index e25bbf10319b641e2c69..b9f5b92791d5ff0c8052 100644
@@ -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");
meson.build +1 -3
index 5e0840750d2b3ff8c608..f7986af9bb5259be5da5 100644
@@ -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',
Signature · 7 lines
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/4 meson,configure: always define HAVE_VISIBILITY

---
 configure.ac    | 2 ++
 libdrm_macros.h | 2 +-
 meson.build     | 7 +++----
 3 files changed, 6 insertions(+), 5 deletions(-)
configure.ac +2 -0
index 5751a8113635ce6a1c48..14baa1c87f9078f336fa 100644
@@ -535,6 +535,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([
 
 if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
     AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__(("hidden"))])
+else
+    AC_DEFINE(HAVE_VISIBILITY, 0)
 fi
 
 CFLAGS="$CFLAGS -include config.h"
libdrm_macros.h +1 -1
index 639d09047efcd5619ae3..211fab21986f55745ad9 100644
@@ -23,7 +23,7 @@
 #ifndef LIBDRM_LIBDRM_H
 #define LIBDRM_LIBDRM_H
 
-#if defined(HAVE_VISIBILITY)
+#if HAVE_VISIBILITY
 #  define drm_private __attribute__((visibility("hidden")))
 #else
 #  define drm_private
meson.build +3 -4
index f7986af9bb5259be5da5..8d4d38b46ebcf75b9fb6 100644
@@ -256,10 +256,9 @@ with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.fo
 # Used for tets
 prog_bash = find_program('bash')
 
-if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
-               name : 'compiler supports __attribute__(("hidden"))')
-  config.set10('HAVE_VISIBILITY', true)
-endif
+config.set10('HAVE_VISIBILITY',
+  cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
+              name : 'compiler supports __attribute__(("hidden"))'))
 
 foreach t : [
              [with_exynos, 'EXYNOS'],
Signature · 7 lines
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 3/4 meson,configure: always define UDEV

In reply to Eric Engestrom
---
 configure.ac | 2 ++
 meson.build  | 2 +-
 xf86drm.c    | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)
configure.ac +2 -0
index 14baa1c87f9078f336fa..619af49726d198c5d685 100644
@@ -347,6 +347,8 @@ AC_SUBST(PCIACCESS_LIBS)
 
 if test "x$UDEV" = xyes; then
 	AC_DEFINE(UDEV, 1, [Have UDEV support])
+else
+	AC_DEFINE(UDEV, 0)
 fi
 
 AC_CANONICAL_HOST
meson.build +1 -1
index 8d4d38b46ebcf75b9fb6..0fe04a1411963c70cf80 100644
@@ -165,9 +165,9 @@ if _libkms != 'false'
   with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
 endif
 
+config.set10('UDEV', with_udev)
 if with_udev
   dep_udev = dependency('udev')
-  config.set10('UDEV', true)
 else
   dep_udev = []
 endif
xf86drm.c +4 -4
index 117b0fc9e4a0158cf384..689e8fe9fe356957f03e 100644
@@ -290,7 +290,7 @@ static int drmMatchBusID(const char *id1, const char *id2, int pci_domain_ok)
  * If any other failure happened then it will output error mesage using
  * drmMsg() call.
  */
-#if !defined(UDEV)
+#if !UDEV
 static int chown_check_return(const char *path, uid_t owner, gid_t group)
 {
         int rv;
@@ -329,7 +329,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
     int             fd;
     mode_t          devmode = DRM_DEV_MODE, serv_mode;
     gid_t           serv_group;
-#if !defined(UDEV)
+#if !UDEV
     int             isroot  = !geteuid();
     uid_t           user    = DRM_DEV_UID;
     gid_t           group   = DRM_DEV_GID;
@@ -358,7 +358,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
         devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
     }
 
-#if !defined(UDEV)
+#if !UDEV
     if (stat(DRM_DIR_NAME, &st)) {
         if (!isroot)
             return DRM_ERR_NOT_ROOT;
@@ -411,7 +411,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
     if (fd >= 0)
         return fd;
 
-#if !defined(UDEV)
+#if !UDEV
     /* Check if the device node is not what we expect it to be, and recreate it
      * and try again if so.
      */
Signature · 7 lines
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 3/4
#3 lore raw

Re: [PATCH libdrm 3/4] meson,configure: always define UDEV

Quoted 25 lines · Eric Engestrom
---
 configure.ac | 2 ++
 meson.build  | 2 +-
 xf86drm.c    | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)
configure.ac +2 -0
index 14baa1c87f9078f336fa..619af49726d198c5d685 100644
@@ -347,6 +347,8 @@ AC_SUBST(PCIACCESS_LIBS)
 
 if test "x$UDEV" = xyes; then
        AC_DEFINE(UDEV, 1, [Have UDEV support])
+else
+       AC_DEFINE(UDEV, 0)
 fi
 
 AC_CANONICAL_HOST
meson.build +0 -0
index 8d4d38b46ebcf75b9fb6..0fe04a1411963c70cf80 100644

meson.build if _libkms != 'false' · line 168

Quoted 4 lines
meson.build +1 -0
@@ -165,9 +165,9 @@ if _libkms != 'false'
   with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
 endif
 
+config.set10('UDEV', with_udev)

This looks fine.

meson.build if _libkms != 'false' · line 173

Quoted 6 lines
meson.build +0 -1
 if with_udev
   dep_udev = dependency('udev')
-  config.set10('UDEV', true)
 else
   dep_udev = []
 endif

Does this pull udev.pc or libudev.pc?

In either case the whole thing can go - see 0ec7252a1deba3bac78b5ba1ebd2898f6bbf0332 + parent commit.

The series is

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Re: [PATCH libdrm 3/4] meson,configure: always define UDEV

Quoted 35 lines · Emil Velikov
Quoted 25 lines · Eric Engestrom
---
 configure.ac | 2 ++
 meson.build  | 2 +-
 xf86drm.c    | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)
configure.ac +2 -0
index 14baa1c87f9078f336fa..619af49726d198c5d685 100644
@@ -347,6 +347,8 @@ AC_SUBST(PCIACCESS_LIBS)
 
 if test "x$UDEV" = xyes; then
        AC_DEFINE(UDEV, 1, [Have UDEV support])
+else
+       AC_DEFINE(UDEV, 0)
 fi
 
 AC_CANONICAL_HOST
meson.build +0 -0
index 8d4d38b46ebcf75b9fb6..0fe04a1411963c70cf80 100644

meson.build if _libkms != 'false' · line 165

Quoted 1 line
meson.build +0 -0
@@ -165,9 +165,9 @@ if _libkms != 'false'
   with_libkms = _libkms == 'true' or ['linux', 'freebsd',

'dragonfly'].contains(host_machine.system())

meson.build if _libkms != 'false' · line 168

Quoted 3 lines
meson.build +1 -0
 endif
 
+config.set10('UDEV', with_udev)

This looks fine.

Quoted 7 lines

meson.build if _libkms != 'false' · line 173

Quoted 6 lines
meson.build +0 -1
 if with_udev
   dep_udev = dependency('udev')
-  config.set10('UDEV', true)
 else
   dep_udev = []
 endif

Does this pull udev.pc or libudev.pc?

udev.pc, which I think is libudev (not on a computer right now, too complicated to double check)

Quoted 3 lines

In either case the whole thing can go - see 0ec7252a1deba3bac78b5ba1ebd2898f6bbf0332 + parent commit.

Sure; I'll double check that this is true for meson as well, and make another patch atop this series for that next week :)

Quoted 3 lines

The series is

Thanks; I'll push it next week though :)

Quoted 6 lines

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

PATCH 4/4 meson: replace `if(compiles) have=true` with `have=compiles`

In reply to Eric Engestrom
---
 meson.build | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meson.build +2 -3
index 0fe04a1411963c70cf80..74a541e8d835ae27c7f4 100644
@@ -187,9 +187,8 @@ else
 endif
 dep_m = cc.find_library('m', required : false)
 foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
-  if cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))
-    config.set10('HAVE_' + header.underscorify().to_upper(), true)
-  endif
+  config.set('HAVE_' + header.underscorify().to_upper(),
+    cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header)))
 endforeach
 if cc.has_header_symbol('sys/sysmacros.h', 'major')
   config.set10('MAJOR_IN_SYSMACROS', true)
Signature · 7 lines
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 4/4
#6 lore raw

Re: [PATCH libdrm 4/4] meson: replace `if(compiles) have=true` with `have=compiles`

Quoting Eric Engestrom (2018-03-16 10:12:27)

Quoted 25 lines
---
 meson.build | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meson.build +2 -3
index 0fe04a1411963c70cf80..74a541e8d835ae27c7f4 100644
@@ -187,9 +187,8 @@ else
 endif
 dep_m = cc.find_library('m', required : false)
 foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
-  if cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))
-    config.set10('HAVE_' + header.underscorify().to_upper(), true)
-  endif
+  config.set('HAVE_' + header.underscorify().to_upper(),
+    cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header)))
 endforeach
 if cc.has_header_symbol('sys/sysmacros.h', 'major')
   config.set10('MAJOR_IN_SYSMACROS', true)
Signature · 2 lines
Cheers,
  Eric

for the series:

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel