how to compile a program statically

how can i do static compilation in cc and -lldap
i have system defined and user defined header file.
Can any one suggest any site where from i can get some information about static and dynamic compilation.

Thankx

It depends on the compiler. Try man cc, search in the output for static - most implementations of man let you search for a word with /<word>, then hit return. THe < > symbols are not used, just there for clarity.

What compiler on what unix ( ie., cc on HPUX 11.0, gcc on Redhat Linux 7.2)?