Hash :
83dd4db8
Author :
Date :
2024-05-18T06:36:55
endian: Make sure system headers can be included. Reported by Bruno Haible in <https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00290.html>. * lib/endian.in.h (be16toh, be32toh, be64toh, htobe16, htobe32, htobe64) (le16toh, le32toh, le64toh, htole16, htole32, htole64): Don't define functions if the system has working versions. * m4/endian_h.m4 (gl_ENDIAN_H): Separate checks for stdint types and proper macro/function definitions. * modules/endian (Depends-on): Add include_next. Update module dependency conditions. (Makefile.am): Perform sed replacements on the header substitute.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
Description:
A POSIX-like <endian.h>.
Files:
lib/endian.in.h
lib/endian.c
m4/endian_h.m4
Depends-on:
gen-header
include_next
extern-inline [$GL_GENERATE_ENDIAN_H && test $ENDIAN_H_JUST_MISSING_STDINT = 0]
byteswap [$GL_GENERATE_ENDIAN_H && test $ENDIAN_H_JUST_MISSING_STDINT = 0]
stdint [$GL_GENERATE_ENDIAN_H]
configure.ac:
gl_ENDIAN_H
gl_CONDITIONAL_HEADER([endian.h])
AC_PROG_MKDIR_P
Makefile.am:
BUILT_SOURCES += $(ENDIAN_H)
# We need the following in order to create <endian.h> when the system
# doesn't have one.
if GL_GENERATE_ENDIAN_H
endian.h: endian.in.h $(top_builddir)/config.status
@NMD@ $(AM_V_GEN)$(MKDIR_P) '%reldir%'
$(gl_V_at)$(SED_HEADER_STDOUT) \
-e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''HAVE_ENDIAN_H''@|$(HAVE_ENDIAN_H)|g' \
-e 's|@''NEXT_ENDIAN_H''@|$(NEXT_ENDIAN_H)|g' \
-e 's|@''ENDIAN_H_JUST_MISSING_STDINT''@|$(ENDIAN_H_JUST_MISSING_STDINT)|g' \
$(srcdir)/endian.in.h > $@-t
$(AM_V_at)mv $@-t $@
lib_SOURCES += endian.c
else
endian.h: $(top_builddir)/config.status
rm -f $@
endif
MOSTLYCLEANFILES += endian.h endian.h-t
Include:
<endian.h>
License:
LGPLv2+
Maintainer:
all