diff --git a/mongoose.c b/mongoose.c
index 0fd02c027b8215912d060c88695d430f08f4af61..9c4ea57016c86084bb9609cc57e410a0fe30d830 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -23,7 +23,9 @@
 #ifdef __linux__
 #define _XOPEN_SOURCE 600     // For flockfile() on Linux
 #endif
+#if !defined(_LARGEFILE_SOURCE)
 #define _LARGEFILE_SOURCE     // Enable 64-bit file offsets
+#endif
 #define __STDC_FORMAT_MACROS  // <inttypes.h> wants this for C++
 #define __STDC_LIMIT_MACROS   // C++ wants that for INT64_MAX
 #endif