This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cp/mv/rm problems with .exe extension filenames


Hi,


Has anybody found a REALLY good solution to this problem yet? I agree
with Steven that Cygwin32 has a serious compatibility problem here: lots
of makefiles will break, i fear.

So here's what I have done in my case to circumvent the problem:

1) Wrote an autoconf macro:

dnl MYMAC_SYS_EXE
dnl ------------
dnl
dnl If the compiler generates foo.exe when instructed to generate foo,
dnl set $exe to `.exe', else set $exe to `'

AC_DEFUN(MYMAC_SYS_EXE, [dnl
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
  AC_CACHE_CHECK([whether the C++ compiler (${CXX}) generates .exe files],
    mymac_cv_sys_exe,[dnl
cat > conftest.$ac_ext <<EOF
dnl This sometimes fails to find confdefs.h, for some reason.
dnl [#]line __oline__ "[$]0"
[#]line __oline__ "configure"
#include "confdefs.h"
int main() { return 0; }
EOF
mymac_cv_sys_exe=no
if eval $ac_link; then
  if test -f conftest.exe
  then
    mymac_cv_sys_exe=yes
  fi
fi
rm -f conftest*]
)
if test $mymac_cv_sys_exe = yes
then
  exe='.exe'
else
  exe=
fi
AC_SUBST(exe)
AC_LANG_RESTORE
])

2) Added the following line to configure.in:

MYMAC_SYS_EXE

3) In all Makefile.in files, shell commands to move executables, are
   changed like this:

     FROM                                TO
     ====                                ==
     $(CXX) -o foo $(OBJ) foo.c          $(CXX) -o foo $(OBJ) foo.c
     cp foo bar                          cp foo@exe@ bar@exe@
     mv foo oldfoo                       mv foo@exe@ oldfoo@exe@

     $(CXX) -o hello.world hello.c       $(CXX) -o hello.world hello.c
     cp hello.world hello.underworld     cp hello.world hello.underworld
     mv hello.world hello                mv hello.world hello@exe@

   Am I right in thinking that this zany .exe-stuff is only appended to
   executables without a dot in their name?

4) And of course invoking autoconf and configure and makefiles in the
   right order as usual.


This seems right now to be my best bet for keeping things runnable on
several platforms besides Cygwin32. Comments on better ideas or
great mistakes in the above points are very welcome.

-- Arne
__________________________________________________________________________
Arne John Glenstrup        | Windows 95: n.  32 bit extensions and a       
panic@diku.dk              |  graphical shell for a 16 bit patch to an 8   
http://www.diku.dk/~panic/ |  bit operating system originally coded for a 4
                              bit microprocessor, written by a 2 bit company
                              that can't stand 1 bit of competition.


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]