Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-22 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

 I guess fixing it will be a matter of seconds...

Angus I'm not sure what you want to happen. Are you're saying that
Angus sed should modify only the first DeclareLaTeXClass entry it
Angus sees, in line 2?

Yes. Could you do the change for me?

JMarc



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-22 Thread Stephan Witt
Angus Leeming wrote:
Stephan Witt wrote:
Angus Leeming wrote:
Stephan Witt wrote:
Angus Leeming wrote:
Jean-Marc Lasgouttes wrote:
Angus Do you also want the stuff to address André's query? The test
Angus would become:

Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out
on his Solaris machine? Do you want me to commit it to cvs or do you
want Stephan to have a go first?

That's no problem... I can do test a patch for you.

Ok, here is lib/configure.m4 Stephan.

snip
Sorry for the delay, I'm a little busy right now.

Hey, don't worry at all! Thanks for doing this.
It is fun. I've to admit I'm working on *nix for years and
I never mastered sed like you!
Afterall I'll have to learn a bit of it.

Now the results:

snip details
So, it should be all as expected :)
Stephan

Great. Then I'll commit these patches (attached for reference) to the 1.3.x
and 1.4.x trees.
Thanks, I'll leave the office now.
snip
Stephan



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-22 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 I guess fixing it will be a matter of seconds...
 
 Angus I'm not sure what you want to happen. Are you're saying that
 Angus sed should modify only the first DeclareLaTeXClass entry it
 Angus sees, in line 2?
 
 Yes. Could you do the change for me?

Sure.

Do you also want the stuff to address André's query?
The test would become:

sed -n '
# We manipulate only those lines that contain
# \Declare(LaTeX|DocBook|LinuxDoc)Class
/\\DeclareLaTeXClass/bmatch
/\\DeclareDocBookClass/bmatch
/\\DeclareLinuxDocClass/bmatch
b

:match
# Remove the \DeclareFOOClass macro and add the correct boolean 
# at the end of the line telling whether the class is 
# available
s/^.*\DeclareLaTeXClass *\(.*\)/\1 false/
s/^.*\DeclareDocBookClass *\(.*\)/\1 '$bool_docbook'/
s/^.*\DeclareLinuxDocClass *\(.*\)/\1 '$bool_linuxdoc'/
# If the macro had an optional argument with several 
# parameters, only keep the first one
s/\[\([^,]*\),[^]]*\]/[\1]/
# If the macro did not have an optional argument, provide one 
# (equal to the class name)
s/^{/['$class']{/
# Remove brackets and replace with correctly quoted entries
s/\[\([^]]*\)\] *{\([^}]*\)}/'$class' \1 \2/
# Print the maninpulated text
p
# We're interested in the first instance of \DeclareFOOClass only,
# so now quit
q
' $file  textclass.lst

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-22 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus Do you also want the stuff to address André's query? The test
Angus would become:

Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

JMarc



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-22 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 Angus Do you also want the stuff to address André's query? The test
 Angus would become:
 
 Why not. It scares me, but if you say it's portable, go ahead. But the
 poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out on
his Solaris machine? Do you want me to commit it to cvs or do you want
Stephan to have a go first?

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-22 Thread Stephan Witt
Angus Leeming wrote:
Jean-Marc Lasgouttes wrote:
Angus Do you also want the stuff to address André's query? The test
Angus would become:
Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out on
his Solaris machine? Do you want me to commit it to cvs or do you want
Stephan to have a go first?
That's no problem... I can do test a patch for you.
Stephan



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-22 Thread Angus Leeming
Stephan Witt wrote:
 Angus Leeming wrote:
 Jean-Marc Lasgouttes wrote:
 
Angus Do you also want the stuff to address André's query? The test
Angus would become:

Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.
 
 
 Heck, now you've scared me! Why don't we give it to Stephan to try out
 on his Solaris machine? Do you want me to commit it to cvs or do you
 want Stephan to have a go first?
 
 That's no problem... I can do test a patch for you.

Ok, here is lib/configure.m4 Stephan. Just in case you don't have m4
installed, I attach also the configure that is generated from this .m4
file.

Before you test it out, could you modify your existing configure to print
out some data. See the lines in the attachment:
  cp textclass.lst angus_textclass.lst
  cp chklayouts.tex angus_chklayouts.tex

Edit your existing configure script to output, say, stephan_textclass.lst
and stephan_chklayouts.tex.
$ ./configure
$ ./configure --without-latex-config

Thereafter, build and run the new configure as:
$ m4 configure.m4  configure
$ ./configure
$ ./configure --without-latex-config

That should generate angus_chklayouts.tex and angus_textclass.lst

Comparing the new with the old, I find that there are (expected)
differences. Do you see something similar?

$ diff -u angus_orig_chklayouts.tex angus_chklayouts.tex
--- angus_orig_chklayouts.tex   2005-04-22 15:25:44.749542128 +
+++ angus_chklayouts.tex2005-04-22 15:27:45.594170952 +
@@ -1,7 +1,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (AA)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (AA V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (AA V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++)
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS,
unnumbered)}}
@@ -70,7 +69,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (AA)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (AA V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (AA V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++)
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS,
unnumbered

$ diff -u angus_orig_textclass.lst angus_textclass.lst
--- angus_orig_textclass.lst2005-04-22 15:26:23.144705176 +
+++ angus_textclass.lst 2005-04-22 15:27:53.605952976 +
@@ -6,7 +6,6 @@
 IEEEtran IEEEtran article (IEEEtran) false
 aa aa article (AA) false
 aapaper aa article (AA V4) false
-aapaper aa-old article (AA V4) false
 aastex aastex article (AASTeX) false
 agums aguplus article (AGU++) manuscript false
 amsart-plain amsart article (AMS, unnumbered) false

-- 
Angus

configure.gz
Description: GNU Zip compressed data


configure.m4.gz
Description: GNU Zip compressed data


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Stephan Witt
Angus Leeming wrote:
Stephan Witt wrote:
Angus Leeming wrote:
Jean-Marc Lasgouttes wrote:

Angus Do you also want the stuff to address André's query? The test
Angus would become:
Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out
on his Solaris machine? Do you want me to commit it to cvs or do you
want Stephan to have a go first?
That's no problem... I can do test a patch for you.

Ok, here is lib/configure.m4 Stephan. Just in case you don't have m4
installed, I attach also the configure that is generated from this .m4
file.
Before you test it out, could you modify your existing configure to print
out some data. See the lines in the attachment:
  cp textclass.lst angus_textclass.lst
  cp chklayouts.tex angus_chklayouts.tex
Edit your existing configure script to output, say, stephan_textclass.lst
and stephan_chklayouts.tex.
$ ./configure
$ ./configure --without-latex-config
Thereafter, build and run the new configure as:
$ m4 configure.m4  configure
$ ./configure
$ ./configure --without-latex-config
That should generate angus_chklayouts.tex and angus_textclass.lst
Comparing the new with the old, I find that there are (expected)
differences. Do you see something similar?
$ diff -u angus_orig_chklayouts.tex angus_chklayouts.tex
--- angus_orig_chklayouts.tex   2005-04-22 15:25:44.749542128 +
+++ angus_chklayouts.tex2005-04-22 15:27:45.594170952 +
@@ -1,7 +1,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (AA)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (AA V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (AA V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++)
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS,
unnumbered)}}
@@ -70,7 +69,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (AA)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (AA V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (AA V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++)
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS,
unnumbered
$ diff -u angus_orig_textclass.lst angus_textclass.lst
--- angus_orig_textclass.lst2005-04-22 15:26:23.144705176 +
+++ angus_textclass.lst 2005-04-22 15:27:53.605952976 +
@@ -6,7 +6,6 @@
 IEEEtran IEEEtran article (IEEEtran) false
 aa aa article (AA) false
 aapaper aa article (AA V4) false
-aapaper aa-old article (AA V4) false
 aastex aastex article (AASTeX) false
 agums aguplus article (AGU++) manuscript false
 amsart-plain amsart article (AMS, unnumbered) false
Sorry for the delay, I'm a little busy right now.
Ok, I created the original versions with my own patched scripts.
The current cvs scripts produced nothing...
Now the results:

$ diff -u stephan_chklayouts.tex angus_chklayouts.tex
--- stephan_chklayouts.tex  2005-04-22 18:12:59.0 +0200
+++ angus_chklayouts.tex2005-04-22 18:17:18.0 +0200
@@ -1,7 +1,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (AA)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (AA V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (AA V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++) 
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS, 
unnumbered)}}
@@ -70,7 +69,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (AA)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (AA V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (AA V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++) 
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS, 
unnumbered)}}
$ diff -u stephan_textclass.lst angus_textclass.lst
--- stephan_textclass.lst   2005-04-22 18:13:21.0 +0200
+++ angus_textclass.lst 2005-04-22 18:17:24.0 +0200
@@ -6,7 +6,6 @@
 IEEEtran IEEEtran article (IEEEtran) false
 aa aa article (AA) false
 aapaper aa article (AA V4) false
