September 5th, 2006

belize

memcached autoconf/automake help

I don't want this to turn into an "Autotools sucks!" thread. I just want help....

Requirements:
  • I want "make test" to run against a binary that has assert() enabled (AM_CFLAGS not containing "-DNDEBUG").
  • I want users to have a choice to run a binary with asserts on or off. CPU vs. paranoia trade-off. Whether this is building two binaries and installing them both on the system, or letting them choose with --without-asserts or --with-asserts, I don't care.
What's the best way to do this?
Are there best practices regarding similar things? (testing with asserts on, regardless of their ultimate choice)

Here's my current Makefile.am:
bin_PROGRAMS = memcached memcached_SOURCES = memcached.c slabs.c items.c memcached.h assoc.c memcached_LDADD = @LIBOBJS@ SUBDIRS = doc DIST_DIRS = scripts EXTRA_DIST = doc scripts TODO t test: memcached prove t # Uncomment the following to save some CPU (by disabling assertions) #AM_CFLAGS=-DNDEBUG dist-hook: rm -rf $(distdir)/doc/.svn/ rm -rf $(distdir)/scripts/.svn/ rm -rf $(distdir)/t/.svn/ rm -rf $(distdir)/t/lib/.svn/
Suggestions?