diff options
| -rw-r--r-- | 3rdParty/Expat/SConscript | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/3rdParty/Expat/SConscript b/3rdParty/Expat/SConscript index c2ccd4a..9a0cecd 100644 --- a/3rdParty/Expat/SConscript +++ b/3rdParty/Expat/SConscript | |||
| @@ -8,6 +8,12 @@ if env.get("EXPAT_BUNDLED", False) : | |||
| 8 | "LIBPATH": [Dir(".")], | 8 | "LIBPATH": [Dir(".")], |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | def checkBuilds(context, message, source): | ||
| 12 | context.Message(message) | ||
| 13 | result = context.TryLink(source, '.cpp') | ||
| 14 | context.Result(result) | ||
| 15 | return result | ||
| 16 | |||
| 11 | if env["SCONS_STAGE"] == "build" : | 17 | if env["SCONS_STAGE"] == "build" : |
| 12 | myenv = env.Clone() | 18 | myenv = env.Clone() |
| 13 | myenv.Append(CPPDEFINES = ["XML_STATIC", "HAVE_EXPAT_CONFIG_H"]) | 19 | myenv.Append(CPPDEFINES = ["XML_STATIC", "HAVE_EXPAT_CONFIG_H"]) |
| @@ -22,6 +28,55 @@ if env.get("EXPAT_BUNDLED", False) : | |||
| 22 | myenv.Append(CPPDEFINES = ["HAVE_MEMMOVE"]) | 28 | myenv.Append(CPPDEFINES = ["HAVE_MEMMOVE"]) |
| 23 | conf.Finish() | 29 | conf.Finish() |
| 24 | 30 | ||
| 31 | if env["PLATFORM"] != "win32" : | ||
| 32 | conf = Configure(conf_env, custom_tests = { "CheckBuilds" : checkBuilds}) | ||
| 33 | if conf.CheckBuilds('Checking for C function getrandom()... ', | ||
| 34 | """ | ||
| 35 | #include <stdlib.h> /* for NULL */ | ||
| 36 | #include <sys/random.h> | ||
| 37 | int main() { | ||
| 38 | return getrandom(NULL, 0U, 0U); | ||
| 39 | } | ||
| 40 | """): | ||
| 41 | myenv.Append(CPPDEFINES = ["HAVE_GETRANDOM"]) | ||
| 42 | elif conf.CheckBuilds('Checking for syscall SYS_getrandom... ', | ||
| 43 | """ | ||
| 44 | #include <stdlib.h> /* for NULL */ | ||
| 45 | #include <unistd.h> /* for syscall */ | ||
| 46 | #include <sys/syscall.h> /* for SYS_getrandom */ | ||
| 47 | int main() { | ||
| 48 | syscall(SYS_getrandom, NULL, 0, 0); | ||
| 49 | return 0; | ||
| 50 | } | ||
| 51 | """): | ||
| 52 | myenv.Append(CPPDEFINES = ["HAVE_SYSCALL_GETRANDOM"]) | ||
| 53 | elif conf.CheckBuilds('Checking for arc4random_buf... ', | ||
| 54 | """ | ||
| 55 | #include <stdlib.h> /* for arc4random_buf on BSD, for NULL */ | ||
| 56 | #if defined(HAVE_LIBBSD) | ||
| 57 | # include <bsd/stdlib.h> | ||
| 58 | #endif | ||
| 59 | int main() { | ||
| 60 | arc4random_buf(NULL, 0U); | ||
| 61 | return 0; | ||
| 62 | } | ||
| 63 | """): | ||
| 64 | myenv.Append(CPPDEFINES = ["HAVE_ARC4RANDOM_BUF"]) | ||
| 65 | elif conf.CheckBuilds('Checking for arc4random... ', | ||
| 66 | """ | ||
| 67 | #if defined(HAVE_LIBBSD) | ||
| 68 | # include <bsd/stdlib.h> | ||
| 69 | #else | ||
| 70 | # include <stdlib.h> | ||
| 71 | #endif | ||
| 72 | int main() { | ||
| 73 | arc4random(); | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | """): | ||
| 77 | myenv.Append(CPPDEFINES = ["HAVE_ARC4RANDOM"]) | ||
| 78 | conf.Finish() | ||
| 79 | |||
| 25 | env["EXPAT_OBJECTS"] = myenv.SwiftenObject([ | 80 | env["EXPAT_OBJECTS"] = myenv.SwiftenObject([ |
| 26 | "src/xmltok.c", | 81 | "src/xmltok.c", |
| 27 | "src/xmlparse.c", | 82 | "src/xmlparse.c", |
Swift