+#endif /* !CANNOT_DUMP */
+
+ return lpath;
+}
+
+void
+init_lread (void)
+{
+ /* First, set Vload_path. */
+
+ /* NB: Do not change Vload_path before calling load_path_default,
+ since it may check it against dump_path.
+ (This behavior could be changed.) */
+
+ /* We explicitly ignore EMACSLOADPATH when dumping. */
+ if (NILP (Vpurify_flag) && egetenv ("EMACSLOADPATH"))
+ {
+ Lisp_Object elpath = decode_env_path ("EMACSLOADPATH", 0, 1);
+
+ /* Check (non-nil) user-supplied elements. */
+ load_path_check (elpath);
+
+ /* If no nils in the environment variable, use as-is.
+ Otherwise, replace any nils with the default. */
+ if (NILP (Fmemq (Qnil, elpath)))
+ {
+ Vload_path = elpath;
+ }
+ else
+ {
+ Lisp_Object elem, default_lpath = load_path_default (0);
+
+ /* Check defaults, before adding site-lisp. */
+ load_path_check (default_lpath);
+
+ /* Add the site-lisp directories to the front of the default. */
+ if (!no_site_lisp)
+ {
+ Lisp_Object sitelisp;
+ sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
+ if (! NILP (sitelisp))
+ default_lpath = nconc2 (sitelisp, default_lpath);
+ }
+
+ Vload_path = Qnil;
+
+ /* Replace nils from EMACSLOADPATH by default. */
+ while (CONSP (elpath))
+ {
+ Lisp_Object arg[2];
+ elem = XCAR (elpath);
+ elpath = XCDR (elpath);
+ arg[0] = Vload_path;
+ arg[1] = NILP (elem) ? default_lpath : Fcons (elem, Qnil);
+ Vload_path = Fappend (2, arg);
+ }
+ } /* Fmemq (Qnil, Vload_path) */
+ }
+ else /* Vpurify_flag || !EMACSLOADPATH */
+ {
+#ifdef CANNOT_DUMP
+ bool changed = 0;
+#else
+ bool changed = initialized && NILP (Fequal (dump_path, Vload_path));
+#endif
+
+ Vload_path = load_path_default (changed);
+
+ /* Check before adding site-lisp directories.
+ The install should have created them, but they are not
+ required, so no need to warn if they are absent.
+ Or we might be running before installation. */
+ load_path_check (Vload_path);
+
+ /* Add the site-lisp directories at the front, unless the
+ load-path has already been changed.
+ FIXME? Should we ignore changed here? */
+ if (initialized && !no_site_lisp && !changed)
+ {
+ Lisp_Object sitelisp;
+ sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
+ if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
+ }
+ } /* !Vpurify_flag && EMACSLOADPATH */