summaryrefslogtreecommitdiffstats
path: root/patches/Python-2.6.2/0008-use-AC_CHECK_SIZEOF-rather-than-handcrafted-test-wit.patch
blob: decda4680a497084d593bd2b321e5c5dbb790d7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
From 648a7538c36f67696d88ee99ddccc2bc78a1ef75 Mon Sep 17 00:00:00 2001
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Fri, 24 Apr 2009 19:10:14 +0200
Subject: [PATCH] use AC_CHECK_SIZEOF rather than handcrafted test with AC_TRY_RUN

AC_TRY_RUN doesn't work in the cross compilation scenario. Recent
versions of autoconf support AC_CHECK_SIZEOF even while cross compiling.

This patch converts the following tests to AC_CHECK_SIZEOF:
- off_t
- time_t
- pthread_t

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 configure.in |   58 ++++------------------------------------------------------
 1 files changed, 4 insertions(+), 54 deletions(-)

diff --git a/configure.in b/configure.in
index aac9bd2..5135bd3 100644
--- a/configure.in
+++ b/configure.in
@@ -1385,23 +1385,9 @@ AC_CHECK_TYPES(uintptr_t,
         #endif])
 
 
-# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
-AC_MSG_CHECKING(size of off_t)
-AC_CACHE_VAL(ac_cv_sizeof_off_t,
-[AC_TRY_RUN([#include <stdio.h>
+AC_CHECK_SIZEOF([off_t],[],[
 #include <sys/types.h>
-main()
-{
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(off_t));
-  exit(0);
-}],
-ac_cv_sizeof_off_t=`cat conftestval`,
-ac_cv_sizeof_off_t=0,
-ac_cv_sizeof_off_t=4)
 ])
-AC_MSG_RESULT($ac_cv_sizeof_off_t)
 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
 [The number of bytes in an off_t.])
 
@@ -1420,22 +1406,9 @@ else
 fi
 
 # AC_CHECK_SIZEOF() doesn't include <time.h>.
-AC_MSG_CHECKING(size of time_t)
-AC_CACHE_VAL(ac_cv_sizeof_time_t,
-[AC_TRY_RUN([#include <stdio.h>
+AC_CHECK_SIZEOF([time_t],[],[
 #include <time.h>
-main()
-{
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(time_t));
-  exit(0);
-}],
-ac_cv_sizeof_time_t=`cat conftestval`,
-ac_cv_sizeof_time_t=0,
-ac_cv_sizeof_time_t=4)
 ])
-AC_MSG_RESULT($ac_cv_sizeof_time_t)
 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t, 
 [The number of bytes in a time_t.])
 
@@ -1449,32 +1422,9 @@ then CC="$CC -Kthread"
 elif test "$ac_cv_pthread" = "yes"
 then CC="$CC -pthread"
 fi
-AC_MSG_CHECKING(for pthread_t)
-have_pthread_t=no
-AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
-AC_MSG_RESULT($have_pthread_t)
-if test "$have_pthread_t" = yes ; then
-  # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
-  AC_MSG_CHECKING(size of pthread_t)
-  AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
-  [AC_TRY_RUN([#include <stdio.h>
+AC_CHECK_SIZEOF([pthread_t],[],[
 #include <pthread.h>
-  main()
-  {
-    FILE *f=fopen("conftestval", "w");
-    if (!f) exit(1);
-    fprintf(f, "%d\n", sizeof(pthread_t));
-    exit(0);
-  }],
-  ac_cv_sizeof_pthread_t=`cat conftestval`,
-  ac_cv_sizeof_pthread_t=0,
-  ac_cv_sizeof_pthread_t=4)
-  ])
-  AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
-  AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
-   [The number of bytes in a pthread_t.])
-fi
-CC="$ac_save_cc"
+])
 
 AC_MSG_CHECKING(for --enable-toolbox-glue)
 AC_ARG_ENABLE(toolbox-glue,
-- 
1.5.6.3