Stupid Robots

Autotools Trick: config.site

This is a quick trick for those who have to continually set up common settings when using Autotools style configure scripts. One of the initial steps a configure script does is to look for a $prefix/share/config.site file and then to execute its contents. An example of how this may be useful is if you have some common libraries that are not on the default search paths for your compiler and you want CFLAGS and LDFLAGS set automatically. In my case I commonly use the Nvidia OpenCL headers, which on the machines I use are installed to /usr/local/cuda/include. To use them, I could have a config.log file like so in my default installation prefix.

1
CPPFLAGS="${CPPFLAGS} -I/usr/local/cuda/include"

Now when I run configure, it picks up that additional flag for the C preprocessor.

A more complicated example is if you maintain a seperate prefix. I do this in my home folder for my CS department account. Because my home folder is shared over NFS to all of the department’s machines, and many of them have different architectures and operating environments, I keep a prefix for different classes of machines. For example:

~/local/
        fast-sparc/
        fast-ubuntu/
        nv-s1070/
        nv-c870/
        src/

The src directory is just a repository for all of the source packages that I end up installing in the other directories. In my .bashrc I export a variable, LOCAL_PREFIX, that is set to the prefix for the machine I’m logging into. Then, all I need to do is ./configure --prefix=$LOCAL_PREFIX and the compiler flags are properly set for that prefix. Another possibility is to export the CONFIG_SITE variable set to the path to the config.site file for that machine configuration.

More details about config.site can be found in the Autoconf manual.

NSString Cons

One of the fundamental operators in functional languages is ‘cons’. It concatenates lists of things together, and since strings are usually treated as lists of characters, cons gets a lot of use in string processing as well. One of the cool tricks I saw done with Objective-C a while ago was implementing cons on NSString, using : like Haskell and ML do. I have been unable to find the original site, so I decided to reimplement it myself recently.

cWavelet

Weekend project I made: cWavelet.

It’s a simple wavelet library written in pure C. I’ve been trying to wrap my head around wavelets off and on for about three months, and I finally got them enough to write a library. It is still being developed, but it does simple forward transforms (as far as I can tell correctly) right now. In the future, I hope to implement portions of it in OpenCL and/or MPI so I can try it out on the clusters at school.

Ubuntu 10.04 on a Dell Mini 9

The Mac OS X install on my Mini 9 was recently borked (friend was borrowing it, and an unclean shutdown corrupted the file system), and I didn’t have the install discs on me. I’d also been messing with the Lucid Lynx beta in a VM on my machine, and was very impressed with the level of polish, so I decided to install Ubuntu on the Mini again and see how it went.