Zoé Martin
Zoé Martin

Reputation: 1897

Am I using libtool correctly?

I am running Linux, Ubuntu 10.04 .

It is not the first time I try to use autotools. I did a lot of researches and follow a lot of tutorials : here is what I want to do, what I tried and what issue I am facing.

Goal :

What I tried and where I am :

From there, everything is ok. But then I try to compile :

$ ./configure

Everything ok too...

$ make

and then I get :

...
src/graphics_engine/FXP_rendering.c:35:25: error: FXP_image_s.h: File not found
...

where :

This means : automake can compile .c files in a sub directory, but can't include in these files a private .h file that is in an other sub directory.

My problem is : How to tell automake to compile every files in every subdirectories as if they were all in the same place ?

I hope I am understandable (and sorry for some problems you could find in my words, cause I am French)

Thank you by advance.

Upvotes: 5

Views: 2897

Answers (1)

ptomato
ptomato

Reputation: 57854

Your configure.ac and Makefile.am files look like you must have put a lot of effort into learning. Congratulations! One useful tip is that you can just run autoreconf instead of the whole chain of aclocal, autoheader, autoconf, automake, etc.

The problem in this case is actually not the autotools, but the C compiler itself - you are executing the compiler in your project's root directory to compile a file in src/sub, but since src/sub2 is neither the current directory nor in the include path, the compiler doesn't know where to find it.

Try adding -I$(srcdir)/src/sub2 to your libfxplib_0_1_la_CFLAGS line in Makefile.am. This will change the include path so as to instruct the compiler to look for header files in src/sub2, so you will have to add a similar instruction for every sub directory containing header files used in another directory.

Upvotes: 8

Related Questions