openjdk fails to configure due to shell builtin test

Michael Zucchi notzed at gmail.com
Sat Apr 25 00:09:23 UTC 2020


Morning all,

A patch from last year [1] discussed on this list adds an autoconf 
fallback test for a shell builtin command using the bash command 'help 
<command>' and invokes it for ulimit.  It's probably not very portable 
to start with but bash can be compiled specifically without the help 
command by passing --disable-help-builtin to configure.  guix uses this 
option for it's build environment shell [4], hence openjdk fails to 
configure there without a patch such as the one below.

For openjdk 14[3], is it possible to use a more portable sequence in the 
BASIC_REQUIRE_BUILTIN_PROGS macro?   The internet [2] suggests using 
"command -v <command>" or "type  <command>" for this purpose.

Although I have not tried, the same appears to apply to openjdk-15 
although the macro has been moved to UTIL_REQUIRE_BUILTIN_PROGS in 
make/autoconf/util.m4

Thanks,
  Z

[1] 
https://mail.openjdk.java.net/pipermail/build-dev/2019-November/026307.html
[2] 
https://stackoverflow.com/questions/592620/how-can-i-check-if-a-program-exists-from-a-bash-script
[3] http://hg.openjdk.java.net/jdk/jdk14/rev/bc54620a3848
[4] 
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/bash.scm#n202

$ help command
command: command [-pVv] command [arg ...]
     Execute a simple command or display information about commands.

     Runs COMMAND with ARGS suppressing  shell function lookup, or display
     information about the specified COMMANDs.  Can be used to invoke 
commands
     on disk when a function with the same name exists.

     Options:
       -p    use a default value for PATH that is guaranteed to find all of
             the standard utilities
       -v    print a description of COMMAND similar to the `type' builtin
       -V    print a more verbose description of each COMMAND

     Exit Status:
     Returns exit status of COMMAND, or failure if COMMAND is not found.


--- jdk14-bc54620a3848/make/autoconf/basics.m4  2020-02-07 
04:40:54.000000000 +1030
+++ jdk14-bc54620a3848-new/make/autoconf/basics.m4      2020-04-24 
10:59:33.056098506 +0930
@@ -583,7 +583,7 @@
    BASIC_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)])
    if test "x[$]$1" = x; then
      AC_MSG_NOTICE([Required tool $2 not found in PATH, checking built-in])
-    if help $2 > /dev/null 2>&1; then
+    if command -v $2 > /dev/null 2>&1; then
        AC_MSG_NOTICE([Found $2 as shell built-in. Using it])
        $1="$2"
      else



More information about the build-dev mailing list