Back: Separators and Drive Letters
Forward: DLLs with Libtool
 
FastBack: DLLs with Libtool
Up: Writing A Cygwin Friendly Package
FastForward: DLLs with Libtool
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

25.3.3 Executable Filename Extensions

As I already noted in 25.5 Package Installation, the fact that Windows requires that all program files be named with the extension `.exe', is the cause of several inconsistencies in package behaviour between Windows and Unix.

For example, where Libtool is involved, if a package builds an executable which is linked against an as yet uninstalled library, libtool puts the real executable in the `.libs' (or `_libs') subdirectory, and writes a shell script to the original destination of the executable(64), which ensures the runtime library search paths are adjusted to find the correct (uninstalled) libraries that it depends upon. On Windows, only a PE-COFF executable is allowed to bear the .exe extension, so the wrapper script has to be named differently to the executable it is substituted for (i.e the script is only executed correctly by the operating system if it does not have an `.exe' extension). The result of this confusion is that the `Makefile' can't see some of the executables it builds with Libtool because the generated rules assume an `.exe' extension will be in evidence. This problem will be addressed in some future revision of Automake and Libtool. In the mean time, it is sometimes necessary to move the executables from the `.libs' directory to their install destination by hand. The continual rebuilding of wrapped executables at each invocation of make is another symptom of using wrapper scripts with a different name to the executable which they represent.

It is very important to correctly add the `.exe' extension to program file names in your `Makefile.am', otherwise many of the generated rules will not work correctly while they await a file without the `.exe' extension. Fortunately, Automake will do this for you where ever it is able to tell that a file is a program -- everything listed in `bin_PROGRAMS' for example. Occasionally you will find cases where there is no way for Automake to be sure of this, in which case you must be sure to add the `$(EXEEXT)' suffix. By structuring your `Makefile.am' carefully, this can be avoided in the majority of cases:

 
TESTS = $(check_SCRIPTS) script-test bin1-test$(EXEEXT)

could be rewritten as:

 
check_PROGRAMS = bin1-test
TESTS = $(check_SCRIPTS) script-test $(check_PROGRAMS)

The value of `EXEEXT' is always set correctly with respect to the host machine if you use Libtool in your project. If you don't use Libtool, you must manually call the Autoconf macro, `AC_EXEEXT' in your `configure.in' to make sure that it is initialiased correctly. If you don't call this macro (either directly or implicitly with `AC_PROG_LIBTOOL'), your project will almost certainly not build correctly on Cygwin.


This document was generated by Gary V. Vaughan on February, 8 2006 using texi2html