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 doc kbd layouts templates reLyX ; do
74 test ! -d $dir && mkdir $dir
78 #### Searching some useful programs
80 echo $ac_n "checking for a LaTeX2e program""... $ac_c"
81 echo "$ac_t""(latex latex2e)"
83 for ac_prog in latex latex2e
85 # Extract the first word of "$ac_prog", so it can be a program name with args.
86 set dummy $ac_prog ; ac_word=$2
87 if test -n "$ac_word"; then
88 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
89 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
90 for ac_dir in $PATH; do
91 test -z "$ac_dir" && ac_dir=.
92 if test -x $ac_dir/$ac_word; then
99 if test -n "$LATEX"; then
105 ## Check whether this is really LaTeX2e
107 cat >chklatex.ltx <<EOF
108 \\nonstopmode\\makeatletter
109 \\ifx\\undefined\\documentclass\\else
110 \\message{ThisIsLaTeX2e}
114 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
115 | grep 'ThisIsLaTeX2e' >/dev/null; then
119 ac_result="not useable"
121 rm -f chklatex.ltx chklatex.log
122 echo "$ac_t""$ac_result"
123 test -n "$LATEX" && break
127 if test -z "$LATEX" ; then
132 if test x$lyx_check_config != x ; then
133 echo $ac_n "checking for the pdflatex program""... $ac_c"
134 echo "$ac_t""(pdflatex)"
136 for ac_prog in pdflatex
138 # Extract the first word of "$ac_prog", so it can be a program name with args.
139 set dummy $ac_prog ; ac_word=$2
140 if test -n "$ac_word"; then
141 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
142 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
143 for ac_dir in $PATH; do
144 test -z "$ac_dir" && ac_dir=.
145 if test -x $ac_dir/$ac_word; then
152 if test -n "$PDFLATEX"; then
158 ## Check whether this is really LaTeX2e
160 cat >chklatex.ltx <<EOF
161 \\nonstopmode\\makeatletter
162 \\ifx\\undefined\\documentclass\\else
163 \\message{ThisIsLaTeX2e}
167 if eval ${LATEX} chklatex.ltx </dev/null 2>/dev/null \
168 | grep 'ThisIsLaTeX2e' >/dev/null; then
172 ac_result="not useable"
174 rm -f chklatex.ltx chklatex.log
175 echo "$ac_t""$ac_result"
176 test -n "$PDFLATEX" && break
180 if test -z "$PDFLATEX" ; then
186 # Search for an installed reLyX or a ready-to-install one
188 PATH=${PATH}:./reLyX/
189 echo $ac_n "checking for reLyX LaTeX-to-LyX translator""... $ac_c"
190 echo "$ac_t""(reLyX)"
194 # Extract the first word of "$ac_prog", so it can be a program name with args.
195 set dummy $ac_prog ; ac_word=$2
196 if test -n "$ac_word"; then
197 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
198 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
199 for ac_dir in $PATH; do
200 test -z "$ac_dir" && ac_dir=.
201 if test -x $ac_dir/$ac_word; then
208 if test -n "$RELYX"; then
214 echo "$ac_t""$ac_result"
215 test -n "$RELYX" && break
219 if test -z "$RELYX" ; then
225 # Search something to process a literate document
226 echo $ac_n "checking for a Literate programming processor""... $ac_c"
227 echo "$ac_t""("noweave -delay -index")"
229 for ac_prog in "noweave -delay -index"
231 # Extract the first word of "$ac_prog", so it can be a program name with args.
232 set dummy $ac_prog ; ac_word=$2
233 if test -n "$ac_word"; then
234 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
235 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
236 for ac_dir in $PATH; do
237 test -z "$ac_dir" && ac_dir=.
238 if test -x $ac_dir/$ac_word; then
245 if test -n "$LITERATE"; then
251 echo "$ac_t""$ac_result"
252 test -n "$LITERATE" && break
256 if test -z "$LITERATE" ; then
260 if test "$LITERATE" = "none"; then LITERATE_EXT="none"; else LITERATE_EXT=".nw"; fi
262 # Search for a Postscript interpreter
263 echo $ac_n "checking for a Postscript interpreter""... $ac_c"
268 # Extract the first word of "$ac_prog", so it can be a program name with args.
269 set dummy $ac_prog ; ac_word=$2
270 if test -n "$ac_word"; then
271 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
272 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
273 for ac_dir in $PATH; do
274 test -z "$ac_dir" && ac_dir=.
275 if test -x $ac_dir/$ac_word; then
282 if test -n "$GS"; then
288 echo "$ac_t""$ac_result"
289 test -n "$GS" && break
293 if test -z "$GS" ; then
298 # Search something to preview postscript
299 echo $ac_n "checking for a Postscript previewer""... $ac_c"
300 echo "$ac_t""(gv ghostview)"
302 for ac_prog in gv ghostview
304 # Extract the first word of "$ac_prog", so it can be a program name with args.
305 set dummy $ac_prog ; ac_word=$2
306 if test -n "$ac_word"; then
307 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
308 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
309 for ac_dir in $PATH; do
310 test -z "$ac_dir" && ac_dir=.
311 if test -x $ac_dir/$ac_word; then
318 if test -n "$GHOSTVIEW"; then
324 echo "$ac_t""$ac_result"
325 test -n "$GHOSTVIEW" && break
329 if test -z "$GHOSTVIEW" ; then
334 # Search for a program to preview pdf
335 echo $ac_n "checking for a PDF preview""... $ac_c"
336 echo "$ac_t""(xpdf acroread gv ghostview)"
338 for ac_prog in xpdf acroread gv ghostview
340 # Extract the first word of "$ac_prog", so it can be a program name with args.
341 set dummy $ac_prog ; ac_word=$2
342 if test -n "$ac_word"; then
343 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
344 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
345 for ac_dir in $PATH; do
346 test -z "$ac_dir" && ac_dir=.
347 if test -x $ac_dir/$ac_word; then
354 if test -n "$PDFVIEWER"; then
360 echo "$ac_t""$ac_result"
361 test -n "$PDFVIEWER" && break
365 if test -z "$PDFVIEWER" ; then
370 # Search for a program to convert pdf to ps
371 echo $ac_n "checking for a PDF to PS converter""... $ac_c"
372 echo "$ac_t""(pdf2ps pdftops)"
374 for ac_prog in pdf2ps pdftops
376 # Extract the first word of "$ac_prog", so it can be a program name with args.
377 set dummy $ac_prog ; ac_word=$2
378 if test -n "$ac_word"; then
379 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
380 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
381 for ac_dir in $PATH; do
382 test -z "$ac_dir" && ac_dir=.
383 if test -x $ac_dir/$ac_word; then
390 if test -n "$PDFPS"; then
396 echo "$ac_t""$ac_result"
397 test -n "$PDFPS" && break
401 if test -z "$PDFPS" ; then
406 # Search for a program to convert dvi to ps
407 echo $ac_n "checking for a DVI to PS converter""... $ac_c"
408 echo "$ac_t""(dvips)"
412 # Extract the first word of "$ac_prog", so it can be a program name with args.
413 set dummy $ac_prog ; ac_word=$2
414 if test -n "$ac_word"; then
415 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
416 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
417 for ac_dir in $PATH; do
418 test -z "$ac_dir" && ac_dir=.
419 if test -x $ac_dir/$ac_word; then
426 if test -n "$DVIPS"; then
432 echo "$ac_t""$ac_result"
433 test -n "$DVIPS" && break
437 if test -z "$DVIPS" ; then
442 # Search a *roff program (used to translate tables in ASCII export)
443 echo $ac_n "checking for a *roff formatter""... $ac_c"
444 echo "$ac_t""(groff nroff)"
446 for ac_prog in groff nroff
448 # Extract the first word of "$ac_prog", so it can be a program name with args.
449 set dummy $ac_prog ; ac_word=$2
450 if test -n "$ac_word"; then
451 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
452 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
453 for ac_dir in $PATH; do
454 test -z "$ac_dir" && ac_dir=.
455 if test -x $ac_dir/$ac_word; then
462 if test -n "$ROFF"; then
468 echo "$ac_t""$ac_result"
469 test -n "$ROFF" && break
473 if test -z "$ROFF" ; then
477 ascii_roff_command=$ROFF
478 test $ROFF = "groff" && ascii_roff_command="groff -t -Tlatin1 \$\$FName"
479 test $ROFF = "nroff" && ascii_roff_command="tbl \$\$FName | nroff"
481 # Search the ChkTeX program
482 echo $ac_n "checking for ChkTeX""... $ac_c"
483 echo "$ac_t""(chktex)"
485 for ac_prog in chktex
487 # Extract the first word of "$ac_prog", so it can be a program name with args.
488 set dummy $ac_prog ; ac_word=$2
489 if test -n "$ac_word"; then
490 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
491 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
492 for ac_dir in $PATH; do
493 test -z "$ac_dir" && ac_dir=.
494 if test -x $ac_dir/$ac_word; then
501 if test -n "$CHKTEX"; then
507 echo "$ac_t""$ac_result"
508 test -n "$CHKTEX" && break
512 if test -z "$CHKTEX" ; then
516 chktex_command=$CHKTEX
517 test $CHKTEX = "chktex" && chktex_command="$CHKTEX -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"
519 # Search for a spellchecker
520 echo $ac_n "checking for a spell-checker""... $ac_c"
521 echo "$ac_t""(ispell)"
523 for ac_prog in ispell
525 # Extract the first word of "$ac_prog", so it can be a program name with args.
526 set dummy $ac_prog ; ac_word=$2
527 if test -n "$ac_word"; then
528 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
529 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
530 for ac_dir in $PATH; do
531 test -z "$ac_dir" && ac_dir=.
532 if test -x $ac_dir/$ac_word; then
539 if test -n "$SPELL"; then
545 echo "$ac_t""$ac_result"
546 test -n "$SPELL" && break
550 if test -z "$SPELL" ; then
555 # Search a Fax handling program
556 echo $ac_n "checking for a fax driver""... $ac_c"
557 echo "$ac_t""(sendfax faxsend fax)"
559 for ac_prog in sendfax faxsend fax
561 # Extract the first word of "$ac_prog", so it can be a program name with args.
562 set dummy $ac_prog ; ac_word=$2
563 if test -n "$ac_word"; then
564 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
565 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
566 for ac_dir in $PATH; do
567 test -z "$ac_dir" && ac_dir=.
568 if test -x $ac_dir/$ac_word; then
575 if test -n "$FAX"; then
581 echo "$ac_t""$ac_result"
582 test -n "$FAX" && break
586 if test -z "$FAX" ; then
590 if test $FAX = sendfax ; then
591 fax_command="sendfax -n -h '\$\$Host' -c '\$\$Comment' -x '\$\$Enterprise' -d '\$\$Name'@'\$\$Phone' '\$\$FName'"
592 elif test $FAX = faxsend ; then
593 fax_command="faxsend '\$\$Phone' '\$\$FName'"
594 elif test $FAX = fax ; then
595 fax_command="fax send '\$\$Phone' '\$\$FName'"
600 # Search for LinuxDoc support
601 echo $ac_n "checking for SGML-tools 1.x (LinuxDoc)""... $ac_c"
602 echo "$ac_t""(sgml2lyx)"
604 for ac_prog in sgml2lyx
606 # Extract the first word of "$ac_prog", so it can be a program name with args.
607 set dummy $ac_prog ; ac_word=$2
608 if test -n "$ac_word"; then
609 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
610 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
611 for ac_dir in $PATH; do
612 test -z "$ac_dir" && ac_dir=.
613 if test -x $ac_dir/$ac_word; then
620 if test -n "$LINUXDOC"; then
626 echo "$ac_t""$ac_result"
627 test -n "$LINUXDOC" && break
631 if test -z "$LINUXDOC" ; then
636 if test $LINUXDOC != none; then
638 linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
643 linuxdoc_to_latex_command="sgml2latex"
644 linuxdoc_to_html_command="sgml2html '\$\$FName'"
645 linuxdoc_to_lyx_command="sgml2lyx";;
647 linuxdoc_to_latex_command="none"
648 linuxdoc_to_html_command="none"
649 linuxdoc_to_lyx_command="none";;
652 # Search for DocBook support
653 echo $ac_n "checking for SGML-tools 2.x (DocBook) or db2x scripts""... $ac_c"
654 echo "$ac_t""(sgmltools db2dvi)"
656 for ac_prog in sgmltools db2dvi
658 # Extract the first word of "$ac_prog", so it can be a program name with args.
659 set dummy $ac_prog ; ac_word=$2
660 if test -n "$ac_word"; then
661 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
662 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
663 for ac_dir in $PATH; do
664 test -z "$ac_dir" && ac_dir=.
665 if test -x $ac_dir/$ac_word; then
672 if test -n "$DOCBOOK"; then
678 echo "$ac_t""$ac_result"
679 test -n "$DOCBOOK" && break
683 if test -z "$DOCBOOK" ; then
688 if test $DOCBOOK != none; then
690 docbook_cmd="\\def\\hasdocbook{yes}"
695 docbook_to_dvi_command="sgmltools -b dvi"
696 docbook_to_html_command="sgmltools -b html '\$\$FName'";;
698 docbook_to_dvi_command="db2dvi"
699 docbook_to_html_command="db2html '\$\$FName'";;
701 docbook_to_dvi_command="none"
702 docbook_to_html_command="none";;
705 # Search for a spool command
706 echo $ac_n "checking for a spool command""... $ac_c"
707 echo "$ac_t""(lp lpr)"
709 for ac_prog in lp lpr
711 # Extract the first word of "$ac_prog", so it can be a program name with args.
712 set dummy $ac_prog ; ac_word=$2
713 if test -n "$ac_word"; then
714 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
715 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
716 for ac_dir in $PATH; do
717 test -z "$ac_dir" && ac_dir=.
718 if test -x $ac_dir/$ac_word; then
725 if test -n "$LPR"; then
731 echo "$ac_t""$ac_result"
732 test -n "$LPR" && break
736 if test -z "$LPR" ; then
741 lp) print_spool_command=lp
742 print_spool_printerprefix="-d ";;
743 lpr) print_spool_command=lpr
744 print_spool_printerprefix="-P";;
745 *) :;; # leave to empty values
748 # Search for a latex to html converter
749 echo $ac_n "checking for an HTML converter""... $ac_c"
750 echo "$ac_t""(tth latex2html hevea)"
752 for ac_prog in tth latex2html hevea
754 # Extract the first word of "$ac_prog", so it can be a program name with args.
755 set dummy $ac_prog ; ac_word=$2
756 if test -n "$ac_word"; then
757 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
758 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
759 for ac_dir in $PATH; do
760 test -z "$ac_dir" && ac_dir=.
761 if test -x $ac_dir/$ac_word; then
768 if test -n "$TOHTML"; then
774 echo "$ac_t""$ac_result"
775 test -n "$TOHTML" && break
779 if test -z "$TOHTML" ; then
784 tth) html_command="tth -t < '\$\$FName' > '\$\$OutName'";;
785 latex2html) html_command="latex2html -no_subdir -split 0 -show_section_numbers '\$\$FName'";;
786 hevea) html_command="hevea -s '\$\$FName'";;
789 #### Explore the LaTeX configuration
790 echo $ac_n "checking LaTeX configuration""... $ac_c"
791 # First, remove the files that we want to re-create
792 rm -f textclass.lst packages.lst chkconfig.sed
793 if test ${lyx_check_config} = no ; then
794 echo "$ac_t""default values"
797 rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
798 cat >wrap_chkconfig.ltx <<EOF
799 \\newcommand\\srcdir{${srcdir}}
802 \\input{${srcdir}/chkconfig.ltx}
804 ## Construct the list of classes to test for.
805 # build the list of available layout files and convert it to commands
807 for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
810 *) test -r "$file" && echo $file ;;
812 done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
814 eval ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
815 eval `cat chkconfig.vars | sed 's/-/_/g'`
818 # Do we have all the files we need? Useful if latex did not run
819 echo creating textclass.lst
820 # if textclass.lst does not exist (because LaTeX did not run),
821 # then provide a standard version.
822 if test ! -f textclass.lst ; then
823 cat >textclass.lst <<EOF
824 # This file declares layouts and their associated definition files
825 # (include dir. relative to the place where this file is).
826 # It contains only default values, since chkconfig.ltx could not be run
827 # for some reason. Run ./configure if you need to update it after a
828 # configuration change.
829 article article article
832 linuxdoc linuxdoc linuxdoc
837 # if chkconfig.sed does not exist (because LaTeX did not run),
838 # then provide a standard version.
839 if test ! -f chkconfig.sed ; then
840 cat >chkconfig.sed <<EOF
845 echo creating packages.lst
846 # if packages.lst does not exist (because LaTeX did not run),
847 # then provide a standard version.
848 if test ! -f packages.lst ; then
849 cat >packages.lst <<EOF
850 # This file should contain the list of LaTeX packages that have been
851 # recognized by LyX. Unfortunately, since configure could not find
852 # your LaTeX2e program, the tests have not been run. Run ./configure
853 # if you need to update it after a configuration change.
858 echo creating doc/LaTeXConfig.lyx
859 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
860 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
861 sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
863 echo creating lyxrc.defaults
865 cat >lyxrc.defaults <<EOF
866 # This file has been automatically generated by LyX' lib/configure
867 # script. It contains default settings that have been determined by
868 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
869 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
870 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
871 # override the values given here.
872 \\latex_command "$LATEX"
873 \\pdflatex_command "$PDFLATEX"
874 \\view_pdf_command "$PDFVIEWER"
875 \\pdf_to_ps_command "$PDFPS"
876 \\dvi_to_ps_command "$DVIPS"
877 \\relyx_command "$RELYX"
878 \\literate_command "$LITERATE"
879 \\literate_extension "$LITERATE_EXT"
881 \\view_ps_command "$GHOSTVIEW -swap"
882 \\view_pspic_command "$GHOSTVIEW"
883 \\ascii_roff_command "$ascii_roff_command"
884 \\chktex_command "$chktex_command"
885 \\spell_command "$SPELL"
886 \\fax_command "$fax_command"
887 \\linuxdoc_to_latex_command "$linuxdoc_to_latex_command"
888 \\linuxdoc_to_html_command "$linuxdoc_to_html_command"
889 \\linuxdoc_to_lyx_command "$linuxdoc_to_lyx_command"
890 \\docbook_to_dvi_command "$docbook_to_dvi_command"
891 \\docbook_to_html_command "$docbook_to_html_command"
892 \\html_command "$html_command"
893 \\print_spool_command "$print_spool_command"
894 \\print_spool_printerprefix "$print_spool_printerprefix"
895 \\font_encoding "$chk_fontenc"
898 # Remove superfluous files if we are not writing in the main lib
900 for file in lyxrc.defaults textclass.lst packages.lst \
901 doc/LaTeXConfig.lyx ; do
902 # we rename the file first, so that we avoid comparing a file with itself
904 if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ;
906 echo "removing $file, which is identical to the system global version"
915 if test $lyx_keep_temps = no ; then
916 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \