[Mesa-dev] [PATCH 1/1] Fix endianess detection with musl-based toolchains
Jonathan Gray
jsg at jsg.id.au
Sat Nov 5 01:55:27 UTC 2016
On Fri, Nov 04, 2016 at 07:53:25PM +0100, Bernd Kuhls wrote:
> Musl does not define __GLIBC__ and will not provide a __MUSL__ macro:
> http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F
>
> This patch checks for the presence of endian.h and promotes the result
> to src/amd/Makefile.addrlib.am which executes the broken build command.
> Fixes compile errors detected by the autobuilder infrastructure of the
> buildroot project:
This will break OpenBSD and perhaps other platforms which
have endian.h that does not define glibc definitions.
>
> http://autobuild.buildroot.net/results/e27/e27a9a95f72dba3076549beb2a2ccfdbea2fcfee/
> http://autobuild.buildroot.net/results/e27/e27a9a95f72dba3076549beb2a2ccfdbea2fcfee/
> Signed-off-by: Bernd Kuhls <bernd.kuhls at t-online.de>
> ---
> configure.ac | 1 +
> src/amd/Makefile.addrlib.am | 1 +
> src/util/u_endian.h | 2 +-
> 3 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 4761c59..7991b52 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -786,6 +786,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"])
>
> diff --git a/src/amd/Makefile.addrlib.am b/src/amd/Makefile.addrlib.am
> index 64823fc..4e2fb1d 100644
> --- a/src/amd/Makefile.addrlib.am
> +++ b/src/amd/Makefile.addrlib.am
> @@ -28,6 +28,7 @@ addrlib_libamdgpu_addrlib_la_CPPFLAGS = \
> -I$(srcdir)/addrlib/core \
> -I$(srcdir)/addrlib/inc/chip/r800 \
> -I$(srcdir)/addrlib/r800/chip \
> + $(DEFINES) \
> -DBRAHMA_BUILD=1
>
> addrlib_libamdgpu_addrlib_la_CXXFLAGS = \
> diff --git a/src/util/u_endian.h b/src/util/u_endian.h
> index b9d563d..266fb4a 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)
> +#if defined(__GLIBC__) || defined(ANDROID) || defined(HAVE_ENDIAN_H)
> #include <endian.h>
>
> #if __BYTE_ORDER == __LITTLE_ENDIAN
> --
> 2.10.1
>
> _______________________________________________
> 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