common/autoconf/basics.m4
changeset 18421 0296625b6c1f
parent 18021 680b9b43e2d6
child 18425 768f15fff30a
equal deleted inserted replaced
18418:ea73f01b9053 18421:0296625b6c1f
    39     else
    39     else
    40 	$ECHO "Arg failed:" >&AS_MESSAGE_LOG_FD
    40 	$ECHO "Arg failed:" >&AS_MESSAGE_LOG_FD
    41 	$ECHO "$OUTPUT" >&AS_MESSAGE_LOG_FD
    41 	$ECHO "$OUTPUT" >&AS_MESSAGE_LOG_FD
    42 	JVM_ARG_OK=false
    42 	JVM_ARG_OK=false
    43     fi
    43     fi
       
    44 ])
       
    45 
       
    46 # Appends a string to a path variable, only adding the : when needed.
       
    47 AC_DEFUN([BASIC_APPEND_TO_PATH],
       
    48 [
       
    49   if test "x[$]$1" = x; then
       
    50     $1="$2"
       
    51   else
       
    52     $1="[$]$1:$2"
       
    53   fi
    44 ])
    54 ])
    45 
    55 
    46 # This will make sure the given variable points to a full and proper
    56 # This will make sure the given variable points to a full and proper
    47 # path. This means:
    57 # path. This means:
    48 # 1) There will be no spaces in the path. On posix platforms,
    58 # 1) There will be no spaces in the path. On posix platforms,
   349   SYS_ROOT=/
   359   SYS_ROOT=/
   350 fi
   360 fi
   351 AC_SUBST(SYS_ROOT)
   361 AC_SUBST(SYS_ROOT)
   352 
   362 
   353 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
   363 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
   354   [search this directory for compilers and tools (for cross-compiling)])], [TOOLS_DIR=$with_tools_dir])
   364   [search this directory for compilers and tools (for cross-compiling)])], 
       
   365   [TOOLS_DIR=$with_tools_dir
       
   366    BASIC_FIXUP_PATH([TOOLS_DIR])
       
   367   ])
   355 
   368 
   356 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
   369 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
   357   [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
   370   [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
   358   [
   371   [
   359     if test "x$with_sys_root" != x; then
   372     if test "x$with_sys_root" != x; then
   360       AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
   373       AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
   361     fi
   374     fi
   362     if test "x$with_tools_dir" != x; then
   375     BASIC_FIXUP_PATH([with_devkit])
   363       AC_MSG_ERROR([Cannot specify both --with-devkit and --with-tools-dir at the same time])
   376     BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin)
   364     fi
       
   365     TOOLS_DIR=$with_devkit/bin
       
   366     if test -d "$with_devkit/$host_alias/libc"; then
   377     if test -d "$with_devkit/$host_alias/libc"; then
   367       SYS_ROOT=$with_devkit/$host_alias/libc
   378       SYS_ROOT=$with_devkit/$host_alias/libc
   368     elif test -d "$with_devkit/$host/sys-root"; then
   379     elif test -d "$with_devkit/$host/sys-root"; then
   369       SYS_ROOT=$with_devkit/$host/sys-root
   380       SYS_ROOT=$with_devkit/$host/sys-root
   370     fi
   381     fi
   371   ])
   382   ])
   372 
       
   373 ])
   383 ])
   374 
   384 
   375 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
   385 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
   376 [
   386 [
   377 
   387