[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/03: runtime: support dynamically located
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/03: runtime: support dynamically located gnuradio installs |
Date: |
Fri, 4 Nov 2016 19:01:41 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 1c129248e62f00f8e7a3cf2db2a309415441729d
Author: Josh Blum <address@hidden>
Date: Sun Oct 9 17:32:04 2016 -0700
runtime: support dynamically located gnuradio installs
Support a "GR_PREFIX" env var to overload prefix() with.
When this env var is specified, sysconfdir() and prefsdir()
also changes to reflect this using the same directory logic
specified in the top level CMakeLists.txt
---
gnuradio-runtime/lib/constants.cc.in | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnuradio-runtime/lib/constants.cc.in
b/gnuradio-runtime/lib/constants.cc.in
index 516e2f8..b368e9d 100644
--- a/gnuradio-runtime/lib/constants.cc.in
+++ b/gnuradio-runtime/lib/constants.cc.in
@@ -24,6 +24,7 @@
#include <config.h>
#endif
+#include <stdlib.h>
#include <gnuradio/constants.h>
namespace gr {
@@ -31,18 +32,36 @@ namespace gr {
const std::string
prefix()
{
+ //Use "GR_PREFIX" environment variable when specified
+ const char *prefix = getenv("GR_PREFIX");
+ if (prefix != NULL) return prefix;
+
return "@prefix@";
}
const std::string
sysconfdir()
{
+ //Provide the sysconfdir in terms of prefix()
+ //when the "GR_PREFIX" environment var is specified.
+ if (getenv("GR_PREFIX") != NULL)
+ {
+ return prefix() + "/@GR_CONF_DIR@";
+ }
+
return "@SYSCONFDIR@";
}
const std::string
prefsdir()
{
+ //Provide the prefsdir in terms of sysconfdir()
+ //when the "GR_PREFIX" environment var is specified.
+ if (getenv("GR_PREFIX") != NULL)
+ {
+ return sysconfdir() + "/@CMAKE_PROJECT_NAME@/conf.d";
+ }
+
return "@GR_PREFSDIR@";
}