32 if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then |
32 if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then |
33 $2="[$]$2 $1" |
33 $2="[$]$2 $1" |
34 fi |
34 fi |
35 ]) |
35 ]) |
36 |
36 |
37 AC_DEFUN([SET_FULL_PATH], |
37 # This will make sure the given variable points to a full and proper |
38 [ |
38 # path. This means: |
39 # Translate "gcc -E" into "`which gcc` -E" ie |
39 # 1) There will be no spaces in the path. On posix platforms, |
40 # extract the full path to the binary and at the |
40 # spaces in the path will result in an error. On Windows, |
41 # same time maintain any arguments passed to it. |
41 # the path will be rewritten using short-style to be space-free. |
42 # The command MUST exist in the path, or else! |
42 # 2) The path will be absolute, and it will be in unix-style (on |
43 tmp="[$]$1" |
43 # cygwin). |
44 car="${tmp%% *}" |
44 # $1: The name of the variable to fix |
45 tmp="[$]$1 EOL" |
45 AC_DEFUN([BASIC_FIXUP_PATH], |
46 cdr="${tmp#* }" |
46 [ |
47 # On windows we want paths without spaces. |
47 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then |
48 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then |
48 BASIC_FIXUP_PATH_CYGWIN($1) |
49 SET_FULL_PATH_SPACESAFE(car) |
49 elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then |
50 else |
50 BASIC_FIXUP_PATH_MSYS($1) |
51 # "which" is not portable, but is used here |
51 else |
52 # because we know that the command exists! |
52 # We're on a posix platform. Hooray! :) |
53 car=`which $car` |
53 path="[$]$1" |
54 fi |
54 |
55 if test "x$cdr" != xEOL; then |
55 if test ! -f "$path" && test ! -d "$path"; then |
56 $1="$car ${cdr% *}" |
56 AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.]) |
57 else |
57 fi |
58 $1="$car" |
58 |
59 fi |
59 has_space=`$ECHO "$path" | $GREP " "` |
60 ]) |
60 if test "x$has_space" != x; then |
61 |
61 AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.]) |
62 AC_DEFUN([SPACESAFE], |
62 AC_MSG_ERROR([Spaces are not allowed in this path.]) |
63 [ |
63 fi |
64 # Fail with message $2 if var $1 contains a path with no spaces in it. |
64 fi |
65 # Unless on Windows, where we can rewrite the path. |
65 ]) |
66 HAS_SPACE=`echo "[$]$1" | grep " "` |
66 |
67 if test "x$HAS_SPACE" != x; then |
67 # This will make sure the given variable points to a executable |
68 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then |
68 # with a full and proper path. This means: |
69 # First convert it to DOS-style, short mode (no spaces) |
69 # 1) There will be no spaces in the path. On posix platforms, |
70 $1=`$CYGPATH -s -m -a "[$]$1"` |
70 # spaces in the path will result in an error. On Windows, |
71 # Now it's case insensitive; let's make it lowercase to improve readability |
71 # the path will be rewritten using short-style to be space-free. |
72 $1=`$ECHO "[$]$1" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'` |
72 # 2) The path will be absolute, and it will be in unix-style (on |
73 # Now convert it back to Unix-stile (cygpath) |
73 # cygwin). |
74 $1=`$CYGPATH -u "[$]$1"` |
74 # Any arguments given to the executable is preserved. |
75 else |
75 # If the input variable does not have a directory specification, then |
76 AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"]) |
76 # it need to be in the PATH. |
|
77 # $1: The name of the variable to fix |
|
78 AC_DEFUN([BASIC_FIXUP_EXECUTABLE], |
|
79 [ |
|
80 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then |
|
81 BASIC_FIXUP_EXECUTABLE_CYGWIN($1) |
|
82 elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then |
|
83 BASIC_FIXUP_EXECUTABLE_MSYS($1) |
|
84 else |
|
85 # We're on a posix platform. Hooray! :) |
|
86 # First separate the path from the arguments. This will split at the first |
|
87 # space. |
|
88 complete="[$]$1" |
|
89 path="${complete%% *}" |
|
90 tmp="$complete EOL" |
|
91 arguments="${tmp#* }" |
|
92 |
|
93 new_path=`$WHICH $path 2> /dev/null` |
|
94 if test "x$new_path" = x; then |
|
95 is_absolute_path=`$ECHO "$path" | $GREP ^/` |
|
96 if test "x$is_absolute_path" != x; then |
|
97 AC_MSG_NOTICE([Resolving $1 (as $path) with 'which' failed, using $path directly.]) |
|
98 new_path="$path" |
|
99 else |
|
100 AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) |
|
101 has_space=`$ECHO "$complete" | $GREP " "` |
|
102 if test "x$has_space" != x; then |
|
103 AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.]) |
77 fi |
104 fi |
78 fi |
105 AC_MSG_ERROR([Cannot locate the the path of $1]) |
79 ]) |
106 fi |
80 |
107 fi |
81 AC_DEFUN([SET_FULL_PATH_SPACESAFE], |
108 fi |
82 [ |
109 |
83 # Translate long cygdrive or C:\sdfsf path |
110 # Now join together the path and the arguments once again |
84 # into a short mixed mode path that has no |
111 if test "x$arguments" != xEOL; then |
85 # spaces in it. |
112 new_complete="$new_path ${arguments% *}" |
86 tmp="[$]$1" |
113 else |
87 |
114 new_complete="$new_path" |
88 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then |
115 fi |
89 tmp=`$CYGPATH -u "[$]$1"` |
116 |
90 tmp=`which "$tmp"` |
117 if test "x$complete" != "x$new_complete"; then |
91 # If file exists with .exe appended, that's the real filename |
118 $1="$new_complete" |
92 # and cygpath needs that to convert to short style path. |
119 AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) |
93 if test -f "${tmp}.exe"; then |
120 fi |
94 tmp="${tmp}.exe" |
121 ]) |
95 elif test -f "${tmp}.cmd"; then |
122 |
96 tmp="${tmp}.cmd" |
123 AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS], |
97 fi |
|
98 # Convert to C:/ mixed style path without spaces. |
|
99 tmp=`$CYGPATH -s -m "$tmp"` |
|
100 fi |
|
101 $1="$tmp" |
|
102 ]) |
|
103 |
|
104 AC_DEFUN([REMOVE_SYMBOLIC_LINKS], |
|
105 [ |
124 [ |
106 if test "x$OPENJDK_BUILD_OS" != xwindows; then |
125 if test "x$OPENJDK_BUILD_OS" != xwindows; then |
107 # Follow a chain of symbolic links. Use readlink |
126 # Follow a chain of symbolic links. Use readlink |
108 # where it exists, else fall back to horribly |
127 # where it exists, else fall back to horribly |
109 # complicated shell code. |
128 # complicated shell code. |
110 AC_PATH_PROG(READLINK, readlink) |
|
111 if test "x$READLINK_TESTED" != yes; then |
129 if test "x$READLINK_TESTED" != yes; then |
112 # On MacOSX there is a readlink tool with a different |
130 # On MacOSX there is a readlink tool with a different |
113 # purpose than the GNU readlink tool. Check the found readlink. |
131 # purpose than the GNU readlink tool. Check the found readlink. |
114 ISGNU=`$READLINK --help 2>&1 | grep GNU` |
132 ISGNU=`$READLINK --help 2>&1 | $GREP GNU` |
115 if test "x$ISGNU" = x; then |
133 if test "x$ISGNU" = x; then |
116 # A readlink that we do not know how to use. |
134 # A readlink that we do not know how to use. |
117 # Are there other non-GNU readlinks out there? |
135 # Are there other non-GNU readlinks out there? |
118 READLINK_TESTED=yes |
136 READLINK_TESTED=yes |
119 READLINK= |
137 READLINK= |
123 if test "x$READLINK" != x; then |
141 if test "x$READLINK" != x; then |
124 $1=`$READLINK -f [$]$1` |
142 $1=`$READLINK -f [$]$1` |
125 else |
143 else |
126 STARTDIR=$PWD |
144 STARTDIR=$PWD |
127 COUNTER=0 |
145 COUNTER=0 |
128 DIR=`dirname [$]$1` |
146 DIR=`$DIRNAME [$]$1` |
129 FIL=`basename [$]$1` |
147 FILE=`$BASENAME [$]$1` |
130 while test $COUNTER -lt 20; do |
148 while test $COUNTER -lt 20; do |
131 ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'` |
149 ISLINK=`$LS -l $DIR/$FILE | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` |
132 if test "x$ISLINK" == x; then |
150 if test "x$ISLINK" == x; then |
133 # This is not a symbolic link! We are done! |
151 # This is not a symbolic link! We are done! |
134 break |
152 break |
135 fi |
153 fi |
136 # The link might be relative! We have to use cd to travel safely. |
154 # The link might be relative! We have to use cd to travel safely. |
137 cd $DIR |
155 cd $DIR |
138 cd `dirname $ISLINK` |
156 # ... and we must get the to the absolute path, not one using symbolic links. |
139 DIR=`pwd` |
157 cd `pwd -P` |
140 FIL=`basename $ISLINK` |
158 cd `$DIRNAME $ISLINK` |
|
159 DIR=`$THEPWDCMD` |
|
160 FILE=`$BASENAME $ISLINK` |
141 let COUNTER=COUNTER+1 |
161 let COUNTER=COUNTER+1 |
142 done |
162 done |
143 cd $STARTDIR |
163 cd $STARTDIR |
144 $1=$DIR/$FIL |
164 $1=$DIR/$FILE |
145 fi |
165 fi |
146 fi |
166 fi |
147 ]) |
167 ]) |
148 |
168 |
149 AC_DEFUN_ONCE([BASIC_INIT], |
169 AC_DEFUN_ONCE([BASIC_INIT], |
150 [ |
170 [ |
151 # Save the original command line. This is passed to us by the wrapper configure script. |
171 # Save the original command line. This is passed to us by the wrapper configure script. |
152 AC_SUBST(CONFIGURE_COMMAND_LINE) |
172 AC_SUBST(CONFIGURE_COMMAND_LINE) |
153 DATE_WHEN_CONFIGURED=`LANG=C date` |
173 DATE_WHEN_CONFIGURED=`LANG=C date` |
154 AC_SUBST(DATE_WHEN_CONFIGURED) |
174 AC_SUBST(DATE_WHEN_CONFIGURED) |
|
175 AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.]) |
|
176 AC_MSG_NOTICE([configure script generated at timestamp $DATE_WHEN_GENERATED.]) |
|
177 ]) |
|
178 |
|
179 # Test that variable $1 denoting a program is not empty. If empty, exit with an error. |
|
180 # $1: variable to check |
|
181 # $2: executable name to print in warning (optional) |
|
182 AC_DEFUN([BASIC_CHECK_NONEMPTY], |
|
183 [ |
|
184 if test "x[$]$1" = x; then |
|
185 if test "x$2" = x; then |
|
186 PROG_NAME=translit($1,A-Z,a-z) |
|
187 else |
|
188 PROG_NAME=$2 |
|
189 fi |
|
190 AC_MSG_NOTICE([Could not find $PROG_NAME!]) |
|
191 AC_MSG_ERROR([Cannot continue]) |
|
192 fi |
|
193 ]) |
|
194 |
|
195 # Does AC_PATH_PROG followed by BASIC_CHECK_NONEMPTY. |
|
196 # Arguments as AC_PATH_PROG: |
|
197 # $1: variable to set |
|
198 # $2: executable name to look for |
|
199 AC_DEFUN([BASIC_REQUIRE_PROG], |
|
200 [ |
|
201 AC_PATH_PROGS($1, $2) |
|
202 BASIC_CHECK_NONEMPTY($1, $2) |
|
203 ]) |
|
204 |
|
205 # Setup the most fundamental tools that relies on not much else to set up, |
|
206 # but is used by much of the early bootstrap code. |
|
207 AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], |
|
208 [ |
|
209 |
|
210 # Start with tools that do not need have cross compilation support |
|
211 # and can be expected to be found in the default PATH. These tools are |
|
212 # used by configure. Nor are these tools expected to be found in the |
|
213 # devkit from the builddeps server either, since they are |
|
214 # needed to download the devkit. |
|
215 |
|
216 # First are all the simple required tools. |
|
217 BASIC_REQUIRE_PROG(BASENAME, basename) |
|
218 BASIC_REQUIRE_PROG(BASH, bash) |
|
219 BASIC_REQUIRE_PROG(CAT, cat) |
|
220 BASIC_REQUIRE_PROG(CHMOD, chmod) |
|
221 BASIC_REQUIRE_PROG(CMP, cmp) |
|
222 BASIC_REQUIRE_PROG(CP, cp) |
|
223 BASIC_REQUIRE_PROG(CUT, cut) |
|
224 BASIC_REQUIRE_PROG(DATE, date) |
|
225 BASIC_REQUIRE_PROG(DIFF, [gdiff diff]) |
|
226 BASIC_REQUIRE_PROG(DIRNAME, dirname) |
|
227 BASIC_REQUIRE_PROG(ECHO, echo) |
|
228 BASIC_REQUIRE_PROG(EXPR, expr) |
|
229 BASIC_REQUIRE_PROG(FILE, file) |
|
230 BASIC_REQUIRE_PROG(FIND, find) |
|
231 BASIC_REQUIRE_PROG(HEAD, head) |
|
232 BASIC_REQUIRE_PROG(LN, ln) |
|
233 BASIC_REQUIRE_PROG(LS, ls) |
|
234 BASIC_REQUIRE_PROG(MKDIR, mkdir) |
|
235 BASIC_REQUIRE_PROG(MKTEMP, mktemp) |
|
236 BASIC_REQUIRE_PROG(MV, mv) |
|
237 BASIC_REQUIRE_PROG(PRINTF, printf) |
|
238 BASIC_REQUIRE_PROG(THEPWDCMD, pwd) |
|
239 BASIC_REQUIRE_PROG(RM, rm) |
|
240 BASIC_REQUIRE_PROG(SH, sh) |
|
241 BASIC_REQUIRE_PROG(SORT, sort) |
|
242 BASIC_REQUIRE_PROG(TAIL, tail) |
|
243 BASIC_REQUIRE_PROG(TAR, tar) |
|
244 BASIC_REQUIRE_PROG(TEE, tee) |
|
245 BASIC_REQUIRE_PROG(TOUCH, touch) |
|
246 BASIC_REQUIRE_PROG(TR, tr) |
|
247 BASIC_REQUIRE_PROG(UNAME, uname) |
|
248 BASIC_REQUIRE_PROG(UNIQ, uniq) |
|
249 BASIC_REQUIRE_PROG(WC, wc) |
|
250 BASIC_REQUIRE_PROG(WHICH, which) |
|
251 BASIC_REQUIRE_PROG(XARGS, xargs) |
|
252 |
|
253 # Then required tools that require some special treatment. |
|
254 AC_PROG_AWK |
|
255 BASIC_CHECK_NONEMPTY(AWK) |
|
256 AC_PROG_GREP |
|
257 BASIC_CHECK_NONEMPTY(GREP) |
|
258 AC_PROG_EGREP |
|
259 BASIC_CHECK_NONEMPTY(EGREP) |
|
260 AC_PROG_FGREP |
|
261 BASIC_CHECK_NONEMPTY(FGREP) |
|
262 AC_PROG_SED |
|
263 BASIC_CHECK_NONEMPTY(SED) |
|
264 |
|
265 AC_PATH_PROGS(NAWK, [nawk gawk awk]) |
|
266 BASIC_CHECK_NONEMPTY(NAWK) |
|
267 |
|
268 # Always force rm. |
|
269 RM="$RM -f" |
|
270 |
|
271 # These are not required on all platforms |
|
272 AC_PATH_PROG(CYGPATH, cygpath) |
|
273 AC_PATH_PROG(READLINK, readlink) |
|
274 AC_PATH_PROG(DF, df) |
|
275 AC_PATH_PROG(SETFILE, SetFile) |
155 ]) |
276 ]) |
156 |
277 |
157 # Setup basic configuration paths, and platform-specific stuff related to PATHs. |
278 # Setup basic configuration paths, and platform-specific stuff related to PATHs. |
158 AC_DEFUN_ONCE([BASIC_SETUP_PATHS], |
279 AC_DEFUN_ONCE([BASIC_SETUP_PATHS], |
159 [ |
280 [ |
160 # Locate the directory of this script. |
281 # Locate the directory of this script. |
161 SCRIPT="[$]0" |
282 SCRIPT="[$]0" |
162 REMOVE_SYMBOLIC_LINKS(SCRIPT) |
283 BASIC_REMOVE_SYMBOLIC_LINKS(SCRIPT) |
163 AUTOCONF_DIR=`dirname [$]0` |
284 AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD` |
164 |
285 |
165 # Where is the source? It is located two levels above the configure script. |
286 # Where is the source? It is located two levels above the configure script. |
166 CURDIR="$PWD" |
287 CURDIR="$PWD" |
167 cd "$AUTOCONF_DIR/../.." |
288 cd "$AUTOCONF_DIR/../.." |
168 SRC_ROOT="`pwd`" |
289 SRC_ROOT="`pwd`" |
169 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then |
290 |
170 SRC_ROOT_LENGTH=`pwd|wc -m` |
291 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
171 if test $SRC_ROOT_LENGTH -gt 100; then |
292 PATH_SEP=";" |
172 AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported]) |
293 BASIC_CHECK_PATHS_WINDOWS |
173 fi |
294 else |
174 fi |
295 PATH_SEP=":" |
|
296 fi |
|
297 |
175 AC_SUBST(SRC_ROOT) |
298 AC_SUBST(SRC_ROOT) |
|
299 AC_SUBST(PATH_SEP) |
176 cd "$CURDIR" |
300 cd "$CURDIR" |
177 |
301 |
178 SPACESAFE(SRC_ROOT,[the path to the source root]) |
302 BASIC_FIXUP_PATH(SRC_ROOT) |
179 SPACESAFE(CURDIR,[the path to the current directory]) |
303 BASIC_FIXUP_PATH(CURDIR) |
180 |
304 |
181 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then |
305 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then |
182 # Add extra search paths on solaris for utilities like ar and as etc... |
306 # Add extra search paths on solaris for utilities like ar and as etc... |
183 PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" |
307 PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" |
184 fi |
308 fi |
185 |
309 |
186 # For cygwin we need cygpath first, since it is used everywhere. |
|
187 AC_PATH_PROG(CYGPATH, cygpath) |
|
188 PATH_SEP=":" |
|
189 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then |
|
190 if test "x$CYGPATH" = x; then |
|
191 AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path]) |
|
192 fi |
|
193 PATH_SEP=";" |
|
194 fi |
|
195 AC_SUBST(PATH_SEP) |
|
196 |
|
197 # You can force the sys-root if the sys-root encoded into the cross compiler tools |
310 # You can force the sys-root if the sys-root encoded into the cross compiler tools |
198 # is not correct. |
311 # is not correct. |
199 AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], |
312 AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], |
200 [pass this sys-root to the compilers and linker (useful if the sys-root encoded in |
313 [pass this sys-root to the compilers and tools (for cross-compiling)])]) |
201 the cross compiler tools is incorrect)])]) |
|
202 |
314 |
203 if test "x$with_sys_root" != x; then |
315 if test "x$with_sys_root" != x; then |
204 SYS_ROOT=$with_sys_root |
316 SYS_ROOT=$with_sys_root |
205 else |
317 else |
206 SYS_ROOT=/ |
318 SYS_ROOT=/ |
207 fi |
319 fi |
208 AC_SUBST(SYS_ROOT) |
320 AC_SUBST(SYS_ROOT) |
209 |
321 |
210 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], |
322 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], |
211 [search this directory for (cross-compiling) compilers and tools])], [TOOLS_DIR=$with_tools_dir]) |
323 [search this directory for compilers and tools (for cross-compiling)])], [TOOLS_DIR=$with_tools_dir]) |
212 |
324 |
213 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], |
325 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], |
214 [use this directory as base for tools-dir and sys-root (for cross-compiling)])], |
326 [use this directory as base for tools-dir and sys-root (for cross-compiling)])], |
215 [ |
327 [ |
216 if test "x$with_sys_root" != x; then |
328 if test "x$with_sys_root" != x; then |
226 ]) |
338 ]) |
227 |
339 |
228 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], |
340 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], |
229 [ |
341 [ |
230 |
342 |
|
343 AC_MSG_CHECKING([what configuration name to use]) |
231 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], |
344 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], |
232 [use this as the name of the configuration, overriding the generated default])], |
345 [use this as the name of the configuration @<:@generated from important configuration options@:>@])], |
233 [ CONF_NAME=${with_conf_name} ]) |
346 [ CONF_NAME=${with_conf_name} ]) |
234 |
347 |
235 # Test from where we are running configure, in or outside of src root. |
348 # Test from where we are running configure, in or outside of src root. |
236 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then |
349 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then |
237 # We are running configure from the src root. |
350 # We are running configure from the src root. |
238 # Create a default ./build/target-variant-debuglevel output root. |
351 # Create a default ./build/target-variant-debuglevel output root. |
239 if test "x${CONF_NAME}" = x; then |
352 if test "x${CONF_NAME}" = x; then |
240 CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" |
353 CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" |
241 fi |
354 fi |
242 OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}" |
355 OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}" |
243 mkdir -p "$OUTPUT_ROOT" |
356 $MKDIR -p "$OUTPUT_ROOT" |
244 if test ! -d "$OUTPUT_ROOT"; then |
357 if test ! -d "$OUTPUT_ROOT"; then |
245 AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT]) |
358 AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT]) |
246 fi |
359 fi |
247 else |
360 else |
248 # We are running configure from outside of the src dir. |
361 # We are running configure from outside of the src dir. |
303 [ |
417 [ |
304 MAKE_CANDIDATE="$1" |
418 MAKE_CANDIDATE="$1" |
305 DESCRIPTION="$2" |
419 DESCRIPTION="$2" |
306 if test "x$MAKE_CANDIDATE" != x; then |
420 if test "x$MAKE_CANDIDATE" != x; then |
307 AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION]) |
421 AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION]) |
308 SET_FULL_PATH(MAKE_CANDIDATE) |
|
309 MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1` |
422 MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1` |
310 IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'` |
423 IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'` |
311 if test "x$IS_GNU_MAKE" = x; then |
424 if test "x$IS_GNU_MAKE" = x; then |
312 AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.]) |
425 AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.]) |
313 else |
426 else |
314 IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[[12346789]]'` |
427 IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[[12346789]]'` |
315 if test "x$IS_MODERN_MAKE" = x; then |
428 if test "x$IS_MODERN_MAKE" = x; then |
316 AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.]) |
429 AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.]) |
317 else |
430 else |
318 FOUND_MAKE=$MAKE_CANDIDATE |
431 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then |
|
432 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then |
|
433 MAKE_EXPECTED_ENV='cygwin' |
|
434 elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then |
|
435 MAKE_EXPECTED_ENV='msys' |
|
436 else |
|
437 AC_MSG_ERROR([Unknown Windows environment]) |
|
438 fi |
|
439 MAKE_BUILT_FOR=`$MAKE_CANDIDATE --version | $GREP -i 'built for'` |
|
440 IS_MAKE_CORRECT_ENV=`$ECHO $MAKE_BUILT_FOR | $GREP $MAKE_EXPECTED_ENV` |
|
441 else |
|
442 # Not relevant for non-Windows |
|
443 IS_MAKE_CORRECT_ENV=true |
|
444 fi |
|
445 if test "x$IS_MAKE_CORRECT_ENV" = x; then |
|
446 AC_MSG_NOTICE([Found GNU make version $MAKE_VERSION_STRING at $MAKE_CANDIDATE, but it is not for $MAKE_EXPECTED_ENV (it says: $MAKE_BUILT_FOR). Ignoring.]) |
|
447 else |
|
448 FOUND_MAKE=$MAKE_CANDIDATE |
|
449 BASIC_FIXUP_EXECUTABLE(FOUND_MAKE) |
|
450 fi |
319 fi |
451 fi |
320 fi |
452 fi |
321 fi |
453 fi |
322 ]) |
454 ]) |
323 |
455 |
387 AC_MSG_RESULT([no]) |
519 AC_MSG_RESULT([no]) |
388 else |
520 else |
389 AC_MSG_RESULT([yes]) |
521 AC_MSG_RESULT([yes]) |
390 fi |
522 fi |
391 rmdir $DELETEDIR |
523 rmdir $DELETEDIR |
392 ]) |
524 AC_SUBST(FIND_DELETE) |
393 |
525 ]) |
394 # Test that variable $1 denoting a program is not empty. If empty, exit with an error. |
526 |
395 # $1: variable to check |
527 AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], |
396 # $2: executable name to print in warning (optional) |
528 [ |
397 AC_DEFUN([CHECK_NONEMPTY], |
529 BASIC_CHECK_GNU_MAKE |
398 [ |
530 |
399 if test "x[$]$1" = x; then |
531 BASIC_CHECK_FIND_DELETE |
400 if test "x$2" = x; then |
532 |
401 PROG_NAME=translit($1,A-Z,a-z) |
533 # These tools might not be installed by default, |
402 else |
534 # need hint on how to install them. |
403 PROG_NAME=$2 |
|
404 fi |
|
405 AC_MSG_NOTICE([Could not find $PROG_NAME!]) |
|
406 AC_MSG_ERROR([Cannot continue]) |
|
407 fi |
|
408 ]) |
|
409 |
|
410 # Does AC_PATH_PROG followed by CHECK_NONEMPTY. |
|
411 # Arguments as AC_PATH_PROG: |
|
412 # $1: variable to set |
|
413 # $2: executable name to look for |
|
414 AC_DEFUN([BASIC_REQUIRE_PROG], |
|
415 [ |
|
416 AC_PATH_PROGS($1, $2) |
|
417 CHECK_NONEMPTY($1, $2) |
|
418 ]) |
|
419 |
|
420 AC_DEFUN_ONCE([BASIC_SETUP_TOOLS], |
|
421 [ |
|
422 # Start with tools that do not need have cross compilation support |
|
423 # and can be expected to be found in the default PATH. These tools are |
|
424 # used by configure. Nor are these tools expected to be found in the |
|
425 # devkit from the builddeps server either, since they are |
|
426 # needed to download the devkit. |
|
427 |
|
428 # First are all the simple required tools. |
|
429 BASIC_REQUIRE_PROG(BASENAME, basename) |
|
430 BASIC_REQUIRE_PROG(CAT, cat) |
|
431 BASIC_REQUIRE_PROG(CHMOD, chmod) |
|
432 BASIC_REQUIRE_PROG(CMP, cmp) |
|
433 BASIC_REQUIRE_PROG(CP, cp) |
|
434 BASIC_REQUIRE_PROG(CPIO, cpio) |
|
435 BASIC_REQUIRE_PROG(CUT, cut) |
|
436 BASIC_REQUIRE_PROG(DATE, date) |
|
437 BASIC_REQUIRE_PROG(DF, df) |
|
438 BASIC_REQUIRE_PROG(DIFF, [gdiff diff]) |
|
439 BASIC_REQUIRE_PROG(ECHO, echo) |
|
440 BASIC_REQUIRE_PROG(EXPR, expr) |
|
441 BASIC_REQUIRE_PROG(FILE, file) |
|
442 BASIC_REQUIRE_PROG(FIND, find) |
|
443 BASIC_REQUIRE_PROG(HEAD, head) |
|
444 BASIC_REQUIRE_PROG(LN, ln) |
|
445 BASIC_REQUIRE_PROG(LS, ls) |
|
446 BASIC_REQUIRE_PROG(MKDIR, mkdir) |
|
447 BASIC_REQUIRE_PROG(MV, mv) |
|
448 BASIC_REQUIRE_PROG(PRINTF, printf) |
|
449 BASIC_REQUIRE_PROG(SH, sh) |
|
450 BASIC_REQUIRE_PROG(SORT, sort) |
|
451 BASIC_REQUIRE_PROG(TAIL, tail) |
|
452 BASIC_REQUIRE_PROG(TAR, tar) |
|
453 BASIC_REQUIRE_PROG(TEE, tee) |
|
454 BASIC_REQUIRE_PROG(TOUCH, touch) |
|
455 BASIC_REQUIRE_PROG(TR, tr) |
|
456 BASIC_REQUIRE_PROG(UNIQ, uniq) |
|
457 BASIC_REQUIRE_PROG(UNZIP, unzip) |
535 BASIC_REQUIRE_PROG(UNZIP, unzip) |
458 BASIC_REQUIRE_PROG(WC, wc) |
|
459 BASIC_REQUIRE_PROG(XARGS, xargs) |
|
460 BASIC_REQUIRE_PROG(ZIP, zip) |
536 BASIC_REQUIRE_PROG(ZIP, zip) |
461 |
537 |
462 # Then required tools that require some special treatment. |
|
463 AC_PROG_AWK |
|
464 CHECK_NONEMPTY(AWK) |
|
465 AC_PROG_GREP |
|
466 CHECK_NONEMPTY(GREP) |
|
467 AC_PROG_EGREP |
|
468 CHECK_NONEMPTY(EGREP) |
|
469 AC_PROG_FGREP |
|
470 CHECK_NONEMPTY(FGREP) |
|
471 AC_PROG_SED |
|
472 CHECK_NONEMPTY(SED) |
|
473 |
|
474 AC_PATH_PROGS(NAWK, [nawk gawk awk]) |
|
475 CHECK_NONEMPTY(NAWK) |
|
476 |
|
477 BASIC_CHECK_GNU_MAKE |
|
478 |
|
479 BASIC_REQUIRE_PROG(RM, rm) |
|
480 RM="$RM -f" |
|
481 |
|
482 BASIC_CHECK_FIND_DELETE |
|
483 AC_SUBST(FIND_DELETE) |
|
484 |
|
485 # Non-required basic tools |
538 # Non-required basic tools |
486 |
539 |
487 AC_PATH_PROG(THEPWDCMD, pwd) |
|
488 AC_PATH_PROG(LDD, ldd) |
540 AC_PATH_PROG(LDD, ldd) |
489 if test "x$LDD" = "x"; then |
541 if test "x$LDD" = "x"; then |
490 # List shared lib dependencies is used for |
542 # List shared lib dependencies is used for |
491 # debug output and checking for forbidden dependencies. |
543 # debug output and checking for forbidden dependencies. |
492 # We can build without it. |
544 # We can build without it. |
495 AC_PATH_PROG(OTOOL, otool) |
547 AC_PATH_PROG(OTOOL, otool) |
496 if test "x$OTOOL" = "x"; then |
548 if test "x$OTOOL" = "x"; then |
497 OTOOL="true" |
549 OTOOL="true" |
498 fi |
550 fi |
499 AC_PATH_PROGS(READELF, [readelf greadelf]) |
551 AC_PATH_PROGS(READELF, [readelf greadelf]) |
500 AC_PATH_PROGS(OBJDUMP, [objdump gobjdump]) |
|
501 AC_PATH_PROG(HG, hg) |
552 AC_PATH_PROG(HG, hg) |
502 ]) |
553 AC_PATH_PROG(STAT, stat) |
503 |
554 AC_PATH_PROG(TIME, time) |
504 AC_DEFUN_ONCE([BASIC_COMPILE_UNCYGDRIVE], |
555 |
505 [ |
556 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
506 # When using cygwin, we need a wrapper binary that renames |
557 BASIC_REQUIRE_PROG(COMM, comm) |
507 # /cygdrive/c/ arguments into c:/ arguments and peeks into |
558 fi |
508 # @files and rewrites these too! This wrapper binary is |
559 ]) |
509 # called uncygdrive.exe. |
560 |
510 UNCYGDRIVE= |
561 # Check if build directory is on local disk. If not possible to determine, |
511 if test "x$OPENJDK_BUILD_OS" = xwindows; then |
562 # we prefer to claim it's local. |
512 AC_MSG_CHECKING([if uncygdrive can be created]) |
|
513 UNCYGDRIVE_SRC=`$CYGPATH -m $SRC_ROOT/common/src/uncygdrive.c` |
|
514 rm -f $OUTPUT_ROOT/uncygdrive* |
|
515 UNCYGDRIVE=`$CYGPATH -m $OUTPUT_ROOT/uncygdrive.exe` |
|
516 cd $OUTPUT_ROOT |
|
517 $CC $UNCYGDRIVE_SRC /Fe$UNCYGDRIVE > $OUTPUT_ROOT/uncygdrive1.log 2>&1 |
|
518 cd $CURDIR |
|
519 |
|
520 if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then |
|
521 AC_MSG_RESULT([no]) |
|
522 cat $OUTPUT_ROOT/uncygdrive1.log |
|
523 AC_MSG_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe]) |
|
524 fi |
|
525 AC_MSG_RESULT([$UNCYGDRIVE]) |
|
526 AC_MSG_CHECKING([if uncygdrive.exe works]) |
|
527 cd $OUTPUT_ROOT |
|
528 $UNCYGDRIVE $CC $SRC_ROOT/common/src/uncygdrive.c /Fe$OUTPUT_ROOT/uncygdrive2.exe > $OUTPUT_ROOT/uncygdrive2.log 2>&1 |
|
529 cd $CURDIR |
|
530 if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then |
|
531 AC_MSG_RESULT([no]) |
|
532 cat $OUTPUT_ROOT/uncygdrive2.log |
|
533 AC_MSG_ERROR([Uncygdrive did not work!]) |
|
534 fi |
|
535 AC_MSG_RESULT([yes]) |
|
536 rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj |
|
537 # The path to uncygdrive to use should be Unix-style |
|
538 UNCYGDRIVE="$OUTPUT_ROOT/uncygdrive.exe" |
|
539 fi |
|
540 |
|
541 AC_SUBST(UNCYGDRIVE) |
|
542 ]) |
|
543 |
|
544 |
|
545 # Check if build directory is on local disk. |
|
546 # Argument 1: directory to test |
563 # Argument 1: directory to test |
547 # Argument 2: what to do if it is on local disk |
564 # Argument 2: what to do if it is on local disk |
548 # Argument 3: what to do otherwise (remote disk or failure) |
565 # Argument 3: what to do otherwise (remote disk or failure) |
549 AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK], |
566 AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK], |
550 [ |
567 [ |
551 # df -l lists only local disks; if the given directory is not found then |
568 # df -l lists only local disks; if the given directory is not found then |
552 # a non-zero exit code is given |
569 # a non-zero exit code is given |
553 if $DF -l $1 > /dev/null 2>&1; then |
570 if test "x$DF" = x; then |
554 $2 |
571 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then |
555 else |
572 # msys does not have df; use Windows "net use" instead. |
556 $3 |
573 IS_NETWORK_DISK=`net use | grep \`pwd -W | cut -d ":" -f 1 | tr a-z A-Z\`:` |
557 fi |
574 if test "x$IS_NETWORK_DISK" = x; then |
|
575 $2 |
|
576 else |
|
577 $3 |
|
578 fi |
|
579 else |
|
580 # No df here, say it's local |
|
581 $2 |
|
582 fi |
|
583 else |
|
584 if $DF -l $1 > /dev/null 2>&1; then |
|
585 $2 |
|
586 else |
|
587 $3 |
|
588 fi |
|
589 fi |
558 ]) |
590 ]) |
559 |
591 |
560 AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES], |
592 AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES], |
561 [ |
593 [ |
562 |
594 |