#! /bin/sh

SED="/opt/local/bin/gsed"
prefix="/opt/local"
datarootdir="/opt/local/php"
exec_prefix="${prefix}"
version="8.2.12"
vernum="80212"
include_dir="/opt/local/include/php82/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 -I/opt/local/include"
ldflags=" -L/opt/local/lib"
libs="  -lresolv -lncurses -lbz2 -lnetwork -lm  -lxml2 -lpcre2-8 -lz -lxml2 -ledit -lxml2 -largon2 -lxml2 -lxml2 -lxml2 -lz "
extension_dir='/opt/local/lib/php82/extensions/no-debug-non-zts-20220829'
man_dir=`eval echo /opt/local/share/man`
program_prefix=""
program_suffix="82"
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--prefix=/opt/local' '--mandir=/opt/local/share/man' '--infodir=/opt/local/share/info' '--program-suffix=82' '--includedir=/opt/local/include/php82' '--libdir=/opt/local/lib/php82' '--with-config-file-path=/opt/local/etc/php82' '--with-config-file-scan-dir=/opt/local/var/db/php82' '--disable-all' '--enable-bcmath' '--enable-ctype' '--enable-dom' '--enable-filter' '--enable-json' '--enable-pdo' '--enable-session' '--enable-simplexml' '--enable-tokenizer' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-bz2=/opt/local' '--with-mhash=/opt/local' '--with-zlib=/opt/local' '--disable-cgi' '--enable-cli' '--with-libxml' '--with-external-pcre=/opt/local' '--enable-fileinfo' '--enable-phar' '--disable-fpm' '--with-password-argon2=/opt/local' '--without-valgrind' '--with-libedit'"
php_sapis=" cli phpdbg"
ini_dir="/opt/local/var/db/php82"
ini_path="/opt/local/etc/php82"

# 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;;
--ini-path)
  echo $ini_path;;
--ini-dir)
  echo $ini_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]
  --ini-path          [$ini_path]
  --ini-dir           [$ini_dir]
  --configure-options [$configure_options]
  --version           [$version]
  --vernum            [$vernum]
EOF
  exit 1;;
esac

exit 0
