diff --git a/Makefile b/Makefile index 811817a..129f09f 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ PROGRAM = xlogdump OBJS = strlcpy.o xlogdump.o xlogdump_rmgr.o xlogdump_statement.o xlogdump_oid2name.o -OBJS += pg_crc32_table.o -PG_CPPFLAGS = -I$(libpq_srcdir) -DDATADIR=\"$(datadir)\" +PG_CPPFLAGS = -I. -I$(libpq_srcdir) -DDATADIR=\"$(datadir)\" PG_LIBS = $(libpq_pgport) DATA = oid2name.txt diff --git a/pg_crc32_table.c b/pg_crc32_table.h similarity index 97% rename from pg_crc32_table.c rename to pg_crc32_table.h index 8520514..cb61924 100644 --- a/pg_crc32_table.c +++ b/pg_crc32_table.h @@ -1,3 +1,6 @@ +#ifndef __PG_CRC32_TABLE__ +#define __PG_CRC32_TABLE__ + #include "postgres.h" const uint32 pg_crc32_table[256] = { @@ -66,3 +69,5 @@ const uint32 pg_crc32_table[256] = { 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D }; + +#endif /* __PG_CRC32_TABLE__ */ diff --git a/xlogdump.c b/xlogdump.c index 3e91fb9..f1f938d 100644 --- a/xlogdump.c +++ b/xlogdump.c @@ -40,6 +40,12 @@ #include "catalog/pg_control.h" #include "utils/pg_crc.h" +#if PG_VERSION_NUM >= 90200 + #include "utils/pg_crc_tables.h" +#else + #include "pg_crc32_table.h" +#endif + #include "libpq-fe.h" #include "pg_config.h" #include "pqexpbuffer.h"