-# set configure options
-#
-OPTS=${OPTS}
-if [ "$2" == "-pcre" ]; then
- CFLAGS="${CFLAGS} -I/usr/local/include/"
- LDFLAGS="${LDFLAGS} -L/usr/local/lib"
+# set configure options based on the parameters passed at the command line
+
+for option in "$@"
+do
+ # set pcre library source to dynamic (libpcre - more up to date but requires the external library to exist for compiling) or static (bundled with privoxy - older version)
+ if [ "$option" == "-pcre" ]; then
+ CFLAGS="${CFLAGS} -I/usr/local/include/"
+ LDFLAGS="${LDFLAGS} -L/usr/local/lib"
+ OPTS="${OPTS}"
+ fi
+
+ # enable HTTPS Inspection?
+ if [ "$option" == "-https" ]; then
+ CFLAGS="${CFLAGS} -I/usr/local/opt/openssl@3/include/"
+ CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/openssl@3/include/"
+ LDFLAGS="${LDFLAGS} -L/usr/local/opt/openssl@3/lib"
+ OPTS="${OPTS} --with-openssl"
+ fi
+done
+
+# if we didn't select external PCRE, set option to use the bundled one
+if [[ "${CFLAGS}" != *"-I/usr/local/include/"* ]]; then
+ OPTS="${OPTS} --disable-dynamic-pcre"