aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README-maintainer3
-rw-r--r--autoconf.mk.in1
-rw-r--r--autofiles.sums2
-rwxr-xr-xazure-pipelines/build-windows2
-rwxr-xr-xconfig-mingw2
-rwxr-xr-xconfig-msvc2
-rwxr-xr-xconfigure239
-rw-r--r--configure.ac22
-rw-r--r--libqpdf/qpdf/qpdf-config.h.in3
9 files changed, 241 insertions, 35 deletions
diff --git a/README-maintainer b/README-maintainer
index dc3e1d5b..77c1b1a3 100644
--- a/README-maintainer
+++ b/README-maintainer
@@ -90,6 +90,9 @@ RELEASE PREPARATION
* Test with clang. Pass `CC=clang CXX=clang++` to `./configure`. Test
with newer version of gcc if available.
+* Test 32-bit. Pass `CC=i686-linux-gnu-gcc CXX=i686-linux-gnu-g++` to
+ `./configure`.
+
* Test build on a mac.
* Test with address sanitizer as described above.
diff --git a/autoconf.mk.in b/autoconf.mk.in
index f198b4ec..a443e1ac 100644
--- a/autoconf.mk.in
+++ b/autoconf.mk.in
@@ -41,6 +41,7 @@ OSS_FUZZ=@OSS_FUZZ@
QPDF_SKIP_TEST_COMPARE_IMAGES=@QPDF_SKIP_TEST_COMPARE_IMAGES@
BUILDRULES=@BUILDRULES@
HAVE_LD_VERSION_SCRIPT=@HAVE_LD_VERSION_SCRIPT@
+IS_32BIT=@IS_32BIT@
WINDOWS_WORDSIZE=@WINDOWS_WORDSIZE@
WINDOWS_WMAIN_COMPILE=@WINDOWS_WMAIN_COMPILE@
WINDOWS_WMAIN_LINK=@WINDOWS_WMAIN_LINK@
diff --git a/autofiles.sums b/autofiles.sums
index 4783c18a..e1784120 100644
--- a/autofiles.sums
+++ b/autofiles.sums
@@ -1,4 +1,4 @@
-d6ab690ff0a692fae861cf77ede19245aa2e60bff561846085473ad7060df157 configure.ac
+585322e3ca6c33acd1d8e3eb3da767c964e93f6fbeb0cf0d2c0cd11bb0b0a445 configure.ac
35bc5c645dc42d47f2daeea06f8f3e767c8a1aee6a35eb2b4854fd2ce66c3413 m4/ax_random_device.m4
37f8897d5f68d7d484e5457832a8f190ddb7507fa2a467cb7ee2be40a4364643 m4/libtool.m4
e77ebba8361b36f14b4d0927173a034b98c5d05049697a9ded84d85eb99a7990 m4/ltoptions.m4
diff --git a/azure-pipelines/build-windows b/azure-pipelines/build-windows
index d0bd7316..e48f6fa8 100755
--- a/azure-pipelines/build-windows
+++ b/azure-pipelines/build-windows
@@ -27,7 +27,7 @@ PATH=$cwd/libqpdf/build:$PATH
installdir=install-$tool$wordsize
rm -rf $installdir
-./config-$tool --with-windows-wordsize=$wordsize --enable-show-failed-test-output
+./config-$tool --enable-show-failed-test-output
make -j$(nproc) -k
make -k check
make install
diff --git a/config-mingw b/config-mingw
index 81190938..0d630101 100755
--- a/config-mingw
+++ b/config-mingw
@@ -6,4 +6,4 @@ if echo $PATH | grep -q /mingw64; then
else
wordsize=32
fi
-./configure --disable-test-compare-images --enable-external-libs --enable-werror --with-windows-wordsize=$wordsize --with-buildrules=mingw ${1+"$@"}
+./configure --disable-test-compare-images --enable-external-libs --enable-werror --with-buildrules=mingw ${1+"$@"}
diff --git a/config-msvc b/config-msvc
index 762e4867..56d752e4 100755
--- a/config-msvc
+++ b/config-msvc
@@ -6,4 +6,4 @@ if echo $PATH | grep -q /mingw64; then
else
wordsize=32
fi
-CC=cl CXX="cl -TP -GR" ./configure --disable-test-compare-images --enable-external-libs --enable-werror --with-windows-wordsize=$wordsize --with-buildrules=msvc ${1+"$@"}
+CC=cl CXX="cl -TP -GR" ./configure --disable-test-compare-images --enable-external-libs --enable-werror --with-buildrules=msvc ${1+"$@"}
diff --git a/configure b/configure
index 46d367a7..9cb10adc 100755
--- a/configure
+++ b/configure
@@ -651,6 +651,7 @@ QPDF_LARGE_FILE_TEST_PATH
WINDOWS_WMAIN_LINK
WINDOWS_WMAIN_COMPILE
WINDOWS_WORDSIZE
+IS_32BIT
RANDOM_DEVICE
LT_SONAME
LT_AGE
@@ -761,7 +762,6 @@ enable_os_secure_random
with_random
enable_avoid_windows_handle
enable_external_libs
-with_windows_wordsize
with_large_file_test_path
enable_largefile
enable_ld_version_script
@@ -1468,9 +1468,6 @@ Optional Packages:
--with-sysroot[=DIR] Search for dependent libraries within DIR (or the
compiler's sysroot if not specified).
--with-random=FILE Use FILE as random number seed [auto-detected]
- --with-windows-wordsize={32,64}
- Windows only: whether this is a 32-bit or 64-bit
- build; required if external-libs are enabled
--with-large-file-test-path=path
To enable testing of files > 4GB, give the path to a
directory with at least 11 GB free. The test suite
@@ -1960,6 +1957,189 @@ fi
} # ac_fn_cxx_try_link
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
+else
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=$ac_mid; break
+else
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+ ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+ fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
@@ -15836,25 +16016,48 @@ else
$as_echo "yes" >&6; }
fi
-WINDOWS_WORDSIZE=
-
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5
+$as_echo_n "checking size of size_t... " >&6; }
+if ${ac_cv_sizeof_size_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then :
-# Check whether --with-windows-wordsize was given.
-if test "${with_windows_wordsize+set}" = set; then :
- withval=$with_windows_wordsize; WINDOWS_WORDSIZE=$withval
else
- WINDOWS_WORDSIZE=none
+ if test "$ac_cv_type_size_t" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (size_t)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_size_t=0
+ fi
fi
-if test "$USE_EXTERNAL_LIBS" = "1"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows wordsize" >&5
-$as_echo_n "checking for windows wordsize... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDOWS_WORDSIZE" >&5
-$as_echo "$WINDOWS_WORDSIZE" >&6; }
- if ! test "$WINDOWS_WORDSIZE" = "32" -o "$WINDOWS_WORDSIZE" = "64"; then
- as_fn_error $? "Windows wordsize of 32 or 64 must be specified if external libs are being used." "$LINENO" 5
- fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5
+$as_echo "$ac_cv_sizeof_size_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
+_ACEOF
+
+
+if test "$ac_cv_sizeof_size_t" = "4"; then
+ IS_32BIT=1
+ WINDOWS_WORDSIZE=32
+else
+ IS_32BIT=0
+ WINDOWS_WORDSIZE=64
+fi
+
+
if test "$BUILD_INTERNAL_LIBS" = "0"; then
ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
diff --git a/configure.ac b/configure.ac
index 13db7395..9dba223f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,20 +123,16 @@ else
AC_MSG_RESULT(yes)
fi
-WINDOWS_WORDSIZE=
-AC_SUBST(WINDOWS_WORDSIZE)
-AC_ARG_WITH(windows-wordsize,
- AS_HELP_STRING([--with-windows-wordsize={32,64}],
- [Windows only: whether this is a 32-bit or 64-bit build; required if external-libs are enabled]),
- [WINDOWS_WORDSIZE=$withval],
- [WINDOWS_WORDSIZE=none])
-if test "$USE_EXTERNAL_LIBS" = "1"; then
- AC_MSG_CHECKING(for windows wordsize)
- AC_MSG_RESULT($WINDOWS_WORDSIZE)
- if ! test "$WINDOWS_WORDSIZE" = "32" -o "$WINDOWS_WORDSIZE" = "64"; then
- AC_MSG_ERROR(Windows wordsize of 32 or 64 must be specified if external libs are being used.)
- fi
+AC_CHECK_SIZEOF([size_t])
+if test "$ac_cv_sizeof_size_t" = "4"; then
+ IS_32BIT=1
+ WINDOWS_WORDSIZE=32
+else
+ IS_32BIT=0
+ WINDOWS_WORDSIZE=64
fi
+AC_SUBST(IS_32BIT)
+AC_SUBST(WINDOWS_WORDSIZE)
if test "$BUILD_INTERNAL_LIBS" = "0"; then
AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1])
diff --git a/libqpdf/qpdf/qpdf-config.h.in b/libqpdf/qpdf/qpdf-config.h.in
index e50a00b8..8d7f960c 100644
--- a/libqpdf/qpdf/qpdf-config.h.in
+++ b/libqpdf/qpdf/qpdf-config.h.in
@@ -69,6 +69,9 @@
/* Define to the filename of the random device (and set HAVE_RANDOM_DEVICE) */
#undef RANDOM_DEVICE
+/* The size of `size_t', as computed by sizeof. */
+#undef SIZEOF_SIZE_T
+
/* Whether to suppres use of OS-provided secure random numbers */
#undef SKIP_OS_SECURE_RANDOM