Skip to content

Commit 3d9b41e

Browse files
committed
build: add --enable-determinism configure flag
If used, this will enable additional compile / link time flags that will make subsequent builds of bitcoind determinisitic.
1 parent 4502ed7 commit 3d9b41e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

configure.ac

+13
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ AC_ARG_ENABLE([gprof],
262262
[enable_gprof=$enableval],
263263
[enable_gprof=no])
264264

265+
dnl Pass compiler & liner flags that make builds deterministic
266+
AC_ARG_ENABLE([determinism],
267+
[AS_HELP_STRING([--enable-determinism],
268+
[Enable compilation flags that make builds deterministic (default is no)])],
269+
[enable_determinism=$enableval],
270+
[enable_determinism=no])
271+
265272
dnl Turn warnings into errors
266273
AC_ARG_ENABLE([werror],
267274
[AS_HELP_STRING([--enable-werror],
@@ -764,6 +771,12 @@ if test x$TARGET_OS = xdarwin; then
764771
AX_CHECK_LINK_FLAG([[-Wl,-bind_at_load]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"])
765772
fi
766773

774+
if test x$enable_determinism = xyes; then
775+
if test x$TARGET_OS = xwindows; then
776+
AX_CHECK_LINK_FLAG([[-Wl,--no-insert-timestamp]], [LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"])
777+
fi
778+
fi
779+
767780
AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h sys/sysctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h])
768781

769782
dnl FD_ZERO may be dependent on a declaration of memcpy, e.g. in SmartOS

0 commit comments

Comments
 (0)