2
0
mirror of https://github.com/vasi/pixz synced 2024-10-30 15:21:41 +00:00

configure: Detect headers before using them

Current logic does not work when system does not have
sys/endian.h, since it tried to reuse the cached results
from first try of detecting htole64 in sys/endian.h which is
'no' and hence the second try to look into endian.h also
comes out negative.

So we check for header and then run the test for symbols
and these symbols are not standard and we need to define _GNU_SOURCE
for it to work, this issue is exposed by systems using musl e.g.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2016-03-22 07:36:54 +00:00
parent 936d8068ae
commit a224836798

View File

@ -69,12 +69,17 @@ AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memchr memmove memset strerror strtol])
AC_CHECK_DECLS([htole64, le64toh],
[],
AC_CHECK_HEADER([sys/endian.h],
[
AC_CHECK_DECLS([htole64, le64toh], [], [], [#include <endian.h>])
AC_CHECK_DECLS([htole64, le64toh], [], [], [#define _GNU_SOURCE 1 #include <sys/endian.h>])
],
[#include <sys/endian.h>])
[], [])
AC_CHECK_HEADER([endian.h],
[
AC_CHECK_DECLS([htole64, le64toh], [], [], [#define _GNU_SOURCE 1 #include <endian.h>])
],
[], [])
AC_CONFIG_FILES([Makefile
src/Makefile