summaryrefslogtreecommitdiff
path: root/libguile/c-tokenize.lex
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/c-tokenize.lex')
-rw-r--r--libguile/c-tokenize.lex13
1 files changed, 11 insertions, 2 deletions
diff --git a/libguile/c-tokenize.lex b/libguile/c-tokenize.lex
index 856224e46..03fe9898c 100644
--- a/libguile/c-tokenize.lex
+++ b/libguile/c-tokenize.lex
@@ -1,3 +1,14 @@
+%top{
+/* Include <config.h> before anything else because Gnulib headers such
+ as <stdio.h> rely on it.
+
+ However, when cross-compiling, don't include <config.h> because it
+ contains information about the host, not about the build. */
+#ifndef CROSS_COMPILING
+# include <config.h>
+#endif
+}
+
%option noyywrap
%option nounput
%pointer
@@ -14,8 +25,6 @@ FLOQUAL (f|F|l|L)
INTQUAL (l|L|ll|LL|lL|Ll|u|U)
%{
-#include <config.h>
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>