-aapaper aa-old article (AA V4) false
 aastex aastex article (AASTeX) false
 agums aguplus article (AGU++) manuscript false
 amsart-plain amsart article (AMS, unnumbered) false

Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Angus Leeming
Stephan Witt wrote:
 Angus Leeming wrote:
 Stephan Witt wrote:
Angus Leeming wrote:
Jean-Marc Lasgouttes wrote:
Angus Do you also want the stuff to address André's query? The test
Angus would become:

Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out
on his Solaris machine? Do you want me to commit it to cvs or do you
want Stephan to have a go first?

That's no problem... I can do test a patch for you.

 Ok, here is lib/configure.m4 Stephan.

snip

 Sorry for the delay, I'm a little busy right now.

Hey, don't worry at all! Thanks for doing this.

 Now the results:

snip details

 So, it should be all as expected :)
 Stephan

Great. Then I'll commit these patches (attached for reference) to the 1.3.x
and 1.4.x trees.

Regards,
-- 
AngusIndex: lib/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.363.2.104
diff -u -p -r1.363.2.104 ChangeLog
--- lib/ChangeLog	17 Apr 2005 17:31:25 -	1.363.2.104
+++ lib/ChangeLog	22 Apr 2005 16:34:40 -
@@ -1,3 +1,8 @@
+2005-04-22  Angus Leeming  [EMAIL PROTECTED]
+
+	* configure.m4: rewrite the DeclareFOOClass manipulation
+	scripts to be more portable.
+
 2005-04-15  Angus Leeming  [EMAIL PROTECTED]
 
 	* scripts/convertDefault.sh: post error messages to STDERR.
Index: lib/configure.m4
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.60.2.17
diff -u -p -r1.60.2.17 configure.m4
--- lib/configure.m4	25 Mar 2005 15:35:52 -	1.60.2.17
+++ lib/configure.m4	22 Apr 2005 16:34:41 -
@@ -422,32 +422,44 @@ changequote([,])dnl
if test  x`[eval] echo $ac_n '${found_'$cleanclass'}'` = x ; then
  [eval] found_$cleanclass=yes
 changequote(,)dnl
-	 # The sed commands below are a bit scary. Here is what they do:
-	 # 1-3: remove the \DeclareFOO macro and add the correct boolean 
-	 #  at the end of the line telling whether the class is 
- #  available
-	 # 4: if the macro had an optional argument with several 
-	 #parameters, only keep the first one
-	 # 5: if the macro did not have an optional argument, provide one 
-	 #(equal to the class name)
-	 # 6: remove brackets and replace with correctly quoted entries
-	 grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' $file \
-	  | sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 false/' \
-		-e 's/^.*\DeclareDocBookClass *\(.*\)/\1 '$bool_docbook'/' \
-		-e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 '$bool_linuxdoc'/' \
-		-e 's/\[\([^,]*\),[^]]*\]/[\1]/' \
-		-e 's/^{/['$class']{/' \
-		-e 's/\[\([^]]*\)\] *{\([^}]*\)}/'$class' \1 \2/' \
-textclass.lst
+	 sed -n '
+# We manipulate only those lines that contain
+# \Declare(LaTeX|DocBook|LinuxDoc)Class
+/\\DeclareLaTeXClass/bmatch
+/\\DeclareDocBookClass/bmatch
+/\\DeclareLinuxDocClass/bmatch
+b
+
+:match
+# Remove the \DeclareFOOClass macro and add the correct boolean 
+# at the end of the line telling whether the class is 
+# available
+s/^.*\DeclareLaTeXClass *\(.*\)/\1 false/
+s/^.*\DeclareDocBookClass *\(.*\)/\1 '$bool_docbook'/
+s/^.*\DeclareLinuxDocClass *\(.*\)/\1 '$bool_linuxdoc'/
+# If the macro had an optional argument with several 
+# parameters, only keep the first one
+s/\[\([^,]*\),[^]]*\]/[\1]/
+# If the macro did not have an optional argument, provide one 
+# (equal to the class name)
+s/^{/['$class']{/
+# Remove brackets and replace with correctly quoted entries
+s/\[\([^]]*\)\] *{\([^}]*\)}/'$class' \1 \2/
+# Print the maninpulated text
+p
+# We are interested in the first instance of \DeclareFOOClass only,
+# so now quit
+q
+' $file  textclass.lst
fi
 	 fi ;;
 esac
-  done 
+  done
   MSG_RESULT(done)
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
-  if ! test -r chkconfig.ltx ; then
+  if test ! -r chkconfig.ltx ; then
 ln -s ${srcdir}/chkconfig.ltx .
 rmlink=true
   fi
@@ -462,11 +474,25 @@ EOF
   for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
 case $file in
   */\*.layout) ;;
