#!/usr/bin/env bash

export CC="gcc"
export CFLAGS="-O2 -Wall -fvisibility=hidden -flto -DZEPHIR_RELEASE=1"

phpize_bin=$(which phpize 2> /dev/null || which phpize5 2> /dev/null)

if [ -z $(which sudo 2> /dev/null) ]; then
    alias sudo=""
fi

if [ -f Makefile ]; then
	sudo make -s clean
	sudo ${phpize_bin} --silent --clean
fi

${phpize_bin} --silent

./configure --silent --enable-phalcon
make -s && sudo make -s install
