Skip to contentSkip to conversation

configure: verify stdio.h

PATCH Superseded Michael S. Tsirkin 1 participant 1 message Jan 26, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: verify stdio.h

Verify that stdio.h supports %ll and %z
Some migw variants don't unless requested explicitly (see
http://www.mail-archive.com/[email protected]/msg00417.html)
), detect them early.

---
 configure |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
configure +25 -0
index 5631bbb..7bbe4bc 100755
@@ -123,6 +123,31 @@ else
     exit 1
 fi
 
+# Check that stdio.h compiler is sane: some
+# mingw variants do not support %z %l that we rely on
+cat > $TMPC <<EOF
+#include <stddef.h>
+#include <stdio.h>
+size_t z = 1;
+long long ll = 2;
+int main(void) {
+  printf("z=%zd;ll=%lld;\n", z, ll);
+  return 0;
+}
+EOF
+
+if compile_prog && ($TMPE | grep "z=1;ll=2;" > /dev/null); then
+  : C compiler works ok
+else
+    echo "ERROR: \"$cc\" does not have a working stdio.h"
+    exit 1
+fi
+
+cat > $TMPC << EOF
+#include <unistd.h>
+int main(void) { return fdatasync(0); }
+EOF
+
 check_define() {
 cat > $TMPC <<EOF
 #if !defined($1)
Signature · 1 line
1.6.6.144.g5c3af