]> git.lyx.org Git - lyx.git/blob - lib/configure.m4
Allow specification of output filename of tex2lyx
[lyx.git] / lib / configure.m4
1 #! /bin/sh
2 dnl Use 'make' to create configure from this m4 script.
3 # This script is a hand-made configure script. It contains a lot of
4 # code stolen from GNU autoconf. I removed all the code that was not
5 # useful for configuring a LyX installation.
6
7
8 dnl ######### Begin M4 macros #########################################
9 dnl This is a template for my stripped-down configure script.
10 dnl First, a few convenient macros.
11 changequote([,])dnl
12 dnl
13 dnl
14 dnl MSG_CHECKING(FEATURE-DESCRIPTION,PREFIX)
15 dnl
16 define(MSG_CHECKING,
17 [echo $ac_n "$2checking $1""... $ac_c"])dnl
18 dnl
19 dnl
20 dnl MSG_RESULT(RESULT-DESCRIPTION)
21 dnl
22 define(MSG_RESULT,
23 [echo "$ac_t""$1"])dnl
24 dnl
25 dnl
26 dnl SEARCH_PROG(FEATURE-DESCRIPTION,VARIABLE-NAME,PROGRAMS-LIST,
27 dnl             ACTION-IF-FOUND,ACTION-IF-NOT-FOUND)
28 dnl
29 define(SEARCH_PROG,[dnl
30 changequote([,])dnl
31 MSG_CHECKING($1)
32 MSG_RESULT()
33 $2=
34 for ac_prog in $3
35 do
36 # Extract the first word of "$ac_prog", so it can be a program name with args.
37 set dummy $ac_prog ; ac_word=$[2]
38 if test -n "$ac_word"; then
39   MSG_CHECKING([for \"$ac_word\"],[+])
40   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
41   save_PATH=$PATH ; PATH=:$PATH
42   for ac_dir in ${PATH} ; do
43     if test -x [$ac_dir/$ac_word]; then
44       $2="$ac_prog"
45       break
46     fi
47   done
48   IFS="$ac_save_ifs"
49   PATH=$save_PATH
50
51   if test -n "[$]$2"; then
52     ac_result=yes
53     ifelse($4,,,[$4])
54   else
55     ac_result=no
56   fi
57   MSG_RESULT($ac_result)
58   test -n "[$]$2" && break
59 fi
60 done
61
62 if test -z "[$]$2" ; then
63   $2=none
64 ifelse($5,,,[  $5
65 ])dnl
66 fi
67 changequote(,)dnl
68 ])dnl
69 dnl
70 dnl
71 dnl LYXRC_VAR(VARIABLE_NAME, VALUE)
72 define(LYXRC_VAR,[dnl
73 rc_entries="$rc_entries
74 $1 \"$2\""])
75 dnl
76 dnl
77 dnl LYXRC_PROG(FEATURE-DESCRIPTION,VARIABLE-NAME,PROGRAMS-LIST,
78 dnl             ACTION-IF-FOUND,ACTION-IF-NOT-FOUND)
79 define(LYXRC_PROG,[dnl
80 SEARCH_PROG($1,prog,$3,$4,$5)
81 LYXRC_VAR($2,$prog)])
82 dnl
83 dnl
84 dnl PROVIDE_DEFAULT_FILE(FILE, DEFAULT-VALUE)
85 dnl
86 define(PROVIDE_DEFAULT_FILE,[dnl
87 # if $1 does not exist (because LaTeX did not run),
88 # then provide a standard version.
89 if test ! -f $1 ; then
90   cat >$1 <<EOF
91 $2
92 EOF
93 fi])
94 changequote(,)dnl
95 dnl ######### End M4 macros #############################################
96
97
98 # Be Bourne compatible (taken from autoconf 2.53)
99 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
100   emulate sh
101   NULLCMD=:
102 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
103   set -o posix
104 fi
105
106
107
108 ####some configuration variables
109 outfile=lyxrc.defaults
110 rc_entries=
111 lyx_check_config=yes
112 lyx_keep_temps=no
113 srcdir=
114 version_suffix=
115
116 #### Parse the command line
117 for ac_option do
118   case "$ac_option" in
119     -help | --help | -h)
120       cat << EOF
121 Usage: configure [options]
122 Options:
123   --help                   show this help lines
124   --keep-temps             keep temporary files (for debug. purposes)
125   --without-latex-config   do not run LaTeX to determine configuration
126   --with-version-suffix=suffix suffix of binary installed files
127 EOF
128       exit 0;;
129     --without-latex-config)
130       lyx_check_config=no ;;
131     --keep-temps)
132       lyx_keep_temps=yes ;;
133     --with-version-suffix*)
134       version_suffix=`echo "$ac_option" | sed 's,--with-version-suffix=,,'`
135   esac
136 done
137
138
139 #### Checking for some echo oddities
140 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
141   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
142   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
143     ac_n= ac_c='
144 ' ac_t='        '
145   else
146     ac_n=-n ac_c= ac_t=
147   fi
148 else
149   ac_n= ac_c='\c' ac_t=
150 fi
151
152
153 #### I do not really know why this is useful, but we might as well keep it.
154 # NLS nuisances.
155 # Only set these to C if already set.  These must not be set unconditionally
156 # because not all systems understand e.g. LANG=C (notably SCO).
157 # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
158 # Non-C LC_CTYPE values break the ctype check.
159 if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
160 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
161 if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
162 if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
163
164
165 #### Guess the directory in which configure is located.
166 changequote([,])dnl
167 ac_prog=[$]0
168 changequote(,)dnl
169 srcdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
170 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
171 test "x${srcdir}" = "x$ac_prog" && srcdir=.
172 if test ! -r "${srcdir}"/chkconfig.ltx ; then
173   echo "configure: error: cannot find chkconfig.ltx script"
174   exit 1
175 fi
176
177 #### Adjust PATH for Win32 (Cygwin)
178 use_cygwin_path_fix=''
179 case `uname -s` in
180    CYGWIN*)
181      tmpfname="/tmp/x$$.ltx";
182      echo "\\documentstyle{article}" > $tmpfname
183      echo "\\begin{document}\\end{document}" >> $tmpfname
184      inpname=`cygpath -w $tmpfname | tr '\\\\' /`
185      echo "\\input{$inpname}" > wrap_temp$$.ltx
186      check_err=`latex wrap_temp$$.ltx 2>&1 < /dev/null | grep Error`
187      rm -f wrap_temp$$.* /tmp/x$$.*
188      if [ x"$check_err" = "x" ]
189      then
190        echo "configure: cygwin detected; path correction"
191        srcdir=`cygpath -w "${srcdir}" | tr '\\\\' /`
192        echo "srcdir=${srcdir}"
193        use_cygwin_path_fix='true'
194      else
195        echo "configure: cygwin detected; path correction is not needed"
196        use_cygwin_path_fix='false'
197      fi
198      ;;
199 esac
200
201 #### Create the build directories if necessary
202 for dir in bind clipart doc examples images kbd layouts \
203     scripts templates ui ; do
204   test ! -d $dir && mkdir $dir
205 done
206
207
208 #### Searching some useful programs
209 define(CHECKLATEX2E,[
210 ## Check whether this is really LaTeX2e
211 rm -f chklatex.ltx
212 cat >chklatex.ltx <<EOF
213 \\nonstopmode\\makeatletter
214 \\ifx\\undefined\\documentclass\\else
215   \\message{ThisIsLaTeX2e}
216 \\fi
217 \\@@end
218 EOF
219 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
220                        | grep 'ThisIsLaTeX2e' >/dev/null; then
221   :
222 else
223   LATEX=
224   ac_result="not useable"
225 fi
226 rm -f chklatex.ltx chklatex.log])dnl
227 dnl
228 # Search LaTeX2e
229 SEARCH_PROG([for a LaTeX2e program],LATEX,pplatex latex2e latex,CHECKLATEX2E,dnl
230   [lyx_check_config=no])
231 latex_to_dvi=$LATEX
232 test -z "$latex_to_dvi" && latex_to_dvi="none"
233
234 # Search for pdflatex
235 if test ${lyx_check_config} = no ; then
236   latex_to_pdf=none
237 else
238   SEARCH_PROG([for the pdflatex program],latex_to_pdf,pdflatex)
239 fi
240
241 test $latex_to_dvi != "none" && latex_to_dvi="$latex_to_dvi \$\$i"
242 test $latex_to_pdf != "none" && latex_to_pdf="$latex_to_pdf \$\$i"
243
244 SEARCH_PROG([for a TGIF viewer and editor], TGIF_EDITOR, tgif)
245 TGIF_VIEWER="$TGIF_EDITOR"
246
247 SEARCH_PROG([for a FIG viewer and editor], FIG_EDITOR, xfig)
248 FIG_VIEWER="$FIG_EDITOR"
249
250 SEARCH_PROG([for a GRACE viewer and editor], GRACE_EDITOR, xmgrace)
251 GRACE_VIEWER="$GRACE_EDITOR"
252
253 SEARCH_PROG([for a FEN viewer and editor], FEN_EDITOR, "xboard -lpf \$\$i -mode EditPosition")
254 FEN_VIEWER="$FEN_EDITOR"
255
256 SEARCH_PROG([for a raster image viewer], RASTERIMAGE_VIEWER, xv kview gimp)
257
258 SEARCH_PROG([for a raster image editor], RASTERIMAGE_EDITOR, gimp)
259
260 SEARCH_PROG([for a text editor], TEXT_EDITOR, xemacs gvim kedit kwrite kate nedit gedit notepad)
261
262 # Search for an installed tex2lyx or a ready-to-install one
263 SEARCH_PROG([for a LaTeX -> LyX converter],tex_to_lyx_command, "$PWD/../src/tex2lyx/tex2lyx -f \$\$i \$\$o" "tex2lyx$version_suffix -f \$\$i \$\$o")
264
265 SEARCH_PROG([for a Noweb -> LyX converter],literate_to_lyx_command,"noweb2lyx \$\$i \$\$o")
266 literate_to_lyx_command=`echo $literate_to_lyx_command | sed "s,noweb2lyx,noweb2lyx$version_suffix,"`
267
268 # Search something to process a literate document
269 SEARCH_PROG([for a Noweb -> LaTeX converter],literate_to_tex_command,"noweave -delay -index \$\$i > \$\$o")
270
271 SEARCH_PROG([for a HTML -> Latex converter],html_to_latex_command, "html2latex \$\$i")
272
273 SEARCH_PROG([for a MSWord -> Latex converter],word_to_latex_command, "wvCleanLatex \$\$i \$\$o" "wvCleanLatex \$\$i \$\$o")
274
275 SEARCH_PROG([for Image converter],image_command, "convert \$\$i \$\$o")
276
277 SEARCH_PROG([for an OpenOffice.org -> Latex converter],sxw_to_latex_command, "w2l -clean \$\$i")
278
279 # oolatex is the original name, SuSE has oolatex.sh
280 SEARCH_PROG([for an Latex -> OpenOffice.org converter],latex_to_sxw_command, "oolatex \$\$i" "oolatex.sh \$\$i")
281
282 # Search something to preview postscript
283 SEARCH_PROG([for a Postscript previewer],PS_VIEWER,gsview32 gv "ghostview -swap" kghostview)
284 EPS_VIEWER=$PS_VIEWER
285
286 # Search for a program to preview pdf
287 SEARCH_PROG([for a PDF previewer],PDF_VIEWER, acrobat acrord32 gsview32 acroread gv ghostview xpdf kpdf kghostview)
288
289 # Search something to preview dvi
290 SEARCH_PROG([for a DVI previewer],DVI_VIEWER, xdvi windvi yap kdvi)
291
292 # Search something to preview html
293 SEARCH_PROG([for a HTML previewer],HTML_VIEWER, "mozilla file://\$\$p\$\$i" netscape)
294
295 # Search for a program to convert ps to pdf
296 SEARCH_PROG([for a PS to PDF converter],ps_to_pdf_command, "ps2pdf13 \$\$i")
297
298 # Search for a program to convert dvi to ps
299 SEARCH_PROG([for a DVI to PS converter],dvi_to_ps_command, "dvips -o \$\$o \$\$i")
300
301 # Search for a program to convert dvi to pdf
302 SEARCH_PROG([for a DVI to PDF converter],dvi_to_pdf_command, "dvipdfm \$\$i")
303
304 # We have a script to convert previewlyx to ppm or to png
305 lyxpreview_to_bitmap_command='python $$s/scripts/lyxpreview2bitmap.py'
306
307 # Search for 'dvipng'. Only enable the conversion from lyxpreview -> png
308 # if dvipng is found.
309 SEARCH_PROG([for dvipng],DVIPNG,dvipng)
310
311 test "$DVIPNG" = "dvipng" && \
312         lyxpreview_to_png_command=$lyxpreview_to_bitmap_command
313
314 # Search a *roff program (used to translate tables in ASCII export)
315 LYXRC_PROG([for a *roff formatter], \ascii_roff_command, dnl
316   "groff -t -Tlatin1 \$\$FName" nroff,dnl
317   test "$prog" = "nroff" && prog='tbl $$FName | nroff')
318
319 # Search the ChkTeX program
320 LYXRC_PROG([for ChkTeX], \chktex_command,dnl
321    "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38")
322
323 # Search for a spellchecker
324 LYXRC_PROG([for a spell-checker], \spell_command, ispell)
325
326 # Search for computer algebra systems
327 SEARCH_PROG([for Octave],OCTAVE,octave)
328 SEARCH_PROG([for Maple],MAPLE,maple)
329
330 dnl # Search a Fax handling program
331 dnl SEARCH_PROG([for a fax driver], FAX, sendfax faxsend fax)
332 dnl if test $FAX = sendfax ; then
333 dnl   fax_command="sendfax -n -h '\$\$Host' -c '\$\$Comment' -x '\$\$Enterprise' -d '\$\$Name'@'\$\$Phone' '\$\$FName'"
334 dnl elif test $FAX = faxsend ; then
335 dnl   fax_command="faxsend '\$\$Phone' '\$\$FName'"
336 dnl elif test $FAX = fax ; then
337 dnl   fax_command="fax send '\$\$Phone' '\$\$FName'"
338 dnl else
339 dnl   fax_command="none"
340 dnl fi
341
342 # Search a GUI Fax program
343 SEARCH_PROG([for a fax program], fax_command, "kdeprintfax \$\$i" "ksendfax \$\$i")
344
345 # Search for LinuxDoc support
346 SEARCH_PROG([for SGML-tools 1.x (LinuxDoc)], LINUXDOC, sgml2lyx)
347 if test $LINUXDOC != none; then
348   chk_linuxdoc=yes
349   bool_linuxdoc=true
350   linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
351 else
352   chk_linuxdoc=no
353   bool_linuxdoc=false
354 fi
355
356 case $LINUXDOC in
357   sgml2lyx)
358     linuxdoc_to_latex_command="sgml2latex \$\$i"
359     linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$i"
360     linuxdoc_to_html_command="sgml2html \$\$i"
361     linuxdoc_to_lyx_command="sgml2lyx \$\$i";;
362   none)
363     linuxdoc_to_latex_command="none"
364     linuxdoc_to_dvi_command="none"
365     linuxdoc_to_html_command="none"
366     linuxdoc_to_lyx_command="none";;
367 esac
368
369 # Search for DocBook support
370 SEARCH_PROG([for SGML-tools 2.x (DocBook) or db2x scripts], DOCBOOK, sgmltools db2dvi)
371 if test $DOCBOOK != none; then
372   chk_docbook=yes
373   bool_docbook=true
374   docbook_cmd="\\def\\hasdocbook{yes}"
375 else
376   chk_docbook=no
377   bool_docbook=false
378 fi
379
380 case $DOCBOOK in
381   sgmltools)
382     docbook_to_dvi_command="sgmltools -b dvi \$\$i"
383     docbook_to_html_command="sgmltools -b html \$\$i";;
384   db2dvi)
385     docbook_to_dvi_command="db2dvi \$\$i"
386     docbook_to_html_command="db2html \$\$i";;
387   none)
388     docbook_to_dvi_command="none"
389     docbook_to_html_command="none";;
390 esac
391
392 # Search for a spool command
393 LYXRC_PROG([for a spool command], \print_spool_command, lp lpr)
394 case $prog in
395   lp) print_spool_printerprefix="-d ";;
396  lpr) print_spool_printerprefix="-P";;
397    *) :;; # leave to empty values
398 esac
399 LYXRC_VAR(\print_spool_printerprefix, $print_spool_printerprefix)
400
401 SEARCH_PROG([for a LaTeX -> HTML converter], latex_to_html_command,dnl
402  "tth -t -e2 -L\$\$b < \$\$i > \$\$o" dnl
403  "latex2html -no_subdir -split 0 -show_section_numbers \$\$i" dnl
404  "hevea -s \$\$i")
405
406 #### Explore the LaTeX configuration
407 MSG_CHECKING(LaTeX configuration)
408 # First, remove the files that we want to re-create
409 rm -f textclass.lst packages.lst chkconfig.sed
410 if test ${lyx_check_config} = no ; then
411   MSG_RESULT(default values)
412   MSG_CHECKING(list of textclasses,+)
413   cat >textclass.lst <<EOF
414 # This file declares layouts and their associated definition files
415 # (include dir. relative to the place where this file is).
416 # It contains only default values, since chkconfig.ltx could not be run
417 # for some reason. Run ./configure if you need to update it after a
418 # configuration change.
419 EOF
420   # build the list of available layout files and convert it to entries
421   # for the default textclass.lst file
422   for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
423     case $file in
424       */\*.layout) ;;
425       *) if test -r "$file" ; then
426            class=`echo $file | sed -e 's%^.*layouts/\(.*\)\.layout$%\1%'`
427            cleanclass=`echo $class | tr ' -' '__'`
428 changequote([,])dnl
429            # make sure the same class is not considered twice
430            if test  x`[eval] echo $ac_n '${found_'$cleanclass'}'` = x ; then
431              [eval] "found_$cleanclass=yes"
432 changequote(,)dnl
433              sed -n '
434 # We manipulate only those lines that contain
435 # "\Declare(LaTeX|DocBook|LinuxDoc)Class"
436 /\\DeclareLaTeXClass/bmatch
437 /\\DeclareDocBookClass/bmatch
438 /\\DeclareLinuxDocClass/bmatch
439 b
440
441 :match
442 # Remove the \DeclareFOOClass macro and add the correct boolean
443 # at the end of the line telling whether the class is
444 # available
445 s/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/
446 s/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/
447 s/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/
448 # If the macro had an optional argument with several
449 # parameters, only keep the first one
450 s/\[\([^,]*\),[^]]*\]/[\1]/
451 # If the macro did not have an optional argument, provide one
452 # (equal to the class name)
453 s/^{/['$class']{/
454 # Remove brackets and replace with correctly quoted entries
455 s/\[\([^]]*\)\] *{\([^}]*\)}/"'$class'" "\1" "\2"/
456 # Print the maninpulated text
457 p
458 # We are interested in the first instance of \DeclareFOOClass only,
459 # so now quit
460 q
461 ' "$file" >> textclass.lst
462            fi
463          fi ;;
464     esac
465   done
466   MSG_RESULT(done)
467 else
468   MSG_RESULT(auto)
469   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
470   if test ! -r "chkconfig.ltx" ; then
471     cp "${srcdir}"/chkconfig.ltx .
472     rmcopy=true
473   fi
474   cat >wrap_chkconfig.ltx <<EOF
475 ${linuxdoc_cmd}
476 ${docbook_cmd}
477 \\input{chkconfig.ltx}
478 EOF
479   ## Construct the list of classes to test for.
480   # build the list of available layout files and convert it to commands
481   # for chkconfig.ltx
482   for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
483     case $file in
484       */\*.layout) ;;
485       *) if test -r "$file" ; then
486            class=`echo $file | sed -e 's%^.*layouts/\(.*\)\.layout$%\1%'`
487            # Generate the proper TestDocClass command for this layout
488            sed -n '
489 # We manipulate only those lines that contain
490 # "\Declare(LaTeX|DocBook|LinuxDoc)Class"
491 /\\DeclareLaTeXClass/bmatch
492 /\\DeclareDocBookClass/bmatch
493 /\\DeclareLinuxDocClass/bmatch
494 b
495
496 :match
497 # Wrap the entire line (minus the leading "# ") inside a
498 # "\TestDocClass{CLASS}{...}" command
499 s/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/
500 # Print the result and quit.
501 p
502 q
503 ' "$file"
504          fi ;;
505     esac
506   done > chklayouts.tex
507   ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
508 changequote([,])dnl
509   [eval] `cat chkconfig.vars | sed 's/-/_/g'`
510 changequote(,)dnl
511   test -n "${rmcopy}" && rm -f chkconfig.ltx
512 fi
513
514 # Do we have all the files we need? Useful if latex did not run
515 changequote([,])dnl
516
517 PROVIDE_DEFAULT_FILE(chkconfig.sed,[s/@.*@/???/g])
518
519 echo "creating packages.lst"
520 PROVIDE_DEFAULT_FILE(packages.lst,dnl
521 [# This file should contain the list of LaTeX packages that have been
522 # recognized by LyX. Unfortunately, since configure could not find
523 # your LaTeX2e program, the tests have not been run. Run ./configure
524 # if you need to update it after a configuration change.
525 ])
526 changequote(,)dnl
527
528 echo "creating doc/LaTeXConfig.lyx"
529 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
530 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
531
532 if test `uname -s | grep 'MINGW'` ; then
533     # Before running chkconfig.sed, remove the trailing '\r'
534     # characters that can bugger up various versions of sed.
535     tr -d '\r' < chkconfig.sed > chkconfig2.sed
536     mv -f chkconfig2.sed chkconfig.sed
537 fi
538
539 sed -f chkconfig.sed "${srcdir}"/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
540
541 ### Let's check whether spaces are allowed in TeX file names
542 MSG_CHECKING(whether TeX allows spaces in file names)
543 if test ${lyx_check_config} = no ; then
544   tex_allows_spaces=false
545 else
546   fname="a b"
547   rm -f "$fname".tex
548   echo "\\message{working^^J}" >"$fname".tex
549   if ${LATEX} "$fname" </dev/null | grep 'working' >/dev/null ; then
550     MSG_RESULT(yes)
551     tex_allows_spaces=true
552   else
553     MSG_RESULT(no)
554     tex_allows_spaces=false
555   fi
556   rm -f "$fname".* texput.log
557 fi
558
559 echo "creating $outfile"
560 cat >$outfile <<EOF
561 # This file has been automatically generated by LyX' lib/configure
562 # script. It contains default settings that have been determined by
563 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
564 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
565 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
566 # override the values given here.
567 \\Format asciichess asc    "Plain text (chess output)"  "" ""   "$TEXT_EDITOR"
568 \\Format asciiimage asc    "Plain text (image)"         "" ""   "$TEXT_EDITOR"
569 \\Format asciixfig  asc    "Plain text (xfig output)"   "" ""   "$TEXT_EDITOR"
570 \\Format agr        agr     GRACE                  "" "$GRACE_VIEWER"   "$GRACE_EDITOR"
571 \\Format bmp        bmp     BMP                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
572 \\Format date       ""     "date command"          "" ""        ""
573 \\Format dateout    tmp    "date (output)"         "" ""        "$TEXT_EDITOR"
574 \\Format docbook    sgml    DocBook                B  ""        "$TEXT_EDITOR"
575 \\Format docbook-xml xml   "Docbook (xml)"         "" ""        "$TEXT_EDITOR"
576 \\Format dvi        dvi     DVI                    D  "$DVI_VIEWER"     ""
577 \\Format eps        eps     EPS                    "" "$EPS_VIEWER"     ""
578 \\Format fax        ""      Fax                    "" ""        ""
579 \\Format fen        fen     FEN                    "" "$FEN_VIEWER"     "$FEN_EDITOR"
580 \\Format fig        fig     XFig                   "" "$FIG_VIEWER"     "$FIG_EDITOR"
581 \\Format gif        gif     GIF                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
582 \\Format html       html    HTML                   H  "$HTML_VIEWER"    ""
583 \\Format jpg        jpg     JPG                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
584 \\Format latex      tex     LaTeX                  L  ""        "$TEXT_EDITOR"
585 \\Format linuxdoc   sgml    LinuxDoc               x  ""        "$TEXT_EDITOR"
586 \\Format lyx        lyx     LyX                    "" "lyx"     "lyx"
587 \\Format lyxpreview lyxpreview "LyX Preview"       "" ""        ""
588 \\Format literate   nw      NoWeb                  N  ""        "$TEXT_EDITOR"
589 \\Format pbm        pbm     PBM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
590 \\Format pdf        pdf    "PDF (ps2pdf)"          P  "$PDF_VIEWER"     ""
591 \\Format pdf2       pdf    "PDF (pdflatex)"        F  "$PDF_VIEWER"     ""
592 \\Format pdf3       pdf    "PDF (dvipdfm)"         m  "$PDF_VIEWER"     ""
593 \\Format pdftex     pdftex_t PDFTEX                "" ""        ""
594 \\Format pgm        pgm     PGM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
595 \\Format png        png     PNG                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
596 \\Format ppm        ppm     PPM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
597 \\Format program    ""      Program                "" ""        ""
598 \\Format ps         ps      Postscript             t  "$PS_VIEWER"      ""
599 \\Format pstex      pstex_t PSTEX                  "" ""        ""
600 \\Format tgif       obj     TGIF                   "" "$TGIF_VIEWER"    "$TGIF_EDITOR"
601 \\Format sxw        sxw    "OpenOffice.Org Writer" O  ""        ""
602 \\Format text       txt    "Plain text"            a  ""        "$TEXT_EDITOR"
603 \\Format textparagraph txt "Plain text (paragraphs)"    "" ""   "$TEXT_EDITOR"
604 \\Format tiff       tif     TIFF                   "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
605 \\Format word       doc     Word                   W  ""        ""
606 \\Format xbm        xbm     XBM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
607 \\Format xpm        xpm     XPM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
608
609 \\converter date       dateout    "date +%d-%m-%Y > \$\$o"      ""
610 \\converter docbook    docbook-xml "cp \$\$i \$\$o" "xml"
611 \\converter docbook    dvi        "$docbook_to_dvi_command"     ""
612 \\converter docbook    html       "$docbook_to_html_command"    ""
613 \\converter dvi        pdf3       "$dvi_to_pdf_command" ""
614 \\converter dvi        ps         "$dvi_to_ps_command"  ""
615 \\converter fen        asciichess "python \$\$s/scripts/fen2ascii.py \$\$i \$\$o"       ""
616 \\converter fig        pdftex     "sh \$\$s/scripts/fig2pdftex.sh \$\$i \$\$o"  ""
617 \\converter fig        pstex      "sh \$\$s/scripts/fig2pstex.sh \$\$i \$\$o"   ""
618 \\converter html       latex      "$html_to_latex_command"      ""
619 \\converter latex      html       "$latex_to_html_command"      "originaldir,needaux"
620 \\converter latex      dvi        "$latex_to_dvi"       "latex"
621 \\converter latex      lyx        "$tex_to_lyx_command" ""
622 \\converter latex      pdf2       "$latex_to_pdf"       "latex"
623 \\converter latex      sxw        "$latex_to_sxw_command"       "latex"
624 \\converter linuxdoc   dvi        "$linuxdoc_to_dvi_command"    ""
625 \\converter linuxdoc   html       "$linuxdoc_to_html_command"   ""
626 \\converter linuxdoc   latex      "$linuxdoc_to_latex_command"  ""
627 \\converter linuxdoc   lyx        "$linuxdoc_to_lyx_command"    ""
628 \\converter literate   latex      "$literate_to_tex_command"    ""
629 \\converter literate   lyx        "$literate_to_lyx_command"    ""
630 \\converter lyxpreview png        "$lyxpreview_to_png_command"  ""
631 \\converter lyxpreview ppm        "$lyxpreview_to_bitmap_command"       ""
632 \\converter ps         fax        "$fax_command"        ""
633 \\converter ps         pdf        "$ps_to_pdf_command"  ""
634 \\converter sxw        latex      "$sxw_to_latex_command"       ""
635 \\converter word       latex      "$word_to_latex_command"      ""
636 EOF
637
638 ### the graphic converter part with the predefined ones
639 #### Search for the nonstandard converting progs
640 #
641 SEARCH_PROG([for an FIG -> EPS/PPM converter], FIG2DEV, fig2dev)
642 if test "$FIG2DEV" = "fig2dev"; then
643 cat >>$outfile <<EOF
644 \\converter fig        eps        "fig2dev -L eps \$\$i \$\$o" ""
645 \\converter fig        ppm        "fig2dev -L ppm \$\$i \$\$o" ""
646 \\converter fig        png        "fig2dev -L png \$\$i \$\$o" ""
647 EOF
648 fi
649
650 SEARCH_PROG([for an TIFF -> PS converter], TIFF2PS, tiff2ps)
651 if test "$TIFF2PS" = "tiff2ps"; then
652 cat >>$outfile <<EOF
653 \\converter tiff       eps        "tiff2ps \$\$i > \$\$o" ""
654 EOF
655 fi
656
657 SEARCH_PROG([for an TGIF -> EPS/PPM converter], TGIF, tgif)
658 if test "$TGIF" = "tgif"; then
659 cat >>$outfile <<EOF
660 \\converter tgif       eps        "tgif -stdout -print -color -eps \$\$i > \$\$o" ""
661 \\converter tgif       pdf        "tgif -stdout -print -color -pdf \$\$i > \$\$o" ""
662 EOF
663 fi
664
665 SEARCH_PROG([for an EPS -> PDF converter], EPSTOPDF, epstopdf)
666 if test "$EPSTOPDF" = "epstopdf"; then
667 cat >>$outfile <<EOF
668 \\converter eps        pdf        "epstopdf --outfile=\$\$o \$\$i" ""
669 EOF
670 fi
671
672 #### Add Grace conversions (xmgrace needs an Xserver, gracebat doesn't.)
673 SEARCH_PROG([for a Grace -> Image converter], GRACE, gracebat)
674 if test "$GRACE" = "gracebat"; then
675 cat >>$outfile <<EOF
676 \\converter agr        eps        "gracebat -hardcopy -printfile \$\$o -hdevice EPS \$\$i 2>/dev/null" ""
677 \\converter agr        png        "gracebat -hardcopy -printfile \$\$o -hdevice PNG \$\$i 2>/dev/null" ""
678 \\converter agr        jpg        "gracebat -hardcopy -printfile \$\$o -hdevice JPEG \$\$i 2>/dev/null" ""
679 \\converter agr        ppm        "gracebat -hardcopy -printfile \$\$o -hdevice PNM \$\$i 2>/dev/null" ""
680 EOF
681 fi
682
683 cat >>$outfile <<EOF
684
685 \\copier    fig        "sh \$\$s/scripts/fig_copy.sh \$\$i \$\$o"
686 \\copier    pstex      "python \$\$s/scripts/tex_copy.py \$\$i \$\$o \$\$l"
687 \\copier    pdftex     "python \$\$s/scripts/tex_copy.py \$\$i \$\$o \$\$l"
688
689 $rc_entries
690 \\font_encoding "$chk_fontenc"
691 \\tex_allows_spaces $tex_allows_spaces
692 EOF
693
694 if [ "x$use_cygwin_path_fix" != "x" ]
695 then
696   echo "\\cygwin_path_fix_needed $use_cygwin_path_fix" >> $outfile
697 fi
698
699 # Remove superfluous files if we are not writing in the main lib
700 # directory
701 for file in $outfile textclass.lst packages.lst \
702             doc/LaTeXConfig.lyx  ; do
703   # we rename the file first, so that we avoid comparing a file with itself
704   mv $file $file.new
705   if test -r "${srcdir}"/$file && diff $file.new "${srcdir}"/$file >/dev/null 2>/dev/null ;
706   then
707     echo "removing $file, which is identical to the system global version"
708     rm -f $file.new
709   else
710     mv $file.new $file
711   fi
712 done
713
714 # Final clean-up
715 if test $lyx_keep_temps = no ; then
716 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \
717       missfont.log
718 fi