Just the control system with one wireless touch panel can be around $3500.00 Average about 10k.
40 zone lighting system -best guess range is 11-18k.
1 zone HVAC control -$800.00 including the communicating thermostat and interface.
Zoned audio system about $1000per zone not including source gear and average speakers used. Security system and interface can be tricky. ADT-$99.00 , and a true protection system like a Apex destiny 6100 with rs-232 interface (32 zone) is $3500.00. In some ways, I feel the typical alarm system of the past is outdated. I like the new motion sensing cameras and HD recorders available.
The structured wiring system in this area is approximately 1% of the value. 12 multimedia outlets and 9 extras (like telephone or cable runs), 16 areas wired for music would be $4200.00 with 8 port LAN router with gateway and 8 way amplified CATV distribution. The larger the home, the cost estimate doesn't work.
Others should add their input on the prices. I just wanted to answer the question and not ask too many, but more specific information is needed. If you have your plans on CAD, there are many companies that would be glad to give you estimates.