#!/usr/bin/env bash
#
# This file was generated automatically by Zephir.
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
# (c) Phalcon Team <team@zephir-lang.com>
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.

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

IN_DOCKER=0

if [[ -f /proc/1/cgroup ]]
then
  if [[ -f /.dockerenv ]] || grep -Eq '/(lxc|docker)/[[:xdigit:]]{64}' /proc/1/cgroup
  then
    IN_DOCKER=1
  fi
fi

phpize="$(command -v phpize 2> /dev/null)"

sudo=""
test "$IN_DOCKER" -eq 0 && sudo="$(command -v sudo 2> /dev/null)"

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

${phpize} --silent

./configure --silent --enable-phalconplus CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"

make -s
$sudo make -s install
