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,
--
Angus
Index: 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 -0000 1.363.2.104
+++ lib/ChangeLog 22 Apr 2005 16:34:40 -0000
@@ -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 -0000 1.60.2.17
+++ lib/configure.m4 22 Apr 2005 16:34:41 -0000
@@ -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}{...}" command
+s/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/
+# Print the result and quit.
+p
+q
+' "$file"
fi ;;
esac
done > chklayouts.tex
Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.689
diff -u -p -r1.689 ChangeLog
--- lib/ChangeLog 21 Apr 2005 06:21:25 -0000 1.689
+++ lib/ChangeLog 22 Apr 2005 16:34:23 -0000
@@ -1,3 +1,8 @@
+2005-04-22 Angus Leeming <[EMAIL PROTECTED]>
+
+ * configure.m4: rewrite the "DeclareFOOClass" manipulation
+ scripts to be more portable.
+
2005-04-18 Martin Vermeer <[EMAIL PROTECTED]>
* stdtoolbars.ui: remove the 4x4 default size
Index: lib/configure.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.93
diff -u -p -r1.93 configure.m4
--- lib/configure.m4 25 Mar 2005 15:27:30 -0000 1.93
+++ lib/configure.m4 22 Apr 2005 16:34:24 -0000
@@ -454,23 +454,35 @@ 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
@@ -479,7 +491,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
@@ -497,8 +509,22 @@ 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 '
+# 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}{...}" command
+s/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/
+# Print the result and quit.
+p
+q
+' "$file"
fi ;;
esac
done > chklayouts.tex