1.1 --- a/common/autoconf/basics.m4 Thu Sep 06 17:27:20 2012 -0700 1.2 +++ b/common/autoconf/basics.m4 Tue Sep 18 11:29:16 2012 -0700 1.3 @@ -34,7 +34,7 @@ 1.4 fi 1.5 ]) 1.6 1.7 -AC_DEFUN([WHICHCMD], 1.8 +AC_DEFUN([SET_FULL_PATH], 1.9 [ 1.10 # Translate "gcc -E" into "`which gcc` -E" ie 1.11 # extract the full path to the binary and at the 1.12 @@ -46,7 +46,7 @@ 1.13 cdr="${tmp#* }" 1.14 # On windows we want paths without spaces. 1.15 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then 1.16 - WHICHCMD_SPACESAFE(car) 1.17 + SET_FULL_PATH_SPACESAFE(car) 1.18 else 1.19 # "which" is not portable, but is used here 1.20 # because we know that the command exists! 1.21 @@ -66,15 +66,19 @@ 1.22 HAS_SPACE=`echo "[$]$1" | grep " "` 1.23 if test "x$HAS_SPACE" != x; then 1.24 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then 1.25 + # First convert it to DOS-style, short mode (no spaces) 1.26 $1=`$CYGPATH -s -m -a "[$]$1"` 1.27 - $1=`$CYGPATH -u "[$]$1"` 1.28 + # Now it's case insensitive; let's make it lowercase to improve readability 1.29 + $1=`$ECHO "[$]$1" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'` 1.30 + # Now convert it back to Unix-stile (cygpath) 1.31 + $1=`$CYGPATH -u "[$]$1"` 1.32 else 1.33 AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"]) 1.34 fi 1.35 fi 1.36 ]) 1.37 1.38 -AC_DEFUN([WHICHCMD_SPACESAFE], 1.39 +AC_DEFUN([SET_FULL_PATH_SPACESAFE], 1.40 [ 1.41 # Translate long cygdrive or C:\sdfsf path 1.42 # into a short mixed mode path that has no 1.43 @@ -148,15 +152,16 @@ 1.44 AC_SUBST(CONFIGURE_COMMAND_LINE) 1.45 DATE_WHEN_CONFIGURED=`LANG=C date` 1.46 AC_SUBST(DATE_WHEN_CONFIGURED) 1.47 +]) 1.48 1.49 +# Setup basic configuration paths, and platform-specific stuff related to PATHs. 1.50 +AC_DEFUN_ONCE([BASIC_SETUP_PATHS], 1.51 +[ 1.52 # Locate the directory of this script. 1.53 SCRIPT="[$]0" 1.54 -REMOVE_SYMBOLIC_LINKS(SCRIPT) 1.55 +REMOVE_SYMBOLIC_LINKS(SCRIPT) 1.56 AUTOCONF_DIR=`dirname [$]0` 1.57 -]) 1.58 1.59 -AC_DEFUN_ONCE([BASIC_SETUP_PATHS], 1.60 -[ 1.61 # Where is the source? It is located two levels above the configure script. 1.62 CURDIR="$PWD" 1.63 cd "$AUTOCONF_DIR/../.." 1.64 @@ -172,18 +177,12 @@ 1.65 1.66 SPACESAFE(SRC_ROOT,[the path to the source root]) 1.67 SPACESAFE(CURDIR,[the path to the current directory]) 1.68 -]) 1.69 1.70 -AC_DEFUN_ONCE([BASIC_SETUP_SEARCHPATH], 1.71 -[ 1.72 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then 1.73 # Add extra search paths on solaris for utilities like ar and as etc... 1.74 PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" 1.75 fi 1.76 -]) 1.77 1.78 -AC_DEFUN_ONCE([BASIC_SETUP_PATH_SEP], 1.79 -[ 1.80 # For cygwin we need cygpath first, since it is used everywhere. 1.81 AC_PATH_PROG(CYGPATH, cygpath) 1.82 PATH_SEP=":" 1.83 @@ -194,6 +193,36 @@ 1.84 PATH_SEP=";" 1.85 fi 1.86 AC_SUBST(PATH_SEP) 1.87 + 1.88 +# You can force the sys-root if the sys-root encoded into the cross compiler tools 1.89 +# is not correct. 1.90 +AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], 1.91 + [pass this sys-root to the compilers and linker (useful if the sys-root encoded in 1.92 + the cross compiler tools is incorrect)])]) 1.93 + 1.94 +if test "x$with_sys_root" != x; then 1.95 + SYS_ROOT=$with_sys_root 1.96 +else 1.97 + SYS_ROOT=/ 1.98 +fi 1.99 +AC_SUBST(SYS_ROOT) 1.100 + 1.101 +AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], 1.102 + [search this directory for (cross-compiling) compilers and tools])], [TOOLS_DIR=$with_tools_dir]) 1.103 + 1.104 +AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], 1.105 + [use this directory as base for tools-dir and sys-root (for cross-compiling)])], 1.106 + [ 1.107 + if test "x$with_sys_root" != x; then 1.108 + AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time]) 1.109 + fi 1.110 + if test "x$with_tools_dir" != x; then 1.111 + AC_MSG_ERROR([Cannot specify both --with-devkit and --with-tools-dir at the same time]) 1.112 + fi 1.113 + TOOLS_DIR=$with_devkit/bin 1.114 + SYS_ROOT=$with_devkit/$host_alias/libc 1.115 + ]) 1.116 + 1.117 ]) 1.118 1.119 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], 1.120 @@ -236,7 +265,13 @@ 1.121 AC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in]) 1.122 # The spec.gmk file contains all variables for the make system. 1.123 AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in]) 1.124 -# The spec.sh file contains variables for compare{images|-objects}.sh scrips. 1.125 +# The hotspot-spec.gmk file contains legacy variables for the hotspot make system. 1.126 +AC_CONFIG_FILES([$OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in]) 1.127 +# The bootcycle-spec.gmk file contains support for boot cycle builds. 1.128 +AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in]) 1.129 +# The compare.sh is used to compare the build output to other builds. 1.130 +AC_CONFIG_FILES([$OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in]) 1.131 +# Spec.sh is currently used by compare-objects.sh 1.132 AC_CONFIG_FILES([$OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in]) 1.133 # The generated Makefile knows where the spec.gmk is and where the source is. 1.134 # You can run make from the OUTPUT_ROOT, or from the top-level Makefile 1.135 @@ -261,6 +296,79 @@ 1.136 1.137 #%%% Simple tools %%% 1.138 1.139 +# Check if we have found a usable version of make 1.140 +# $1: the path to a potential make binary (or empty) 1.141 +# $2: the description on how we found this 1.142 +AC_DEFUN([BASIC_CHECK_MAKE_VERSION], 1.143 +[ 1.144 + MAKE_CANDIDATE="$1" 1.145 + DESCRIPTION="$2" 1.146 + if test "x$MAKE_CANDIDATE" != x; then 1.147 + AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION]) 1.148 + SET_FULL_PATH(MAKE_CANDIDATE) 1.149 + MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1` 1.150 + IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'` 1.151 + if test "x$IS_GNU_MAKE" = x; then 1.152 + AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.]) 1.153 + else 1.154 + IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[[12346789]]'` 1.155 + if test "x$IS_MODERN_MAKE" = x; then 1.156 + AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.]) 1.157 + else 1.158 + FOUND_MAKE=$MAKE_CANDIDATE 1.159 + fi 1.160 + fi 1.161 + fi 1.162 +]) 1.163 + 1.164 +# Goes looking for a usable version of GNU make. 1.165 +AC_DEFUN([BASIC_CHECK_GNU_MAKE], 1.166 +[ 1.167 + # We need to find a recent version of GNU make. Especially on Solaris, this can be tricky. 1.168 + if test "x$MAKE" != x; then 1.169 + # User has supplied a make, test it. 1.170 + if test ! -f "$MAKE"; then 1.171 + AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.]) 1.172 + fi 1.173 + BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=]) 1.174 + if test "x$FOUND_MAKE" = x; then 1.175 + AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.]) 1.176 + fi 1.177 + else 1.178 + # Try our hardest to locate a correct version of GNU make 1.179 + AC_PATH_PROGS(CHECK_GMAKE, gmake) 1.180 + BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH]) 1.181 + 1.182 + if test "x$FOUND_MAKE" = x; then 1.183 + AC_PATH_PROGS(CHECK_MAKE, make) 1.184 + BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH]) 1.185 + fi 1.186 + 1.187 + if test "x$FOUND_MAKE" = x; then 1.188 + if test "x$TOOLS_DIR" != x; then 1.189 + # We have a tools-dir, check that as well before giving up. 1.190 + OLD_PATH=$PATH 1.191 + PATH=$TOOLS_DIR:$PATH 1.192 + AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) 1.193 + BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir]) 1.194 + if test "x$FOUND_MAKE" = x; then 1.195 + AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make) 1.196 + BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir]) 1.197 + fi 1.198 + PATH=$OLD_PATH 1.199 + fi 1.200 + fi 1.201 + 1.202 + if test "x$FOUND_MAKE" = x; then 1.203 + AC_MSG_ERROR([Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.]) 1.204 + fi 1.205 + fi 1.206 + 1.207 + MAKE=$FOUND_MAKE 1.208 + AC_SUBST(MAKE) 1.209 + AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)]) 1.210 +]) 1.211 + 1.212 AC_DEFUN([BASIC_CHECK_FIND_DELETE], 1.213 [ 1.214 # Test if find supports -delete 1.215 @@ -283,10 +391,30 @@ 1.216 rmdir $DELETEDIR 1.217 ]) 1.218 1.219 +# Test that variable $1 denoting a program is not empty. If empty, exit with an error. 1.220 +# $1: variable to check 1.221 +# $2: executable name to print in warning (optional) 1.222 AC_DEFUN([CHECK_NONEMPTY], 1.223 [ 1.224 - # Test that variable $1 is not empty. 1.225 - if test "" = "[$]$1"; then AC_MSG_ERROR(Could not find translit($1,A-Z,a-z) !); fi 1.226 + if test "x[$]$1" = x; then 1.227 + if test "x$2" = x; then 1.228 + PROG_NAME=translit($1,A-Z,a-z) 1.229 + else 1.230 + PROG_NAME=$2 1.231 + fi 1.232 + AC_MSG_NOTICE([Could not find $PROG_NAME!]) 1.233 + AC_MSG_ERROR([Cannot continue]) 1.234 + fi 1.235 +]) 1.236 + 1.237 +# Does AC_PATH_PROG followed by CHECK_NONEMPTY. 1.238 +# Arguments as AC_PATH_PROG: 1.239 +# $1: variable to set 1.240 +# $2: executable name to look for 1.241 +AC_DEFUN([BASIC_REQUIRE_PROG], 1.242 +[ 1.243 + AC_PATH_PROGS($1, $2) 1.244 + CHECK_NONEMPTY($1, $2) 1.245 ]) 1.246 1.247 AC_DEFUN_ONCE([BASIC_SETUP_TOOLS], 1.248 @@ -295,90 +423,68 @@ 1.249 # and can be expected to be found in the default PATH. These tools are 1.250 # used by configure. Nor are these tools expected to be found in the 1.251 # devkit from the builddeps server either, since they are 1.252 -# needed to download the devkit. 1.253 +# needed to download the devkit. 1.254 + 1.255 +# First are all the simple required tools. 1.256 +BASIC_REQUIRE_PROG(BASENAME, basename) 1.257 +BASIC_REQUIRE_PROG(CAT, cat) 1.258 +BASIC_REQUIRE_PROG(CHMOD, chmod) 1.259 +BASIC_REQUIRE_PROG(CMP, cmp) 1.260 +BASIC_REQUIRE_PROG(CP, cp) 1.261 +BASIC_REQUIRE_PROG(CPIO, cpio) 1.262 +BASIC_REQUIRE_PROG(CUT, cut) 1.263 +BASIC_REQUIRE_PROG(DATE, date) 1.264 +BASIC_REQUIRE_PROG(DF, df) 1.265 +BASIC_REQUIRE_PROG(DIFF, [gdiff diff]) 1.266 +BASIC_REQUIRE_PROG(ECHO, echo) 1.267 +BASIC_REQUIRE_PROG(EXPR, expr) 1.268 +BASIC_REQUIRE_PROG(FILE, file) 1.269 +BASIC_REQUIRE_PROG(FIND, find) 1.270 +BASIC_REQUIRE_PROG(HEAD, head) 1.271 +BASIC_REQUIRE_PROG(LN, ln) 1.272 +BASIC_REQUIRE_PROG(LS, ls) 1.273 +BASIC_REQUIRE_PROG(MKDIR, mkdir) 1.274 +BASIC_REQUIRE_PROG(MV, mv) 1.275 +BASIC_REQUIRE_PROG(PRINTF, printf) 1.276 +BASIC_REQUIRE_PROG(SH, sh) 1.277 +BASIC_REQUIRE_PROG(SORT, sort) 1.278 +BASIC_REQUIRE_PROG(TAIL, tail) 1.279 +BASIC_REQUIRE_PROG(TAR, tar) 1.280 +BASIC_REQUIRE_PROG(TEE, tee) 1.281 +BASIC_REQUIRE_PROG(TOUCH, touch) 1.282 +BASIC_REQUIRE_PROG(TR, tr) 1.283 +BASIC_REQUIRE_PROG(UNIQ, uniq) 1.284 +BASIC_REQUIRE_PROG(UNZIP, unzip) 1.285 +BASIC_REQUIRE_PROG(WC, wc) 1.286 +BASIC_REQUIRE_PROG(XARGS, xargs) 1.287 +BASIC_REQUIRE_PROG(ZIP, zip) 1.288 + 1.289 +# Then required tools that require some special treatment. 1.290 AC_PROG_AWK 1.291 CHECK_NONEMPTY(AWK) 1.292 -AC_PATH_PROG(CAT, cat) 1.293 -CHECK_NONEMPTY(CAT) 1.294 -AC_PATH_PROG(CHMOD, chmod) 1.295 -CHECK_NONEMPTY(CHMOD) 1.296 -AC_PATH_PROG(CP, cp) 1.297 -CHECK_NONEMPTY(CP) 1.298 -AC_PATH_PROG(CPIO, cpio) 1.299 -CHECK_NONEMPTY(CPIO) 1.300 -AC_PATH_PROG(CUT, cut) 1.301 -CHECK_NONEMPTY(CUT) 1.302 -AC_PATH_PROG(DATE, date) 1.303 -CHECK_NONEMPTY(DATE) 1.304 -AC_PATH_PROG(DF, df) 1.305 -CHECK_NONEMPTY(DF) 1.306 -AC_PATH_PROG(DIFF, diff) 1.307 -CHECK_NONEMPTY(DIFF) 1.308 -# Warning echo is really, really unportable!!!!! Different 1.309 -# behaviour in bash and dash and in a lot of other shells! 1.310 -# Use printf for serious work! 1.311 -AC_PATH_PROG(ECHO, echo) 1.312 -CHECK_NONEMPTY(ECHO) 1.313 +AC_PROG_GREP 1.314 +CHECK_NONEMPTY(GREP) 1.315 AC_PROG_EGREP 1.316 CHECK_NONEMPTY(EGREP) 1.317 AC_PROG_FGREP 1.318 CHECK_NONEMPTY(FGREP) 1.319 +AC_PROG_SED 1.320 +CHECK_NONEMPTY(SED) 1.321 1.322 -AC_PATH_PROG(FIND, find) 1.323 -CHECK_NONEMPTY(FIND) 1.324 +AC_PATH_PROGS(NAWK, [nawk gawk awk]) 1.325 +CHECK_NONEMPTY(NAWK) 1.326 + 1.327 +BASIC_CHECK_GNU_MAKE 1.328 + 1.329 +BASIC_REQUIRE_PROG(RM, rm) 1.330 +RM="$RM -f" 1.331 + 1.332 BASIC_CHECK_FIND_DELETE 1.333 AC_SUBST(FIND_DELETE) 1.334 1.335 -AC_PROG_GREP 1.336 -CHECK_NONEMPTY(GREP) 1.337 -AC_PATH_PROG(HEAD, head) 1.338 -CHECK_NONEMPTY(HEAD) 1.339 -AC_PATH_PROG(LN, ln) 1.340 -CHECK_NONEMPTY(LN) 1.341 -AC_PATH_PROG(LS, ls) 1.342 -CHECK_NONEMPTY(LS) 1.343 -AC_PATH_PROGS(MAKE, [gmake make]) 1.344 -CHECK_NONEMPTY(MAKE) 1.345 -MAKE_VERSION=`$MAKE --version | head -n 1 | grep '3.8[[12346789]]'` 1.346 -if test "x$MAKE_VERSION" = x; then 1.347 - AC_MSG_ERROR([You must use GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.]) 1.348 -fi 1.349 -AC_PATH_PROG(MKDIR, mkdir) 1.350 -CHECK_NONEMPTY(MKDIR) 1.351 -AC_PATH_PROG(MV, mv) 1.352 -CHECK_NONEMPTY(MV) 1.353 -AC_PATH_PROGS(NAWK, [nawk gawk awk]) 1.354 -CHECK_NONEMPTY(NAWK) 1.355 -AC_PATH_PROG(PRINTF, printf) 1.356 -CHECK_NONEMPTY(PRINTF) 1.357 +# Non-required basic tools 1.358 + 1.359 AC_PATH_PROG(THEPWDCMD, pwd) 1.360 -AC_PATH_PROG(RM, rm) 1.361 -CHECK_NONEMPTY(RM) 1.362 -RM="$RM -f" 1.363 -AC_PROG_SED 1.364 -CHECK_NONEMPTY(SED) 1.365 -AC_PATH_PROG(SH, sh) 1.366 -CHECK_NONEMPTY(SH) 1.367 -AC_PATH_PROG(SORT, sort) 1.368 -CHECK_NONEMPTY(SORT) 1.369 -AC_PATH_PROG(TAR, tar) 1.370 -CHECK_NONEMPTY(TAR) 1.371 -AC_PATH_PROG(TAIL, tail) 1.372 -CHECK_NONEMPTY(TAIL) 1.373 -AC_PATH_PROG(TEE, tee) 1.374 -CHECK_NONEMPTY(TEE) 1.375 -AC_PATH_PROG(TR, tr) 1.376 -CHECK_NONEMPTY(TR) 1.377 -AC_PATH_PROG(TOUCH, touch) 1.378 -CHECK_NONEMPTY(TOUCH) 1.379 -AC_PATH_PROG(WC, wc) 1.380 -CHECK_NONEMPTY(WC) 1.381 -AC_PATH_PROG(XARGS, xargs) 1.382 -CHECK_NONEMPTY(XARGS) 1.383 -AC_PATH_PROG(ZIP, zip) 1.384 -CHECK_NONEMPTY(ZIP) 1.385 -AC_PATH_PROG(UNZIP, unzip) 1.386 -CHECK_NONEMPTY(UNZIP) 1.387 AC_PATH_PROG(LDD, ldd) 1.388 if test "x$LDD" = "x"; then 1.389 # List shared lib dependencies is used for 1.390 @@ -390,16 +496,11 @@ 1.391 if test "x$OTOOL" = "x"; then 1.392 OTOOL="true" 1.393 fi 1.394 -AC_PATH_PROG(READELF, readelf) 1.395 -AC_PATH_PROG(EXPR, expr) 1.396 -CHECK_NONEMPTY(EXPR) 1.397 -AC_PATH_PROG(FILE, file) 1.398 -CHECK_NONEMPTY(FILE) 1.399 +AC_PATH_PROGS(READELF, [readelf greadelf]) 1.400 +AC_PATH_PROGS(OBJDUMP, [objdump gobjdump]) 1.401 AC_PATH_PROG(HG, hg) 1.402 ]) 1.403 1.404 - 1.405 - 1.406 AC_DEFUN_ONCE([BASIC_COMPILE_UNCYGDRIVE], 1.407 [ 1.408 # When using cygwin, we need a wrapper binary that renames 1.409 @@ -433,6 +534,8 @@ 1.410 fi 1.411 AC_MSG_RESULT([yes]) 1.412 rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj 1.413 + # The path to uncygdrive to use should be Unix-style 1.414 + UNCYGDRIVE="$OUTPUT_ROOT/uncygdrive.exe" 1.415 fi 1.416 1.417 AC_SUBST(UNCYGDRIVE)