Skip to content

Commit

Permalink
Allow to configure Firebird in posix using relative directories with …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
asfernandes authored Dec 14, 2023
1 parent e3465b1 commit 6f33e54
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
16 changes: 13 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,19 @@ dnl XE_CONF_DIR(param, help, variable, default)
define([XE_CONF_DIR],[
AC_ARG_WITH([$1],
[AS_HELP_STRING([--with-$1],[$2])],
[[$3]="$withval"
CHANGE_PATH_SUPPORT=no
AC_DEFINE_UNQUOTED([$3], "$[$3]", [$2])],
[
case "$withval" in
/*)
CHANGE_PATH_SUPPORT=no
[$3]="$withval"
;;
*)
[$3]='${fb_install_prefix}'/"${withval}"
;;
esac
AC_DEFINE_UNQUOTED([$3], "${withval}", [$2])
],
[[$3]='${fb_install_prefix}[$4]'
AC_DEFINE_UNQUOTED([$3], [""], [$2])]
)
Expand Down
4 changes: 3 additions & 1 deletion src/common/TimeZoneUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ namespace
PathName temp;

// Could not call fb_utils::getPrefix here.
if (FB_TZDATADIR[0])
if (FB_TZDATADIR[0] && PathUtils::isRelative(FB_TZDATADIR))
PathUtils::concatPath(temp, Config::getRootDirectory(), FB_TZDATADIR);
else if (FB_TZDATADIR[0])
temp = FB_TZDATADIR;
else
{
Expand Down
12 changes: 10 additions & 2 deletions src/common/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,10 +1232,18 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
{
if (prefType != Firebird::IConfigManager::DIR_CONF &&
prefType != Firebird::IConfigManager::DIR_MSG &&
prefType != Firebird::IConfigManager::DIR_TZDATA &&
configDir[prefType][0])
{
// Value is set explicitly and is not environment overridable
PathUtils::concatPath(s, configDir[prefType], name);

if (PathUtils::isRelative(s))
{
gds__prefix(tmp, s.c_str());
return tmp;
}

return s;
}
}
Expand Down Expand Up @@ -1316,11 +1324,11 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
}

if (s.hasData() && name[0])
{
s += PathUtils::dir_sep;
}

s += name;
gds__prefix(tmp, s.c_str());

return tmp;
#endif
}
Expand Down
5 changes: 4 additions & 1 deletion src/yvalve/gds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4146,7 +4146,10 @@ class InitPrefix
Firebird::PathName msgPrefix;
if (!fb_utils::readenv(FB_MSG_ENV, msgPrefix))
{
msgPrefix = FB_MSGDIR[0] ? FB_MSGDIR : prefix;
if (FB_MSGDIR[0] && PathUtils::isRelative(FB_MSGDIR))
PathUtils::concatPath(msgPrefix, prefix, FB_MSGDIR);
else
msgPrefix = FB_MSGDIR[0] ? FB_MSGDIR : prefix;
}
msgPrefix.copyTo(fb_prefix_msg_val, sizeof(fb_prefix_msg_val));
fb_prefix_msg = fb_prefix_msg_val;
Expand Down

0 comments on commit 6f33e54

Please sign in to comment.