#! /bin/sh

SED="/bin/sed"
prefix="/opt/php5"
datarootdir="/opt/php5/php"
exec_prefix="${prefix}"
version="5.6.29"
vernum="50629"
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=" -L/var/mc_compile/softs/src/imap-2007f-fpic-gss/c-client -L/usr/lib/x86_64-linux-gnu/mit-krb5"
libs="-lcrypt  -lc-client  -lresolv -lcrypt -lldap -llber -lcrypt -lpam -lz -lsqlite3 -lrt -lm -ldl -lnsl  -lxml2 -lxml2 -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lxml2 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lssl -lcrypto -lcrypt "
extension_dir='/opt/php5/lib/php/extensions/no-debug-non-zts-20131226'
man_dir=`eval echo ${datarootdir}/man`
program_prefix=""
program_suffix=""
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--prefix=/opt/php5' '--sysconfdir=/etc/opt/php5' '--with-apxs2=/opt/apache2/bin/apxs' '--with-config-file-path=/etc/opt/php5/' '--with-libdir=lib/x86_64-linux-gnu/' '--with-zlib=/usr' '--enable-bcmath=shared' '--with-bz2=shared' '--enable-calendar=shared' '--with-jpeg-dir=shared' '--with-curl=shared' '--enable-dba=shared' '--with-gdbm=shared' '--enable-exif=shared' '--with-gd=shared' '--with-freetype-dir=/usr' '--with-gettext=shared' '--with-gmp=shared' '--with-openssl=shared' '--with-imap=/var/mc_compile/softs/src/imap-2007f-fpic-gss' '--with-imap-ssl=shared' '--with-ldap' '--enable-mbstring=shared' '--with-mcrypt=shared' '--with-mhash=shared' '--with-mysql' '--with-mysql-sock=/var/opt/mysql5/mysqld.sock' '--with-libedit=shared' '--with-readline=shared' '--with-snmp=shared' '--enable-soap' '--enable-sockets' '--with-pear' '--with-freetype-dir=shared' '--enable-gd-native-ttf' '--enable-ftp' '--with-iconv=shared' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-zip=shared' '--with-libxml-dir=shared' '--with-pcre-regex' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-opcache' '--with-sqlite3=/usr' '--without-pdo-sqlite' '--with-kerberos'"
php_sapis=" apache2handler cli 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
