1 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
3 ### Compute pgxs_data, used in src/meson.build to generate Makefile.global
4 ### etc, that's complete enough for PGXS to work.
7 # Emulation of PGAC_CHECK_STRIP
8 strip_bin = find_program(get_option('STRIP'), required: false, native: true)
9 strip_cmd = strip_bin.found() ? [strip_bin.path()] : [':']
13 strip_version = run_command(strip_bin, '-V', check: false)
15 if strip_version.returncode() == 0 and (
16 strip_version.stdout().contains('GNU strip') or
17 strip_version.stderr().contains('GNU strip'))
19 strip_static_cmd = strip_cmd + ['--strip-unneeded']
20 strip_shared_cmd = strip_cmd + ['--strip-unneeded']
21 elif host_system == 'darwin'
23 strip_static_cmd = strip_cmd + ['-x']
24 strip_shared_cmd = strip_cmd + ['-x']
30 strip_static_cmd = [':']
31 strip_shared_cmd = [':']
36 'PACKAGE_URL': pg_url,
37 'PACKAGE_VERSION': pg_version,
38 'PG_MAJORVERSION': pg_version_major,
39 'PG_VERSION_NUM': pg_version_num,
40 'configure_input': 'meson',
43 'autodepend': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
46 'host': '@0@-@1@'.format(host_cpu, host_system),
47 'host_os': host_system,
48 'build_os': build_machine.system(),
50 'PG_SYSROOT': pg_sysroot,
52 'abs_top_builddir': meson.build_root(),
53 'abs_top_srcdir': meson.source_root(),
55 'enable_rpath': get_option('rpath') ? 'yes' : 'no',
56 'enable_nls': libintl.found() ? 'yes' : 'no',
57 'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no',
58 'enable_debug': get_option('debug') ? 'yes' : 'no',
59 'enable_coverage': 'no',
60 'enable_dtrace': dtrace.found() ? 'yes' : 'no',
65 'SUN_STUDIO_CC': 'no', # not supported so far
67 # want the chosen option, rather than the library
68 'with_ssl' : ssl_library,
71 'default_port': get_option('pgport'),
72 'with_system_tzdata': get_option('system_tzdata'),
74 'with_krb_srvnam': get_option('krb_srvnam'),
75 'krb_srvtab': krb_srvtab,
77 'STRIP': ' '.join(strip_cmd),
78 'STRIP_STATIC_LIB': ' '.join(strip_static_cmd),
79 'STRIP_SHARED_LIB': ' '.join(strip_shared_cmd),
81 # these seem to be standard these days
82 'MKDIR_P': 'mkdir -p',
84 # Just always use the install_sh fallback that autoconf uses. Unlikely to
85 # matter performance-wise for extensions. If it turns out to do, we can
86 'install_bin': '$(SHELL) $(top_srcdir)/config/install-sh -c',
90 'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
92 'CPPFLAGS': var_cppflags,
94 'CXXFLAGS': var_cxxflags,
95 'CFLAGS_SL': var_cflags_sl,
96 'CFLAGS_SL_MODULE': ' '.join(cflags_mod),
97 'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod),
98 'PERMIT_DECLARATION_AFTER_STATEMENT':
99 ' '.join(cflags_no_decl_after_statement),
101 'CFLAGS_CRC': ' '.join(cflags_crc),
102 'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags),
103 'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags),
105 'LDFLAGS': var_ldflags,
106 'LDFLAGS_EX': var_ldflags_ex,
108 ' '.join(cc.get_supported_link_arguments('-Wl,--export-dynamic')),
109 'LDFLAGS_SL': var_ldflags_sl,
111 # TODO: requires bitcode generation to be implemented for meson
112 'BITCODE_CFLAGS': '',
113 'BITCODE_CXXFLAGS': '',
115 'BISONFLAGS': ' '.join(bison_flags),
116 'FLEXFLAGS': ' '.join(flex_flags),
123 'CLANG': clang.path(),
124 'CXX': ' '.join(cpp.cmd_array()),
125 'LLVM_BINPATH': llvm_binpath,
137 find_program(['ar'], native: true, required: false),
139 find_program(['gawk', 'mawk', 'nawk', 'awk'], native: true, required: false),
149 'ZSTD': program_zstd,
154 'ICU_CFLAGS', # needs to be added, included by public server headers
156 # hard to see why we'd need either?
160 # docs don't seem to be supported by pgxs
166 # supporting coverage for pgxs-in-meson build doesn't seem worth it
172 # translation doesn't appear to be supported by pgxs
178 # Not needed because we don't build the server / PLs with the generated makefile
179 'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
180 'DTRACEFLAGS', # only server has dtrace probes
182 'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp',
183 'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
185 # possible that some of these are referenced explicitly in pgxs makefiles?
186 # For now not worth it.
187 'TCL_INCLUDE_SPEC', 'TCL_LIBS', 'TCL_LIB_SPEC', 'TCL_SHARED_BUILD',
189 'LLVM_CFLAGS', 'LLVM_CPPFLAGS', 'LLVM_CXXFLAGS', 'LLVM_LIBS',
191 'LDAP_LIBS_BE', 'LDAP_LIBS_FE',
195 'PTHREAD_CFLAGS', 'PTHREAD_LIBS',
200 if host_system == 'windows' and cc.get_argument_syntax() != 'msvc'
201 pgxs_bins += {'WINDRES': windres}
203 pgxs_empty += 'WINDRES'
207 'prefix': get_option('prefix'),
209 'bindir': '${exec_prefix}' / get_option('bindir'),
210 'datarootdir': '${prefix}' / get_option('datadir'),
211 'datadir': '${datarootdir}',
212 'docdir': '${prefix}' / dir_doc,
213 'exec_prefix': '${prefix}',
214 'htmldir': '${docdir}',
215 'includedir': '${prefix}' / get_option('includedir'),
216 'libdir': '${exec_prefix}' / get_option('libdir'),
217 'localedir': '${prefix}' / get_option('localedir'),
218 'mandir': '${prefix}' / get_option('mandir'),
219 'sysconfdir': '${prefix}' / get_option('sysconfdir'),
224 'bsd_auth': bsd_auth,
235 'python': python3_dep,
236 'readline': readline,
245 pgxs_cdata = configuration_data(pgxs_kv)
247 foreach b, p : pgxs_bins
248 pgxs_cdata.set(b, p.found() ? p.path() : '')
251 foreach pe : pgxs_empty
252 pgxs_cdata.set(pe, '')
255 foreach d, p : pgxs_dirs
259 foreach d, v : pgxs_deps
260 pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no')