]> git.lyx.org Git - lyx.git/blob - lib/configure.m4
Prevent changing of non-tabular lines.
[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(($3))
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   for ac_dir in $PATH; do
42     test -z "$ac_dir" && ac_dir=.
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
50   if test -n "[$]$2"; then
51     ac_result=yes
52     ifelse($4,,,[$4])
53   else
54     ac_result=no
55   fi
56   MSG_RESULT($ac_result)
57   test -n "[$]$2" && break
58 fi
59 done
60
61 if test -z "[$]$2" ; then
62   $2=none
63 ifelse($5,,,[  $5
64 ])dnl
65 fi
66 changequote(,)dnl
67 ])dnl
68 dnl
69 dnl
70 dnl LYXRC_VAR(VARIABLE_NAME, VALUE)
71 define(LYXRC_VAR,[dnl
72 rc_entries="$rc_entries
73 $1 \"$2\""])
74 dnl
75 dnl
76 dnl LYXRC_PROG(FEATURE-DESCRIPTION,VARIABLE-NAME,PROGRAMS-LIST,
77 dnl             ACTION-IF-FOUND,ACTION-IF-NOT-FOUND)
78 define(LYXRC_PROG,[dnl
79 SEARCH_PROG($1,prog,$3,$4,$5)
80 LYXRC_VAR($2,$prog)])
81 dnl
82 dnl
83 dnl PROVIDE_DEFAULT_FILE(FILE, DEFAULT-VALUE)
84 dnl
85 define(PROVIDE_DEFAULT_FILE,[dnl
86 # if $1 does not exist (because LaTeX did not run),
87 # then provide a standard version.
88 if test ! -f $1 ; then
89   cat >$1 <<EOF
90 $2
91 EOF
92 fi])
93 changequote(,)dnl
94 dnl ######### End M4 macros #############################################
95
96
97 ####some configuration variables
98 outfile=lyxrc.defaults
99 rc_entries=
100 lyx_check_config=yes
101 lyx_keep_temps=no
102 srcdir=
103 version_suffix=
104
105 #### Parse the command line
106 for ac_option do
107   case "$ac_option" in
108     -help | --help | -h)
109       cat << EOF
110 Usage: configure [options]
111 Options:
112   --help                   show this help lines
113   --keep-temps             keep temporary files (for debug. purposes)
114   --without-latex-config   do not run LaTeX to determine configuration
115   --with-version-suffix=suffix suffix of binary installed files
116 EOF
117       exit 0;;
118     --without-latex-config)
119       lyx_check_config=no ;;
120     --keep-temps)
121       lyx_keep_temps=yes ;;
122     --with-version-suffix*)
123       version_suffix=`echo "$ac_option" | sed 's,--with-version-suffix=,,'`
124   esac
125 done
126
127
128 #### Checking for some echo oddities
129 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
130   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
131   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
132     ac_n= ac_c='
133 ' ac_t='        '
134   else
135     ac_n=-n ac_c= ac_t=
136   fi
137 else
138   ac_n= ac_c='\c' ac_t=
139 fi
140
141
142 #### I do not really know why this is useful, but we might as well keep it.
143 # NLS nuisances.
144 # Only set these to C if already set.  These must not be set unconditionally
145 # because not all systems understand e.g. LANG=C (notably SCO).
146 # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
147 # Non-C LC_CTYPE values break the ctype check.
148 if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
149 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
150 if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
151 if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
152
153
154 #### Guess the directory in which configure is located.
155 changequote([,])dnl
156 ac_prog=[$]0
157 changequote(,)dnl
158 srcdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
159 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
160 test "x$srcdir" = "x$ac_prog" && srcdir=.
161 if test ! -r ${srcdir}/chkconfig.ltx ; then
162   echo "configure: error: cannot find chkconfig.ltx script"
163   exit 1
164 fi
165
166 #### Adjust PATH for Win32 (Cygwin)
167 case `uname -s` in
168    CYGWIN*)
169      echo "configure: cygwin detected; path correction"
170      srcdir=`cygpath -w "${srcdir}" | tr '\\\\' /`
171      echo "srcdir=${srcdir}" ;;
172 esac
173
174 #### Create the build directories if necessary
175 for dir in bind clipart doc examples help images kbd layouts reLyX \
176     scripts templates ui xfonts; do
177   test ! -d $dir && mkdir $dir
178 done
179
180
181 #### Searching some useful programs
182 define(CHECKLATEX2E,[
183 ## Check whether this is really LaTeX2e
184 rm -f chklatex.ltx
185 cat >chklatex.ltx <<EOF
186 \\nonstopmode\\makeatletter
187 \\ifx\\undefined\\documentclass\\else
188   \\message{ThisIsLaTeX2e}
189 \\fi
190 \\@@end
191 EOF
192 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
193                        | grep 'ThisIsLaTeX2e' >/dev/null; then
194   :
195 else
196   LATEX=
197   ac_result="not useable"
198 fi
199 rm -f chklatex.ltx chklatex.log])dnl
200 dnl
201 # Search LaTeX2e
202 SEARCH_PROG([for a LaTeX2e program],LATEX,latex latex2e,CHECKLATEX2E,dnl
203   [lyx_check_config=no])
204 latex_to_dvi=$LATEX
205 test -z "$latex_to_dvi" && latex_to_dvi="none"
206
207 # Search for pdflatex
208 if test ${lyx_check_config} = no ; then
209   latex_to_pdf=none
210 else
211   SEARCH_PROG([for the pdflatex program],latex_to_pdf,pdflatex)
212 fi
213
214 test $latex_to_dvi != "none" && latex_to_dvi="$latex_to_dvi \$\$i"
215 test $latex_to_pdf != "none" && latex_to_pdf="$latex_to_pdf \$\$i"
216
217 # Search for an installed reLyX or a ready-to-install one
218 save_PATH=${PATH}
219 PATH=${PATH}:./reLyX/
220 SEARCH_PROG([for a LaTeX -> LyX converter],tex_to_lyx_command,reLyX)
221 PATH=${save_PATH}
222 test $tex_to_lyx_command = "reLyX" && tex_to_lyx_command="reLyX -f \$\$i"
223 tex_to_lyx_command=`echo $tex_to_lyx_command | sed "s,reLyX,reLyX$version_suffix,"`
224
225 SEARCH_PROG([for a Noweb -> LyX converter],literate_to_lyx_command,noweb2lyx)
226 test $literate_to_lyx_command = "noweb2lyx" && literate_to_lyx_command="noweb2lyx \$\$i \$\$o"
227 literate_to_lyx_command=`echo $literate_to_lyx_command | sed "s,noweb2lyx,noweb2lyx$version_suffix,"`
228
229 # Search something to process a literate document
230 SEARCH_PROG([for a Noweb -> LaTeX converter],literate_to_tex_command,noweave)
231 test $literate_to_tex_command = "noweave" && literate_to_tex_command="noweave -delay -index \$\$i > \$\$o"
232
233 SEARCH_PROG([for a HTML -> Latex converter],html_to_latex_command,html2latex)
234 test $html_to_latex_command = "html2latex" && html_to_latex_command="html2latex \$\$i"
235
236 SEARCH_PROG([for a MSWord -> Latex converter],word_to_latex_command,wvCleanLatex word2x)
237 test "$word_to_latex_command" = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$i \$\$o"
238 test "$word_to_latex_command" = "word2x" && word_to_latex_command="word2x -f latex \$\$i"
239
240 SEARCH_PROG([for Image converter],image_command,convert)
241 test $image_command = "convert" && image_command="convert \$\$i \$\$o"
242
243 # Search for a Postscript interpreter
244 LYXRC_PROG([for a Postscript interpreter], \ps_command, gs)
245
246 # Search something to preview postscript
247 SEARCH_PROG([for a Postscript previewer],GHOSTVIEW,gv ghostview)
248
249 # Search for a program to preview pdf
250 SEARCH_PROG([for a PDF preview],PDF_VIEWER,acroread gv ghostview xpdf)
251
252 # Search something to preview dvi
253 SEARCH_PROG([for a DVI previewer],DVI_VIEWER, xdvi windvi yap)
254
255 # Search something to preview html
256 SEARCH_PROG([for a HTML previewer],HTML_VIEWER, netscape)
257
258 # Search for a program to preview latex code
259 SEARCH_PROG([for a LaTeX preview],LATEX_VIEWER, "xterm -e less")
260
261 # Search for a program to convert ps to pdf
262 SEARCH_PROG([for a PS to PDF converter],ps_to_pdf_command,ps2pdf)
263 test $ps_to_pdf_command = "ps2pdf" && ps_to_pdf_command="ps2pdf \$\$i"
264
265 # Search for a program to convert dvi to ps
266 SEARCH_PROG([for a DVI to PS converter],dvi_to_ps_command,dvips)
267 test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$o \$\$i"
268
269 # Search for a program to convert dvi to pdf
270 SEARCH_PROG([for a DVI to PDF converter],dvi_to_pdf_command,dvipdfm)
271 test $dvi_to_pdf_command = "dvipdfm" && dvi_to_pdf_command="dvipdfm \$\$i"
272
273 # We have a script to convert previewlyx to ppm
274 lyxpreview_to_ppm_command="lyxpreview2ppm.sh"
275
276 # Search a *roff program (used to translate tables in ASCII export)
277 LYXRC_PROG([for a *roff formatter], \ascii_roff_command, dnl
278   'groff -t -Tlatin1 $$FName' nroff,dnl
279   test "$prog" = "nroff" && prog='tbl $$FName | nroff')
280
281 # Search the ChkTeX program
282 LYXRC_PROG([for ChkTeX], \chktex_command,dnl
283    "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38")
284
285 # Search for a spellchecker
286 LYXRC_PROG([for a spell-checker], \spell_command, ispell)
287
288 # Search for computer algebra systems
289 SEARCH_PROG([for Octave],OCTAVE,octave)
290 SEARCH_PROG([for Maple],MAPLE,maple)
291
292 dnl # Search a Fax handling program
293 dnl SEARCH_PROG([for a fax driver], FAX, sendfax faxsend fax)
294 dnl if test $FAX = sendfax ; then
295 dnl   fax_command="sendfax -n -h '\$\$Host' -c '\$\$Comment' -x '\$\$Enterprise' -d '\$\$Name'@'\$\$Phone' '\$\$FName'"
296 dnl elif test $FAX = faxsend ; then
297 dnl   fax_command="faxsend '\$\$Phone' '\$\$FName'"
298 dnl elif test $FAX = fax ; then
299 dnl   fax_command="fax send '\$\$Phone' '\$\$FName'"
300 dnl else
301 dnl   fax_command="none"
302 dnl fi
303
304 # Search a GUI Fax program
305 SEARCH_PROG([for a fax program], fax_command, ksendfax)
306 test $fax_command = "ksendfax" && fax_command="ksendfax \$\$i"
307
308 # Search for LinuxDoc support
309 SEARCH_PROG([for SGML-tools 1.x (LinuxDoc)], LINUXDOC, sgml2lyx)
310 chk_linuxdoc=no
311 if test $LINUXDOC != none; then
312   chk_linuxdoc=yes
313   linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
314 fi
315
316 case $LINUXDOC in
317   sgml2lyx)
318     linuxdoc_to_latex_command="sgml2latex \$\$i"
319     linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$i"
320     linuxdoc_to_html_command="sgml2html \$\$i"
321     linuxdoc_to_lyx_command="sgml2lyx \$\$i";;
322   none)
323     linuxdoc_to_latex_command="none"
324     linuxdoc_to_dvi_command="none"
325     linuxdoc_to_html_command="none"
326     linuxdoc_to_lyx_command="none";;
327 esac
328
329 # Search for DocBook support
330 SEARCH_PROG([for SGML-tools 2.x (DocBook) or db2x scripts], DOCBOOK, sgmltools db2dvi)
331 chk_docbook=no
332 if test $DOCBOOK != none; then
333   chk_docbook=yes
334   docbook_cmd="\\def\\hasdocbook{yes}"
335 fi
336
337 case $DOCBOOK in
338   sgmltools)
339     docbook_to_dvi_command="sgmltools -b dvi \$\$i"
340     docbook_to_html_command="sgmltools -b html \$\$i";;
341   db2dvi)
342     docbook_to_dvi_command="db2dvi \$\$i"
343     docbook_to_html_command="db2html \$\$i";;
344   none)
345     docbook_to_dvi_command="none"
346     docbook_to_html_command="none";;
347 esac
348
349 # Search for a spool command
350 LYXRC_PROG([for a spool command], \print_spool_command, lp lpr)
351 case $prog in
352   lp) print_spool_printerprefix="-d ";;
353  lpr) print_spool_printerprefix="-P";;
354    *) :;; # leave to empty values
355 esac
356 LYXRC_VAR(\print_spool_printerprefix, $print_spool_printerprefix)
357
358 SEARCH_PROG([for a LaTeX -> HTML converter], TOHTML, tth latex2html hevea)
359 latex_to_html_command=$TOHTML
360 case $TOHTML in
361         tth) latex_to_html_command="tth -t -e2 -L\$\$b < \$\$i > \$\$o";;
362  latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$i";;
363       hevea) latex_to_html_command="hevea -s \$\$i";;
364 esac
365
366 #### Explore the LaTeX configuration
367 MSG_CHECKING(LaTeX configuration)
368 # First, remove the files that we want to re-create
369 rm -f textclass.lst packages.lst chkconfig.sed
370 if test ${lyx_check_config} = no ; then
371   MSG_RESULT(default values)
372 else
373   MSG_RESULT(auto)
374   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
375   cat >wrap_chkconfig.ltx <<EOF
376 \\newcommand\\srcdir{${srcdir}}
377 ${linuxdoc_cmd}
378 ${docbook_cmd}
379 \\input{${srcdir}/chkconfig.ltx}
380 EOF
381   ## Construct the list of classes to test for.
382   # build the list of available layout files and convert it to commands
383   # for chkconfig.ltx
384   for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
385     case $file in
386       */\*.layout) ;;
387       *) test -r "$file" && echo $file ;;
388     esac
389   done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
390              > chklayouts.tex
391 changequote([,])dnl
392   [eval] ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
393   [eval] `cat chkconfig.vars | sed 's/-/_/g'`
394 changequote(,)dnl
395 fi
396
397 # Do we have all the files we need? Useful if latex did not run
398 changequote([,])dnl
399 echo "creating textclass.lst"
400 PROVIDE_DEFAULT_FILE(textclass.lst,dnl
401 [# This file declares layouts and their associated definition files
402 # (include dir. relative to the place where this file is).
403 # It contains only default values, since chkconfig.ltx could not be run
404 # for some reason. Run ./configure if you need to update it after a
405 # configuration change.
406 article article article
407 report  report  report
408 book    book    book
409 linuxdoc        linuxdoc        linuxdoc
410 letter  letter  letter])
411
412 PROVIDE_DEFAULT_FILE(chkconfig.sed,[s/@.*@/???/g])
413
414 echo "creating packages.lst"
415 PROVIDE_DEFAULT_FILE(packages.lst,dnl
416 [# This file should contain the list of LaTeX packages that have been
417 # recognized by LyX. Unfortunately, since configure could not find
418 # your LaTeX2e program, the tests have not been run. Run ./configure
419 # if you need to update it after a configuration change.
420 ])
421 changequote(,)dnl
422
423 echo "creating doc/LaTeXConfig.lyx"
424 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
425 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
426 sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
427
428 echo "creating $outfile"
429 cat >$outfile <<EOF
430 # This file has been automatically generated by LyX' lib/configure
431 # script. It contains default settings that have been determined by
432 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
433 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
434 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
435 # override the values given here.
436 \\Format text     txt   ASCII           A
437 \\Format textparagraph txt ASCII(paragraphs)    ""
438 \\Format docbook  sgml  DocBook         B
439 \\Format bmp      bmp   BMP             ""
440 \\Format dvi      dvi   DVI             D
441 \\Format eps      eps   EPS             ""
442 \\Format epsi     epsi  EPSI            ""
443 \\Format fax      ""    Fax             ""
444 \\Format fig      fig   XFig            ""
445 \\Format agr      agr   GRACE           ""
446 \\Format html     html  HTML            H
447 \\Format latex    tex   LaTeX           L
448 \\Format linuxdoc sgml  LinuxDoc        x
449 \\Format lyx      lyx   LyX             ""
450 \\Format literate nw    NoWeb           N
451 \\Format pdf      pdf   PDF             P
452 \\Format pdf2     pdf  "PDF (pdflatex)" F
453 \\Format pdf3     pdf  "PDF (dvipdfm)"  m
454 \\Format png      png   PNG             ""
455 \\Format ppm      ppm   PPM             ""
456 \\Format ps       ps    Postscript      t
457 \\Format program  ""    Program         ""
458 \\Format tgif     obj   TGIF            ""
459 \\Format tiff     tif   TIFF            ""
460 \\Format word     doc   Word            W
461 \\Format xpm      xpm   XPM             ""
462 \\Format lyxpreview     lyxpreview      "LyX Preview"           ""
463
464 \\converter latex dvi "$latex_to_dvi" "latex"
465 \\converter latex pdf2 "$latex_to_pdf" "latex"
466 \\converter latex html "$latex_to_html_command" "originaldir,needaux"
467 \\converter literate latex "$literate_to_tex_command" ""
468 \\converter dvi pdf3 "$dvi_to_pdf_command" ""
469 \\converter dvi ps "$dvi_to_ps_command" ""
470 \\converter ps pdf "$ps_to_pdf_command" ""
471 \\converter ps fax "$fax_command" ""
472 \\converter linuxdoc lyx "$linuxdoc_to_lyx_command" ""
473 \\converter linuxdoc latex "$linuxdoc_to_latex_command" ""
474 \\converter linuxdoc dvi "$linuxdoc_to_dvi_command" ""
475 \\converter linuxdoc html "$linuxdoc_to_html_command" ""
476 \\converter docbook dvi "$docbook_to_dvi_command" ""
477 \\converter docbook html "$docbook_to_html_command" ""
478 \\converter lyxpreview ppm "$lyxpreview_to_ppm_command" ""
479
480 \\converter latex lyx "$tex_to_lyx_command" ""
481 \\converter literate lyx "$literate_to_lyx_command" ""
482 \\converter html latex "$html_to_latex_command" ""
483 \\converter word latex "$word_to_latex_command" ""
484
485 \\viewer dvi "$DVI_VIEWER"
486 \\viewer html "$HTML_VIEWER"
487 \\viewer pdf "$PDF_VIEWER"
488 \\viewer ps "$GHOSTVIEW -swap"
489 \\viewer eps "$GHOSTVIEW"
490 \\viewer latex "$LATEX_VIEWER"
491
492 $rc_entries
493 \\font_encoding "$chk_fontenc"
494 EOF
495
496 ### the graphic converter part with the predefined ones
497 #### Search for tne nonstandard converting progs
498 #
499 SEARCH_PROG([for an FIG -> EPS/XPM converter], FIG2DEV, fig2dev)
500 if test "$FIG2DEV" = "fig2dev"; then
501 cat >>$outfile <<EOF
502 \\converter fig eps "fig2dev -L eps \$\$i \$\$o" ""
503 \\converter fig xpm "fig2dev -L xpm \$\$i \$\$o" ""
504 EOF
505 fi
506
507 SEARCH_PROG([for an TIFF -> PS converter], TIFF2PS, tiff2ps)
508 if test "$TIFF2PS" = "tiff2ps"; then
509 cat >>$outfile <<EOF
510 \\converter tiff eps "tiff2ps \$\$i > \$\$o" ""
511 EOF
512 fi
513
514 SEARCH_PROG([for an TGIF -> EPS/XPM converter], TGIF, tgif)
515 if test "$TGIF" = "tgif"; then
516 cat >>$outfile <<EOF
517 \\converter tgif eps "tgif -print -eps \$\$i" ""
518 \\converter tgif pdf "tgif -print -pdf \$\$i" ""
519 \\converter tgif png "tgif -print -png \$\$i" ""
520 \\converter tgif xpm "tgif -print -stdout -xpm \$\$i > \$\$o" ""
521 EOF
522 fi
523
524 SEARCH_PROG([for an EPS -> PDF converter], EPSTOPDF, epstopdf)
525 if test "$EPSTOPDF" = "epstopdf"; then
526 cat >>$outfile <<EOF
527 \\converter eps pdf "epstopdf --outfile=\$\$o \$\$i" ""
528 EOF
529 fi
530
531 SEARCH_PROG([for an EPSI ->  EPS/XPM converter], EPS2EPS, eps2eps)
532 if test "$EPS2EPS" = "eps2eps"; then
533 cat >>$outfile <<EOF
534 \\converter epsi pdf "epstopdf --outfile=\$\$o \$\$i" ""
535 \\converter epsi eps "eps2eps \$\$i \$\$o" ""
536 \\converter epsi xpm "eps2eps -sOutputFile=- \$\$i dummy.eps | convert - \$\$o" ""
537 EOF
538 fi
539
540 #### Add Grace conversions (xmgrace needs an Xserver, gracebat doesn't.)
541 SEARCH_PROG([for a Grace -> Image converter], GRACE, gracebat)
542 if test "$GRACE" = "gracebat"; then 
543 cat >>$outfile <<EOF
544 \\converter agr eps "gracebat -hardcopy -printfile \$\$o -hdevice EPS \$\$i 2>/dev/null" ""
545 \\converter agr png "gracebat -hardcopy -printfile \$\$o -hdevice PNG \$\$i 2>/dev/null" ""
546 \\converter agr xpm "gracebat -hardcopy -printfile - -hdevice PNG \$\$i 2>/dev/null | convert - \$\$o" ""
547 EOF
548 fi
549
550 ######## X FONTS
551 # create a fonts.dir file to make X fonts available to LyX
552 echo "checking for TeX fonts"
553
554 fontlist="cmex10 cmmi10 cmr10 cmsy10 eufm10 msam10 msbm10 wasy10"
555 rm -f xfonts/fonts.dir xfonts/fonts.scale xfonts/tmpfonts
556
557 num=0
558 touch xfonts/tmpfonts
559 for font in $fontlist ; do
560   MSG_CHECKING([for $font])
561   result=no
562   for ext in pfb pfa ttf ; do
563     if filepath=`kpsewhich $font.$ext` ; then
564       result="yes ($ext)"
565       rm -f xfonts/$font.$ext
566       ln -s $filepath xfonts 2>/dev/null
567       echo "$font.$ext -unknown-$font-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific" >>xfonts/tmpfonts
568       num=`expr $num + 1`
569       break
570     fi
571   done
572   MSG_RESULT($result)
573 done
574
575 if test ! $num = 0 ; then
576   echo $num >xfonts/fonts.scale
577   cat xfonts/tmpfonts >>xfonts/fonts.scale
578   cp xfonts/fonts.scale xfonts/fonts.dir
579 fi
580 rm -f xfonts/tmpfonts
581
582
583 # Remove superfluous files if we are not writing in the main lib
584 # directory
585 for file in $outfile textclass.lst packages.lst \
586             doc/LaTeXConfig.lyx xfonts/fonts.dir ; do
587   # we rename the file first, so that we avoid comparing a file with itself
588   mv $file $file.new
589   if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ;
590   then
591     echo "removing $file, which is identical to the system global version"
592     rm -f $file.new
593   else
594     mv $file.new $file
595   fi
596 done
597
598
599 # Final clean-up
600 if test $lyx_keep_temps = no ; then
601 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \
602       missfont.log
603 fi