views:

264

answers:

4

I'm trying to build a program I've written in C using GNU autotools, but I evidently have it set up wrong because when configure runs, it spits out:

configure: error: C compiler cannot create executables

If I look in config.log, I see:

configure:2846: checking for C compiler default output file name
configure:2868: gcc    conftest.c  >&5
conftest.c:3:25: warning: missing terminating " character
conftest.c:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "Jackoff"
| #define PACKAGE_TARNAME "jackoff
|       http://github.com/enaeseth/jackoff"
| #define PACKAGE_VERSION "0.1"
| #define PACKAGE_STRING "Jackoff 0.1"
| #define PACKAGE_BUGREPORT "Eric Naeseth <[email protected]>"
| #define PACKAGE "jackoff
|       http://github.com/enaeseth/jackoff"
| #define VERSION "0.1"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }

For some reason, autoconf is generating an invalid test file: what should be on that line that is coming up as just an semicolon? The build fails in the same way on Ubuntu 9.04 and Mac OS X 10.6, so this is definitely my fault, not the environment's.

+2  A: 

It looks like the problem is in a new-line character in "jackoff http://github.com/enaeseth/jackoff". Check that.

Viliam
+1  A: 

The trouble is that there is a newline in the PACKAGE_TARNAME (and PACKAGE), which is set in the configure.ac file. You should look at what that contains - fix it, and regenerate the configure script.

One of my configure.ac scripts contains (near the top):

AC_CONFIG_HEADER(config.h)

PACKAGE="sqlcmd"
VERSION="86.04"

AC_MSG_RESULT([Configuring $PACKAGE version $VERSION])

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
Jonathan Leffler
A: 

PACKAGE_TARNAME doesn't look at all right. For one thing, it has an embedded newline, which is the direct cause of your problem.

DigitalRoss
A: 

You have an extra argument for AC_INIT at the beginning of your configure.ac. Just remove it.

Paolo Capriotti