aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-configure-Fix-compoiler-detection-logic-for-cross-co.patch
blob: 718f8c19f16d26bfaefaf87c3ba65a8b02f19121 (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
From e1dcd27e816520bdabc69511d90c4a2ebc242831 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 6 Jan 2023 18:51:34 -0800
Subject: [PATCH] configure: Fix compoiler detection logic for
 cross-compilation

We can not run binaries during cross compile, so poke at compiler to
figure out if it is clang or gcc, for OE we do not have other compilers
in opensource world if there are we can extend this logic

Upstream-Status: Inappropriate [OE-Specific]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 configure | 56 ++++++++++++++++---------------------------------------
 1 file changed, 16 insertions(+), 40 deletions(-)

--- a/configure
+++ b/configure
@@ -661,48 +661,24 @@ if test "$PROFILE"; then
 fi
 
 printf "Finding suitable compiler........"
-if test ! -x "${CC}"; then
-	CC=`pathsearch "${CC:-cc}"`
-	if test -z "$CC" -o ! -x "$CC"; then
-		CC=`pathsearch "${CC:-gcc}"`
-	fi
+if test -z "$CC"; then
+  if test ! -x "${CC}"; then
+	  CC=`pathsearch "${CC:-cc}"`
+	  if test -z "$CC" -o ! -x "$CC"; then
+		  CC=`pathsearch "${CC:-gcc}"`
+	  fi
+  fi
+  assert "$CC" "not found"
+fi
+if `$CC --version | grep gcc > /dev/null 2>&1`; then
+  COMPILER=gcc
+elif `$CC --version | grep clang > /dev/null 2>&1`; then
+  COMPILER=clang
+else
+  COMPILER="not-found"
 fi
-assert "$CC" "not found"
-
-cat << EOF > .1.c
-#include <stdio.h>
-int main(void) {
-#if defined(_WIN32)
-#if defined(__MINGW64__)
-	puts("mingw64");
-	return (0);
-#elif defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION >= 3)
-	puts("mingw32");
-	return (0);
-#else
-	return (1);
-#endif /* __MINGW32__ && __MINGW32_MAJOR_VERSION >= 3 */
-#elif defined(__clang__) && (__clang_major__ >= 3)
-	puts("clang");
-	return (0);
-#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5110)
-	puts("suncc");
-	return (0);
-#elif defined(__GNUC__) && (__GNUC__ >= 4)
-	puts("gcc");
-	return (0);
-#else
-	return (1);
-#endif
-}
-EOF
-
-$CC -o .1 .1.c
-COMPILER=`./.1 2> /dev/null`
-r=$?
-rm -f .1.c .1
 
-if test "$r" -ne 0; then
+if test "$COMPILER" = "not-found"; then
 	assert "" "update compiler"
 else
 	echo "success [$CC]"