The appended patch automatically runs lyxdir/configure if the user's
.lyx/lyxrc.defaults file does not exist or is older than the configure
script. The effect is that the users' setup is kept up to date when
lyx is upgraded

Pros:

- people have asked for some scheme for a long time. We have a lot of
  people who have problems with new versions just because they did not
  run Edit>Reconfigure

- this way of doing it is both simple and (IMO) effective

- it seems very important for me to address this before next release

Cons:

- feature freeze

- it may be that this scheme does not work well in some setups (cases
  where people have setup their system in a way I have not thought of)

- this does not catch _all_ the cases where reconfiguring is needed.
  However, it catches 90% of the cases, I think

- it does this reconfiguration without asking the user about it. This
  is not a big problem, since only the defaults are changed.

- feature freeze


What I would like to do is commit this patch now, and maybe revert it
after the first prerelease if it turns out that it was not a good
idea. I'd like people to try it out, although I do not see how it
could cause problems.

Also, I would like to change the behaviour so that the output goes to
a file config.log instead of standard output.

Comments?

JMarc

Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.944
diff -u -p -r1.944 ChangeLog
--- src/ChangeLog	16 Sep 2002 12:52:57 -0000	1.944
+++ src/ChangeLog	17 Sep 2002 13:55:24 -0000
@@ -1,3 +1,8 @@
+2002-09-17  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* lyx_main.C (queryUserLyXDir): re-run automatically the configure
+	script if it is newer than the lyxrc.defaults in user directory
+
 2002-09-16  John Levon  <[EMAIL PROTECTED]>
 
 	* lyxfunc.C: check tabular for cut/copy too
Index: src/lyx_main.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_main.C,v
retrieving revision 1.123
diff -u -p -r1.123 lyx_main.C
--- src/lyx_main.C	27 Aug 2002 20:30:18 -0000	1.123
+++ src/lyx_main.C	17 Sep 2002 13:55:24 -0000
@@ -571,10 +571,22 @@ void LyX::deadKeyBindings(kb_keymap * kb
 
 void LyX::queryUserLyXDir(bool explicit_userdir)
 {
+	string const configure_script = AddName(system_lyxdir, "configure");
+
 	// Does user directory exist?
 	FileInfo fileInfo(user_lyxdir);
 	if (fileInfo.isOK() && fileInfo.isDir()) {
 		first_start = false;
+		Path p(user_lyxdir);
+		FileInfo script(configure_script);
+		FileInfo defaults("lyxrc.defaults");
+		if (!defaults.isOK()
+		    || defaults.getModificationTime() < script.getModificationTime()) {
+			lyxerr << _("LyX: reconfiguring user directory")
+			       << endl;
+			::system(configure_script.c_str());
+			lyxerr << "LyX: " << _("Done!") << endl;
+		}
 		return;
 	}
 
@@ -605,7 +617,7 @@ void LyX::queryUserLyXDir(bool explicit_
 
 	// Run configure in user lyx directory
 	Path p(user_lyxdir);
-	::system(AddName(system_lyxdir, "configure").c_str());
+	::system(configure_script.c_str());
 	lyxerr << "LyX: " << _("Done!") << endl;
 }
 

Reply via email to