I'm attempting to build a basic GTK+ application and am having a few difficulties with automake (Gentoo Linux, latest of pretty much everything.):
First, I run my bootstrap script:
Code:
tom@fee gpim $ cat bootstrap.sh
#!/bin/sh
aclocal
autoconf
automake -a --copy --gnu
./configure
tom@fee gpim $ cat configure.in
AC_INIT(src/main.c)
AM_INIT_AUTOMAKE(gpim, 1.0)
AC_PROG_CC
# TODO: check for gtk+ 2.x
AC_OUTPUT( Makefile src/Makefile )
tom@fee gpim $ ./bootstrap.sh
creating cache ./config.cache
checking for a BSD compatible install... /bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal-1.4... found
checking for working autoconf... found
checking for working automake-1.4... found
checking for working autoheader... found
checking for working makeinfo... found
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating src/Makefile
So far so good. Now, make:
Code:
tom@fee gpim $ cat Makefile.am
SUBDIRS=src
tom@fee gpim $ cat src/Makefile.am
bin_PROGRAMS=gpim
gpim_SOURCES=main.c gpim_contact.c gpim_contactlistio.c
gpim_CFLAGS=-Wall -I../include `pkg-config gtk+-2.0 --cflags`
gpim_LDFLAGS=`pkg-config gtk+-2.0 --libs` -lexpat
tom@fee gpim $ make
Making all in src
make[1]: Entering directory `/home/tom/work.d/software/gpim/src'
gcc -DPACKAGE=\"gpim\" -DVERSION=\"1.0\" -I. -I. -g -O2 -c main.c
main.c:1:21: gtk/gtk.h: No such file or directory
main.c:3: error: syntax error before '*' token
main.c: In function `main':
main.c:8: error: `GtkWidget' undeclared (first use in this function)
main.c:8: error: (Each undeclared identifier is reported only once
main.c:8: error: for each function it appears in.)
main.c:8: error: `main_wnd' undeclared (first use in this function)
main.c:13: error: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)
main.c:14: error: `NULL' undeclared (first use in this function)
make[1]: *** [main.o] Error 1
make[1]: Leaving directory `/home/tom/work.d/software/gpim/src'
make: *** [all-recursive] Error 1
Here two problems are evident:
- my CFLAGS are not being passed to the compiler ...
- ... and as a result gtk/gtk.h cannot be found
Does anybody know what might be going on? Weird thing is, if I use INCLUDE instead of gpim_CFLAGS, it works (even gpim_LDFLAGS is passed to the linker).
What am I doing wrong?