Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On Wednesday, 2018-03-28 14:05:00 +1100, Jonathan Gray wrote: > On Tue, Mar 27, 2018 at 07:36:17PM +0100, Emil Velikov wrote: > > On 25 March 2018 at 09:06, Jonathan Graywrote: > > > On Wed, Mar 21, 2018 at 05:09:17PM +, Eric Engestrom wrote: > > >> Cc: Maxin B. John > > >> Cc: Khem Raj > > >> Suggested-by: Jon Turney > > >> Signed-off-by: Eric Engestrom > > >> --- > > >> configure.ac| 1 + > > >> meson.build | 2 +- > > >> src/util/u_endian.h | 2 +- > > >> 3 files changed, 3 insertions(+), 2 deletions(-) > > > > > > OpenBSD and I suspect other systems have an endian.h that does not have > > > the __ defines like glibc. > > > > > Sigh, I guess the C/POSIX commitee should really wake up and add that > > to the standard. > > ... one way or another. > > > > Jonathan can you play around with AC_CHECK_DECLS and send a patch that > > works on your end? > > > > Thanks > > Emil > > > > [1] > > https://www.gnu.org/software/autoconf/manual/autoconf-2.62/html_node/Generic-Declarations.html > > Or just change the header? Or just add `_DEFAULT_SOURCE` to the build, allowing glibc to use non-underscored names? I was meaning to send a patch with this, but I'm swamped right now and haven't have a change to do this, but I'd rather not duplicate the block like suggested below. Automatic ack from me on a patch that adds this define to all the build systems, replaces all 3 names with their non-underscored variants and adds a `#ifndef BYTE_ORDER #error "BYTE_ORDER undefined" #endif`. > > Some care is needed as '#if undefined == undefined' becomes '#if 0 == 0' > which is true... Agreed :) > > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > index e11b381588..bf3b8707a1 100644 > --- a/src/util/u_endian.h > +++ b/src/util/u_endian.h > @@ -30,9 +30,17 @@ > #ifdef HAVE_ENDIAN_H > #include > > -#if __BYTE_ORDER == __LITTLE_ENDIAN > +/* glibc */ > +#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) > # define PIPE_ARCH_LITTLE_ENDIAN > -#elif __BYTE_ORDER == __BIG_ENDIAN > +#elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) > +# define PIPE_ARCH_BIG_ENDIAN > +#endif > + > +/* OpenBSD */ > +#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN) > +# define PIPE_ARCH_LITTLE_ENDIAN > +#elif defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN) > # define PIPE_ARCH_BIG_ENDIAN > #endif > > @@ -54,8 +62,8 @@ > # define PIPE_ARCH_BIG_ENDIAN > #endif > > -#elif defined(__OpenBSD__) || defined(__NetBSD__) || \ > - defined(__FreeBSD__) || defined(__DragonFly__) > +#elif defined(__NetBSD__) || defined(__FreeBSD__) || \ > + defined(__DragonFly__) > #include > #include > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On Tue, Mar 27, 2018 at 07:36:17PM +0100, Emil Velikov wrote: > On 25 March 2018 at 09:06, Jonathan Graywrote: > > On Wed, Mar 21, 2018 at 05:09:17PM +, Eric Engestrom wrote: > >> Cc: Maxin B. John > >> Cc: Khem Raj > >> Suggested-by: Jon Turney > >> Signed-off-by: Eric Engestrom > >> --- > >> configure.ac| 1 + > >> meson.build | 2 +- > >> src/util/u_endian.h | 2 +- > >> 3 files changed, 3 insertions(+), 2 deletions(-) > > > > OpenBSD and I suspect other systems have an endian.h that does not have > > the __ defines like glibc. > > > Sigh, I guess the C/POSIX commitee should really wake up and add that > to the standard. > ... one way or another. > > Jonathan can you play around with AC_CHECK_DECLS and send a patch that > works on your end? > > Thanks > Emil > > [1] > https://www.gnu.org/software/autoconf/manual/autoconf-2.62/html_node/Generic-Declarations.html Or just change the header? Some care is needed as '#if undefined == undefined' becomes '#if 0 == 0' which is true... diff --git a/src/util/u_endian.h b/src/util/u_endian.h index e11b381588..bf3b8707a1 100644 --- a/src/util/u_endian.h +++ b/src/util/u_endian.h @@ -30,9 +30,17 @@ #ifdef HAVE_ENDIAN_H #include -#if __BYTE_ORDER == __LITTLE_ENDIAN +/* glibc */ +#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) # define PIPE_ARCH_LITTLE_ENDIAN -#elif __BYTE_ORDER == __BIG_ENDIAN +#elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) +# define PIPE_ARCH_BIG_ENDIAN +#endif + +/* OpenBSD */ +#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN) +# define PIPE_ARCH_LITTLE_ENDIAN +#elif defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN) # define PIPE_ARCH_BIG_ENDIAN #endif @@ -54,8 +62,8 @@ # define PIPE_ARCH_BIG_ENDIAN #endif -#elif defined(__OpenBSD__) || defined(__NetBSD__) || \ - defined(__FreeBSD__) || defined(__DragonFly__) +#elif defined(__NetBSD__) || defined(__FreeBSD__) || \ + defined(__DragonFly__) #include #include ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On 25 March 2018 at 09:06, Jonathan Graywrote: > On Wed, Mar 21, 2018 at 05:09:17PM +, Eric Engestrom wrote: >> Cc: Maxin B. John >> Cc: Khem Raj >> Suggested-by: Jon Turney >> Signed-off-by: Eric Engestrom >> --- >> configure.ac| 1 + >> meson.build | 2 +- >> src/util/u_endian.h | 2 +- >> 3 files changed, 3 insertions(+), 2 deletions(-) > > OpenBSD and I suspect other systems have an endian.h that does not have > the __ defines like glibc. > Sigh, I guess the C/POSIX commitee should really wake up and add that to the standard. ... one way or another. Jonathan can you play around with AC_CHECK_DECLS and send a patch that works on your end? Thanks Emil [1] https://www.gnu.org/software/autoconf/manual/autoconf-2.62/html_node/Generic-Declarations.html ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On Wed, Mar 21, 2018 at 10:09 AM, Eric Engestromwrote: > Cc: Maxin B. John > Cc: Khem Raj > Suggested-by: Jon Turney > Signed-off-by: Eric Engestrom > --- > configure.ac| 1 + > meson.build | 2 +- > src/util/u_endian.h | 2 +- > 3 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -865,6 +865,7 @@ fi > AC_HEADER_MAJOR > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) > diff --git a/meson.build b/meson.build > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > --- a/meson.build > +++ b/meson.build > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') >pre_args += '-DMAJOR_IN_MKDEV' > endif > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] >if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) >endif > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > --- a/src/util/u_endian.h > +++ b/src/util/u_endian.h > @@ -27,7 +27,7 @@ > #ifndef U_ENDIAN_H > #define U_ENDIAN_H > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > +#ifdef HAVE_ENDIAN_H > #include > > #if __BYTE_ORDER == __LITTLE_ENDIAN I like this patch better than what I had done. Please go ahead with this change ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On Wed, Mar 21, 2018 at 05:09:17PM +, Eric Engestrom wrote: > Cc: Maxin B. John> Cc: Khem Raj > Suggested-by: Jon Turney > Signed-off-by: Eric Engestrom > --- > configure.ac| 1 + > meson.build | 2 +- > src/util/u_endian.h | 2 +- > 3 files changed, 3 insertions(+), 2 deletions(-) OpenBSD and I suspect other systems have an endian.h that does not have the __ defines like glibc. So this change will break things unless a block along the lines of #if _BYTE_ORDER == _LITTLE_ENDIAN # define PIPE_ARCH_LITTLE_ENDIAN #elif _BYTE_ORDER == _BIG_ENDIAN # define PIPE_ARCH_BIG_ENDIAN #endif or #if BYTE_ORDER == LITTLE_ENDIAN # define PIPE_ARCH_LITTLE_ENDIAN #elif BYTE_ORDER == BIG_ENDIAN # define PIPE_ARCH_BIG_ENDIAN #endif is added. defines the public non underscored names will only pull in the underscored defines. > > diff --git a/configure.ac b/configure.ac > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -865,6 +865,7 @@ fi > AC_HEADER_MAJOR > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) > diff --git a/meson.build b/meson.build > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > --- a/meson.build > +++ b/meson.build > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') >pre_args += '-DMAJOR_IN_MKDEV' > endif > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] >if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) >endif > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > --- a/src/util/u_endian.h > +++ b/src/util/u_endian.h > @@ -27,7 +27,7 @@ > #ifndef U_ENDIAN_H > #define U_ENDIAN_H > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > +#ifdef HAVE_ENDIAN_H > #include > > #if __BYTE_ORDER == __LITTLE_ENDIAN > -- > Cheers, > Eric > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On Friday, 2018-03-23 09:33:39 +, Eric Engestrom wrote: > > > On March 23, 2018 9:21:25 AM UTC, "Tapani Pälli"> wrote: > > > > > > On 03/21/2018 08:55 PM, Eric Engestrom wrote: > > > > > > > > > On March 21, 2018 6:47:48 PM UTC, Dylan Baker > > wrote: > > >> Quoting Emil Velikov (2018-03-21 10:53:08) > > >>> On 21 March 2018 at 17:09, Eric Engestrom > > >> wrote: > > Cc: Maxin B. John > > Cc: Khem Raj > > Suggested-by: Jon Turney > > Signed-off-by: Eric Engestrom > > --- > > configure.ac| 1 + > > meson.build | 2 +- > > src/util/u_endian.h | 2 +- > > 3 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/configure.ac b/configure.ac > > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -865,6 +865,7 @@ fi > > AC_HEADER_MAJOR > > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES > > >> -DHAVE_XLOCALE_H"]) > > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES > > >> -DHAVE_SYS_SYSCTL_H"]) > > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES > > -DHAVE_ENDIAN_H"]) > > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES > > >> -DHAVE_TIMESPEC_GET"]) > > >>> Just hit me - why are we using any of these instead of > > >> AC_CHECK_FUNCS > > >>> and AC_CHECK_HEADERS (note the S at the end). > > >>> Those take a list + automatically set the HAVE_ macros for us. > > >>> > > >>> Off the top of my head - we could even use the _ONCE version which > > >>> should lead to smaller configure file + faster runtime. > > >>> > > >>> I'm thinking out loud here ^^, no changes needed ;-) > > >>> > > diff --git a/meson.build b/meson.build > > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', > > >> 'major') > > pre_args += '-DMAJOR_IN_MKDEV' > > endif > > > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', > > >> 'endian.h'] > > if cc.compiles('#include <@0@>'.format(h), name : '@0@ > > >> works'.format(h)) > > pre_args += > > '-DHAVE_@0@'.format(h.to_upper().underscorify()) > > endif > > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > > --- a/src/util/u_endian.h > > +++ b/src/util/u_endian.h > > @@ -27,7 +27,7 @@ > > #ifndef U_ENDIAN_H > > #define U_ENDIAN_H > > > > -#if defined(__GLIBC__) || defined(ANDROID) || > > defined(__CYGWIN__) > > +#ifdef HAVE_ENDIAN_H > > >>> I'd either keep the ANDROID hunk here, or add -DHAVE_ENDIAN_H to > > >>> Android.common.mk > > >>> With slight inclination towards the latter ;-) > > >>> > > >>> With that the patch is > > >>> Reviewed-by: Emil Velikov > > >>> Cc: > > >>> > > >> > > >> With Emil's fixes, > > >> Reviewed-by: Dylan Baker > > > > > > Thanks! > > > I have the Android.common.mk hunk that I sent in the other email > > > applied locally; this is what I'll push tomorrow, I'm just giving > > > RobHer some time to shout if I'm doing it wrong. > > > > Not sure if this got resolved > > I forgot/didn't have time to push it last night, I'll do that when I get to > my desk in half an hour. pushed now: cbee1bfb34274668a059 > > > but Android has endian.h and it is fine > > to > > have -DHAVE_ENDIAN_H in Android.common.mk. > > Is that an r-b? :P > > > > > // Tapani > > ___ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On March 23, 2018 9:21:25 AM UTC, "Tapani Pälli"wrote: > > > On 03/21/2018 08:55 PM, Eric Engestrom wrote: > > > > > > On March 21, 2018 6:47:48 PM UTC, Dylan Baker > wrote: > >> Quoting Emil Velikov (2018-03-21 10:53:08) > >>> On 21 March 2018 at 17:09, Eric Engestrom > >> wrote: > Cc: Maxin B. John > Cc: Khem Raj > Suggested-by: Jon Turney > Signed-off-by: Eric Engestrom > --- > configure.ac| 1 + > meson.build | 2 +- > src/util/u_endian.h | 2 +- > 3 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -865,6 +865,7 @@ fi > AC_HEADER_MAJOR > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES > >> -DHAVE_XLOCALE_H"]) > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES > >> -DHAVE_SYS_SYSCTL_H"]) > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES > -DHAVE_ENDIAN_H"]) > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES > >> -DHAVE_TIMESPEC_GET"]) > >>> Just hit me - why are we using any of these instead of > >> AC_CHECK_FUNCS > >>> and AC_CHECK_HEADERS (note the S at the end). > >>> Those take a list + automatically set the HAVE_ macros for us. > >>> > >>> Off the top of my head - we could even use the _ONCE version which > >>> should lead to smaller configure file + faster runtime. > >>> > >>> I'm thinking out loud here ^^, no changes needed ;-) > >>> > diff --git a/meson.build b/meson.build > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > --- a/meson.build > +++ b/meson.build > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', > >> 'major') > pre_args += '-DMAJOR_IN_MKDEV' > endif > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', > >> 'endian.h'] > if cc.compiles('#include <@0@>'.format(h), name : '@0@ > >> works'.format(h)) > pre_args += > '-DHAVE_@0@'.format(h.to_upper().underscorify()) > endif > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > --- a/src/util/u_endian.h > +++ b/src/util/u_endian.h > @@ -27,7 +27,7 @@ > #ifndef U_ENDIAN_H > #define U_ENDIAN_H > > -#if defined(__GLIBC__) || defined(ANDROID) || > defined(__CYGWIN__) > +#ifdef HAVE_ENDIAN_H > >>> I'd either keep the ANDROID hunk here, or add -DHAVE_ENDIAN_H to > >>> Android.common.mk > >>> With slight inclination towards the latter ;-) > >>> > >>> With that the patch is > >>> Reviewed-by: Emil Velikov > >>> Cc: > >>> > >> > >> With Emil's fixes, > >> Reviewed-by: Dylan Baker > > > > Thanks! > > I have the Android.common.mk hunk that I sent in the other email > > applied locally; this is what I'll push tomorrow, I'm just giving > > RobHer some time to shout if I'm doing it wrong. > > Not sure if this got resolved I forgot/didn't have time to push it last night, I'll do that when I get to my desk in half an hour. > but Android has endian.h and it is fine > to > have -DHAVE_ENDIAN_H in Android.common.mk. Is that an r-b? :P > > // Tapani > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On 03/21/2018 08:55 PM, Eric Engestrom wrote: On March 21, 2018 6:47:48 PM UTC, Dylan Bakerwrote: Quoting Emil Velikov (2018-03-21 10:53:08) On 21 March 2018 at 17:09, Eric Engestrom wrote: Cc: Maxin B. John Cc: Khem Raj Suggested-by: Jon Turney Signed-off-by: Eric Engestrom --- configure.ac| 1 + meson.build | 2 +- src/util/u_endian.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 --- a/configure.ac +++ b/configure.ac @@ -865,6 +865,7 @@ fi AC_HEADER_MAJOR AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) Just hit me - why are we using any of these instead of AC_CHECK_FUNCS and AC_CHECK_HEADERS (note the S at the end). Those take a list + automatically set the HAVE_ macros for us. Off the top of my head - we could even use the _ONCE version which should lead to smaller configure file + faster runtime. I'm thinking out loud here ^^, no changes needed ;-) diff --git a/meson.build b/meson.build index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 --- a/meson.build +++ b/meson.build @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') pre_args += '-DMAJOR_IN_MKDEV' endif -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) endif diff --git a/src/util/u_endian.h b/src/util/u_endian.h index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 --- a/src/util/u_endian.h +++ b/src/util/u_endian.h @@ -27,7 +27,7 @@ #ifndef U_ENDIAN_H #define U_ENDIAN_H -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) +#ifdef HAVE_ENDIAN_H I'd either keep the ANDROID hunk here, or add -DHAVE_ENDIAN_H to Android.common.mk With slight inclination towards the latter ;-) With that the patch is Reviewed-by: Emil Velikov Cc: With Emil's fixes, Reviewed-by: Dylan Baker Thanks! I have the Android.common.mk hunk that I sent in the other email applied locally; this is what I'll push tomorrow, I'm just giving RobHer some time to shout if I'm doing it wrong. Not sure if this got resolved but Android has endian.h and it is fine to have -DHAVE_ENDIAN_H in Android.common.mk. // Tapani ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On March 21, 2018 6:47:48 PM UTC, Dylan Bakerwrote: > Quoting Emil Velikov (2018-03-21 10:53:08) > > On 21 March 2018 at 17:09, Eric Engestrom > wrote: > > > Cc: Maxin B. John > > > Cc: Khem Raj > > > Suggested-by: Jon Turney > > > Signed-off-by: Eric Engestrom > > > --- > > > configure.ac| 1 + > > > meson.build | 2 +- > > > src/util/u_endian.h | 2 +- > > > 3 files changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/configure.ac b/configure.ac > > > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > > > --- a/configure.ac > > > +++ b/configure.ac > > > @@ -865,6 +865,7 @@ fi > > > AC_HEADER_MAJOR > > > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES > -DHAVE_XLOCALE_H"]) > > > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES > -DHAVE_SYS_SYSCTL_H"]) > > > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > > > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > > > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > > > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES > -DHAVE_TIMESPEC_GET"]) > > Just hit me - why are we using any of these instead of > AC_CHECK_FUNCS > > and AC_CHECK_HEADERS (note the S at the end). > > Those take a list + automatically set the HAVE_ macros for us. > > > > Off the top of my head - we could even use the _ONCE version which > > should lead to smaller configure file + faster runtime. > > > > I'm thinking out loud here ^^, no changes needed ;-) > > > > > diff --git a/meson.build b/meson.build > > > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > > > --- a/meson.build > > > +++ b/meson.build > > > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', > 'major') > > >pre_args += '-DMAJOR_IN_MKDEV' > > > endif > > > > > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > > > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', > 'endian.h'] > > >if cc.compiles('#include <@0@>'.format(h), name : '@0@ > works'.format(h)) > > > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) > > >endif > > > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > > > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > > > --- a/src/util/u_endian.h > > > +++ b/src/util/u_endian.h > > > @@ -27,7 +27,7 @@ > > > #ifndef U_ENDIAN_H > > > #define U_ENDIAN_H > > > > > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > > > +#ifdef HAVE_ENDIAN_H > > I'd either keep the ANDROID hunk here, or add -DHAVE_ENDIAN_H to > > Android.common.mk > > With slight inclination towards the latter ;-) > > > > With that the patch is > > Reviewed-by: Emil Velikov > > Cc: > > > > With Emil's fixes, > Reviewed-by: Dylan Baker Thanks! I have the Android.common.mk hunk that I sent in the other email applied locally; this is what I'll push tomorrow, I'm just giving RobHer some time to shout if I'm doing it wrong. Cheers, Eric ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
Quoting Emil Velikov (2018-03-21 10:53:08) > On 21 March 2018 at 17:09, Eric Engestromwrote: > > Cc: Maxin B. John > > Cc: Khem Raj > > Suggested-by: Jon Turney > > Signed-off-by: Eric Engestrom > > --- > > configure.ac| 1 + > > meson.build | 2 +- > > src/util/u_endian.h | 2 +- > > 3 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/configure.ac b/configure.ac > > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -865,6 +865,7 @@ fi > > AC_HEADER_MAJOR > > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) > > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) > Just hit me - why are we using any of these instead of AC_CHECK_FUNCS > and AC_CHECK_HEADERS (note the S at the end). > Those take a list + automatically set the HAVE_ macros for us. > > Off the top of my head - we could even use the _ONCE version which > should lead to smaller configure file + faster runtime. > > I'm thinking out loud here ^^, no changes needed ;-) > > > diff --git a/meson.build b/meson.build > > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') > >pre_args += '-DMAJOR_IN_MKDEV' > > endif > > > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] > >if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) > > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) > >endif > > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > > --- a/src/util/u_endian.h > > +++ b/src/util/u_endian.h > > @@ -27,7 +27,7 @@ > > #ifndef U_ENDIAN_H > > #define U_ENDIAN_H > > > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > > +#ifdef HAVE_ENDIAN_H > I'd either keep the ANDROID hunk here, or add -DHAVE_ENDIAN_H to > Android.common.mk > With slight inclination towards the latter ;-) > > With that the patch is > Reviewed-by: Emil Velikov > Cc: > With Emil's fixes, Reviewed-by: Dylan Baker signature.asc Description: signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
Quoting Emil Velikov (2018-03-21 10:57:09) > On 21 March 2018 at 17:54, Eric Engestromwrote: > > On Wednesday, 2018-03-21 10:45:35 -0700, Dylan Baker wrote: > >> Quoting Eric Engestrom (2018-03-21 10:09:17) > >> > Cc: Maxin B. John > >> > Cc: Khem Raj > >> > Suggested-by: Jon Turney > >> > Signed-off-by: Eric Engestrom > >> > --- > >> > configure.ac| 1 + > >> > meson.build | 2 +- > >> > src/util/u_endian.h | 2 +- > >> > 3 files changed, 3 insertions(+), 2 deletions(-) > >> > > >> > diff --git a/configure.ac b/configure.ac > >> > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > >> > --- a/configure.ac > >> > +++ b/configure.ac > >> > @@ -865,6 +865,7 @@ fi > >> > AC_HEADER_MAJOR > >> > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > >> > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES > >> > -DHAVE_SYS_SYSCTL_H"]) > >> > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > >> > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > >> > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > >> > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) > >> > diff --git a/meson.build b/meson.build > >> > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > >> > --- a/meson.build > >> > +++ b/meson.build > >> > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') > >> >pre_args += '-DMAJOR_IN_MKDEV' > >> > endif > >> > > >> > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > >> > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] > >> >if cc.compiles('#include <@0@>'.format(h), name : '@0@ > >> > works'.format(h)) > >> > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) > >> >endif > >> > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > >> > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > >> > --- a/src/util/u_endian.h > >> > +++ b/src/util/u_endian.h > >> > @@ -27,7 +27,7 @@ > >> > #ifndef U_ENDIAN_H > >> > #define U_ENDIAN_H > >> > > >> > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > >> > +#ifdef HAVE_ENDIAN_H > >> > >> is it really safe to remove the `defined(ANDROID)` check here? > > > > I'm clearly too tired to do this... > > > > Cc'ing Rob; can you tell us if defining HAVE_ENDIAN_H unconditionally in > > Android.mk seems reasonable? Or is there a way to detect headers on Android? > > > Pretty sure it's safe - we've been doing that for a long time ;-) > > > I also forgot to add the check in scons; I just added this to the commit > > locally: > > 8< > > diff --git a/scons/gallium.py b/scons/gallium.py > > index 75200b89c1fe6d751980..6cb20efcbf4b8c997f60 100755 > > --- a/scons/gallium.py > > +++ b/scons/gallium.py > > @@ -354,6 +354,9 @@ def generate(env): > > if check_header(env, 'xlocale.h'): > > cppdefines += ['HAVE_XLOCALE_H'] > > > > +if check_header(env, 'endian.h'): > > +cppdefines += ['HAVE_ENDIAN_H'] > > + > Wondering if anyone uses scons on POSIX platforms. Regardless - thanks > for updating it. We do build test scons on Linux, it gives a pretty good indication when someone has broken the build on Windows (or is going to). Dylan signature.asc Description: signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On Wednesday, 2018-03-21 17:53:08 +, Emil Velikov wrote: > On 21 March 2018 at 17:09, Eric Engestromwrote: > > Cc: Maxin B. John > > Cc: Khem Raj > > Suggested-by: Jon Turney > > Signed-off-by: Eric Engestrom > > --- > > configure.ac| 1 + > > meson.build | 2 +- > > src/util/u_endian.h | 2 +- > > 3 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/configure.ac b/configure.ac > > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -865,6 +865,7 @@ fi > > AC_HEADER_MAJOR > > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) > > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) > Just hit me - why are we using any of these instead of AC_CHECK_FUNCS > and AC_CHECK_HEADERS (note the S at the end). > Those take a list + automatically set the HAVE_ macros for us. > > Off the top of my head - we could even use the _ONCE version which > should lead to smaller configure file + faster runtime. > > I'm thinking out loud here ^^, no changes needed ;-) I'll leave autotools refactors to you, I myself consider it in maintenance-only mode :P > > > diff --git a/meson.build b/meson.build > > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') > >pre_args += '-DMAJOR_IN_MKDEV' > > endif > > > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] > >if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) > > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) > >endif > > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > > --- a/src/util/u_endian.h > > +++ b/src/util/u_endian.h > > @@ -27,7 +27,7 @@ > > #ifndef U_ENDIAN_H > > #define U_ENDIAN_H > > > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > > +#ifdef HAVE_ENDIAN_H > I'd either keep the ANDROID hunk here, or add -DHAVE_ENDIAN_H to > Android.common.mk > With slight inclination towards the latter ;-) Same, I just asked RobHer what he thinks. > > With that the patch is > Reviewed-by: Emil Velikov Thanks! > Cc: Good point, didn't think about that! > > -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On 21 March 2018 at 17:54, Eric Engestromwrote: > On Wednesday, 2018-03-21 10:45:35 -0700, Dylan Baker wrote: >> Quoting Eric Engestrom (2018-03-21 10:09:17) >> > Cc: Maxin B. John >> > Cc: Khem Raj >> > Suggested-by: Jon Turney >> > Signed-off-by: Eric Engestrom >> > --- >> > configure.ac| 1 + >> > meson.build | 2 +- >> > src/util/u_endian.h | 2 +- >> > 3 files changed, 3 insertions(+), 2 deletions(-) >> > >> > diff --git a/configure.ac b/configure.ac >> > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 >> > --- a/configure.ac >> > +++ b/configure.ac >> > @@ -865,6 +865,7 @@ fi >> > AC_HEADER_MAJOR >> > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) >> > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) >> > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) >> > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) >> > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) >> > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) >> > diff --git a/meson.build b/meson.build >> > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 >> > --- a/meson.build >> > +++ b/meson.build >> > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') >> >pre_args += '-DMAJOR_IN_MKDEV' >> > endif >> > >> > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] >> > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] >> >if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) >> > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) >> >endif >> > diff --git a/src/util/u_endian.h b/src/util/u_endian.h >> > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 >> > --- a/src/util/u_endian.h >> > +++ b/src/util/u_endian.h >> > @@ -27,7 +27,7 @@ >> > #ifndef U_ENDIAN_H >> > #define U_ENDIAN_H >> > >> > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) >> > +#ifdef HAVE_ENDIAN_H >> >> is it really safe to remove the `defined(ANDROID)` check here? > > I'm clearly too tired to do this... > > Cc'ing Rob; can you tell us if defining HAVE_ENDIAN_H unconditionally in > Android.mk seems reasonable? Or is there a way to detect headers on Android? > Pretty sure it's safe - we've been doing that for a long time ;-) > I also forgot to add the check in scons; I just added this to the commit > locally: > 8< > diff --git a/scons/gallium.py b/scons/gallium.py > index 75200b89c1fe6d751980..6cb20efcbf4b8c997f60 100755 > --- a/scons/gallium.py > +++ b/scons/gallium.py > @@ -354,6 +354,9 @@ def generate(env): > if check_header(env, 'xlocale.h'): > cppdefines += ['HAVE_XLOCALE_H'] > > +if check_header(env, 'endian.h'): > +cppdefines += ['HAVE_ENDIAN_H'] > + Wondering if anyone uses scons on POSIX platforms. Regardless - thanks for updating it. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On Wednesday, 2018-03-21 17:54:02 +, Eric Engestrom wrote: > On Wednesday, 2018-03-21 10:45:35 -0700, Dylan Baker wrote: > > Quoting Eric Engestrom (2018-03-21 10:09:17) > > > Cc: Maxin B. John> > > Cc: Khem Raj > > > Suggested-by: Jon Turney > > > Signed-off-by: Eric Engestrom > > > --- > > > configure.ac| 1 + > > > meson.build | 2 +- > > > src/util/u_endian.h | 2 +- > > > 3 files changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/configure.ac b/configure.ac > > > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > > > --- a/configure.ac > > > +++ b/configure.ac > > > @@ -865,6 +865,7 @@ fi > > > AC_HEADER_MAJOR > > > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > > > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) > > > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > > > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > > > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > > > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) > > > diff --git a/meson.build b/meson.build > > > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > > > --- a/meson.build > > > +++ b/meson.build > > > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') > > >pre_args += '-DMAJOR_IN_MKDEV' > > > endif > > > > > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > > > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] > > >if cc.compiles('#include <@0@>'.format(h), name : '@0@ > > > works'.format(h)) > > > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) > > >endif > > > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > > > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > > > --- a/src/util/u_endian.h > > > +++ b/src/util/u_endian.h > > > @@ -27,7 +27,7 @@ > > > #ifndef U_ENDIAN_H > > > #define U_ENDIAN_H > > > > > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > > > +#ifdef HAVE_ENDIAN_H > > > > is it really safe to remove the `defined(ANDROID)` check here? > > I'm clearly too tired to do this... > > Cc'ing Rob; can you tell us if defining HAVE_ENDIAN_H unconditionally in > Android.mk seems reasonable? Or is there a way to detect headers on Android? To be clear, I'm suggesting this: 8< diff --git a/Android.common.mk b/Android.common.mk index 52dc7bff3be5af1f97b6..e8aed48c31ab1704cbcf 100644 --- a/Android.common.mk +++ b/Android.common.mk @@ -70,6 +70,7 @@ LOCAL_CFLAGS += \ -DHAVE_DLADDR \ -DHAVE_DL_ITERATE_PHDR \ -DHAVE_LINUX_FUTEX_H \ + -DHAVE_ENDIAN_H \ -DHAVE_ZLIB \ -DMAJOR_IN_SYSMACROS \ -fvisibility=hidden \ >8 > > I also forgot to add the check in scons; I just added this to the commit > locally: > 8< > diff --git a/scons/gallium.py b/scons/gallium.py > index 75200b89c1fe6d751980..6cb20efcbf4b8c997f60 100755 > --- a/scons/gallium.py > +++ b/scons/gallium.py > @@ -354,6 +354,9 @@ def generate(env): > if check_header(env, 'xlocale.h'): > cppdefines += ['HAVE_XLOCALE_H'] > > +if check_header(env, 'endian.h'): > +cppdefines += ['HAVE_ENDIAN_H'] > + > if check_functions(env, ['strtod_l', 'strtof_l']): > cppdefines += ['HAVE_STRTOD_L'] > > >8 > > > > > > #include > > > > > > #if __BYTE_ORDER == __LITTLE_ENDIAN > > > -- > > > Cheers, > > > Eric > > > > > > ___ > > > mesa-dev mailing list > > > mesa-dev@lists.freedesktop.org > > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On Wednesday, 2018-03-21 10:45:35 -0700, Dylan Baker wrote: > Quoting Eric Engestrom (2018-03-21 10:09:17) > > Cc: Maxin B. John> > Cc: Khem Raj > > Suggested-by: Jon Turney > > Signed-off-by: Eric Engestrom > > --- > > configure.ac| 1 + > > meson.build | 2 +- > > src/util/u_endian.h | 2 +- > > 3 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/configure.ac b/configure.ac > > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -865,6 +865,7 @@ fi > > AC_HEADER_MAJOR > > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) > > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) > > diff --git a/meson.build b/meson.build > > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') > >pre_args += '-DMAJOR_IN_MKDEV' > > endif > > > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] > >if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) > > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) > >endif > > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > > --- a/src/util/u_endian.h > > +++ b/src/util/u_endian.h > > @@ -27,7 +27,7 @@ > > #ifndef U_ENDIAN_H > > #define U_ENDIAN_H > > > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > > +#ifdef HAVE_ENDIAN_H > > is it really safe to remove the `defined(ANDROID)` check here? I'm clearly too tired to do this... Cc'ing Rob; can you tell us if defining HAVE_ENDIAN_H unconditionally in Android.mk seems reasonable? Or is there a way to detect headers on Android? I also forgot to add the check in scons; I just added this to the commit locally: 8< diff --git a/scons/gallium.py b/scons/gallium.py index 75200b89c1fe6d751980..6cb20efcbf4b8c997f60 100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -354,6 +354,9 @@ def generate(env): if check_header(env, 'xlocale.h'): cppdefines += ['HAVE_XLOCALE_H'] +if check_header(env, 'endian.h'): +cppdefines += ['HAVE_ENDIAN_H'] + if check_functions(env, ['strtod_l', 'strtof_l']): cppdefines += ['HAVE_STRTOD_L'] >8 > > > #include > > > > #if __BYTE_ORDER == __LITTLE_ENDIAN > > -- > > Cheers, > > Eric > > > > ___ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
On 21 March 2018 at 17:09, Eric Engestromwrote: > Cc: Maxin B. John > Cc: Khem Raj > Suggested-by: Jon Turney > Signed-off-by: Eric Engestrom > --- > configure.ac| 1 + > meson.build | 2 +- > src/util/u_endian.h | 2 +- > 3 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -865,6 +865,7 @@ fi > AC_HEADER_MAJOR > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) Just hit me - why are we using any of these instead of AC_CHECK_FUNCS and AC_CHECK_HEADERS (note the S at the end). Those take a list + automatically set the HAVE_ macros for us. Off the top of my head - we could even use the _ONCE version which should lead to smaller configure file + faster runtime. I'm thinking out loud here ^^, no changes needed ;-) > diff --git a/meson.build b/meson.build > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > --- a/meson.build > +++ b/meson.build > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') >pre_args += '-DMAJOR_IN_MKDEV' > endif > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] >if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) >endif > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > --- a/src/util/u_endian.h > +++ b/src/util/u_endian.h > @@ -27,7 +27,7 @@ > #ifndef U_ENDIAN_H > #define U_ENDIAN_H > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > +#ifdef HAVE_ENDIAN_H I'd either keep the ANDROID hunk here, or add -DHAVE_ENDIAN_H to Android.common.mk With slight inclination towards the latter ;-) With that the patch is Reviewed-by: Emil Velikov Cc: -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
Quoting Eric Engestrom (2018-03-21 10:09:17) > Cc: Maxin B. John> Cc: Khem Raj > Suggested-by: Jon Turney > Signed-off-by: Eric Engestrom > --- > configure.ac| 1 + > meson.build | 2 +- > src/util/u_endian.h | 2 +- > 3 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -865,6 +865,7 @@ fi > AC_HEADER_MAJOR > AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) > AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) > +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) > AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) > AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) > AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) > diff --git a/meson.build b/meson.build > index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 > --- a/meson.build > +++ b/meson.build > @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') >pre_args += '-DMAJOR_IN_MKDEV' > endif > > -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] > +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] >if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) > pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) >endif > diff --git a/src/util/u_endian.h b/src/util/u_endian.h > index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 > --- a/src/util/u_endian.h > +++ b/src/util/u_endian.h > @@ -27,7 +27,7 @@ > #ifndef U_ENDIAN_H > #define U_ENDIAN_H > > -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) > +#ifdef HAVE_ENDIAN_H is it really safe to remove the `defined(ANDROID)` check here? > #include > > #if __BYTE_ORDER == __LITTLE_ENDIAN > -- > Cheers, > Eric > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available
Cc: Maxin B. JohnCc: Khem Raj Suggested-by: Jon Turney Signed-off-by: Eric Engestrom --- configure.ac| 1 + meson.build | 2 +- src/util/u_endian.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 29d3c3457a7cdaefc36a..36c56da787e4fab5a355 100644 --- a/configure.ac +++ b/configure.ac @@ -865,6 +865,7 @@ fi AC_HEADER_MAJOR AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"]) AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"]) diff --git a/meson.build b/meson.build index 88518ec0f0e9b81759a7..1132b4bd37075d8c9d21 100644 --- a/meson.build +++ b/meson.build @@ -904,7 +904,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') pre_args += '-DMAJOR_IN_MKDEV' endif -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h'] +foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h'] if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h)) pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) endif diff --git a/src/util/u_endian.h b/src/util/u_endian.h index 22d011ec0086ee77e11c..e11b381588dbc960e8c3 100644 --- a/src/util/u_endian.h +++ b/src/util/u_endian.h @@ -27,7 +27,7 @@ #ifndef U_ENDIAN_H #define U_ENDIAN_H -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) +#ifdef HAVE_ENDIAN_H #include #if __BYTE_ORDER == __LITTLE_ENDIAN -- Cheers, Eric ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev