#### Archived

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

# configure ...

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

## 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 on other sites
autoconf. At your console prompt, type the following commands and read the information presented:
info auotoconfinfo automake

Enjoy!

##### Share on other sites
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

(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.

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 17
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632660
• Total Posts
3007696
• ### Who's Online (See full list)

There are no registered users currently online

×