diff options
author | Eric Engestrom <[email protected]> | 2018-03-21 17:04:06 +0000 |
---|---|---|
committer | Juan A. Suarez Romero <[email protected]> | 2018-04-12 21:49:28 +0200 |
commit | a602ef93524d92695fc3df4b463ecf6fb50765be (patch) | |
tree | 404d0d8b14e9a06587342ef90e135a2a5a5f3947 | |
parent | fd6ded8f9cc3c95f25ee2623a397aff08cb158e2 (diff) |
meson/configure: detect endian.h instead of trying to guess when it's available
Cc: Maxin B. John <[email protected]>
Cc: Khem Raj <[email protected]>
Cc: Rob Herring <[email protected]>
Suggested-by: Jon Turney <[email protected]>
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
Cc: <[email protected]>
(cherry picked from commit cbee1bfb34274668a05995b9d4c78ddec9e5ea4c)
[Juan A. Suarez: resolve trivial conflicts]
Signed-off-by: Juan A. Suarez Romero <[email protected]>
Conflicts:
meson.build
Squashed with:
configure: use AC_CHECK_HEADERS to check for endian.h
The currently we use the singular CHECK_HEADER combined with explicit
append to the DEFINES variable. That is a legacy misnomer, since it
requires us to add $DEFINES to every piece that we build.
Using the plural version of the helper sets the HAVE_ macro for us, plus
ensures it's passed to the compiler - if config.h is available in there
(not in the case of mesa) otherwise on the command line.
In hindsight, we should replace all the AC_CHECK_{FUNC,HEADER} instances
with the plural version (or even the _ONCE suffixed version) and drop
the DEFINES hacks.
Fixes: cbee1bfb342 ("meson/configure: detect endian.h instead of trying
to guess when it's available")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105717
Signed-off-by: Emil Velikov <[email protected]>
Acked-by: Eric Engestrom <[email protected]>
Tested-by: Clayton Craft <[email protected]>
(cherry picked from commit 5a75019ad0270a974788a9b8648ba98ff4203768)
-rw-r--r-- | Android.common.mk | 1 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rwxr-xr-x | scons/gallium.py | 3 | ||||
-rw-r--r-- | src/util/u_endian.h | 2 |
5 files changed, 7 insertions, 2 deletions
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 137ff5a7652..a6a521794e8 100644 --- a/configure.ac +++ b/configure.ac @@ -862,6 +862,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_HEADERS([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 bc1905178d9..5eef2227e0f 100644 --- a/meson.build +++ b/meson.build @@ -838,7 +838,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.has_header(h) pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) endif diff --git a/scons/gallium.py b/scons/gallium.py index ef3b2ee81ae..6f7eb9624a3 100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -352,6 +352,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 <endian.h> #if __BYTE_ORDER == __LITTLE_ENDIAN |