mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-22 22:58:33 +00:00
configure: determine wordsize automatically
Based on sizeof(size_t). Assumes 64 if not 32.
This commit is contained in:
parent
f562d494b0
commit
2155815234
@ -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.
|
||||
|
@ -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@
|
||||
|
@ -1,4 +1,4 @@
|
||||
d6ab690ff0a692fae861cf77ede19245aa2e60bff561846085473ad7060df157 configure.ac
|
||||
585322e3ca6c33acd1d8e3eb3da767c964e93f6fbeb0cf0d2c0cd11bb0b0a445 configure.ac
|
||||
35bc5c645dc42d47f2daeea06f8f3e767c8a1aee6a35eb2b4854fd2ce66c3413 m4/ax_random_device.m4
|
||||
37f8897d5f68d7d484e5457832a8f190ddb7507fa2a467cb7ee2be40a4364643 m4/libtool.m4
|
||||
e77ebba8361b36f14b4d0927173a034b98c5d05049697a9ded84d85eb99a7990 m4/ltoptions.m4
|
||||
|
@ -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
|
||||
|
@ -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+"$@"}
|
||||
|
@ -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+"$@"}
|
||||
|
239
configure
vendored
239
configure
vendored
@ -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,26 +16016,49 @@ else
|
||||
$as_echo "yes" >&6; }
|
||||
fi
|
||||
|
||||
WINDOWS_WORDSIZE=
|
||||
|
||||
|
||||
# Check whether --with-windows-wordsize was given.
|
||||
if test "${with_windows_wordsize+set}" = set; then :
|
||||
withval=$with_windows_wordsize; WINDOWS_WORDSIZE=$withval
|
||||
# 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
|
||||
WINDOWS_WORDSIZE=none
|
||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then :
|
||||
|
||||
else
|
||||
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
|
||||
{ $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"
|
||||
if test "x$ac_cv_header_zlib_h" = xyes; then :
|
||||
|
22
configure.ac
22
configure.ac
@ -123,20 +123,16 @@ else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
|
||||
WINDOWS_WORDSIZE=
|
||||
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)
|
||||
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
|
||||
fi
|
||||
|
||||
if test "$BUILD_INTERNAL_LIBS" = "0"; then
|
||||
AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1])
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user