-  *) if test -r $file ; then 
+  *) 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}/' 
+	   sed -n '
+# We manipulate only those lines that contain
+# \Declare(LaTeX|DocBook|LinuxDoc)Class
+/\\DeclareLaTeXClass/bmatch
+/\\DeclareDocBookClass/bmatch
+/\\DeclareLinuxDocClass/bmatch
+b
+
+:match
+# Wrap the entire line (minus the leading # ) inside a
+# \TestDocClass{CLASS}{...} 

Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

>> I guess fixing it will be a matter of seconds...

Angus> I'm not sure what you want to happen. Are you're saying that
Angus> sed should modify only the first DeclareLaTeXClass entry it
Angus> sees, in line 2?

Yes. Could you do the change for me?

JMarc



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Stephan Witt
Angus Leeming wrote:
Stephan Witt wrote:
Angus Leeming wrote:
Stephan Witt wrote:
Angus Leeming wrote:
Jean-Marc Lasgouttes wrote:
Angus> Do you also want the stuff to address André's query? The test
Angus> would become:

Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out
on his Solaris machine? Do you want me to commit it to cvs or do you
want Stephan to have a go first?

That's no problem... I can do test a patch for you.

Ok, here is lib/configure.m4 Stephan.


Sorry for the delay, I'm a little busy right now.

Hey, don't worry at all! Thanks for doing this.
It is fun. I've to admit I'm working on *nix for years and
I never mastered "sed" like you!
Afterall I'll have to learn a bit of it.

Now the results:


So, it should be all as expected :)
Stephan

Great. Then I'll commit these patches (attached for reference) to the 1.3.x
and 1.4.x trees.
Thanks, I'll leave the office now.

Stephan



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
>>> I guess fixing it will be a matter of seconds...
> 
> Angus> I'm not sure what you want to happen. Are you're saying that
> Angus> sed should modify only the first DeclareLaTeXClass entry it
> Angus> sees, in line 2?
> 
> Yes. Could you do the change for me?

Sure.

Do you also want the stuff to address André's query?
The test would become:

sed -n '
# We manipulate only those lines that contain
# "\Declare(LaTeX|DocBook|LinuxDoc)Class"
/\\DeclareLaTeXClass/bmatch
/\\DeclareDocBookClass/bmatch
/\\DeclareLinuxDocClass/bmatch
b

:match
# Remove the \DeclareFOOClass macro and add the correct boolean 
# at the end of the line telling whether the class is 
# available
s/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/
s/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/
s/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/
# If the macro had an optional argument with several 
# parameters, only keep the first one
s/\[\([^,]*\),[^]]*\]/[\1]/
# If the macro did not have an optional argument, provide one 
# (equal to the class name)
s/^{/['$class']{/
# Remove brackets and replace with correctly quoted entries
s/\[\([^]]*\)\] *{\([^}]*\)}/"'$class'" "\1" "\2"/
# Print the maninpulated text
p
# We're interested in the first instance of \DeclareFOOClass only,
# so now quit
q
' "$file" >> textclass.lst

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Do you also want the stuff to address André's query? The test
Angus> would become:

Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

JMarc



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> Angus> Do you also want the stuff to address André's query? The test
> Angus> would become:
> 
> Why not. It scares me, but if you say it's portable, go ahead. But the
> poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out on
his Solaris machine? Do you want me to commit it to cvs or do you want
Stephan to have a go first?

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Stephan Witt
Angus Leeming wrote:
Jean-Marc Lasgouttes wrote:
Angus> Do you also want the stuff to address André's query? The test
Angus> would become:
Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out on
his Solaris machine? Do you want me to commit it to cvs or do you want
Stephan to have a go first?
That's no problem... I can do test a patch for you.
Stephan



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Angus Leeming
Stephan Witt wrote:
> Angus Leeming wrote:
>> Jean-Marc Lasgouttes wrote:
>> 
>>>Angus> Do you also want the stuff to address André's query? The test
>>>Angus> would become:
>>>
>>>Why not. It scares me, but if you say it's portable, go ahead. But the
>>>poor man's version is good enough for me.
>> 
>> 
>> Heck, now you've scared me! Why don't we give it to Stephan to try out
>> on his Solaris machine? Do you want me to commit it to cvs or do you
>> want Stephan to have a go first?
> 
> That's no problem... I can do test a patch for you.

Ok, here is lib/configure.m4 Stephan. Just in case you don't have m4
installed, I attach also the configure that is generated from this .m4
file.

Before you test it out, could you modify your existing configure to print
out some data. See the lines in the attachment:
  cp textclass.lst angus_textclass.lst
  cp chklayouts.tex angus_chklayouts.tex

Edit your existing configure script to output, say, stephan_textclass.lst
and stephan_chklayouts.tex.
$ ./configure
$ ./configure --without-latex-config

Thereafter, build and run the new configure as:
$ m4 configure.m4 > configure
$ ./configure
$ ./configure --without-latex-config

That should generate angus_chklayouts.tex and angus_textclass.lst

Comparing the new with the old, I find that there are (expected)
differences. Do you see something similar?

$ diff -u angus_orig_chklayouts.tex angus_chklayouts.tex
--- angus_orig_chklayouts.tex   2005-04-22 15:25:44.749542128 +
+++ angus_chklayouts.tex2005-04-22 15:27:45.594170952 +
@@ -1,7 +1,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (A)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (A V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (A V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++)
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS,
unnumbered)}}
@@ -70,7 +69,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (A)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (A V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (A V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++)
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS,
unnumbered

$ diff -u angus_orig_textclass.lst angus_textclass.lst
--- angus_orig_textclass.lst2005-04-22 15:26:23.144705176 +
+++ angus_textclass.lst 2005-04-22 15:27:53.605952976 +
@@ -6,7 +6,6 @@
 "IEEEtran" "IEEEtran" "article (IEEEtran)" "false"
 "aa" "aa" "article (A)" "false"
 "aapaper" "aa" "article (A V4)" "false"
-"aapaper" "aa-old" "article (A V4)" "false"
 "aastex" "aastex" "article (AASTeX)" "false"
 "agums" "aguplus" "article (AGU++) manuscript" "false"
 "amsart-plain" "amsart" "article (AMS, unnumbered)" "false"

-- 
Angus

configure.gz
Description: GNU Zip compressed data


configure.m4.gz
Description: GNU Zip compressed data


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Stephan Witt
Angus Leeming wrote:
Stephan Witt wrote:
Angus Leeming wrote:
Jean-Marc Lasgouttes wrote:

Angus> Do you also want the stuff to address André's query? The test
Angus> would become:
Why not. It scares me, but if you say it's portable, go ahead. But the
poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out
on his Solaris machine? Do you want me to commit it to cvs or do you
want Stephan to have a go first?
That's no problem... I can do test a patch for you.

Ok, here is lib/configure.m4 Stephan. Just in case you don't have m4
installed, I attach also the configure that is generated from this .m4
file.
Before you test it out, could you modify your existing configure to print
out some data. See the lines in the attachment:
  cp textclass.lst angus_textclass.lst
  cp chklayouts.tex angus_chklayouts.tex
Edit your existing configure script to output, say, stephan_textclass.lst
and stephan_chklayouts.tex.
$ ./configure
$ ./configure --without-latex-config
Thereafter, build and run the new configure as:
$ m4 configure.m4 > configure
$ ./configure
$ ./configure --without-latex-config
That should generate angus_chklayouts.tex and angus_textclass.lst
Comparing the new with the old, I find that there are (expected)
differences. Do you see something similar?
$ diff -u angus_orig_chklayouts.tex angus_chklayouts.tex
--- angus_orig_chklayouts.tex   2005-04-22 15:25:44.749542128 +
+++ angus_chklayouts.tex2005-04-22 15:27:45.594170952 +
@@ -1,7 +1,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (A)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (A V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (A V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++)
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS,
unnumbered)}}
@@ -70,7 +69,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (A)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (A V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (A V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++)
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS,
unnumbered
$ diff -u angus_orig_textclass.lst angus_textclass.lst
--- angus_orig_textclass.lst2005-04-22 15:26:23.144705176 +
+++ angus_textclass.lst 2005-04-22 15:27:53.605952976 +
@@ -6,7 +6,6 @@
 "IEEEtran" "IEEEtran" "article (IEEEtran)" "false"
 "aa" "aa" "article (A)" "false"
 "aapaper" "aa" "article (A V4)" "false"
-"aapaper" "aa-old" "article (A V4)" "false"
 "aastex" "aastex" "article (AASTeX)" "false"
 "agums" "aguplus" "article (AGU++) manuscript" "false"
 "amsart-plain" "amsart" "article (AMS, unnumbered)" "false"
Sorry for the delay, I'm a little busy right now.
Ok, I created the "original" versions with my own patched scripts.
The current cvs scripts produced nothing...
Now the results:

$ diff -u stephan_chklayouts.tex angus_chklayouts.tex
--- stephan_chklayouts.tex  2005-04-22 18:12:59.0 +0200
+++ angus_chklayouts.tex2005-04-22 18:17:18.0 +0200
@@ -1,7 +1,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (A)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (A V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (A V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++) 
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS, 
unnumbered)}}
@@ -70,7 +69,6 @@
 \TestDocClass{IEEEtran}{\DeclareLaTeXClass{article (IEEEtran)}}
 \TestDocClass{aa}{\DeclareLaTeXClass[aa]{article (A)}}
 \TestDocClass{aapaper}{\DeclareLaTeXClass[aa]{article (A V4)}}
-\TestDocClass{aapaper}{\DeclareLaTeXClass[aa-old]{article (A V4)}}
 \TestDocClass{aastex}{\DeclareLaTeXClass[aastex]{article (AASTeX)}}
 \TestDocClass{agums}{\DeclareLaTeXClass[aguplus,agums.sty]{article (AGU++) 
manuscript}}
 \TestDocClass{amsart-plain}{\DeclareLaTeXClass[amsart]{article (AMS, 
unnumbered)}}
$ diff -u stephan_textclass.lst angus_textclass.lst
--- stephan_textclass.lst   2005-04-22 18:13:21.0 +0200
+++ angus_textclass.lst 2005-04-22 18:17:24.0 +0200
@@ -6,7 +6,6 @@
 "IEEEtran" "IEEEtran" "article (IEEEtran)" "false"
 "aa" "aa" "article (A)" "false"
 "aapaper" "aa" "article (A V4)" "false"
-"aapaper" "aa-old" "article (A V4)" "false"
 "aastex" "aastex" "article (AASTeX)" "false"
 "agums" "aguplus" "article 

Re: Portability problem with lib/configure srcipt on Solaris

2005-04-22 Thread Angus Leeming
Stephan Witt wrote:
> Angus Leeming wrote:
>> Stephan Witt wrote:
>>>Angus Leeming wrote:
Jean-Marc Lasgouttes wrote:
>Angus> Do you also want the stuff to address André's query? The test
>Angus> would become:

>Why not. It scares me, but if you say it's portable, go ahead. But the
>poor man's version is good enough for me.

Heck, now you've scared me! Why don't we give it to Stephan to try out
on his Solaris machine? Do you want me to commit it to cvs or do you
want Stephan to have a go first?

>>>That's no problem... I can do test a patch for you.

>> Ok, here is lib/configure.m4 Stephan.



> Sorry for the delay, I'm a little busy right now.

Hey, don't worry at all! Thanks for doing this.

> Now the results:



> So, it should be all as expected :)
> Stephan

Great. Then I'll commit these patches (attached for reference) to the 1.3.x
and 1.4.x trees.

Regards,
-- 
AngusIndex: lib/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.363.2.104
diff -u -p -r1.363.2.104 ChangeLog
--- lib/ChangeLog	17 Apr 2005 17:31:25 -	1.363.2.104
+++ lib/ChangeLog	22 Apr 2005 16:34:40 -
@@ -1,3 +1,8 @@
+2005-04-22  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* configure.m4: rewrite the "DeclareFOOClass" manipulation
+	scripts to be more portable.
+
 2005-04-15  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* scripts/convertDefault.sh: post error messages to STDERR.
Index: lib/configure.m4
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.60.2.17
diff -u -p -r1.60.2.17 configure.m4
--- lib/configure.m4	25 Mar 2005 15:35:52 -	1.60.2.17
+++ lib/configure.m4	22 Apr 2005 16:34:41 -
@@ -422,32 +422,44 @@ changequote([,])dnl
if test  x`[eval] echo $ac_n '${found_'$cleanclass'}'` = x ; then
  [eval] "found_$cleanclass=yes"
 changequote(,)dnl
-	 # The sed commands below are a bit scary. Here is what they do:
-	 # 1-3: remove the \DeclareFOO macro and add the correct boolean 
-	 #  at the end of the line telling whether the class is 
- #  available
-	 # 4: if the macro had an optional argument with several 
-	 #parameters, only keep the first one
-	 # 5: if the macro did not have an optional argument, provide one 
-	 #(equal to the class name)
-	 # 6: remove brackets and replace with correctly quoted entries
-	 grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
-	  | sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/' \
-		-e 's/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/' \
-		-e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/' \
-		-e 's/\[\([^,]*\),[^]]*\]/[\1]/' \
-		-e 's/^{/['$class']{/' \
-		-e 's/\[\([^]]*\)\] *{\([^}]*\)}/"'$class'" "\1" "\2"/' \
->>textclass.lst
+	 sed -n '
+# We manipulate only those lines that contain
+# "\Declare(LaTeX|DocBook|LinuxDoc)Class"
+/\\DeclareLaTeXClass/bmatch
+/\\DeclareDocBookClass/bmatch
+/\\DeclareLinuxDocClass/bmatch
+b
+
+:match
+# Remove the \DeclareFOOClass macro and add the correct boolean 
+# at the end of the line telling whether the class is 
+# available
+s/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/
+s/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/
+s/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/
+# If the macro had an optional argument with several 
+# parameters, only keep the first one
+s/\[\([^,]*\),[^]]*\]/[\1]/
+# If the macro did not have an optional argument, provide one 
+# (equal to the class name)
+s/^{/['$class']{/
+# Remove brackets and replace with correctly quoted entries
+s/\[\([^]]*\)\] *{\([^}]*\)}/"'$class'" "\1" "\2"/
+# Print the maninpulated text
+p
+# We are interested in the first instance of \DeclareFOOClass only,
+# so now quit
+q
+' "$file" >> textclass.lst
fi
 	 fi ;;
 esac
