I have a fairly large program written in C. It spans several files, and has a bit of retooling in order to attempt to compensate for platform issues. Specifically, I have header files for different OSes, architectures, and compilers that define macros that it uses to handle things. As an example, the -v
flag prints version info, including the name of the compiler that built it, and the operating system and architecture it was built on. As an example of why it's important, the program can create a C code file and, if you like, compile it - a task for which it simply makes a system call to whatever compiler it was built with.
It also has support for the GNU Readline library (or the BSD Editline library - same thing) if it is found on your system, as well as an equivalent without all the nice Readline features that is pure ANSI if you don't have it.
The bottom line is, I can't take out any of the platform-dependent bits, as several functions depend rather heavily on what OS/architecture/compiler you have. I also want to provide good functionality to those who have it. And I want people to download and install it with a standard ./configure
, make
and make install
interface.
Currently I'm using a sorry handmade shell script for configure
that creates the Makefile from scratch, and determines which header files to include based on your OS/architecture/compiler. I'd like a more efficient approach, and I'd like to use a more standard build system using GNU Autotools. That way I know that what I do will work on someone else's computer without having to go around testing it on their computers.
My question, for those of you who've slogged through all of that (thank you!), is: 1) How do I go about switching from a homebrew build system to GNU Autotools? 2) What good tutorials are there for getting started with GNU Autotools? 3) How can I make this a relatively painless process?