summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@dilger.ca>2013-12-15 22:09:24 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-12-15 22:10:09 -0500
commit3a941bef3b9036ca3db9d510c71bcae801ea4dd1 (patch)
tree0316a15c1a7011f8c2e79009bdaa6aac4422ead0 /config
parent66457fcb842300e757a69c49c2eb4d8e335be34c (diff)
downloade2fsprogs-3a941bef3b9036ca3db9d510c71bcae801ea4dd1.tar.gz
build: use long long for __u64 by default
Don't print a verbose configure error in parse-types.h if <asm/types.h> missing and __[SU]*_TYPEDEF is unset. This is always the case for non-Linux builds. The printf formatting strings all use "%llu" for printing 64-bit values and this it produces a large number of warnings if __u64 is defined as "unsigned long". If __U64_TYPEDEF isn't set use "unsigned long long" for __u64 in ext2-types.h and blkid-types.h by default instead of using "unsigned long". Fix a few places where "%d" or "%u" or "%Lu" were used to print a 64-bit value, by converting them to use "%lld" or "%llu" instead. Fix a few places where "%lu" was used to print .tv_usec, by casting the variable to "(long)" since .tv_usec is "int" on some systems. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'config')
-rwxr-xr-xconfig/parse-types.sh27
1 files changed, 17 insertions, 10 deletions
diff --git a/config/parse-types.sh b/config/parse-types.sh
index 00371ff9..5076f6ca 100755
--- a/config/parse-types.sh
+++ b/config/parse-types.sh
@@ -16,8 +16,15 @@ if test -z "$CPP"; then
CPP="$CC -E"
fi
-echo '#include <asm/types.h>' | $CPP - | \
- sed -f sed.script | grep '^#' > asm_types.h
+/bin/echo -n "checking for __uNN types... "
+# can't check [ -f /usr/include/asm/types.h ] directly, since
+# the include path might be different if cross-compiling
+if echo '#include <asm/types.h>' | $CPP - 2> parse-types.log | \
+ sed -f sed.script | grep '^#' > asm_types.h; then
+ echo "using <asm/types.h>"
+else
+ echo "using generic types"
+fi
rm sed.script
@@ -34,7 +41,7 @@ int main(int argc, char **argv)
(int) sizeof(__U8_TYPEDEF));
exit(1);
}
-#else
+#elif defined(__linux__)
#warning __U8_TYPEDEF not defined
#endif
#ifdef __S8_TYPEDEF
@@ -43,7 +50,7 @@ int main(int argc, char **argv)
(int) sizeof(__S8_TYPEDEF));
exit(1);
}
-#else
+#elif defined(__linux__)
#warning __S8_TYPEDEF not defined
#endif
#ifdef __U16_TYPEDEF
@@ -52,7 +59,7 @@ int main(int argc, char **argv)
(int) sizeof(__U16_TYPEDEF));
exit(1);
}
-#else
+#elif defined(__linux__)
#warning __U16_TYPEDEF not defined
#endif
#ifdef __S16_TYPEDEF
@@ -61,7 +68,7 @@ int main(int argc, char **argv)
(int) sizeof(__S16_TYPEDEF));
exit(1);
}
-#else
+#elif defined(__linux__)
#warning __S16_TYPEDEF not defined
#endif
@@ -71,7 +78,7 @@ int main(int argc, char **argv)
(int) sizeof(__U32_TYPEDEF));
exit(1);
}
-#else
+#elif defined(__linux__)
#warning __U32_TYPEDEF not defined
#endif
#ifdef __S32_TYPEDEF
@@ -80,7 +87,7 @@ int main(int argc, char **argv)
(int) sizeof(__S32_TYPEDEF));
exit(1);
}
-#else
+#elif defined(__linux__)
#warning __S32_TYPEDEF not defined
#endif
@@ -90,7 +97,7 @@ int main(int argc, char **argv)
(int) sizeof(__U64_TYPEDEF));
exit(1);
}
-#else
+#elif defined(__linux__)
#warning __U64_TYPEDEF not defined
#endif
#ifdef __S64_TYPEDEF
@@ -99,7 +106,7 @@ int main(int argc, char **argv)
(int) sizeof(__S64_TYPEDEF));
exit(1);
}
-#else
+#elif defined(__linux__)
#warning __S64_TYPEDEF not defined
#endif
return 0;