[JWM] configure and test -x `which foo`

Jeremy C. Reed reed at reedmedia.net
Wed Nov 28 12:27:31 CST 2007


I noticed jwm didn't link because no -lpng listed in LDFLAGS. It set 
PNG_LDFLAGS to nothing. It tried to run non-existent libpng-config.

My fix in configure was simply:

        if test "$use_pkgconfig_png" = "yes" ; then
                PNG_CFLAGS=`$PKGCONFIG --cflags libpng`
                PNG_LDFLAGS=`$PKGCONFIG --libs libpng`
-       elif test -x `which libpng-config` ; then
+       elif test -x "`which libpng-config`" ; then
                PNG_CFLAGS=`libpng-config --cflags`
                PNG_LDFLAGS=`libpng-config --libs`
        else


Note that if "which" doesn't return anything then "test -x" on several 
platforms will return success if not given any argument.

For example:

$ /usr/bin/test -x && echo true 
true
$ /usr/bin/test -x "" && echo true
$

# test -x && echo true    
true
# test -x "" && echo true
#

I did this on different systems with different test (some builtin to shell 
and some as standalone test executable).

The configure has more of these beyond just the png test. Okay if I fix 
all these in configure.in?


More information about the JWM mailing list