Using either static IP or DHCP

Hi !
I am using BLS4160 connected to Ethernet.
I know that if I want static IP I have to set compiler macro
#define TCPCONFIG 1
and if DHCP
#define TCPCONFIG 7

But this is compile time setting, is it possible to use either static or DHCP dynamically in a compiled bin ?
So that I could start the program with some configuration setting 1 or 7
I would like to have a single compiled bin that can be configured depending the environment, if DHCP is available or not.

It is possible to do this at run time by selecting a blank configuration at start up and manually configuring the correct settings for your situation.

A good place to start with for this is to look at the ADDP.C in the TCPIP samples directory. This shows how to do it.

It is possible to set up several different modes including: DHCP only, fixed IP only, Link-Local address only and DHCP with fall back to fixed IP or link-local.

Regards,
Peter