Hi folks! I'm trying to convince autotools to allow me to include fish.c in a C file containing a bunch of unit tests. In order to do that I need to convince it add include path (-I../) to gcc for that particular file (test-quoting.c originally, but dash seems to make troubles as well). I came up with this (snippet from Makefile.am): bin_TESTS = testquoting testquoting_CFLAGS = -I../ TESTS = testquoting And it does not work (snippet of make check output): gcc -std=gnu99 -std=gnu99 -g -O2 testquoting.c -o testquoting In file included from testquoting.c:4:0: fish.c:19:20: fatal error: config.h: No such file or directory #include <config.h> Could you please share your thoughts on this? The motivation to include fish.c is storage type (static) of functions of interest. thanks, - m
On Thursday 04 September 2014 18:06:05 Maros Zatko wrote:
I'm trying to convince autotools to allow me to include fish.c in a C file containing a bunch of unit tests. In order to do that I need to convince it add include path (-I../) to gcc for that particular file (test-quoting.c originally, but dash seems to make troubles as well). I came up with this (snippet from Makefile.am):
bin_TESTS = testquoting
IIRC this isn't needed if your test is already added to TESTS.
testquoting_CFLAGS = -I../
Try with testquoting_CPPFLAGS. -- Pino Toscano
On 09/04/2014 06:49 PM, Pino Toscano wrote:
On Thursday 04 September 2014 18:06:05 Maros Zatko wrote:
I'm trying to convince autotools to allow me to include fish.c in a C file containing a bunch of unit tests. In order to do that I need to convince it add include path (-I../) to gcc for that particular file (test-quoting.c originally, but dash seems to make troubles as well). I came up with this (snippet from Makefile.am):
bin_TESTS = testquoting IIRC this isn't needed if your test is already added to TESTS. Indeed
testquoting_CFLAGS = -I../ Try with testquoting_CPPFLAGS. Tried, it does cut it either.
On Fri, Sep 05, 2014 at 01:21:58PM +0200, Maros Zatko wrote:
testquoting_CFLAGS = -I../ Try with testquoting_CPPFLAGS. Tried, it does cut it either.
automake itself adds -I.. to the list of flags. Try using `make V=1' to see that, eg: make: Entering directory `/home/rjones/d/libguestfs/fish' make all-am make[1]: Entering directory `/home/rjones/d/libguestfs/fish' gcc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -DCOMPILING_GUESTFISH=1 -DGUESTFS_WARN_DEPRECATED=1 -DLOCALEBASEDIR=\""/usr/share/locale"\" -I../src -I../src -I../fish -I../fish -I./../gnulib/lib -I../gnulib/lib [etc] '-DHAVE_CONFIG_H -I. -I..' are added by automake itself. So it ought to just work, but it's hard to tell what's going on unless you use `make V=1'. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
On 09/05/2014 02:04 PM, Richard W.M. Jones wrote:
On Fri, Sep 05, 2014 at 01:21:58PM +0200, Maros Zatko wrote:
testquoting_CFLAGS = -I../ Try with testquoting_CPPFLAGS. Tried, it does cut it either. automake itself adds -I.. to the list of flags. Try using `make V=1' to see that, eg:
make: Entering directory `/home/rjones/d/libguestfs/fish' make all-am make[1]: Entering directory `/home/rjones/d/libguestfs/fish' gcc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -DCOMPILING_GUESTFISH=1 -DGUESTFS_WARN_DEPRECATED=1 -DLOCALEBASEDIR=\""/usr/share/locale"\" -I../src -I../src -I../fish -I../fish -I./../gnulib/lib -I../gnulib/lib [etc]
'-DHAVE_CONFIG_H -I. -I..' are added by automake itself.
So it ought to just work, but it's hard to tell what's going on unless you use `make V=1'.
Rich. Did not help either. I've tried AM_CFLAGS and AM_CPPFLAGS too. Same results.
-m
participants (3)
-
Maros Zatko -
Pino Toscano -
Richard W.M. Jones