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.
10 ####some configuration variables
15 #### Parse the command line
20 Usage: configure [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
27 --without-latex-config)
28 lyx_check_config=no ;;
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
49 #### I do not really know why this is useful, but we might as well keep it.
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
61 #### Guess the directory in which configure is located.
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"
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
79 #### Searching some useful programs
81 echo $ac_n "checking for a LaTeX2e program""... $ac_c"
82 echo "$ac_t""(latex latex2e)"
84 for ac_prog in latex latex2e
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
100 if test -n "$LATEX"; then
106 ## Check whether this is really LaTeX2e
108 cat >chklatex.ltx <<EOF
109 \\nonstopmode\\makeatletter
110 \\ifx\\undefined\\documentclass\\else
111 \\message{ThisIsLaTeX2e}
115 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
116 | grep 'ThisIsLaTeX2e' >/dev/null; then
120 ac_result="not useable"
122 rm -f chklatex.ltx chklatex.log
123 echo "$ac_t""$ac_result"
124 test -n "$LATEX" && break
128 if test -z "$LATEX" ; then
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)"
137 for ac_prog in pdflatex
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
153 if test -n "$PDFLATEX"; then
159 ## Check whether this is really LaTeX2e
161 cat >chklatex.ltx <<EOF
162 \\nonstopmode\\makeatletter
163 \\ifx\\undefined\\documentclass\\else
164 \\message{ThisIsLaTeX2e}
168 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
169 | grep 'ThisIsLaTeX2e' >/dev/null; then
173 ac_result="not useable"
175 rm -f chklatex.ltx chklatex.log
176 echo "$ac_t""$ac_result"
177 test -n "$PDFLATEX" && break
181 if test -z "$PDFLATEX" ; then
187 # Search for an installed reLyX or a ready-to-install one
189 PATH=${PATH}:./reLyX/
190 echo $ac_n "checking for reLyX LaTeX-to-LyX translator""... $ac_c"
191 echo "$ac_t""(reLyX)"
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
209 if test -n "$RELYX"; then
215 echo "$ac_t""$ac_result"
216 test -n "$RELYX" && break
220 if test -z "$RELYX" ; then
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")"
230 for ac_prog in "noweave -delay -index"
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
246 if test -n "$LITERATE"; then
252 echo "$ac_t""$ac_result"
253 test -n "$LITERATE" && break
257 if test -z "$LITERATE" ; then
261 if test "$LITERATE" = "none"; then LITERATE_EXT="none"; else LITERATE_EXT=".nw"; fi
263 # Search for a Postscript interpreter
264 echo $ac_n "checking for a Postscript interpreter""... $ac_c"
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
283 if test -n "$GS"; then
289 echo "$ac_t""$ac_result"
290 test -n "$GS" && break
294 if test -z "$GS" ; then
299 # Search something to preview postscript
300 echo $ac_n "checking for a Postscript previewer""... $ac_c"
301 echo "$ac_t""(gv ghostview)"
303 for ac_prog in gv ghostview
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
319 if test -n "$GHOSTVIEW"; then
325 echo "$ac_t""$ac_result"
326 test -n "$GHOSTVIEW" && break
330 if test -z "$GHOSTVIEW" ; then
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)"
339 for ac_prog in xpdf acroread gv ghostview
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
355 if test -n "$PDFVIEWER"; then
361 echo "$ac_t""$ac_result"
362 test -n "$PDFVIEWER" && break
366 if test -z "$PDFVIEWER" ; then
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)"
375 for ac_prog in pdf2ps pdftops
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
391 if test -n "$PDFPS"; then
397 echo "$ac_t""$ac_result"
398 test -n "$PDFPS" && break
402 if test -z "$PDFPS" ; then
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)"
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
427 if test -n "$DVIPS"; then
433 echo "$ac_t""$ac_result"
434 test -n "$DVIPS" && break
438 if test -z "$DVIPS" ; then
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)"
447 for ac_prog in groff nroff
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
463 if test -n "$ROFF"; then
469 echo "$ac_t""$ac_result"
470 test -n "$ROFF" && break
474 if test -z "$ROFF" ; then
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"
482 # Search the ChkTeX program
483 echo $ac_n "checking for ChkTeX""... $ac_c"
484 echo "$ac_t""(chktex)"
486 for ac_prog in chktex
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
502 if test -n "$CHKTEX"; then
508 echo "$ac_t""$ac_result"
509 test -n "$CHKTEX" && break
513 if test -z "$CHKTEX" ; then
517 chktex_command=$CHKTEX
518 test $CHKTEX = "chktex" && chktex_command="$CHKTEX -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"
520 # Search for a spellchecker
521 echo $ac_n "checking for a spell-checker""... $ac_c"
522 echo "$ac_t""(ispell)"
524 for ac_prog in ispell
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
540 if test -n "$SPELL"; then
546 echo "$ac_t""$ac_result"
547 test -n "$SPELL" && break
551 if test -z "$SPELL" ; then
556 # Search a Fax handling program
557 echo $ac_n "checking for a fax driver""... $ac_c"
558 echo "$ac_t""(sendfax faxsend fax)"
560 for ac_prog in sendfax faxsend fax
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
576 if test -n "$FAX"; then
582 echo "$ac_t""$ac_result"
583 test -n "$FAX" && break
587 if test -z "$FAX" ; then
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'"
601 # Search for LinuxDoc support
602 echo $ac_n "checking for SGML-tools 1.x (LinuxDoc)""... $ac_c"
603 echo "$ac_t""(sgml2lyx)"
605 for ac_prog in sgml2lyx
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
621 if test -n "$LINUXDOC"; then
627 echo "$ac_t""$ac_result"
628 test -n "$LINUXDOC" && break
632 if test -z "$LINUXDOC" ; then
637 if test $LINUXDOC != none; then
639 linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
644 linuxdoc_to_latex_command="sgml2latex"
645 linuxdoc_to_html_command="sgml2html '\$\$FName'"
646 linuxdoc_to_lyx_command="sgml2lyx";;
648 linuxdoc_to_latex_command="none"
649 linuxdoc_to_html_command="none"
650 linuxdoc_to_lyx_command="none";;
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)"
657 for ac_prog in sgmltools db2dvi
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
673 if test -n "$DOCBOOK"; then
679 echo "$ac_t""$ac_result"
680 test -n "$DOCBOOK" && break
684 if test -z "$DOCBOOK" ; then
689 if test $DOCBOOK != none; then
691 docbook_cmd="\\def\\hasdocbook{yes}"
696 docbook_to_dvi_command="sgmltools -b dvi"
697 docbook_to_html_command="sgmltools -b html '\$\$FName'";;
699 docbook_to_dvi_command="db2dvi"
700 docbook_to_html_command="db2html '\$\$FName'";;
702 docbook_to_dvi_command="none"
703 docbook_to_html_command="none";;
706 # Search for a spool command
707 echo $ac_n "checking for a spool command""... $ac_c"
708 echo "$ac_t""(lp lpr)"
710 for ac_prog in lp lpr
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
726 if test -n "$LPR"; then
732 echo "$ac_t""$ac_result"
733 test -n "$LPR" && break
737 if test -z "$LPR" ; then
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
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)"
753 for ac_prog in tth latex2html hevea
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
769 if test -n "$TOHTML"; then
775 echo "$ac_t""$ac_result"
776 test -n "$TOHTML" && break
780 if test -z "$TOHTML" ; then
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'";;
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"
798 rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
799 cat >wrap_chkconfig.ltx <<EOF
800 \\newcommand\\srcdir{${srcdir}}
803 \\input{${srcdir}/chkconfig.ltx}
805 ## Construct the list of classes to test for.
806 # build the list of available layout files and convert it to commands
808 for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
811 *) test -r "$file" && echo $file ;;
813 done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
815 eval ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
816 eval `cat chkconfig.vars | sed 's/-/_/g'`
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
833 linuxdoc linuxdoc linuxdoc
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
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.
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
864 echo creating 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"
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"
899 # Remove superfluous files if we are not writing in the main lib
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
905 if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ;
907 echo "removing $file, which is identical to the system global version"
916 if test $lyx_keep_temps = no ; then
917 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \