autoconf-patches
[Top][All Lists]
Advanced

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

AC_PROG_CXX_C_O


From: Ralf Wildenhues
Subject: AC_PROG_CXX_C_O
Date: Fri, 19 May 2006 21:58:18 +0200
User-agent: Mutt/1.5.11+cvs20060403

[ this is just FYI for automake-patches ]

Automake needs some beef for better subdir-objects support.  
For C and C++, it works pretty decently already, but for other
languages, it is lacking some support, notably bug reports for
Assembler, Fortran have been seen.

Also, there are C++ compilers out there that do not support "-c -o":
http://lists.gnu.org/archive/html/libtool/2005-10/msg00063.html and
MSVC (without a wrapper such as cccl; it uses `/OUT' as flag).

Therefore, I'd like to add AC_PROG_CXX_C_O to Autoconf now, so that
Automake-1.10 will be able to use it.

The patch below implements that very suboptimally, by copying much of
_AC_PROG_FC_C_O.  A factoring may be done later easily, so I gather
this to be the safest route.

OK to apply?  I actually don't know whether there exists a losing
Fortran compiler outside of the Cray-Cyber museum, but if Automake
is going to use the macros, it's IMHO not suitable to suggest that
Autoconf could remove them.

Cheers,
Ralf

        * lib/autoconf/c.m4 (AC_PROG_CXX_C_O): New macro.
        * doc/autoconf.texi (C++ Compiler): Document it.
        * lib/autoconf/fortran.m4 (_AC_PROG_FC_C_O): Adjust comment.
        * NEWS: Update.

Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.369
diff -u -r1.369 NEWS
--- NEWS        10 May 2006 23:05:15 -0000      1.369
+++ NEWS        19 May 2006 19:32:47 -0000
@@ -5,6 +5,9 @@
   and ac_cv_prog_cc_c89 to 'no' as well, for backward compatibility with
   obsolete K&R tests in the Automake test suite.
 
+** AC_PROG_CXX_C_O
+  New macro.
+
 ** AC_PROG_MKDIR_P
   New macro.
 
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1017
diff -u -r1.1017 autoconf.texi
--- doc/autoconf.texi   13 May 2006 09:54:51 -0000      1.1017
+++ doc/autoconf.texi   19 May 2006 19:32:47 -0000
@@ -6409,6 +6409,14 @@
 it is not known whether such broken preprocessors exist for C++.
 @end defmac
 
address@hidden AC_PROG_CXX_C_O
address@hidden
address@hidden CXX_NO_MINUS_C_MINUS_O
+Test whether the C++ compiler accepts the options @option{-c} and
address@hidden simultaneously, and define @code{CXX_NO_MINUS_C_MINUS_O},
+if it does not.
address@hidden defmac
+
 
 @node Objective C Compiler
 @subsection Objective C Compiler Characteristics
Index: lib/autoconf/c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.224
diff -u -r1.224 c.m4
--- lib/autoconf/c.m4   7 May 2006 20:36:01 -0000       1.224
+++ lib/autoconf/c.m4   19 May 2006 19:32:47 -0000
@@ -824,6 +824,35 @@
 ])# _AC_PROG_CXX_G
 
 
+# AC_PROG_CXX_C_O
+# ---------------
+# Test if the C++ compiler accepts the options `-c' and `-o'
+# simultaneously, and define `CXX_NO_MINUS_C_MINUS_O' if it does not.
+AC_DEFUN([AC_PROG_CXX_C_O],
+[AC_LANG_ASSERT([C++])dnl
+AC_CACHE_CHECK([whether $CXX understands -c and -o together],
+               [ac_cv_prog_cxx_c_o],
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+# We test twice because some compilers refuse to overwrite an existing
+# `.o' file with `-o', although they will create one.
+ac_try='$CXX $CXXFLAGS -c conftest.$ac_ext -o conftest2.$ac_objext 
>&AS_MESSAGE_LOG_FD'
+rm -f conftest2.*
+if AC_TRY_EVAL(ac_try) &&
+     test -f conftest2.$ac_objext &&
+     AC_TRY_EVAL(ac_try); then
+  ac_cv_prog_cxx_c_o=yes
+else
+  ac_cv_prog_cxx_c_o=no
+fi
+rm -f conftest*])
+if test $ac_cv_prog_cxx_c_o = no; then
+  AC_DEFINE(CXX_NO_MINUS_C_MINUS_O, 1,
+            [Define to 1 if your C++ compiler doesn't accept
+             -c and -o together.])
+fi
+])# AC_PROG_CXX_C_O
+
+
 # ------------------------------ #
 # 3d. The Objective C compiler.  #
 # ------------------------------ #
Index: lib/autoconf/fortran.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/fortran.m4,v
retrieving revision 1.206
diff -u -r1.206 fortran.m4
--- lib/autoconf/fortran.m4     24 Apr 2006 06:51:53 -0000      1.206
+++ lib/autoconf/fortran.m4     19 May 2006 19:32:48 -0000
@@ -448,11 +448,7 @@
 # Test if the Fortran compiler accepts the options `-c' and `-o'
 # simultaneously, and define `[F77/FC]_NO_MINUS_C_MINUS_O' if it does not.
 #
-# The usefulness of this macro is questionable, as I can't really see
-# why anyone would use it.  The only reason I include it is for
-# completeness, since a similar test exists for the C compiler.
-#
-# FIXME: it seems like we could merge the C/Fortran versions of this.
+# FIXME: it seems like we could merge the C/C++/Fortran versions of this.
 AC_DEFUN([_AC_PROG_FC_C_O],
 [_AC_FORTRAN_ASSERT()dnl
 AC_CACHE_CHECK([whether $[]_AC_FC[] understands -c and -o together],




reply via email to

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