<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >I want to add some configure stuff, how could I do this? [GTK 2.x]</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="GTK+ FAQ" HREF="book1.html"><LINK REL="UP" TITLE="Development with GTK+: the begining" HREF="c377.html"><LINK REL="PREVIOUS" TITLE="I use the backquote stuff in my makefiles, but my make process failed. [GTK 2.x]" HREF="x424.html"><LINK REL="NEXT" TITLE="I try to debug my GTK+ application with gdb, but it hangs my X server when I hit some breakpoint. Any Idea? [GTK 2.x]" HREF="x452.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >GTK+ FAQ</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x424.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Development with GTK+: the begining</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x452.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN430" >I want to add some configure stuff, how could I do this? <I CLASS="EMPHASIS" >[GTK 2.x]</I ></A ></H1 ><P >To use autoconf/automake, you must first install the relevant packages. These are:</P ><P ></P ><UL COMPACT="COMPACT" ><LI ><SPAN >the m4 preprocessor v1.4 or better</SPAN ></LI ><LI ><SPAN >autoconf v2.54 or better</SPAN ></LI ><LI ><SPAN >automake v1.7 or better suggested</SPAN ></LI ></UL ><P >You'll find these packages on the main GNU ftp server (<A HREF="ftp://ftp.gnu.org/" TARGET="_top" >ftp://ftp.gnu.org/</A >) or on any GNU mirror.</P ><P >In order to use the powerful autoconf/automake scheme, you must create a configure.in which may look like:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >dnl Process this file with autoconf to produce a configure script. dnl configure.in for a GTK+ based program AC_INIT(myprg.c) AM_INIT_AUTOMAKE(mypkgname, 0.0.1) AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC dnl check for the c compiler dnl you should add CFLAGS="" here, 'cos it is set to -g by PROG_CC dnl Checks for libraries. AM_PATH_GTK_2_0(2.2.0,,AC_MSG_ERROR(mypkgname 0.1 needs GTK+ 2.2.0)) AC_OUTPUT( Makefile )</PRE ></TD ></TR ></TABLE ><P >You must add a Makefile.am file:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >bin_PROGRAMS = myprg myprg_SOURCES = myprg.c foo.c bar.c INCLUDES = @GTK_CFLAGS@ LDADD = @GTK_LIBS@ CLEANFILES = *~ DISTCLEANFILES = .deps/*.P</PRE ></TD ></TR ></TABLE ><P >If your project contains more than one subdirectory, you'll have to create one Makefile.am in each directory plus a master Makefile.am which will look like:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >SUBDIRS = mydir1 mydir2 mydir3</PRE ></TD ></TR ></TABLE ><P >then, to use these, simply type the following commands:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >aclocal autoheader autoconf automake --add-missing --include-deps --foreign </PRE ></TD ></TR ></TABLE ><P >For further information, you should look at the autoconf and the automake documentation (the shipped info files are really easy to understand, and there are plenty of web resources that deal with autoconf and automake).</P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x424.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x452.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >I use the backquote stuff in my makefiles, but my make process failed. <I CLASS="EMPHASIS" >[GTK 2.x]</I ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="c377.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >I try to debug my GTK+ application with gdb, but it hangs my X server when I hit some breakpoint. Any Idea? <I CLASS="EMPHASIS" >[GTK 2.x]</I ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >