As far as I remember I was able to strip the compiled stack to around 10k with UDP communication only and a static IP. I used PIC18F87K22. As soon as you start adding TCP/IP, DHCP, HTTP... the numbers jump up quickly. Try it yourself by defining/undefining options. Beware that defining some options automatically defines other options as well.
I have just reopened the stack in MPLab. Here is an exaple of configuration settings from TCPIP ENC28.h file:
// =======================================================================
// Application Options
// =======================================================================
/* Application Level Module Selection
* Uncomment or comment the following lines to enable or
* disabled the following high-level application modules.
*/
#define STACK_USE_UART // Application demo using UART for IP address display and stack configuration
//#define STACK_USE_UART2TCP_BRIDGE // UART to TCP Bridge application example
//#define STACK_USE_IP_GLEANING
#define STACK_USE_ICMP_SERVER // Ping query and response capability
//#define STACK_USE_ICMP_CLIENT // Ping transmission capability
//#define STACK_USE_HTTP2_SERVER // New HTTP server with POST, Cookies, Authentication, etc.
//#define STACK_USE_SSL_SERVER // SSL server socket support (Requires SW300052)
//#define STACK_USE_SSL_CLIENT // SSL client socket support (Requires SW300052)
//#define STACK_USE_AUTO_IP // Dynamic link-layer IP address automatic configuration protocol
//#define STACK_USE_DHCP_CLIENT // Dynamic Host Configuration Protocol client for obtaining IP address and other parameters
#define STACK_USE_DHCP_SERVER // Single host DHCP server
//#define STACK_USE_FTP_SERVER // File Transfer Protocol (old)
//#define STACK_USE_SMTP_CLIENT // Simple Mail Transfer Protocol for sending email
//#define STACK_USE_SNMP_SERVER // Simple Network Management Protocol v2C Community Agent
//#define STACK_USE_SNMPV3_SERVER // Simple Network Management Protocol v3 Agent
//#define STACK_USE_TFTP_CLIENT // Trivial File Transfer Protocol client
//#define STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE // HTTP Client example in GenericTCPClient.c
//#define STACK_USE_GENERIC_TCP_SERVER_EXAMPLE // ToUpper server example in GenericTCPServer.c
//#define STACK_USE_TELNET_SERVER // Telnet server
//#define STACK_USE_ANNOUNCE // Microchip Embedded Ethernet Device Discoverer server/client
//#define STACK_USE_DNS // Domain Name Service Client for resolving hostname strings to IP addresses
//#define STACK_USE_DNS_SERVER // Domain Name Service Server for redirection to the local device
//#define STACK_USE_NBNS // NetBIOS Name Service Server for repsonding to NBNS hostname broadcast queries
//#define STACK_USE_REBOOT_SERVER // Module for resetting this PIC remotely. Primarily useful for a Bootloader.
//#define STACK_USE_SNTP_CLIENT // Simple Network Time Protocol for obtaining current date/time from Internet
#define STACK_USE_UDP_PERFORMANCE_TEST // Module for testing UDP TX performance characteristics. NOTE: Enabling this will cause a huge amount of UDP broadcast packets to flood your network on the discard port. Use care when enabling this on production networks, especially with VPNs (could tunnel broadcast traffic across a limited bandwidth connection).
//#define STACK_USE_TCP_PERFORMANCE_TEST // Module for testing TCP TX performance characteristics
//#define STACK_USE_DYNAMICDNS_CLIENT // Dynamic DNS client updater module
//#define STACK_USE_BERKELEY_API // Berekely Sockets APIs are available
//#define STACK_USE_ZEROCONF_LINK_LOCAL // Zeroconf IPv4 Link-Local Addressing
//#define STACK_USE_ZEROCONF_MDNS_SD // Zeroconf mDNS and mDNS service discovery
// =======================================================================
// Data Storage Options
// =======================================================================
/* MPFS Configuration
* MPFS is automatically included when required for other
* applications. If your custom application requires it
* otherwise, uncomment the appropriate selection.
*/
//#define STACK_USE_MPFS2
/* MPFS Storage Location
* If html pages are stored in internal program memory,
* comment both MPFS_USE_EEPROM and MPFS_USE_SPI_FLASH, then
* include an MPFS image (.c or .s file) in the project.
* If html pages are stored in external memory, uncomment the
* appropriate definition.
*
* Supported serial flash parts include the SST25VFxxxB series.
*/
//#define MPFS_USE_EEPROM
//#define MPFS_USE_SPI_FLASH
/* EEPROM Addressing Selection
* If using the 1Mbit EEPROM, uncomment this line
*/
//#define USE_EEPROM_25LC1024
/* EEPROM Reserved Area
* Number of EEPROM bytes to be reserved before MPFS storage starts.
* These bytes host application configurations such as IP Address,
* MAC Address, and any other required variables.
*
* For MPFS Classic, this setting must match the Reserved setting
* on the Advanced Settings page of the MPFS2 Utility.
*/
#define MPFS_RESERVE_BLOCK (137ul)
/* MPFS File Handles
* Maximum number of simultaneously open MPFS2 files.
* For MPFS Classic, this has no effect.
*/
#define MAX_MPFS_HANDLES (7ul)
With this configuration it compiles to 9897 words.