/hg/icedtea6: Make JDK binary macros more idiot-proof.

Dr Andrew John Hughes ahughes at redhat.com
Wed Feb 23 11:17:36 PST 2011


Just a heads up for people, this is quite a nice little change.  It essentially
makes configure a bit intelligent:

$ /home/andrew/projects/openjdk/icedtea6/configure \
  --with-jar=/boom --with-rmic=/bang --with-java=/bang \
  --with-javah=/boom --with-native2ascii=/whoop

...

checking if a java binary was specified... /bang
checking if /bang is a valid executable... no
checking for java... /usr/bin/java
checking for javac... /home/andrew/.gentoo/java-config-2/current-user-vm/bin/javac
checking if a javah binary was specified... /boom
checking if /boom is a valid executable... no
checking for javah... /usr/bin/javah
checking if a jar binary was specified... /boom
checking if /boom is a valid executable... no
checking for jar... /usr/bin/jar
checking whether jar supports @<file> argument... yes
checking whether jar supports stdin file arguments... no
checking whether jar supports -J options at the end... yes
checking if a rmic binary was specified... /bang
checking if /bang is a valid executable... no
checking for rmic... /usr/bin/rmic
checking if a native2ascii binary was specified... /whoop
checking if /whoop is a valid executable... no
checking for native2ascii... /usr/bin/native2ascii

Assuming you don't have binaries call boom, bang and whoop in /, then
configure will correct you and find the appropriate binaries on the
path.  I'm in two minds as to whether correcting the user rather than
just bailing is the right thing to do, though that's not a change from
what we had before.  I spotted the awfulness of the previous versions
when creating the one for native2ascii.  I had no native2ascii in my
gcj jdk directory, but it still went ahead and created a broken
symlink.

Note that if you don't specify any of the options, it now finds
everything in the JDK being used.  This is from just ./configure:

checking for a JDK home directory... /usr/lib/jvm/gcj-jdk
checking if a java binary was specified... no
checking if /usr/lib/jvm/gcj-jdk/bin/java is a valid executable... yes
checking for javac... /home/andrew/.gentoo/java-config-2/current-user-vm/bin/javac
checking if a javah binary was specified... no
checking if /usr/lib/jvm/gcj-jdk/bin/javah is a valid executable... yes
checking if a jar binary was specified... no
checking if /usr/lib/jvm/gcj-jdk/bin/jar is a valid executable... yes
checking whether jar supports @<file> argument... yes
checking whether jar supports stdin file arguments... yes
checking whether jar supports -J options at the end... yes
checking if a rmic binary was specified... no
checking if /usr/lib/jvm/gcj-jdk/bin/rmic is a valid executable... yes
checking if a native2ascii binary was specified... no
checking if /usr/lib/jvm/gcj-jdk/bin/native2ascii is a valid executable... yes

So you only need to override the values if you want something else.

I still need to look at the javac mess, but I'll leave that until 1.11.

