#! /bin/sh

SED="/usr/bin/sed"
prefix='/var/www/pear'
datarootdir="/usr/local/share"
exec_prefix="${prefix}"
version="8.4.22"
vernum="80422"
include_dir="/usr/local/share/php-8.4/include"
lib_dir="${exec_prefix}/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=" -L/usr/local/lib"
libs="  -lreadline -lncurses -liconv -lintl -lutil -lm  -lxml2 -lssl -lcrypto -lpcre2-8 -lz -lxml2 -lssl -lcrypto -lonig -lxml2 -lsodium -largon2 -lxml2 -lxml2 -lxml2 -lz -lssl -lcrypto"
extension_dir="/usr/local/lib/php-8.4/modules"
man_dir=`eval echo /usr/local/man`
program_prefix=""
program_suffix="-8.4"
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--enable-opcache' '--disable-rpath' '--disable-static' '--enable-shared' '--program-suffix=-8.4' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php-8.4' '--with-layout=GNU' '--with-external-pcre' '--with-pcre-jit=no' '--with-pear=/usr/local/share/php-8.4' '--with-pic' '--with-readline' '--without-valgrind' '--with-mysql-sock=/var/run/mysql/mysql.sock' '--with-gettext=/usr/local' '--with-iconv=/usr/local' '--with-openssl' '--with-password-argon2=/usr/local' '--with-sodium=/usr/local' '--with-zlib' '--enable-bcmath' '--enable-calendar' '--enable-ctype' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-phar' '--enable-session' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-xml' '--with-capstone' '--enable-cli' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--enable-cgi' '--enable-phpdbg' '--with-apxs2=/usr/local/sbin/apxs' '--with-bz2=shared,/usr/local' '--with-curl=shared,/usr/local' '--enable-dba=shared' '--with-gdbm=/usr/local' '--with-enchant=shared,/usr/local' '--with-external-gd' '--enable-gd=shared' '--with-freetype=/usr/X11R6' '--with-jpeg=/usr/local' '--with-webp=/usr/local' '--with-xpm=/usr/X11R6' '--with-gmp=shared,/usr/local' '--enable-intl=shared' '--with-ldap=shared,/usr/local' '--with-mysqli=shared' '--with-iodbc=shared,/usr/local' '--enable-pcntl=shared' '--with-pdo-dblib=shared,/usr/local' '--with-pdo-mysql=shared' '--with-pdo-odbc=shared,iODBC,/usr/local' '--with-pdo-pgsql=shared,/usr/local' '--with-pdo-sqlite=shared,/usr/local' '--with-pgsql=shared,/usr/local' '--enable-shmop=shared,/usr/local' '--with-snmp=shared,/usr/local' '--enable-soap=shared,/usr/local' '--with-sqlite3=shared,/usr/local' '--with-tidy=shared,/usr/local' '--with-xsl=shared' '--enable-dom' '--with-zip=shared' '--prefix=/usr/local' '--sysconfdir=/etc' '--mandir=/usr/local/man' '--infodir=/usr/local/info' '--localstatedir=/var' '--disable-silent-rules' '--disable-gtk-doc' 'CFLAGS=-O2 -pipe -I/usr/local/include -pthread' 'EXTENSION_DIR=/usr/local/lib/php-8.4/modules'"
php_sapis=" apache2handler cli fpm phpdbg cgi"
ini_dir="/etc/php-8.4"
ini_path="/etc"
php_embed_type=""

# Set php_cli_binary and php_cgi_binary if available
for sapi in $php_sapis; do
  case $sapi in
  cli)
    php_cli_binary="/usr/local/bin/php${program_suffix}"
    ;;
  cgi)
    php_cgi_binary="${exec_prefix}/bin/${program_prefix}php-cgi${program_suffix}${exe_extension}"
    php_cgi_binary="/usr/local/bin/php-cgi${program_suffix}"
    ;;
  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
