Opened 17 years ago

Closed 17 years ago

#2183 closed defect (fixed)

configure "test -e" is not portable

Reported by: havatv Owned by: dmorissette
Priority: normal Milestone: 5.0 release
Component: Build Problems Version: 5.0
Severity: normal Keywords: configure test portable
Cc: sdlime

Description

test -e, as used in the AGG section of configure, is not considered portable.
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' or test -r'. Do not use test -x', because 4.3BSD does not have it. Do not use test -e' either, because Solaris /bin/sh lacks it. To test for symbolic links on systems that have them, use test -h' rather than test -L'; either form conforms to Posix 1003.1-2001, but older shells like Solaris 8 /bin/sh support only -h.

Change History (3)

comment:1 by dmorissette, 17 years ago

Owner: changed from mapserverbugs to dmorissette

I like tickets that come with that much detail! Thanks! Checking now.

comment:2 by dmorissette, 17 years ago

Cc: sdlime added

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.

comment:3 by dmorissette, 17 years ago

Resolution: fixed
Status: newclosed

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 r6411.

Note: See TracTickets for help on using tickets.