replace memalign with custom implementation, as it's not supported on osx
change LDFLAGS to work on osx
enable maximal debugging flags (otherwise gdb doesn't seem to pick up all important debugging info)