#! /bin/sh

SED="/opt/freeware/bin/sed"
prefix="/opt/freeware"
datarootdir="/opt/freeware/php"
exec_prefix="${prefix}"
version="7.4.2"
vernum="70402"
include_dir="${prefix}/include/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"
ldflags=" -L/opt/freeware/lib"
libs="  -lrt -lldap -llber -liconv -liconv -lbz2 -lrt -lm  -lxml2 -lssl -lcrypto -lsqlite3 -lz -lcurl -lssl -lcrypto -lxml2 -lssl -lcrypto -lz -lpng16 -lfreetype -lonig -lxml2 -lxml2 -lxml2 -lxml2 -lxml2 -lzip -lz -lssl -lcrypto "
extension_dir='/opt/freeware/lib/php/modules'
man_dir=`eval echo ${datarootdir}/man`
program_prefix=""
program_suffix=""
exe_extension=""
php_cli_binary=NONE
php_cgi_binary=NONE
configure_options=" '--prefix=/opt/freeware' '--with-config-file-path=/opt/freeware/etc' '--with-config-file-scan-dir=/opt/freeware/etc/php.d' '--disable-debug' '--enable-shared' '--enable-static' '--enable-bcmath' '--without-pear' '--with-openssl' '--with-zlib' '--with-bz2' '--with-curl=/opt/freeware' '--enable-gd' '--with-freetype' '--with-jpeg-dir=/opt/freeware' '--with-xpm-dir=no' '--with-zlib-dir=/opt/freeware' '--with-ldap=/opt/freeware' '--enable-soap' '--enable-ftp' '--enable-sockets' '--enable-mbstring' '--with-zip' '--with-iconv=/opt/freeware' '--with-iconv-dir=/opt/freeware' '--with-mysqli=mysqlnd' '--enable-dom' '--enable-json' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/opt/freeware' '--with-pdo-sqlite=shared,/opt/freeware' '--with-unixODBC=shared,/opt/freeware' '--libdir=/opt/freeware/lib' '--libexecdir=/opt/freeware/lib' 'PKG_CONFIG_PATH=:/opt/freeware/lib/pkgconfig:/opt/freeware/share/pkgconfig' 'CC= /opt/freeware/bin/gcc -maix32 -O2' 'LDFLAGS=-L/opt/freeware/lib -lpthread -lm -lXpm -Wl,-bmaxdata:0x80000000' 'OPENSSL_CFLAGS=-I/usr/include/openssl' 'OPENSSL_LIBS=-lssl -lcrypto' 'CXX=/opt/freeware/bin/g++ -maix32 -O2'"
php_sapis=" cli phpdbg cgi"
ini_dir="/opt/freeware/etc/php.d"
ini_path="/opt/freeware/etc"

# 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
