#! /bin/sh

SED="/usr/bin/sed"
prefix="/opt/homebrew/Cellar/php/8.5.2"
datarootdir="/opt/homebrew/Cellar/php/8.5.2/share"
exec_prefix="${prefix}"
version="8.5.2"
vernum="80502"
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/opt/homebrew/Cellar/openssl@3/3.6.0/lib -L/opt/homebrew/Cellar/pcre2/10.47/lib -L/opt/homebrew/opt/sqlite/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/lib -L/opt/homebrew/Cellar/curl/8.18.0/lib -L/opt/homebrew/Cellar/gd/2.3.3_6/lib -L/opt/homebrew/opt/gettext/lib -L/opt/homebrew/opt/gmp/lib -L/opt/homebrew/Cellar/icu4c@78/78.2/lib -L/opt/homebrew/opt/openldap/lib -L/opt/homebrew/Cellar/oniguruma/6.9.10/lib -L/opt/homebrew/Cellar/unixodbc/2.3.14/lib -L/opt/homebrew/opt/freetds/lib -L/opt/homebrew/opt/libpq/lib -L/opt/homebrew/Cellar/net-snmp/5.9.5.2/lib -L/opt/homebrew/opt/openssl@3/lib -L/opt/homebrew/Cellar/libsodium/1.0.21/lib -L/opt/homebrew/Cellar/argon2/20190702_1/lib -L/opt/homebrew/opt/tidy-html5/lib -L/opt/homebrew/Cellar/libzip/1.11.4/lib"
libs="  -ltidy -lresolv -lncurses -lsybdb -lldap -llber -lstdc++ -liconv -lintl -lbz2  -lxml2 -lssl -lcrypto -lpcre2-8 -lsqlite3 -lz -lcurl -lxml2 -lffi -lssl -lcrypto -lgd -lgmp -licuio -licui18n -licuuc -lsasl2 -lonig -lodbc -lodbc -lpq -lsqlite3 -lpq -ledit -lxml2 -lnetsnmp -lcrypto -lxml2 -lsodium -largon2 -lxml2 -lxml2 -lxml2 -lxslt -lxml2 -lexslt -lxslt -lxml2 -lzip -lz -lssl -lcrypto"
extension_dir="/opt/homebrew/Cellar/php/8.5.2/pecl/20250925"
man_dir=`eval echo ${datarootdir}/man`
program_prefix=""
program_suffix=""
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--prefix=/opt/homebrew/Cellar/php/8.5.2' '--localstatedir=/opt/homebrew/var' '--sysconfdir=/opt/homebrew/etc/php/8.5' '--with-config-file-path=/opt/homebrew/etc/php/8.5' '--with-config-file-scan-dir=/opt/homebrew/etc/php/8.5/conf.d' '--with-pear=/opt/homebrew/Cellar/php/8.5.2/share/php/pear' '--enable-bcmath' '--enable-calendar' '--enable-dba' '--enable-exif' '--enable-ftp' '--enable-fpm' '--enable-gd' '--enable-intl' '--enable-mbregex' '--enable-mbstring' '--enable-mysqlnd' '--enable-pcntl' '--enable-phpdbg' '--enable-phpdbg-readline' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-apxs2=/opt/homebrew/opt/httpd/bin/apxs' '--with-bz2=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr' '--with-curl' '--with-external-gd' '--with-external-pcre' '--with-ffi' '--with-fpm-user=_www' '--with-fpm-group=_www' '--with-gettext=/opt/homebrew/opt/gettext' '--with-gmp=/opt/homebrew/opt/gmp' '--with-iconv=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr' '--with-layout=GNU' '--with-ldap-sasl' '--with-ldap=/opt/homebrew/opt/openldap' '--with-libedit' '--with-libxml' '--with-mhash=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=mysqlnd' '--with-ndbm=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr' '--with-openssl' '--with-password-argon2=/opt/homebrew/opt/argon2' '--with-pdo-dblib=/opt/homebrew/opt/freetds' '--with-pdo-mysql=mysqlnd' '--with-pdo-odbc=unixODBC,/opt/homebrew/opt/unixodbc' '--with-pdo-pgsql=/opt/homebrew/opt/libpq' '--with-pdo-sqlite' '--with-pgsql=/opt/homebrew/opt/libpq' '--with-pic' '--with-snmp=/opt/homebrew/opt/net-snmp' '--with-sodium' '--with-sqlite3' '--with-tidy=/opt/homebrew/opt/tidy-html5' '--with-unixODBC' '--with-xsl' '--with-zip' '--with-zlib' '--enable-dtrace' 'PKG_CONFIG_PATH=/opt/homebrew/opt/pkgconf/lib/pkgconfig:/opt/homebrew/opt/apr/lib/pkgconfig:/opt/homebrew/opt/openssl@3/lib/pkgconfig:/opt/homebrew/opt/apr-util/lib/pkgconfig:/opt/homebrew/opt/argon2/lib/pkgconfig:/opt/homebrew/opt/brotli/lib/pkgconfig:/opt/homebrew/opt/libnghttp2/lib/pkgconfig:/opt/homebrew/opt/libnghttp3/lib/pkgconfig:/opt/homebrew/opt/libngtcp2/lib/pkgconfig:/opt/homebrew/opt/libssh2/lib/pkgconfig:/opt/homebrew/opt/rtmpdump/lib/pkgconfig:/opt/homebrew/opt/lz4/lib/pkgconfig:/opt/homebrew/opt/xz/lib/pkgconfig:/opt/homebrew/opt/zstd/lib/pkgconfig:/opt/homebrew/opt/curl/lib/pkgconfig:/opt/homebrew/opt/unixodbc/lib/pkgconfig:/opt/homebrew/opt/libpng/lib/pkgconfig:/opt/homebrew/opt/freetype/lib/pkgconfig:/opt/homebrew/opt/fontconfig/lib/pkgconfig:/opt/homebrew/opt/jpeg-turbo/lib/pkgconfig:/opt/homebrew/opt/highway/lib/pkgconfig:/opt/homebrew/opt/imath/lib/pkgconfig:/opt/homebrew/opt/libtiff/lib/pkgconfig:/opt/homebrew/opt/little-cms2/lib/pkgconfig:/opt/homebrew/opt/libdeflate/lib/pkgconfig:/opt/homebrew/opt/openjph/lib/pkgconfig:/opt/homebrew/opt/openexr/lib/pkgconfig:/opt/homebrew/opt/jpeg-xl/lib/pkgconfig:/opt/homebrew/opt/libvmaf/lib/pkgconfig:/opt/homebrew/opt/aom/lib/pkgconfig:/opt/homebrew/opt/dav1d/lib/pkgconfig:/opt/homebrew/opt/libavif/lib/pkgconfig:/opt/homebrew/opt/webp/lib/pkgconfig:/opt/homebrew/opt/gd/lib/pkgconfig:/opt/homebrew/opt/gmp/lib/pkgconfig:/opt/homebrew/opt/icu4c@78/lib/pkgconfig:/opt/homebrew/opt/krb5/lib/pkgconfig:/opt/homebrew/opt/libpq/lib/pkgconfig:/opt/homebrew/opt/libsodium/lib/pkgconfig:/opt/homebrew/opt/libzip/lib/pkgconfig:/opt/homebrew/opt/net-snmp/lib/pkgconfig:/opt/homebrew/opt/oniguruma/lib/pkgconfig:/opt/homebrew/opt/openldap/lib/pkgconfig:/opt/homebrew/opt/pcre2/lib/pkgconfig:/opt/homebrew/opt/readline/lib/pkgconfig:/opt/homebrew/opt/sqlite/lib/pkgconfig:/opt/homebrew/opt/tidy-html5/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/14' 'SASL_CFLAGS=-I/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sasl' 'SASL_LIBS=-lsasl2' 'PHP_BUILD_PROVIDER=Homebrew'"
php_sapis=" apache2handler cli fpm phpdbg cgi"
ini_dir="/opt/homebrew/etc/php/8.5/conf.d"
ini_path="/opt/homebrew/etc/php/8.5"
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
