Where are system dependent symbols typically defined?
I'm looking at the source code for Tor a开发者_高级运维s part of an RA project. I'm trying to figure out why it was automatically compiled to use threads on one system (SuSE) and forks a new process on a different system (Solaris). There are only a few places in the source code where fork()
is called, and it's dependent on various symbols (things like ENABLE_THREADING or USE_PTHREADS) being defined. I've searched the files, and have been unable to find definitions for most of the required symbols.
I'm not looking for a solution to this problem specifically, but more a general guideline. How and where are symbols relating to system dependent compiliation defined?
I honestly don't know, but here is my guess.
These are macros which are defined in the Makefile
. Often, the Makefile
is dynamically generated by some sort of ./configure
script.
Note that in C and C++, it is common convention to make all macros uppercase characters and underscores so that it is more obvious that they are macros. This is of course just convention, and not required.
In the end, grep
can be your friend. Try something like this in the source directory:
grep -R "ENABLE_THREADING" *
this will find all files which either use or define that macro.
These are generated during the configure
part of the build with autotools
.
精彩评论