diff --git a/SConstruct b/SConstruct
index 41b467e976aa29985e80bab4ccf01c6f86236816..a8203a69ff9b8ecfbab64b3ba8a6ad11e4366f10 100644
--- a/SConstruct
+++ b/SConstruct
@@ -102,7 +102,7 @@ if env['CC'] == 'cl':
         ]
     )
 else:
-    env.MergeFlags('-std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -Wno-unused-variable')
+    env.MergeFlags('-std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -Wno-unused-variable')
 
 # Linker options
 if env['PLATFORM'] == 'darwin':
diff --git a/src/registry.c b/src/registry.c
index a8646c14ed97f42f263770d5ebdd3b7e8c032b10..00486db46ca6c1fdece03a051242f4f05ad23514 100644
--- a/src/registry.c
+++ b/src/registry.c
@@ -15,6 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
+#include <search.h>
 #include <stdlib.h>
 #include "hammer.h"
 #include "internal.h"