summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc
index 317f3bce..482fb4a4 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -683,11 +683,30 @@ bool readCheck( const char *fn )
return result;
}
+void defaultBuildDir()
+{
+ if ( buildDir != 0 )
+ return;
+
+ const char *ldlp = getenv("LD_LIBRARY_PATH");
+ if ( ldlp != 0 ) {
+ size_t len_atbd = strlen(ABS_TOP_BUILDDIR);
+
+ if ( strlen(ldlp) > len_atbd &&
+ memcmp( ldlp, ABS_TOP_BUILDDIR "/", len_atbd+1) == 0 )
+ {
+ buildDir = ABS_TOP_BUILDDIR;
+ }
+ }
+}
+
/* Main, process args and call yyparse to start scanning input. */
int main(int argc, const char **argv)
{
processArgs( argc, argv );
+ defaultBuildDir();
+
if ( verbose )
gblActiveRealm = 0xffffffff;