diff --git a/lib/utils/mem.c b/lib/utils/mem.c
index 965b4c5cb90df129699acff66da9f34796fc8de3..9331273de344eb537543079af0c62ca5a89a30a6 100644
--- a/lib/utils/mem.c
+++ b/lib/utils/mem.c
@@ -1,10 +1,15 @@
 /*
- * SPDX-FileCopyrightText: 2018, 2019 Bruce Cowan <bruce@bcowan.me.uk>
+ * SPDX-FileCopyrightText: 2018-2020 Bruce Cowan <bruce@bcowan.me.uk>
  *
  * SPDX-License-Identifier: Apache-2.0
  */
 
 #include "config.h"
+
+#ifdef HAVE_REALLOCARRAY
+  #define _GNU_SOURCE
+#endif
+
 #include "mem.h"
 
 #include <stdlib.h>
diff --git a/meson.build b/meson.build
index 13bb8027069b28e4d5646b9a230bd74215489b61..d932226242f9c8db36317937816277e106069a19 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,8 @@
 # SPDX-License-Identifier: CC0-1.0
 
 project('stdlib', 'c',
-  default_options: ['warning_level=3', 'c_std=gnu99'])
+  default_options: ['warning_level=3', 'c_std=gnu99'],
+  meson_version: '>=0.50.0')
 
 cc = meson.get_compiler('c')
 libm = cc.find_library('m')