#! /bin/sh

SED="/usr/bin/sed"
prefix="/usr"
datarootdir="/usr/php"
exec_prefix="${prefix}"
version="8.4.14"
vernum="80414"
include_dir="${prefix}/include/php"
lib_dir="/usr/lib"
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="  -lreadline -lncurses -lstdc++ -lm  -lxml2 -lssl -lcrypto -lz -lxml2 -lssl -lcrypto -lxml2 -lxml2 -lxml2 -lxml2 -lz -lssl -lcrypto"
extension_dir="/usr/lib/php/modules"
man_dir=`eval echo /usr/share/man`
program_prefix=""
program_suffix=""
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--prefix=/usr' '--libdir=/usr/lib' '--srcdir=../php-8.4.14' '--sysconfdir=/etc' '--localstatedir=/var' '--datadir=/usr/share/php' '--with-config-file-path=/etc/php' '--with-config-file-scan-dir=/etc/php/conf.d' '--mandir=/usr/share/man' '--enable-cgi' '--enable-fpm' '--with-fpm-systemd' '--with-fpm-acl' '--with-fpm-user=apache' '--with-fpm-group=apache' '--enable-embed=shared' '--enable-libxml=shared' '--enable-bcmath=shared' '--enable-calendar=shared' '--enable-dba=shared' '--enable-exif=shared' '--enable-ftp' '--enable-gd=shared' '--enable-intl=shared' '--enable-mbstring=shared' '--with-bz2=shared' '--with-curl=shared' '--with-enchant=shared' '--with-ffi=shared' '--with-gettext=shared' '--with-gdbm' '--with-gmp=shared' '--with-mysqli=shared' '--with-mysql-sock=/run/mysqld/mysqld.sock' '--with-pdo-mysql=shared' '--with-pdo-pgsql=shared' '--with-pdo-sqlite=shared' '--with-openssl' '--with-pgsql=shared' '--with-readline' '--with-sqlite3=shared' '--with-xsl=shared' '--with-zip=shared' '--with-zlib' 'EXTENSION_DIR=/usr/lib/php/modules'"
php_sapis=" cli embed fpm phpdbg cgi"
ini_dir="/etc/php/conf.d"
ini_path="/etc/php"
php_embed_type="shared"

# 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

# Set embed SAPI library path
if test "$php_embed_type" = "shared"; then
  php_embed_lib=libphp.so
elif test "$php_embed_type" = "static"; then
  php_embed_lib=libphp.a
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;;
--lib-dir)
  echo $lib_dir;;
--lib-embed)
  echo $php_embed_lib;;
--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]
  --lib-dir           [$lib_dir]
  --lib-embed         [$php_embed_lib]
  --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