-  done 
+  done
   MSG_RESULT(done)
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
-  if ! test -r "chkconfig.ltx" ; then
+  if test ! -r "chkconfig.ltx" ; then
 ln -s "${srcdir}"/chkconfig.ltx .
 rmlink=true
   fi
@@ -462,11 +474,25 @@ EOF
   for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
 case $file in
   */\*.layout) ;;
-  *) if test -r "$file" ; then 
+  *) 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}/' 
+	   sed -n '
+# We manipulate only those lines that contain
+# "\Declare(LaTeX|DocBook|LinuxDoc)Class"
+/\\DeclareLaTeXClass/bmatch
+/\\DeclareDocBookClass/bmatch
+/\\DeclareLinuxDocClass/bmatch
+b
+

Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-21 Thread Angus Leeming
Andre Poenitz wrote:

 On Wed, Apr 20, 2005 at 01:54:09PM +0100, Angus Leeming wrote:
 Attached. Looks scary, but the textclass.lst and chklayouts.tex files
 are unchanged by this manipulation.
 
 +# For lines containing \Declare(LaTeX|DocBook|LinuxDoc)Class
 +/\\Declare[LD][a-zA-Z]\{1,\}Class/{
 
 The comment does not match the code, does it?

Well, the regex will match the searched-for string...

If you want a real test:

/\\DeclareLaTeXClass/bmatch
/\\DeclareDocBookClass/bmatch
/\\DeclareLinuxDocClass/bmatch
b

:match
# The manipulation stuff goes here

Jean-Marc, the above seems like overkill to me, but it has the advantage of
being clear :) Let me know what you'd like.

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-21 Thread Angus Leeming
Andre Poenitz wrote:

> On Wed, Apr 20, 2005 at 01:54:09PM +0100, Angus Leeming wrote:
>> Attached. Looks scary, but the textclass.lst and chklayouts.tex files
>> are unchanged by this manipulation.
> 
> +# For lines containing "\Declare(LaTeX|DocBook|LinuxDoc)Class"
> +/\\Declare[LD][a-zA-Z]\{1,\}Class/{
> 
> The comment does not match the code, does it?

Well, the regex will match the searched-for string...

If you want a real test:

/\\DeclareLaTeXClass/bmatch
/\\DeclareDocBookClass/bmatch
/\\DeclareLinuxDocClass/bmatch
b

:match
# The manipulation stuff goes here

Jean-Marc, the above seems like overkill to me, but it has the advantage of
being clear :) Let me know what you'd like.

-- 
Angus



Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Stephan Witt
I've found a porting issue on Solaris.
The shell script lib/configure is GNU-specific. There is
1. a badly placed ! operator for test of file existance and
2. an problem with grep (extended expression syntax)
These problems are fixed for the 1.3.x Branch with the
attached patch...
Hope it's of any help and acceptable.
Greetings,
Stephan
Index: configure.m4
===
RCS file: /cvs/lyx/lyx-devel/lib/configure.m4,v
retrieving revision 1.60.2.17
diff -u -p -r1.60.2.17 configure.m4
--- configure.m42005/03/25 15:35:52 1.60.2.17
+++ configure.m42005/04/20 09:51:07
@@ -431,7 +431,7 @@ changequote(,)dnl
 # 5: if the macro did not have an optional argument, provide one 
 #(equal to the class name)
 # 6: remove brackets and replace with correctly quoted entries
-grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' $file \
+egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' $file \
  | sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 false/' \
-e 's/^.*\DeclareDocBookClass *\(.*\)/\1 
'$bool_docbook'/' \
-e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 
'$bool_linuxdoc'/' \
@@ -447,7 +447,7 @@ changequote(,)dnl
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
-  if ! test -r chkconfig.ltx ; then
+  if test ! -r chkconfig.ltx ; then
 ln -s ${srcdir}/chkconfig.ltx .
 rmlink=true
   fi
@@ -465,7 +465,7 @@ EOF
   *) 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 \
+  egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' $file \
  | sed -e 's/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/' 
 fi ;;
 esac


Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Jean-Marc Lasgouttes
 Stephan == Stephan Witt [EMAIL PROTECTED] writes:

Stephan I've found a porting issue on Solaris. The shell script
Stephan lib/configure is GNU-specific. 

Thanks for the report, Stephan.

Stephan 1. a badly placed ! operator for test of file existance and

This fix is indeed fine.

Stephan 2. an problem with grep (extended expression syntax)

The problem is that there is no guarantee that 'egrep' exists, and
that some systems do not provide 'grep -E' either...

Autoconf provides a test for that, I'll look whethe rit is simple
enough to be duplicated for our needs.

JMarc 



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Angus Leeming
Stephan Witt wrote:

 I've found a porting issue on Solaris.
 
 The shell script lib/configure is GNU-specific. There is
 1. a badly placed ! operator for test of file existance and
 2. an problem with grep (extended expression syntax)
 
 These problems are fixed for the 1.3.x Branch with the
 attached patch...
 
 Hope it's of any help and acceptable.

Many thanks, Stephan.

-  grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' $file \
+  egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' $file \

(a|b) is indeed an E.R.E., according to man grep. However, the same man 
page (Tru64 Unix) says that 'egrep' is obsolescent and that 'grep -E' 
should be used instead. I see here 
http://www.cs.biu.ac.il/cgi-bin/man?grep+1
that Solaris can use 'grep -E' too, so I propose that we go with that.

-  if ! test -r chkconfig.ltx ; then
+  if test ! -r chkconfig.ltx ; then

Looks good.

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 Stephan 2. an problem with grep (extended expression syntax)
 
 The problem is that there is no guarantee that 'egrep' exists, and
 that some systems do not provide 'grep -E' either...
 
 Autoconf provides a test for that, I'll look whether it is simple
 enough to be duplicated for our needs.

Looking at the tests themselves:

-   grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' $file \
+   egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' $file \
| sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 false/' \
  -e 's/^.*\DeclareDocBookClass *\(.*\)/\1 '$bool_docbook'/' \
  -e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 '$bool_linuxdoc'/' \

