[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EXEEXT: `cc -o' (Was: AC_CYGWIN etc.)
From: |
Akim Demaille |
Subject: |
Re: EXEEXT: `cc -o' (Was: AC_CYGWIN etc.) |
Date: |
15 Dec 2000 12:31:28 +0100 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands) |
| --- akim_aclang.m4 Fri Dec 15 01:44:44 2000
| +++ aclang.m4 Fri Dec 15 02:03:29 2000
| @@ -668,7 +668,7 @@
| [for ac_file in `ls a.exe a.* 2>/dev/null`; do
| case $ac_file in
| *.$ac_ext | *.out | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
| - *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'`
| + *) ac_cv_exeext=`expr "$ac_file" : 'a\(.*\)'`
Pfff!!! Sorry!
| break;;
| esac
| done],
| @@ -687,7 +687,11 @@
| # Check for the extension used when `-o foo'. Try to see if
| ac_cv_exeext,
| # as computed by _AC_COMPILER_EXEEXT_DEFAULT is OK.
| m4_define([_AC_COMPILER_EXEEXT_O],
| -[_AC_LINK_IFELSE([],
| +[# Note that we have not set ac_exeext yet, so we do that here
| +# because linking a file depends on ac_exeext not ac_cv_exeext
| +ac_exeext_save=$ac_exeext
| +ac_exeext=$ac_cv_exeext
Pff!!! Sorry again. But note we don't need to save ac_exeext.
Here is your patch included in mine.
Index: ChangeLog
from Akim Demaille <address@hidden>, Mo DeJong <address@hidden>
* aclang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): New.
(_AC_COMPILER_EXEEXT_O): Extracted from...
(_AC_COMPILER_EXEEXT): here. Adjust.
Index: aclang.m4
===================================================================
RCS file: /cvs/autoconf/aclang.m4,v
retrieving revision 1.97
diff -u -u -r1.97 aclang.m4
--- aclang.m4 2000/12/15 07:49:13 1.97
+++ aclang.m4 2000/12/15 11:22:24
@@ -652,22 +652,52 @@
AC_DEFUN([AC_OBJEXT], [])
-# _AC_COMPILER_EXEEXT
-# -------------------
-# Check for the extension used for executables. It compiles a test
-# executable. If this is called, the executable extensions will be
-# automatically used by link commands run by the configure script.
-#
-# This macro is called by AC_LANG_COMPILER, the latter being required
-# 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()],
+# _AC_COMPILER_EXEEXT_DEFAULT
+# ---------------------------
+# Check for the extension used for the default name for executables.
+m4_define([_AC_COMPILER_EXEEXT_DEFAULT],
+[# Try without -o first, disregard a.out.
+ac_link_save=$ac_link
+ac_link=`echo "$ac_link" | sed ['s/ -o *conftest[^ ]*//']`
+if ls a.* >/dev/null 2>&1; then
+ rm -rf conftestdir
+ mkdir conftestdir
+ mv a.* conftestdir
+fi
+AS_IFELSE([AC_TRY_EVAL(ac_link)],
+ [for ac_file in `ls a.exe a.* 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.out | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *) ac_cv_exeext=`expr "$ac_file" : 'a\(.*\)'`
+ break;;
+ esac
+done],
+ [echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD
+cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD])
+rm -f a.*
+if test -d conftestdir; then
+ mv conftestdir/* .
+ rm -rf conftestdir
+fi
+ac_link=$ac_link_save
+])# _AC_COMPILER_EXEEXT_DEFAULT
+
+
+# _AC_COMPILER_EXEEXT_O
+# ---------------------
+# Check for the extension used when `-o foo'. Try to see if ac_cv_exeext,
+# as computed by _AC_COMPILER_EXEEXT_DEFAULT is OK.
+m4_define([_AC_COMPILER_EXEEXT_O],
+[# Note that we have not set ac_exeext yet, so we do that here because
+# linking a file depends on ac_exeext not ac_cv_exeext
+ac_exeext=$ac_cv_exeext
+_AC_LINK_IFELSE([],
[# 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
# `rm'.
-for ac_file in `ls conftest.exe conftest conftest.* 2>/dev/null`; do
+for ac_file in `ls conftest$ac_exeext conftest.exe conftest conftest.* \
+ 2>/dev/null`; do
case $ac_file in
*.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
*) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'`
@@ -675,7 +705,24 @@
esac
done],
[AC_MSG_ERROR([cannot compute EXEEXT: cannot compile and link])])
-rm -f conftest$ac_cv_exeext])
+rm -f conftest.$ac_ext conftest$ac_cv_exeext
+])# _AC_COMPILER_EXEEXT_O
+
+
+# _AC_COMPILER_EXEEXT
+# -------------------
+# Check for the extension used for executables. It compiles a test
+# executable. If this is called, the executable extensions will be
+# automatically used by link commands run by the configure script.
+#
+# Note that some compilers (cross or not), strictly obey to `-o foo' while
+# the host requires `foo.exe', so we should not depend upon `-o' to
+# test EXEEXT. But then, be sure no to destroy user files.
+m4_define([_AC_COMPILER_EXEEXT],
+[AC_CACHE_CHECK([for executable suffix], ac_cv_exeext,
+ [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
+_AC_COMPILER_EXEEXT_DEFAULT
+_AC_COMPILER_EXEEXT_O])
AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl
ac_exeext=$EXEEXT
])# _AC_COMPILER_EXEEXT