Archived

This topic is now archived and is closed to further replies.

configure ...

This topic is 5872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites