]> git.lyx.org Git - lyx.git/blob - lib/configure
Added patches from John and applied some fixes.
[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
15 #### Parse the command line
16 for ac_option do
17   case "$ac_option" in
18     -help | --help | -h)
19       cat << EOF
20 Usage: configure [options] 
21 Options: 
22   --help                   show this help lines
23   --keep-temps             keep temporary files (for debug. purposes)
24   --without-latex-config   do not run LaTeX to determine configuration
25 EOF
26       exit 0;;
27     --without-latex-config)
28       lyx_check_config=no ;;
29     --keep-temps)
30       lyx_keep_temps=yes ;;
31   esac 
32 done
33
34
35 #### Checking for some echo oddities
36 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
37   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
38   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
39     ac_n= ac_c='
40 ' ac_t='        '
41   else
42     ac_n=-n ac_c= ac_t=
43   fi
44 else
45   ac_n= ac_c='\c' ac_t=
46 fi
47
48
49 #### I do not really know why this is useful, but we might as well keep it.
50 # NLS nuisances.
51 # Only set these to C if already set.  These must not be set unconditionally
52 # because not all systems understand e.g. LANG=C (notably SCO).
53 # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
54 # Non-C LC_CTYPE values break the ctype check.
55 if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
56 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
57 if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
58 if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
59
60
61 #### Guess the directory in which configure is located.
62 ac_prog=$0
63 srcdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` 
64 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
65 test "x$srcdir" = "x$ac_prog" && srcdir=.
66 if test ! -r ${srcdir}/chkconfig.ltx ; then
67   echo "configure: error: cannot find chkconfig.ltx script"
68   exit 1
69 fi
70
71
72 #### Create the build directories if necessary
73 for dir in bind clipart doc examples images kbd layouts reLyX \
74     scripts templates ui ; do
75   test ! -d $dir && mkdir $dir
76 done
77
78
79 #### Searching some useful programs
80 # Search LaTeX2e
81 echo $ac_n "checking for a LaTeX2e program""... $ac_c"
82 echo "$ac_t""(latex latex2e)"
83 LATEX=
84 for ac_prog in latex latex2e
85 do
86 # Extract the first word of "$ac_prog", so it can be a program name with args.
87 set dummy $ac_prog ; ac_word=$2
88 if test -n "$ac_word"; then
89   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
90   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
91   for ac_dir in $PATH; do
92     test -z "$ac_dir" && ac_dir=.
93     if test -x $ac_dir/$ac_word; then
94       LATEX="$ac_prog"
95       break
96     fi
97   done
98   IFS="$ac_save_ifs"
99
100   if test -n "$LATEX"; then
101     ac_result=yes
102   else
103     ac_result=no
104   fi
105   
106 ## Check whether this is really LaTeX2e
107 rm -f chklatex.ltx
108 cat >chklatex.ltx <<EOF
109 \\nonstopmode\\makeatletter
110 \\ifx\\undefined\\documentclass\\else
111   \\message{ThisIsLaTeX2e}
112 \\fi
113 \\@@end
114 EOF
115 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
116                        | grep 'ThisIsLaTeX2e' >/dev/null; then
117   :
118 else
119   LATEX=
120   ac_result="not useable"
121 fi
122 rm -f chklatex.ltx chklatex.log
123   echo "$ac_t""$ac_result"
124   test -n "$LATEX" && break
125 fi
126 done
127
128 if test -z "$LATEX" ; then
129   LATEX=none
130     lyx_check_config=no
131 fi
132
133 if test x$lyx_check_config != x ; then
134 echo $ac_n "checking for the pdflatex program""... $ac_c"
135 echo "$ac_t""(pdflatex)"
136 PDFLATEX=
137 for ac_prog in pdflatex
138 do
139 # Extract the first word of "$ac_prog", so it can be a program name with args.
140 set dummy $ac_prog ; ac_word=$2
141 if test -n "$ac_word"; then
142   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
143   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
144   for ac_dir in $PATH; do
145     test -z "$ac_dir" && ac_dir=.
146     if test -x $ac_dir/$ac_word; then
147       PDFLATEX="$ac_prog"
148       break
149     fi
150   done
151   IFS="$ac_save_ifs"
152
153   if test -n "$PDFLATEX"; then
154     ac_result=yes
155   else
156     ac_result=no
157   fi
158   
159 ## Check whether this is really LaTeX2e
160 rm -f chklatex.ltx
161 cat >chklatex.ltx <<EOF
162 \\nonstopmode\\makeatletter
163 \\ifx\\undefined\\documentclass\\else
164   \\message{ThisIsLaTeX2e}
165 \\fi
166 \\@@end
167 EOF
168 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
169                        | grep 'ThisIsLaTeX2e' >/dev/null; then
170   :
171 else
172   LATEX=
173   ac_result="not useable"
174 fi
175 rm -f chklatex.ltx chklatex.log
176   echo "$ac_t""$ac_result"
177   test -n "$PDFLATEX" && break
178 fi
179 done
180
181 if test -z "$PDFLATEX" ; then
182   PDFLATEX=none
183 fi
184
185 fi
186
187 # Search for an installed reLyX or a ready-to-install one
188 save_PATH=${PATH}
189 PATH=${PATH}:./reLyX/
190 echo $ac_n "checking for reLyX LaTeX-to-LyX translator""... $ac_c"
191 echo "$ac_t""(reLyX)"
192 RELYX=
193 for ac_prog in reLyX
194 do
195 # Extract the first word of "$ac_prog", so it can be a program name with args.
196 set dummy $ac_prog ; ac_word=$2
197 if test -n "$ac_word"; then
198   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
199   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
200   for ac_dir in $PATH; do
201     test -z "$ac_dir" && ac_dir=.
202     if test -x $ac_dir/$ac_word; then
203       RELYX="$ac_prog"
204       break
205     fi
206   done
207   IFS="$ac_save_ifs"
208
209   if test -n "$RELYX"; then
210     ac_result=yes
211   else
212     ac_result=no
213   fi
214   
215   echo "$ac_t""$ac_result"
216   test -n "$RELYX" && break
217 fi
218 done
219
220 if test -z "$RELYX" ; then
221   RELYX=none
222 fi
223
224 PATH=${save_PATH}
225
226 # Search something to process a literate document
227 echo $ac_n "checking for a Literate programming processor""... $ac_c"
228 echo "$ac_t""("noweave -delay -index")"
229 LITERATE=
230 for ac_prog in "noweave -delay -index"
231 do
232 # Extract the first word of "$ac_prog", so it can be a program name with args.
233 set dummy $ac_prog ; ac_word=$2
234 if test -n "$ac_word"; then
235   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
236   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
237   for ac_dir in $PATH; do
238     test -z "$ac_dir" && ac_dir=.
239     if test -x $ac_dir/$ac_word; then
240       LITERATE="$ac_prog"
241       break
242     fi
243   done
244   IFS="$ac_save_ifs"
245
246   if test -n "$LITERATE"; then
247     ac_result=yes
248   else
249     ac_result=no
250   fi
251   
252   echo "$ac_t""$ac_result"
253   test -n "$LITERATE" && break
254 fi
255 done
256
257 if test -z "$LITERATE" ; then
258   LITERATE=none
259 fi
260
261 if test "$LITERATE" = "none"; then LITERATE_EXT="none"; else LITERATE_EXT=".nw"; fi
262
263 # Search for a Postscript interpreter
264 echo $ac_n "checking for a Postscript interpreter""... $ac_c"
265 echo "$ac_t""(gs)"
266 GS=
267 for ac_prog in gs
268 do
269 # Extract the first word of "$ac_prog", so it can be a program name with args.
270 set dummy $ac_prog ; ac_word=$2
271 if test -n "$ac_word"; then
272   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
273   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
274   for ac_dir in $PATH; do
275     test -z "$ac_dir" && ac_dir=.
276     if test -x $ac_dir/$ac_word; then
277       GS="$ac_prog"
278       break
279     fi
280   done
281   IFS="$ac_save_ifs"
282
283   if test -n "$GS"; then
284     ac_result=yes
285   else
286     ac_result=no
287   fi
288   
289   echo "$ac_t""$ac_result"
290   test -n "$GS" && break
291 fi
292 done
293
294 if test -z "$GS" ; then
295   GS=none
296 fi
297
298
299 # Search something to preview postscript
300 echo $ac_n "checking for a Postscript previewer""... $ac_c"
301 echo "$ac_t""(gv ghostview)"
302 GHOSTVIEW=
303 for ac_prog in gv ghostview
304 do
305 # Extract the first word of "$ac_prog", so it can be a program name with args.
306 set dummy $ac_prog ; ac_word=$2
307 if test -n "$ac_word"; then
308   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
309   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
310   for ac_dir in $PATH; do
311     test -z "$ac_dir" && ac_dir=.
312     if test -x $ac_dir/$ac_word; then
313       GHOSTVIEW="$ac_prog"
314       break
315     fi
316   done
317   IFS="$ac_save_ifs"
318
319   if test -n "$GHOSTVIEW"; then
320     ac_result=yes
321   else
322     ac_result=no
323   fi
324   
325   echo "$ac_t""$ac_result"
326   test -n "$GHOSTVIEW" && break
327 fi
328 done
329
330 if test -z "$GHOSTVIEW" ; then
331   GHOSTVIEW=none
332 fi
333
334
335 # Search for a program to preview pdf
336 echo $ac_n "checking for a PDF preview""... $ac_c"
337 echo "$ac_t""(xpdf acroread gv ghostview)"
338 PDFVIEWER=
339 for ac_prog in xpdf acroread gv ghostview
340 do
341 # Extract the first word of "$ac_prog", so it can be a program name with args.
342 set dummy $ac_prog ; ac_word=$2
343 if test -n "$ac_word"; then
344   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
345   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
346   for ac_dir in $PATH; do
347     test -z "$ac_dir" && ac_dir=.
348     if test -x $ac_dir/$ac_word; then
349       PDFVIEWER="$ac_prog"
350       break
351     fi
352   done
353   IFS="$ac_save_ifs"
354
355   if test -n "$PDFVIEWER"; then
356     ac_result=yes
357   else
358     ac_result=no
359   fi
360   
361   echo "$ac_t""$ac_result"
362   test -n "$PDFVIEWER" && break
363 fi
364 done
365
366 if test -z "$PDFVIEWER" ; then
367   PDFVIEWER=none
368 fi
369
370
371 # Search for a program to convert pdf to ps
372 echo $ac_n "checking for a PDF to PS converter""... $ac_c"
373 echo "$ac_t""(pdf2ps pdftops)"
374 PDFPS=
375 for ac_prog in pdf2ps pdftops
376 do
377 # Extract the first word of "$ac_prog", so it can be a program name with args.
378 set dummy $ac_prog ; ac_word=$2
379 if test -n "$ac_word"; then
380   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
381   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
382   for ac_dir in $PATH; do
383     test -z "$ac_dir" && ac_dir=.
384     if test -x $ac_dir/$ac_word; then
385       PDFPS="$ac_prog"
386       break
387     fi
388   done
389   IFS="$ac_save_ifs"
390
391   if test -n "$PDFPS"; then
392     ac_result=yes
393   else
394     ac_result=no
395   fi
396   
397   echo "$ac_t""$ac_result"
398   test -n "$PDFPS" && break
399 fi
400 done
401
402 if test -z "$PDFPS" ; then
403   PDFPS=none
404 fi
405
406
407 # Search for a program to convert dvi to ps
408 echo $ac_n "checking for a DVI to PS converter""... $ac_c"
409 echo "$ac_t""(dvips)"
410 DVIPS=
411 for ac_prog in dvips
412 do
413 # Extract the first word of "$ac_prog", so it can be a program name with args.
414 set dummy $ac_prog ; ac_word=$2
415 if test -n "$ac_word"; then
416   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
417   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
418   for ac_dir in $PATH; do
419     test -z "$ac_dir" && ac_dir=.
420     if test -x $ac_dir/$ac_word; then
421       DVIPS="$ac_prog"
422       break
423     fi
424   done
425   IFS="$ac_save_ifs"
426
427   if test -n "$DVIPS"; then
428     ac_result=yes
429   else
430     ac_result=no
431   fi
432   
433   echo "$ac_t""$ac_result"
434   test -n "$DVIPS" && break
435 fi
436 done
437
438 if test -z "$DVIPS" ; then
439   DVIPS=none
440 fi
441
442
443 # Search a *roff program (used to translate tables in ASCII export)
444 echo $ac_n "checking for a *roff formatter""... $ac_c"
445 echo "$ac_t""(groff nroff)"
446 ROFF=
447 for ac_prog in groff nroff
448 do
449 # Extract the first word of "$ac_prog", so it can be a program name with args.
450 set dummy $ac_prog ; ac_word=$2
451 if test -n "$ac_word"; then
452   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
453   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
454   for ac_dir in $PATH; do
455     test -z "$ac_dir" && ac_dir=.
456     if test -x $ac_dir/$ac_word; then
457       ROFF="$ac_prog"
458       break
459     fi
460   done
461   IFS="$ac_save_ifs"
462
463   if test -n "$ROFF"; then
464     ac_result=yes
465   else
466     ac_result=no
467   fi
468   
469   echo "$ac_t""$ac_result"
470   test -n "$ROFF" && break
471 fi
472 done
473
474 if test -z "$ROFF" ; then
475   ROFF=none
476 fi
477
478 ascii_roff_command=$ROFF
479 test $ROFF = "groff" && ascii_roff_command="groff -t -Tlatin1 \$\$FName"
480 test $ROFF = "nroff" && ascii_roff_command="tbl \$\$FName | nroff"
481
482 # Search the ChkTeX program
483 echo $ac_n "checking for ChkTeX""... $ac_c"
484 echo "$ac_t""(chktex)"
485 CHKTEX=
486 for ac_prog in chktex
487 do
488 # Extract the first word of "$ac_prog", so it can be a program name with args.
489 set dummy $ac_prog ; ac_word=$2
490 if test -n "$ac_word"; then
491   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
492   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
493   for ac_dir in $PATH; do
494     test -z "$ac_dir" && ac_dir=.
495     if test -x $ac_dir/$ac_word; then
496       CHKTEX="$ac_prog"
497       break
498     fi
499   done
500   IFS="$ac_save_ifs"
501
502   if test -n "$CHKTEX"; then
503     ac_result=yes
504   else
505     ac_result=no
506   fi
507   
508   echo "$ac_t""$ac_result"
509   test -n "$CHKTEX" && break
510 fi
511 done
512
513 if test -z "$CHKTEX" ; then
514   CHKTEX=none
515 fi
516
517 chktex_command=$CHKTEX
518 test $CHKTEX = "chktex" && chktex_command="$CHKTEX -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"
519
520 # Search for a spellchecker
521 echo $ac_n "checking for a spell-checker""... $ac_c"
522 echo "$ac_t""(ispell)"
523 SPELL=
524 for ac_prog in ispell
525 do
526 # Extract the first word of "$ac_prog", so it can be a program name with args.
527 set dummy $ac_prog ; ac_word=$2
528 if test -n "$ac_word"; then
529   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
530   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
531   for ac_dir in $PATH; do
532     test -z "$ac_dir" && ac_dir=.
533     if test -x $ac_dir/$ac_word; then
534       SPELL="$ac_prog"
535       break
536     fi
537   done
538   IFS="$ac_save_ifs"
539
540   if test -n "$SPELL"; then
541     ac_result=yes
542   else
543     ac_result=no
544   fi
545   
546   echo "$ac_t""$ac_result"
547   test -n "$SPELL" && break
548 fi
549 done
550
551 if test -z "$SPELL" ; then
552   SPELL=none
553 fi
554
555
556 # Search a Fax handling program
557 echo $ac_n "checking for a fax driver""... $ac_c"
558 echo "$ac_t""(sendfax faxsend fax)"
559 FAX=
560 for ac_prog in sendfax faxsend fax
561 do
562 # Extract the first word of "$ac_prog", so it can be a program name with args.
563 set dummy $ac_prog ; ac_word=$2
564 if test -n "$ac_word"; then
565   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
566   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
567   for ac_dir in $PATH; do
568     test -z "$ac_dir" && ac_dir=.
569     if test -x $ac_dir/$ac_word; then
570       FAX="$ac_prog"
571       break
572     fi
573   done
574   IFS="$ac_save_ifs"
575
576   if test -n "$FAX"; then
577     ac_result=yes
578   else
579     ac_result=no
580   fi
581   
582   echo "$ac_t""$ac_result"
583   test -n "$FAX" && break
584 fi
585 done
586
587 if test -z "$FAX" ; then
588   FAX=none
589 fi
590
591 if test $FAX = sendfax ; then
592   fax_command="sendfax -n -h '\$\$Host' -c '\$\$Comment' -x '\$\$Enterprise' -d '\$\$Name'@'\$\$Phone' '\$\$FName'"
593 elif test $FAX = faxsend ; then
594   fax_command="faxsend '\$\$Phone' '\$\$FName'"
595 elif test $FAX = fax ; then
596   fax_command="fax send '\$\$Phone' '\$\$FName'"
597 else
598   fax_command="none"
599 fi
600
601 # Search for LinuxDoc support
602 echo $ac_n "checking for SGML-tools 1.x (LinuxDoc)""... $ac_c"
603 echo "$ac_t""(sgml2lyx)"
604 LINUXDOC=
605 for ac_prog in sgml2lyx
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       LINUXDOC="$ac_prog"
616       break
617     fi
618   done
619   IFS="$ac_save_ifs"
620
621   if test -n "$LINUXDOC"; then
622     ac_result=yes
623   else
624     ac_result=no
625   fi
626   
627   echo "$ac_t""$ac_result"
628   test -n "$LINUXDOC" && break
629 fi
630 done
631
632 if test -z "$LINUXDOC" ; then
633   LINUXDOC=none
634 fi
635
636 chk_linuxdoc=no
637 if test $LINUXDOC != none; then
638   chk_linuxdoc=yes
639   linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
640 fi
641
642 case $LINUXDOC in
643   sgml2lyx)
644     linuxdoc_to_latex_command="sgml2latex"
645     linuxdoc_to_html_command="sgml2html '\$\$FName'"
646     linuxdoc_to_lyx_command="sgml2lyx";;
647   none)
648     linuxdoc_to_latex_command="none"
649     linuxdoc_to_html_command="none"
650     linuxdoc_to_lyx_command="none";;
651 esac
652
653 # Search for DocBook support
654 echo $ac_n "checking for SGML-tools 2.x (DocBook) or db2x scripts""... $ac_c"
655 echo "$ac_t""(sgmltools db2dvi)"
656 DOCBOOK=
657 for ac_prog in sgmltools db2dvi
658 do
659 # Extract the first word of "$ac_prog", so it can be a program name with args.
660 set dummy $ac_prog ; ac_word=$2
661 if test -n "$ac_word"; then
662   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
663   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
664   for ac_dir in $PATH; do
665     test -z "$ac_dir" && ac_dir=.
666     if test -x $ac_dir/$ac_word; then
667       DOCBOOK="$ac_prog"
668       break
669     fi
670   done
671   IFS="$ac_save_ifs"
672
673   if test -n "$DOCBOOK"; then
674     ac_result=yes
675   else
676     ac_result=no
677   fi
678   
679   echo "$ac_t""$ac_result"
680   test -n "$DOCBOOK" && break
681 fi
682 done
683
684 if test -z "$DOCBOOK" ; then
685   DOCBOOK=none
686 fi
687
688 chk_docbook=no
689 if test $DOCBOOK != none; then
690   chk_docbook=yes
691   docbook_cmd="\\def\\hasdocbook{yes}"
692 fi
693
694 case $DOCBOOK in
695   sgmltools)
696     docbook_to_dvi_command="sgmltools -b dvi"
697     docbook_to_html_command="sgmltools -b html '\$\$FName'";;
698   db2dvi)
699     docbook_to_dvi_command="db2dvi"
700     docbook_to_html_command="db2html '\$\$FName'";;
701   none)
702     docbook_to_dvi_command="none"
703     docbook_to_html_command="none";;
704 esac
705
706 # Search for a spool command
707 echo $ac_n "checking for a spool command""... $ac_c"
708 echo "$ac_t""(lp lpr)"
709 LPR=
710 for ac_prog in lp lpr
711 do
712 # Extract the first word of "$ac_prog", so it can be a program name with args.
713 set dummy $ac_prog ; ac_word=$2
714 if test -n "$ac_word"; then
715   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
716   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
717   for ac_dir in $PATH; do
718     test -z "$ac_dir" && ac_dir=.
719     if test -x $ac_dir/$ac_word; then
720       LPR="$ac_prog"
721       break
722     fi
723   done
724   IFS="$ac_save_ifs"
725
726   if test -n "$LPR"; then
727     ac_result=yes
728   else
729     ac_result=no
730   fi
731   
732   echo "$ac_t""$ac_result"
733   test -n "$LPR" && break
734 fi
735 done
736
737 if test -z "$LPR" ; then
738   LPR=none
739 fi
740
741 case $LPR in
742   lp) print_spool_command=lp
743       print_spool_printerprefix="-d ";;
744  lpr) print_spool_command=lpr
745       print_spool_printerprefix="-P";;
746    *) :;; # leave to empty values
747 esac
748
749 # Search for a latex to html converter
750 echo $ac_n "checking for an HTML converter""... $ac_c"
751 echo "$ac_t""(tth latex2html hevea)"
752 TOHTML=
753 for ac_prog in tth latex2html hevea
754 do
755 # Extract the first word of "$ac_prog", so it can be a program name with args.
756 set dummy $ac_prog ; ac_word=$2
757 if test -n "$ac_word"; then
758   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
759   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
760   for ac_dir in $PATH; do
761     test -z "$ac_dir" && ac_dir=.
762     if test -x $ac_dir/$ac_word; then
763       TOHTML="$ac_prog"
764       break
765     fi
766   done
767   IFS="$ac_save_ifs"
768
769   if test -n "$TOHTML"; then
770     ac_result=yes
771   else
772     ac_result=no
773   fi
774   
775   echo "$ac_t""$ac_result"
776   test -n "$TOHTML" && break
777 fi
778 done
779
780 if test -z "$TOHTML" ; then
781   TOHTML=none
782 fi
783
784 case $TOHTML in
785         tth) html_command="tth -t < '\$\$FName' > '\$\$OutName'";;
786  latex2html) html_command="latex2html -no_subdir -split 0 -show_section_numbers '\$\$FName'";;
787       hevea) html_command="hevea -s '\$\$FName'";;
788 esac
789
790 #### Explore the LaTeX configuration
791 echo $ac_n "checking LaTeX configuration""... $ac_c"
792 # First, remove the files that we want to re-create
793 rm -f textclass.lst packages.lst chkconfig.sed
794 if test ${lyx_check_config} = no ; then
795   echo "$ac_t""default values"
796 else
797   echo "$ac_t""auto"
798   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
799   cat >wrap_chkconfig.ltx <<EOF
800 \\newcommand\\srcdir{${srcdir}}
801 ${linuxdoc_cmd}
802 ${docbook_cmd}
803 \\input{${srcdir}/chkconfig.ltx}
804 EOF
805   ## Construct the list of classes to test for.
806   # build the list of available layout files and convert it to commands 
807   # for chkconfig.ltx 
808   for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do 
809     case $file in
810       */\*.layout) ;;
811       *) test -r "$file" && echo $file ;;
812     esac
813   done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
814              > chklayouts.tex
815   eval ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
816   eval `cat chkconfig.vars | sed 's/-/_/g'`
817 fi
818
819 # Do we have all the files we need? Useful if latex did not run
820 echo creating textclass.lst 
821 # if textclass.lst does not exist (because LaTeX did not run), 
822 # then provide a standard version.
823 if test ! -f textclass.lst ; then
824   cat >textclass.lst <<EOF
825 # This file declares layouts and their associated definition files
826 # (include dir. relative to the place where this file is).
827 # It contains only default values, since chkconfig.ltx could not be run 
828 # for some reason. Run ./configure if you need to update it after a
829 # configuration change.  
830 article article article
831 report  report  report
832 book    book    book
833 linuxdoc        linuxdoc        linuxdoc
834 letter  letter  letter
835 EOF
836 fi
837
838 # if chkconfig.sed does not exist (because LaTeX did not run), 
839 # then provide a standard version.
840 if test ! -f chkconfig.sed ; then
841   cat >chkconfig.sed <<EOF
842 s/@.*@/???/g
843 EOF
844 fi
845
846 echo creating packages.lst
847 # if packages.lst does not exist (because LaTeX did not run), 
848 # then provide a standard version.
849 if test ! -f packages.lst ; then
850   cat >packages.lst <<EOF
851 # This file should contain the list of LaTeX packages that have been
852 # recognized by LyX. Unfortunately, since configure could not find
853 # your LaTeX2e program, the tests have not been run. Run ./configure
854 # if you need to update it after a configuration change.
855
856 EOF
857 fi
858
859 echo creating doc/LaTeXConfig.lyx
860 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
861 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
862 sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
863
864 echo creating lyxrc.defaults
865 rm -f lyxrc.defaults
866 cat >lyxrc.defaults <<EOF
867 # This file has been automatically generated by LyX' lib/configure
868 # script. It contains default settings that have been determined by
869 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
870 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
871 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
872 # override the values given here.
873 \\latex_command "$LATEX"
874 \\pdflatex_command "$PDFLATEX"
875 \\view_pdf_command "$PDFVIEWER"
876 \\pdf_to_ps_command "$PDFPS"
877 \\dvi_to_ps_command "$DVIPS"
878 \\relyx_command "$RELYX"
879 \\literate_command "$LITERATE"
880 \\literate_extension "$LITERATE_EXT"
881 \\ps_command "$GS"
882 \\view_ps_command "$GHOSTVIEW -swap"
883 \\view_pspic_command "$GHOSTVIEW"
884 \\ascii_roff_command "$ascii_roff_command"
885 \\chktex_command "$chktex_command"
886 \\spell_command "$SPELL"
887 \\fax_command "$fax_command"
888 \\linuxdoc_to_latex_command "$linuxdoc_to_latex_command"
889 \\linuxdoc_to_html_command "$linuxdoc_to_html_command"
890 \\linuxdoc_to_lyx_command "$linuxdoc_to_lyx_command"
891 \\docbook_to_dvi_command "$docbook_to_dvi_command"
892 \\docbook_to_html_command "$docbook_to_html_command"
893 \\html_command "$html_command"
894 \\print_spool_command "$print_spool_command"
895 \\print_spool_printerprefix "$print_spool_printerprefix"
896 \\font_encoding "$chk_fontenc"
897 EOF
898
899 # Remove superfluous files if we are not writing in the main lib
900 # directory 
901 for file in lyxrc.defaults textclass.lst packages.lst \
902             doc/LaTeXConfig.lyx ; do
903   # we rename the file first, so that we avoid comparing a file with itself
904   mv $file $file.new
905   if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ; 
906   then 
907     echo "removing $file, which is identical to the system global version"
908     rm -f $file.new
909   else
910     mv $file.new $file
911   fi
912 done
913
914
915 # Final clean-up
916 if test $lyx_keep_temps = no ; then
917 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \
918       missfont.log
919 fi