Define __GNUC_PREREQ if necessary
The __GNUC_PREREQ convenience macro is defined by glibc's header
files. If it isn't available, make it available for us to use.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index 4ad09f1..13c2c20 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -18,6 +18,15 @@
#include <ext2fs/ext2_types.h> /* Changed from linux/types.h */
+#ifndef __GNUC_PREREQ
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#define __GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+#define __GNUC_PREREQ(maj, min) 0
+#endif
+#endif
+
/*
* The second extended filesystem constants/structures
*/
diff --git a/lib/ext2fs/hashmap.h b/lib/ext2fs/hashmap.h
index 228f439..656d3d9 100644
--- a/lib/ext2fs/hashmap.h
+++ b/lib/ext2fs/hashmap.h
@@ -4,6 +4,15 @@
# include <stdlib.h>
# include <stdint.h>
+#ifndef __GNUC_PREREQ
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#define __GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+#define __GNUC_PREREQ(maj, min) 0
+#endif
+#endif
+
struct ext2fs_hashmap {
uint32_t size;
uint32_t(*hash)(const void *key, size_t len);
diff --git a/lib/uuid/uuidP.h b/lib/uuid/uuidP.h
index e897bbb..6c0fd80 100644
--- a/lib/uuid/uuidP.h
+++ b/lib/uuid/uuidP.h
@@ -55,6 +55,14 @@
uint8_t node[6];
};
+#ifndef __GNUC_PREREQ
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#define __GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+#define __GNUC_PREREQ(maj, min) 0
+#endif
+#endif
/*
* prototypes