autoconf
[Top][All Lists]
Advanced

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

compile wrapper script with C++ file


From: David Byron
Subject: compile wrapper script with C++ file
Date: Fri, 14 Aug 2009 12:57:56 -0700

I'm not sure whether this is something I'm doing wrong or something wrong
with automake, autoconf or libtool.  At the moment I'm leaning to autoconf +
automake.

I'm building on a platform where -c -o doesn't work.  Here are what I think
are the relevant parts of my configure.ac:

AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O

and my configure invocation (run from msys):

../configure CC=cl CXX=cl

and my configure output:

checking whether cl and cc understand -c and -o together... no
checking how to run the C preprocessor... <absolute path to>/compile cl -E
checking how to run the C++ preprocessor... cl -E
checking if <absolute path to>/compile cl supports -c -o file.obj... yes
checking if <absolute path to>/compile cl supports -c -o file.obj...
(cached) yes
checking if cl supports -c -o file.obj... no
checking if cl supports -c -o file.obj... (cached) no

In the resulting Makefile I end up with:

CC = <absolute path to>/compile cl
CXX = cl

My C files compile file and the object files get renamed by the compile
script to go in the right place.

My C++ files (extension .cc) don't however.  They get compiled fine but they
don't end up in the correct place.  If I manually change the Makefile to
have:

CXX = <absolute path to>/compile cl

I get a step closer but I needed to modify the compile script as well (see
below).  With both of these changes, everything (C and C++) compile fine and
the objects go where they're supposed to.  Is the kind of thing that could
make its way upstream (maybe even for .cpp file support as well)?  I'm not
sure how to modify autoconf/configure to do what I did manually...or even
if's the "right thing".  

Thanks much for your feedback.

automake (GNU automake) 1.11
autoconf (GNU Autoconf) 2.63
libtool (GNU libtool 1.3107 2009-03-20) 2.2.7a

-DB

$ diff -u compile compile.dbyron
--- compile     Fri Aug 14 12:37:10 2009
+++ compile.dbyron      Fri Aug 14 12:38:02 2009
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand `-c -o'.

-scriptversion=2009-04-28.21; # UTC
+scriptversion=2009-08-14.19; # UTC

 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
 # Foundation, Inc.
@@ -79,7 +79,7 @@
            ;;
        esac
        ;;
-      *.c)
+      *.c|*.cc)
        cfile=$1
        set x "$@" "$1"
        shift
@@ -103,7 +103,7 @@
 fi

 # Name of file we expect compiler to create.
-cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/;
s/\.cc$/.o/'`

 # Create the lock directory.
 # Note: use `[/\\:.-]' here to ensure that we don't use the same name





reply via email to

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