On 18:39 Wed 23 Feb     , andrew at icedtea.classpath.org wrote:
> changeset a597500577ef in /hg/icedtea6
> details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=a597500577ef
> author: Andrew John Hughes <ahughes at redhat.com>
> date: Wed Feb 23 18:38:54 2011 +0000
> 
> 	Make JDK binary macros more idiot-proof.
> 
> 	2011-02-23 Andrew John Hughes <ahughes at redhat.com>
> 
> 	 * acinclude.m4: Make java, javah, rmic and jar
> 	macros more idiot-proof like the new native2ascii macro.
> 	(IT_FIND_JAVA): Improve output, check file exists and is
> 	executable and look for alternatives on the path if not.
> 	(IT_FIND_JAVAH): Likewise. (IT_FIND_JAR): Likewise.
> 	(IT_FIND_RMIC): Likewise. (IT_FIND_NATIVE2ASCII): Invert
> 	executable test for clarify.
> 
> 
> diffstat:
> 
> 2 files changed, 116 insertions(+), 59 deletions(-)
> ChangeLog    |   14 +++++
> acinclude.m4 |  161 ++++++++++++++++++++++++++++++++++++----------------------
> 
> diffs (257 lines):
> 
> diff -r 22d33e039c2f -r a597500577ef ChangeLog
> --- a/ChangeLog	Wed Feb 23 18:22:42 2011 +0100
> +++ b/ChangeLog	Wed Feb 23 18:38:54 2011 +0000
> @@ -1,3 +1,17 @@ 2011-02-23  Pavel Tisnovsky  <ptisnovs at r
> +2011-02-23  Andrew John Hughes  <ahughes at redhat.com>
> +
> +	* acinclude.m4:
> +	Make java, javah, rmic and jar macros more
> +	idiot-proof like the new native2ascii macro.
> +	(IT_FIND_JAVA): Improve output, check file
> +	exists and is executable and look for alternatives
> +	on the path if not.
> +	(IT_FIND_JAVAH): Likewise.
> +	(IT_FIND_JAR): Likewise.
> +	(IT_FIND_RMIC): Likewise.
> +	(IT_FIND_NATIVE2ASCII): Invert executable test
> +	for clarify.
> +
>  2011-02-23  Pavel Tisnovsky  <ptisnovs at redhat.com>
>  
>  	* Makefile.am: Renamed and moved patch.
> diff -r 22d33e039c2f -r a597500577ef acinclude.m4
> --- a/acinclude.m4	Wed Feb 23 18:22:42 2011 +0100
> +++ b/acinclude.m4	Wed Feb 23 18:38:54 2011 +0000
> @@ -220,28 +220,41 @@ AC_DEFUN([IT_CHECK_JAVAC],
>  
>  AC_DEFUN([IT_FIND_JAVA],
>  [
> -  AC_MSG_CHECKING(for java)
> +  JAVA_DEFAULT=${SYSTEM_JDK_DIR}/bin/java
> +  AC_MSG_CHECKING([if a java binary was specified])
>    AC_ARG_WITH([java],
>                [AS_HELP_STRING(--with-java,specify location of the 1.5 java vm)],
>    [
> -    JAVA="${withval}"
> +    if test "x${withval}" = "xyes"; then
> +      JAVA=no
> +    else
> +      JAVA="${withval}"
> +    fi
>    ],
>    [
> -    JAVA=${SYSTEM_JDK_DIR}/bin/java
> +    JAVA=no
>    ])
> -  if ! test -f "${JAVA}"; then
> -    AC_PATH_PROG(JAVA, "${JAVA}")
> +  AC_MSG_RESULT(${JAVA})
> +  if test "x${JAVA}" = "xno"; then
> +    JAVA=${JAVA_DEFAULT}
>    fi
> -  if test -z "${JAVA}"; then
> -    AC_PATH_PROG(JAVA, "gij")
> +  AC_MSG_CHECKING([if $JAVA is a valid executable])
> +  if test -x "${JAVA}"; then
> +    AC_MSG_RESULT([yes])
> +  else
> +    AC_MSG_RESULT([no])
> +    JAVA=""
> +    AC_PATH_PROG(JAVA, "java")
> +    if test -z "${JAVA}"; then
> +      AC_PATH_PROG(JAVA, "gij")
> +    fi
> +    if test -z "${JAVA}"; then
> +      AC_PATH_PROG(JAVA, "cacao")
> +    fi
> +    if test -z "${JAVA}"; then
> +      AC_MSG_ERROR("A 1.5-compatible Java VM is required.")
> +    fi
>    fi
> -  if test -z "${JAVA}"; then
> -    AC_PATH_PROG(JAVA, "java")
> -  fi
> -  if test -z "${JAVA}"; then
> -    AC_MSG_ERROR("A 1.5-compatible Java VM is required.")
> -  fi
> -  AC_MSG_RESULT(${JAVA})
>    AC_SUBST(JAVA)
>  ])
>  
> @@ -360,55 +373,75 @@ AC_DEFUN([IT_CHECK_GCC_VERSION],
>  
>  AC_DEFUN([IT_FIND_JAVAH],
>  [
> -  AC_MSG_CHECKING([for javah])
> +  JAVAH_DEFAULT=${SYSTEM_JDK_DIR}/bin/javah
> +  AC_MSG_CHECKING([if a javah binary was specified])
>    AC_ARG_WITH([javah],
>                [AS_HELP_STRING(--with-javah,specify location of the Java header generator)],
>    [
> -    JAVAH="${withval}"
> +    if test "x${withval}" = "xyes"; then
> +      JAVAH=no
> +    else
> +      JAVAH="${withval}"
> +    fi
>    ],
>    [
> -    JAVAH=${SYSTEM_JDK_DIR}/bin/javah
> +    JAVAH=no
>    ])
> -  if ! test -f "${JAVAH}"; then
> -    AC_PATH_PROG(JAVAH, "${JAVAH}")
> +  AC_MSG_RESULT(${JAVAH})
> +  if test "x${JAVAH}" = "xno"; then
> +    JAVAH=${JAVAH_DEFAULT}
>    fi
> -  if test -z "${JAVAH}"; then
> -    AC_PATH_PROG(JAVAH, "gjavah")
> +  AC_MSG_CHECKING([if $JAVAH is a valid executable])
> +  if test -x "${JAVAH}"; then
> +    AC_MSG_RESULT([yes])
> +  else
> +    AC_MSG_RESULT([no])
> +    JAVAH=""
> +    AC_PATH_PROG(JAVAH, "javah")
> +    if test -z "${JAVAH}"; then
> +      AC_PATH_PROG(JAVAH, "gjavah")
> +    fi
> +    if test -z "${JAVAH}"; then
> +      AC_MSG_ERROR("A Java header generator was not found.")
> +    fi
>    fi
> -  if test -z "${JAVAH}"; then
> -    AC_PATH_PROG(JAVAH, "javah")
> -  fi
> -  if test -z "${JAVAH}"; then
> -    AC_MSG_ERROR("A Java header generator was not found.")
> -  fi
> -  AC_MSG_RESULT(${JAVAH})
>    AC_SUBST(JAVAH)
>  ])
>  
>  AC_DEFUN([IT_FIND_JAR],
>  [
> -  AC_MSG_CHECKING([for jar])
> +  JAR_DEFAULT=${SYSTEM_JDK_DIR}/bin/jar
> +  AC_MSG_CHECKING([if a jar binary was specified])
>    AC_ARG_WITH([jar],
>                [AS_HELP_STRING(--with-jar,specify location of Java archive tool (jar))],
>    [
> -    JAR="${withval}"
> +    if test "x${withval}" = "xyes"; then
> +      JAR=no
> +    else
> +      JAR="${withval}"
> +    fi
>    ],
>    [
> -    JAR=${SYSTEM_JDK_DIR}/bin/jar
> +    JAR=no
>    ])
> -  if ! test -f "${JAR}"; then
> -    AC_PATH_PROG(JAR, "${JAR}")
> +  AC_MSG_RESULT(${JAR})
> +  if test "x${JAR}" = "xno"; then
> +    JAR=${JAR_DEFAULT}
>    fi
> -  if test -z "${JAR}"; then
> -    AC_PATH_PROG(JAR, "gjar")
> +  AC_MSG_CHECKING([if $JAR is a valid executable])
> +  if test -x "${JAR}"; then
> +    AC_MSG_RESULT([yes])
> +  else
> +    AC_MSG_RESULT([no])
> +    JAR=""
> +    AC_PATH_PROG(JAR, "jar")
> +    if test -z "${JAR}"; then
> +      AC_PATH_PROG(JAR, "gjar")
> +    fi
> +    if test -z "${JAR}"; then
> +      AC_MSG_ERROR("No Java archive tool was found.")
> +    fi
>    fi
> -  if test -z "${JAR}"; then
> -    AC_PATH_PROG(JAR, "jar")
> -  fi
> -  if test -z "${JAR}"; then
> -    AC_MSG_ERROR("No Java archive tool was found.")
> -  fi
> -  AC_MSG_RESULT(${JAR})
>    AC_MSG_CHECKING([whether jar supports @<file> argument])
>    touch _config.txt
>    cat >_config.list <<EOF
> @@ -447,28 +480,38 @@ EOF
>  
>  AC_DEFUN([IT_FIND_RMIC],
>  [
> -  AC_MSG_CHECKING(for rmic)
> +  RMIC_DEFAULT=${SYSTEM_JDK_DIR}/bin/rmic
> +  AC_MSG_CHECKING([if a rmic binary was specified])
>    AC_ARG_WITH([rmic],
>                [AS_HELP_STRING(--with-rmic,specify location of the RMI compiler)],
>    [
> -    RMIC="${withval}"
> +    if test "x${withval}" = "xyes"; then
> +      RMIC=no
> +    else
> +      RMIC="${withval}"
> +    fi
>    ],
>    [
> -    RMIC=${SYSTEM_JDK_DIR}/bin/rmic
> +    RMIC=no
>    ])
> -  if ! test -f "${RMIC}"; then
> -    AC_PATH_PROG(RMIC, "${RMIC}")
> +  AC_MSG_RESULT(${RMIC})
> +  if test "x${RMIC}" = "xno"; then
> +    RMIC=${RMIC_DEFAULT}
>    fi
> -  if test -z "${RMIC}"; then
> -    AC_PATH_PROG(RMIC, "grmic")
> +  AC_MSG_CHECKING([if $RMIC is a valid executable])
> +  if test -x "${RMIC}"; then
> +    AC_MSG_RESULT([yes])
> +  else
> +    AC_MSG_RESULT([no])
> +    RMIC=""
> +    AC_PATH_PROG(RMIC, "rmic")
> +    if test -z "${RMIC}"; then
> +      AC_PATH_PROG(RMIC, "grmic")
> +    fi
> +    if test -z "${RMIC}"; then
> +      AC_MSG_ERROR("An RMI compiler was not found.")
> +    fi
>    fi
> -  if test -z "${RMIC}"; then
> -    AC_PATH_PROG(RMIC, "rmic")
> -  fi
> -  if test -z "${RMIC}"; then
> -    AC_MSG_ERROR("An RMI compiler was not found.")
> -  fi
> -  AC_MSG_RESULT(${RMIC})
>    AC_SUBST(RMIC)
>  ])
>  
> @@ -493,7 +536,9 @@ AC_DEFUN([IT_FIND_NATIVE2ASCII],
>      NATIVE2ASCII=${NATIVE2ASCII_DEFAULT}
>    fi
>    AC_MSG_CHECKING([if $NATIVE2ASCII is a valid executable])
> -  if ! test -x "${NATIVE2ASCII}"; then
> +  if test -x "${NATIVE2ASCII}"; then
> +    AC_MSG_RESULT([yes])
> +  else
>      AC_MSG_RESULT([no])
>      NATIVE2ASCII=""
>      AC_PATH_PROG(NATIVE2ASCII, "native2ascii")
> @@ -503,8 +548,6 @@ AC_DEFUN([IT_FIND_NATIVE2ASCII],
>      if test -z "${NATIVE2ASCII}"; then
>        AC_MSG_ERROR("A native2ascii converter was not found.")
>      fi
> -  else
> -    AC_MSG_RESULT([yes])
>    fi
>    AC_SUBST([NATIVE2ASCII])
>  ])

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D  0698 0713 C3ED F586 2A37



More information about the distro-pkg-dev mailing list