#!/bin/sh

# openssl-config
# provides configuration info for openssl.

version="1.0.2q"
openssldir="/etc/pki/tls"
cppflags=""
cflags="-O2 -Wa,--compress-debug-sections -gdwarf-4 -fvar-tracking-assignments -frecord-gcc-switches -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -ffat-lto-objects -fno-delete-null-pointer-checks -fstack-protector --param=ssp-buffer-size=4 -fPIC"
ldflags=" -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -Wl,--hash-style=gnu"
libs="-lcrypto -lssl"

usage()
{
    cat <<EOF
Usage: openssl-config [OPTION] ...

Known values for OPTION are:

  --openssldir		print OpenSSL directory
  --cflags              print compiler flags
  --cppflags            print pre-processor flags
  --ldflags             print loader flags
  --libs                print library linking information
  --help                display this help and exit
  --version             output version information
EOF

    exit $1
}

if test $# -eq 0; then
    usage 1
fi

while test $# -gt 0; do
    case "$1" in
    --openssldir)
        echo "${openssldir}"
        ;;
    --cflags)
        echo "${cflags}"
        ;;
    --cppflags)
        echo "${cppflags}"
        ;;
    --libs)
        echo "${libs}"
        ;;
    --ldflags)
        echo "${ldflags}"
        ;;
    --version)
        echo "${version}"
        exit 0
        ;;
    --help)
        usage 0
        ;;
    *)
        usage
        exit 1
        ;;
    esac
    shift
done

exit 0
