Fix meson build with -Duuid=ossp when using version older than 0.60
authorMichael Paquier <[email protected]>
Sun, 21 Sep 2025 23:03:28 +0000 (08:03 +0900)
committerMichael Paquier <[email protected]>
Sun, 21 Sep 2025 23:03:28 +0000 (08:03 +0900)
The package for the UUID library may be named "uuid" or "ossp-uuid", and
meson.build has been using a single call of dependency() with multiple
names, something only supported since meson 0.60.0.

The minimum version of meson supported by Postgres is 0.57.2 on HEAD,
since f039c2244110, and 0.54 on stable branches down to 16.

Author: Oreo Yang <[email protected]>
Reviewed-by: Nazir Bilal Yavuz <[email protected]>
Discussion: https://postgr.es/m/OS3P301MB01656E6F91539770682B1E77E711A@OS3P301MB0165.JPNP301.PROD.OUTLOOK.COM
Backpatch-through: 16

meson.build

index 5c33f569b438548852bc2d24e06b25ac1e052b04..8e7a183edd999c8202e3cf51d5868b17f1f8b17b 100644 (file)
@@ -1458,7 +1458,10 @@ if uuidopt != 'none'
   elif uuidopt == 'ossp'
     # In upstream, the package and library is called just 'uuid', but many
     # distros change it to 'ossp-uuid'.
-    uuid = dependency('ossp-uuid', 'uuid', required: false)
+    uuid = dependency('ossp-uuid', required: false)
+    if not uuid.found()
+      uuid = dependency('uuid', required: false)
+    endif
     uuidfunc = 'uuid_export'
     uuidheader = 'uuid.h'