>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> So, should we make it work? I guess that it will work already
Angus> on Windows for those who use MikTeX and they're the ones who
Angus> will be running a LyX installed as C:\Program
Angus> Files\LyX\bin\lyx.exe

Could you try the following backport of the 1.4.x port? I did not have
the time to actually test it, all I can say is that it still seems to
work in the normal case.

JMarc

Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.363.2.94
diff -u -p -r1.363.2.94 ChangeLog
--- lib/ChangeLog	2 Feb 2005 13:12:21 -0000	1.363.2.94
+++ lib/ChangeLog	2 Feb 2005 13:20:49 -0000
@@ -1,3 +1,16 @@
+2005-02-02  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* configure.m4: instead of \input-ing the layout files directly in
+	latex, grep out the correct command from them; remove need for
+	\srcdir. This should fix the bug where latex configuration cannot
+	be done because LyX is installed in a directory which name
+	contains spaces.
+
+	* chkconfig.ltx: remove use of macro \srcdir
+	(\TestDocClass): change to take two arguments
+	(\DeclareLaTeXClass, \DeclareLinuxDocClass, \DeclareDocBookClass):
+	do not exit after execution
+
 2005-01-28  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* reLyX/acinclude.m4 (RELYX_ERROR, RELYX_USE_PACKAGING): new
Index: lib/chkconfig.ltx
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/chkconfig.ltx,v
retrieving revision 1.9.6.2
diff -u -p -r1.9.6.2 chkconfig.ltx
--- lib/chkconfig.ltx	13 Nov 2003 15:51:43 -0000	1.9.6.2
+++ lib/chkconfig.ltx	2 Feb 2005 13:20:49 -0000
@@ -35,24 +35,16 @@
 
 % we do not want to stop on errors
 \nonstopmode\makeatletter
