common/autoconf/basics.m4

changeset 2215
7a73b8b4ac8a
parent 2214
fda76d0c4b84
child 2219
cb1203f48728
     1.1 --- a/common/autoconf/basics.m4	Thu Apr 12 02:54:38 2018 -0700
     1.2 +++ b/common/autoconf/basics.m4	Mon Apr 16 00:48:00 2018 -0700
     1.3 @@ -46,10 +46,24 @@
     1.4  # Appends a string to a path variable, only adding the : when needed.
     1.5  AC_DEFUN([BASIC_APPEND_TO_PATH],
     1.6  [
     1.7 -  if test "x[$]$1" = x; then
     1.8 -    $1="$2"
     1.9 -  else
    1.10 -    $1="[$]$1:$2"
    1.11 +  if test "x$2" != x; then
    1.12 +    if test "x[$]$1" = x; then
    1.13 +      $1="$2"
    1.14 +    else
    1.15 +      $1="[$]$1:$2"
    1.16 +    fi
    1.17 +  fi
    1.18 +])
    1.19 +
    1.20 +# Prepends a string to a path variable, only adding the : when needed.
    1.21 +AC_DEFUN([BASIC_PREPEND_TO_PATH],
    1.22 +[
    1.23 +  if test "x$2" != x; then
    1.24 +    if test "x[$]$1" = x; then
    1.25 +      $1="$2"
    1.26 +    else
    1.27 +      $1="$2:[$]$1"
    1.28 +    fi
    1.29    fi
    1.30  ])
    1.31  
    1.32 @@ -442,49 +456,101 @@
    1.33  
    1.34    # Locate the directory of this script.
    1.35    AUTOCONF_DIR=$TOPDIR/common/autoconf
    1.36 +])
    1.37 +
    1.38 +AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
    1.39 +[
    1.40 +  AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
    1.41 +      [use this devkit for compilers, tools and resources])],
    1.42 +      [
    1.43 +        BASIC_FIXUP_PATH([with_devkit])
    1.44 +        DEVKIT_ROOT="$with_devkit"
    1.45 +        # Check for a meta data info file in the root of the devkit
    1.46 +        if test -f "$DEVKIT_ROOT/devkit.info"; then
    1.47 +          # This potentially sets the following:
    1.48 +          # DEVKIT_NAME: A descriptive name of the devkit
    1.49 +          # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path
    1.50 +          # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path
    1.51 +          # DEVKIT_SYSROOT: Corresponds to --with-sysroot
    1.52 +          . $DEVKIT_ROOT/devkit.info
    1.53 +        fi
    1.54 +
    1.55 +        AC_MSG_CHECKING([for devkit])
    1.56 +        if test "x$DEVKIT_NAME" != x; then
    1.57 +          AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
    1.58 +        else
    1.59 +          AC_MSG_RESULT([$DEVKIT_ROOT])
    1.60 +        fi
    1.61 +
    1.62 +        if test "x$DEVKIT_EXTRA_PATH" != x; then
    1.63 +          BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
    1.64 +        fi
    1.65 +
    1.66 +        # Fallback default of just /bin if DEVKIT_PATH is not defined
    1.67 +        if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
    1.68 +          DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
    1.69 +        fi
    1.70 +        BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
    1.71 +
    1.72 +        # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
    1.73 +        # places for backwards compatiblity.
    1.74 +        if test "x$DEVKIT_SYSROOT" != x; then
    1.75 +          SYSROOT="$DEVKIT_SYSROOT"
    1.76 +        elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
    1.77 +          SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
    1.78 +        elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
    1.79 +          SYSROOT="$DEVKIT_ROOT/$host/sys-root"
    1.80 +        fi
    1.81 +      ]
    1.82 +  )
    1.83 +
    1.84 +  # You can force the sysroot if the sysroot encoded into the compiler tools
    1.85 +  # is not correct.
    1.86 +  AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
    1.87 +      [alias for --with-sysroot for backwards compatability])],
    1.88 +      [SYSROOT=$with_sys_root]
    1.89 +  )
    1.90 +
    1.91 +  AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
    1.92 +      [use this directory as sysroot)])],
    1.93 +      [SYSROOT=$with_sysroot]
    1.94 +  )
    1.95 +
    1.96 +  AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
    1.97 +      [alias for --with-toolchain-path for backwards compatibility])],
    1.98 +      [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)]
    1.99 +  )
   1.100 +
   1.101 +  AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path],
   1.102 +      [prepend these directories when searching for toolchain binaries (compilers etc)])],
   1.103 +      [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
   1.104 +  )
   1.105 +
   1.106 +  AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
   1.107 +      [prepend these directories to the default path])],
   1.108 +      [BASIC_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
   1.109 +  )
   1.110 +
   1.111 +  # Prepend the extra path to the global path
   1.112 +  BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
   1.113  
   1.114    if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
   1.115      # Add extra search paths on solaris for utilities like ar and as etc...
   1.116      PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
   1.117    fi
   1.118  
   1.119 -  # You can force the sys-root if the sys-root encoded into the cross compiler tools
   1.120 -  # is not correct.
   1.121 -  AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
   1.122 -      [pass this sys-root to the compilers and tools (for cross-compiling)])])
   1.123 -
   1.124 -  if test "x$with_sys_root" != x; then
   1.125 -    SYS_ROOT=$with_sys_root
   1.126 -  else
   1.127 -    SYS_ROOT=/
   1.128 -  fi
   1.129 -  AC_SUBST(SYS_ROOT)
   1.130 -
   1.131 -  AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
   1.132 -      [search this directory for compilers and tools (for cross-compiling)])],
   1.133 -      [TOOLS_DIR=$with_tools_dir]
   1.134 -  )
   1.135 -
   1.136    # Xcode version will be validated later
   1.137    AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path],
   1.138        [explicit path to Xcode 4 (generally for building on 10.9 and later)])],
   1.139        [XCODE_PATH=$with_xcode_path]
   1.140    )
   1.141  
   1.142 -  AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
   1.143 -      [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
   1.144 -      [
   1.145 -        if test "x$with_sys_root" != x; then
   1.146 -          AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
   1.147 -        fi
   1.148 -        BASIC_FIXUP_PATH([with_devkit])
   1.149 -        BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin)
   1.150 -        if test -d "$with_devkit/$host_alias/libc"; then
   1.151 -          SYS_ROOT=$with_devkit/$host_alias/libc
   1.152 -        elif test -d "$with_devkit/$host/sys-root"; then
   1.153 -          SYS_ROOT=$with_devkit/$host/sys-root
   1.154 -        fi
   1.155 -      ])
   1.156 +  AC_MSG_CHECKING([for sysroot])
   1.157 +  AC_MSG_RESULT([$SYSROOT])
   1.158 +  AC_MSG_CHECKING([for toolchain path])
   1.159 +  AC_MSG_RESULT([$TOOLCHAIN_PATH])
   1.160 +  AC_MSG_CHECKING([for extra path])
   1.161 +  AC_MSG_RESULT([$EXTRA_PATH])
   1.162  ])
   1.163  
   1.164  AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
   1.165 @@ -654,10 +720,10 @@
   1.166      fi
   1.167  
   1.168      if test "x$FOUND_MAKE" = x; then
   1.169 -      if test "x$TOOLS_DIR" != x; then
   1.170 -        # We have a tools-dir, check that as well before giving up.
   1.171 +      if test "x$TOOLCHAIN_PATH" != x; then
   1.172 +        # We have a toolchain path, check that as well before giving up.
   1.173          OLD_PATH=$PATH
   1.174 -        PATH=$TOOLS_DIR:$PATH
   1.175 +        PATH=$TOOLCHAIN_PATH:$PATH
   1.176          AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
   1.177          BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir])
   1.178          if test "x$FOUND_MAKE" = x; then

mercurial