From f155f7f24419a8b2ad761eefc5312de857296f9a Mon Sep 17 00:00:00 2001 From: "ramiro%eazel.com" Date: Sat, 21 Oct 2000 08:33:16 +0000 Subject: [PATCH] Bug 56793. Add support for building unix mozilla with a default MOZILLA_FIVE_HOME. Build changes r=cls. Small XPCOM change sr=scc. --- build/unix/nspr_my_overrides.mk.in | 5 +++++ configure.in | 19 +++++++++++++++++++ xpcom/io/nsDirectoryService.cpp | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/build/unix/nspr_my_overrides.mk.in b/build/unix/nspr_my_overrides.mk.in index cc9ac3132d06..81152a9792ea 100644 --- a/build/unix/nspr_my_overrides.mk.in +++ b/build/unix/nspr_my_overrides.mk.in @@ -1,7 +1,12 @@ DIST=@MOZ_NSPRENV_DIST@ MOZ_NSPRENV_OVERRIDE_MAKE=@MOZ_NSPRENV_OVERRIDE_MAKE@ +MOZ_NSPRENV_OVERRIDE_DSO_LDOPTS=@MOZ_NSPRENV_OVERRIDE_DSO_LDOPTS@ ifdef MOZ_NSPRENV_OVERRIDE_MAKE MAKE=$(MOZ_NSPRENV_OVERRIDE_MAKE) endif +ifdef MOZ_NSPRENV_OVERRIDE_DSO_LDOPTS +DSO_LDOPTS=$(MOZ_NSPRENV_OVERRIDE_DSO_LDOPTS) +endif + diff --git a/configure.in b/configure.in index 5b41036878a5..494179a6a532 100644 --- a/configure.in +++ b/configure.in @@ -3105,6 +3105,25 @@ MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc, AC_SUBST(USE_ELF_DYNSTR_GC) +dnl ======================================================== +dnl = +dnl = --with-debug-modules=module1,^module2,etc +dnl = +dnl = Enable/disable debug for specific modules only +dnl = module names beginning with ^ will be disabled (this is because you can't +dnl = pass args to --without-debug-modules) +dnl = +dnl ======================================================== +MOZ_ARG_WITH_STRING(default-mozilla-five-home, +[ --with-default-mozilla-five-home Set the default value for MOZILLA_FIVE_HOME], + [ val=`echo $withval` + DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath=$val" + LIBS="$LIBS -Wl,-rpath=$val" + AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") + MOZ_NSPRENV_OVERRIDE_DSO_LDOPTS="-shared -rpath=$val" + AC_SUBST(MOZ_NSPRENV_OVERRIDE_DSO_LDOPTS) ] ) +dnl ======================================================== + dnl ======================================================== dnl = dnl = --with-debug-modules=module1,^module2,etc diff --git a/xpcom/io/nsDirectoryService.cpp b/xpcom/io/nsDirectoryService.cpp index 34c56f2b6be3..1d2aba834d48 100644 --- a/xpcom/io/nsDirectoryService.cpp +++ b/xpcom/io/nsDirectoryService.cpp @@ -196,7 +196,25 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile) // - if MOZILLA_FIVE_HOME is defined, that is it // - else give the current directory char buf[MAXPATHLEN]; + + // The MOZ_DEFAULT_MOZILLA_FIVE_HOME variable can be set at configure time with + // a --with-default-mozilla-five-home=foo autoconf flag. + // + // The idea here is to allow for builds that have a default MOZILLA_FIVE_HOME + // regardless of the environment. This makes it easier to write apps that + // embed mozilla without having to worry about setting up the environment + // + // We do this py putenv()ing the default value into the environment. Note that + // we only do this if it is not already set. +#ifdef MOZ_DEFAULT_MOZILLA_FIVE_HOME + if (PR_GetEnv("MOZILLA_FIVE_HOME") == nsnull) + { + putenv("MOZILLA_FIVE_HOME=" MOZ_DEFAULT_MOZILLA_FIVE_HOME); + } +#endif + char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME"); + if (moz5) { localFile->InitWithPath(moz5);