there's no need for the grep call at all. Just pass $file to sed.

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus (a|b) is indeed an E.R.E., according to man grep. However, the
Angus same man page (Tru64 Unix) says that 'egrep' is obsolescent and
Angus that 'grep -E' should be used instead. I see here
Angus http://www.cs.biu.ac.il/cgi-bin/man?grep+1 that Solaris can use
Angus 'grep -E' too, so I propose that we go with that.

But autoconf.info says:

`egrep'
 POSIX 1003.1-2001 no longer requires `egrep', but many older hosts
 do not yet support the POSIX replacement `grep -E'.  To work
 around this problem, invoke `AC_PROG_EGREP' and then use `$EGREP'.

What about using the dumber regexp
+  grep '\\Declare[a-zA-Z]*Class' $file \

It is less accurate, but should be good enough for what we need. If we
want to be robust and catch \DeclareMyWeirdClass, I am sure that it is
possible to add a clause like
  -e 's/\\Declare[a-zA-Z]*Class//'

Angus, would that work?

JMarc


Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Angus Leeming
Angus Leeming wrote:
 Looking at the tests themselves:
 
 -   grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' $file \
 +   egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' $file \
 | sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 false/' \
   -e 's/^.*\DeclareDocBookClass *\(.*\)/\1 '$bool_docbook'/' \
   -e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 '$bool_linuxdoc'/'
   \
 
 there's no need for the grep call at all. Just pass $file to sed.

My reading of the above is that egrep is used to filter out only the 
DeclareFooClass lines which are then manipulated by sed. That's equivalent 
to:

sed -n -e 's/a/b/p' -e 's/c/d/p' -e 's/e/f/p' $file

which prints out only those lines in $file that are manipulated.

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus Jean-Marc Lasgouttes wrote:
Stephan 2. an problem with grep (extended expression syntax)
  The problem is that there is no guarantee that 'egrep' exists, and
 that some systems do not provide 'grep -E' either...
 
 Autoconf provides a test for that, I'll look whether it is simple
 enough to be duplicated for our needs.

Angus Looking at the tests themselves:
Angus there's no need for the grep call at all. Just pass $file to
Angus sed.

I am open to that. How do you make sure that the other lines of the
file get nuked?

JMarc


Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus My reading of the above is that egrep is used to filter out
Angus only the DeclareFooClass lines which are then manipulated by
Angus sed. 

Indeed. As you remember, I am not very good with sed.

Angus That's equivalent to:

Angus sed -n -e 's/a/b/p' -e 's/c/d/p' -e 's/e/f/p' $file

Angus which prints out only those lines in $file that are
Angus manipulated.

How portable is -n?

JMarc


Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 Angus That's equivalent to:
 
 Angus sed -n -e 's/a/b/p' -e 's/c/d/p' -e 's/e/f/p' $file
 
 Angus which prints out only those lines in $file that are
 Angus manipulated.
 
 How portable is -n?

It's portable. 

As in, it's not mentioned here:
http://www.student.northpark.edu/pemente/sed/sedfaq6.html#s6.6

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

  How portable is -n?

Angus It's portable.

Angus As in, it's not mentioned here:
Angus http://www.student.northpark.edu/pemente/sed/sedfaq6.html#s6.6

Fair enough. Could you make a patch?

JMarc


Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
  How portable is -n?
 
 Angus It's portable.
 
 Angus As in, it's not mentioned here:
 Angus http://www.student.northpark.edu/pemente/sed/sedfaq6.html#s6.6
 
 Fair enough. Could you make a patch?

Attached. Looks scary, but the textclass.lst and chklayouts.tex files are 
unchanged by this manipulation.

-- 
AngusIndex: lib/configure.m4
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.60.2.17
diff -u -p -r1.60.2.17 configure.m4
--- lib/configure.m4	25 Mar 2005 15:35:52 -	1.60.2.17
+++ lib/configure.m4	20 Apr 2005 12:49:20 -
@@ -422,23 +422,26 @@ changequote([,])dnl
if test  x`[eval] echo $ac_n '${found_'$cleanclass'}'` = x ; then
  [eval] found_$cleanclass=yes
 changequote(,)dnl
-	 # The sed commands below are a bit scary. Here is what they do:
-	 # 1-3: remove the \DeclareFOO macro and add the correct boolean 
-	 #  at the end of the line telling whether the class is 
- #  available
-	 # 4: if the macro had an optional argument with several 
-	 #parameters, only keep the first one
-	 # 5: if the macro did not have an optional argument, provide one 
-	 #(equal to the class name)
-	 # 6: remove brackets and replace with correctly quoted entries
-	 grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' $file \
-	  | sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 false/' \
-		-e 's/^.*\DeclareDocBookClass *\(.*\)/\1 '$bool_docbook'/' \
-		-e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 '$bool_linuxdoc'/' \
-		-e 's/\[\([^,]*\),[^]]*\]/[\1]/' \
-		-e 's/^{/['$class']{/' \
-		-e 's/\[\([^]]*\)\] *{\([^}]*\)}/'$class' \1 \2/' \
-textclass.lst
+	 sed -n '
+# For lines containing \Declare(LaTeX|DocBook|LinuxDoc)Class
+/\\Declare[LD][a-zA-Z]\{1,\}Class/{
+# Remove the \DeclareFOOClass macro and add the correct boolean 
+# at the end of the line telling whether the class is 
+# available
+s/^.*\DeclareLaTeXClass *\(.*\)/\1 false/
+s/^.*\DeclareDocBookClass *\(.*\)/\1 '$bool_docbook'/
+s/^.*\DeclareLinuxDocClass *\(.*\)/\1 '$bool_linuxdoc'/
+# If the macro had an optional argument with several 
+# parameters, only keep the first one
+s/\[\([^,]*\),[^]]*\]/[\1]/
+# If the macro did not have an optional argument, provide one 
+# (equal to the class name)
+s/^{/['$class']{/
+# Remove brackets and replace with correctly quoted entries
+s/\[\([^]]*\)\] *{\([^}]*\)}/'$class' \1 \2/
+# Print the maninpulated text
+p
+}' $file  textclass.lst
fi
 	 fi ;;
 esac
@@ -447,7 +450,7 @@ changequote(,)dnl
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
-  if ! test -r chkconfig.ltx ; then
+  if test ! -r chkconfig.ltx ; then
 ln -s ${srcdir}/chkconfig.ltx .
 rmlink=true
   fi
@@ -465,8 +468,12 @@ EOF
   *) 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}/' 
+	   sed -n '
+# For lines containing \Declare(LaTeX|DocBook|LinuxDoc)Class
+/\\Declare[LD][a-zA-Z]\{1,\}Class/{
+# Wrap the entire line (minus the leading # ) inside a
+# \TestDocClass{CLASS}{...} command and print the result.
+s/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/p}' $file
 	 fi ;;
 esac
   done  chklayouts.tex


Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus Attached. Looks scary, but the textclass.lst and chklayouts.tex
Angus files are unchanged by this manipulation.

