MapServer / MapServer-import

3 stars 2 forks source link

configure "test -e" is not portable #2183

Closed tbonfort closed 12 years ago

tbonfort commented 12 years ago

Reporter: havatv Date: 2007/07/27 - 12:46 test -e, as used in the AGG section of configure, is not considered portable.[[BR]] It causes configure to fail on my Solaris 2.7 system (/bin/sh).

See for example: http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Builtins.html#Limitations-of-Builtins

test (files) To enable configure scripts to support cross-compilation, they shouldn't do anything that tests features of the build system instead of the host system. But occasionally you may find it necessary to check whether some arbitrary file exists. To do so, use test -f' ortest -r'. Do not use test -x', because 4.3BSD does not have it. Do not usetest -e' either, because Solaris /bin/sh lacks it. To test for symbolic links on systems that have them, use test -h' rather thantest -L'; either form conforms to Posix 1003.1-2001, but older shells like Solaris 8 /bin/sh support only -h.

tbonfort commented 12 years ago

Author: dmorissette Date: 2007/07/27 - 19:47 I like tickets that come with that much detail! Thanks! Checking now.

tbonfort commented 12 years ago

Author: dmorissette Date: 2007/07/27 - 20:22 The AGG tests in question are:

  test -f $AGG_DIR/lib/libagg.a && AGG_LIBDIR="$AGG_DIR/lib"
  test -e $AGG_DIR/lib/libagg.so && AGG_LIBDIR="$AGG_DIR/lib"
  test -f $AGG_DIR/src/libagg.a && AGG_LIBDIR="$AGG_DIR/src"
  test -e $AGG_DIR/src/libagg.so && AGG_LIBDIR="$AGG_DIR/src"

I believe 'test -e' is used so that the test passes if the .so file is a symlink.

It seems that using 'test -r' would be portable and works for symblinks. I'll use that.

tbonfort commented 12 years ago

Author: dmorissette Date: 2007/07/27 - 20:31 I was wrong, we don't need 'test -r' as 'test -f' is portable and works fine for symlinks.

Fixed. I have replaced the 'test -e' with 'test -f' in 964e363c21efb52f9d8b65fec0b63909a9ff1b0c (r6411).