#!/usr/bin/awk -f 

## Copyright (C) 1996-2018 The Squid Software Foundation and contributors
##
## Squid software is distributed under GPLv2+ license and includes
## contributions from numerous individuals and organizations.
## Please see the COPYING and CONTRIBUTORS files for details.
##

BEGIN {
	print "/* Generated automatically from cf.data.pre DO NOT EDIT */"
	print "/*"
	print " * Copyright (C) 1996-2018 The Squid Software Foundation and contributors"
	print " *"
	print " * Squid software is distributed under GPLv2+ license and includes"
	print " * contributions from numerous individuals and organizations."
	print " * Please see the COPYING and CONTRIBUTORS files for details."
	print " */"
	print ""
	print "#include \"autoconf.h\""
	print "static struct { const char *name; const char *enable; int defined;} defines[] = {"
	define["_SQUID_WINDOWS_"]="MS Windows"
	define["FOLLOW_X_FORWARDED_FOR"]="--enable-follow-x-forwarded-for"
	define["FOLLOW_X_FORWARDED_FOR&&LINUX_NETFILTER"]="--enable-follow-x-forwarded-for and --enable-linux-netfilter"
	define["FOLLOW_X_FORWARDED_FOR&&USE_ADAPTATION"]="--enable-follow-x-forwarded-for and (--enable-icap-client and/or --enable-ecap)"
	define["FOLLOW_X_FORWARDED_FOR&&USE_DELAY_POOLS"]="--enable-follow-x-forwarded-for and --enable-delay-pools"
	define["HAVE_MSTATS&&HAVE_GNUMALLOC_H"]="GNU Malloc with mstats()"
	define["ICAP_CLIENT"]="--enable-icap-client"
	define["SO_MARK&&USE_LIBCAP"]="Packet MARK (Linux)"
	define["SQUID_SNMP"]="--enable-snmp"
	define["USE_ADAPTATION"]="--enable-ecap or --enable-icap-client"
	define["USE_AUTH"]="--enable-auth"
	define["USE_CACHE_DIGESTS"]="--enable-cache-digests"
	define["USE_DELAY_POOLS"]="--enable-delay-pools"
	define["USE_ECAP"]="--enable-ecap"
	define["USE_ERR_LOCALES"]="--enable-auto-locale"
	define["USE_HTCP"]="--enable-htcp"
	define["USE_HTTP_VIOLATIONS"]="--enable-http-violations"
	define["USE_ICMP"]="--enable-icmp"
	define["USE_IDENT"]="--enable-ident-lookups"
	define["USE_LOADABLE_MODULES"]="--enable-loadable-modules"
	define["USE_OPENSSL"]="--with-openssl"
	define["USE_QOS_TOS"]="--enable-zph-qos"
	define["USE_SQUID_ESI"]="--enable-esi"
	define["USE_SQUID_EUI"]="--enable-eui"
	define["USE_SSL_CRTD"]="--enable-ssl-crtd"
	define["USE_UNLINKD"]="--enable-unlinkd"
	define["USE_WCCP"]="--enable-wccp"
	define["USE_WCCPv2"]="--enable-wccpv2"
}
/^IFDEF:/ {
	if (define[$2] != "")
	    DEFINE=define[$2]
	else
	    DEFINE="-D" $2 " define"
	print "{\"" $2 "\", \"" DEFINE "\", "
	print "#if " $2
	print "1"
	print "#else"
	print "0"
	print "#endif"
	print "},"
}
END {
	print "{(char const *)0L, (char const *)0L, 0}};"
}
