From: Eric Engestrom Date: Wed, 21 Mar 2018 17:04:06 +0000 (+0000) Subject: meson/configure: detect endian.h instead of trying to guess when it's available X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbee1bfb34274668a05995b9d4c78ddec9e5ea4c;p=mesa.git meson/configure: detect endian.h instead of trying to guess when it's available Cc: Maxin B. John Cc: Khem Raj Cc: Rob Herring Suggested-by: Jon Turney Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov Reviewed-by: Dylan Baker Cc: --- diff --git a/Android.common.mk b/Android.common.mk index 52dc7bff3be..e8aed48c31a 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 \ diff --git a/configure.ac b/configure.ac index 29d3c3457a7..36c56da787e 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 871b0d8d22f..041d2bfc70d 100644 --- a/meson.build +++ b/meson.build @@ -916,7 +916,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/scons/gallium.py b/scons/gallium.py index 75200b89c1f..6cb20efcbf4 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'] diff --git a/src/util/u_endian.h b/src/util/u_endian.h index 22d011ec008..e11b381588d 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