I hate autoconf
Update: autoconf and I have a tenuous peace treaty thanks to MSYS. See my post, “Haskell and freeglut at last!”, for an example of what I’ve been able to do :Update
I really do hate autoconf. I’ll probably end up upsetting a few C/C++ guys, but I’m pissed and I have a blog and that means I’m going to blog about being pissed.
I should warn you, I’ve never actually used autoconf in any of my projects. Being a Windows programmer, I’ve never had it easily available. For all I know, it’s a wonderful tool that saves gobs of effort, just not mine.
See, the problem isn’t so much autoconf, it’s the whole “autoconf on Windows” thing. In fact, it’s pretty much building anything on Windows. A whole lot of software projects claim to be ‘cross-platform’, and usually this is done with makefile and #define trickiness, with a lot of checking and configuring and editing done depending on what platform your build tools think you’re running on.
This is where the madness starts.
Why are all of these configuration doodads crammed into one set of headers? That pisses me off. The configuration between Windows and *nix is so wildly different in most cases that the resulting mega-header becomes a steaming pile of near incomprehensible preprocessor syntax that never configures for my Windows box properly. Why don’t these people just make a separate Windows header set if they really want Windows support?
But sometimes this doesn’t matter. Sometimes there’s a configure script that knows what the hell it’s doing, and it’s written in an OS neutral scripting language. Sometimes it just works. But not when autoconf enters the picture. Autoconf, in Windows, is a sign that reads ‘Pain’
Every time I’ve had to install a software package that required autoconf to build, I’ve ended up spending hours playing with it and still having to find a hack-around to get the package to compile without any autoconfing or I’ve given up and looked elsewhere for the functionality I wanted from that package. Needless to say(but I will anyway), I don’t like doing that.
Take my latest endeavor. I’m trying to build a Haskell GLUT binding with support for freeglut.
I’ve been struggling with this for a week on and off. Why? First off, there is no autoconf for Windows, and Haskell’s GLUT binding needs autoconf. That would seem to be quite the problem, but there are ways around it. Namely, the old favorite Cygwin and the newcomer(to me, anyway) MSYS.
I, of course, tried the Cygwin route first, since that’s what you do when you need *nix stuff in Windows. It was no easy task to get the binding to compile, even with access to autoconf, but I wont go over the steps here. Why, you ask? Because this path ends in linker errors. Lots of linker errors. I’ve never figured out why I had linker errors, but I’m guessing autoconf thought Cygwin was *nix-y enough to use the wrong calling conventions, paths and settings. Screw it, I’m not going to debug a configure script in an environment I don’t like, and my Cygwin environment isn’t nearly as familiar and friendly as the Ubuntu shell I’m used to. So, onward to MSYS.
With some tweaking, I got the binding to build. It wasn’t too hard, actually. I’m glad that worked out faster than on Cygwin, but I still don’t like having to move some stuff around to get the config script to function in the environment that I had to get just to run it. Not fun. Even after it built, because I’m too stupid to figure out how to set the install path for the install script, I had to move the generated library files to their proper place and edit my GHC(Haskell compiler) package config. Not fun either, but also not hard. Easier than figuring out how to tell the build chain where to put the files. With that done, it was time for the moment of truth.
Fingers crossed, I keyed in the compile command for my little Haskell OpenGL app.
Linker errors. @#$%!!
Change settings, move files, rub, rinse, and repeat the above headache about 15 times, substituting linker for compiler errors as needed, and you have a decent idea of what happens every time I try to build most ‘cross-platform’ projects, especially if they use autoconf.
Why is it so hard to build code? I don’t get it, and frankly, I don’t want to. I just want to make programs.
Well kids, what have we learned? I learned that I like MSYS. It makes this stuff a lot easier, and it plays well with MinGW, which is good because that’s what I use when I have to dabble in C. I also learned that makefiles often don’t(make, that is), and in a lot of cases you can just compile all the source files and link all the object files to get a working binary.
I just hope freeglut is worth it. More on this when I get it working.
Tags: C/C++, Haskell, Programming