-% Have we been called from the configure script?
[EMAIL PROTECTED]
- {\message{%
-**** WARNING: For proper results, you should not run this script directly.^^J%
-**** Please use the `configure' script.^^J}
-  \newcommand\srcdir{.}}
- [EMAIL PROTECTED]/}}}
 
 %%% Some useful macros.
 %   Several commands are defined to test for packages:
 %    \AddLayout{<layout>} adds an entry for <layout> in textclass.lst
 %    \AddVariable{<name>}{<value>} creates a new variable chk_<name>,
 %      and gives it the value <value>.
-%    \TestDocClass[<file>]{<name>} tests whether <name>.cls (or <file>,
-%      if it is provided) exists and creates a new entry with
-%      \AddLayout if this is the case. Note that you will probably not
-%      need to use this directly, since the configure script generates
-%      the needed macro calls automatically.
+%    \TestDocClass{<name>}{<command>} if layout <name> has not already
+%      been tested for, execute <command>. Note that you will
+%      probably not need to use this directly, since the configure
+%      script generates the needed macro calls automatically.
 %    \TestPackage[<file>]{<name>} tests whether <name>.sty (or <file>,
 %      if it is provided) exists. 
 %   Both commands call \AddVariable to give value 'yes' or 'no' to
@@ -95,13 +87,10 @@
   \fi}
 \newcommand{\TestPackage}[2][\default]{
   \TestItem[#1]{#2}{package}{sty}{\AddPackage{#2}}{}}
-\newcommand{\TestDocClass}[1]{
+\newcommand{\TestDocClass}[2]{
    \def\layoutname{#1}  % remember the name of the layout file
    [EMAIL PROTECTED]@#1}
-     {\bgroup
-        \catcode`\#=9  % consider # as a space
-        \input{layouts/#1.layout}  % read the layout file
-      \egroup
+     {#2  % execute the command
       [EMAIL PROTECTED]@#1}{}} 
      {} % we have already tried this one.
 }
@@ -109,7 +98,6 @@
   \TestItem[#1]{\layoutname}{document class}{cls}
            {\AddLayout[\firstelement]{\layoutname}{#2}{true}}
            {\AddLayout[\firstelement]{\layoutname}{#2}{false}}
-  \expandafter\endinput
 }
 \newcommand{\DeclareLinuxDocClass}[2][\default]{
   \message{^^J\prefix checking for linuxdoc class \layoutname... }
@@ -118,7 +106,6 @@
      \AddLayout[#1]{\layoutname}{#2}{false}}
     {\message{yes^^J}
      \AddLayout[#1]{\layoutname}{#2}{true}}
-  \expandafter\endinput
 }
 % Only for compatibility. Will be removed later.
 \let\DeclareSGMLClass=\DeclareDocBookClass
@@ -130,7 +117,6 @@
      \AddLayout[#1]{\layoutname}{#2}{false}}
     {\message{yes^^J}
      \AddLayout[#1]{\layoutname}{#2}{true}}
-  \expandafter\endinput
 }
 
 % Stolen from article.cls
Index: lib/configure.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.60.2.14
diff -u -p -r1.60.2.14 configure.m4
--- lib/configure.m4	2 Feb 2005 12:58:05 -0000	1.60.2.14
+++ lib/configure.m4	2 Feb 2005 13:20:49 -0000
@@ -165,8 +165,8 @@ ac_prog=[$]0
 changequote(,)dnl
 srcdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-test "x$srcdir" = "x$ac_prog" && srcdir=.
-if test ! -r ${srcdir}/chkconfig.ltx ; then
+test "x${srcdir}" = "x$ac_prog" && srcdir=.
+if test ! -r "${srcdir}"/chkconfig.ltx ; then
   echo "configure: error: cannot find chkconfig.ltx script"
   exit 1
 fi
@@ -409,9 +409,9 @@ if test ${lyx_check_config} = no ; then
 # for some reason. Run ./configure if you need to update it after a
 # configuration change.
 EOF
-  # build the list of available layout files and convert it to commands
-  # for chkconfig.ltx
-  for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
+  # build the list of available layout files and convert it to entries
+  # for the default textclass.lst file
+  for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
     case $file in
       */\*.layout) ;;
       *) if test -r "$file" ; then
@@ -447,26 +447,34 @@ changequote(,)dnl
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
+  if ! test -r "chkconfig.ltx" ; then
+    ln -s "${srcdir}"/chkconfig.ltx .
+    rmlink=true
+  fi
   cat >wrap_chkconfig.ltx <<EOF
-\\newcommand\\srcdir{${srcdir}}
 ${linuxdoc_cmd}
 ${docbook_cmd}
-\\input{${srcdir}/chkconfig.ltx}
+\\input{chkconfig.ltx}
 EOF
   ## Construct the list of classes to test for.
   # build the list of available layout files and convert it to commands
   # for chkconfig.ltx
-  for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
+  for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
     case $file in
       */\*.layout) ;;
-      *) test -r "$file" && echo $file ;;
+      *) if test -r "$file" ; then 
+           class=`echo $file | sed -e 's%^.*layouts/\(.*\)\.layout$%\1%'`
+	   # Generate the proper TestDocClass command for this layout
+	   grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
+	      | sed -e 's/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/' 
+	 fi ;;
     esac
-  done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
-	     > chklayouts.tex
+  done > chklayouts.tex
 changequote([,])dnl
   [eval] ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
   [eval] `cat chkconfig.vars | sed 's/-/_/g'`
 changequote(,)dnl
+  test -n "${rmlink}" && rm -f chkconfig.ltx
 fi
 
 # Do we have all the files we need? Useful if latex did not run
@@ -486,7 +494,7 @@ changequote(,)dnl
 echo "creating doc/LaTeXConfig.lyx"
 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
-sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
+sed -f chkconfig.sed "${srcdir}"/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
 
 echo "creating $outfile"
 cat >$outfile <<EOF
@@ -649,7 +657,7 @@ for file in $outfile textclass.lst packa
 	    doc/LaTeXConfig.lyx xfonts/fonts.dir ; do
   # we rename the file first, so that we avoid comparing a file with itself
   mv $file $file.new
-  if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ;
+  if test -r "${srcdir}"/$file && diff $file.new "${srcdir}"/$file >/dev/null 2>/dev/null ;
   then
     echo "removing $file, which is identical to the system global version"
     rm -f $file.new

Reply via email to