Rewritten script for automatic CFLAGS setup.