Thanks. After testing with --without-latex-config (which invokes the
first sed machniery), I see in textclass.lst:

aapaper aa article (AA V4) false
aapaper aa-old article (AA V4) false

This is because aapaper.layout has another \DeclareLaTeXClass entry in
comments. 

I guess fixing it will be a matter of seconds...

JMarc


Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 Angus Attached. Looks scary, but the textclass.lst and chklayouts.tex
 Angus files are unchanged by this manipulation.
 
 Thanks. After testing with --without-latex-config (which invokes the
 first sed machniery), I see in textclass.lst:
 
 aapaper aa article (AA V4) false
 aapaper aa-old article (AA V4) false
 
 This is because aapaper.layout has another \DeclareLaTeXClass entry in
 comments.
 
 I guess fixing it will be a matter of seconds...

I'm not sure what you want to happen. Are you're saying that sed should
modify only the first DeclareLaTeXClass entry it sees, in line 2?

If so, then the fix is to change this:

...
# Print the maninpulated text
p
}' $file  textclass.lst

to

...
# Print the manipulated text and exit.
p
q
}' $file  textclass.lst

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris Watchdog: Virus checked

2005-04-20 Thread Andre Poenitz
On Wed, Apr 20, 2005 at 01:54:09PM +0100, Angus Leeming wrote:
 Attached. Looks scary, but the textclass.lst and chklayouts.tex files are 
 unchanged by this manipulation.

+# For lines containing \Declare(LaTeX|DocBook|LinuxDoc)Class
+/\\Declare[LD][a-zA-Z]\{1,\}Class/{

The comment does not match the code, does it?

Andre'


Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Stephan Witt
I've found a porting issue on Solaris.
The shell script lib/configure is GNU-specific. There is
1. a badly placed ! operator for test of file existance and
2. an problem with grep (extended expression syntax)
These problems are fixed for the 1.3.x Branch with the
attached patch...
Hope it's of any help and acceptable.
Greetings,
Stephan
Index: configure.m4
===
RCS file: /cvs/lyx/lyx-devel/lib/configure.m4,v
retrieving revision 1.60.2.17
diff -u -p -r1.60.2.17 configure.m4
--- configure.m42005/03/25 15:35:52 1.60.2.17
+++ configure.m42005/04/20 09:51:07
@@ -431,7 +431,7 @@ changequote(,)dnl
 # 5: if the macro did not have an optional argument, provide one 
 #(equal to the class name)
 # 6: remove brackets and replace with correctly quoted entries
-grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
+egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' "$file" \
  | sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/' \
-e 's/^.*\DeclareDocBookClass *\(.*\)/\1 
"'$bool_docbook'"/' \
-e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 
"'$bool_linuxdoc'"/' \
@@ -447,7 +447,7 @@ changequote(,)dnl
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
-  if ! test -r "chkconfig.ltx" ; then
+  if test ! -r "chkconfig.ltx" ; then
 ln -s "${srcdir}"/chkconfig.ltx .
 rmlink=true
   fi
@@ -465,7 +465,7 @@ EOF
   *) 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" \
+  egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' "$file" \
  | sed -e 's/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/' 
 fi ;;
 esac


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Jean-Marc Lasgouttes
> "Stephan" == Stephan Witt <[EMAIL PROTECTED]> writes:

Stephan> I've found a porting issue on Solaris. The shell script
Stephan> lib/configure is GNU-specific. 

Thanks for the report, Stephan.

Stephan> 1. a badly placed ! operator for test of file existance and

This fix is indeed fine.

Stephan> 2. an problem with grep (extended expression syntax)

The problem is that there is no guarantee that 'egrep' exists, and
that some systems do not provide 'grep -E' either...

Autoconf provides a test for that, I'll look whethe rit is simple
enough to be duplicated for our needs.

JMarc 



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Angus Leeming
Stephan Witt wrote:

> I've found a porting issue on Solaris.
> 
> The shell script lib/configure is GNU-specific. There is
> 1. a badly placed ! operator for test of file existance and
> 2. an problem with grep (extended expression syntax)
> 
> These problems are fixed for the 1.3.x Branch with the
> attached patch...
> 
> Hope it's of any help and acceptable.

Many thanks, Stephan.

>-  grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
>+  egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' "$file" \

(a|b) is indeed an E.R.E., according to man grep. However, the same man 
page (Tru64 Unix) says that 'egrep' is obsolescent and that 'grep -E' 
should be used instead. I see here 
http://www.cs.biu.ac.il/cgi-bin/man?grep+1
that Solaris can use 'grep -E' too, so I propose that we go with that.

>-  if ! test -r "chkconfig.ltx" ; then
>+  if test ! -r "chkconfig.ltx" ; then

Looks good.

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> Stephan> 2. an problem with grep (extended expression syntax)
> 
> The problem is that there is no guarantee that 'egrep' exists, and
> that some systems do not provide 'grep -E' either...
> 
> Autoconf provides a test for that, I'll look whether it is simple
> enough to be duplicated for our needs.

Looking at the tests themselves:

-   grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
+   egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' "$file" \
| sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/' \
  -e 's/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/' \
  -e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/' \

there's no need for the grep call at all. Just pass "$file" to sed.

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> (a|b) is indeed an E.R.E., according to man grep. However, the
Angus> same man page (Tru64 Unix) says that 'egrep' is obsolescent and
Angus> that 'grep -E' should be used instead. I see here
Angus> http://www.cs.biu.ac.il/cgi-bin/man?grep+1 that Solaris can use
Angus> 'grep -E' too, so I propose that we go with that.

But autoconf.info says:

`egrep'
 POSIX 1003.1-2001 no longer requires `egrep', but many older hosts
 do not yet support the POSIX replacement `grep -E'.  To work
 around this problem, invoke `AC_PROG_EGREP' and then use `$EGREP'.

What about using the dumber regexp
+  grep '\\Declare[a-zA-Z]*Class' "$file" \

It is less accurate, but should be good enough for what we need. If we
want to be robust and catch \DeclareMyWeirdClass, I am sure that it is
possible to add a clause like
  -e 's/\\Declare[a-zA-Z]*Class//'

Angus, would that work?

JMarc


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Angus Leeming
Angus Leeming wrote:
> Looking at the tests themselves:
> 
> -   grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
> +   egrep '\\Declare(LaTeX|DocBook|LinuxDoc)Class' "$file" \
> | sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/' \
>   -e 's/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/' \
>   -e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/'
>   \
> 
> there's no need for the grep call at all. Just pass "$file" to sed.

My reading of the above is that egrep is used to filter out only the 
DeclareFooClass lines which are then manipulated by sed. That's equivalent 
to:

sed -n -e 's/a/b/p' -e 's/c/d/p' -e 's/e/f/p' "$file"

