]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
misc/util.c: enable MinGW alarm() when building for Windows
authorEric Biggers <ebiggers@google.com>
Sat, 21 Jan 2023 20:32:28 +0000 (12:32 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 27 Jan 2023 17:39:19 +0000 (12:39 -0500)
To compile for Windows, this file needs MinGW's implementation of
alarm().  To expose that definition, some macros must be defined before
including the system headers.  This was done in Android.bp, but it was
not done in the autotools-based build system.  Define these macros in
the source file itself so that all build systems work.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/Android.bp
misc/util.c

index 2baeac2add8dbdf78ac4d24c435d3e1a0cb9800d..2b1620ac624073b97719e3763d1d359faec131c0 100644 (file)
@@ -83,8 +83,6 @@ cc_binary {
         windows: {
             include_dirs: [ "external/e2fsprogs/include/mingw" ],
             cflags: [
-                "-D_POSIX",
-                "-D__USE_MINGW_ALARM",
                 // mke2fs.c has a warning from gcc which cannot be suppressed:
                 // passing argument 3 of 'ext2fs_get_device_size' from
                 // incompatible pointer type
index e84ebab5bd3b1ba243e86b80c6381d15780c0629..3e83169f118995898ab680b6a53aca31bfb0186f 100644 (file)
 #define _LARGEFILE64_SOURCE
 #endif
 
+#ifdef _WIN32
+#define _POSIX
+#define __USE_MINGW_ALARM
+#endif
+
 #include "config.h"
 #include <fcntl.h>
 #include <setjmp.h>