Add new configure option, --disable-timestamps, intended to turn off anything which would mess up binary/object comparisons. Currently:

- Disables 'Built on ...' in 'foo --version'.
 - Disables timestamps from being embedded into .dir files.

llvm-svn: 103423
This commit is contained in:
Daniel Dunbar 2010-05-10 20:11:56 +00:00
parent bf2fb95b7c
commit dac182450b
6 changed files with 62 additions and 4 deletions

View File

@ -270,6 +270,9 @@ ENABLE_SHARED := @ENABLE_SHARED@
# Use -fvisibility-inlines-hidden? # Use -fvisibility-inlines-hidden?
ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@ ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
# Do we want to allow timestamping information into builds?
ENABLE_TIMESTAMPS := @ENABLE_TIMESTAMPS@
# This option tells the Makefiles to produce verbose output. # This option tells the Makefiles to produce verbose output.
# It essentially prints the commands that make is executing # It essentially prints the commands that make is executing
#VERBOSE = 1 #VERBOSE = 1

View File

@ -447,6 +447,14 @@ else
endif endif
endif endif
# Support makefile variable to disable any kind of timestamp/non-deterministic
# info from being used in the build.
ifeq ($(ENABLE_TIMESTAMPS),1)
DOTDIR_TIMESTAMP_COMMAND := $(DATE)
else
DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
endif
ifeq ($(HOST_OS),MingW) ifeq ($(HOST_OS),MingW)
# Work around PR4957 # Work around PR4957
CPP.Defines += -D__NO_CTYPE_INLINE CPP.Defines += -D__NO_CTYPE_INLINE
@ -779,7 +787,7 @@ $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $
# To create other directories, as needed, and timestamp their creation # To create other directories, as needed, and timestamp their creation
%/.dir: %/.dir:
$(Verb) $(MKDIR) $* > /dev/null $(Verb) $(MKDIR) $* > /dev/null
$(Verb) $(DATE) > $@ $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir

View File

@ -525,6 +525,20 @@ case "$enableval" in
*) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;; *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
esac esac
dnl Enable embedding timestamp information into build.
AC_ARG_ENABLE(timestamps,
AS_HELP_STRING([--enable-timestamps],
[Enable embedding timestamp information in build (default is YES)]),,
enableval=default)
case "$enableval" in
yes) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
no) AC_SUBST(ENABLE_TIMESTAMPS,[0]) ;;
default) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
*) AC_MSG_ERROR([Invalid setting for --enable-timestamps. Use "yes" or "no"]) ;;
esac
AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS,
[Define if timestamp information (e.g., __DATE___) is allowed])
dnl Allow specific targets to be specified for building (or not) dnl Allow specific targets to be specified for building (or not)
TARGETS_TO_BUILD="" TARGETS_TO_BUILD=""
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets], AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],

34
llvm/configure vendored
View File

