Browse Source

configurator: HAVE_FILE_OFFSET_BITS

Defines whether it's useful to do #define _FILE_OFFSET_BITS 64 to get a
larger off_t.
Rusty Russell 15 years ago
parent
commit
4db6a6709b
2 changed files with 14 additions and 0 deletions
  1. 2 0
      config.h
  2. 12 0
      tools/configurator/configurator.c

+ 2 - 0
config.h

@@ -5,6 +5,7 @@
 #define CCAN_COMPILER "cc"
 #define CCAN_CFLAGS "-g -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -DCCAN_STR_DEBUG=1"
 
+#define HAVE_32BIT_OFF_T 1
 #define HAVE_ALIGNOF 1
 #define HAVE_ASPRINTF 1
 #define HAVE_ATTRIBUTE_COLD 1
@@ -28,6 +29,7 @@
 #define HAVE_BUILTIN_TYPES_COMPATIBLE_P 1
 #define HAVE_BYTESWAP_H 1
 #define HAVE_COMPOUND_LITERALS 1
+#define HAVE_FILE_OFFSET_BITS 1
 #define HAVE_FOR_LOOP_DECLARATION 0
 #define HAVE_FLEXIBLE_ARRAY_MEMBER 1
 #define HAVE_GETPAGESIZE 1

+ 12 - 0
tools/configurator/configurator.c

@@ -38,6 +38,11 @@ struct test {
 };
 
 static struct test tests[] = {
+	{ "HAVE_32BIT_OFF_T", DEFINES_EVERYTHING|EXECUTE, NULL,
+	  "#include <sys/types.h>\n"
+	  "int main(int argc, char *argv[]) {\n"
+	  "	return sizeof(off_t) == 4 ? 0 : 1;\n"
+	  "}\n" },
 	{ "HAVE_ALIGNOF", INSIDE_MAIN, NULL,
 	  "return __alignof__(double) > 0 ? 0 : 1;" },
 	{ "HAVE_ASPRINTF", DEFINES_FUNC, NULL,
@@ -95,6 +100,13 @@ static struct test tests[] = {
 	{ "HAVE_COMPOUND_LITERALS", INSIDE_MAIN, NULL,
 	  "int *foo = (int[]) { 1, 2, 3, 4 };\n"
 	  "return foo[0] ? 0 : 1;" },
+	{ "HAVE_FILE_OFFSET_BITS", DEFINES_EVERYTHING|EXECUTE,
+	  "HAVE_32BIT_OFF_T",
+	  "#define _FILE_OFFSET_BITS 64\n"
+	  "#include <sys/types.h>\n"
+	  "int main(int argc, char *argv[]) {\n"
+	  "	return sizeof(off_t) == 8 ? 0 : 1;\n"
+	  "}\n" },
 	{ "HAVE_FOR_LOOP_DECLARATION", INSIDE_MAIN, NULL,
 	  "for (int i = 0; i < argc; i++) { return 0; };\n"
 	  "return 1;" },