Skip to content

Commit

Permalink
Default to being year 2038 safe on 32-bit machines
Browse files Browse the repository at this point in the history
  • Loading branch information
rickard-green committed Feb 8, 2024
1 parent a7bc231 commit e0df83d
Show file tree
Hide file tree
Showing 23 changed files with 64 additions and 70 deletions.
64 changes: 21 additions & 43 deletions erts/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dnl autoconf convention that should be cleaned up.

AC_INIT
AC_CONFIG_SRCDIR([emulator/beam/erl_process.c])
AC_PREREQ([2.71])
AC_PREREQ([2.72])

m4_include([otp.m4])

Expand Down Expand Up @@ -423,6 +423,10 @@ AC_DEFINE_UNQUOTED(ERTS_NO_RETPOLINE, $i_noretpoline_attr,
*only* defined when --with-spectre-mitigation=incomplete
and has no effects otherwise])

# Remove old configuration information.
# Next line should be before first output to CONF_INFO.
rm -f "$ERL_TOP/erts/CONF_INFO"

dnl ----------------------------------------------------------------------
dnl Checks for programs.
dnl ----------------------------------------------------------------------
Expand Down Expand Up @@ -548,45 +552,24 @@ extra_flags="$ERTS_CONFIG_H_IDIR $OTP_EXTRA_FLAGS"
CFLAGS="$CFLAGS $extra_flags"
DEBUG_FLAGS=-g

# Large file support and 8-byte time_t by default
AC_SYS_YEAR2038

lfs_conf=ok
lfs_source=none
AS_IF([test "${LFS_CFLAGS+set}" = "set" || test "${LFS_LDFLAGS+set}" = "set" || test "${LFS_LIBS+set}" = "set"],
[
lfs_source=user
],
[
LM_CHECK_GETCONF
test "$GETCONF" = "false" || lfs_source=getconf
])
AC_CHECK_SIZEOF(time_t)

if test "$lfs_source" = "none"; then
AC_MSG_WARN([Do not know how to check for large file support flags; no getconf is available])
else
for var in CFLAGS LDFLAGS LIBS; do
AC_MSG_CHECKING([for large file support $var])
if test $lfs_source = user; then
eval "lfs_val=\"\$LFS_$var\""
else
eval "lfs_var=LFS_$var"
lfs_val=`$GETCONF $lfs_var 2>/dev/null` || lfs_conf=failed
if test $lfs_conf = failed; then
AC_MSG_RESULT([failed])
break
fi
eval "$lfs_var=\"$lfs_val\""
fi
test "$lfs_val" != "" || lfs_val=none
AC_MSG_RESULT([$lfs_val])
done
if test $lfs_conf = failed; then
AC_MSG_WARN([Check for large file support flags failed; $GETCONF failed])
else
CFLAGS="$CFLAGS $LFS_CFLAGS"
LDFLAGS="$LDFLAGS $LFS_LDFLAGS"
LIBS="$LIBS $LFS_LIBS"
fi
fi
AS_IF([test "$ac_cv_sizeof_time_t" != "8"],
[
test -f "$ERL_TOP/erts/CONF_INFO" || echo "" > "$ERL_TOP/erts/CONF_INFO"
cat >> $ERL_TOP/erts/CONF_INFO <<EOF
WARNING:
'configure' was not able to figure out how to
make the system year 2038 safe! This runtime
system will not be able to function properly
after mid-January 2038.
EOF
])

