[Mesa-dev] [PATCH mesa] meson/configure: detect endian.h instead of trying to guess when it's available

Eric Engestrom eric.engestrom at imgtec.com
Fri Mar 23 11:54:48 UTC 2018


On Friday, 2018-03-23 09:33:39 +0000, Eric Engestrom wrote:
> 
> 
> On March 23, 2018 9:21:25 AM UTC, "Tapani Pälli" <tapani.palli at intel.com> wrote:
> > 
> > 
> > On 03/21/2018 08:55 PM, Eric Engestrom wrote:
> > > 
> > > 
> > > On March 21, 2018 6:47:48 PM UTC, Dylan Baker <dylan at pnwbakers.com>
> > wrote:
> > >> Quoting Emil Velikov (2018-03-21 10:53:08)
> > >>> On 21 March 2018 at 17:09, Eric Engestrom
> > >> <eric.engestrom at imgtec.com> wrote:
> > >>>> Cc: Maxin B. John <maxin.john at gmail.com>
> > >>>> Cc: Khem Raj <raj.khem at gmail.com>
> > >>>> Suggested-by: Jon Turney <jon.turney at dronecode.org.uk>
> > >>>> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> > >>>> ---
> > >>>>   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_ at 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 <emil.velikov at collabora.com>
> > >>> Cc: <mesa-stable at lists.freedesktop.org>
> > >>>
> > >>
> > >> With Emil's fixes,
> > >> Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
> > > 
> > > 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 at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list