diff --git a/build/autoconf/config.status.m4 b/build/autoconf/config.status.m4 index 99c90f43018a..e1f3a433777a 100644 --- a/build/autoconf/config.status.m4 +++ b/build/autoconf/config.status.m4 @@ -54,6 +54,11 @@ define([AC_SUBST_FFLAGS], ) define([AC_SUBST_DEFS], ) define([AC_SUBST_LDFLAGS], ) define([AC_SUBST_LIBS], ) +define([AC_SUBST_exec_prefix], ) +define([AC_SUBST_prefix], ) +define([AC_SUBST_datadir], ) +define([AC_SUBST_libdir], ) +define([AC_SUBST_includedir], ) dnl Wrap AC_DEFINE to store values in a format suitable for python. dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h, diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index dc4bec104ca8..360f76368458 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -1338,3 +1338,37 @@ def valid_mozillabuild_version(mozillabuild_version): die( f"Please upgrade MozillaBuild. You can find a recent version at: https://wiki.mozilla.org/MozillaBuild" ) + + +# old-school options for controlling install step +# ============================================================== +option( + "--prefix", + nargs=1, + metavar="PREFIX", + default="/usr/local", + help="install files using PREFIX as root directory", +) +set_config("prefix", depends("--prefix")(lambda prefix: prefix[0])) + +# Unlike autoconf, we don't offer these as a customisation point. +set_config("exec_prefix", depends("--prefix")(lambda prefix: prefix[0])) +set_config("datadir", depends("--prefix")(lambda prefix: f"{prefix[0]}/share")) + +option( + "--includedir", + nargs=1, + metavar="DIR", + default=depends("--prefix")(lambda prefix: f"{prefix[0]}/include"), + help="C header files in DIR", +) +set_config("includedir", depends("--includedir")(lambda idir: idir[0])) + +option( + "--libdir", + nargs=1, + metavar="DIR", + default=depends("--prefix")(lambda prefix: f"{prefix[0]}/lib"), + help="object code libraries in DIR", +) +set_config("libdir", depends("--libdir")(lambda ldir: ldir[0])) diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index b6f784d41f3e..579dc0d8d123 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -96,11 +96,7 @@ def old_configure_options(*options): @old_configure_options( "--cache-file", - "--datadir", "--enable-official-branding", - "--includedir", - "--libdir", - "--prefix", "--with-branding", "--x-includes", "--x-libraries", @@ -126,6 +122,9 @@ def old_configure_for(old_configure_path, extra_env=None): @depends( prepare_configure, prepare_configure_options, + "--prefix", + "--includedir", + "--libdir", prefer_mozillabuild_path, altered_path, extra_env, @@ -154,6 +153,9 @@ def old_configure_for(old_configure_path, extra_env=None): def old_configure( prepare_configure, prepare_configure_options, + prefix, + includedir, + libdir, prefer_mozillabuild_path, altered_path, extra_env, @@ -270,7 +272,16 @@ def old_configure_for(old_configure_path, extra_env=None): except OSError as e: die("Failed re-creating old-configure: %s" % e.message) - cmd = [shell, old_configure] + prepare_configure_options.options + old_configure_options = { + "prefix": prefix[0], + "includedir": includedir[0], + "libdir": libdir[0], + } + cmd = ( + [shell, old_configure] + + prepare_configure_options.options + + [f"--{k}={v}" for k, v in old_configure_options.items()] + ) env = dict(os.environ)