diff --git a/tools/make_xftmpl.c b/tools/make_xftmpl.c
index 1d83498ae178ca3ce7d37764cc0550576cefca30..75b47cc1f6fad9b80b663d731817abf21a59d27a 100644
--- a/tools/make_xftmpl.c
+++ b/tools/make_xftmpl.c
@@ -99,6 +99,8 @@ static const struct keyword reserved_words[] = {
     {"WORD", TOKEN_WORD}
 };
 
+extern int getopt(int argc, char *const *argv, const char *optstring);
+
 static BOOL option_header;
 static char *option_inc_var_name = NULL;
 static char *option_inc_size_name = NULL;