1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00

stdckdint-h: Don't generate header if it is not needed.

Suggested by Paul Eggert in:
<https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00216.html>.

* m4/stdckdint_h.m4: New file.
* modules/stdckdint-h (Files): Add m4/stdckdint_h.m4.
(configure.ac): Remove checks and just invoke gl_STDCKDINT_H.
(Makefile.am): Replace variables set by ./configure.
* lib/stdckdint.in.h: Include the compilers header if it exists.  Add
comment mentioning expected future standardization in C++26.
(ckd_add, ckd_sub, ckd_mul): Only define if the compilers definitions do
not work.
This commit is contained in:
Collin Funk
2025-05-22 19:33:05 -07:00
parent 7d0b12d70b
commit e331531a77
4 changed files with 192 additions and 18 deletions

View File

@@ -2,6 +2,7 @@ Description:
An <stdckdint.h> that is like C23.
Files:
m4/stdckdint_h.m4
lib/stdckdint.in.h
lib/intprops-internal.h
@@ -10,16 +11,7 @@ gen-header
bool
configure.ac:
AC_CHECK_HEADERS_ONCE([stdckdint.h])
if test $ac_cv_header_stdckdint_h = yes; then
if test -n "$CXX" && test "$CXX" != no; then
GL_GENERATE_STDCKDINT_H=true
else
GL_GENERATE_STDCKDINT_H=false
fi
else
GL_GENERATE_STDCKDINT_H=true
fi
gl_STDCKDINT_H
gl_CONDITIONAL_HEADER([stdckdint.h])
AC_PROG_MKDIR_P
@@ -32,6 +24,15 @@ if GL_GENERATE_STDCKDINT_H
stdckdint.h: stdckdint.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|@''NEXT_STDCKDINT_H''@|$(NEXT_STDCKDINT_H)|g' \
-e 's|@''HAVE_C_STDCKDINT_H''@|$(HAVE_C_STDCKDINT_H)|g' \
-e 's|@''HAVE_WORKING_C_STDCKDINT_H''@|$(HAVE_WORKING_C_STDCKDINT_H)|g' \
-e 's|@''HAVE_CXX_STDCKDINT_H''@|$(HAVE_CXX_STDCKDINT_H)|g' \
-e 's|@''HAVE_WORKING_CXX_STDCKDINT_H''@|$(HAVE_WORKING_CXX_STDCKDINT_H)|g' \
$(srcdir)/stdckdint.in.h > $@-t
$(AM_V_at)mv $@-t $@
else