home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / lyx21041.zip / XFree86 / lib / X11 / lyx / configure.cmd < prev    next >
OS/2 REXX Batch file  |  1999-10-29  |  9KB  |  237 lines

  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.  
  93. call SysFileDelete 'chklatex.ltx'
  94. rc=lineout('chklatex.ltx','\nonstopmode\makeatletter')
  95. rc=lineout('chklatex.ltx','\ifx\undefined\documentclass\else')
  96. rc=lineout('chklatex.ltx','  \message{ThisIsLaTeX2e}')
  97. rc=lineout('chklatex.ltx','\fi')
  98. rc=lineout('chklatex.ltx','\@@end')
  99. rc=lineout('chklatex.ltx')
  100. 'cmd /c 'LATEX' chklatex.ltx>nul'
  101. call SysFileSearch 'NotLaTeX2e', 'chklatex.log', chklatex
  102. if chklatex.0 > 0 then LATEX=''
  103.  
  104. rc=SysFileDelete('textclass.lst')
  105. rc=SysFileDelete('packages.lst')
  106. rc=SysFileDelete('chkconfig.sed')
  107. if \(lyx_check_config='no') then
  108. do
  109.   rc=SysFileTree(srcdir'\layouts\*.layout',found,'FO')
  110.   rc=SysFileDelete('chklayouts.tex')
  111.   rc=SysFileDelete('chkconfig.vars')
  112.   if found.0>0 then
  113.     do num=1 to found.0
  114.       parse value filespec('name',found.num) with DocClass '.layout'
  115.       parse value DocClass with mainClass '_' subClass
  116.       if ''=subClass then
  117.         rc=lineout('chklayouts.tex','\TestDocClass{'DocClass'}')
  118.       else    /* Not used, or must be empty? */
  119.         rc=lineout('chklayouts.tex','\TestDocClass['mainClass'.cls]{'DocClass'}')
  120.     end
  121.   rc=lineout('chklayouts.tex')
  122.   sgmltools_cmd=''
  123.   chk_sgmltools='no'
  124.   if SGMLTOOLS='sgml2lyx' then
  125.    do
  126.     chk_sgmltools='yes'
  127.     sgmltools_cmd='\def\hassgmltools{}'
  128.    end
  129.   rc=SysFileDelete('wrap_chkconfig.ltx')
  130.   rc=lineout('wrap_chkconfig.ltx','\newcommand\srcdir{'srcdir'}')
  131.   rc=lineout('wrap_chkconfig.ltx',sgmltools_cmd)
  132.   rc=lineout('wrap_chkconfig.ltx','\input{'srcdir'/chkconfig.ltx}')
  133.   rc=lineout('wrap_chkconfig.ltx')
  134.   'cmd /c 'LATEX' wrap_chkconfig.ltx'
  135.   size=stream('chkconfig.sed','c','query size')
  136.   rc=stream('chkconfig.sed','c','open')
  137. /*   if rxfuncquery(SysAddRexxMacro) then */
  138.    rc=stream('chkconfig.sed','c','seek +'size) 
  139. /*   else
  140.      rc=stream('chkconfig.sed','c','seek + 'size' write') */
  141. say size;'cmd/c dir chkconfig.sed'; 
  142.   rc=lineout('chkconfig.sed','s/@chk_sgmltools@/'chk_sgmltools'/g')
  143.   rc=lineout('chkconfig.sed')
  144.   call SysFileSearch 'chk_fontenc=', 'chkconfig.vars', fontenc
  145.   if fontenc.0 > 0 then parse var fontenc.1 chk"='"rc_fontenc"'"
  146. end
  147.  
  148. call SysFileTree 'textclass.lst', 'file', 'FO'
  149. if file.0=0 then
  150. do
  151.    rc=lineout('textclass.lst','# This file declares layouts and their associated definition files')
  152.    rc=lineout('textclass.lst','# (include dir. relative to the place where this file is).')
  153.    rc=lineout('textclass.lst','# It contains only default values, since chkconfig.ltx could not be run')
  154.    rc=lineout('textclass.lst','# for some reason. Run ./configure if you need to update it after a')
  155.    rc=lineout('textclass.lst','# configuration change.')
  156.    rc=lineout('textclass.lst','article    article    article')
  157.    rc=lineout('textclass.lst','report    report    report')
  158.    rc=lineout('textclass.lst','book    book    book')
  159.    rc=lineout('textclass.lst','linuxdoc    linuxdoc    linuxdoc')
  160.    rc=lineout('textclass.lst','letter    letter    letter')
  161.    rc=lineout('textclass.lst')
  162.    rc=lineout('chkconfig.sed','s/@.*@/???/g')
  163.    rc=lineout('chkconfig.sed')
  164.    rc_graphics='none'
  165. end
  166.  
  167. call SysFileTree 'chkconfig.sed', 'file', 'FO'
  168. if file.0=0 then
  169. do
  170.    rc=lineout('chkconfig.sed','s/@.*@/???/g')
  171.    rc=lineout('chkconfig.sed')
  172. end
  173.  
  174. call SysFileTree 'packages.lst', 'file', 'FO'
  175. if file.0=0 then
  176. do
  177.    rc=lineout('packages.lst','# This file should contain the list of LaTeX packages that have been')
  178.    rc=lineout('packages.lst','# recognized by LyX. Unfortunately, since configure could not find')
  179.    rc=lineout('packages.lst','# your LaTeX2e program, the tests have not been run. Run configure')
  180.    rc=lineout('packages.lst','# if you need to update it after a configuration change.')
  181.    rc=lineout('packages.lst')
  182. end
  183.  
  184. say 'creating doc/LaTeXConfig.lyx'
  185. 'sed -f chkconfig.sed 'srcdir'/doc/LaTeXConfig.lyx.in >doc\LaTeXConfig.lyx'
  186. call SysFileDelete 'chkconfig.sed'
  187. call SysFileDelete 'chkconfig.vars'
  188. call SysFileDelete 'wrap_chkconfig.ltx'
  189. call SysFileDelete 'wrap_chkconfig.log'
  190. call SysFileDelete 'chklatex.ltx'
  191. call SysFileDelete 'chklatex.log'
  192. call SysFileDelete 'chklayouts.tex'
  193. call SysFileDelete 'missfont.log'
  194.  
  195. say 'creating 'lyxrc_defaults
  196. rc=SysFileDelete(lyxrc_defaults)
  197. if rxfuncquery(SysAddRexxMacro) then
  198.   rc=stream(lyxrc_defaults,'c','seek =0')
  199. rc=SysFileDelete(X11ROOT'\XFree86\bin\fsend2.cmd')
  200. rc=lineout(lyxrc_defaults,'\latex_command "'LATEX'"')
  201. rc=lineout(lyxrc_defaults,'\literate_command "'LITERATE'"')
  202. rc=lineout(lyxrc_defaults,'\literate_extension "'LITERATE_EXT'"')
  203. rc=lineout(lyxrc_defaults,'\ps_command "'GS'"')
  204. rc=lineout(lyxrc_defaults,'\view_ps_command "'GHOSTVIEW' -swap"')
  205. rc=lineout(lyxrc_defaults,'\view_pspic_command "'GHOSTVIEW'"')
  206. rc=lineout(lyxrc_defaults,'\ascii_roff_command "groff -t -ms -Tlatin1"')
  207. rc=lineout(lyxrc_defaults,'\chktex_command "'CHKTEX'"')
  208. rc=lineout(lyxrc_defaults,'\spell_command "'SPELL'"')
  209. if \(''=SysSearchPath('PATH','fsend.exe')) then
  210. do
  211.   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','/*A wrapper for fsend.exe*/')
  212.   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','parse arg "-p" phone "-i" fname "-d" name "-m" comment')
  213.   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','"gs -sDEVICE=tiffg3 -sOutputFile=temp_tiff.TIF -dNOPAUSE "fname" -c quit"')
  214.   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','"fsend -p"phone" -itemp_tiff.TIF -d"name" -m"comment')
  215.   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd','"rm -f temp_tiff.TIF"')
  216.   rc=lineout(X11ROOT'\XFree86\bin\fsend2.cmd')
  217.   rc=lineout(lyxrc_defaults,'\fax_command "fsend2 -p'"'$$Phone' -i'$$FName' -d'$$Name' -m'$$Comment'"'"')
  218. end
  219. if \(''=SysSearchPath('PATH','lp.exe')) then
  220. do
  221.   rc=lineout(lyxrc_defaults,'\print_spool_command "lp"')
  222.   rc=lineout(lyxrc_defaults,'\print_spool_printerprefix "-d"')
  223. end
  224. else
  225. if \(''=SysSearchPath('PATH','lpr.exe')) then
  226. do
  227.   rc=lineout(lyxrc_defaults,'\print_spool_command "lpr"')
  228.   rc=lineout(lyxrc_defaults,'\print_spool_printerprefix "-P"')
  229. end
  230. else
  231. do
  232.   rc=lineout(lyxrc_defaults,'\print_spool_command ""')
  233.   rc=lineout(lyxrc_defaults,'\print_spool_printerprefix ""')
  234. end
  235. rc=lineout(lyxrc_defaults,'\font_encoding "'rc_fontenc'"')
  236. rc=lineout(lyxrc_defaults)
  237.