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"
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="${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
133 # Search for an installed reLyX or a ready-to-install one
135 PATH=${PATH}:./reLyX/
136 echo $ac_n "checking for reLyX LaTeX-to-LyX translator""... $ac_c"
141 # Extract the first word of "$ac_prog", so it can be a program name with args.
142 set dummy $ac_prog ; ac_word=$2
143 if test -n "$ac_word"; then
144 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
145 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
146 for ac_dir in $PATH; do
147 test -z "$ac_dir" && ac_dir=.
148 if test -x $ac_dir/$ac_word; then
155 if test -n "$RELYX"; then
161 echo "$ac_t""$ac_result"
162 test -n "$RELYX" && break
166 if test -z "$RELYX" ; then
172 # Search something to process a literate document
173 echo $ac_n "checking for a Literate programming processor""... $ac_c"
176 for ac_prog in "noweave -delay -index"
178 # Extract the first word of "$ac_prog", so it can be a program name with args.
179 set dummy $ac_prog ; ac_word=$2
180 if test -n "$ac_word"; then
181 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
182 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
183 for ac_dir in $PATH; do
184 test -z "$ac_dir" && ac_dir=.
185 if test -x $ac_dir/$ac_word; then
192 if test -n "$LITERATE"; then
198 echo "$ac_t""$ac_result"
199 test -n "$LITERATE" && break
203 if test -z "$LITERATE" ; then
207 if test "$LITERATE" = "none"; then LITERATE_EXT="none"; else LITERATE_EXT=".nw"; fi
209 # Search for a Postscript interpreter
210 echo $ac_n "checking for a Postscript interpreter""... $ac_c"
215 # Extract the first word of "$ac_prog", so it can be a program name with args.
216 set dummy $ac_prog ; ac_word=$2
217 if test -n "$ac_word"; then
218 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
219 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
220 for ac_dir in $PATH; do
221 test -z "$ac_dir" && ac_dir=.
222 if test -x $ac_dir/$ac_word; then
229 if test -n "$GS"; then
235 echo "$ac_t""$ac_result"
236 test -n "$GS" && break
240 if test -z "$GS" ; then
245 # Search something to preview postscript
246 echo $ac_n "checking for a Postscript previewer""... $ac_c"
249 for ac_prog in gv ghostview
251 # Extract the first word of "$ac_prog", so it can be a program name with args.
252 set dummy $ac_prog ; ac_word=$2
253 if test -n "$ac_word"; then
254 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
255 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
256 for ac_dir in $PATH; do
257 test -z "$ac_dir" && ac_dir=.
258 if test -x $ac_dir/$ac_word; then
265 if test -n "$GHOSTVIEW"; then
271 echo "$ac_t""$ac_result"
272 test -n "$GHOSTVIEW" && break
276 if test -z "$GHOSTVIEW" ; then
281 # Search a *roff program (used to translate tables in ASCII export)
282 echo $ac_n "checking for a *roff formatter""... $ac_c"
285 for ac_prog in groff nroff
287 # Extract the first word of "$ac_prog", so it can be a program name with args.
288 set dummy $ac_prog ; ac_word=$2
289 if test -n "$ac_word"; then
290 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
291 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
292 for ac_dir in $PATH; do
293 test -z "$ac_dir" && ac_dir=.
294 if test -x $ac_dir/$ac_word; then
301 if test -n "$ROFF"; then
307 echo "$ac_t""$ac_result"
308 test -n "$ROFF" && break
312 if test -z "$ROFF" ; then
316 ascii_roff_command=$ROFF
317 test $ROFF = "groff" && ascii_roff_command="groff -t -Tlatin1 \$\$FName"
318 test $ROFF = "nroff" && ascii_roff_command="tbl \$\$FName | nroff"
320 # Search the ChkTeX program
321 echo $ac_n "checking for ChkTeX""... $ac_c"
324 for ac_prog in chktex
326 # Extract the first word of "$ac_prog", so it can be a program name with args.
327 set dummy $ac_prog ; ac_word=$2
328 if test -n "$ac_word"; then
329 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
330 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
331 for ac_dir in $PATH; do
332 test -z "$ac_dir" && ac_dir=.
333 if test -x $ac_dir/$ac_word; then
340 if test -n "$CHKTEX"; then
346 echo "$ac_t""$ac_result"
347 test -n "$CHKTEX" && break
351 if test -z "$CHKTEX" ; then
355 chktex_command=$CHKTEX
356 test $CHKTEX = "chktex" && chktex_command="$CHKTEX -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"
358 # Search for a spellchecker
359 echo $ac_n "checking for a spell-checker""... $ac_c"
362 for ac_prog in ispell
364 # Extract the first word of "$ac_prog", so it can be a program name with args.
365 set dummy $ac_prog ; ac_word=$2
366 if test -n "$ac_word"; then
367 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
368 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
369 for ac_dir in $PATH; do
370 test -z "$ac_dir" && ac_dir=.
371 if test -x $ac_dir/$ac_word; then
378 if test -n "$SPELL"; then
384 echo "$ac_t""$ac_result"
385 test -n "$SPELL" && break
389 if test -z "$SPELL" ; then
394 # Search a Fax handling program
395 echo $ac_n "checking for a fax driver""... $ac_c"
398 for ac_prog in sendfax faxsend fax
400 # Extract the first word of "$ac_prog", so it can be a program name with args.
401 set dummy $ac_prog ; ac_word=$2
402 if test -n "$ac_word"; then
403 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
404 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
405 for ac_dir in $PATH; do
406 test -z "$ac_dir" && ac_dir=.
407 if test -x $ac_dir/$ac_word; then
414 if test -n "$FAX"; then
420 echo "$ac_t""$ac_result"
421 test -n "$FAX" && break
425 if test -z "$FAX" ; then
429 if test $FAX = sendfax ; then
430 fax_command="sendfax -n -h '\$\$Host' -c '\$\$Comment' -x '\$\$Enterprise' -d '\$\$Name'@'\$\$Phone' '\$\$FName'"
431 elif test $FAX = faxsend ; then
432 fax_command="faxsend '\$\$Phone' '\$\$FName'"
433 elif test $FAX = fax ; then
434 fax_command="fax send '\$\$Phone' '\$\$FName'"
439 # Search for LinuxDoc support
440 echo $ac_n "checking for SGML-tools 1.x (LinuxDoc)""... $ac_c"
443 for ac_prog in sgml2lyx
445 # Extract the first word of "$ac_prog", so it can be a program name with args.
446 set dummy $ac_prog ; ac_word=$2
447 if test -n "$ac_word"; then
448 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
449 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
450 for ac_dir in $PATH; do
451 test -z "$ac_dir" && ac_dir=.
452 if test -x $ac_dir/$ac_word; then
459 if test -n "$LINUXDOC"; then
465 echo "$ac_t""$ac_result"
466 test -n "$LINUXDOC" && break
470 if test -z "$LINUXDOC" ; then
475 if test $LINUXDOC != none; then
477 linuxdoc_cmd="\\def\\haslinuxdoc{yes}"
480 # Search for DocBook support
481 echo $ac_n "checking for SGML-tools 2.x (DocBook)""... $ac_c"
484 for ac_prog in sgmltools
486 # Extract the first word of "$ac_prog", so it can be a program name with args.
487 set dummy $ac_prog ; ac_word=$2
488 if test -n "$ac_word"; then
489 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
490 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
491 for ac_dir in $PATH; do
492 test -z "$ac_dir" && ac_dir=.
493 if test -x $ac_dir/$ac_word; then
500 if test -n "$DOCBOOK"; then
506 echo "$ac_t""$ac_result"
507 test -n "$DOCBOOK" && break
511 if test -z "$DOCBOOK" ; then
516 if test $DOCBOOK != none; then
518 docbook_cmd="\\def\\hasdocbook{yes}"
522 # Search for a spool command
523 echo $ac_n "checking for a spool command""... $ac_c"
526 for ac_prog in lp lpr
528 # Extract the first word of "$ac_prog", so it can be a program name with args.
529 set dummy $ac_prog ; ac_word=$2
530 if test -n "$ac_word"; then
531 echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
532 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
533 for ac_dir in $PATH; do
534 test -z "$ac_dir" && ac_dir=.
535 if test -x $ac_dir/$ac_word; then
542 if test -n "$LPR"; then
548 echo "$ac_t""$ac_result"
549 test -n "$LPR" && break
553 if test -z "$LPR" ; then
558 lp) print_spool_command=lp
559 print_spool_printerprefix="-d ";;
560 lpr) print_spool_command=lpr
561 print_spool_printerprefix="-P";;
562 *) :;; # leave to empty values
565 #### Explore the LaTeX configuration
566 echo $ac_n "checking LaTeX configuration""... $ac_c"
567 # First, remove the files that we want to re-create
568 rm -f textclass.lst packages.lst chkconfig.sed
569 if test ${lyx_check_config} = no ; then
570 echo "$ac_t""default values"
573 rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
574 cat >wrap_chkconfig.ltx <<EOF
575 \\newcommand\\srcdir{${srcdir}}
578 \\input{${srcdir}/chkconfig.ltx}
580 ## Construct the list of classes to test for.
581 # build the list of available layout files and convert it to commands
583 for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
588 done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
590 eval ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
591 eval `cat chkconfig.vars | sed 's/-/_/g'`
594 # Do we have all the files we need? Useful if latex did not run
595 echo creating textclass.lst
596 # if textclass.lst does not exist (because LaTeX did not run),
597 # then provide a standard version.
598 if test ! -f textclass.lst ; then
599 cat >textclass.lst <<EOF
600 # This file declares layouts and their associated definition files
601 # (include dir. relative to the place where this file is).
602 # It contains only default values, since chkconfig.ltx could not be run
603 # for some reason. Run ./configure if you need to update it after a
604 # configuration change.
605 article article article
608 linuxdoc linuxdoc linuxdoc
613 # if chkconfig.sed does not exist (because LaTeX did not run),
614 # then provide a standard version.
615 if test ! -f chkconfig.sed ; then
616 cat >chkconfig.sed <<EOF
621 echo creating packages.lst
622 # if packages.lst does not exist (because LaTeX did not run),
623 # then provide a standard version.
624 if test ! -f packages.lst ; then
625 cat >packages.lst <<EOF
626 # This file should contain the list of LaTeX packages that have been
627 # recognized by LyX. Unfortunately, since configure could not find
628 # your LaTeX2e program, the tests have not been run. Run ./configure
629 # if you need to update it after a configuration change.
634 echo creating doc/LaTeXConfig.lyx
635 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
636 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
637 sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
639 echo creating lyxrc.defaults
641 cat >lyxrc.defaults <<EOF
642 # This file has been automatically generated by LyX' lib/configure
643 # script. It contains default settings that have been determined by
644 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
645 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
646 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
647 # override the values given here.
648 \\latex_command "$LATEX"
649 \\relyx_command "$RELYX"
650 \\literate_command "$LITERATE"
651 \\literate_extension "$LITERATE_EXT"
653 \\view_ps_command "$GHOSTVIEW -swap"
654 \\view_pspic_command "$GHOSTVIEW"
655 \\ascii_roff_command "$ascii_roff_command"
656 \\chktex_command "$chktex_command"
657 \\spell_command "$SPELL"
658 \\fax_command "$fax_command"
659 \\print_spool_command "$print_spool_command"
660 \\print_spool_printerprefix "$print_spool_printerprefix"
661 \\font_encoding "$chk_fontenc"
664 # Remove superfluous files if we are not writing in the main lib
666 for file in lyxrc.defaults textclass.lst packages.lst \
667 doc/LaTeXConfig.lyx ; do
668 # we rename the file first, so that we avoid comparing a file with itself
670 if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ;
672 echo "removing $file, which is identical to the system global version"
681 if test $lyx_keep_temps = no ; then
682 rm -f chkconfig.sed chkconfig.vars wrap_chkconfig.* chklayouts.tex \