forked from wolfSSL/wolfssl
configure.ac: add --enable-reproducible-build: put ar and ranlib in deterministic mode, and leave LIBWOLFSSL_CONFIGURE_ARGS and LIBWOLFSSL_GLOBAL_CFLAGS out of the generated config.h. relates to PR #3417 .
This commit is contained in:
37
configure.ac
37
configure.ac
@@ -14,9 +14,30 @@ AC_CONFIG_AUX_DIR([build-aux])
|
|||||||
# want the default "-g -O2" that AC_PROG_CC sets automatically.
|
# want the default "-g -O2" that AC_PROG_CC sets automatically.
|
||||||
: ${CFLAGS=""}
|
: ${CFLAGS=""}
|
||||||
|
|
||||||
# Test ar for the "U" option. Should be checked before the libtool macros.
|
# For reproducible builds, gate out from the build anything that might
|
||||||
|
# introduce semantically frivolous jitter, maximizing chance of
|
||||||
|
# identical object files.
|
||||||
|
AC_ARG_ENABLE([reproducible-build],
|
||||||
|
[AS_HELP_STRING([--enable-reproducible-builds],[Enable maximally reproducible build (default: disabled)])],
|
||||||
|
[ ENABLED_REPRODUCIBLE_BUILD=$enableval ],
|
||||||
|
[ ENABLED_REPRODUCIBLE_BUILD=no ]
|
||||||
|
)
|
||||||
|
|
||||||
|
# Test ar for the "U" or "D" options. Should be checked before the libtool macros.
|
||||||
xxx_ar_flags=$(ar --help 2>&1)
|
xxx_ar_flags=$(ar --help 2>&1)
|
||||||
AS_CASE([$xxx_ar_flags],[*'use actual timestamps and uids/gids'*],[: ${AR_FLAGS="Ucru"}])
|
if test "$ENABLED_REPRODUCIBLE_BUILD" = "yes"
|
||||||
|
then
|
||||||
|
AS_CASE([$xxx_ar_flags],[*'use zero for timestamps and uids/gids'*],[: ${AR_FLAGS="Dcr"}])
|
||||||
|
else
|
||||||
|
AS_CASE([$xxx_ar_flags],[*'use actual timestamps and uids/gids'*],[: ${AR_FLAGS="Ucru"}])
|
||||||
|
fi
|
||||||
|
xxx_ranlib_flags=$(ranlib --help 2>&1)
|
||||||
|
if test "$ENABLED_REPRODUCIBLE_BUILD" = "yes"
|
||||||
|
then
|
||||||
|
AS_CASE([$xxx_ranlib_flags],[*'Use zero for symbol map timestamp'*],[: ${RANLIB="ranlib -D"}])
|
||||||
|
else
|
||||||
|
AS_CASE([$xxx_ranlib_flags],[*'Use actual symbol map timestamp'*],[: ${RANLIB="ranlib -U"}])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
@@ -6329,6 +6350,7 @@ echo " * OpenSSL Coexist: $ENABLED_OPENSSLCOEXIST"
|
|||||||
echo " * Old Names: $ENABLED_OLDNAMES"
|
echo " * Old Names: $ENABLED_OLDNAMES"
|
||||||
echo " * Max Strength Build: $ENABLED_MAXSTRENGTH"
|
echo " * Max Strength Build: $ENABLED_MAXSTRENGTH"
|
||||||
echo " * Distro Build: $ENABLED_DISTRO"
|
echo " * Distro Build: $ENABLED_DISTRO"
|
||||||
|
echo " * Reproducible Build: $ENABLED_REPRODUCIBLE_BUILD"
|
||||||
echo " * fastmath: $ENABLED_FASTMATH"
|
echo " * fastmath: $ENABLED_FASTMATH"
|
||||||
echo " * Assembly Allowed: $ENABLED_ASM"
|
echo " * Assembly Allowed: $ENABLED_ASM"
|
||||||
echo " * sniffer: $ENABLED_SNIFFER"
|
echo " * sniffer: $ENABLED_SNIFFER"
|
||||||
@@ -6489,10 +6511,13 @@ echo " * Crypto callbacks: $ENABLED_CRYPTOCB"
|
|||||||
echo ""
|
echo ""
|
||||||
echo "---"
|
echo "---"
|
||||||
|
|
||||||
echo >> config.h
|
if test "$ENABLED_REPRODUCIBLE_BUILD" != "yes"
|
||||||
echo "#define LIBWOLFSSL_CONFIGURE_ARGS \"$ac_configure_args\"" >> config.h
|
then
|
||||||
echo >> config.h
|
echo >> config.h
|
||||||
echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS\"" >> config.h
|
echo "#define LIBWOLFSSL_CONFIGURE_ARGS \"$ac_configure_args\"" >> config.h
|
||||||
|
echo >> config.h
|
||||||
|
echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS\"" >> config.h
|
||||||
|
fi
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Show warnings at bottom so they are noticed
|
# Show warnings at bottom so they are noticed
|
||||||
|
Reference in New Issue
Block a user