copy codes from https://launchpad.net/gozk/zookeeper
fix compile error of wrong CFLAGS