Advertisement

configure ...

Started by November 14, 2001 04:55 PM
2 comments, last by TheMummy 22 years, 10 months ago
Hi, I just started with corss platform development. Currently I write my Makefiles by hand. All source code packages I have seen so far use configure scripts that create the Makefiles for the system ... How can I make these scripts for my code ?? Thanks in advance
While I haven''t done it myself, I think the tool used is called automake. I need to learn how soon anyway, so I''ll go do some reading .

[Resist Windows XP''s Invasive Production Activation Technology!]
Advertisement
autoconf. At your console prompt, type the following commands and read the information presented:
info auotoconfinfo automake 

Enjoy!
Basically, you create a Makefile.am file and write the following informations to it :

LDFLAGS = -libname1 -libname2
bin_PROGRAMS = progname
progname_SOURCES = file1.cc file2.cc
include_HEADERS = header1.h header2.h

(replace libnames with the libraries required by your program, progname by the name of the binary).

Then you create configure.in and write this :

AC_INIT(file1.cc)
AM_INIT_AUTOMAKE(progname,0.1)
AC_PROG_CXX
AC_PROG_INSTALL
AC_OUTPUT(Makefile)

the 0.1 in AM_INIT_AUTOMAKE is the version of your program. AC_PROG_CXX the name of the compiler (it would be AC_PROG_CC for C and I guess than GCC and GXX would work). AC_OUTPUT(Makefile) tells configure to write the informations to a file named Makefile. This can also be done by calling ''autoscan'' and then editing the ''configure.scan'' file and finally renaming it ''configure.in''.

Now, just type ''aclocal'' in your source directory, then ''autoconf'' and finally ''automake -a'' (it will probably complain about missing files like ''Authors'' etc, just ''touch'' them and rerun ''automake -a'').


This is a simplistic example, as it assumes than all your files are in the same directory, but it should get you started (the man pages and info are probably not good for *starting* this, they''re mostly reminders). You''ll also want to check tools like ''autoheader'' and ''autoscan'', but I''m sure you''ll figure them out easily.

This is mostly a rewrite of GNU''s "hello world" example for the autotools. Their tutorials are by far better explained and more complete. This barely touches the power of the autotools.

Hope this helps.

This topic is closed to new replies.

Advertisement