aboutsummaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2020-10-15 22:47:35 +0200
committerJay Berkenbilt <ejb@ql.org>2020-10-16 13:02:23 +0200
commitff65e272a8f8e647a3db5187e5c4594ff01cbd34 (patch)
treecb86bf74c0b5c6d1d1f49a3dbcf519ac4fe3cbe2 /configure
parentbe21ede7ba05027829adaf7275e9bbbc1574a760 (diff)
downloadqpdf-ff65e272a8f8e647a3db5187e5c4594ff01cbd34.tar.zst
Fix printf formatting for newer msvc
Use autoconf rather than ifdefs to determine what format string to use for long long.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure57
1 files changed, 57 insertions, 0 deletions
diff --git a/configure b/configure
index d6aebce8..47e08dad 100755
--- a/configure
+++ b/configure
@@ -17694,6 +17694,63 @@ $as_echo "no" >&6; }
fi
fi
+LL_FMT=""
+oCFLAGS=$CFLAGS
+CFLAGS="$WFLAGS $CFLAGS"
+for fmt in "%lld" "%I64d" "%I64lld"; do
+ if test "$LL_FMT" = ""; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking printf format for long long: $fmt" >&5
+$as_echo_n "checking printf format for long long: $fmt... " >&6; }
+ if test "$cross_compiling" = yes; then :
+ LL_FMT="%lld"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #define _CRT_SECURE_NO_WARNINGS
+ #include <stdio.h>
+ #include <string.h>
+
+int
+main ()
+{
+
+ long long int a = 123456789012345ll;
+ char s[30];
+ sprintf(s, "$fmt", a);
+ return (strcmp(s, "123456789012345") == 0) ? 0 : 1
+
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ LL_FMT=$fmt
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ if test "$LL_FMT" != ""; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ fi
+done
+CFLAGS=$oCFLAGS
+if test "LL_FMT" = ""; then
+ LL_FMT="%lld%"
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define LL_FMT "$LL_FMT"
+_ACEOF
+
+
if test "$BUILDRULES" = "msvc"; then