]> git.lyx.org Git - lyx.git/blob - lib/configure.m4
support tex4ht converter; polish/fix some comments
[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 an HTML -> LaTeX converter],html_to_latex_command, "html2latex \$\$i")
272
273 SEARCH_PROG([for an MS Word -> LaTeX converter],word_to_latex_command, "wvCleanLatex \$\$i \$\$o")
274
275 # tex4ht generates HTML output that is well-suited for MS Word
276 SEARCH_PROG([for a LaTeX -> MS Word converter],latex_to_word_command, "htlatex")
277 test "$latex_to_word_command" = "htlatex" && latex_to_word_command="htlatex \$\$i 'html,word' 'symbol/!' '-cvalidate'"
278
279
280
281 SEARCH_PROG([for Image converter],image_command, "convert \$\$i \$\$o")
282
283 SEARCH_PROG([for an OpenOffice.org -> LaTeX converter],sxw_to_latex_command, "w2l -clean \$\$i")
284
285 # oolatex is the original name, SuSE has oolatex.sh
286 SEARCH_PROG([for a LaTeX -> OpenOffice.org converter],latex_to_sxw_command, "oolatex \$\$i" "oolatex.sh \$\$i")
287
288 # Search something to preview postscript
289 SEARCH_PROG([for a Postscript previewer],PS_VIEWER,gsview32 gv "ghostview -swap" kghostview)
290 EPS_VIEWER=$PS_VIEWER
291
292 # Search for a program to preview pdf
293 SEARCH_PROG([for a PDF previewer],PDF_VIEWER, acrobat acrord32 gsview32 acroread gv ghostview xpdf kpdf kghostview)
294
295 # Search something to preview dvi
296 SEARCH_PROG([for a DVI previewer],DVI_VIEWER, xdvi windvi yap kdvi)
297
298 # Search something to preview html
299 SEARCH_PROG([for a HTML previewer],HTML_VIEWER, "mozilla file://\$\$p\$\$i" netscape)
300
301 # Search for a program to convert ps to pdf
302 SEARCH_PROG([for a PS to PDF converter],ps_to_pdf_command, "ps2pdf13 \$\$i")
303
304 # Search for a program to convert dvi to ps
305 SEARCH_PROG([for a DVI to PS converter],dvi_to_ps_command, "dvips -o \$\$o \$\$i")
306
307 # Search for a program to convert dvi to pdf
308 SEARCH_PROG([for a DVI to PDF converter],dvi_to_pdf_command, "dvipdfm \$\$i")
309
310 # We have a script to convert previewlyx to ppm or to png
311 lyxpreview_to_bitmap_command='python $$s/scripts/lyxpreview2bitmap.py'
312
313 # Search for 'dvipng'. Only enable the conversion from lyxpreview -> png
314 # if dvipng is found.
315 SEARCH_PROG([for dvipng],DVIPNG,dvipng)
316
317 test "$DVIPNG" = "dvipng" && \
318         lyxpreview_to_png_command=$lyxpreview_to_bitmap_command
319
320 # Search a *roff program (used to translate tables in ASCII export)
321 LYXRC_PROG([for a *roff formatter], \ascii_roff_command, dnl
322   "groff -t -Tlatin1 \$\$FName" nroff,dnl
323   test "$prog" = "nroff" && prog='tbl $$FName | nroff')
324
325 # Search the ChkTeX program
326 LYXRC_PROG([for ChkTeX], \chktex_command,dnl
327    "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38")
328
329 # Search for a spellchecker
330 LYXRC_PROG([for a spell-checker], \spell_command, ispell)
331
332 # Search for computer algebra systems
333 SEARCH_PROG([for Octave],OCTAVE,octave)
334 SEARCH_PROG([for Maple],MAPLE,maple)
335
336 dnl # Search a Fax handling program
337 dnl SEARCH_PROG([for a fax driver], FAX, sendfax faxsend fax)
338 dnl if test $FAX = sendfax ; then
339 dnl   fax_command="sendfax -n -h '\$\$Host' -c '\$\$Comment' -x '\$\$Enterprise' -d '\$\$Name'@'\$\$Phone' '\$\$FName'"
340 dnl elif test $FAX = faxsend ; then
341 dnl   fax_command="faxsend '\$\$Phone' '\$\$FName'"
342 dnl elif test $FAX = fax ; then
343 dnl   fax_command="fax send '\$\$Phone' '\$\$FName'"
344 dnl else
345 dnl   fax_command="none"
346 dnl fi
347
348 # Search a GUI Fax program
349 SEARCH_PROG([for a fax program], fax_command, "kdeprintfax \$\$i" "ksendfax \$\$i")
350
351 # Search for LinuxDoc support
352 SEARCH_PROG([for SGML-tools 1.x (LinuxDoc)], LINUXDOC, sgml2lyx)
353 if test $LINUXDOC != none; then
354   chk_linuxdoc=yes
355   bool_linuxdoc=true
356   linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
357 else
358   chk_linuxdoc=no
359   bool_linuxdoc=false
360 fi
361
362 case $LINUXDOC in
363   sgml2lyx)
364     linuxdoc_to_latex_command="sgml2latex \$\$i"
365     linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$i"
366     linuxdoc_to_html_command="sgml2html \$\$i"
367     linuxdoc_to_lyx_command="sgml2lyx \$\$i";;
368   none)
369     linuxdoc_to_latex_command="none"
370     linuxdoc_to_dvi_command="none"
371     linuxdoc_to_html_command="none"
372     linuxdoc_to_lyx_command="none";;
373 esac
374
375 # Search for DocBook support
376 SEARCH_PROG([for SGML-tools 2.x (DocBook) or db2x scripts], DOCBOOK, sgmltools db2dvi)
377 if test $DOCBOOK != none; then
378   chk_docbook=yes
379   bool_docbook=true
380   docbook_cmd="\\def\\hasdocbook{yes}"
381 else
382   chk_docbook=no
383   bool_docbook=false
384 fi
385
386 case $DOCBOOK in
387   sgmltools)
388     docbook_to_dvi_command="sgmltools -b dvi \$\$i"
389     docbook_to_html_command="sgmltools -b html \$\$i";;
390   db2dvi)
391     docbook_to_dvi_command="db2dvi \$\$i"
392     docbook_to_html_command="db2html \$\$i";;
393   none)
394     docbook_to_dvi_command="none"
395     docbook_to_html_command="none";;
396 esac
397
398 # Search for a spool command
399 LYXRC_PROG([for a spool command], \print_spool_command, lp lpr)
400 case $prog in
401   lp) print_spool_printerprefix="-d ";;
402  lpr) print_spool_printerprefix="-P";;
403    *) :;; # leave to empty values
404 esac
405 LYXRC_VAR(\print_spool_printerprefix, $print_spool_printerprefix)
406
407 SEARCH_PROG([for a LaTeX -> HTML converter], latex_to_html_command,dnl
408  "htlatex \$\$i" dnl
409  "tth -t -e2 -L\$\$b < \$\$i > \$\$o" dnl
410  "latex2html -no_subdir -split 0 -show_section_numbers \$\$i" dnl
411  "hevea -s \$\$i")
412
413 #### Explore the LaTeX configuration
414 MSG_CHECKING(LaTeX configuration)
415 # First, remove the files that we want to re-create
416 rm -f textclass.lst packages.lst chkconfig.sed
417 if test ${lyx_check_config} = no ; then
418   MSG_RESULT(default values)
419   MSG_CHECKING(list of textclasses,+)
420   cat >textclass.lst <<EOF
421 # This file declares layouts and their associated definition files
422 # (include dir. relative to the place where this file is).
423 # It contains only default values, since chkconfig.ltx could not be run
424 # for some reason. Run ./configure if you need to update it after a
425 # configuration change.
426 EOF
427   # build the list of available layout files and convert it to entries
428   # for the default textclass.lst file
429   for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
430     case $file in
431       */\*.layout) ;;
432       *) if test -r "$file" ; then
433            class=`echo $file | sed -e 's%^.*layouts/\(.*\)\.layout$%\1%'`
434            cleanclass=`echo $class | tr ' -' '__'`
435 changequote([,])dnl
436            # make sure the same class is not considered twice
437            if test  x`[eval] echo $ac_n '${found_'$cleanclass'}'` = x ; then
438              [eval] "found_$cleanclass=yes"
439 changequote(,)dnl
440              sed -n '
441 # We manipulate only those lines that contain
442 # "\Declare(LaTeX|DocBook|LinuxDoc)Class"
443 /\\DeclareLaTeXClass/bmatch
444 /\\DeclareDocBookClass/bmatch
445 /\\DeclareLinuxDocClass/bmatch
446 b
447
448 :match
449 # Remove the \DeclareFOOClass macro and add the correct boolean
450 # at the end of the line telling whether the class is
451 # available
452 s/^.*\DeclareLaTeXClass *\(.*\)/\1 "false"/
453 s/^.*\DeclareDocBookClass *\(.*\)/\1 "'$bool_docbook'"/
454 s/^.*\DeclareLinuxDocClass *\(.*\)/\1 "'$bool_linuxdoc'"/
455 # If the macro had an optional argument with several
456 # parameters, only keep the first one
457 s/\[\([^,]*\),[^]]*\]/[\1]/
458 # If the macro did not have an optional argument, provide one
459 # (equal to the class name)
460 s/^{/['$class']{/
461 # Remove brackets and replace with correctly quoted entries
462 s/\[\([^]]*\)\] *{\([^}]*\)}/"'$class'" "\1" "\2"/
463 # Print the maninpulated text
464 p
465 # We are interested in the first instance of \DeclareFOOClass only,
466 # so now quit
467 q
468 ' "$file" >> textclass.lst
469            fi
470          fi ;;
471     esac
472   done
473   MSG_RESULT(done)
474 else
475   MSG_RESULT(auto)
476   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
477   if test ! -r "chkconfig.ltx" ; then
478     cp "${srcdir}"/chkconfig.ltx .
479     rmcopy=true
480   fi
481   cat >wrap_chkconfig.ltx <<EOF
482 ${linuxdoc_cmd}
483 ${docbook_cmd}
484 \\input{chkconfig.ltx}
485 EOF
486   ## Construct the list of classes to test for.
487   # build the list of available layout files and convert it to commands
488   # for chkconfig.ltx
489   for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
490     case $file in
491       */\*.layout) ;;
492       *) if test -r "$file" ; then
493            class=`echo $file | sed -e 's%^.*layouts/\(.*\)\.layout$%\1%'`
494            # Generate the proper TestDocClass command for this layout
495            sed -n '
496 # We manipulate only those lines that contain
497 # "\Declare(LaTeX|DocBook|LinuxDoc)Class"
498 /\\DeclareLaTeXClass/bmatch
499 /\\DeclareDocBookClass/bmatch
500 /\\DeclareLinuxDocClass/bmatch
501 b
502
503 :match
504 # Wrap the entire line (minus the leading "# ") inside a
505 # "\TestDocClass{CLASS}{...}" command
506 s/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/
507 # Print the result and quit.
508 p
509 q
510 ' "$file"
511          fi ;;
512     esac
513   done > chklayouts.tex
514   ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
515 changequote([,])dnl
516   [eval] `cat chkconfig.vars | sed 's/-/_/g'`
517 changequote(,)dnl
518   test -n "${rmcopy}" && rm -f chkconfig.ltx
519 fi
520
521 # Do we have all the files we need? Useful if latex did not run
522 changequote([,])dnl
523
524 PROVIDE_DEFAULT_FILE(chkconfig.sed,[s/@.*@/???/g])
525
526 echo "creating packages.lst"
527 PROVIDE_DEFAULT_FILE(packages.lst,dnl
528 [# This file should contain the list of LaTeX packages that have been
529 # recognized by LyX. Unfortunately, since configure could not find
530 # your LaTeX2e program, the tests have not been run. Run ./configure
531 # if you need to update it after a configuration change.
532 ])
533 changequote(,)dnl
534
535 echo "creating doc/LaTeXConfig.lyx"
536 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
537 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
538
539 if test `uname -s | grep 'MINGW'` ; then
540     # Before running chkconfig.sed, remove the trailing '\r'
541     # characters that can bugger up various versions of sed.
542     tr -d '\r' < chkconfig.sed > chkconfig2.sed
543     mv -f chkconfig2.sed chkconfig.sed
544 fi
545
546 sed -f chkconfig.sed "${srcdir}"/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
547
548 ### Let's check whether spaces are allowed in TeX file names
549 MSG_CHECKING(whether TeX allows spaces in file names)
550 if test ${lyx_check_config} = no ; then
551   tex_allows_spaces=false
552 else
553   fname="a b"
554   rm -f "$fname".tex
555   echo "\\message{working^^J}" >"$fname".tex
556   if ${LATEX} "$fname" </dev/null | grep 'working' >/dev/null ; then
557     MSG_RESULT(yes)
558     tex_allows_spaces=true
559   else
560     MSG_RESULT(no)
561     tex_allows_spaces=false
562   fi
563   rm -f "$fname".* texput.log
564 fi
565
566 echo "creating $outfile"
567 cat >$outfile <<EOF
568 # This file has been automatically generated by LyX' lib/configure
569 # script. It contains default settings that have been determined by
570 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
571 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
572 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
573 # override the values given here.
574 \\Format asciichess asc    "Plain text (chess output)"  "" ""   "$TEXT_EDITOR"
575 \\Format asciiimage asc    "Plain text (image)"         "" ""   "$TEXT_EDITOR"
576 \\Format asciixfig  asc    "Plain text (Xfig output)"   "" ""   "$TEXT_EDITOR"
577 \\Format agr        agr     Grace                  "" "$GRACE_VIEWER"   "$GRACE_EDITOR"
578 \\Format bmp        bmp     BMP                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
579 \\Format date       ""     "date command"          "" ""        ""
580 \\Format dateout    tmp    "date (output)"         "" ""        "$TEXT_EDITOR"
581 \\Format docbook    sgml    DocBook                B  ""        "$TEXT_EDITOR"
582 \\Format docbook-xml xml   "Docbook (XML)"         "" ""        "$TEXT_EDITOR"
583 \\Format dvi        dvi     DVI                    D  "$DVI_VIEWER"     ""
584 \\Format eps        eps     EPS                    "" "$EPS_VIEWER"     ""
585 \\Format fax        ""      Fax                    "" ""        ""
586 \\Format fen        fen     FEN                    "" "$FEN_VIEWER"     "$FEN_EDITOR"
587 \\Format fig        fig     FIG                    "" "$FIG_VIEWER"     "$FIG_EDITOR"
588 \\Format gif        gif     GIF                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
589 \\Format html       html    HTML                   H  "$HTML_VIEWER"    ""
590 \\Format jpg        jpg     JPEG                   "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
591 \\Format latex      tex     LaTeX                  L  ""        "$TEXT_EDITOR"
592 \\Format linuxdoc   sgml    LinuxDoc               x  ""        "$TEXT_EDITOR"
593 \\Format lyx        lyx     LyX                    "" "lyx"     "lyx"
594 \\Format lyxpreview lyxpreview "LyX Preview"       "" ""        ""
595 \\Format literate   nw      NoWeb                  N  ""        "$TEXT_EDITOR"
596 \\Format pbm        pbm     PBM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
597 \\Format pdf        pdf    "PDF (ps2pdf)"          P  "$PDF_VIEWER"     ""
598 \\Format pdf2       pdf    "PDF (pdflatex)"        F  "$PDF_VIEWER"     ""
599 \\Format pdf3       pdf    "PDF (dvipdfm)"         m  "$PDF_VIEWER"     ""
600 \\Format pdftex     pdftex_t PDFTEX                "" ""        ""
601 \\Format pgm        pgm     PGM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
602 \\Format png        png     PNG                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
603 \\Format ppm        ppm     PPM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
604 \\Format program    ""      Program                "" ""        ""
605 \\Format ps         ps      Postscript             t  "$PS_VIEWER"      ""
606 \\Format pstex      pstex_t PSTEX                  "" ""        ""
607 \\Format tgif       obj     Tgif                   "" "$TGIF_VIEWER"    "$TGIF_EDITOR"
608 \\Format sxw        sxw    "OpenOffice.Org Writer" O  ""        ""
609 \\Format text       txt    "Plain text"            a  ""        "$TEXT_EDITOR"
610 \\Format textparagraph txt "Plain text (paragraphs)"    "" ""   "$TEXT_EDITOR"
611 \\Format tiff       tif     TIFF                   "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
612 \\Format word       doc    "MS Word"               W  ""        ""
613 \\Format wordhtml   html   "MS Word (HTML)"        "" ""        ""
614 \\Format xbm        xbm     XBM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
615 \\Format xpm        xpm     XPM                    "" "$RASTERIMAGE_VIEWER"     "$RASTERIMAGE_EDITOR"
616
617 \\converter date       dateout    "date +%d-%m-%Y > \$\$o"      ""
618 \\converter docbook    docbook-xml "cp \$\$i \$\$o" "xml"
619 \\converter docbook    dvi        "$docbook_to_dvi_command"     ""
620 \\converter docbook    html       "$docbook_to_html_command"    ""
621 \\converter dvi        pdf3       "$dvi_to_pdf_command" ""
622 \\converter dvi        ps         "$dvi_to_ps_command"  ""
623 \\converter fen        asciichess "python \$\$s/scripts/fen2ascii.py \$\$i \$\$o"       ""
624 \\converter fig        pdftex     "sh \$\$s/scripts/fig2pdftex.sh \$\$i \$\$o"  ""
625 \\converter fig        pstex      "sh \$\$s/scripts/fig2pstex.sh \$\$i \$\$o"   ""
626 \\converter html       latex      "$html_to_latex_command"      ""
627 \\converter latex      html       "$latex_to_html_command"      "originaldir,needaux"
628 \\converter latex      dvi        "$latex_to_dvi"       "latex"
629 \\converter latex      lyx        "$tex_to_lyx_command" ""
630 \\converter latex      pdf2       "$latex_to_pdf"       "latex"
631 \\converter latex      sxw        "$latex_to_sxw_command"       "latex"
632 \\converter latex      wordhtml   "$latex_to_word_command"       ""
633 \\converter linuxdoc   dvi        "$linuxdoc_to_dvi_command"    ""
634 \\converter linuxdoc   html       "$linuxdoc_to_html_command"   ""
635 \\converter linuxdoc   latex      "$linuxdoc_to_latex_command"  ""
636 \\converter linuxdoc   lyx        "$linuxdoc_to_lyx_command"    ""
637 \\converter literate   latex      "$literate_to_tex_command"    ""
638 \\converter literate   lyx        "$literate_to_lyx_command"    ""
639 \\converter lyxpreview png        "$lyxpreview_to_png_command"  ""
640 \\converter lyxpreview ppm        "$lyxpreview_to_bitmap_command"       ""
641 \\converter ps         fax        "$fax_command"        ""
642 \\converter ps         pdf        "$ps_to_pdf_command"  ""
643 \\converter sxw        latex      "$sxw_to_latex_command"       ""
644 \\converter word       latex      "$word_to_latex_command"      ""
645 EOF
646
647 ### the graphic converter part with the predefined ones
648 #### Search for the nonstandard converting progs
649 #
650 SEARCH_PROG([for a FIG -> EPS/PPM/PNG converter], FIG2DEV, fig2dev)
651 if test "$FIG2DEV" = "fig2dev"; then
652 cat >>$outfile <<EOF
653 \\converter fig        eps        "fig2dev -L eps \$\$i \$\$o" ""
654 \\converter fig        ppm        "fig2dev -L ppm \$\$i \$\$o" ""
655 \\converter fig        png        "fig2dev -L png \$\$i \$\$o" ""
656 EOF
657 fi
658
659 SEARCH_PROG([for a TIFF -> PS converter], TIFF2PS, tiff2ps)
660 if test "$TIFF2PS" = "tiff2ps"; then
661 cat >>$outfile <<EOF
662 \\converter tiff       eps        "tiff2ps \$\$i > \$\$o" ""
663 EOF
664 fi
665
666 SEARCH_PROG([for a Tgif -> EPS/PDF converter], TGIF, tgif)
667 if test "$TGIF" = "tgif"; then
668 cat >>$outfile <<EOF
669 \\converter tgif       eps        "tgif -stdout -print -color -eps \$\$i > \$\$o" ""
670 \\converter tgif       pdf        "tgif -stdout -print -color -pdf \$\$i > \$\$o" ""
671 EOF
672 fi
673
674 SEARCH_PROG([for an EPS -> PDF converter], EPSTOPDF, epstopdf)
675 if test "$EPSTOPDF" = "epstopdf"; then
676 cat >>$outfile <<EOF
677 \\converter eps        pdf        "epstopdf --outfile=\$\$o \$\$i" ""
678 EOF
679 fi
680
681 #### Add Grace conversions (xmgrace needs an Xserver, gracebat doesn't.)
682 SEARCH_PROG([for a Grace -> Image converter], GRACE, gracebat)
683 if test "$GRACE" = "gracebat"; then
684 cat >>$outfile <<EOF
685 \\converter agr        eps        "gracebat -hardcopy -printfile \$\$o -hdevice EPS \$\$i 2>/dev/null" ""
686 \\converter agr        png        "gracebat -hardcopy -printfile \$\$o -hdevice PNG \$\$i 2>/dev/null" ""
687 \\converter agr        jpg        "gracebat -hardcopy -printfile \$\$o -hdevice JPEG \$\$i 2>/dev/null" ""
688 \\converter agr        ppm        "gracebat -hardcopy -printfile \$\$o -hdevice PNM \$\$i 2>/dev/null" ""
689 EOF
690 fi
691
692 cat >>$outfile <<EOF
693
694 \\copier    fig        "sh \$\$s/scripts/fig_copy.sh \$\$i \$\$o"
695 \\copier    pstex      "python \$\$s/scripts/tex_copy.py \$\$i \$\$o \$\$l"
696 \\copier    pdftex     "python \$\$s/scripts/tex_copy.py \$\$i \$\$o \$\$l"
697
698 $rc_entries
699 \\font_encoding "$chk_fontenc"
700 \\tex_allows_spaces $tex_allows_spaces
701 EOF
702
703 if [ "x$use_cygwin_path_fix" != "x" ]
704 then
705   echo "\\cygwin_path_fix_needed $use_cygwin_path_fix" >> $outfile
706 fi
707
708 # Remove superfluous files if we are not writing in the main lib
709 # directory
710 for file in $outfile textclass.lst packages.lst \
711             doc/LaTeXConfig.lyx  ; do
712   # we rename the file first, so that we avoid comparing a file with itself
713   mv $file $file.new
714   if test -r "${srcdir}"/$file && diff $file.new "${srcdir}"/$file >/dev/null 2>/dev/null ;
715   then
716     echo "removing $file, which is identical to the system global version"
717     rm -f $file.new
718   else
719     mv $file.new $file
720   fi
721 done
722
723 # Final clean-up
724 if test $lyx_keep_temps = no ; then
725 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \
726       missfont.log
727 fi