Skip to content

Commit 6f33e54

Browse files
authored
Allow to configure Firebird in posix using relative directories with options --with-fb* (#7918)
* Allow to configure Firebird in posix using relative directories with options --with-fb*. Relative directories will be interpreted based in the runtime root prefix.
1 parent e3465b1 commit 6f33e54

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

configure.ac

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,19 @@ dnl XE_CONF_DIR(param, help, variable, default)
2626
define([XE_CONF_DIR],[
2727
AC_ARG_WITH([$1],
2828
[AS_HELP_STRING([--with-$1],[$2])],
29-
[[$3]="$withval"
30-
CHANGE_PATH_SUPPORT=no
31-
AC_DEFINE_UNQUOTED([$3], "$[$3]", [$2])],
29+
[
30+
case "$withval" in
31+
/*)
32+
CHANGE_PATH_SUPPORT=no
33+
[$3]="$withval"
34+
;;
35+
*)
36+
[$3]='${fb_install_prefix}'/"${withval}"
37+
;;
38+
esac
39+
40+
AC_DEFINE_UNQUOTED([$3], "${withval}", [$2])
41+
],
3242
[[$3]='${fb_install_prefix}[$4]'
3343
AC_DEFINE_UNQUOTED([$3], [""], [$2])]
3444
)

src/common/TimeZoneUtil.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ namespace
121121
PathName temp;
122122

123123
// Could not call fb_utils::getPrefix here.
124-
if (FB_TZDATADIR[0])
124+
if (FB_TZDATADIR[0] && PathUtils::isRelative(FB_TZDATADIR))
125+
PathUtils::concatPath(temp, Config::getRootDirectory(), FB_TZDATADIR);
126+
else if (FB_TZDATADIR[0])
125127
temp = FB_TZDATADIR;
126128
else
127129
{

src/common/utils.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,10 +1232,18 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
12321232
{
12331233
if (prefType != Firebird::IConfigManager::DIR_CONF &&
12341234
prefType != Firebird::IConfigManager::DIR_MSG &&
1235+
prefType != Firebird::IConfigManager::DIR_TZDATA &&
12351236
configDir[prefType][0])
12361237
{
12371238
// Value is set explicitly and is not environment overridable
12381239
PathUtils::concatPath(s, configDir[prefType], name);
1240+
1241+
if (PathUtils::isRelative(s))
1242+
{
1243+
gds__prefix(tmp, s.c_str());
1244+
return tmp;
1245+
}
1246+
12391247
return s;
12401248
}
12411249
}
@@ -1316,11 +1324,11 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
13161324
}
13171325

13181326
if (s.hasData() && name[0])
1319-
{
13201327
s += PathUtils::dir_sep;
1321-
}
1328+
13221329
s += name;
13231330
gds__prefix(tmp, s.c_str());
1331+
13241332
return tmp;
13251333
#endif
13261334
}

src/yvalve/gds.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4146,7 +4146,10 @@ class InitPrefix
41464146
Firebird::PathName msgPrefix;
41474147
if (!fb_utils::readenv(FB_MSG_ENV, msgPrefix))
41484148
{
4149-
msgPrefix = FB_MSGDIR[0] ? FB_MSGDIR : prefix;
4149+
if (FB_MSGDIR[0] && PathUtils::isRelative(FB_MSGDIR))
4150+
PathUtils::concatPath(msgPrefix, prefix, FB_MSGDIR);
4151+
else
4152+
msgPrefix = FB_MSGDIR[0] ? FB_MSGDIR : prefix;
41504153
}
41514154
msgPrefix.copyTo(fb_prefix_msg_val, sizeof(fb_prefix_msg_val));
41524155
fb_prefix_msg = fb_prefix_msg_val;

0 commit comments

Comments
 (0)