## Copyright (C) 2018 Mike Miller
## 
## This program is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this program.  If not, see
## <https://www.gnu.org/licenses/>.

## -*- texinfo -*- 
## @deftypefn {} {} javaarchname ()
## Return the Java architecture name of the current system.
## @end deftypefn

function arch = javaarchname ()

  host = __octave_config_info__ ("canonical_host_type");
  tuple = strsplit (host, "-");

  if (numel (tuple) < 3)
    error ("javaarchname: unable to determine system architecture name");
  endif

  arch = tuple{1};
  arch = regexprep (arch, "^i[34567]86$", "i386");
  arch = strrep (arch, "x86_64", "amd64");

endfunction

%!error javaarchname (1)
