Branch
Hash :
77386040
Author :
Date :
2025-09-08T15:22:46
stdcountof-h: Add support for C++ compilers that lack _Countof. * lib/stdcountof.in.h: Use include_next idiom. In C++ mode, test CXX_HAVE_STDCOUNTOF_H instead of HAVE_STDCOUNTOF_H. * m4/stdcountof_h.m4 (gl_STDCOUNTOF_H): Invoke gl_CHECK_NEXT_HEADERS. Set CXX_HAVE_STDCOUNTOF_H. Consider CXX_HAVE_STDCOUNTOF_H when setting GL_GENERATE_STDCOUNTOF_H. * modules/stdcountof-h (Depends-on): Add include_next. (Makefile.am): Substitute GUARD_PREFIX, HAVE_STDCOUNTOF_H, CXX_HAVE_STDCOUNTOF_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, PRAGMA_COLUMNS, NEXT_STDCOUNTOF_H.
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
Description:
An <stdcountof.h> that is like C2y.
Files:
lib/stdcountof.in.h
m4/stdcountof_h.m4
Depends-on:
gen-header
include_next
configure.ac:
gl_STDCOUNTOF_H
gl_CONDITIONAL_HEADER([stdcountof.h])
AC_PROG_MKDIR_P
Makefile.am:
BUILT_SOURCES += $(STDCOUNTOF_H)
# We need the following in order to create <stdcountof.h> when the system
# doesn't have one that works with the given compiler.
if GL_GENERATE_STDCOUNTOF_H
stdcountof.h: stdcountof.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/@''HAVE_STDCOUNTOF_H''@/$(HAVE_STDCOUNTOF_H)/g' \
-e 's/@''CXX_HAVE_STDCOUNTOF_H''@/$(CXX_HAVE_STDCOUNTOF_H)/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|@''NEXT_STDCOUNTOF_H''@|$(NEXT_STDCOUNTOF_H)|g' \
$(srcdir)/stdcountof.in.h > $@-t
$(AM_V_at)mv $@-t $@
else
stdcountof.h: $(top_builddir)/config.status
rm -f $@
endif
MOSTLYCLEANFILES += stdcountof.h stdcountof.h-t
Include:
<stdcountof.h>
License:
LGPLv2+
Maintainer:
Bruno Haible