#! /bin/sh

SED="/usr/bin/sed"
prefix="/usr/pkg"
datarootdir="/usr/pkg/"
exec_prefix="${prefix}"
version="5.6.40"
vernum="50640"
include_dir="${prefix}/include/php/5.6"
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/usr/pkg/lib"
libs="-lcrypt   -lcrypto -lssl -lcrypto -lcrypt -lcrypto -lssl -lcrypto -lrt -lm  -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt "
extension_dir='/usr/pkg/lib/php/5.6/i486'
man_dir=`eval echo /usr/pkg/man`
program_prefix=""
program_suffix="56"
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--program-suffix=56' '--with-config-file-path=/usr/pkg/etc/php/5.6' '--with-config-file-scan-dir=/usr/pkg/etc/php/5.6/php.d' '--sysconfdir=/usr/pkg/etc/php/5.6' '--libdir=/usr/pkg/lib/php/5.6' '--datadir=/usr/pkg/share/php/5.6' '--localstatedir=/var' '--with-regex=system' '--without-mysql' '--without-iconv' '--without-pear' '--without-sqlite3' '--disable-posix' '--disable-opcache' '--disable-pdo' '--disable-json' '--enable-mysqlnd' '--enable-xml' '--with-libxml-dir=/usr/pkg' '--enable-ipv6' '--with-openssl=/usr' '--without-readline' '--enable-cgi' '--prefix=/usr/pkg' '--build=i486--netbsdelf' '--host=i486--netbsdelf' '--mandir=/usr/pkg/man' '--enable-option-checking=yes' 'build_alias=i486--netbsdelf' 'host_alias=i486--netbsdelf' 'CC=gcc' 'CFLAGS=-O2 '-Wno-error=incompatible-pointer-types' '-Wno-error=int-conversion' '-pthread' '-I/usr/pkg/include/libxml2' '-I/usr/include' '-Dz_off_t=long'' 'LDFLAGS=-Wl,-zrelro '-L/usr/pkg/lib' '-Wl,-R/usr/pkg/lib' '-L/usr/lib' '-Wl,-R/usr/lib' '-pthread'' 'LIBS=' 'CPPFLAGS=-I/usr/pkg/include/libxml2 '-I/usr/include' '-Dz_off_t=long'' 'CXX=c++' 'CXXFLAGS=-O2 '-Wno-error=incompatible-pointer-types' '-Wno-error=int-conversion' '-pthread' '-I/usr/pkg/include/libxml2' '-I/usr/include' '-Dz_off_t=long''"
php_sapis=" 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
