blob: b021d0b7271124568e7cc6275bf76954478902da [file] [log] [blame]
Andrew Geissler7f40b712020-05-15 14:09:53 -05001Subject: [PATCH] Revert "SConstruct: Add test for sizeof(time_t), result in
2 SIZEOF_TIME_T."
3
4This reverts commit b32ff1a86c44fa738dabaf63de1b5462e0071ad3.
5
6Upstream-Status: Inappropriate [cross-compile specific]
7
8---
9 SConstruct | 54 ++++--------------------------------------
10 android/gpsd_config.in | 1 -
11 2 files changed, 5 insertions(+), 50 deletions(-)
12
13diff --git a/SConstruct b/SConstruct
14index 33e0ff326..e3c62fa3c 100644
15--- a/SConstruct
16+++ b/SConstruct
17@@ -597,42 +597,6 @@ def CheckHeaderDefines(context, file, define):
18 return ret
19
20
21-def CheckSizeOf(context, type):
22- """Check sizeof 'type'"""
23- context.Message('Checking size of ' + type + '... ')
24-
25- program = """
26-#include <stdlib.h>
27-#include <stdio.h>
28-
29-/*
30- * The CheckSizeOf function does not have a way for the caller to
31- * specify header files to be included to provide the type being
32- * checked. As a workaround until that is remedied, include the
33- * header required for time_t, which is the sole current use of this
34- * function.
35- */
36-#include <time.h>
37-
38-int main() {
39- printf("%d", (int)sizeof(""" + type + """));
40- return 0;
41-}
42-"""
43-
44- # compile it
45- ret = context.TryCompile(program, '.c')
46- if 0 == ret:
47- announce('ERROR: TryCompile failed\n')
48- # fall back to sizeof(time_t) is 8
49- return '8'
50-
51- # run it
52- ret = context.TryRun(program, '.c')
53- context.Result(ret[0])
54- return ret[1]
55-
56-
57 def CheckCompilerDefines(context, define):
58 context.Message('Checking if compiler supplies %s... ' % (define,))
59 ret = context.TryLink("""
60@@ -703,15 +667,13 @@ env.Prepend(LIBPATH=[os.path.realpath(os.curdir)])
61
62 # CheckXsltproc works, but result is incorrectly saved as "no"
63 config = Configure(env, custom_tests={
64- 'CheckC11': CheckC11,
65- 'CheckCompilerDefines': CheckCompilerDefines,
66- 'CheckCompilerOption': CheckCompilerOption,
67- 'CheckHeaderDefines': CheckHeaderDefines,
68 'CheckPKG': CheckPKG,
69- 'CheckSizeOf': CheckSizeOf,
70 'CheckXsltproc': CheckXsltproc,
71- 'GetPythonValue': GetPythonValue,
72- })
73+ 'CheckCompilerOption': CheckCompilerOption,
74+ 'CheckCompilerDefines': CheckCompilerDefines,
75+ 'CheckC11': CheckC11,
76+ 'CheckHeaderDefines': CheckHeaderDefines,
77+ 'GetPythonValue': GetPythonValue})
78
79 # Use print, rather than announce, so we see it in -s mode.
80 print("This system is: %s" % sys.platform)
81@@ -1043,12 +1005,6 @@ else:
82 confdefs.append("/* #undef HAVE_%s_H */\n"
83 % hdr.replace("/", "_").upper())
84
85- sizeof_time_t = config.CheckSizeOf("time_t")
86- confdefs.append("#define SIZEOF_TIME_T %s\n" % sizeof_time_t)
87- announce("sizeof(time_t) is %s" % sizeof_time_t)
88- if 4 >= int(sizeof_time_t):
89- announce("WARNING: time_t is too small. It will fail in 2038")
90-
91 # check function after libraries, because some function require libraries
92 # for example clock_gettime() require librt on Linux glibc < 2.17
93 for f in ("cfmakeraw", "clock_gettime", "daemon", "fcntl", "fork",
94diff --git a/android/gpsd_config.in b/android/gpsd_config.in
95index 758251986..d240f6d34 100644
96--- a/android/gpsd_config.in
97+++ b/android/gpsd_config.in
98@@ -19,7 +19,6 @@
99 #define HAVE_ARPA_INET_H 1
100 #define HAVE_SYSLOG_H 1
101 #define HAVE_DAEMON 1
102-#define SIZEOF_TIME_T 8
103 #define HAVE_CLOCK_GETTIME 1
104 #define HAVE_STRPTIME 1
105 #define HAVE_GMTIME_R 1
106--
1072.26.2
108