]> git.lyx.org Git - lyx.git/blob - lib/configure
fix compatability reading of floats
[lyx.git] / lib / configure
1 #! /bin/sh
2 # This script is a hand-made configure script. It contains a lot of
3 # code stolen from GNU autoconf. I removed all the code that was not
4 # useful for configuring a LyX installation.
5
6
7
8
9
10 ####some configuration variables
11 lyx_check_config=yes
12 lyx_keep_temps=no
13 srcdir=
14 lyx_suffix=
15
16 #### Parse the command line
17 for ac_option do
18   case "$ac_option" in
19     -help | --help | -h)
20       cat << EOF
21 Usage: configure [options] 
22 Options: 
23   --help                   show this help lines
24   --keep-temps             keep temporary files (for debug. purposes)
25   --without-latex-config   do not run LaTeX to determine configuration
26   --with-lyx-suffix=suffix suffix of binary installed files
27 EOF
28       exit 0;;
29     --without-latex-config)
30       lyx_check_config=no ;;
31     --keep-temps)
32       lyx_keep_temps=yes ;;
33     --with-lyx-suffix*)
34       lyx_suffix=`echo "$ac_option" | sed 's,--with-lyx-suffix=,,;s,^,-,'`
35   esac 
36 done
37
38
39 #### Checking for some echo oddities
40 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
41   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
42   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
43     ac_n= ac_c='
44 ' ac_t='        '
45   else
46     ac_n=-n ac_c= ac_t=
47   fi
48 else
49   ac_n= ac_c='\c' ac_t=
50 fi
51
52
53 #### I do not really know why this is useful, but we might as well keep it.
54 # NLS nuisances.
55 # Only set these to C if already set.  These must not be set unconditionally
56 # because not all systems understand e.g. LANG=C (notably SCO).
57 # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
58 # Non-C LC_CTYPE values break the ctype check.
59 if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
60 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
61 if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
62 if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
63
64
65 #### Guess the directory in which configure is located.
66 ac_prog=$0
67 srcdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` 
68 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
69 test "x$srcdir" = "x$ac_prog" && srcdir=.
70 if test ! -r ${srcdir}/chkconfig.ltx ; then
71   echo "configure: error: cannot find chkconfig.ltx script"
72   exit 1
73 fi
74
75 #### Adjust PATH for Win32 (Cygwin)
76 if test "x$OSTYPE" = xcygwin; then
77   echo "configure: cygwin detected; path correction"
78   srcdir=`cygpath -w "${srcdir}" | tr '\\\\' /`
79   echo "srcdir=${srcdir}"
80 fi
81
82 #### Create the build directories if necessary
83 for dir in bind clipart doc examples images kbd layouts reLyX \
84     scripts templates ui ; do
85   test ! -d $dir && mkdir $dir
86 done
87
88
89 #### Searching some useful programs
90 # Search LaTeX2e
91 echo $ac_n "checking for a LaTeX2e program""... $ac_c"
92 echo "$ac_t""(latex latex2e)"
93 LATEX=
94 for ac_prog in latex latex2e
95 do
96 # Extract the first word of "$ac_prog", so it can be a program name with args.
97 set dummy $ac_prog ; ac_word=$2
98 if test -n "$ac_word"; then
99   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
100   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
101   for ac_dir in $PATH; do
102     test -z "$ac_dir" && ac_dir=.
103     if test -x $ac_dir/$ac_word; then
104       LATEX="$ac_prog"
105       break
106     fi
107   done
108   IFS="$ac_save_ifs"
109
110   if test -n "$LATEX"; then
111     ac_result=yes
112   else
113     ac_result=no
114   fi
115   
116 ## Check whether this is really LaTeX2e
117 rm -f chklatex.ltx
118 cat >chklatex.ltx <<EOF
119 \\nonstopmode\\makeatletter
120 \\ifx\\undefined\\documentclass\\else
121   \\message{ThisIsLaTeX2e}
122 \\fi
123 \\@@end
124 EOF
125 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
126                        | grep 'ThisIsLaTeX2e' >/dev/null; then
127   :
128 else
129   LATEX=
130   ac_result="not useable"
131 fi
132 rm -f chklatex.ltx chklatex.log
133   echo "$ac_t""$ac_result"
134   test -n "$LATEX" && break
135 fi
136 done
137
138 if test -z "$LATEX" ; then
139   LATEX=none
140     lyx_check_config=no
141 fi
142
143 if test x$lyx_check_config != x ; then
144 echo $ac_n "checking for the pdflatex program""... $ac_c"
145 echo "$ac_t""(pdflatex)"
146 PDFLATEX=
147 for ac_prog in pdflatex
148 do
149 # Extract the first word of "$ac_prog", so it can be a program name with args.
150 set dummy $ac_prog ; ac_word=$2
151 if test -n "$ac_word"; then
152   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
153   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
154   for ac_dir in $PATH; do
155     test -z "$ac_dir" && ac_dir=.
156     if test -x $ac_dir/$ac_word; then
157       PDFLATEX="$ac_prog"
158       break
159     fi
160   done
161   IFS="$ac_save_ifs"
162
163   if test -n "$PDFLATEX"; then
164     ac_result=yes
165   else
166     ac_result=no
167   fi
168   
169 ## Check whether this is really LaTeX2e
170 rm -f chklatex.ltx
171 cat >chklatex.ltx <<EOF
172 \\nonstopmode\\makeatletter
173 \\ifx\\undefined\\documentclass\\else
174   \\message{ThisIsLaTeX2e}
175 \\fi
176 \\@@end
177 EOF
178 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
179                        | grep 'ThisIsLaTeX2e' >/dev/null; then
180   :
181 else
182   LATEX=
183   ac_result="not useable"
184 fi
185 rm -f chklatex.ltx chklatex.log
186   echo "$ac_t""$ac_result"
187   test -n "$PDFLATEX" && break
188 fi
189 done
190
191 if test -z "$PDFLATEX" ; then
192   PDFLATEX=none
193 fi
194
195 fi
196
197 # Search for an installed reLyX or a ready-to-install one
198 save_PATH=${PATH}
199 PATH=${PATH}:./reLyX/
200 echo $ac_n "checking for a LaTeX -> LyX converter""... $ac_c"
201 echo "$ac_t""(reLyX)"
202 tex_to_lyx_command=
203 for ac_prog in reLyX
204 do
205 # Extract the first word of "$ac_prog", so it can be a program name with args.
206 set dummy $ac_prog ; ac_word=$2
207 if test -n "$ac_word"; then
208   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
209   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
210   for ac_dir in $PATH; do
211     test -z "$ac_dir" && ac_dir=.
212     if test -x $ac_dir/$ac_word; then
213       tex_to_lyx_command="$ac_prog"
214       break
215     fi
216   done
217   IFS="$ac_save_ifs"
218
219   if test -n "$tex_to_lyx_command"; then
220     ac_result=yes
221   else
222     ac_result=no
223   fi
224   
225   echo "$ac_t""$ac_result"
226   test -n "$tex_to_lyx_command" && break
227 fi
228 done
229
230 if test -z "$tex_to_lyx_command" ; then
231   tex_to_lyx_command=none
232 fi
233
234 PATH=${save_PATH}
235 test $tex_to_lyx_command = "reLyX" && tex_to_lyx_command="reLyX -f \$\$i"
236 tex_to_lyx_command=`echo $tex_to_lyx_command | sed "s,reLyX,reLyX$lyx_suffix,"`
237
238 echo $ac_n "checking for a Noweb -> LyX converter""... $ac_c"
239 echo "$ac_t""(noweb2lyx)"
240 literate_to_lyx_command=
241 for ac_prog in noweb2lyx
242 do
243 # Extract the first word of "$ac_prog", so it can be a program name with args.
244 set dummy $ac_prog ; ac_word=$2
245 if test -n "$ac_word"; then
246   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
247   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
248   for ac_dir in $PATH; do
249     test -z "$ac_dir" && ac_dir=.
250     if test -x $ac_dir/$ac_word; then
251       literate_to_lyx_command="$ac_prog"
252       break
253     fi
254   done
255   IFS="$ac_save_ifs"
256
257   if test -n "$literate_to_lyx_command"; then
258     ac_result=yes
259   else
260     ac_result=no
261   fi
262   
263   echo "$ac_t""$ac_result"
264   test -n "$literate_to_lyx_command" && break
265 fi
266 done
267
268 if test -z "$literate_to_lyx_command" ; then
269   literate_to_lyx_command=none
270 fi
271
272 test $literate_to_lyx_command = "noweb2lyx" && literate_to_lyx_command="noweb2lyx \$\$i \$\$o"
273 literate_to_lyx_command=`echo $literate_to_lyx_command | sed "s,noweb2lyx,noweb2lyx$lyx_suffix,"`
274
275 # Search something to process a literate document
276 echo $ac_n "checking for a Noweb -> LaTeX converter""... $ac_c"
277 echo "$ac_t""(noweave)"
278 literate_to_tex_command=
279 for ac_prog in noweave
280 do
281 # Extract the first word of "$ac_prog", so it can be a program name with args.
282 set dummy $ac_prog ; ac_word=$2
283 if test -n "$ac_word"; then
284   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
285   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
286   for ac_dir in $PATH; do
287     test -z "$ac_dir" && ac_dir=.
288     if test -x $ac_dir/$ac_word; then
289       literate_to_tex_command="$ac_prog"
290       break
291     fi
292   done
293   IFS="$ac_save_ifs"
294
295   if test -n "$literate_to_tex_command"; then
296     ac_result=yes
297   else
298     ac_result=no
299   fi
300   
301   echo "$ac_t""$ac_result"
302   test -n "$literate_to_tex_command" && break
303 fi
304 done
305
306 if test -z "$literate_to_tex_command" ; then
307   literate_to_tex_command=none
308 fi
309
310 test $literate_to_tex_command = "noweave" && literate_to_tex_command="noweave -delay -index \$\$i > \$\$o"
311
312 echo $ac_n "checking for a HTML -> Latex converter""... $ac_c"
313 echo "$ac_t""(html2latex)"
314 html_to_latex_command=
315 for ac_prog in html2latex
316 do
317 # Extract the first word of "$ac_prog", so it can be a program name with args.
318 set dummy $ac_prog ; ac_word=$2
319 if test -n "$ac_word"; then
320   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
321   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
322   for ac_dir in $PATH; do
323     test -z "$ac_dir" && ac_dir=.
324     if test -x $ac_dir/$ac_word; then
325       html_to_latex_command="$ac_prog"
326       break
327     fi
328   done
329   IFS="$ac_save_ifs"
330
331   if test -n "$html_to_latex_command"; then
332     ac_result=yes
333   else
334     ac_result=no
335   fi
336   
337   echo "$ac_t""$ac_result"
338   test -n "$html_to_latex_command" && break
339 fi
340 done
341
342 if test -z "$html_to_latex_command" ; then
343   html_to_latex_command=none
344 fi
345
346 test $html_to_latex_command = "html2latex" && html_to_latex_command="html2latex \$\$i"
347
348 echo $ac_n "checking for a MSWord -> Latex converter""... $ac_c"
349 echo "$ac_t""(wvCleanLatex word2x)"
350 word_to_latex_command=
351 for ac_prog in wvCleanLatex word2x
352 do
353 # Extract the first word of "$ac_prog", so it can be a program name with args.
354 set dummy $ac_prog ; ac_word=$2
355 if test -n "$ac_word"; then
356   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
357   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
358   for ac_dir in $PATH; do
359     test -z "$ac_dir" && ac_dir=.
360     if test -x $ac_dir/$ac_word; then
361       word_to_latex_command="$ac_prog"
362       break
363     fi
364   done
365   IFS="$ac_save_ifs"
366
367   if test -n "$word_to_latex_command"; then
368     ac_result=yes
369   else
370     ac_result=no
371   fi
372   
373   echo "$ac_t""$ac_result"
374   test -n "$word_to_latex_command" && break
375 fi
376 done
377
378 if test -z "$word_to_latex_command" ; then
379   word_to_latex_command=none
380 fi
381
382 test "$word_to_latex_command" = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$i \$\$o"
383 test "$word_to_latex_command" = "word2x" && word_to_latex_command="word2x -f latex \$\$i"
384
385 echo $ac_n "checking for Image converter""... $ac_c"
386 echo "$ac_t""(convert)"
387 image_command=
388 for ac_prog in convert
389 do
390 # Extract the first word of "$ac_prog", so it can be a program name with args.
391 set dummy $ac_prog ; ac_word=$2
392 if test -n "$ac_word"; then
393   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
394   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
395   for ac_dir in $PATH; do
396     test -z "$ac_dir" && ac_dir=.
397     if test -x $ac_dir/$ac_word; then
398       image_command="$ac_prog"
399       break
400     fi
401   done
402   IFS="$ac_save_ifs"
403
404   if test -n "$image_command"; then
405     ac_result=yes
406   else
407     ac_result=no
408   fi
409   
410   echo "$ac_t""$ac_result"
411   test -n "$image_command" && break
412 fi
413 done
414
415 if test -z "$image_command" ; then
416   image_command=none
417 fi
418
419 test $image_command = "convert" && image_command="convert \$\$i \$\$o"
420
421 # Search for a Postscript interpreter
422 echo $ac_n "checking for a Postscript interpreter""... $ac_c"
423 echo "$ac_t""(gs)"
424 GS=
425 for ac_prog in gs
426 do
427 # Extract the first word of "$ac_prog", so it can be a program name with args.
428 set dummy $ac_prog ; ac_word=$2
429 if test -n "$ac_word"; then
430   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
431   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
432   for ac_dir in $PATH; do
433     test -z "$ac_dir" && ac_dir=.
434     if test -x $ac_dir/$ac_word; then
435       GS="$ac_prog"
436       break
437     fi
438   done
439   IFS="$ac_save_ifs"
440
441   if test -n "$GS"; then
442     ac_result=yes
443   else
444     ac_result=no
445   fi
446   
447   echo "$ac_t""$ac_result"
448   test -n "$GS" && break
449 fi
450 done
451
452 if test -z "$GS" ; then
453   GS=none
454 fi
455
456
457 # Search something to preview postscript
458 echo $ac_n "checking for a Postscript previewer""... $ac_c"
459 echo "$ac_t""(gv ghostview)"
460 GHOSTVIEW=
461 for ac_prog in gv ghostview
462 do
463 # Extract the first word of "$ac_prog", so it can be a program name with args.
464 set dummy $ac_prog ; ac_word=$2
465 if test -n "$ac_word"; then
466   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
467   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
468   for ac_dir in $PATH; do
469     test -z "$ac_dir" && ac_dir=.
470     if test -x $ac_dir/$ac_word; then
471       GHOSTVIEW="$ac_prog"
472       break
473     fi
474   done
475   IFS="$ac_save_ifs"
476
477   if test -n "$GHOSTVIEW"; then
478     ac_result=yes
479   else
480     ac_result=no
481   fi
482   
483   echo "$ac_t""$ac_result"
484   test -n "$GHOSTVIEW" && break
485 fi
486 done
487
488 if test -z "$GHOSTVIEW" ; then
489   GHOSTVIEW=none
490 fi
491
492
493 # Search for a program to preview pdf
494 echo $ac_n "checking for a PDF preview""... $ac_c"
495 echo "$ac_t""(acroread gv ghostview xpdf)"
496 PDF_VIEWER=
497 for ac_prog in acroread gv ghostview xpdf
498 do
499 # Extract the first word of "$ac_prog", so it can be a program name with args.
500 set dummy $ac_prog ; ac_word=$2
501 if test -n "$ac_word"; then
502   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
503   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
504   for ac_dir in $PATH; do
505     test -z "$ac_dir" && ac_dir=.
506     if test -x $ac_dir/$ac_word; then
507       PDF_VIEWER="$ac_prog"
508       break
509     fi
510   done
511   IFS="$ac_save_ifs"
512
513   if test -n "$PDF_VIEWER"; then
514     ac_result=yes
515   else
516     ac_result=no
517   fi
518   
519   echo "$ac_t""$ac_result"
520   test -n "$PDF_VIEWER" && break
521 fi
522 done
523
524 if test -z "$PDF_VIEWER" ; then
525   PDF_VIEWER=none
526 fi
527
528
529 # Search something to preview dvi
530 echo $ac_n "checking for a DVI previewer""... $ac_c"
531 echo "$ac_t""(xdvi windvi yap)"
532 DVI_VIEWER=
533 for ac_prog in xdvi windvi yap
534 do
535 # Extract the first word of "$ac_prog", so it can be a program name with args.
536 set dummy $ac_prog ; ac_word=$2
537 if test -n "$ac_word"; then
538   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
539   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
540   for ac_dir in $PATH; do
541     test -z "$ac_dir" && ac_dir=.
542     if test -x $ac_dir/$ac_word; then
543       DVI_VIEWER="$ac_prog"
544       break
545     fi
546   done
547   IFS="$ac_save_ifs"
548
549   if test -n "$DVI_VIEWER"; then
550     ac_result=yes
551   else
552     ac_result=no
553   fi
554   
555   echo "$ac_t""$ac_result"
556   test -n "$DVI_VIEWER" && break
557 fi
558 done
559
560 if test -z "$DVI_VIEWER" ; then
561   DVI_VIEWER=none
562 fi
563
564
565 # Search something to preview html
566 echo $ac_n "checking for a HTML previewer""... $ac_c"
567 echo "$ac_t""(netscape)"
568 HTML_VIEWER=
569 for ac_prog in netscape
570 do
571 # Extract the first word of "$ac_prog", so it can be a program name with args.
572 set dummy $ac_prog ; ac_word=$2
573 if test -n "$ac_word"; then
574   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
575   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
576   for ac_dir in $PATH; do
577     test -z "$ac_dir" && ac_dir=.
578     if test -x $ac_dir/$ac_word; then
579       HTML_VIEWER="$ac_prog"
580       break
581     fi
582   done
583   IFS="$ac_save_ifs"
584
585   if test -n "$HTML_VIEWER"; then
586     ac_result=yes
587   else
588     ac_result=no
589   fi
590   
591   echo "$ac_t""$ac_result"
592   test -n "$HTML_VIEWER" && break
593 fi
594 done
595
596 if test -z "$HTML_VIEWER" ; then
597   HTML_VIEWER=none
598 fi
599
600
601 # Search for a program to convert ps to pdf
602 echo $ac_n "checking for a PS to PDF converter""... $ac_c"
603 echo "$ac_t""(ps2pdf)"
604 ps_to_pdf_command=
605 for ac_prog in ps2pdf
606 do
607 # Extract the first word of "$ac_prog", so it can be a program name with args.
608 set dummy $ac_prog ; ac_word=$2
609 if test -n "$ac_word"; then
610   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
611   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
612   for ac_dir in $PATH; do
613     test -z "$ac_dir" && ac_dir=.
614     if test -x $ac_dir/$ac_word; then
615       ps_to_pdf_command="$ac_prog"
616       break
617     fi
618   done
619   IFS="$ac_save_ifs"
620
621   if test -n "$ps_to_pdf_command"; then
622     ac_result=yes
623   else
624     ac_result=no
625   fi
626   
627   echo "$ac_t""$ac_result"
628   test -n "$ps_to_pdf_command" && break
629 fi
630 done
631
632 if test -z "$ps_to_pdf_command" ; then
633   ps_to_pdf_command=none
634 fi
635
636 test $ps_to_pdf_command = "ps2pdf" && ps_to_pdf_command="ps2pdf \$\$i"
637
638 # Search for a program to convert dvi to ps
639 echo $ac_n "checking for a DVI to PS converter""... $ac_c"
640 echo "$ac_t""(dvips)"
641 dvi_to_ps_command=
642 for ac_prog in dvips
643 do
644 # Extract the first word of "$ac_prog", so it can be a program name with args.
645 set dummy $ac_prog ; ac_word=$2
646 if test -n "$ac_word"; then
647   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
648   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
649   for ac_dir in $PATH; do
650     test -z "$ac_dir" && ac_dir=.
651     if test -x $ac_dir/$ac_word; then
652       dvi_to_ps_command="$ac_prog"
653       break
654     fi
655   done
656   IFS="$ac_save_ifs"
657
658   if test -n "$dvi_to_ps_command"; then
659     ac_result=yes
660   else
661     ac_result=no
662   fi
663   
664   echo "$ac_t""$ac_result"
665   test -n "$dvi_to_ps_command" && break
666 fi
667 done
668
669 if test -z "$dvi_to_ps_command" ; then
670   dvi_to_ps_command=none
671 fi
672
673 test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$o \$\$i"
674
675 # Search for a program to convert dvi to pdf
676 echo $ac_n "checking for a DVI to PDF converter""... $ac_c"
677 echo "$ac_t""(dvipdfm)"
678 dvi_to_pdf_command=
679 for ac_prog in dvipdfm
680 do
681 # Extract the first word of "$ac_prog", so it can be a program name with args.
682 set dummy $ac_prog ; ac_word=$2
683 if test -n "$ac_word"; then
684   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
685   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
686   for ac_dir in $PATH; do
687     test -z "$ac_dir" && ac_dir=.
688     if test -x $ac_dir/$ac_word; then
689       dvi_to_pdf_command="$ac_prog"
690       break
691     fi
692   done
693   IFS="$ac_save_ifs"
694
695   if test -n "$dvi_to_pdf_command"; then
696     ac_result=yes
697   else
698     ac_result=no
699   fi
700   
701   echo "$ac_t""$ac_result"
702   test -n "$dvi_to_pdf_command" && break
703 fi
704 done
705
706 if test -z "$dvi_to_pdf_command" ; then
707   dvi_to_pdf_command=none
708 fi
709
710 test $dvi_to_pdf_command = "dvipdfm" && dvi_to_pdf_command="dvipdfm \$\$i"
711
712 # Search a *roff program (used to translate tables in ASCII export)
713 echo $ac_n "checking for a *roff formatter""... $ac_c"
714 echo "$ac_t""(groff nroff)"
715 ROFF=
716 for ac_prog in groff nroff
717 do
718 # Extract the first word of "$ac_prog", so it can be a program name with args.
719 set dummy $ac_prog ; ac_word=$2
720 if test -n "$ac_word"; then
721   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
722   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
723   for ac_dir in $PATH; do
724     test -z "$ac_dir" && ac_dir=.
725     if test -x $ac_dir/$ac_word; then
726       ROFF="$ac_prog"
727       break
728     fi
729   done
730   IFS="$ac_save_ifs"
731
732   if test -n "$ROFF"; then
733     ac_result=yes
734   else
735     ac_result=no
736   fi
737   
738   echo "$ac_t""$ac_result"
739   test -n "$ROFF" && break
740 fi
741 done
742
743 if test -z "$ROFF" ; then
744   ROFF=none
745 fi
746
747 ascii_roff_command=$ROFF
748 test $ROFF = "groff" && ascii_roff_command="groff -t -Tlatin1 \$\$FName"
749 test $ROFF = "nroff" && ascii_roff_command="tbl \$\$FName | nroff"
750
751 # Search the ChkTeX program
752 echo $ac_n "checking for ChkTeX""... $ac_c"
753 echo "$ac_t""(chktex)"
754 CHKTEX=
755 for ac_prog in chktex
756 do
757 # Extract the first word of "$ac_prog", so it can be a program name with args.
758 set dummy $ac_prog ; ac_word=$2
759 if test -n "$ac_word"; then
760   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
761   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
762   for ac_dir in $PATH; do
763     test -z "$ac_dir" && ac_dir=.
764     if test -x $ac_dir/$ac_word; then
765       CHKTEX="$ac_prog"
766       break
767     fi
768   done
769   IFS="$ac_save_ifs"
770
771   if test -n "$CHKTEX"; then
772     ac_result=yes
773   else
774     ac_result=no
775   fi
776   
777   echo "$ac_t""$ac_result"
778   test -n "$CHKTEX" && break
779 fi
780 done
781
782 if test -z "$CHKTEX" ; then
783   CHKTEX=none
784 fi
785
786 chktex_command=$CHKTEX
787 test $CHKTEX = "chktex" && chktex_command="$CHKTEX -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"
788
789 # Search for a spellchecker
790 echo $ac_n "checking for a spell-checker""... $ac_c"
791 echo "$ac_t""(ispell)"
792 SPELL=
793 for ac_prog in ispell
794 do
795 # Extract the first word of "$ac_prog", so it can be a program name with args.
796 set dummy $ac_prog ; ac_word=$2
797 if test -n "$ac_word"; then
798   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
799   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
800   for ac_dir in $PATH; do
801     test -z "$ac_dir" && ac_dir=.
802     if test -x $ac_dir/$ac_word; then
803       SPELL="$ac_prog"
804       break
805     fi
806   done
807   IFS="$ac_save_ifs"
808
809   if test -n "$SPELL"; then
810     ac_result=yes
811   else
812     ac_result=no
813   fi
814   
815   echo "$ac_t""$ac_result"
816   test -n "$SPELL" && break
817 fi
818 done
819
820 if test -z "$SPELL" ; then
821   SPELL=none
822 fi
823
824
825
826 # Search a GUI Fax program
827 echo $ac_n "checking for a fax program""... $ac_c"
828 echo "$ac_t""(ksendfax)"
829 fax_command=
830 for ac_prog in ksendfax
831 do
832 # Extract the first word of "$ac_prog", so it can be a program name with args.
833 set dummy $ac_prog ; ac_word=$2
834 if test -n "$ac_word"; then
835   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
836   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
837   for ac_dir in $PATH; do
838     test -z "$ac_dir" && ac_dir=.
839     if test -x $ac_dir/$ac_word; then
840       fax_command="$ac_prog"
841       break
842     fi
843   done
844   IFS="$ac_save_ifs"
845
846   if test -n "$fax_command"; then
847     ac_result=yes
848   else
849     ac_result=no
850   fi
851   
852   echo "$ac_t""$ac_result"
853   test -n "$fax_command" && break
854 fi
855 done
856
857 if test -z "$fax_command" ; then
858   fax_command=none
859 fi
860
861 test $fax_command = "ksendfax" && fax_command="ksendfax \$\$i"
862
863 # Search for LinuxDoc support
864 echo $ac_n "checking for SGML-tools 1.x (LinuxDoc)""... $ac_c"
865 echo "$ac_t""(sgml2lyx)"
866 LINUXDOC=
867 for ac_prog in sgml2lyx
868 do
869 # Extract the first word of "$ac_prog", so it can be a program name with args.
870 set dummy $ac_prog ; ac_word=$2
871 if test -n "$ac_word"; then
872   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
873   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
874   for ac_dir in $PATH; do
875     test -z "$ac_dir" && ac_dir=.
876     if test -x $ac_dir/$ac_word; then
877       LINUXDOC="$ac_prog"
878       break
879     fi
880   done
881   IFS="$ac_save_ifs"
882
883   if test -n "$LINUXDOC"; then
884     ac_result=yes
885   else
886     ac_result=no
887   fi
888   
889   echo "$ac_t""$ac_result"
890   test -n "$LINUXDOC" && break
891 fi
892 done
893
894 if test -z "$LINUXDOC" ; then
895   LINUXDOC=none
896 fi
897
898 chk_linuxdoc=no
899 if test $LINUXDOC != none; then
900   chk_linuxdoc=yes
901   linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
902 fi
903
904 case $LINUXDOC in
905   sgml2lyx)
906     linuxdoc_to_latex_command="sgml2latex \$\$i"
907     linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$i"
908     linuxdoc_to_html_command="sgml2html \$\$i"
909     linuxdoc_to_lyx_command="sgml2lyx \$\$i";;
910   none)
911     linuxdoc_to_latex_command="none"
912     linuxdoc_to_dvi_command="none"
913     linuxdoc_to_html_command="none"
914     linuxdoc_to_lyx_command="none";;
915 esac
916
917 # Search for DocBook support
918 echo $ac_n "checking for SGML-tools 2.x (DocBook) or db2x scripts""... $ac_c"
919 echo "$ac_t""(sgmltools db2dvi)"
920 DOCBOOK=
921 for ac_prog in sgmltools db2dvi
922 do
923 # Extract the first word of "$ac_prog", so it can be a program name with args.
924 set dummy $ac_prog ; ac_word=$2
925 if test -n "$ac_word"; then
926   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
927   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
928   for ac_dir in $PATH; do
929     test -z "$ac_dir" && ac_dir=.
930     if test -x $ac_dir/$ac_word; then
931       DOCBOOK="$ac_prog"
932       break
933     fi
934   done
935   IFS="$ac_save_ifs"
936
937   if test -n "$DOCBOOK"; then
938     ac_result=yes
939   else
940     ac_result=no
941   fi
942   
943   echo "$ac_t""$ac_result"
944   test -n "$DOCBOOK" && break
945 fi
946 done
947
948 if test -z "$DOCBOOK" ; then
949   DOCBOOK=none
950 fi
951
952 chk_docbook=no
953 if test $DOCBOOK != none; then
954   chk_docbook=yes
955   docbook_cmd="\\def\\hasdocbook{yes}"
956 fi
957
958 case $DOCBOOK in
959   sgmltools)
960     docbook_to_dvi_command="sgmltools -b dvi \$\$i"
961     docbook_to_html_command="sgmltools -b html \$\$i";;
962   db2dvi)
963     docbook_to_dvi_command="db2dvi \$\$i"
964     docbook_to_html_command="db2html \$\$i";;
965   none)
966     docbook_to_dvi_command="none"
967     docbook_to_html_command="none";;
968 esac
969
970 # Search for a spool command
971 echo $ac_n "checking for a spool command""... $ac_c"
972 echo "$ac_t""(lp lpr)"
973 LPR=
974 for ac_prog in lp lpr
975 do
976 # Extract the first word of "$ac_prog", so it can be a program name with args.
977 set dummy $ac_prog ; ac_word=$2
978 if test -n "$ac_word"; then
979   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
980   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
981   for ac_dir in $PATH; do
982     test -z "$ac_dir" && ac_dir=.
983     if test -x $ac_dir/$ac_word; then
984       LPR="$ac_prog"
985       break
986     fi
987   done
988   IFS="$ac_save_ifs"
989
990   if test -n "$LPR"; then
991     ac_result=yes
992   else
993     ac_result=no
994   fi
995   
996   echo "$ac_t""$ac_result"
997   test -n "$LPR" && break
998 fi
999 done
1000
1001 if test -z "$LPR" ; then
1002   LPR=none
1003 fi
1004
1005 case $LPR in
1006   lp) print_spool_command=lp
1007       print_spool_printerprefix="-d ";;
1008  lpr) print_spool_command=lpr
1009       print_spool_printerprefix="-P";;
1010    *) :;; # leave to empty values
1011 esac
1012
1013 echo $ac_n "checking for a LaTeX -> HTML converter""... $ac_c"
1014 echo "$ac_t""(tth latex2html hevea)"
1015 TOHTML=
1016 for ac_prog in tth latex2html hevea
1017 do
1018 # Extract the first word of "$ac_prog", so it can be a program name with args.
1019 set dummy $ac_prog ; ac_word=$2
1020 if test -n "$ac_word"; then
1021   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
1022   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
1023   for ac_dir in $PATH; do
1024     test -z "$ac_dir" && ac_dir=.
1025     if test -x $ac_dir/$ac_word; then
1026       TOHTML="$ac_prog"
1027       break
1028     fi
1029   done
1030   IFS="$ac_save_ifs"
1031
1032   if test -n "$TOHTML"; then
1033     ac_result=yes
1034   else
1035     ac_result=no
1036   fi
1037   
1038   echo "$ac_t""$ac_result"
1039   test -n "$TOHTML" && break
1040 fi
1041 done
1042
1043 if test -z "$TOHTML" ; then
1044   TOHTML=none
1045 fi
1046
1047 latex_to_html_command=$TOHTML
1048 case $TOHTML in
1049         tth) latex_to_html_command="tth -t -e2 -L\$\$b < \$\$i > \$\$o";;
1050  latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$i";;
1051       hevea) latex_to_html_command="hevea -s \$\$i";;
1052 esac
1053
1054 #### Explore the LaTeX configuration
1055 echo $ac_n "checking LaTeX configuration""... $ac_c"
1056 # First, remove the files that we want to re-create
1057 rm -f textclass.lst packages.lst chkconfig.sed
1058 if test ${lyx_check_config} = no ; then
1059   echo "$ac_t""default values"
1060 else
1061   echo "$ac_t""auto"
1062   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
1063   cat >wrap_chkconfig.ltx <<EOF
1064 \\newcommand\\srcdir{${srcdir}}
1065 ${linuxdoc_cmd}
1066 ${docbook_cmd}
1067 \\input{${srcdir}/chkconfig.ltx}
1068 EOF
1069   ## Construct the list of classes to test for.
1070   # build the list of available layout files and convert it to commands 
1071   # for chkconfig.ltx 
1072   for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do 
1073     case $file in
1074       */\*.layout) ;;
1075       *) test -r "$file" && echo $file ;;
1076     esac
1077   done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
1078              > chklayouts.tex
1079   eval ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
1080   eval `cat chkconfig.vars | sed 's/-/_/g'`
1081 fi
1082
1083 # Do we have all the files we need? Useful if latex did not run
1084 echo creating textclass.lst 
1085 # if textclass.lst does not exist (because LaTeX did not run), 
1086 # then provide a standard version.
1087 if test ! -f textclass.lst ; then
1088   cat >textclass.lst <<EOF
1089 # This file declares layouts and their associated definition files
1090 # (include dir. relative to the place where this file is).
1091 # It contains only default values, since chkconfig.ltx could not be run 
1092 # for some reason. Run ./configure if you need to update it after a
1093 # configuration change.  
1094 article article article
1095 report  report  report
1096 book    book    book
1097 linuxdoc        linuxdoc        linuxdoc
1098 letter  letter  letter
1099 EOF
1100 fi
1101
1102 # if chkconfig.sed does not exist (because LaTeX did not run), 
1103 # then provide a standard version.
1104 if test ! -f chkconfig.sed ; then
1105   cat >chkconfig.sed <<EOF
1106 s/@.*@/???/g
1107 EOF
1108 fi
1109
1110 echo creating packages.lst
1111 # if packages.lst does not exist (because LaTeX did not run), 
1112 # then provide a standard version.
1113 if test ! -f packages.lst ; then
1114   cat >packages.lst <<EOF
1115 # This file should contain the list of LaTeX packages that have been
1116 # recognized by LyX. Unfortunately, since configure could not find
1117 # your LaTeX2e program, the tests have not been run. Run ./configure
1118 # if you need to update it after a configuration change.
1119
1120 EOF
1121 fi
1122
1123 echo creating doc/LaTeXConfig.lyx
1124 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
1125 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
1126 sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
1127
1128 echo creating lyxrc.defaults
1129 rm -f lyxrc.defaults
1130 cat >lyxrc.defaults <<EOF
1131 # This file has been automatically generated by LyX' lib/configure
1132 # script. It contains default settings that have been determined by
1133 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
1134 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
1135 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
1136 # override the values given here.
1137 \\Format text     txt   ASCII           A
1138 \\Format textparagraph txt ASCII(paragraphs)    ""
1139 \\Format docbook  sgml  DocBook         B
1140 \\Format dvi      dvi   DVI             D
1141 \\Format eps      eps   EPS             ""
1142 \\Format fax      ""    Fax             ""
1143 \\Format gif      gif   GIF             ""
1144 \\Format html     html  HTML            H
1145 \\Format jpg      jpg   JPEG            ""
1146 \\Format latex    tex   LaTeX           L
1147 \\Format linuxdoc sgml  LinuxDoc        x
1148 \\Format lyx      lyx   LyX             ""
1149 \\Format literate nw    NoWeb           N
1150 \\Format pdf      pdf   PDF             P
1151 \\Format pdf2     pdf  "PDF (pdflatex)" F
1152 \\Format pdf3     pdf  "PDF (dvipdfm)"  m
1153 \\Format png      png   PNG             ""
1154 \\Format ps       ps    Postscript      t
1155 \\Format program  ""    Program         ""
1156 \\Format word     doc   Word            W
1157
1158
1159 \\converter latex dvi "$LATEX \$\$i" "latex"
1160 \\converter latex pdf2 "$PDFLATEX \$\$i" "latex"
1161 \\converter latex html "$latex_to_html_command" "originaldir,needaux"
1162 \\converter literate latex "$literate_to_tex_command" ""
1163 \\converter dvi pdf3 "$dvi_to_pdf_command" ""
1164 \\converter dvi ps "$dvi_to_ps_command" ""
1165 \\converter ps pdf "$ps_to_pdf_command" ""
1166 \\converter ps fax "$fax_command" ""
1167 \\converter linuxdoc lyx "$linuxdoc_to_lyx_command" ""
1168 \\converter linuxdoc latex "$linuxdoc_to_latex_command" ""
1169 \\converter linuxdoc dvi "$linuxdoc_to_dvi_command" ""
1170 \\converter linuxdoc html "$linuxdoc_to_html_command" ""
1171 \\converter docbook dvi "$docbook_to_dvi_command" ""
1172 \\converter docbook html "$docbook_to_html_command" ""
1173
1174 \\converter latex lyx "$tex_to_lyx_command" ""
1175 \\converter literate lyx "$literate_to_lyx_command" ""
1176 \\converter html latex "$html_to_latex_command" ""
1177 \\converter word latex "$word_to_latex_command" ""
1178
1179 \converter gif eps "$image_command" ""
1180 \converter png eps "$image_command" ""
1181 \converter jpg eps "$image_command" ""
1182 \converter gif png "$image_command" ""
1183
1184 \\viewer dvi "$DVI_VIEWER"
1185 \\viewer html "$HTML_VIEWER"
1186 \\viewer pdf "$PDF_VIEWER"
1187 \\viewer ps "$GHOSTVIEW -swap"
1188 \\viewer eps "$GHOSTVIEW"
1189
1190 \\ps_command "$GS"
1191 \\ascii_roff_command "$ascii_roff_command"
1192 \\chktex_command "$chktex_command"
1193 \\spell_command "$SPELL"
1194 \\print_spool_command "$print_spool_command"
1195 \\print_spool_printerprefix "$print_spool_printerprefix"
1196 \\font_encoding "$chk_fontenc"
1197 EOF
1198
1199 # Remove superfluous files if we are not writing in the main lib
1200 # directory 
1201 for file in lyxrc.defaults textclass.lst packages.lst \
1202             doc/LaTeXConfig.lyx ; do
1203   # we rename the file first, so that we avoid comparing a file with itself
1204   mv $file $file.new
1205   if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ; 
1206   then 
1207     echo "removing $file, which is identical to the system global version"
1208     rm -f $file.new
1209   else
1210     mv $file.new $file
1211   fi
1212 done
1213
1214
1215 # Final clean-up
1216 if test $lyx_keep_temps = no ; then
1217 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \
1218       missfont.log
1219 fi