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