www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/09/24/06:06:20

From: panic AT diku DOT dk (Arne Glenstrup)
Subject: Re: cp/mv/rm problems with .exe extension filenames
24 Sep 1998 06:06:20 -0700 :
Message-ID: <Pine.HPP.3.95.980923160258.15504C-100000.cygnus.gnu-win32@grimer.diku.dk>
Mime-Version: 1.0
To: gnu-win32 AT cynus DOT com

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 AT exe@ bar AT exe@
     mv foo oldfoo                       mv foo AT exe@ oldfoo AT 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 AT 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 AT diku DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019