From: Roger Pau Monne Date: Thu, 4 Feb 2021 09:38:33 +0000 (+0100) Subject: autoconf: check endian.h include path X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~915 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c9b0242ad44a739e0f4c72b67fd4bcf4b042f800;p=xen.git autoconf: check endian.h include path Introduce an autoconf macro to check for the include path of certain headers that can be different between OSes. Use such macro to find the correct path for the endian.h header, and modify the users of endian.h to use the output of such check. Suggested-by: Ian Jackson Signed-off-by: Roger Pau Monné Reviewed-by: Ian Jackson Release-Acked-by: Ian Jackson --- diff --git a/m4/header.m4 b/m4/header.m4 new file mode 100644 index 0000000000..81d1d65194 --- /dev/null +++ b/m4/header.m4 @@ -0,0 +1,13 @@ +AC_DEFUN([AX_FIND_HEADER], [ +ax_found=0 +m4_foreach_w([header], $2, [ + AS_IF([test "$ax_found" = "0"], [ + AC_CHECK_HEADER(header, [ + AC_DEFINE($1, [
], [Header path for $1]) + ax_found=1]) + ]) +]) +AS_IF([test "$ax_found" = "0"], [ + AC_MSG_ERROR([No header found from list $2]) +]) +]) diff --git a/tools/configure.ac b/tools/configure.ac index 5b328700e0..3a3e7b4b2b 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -74,6 +74,7 @@ m4_include([../m4/ax_compare_version.m4]) m4_include([../m4/paths.m4]) m4_include([../m4/systemd.m4]) m4_include([../m4/golang.m4]) +m4_include([../m4/header.m4]) AX_XEN_EXPAND_CONFIG() @@ -517,4 +518,6 @@ AC_ARG_ENABLE([pvshim], ]) AC_SUBST(pvshim) +AX_FIND_HEADER([INCLUDE_ENDIAN_H], [endian.h sys/endian.h]) + AC_OUTPUT() diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c b/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c index a4f8ebd42d..e58c1b95ed 100644 --- a/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c +++ b/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include INCLUDE_ENDIAN_H #include #include "xg_private.h" diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_xz.c b/tools/libs/guest/xg_dom_decompress_unsafe_xz.c index ff6824b38d..fc48198741 100644 --- a/tools/libs/guest/xg_dom_decompress_unsafe_xz.c +++ b/tools/libs/guest/xg_dom_decompress_unsafe_xz.c @@ -1,5 +1,5 @@ #include -#include +#include INCLUDE_ENDIAN_H #include #include #include diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c index 52558d2ffc..01eafaaaa6 100644 --- a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c +++ b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c @@ -1,5 +1,5 @@ #include -#include +#include INCLUDE_ENDIAN_H #include #include #include diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h index f7e4da2b2c..ae0d053c8f 100644 --- a/tools/xenstore/include/xenstore_state.h +++ b/tools/xenstore/include/xenstore_state.h @@ -21,11 +21,7 @@ #ifndef XENSTORE_STATE_H #define XENSTORE_STATE_H -#if defined(__FreeBSD__) || defined(__NetBSD__) -#include -#else -#include -#endif +#include INCLUDE_ENDIAN_H #include #ifndef htobe32