annotate Resources/CMake/PostgreSQLConfiguration.cmake @ 586:3b1070dcab2f find-refactoring tip

fix
author Alain Mazy <am@orthanc.team>
date Mon, 04 Nov 2024 22:52:58 +0100
parents 54d518dcd74a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 # Orthanc - A Lightweight, RESTful DICOM Store
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 # Department, University Hospital of Liege, Belgium
507
54d518dcd74a updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 459
diff changeset
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
54d518dcd74a updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 459
diff changeset
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
459
ecd0b719cff5 update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 #
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 # This program is free software: you can redistribute it and/or
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 # modify it under the terms of the GNU Affero General Public License
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 # as published by the Free Software Foundation, either version 3 of
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 # the License, or (at your option) any later version.
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 #
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 # This program is distributed in the hope that it will be useful, but
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 # Affero General Public License for more details.
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 #
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 # You should have received a copy of the GNU Affero General Public License
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #####################################################################
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 ## PostgreSQL
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #####################################################################
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 INCLUDE(CheckCSourceCompiles)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 INCLUDE(CheckFunctionExists)
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
28 INCLUDE(CheckIncludeFiles)
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 INCLUDE(CheckStructHasMember)
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
30 INCLUDE(CheckTypeSize)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
31
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
32
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
33 macro(PrepareCMakeConfigurationFile Source Target)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
34 execute_process(
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
35 COMMAND
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
36 ${PYTHON_EXECUTABLE}
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
37 "${CMAKE_CURRENT_LIST_DIR}/../PostgreSQL/PrepareCMakeConfigurationFile.py" "${Source}" "${Target}"
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
38 ERROR_VARIABLE tmp
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
39 OUTPUT_VARIABLE out
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
40 )
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
41
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
42 if (tmp)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
43 message(FATAL_ERROR "Cannot find ${Source}")
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
44 endif()
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
45 endmacro()
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBPQ)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 add_definitions(-DORTHANC_POSTGRESQL_STATIC=1)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
51 SET(LIBPQ_MAJOR 13)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
52 SET(LIBPQ_MINOR 1)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
53 SET(LIBPQ_VERSION ${LIBPQ_MAJOR}.${LIBPQ_MINOR})
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 SET(LIBPQ_SOURCES_DIR ${CMAKE_BINARY_DIR}/postgresql-${LIBPQ_VERSION})
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 DownloadPackage(
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
57 "551302a823a1ab48b4ed14166beebba9"
426
d700c8f9fc24 migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
58 "https://orthanc.uclouvain.be/downloads/third-party-downloads/postgresql-${LIBPQ_VERSION}.tar.gz"
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 "${LIBPQ_SOURCES_DIR}")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 ##
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 ## Platform-specific configuration
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 ##
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
178
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
67 if (EXISTS ${AUTOGENERATED_DIR}/pg_config_os.h)
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
68 set(FirstRun OFF)
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
69 else()
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
70 set(FirstRun ON)
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
71 endif()
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
72
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 configure_file(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 ${LIBPQ_SOURCES_DIR}/src/include/port/win32.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 ${AUTOGENERATED_DIR}/pg_config_os.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 COPYONLY)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
178
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
78 if (FirstRun)
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
79 # This is needed on MSVC2008 to have an implementation of "isinf()" and "isnan()"
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
80 file(APPEND ${AUTOGENERATED_DIR}/pg_config_os.h "
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
81 #if defined(_MSC_VER)
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
82 # include <math.h>
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
83 # include <float.h>
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
84 # if !defined(isinf)
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
85 # define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
86 # endif
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
87 # if !defined(isnan)
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
88 # define isnan(d) (_isnan(d))
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
89 # endif
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
90 #endif
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
91 ")
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
92 endif()
48aa43c14bb3 definition of isinf() and isnan() in msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 177
diff changeset
93
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 add_definitions(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 -D_GNU_SOURCE
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 configure_file(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 ${LIBPQ_SOURCES_DIR}/src/include/port/linux.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 ${AUTOGENERATED_DIR}/pg_config_os.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 COPYONLY)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 add_definitions(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 -D_GNU_SOURCE
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 -D_THREAD_SAFE
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 -D_POSIX_PTHREAD_SEMANTICS
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 configure_file(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 ${LIBPQ_SOURCES_DIR}/src/include/port/darwin.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 ${AUTOGENERATED_DIR}/pg_config_os.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 COPYONLY)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 configure_file(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 ${LIBPQ_SOURCES_DIR}/src/include/port/openbsd.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 ${AUTOGENERATED_DIR}/pg_config_os.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 COPYONLY)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 configure_file(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 ${LIBPQ_SOURCES_DIR}/src/include/port/freebsd.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 ${AUTOGENERATED_DIR}/pg_config_os.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 COPYONLY)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 else()
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 message(FATAL_ERROR "Support your platform here")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 endif()
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 ##
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 ## Generation of "pg_config.h"
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 ##
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
137 set(PG_VERSION "\"${LIBPQ_MAJOR}.${LIBPQ_MINOR}\"")
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
138 math(EXPR PG_VERSION_NUM "${LIBPQ_MAJOR} * 10000 + ${LIBPQ_MINOR}")
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
140 include(${CMAKE_CURRENT_LIST_DIR}/../PostgreSQL/func_accept_args.cmake)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
141 include(${CMAKE_CURRENT_LIST_DIR}/../PostgreSQL/CheckTypeAlignment.cmake)
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
143 check_include_file("execinfo.h" HAVE_EXECINFO_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
144 check_include_file("getopt.h" HAVE_GETOPT_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
145 check_include_file("ifaddrs.h" HAVE_IFADDRS_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
146 check_include_file("inttypes.h" HAVE_INTTYPES_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
147 check_include_file("langinfo.h" HAVE_LANGINFO_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
148 check_include_file("memory.h" HAVE_MEMORY_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
149 check_include_file("netinet/tcp.h" HAVE_NETINET_TCP_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
150 check_include_file("readline/history.h" HAVE_READLINE_HISTORY_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
151 check_include_file("readline/readline.h" HAVE_READLINE_READLINE_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
152 check_include_file("stdbool.h" HAVE_STDBOOL_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
153 check_include_file("stdlib.h" HAVE_STDLIB_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
154 check_include_file("string.h" HAVE_STRING_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
155 check_include_file("strings.h" HAVE_STRINGS_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
156 check_include_file("sys/epoll.h" HAVE_SYS_EPOLL_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
157 check_include_file("sys/event.h" HAVE_SYS_EVENT_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
158 check_include_file("sys/ipc.h" HAVE_SYS_IPC_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
159 check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
160 check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
161 check_include_file("sys/select.h" HAVE_SYS_SELECT_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
162 check_include_file("sys/sem.h" HAVE_SYS_SEM_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
163 check_include_file("sys/shm.h" HAVE_SYS_SHM_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
164 check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
165 check_include_file("sys/termios.h" HAVE_SYS_TERMIOS_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
166 check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
167 check_include_file("sys/un.h" HAVE_SYS_UN_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
168 check_include_file("termios.h" HAVE_TERMIOS_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
169 check_include_file("unistd.h" HAVE_UNISTD_H)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
170 check_include_file("wctype.h" HAVE_WCTYPE_H)
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
172 check_type_size("long long int" SIZEOF_LONG_LONG_INT)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
173 if (SIZEOF_LONG_LONG_INT EQUAL 8)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
174 set(HAVE_LONG_LONG_INT_64 1)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
175 set(PG_INT64_TYPE "long long int")
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
176 endif()
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
178 check_type_size("long int" SIZEOF_LONG_INT)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
179 if (SIZEOF_LONG_INT EQUAL 8)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
180 set(HAVE_LONG_INT_64 1)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
181 set(PG_INT64_TYPE "long int")
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
182 endif()
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
183
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
184 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
185 set(ALIGNOF_DOUBLE 8)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
186 set(ALIGNOF_INT 4)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
187 set(ALIGNOF_LONG 4)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
188 set(ALIGNOF_LONG_LONG_INT 8)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
189 set(ALIGNOF_SHORT 2)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
190 else()
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
191 check_type_alignment(double ALIGNOF_DOUBLE)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
192 check_type_alignment(int ALIGNOF_INT)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
193 check_type_alignment(long ALIGNOF_LONG)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
194 check_type_alignment("long long int" ALIGNOF_LONG_LONG_INT)
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
195 check_type_alignment(short ALIGNOF_SHORT)
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
196 endif()
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
197
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
198 set(MAXIMUM_ALIGNOF ${ALIGNOF_LONG})
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
199 if (MAXIMUM_ALIGNOF LESS ALIGNOF_DOUBLE)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
200 set(MAXIMUM_ALIGNOF ${ALIGNOF_DOUBLE})
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
201 endif()
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
202 if (HAVE_LONG_LONG_INT_64 AND (MAXIMUM_ALIGNOF LESS HAVE_LONG_LONG_INT_64))
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
203 set(MAXIMUM_ALIGNOF ${HAVE_LONG_LONG_INT_64})
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
204 endif()
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
205
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
206 if (CMAKE_COMPILER_IS_GNUCXX OR
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
207 "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
208 set(PG_PRINTF_ATTRIBUTE "gnu_printf")
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
209 set(pg_restrict "__restrict")
174
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
210 set(restrict "__restrict")
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
211 else()
174
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
212 # The empty string below wouldn't work (it would do an #undef)
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
213 set(pg_restrict " ")
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
214 set(restrict " ")
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
215 endif()
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
216
174
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
217 if (MSVC)
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
218 set(inline "__inline")
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
219 endif()
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
220
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
221 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
177
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
222 set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h;winsock2.h;ws2tcpip.h;float.h;math.h")
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
223 else()
177
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
224 set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h;sys/socket.h;netdb.h;float.h;math.h")
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
225 endif()
174
77a5d1a5ebfd fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
226
175
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
227 check_type_size("size_t" SIZEOF_SIZE_T)
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
228 check_type_size("struct addrinfo" HAVE_STRUCT_ADDRINFO)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
229 check_type_size("struct sockaddr_storage" HAVE_STRUCT_SOCKADDR_STORAGE)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
230 check_struct_has_member("struct sockaddr_storage" ss_family
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
231 "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
232
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
233 check_function_exists(gethostbyname_r HAVE_GETHOSTBYNAME_R)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
234 check_function_exists(getopt HAVE_GETOPT)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
235 check_function_exists(getopt_long HAVE_GETOPT_LONG)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
236 check_function_exists(getpwuid_r HAVE_GETPWUID_R)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
237 check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
238 check_function_exists(random HAVE_RANDOM)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
239 check_function_exists(srandom HAVE_SRANDOM)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
240 check_function_exists(strchrnul HAVE_STRCHRNUL)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
241 check_function_exists(strerror HAVE_STRERROR)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
242 check_function_exists(strerror_r HAVE_STRERROR_R)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
243 check_function_exists(unsetenv HAVE_UNSETENV)
175
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
244 check_function_exists(strlcat HAVE_STRLCAT)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
245 check_function_exists(strlcpy HAVE_STRLCPY)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
246 check_function_exists(getpeereid HAVE_GETPEEREID)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
247 check_function_exists(getpeerucred HAVE_GETPEERUCRED)
177
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
248 check_function_exists(isinf HAVE_ISINF)
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
249 check_function_exists(isnan HAVE_ISNAN)
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
250
175
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
251 check_symbol_exists(strlcpy "stdio.h;string.h" HAVE_DECL_STRLCPY)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
252 if (NOT HAVE_DECL_STRLCPY)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
253 set(HAVE_DECL_STRLCPY 0)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
254 endif()
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
255 check_symbol_exists(strlcat "stdio.h;string.h" HAVE_DECL_STRLCAT)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
256 if (NOT HAVE_DECL_STRLCAT)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
257 set(HAVE_DECL_STRLCAT 0)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
258 endif()
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
259 check_symbol_exists(snprintf "stdio.h;string.h" HAVE_DECL_SNPRINTF)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
260 if (NOT HAVE_DECL_SNPRINTF)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
261 set(HAVE_DECL_SNPRINTF 0)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
262 endif()
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
263 check_symbol_exists(vsnprintf "stdio.h;string.h" HAVE_DECL_VSNPRINTF)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
264 if (NOT HAVE_DECL_VSNPRINTF)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
265 set(HAVE_DECL_VSNPRINTF 0)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
266 endif()
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
267
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
268 check_c_source_compiles("
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
269 #include <sys/time.h>
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
270 int main(void){
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
271 struct timeval *tp;
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
272 struct timezone *tzp;
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
273 gettimeofday(tp,tzp);
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
274 return 0;
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
275 }
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
276 " GETTIMEOFDAY_2ARG)
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
277
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
278 if(NOT GETTIMEOFDAY_2ARG)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
279 set(GETTIMEOFDAY_1ARG 1)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
280 endif(NOT GETTIMEOFDAY_2ARG)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
281
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
282 check_c_source_compiles("
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
283 #include <time.h>
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
284 int main(void){
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
285 int res;
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
286 #ifndef __CYGWIN__
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
287 res = timezone / 60;
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
288 #else
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
289 res = _timezone / 60;
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
290 #endif
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
291 return 0;
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
292 }
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
293 " HAVE_INT_TIMEZONE)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
294
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
295 # Hardcoded stuff from "./configure" of libpq
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
296 set(MEMSET_LOOP_LIMIT 1024)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
297 set(BLCKSZ 8192)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
298 set(XLOG_BLCKSZ 8192)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
299 set(DEF_PGPORT 5432)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
300 set(DEF_PGPORT_STR "\"${DEF_PGPORT}\"")
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
301 set(PG_KRB_SRVNAM "\"postgres\"")
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
302
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
303 # Assume that zlib and openssl are always present
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
304 set(HAVE_LIBZ 1)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
305 set(HAVE_LIBSSL 1)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
306 set(HAVE_OPENSSL_INIT_SSL 1)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
307 set(USE_OPENSSL 1)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
308 set(USE_OPENSSL_RANDOM 1)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
309
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
310 PrepareCMakeConfigurationFile(
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
311 ${LIBPQ_SOURCES_DIR}/src/include/pg_config_ext.h.in
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
312 ${AUTOGENERATED_DIR}/pg_config_ext.h.in)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
313
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
314 PrepareCMakeConfigurationFile(
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
315 ${LIBPQ_SOURCES_DIR}/src/include/pg_config.h.in
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
316 ${AUTOGENERATED_DIR}/pg_config.h.in)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
317
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
318 configure_file(
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
319 ${AUTOGENERATED_DIR}/pg_config_ext.h.in
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
320 ${AUTOGENERATED_DIR}/pg_config_ext.h)
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
321
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
322 configure_file(
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
323 ${AUTOGENERATED_DIR}/pg_config.h.in
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
324 ${AUTOGENERATED_DIR}/pg_config.h)
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 ##
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 ## Generic configuration
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 ##
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 file(WRITE
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 ${AUTOGENERATED_DIR}/pg_config_paths.h
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 "")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 add_definitions(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 -DFRONTEND
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 -DSYSCONFDIR=""
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
339 -DTCP_NODELAY # For performance
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
340
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
341 # Must be set for OpenSSL 1.1, not for OpenSSL 1.0??
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
342 -DHAVE_BIO_GET_DATA=1
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
343 -DHAVE_BIO_METH_NEW=1
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 include_directories(
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
347 ${LIBPQ_SOURCES_DIR}/src/backend
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 ${LIBPQ_SOURCES_DIR}/src/include
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 ${LIBPQ_SOURCES_DIR}/src/include/libpq
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 set(LIBPQ_SOURCES
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
354 # Don't use files from the "src/backend/" folder
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
355 ${LIBPQ_SOURCES_DIR}/src/common/base64.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
356 ${LIBPQ_SOURCES_DIR}/src/common/encnames.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
357 ${LIBPQ_SOURCES_DIR}/src/common/ip.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
358 ${LIBPQ_SOURCES_DIR}/src/common/link-canary.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
359 ${LIBPQ_SOURCES_DIR}/src/common/md5.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
360 ${LIBPQ_SOURCES_DIR}/src/common/saslprep.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
361 ${LIBPQ_SOURCES_DIR}/src/common/scram-common.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
362 ${LIBPQ_SOURCES_DIR}/src/common/sha2_openssl.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
363 ${LIBPQ_SOURCES_DIR}/src/common/string.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
364 ${LIBPQ_SOURCES_DIR}/src/common/unicode_norm.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
365 ${LIBPQ_SOURCES_DIR}/src/common/wchar.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
366 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-auth-scram.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
367 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-auth.c
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-connect.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-exec.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-lobj.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-misc.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-print.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-protocol2.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-protocol3.c
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
375 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-secure-common.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
376 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-secure-openssl.c
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/fe-secure.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/libpq-events.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/pqexpbuffer.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 ${LIBPQ_SOURCES_DIR}/src/port/chklocale.c
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
381 ${LIBPQ_SOURCES_DIR}/src/port/explicit_bzero.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
382 ${LIBPQ_SOURCES_DIR}/src/port/getaddrinfo.c
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 ${LIBPQ_SOURCES_DIR}/src/port/inet_net_ntop.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 ${LIBPQ_SOURCES_DIR}/src/port/noblock.c
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
385 ${LIBPQ_SOURCES_DIR}/src/port/pg_strong_random.c
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 ${LIBPQ_SOURCES_DIR}/src/port/pgstrcasecmp.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 ${LIBPQ_SOURCES_DIR}/src/port/pqsignal.c
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
388 ${LIBPQ_SOURCES_DIR}/src/port/snprintf.c
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 166
diff changeset
389 ${LIBPQ_SOURCES_DIR}/src/port/strerror.c
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 ${LIBPQ_SOURCES_DIR}/src/port/thread.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392
175
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
393 if (NOT HAVE_STRLCPY)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
394 LIST(APPEND LIBPQ_SOURCES
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
395 ${LIBPQ_SOURCES_DIR}/src/port/strlcpy.c # Doesn't work on OS X
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
396 )
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
397 endif()
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
398
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
399 if (NOT HAVE_GETPEEREID)
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
400 LIST(APPEND LIBPQ_SOURCES
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
401 ${LIBPQ_SOURCES_DIR}/src/port/getpeereid.c # Doesn't work on OS X
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
402 )
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
403 endif()
1b67c6f8037c fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
404
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
405 if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
5
9e5e7a8314e0 fix postgresql for msvc
jodogne
parents: 0
diff changeset
406 link_libraries(secur32)
9e5e7a8314e0 fix postgresql for msvc
jodogne
parents: 0
diff changeset
407
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 include_directories(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 ${LIBPQ_SOURCES_DIR}/src/include/port/win32
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 ${LIBPQ_SOURCES_DIR}/src/port
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 LIST(APPEND LIBPQ_SOURCES
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
414 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/pthread-win32.c
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 ${LIBPQ_SOURCES_DIR}/src/interfaces/libpq/win32.c
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
416 ${LIBPQ_SOURCES_DIR}/src/port/dirmod.c
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 ${LIBPQ_SOURCES_DIR}/src/port/inet_aton.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 ${LIBPQ_SOURCES_DIR}/src/port/open.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 ${LIBPQ_SOURCES_DIR}/src/port/pgsleep.c
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
420 ${LIBPQ_SOURCES_DIR}/src/port/system.c
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 ${LIBPQ_SOURCES_DIR}/src/port/win32setlocale.c
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423
177
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
424 if (CMAKE_COMPILER_IS_GNUCXX OR
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
425 (MSVC AND MSVC_VERSION GREATER 1800))
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
426 # Starting Visual Studio 2013 (version 1800), it is necessary to also add "win32error.c"
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
427 LIST(APPEND LIBPQ_SOURCES ${LIBPQ_SOURCES_DIR}/src/port/win32error.c)
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
428 endif()
02ad3ea95fca fix build on ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 175
diff changeset
429
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 if (MSVC)
173
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
431 include_directories(
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
432 ${LIBPQ_SOURCES_DIR}/src/include/port/win32_msvc
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
433 )
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
434
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
435 LIST(APPEND LIBPQ_SOURCES
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
436 ${LIBPQ_SOURCES_DIR}/src/port/dirent.c
30d3f68631d2 support of mingw in postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 172
diff changeset
437 )
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 endif()
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 endif()
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 source_group(ThirdParty\\PostgreSQL REGULAR_EXPRESSION ${LIBPQ_SOURCES_DIR}/.*)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 else()
104
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
444 set(PostgreSQL_ADDITIONAL_VERSIONS
440
2f654d1038a1 added linking againt PostgreSQL 16
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 426
diff changeset
445 "16" "15" "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
104
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
446 if (NOT WIN32)
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
447 foreach (suffix ${PostgreSQL_ADDITIONAL_VERSIONS})
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
448 list(APPEND PostgreSQL_ADDITIONAL_SEARCH_PATHS
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
449 "/usr/include/postgresql/${suffix}"
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
450 "/usr/include/postgresql/${suffix}/server"
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
451 "/usr/local/include/postgresql/${suffix}"
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
452 )
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
453 endforeach()
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
454 endif()
0a713ffdf842 fix build on Ubuntu 14.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
455
103
9263b3de37ed fix build on Debian Buster
jodogne
parents: 91
diff changeset
456 include(FindPostgreSQL)
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 include_directories(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 ${PostgreSQL_INCLUDE_DIR}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 ${PostgreSQL_TYPE_INCLUDE_DIR}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 link_libraries(${PostgreSQL_LIBRARY})
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 endif()