return to OCLUG Web Site
A Django site.
December 16, 2012

Michael P. Soulier
But I Digress
» Getting started with autotools

So, I'm still reading O'Rielly's 21st Century C. I know, too many books on the go and I read slowly, and not often enough. I'm going through the section on GNU autotools, which I've never been a heavy user of, albiet I'm a heavy consumer of. I just don't spend much time distributing C/C++ across platforms.

I have a little C tool that I figured I'd try it on, a small replacement for GNU tree that I wrote a while back, and since tree isn't available on OS X, it seemed a good excuse to port it. Previously I just had a Makefile that I maintained, and it works fine, but it's a good excuse to learn how to use autotools for the future. I do have some libraries, and they're harder to port, which is where libtool comes in.

This build script outlines the process of using autotools for the first time. This script borrows very heavily from the book's author.


echo "Creating"
cat > <<EOF

echo "Running autoscan..."

echo "Creating"
sed -e 's/FULL-PACKAGE-NAME/twig/' \
    -e 's/VERSION/1.0/'   \
    -e 's|BUG-REPORT-ADDRESS||' \
    -e '10i\
        < configure.scan >

echo "Creating additional files..."

echo "Running autoreconf..."
autoreconf -iv

echo "Running configure..."

echo "Running make distcheck to package sources..."
make distcheck

At this point, it's not ready to ship, as the NEWS, README, AUTHORS and ChangeLog aren't populated yet. But it's close. The configure script works, and I could then build it on OS X using the expected.

./configure --prefix=/usr/local
make install

My next project to package is a shared library for work, so that will be more interesting. Still, if you're looking to use autotools for the first time for something simple, this should take the mystery out of kick-starting it. Sure, there's some magic like the AM_INIT_AUTOMAKE macro, and I've a ton to learn yet, but this worked on the first try, and the resulting tarball is good to push to SourceForge or elsewhere if you want to.

As I pick up more, I'll try to share it. I don't find autotools intuitive at all, but with some simple recipes I think I'll survive.

November 7, 2012

Michael P. Soulier
But I Digress
» 21st Century C

I saw a sale from O'Reilly Publishing tonight on an new ebook for 21st Century C. I have a good history with O'Reilly and C programming, so it caught my attention.

When I was in University, Practical C Programming taught me much more than any of my professors, and Unix System Programming for System VR4 taught me a great deal more about programming C on Unix/Linux. After reading those books, I became actually comfortable in working in C for all of my assignments, and other students kept coming to me for help until I had somehow become a local C expert. Amazing what a good investment in reading material will do, not to mention actually reading said material. Another friend in University taught me that. He told me not to ever begrudge the cost of a book that helps you get better at what you do. I've applied that lesson ever since.

I relied on O'Reilly for my first introduction to C++, with C++, the Core Language, which finally explained to me where some of my memory leaks were coming from, by explaining copy constructors and assignment operators. I turned to another book to finish most of my C++ education, but O'Reilly got me started.

Since University, with the wealth of information on the Internet, I haven't bought many C books, but I did pick up Advanced Unix Programming, second edition, on the recommendation of a coworker, and he did not lead me astray, the book is excellent. Mind you, I still haven't finished reading it. I seem to buy books faster than I read them these days.

Maybe one day I'll take a little vacation just to read. Anyway...

Looking at the new O'Reilly book, it looks like it has many practical ideas for someone living with C from day to day, and should also provide a nice introduction to the new C11 standard, just released in December of last year. Hopefully it'll sharpen my skills like previous O'Reilly books have. I'll try to post a full review once I've finished it...err...if I finish it.

I will stop buying faster than I can read. I will stop buying faster than I can read. Maybe if I keep repeating that, it'll sink in.

December 9, 2010

Dave O'Neill
» Fun With Perl, Dynamic Linking, and C++ Exceptions

I'm hacking on some tools that use the Search::Xapian module to build up search indexes. It's an excellent Perl interface to Xapian, but unfortunately it seemed to be too slow for our purposes. Tracing our code showed that much of the slowness was in passing data back and forth between Perl and the C++ library for every call.

I decided to write my own XS module to speed things up. Instead of using Search::Xapian, I'd bundle everything up into a Perl datastructure, and pass it down to libxapian through my own module, once, and do all the indexing work in C++. This worked great -- until I started trying to do some exception handling.


March 30, 2009

Rick Leir
» The art of debugging with GDB, DDD, and Eclipse

The art of debugging with GDB, DDD, and Eclipse / by Norman Matloff, No Starch Press, 2008

This book is important reading for anyone programming on Linux in C++, Java, Perl, or Python. It is very readable with 250 pages.

Get it here at OPL

March 28, 2009

Rick Leir
» How to think about algorithms

How to think about algorithms / Jeff Edmonds, Cambridge University Press, 2008

Here is a CS textbook for advanced undergraduate courses which is more readable than most. Apply its concepts to make your programs correct and fast.  450 pages.

Get it here at OPL

» Cocoa programming for Mac OS X for dummies

Cocoa programming for Mac OS X for dummies / by Erick Tejkowski, Wiley, 2009

Here is GUI application programming for the MAC. Learn the Cocoa IDE and a bit about programming in Objective C. The author gives lots of practical advice and some code examples in 375 pages.

Get it here at OPL

March 17, 2009

Rick Leir
» GNU/Linux application programming

