Suppress "C source seen but `CC` undefined" in automake?
Asked Answered
A

2

9

I have a Makefile.am for compiling Ocaml source code with ocamlbuild. However, even though I have

AM_INIT_AUTOMAKE([foreign no-dependencies])

in my configure.ac, automake thinks that a C compiler must be present to install exectuables. That is, if I put in Makefile.am a target executable under bin_PROGRAMS that is to be built with ocamlbuild, autoreconf (version 1.11.3) tells me:

Makefile.am: C source seen but `CC' is undefined
Makefile.am:   The usual way to define `CC' is to add `AC_PROG_CC'
Makefile.am:   to `configure.ac' and run `autoconf' again.
autoreconf: automake failed with exit status: 1

I do not want to include AC_PROG_CC because my source code includes no C. It is pure Ocaml. What can I do? (I have the same problem with libexec_PROGRAMS.)

Alfonzoalford answered 11/3, 2012 at 7:57 Comment(0)
O
5

It may be unneeded, but will it hurt anything to simply add AC_PROG_CC to Makefile.am? Path of least resistance and all.

Working off this decade-old mailing list message:

http://lists.gnu.org/archive/html/automake/2003-01/msg00057.html

It sounds like you might need to define progname_SOURCES as empty. If I understand the post correctly, if you omit an explicit declaraction, progname_SOURCES will implicitly be defined as progname.c.

Our answered 11/3, 2012 at 18:15 Comment(3)
AC_PROG_CC will probably add unneeded tests, slowing down configure.Mudlark
This one is how things should be done. Just set progname_SOURCES to the empty value. So I am declaring that this one is the "accepted answer".Alfonzoalford
I was struggling against a similar problem until I read this answer and realised that my "progname" contained invalid characters ('+'). Everything went fine after renaming my progname.Kind
P
5

If you add AC_SUBST([CC]) to configure.ac, that will be enough to define the variable as far as Automake is concerned.

Perri answered 11/3, 2012 at 19:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.