Skip to content

Commit

Permalink
pg_config: Optionally support Windows based on _WIN32 or _WIN64 being…
Browse files Browse the repository at this point in the history
… set
  • Loading branch information
lfittl committed Dec 30, 2023
1 parent 61c28d6 commit 4ad8776
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,22 @@ $(PGDIR):
echo "#if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2))" >> $(PGDIR)/src/include/pg_config.h
echo "#define HAVE_STRCHRNUL" >> $(PGDIR)/src/include/pg_config.h
echo "#endif" >> $(PGDIR)/src/include/pg_config.h
# Windows
echo "#if defined(_WIN32) || defined(_WIN64)" >> $(PGDIR)/src/include/pg_config.h
echo "#define WIN32 1" >> $(PGDIR)/src/include/pg_config.h
echo "#define __thread __declspec( thread )" >> $(PGDIR)/src/include/pg_config.h
echo "#undef SIZEOF_VOID_P" >> $(PGDIR)/src/include/pg_config.h
echo "#define SIZEOF_VOID_P 4" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE_STRINGS_H" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE_VISIBILITY_ATTRIBUTE" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE__BUILTIN_CONSTANT_P" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE__BUILTIN_TYPES_COMPATIBLE_P" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE_TYPEOF" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE_GETOPT_H" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE_SYSLOG" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE_PTHREAD" >> $(PGDIR)/src/include/pg_config.h
echo "#undef HAVE_PTHREAD_IS_THREADED_NP" >> $(PGDIR)/src/include/pg_config.h
echo "#endif" >> $(PGDIR)/src/include/pg_config.h

extract_source: $(PGDIR)
-@ $(RM) -rf ./src/postgres/
Expand Down
15 changes: 15 additions & 0 deletions src/postgres/include/pg_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -841,3 +841,18 @@
#if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2))
#define HAVE_STRCHRNUL
#endif
#if defined(_WIN32) || defined(_WIN64)
#define WIN32 1
#define __thread __declspec( thread )
#undef SIZEOF_VOID_P
#define SIZEOF_VOID_P 4
#undef HAVE_STRINGS_H
#undef HAVE_VISIBILITY_ATTRIBUTE
#undef HAVE__BUILTIN_CONSTANT_P
#undef HAVE__BUILTIN_TYPES_COMPATIBLE_P
#undef HAVE_TYPEOF
#undef HAVE_GETOPT_H
#undef HAVE_SYSLOG
#undef HAVE_PTHREAD
#undef HAVE_PTHREAD_IS_THREADED_NP
#endif

0 comments on commit 4ad8776

Please sign in to comment.