]> git.lyx.org Git - lyx.git/blob - lib/configure
Replace --with-lyxname by --with-lyx-suffix
[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 a *roff program (used to translate tables in ASCII export)
670 echo $ac_n "checking for a *roff formatter""... $ac_c"
671 echo "$ac_t""(groff nroff)"
672 ROFF=
673 for ac_prog in groff nroff
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       ROFF="$ac_prog"
684       break
685     fi
686   done
687   IFS="$ac_save_ifs"
688
689   if test -n "$ROFF"; then
690     ac_result=yes
691   else
692     ac_result=no
693   fi
694   
695   echo "$ac_t""$ac_result"
696   test -n "$ROFF" && break
697 fi
698 done
699
700 if test -z "$ROFF" ; then
701   ROFF=none
702 fi
703
704 ascii_roff_command=$ROFF
705 test $ROFF = "groff" && ascii_roff_command="groff -t -Tlatin1 \$\$FName"
706 test $ROFF = "nroff" && ascii_roff_command="tbl \$\$FName | nroff"
707
708 # Search the ChkTeX program
709 echo $ac_n "checking for ChkTeX""... $ac_c"
710 echo "$ac_t""(chktex)"
711 CHKTEX=
712 for ac_prog in chktex
713 do
714 # Extract the first word of "$ac_prog", so it can be a program name with args.
715 set dummy $ac_prog ; ac_word=$2
716 if test -n "$ac_word"; then
717   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
718   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
719   for ac_dir in $PATH; do
720     test -z "$ac_dir" && ac_dir=.
721     if test -x $ac_dir/$ac_word; then
722       CHKTEX="$ac_prog"
723       break
724     fi
725   done
726   IFS="$ac_save_ifs"
727
728   if test -n "$CHKTEX"; then
729     ac_result=yes
730   else
731     ac_result=no
732   fi
733   
734   echo "$ac_t""$ac_result"
735   test -n "$CHKTEX" && break
736 fi
737 done
738
739 if test -z "$CHKTEX" ; then
740   CHKTEX=none
741 fi
742
743 chktex_command=$CHKTEX
744 test $CHKTEX = "chktex" && chktex_command="$CHKTEX -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"
745
746 # Search for a spellchecker
747 echo $ac_n "checking for a spell-checker""... $ac_c"
748 echo "$ac_t""(ispell)"
749 SPELL=
750 for ac_prog in ispell
751 do
752 # Extract the first word of "$ac_prog", so it can be a program name with args.
753 set dummy $ac_prog ; ac_word=$2
754 if test -n "$ac_word"; then
755   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
756   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
757   for ac_dir in $PATH; do
758     test -z "$ac_dir" && ac_dir=.
759     if test -x $ac_dir/$ac_word; then
760       SPELL="$ac_prog"
761       break
762     fi
763   done
764   IFS="$ac_save_ifs"
765
766   if test -n "$SPELL"; then
767     ac_result=yes
768   else
769     ac_result=no
770   fi
771   
772   echo "$ac_t""$ac_result"
773   test -n "$SPELL" && break
774 fi
775 done
776
777 if test -z "$SPELL" ; then
778   SPELL=none
779 fi
780
781
782
783 # Search a GUI Fax program
784 echo $ac_n "checking for a fax program""... $ac_c"
785 echo "$ac_t""(ksendfax)"
786 fax_command=
787 for ac_prog in ksendfax
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       fax_command="$ac_prog"
798       break
799     fi
800   done
801   IFS="$ac_save_ifs"
802
803   if test -n "$fax_command"; then
804     ac_result=yes
805   else
806     ac_result=no
807   fi
808   
809   echo "$ac_t""$ac_result"
810   test -n "$fax_command" && break
811 fi
812 done
813
814 if test -z "$fax_command" ; then
815   fax_command=none
816 fi
817
818 test $fax_command = "ksendfax" && fax_command="ksendfax \$\$i"
819
820 # Search for LinuxDoc support
821 echo $ac_n "checking for SGML-tools 1.x (LinuxDoc)""... $ac_c"
822 echo "$ac_t""(sgml2lyx)"
823 LINUXDOC=
824 for ac_prog in sgml2lyx
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       LINUXDOC="$ac_prog"
835       break
836     fi
837   done
838   IFS="$ac_save_ifs"
839
840   if test -n "$LINUXDOC"; then
841     ac_result=yes
842   else
843     ac_result=no
844   fi
845   
846   echo "$ac_t""$ac_result"
847   test -n "$LINUXDOC" && break
848 fi
849 done
850
851 if test -z "$LINUXDOC" ; then
852   LINUXDOC=none
853 fi
854
855 chk_linuxdoc=no
856 if test $LINUXDOC != none; then
857   chk_linuxdoc=yes
858   linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
859 fi
860
861 case $LINUXDOC in
862   sgml2lyx)
863     linuxdoc_to_latex_command="sgml2latex \$\$i"
864     linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$i"
865     linuxdoc_to_html_command="sgml2html \$\$i"
866     linuxdoc_to_lyx_command="sgml2lyx \$\$i";;
867   none)
868     linuxdoc_to_latex_command="none"
869     linuxdoc_to_dvi_command="none"
870     linuxdoc_to_html_command="none"
871     linuxdoc_to_lyx_command="none";;
872 esac
873
874 # Search for DocBook support
875 echo $ac_n "checking for SGML-tools 2.x (DocBook) or db2x scripts""... $ac_c"
876 echo "$ac_t""(sgmltools db2dvi)"
877 DOCBOOK=
878 for ac_prog in sgmltools db2dvi
879 do
880 # Extract the first word of "$ac_prog", so it can be a program name with args.
881 set dummy $ac_prog ; ac_word=$2
882 if test -n "$ac_word"; then
883   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
884   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
885   for ac_dir in $PATH; do
886     test -z "$ac_dir" && ac_dir=.
887     if test -x $ac_dir/$ac_word; then
888       DOCBOOK="$ac_prog"
889       break
890     fi
891   done
892   IFS="$ac_save_ifs"
893
894   if test -n "$DOCBOOK"; then
895     ac_result=yes
896   else
897     ac_result=no
898   fi
899   
900   echo "$ac_t""$ac_result"
901   test -n "$DOCBOOK" && break
902 fi
903 done
904
905 if test -z "$DOCBOOK" ; then
906   DOCBOOK=none
907 fi
908
909 chk_docbook=no
910 if test $DOCBOOK != none; then
911   chk_docbook=yes
912   docbook_cmd="\\def\\hasdocbook{yes}"
913 fi
914
915 case $DOCBOOK in
916   sgmltools)
917     docbook_to_dvi_command="sgmltools -b dvi \$\$i"
918     docbook_to_html_command="sgmltools -b html \$\$i";;
919   db2dvi)
920     docbook_to_dvi_command="db2dvi \$\$i"
921     docbook_to_html_command="db2html \$\$i";;
922   none)
923     docbook_to_dvi_command="none"
924     docbook_to_html_command="none";;
925 esac
926
927 # Search for a spool command
928 echo $ac_n "checking for a spool command""... $ac_c"
929 echo "$ac_t""(lp lpr)"
930 LPR=
931 for ac_prog in lp lpr
932 do
933 # Extract the first word of "$ac_prog", so it can be a program name with args.
934 set dummy $ac_prog ; ac_word=$2
935 if test -n "$ac_word"; then
936   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
937   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
938   for ac_dir in $PATH; do
939     test -z "$ac_dir" && ac_dir=.
940     if test -x $ac_dir/$ac_word; then
941       LPR="$ac_prog"
942       break
943     fi
944   done
945   IFS="$ac_save_ifs"
946
947   if test -n "$LPR"; then
948     ac_result=yes
949   else
950     ac_result=no
951   fi
952   
953   echo "$ac_t""$ac_result"
954   test -n "$LPR" && break
955 fi
956 done
957
958 if test -z "$LPR" ; then
959   LPR=none
960 fi
961
962 case $LPR in
963   lp) print_spool_command=lp
964       print_spool_printerprefix="-d ";;
965  lpr) print_spool_command=lpr
966       print_spool_printerprefix="-P";;
967    *) :;; # leave to empty values
968 esac
969
970 echo $ac_n "checking for a LaTeX -> HTML converter""... $ac_c"
971 echo "$ac_t""(tth latex2html hevea)"
972 TOHTML=
973 for ac_prog in tth latex2html hevea
974 do
975 # Extract the first word of "$ac_prog", so it can be a program name with args.
976 set dummy $ac_prog ; ac_word=$2
977 if test -n "$ac_word"; then
978   echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
979   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
980   for ac_dir in $PATH; do
981     test -z "$ac_dir" && ac_dir=.
982     if test -x $ac_dir/$ac_word; then
983       TOHTML="$ac_prog"
984       break
985     fi
986   done
987   IFS="$ac_save_ifs"
988
989   if test -n "$TOHTML"; then
990     ac_result=yes
991   else
992     ac_result=no
993   fi
994   
995   echo "$ac_t""$ac_result"
996   test -n "$TOHTML" && break
997 fi
998 done
999
1000 if test -z "$TOHTML" ; then
1001   TOHTML=none
1002 fi
1003
1004 latex_to_html_command=$TOHTML
1005 case $TOHTML in
1006         tth) latex_to_html_command="tth -t -e2 -L\$\$b < \$\$i > \$\$o";;
1007  latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$i";;
1008       hevea) latex_to_html_command="hevea -s \$\$i";;
1009 esac
1010
1011 #### Explore the LaTeX configuration
1012 echo $ac_n "checking LaTeX configuration""... $ac_c"
1013 # First, remove the files that we want to re-create
1014 rm -f textclass.lst packages.lst chkconfig.sed
1015 if test ${lyx_check_config} = no ; then
1016   echo "$ac_t""default values"
1017 else
1018   echo "$ac_t""auto"
1019   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
1020   cat >wrap_chkconfig.ltx <<EOF
1021 \\newcommand\\srcdir{${srcdir}}
1022 ${linuxdoc_cmd}
1023 ${docbook_cmd}
1024 \\input{${srcdir}/chkconfig.ltx}
1025 EOF
1026   ## Construct the list of classes to test for.
1027   # build the list of available layout files and convert it to commands 
1028   # for chkconfig.ltx 
1029   for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do 
1030     case $file in
1031       */\*.layout) ;;
1032       *) test -r "$file" && echo $file ;;
1033     esac
1034   done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
1035              > chklayouts.tex
1036   eval ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
1037   eval `cat chkconfig.vars | sed 's/-/_/g'`
1038 fi
1039
1040 # Do we have all the files we need? Useful if latex did not run
1041 echo creating textclass.lst 
1042 # if textclass.lst does not exist (because LaTeX did not run), 
1043 # then provide a standard version.
1044 if test ! -f textclass.lst ; then
1045   cat >textclass.lst <<EOF
1046 # This file declares layouts and their associated definition files
1047 # (include dir. relative to the place where this file is).
1048 # It contains only default values, since chkconfig.ltx could not be run 
1049 # for some reason. Run ./configure if you need to update it after a
1050 # configuration change.  
1051 article article article
1052 report  report  report
1053 book    book    book
1054 linuxdoc        linuxdoc        linuxdoc
1055 letter  letter  letter
1056 EOF
1057 fi
1058
1059 # if chkconfig.sed does not exist (because LaTeX did not run), 
1060 # then provide a standard version.
1061 if test ! -f chkconfig.sed ; then
1062   cat >chkconfig.sed <<EOF
1063 s/@.*@/???/g
1064 EOF
1065 fi
1066
1067 echo creating packages.lst
1068 # if packages.lst does not exist (because LaTeX did not run), 
1069 # then provide a standard version.
1070 if test ! -f packages.lst ; then
1071   cat >packages.lst <<EOF
1072 # This file should contain the list of LaTeX packages that have been
1073 # recognized by LyX. Unfortunately, since configure could not find
1074 # your LaTeX2e program, the tests have not been run. Run ./configure
1075 # if you need to update it after a configuration change.
1076
1077 EOF
1078 fi
1079
1080 echo creating doc/LaTeXConfig.lyx
1081 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
1082 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
1083 sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
1084
1085 echo creating lyxrc.defaults
1086 rm -f lyxrc.defaults
1087 cat >lyxrc.defaults <<EOF
1088 # This file has been automatically generated by LyX' lib/configure
1089 # script. It contains default settings that have been determined by
1090 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
1091 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
1092 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
1093 # override the values given here.
1094 \\Format text     txt   ASCII           A
1095 \\Format textparagraph txt ASCII(paragraphs)    ""
1096 \\Format docbook  sgml  DocBook         B
1097 \\Format dvi      dvi   DVI             D
1098 \\Format eps      eps   EPS             ""
1099 \\Format fax      ""    Fax             ""
1100 \\Format gif      gif   GIF             ""
1101 \\Format html     html  HTML            H
1102 \\Format jpg      jpg   JPEG            ""
1103 \\Format latex    tex   LaTeX           L
1104 \\Format linuxdoc sgml  LinuxDoc        x
1105 \\Format lyx      lyx   LyX             ""
1106 \\Format literate nw    NoWeb           N
1107 \\Format pdf      pdf   PDF             P
1108 \\Format pdf2     pdf  "PDF (pdflatex)" F
1109 \\Format png      png   PNG             ""
1110 \\Format ps       ps    Postscript      t
1111 \\Format program  ""    Program         ""
1112 \\Format word     doc   Word            W
1113
1114
1115 \\converter latex dvi "$LATEX \$\$i" "latex"
1116 \\converter latex pdf2 "$PDFLATEX \$\$i" "latex"
1117 \\converter latex html "$latex_to_html_command" "originaldir,needaux"
1118 \\converter literate latex "$literate_to_tex_command" ""
1119 \\converter dvi ps "$dvi_to_ps_command" ""
1120 \\converter ps pdf "$ps_to_pdf_command" ""
1121 \\converter ps fax "$fax_command" ""
1122 \\converter linuxdoc lyx "$linuxdoc_to_lyx_command" ""
1123 \\converter linuxdoc latex "$linuxdoc_to_latex_command" ""
1124 \\converter linuxdoc dvi "$linuxdoc_to_dvi_command" ""
1125 \\converter linuxdoc html "$linuxdoc_to_html_command" ""
1126 \\converter docbook dvi "$docbook_to_dvi_command" ""
1127 \\converter docbook html "$docbook_to_html_command" ""
1128
1129 \\converter latex lyx "$tex_to_lyx_command" ""
1130 \\converter literate lyx "$literate_to_lyx_command" ""
1131 \\converter html latex "$html_to_latex_command" ""
1132 \\converter word latex "$word_to_latex_command" ""
1133
1134 \converter gif eps "$image_command" ""
1135 \converter png eps "$image_command" ""
1136 \converter jpg eps "$image_command" ""
1137 \converter gif png "$image_command" ""
1138
1139 \\viewer dvi "$DVI_VIEWER"
1140 \\viewer html "$HTML_VIEWER"
1141 \\viewer pdf "$PDF_VIEWER"
1142 \\viewer ps "$GHOSTVIEW -swap"
1143 \\viewer eps "$GHOSTVIEW"
1144
1145 \\ps_command "$GS"
1146 \\ascii_roff_command "$ascii_roff_command"
1147 \\chktex_command "$chktex_command"
1148 \\spell_command "$SPELL"
1149 \\print_spool_command "$print_spool_command"
1150 \\print_spool_printerprefix "$print_spool_printerprefix"
1151 \\font_encoding "$chk_fontenc"
1152 EOF
1153
1154 # Remove superfluous files if we are not writing in the main lib
1155 # directory 
1156 for file in lyxrc.defaults textclass.lst packages.lst \
1157             doc/LaTeXConfig.lyx ; do
1158   # we rename the file first, so that we avoid comparing a file with itself
1159   mv $file $file.new
1160   if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ; 
1161   then 
1162     echo "removing $file, which is identical to the system global version"
1163     rm -f $file.new
1164   else
1165     mv $file.new $file
1166   fi
1167 done
1168
1169
1170 # Final clean-up
1171 if test $lyx_keep_temps = no ; then
1172 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \
1173       missfont.log
1174 fi