summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Expat/SConscript')
-rw-r--r--3rdParty/Expat/SConscript98
1 files changed, 79 insertions, 19 deletions
diff --git a/3rdParty/Expat/SConscript b/3rdParty/Expat/SConscript
index d5724b4..9a0cecd 100644
--- a/3rdParty/Expat/SConscript
+++ b/3rdParty/Expat/SConscript
@@ -1,25 +1,85 @@
Import(["env", "conf_env"])
if env.get("EXPAT_BUNDLED", False) :
- if env["SCONS_STAGE"] == "flags" :
- env["EXPAT_FLAGS"] = {
- "CPPDEFINES": ["XML_STATIC"],
- "CPPPATH": [Dir("src")],
- "LIBPATH": [Dir(".")],
- }
+ if env["SCONS_STAGE"] == "flags" :
+ env["EXPAT_FLAGS"] = {
+ "CPPDEFINES": ["XML_STATIC"],
+ "CPPPATH": [Dir("src")],
+ "LIBPATH": [Dir(".")],
+ }
- if env["SCONS_STAGE"] == "build" :
- myenv = env.Clone()
- myenv.Append(CPPDEFINES = ["XML_STATIC", "HAVE_EXPAT_CONFIG_H"])
- myenv.Append(CPPPATH = [".", "src"])
+ def checkBuilds(context, message, source):
+ context.Message(message)
+ result = context.TryLink(source, '.cpp')
+ context.Result(result)
+ return result
- conf = Configure(conf_env)
- if conf.CheckFunc('memmove') :
- myenv.Append(CPPDEFINES = ["HAVE_MEMMOVE"])
- conf.Finish()
+ if env["SCONS_STAGE"] == "build" :
+ myenv = env.Clone()
+ myenv.Append(CPPDEFINES = ["XML_STATIC", "HAVE_EXPAT_CONFIG_H"])
+ if env.get("BOOST_BUNDLED", False) :
+ myenv.Append(CPPPATH = [".", "src", "../Boost/src"])
+ else :
+ myenv.Append(CPPPATH = [".", "src"])
+ myenv.MergeFlags(env["BOOST_FLAGS"])
- env["EXPAT_OBJECTS"] = myenv.SwiftenObject([
- "src/xmltok.c",
- "src/xmlparse.c",
- "src/xmlrole.c"
- ])
+ conf = Configure(conf_env)
+ if conf.CheckFunc('memmove') :
+ myenv.Append(CPPDEFINES = ["HAVE_MEMMOVE"])
+ conf.Finish()
+
+ if env["PLATFORM"] != "win32" :
+ conf = Configure(conf_env, custom_tests = { "CheckBuilds" : checkBuilds})
+ if conf.CheckBuilds('Checking for C function getrandom()... ',
+ """
+ #include <stdlib.h> /* for NULL */
+ #include <sys/random.h>
+ int main() {
+ return getrandom(NULL, 0U, 0U);
+ }
+ """):
+ myenv.Append(CPPDEFINES = ["HAVE_GETRANDOM"])
+ elif conf.CheckBuilds('Checking for syscall SYS_getrandom... ',
+ """
+ #include <stdlib.h> /* for NULL */
+ #include <unistd.h> /* for syscall */
+ #include <sys/syscall.h> /* for SYS_getrandom */
+ int main() {
+ syscall(SYS_getrandom, NULL, 0, 0);
+ return 0;
+ }
+ """):
+ myenv.Append(CPPDEFINES = ["HAVE_SYSCALL_GETRANDOM"])
+ elif conf.CheckBuilds('Checking for arc4random_buf... ',
+ """
+ #include <stdlib.h> /* for arc4random_buf on BSD, for NULL */
+ #if defined(HAVE_LIBBSD)
+ # include <bsd/stdlib.h>
+ #endif
+ int main() {
+ arc4random_buf(NULL, 0U);
+ return 0;
+ }
+ """):
+ myenv.Append(CPPDEFINES = ["HAVE_ARC4RANDOM_BUF"])
+ elif conf.CheckBuilds('Checking for arc4random... ',
+ """
+ #if defined(HAVE_LIBBSD)
+ # include <bsd/stdlib.h>
+ #else
+ # include <stdlib.h>
+ #endif
+ int main() {
+ arc4random();
+ return 0;
+ }
+ """):
+ myenv.Append(CPPDEFINES = ["HAVE_ARC4RANDOM"])
+ conf.Finish()
+
+ env["EXPAT_OBJECTS"] = myenv.SwiftenObject([
+ "src/xmltok.c",
+ "src/xmlparse.c",
+ "src/xmlrole.c",
+ "src/loadlibrary.c",
+ ]) \ No newline at end of file