From 8679b2d94912e5fbc3a923149c9f205a7a92b3df Mon Sep 17 00:00:00 2001 From: Chad Condon Date: Fri, 14 Nov 2025 20:21:06 -0800 Subject: [PATCH 1/2] Rename config.h and HAVE_CONFIG_H --- Makefile.am | 3 +++ include/CppUTest/CppUTestGeneratedConfig.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3406079c7..ac2e4706b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,6 +10,9 @@ EXTRA_PROGRAMS = CppUTestExtTests lib_LIBRARIES = lib/libCppUTest.a check_PROGRAMS = $(CPPUTEST_TESTS) +# Change autoconf's hard-coded (and collision susceptible) HAVE_CONFIG_H macro. +DEFS = $(filter-out -DHAVE_CONFIG_H,@DEFS@) -DCPPUTEST_HAVE_GENERATED_CONFIG_H + if INCLUDE_CPPUTEST_EXT lib_LIBRARIES+= lib/libCppUTestExt.a check_PROGRAMS += $(CPPUTESTEXT_TESTS) diff --git a/include/CppUTest/CppUTestGeneratedConfig.h b/include/CppUTest/CppUTestGeneratedConfig.h index 5bcd53768..4ae6b6048 100644 --- a/include/CppUTest/CppUTestGeneratedConfig.h +++ b/include/CppUTest/CppUTestGeneratedConfig.h @@ -41,7 +41,7 @@ * */ -#ifdef HAVE_CONFIG_H +#ifdef CPPUTEST_HAVE_GENERATED_CONFIG_H #include "generated/CppUTestGeneratedConfig.h" #endif From 7f9c2455c5f5666805612626f1d648b2807a1109 Mon Sep 17 00:00:00 2001 From: Chad Condon Date: Sun, 4 Jan 2026 13:15:54 -0800 Subject: [PATCH 2/2] Better annotate HAVE_CONFIG_H hack --- Makefile.am | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ac2e4706b..2445822f4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,11 @@ EXTRA_PROGRAMS = CppUTestExtTests lib_LIBRARIES = lib/libCppUTest.a check_PROGRAMS = $(CPPUTEST_TESTS) -# Change autoconf's hard-coded (and collision susceptible) HAVE_CONFIG_H macro. +# HACK: Replace the HAVE_CONFIG_H macro with CPPUTEST_HAVE_GENERATED_CONFIG_H. +# The name HAVE_CONFIG_H is a hard-coded in autoconf and cannot be changed in +# any "normal" ways. This isn't typically a problem, but CppUTest exposes the +# macro in its public headers. This leads to collisions with any other projects +# built with autoconf. DEFS = $(filter-out -DHAVE_CONFIG_H,@DEFS@) -DCPPUTEST_HAVE_GENERATED_CONFIG_H if INCLUDE_CPPUTEST_EXT