GNU/Linux application programming / M. Tim Jones, Charles River Media, 2008

This is about programming using bash, awk, lex, Python, and similar languages. It also covers automake, gdb, gprof, networking and virtualization. It also explains the use of multiple processes and threads with pthreads and IPC. It is very readable. This is a thick book, and covers a lot of topics. It steers clear of the kernel and drivers.

Get it here at OPL

March 11, 2009

Rick Leir
» Professional multicore programming

Professional multicore programming : design and implementation for C++ developers / Cameron Hughes, Tracey Hughes, Wiley, 2008

Concurrent programming has become important for a greater proportion of all programmers since commodity PC’s went multicore. Good books on this have been in OPL for years (click on the 5-star tag to see some of them).  This book is useful because it gathers all the important topics into one place.  It starts with a good introduction, then outlines machine architecture for Intel, AMD, Sparc and Cell. Then it gets into programming structure for thread synchronization, with code examples in C++.  It has good reference information on Posix threads (pthreads).  It is intended for C++ programmers, but Java programmers will gain from reading it too.

Get it here at OPL

March 4, 2009

Rick Leir
» Programming principles and practice using C++

Programming principles and practice using C++ / Bjarne Stroustrup, Addison-Wesley, 2009

Here is a really good introduction to C++, written by the original designer of C++. At 1200 pages, it will keep you busy for a while. It does not assume any programming experience, and is a good textbook for a university course.

Get it here at OPL

February 8, 2009

Rick Leir
» Programming Microsoft Visual C♯

Programming Microsoft Visual C♯ 2008 : the language / Donis Marshall, Microsoft Press, 2008

Here are 750 pages of reference information on C#.

Get it here at OPL

» C# 2008 programmer’s reference

C# 2008 programmer’s reference / Wei-Meng Lee, Wiley, 2009

Here are 800 pages of reference information on C#.

Get it here at OPL

February 3, 2009

Rick Leir
» Foundations of Qt development

Foundations of Qt development / Johan Thelin, Apress 2007

Here is another great book on the best C++ development environment. QT is more than just a library of GUI functions. It supports XML i/o, I18n, threading, databases, networking, and qmake. Of course, it does portable GUI’s well. Free for open source projects!

Get it here at OPL

January 24, 2009

Rick Leir
» C++ programming cookbook

Herb Schildt’s C++ programming cookbook / Herb Schildt, McGraw-Hill, 2008

The best way to learn C++ is to read some well written code, preferably with brief comments or discussion. This book is your best source for the main STL and C++ library idioms. When you are writing new code, you would do well to have this book close at hand.

Get it here from OPL

December 3, 2008

Rick Leir
» C# 2008

C# 2008 for programmers / Paul J. Deitel, Harvey M. Deitel, Prentice Hall, 2009

Here are 1000+ pages packed with good tutorial material on C#, ASP.NET, WCF, WPF, and Silverlight.

Get it from OPL

November 11, 2008

Rick Leir
» Linux system programming

Linux system programming / Robert Love, O’Reilly, c2007

If you are writing the next universal db converter or such in C on Linux, this book is for you. Linux has many improvements over Unix, and this book is an easily read manual for them.  It covers IO, process and  memory management, signals, and time.  No networking or pthreads.

Get it form OPL

» Advanced programming in the Unix environment

Advanced programming in the Unix environment / W. Richard Stevens, Stephen A. Rago, Addison-Wesley, 2005

If you are doing systems programming in C on Unix, this book is indispensable. It is slightly dated, and does not cover the latest improvements in Linux.

Get it from OPL

October 19, 2008

Rick Leir
» Programming interviews exposed

Programming interviews exposed : secrets to landing your next job / John Mongan, Noah Suojanen, Eric Giguère. Wiley Pub., 2007

If you work in technology, whether programming or similar, you probably need to look for new work now and then. This book is the best I have seen for advice on how to interview, negotiate pay, and prepare your resume. Useful to hiring managers too.

There is another way to approach this book.  More than half of the book is programming algorithms that you would learn in undergrad CS, and you can read it to refresh your knowledge.

Get it from OPL

September 20, 2008

Rick Leir
» Effective C++ : 55 specific ways

Effective C++ : 55 specific ways to improve your programs and designs / Scott Meyers, Addison-Wesley, 2005

Some very useful idioms in C++ are not obvious. For example, making a class non-copyable. Maybe you know of the idiom but don’t know the simplest or cleanest way to apply it. Maybe you have never encountered it. This book discusses some of the most useful ones.

Get it from OPL

September 14, 2008

Rick Leir
» Linux debugging

book coverLinux debugging and performance tuning : tips and techniques / Steve Best, Prentice Hall,  2006

This book is for programmers developing Linux applications, particularly if you have multiple processes or threads.  It has been useful in my current work.  In the open source world there is a profusion of tools available, to the point that it is hard to know which ones to use.  This book reduces your search to the top runners.

Get it from OPL

August 22, 2008

Rick Leir
» Visual C++ 2008

book coverVisual C++ 2008 : how to program / P.J. Deitel, H.M. Deitel, D.T. Quirk. Prentice Hall : 2008.

Almost 1500 pages! A cover sure to wake you if you nod off! I have dipped into this book, and wish I had time to read it all.  It is slightly biased towards Microsoft’s tools, but all c++ programmers will find it valuable.

Get it from OPL