which prints out only those lines in "$file" that are manipulated.

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Jean-Marc Lasgouttes wrote:
Stephan> 2. an problem with grep (extended expression syntax)
>>  The problem is that there is no guarantee that 'egrep' exists, and
>> that some systems do not provide 'grep -E' either...
>> 
>> Autoconf provides a test for that, I'll look whether it is simple
>> enough to be duplicated for our needs.

Angus> Looking at the tests themselves:
Angus> there's no need for the grep call at all. Just pass "$file" to
Angus> sed.

I am open to that. How do you make sure that the other lines of the
file get nuked?

JMarc


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> My reading of the above is that egrep is used to filter out
Angus> only the DeclareFooClass lines which are then manipulated by
Angus> sed. 

Indeed. As you remember, I am not very good with sed.

Angus> That's equivalent to:

Angus> sed -n -e 's/a/b/p' -e 's/c/d/p' -e 's/e/f/p' "$file"

Angus> which prints out only those lines in "$file" that are
Angus> manipulated.

How portable is -n?

JMarc


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> Angus> That's equivalent to:
> 
> Angus> sed -n -e 's/a/b/p' -e 's/c/d/p' -e 's/e/f/p' "$file"
> 
> Angus> which prints out only those lines in "$file" that are
> Angus> manipulated.
> 
> How portable is -n?

It's portable. 

As in, it's not mentioned here:
http://www.student.northpark.edu/pemente/sed/sedfaq6.html#s6.6

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

>>  How portable is -n?

Angus> It's portable.

Angus> As in, it's not mentioned here:
Angus> http://www.student.northpark.edu/pemente/sed/sedfaq6.html#s6.6

Fair enough. Could you make a patch?

JMarc


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
>>>  How portable is -n?
> 
> Angus> It's portable.
> 
> Angus> As in, it's not mentioned here:
> Angus> http://www.student.northpark.edu/pemente/sed/sedfaq6.html#s6.6
> 
> Fair enough. Could you make a patch?

Attached. Looks scary, but the textclass.lst and chklayouts.tex files are 
unchanged by this manipulation.

-- 
AngusIndex: lib/configure.m4
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.60.2.17
diff -u -p -r1.60.2.17 configure.m4
--- lib/configure.m4	25 Mar 2005 15:35:52 -	1.60.2.17
+++ lib/configure.m4	20 Apr 2005 12:49:20 -
@@ -422,23 +422,26 @@ changequote([,])dnl
if test  x`[eval] echo $ac_n '${found_'$cleanclass'}'` = x ; then
  [eval] "found_$cleanclass=yes"
 changequote(,)dnl
-	 # The sed commands below are a bit scary. Here is what they do:
-	 # 1-3: remove the \DeclareFOO macro and add the correct boolean 
-	 #  at the end of the line telling whether the class is 
- #  available
-	 # 4: if the macro had an optional argument with several 
-	 #parameters, only keep the first one
-	 # 5: if the macro did not have an optional argument, provide one 
-	 #(equal to the class name)
-	 # 6: remove brackets and replace with correctly quoted entries
-	 grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
-	  | sed -e 's/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/' \
-		-e 's/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/' \
-		-e 's/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/' \
-		-e 's/\[\([^,]*\),[^]]*\]/[\1]/' \
-		-e 's/^{/['$class']{/' \
-		-e 's/\[\([^]]*\)\] *{\([^}]*\)}/"'$class'" "\1" "\2"/' \
->>textclass.lst
+	 sed -n '
+# For lines containing "\Declare(LaTeX|DocBook|LinuxDoc)Class"
+/\\Declare[LD][a-zA-Z]\{1,\}Class/{
+# Remove the \DeclareFOOClass macro and add the correct boolean 
+# at the end of the line telling whether the class is 
+# available
+s/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/
+s/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/
+s/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/
+# If the macro had an optional argument with several 
+# parameters, only keep the first one
+s/\[\([^,]*\),[^]]*\]/[\1]/
+# If the macro did not have an optional argument, provide one 
+# (equal to the class name)
+s/^{/['$class']{/
+# Remove brackets and replace with correctly quoted entries
+s/\[\([^]]*\)\] *{\([^}]*\)}/"'$class'" "\1" "\2"/
+# Print the maninpulated text
+p
+}' "$file" >> textclass.lst
fi
 	 fi ;;
 esac
@@ -447,7 +450,7 @@ changequote(,)dnl
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
-  if ! test -r "chkconfig.ltx" ; then
+  if test ! -r "chkconfig.ltx" ; then
 ln -s "${srcdir}"/chkconfig.ltx .
 rmlink=true
   fi
@@ -465,8 +468,12 @@ EOF
   *) 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}/' 
+	   sed -n '
+# For lines containing "\Declare(LaTeX|DocBook|LinuxDoc)Class"
+/\\Declare[LD][a-zA-Z]\{1,\}Class/{
+# Wrap the entire line (minus the leading "# ") inside a
+# "\TestDocClass{CLASS}{...}" command and print the result.
+s/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/p}' "$file"
 	 fi ;;
 esac
   done > chklayouts.tex


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Attached. Looks scary, but the textclass.lst and chklayouts.tex
Angus> files are unchanged by this manipulation.

Thanks. After testing with --without-latex-config (which invokes the
first sed machniery), I see in textclass.lst:

"aapaper" "aa" "article (A V4)" "false"
"aapaper" "aa-old" "article (A V4)" "false"

This is because aapaper.layout has another \DeclareLaTeXClass entry in
comments. 

I guess fixing it will be a matter of seconds...

JMarc


Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> Angus> Attached. Looks scary, but the textclass.lst and chklayouts.tex
> Angus> files are unchanged by this manipulation.
> 
> Thanks. After testing with --without-latex-config (which invokes the
> first sed machniery), I see in textclass.lst:
> 
> "aapaper" "aa" "article (A V4)" "false"
> "aapaper" "aa-old" "article (A V4)" "false"
> 
> This is because aapaper.layout has another \DeclareLaTeXClass entry in
> comments.
> 
> I guess fixing it will be a matter of seconds...

I'm not sure what you want to happen. Are you're saying that sed should
modify only the first DeclareLaTeXClass entry it sees, in line 2?

If so, then the fix is to change this:

...
# Print the maninpulated text
p
}' "$file" >> textclass.lst

to

...
# Print the manipulated text and exit.
p
q
}' "$file" >> textclass.lst

-- 
Angus



Re: Portability problem with lib/configure srcipt on Solaris

2005-04-20 Thread Andre Poenitz
On Wed, Apr 20, 2005 at 01:54:09PM +0100, Angus Leeming wrote:
> Attached. Looks scary, but the textclass.lst and chklayouts.tex files are 
> unchanged by this manipulation.

+# For lines containing "\Declare(LaTeX|DocBook|LinuxDoc)Class"
+/\\Declare[LD][a-zA-Z]\{1,\}Class/{

The comment does not match the code, does it?

Andre'