]> git.lyx.org Git - lyx.git/blob - lib/configure.cmd
Few insettabular/text fixes (added cut&paste for tabulars) + Markos GNOME patch
[lyx.git] / lib / configure.cmd
1 /* OS/2 REXX : The lib/configure.cmd; Don't delete this comment. */
2 call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
3 call SysLoadFuncs
4 env='OS2ENVIRONMENT'
5 EMTEXDIR=value('EMTEXDIR',,env)
6 X11ROOT=value('X11ROOT',,env)
7 latex_script='chkconfig.ltx'
8 lyxrc_defaults='lyxrc.defaults'
9 lyx_check_config='yes'
10 rc_fontenc='default'
11
12 parse arg option '=' srcdir
13 select
14    when option='-h'|option='-help'|option='--help' then do
15   say 'Usage: configure [options]'
16   say 'Options:'
17   say '  --help                   show this help lines'
18   say '  --without-latex-config   do not run LaTeX to determine configuration'
19   exit
20   end
21    when option='--without-latex-config' then
22   lyx_check_config='no'
23    when option='--srcdir' then
24   srcdir=translate(srcdir,'\','/')
25    otherwise
26   nop
27 end  /* select */
28 if srcdir='' then do
29    parse source 'OS/2 COMMAND ' script
30 say 'script =' script
31    srcdir=filespec('drive',script)strip(filespec('path',script),'T','\')
32 end
33
34 rc=SysFileTree(srcdir'\'latex_script,found,'F')
35 if found.0 = 0 then do
36    say "configure: error: cannot find "srcdir'\'latex_script" script"
37    exit 1
38 end
39 curdir=directory()
40 if \(curdir=srcdir) then do
41   call SysFileTree 'layouts', 'found', 'D'
42   if found.0 = 0 then do
43     call SysMkDir 'bind'
44     call SysMkDir 'doc'
45     call SysMkDir 'kbd'
46     call SysMkDir 'layouts'
47     call SysMkDir 'templates'
48   end
49   'cmd /c copy /v' srcdir'\layouts\*.layout layouts'
50   if \(rc=0) then
51     say 'Error! copying layout files.'
52 end
53 curdir=translate(curdir,'/','\')
54 srcdir=translate(srcdir,'/','\')
55 call SysFileTree EMTEXDIR'\bin\latex.cmd', 'found', 'F'
56 if found.0 = 0 then LATEX='latex2e'
57 else LATEX='latex'
58 if \(''=SysSearchPath('PATH','GS.EXE')) then
59   GS='gs'
60 else
61 if \(''=SysSearchPath('PATH','GSOS2.EXE')) then
62   GS='gsos2'
63 else
64   GS='none'
65 if \(''=SysSearchPath('PATH','GV.EXE')) then
66   GHOSTVIEW='gv'
67 else
68 if \(''=SysSearchPath('PATH','GHOSTVIEW.EXE')) then
69   GHOSTVIEW='ghostview'
70 else
71   GHOSTVIEW='none'
72 if (''=SysSearchPath('PATH','SGML2LYX.CMD')) then
73   SGMLTOOLS='none'
74 else
75   SGMLTOOLS='sgml2lyx'
76 if (''=SysSearchPath('PATH','CHKTEX.EXE')) then
77   CHKTEX='none'
78 else
79   CHKTEX='chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'
80 if \(''=SysSearchPath('PATH','ISPELL.EXE')) then
81   SPELL='ispell'
82 else
83   SPELL='none'
84 if (''=SysSearchPath('PATH','NOWEAVE.EXE')) then do
85   LITERATE='none'
86   LITERATE_EXT='none'
87 end
88 else do
89   LITERATE='noweave -delay -index'
90   LITERATE_EXT='.nw'
91 end
92 call SysFileTree 'reLyX\reLyX.cmd', 'found', 'F'
93 if found.0 = 0 then
94   if (''=SysSearchPath('PATH','reLyX.cmd')) then
95     RELYX='none'
96   else
97     RELYX='reLyX.cmd'
98 else
99   RELYX='reLyX.cmd'
100 call SysFileDelete 'chklatex.ltx'
101 rc=lineout('chklatex.ltx','\nonstopmode\makeatletter')
102 rc=lineout('chklatex.ltx','\ifx\undefined\documentclass\else')
103 rc=lineout('chklatex.ltx','  \message{ThisIsLaTeX2e}')
104 rc=lineout('chklatex.ltx','\fi')
105 rc=lineout('chklatex.ltx','\@@end')
106 rc=lineout('chklatex.ltx')
107 'cmd /c 'LATEX' chklatex.ltx>nul'
108 call SysFileSearch 'NotLaTeX2e', 'chklatex.log', chklatex
109 if chklatex.0 > 0 then LATEX=''
110
111 rc=SysFileDelete('textclass.lst')
112 rc=SysFileDelete('packages.lst')
113 rc=SysFileDelete('chkconfig.sed')
114 if \(lyx_check_config='no') then
115 do
116   rc=SysFileTree(srcdir'\layouts\*.layout',found,'FO')
117   rc=SysFileDelete('chklayouts.tex')
118   rc=SysFileDelete('chkconfig.vars')
119   if found.0>0 then
120     do num=1 to found.0
121       parse value filespec('name',found.num) with DocClass '.layout'
122       parse value DocClass with mainClass '_' subClass
123       if ''=subClass then
124         rc=lineout('chklayouts.tex','\TestDocClass{'DocClass'}')
125       else      /* Not used, or must be empty? */
126         rc=lineout('chklayouts.tex','\TestDocClass['mainClass'.cls]{'DocClass'}')
127     end
128   rc=lineout('chklayouts.tex')
129   sgmltools_cmd=''
130   chk_sgmltools='no'
131   if SGMLTOOLS='sgml2lyx' then
132    do
133     chk_sgmltools='yes'
134     sgmltools_cmd='\def\hassgmltools{}'
135    end
136   rc=SysFileDelete('wrap_chkconfig.ltx')
137   rc=lineout('wrap_chkconfig.ltx','\newcommand\srcdir{'srcdir'}')
138   rc=lineout('wrap_chkconfig.ltx',sgmltools_cmd)
139   rc=lineout('wrap_chkconfig.ltx','\input{'srcdir'/chkconfig.ltx}')
140   rc=lineout('wrap_chkconfig.ltx')
141   'cmd /c 'LATEX' wrap_chkconfig.ltx'
142   size=stream('chkconfig.sed','c','query size')
143   rc=stream('chkconfig.sed','c','open')
144   if rxfuncquery(SysAddRexxMacro) then
145     rc=stream('chkconfig.sed','c','seek +'size)
146   else
147     rc=stream('chkconfig.sed','c','seek + 'size' write')
148   rc=lineout('chkconfig.sed','s/@chk_sgmltools@/'chk_sgmltools'/g')
149   rc=lineout('chkconfig.sed')
150   call SysFileSearch 'chk_fontenc=', 'chkconfig.vars', fontenc
151   if fontenc.0 > 0 then parse var fontenc.1 chk"='"rc_fontenc"'"
152 end
153
154 call SysFileTree 'textclass.lst', 'file', 'FO'
155 if file.0=0 then
156 do
157    rc=lineout('textclass.lst','# This file declares layouts and their associated definition files')
158    rc=lineout('textclass.lst','# (include dir. relative to the place where this file is).')
159    rc=lineout('textclass.lst','# It contains only default values, since chkconfig.ltx could not be run')
160    rc=lineout('textclass.lst','# for some reason. Run ./configure if you need to update it after a')
161    rc=lineout('textclass.lst','# configuration change.')
162    rc=lineout('textclass.lst','article  article article')
163    rc=lineout('textclass.lst','report   report  report')
164    rc=lineout('textclass.lst','book     book    book')
165    rc=lineout('textclass.lst','linuxdoc linuxdoc        linuxdoc')
166    rc=lineout('textclass.lst','letter   letter  letter')
167    rc=lineout('textclass.lst')
168    rc=lineout('chkconfig.sed','s/@.*@/???/g')
169    rc=lineout('chkconfig.sed')
170    rc_graphics='none'
171 end
172
173 call SysFileTree 'chkconfig.sed', 'file', 'FO'
174 if file.0=0 then
175 do
176    rc=lineout('chkconfig.sed','s/@.*@/???/g')
177    rc=lineout('chkconfig.sed')
178 end
179
180 call SysFileTree 'packages.lst', 'file', 'FO'
181 if file.0=0 then
182 do
183    rc=lineout('packages.lst','# This file should contain the list of LaTeX packages that have been')
184    rc=lineout('packages.lst','# recognized by LyX. Unfortunately, since configure could not find')
185    rc=lineout('packages.lst','# your LaTeX2e program, the tests have not been run. Run configure')
186    rc=lineout('packages.lst','# if you need to update it after a configuration change.')
187    rc=lineout('packages.lst')
188 end
189
190 say 'creating doc/LaTeXConfig.lyx'
191 'sed -f chkconfig.sed 'srcdir'/doc/LaTeXConfig.lyx.in >doc\LaTeXConfig.lyx'
192 call SysFileDelete 'chkconfig.sed'
193 call SysFileDelete 'chkconfig.vars'
194 call SysFileDelete 'wrap_chkconfig.ltx'
195 call SysFileDelete 'wrap_chkconfig.log'
196 call SysFileDelete 'chklatex.ltx'
197 call SysFileDelete 'chklatex.log'
198 call SysFileDelete 'chklayouts.tex'
199 call SysFileDelete 'missfont.log'
200
201 say 'creating 'lyxrc_defaults
202 rc=SysFileDelete(lyxrc_defaults)
203 if rxfuncquery(SysAddRexxMacro) then
204   rc=stream(lyxrc_defaults,'c','seek =0')
205 rc=SysFileDelete(X11ROOT'\XFree86\bin\fsend2.cmd')
206 rc=lineout(lyxrc_defaults,'\latex_command "'LATEX'"')
207 rc=lineout(lyxrc_defaults,'\relyx_command "'RELYX'"')
208 rc=lineout(lyxrc_defaults,'\literate_command "'LITERATE'"')
209 rc=lineout(lyxrc_defaults,'\literate_extension "'LITERATE_EXT'"')
210 rc=lineout(lyxrc_defaults,'\ps_command "'GS'"')
211 rc=lineout(lyxrc_defaults,'\view_ps_command "'GHOSTVIEW' -swap"')
212 rc=lineout(lyxrc_defaults,'\view_pspic_command "'GHOSTVIEW'"')
213 rc=lineout(lyxrc_defaults,'\ascii_roff_command "groff -t -ms -Tlatin1"')
214 rc=lineout(lyxrc_defaults,'\chktex_command "'CHKTEX'"')
215 rc=lineout(lyxrc_defaults,'\spell_command "'SPELL'"')
216 if \(''=SysSearchPath('PATH','fsend.exe')) then
217 do
218   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','/*A wrapper for fsend.exe*/')
219   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','parse arg "-p" phone "-i" fname "-d" name "-m" comment')
220   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','"gs -sDEVICE=tiffg3 -sOutputFile=temp_tiff.TIF -dNOPAUSE "fname" -c quit"')
221   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','"fsend -p"phone" -itemp_tiff.TIF -d"name" -m"comment')
222   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','"rm -f temp_tiff.TIF"')
223   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd')
224   rc=lineout(lyxrc_defaults,'\fax_command "fsend2 -p'"'$$Phone' -i'$$FName' -d'$$Name' -m'$$Comment'"'"')
225 end
226 if \(''=SysSearchPath('PATH','lp.exe')) then
227 do
228   rc=lineout(lyxrc_defaults,'\print_spool_command "lp"')
229   rc=lineout(lyxrc_defaults,'\print_spool_printerprefix "-d"')
230 end
231 else
232 if \(''=SysSearchPath('PATH','lpr.exe')) then
233 do
234   rc=lineout(lyxrc_defaults,'\print_spool_command "lpr"')
235   rc=lineout(lyxrc_defaults,'\print_spool_printerprefix "-P"')
236 end
237 else
238 do
239   rc=lineout(lyxrc_defaults,'\print_spool_command ""')
240   rc=lineout(lyxrc_defaults,'\print_spool_printerprefix ""')
241 end
242 rc=lineout(lyxrc_defaults,'\font_encoding "'rc_fontenc'"')
243 rc=lineout(lyxrc_defaults)