aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/openjdk/patches-openjdk-8/openjdk8-find-compiler-fix-env-respect.patch
blob: 91d258dc099a0846532a102cfde3d3adab82f1d9 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
--- common/autoconf/toolchain.m4.orig
+++ common/autoconf/toolchain.m4
@@ -77,7 +77,7 @@ AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSI
 # $2 = human readable name of compiler (C or C++)
 AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION],
 [
-  COMPILER=[$]$1
+  COMPILER="[$]$1"
   COMPILER_NAME=$2
 
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
@@ -174,64 +174,37 @@ AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
 [
   COMPILER_NAME=$2
 
-  $1=
+  FOUND_$1=
+
+  if test "x[$]$1" != "x"; then
+    FOUND_$1="[$]$1"
+  fi
+
   # If TOOLS_DIR is set, check for all compiler names in there first
   # before checking the rest of the PATH.
-  if test -n "$TOOLS_DIR"; then
+  if test "x[$]FOUND_$1" = x -a -n "$TOOLS_DIR"; then
     PATH_save="$PATH"
     PATH="$TOOLS_DIR"
     AC_PATH_PROGS(TOOLS_DIR_$1, $3)
-    $1=$TOOLS_DIR_$1
+    FOUND_$1=$TOOLS_DIR_$1
     PATH="$PATH_save"
   fi
 
   # AC_PATH_PROGS can't be run multiple times with the same variable,
   # so create a new name for this run.
-  if test "x[$]$1" = x; then
+  if test "x[$]FOUND_$1" = x; then
     AC_PATH_PROGS(POTENTIAL_$1, $3)
-    $1=$POTENTIAL_$1
+    FOUND_$1=$POTENTIAL_$1
   fi
 
-  if test "x[$]$1" = x; then
+  if test "x[$]FOUND_$1" = x; then
     HELP_MSG_MISSING_DEPENDENCY([devkit])
     AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
   fi
-  BASIC_FIXUP_EXECUTABLE($1)
-  TEST_COMPILER="[$]$1"
-  # Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links
-  # to 'xlc' but it is crucial that we invoke the compiler with the right name!
-  if test "x$OPENJDK_BUILD_OS" != xaix; then
-    AC_MSG_CHECKING([resolved symbolic links for $1])
-    BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
-    AC_MSG_RESULT([$TEST_COMPILER])
-  fi
-  AC_MSG_CHECKING([if $1 is disguised ccache])
-
-  COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
-  if test "x$COMPILER_BASENAME" = "xccache"; then
-    AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
-    # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
-    # We want to control ccache invocation ourselves, so ignore this cc and try
-    # searching again.
-
-    # Remove the path to the fake ccache cc from the PATH
-    RETRY_COMPILER_SAVED_PATH="$PATH"
-    COMPILER_DIRNAME=`$DIRNAME [$]$1`
-    PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
-
-    # Try again looking for our compiler
-    AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
-    BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
-    PATH="$RETRY_COMPILER_SAVED_PATH"
-
-    AC_MSG_CHECKING([for resolved symbolic links for $1])
-    BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
-    AC_MSG_RESULT([$PROPER_COMPILER_$1])
-    $1="$PROPER_COMPILER_$1"
-  else
-    AC_MSG_RESULT([no, keeping $1])
-    $1="$TEST_COMPILER"
-  fi
+  BASIC_FIXUP_EXECUTABLE(FOUND_$1)
+  TEST_COMPILER="[$]FOUND_$1"
+
+  $1="$TEST_COMPILER"
   TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME])
 ])
 
@@ -265,12 +238,12 @@ AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
     # otherwise we might pick up cross-compilers which don't use standard naming.
     # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
     # to wait until they are properly discovered.
-    AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
-    BASIC_FIXUP_EXECUTABLE(BUILD_CC)
-    AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
-    BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
-    AC_PATH_PROG(BUILD_LD, ld)
-    BASIC_FIXUP_EXECUTABLE(BUILD_LD)
+    AS_IF([test "x${BUILD_CC}" = "x"], [AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
+    BASIC_FIXUP_EXECUTABLE(BUILD_CC)])
+    AS_IF([test "x${BUILD_CXX}" = "x"], [AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
+    BASIC_FIXUP_EXECUTABLE(BUILD_CXX)])
+    AS_IF([test "x${BUILD_LD}" = "x"], [AC_PATH_PROG(BUILD_LD, ld)
+    BASIC_FIXUP_EXECUTABLE(BUILD_LD)])
   fi
   AC_SUBST(BUILD_CC)
   AC_SUBST(BUILD_CXX)
--- common/autoconf/basics.m4.orig
+++ common/autoconf/basics.m4
@@ -171,8 +171,15 @@ AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS],
       fi
     fi
 
+    # First separate the path from the arguments. This will split at the first
+    # space.
+    complete="[$]$1"
+    path="${complete%% *}"
+    tmp="$complete EOL"
+    arguments="${tmp#* }"
+
     if test "x$READLINK" != x; then
-      $1=`$READLINK -f [$]$1`
+      new_path=`$READLINK -f $path`
     else
       # Save the current directory for restoring afterwards
       STARTDIR=$PWD
@@ -198,8 +205,9 @@ AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS],
         let COUNTER=COUNTER+1
       done
       cd $STARTDIR
-      $1=$sym_link_dir/$sym_link_file
+      new_path=$sym_link_dir/$sym_link_file
     fi
+    $1="$new_path ${arguments% *}"
   fi
 ])