]> git.sesse.net Git - plocate/commitdiff
Check for endian.h before including it. Fixes compilation on FreeBSD.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Sat, 31 Oct 2020 11:24:34 +0000 (12:24 +0100)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Sat, 31 Oct 2020 11:24:34 +0000 (12:24 +0100)
meson.build
turbopfor-encode.h
turbopfor.cpp

index 960e4eac91d338b1898fd2f479f24b74369d5a5e..05095329fa31d000b03eccbca18139192b6e3b8e 100644 (file)
@@ -12,6 +12,9 @@ atomicdep = cxx.find_library('atomic', required: false)
 if not uringdep.found()
        add_project_arguments('-DWITHOUT_URING', language: 'cpp')
 endif
+if cxx.has_header('endian.h')
+       add_project_arguments('-DHAS_ENDIAN_H', language: 'cpp')
+endif
 
 # Function multiversioning is x86-only _and_ not available on certain targets
 # (they need “ifunc”, indirect functions, a GNU extension).
index 186d7fba89574bdc1a94f9af62e0f9ebe907f950..4b2135f96509e45b89f42e20ce99c399c3088806 100644 (file)
@@ -15,7 +15,9 @@
 
 #include <algorithm>
 #include <assert.h>
+#ifdef HAS_ENDIAN_H
 #include <endian.h>
+#endif
 #include <limits.h>
 #include <stdint.h>
 #include <string.h>
index 3027e5ac205d48a99448f1280d802e9ffeb4c9b9..b7902a292d7fb494c2eabe0d4e0675b06fbde50c 100644 (file)
@@ -1,6 +1,8 @@
 #include <algorithm>
 #include <assert.h>
+#ifdef HAS_ENDIAN_H
 #include <endian.h>
+#endif
 #include <stdint.h>
 #include <string.h>
 #include <strings.h>