-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eli Zaretskii on 1/22/2005 9:46 PM: > > Then how can I, with the Cygwin Bash, make a reliable test for the > existence of `foo'? Suppose that `foo' doesn't exist, but `foo.exe' > does--how can one test for that? If only `foo.exe' exists, then cygwin treats 'foo' and 'foo.exe' as synonyms. Likewise, in the case of symlinks, if only `foo.lnk' exists, cygwin treats 'foo' and 'foo.lnk' as synonyms. But if both a no-suffix and suffix version of the file exist, then you must use the suffix to access the suffix'd file. Normally this is not a problem; about the only program that creates both foo and foo.exe to be in the same directory is libtool (foo is a shell script wrapper that sets $PATH before invoking foo.exe, and in this case, you really do want the shell wrapper to take precedence). The upshot of this is that in the normal case, you don't even have to know that the suffixes .exe and .lnk exist - just use the short name. But, when you DO want to know whether the filename was really short or suffixed, try again with an explicit suffix. One reason to need to know is that `rm foo', to be safe, will not remove foo.exe; you have to use `rm foo.exe'. That is probably the biggest reason why Makefiles should use $(EXEEXT) religiously when targeting cygwin. Below is a trace that shows the difference between foo and foo.exe. $ ls foo.c $ gcc -o foo foo.c $ ls foo.c foo.exe* $ ./foo Hello world $ ./foo.exe Hello world $ test -f foo; echo $? 0 $ test -x foo; echo $? 0 $ touch foo $ ls foo foo.c foo.exe* $ test -f foo; echo $? 0 $ test -x foo; echo $? 1 $ test -f foo.exe; echo $? 0 $ test -x foo.exe; echo $? 0 - -- Life is short - so eat dessert first! Eric Blake ebb9@xxxxxxx -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB8zOU84KuGfSFAYARAkk/AKCCdKnee+R1/nyFDTB/nbcoHRjIJgCfYS8W TXzhZOW99/jajJZ5Jggyyjk= =gUTq -----END PGP SIGNATURE----- _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf