]> git.lyx.org Git - lyx.git/blobdiff - lib/configure.m4
use <cmd>-Tab and <cmd>-backtab as shortcuts for
[lyx.git] / lib / configure.m4
index 43d5810313c2c05bbade7085dfa73683577f925c..ad2af1dae87d27dad5e440a546dc1a594caa1249 100644 (file)
@@ -167,8 +167,8 @@ ac_prog=[$]0
 changequote(,)dnl
 srcdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-test "x$srcdir" = "x$ac_prog" && srcdir=.
-if test ! -r ${srcdir}/chkconfig.ltx ; then
+test "x${srcdir}" = "x$ac_prog" && srcdir=.
+if test ! -r "${srcdir}"/chkconfig.ltx ; then
   echo "configure: error: cannot find chkconfig.ltx script"
   exit 1
 fi
@@ -314,7 +314,7 @@ lyxpreview_to_bitmap_command='python $$s/lyxpreview2bitmap.py'
 SEARCH_PROG([for dvipng],DVIPNG,dvipng)
 
 test "$DVIPNG" = "dvipng" && \
-       lyxpreview_to_png_command = $lyxpreview_to_bitmap_command
+       lyxpreview_to_png_command=$lyxpreview_to_bitmap_command
 
 # Search a *roff program (used to translate tables in ASCII export)
 LYXRC_PROG([for a *roff formatter], \ascii_roff_command, dnl
@@ -426,9 +426,9 @@ if test ${lyx_check_config} = no ; then
 # for some reason. Run ./configure if you need to update it after a
 # configuration change.
 EOF
-  # build the list of available layout files and convert it to commands
-  # for chkconfig.ltx
-  for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
+  # build the list of available layout files and convert it to entries
+  # for the default textclass.lst file
+  for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
     case $file in
       */\*.layout) ;;
       *) if test -r "$file" ; then
@@ -440,12 +440,12 @@ changequote([,])dnl
              [eval] "found_$cleanclass=yes"
 changequote(,)dnl
             # The sed commands below are a bit scary. Here is what they do:
-            # 1-3: remove the \DeclareFOO macro and add the correct boolean 
-            #      at the end of the line telling whether the class is 
+            # 1-3: remove the \DeclareFOO macro and add the correct boolean
+            #      at the end of the line telling whether the class is
              #      available
-            # 4: if the macro had an optional argument with several 
+            # 4: if the macro had an optional argument with several
             #    parameters, only keep the first one
-            # 5: if the macro did not have an optional argument, provide one 
+            # 5: if the macro did not have an optional argument, provide one
             #    (equal to the class name)
             # 6: remove brackets and replace with correctly quoted entries
             grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
@@ -459,31 +459,39 @@ changequote(,)dnl
            fi
         fi ;;
     esac
-  done 
+  done
   MSG_RESULT(done)
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
+  if ! test -r "chkconfig.ltx" ; then
+    ln -s "${srcdir}"/chkconfig.ltx .
+    rmlink=true
+  fi
   cat >wrap_chkconfig.ltx <<EOF
-\\newcommand\\srcdir{${srcdir}}
 ${linuxdoc_cmd}
 ${docbook_cmd}
-\\input{${srcdir}/chkconfig.ltx}
+\\input{chkconfig.ltx}
 EOF
   ## Construct the list of classes to test for.
   # build the list of available layout files and convert it to commands
   # for chkconfig.ltx
-  for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
+  for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
     case $file in
       */\*.layout) ;;
-      *) test -r "$file" && echo $file ;;
+      *) if test -r "$file" ; then
+           class=`echo $file | sed -e 's%^.*layouts/\(.*\)\.layout$%\1%'`
+          # Generate the proper TestDocClass command for this layout
+          grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
+             | sed -e 's/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/'
+        fi ;;
     esac
-  done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
-            > chklayouts.tex
+  done > chklayouts.tex
 changequote([,])dnl
   [eval] ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
   [eval] `cat chkconfig.vars | sed 's/-/_/g'`
 changequote(,)dnl
+  test -n "${rmlink}" && rm -f chkconfig.ltx
 fi
 
 # Do we have all the files we need? Useful if latex did not run
@@ -503,7 +511,7 @@ changequote(,)dnl
 echo "creating doc/LaTeXConfig.lyx"
 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
-sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
+sed -f chkconfig.sed "${srcdir}"/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
 
 echo "creating $outfile"
 cat >$outfile <<EOF
@@ -521,6 +529,7 @@ cat >$outfile <<EOF
 \\Format date       ""     "date command"          "" ""       ""
 \\Format dateout    tmp    "date (output)"         "" ""       ""
 \\Format docbook    sgml    DocBook                B  ""       ""
+\\Format docbook-xml xml    "Docbook (xml)"        "" "" ""
 \\Format dvi        dvi     DVI                    D  "$DVI_VIEWER"    ""
 \\Format eps        eps     EPS                    "" "$EPS_VIEWER"    ""
 \\Format fax        ""      Fax                    "" ""       ""
@@ -554,6 +563,7 @@ cat >$outfile <<EOF
 \\Format xpm        xpm     XPM                    "" "$RASTERIMAGE_VIEWER"    "$RASTERIMAGE_EDITOR"
 
 \\converter date       dateout    "date +%d-%m-%Y > \$\$o"     ""
+\\converter docbook    docbook-xml "cp \$\$i \$\$o" "xml"
 \\converter docbook    dvi        "$docbook_to_dvi_command"    ""
 \\converter docbook    html       "$docbook_to_html_command"   ""
 \\converter dvi        pdf3       "$dvi_to_pdf_command"        ""
@@ -626,6 +636,10 @@ fi
 
 cat >>$outfile <<EOF
 
+\\copier    fig        "sh \$\$s/fig_copy.sh \$\$i \$\$o"
+\\copier    pstex      "python \$\$s/tex_copy.py \$\$i \$\$o \$\$l"
+\\copier    pdftex     "python \$\$s/tex_copy.py \$\$i \$\$o \$\$l"
+
 $rc_entries
 \\font_encoding "$chk_fontenc"
 EOF
@@ -671,7 +685,7 @@ for file in $outfile textclass.lst packages.lst \
            doc/LaTeXConfig.lyx xfonts/fonts.dir ; do
   # we rename the file first, so that we avoid comparing a file with itself
   mv $file $file.new
-  if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ;
+  if test -r "${srcdir}"/$file && diff $file.new "${srcdir}"/$file >/dev/null 2>/dev/null ;
   then
     echo "removing $file, which is identical to the system global version"
     rm -f $file.new