Hi, I was building an extension against a meson-built tree on macOS and the build failed because a public server header includes openssl/ssl.h, but the compiler couldn't find it. The extension includes libpq/auth.h, which pulls in libpq-be.h, which includes openssl/ssl.h when OpenSSL support is enabled. On systems where OpenSSL is installed in a non-default prefix (Homebrew on macOS being the common case), that header is not on the default search path.
With autoconf this works because you pass the include path to configure via CPPFLAGS and it ends up in Makefile.global and pg_config --cppflags. But meson keeps the include directory inside the ssl dependency object and never writes it into var_cppflags, so extensions get nothing. ICU has the same issue, and it's actually been known since the original meson commit: ICU_CFLAGS sits in pgxs_empty with a comment saying it "needs to be added, included by public server headers", so the $(ICU_CFLAGS) reference in Makefile.global has always been empty. The attached patch fixes both, mirroring how autoconf handles each. For OpenSSL I extract the include directory from the ssl dependency and append it to var_cppflags in src/include/meson.build. Since var_cppflags feeds both VAL_CPPFLAGS and CPPFLAGS in the generated Makefile.global, this fixes pg_config --cppflags and the PGXS build in one place, which matches autoconf (where OpenSSL rides along in CPPFLAGS). For ICU I populate ICU_CFLAGS from the icu dependency and drop it from pgxs_empty. ICU gets a cmake fallback in get_variable because the meson setup can find ICU via cmake; OpenSSL can't, so it doesn't get one. One thing I noticed and left alone: autoconf's pg_config --cppflags also includes ICU_CFLAGS (VAL_CPPFLAGS is built from STD_CPPFLAGS, which picks up the override), while meson's won't. Extensions don't care because they get ICU through $(ICU_CFLAGS) in Makefile.global, and I didn't want to duplicate the flags in the PGXS path. Easy to add ICU to var_cppflags too if you want full parity there. I tested by building and installing PostgreSQL both ways (autoconf and meson, with SSL enabled, on macOS with Homebrew) and compiling the same extension against each installation. Both build now, and the compile command contains both the OpenSSL and ICU include directories. Before the patch, meson's pg_config --cppflags was empty for these. Regards, Aidar Imamov
0001-meson_expose-openssl_and_icu_include_dirs.patch
Description: Binary data
