Config.OSX.pp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. //
  2. // Config.OSX.pp
  3. //
  4. // This file defines some custom config variables for the osx
  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_OSX 1
  21. // Compiler flags
  22. #define CC gcc
  23. #define CXX g++
  24. #define C++FLAGS_GEN -ftemplate-depth-30
  25. // Configure for universal binaries on OSX.
  26. #defer ARCH_FLAGS $[if $[UNIVERSAL_BINARIES],-arch i386 -arch ppc,]
  27. #define OSX_CDEFS
  28. #define OSX_CFLAGS -Wno-deprecated-declarations
  29. // How to compile a C or C++ file into a .o file. $[target] is the
  30. // name of the .o file, $[source] is the name of the source file,
  31. // $[ipath] is a space-separated list of directories to search for
  32. // include files, and $[flags] is a list of additional flags to pass
  33. // to the compiler.
  34. #defer COMPILE_C $[CC] $[CFLAGS_GEN] $[ARCH_FLAGS] $[OSX_CFLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source]
  35. #defer COMPILE_C++ $[CXX] $[C++FLAGS_GEN] $[ARCH_FLAGS] $[OSX_CFLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source]
  36. // What flags should be passed to both C and C++ compilers to enable
  37. // debug symbols? This will be supplied when OPTIMIZE (above) is set
  38. // to 1, 2, or 3.
  39. #defer DEBUGFLAGS -g
  40. // What flags should be passed to both C and C++ compilers to enable
  41. // compiler optimizations? This will be supplied when OPTIMIZE
  42. // (above) is set to 2, 3, or 4.
  43. #defer OPTFLAGS -O2
  44. // By convention, any source file that contains the string _no_opt_ in
  45. // its filename won't have the above compiler optimizations run for it.
  46. #defer no_opt $[findstring _no_opt_,$[source]]
  47. // What define variables should be passed to the compilers for each
  48. // value of OPTIMIZE? We separate this so we can pass these same
  49. // options to interrogate, guaranteeing that the correct interfaces
  50. // are generated. Do not include -D here; that will be supplied
  51. // automatically.
  52. #defer CDEFINES_OPT1 $[EXTRA_CDEFS] $[OSX_CDEFS]
  53. #defer CDEFINES_OPT2 $[EXTRA_CDEFS] $[OSX_CDEFS]
  54. #defer CDEFINES_OPT3 $[EXTRA_CDEFS] $[OSX_CDEFS]
  55. #defer CDEFINES_OPT4 $[EXTRA_CDEFS] $[OSX_CDEFS]
  56. // What additional flags should be passed for each value of OPTIMIZE
  57. // (above)? We separate out the compiler-optimization flags, above,
  58. // so we can compile certain files that give optimizers trouble (like
  59. // the output of lex and yacc) without them, but with all the other
  60. // relevant flags.
  61. #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] -Wall $[DEBUGFLAGS]
  62. #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] -Wall $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]]
  63. #defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]]
  64. #defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[if $[no_opt],,$[OPTFLAGS]]
  65. // What additional flags should be passed to both compilers when
  66. // building shared (relocatable) sources? Some architectures require
  67. // special support for this.
  68. #defer CFLAGS_SHARED -fPIC
  69. // How to generate a C or C++ executable from a collection of .o
  70. // files. $[target] is the name of the binary to generate, and
  71. // $[sources] is the list of .o files. $[libs] is a space-separated
  72. // list of dependent libraries, and $[lpath] is a space-separated list
  73. // of directories in which those libraries can be found.
  74. #defer link_bin_opts $[ARCH_FLAGS] $[OSX_CFLAGS] \
  75. $[if $[not $[LINK_ALL_STATIC]],-undefined dynamic_lookup] \
  76. -o $[target] $[sources]\
  77. $[flags]\
  78. $[lpath:%=-L%] $[libs:%=-l%]\
  79. $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]]
  80. #defer LINK_BIN_C $[cc_ld] $[link_bin_opts]
  81. #defer LINK_BIN_C++ $[cxx_ld] $[link_bin_opts]
  82. // How to generate a static C or C++ library. $[target] is the
  83. // name of the library to generate, and $[sources] is the list of .o
  84. // files that will go into the library.
  85. #defer STATIC_LIB_C libtool -static -o $[target] $[sources]
  86. #defer STATIC_LIB_C++ libtool -static -o $[target] $[sources]
  87. // How to run ranlib, if necessary, after generating a static library.
  88. // $[target] is the name of the library. Set this to the empty string
  89. // if ranlib is not necessary on your platform.
  90. #defer RANLIB ranlib $[target]
  91. // Where to put the so_locations file, used by an Irix MIPSPro
  92. // compiler, to generate a map of shared library memory locations.
  93. #defer SO_LOCATIONS $[DTOOL_INSTALL]/etc/so_locations
  94. // How to generate a shared C or C++ library. $[source] and $[target]
  95. // as above, and $[libs] is a space-separated list of dependent
  96. // libraries, and $[lpath] is a space-separated list of directories in
  97. // which those libraries can be found.
  98. #defer SHARED_LIB_C $[cc_ld] $[ARCH_FLAGS] $[OSX_CFLAGS] -o $[target] -dynamiclib -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
  99. #defer SHARED_LIB_C++ $[cxx_ld] $[ARCH_FLAGS] $[OSX_CFLAGS] -undefined dynamic_lookup -dynamic -dynamiclib -o $[target] -dynamiclib -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
  100. #defer BUNDLE_LIB_C++ $[cxx_ld] $[ARCH_FLAGS] $[OSX_CFLAGS] -undefined dynamic_lookup -bundle -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
  101. // How to install a data file or executable file. $[local] is the
  102. // local name of the file to install, and $[dest] is the name of the
  103. // directory to put it in.
  104. // On Unix systems, we strongly prefer using the install program to
  105. // install files. This has nice features like automatically setting
  106. // the permissions bits, and also is usually clever enough to install
  107. // a running program without crashing the running instance. However,
  108. // it doesn't understanding installing a program from a subdirectory,
  109. // so we have to cd into the source directory first.
  110. #defer install_dash_p $[if $[KEEP_TIMESTAMPS],-p,]
  111. #defer INSTALL $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_DATA] $[install_dash_p] $[notdir $[local]] $[dest]/
  112. #defer INSTALL_PROG $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_PROG] $[install_dash_p] $[notdir $[local]] $[dest]/
  113. // Assume that OSX has OpenGL available.
  114. #define HAVE_GL 1
  115. // What additional flags should we pass to interrogate?
  116. #define BASE_IGATE_FLAGS -D__FLT_EVAL_METHOD__=0 -D__const=const -Dvolatile -Dmutable -D__LITTLE_ENDIAN__ -D__inline__=inline -D__GNUC__
  117. #define IGATE_ARCH -D__i386__
  118. #defer SYSTEM_IGATE_FLAGS $[BASE_IGATE_FLAGS] $[IGATE_ARCH]
  119. // We don't need worry about defining WORDS_BIGENDIAN (and we
  120. // shouldn't anyway, since ppc and intel are different). We rely on
  121. // dtoolbase.h to determine this at compilation time.
  122. #define WORDS_BIGENDIAN
  123. // Does the C++ compiler support namespaces?
  124. #define HAVE_NAMESPACE 1
  125. // Does the C++ compiler support ios::binary?
  126. #define HAVE_IOS_BINARY 1
  127. // How about the typename keyword?
  128. #define HAVE_TYPENAME 1
  129. // Will the compiler avoid inserting extra bytes in structs between a
  130. // base struct and its derived structs? It is safe to define this
  131. // false if you don't know, but if you know that you can get away with
  132. // this you may gain a tiny performance gain by defining this true.
  133. // If you define this true incorrectly, you will get lots of
  134. // assertion failures on execution.
  135. #define SIMPLE_STRUCT_POINTERS
  136. // Do we have a gettimeofday() function?
  137. #define HAVE_GETTIMEOFDAY 1
  138. // Does gettimeofday() take only one parameter?
  139. #define GETTIMEOFDAY_ONE_PARAM
  140. // Do we have getopt() and/or getopt_long_only() built into the
  141. // system?
  142. #define HAVE_GETOPT 1
  143. #define HAVE_GETOPT_LONG_ONLY
  144. // Are the above getopt() functions defined in getopt.h, or somewhere else?
  145. #define PHAVE_GETOPT_H 1
  146. // Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call?
  147. #define IOCTL_TERMINAL_WIDTH 1
  148. // Do the system headers define a "streamsize" typedef? How about the
  149. // ios::binary enumerated value? And other ios typedef symbols like
  150. // ios::openmode and ios::fmtflags?
  151. #define HAVE_STREAMSIZE 1
  152. #define HAVE_IOS_BINARY 1
  153. #define HAVE_IOS_TYPEDEFS 1
  154. // Can we safely call getenv() at static init time?
  155. #define STATIC_INIT_GETENV 1
  156. // Can we read the file /proc/self/* to determine our
  157. // environment variables at static init time?
  158. #define HAVE_PROC_SELF_EXE
  159. #define HAVE_PROC_SELF_MAPS
  160. #define HAVE_PROC_SELF_ENVIRON
  161. #define HAVE_PROC_SELF_CMDLINE
  162. // Do we have a global pair of argc/argv variables that we can read at
  163. // static init time? Should we prototype them? What are they called?
  164. #define HAVE_GLOBAL_ARGV
  165. #define PROTOTYPE_GLOBAL_ARGV
  166. #define GLOBAL_ARGV __Argv
  167. #define GLOBAL_ARGC __Argc
  168. // Should we include <iostream> or <iostream.h>? Define PHAVE_IOSTREAM
  169. // to nonempty if we should use <iostream>, or empty if we should use
  170. // <iostream.h>.
  171. #define PHAVE_IOSTREAM 1
  172. // Do we have a true stringstream class defined in <sstream>?
  173. #define PHAVE_SSTREAM 1
  174. // Does fstream::open() require a third parameter, specifying the
  175. // umask? Versions of gcc prior to 3.2 had this.
  176. #define HAVE_OPEN_MASK
  177. // Do the compiler or system libraries define wchar_t for you?
  178. #define HAVE_WCHAR_T 1
  179. // Does <string> define the typedef wstring? Most do, but for some
  180. // reason, versions of gcc before 3.0 didn't do this.
  181. #define HAVE_WSTRING 1
  182. // Do we have <new>?
  183. #define PHAVE_NEW 1
  184. // Do we have <io.h>?
  185. #define PHAVE_IO_H
  186. // Do we have <malloc.h>?
  187. #define PHAVE_MALLOC_H
  188. // Do we have <alloca.h>?
  189. #define PHAVE_ALLOCA_H 1
  190. // Do we have <locale.h>?
  191. #define PHAVE_LOCALE_H 1
  192. // Do we have <string.h>?
  193. #define PHAVE_STRING_H 1
  194. // Do we have <stdlib.h>?
  195. #define PHAVE_STDLIB_H 1
  196. // Do we have <limits.h>?
  197. #define PHAVE_LIMITS_H 1
  198. // Do we have <minmax.h>?
  199. #define PHAVE_MINMAX_H
  200. // Do we have <sys/types.h>?
  201. #define PHAVE_SYS_TYPES_H 1
  202. #define PHAVE_SYS_TIME_H 1
  203. // Do we have <unistd.h>?
  204. #define PHAVE_UNISTD_H 1
  205. // Do we have <utime.h>?
  206. #define PHAVE_UTIME_H 1
  207. // Do we have <dirent.h>?
  208. #define PHAVE_DIRENT_H 1
  209. // Do we have <glob.h> (and do we want to use it instead of dirent.h)?
  210. #define PHAVE_GLOB_H 1
  211. // Do we have <sys/soundcard.h> (and presumably a Linux-style audio
  212. // interface)?
  213. #define PHAVE_SYS_SOUNDCARD_H 1
  214. // Do we have <ucontext.h> (and therefore makecontext() / swapcontext())?
  215. #define PHAVE_UCONTEXT_H 1
  216. // Do we have RTTI (and <typeinfo>)?
  217. #define HAVE_RTTI 1
  218. // Do we have <stdint.h>?
  219. #define PHAVE_STDINT_H 1
  220. // The dynamic library file extension (usually .so .dll or .dylib):
  221. #define DYNAMIC_LIB_EXT .dylib
  222. #define STATIC_LIB_EXT .a
  223. // If you need to build .so files in addition to .dylibs, declare this
  224. // too. Python 2.4 on OSX 10.4 seems to require this (it won't import
  225. // a .dylib file directly).
  226. //#define BUNDLE_EXT .so