common/autoconf/basics.m4

changeset 726
c31e9dc1fe3d
parent 725
03e60e87d92a
child 740
c0fa87863427
equal deleted inserted replaced
725:03e60e87d92a 726:c31e9dc1fe3d
70 eval path="$path" 70 eval path="$path"
71 if test ! -f "$path" && test ! -d "$path"; then 71 if test ! -f "$path" && test ! -d "$path"; then
72 AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.]) 72 AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
73 fi 73 fi
74 74
75 $1="`cd "$path"; $THEPWDCMD`" 75 $1="`cd "$path"; $THEPWDCMD -L`"
76 fi 76 fi
77 ]) 77 ])
78 78
79 # This will make sure the given variable points to a executable 79 # This will make sure the given variable points to a executable
80 # with a full and proper path. This means: 80 # with a full and proper path. This means:
167 # Save the current directory for restoring afterwards 167 # Save the current directory for restoring afterwards
168 STARTDIR=$PWD 168 STARTDIR=$PWD
169 COUNTER=0 169 COUNTER=0
170 sym_link_dir=`$DIRNAME [$]$1` 170 sym_link_dir=`$DIRNAME [$]$1`
171 sym_link_file=`$BASENAME [$]$1` 171 sym_link_file=`$BASENAME [$]$1`
172 # Use the system pwd and not the shell builtin to resolve directory symlinks
173 cd $sym_link_dir 172 cd $sym_link_dir
174 cd `$THEPWDCMD` 173 # Use -P flag to resolve symlinks in directories.
175 sym_link_dir=`$THEPWDCMD` 174 cd `$THEPWDCMD -P`
175 sym_link_dir=`$THEPWDCMD -P`
176 # Resolve file symlinks 176 # Resolve file symlinks
177 while test $COUNTER -lt 20; do 177 while test $COUNTER -lt 20; do
178 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` 178 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
179 if test "x$ISLINK" == x; then 179 if test "x$ISLINK" == x; then
180 # This is not a symbolic link! We are done! 180 # This is not a symbolic link! We are done!
181 break 181 break
182 fi 182 fi
183 # Again resolve directory symlinks since the target of the just found 183 # Again resolve directory symlinks since the target of the just found
184 # link could be in a different directory 184 # link could be in a different directory
185 cd `$DIRNAME $ISLINK` 185 cd `$DIRNAME $ISLINK`
186 sym_link_dir=`$THEPWDCMD` 186 sym_link_dir=`$THEPWDCMD -P`
187 sym_link_file=`$BASENAME $ISLINK` 187 sym_link_file=`$BASENAME $ISLINK`
188 let COUNTER=COUNTER+1 188 let COUNTER=COUNTER+1
189 done 189 done
190 cd $STARTDIR 190 cd $STARTDIR
191 $1=$sym_link_dir/$sym_link_file 191 $1=$sym_link_dir/$sym_link_file
262 BASIC_REQUIRE_PROG(LS, ls) 262 BASIC_REQUIRE_PROG(LS, ls)
263 BASIC_REQUIRE_PROG(MKDIR, mkdir) 263 BASIC_REQUIRE_PROG(MKDIR, mkdir)
264 BASIC_REQUIRE_PROG(MKTEMP, mktemp) 264 BASIC_REQUIRE_PROG(MKTEMP, mktemp)
265 BASIC_REQUIRE_PROG(MV, mv) 265 BASIC_REQUIRE_PROG(MV, mv)
266 BASIC_REQUIRE_PROG(PRINTF, printf) 266 BASIC_REQUIRE_PROG(PRINTF, printf)
267 BASIC_REQUIRE_PROG(THEPWDCMD, pwd)
268 BASIC_REQUIRE_PROG(RM, rm) 267 BASIC_REQUIRE_PROG(RM, rm)
269 BASIC_REQUIRE_PROG(SH, sh) 268 BASIC_REQUIRE_PROG(SH, sh)
270 BASIC_REQUIRE_PROG(SORT, sort) 269 BASIC_REQUIRE_PROG(SORT, sort)
271 BASIC_REQUIRE_PROG(TAIL, tail) 270 BASIC_REQUIRE_PROG(TAIL, tail)
272 BASIC_REQUIRE_PROG(TAR, tar) 271 BASIC_REQUIRE_PROG(TAR, tar)
295 BASIC_CHECK_NONEMPTY(NAWK) 294 BASIC_CHECK_NONEMPTY(NAWK)
296 295
297 # Always force rm. 296 # Always force rm.
298 RM="$RM -f" 297 RM="$RM -f"
299 298
299 # pwd behaves differently on various platforms and some don't support the -L flag.
300 # Always use the bash builtin pwd to get uniform behavior.
301 THEPWDCMD=pwd
302
300 # These are not required on all platforms 303 # These are not required on all platforms
301 AC_PATH_PROG(CYGPATH, cygpath) 304 AC_PATH_PROG(CYGPATH, cygpath)
302 AC_PATH_PROG(READLINK, readlink) 305 AC_PATH_PROG(READLINK, readlink)
303 AC_PATH_PROG(DF, df) 306 AC_PATH_PROG(DF, df)
304 AC_PATH_PROG(SETFILE, SetFile) 307 AC_PATH_PROG(SETFILE, SetFile)
307 # Setup basic configuration paths, and platform-specific stuff related to PATHs. 310 # Setup basic configuration paths, and platform-specific stuff related to PATHs.
308 AC_DEFUN_ONCE([BASIC_SETUP_PATHS], 311 AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
309 [ 312 [
310 # Locate the directory of this script. 313 # Locate the directory of this script.
311 SCRIPT="[$]0" 314 SCRIPT="[$]0"
312 BASIC_REMOVE_SYMBOLIC_LINKS(SCRIPT) 315 AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD -L`
313 AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD`
314 316
315 # Where is the source? It is located two levels above the configure script. 317 # Where is the source? It is located two levels above the configure script.
316 CURDIR="$PWD" 318 CURDIR="$PWD"
317 cd "$AUTOCONF_DIR/../.." 319 cd "$AUTOCONF_DIR/../.."
318 SRC_ROOT="`$THEPWDCMD`" 320 SRC_ROOT="`$THEPWDCMD -L`"
319 321
320 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then 322 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
321 PATH_SEP=";" 323 PATH_SEP=";"
322 BASIC_CHECK_PATHS_WINDOWS 324 BASIC_CHECK_PATHS_WINDOWS
323 else 325 else
372 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], 374 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
373 [use this as the name of the configuration @<:@generated from important configuration options@:>@])], 375 [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
374 [ CONF_NAME=${with_conf_name} ]) 376 [ CONF_NAME=${with_conf_name} ])
375 377
376 # Test from where we are running configure, in or outside of src root. 378 # Test from where we are running configure, in or outside of src root.
377 # To enable comparison of directories, CURDIR needs to be symlink free 379 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
378 # just like SRC_ROOT already is 380 || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
379 NOSYM_CURDIR="$CURDIR" 381 || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
380 BASIC_REMOVE_SYMBOLIC_LINKS(NOSYM_CURDIR)
381 if test "x$NOSYM_CURDIR" = "x$SRC_ROOT" || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common" \
382 || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/autoconf" \
383 || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
384 # We are running configure from the src root. 382 # We are running configure from the src root.
385 # Create a default ./build/target-variant-debuglevel output root. 383 # Create a default ./build/target-variant-debuglevel output root.
386 if test "x${CONF_NAME}" = x; then 384 if test "x${CONF_NAME}" = x; then
387 CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" 385 CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
388 fi 386 fi

mercurial