MESSAGE
DATE | 2008-10-02 |
FROM | Ruben
|
SUBJECT | Subject: [NYLXS - HANGOUT] Re: autoconf
|
On Thu, 02 Oct 2008 15:21:25 -0400, Alfred M. Szmidt wrote:
> I'm using this autogen.sh script > > Use autoreconf. > > > This is my top level configure.ac > > Looks fine. > > This is my toplevel Makefile.am > > Looks fine. > > This is my src directory Makefile.am > > Looks fine. > > one_window.cc:1:19: gtkmm.h: No such file or directory > > You did not specify where the compiler should look for headers (and > libraries). > > The resulting Makefile.in has > > MYAPP_CFLAGS = -at-MYAPP_CFLAGS-at- > MYAPP_LIBS = -at-MYAPP_LIBS-at- > > CFLAGS is used for C, not C++. CXXFLAGS is what you wish to look at, > and set. > > PKG_CHECK_MODULES I have never used that variable, maybe it is buggy > and does not set CXXFLAGS accordingly, check the documentation for it. > And maybe check with the people who maintain that macro (it isn't part > of autoconf or automake).
OK Alfred, you were right on the MONEY
So just to make this complete so that someone else can find this in the future I want to cut and paste this conversation on irc ---------------------------------------------------------------------- * Now talking on #gtk+ * Topic for #gtk+ is: Welcome to #gtk+: http://library.gnome.org/devel/gtk/stable/ | GtkTreeView tutorial: http://scentric.net/tutorial/ | Do use Glade! But, don't use Glade to generate source code!- http://developer.gnome.org/doc/API/2.0/libglade/index.html | Do not ask to ask! * Topic for #gtk+ set by __tim at Tue Jul 15 09:57:10 2008 mrbrklyn He;;p mrbrklyn hello mrbrklyn anyone have expereince with autoconf mrbrklyn and automake descender that's off-topic, but yeah I have mrbrklyn well I'm trying to use it with gtkmm according to the docs on that sight mrbrklyn and I can't get it to work, to find the gtk library mrbrklyn I'm missing something obvious and I don't know what it is mrbrklyn http://www.nylxs.com/messages.html?id=538339&archive=2008-10-01 descender mrbrklyn, trying running pkg-config --modversion gtkmm-2.4 to see if you have trouble with pkgconfig descender oh n/m, you've gone past that stage mrbrklyn pkg-config --modversion gtkmm-2.4 mrbrklyn 2.4.11 descender mrbrklyn, try adding two Automake targets: descender onewindow_CXXFLAGS = $(MYAPP_CFLAGS) descender onewindow_LDADD = $(MYAPP_LIBS) descender then rerun autotools descender .. variables I mean mrbrklyn add it to configure.ac? mrbrklyn or Makefile.am mrbrklyn ? descender mrbrklyn, the Makefile.am that resides alongside your C++ source files descender that one with bin_PROGRAMS = onewindow mrbrklyn Ok - BRB mrbrklyn descender - that did it. descender ok mrbrklyn Now my question is why? descender AFAICT, it has to do with your autoconf language settings mrbrklyn I'm going to need to do that for every external lib? descender PKG_CHECK_MODULES added the flags to CFLAGS but not CXXFLAGS descender CFLAGS isn't used to compile C++ programs= descender so the compiler flags were missing descender mrbrklyn, I add each lib manually mrbrklyn what does that mean? descender which? mrbrklyn to do it manually descender like this: descender onewindow_CXXFLAGS = $(LIB1_CFLAGS) $(LIB2_CFLAGS) $(LIB3_CFLAGS) .. descender onewindow_LDADD = $(LIB1_LIBS) $(LIB2_LIBS) $(LIB3_LIBS) .. descender I think it's possible to get PKG_CHECK_MODULES to add the detected flags to CXXFLAGS by setting the language to C++ with AC_LANG([CXX]) mrbrklyn thanks descender I'm wrong, PKG_CHECK_MODULES never modifies CFLAGS or CXXFLAGS, so you always have to add the variables manually as in the example I gave you descender I gotta go to bed
_______________________________________
The finished example for the autotool files look like this
configure.ac on the top level
AC_INIT(src/onewindow.cc)
AM_INIT_AUTOMAKE(onewindow_cc,0.1) AM_CONFIG_HEADER(config.h)
AC_PROG_CC AC_PROG_CXX
AC_PROG_INSTALL AC_PROG_LIBTOOL
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.4.0]) AC_OUTPUT(Makefile src/Makefile)
_________________________________________________
Top Level Makefile.am
SUBDIRS = src EXTRA_DIST=autogen.sh
______________________________________
/src level Makefile.am
AC_INIT(src/onewindow.cc)
AM_INIT_AUTOMAKE(onewindow_cc,0.1) AM_CONFIG_HEADER(config.h)
AC_PROG_CC AC_PROG_CXX
AC_PROG_INSTALL AC_PROG_LIBTOOL
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.4.0]) AC_OUTPUT(Makefile src/Makefile)
________________________________________________
all this is in reference to corrections needed for the gtkmm tutorial located at
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-headers-and-linking.html and
http://www.openismus.com/documents/linux/automake/automake.shtml#ExampleFiles
Thanks for everyones help!
Ruben Safir
-- http://www.mrbrklyn.com - Interesting Stuff http://www.nylxs.com - Leadership Development in Free Software
So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998
http://fairuse.nylxs.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
"Yeah - I write Free Software...so SUE ME"
"The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."
"> I'm an engineer. I choose the best tool for the job, politics be damned.< You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt. I guess you missed that one."
© Copyright for the Digital Millennium
|
|