#! /bin/sh

SED="/usr/bin/sed"
prefix="/var/cfengine/httpd/php"
datarootdir="/var/cfengine/httpd/php/php"
exec_prefix="${prefix}"
version="8.5.4"
vernum="80504"
include_dir="${prefix}/include/php"
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/var/cfengine/lib"
libs="  -lldap -llber -lm  -lxml2 -lz -lxml2 -lpq -lxml2 -lxml2 -lxml2 -lxml2"
extension_dir="/var/cfengine/httpd/php/lib/php/extensions/no-debug-non-zts-20250925"
man_dir=`eval echo ${datarootdir}/man`
program_prefix=""
program_suffix=""
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--prefix=/var/cfengine/httpd/php' '--with-config-file-scan-dir=/var/cfengine/httpd/php/lib' '--without-apxs2' '--with-openssl=shared,/var/cfengine' '--with-curl=shared,/var/cfengine' '--with-ldap=/var/cfengine' '--with-pdo-pgsql=/var/cfengine' '--with-iconv' '--with-zlib=/var/cfengine' '--enable-mbstring' '--enable-sockets' '--disable-mbregex' '--enable-fpm' '--without-layout' '--without-sqlite3' '--without-bz2' '--without-qdbm' '--without-ndbm' '--without-db4' '--without-db3' '--without-db2' '--without-db1' '--without-dbm' '--without-tcadb' '--without-cdb' '--without-enchant' '--without-gettext' '--without-gmp' '--without-mhash' '--without-imap' '--without-imap-ssl' '--without-oci8' '--without-odbcver' '--without-adabas' '--without-sapdb' '--without-solid' '--without-ibm-db2' '--without-empress' '--without-empress-bcs' '--without-custom-odbc' '--without-iodbc' '--without-esoob' '--without-unixODBC' '--without-dbmaker' '--without-pdo-dblib' '--without-pdo-firebird' '--without-pdo-mysql' '--without-pdo-oci' '--without-pdo-odbc' '--without-pdo-sqlite' '--without-pgsql' '--without-pspell' '--without-libedit' '--without-readline' '--without-mm' '--without-snmp' '--without-tidy' '--without-xsl' '--without-pear' 'LD_LIBRARY_PATH=/var/cfengine/lib' 'LD_RUN_PATH=//var/cfengine/lib' 'PKG_CONFIG_PATH=//var/cfengine/lib/pkgconfig'"
php_sapis=" cli fpm phpdbg cgi"
ini_dir="/var/cfengine/httpd/php/lib"
ini_path="/var/cfengine/httpd/php/lib"
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="${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
