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