#! /bin/sh

SED="/bin/sed"
prefix="/usr"
exec_prefix="${prefix}"
version="5.2.13"
vernum="50213"
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   -lcrypt -lreadline -lncurses -lpcre -lrt -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt "
extension_dir='/usr/lib/php/20060613'
program_prefix=""
program_suffix=""
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--prefix=/usr' '--sysconfdir=/etc/php' '--with-layout=GNU' '--with-config-file-path=/etc/php' '--with-config-file-scan-dir=/etc/php/conf.d' '--enable-inline-optimization' '--disable-debug' '--disable-rpath' '--disable-static' '--enable-shared' '--mandir=/usr/share/man' '--disable-cgi' '--with-readline' '--enable-pcntl' '--with-pear=/usr/share/pear' '--with-openssl=shared' '--with-zlib=shared' '--enable-bcmath=shared' '--with-bz2=shared' '--enable-calendar=shared' '--with-curl=shared' '--enable-dba=shared' '--without-db2' '--without-db3' '--with-db4=shared' '--with-gdbm=shared' '--enable-dbase=shared' '--enable-exif=shared' '--enable-ftp=shared' '--with-gd=shared' '--enable-gd-native-ttf' '--with-jpeg-dir=shared,/usr' '--with-png-dir=shared,/usr' '--with-gettext=shared' '--with-imap=shared' '--with-imap-ssl=shared' '--with-ldap=shared' '--enable-mbstring=shared' '--with-mcrypt=shared' '--with-mysql=shared' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysql=shared' '--with-mysqli=shared' '--with-ncurses=shared' '--with-unixODBC=shared,/usr' '--enable-pdo=shared' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared,/usr' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared' '--with-sqlite=shared' '--enable-sqlite-utf8' '--with-pgsql=shared' '--enable-shmop=shared' '--with-snmp=shared' '--enable-soap=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--with-tidy=shared' '--with-xsl=shared' '--enable-zip=shared' '--enable-posix=shared' '--enable-sockets=shared' '--enable-xml' '--with-ttf=shared' '--enable-session=shared' '--with-regex=php' '--with-pcre-regex=/usr' '--enable-mbstring=all' '--enable-mbregex' '--enable-json=shared' '--with-iconv=shared' '--with-xmlrpc=shared' '--with-pspell=shared' '--with-freetype-dir=shared,/usr' '--with-mime-magic=shared' '--with-gmp=shared' '--with-mhash=shared'"
php_sapis="cli cli"

# 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;;
--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]
  --php-binary        [$php_binary]
  --php-sapis         [$php_sapis]
  --configure-options [$configure_options]
  --version           [$version]
  --vernum            [$vernum]
EOF
  exit 1;;
esac

exit 0
