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