AS_IF([test "x$GCC" = xyes],
[
Expand Down Expand Up @@ -865,11 +848,6 @@ fi
_search_path=


# Remove old configuration information.
# Next line should be before first output to CONN_INFO. So this is
# just the right place.
rm -f "$ERL_TOP/erts/CONF_INFO"

dnl Check if we should/can build a sharing-preserving emulator
AC_MSG_CHECKING(if we are building a sharing-preserving emulator)
if test "$enable_sharing_preserving" = "yes"; then
Expand Down
13 changes: 13 additions & 0 deletions erts/include/internal/ethread_header_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,16 @@

/* Define if pthread_cond_timedwait() can be used with a monotonic clock */
#undef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC

/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

/* Define to 1 on platforms where this makes off_t a 64-bit type. */
#undef _LARGE_FILES

/* Number of bits in time_t, on hosts where this is settable. */
#undef _TIME_BITS

/* Define to 1 on platforms where this makes time_t a 64-bit type. */
#undef __MINGW_USE_VC2005_COMPAT

5 changes: 4 additions & 1 deletion lib/common_test/test_server/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dnl

AC_INIT
AC_CONFIG_SRCDIR([conf_vars.in])
AC_PREREQ([2.71])
AC_PREREQ([2.72])

AC_CANONICAL_HOST

Expand Down Expand Up @@ -70,6 +70,9 @@ if test X${enable_m32_build} = Xyes; then
LDFLAGS="-m32 $LDFLAGS"
fi

# Large file support and 8-byte time_t by default
AC_SYS_YEAR2038

AC_CHECK_LIB(m, sin)

#--------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/crypto/c_src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ LD = @DED_LD@
SHELL = /bin/sh
LIBS = @DED_LIBS@
LDFLAGS += @DED_LDFLAGS@
CFLAGS = @DED_CFLAGS@ @SSL_FLAGS@
CFLAGS = @DED_CFLAGS@ @SSL_FLAGS@ @DEFS@

# From configure
SSL_LIBDIR = @SSL_LIBDIR@
Expand Down
2 changes: 1 addition & 1 deletion lib/crypto/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dnl define([AC_CACHE_SAVE], )dnl

AC_INIT
AC_CONFIG_SRCDIR([vsn.mk])
AC_PREREQ([2.71])
AC_PREREQ([2.72])

m4_include([otp.m4])

Expand Down
8 changes: 4 additions & 4 deletions lib/erl_interface/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dnl m4_define(EI_VERSION,regexp(m4_include(VERSION),[version \([-.0-9A-Za-z]+\)]

AC_INIT
AC_CONFIG_SRCDIR([include/ei.h])
AC_PREREQ([2.71])
AC_PREREQ([2.72])

m4_include([otp.m4])

Expand Down Expand Up @@ -105,6 +105,9 @@ AC_CHECK_PROGS(LD, ld.sh)
AC_CHECK_TOOL(LD, ld, '$(CC)')
AC_SUBST(LD)

ERL_DED_FLAT_BUNDLE=true
ERL_DED_FLAGS

AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
Expand Down Expand Up @@ -356,9 +359,6 @@ else
fi
fi

ERL_DED_FLAT_BUNDLE=true
ERL_DED_FLAGS

# ---------------------------------------------------------------------------
# XXX
# ---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ endif

WARNFLAGS += -DEI_NO_DEPR_WARN

CFLAGS = @DED_CFLAGS@ $(WARNFLAGS) $(INCFLAGS) $(TYPE_FLAGS) \
CFLAGS = @DED_CFLAGS@ @DEFS@ $(WARNFLAGS) $(INCFLAGS) $(TYPE_FLAGS) \
-DERLANG_OPENSSL_INTEGRATION
DED_LD = @DED_LD@
DED_LDFLAGS = @DED_LDFLAGS@
Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LIBPATH = @erl_interface_libpath@
LIBERL = $(LIBPATH)/@erl_interface_lib@
LIBEI = $(LIBPATH)/@erl_interface_eilib@
LIBFLAGS = $(LIBERL) $(LIBEI)
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../common
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../common

ETERM_OBJS = eterm_test@obj@ eterm_test_decl@obj@ runner@obj@
EXT_OBJS = ext_test@obj@ ext_test_decl@obj@ runner@obj@
Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/all_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include @erl_interface_mk_include@
CC0 = @CC@
CC = .@DS@gccifier@exe@ -CC"$(CC0)"
CFLAGS0 = @CFLAGS@ -I@erl_interface_include@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@
EI_COMMON_OBJS = runner@obj@ ei_runner@obj@ my_ussi@obj@
ALL_OBJS = gccifier@exe@ $(EI_COMMON_OBJS)

Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/ei_accept_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
../all_SUITE_data/my_ussi@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_ACCEPT_OBJS = ei_accept_test@obj@ ei_accept_test_decl@obj@
EIACCNODE_OBJS = eiaccnode@obj@

Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LIBEI = @erl_interface_eilib@
LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_CONNECT_OBJS = ei_connect_test@obj@ ei_connect_test_decl@obj@
EINODE_OBJS = einode@obj@

Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/ei_decode_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LIBEI = @erl_interface_eilib@
LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_DECODE_OBJS = ei_decode_test@obj@ ei_decode_test_decl@obj@

all: ei_decode_test@exe@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LIBEI = @erl_interface_eilib@
LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_DECODE_ENCODE_OBJS = ei_decode_encode_test@obj@ ei_decode_encode_test_decl@obj@

all: ei_decode_encode_test@exe@
Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/ei_encode_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LIBEI = @erl_interface_eilib@
LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_ENCODE_OBJS = ei_encode_test@obj@ ei_encode_test_decl@obj@

all: ei_encode_test@exe@
Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/ei_format_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LIBEI = @erl_interface_eilib@
LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_FORMAT_OBJS = ei_format_test@obj@ ei_format_test_decl@obj@

all: ei_format_test@exe@
Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/ei_global_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LIBEI = @erl_interface_eilib@
LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_GLOBAL_OBJS = ei_global_test@obj@ ei_global_test_decl@obj@

all: ei_global_test@exe@
Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/ei_print_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LIBEI = @erl_interface_eilib@
LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_PRINT_OBJS = ei_print_test@obj@ ei_print_test_decl@obj@

all: ei_print_test@exe@
Expand Down
2 changes: 1 addition & 1 deletion lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
../all_SUITE_data/my_ussi@obj@ \
$(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) @DEFS@ -I@erl_interface_include@ -I../all_SUITE_data
EI_TMO_OBJS = ei_tmo_test@obj@ ei_tmo_test_decl@obj@

all: ei_tmo_test@exe@
Expand Down
2 changes: 1 addition & 1 deletion lib/megaco/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dnl define([AC_CACHE_SAVE], )dnl

AC_INIT
AC_CONFIG_SRCDIR([vsn.mk])
AC_PREREQ([2.71])
AC_PREREQ([2.72])

m4_include([otp.m4])

Expand Down
2 changes: 1 addition & 1 deletion lib/megaco/src/flex/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ VSN=$(MEGACO_VSN)

FLEX_VSN = $(shell flex --version)

TMP_CFLAGS = @DED_BASIC_CFLAGS@ @OTP_EXTRA_FLAGS@
TMP_CFLAGS = @DED_BASIC_CFLAGS@ @DEFS@ @OTP_EXTRA_FLAGS@
ifeq ($(TYPE),valgrind)
CFLAGS = $(subst -O2, , $(TMP_CFLAGS)) -DVALGRIND
else
Expand Down
6 changes: 3 additions & 3 deletions make/autoconf/otp.m4
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ AC_ARG_VAR(LIBS, [libraries])
AC_ARG_VAR(DED_LD, [linker for Dynamic Erlang Drivers (set all DED_LD* variables or none)])
AC_ARG_VAR(DED_LDFLAGS, [linker flags for Dynamic Erlang Drivers (set all DED_LD* variables or none)])
AC_ARG_VAR(DED_LD_FLAG_RUNTIME_LIBRARY_PATH, [runtime library path linker flag for Dynamic Erlang Drivers (set all DED_LD* variables or none)])
AC_ARG_VAR(LFS_CFLAGS, [large file support C compiler flags (set all LFS_* variables or none)])
AC_ARG_VAR(LFS_LDFLAGS, [large file support linker flags (set all LFS_* variables or none)])
AC_ARG_VAR(LFS_LIBS, [large file support libraries (set all LFS_* variables or none)])
AC_ARG_VAR(RANLIB, [ranlib])
AC_ARG_VAR(AR, [ar])
AC_ARG_VAR(GETCONF, [getconf])
Expand Down Expand Up @@ -3069,6 +3066,9 @@ ERL_DED_FLAGS
AC_DEFUN(ERL_DED_FLAGS,
[
# Large file support and 8-byte time_t by default
AC_SYS_YEAR2038
USER_LD=$LD
USER_LDFLAGS="$LDFLAGS"
Expand Down
2 changes: 1 addition & 1 deletion make/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dnl limitations under the License.
dnl
dnl %CopyrightEnd%

AC_PREREQ([2.71])dnl
AC_PREREQ([2.72])dnl

AC_INIT

Expand Down
4 changes: 2 additions & 2 deletions make/otp_ded.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ DED_CC = @DED_CC@
DED_GCC = @DED_GCC@
DED_LD = @DED_LD@
DED_LDFLAGS = @DED_LDFLAGS@
DED_BASIC_CFLAGS = @DED_CFLAGS@
DED_BASIC_CFLAGS = @DED_BASIC_CFLAGS@ @DEFS@
DED_THR_DEFS = @DED_THR_DEFS@
DED_WERRORFLAGS = @DED_WERRORFLAGS@
DED_WARN_FLAGS = @DED_WARN_FLAGS@
DED_CFLAGS = @DED_CFLAGS@
DED_CFLAGS = @DED_CFLAGS@ @DEFS@
DED_LD_FLAG_RUNTIME_LIBRARY_PATH = @DED_LD_FLAG_RUNTIME_LIBRARY_PATH@
DED_STATIC_CFLAGS = @DED_STATIC_CFLAGS@
DED_LIBS = @DED_LIBS@
Expand Down

0 comments on commit e0df83d

Please sign in to comment.