This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[JAVA] /bin/sh portability issues in gen-classlist.sh.in


The following patch, the first in a series, fixes some shell portability
issues building libjava using /bin/sh on Solaris.  As pointed out by
Andrew Pinski, I should probably simply use CONFIG_SHELL, however I
think I've managed to resolve all the remaining shell issues preventing
bootstraping mainline GCC on Solaris/x86 with the native /bin/sh.

The first pair of issues is in libjava/classpath/lib/gen-classlist.sh.in
which uses test's "-ef" and "-e" operators which aren't available on
Solaris.  Many thanks to Ian Lance Taylor for recommending the more
portable idiom used below.

Tested on i386-pc-solaris2.10 where a top-level "make bootstrap" makes
it further with this patch than without.

Ok for mainline?



2006-07-06  Roger Sayle  <roger@eyesopen.com>
	    Ian Lance Taylor  <ian@airs.com>

	* lib/gen-classlist.sh.in:  Avoid using test's -ef operator for
	increased portability.  Likewise, use -f instead of -e.


Index: lib/gen-classlist.sh.in
===================================================================
*** lib/gen-classlist.sh.in	(revision 115223)
--- lib/gen-classlist.sh.in	(working copy)
*************** for dir in $vm_dirlist; do
*** 55,61 ****
  done

  # Only include generated files once.
! if test ! "${top_builddir}" -ef "@top_srcdir@"; then
    echo "Adding generated files in builddir '${top_builddir}'."
    # Currently the only generated files are in gnu.*.
    (cd ${top_builddir}; @FIND@ gnu -follow -name '*.java' -print) |
--- 55,61 ----
  done

  # Only include generated files once.
! if test `cd "${top_builddir}"; pwd` != `cd "@top_srcdir@"; pwd`; then
    echo "Adding generated files in builddir '${top_builddir}'."
    # Currently the only generated files are in gnu.*.
    (cd ${top_builddir}; @FIND@ gnu -follow -name '*.java' -print) |
*************** rm vm.add
*** 95,101 ****
  rm tmp.omit

  new=
! if test -e ${top_builddir}/lib/classes.2; then
    p=`diff ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1`
    if test "$p" != ""; then
      new="true"
--- 95,101 ----
  rm tmp.omit

  new=
! if test -f ${top_builddir}/lib/classes.2; then
    p=`diff ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1`
    if test "$p" != ""; then
      new="true"


Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]