aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2020-03-05 09:08:34 +1000
committerSteve Bennett <steveb@workware.net.au>2020-03-05 22:38:34 +1000
commitbd7037fdd108729999cfb32a1304abd0eec1d1ad (patch)
tree17249b496cbcbe72d6e8238ddca83aed054f0810
parent2e8d9d5014cac46b9486a88307436f74a7a3784c (diff)
downloadjimtcl-bd7037fdd108729999cfb32a1304abd0eec1d1ad.zip
jimtcl-bd7037fdd108729999cfb32a1304abd0eec1d1ad.tar.gz
jimtcl-bd7037fdd108729999cfb32a1304abd0eec1d1ad.tar.bz2
build: Check for 32-bit time_t at configure time
To warn of Y2038 problems, and suggest use of -D__MINGW_USE_VC2005_COMPAT on mingw32. Do this instead of the previous runtime test. Add -D__MINGW_USE_VC2005_COMPAT to the appveyor build. Fixes msteveb/jimtcl#145 Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--appveyor.yml4
-rw-r--r--auto.def16
-rw-r--r--tests/clock.test5
3 files changed, 17 insertions, 8 deletions
diff --git a/appveyor.yml b/appveyor.yml
index c0c47f9..a3cac63 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,10 +1,10 @@
-version: "0.78.0.{build}"
+version: "0.79.0.{build}"
install:
- cmd: set MSYSTEM=MINGW32
- cmd: C:\msys64\usr\bin\bash -lc "pacman --sync --noconfirm make mingw-w64-i686-gcc mingw-w64-i686-sqlite3"
- cmd: cd C:\projects & mklink /D %APPVEYOR_PROJECT_NAME% %APPVEYOR_PROJECT_SLUG% & exit 0
build_script:
- - cmd: C:\msys64\usr\bin\bash -lc "cd /c/projects/jimtcl; ./configure --full --ssl --with-ext='sqlite3 win32 zlib' --disable-docs"
+ - cmd: C:\msys64\usr\bin\bash -lc "cd /c/projects/jimtcl; ./configure --full --ssl --with-ext='sqlite3 win32 zlib' --disable-docs CFLAGS=-D__MINGW_USE_VC2005_COMPAT"
- cmd: C:\msys64\usr\bin\bash -lc "cd /c/projects/jimtcl; make"
test_script:
- cmd: C:\msys64\usr\bin\bash -lc "cd /c/projects/jimtcl; make test"
diff --git a/auto.def b/auto.def
index 4cff73a..681c913 100644
--- a/auto.def
+++ b/auto.def
@@ -99,9 +99,14 @@ if {[cctest -cflags -fno-asynchronous-unwind-tables]} {
define-append CCOPTS -fno-asynchronous-unwind-tables
}
-cc-check-includes sys/time.h sys/socket.h netinet/in.h arpa/inet.h netdb.h
+cc-check-includes time.h sys/time.h sys/socket.h netinet/in.h arpa/inet.h netdb.h
cc-check-includes sys/un.h dlfcn.h unistd.h dirent.h crt_externs.h
+# Check sizeof time_t so we can warn on non-Y2038 compliance
+cc-with {-includes time.h} {
+ cc-check-sizeof time_t
+}
+
define LDLIBS ""
# Haiku needs -lnetwork, Solaris needs -lnsl
@@ -545,3 +550,12 @@ make-template build-jim-ext.in
make-template jimtcl.pc.in
catch {exec chmod +x build-jim-ext}
+
+# Finally produce any warnings
+if {[get-define SIZEOF_TIME_T] <= 4} {
+ set note ""
+ if {[have-feature windows]} {
+ set note ", consider CFLAGS=-D__MINGW_USE_VC2005_COMPAT on mingw32"
+ }
+ user-notice "Warning: sizeof(time_t) is [get-define SIZEOF_TIME_T] -- not Y2038 compliant$note"
+}
diff --git a/tests/clock.test b/tests/clock.test
index 3e9aec3..4e32df4 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -51,9 +51,4 @@ test clock-4.1 {clock scan tests} clockscan {
clock scan {Sun Nov 04 03:02:46 AM 1990} -format {%a %b %d %I:%M:%S %p %Y} -gmt true
} 657687766
-# This will fail on systems that are not Y2038 compliant
-test clock-5.1 {Year 2038 compliance} {
- clock format 2200000000 -format %Y-%m-%dT%H:%M:%S -gmt true
-} 2039-09-18T23:06:40
-
testreport