]> git.lyx.org Git - features.git/blob - lib/configure.cmd
f51beddcbfc0660ef5862d9bddceecf1de0fa54c
[features.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 X11ROOT=value('X11ROOT',,env)
6 latex_script='chkconfig.ltx'
7 lyxrc_defaults='lyxrc.defaults'
8 lyx_check_config='yes'
9 rc_fontenc='default'
10
11 parse arg option '=' srcdir
12 select
13    when option='-h'|option='-help'|option='--help' then do
14   say 'Usage: configure [options]'
15   say 'Options:'
16   say '  --help                   show this help lines'
17   say '  --without-latex-config   do not run LaTeX to determine configuration'
18   exit
19   end
20    when option='--without-latex-config' then
21   lyx_check_config='no'
22    when option='--srcdir' then
23   srcdir=translate(srcdir,'\','/')
24    otherwise
25   nop
26 end  /* select */
27 if srcdir='' then do
28    parse source 'OS/2 COMMAND ' script
29 say 'script =' script
30    srcdir=filespec('drive',script)strip(filespec('path',script),'T','\')
31 end
32
33 rc=SysFileTree(srcdir'\'latex_script,found,'F')
34 if found.0 = 0 then do
35    say "configure: error: cannot find "srcdir'\'latex_script" script"
36    exit 1
37 end
38 curdir=directory()
39 if \(curdir=srcdir) then do
40   call SysFileTree 'layouts', 'found', 'D'
41   if found.0 = 0 then do
42     call SysMkDir 'bind'
43     call SysMkDir 'clipart'
44     call SysMkDir 'doc'
45     call SysMkDir 'examples'
46     call SysMkDir 'images'
47     call SysMkDir 'kbd'
48     call SysMkDir 'layouts'
49     call SysMkDir 'reLyX'
50     call SysMkDir 'scripts'
51     call SysMkDir 'templates'
52     call SysMkDir 'ui'
53   end
54   'cmd /c copy /v' srcdir'\layouts\*.layout layouts'
55   if \(rc=0) then
56     say 'Error! copying layout files.'
57 end
58 curdir=translate(curdir,'/','\')
59 srcdir=translate(srcdir,'/','\')
60 A_.0=0
61 call SEARCH_PROG 'converter latex dvi%latex|latex2e%"latex,disable=linuxdoc&docbook"'
62 call SEARCH_PROG 'converter latex pdf%pdflatex|pdflatex2e%"latex,disable=linuxdoc&docbook"'
63 call SEARCH_PROG 'converter latex html%tth -t -e2 -L$$BaseName < $$FName > $$OutName|latex2html -no_subdir -split 0 -show_section_numbers $$FName|hevea -s $$FName%"originaldir,needaux,disable=linuxdoc&docbook"'
64 call SEARCH_PROG 'converter literate latex%noweave -delay -index $$FName > $$OutName%""'
65 call SEARCH_PROG 'converter dvi ps%dvips -o $$OutName $$FName%""'
66 call SEARCH_PROG 'converter ps pdf%ps2pdf $$FName%""'
67 call SEARCH_PROG 'converter ps tiff%gs -sDEVICE=tiffg3 -sOutputFile=$$OutName -dNOPAUSE $$FName -c quit|gsos2 -sDEVICE=tiffg3 -sOutputFile=$$OutName -dNOPAUSE $$FName -c quit%""'
68 call SEARCH_PROG 'converter linuxdoc lyx%sgml2lyx $$FName%""'
69 call SEARCH_PROG 'converter linuxdoc latex%sgml2latex $$FName%""'
70 call SEARCH_PROG 'converter linuxdoc dvi%sgml2latex -o dvi $$FName%""'
71 call SEARCH_PROG 'converter linuxdoc html%sgml2html $$FName%""'
72 call SEARCH_PROG 'converter docbook dvi%sgmltools -b dvi $$FName|db2dvi $$FName%""'
73 call SEARCH_PROG 'converter docbook html%sgmltools -b html $$FName|db2html $$FName%""'
74 A_.0=A_.0+1;i=A_.0
75 A_.i=''
76 call SEARCH_PROG 'converter latex lyx%reLyX -f $$FName%"importer"'
77 call SEARCH_PROG 'converter literate lyx%noweb2lyx $$FName $$OutName%"importer"'
78 call SEARCH_PROG 'converter html latex%html2latex $$FName%"importer"'
79 call SEARCH_PROG 'converter word latex%wvCleanLatex $$FName $$OutName|word2x -f latex $$FName%"importer"'
80 A_.0=A_.0+1;i=A_.0
81 A_.i=''
82 call SEARCH_PROG 'converter gif eps%convert $$FName $$OutName%""'
83 call SEARCH_PROG 'converter png eps%convert $$FName $$OutName%""'
84 call SEARCH_PROG 'converter jpg eps%convert $$FName $$OutName%""'
85 call SEARCH_PROG 'converter gif png%convert $$FName $$OutName%""'
86 A_.0=A_.0+1;i=A_.0
87 A_.i=''
88 call SEARCH_PROG 'viewer dvi%xdvi'
89 call SEARCH_PROG 'viewer html%netscape'
90 call SEARCH_PROG 'viewer pdf%xpdf gv ghostview acroread'
91 call SEARCH_PROG 'viewer ps%gv -swap|ghostview -swap|gvpm -swap'
92 call SEARCH_PROG 'viewer eps%gv|ghostview|gvpm'
93 A_.0=A_.0+1;i=A_.0
94 A_.i=''
95 call SEARCH_PROG 'ps_command%gs|gsos2'
96 call SEARCH_PROG 'ascii_roff_command%groff -t -Tlatin1 $$FName'
97 call SEARCH_PROG 'chktex_command%chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'
98 call SEARCH_PROG 'spell_command%ispell'
99 /* call SEARCH_PROG 'fax_command%fsend -p$$Phone -i$$FName -d$$Name -m$$Comment' */
100 call SEARCH_PROG 'print_spool_command%lp|lpr'
101 i=A_.0;A_.0=A_.0+1
102 if pos('lpr',A_.i)>0 then
103   do
104     i=i+1
105     A_.i='print_spool_printerprefix "-P"'
106   end
107 else
108   do
109     i=i+1
110     A_.i='print_spool_printerprefix "-d "'
111   end
112 /* call SysFileTree 'reLyX\reLyX.cmd', 'found', 'F' */
113 /* $ChkLaTeX
114 \nonstopmode\makeatletter
115 \ifx\undefined\documentclass\else
116   \message{ThisIsLaTeX2e}
117 \fi
118 \@@end
119  EOF */
120 call WRITE_FILE 'chklatex.ltx' '$ChkLaTeX'
121 'cmd /c 'LATEX' chklatex.ltx>nul'
122 call SysFileSearch 'NotLaTeX2e', 'chklatex.log', chklatex
123 if chklatex.0 > 0 then LATEX=''
124
125 rc=SysFileDelete('textclass.lst')
126 rc=SysFileDelete('packages.lst')
127 rc=SysFileDelete('chkconfig.sed')
128 if \(lyx_check_config='no') then
129 do
130   rc=SysFileTree(srcdir'\layouts\*.layout',found,'FO')
131   rc=SysFileDelete('chklayouts.tex')
132   rc=SysFileDelete('chkconfig.vars')
133   if found.0>0 then
134     do num=1 to found.0
135       parse value filespec('name',found.num) with DocClass '.layout'
136       parse value DocClass with mainClass '_' subClass
137       if ''=subClass then
138         rc=lineout('chklayouts.tex','\TestDocClass{'DocClass'}')
139       else      /* Not used, or must be empty? */
140         rc=lineout('chklayouts.tex','\TestDocClass['mainClass'.cls]{'DocClass'}')
141     end
142   rc=lineout('chklayouts.tex')
143   sgmltools_cmd=''
144   chk_sgmltools='no'
145   if SGMLTOOLS='sgml2lyx' then
146    do
147     chk_sgmltools='yes'
148     sgmltools_cmd='\def\hassgmltools{}'
149    end
150   rc=SysFileDelete('wrap_chkconfig.ltx')
151   rc=lineout('wrap_chkconfig.ltx','\newcommand\srcdir{'srcdir'}')
152   rc=lineout('wrap_chkconfig.ltx',sgmltools_cmd)
153   rc=lineout('wrap_chkconfig.ltx','\input{'srcdir'/chkconfig.ltx}')
154   rc=lineout('wrap_chkconfig.ltx')
155   'cmd /c 'LATEX' wrap_chkconfig.ltx'
156   size=stream('chkconfig.sed','c','query size')
157   rc=stream('chkconfig.sed','c','open')
158   if rxfuncquery(SysAddRexxMacro) then
159     rc=stream('chkconfig.sed','c','seek +'size)
160   else
161     rc=stream('chkconfig.sed','c','seek + 'size' write')
162   rc=lineout('chkconfig.sed','s/@chk_sgmltools@/'chk_sgmltools'/g')
163   rc=lineout('chkconfig.sed')
164   call SysFileSearch 'chk_fontenc=', 'chkconfig.vars', fontenc
165   if fontenc.0 > 0 then parse var fontenc.1 chk"='"rc_fontenc"'"
166 end
167
168 call SysFileTree 'textclass.lst', 'file', 'FO'
169 if file.0=0 then
170 do
171 /* $TextClass
172 # This file declares layouts and their associated definition files
173 # (include dir. relative to the place where this file is).
174 # It contains only default values, since chkconfig.ltx could not be run
175 # for some reason. Run ./configure if you need to update it after a
176 # configuration change.
177 article article article
178 report  report  report
179 book    book    book
180 linuxdoc        linuxdoc        linuxdoc
181 letter  letter  letter
182  EOF */
183   call WRITE_FILE 'textclass.lst' '$TextClass'
184   rc=lineout('chkconfig.sed','s/@.*@/???/g')
185   rc=lineout('chkconfig.sed')
186   rc_graphics='none'
187 end
188
189 call SysFileTree 'chkconfig.sed', 'file', 'FO'
190 if file.0=0 then
191 do
192    rc=lineout('chkconfig.sed','s/@.*@/???/g')
193    rc=lineout('chkconfig.sed')
194 end
195
196 call SysFileTree 'packages.lst', 'file', 'FO'
197 if file.0=0 then
198 do
199 /* $Packages
200 # This file should contain the list of LaTeX packages that have been
201 # recognized by LyX. Unfortunately, since configure could not find
202 # your LaTeX2e program, the tests have not been run. Run configure
203 # if you need to update it after a configuration change.
204  EOF */
205   call WRITE_FILE 'packages.lst' '$Packages'
206 end
207
208 say 'creating doc/LaTeXConfig.lyx'
209 'sed -f chkconfig.sed 'srcdir'/doc/LaTeXConfig.lyx.in >doc\LaTeXConfig.lyx'
210 call SysFileDelete 'chkconfig.sed'
211 call SysFileDelete 'chkconfig.vars'
212 call SysFileDelete 'wrap_chkconfig.ltx'
213 call SysFileDelete 'wrap_chkconfig.log'
214 call SysFileDelete 'chklatex.ltx'
215 call SysFileDelete 'chklatex.log'
216 call SysFileDelete 'chklayouts.tex'
217 call SysFileDelete 'missfont.log'
218
219 say 'creating 'lyxrc_defaults
220 if rxfuncquery(SysAddRexxMacro) then
221   rc=stream(lyxrc_defaults,'c','seek =0')
222 rc=SysFileDelete(X11ROOT'\XFree86\bin\fsend2.cmd')
223 /* $LyXRC_Default
224 # This file has been automatically generated by LyX' lib/configure
225 # script. It contains default settings that have been determined by
226 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
227 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
228 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
229 # override the values given here.
230 \Format latex tex     LaTeX           L
231 \Format dvi   dvi     DVI             D
232 \Format ps    ps      Postscript      t
233 \Format pdf   pdf     PDF             P
234 \Format html  html    HTML            H
235 \Format text  txt     ASCII           A
236 \Format word  doc     Word            W
237 \Format literate nw   NoWeb           N
238 \Format linuxdoc sgml LinuxDoc        x
239 \Format docbook  sgml DocBook         B
240 \Format program  ""   Program         ""
241 \Format fax      ""   Fax             ""
242
243  EOF */
244 call WRITE_FILE lyxrc_defaults '$LyXRC_Default'
245 A_.0=A_.0+1;i=A_.0
246 A_.i='font_encoding "'||rc_fontenc||'"'
247 do i=1 to A_.0
248   if A_.i\='' then A_.i='\'||A_.i
249   call lineout lyxrc_defaults,A_.i
250 end
251 call lineout lyxrc_defaults
252 call lineout script
253 exit
254
255 SEARCH_PROG: procedure expose A_.
256 parse arg LABEL '%' COMMANDS '%' ROUTE
257   i=A_.0+1
258   A_.0=i
259   A_.i=LABEL||' "none" '||ROUTE
260   do while COMMANDS\=''
261     parse value COMMANDS with COMMAND '|' COMMANDS
262     parse upper value COMMAND with CMD  ARGV
263     if (\(''=SysSearchPath('PATH',CMD||'.EXE'))|\(''=SysSearchPath('PATH',CMD||'.CMD'))) then
264     do
265       A_.i=LABEL||' "'||COMMAND||'" '||ROUTE
266       COMMANDS=''
267     end
268   end
269 return
270
271 WRITE_FILE: procedure expose script
272 parse arg FILE TAG
273 call SysFileDelete FILE
274 C_=''
275 do while pos(TAG,C_)=0
276   C_=linein(script)
277 end
278 C_=linein(script)
279 do while pos('EOF',C_)=0
280   call lineout FILE,C_
281   C_=linein(script)
282 end
283 call lineout FILE
284 /*call lineout script*/
285 return