8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:40:38 +01:00

Allow to configure Firebird in posix using relative directories with options --with-fb*. (#7918)

Relative directories will be interpreted based in the runtime root prefix.
This commit is contained in:
Adriano dos Santos Fernandes 2023-12-12 22:36:14 -03:00
parent 4520f2e9c7
commit 69e2501d58
4 changed files with 31 additions and 8 deletions

View File

@ -26,9 +26,19 @@ dnl XE_CONF_DIR(param, help, variable, default)
define([XE_CONF_DIR],[ define([XE_CONF_DIR],[
AC_ARG_WITH([$1], AC_ARG_WITH([$1],
[AS_HELP_STRING([--with-$1],[$2])], [AS_HELP_STRING([--with-$1],[$2])],
[[$3]="$withval" [
CHANGE_PATH_SUPPORT=no case "$withval" in
AC_DEFINE_UNQUOTED([$3], "$[$3]", [$2])], /*)
CHANGE_PATH_SUPPORT=no
[$3]="$withval"
;;
*)
[$3]='${fb_install_prefix}'/"${withval}"
;;
esac
AC_DEFINE_UNQUOTED([$3], "${withval}", [$2])
],
[[$3]='${fb_install_prefix}[$4]' [[$3]='${fb_install_prefix}[$4]'
AC_DEFINE_UNQUOTED([$3], [""], [$2])] AC_DEFINE_UNQUOTED([$3], [""], [$2])]
) )

View File

@ -120,7 +120,9 @@ namespace
PathName temp; PathName temp;
// Could not call fb_utils::getPrefix here. // 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; temp = FB_TZDATADIR;
else else
{ {

View File

@ -1232,11 +1232,19 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
{ {
if (prefType != Firebird::IConfigManager::DIR_CONF && if (prefType != Firebird::IConfigManager::DIR_CONF &&
prefType != Firebird::IConfigManager::DIR_MSG && prefType != Firebird::IConfigManager::DIR_MSG &&
prefType != Firebird::IConfigManager::DIR_TZDATA &&
configDir[prefType][0]) configDir[prefType][0])
{ {
// Value is set explicitly and is not environment overridable // Value is set explicitly and is not environment overridable
PathUtils::concatPath(s, configDir[prefType], name); PathUtils::concatPath(s, configDir[prefType], name);
return s;
if (PathUtils::isRelative(s))
{
gds__prefix(tmp, s.c_str());
return tmp;
}
else
return s;
} }
} }
@ -1316,11 +1324,11 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
} }
if (s.hasData() && name[0]) if (s.hasData() && name[0])
{
s += PathUtils::dir_sep; s += PathUtils::dir_sep;
}
s += name; s += name;
gds__prefix(tmp, s.c_str()); gds__prefix(tmp, s.c_str());
return tmp; return tmp;
#endif #endif
} }

View File

@ -4364,7 +4364,10 @@ public:
Firebird::PathName msgPrefix; Firebird::PathName msgPrefix;
if (!fb_utils::readenv(FB_MSG_ENV, 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)); msgPrefix.copyTo(fb_prefix_msg_val, sizeof(fb_prefix_msg_val));
fb_prefix_msg = fb_prefix_msg_val; fb_prefix_msg = fb_prefix_msg_val;