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]

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



  # 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

Might be a problem when directories have spaces in it (remember this script is also used on Windows):


  $ test `echo foo bar` != `echo foo bar`
  bash: test: too many arguments

Unfortunately, "`...`" is unportable if the substituted command also have quotes. But a=`foo` does not break words so you can do this, which may also be marginally more readable:

  abs_top_builddir=`cd "${top_builddir}"; pwd`
  abs_top_srcdir=`cd "@top_srcdir@"; pwd`
  if test "$abs_top_builddir" != "$abs_top_srcdir"; then
    ...

Paolo


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