#! /bin/sh

SED="/usr/bin/sed"
prefix="/tmp/php-7.2.31/app/vendor/php-7.2.31"
datarootdir="/tmp/php-7.2.31/app/vendor/php-7.2.31/php"
exec_prefix="${prefix}"
version="7.2.31"
vernum="70231"
include_dir="${prefix}/include/php"
includes="-I$include_dir -I$include_dir/main -I$include_dir/TSRM -I$include_dir/Zend -I$include_dir/ext -I$include_dir/ext/date/lib"
ldflags=""
libs="-lcrypt   -largon2 -lresolv -lcrypt -lstdc++ -lrt -lm -ldl  -lxml2 -lz -llzma -lm -ldl -lxml2 -lz -llzma -lm -ldl -licuio -licui18n -licuuc -licudata -lxml2 -lz -llzma -lm -ldl -lcrypt -largon2 -largon2 -lxml2 -lz -llzma -lm -ldl -lxml2 -lz -llzma -lm -ldl -lxml2 -lz -llzma -lm -ldl -lssl -lcrypto -lcrypt "
extension_dir='/tmp/php-7.2.31/app/vendor/php-7.2.31/lib/php/extensions/no-debug-non-zts-20170718'
man_dir=`eval echo ${datarootdir}/man`
program_prefix=""
program_suffix=""
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--prefix=/tmp/php-7.2.31/app/vendor/php-7.2.31' '--disable-static' '--enable-shared' '--enable-ftp=shared' '--enable-sockets=shared' '--enable-soap=shared' '--enable-fileinfo=shared' '--enable-bcmath' '--enable-calendar' '--enable-intl' '--with-kerberos' '--with-bz2=shared' '--with-curl=shared' '--enable-dba=shared' '--with-password-argon2=/tmp/php-7.2.31/app/vendor/php-7.2.31/lib' '--with-cdb' '--with-gdbm' '--with-mysqli=shared' '--enable-pdo=shared' '--with-pdo-sqlite=shared,/usr' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-pgsql=shared' '--with-pgsql=shared' '--with-pspell=shared' '--with-gettext=shared' '--with-gmp=shared' '--with-imap=shared' '--with-imap-ssl=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-zlib=shared' '--with-libzip=shared' '--with-xsl=shared' '--with-snmp=shared' '--enable-mbstring=shared' '--enable-mbregex' '--enable-exif=shared' '--with-openssl=shared' '--enable-fpm' '--enable-pcntl=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-sysvmsg=shared' '--enable-shmop=shared' '--with-libdir=lib64'"
php_sapis=" cli fpm phpdbg cgi"

# Set php_cli_binary and php_cgi_binary if available
for sapi in $php_sapis; do
  case $sapi in
  cli)
    php_cli_binary="${exec_prefix}/bin/${program_prefix}php${program_suffix}${exe_extension}"
    ;;
  cgi)
    php_cgi_binary="${exec_prefix}/bin/${program_prefix}php-cgi${program_suffix}${exe_extension}"
    ;;
  esac
done

# Determine which (if any) php binary is available
if test "$php_cli_binary" != "NONE"; then
  php_binary="$php_cli_binary"
else
  php_binary="$php_cgi_binary"
fi

# Remove quotes
configure_options=`echo $configure_options | $SED -e "s#'##g"`

case "$1" in
--prefix)
  echo $prefix;;
--includes)
  echo $includes;;
--ldflags)
  echo $ldflags;;
--libs)
  echo $libs;;
--extension-dir)
  echo $extension_dir;;
--include-dir)
  echo $include_dir;;
--php-binary)
  echo $php_binary;;
--php-sapis)
  echo $php_sapis;;
--configure-options)
  echo $configure_options;;
--man-dir)
  echo $man_dir;;
--version)
  echo $version;;
--vernum)
  echo $vernum;;
*)
  cat << EOF
Usage: $0 [OPTION]
Options:
  --prefix            [$prefix]
  --includes          [$includes]
  --ldflags           [$ldflags]
  --libs              [$libs]
  --extension-dir     [$extension_dir]
  --include-dir       [$include_dir]
  --man-dir           [$man_dir]
  --php-binary        [$php_binary]
  --php-sapis         [$php_sapis]
  --configure-options [$configure_options]
  --version           [$version]
  --vernum            [$vernum]
EOF
  exit 1;;
esac

exit 0
