Config.Linux.pp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. //
  2. // Config.Linux.pp
  3. //
  4. // This file defines some custom config variables for the Linux
  5. // platform. It makes some initial guesses about compiler features,
  6. // etc.
  7. //
  8. // *******************************************************************
  9. // NOTE: you should not attempt to copy this file verbatim as your own
  10. // personal Config.pp file. Instead, you should start with an empty
  11. // Config.pp file, and add lines to it when you wish to override
  12. // settings given in here. In the normal ppremake system, this file
  13. // will always be read first, and then your personal Config.pp file
  14. // will be read later, which gives you a chance to override the
  15. // default settings found in this file. However, if you start by
  16. // copying the entire file, it will be difficult to tell which
  17. // settings you have customized, and it will be difficult to upgrade
  18. // to a subsequent version of Panda.
  19. // *******************************************************************
  20. #define IS_LINUX 1
  21. // Compiler flags
  22. // How to invoke the C and C++ compilers.
  23. #if $[eq $[USE_COMPILER], GCC]
  24. #define CC gcc
  25. #define CXX g++
  26. // gcc might run into template limits on some parts of Panda.
  27. // I upped this from 25 to build on OS X (GCC 3.3) -- skyler.
  28. #define C++FLAGS_GEN -ftemplate-depth-30
  29. #else
  30. #define CC cc
  31. #define CXX CC
  32. #endif
  33. // Linux doesn't (yet) have any funny architecture flags.
  34. #defer ARCH_FLAGS
  35. // How to compile a C or C++ file into a .o file. $[target] is the
  36. // name of the .o file, $[source] is the name of the source file,
  37. // $[ipath] is a space-separated list of directories to search for
  38. // include files, and $[flags] is a list of additional flags to pass
  39. // to the compiler.
  40. #defer COMPILE_C $[CC] $[CFLAGS_GEN] $[ARCH_FLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source]
  41. #defer COMPILE_C++ $[CXX] $[C++FLAGS_GEN] $[ARCH_FLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source]
  42. // What flags should be passed to both C and C++ compilers to enable
  43. // debug symbols? This will be supplied when OPTIMIZE (above) is set
  44. // to 1, 2, or 3.
  45. #defer DEBUGFLAGS -g
  46. // What flags should be passed to both C and C++ compilers to enable
  47. // compiler optimizations? This will be supplied when OPTIMIZE
  48. // (above) is set to 2, 3, or 4.
  49. #defer OPTFLAGS -O2
  50. // By convention, any source file that contains the string _no_opt_ in
  51. // its filename won't have the above compiler optimizations run for it.
  52. #defer no_opt $[findstring _no_opt_,$[source]]
  53. // What define variables should be passed to the compilers for each
  54. // value of OPTIMIZE? We separate this so we can pass these same
  55. // options to interrogate, guaranteeing that the correct interfaces
  56. // are generated. Do not include -D here; that will be supplied
  57. // automatically.
  58. #defer CDEFINES_OPT1 _DEBUG $[EXTRA_CDEFS]
  59. #defer CDEFINES_OPT2 _DEBUG $[EXTRA_CDEFS]
  60. #defer CDEFINES_OPT3 $[EXTRA_CDEFS]
  61. #defer CDEFINES_OPT4 NDEBUG $[EXTRA_CDEFS]
  62. // What additional flags should be passed for each value of OPTIMIZE
  63. // (above)? We separate out the compiler-optimization flags, above,
  64. // so we can compile certain files that give optimizers trouble (like
  65. // the output of lex and yacc) without them, but with all the other
  66. // relevant flags.
  67. #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] -Wall $[DEBUGFLAGS]
  68. #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] -Wall $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]]
  69. #defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]]
  70. #defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[if $[no_opt],,$[OPTFLAGS]]
  71. // What additional flags should be passed to both compilers when
  72. // building shared (relocatable) sources? Some architectures require
  73. // special support for this.
  74. #defer CFLAGS_SHARED -fPIC
  75. // How to generate a C or C++ executable from a collection of .o
  76. // files. $[target] is the name of the binary to generate, and
  77. // $[sources] is the list of .o files. $[libs] is a space-separated
  78. // list of dependent libraries, and $[lpath] is a space-separated list
  79. // of directories in which those libraries can be found.
  80. #defer LINK_BIN_C $[cc_ld] $[ARCH_FLAGS] -o $[target] $[sources] $[flags] $[lpath:%=-L%] $[libs:%=-l%]\
  81. $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]]
  82. #defer LINK_BIN_C++ $[cxx_ld] $[ARCH_FLAGS] \
  83. -o $[target] $[sources]\
  84. $[flags]\
  85. $[lpath:%=-L%] $[libs:%=-l%]\
  86. $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]]
  87. // How to generate a static C or C++ library. $[target] is the
  88. // name of the library to generate, and $[sources] is the list of .o
  89. // files that will go into the library.
  90. #defer STATIC_LIB_C ar cru $[target] $[sources]
  91. #defer STATIC_LIB_C++ ar cru $[target] $[sources]
  92. // How to run ranlib, if necessary, after generating a static library.
  93. // $[target] is the name of the library. Set this to the empty string
  94. // if ranlib is not necessary on your platform.
  95. #defer RANLIB ranlib $[target]
  96. // Where to put the so_locations file, used by an Irix MIPSPro
  97. // compiler, to generate a map of shared library memory locations.
  98. #defer SO_LOCATIONS $[DTOOL_INSTALL]/etc/so_locations
  99. // How to generate a shared C or C++ library. $[source] and $[target]
  100. // as above, and $[libs] is a space-separated list of dependent
  101. // libraries, and $[lpath] is a space-separated list of directories in
  102. // which those libraries can be found.
  103. #defer SHARED_LIB_C $[cc_ld] -shared $[LFLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
  104. #defer SHARED_LIB_C++ $[cxx_ld] -shared $[LFLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
  105. #define BUNDLE_LIB_C++
  106. // How to install a data file or executable file. $[local] is the
  107. // local name of the file to install, and $[dest] is the name of the
  108. // directory to put it in.
  109. // On Unix systems, we strongly prefer using the install program to
  110. // install files. This has nice features like automatically setting
  111. // the permissions bits, and also is usually clever enough to install
  112. // a running program without crashing the running instance. However,
  113. // it doesn't understanding installing a program from a subdirectory,
  114. // so we have to cd into the source directory first.
  115. #defer install_dash_p $[if $[KEEP_TIMESTAMPS],-p,]
  116. #defer INSTALL $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_DATA] $[install_dash_p] $[notdir $[local]] $[dest]/
  117. #defer INSTALL_PROG $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_PROG] $[install_dash_p] $[notdir $[local]] $[dest]/
  118. // Variable definitions for building with the Irix MIPSPro compiler.
  119. #if $[eq $[USE_COMPILER], MIPS]
  120. #define CC cc -n32 -mips3
  121. #define CXX CC -n32 -mips3
  122. // Turn off a few annoying warning messages.
  123. // 1174 - function 'blah' was declared but never used
  124. // 1201 - trailing comma is nonstandard.
  125. // 1209 - controlling expression is constant, e.g. if (0) { ... }
  126. // 1234 - access control not specified, 'public' by default
  127. // 1355 - extra ";" ignored
  128. // 1375 - destructor for base class is not virtual.
  129. // this one actually is bad. But we got alot of them from the classes
  130. // that we've derived from STL collections. Beware of this.
  131. // 3322 - omission of explicit type is nonstandard ("int" assumed)
  132. #define WOFF_LIST -woff 1174,1201,1209,1234,1355,1375,3322
  133. // Linker warnings
  134. // 85 - definition of SOMESYMBOL in SOMELIB preempts that of definition in
  135. // SOMEOTHERLIB.
  136. #define WOFF_LIST $[WOFF_LIST] -Wl,-LD_MSG:off=85
  137. #defer OPTFLAGS -O2 -OPT:Olimit=2500
  138. #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] $[WOFF_LIST] -g
  139. #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] $[WOFF_LIST]
  140. #defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[WOFF_LIST]
  141. #defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[WOFF_LIST]
  142. #defer CFLAGS_SHARED
  143. #defer STATIC_LIB_C $[CC] -ar -o $[target] $[sources]
  144. #defer STATIC_LIB_C++ $[CXX] -ar -o $[target] $[sources]
  145. #defer RANLIB
  146. #defer SHARED_FLAGS -Wl,-none -Wl,-update_registry,$[SO_LOCATIONS]
  147. #defer SHARED_LIB_C $[cc_ld] -shared $[SHARED_FLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
  148. #defer SHARED_LIB_C++ $[cxx_ld] -shared $[SHARED_FLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
  149. #endif
  150. // What additional flags should we pass to interrogate?
  151. #if $[eq $[shell uname -m], x86_64] // if Linux is 64bit
  152. #define SYSTEM_IGATE_FLAGS -D_LP64 -D__const=const -Dvolatile -Dmutable
  153. #else
  154. #define SYSTEM_IGATE_FLAGS -D__i386__ -D__const=const -Dvolatile -Dmutable
  155. #endif
  156. // Is the platform big-endian (like an SGI workstation) or
  157. // little-endian (like a PC)? Define this to the empty string to
  158. // indicate little-endian, or nonempty to indicate big-endian.
  159. #define WORDS_BIGENDIAN
  160. // Does the C++ compiler support namespaces?
  161. #define HAVE_NAMESPACE 1
  162. // Does the C++ compiler support ios::binary?
  163. #define HAVE_IOS_BINARY 1
  164. // How about the typename keyword?
  165. #define HAVE_TYPENAME 1
  166. // Will the compiler avoid inserting extra bytes in structs between a
  167. // base struct and its derived structs? It is safe to define this
  168. // false if you don't know, but if you know that you can get away with
  169. // this you may gain a tiny performance gain by defining this true.
  170. // If you define this true incorrectly, you will get lots of
  171. // assertion failures on execution.
  172. #define SIMPLE_STRUCT_POINTERS
  173. // Do we have a gettimeofday() function?
  174. #define HAVE_GETTIMEOFDAY 1
  175. // Does gettimeofday() take only one parameter?
  176. #define GETTIMEOFDAY_ONE_PARAM
  177. // Do we have getopt() and/or getopt_long_only() built into the
  178. // system?
  179. #define HAVE_GETOPT 1
  180. #define HAVE_GETOPT_LONG_ONLY 1
  181. // Are the above getopt() functions defined in getopt.h, or somewhere else?
  182. #define HAVE_GETOPT_H 1
  183. // Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call?
  184. #define IOCTL_TERMINAL_WIDTH 1
  185. // Do the system headers define a "streamsize" typedef? How about the
  186. // ios::binary enumerated value? And other ios typedef symbols like
  187. // ios::openmode and ios::fmtflags?
  188. #define HAVE_STREAMSIZE 1
  189. #define HAVE_IOS_BINARY 1
  190. #define HAVE_IOS_TYPEDEFS 1
  191. // Can we safely call getenv() at static init time?
  192. #define STATIC_INIT_GETENV 1
  193. // Can we read the file /proc/self/environ to determine our
  194. // environment variables at static init time?
  195. #define HAVE_PROC_SELF_ENVIRON 1
  196. // Do we have a global pair of argc/argv variables that we can read at
  197. // static init time? Should we prototype them? What are they called?
  198. #define HAVE_GLOBAL_ARGV
  199. #define PROTOTYPE_GLOBAL_ARGV
  200. #define GLOBAL_ARGV
  201. #define GLOBAL_ARGC
  202. // Can we read the file /proc/self/cmdline to determine our
  203. // command-line arguments at static init time?
  204. #define HAVE_PROC_SELF_CMDLINE 1
  205. // Should we include <iostream> or <iostream.h>? Define HAVE_IOSTREAM
  206. // to nonempty if we should use <iostream>, or empty if we should use
  207. // <iostream.h>.
  208. #define HAVE_IOSTREAM 1
  209. // Do we have a true stringstream class defined in <sstream>?
  210. #define HAVE_SSTREAM 1
  211. // Does fstream::open() require a third parameter, specifying the
  212. // umask? Versions of gcc prior to 3.2 had this.
  213. #define HAVE_OPEN_MASK
  214. // Do the compiler or system libraries define wchar_t for you?
  215. #define HAVE_WCHAR_T 1
  216. // Does <string> define the typedef wstring? Most do, but for some
  217. // reason, versions of gcc before 3.0 didn't do this.
  218. #define HAVE_WSTRING 1
  219. // Do we have <new>?
  220. #define HAVE_NEW 1
  221. // Do we have <io.h>?
  222. #define HAVE_IO_H
  223. // Do we have <malloc.h>?
  224. #define HAVE_MALLOC_H 1
  225. // Do we have <alloca.h>?
  226. #define HAVE_ALLOCA_H 1
  227. // Do we have <locale.h>?
  228. #define HAVE_LOCALE_H 1
  229. // Do we have <string.h>?
  230. #define HAVE_STRING_H 1
  231. // Do we have <stdlib.h>?
  232. #define HAVE_STDLIB_H 1
  233. // Do we have <limits.h>?
  234. #define HAVE_LIMITS_H 1
  235. // Do we have <minmax.h>?
  236. #define HAVE_MINMAX_H
  237. // Do we have <sys/types.h>?
  238. #define HAVE_SYS_TYPES_H 1
  239. #define HAVE_SYS_TIME_H 1
  240. // Do we have <unistd.h>?
  241. #define HAVE_UNISTD_H 1
  242. // Do we have <utime.h>?
  243. #define HAVE_UTIME_H 1
  244. // Do we have <dirent.h>?
  245. #define HAVE_DIRENT_H 1
  246. // Do we have <glob.h> (and do we want to use it instead of dirent.h)?
  247. #define HAVE_GLOB_H 1
  248. // Do we have <sys/soundcard.h> (and presumably a Linux-style audio
  249. // interface)?
  250. #define HAVE_SYS_SOUNDCARD_H 1
  251. // Do we have <ucontext.h> (and therefore makecontext() / swapcontext())?
  252. #define HAVE_UCONTEXT_H 1
  253. // Do we have RTTI (and <typeinfo>)?
  254. #define HAVE_RTTI 1
  255. // We need 64-bit file i/o
  256. #define __USE_LARGEFILE64 1
  257. // Modern versions of gcc do support the latest STL allocator
  258. // definitions.
  259. #define USE_STL_ALLOCATOR 1
  260. // The dynamic library file extension (usually .so .dll or .dylib):
  261. #define DYNAMIC_LIB_EXT .so
  262. #define STATIC_LIB_EXT .a
  263. #define BUNDLE_EXT