From ee196a3717efeb0e42e8fc40c307ac5af25a43b1 Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Wed, 27 Aug 2008 09:51:35 +0400 Subject: [PATCH] don't expose configure generated headers to users. Those HAVE_FOO collide with #define's introduced by a package which uses CLN. The result is very funny (debugging this is not, though). --- configure.ac | 6 +++++- include/cln/config.h.in | 14 ++++++++++++++ include/cln/version.h.in | 16 ++++++++++------ src/base/cl_maybe_inline.h | 2 +- src/base/cl_sysdep.h | 2 +- src/base/digitseq/cl_asm.h | 2 +- src/base/digitseq/cl_asm_.cc | 2 +- src/polynomial/elem/cl_asm_GF2.cc | 2 +- 8 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 include/cln/config.h.in diff --git a/configure.ac b/configure.ac index 21740d9..63891d0 100644 --- a/configure.ac +++ b/configure.ac @@ -24,10 +24,14 @@ AC_INIT([cln], cln_version) AC_PREREQ(2.59) AC_CONFIG_SRCDIR(src/integer/gcd/cl_I_gcd.cc) AC_CONFIG_AUX_DIR([autoconf]) -AC_CONFIG_HEADERS(include/cln/config.h include/cln/host_cpu.h include/cln/version.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/timing/cl_t_config.h) +AC_CONFIG_HEADERS(autoconf/cl_config.h include/cln/config.h include/cln/host_cpu.h include/cln/version.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/timing/cl_t_config.h) AM_INIT_AUTOMAKE([foreign 1.8 dist-bzip2]) AH_TOP([#ifdef _CL_CONFIG_H]) AH_TOP([#include "cln/host_cpu.h"]) +AH_TOP([/* prevents cln/config.h from being included, so no macro gets redefined */]) +AH_TOP([#define _CL_CONFIG_PUBLIC_H]) +AH_TOP([/* prevents cln/version.h from being included, so no macro gets redefined */]) +AH_TOP([#define _CL_VERSION_H]) AH_BOTTOM([#endif /* _CL_CONFIG_H */]) dnl checks for programs diff --git a/include/cln/config.h.in b/include/cln/config.h.in new file mode 100644 index 0000000..42cfbaf --- /dev/null +++ b/include/cln/config.h.in @@ -0,0 +1,14 @@ +#ifdef _CL_CONFIG_PUBLIC_H + +#include "cln/host_cpu.h" +#include "cln/version.h" + +/* + * FIXME: this should not be exposed to user. Or at least it should be + * renamed to CL_HAVE_LONGLONG or something like that. + */ +/* compiler supports the `long long' type */ +#undef HAVE_LONGLONG + +#endif /* _CL_CONFIG_PUBLIC_H */ + diff --git a/include/cln/version.h.in b/include/cln/version.h.in index 62be940..aacd909 100644 --- a/include/cln/version.h.in +++ b/include/cln/version.h.in @@ -1,15 +1,19 @@ -// Version information (cf. cln.m4) +/* CLN version information */ #ifndef _CL_VERSION_H #define _CL_VERSION_H -/* These definitions are adjusted by `configure' automatically. */ +/* CLN release number */ +#undef CL_VERSION +/* Major version number of CLN */ +#undef CL_VERSION_MAJOR -#define CL_VERSION_MAJOR 1 -#define CL_VERSION_MINOR 1 -#define CL_VERSION_PATCHLEVEL 0 -#define CL_VERSION 1.1.0 +/* Minor version number of CLN */ +#undef CL_VERSION_MINOR + +/* Patchlevel version number of CLN */ +#undef CL_VERSION_PATCHLEVEL namespace cln { diff --git a/src/base/cl_maybe_inline.h b/src/base/cl_maybe_inline.h index 77073a3..d615cb3 100644 --- a/src/base/cl_maybe_inline.h +++ b/src/base/cl_maybe_inline.h @@ -3,7 +3,7 @@ #ifndef _CL_MAYBE_INLINE_H #define _CL_MAYBE_INLINE_H -#include "cln/config.h" +#include "cl_config.h" /* * Selectively inline a function in *some* translation units. diff --git a/src/base/cl_sysdep.h b/src/base/cl_sysdep.h index 081ef4c..9e64575 100644 --- a/src/base/cl_sysdep.h +++ b/src/base/cl_sysdep.h @@ -4,7 +4,7 @@ #define _CL_SYSDEP_H // CPU and other -#include "cln/config.h" +#include "cl_config.h" // char_bitsize, short_bitsize, long_bitsize, long_long_bitsize #include "cln/intparam.h" diff --git a/src/base/digitseq/cl_asm.h b/src/base/digitseq/cl_asm.h index ccd1d23..01ab9c5 100644 --- a/src/base/digitseq/cl_asm.h +++ b/src/base/digitseq/cl_asm.h @@ -1,6 +1,6 @@ // Includes the CPU specific cl_asm_*.h file. -#include "cln/config.h" +#include "cl_config.h" #include "base/digitseq/cl_DS_endian.h" #ifndef NO_ASM diff --git a/src/base/digitseq/cl_asm_.cc b/src/base/digitseq/cl_asm_.cc index 87df666..0ca846f 100644 --- a/src/base/digitseq/cl_asm_.cc +++ b/src/base/digitseq/cl_asm_.cc @@ -1,6 +1,6 @@ // Includes the CPU specific cl_asm_*.cc file. -#include "cln/config.h" +#include "cl_config.h" #include "base/digitseq/cl_DS_endian.h" #ifndef NO_ASM diff --git a/src/polynomial/elem/cl_asm_GF2.cc b/src/polynomial/elem/cl_asm_GF2.cc index f8b3388..dbdfb68 100644 --- a/src/polynomial/elem/cl_asm_GF2.cc +++ b/src/polynomial/elem/cl_asm_GF2.cc @@ -1,6 +1,6 @@ // Includes the CPU specific cl_asm_*.cc file. -#include "cln/config.h" +#include "cl_config.h" #if defined(__sparc__) || defined(__sparc64__) #include "cl_asm_sparc_GF2.cc"