From f562d494b09dd889ac7600cfd22e4d7124e8656c Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 18 Jun 2019 18:43:49 -0400 Subject: [PATCH] configure: add --enable-int-warnings --- autofiles.sums | 2 +- configure | 30 ++++++++++++++++++++++++++++++ configure.ac | 21 +++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/autofiles.sums b/autofiles.sums index 996355c8..4783c18a 100644 --- a/autofiles.sums +++ b/autofiles.sums @@ -1,4 +1,4 @@ -1644769c53aa0f44d2957ec4da300da1b184452abbf5bd3c280bcd01958d5c04 configure.ac +d6ab690ff0a692fae861cf77ede19245aa2e60bff561846085473ad7060df157 configure.ac 35bc5c645dc42d47f2daeea06f8f3e767c8a1aee6a35eb2b4854fd2ce66c3413 m4/ax_random_device.m4 37f8897d5f68d7d484e5457832a8f190ddb7507fa2a467cb7ee2be40a4364643 m4/libtool.m4 e77ebba8361b36f14b4d0927173a034b98c5d05049697a9ded84d85eb99a7990 m4/ltoptions.m4 diff --git a/configure b/configure index d04727a1..46d367a7 100755 --- a/configure +++ b/configure @@ -767,6 +767,7 @@ enable_largefile enable_ld_version_script with_buildrules enable_werror +enable_int_warnings enable_test_compare_images enable_show_failed_test_output with_docbook_xsl @@ -1438,6 +1439,8 @@ Optional Features: --enable-ld-version-script enable linker version script (default is enabled) --enable-werror whether to treat warnings as errors (default is no) + --enable-int-warnings whether to turn on integer type warnings (default is + no) --enable-test-compare-images whether to compare images in test suite; disabled by default, enabling requires ghostscript and tiffcmp @@ -16683,6 +16686,33 @@ else $as_echo "no" >&6; } fi +if test "$BUILDRULES" = "msvc"; then + try_flags="-W3" +else + try_flags="-Wconversion -Wsign-conversion" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for whether to use $try_flags" >&5 +$as_echo_n "checking for whether to use $try_flags... " >&6; } +# Check whether --enable-int-warnings was given. +if test "${enable_int_warnings+set}" = set; then : + enableval=$enable_int_warnings; if test "$enableval" = "yes"; then + qpdf_INT_WARNINGS=1; + else + qpdf_INT_WARNINGS=0; + fi +else + qpdf_INT_WARNINGS=0 +fi + +if test "$qpdf_INT_WARNINGS" = "1"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + WFLAGS="$WFLAGS $try_flags" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + # Check whether --enable-test-compare-images was given. if test "${enable_test_compare_images+set}" = set; then : diff --git a/configure.ac b/configure.ac index 75993fdb..13db7395 100644 --- a/configure.ac +++ b/configure.ac @@ -392,6 +392,27 @@ else AC_MSG_RESULT(no) fi +if test "$BUILDRULES" = "msvc"; then + try_flags="-W3" +else + try_flags="-Wconversion -Wsign-conversion" +fi +AC_MSG_CHECKING(for whether to use $try_flags) +AC_ARG_ENABLE(int-warnings, + AS_HELP_STRING([--enable-int-warnings], + [whether to turn on integer type warnings (default is no)]), + [if test "$enableval" = "yes"; then + qpdf_INT_WARNINGS=1; + else + qpdf_INT_WARNINGS=0; + fi], [qpdf_INT_WARNINGS=0]) +if test "$qpdf_INT_WARNINGS" = "1"; then + AC_MSG_RESULT(yes) + WFLAGS="$WFLAGS $try_flags" +else + AC_MSG_RESULT(no) +fi + AC_SUBST(QPDF_SKIP_TEST_COMPARE_IMAGES) AC_ARG_ENABLE(test-compare-images, AS_HELP_STRING([--enable-test-compare-images],