autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CYGWIN etc. (Was: AC_OBJEXT again)


From: Mo DeJong
Subject: Re: AC_CYGWIN etc. (Was: AC_OBJEXT again)
Date: Thu, 14 Dec 2000 01:17:07 -0800 (PST)

On 14 Dec 2000, Akim Demaille wrote:

> >>>>> "Mo" == Mo DeJong <address@hidden> writes:
> 
> Mo> Boy, the problems with these macros just don't stop. I have now
> Mo> re-discovered that when you do not include a call to AC_OBJEXT or
> Mo> AC_EXEEXT, automake acts differently.
> 
> Right.  Do not remove them until Automake is fixed.  They are defined
> to nothing for this reason.

Ok.

Well, what if we did this? It kind of puts the hack back in
but it does it without keeping the AC_CYGWIN macros and
without compiling anything.

Another possibility would be to only do this in the case
of a cross compile, I think the native tools write a .exe
but I could be wrong about that.

Index: aclang.m4
===================================================================
RCS file: /cvs/autoconf/aclang.m4,v
retrieving revision 1.95
diff -u -r1.95 aclang.m4
--- aclang.m4   2000/12/13 12:36:54     1.95
+++ aclang.m4   2000/12/14 09:12:32
@@ -662,7 +662,18 @@
 # by the AC_LINK_IFELSE macros, so use _AC_LINK_IFELSE.
 m4_define([_AC_COMPILER_EXEEXT],
 [AC_CACHE_CHECK([for executable suffix], ac_cv_exeext,
-[_AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+[
+# Yes, we know this is a hack, but there are cygwin and
+# mingw cross compilers that do not correctly add the
+# .exe to an executable linked like so "gcc -o foo foo.c"
+# so we need this special case for those broken compilers.
+case $host_os in
+  *cygwin*) ac_cv_exeext=.exe ;;
+  *mingw*) ac_cv_exeext=.exe ;;
+  *emx*) ac_cv_exeext=.exe ;;
+esac
+if test "x$ac_cv_exeext" = "" ; then
+_AC_LINK_IFELSE([AC_LANG_PROGRAM()],
 [# If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
 # work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -676,6 +687,7 @@
 done],
               [AC_MSG_ERROR([cannot compute EXEEXT: cannot compile and 
link])])
 rm -f conftest$ac_cv_exeext])
+fi
 AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl
 ac_exeext=$EXEEXT
 ])# _AC_COMPILER_EXEEXT


Mo DeJong
Red Hat Inc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]