@ -690,6 +690,7 @@ ENABLE_DOXYGEN
ENABLE_THREADS ENABLE_THREADS
ENABLE_PIC ENABLE_PIC
ENABLE_SHARED ENABLE_SHARED
ENABLE_TIMESTAMPS
TARGETS_TO_BUILD TARGETS_TO_BUILD
LLVM_ENUM_TARGETS LLVM_ENUM_TARGETS
LLVM_ENUM_ASM_PRINTERS LLVM_ENUM_ASM_PRINTERS
@ -1410,6 +1411,8 @@ Optional Features:
is YES) is YES)
--enable-shared Build a shared library and link tools against it --enable-shared Build a shared library and link tools against it
(default is NO) (default is NO)
--enable-timestamps Enable embedding timestamp information in build
(default is YES)
--enable-targets Build specific host targets: all or --enable-targets Build specific host targets: all or
target1,target2,... Valid targets are: host, x86, target1,target2,... Valid targets are: host, x86,
x86_64, sparc, powerpc, alpha, arm, mips, spu, x86_64, sparc, powerpc, alpha, arm, mips, spu,
@ -4923,6 +4926,30 @@ echo "$as_me: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\""
{ (exit 1); exit 1; }; } ;; { (exit 1); exit 1; }; } ;;
esac esac
# Check whether --enable-timestamps was given.
if test "${enable_timestamps+set}" = set; then
enableval=$enable_timestamps;
else
enableval=default
fi
case "$enableval" in
yes) ENABLE_TIMESTAMPS=1
;;
no) ENABLE_TIMESTAMPS=0
;;
default) ENABLE_TIMESTAMPS=1
;;
*) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-timestamps. Use \"yes\" or \"no\"" >&5
echo "$as_me: error: Invalid setting for --enable-timestamps. Use \"yes\" or \"no\"" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
cat >>confdefs.h <<_ACEOF
#define ENABLE_TIMESTAMPS $ENABLE_TIMESTAMPS
_ACEOF
TARGETS_TO_BUILD="" TARGETS_TO_BUILD=""
# Check whether --enable-targets was given. # Check whether --enable-targets was given.
if test "${enable_targets+set}" = set; then if test "${enable_targets+set}" = set; then
@ -11357,7 +11384,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 11360 "configure" #line 11387 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -21167,6 +21194,7 @@ ENABLE_DOXYGEN!$ENABLE_DOXYGEN$ac_delim
ENABLE_THREADS!$ENABLE_THREADS$ac_delim ENABLE_THREADS!$ENABLE_THREADS$ac_delim
ENABLE_PIC!$ENABLE_PIC$ac_delim ENABLE_PIC!$ENABLE_PIC$ac_delim
ENABLE_SHARED!$ENABLE_SHARED$ac_delim ENABLE_SHARED!$ENABLE_SHARED$ac_delim
ENABLE_TIMESTAMPS!$ENABLE_TIMESTAMPS$ac_delim
TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim
LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim
LLVM_ENUM_ASM_PRINTERS!$LLVM_ENUM_ASM_PRINTERS$ac_delim LLVM_ENUM_ASM_PRINTERS!$LLVM_ENUM_ASM_PRINTERS$ac_delim
@ -21175,7 +21203,6 @@ LLVM_ENUM_DISASSEMBLERS!$LLVM_ENUM_DISASSEMBLERS$ac_delim
ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim
CLANGPATH!$CLANGPATH$ac_delim CLANGPATH!$CLANGPATH$ac_delim
CLANGXXPATH!$CLANGXXPATH$ac_delim CLANGXXPATH!$CLANGXXPATH$ac_delim
ENABLE_BUILT_CLANG!$ENABLE_BUILT_CLANG$ac_delim
_ACEOF _ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@ -21217,6 +21244,7 @@ _ACEOF
ac_delim='%!_!# ' ac_delim='%!_!# '
for ac_last_try in false false false false false :; do for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF cat >conf$$subs.sed <<_ACEOF
ENABLE_BUILT_CLANG!$ENABLE_BUILT_CLANG$ac_delim
OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
@ -21313,7 +21341,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF _ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 94; then if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then
break break
elif $ac_last_try; then elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -24,6 +24,9 @@
/* Define if threads enabled */ /* Define if threads enabled */
#undef ENABLE_THREADS #undef ENABLE_THREADS
/* Define if timestamp information (e.g., __DATE___) is allowed */
#undef ENABLE_TIMESTAMPS
/* Define to 1 if you have the `argz_append' function. */ /* Define to 1 if you have the `argz_append' function. */
#undef HAVE_ARGZ_APPEND #undef HAVE_ARGZ_APPEND

View File

@ -1170,7 +1170,9 @@ public:
std::string CPU = sys::getHostCPUName(); std::string CPU = sys::getHostCPUName();
if (CPU == "generic") CPU = "(unknown)"; if (CPU == "generic") CPU = "(unknown)";
OS << ".\n" OS << ".\n"
#if (ENABLE_TIMESTAMPS == 1)
<< " Built " << __DATE__ << " (" << __TIME__ << ").\n" << " Built " << __DATE__ << " (" << __TIME__ << ").\n"
#endif
<< " Host: " << sys::getHostTriple() << '\n' << " Host: " << sys::getHostTriple() << '\n'
<< " Host CPU: " << CPU << '\n' << " Host CPU: " << CPU << '\n'
<< '\n' << '\n'