Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.)

like image 951
Andrej Bauer Avatar asked Mar 11 '12 07:03

Andrej Bauer


2 Answers

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.

like image 179
Multimedia Mike Avatar answered Dec 22 '22 03:12

Multimedia Mike


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

like image 44
adl Avatar answered Dec 22 '22 03:12

adl