Permalink
Browse files

build: rely on autoconf latex helpers.

  • Loading branch information...
1 parent e97ef51 commit 8be9b514bef34fa10d677daa9a343b8b013d8f96 @chergert committed Jan 14, 2013
Showing with 2,171 additions and 11 deletions.
  1. +4 −1 Makefile.am
  2. +11 −10 configure.ac
  3. +46 −0 m4/_ac_latex_test.m4
  4. +69 −0 m4/ac_latex_class.m4
  5. +35 −0 m4/ac_latex_class_article.m4
  6. +35 −0 m4/ac_latex_class_book.m4
  7. +35 −0 m4/ac_latex_class_report.m4
  8. +52 −0 m4/ac_latex_classes.m4
  9. +55 −0 m4/ac_latex_dvips_o_stdout.m4
  10. +59 −0 m4/ac_latex_dvips_t.m4
  11. +37 −0 m4/ac_latex_dvips_t_a4.m4
  12. +38 −0 m4/ac_latex_dvips_t_a4_landscape.m4
  13. +38 −0 m4/ac_latex_dvips_t_letter.m4
  14. +38 −0 m4/ac_latex_dvips_t_letter_landscape.m4
  15. +83 −0 m4/ac_latex_package.m4
  16. +66 −0 m4/ac_latex_package_amsmath.m4
  17. +74 −0 m4/ac_latex_package_fontenc.m4
  18. +58 −0 m4/ac_latex_package_input.m4
  19. +64 −0 m4/ac_latex_package_opt.m4
  20. +54 −0 m4/ac_latex_packages.m4
  21. +41 −0 m4/ac_prog_bibtex.m4
  22. +41 −0 m4/ac_prog_dvibook.m4
  23. +41 −0 m4/ac_prog_dvipdf.m4
  24. +41 −0 m4/ac_prog_dvips.m4
  25. +41 −0 m4/ac_prog_fig2dev.m4
  26. +41 −0 m4/ac_prog_gnuplot.m4
  27. +41 −0 m4/ac_prog_gunzip.m4
  28. +41 −0 m4/ac_prog_gzip.m4
  29. +41 −0 m4/ac_prog_jpeg2ps.m4
  30. +41 −0 m4/ac_prog_jpegtopnm.m4
  31. +41 −0 m4/ac_prog_kpsewhich.m4
  32. +41 −0 m4/ac_prog_latex.m4
  33. +41 −0 m4/ac_prog_latex2html.m4
  34. +41 −0 m4/ac_prog_latex2man.m4
  35. +41 −0 m4/ac_prog_latex2png.m4
  36. +41 −0 m4/ac_prog_latex2rtf.m4
  37. +41 −0 m4/ac_prog_makeindex.m4
  38. +41 −0 m4/ac_prog_mf.m4
  39. +41 −0 m4/ac_prog_mktexpk.m4
  40. +41 −0 m4/ac_prog_pdflatex.m4
  41. +41 −0 m4/ac_prog_pngtopnm.m4
  42. +41 −0 m4/ac_prog_pnmtops.m4
  43. +41 −0 m4/ac_prog_ps2pdf.m4
  44. +41 −0 m4/ac_prog_psbook.m4
  45. +41 −0 m4/ac_prog_psnup.m4
  46. +41 −0 m4/ac_prog_psresize.m4
  47. +41 −0 m4/ac_prog_psselect.m4
  48. +41 −0 m4/ac_prog_texhash.m4
  49. +72 −0 m4/ac_texmf_path.m4
View
@@ -1,5 +1,8 @@
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+
+
pdfdatadir = $(datadir)/gnome-desktop-programming
-pdfdata_DATA :=
+pdfdata_DATA =
pdfdata_DATA += gnome-desktop-programming.pdf
View
@@ -4,21 +4,22 @@ dnl ************************************************************************
AC_PREREQ([2.69])
AC_INIT([gnome-desktop-programming],[0.1.0])
AM_INIT_AUTOMAKE([1.11.1 no-dist-gzip dist-xz])
+AC_CONFIG_MACRO_DIR([m4])
dnl ************************************************************************
-dnl Check for required programs.
+dnl Check for latex dependencies.
dnl ************************************************************************
-AC_PATH_PROG([PDFLATEX], [pdflatex], [])
-if test "$PDFLATEX" = ""; then
- AC_MSG_ERROR([pdflatex could not be found, please install texlive-latex.])
-fi
+AC_LATEX_CLASS_ARTICLE
+AC_LATEX_PACKAGE_AMSMATH
+AC_LATEX_PACKAGE_FONTENC
+AC_PROG_MF
+AC_PROG_PDFLATEX
-AC_PATH_PROG([MF2PT1], [mf2pt1], [])
-if test "$MF2PT1" = ""; then
- AC_MSG_ERROR([mf2pt1 could not be found, please install texlive-mf2pt1.])
-fi
+dnl ************************************************************************
+dnl Check for other required programs.
+dnl ************************************************************************
AC_PATH_PROG([DIA], [dia], [])
if test "$DIA" = ""; then
AC_MSG_ERROR([dia could not be found, please install dia.])
@@ -44,5 +45,5 @@ echo " Prefix .................: ${prefix}"
echo ""
echo " Programs"
echo " dia ..................: ${DIA}"
-echo " pdflatex .............: ${PDFLATEX}"
+echo " pdflatex .............: ${pdflatex}"
echo ""
View
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2004 Boretti Mathieu
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# Internal macro to test a latex file
+#
+
+AC_DEFUN([_AC_LATEX_TEST],[
+AC_REQUIRE([AC_PROG_LATEX])
+rm -rf .tmps_latex
+mkdir .tmps_latex
+cd .tmps_latex
+ifelse($#,2,[
+$2="no"; export $2;
+cat > testconf.tex << \EOF
+$1
+EOF
+],$#,3,[
+echo "\\documentclass{$3}" > testconf.tex
+cat >> testconf.tex << \EOF
+$1
+EOF
+],$#,4,[
+echo "\\documentclass{$3}" > testconf.tex
+echo "\\usepackage{$4}" > testconf.tex
+cat >> testconf.tex << \EOF
+$1
+])
+cat testconf.tex | $latex 2>&1 1>/dev/null && $2=yes; export $2;
+cd ..
+rm -rf .tmps_latex
+])
View
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2004 Boretti Mathieu
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# AC_LATEX_CLASS(<class>,<variable>)
+#
+# Test the presences of class and set $<variable>
+# to yes or no
+#
+#
+dnl @synopsis AC_LATEX_CLASSE(<class1>,<var>)
+dnl
+dnl Test if class1 exists
+dnl and set $var to the right value
+dnl
+dnl AC_LATEX_CLASSES([book],book)
+dnl should set $book="yes"
+dnl
+dnl AC_LATEX_CLASSES(allo,book)
+dnl should set $book="no"
+dnl
+dnl @version 1.3
+dnl @author Mathieu Boretti boretti@eig.unige.ch
+dnl
+AC_DEFUN([AC_LATEX_CLASS],[
+AC_CACHE_CHECK([for class $1],[ac_cv_latex_class_]translit($1,[-],[_]),[
+_AC_LATEX_TEST([
+\begin{document}
+\end{document}
+],[ac_cv_latex_class_]translit($1,[-],[_]),$1)
+])
+$2=$[ac_cv_latex_class_]translit($1,[-],[_]) ; export $2;
+AC_SUBST($2)
+ifelse($#,2,[],$#,3,[
+ if test "[$]$2" = "yes" ;
+ then
+ $3
+ fi
+],$#,4,[
+ ifelse($3,[],[
+ if test "[$]$2" = "no" ;
+ then
+ $4
+ fi
+ ],[
+ if test "[$]$2" = "yes" ;
+ then
+ $3
+ else
+ $4
+ fi
+ ])
+])
+
+])
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2004 Boretti Mathieu
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# AC_LATEX_CLASS_ARTICLE
+#
+# Test the presences class article and
+# set article to yes if exists,
+# else Error
+#
+#
+dnl @synopsis AC_LATEX_CLASS_ARTICLE
+dnl
+dnl same as AC_LATEX_CLASS(article,article)
+dnl
+dnl @version 1.3
+dnl @author Mathieu Boretti boretti@eig.unige.ch
+dnl
+AC_DEFUN([AC_LATEX_CLASS_ARTICLE],[
+AC_LATEX_CLASS(article,article,[],[AC_MSG_ERROR([Unable to find the article class])])
+])
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2004 Boretti Mathieu
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# AC_LATEX_CLASS_BOOK
+#
+# Test the presences class book and
+# set book to yes if exists,
+# else Error
+#
+#
+dnl @synopsis AC_LATEX_CLASS_BOOK
+dnl
+dnl same as AC_LATEX_CLASS(book,book)
+dnl
+dnl @version 1.3
+dnl @author Mathieu Boretti boretti@eig.unige.ch
+dnl
+AC_DEFUN([AC_LATEX_CLASS_BOOK],[
+AC_LATEX_CLASS(book,book,[],[AC_MSG_ERROR([Unable to find the book class])])
+])
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2004 Boretti Mathieu
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# AC_LATEX_CLASS_REPORT
+#
+# Test the presences class report and
+# set report to yes if exists,
+# else Error
+#
+#
+dnl @synopsis AC_LATEX_CLASS_REPORT
+dnl
+dnl same as AC_LATEX_CLASS(report,report)
+dnl
+dnl @version 1.3
+dnl @author Mathieu Boretti boretti@eig.unige.ch
+dnl
+AC_DEFUN([AC_LATEX_CLASS_REPORT],[
+AC_LATEX_CLASS(report,report,[],[AC_MSG_ERROR([Unable to find the report class])])
+])
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2004 Boretti Mathieu
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# AC_LATEX_CLASSES([<class1>,<class2>,...,<classn>],<variable>)
+#
+# Test the presences of class1 or class2 or ...
+# and set $<variable> to the right value or no if not found
+#
+dnl @synopsis AC_LATEX_CLASSES([<class1>,<class2>,...],<var>)
+dnl
+dnl Test if class1 exists and if not class2 and so
+dnl and set $var to the right value
+dnl
+dnl AC_LATEX_CLASSES([allo,book,bnjour],book)
+dnl should set $book="book"
+dnl
+dnl @version 1.3
+dnl @author Mathieu Boretti boretti@eig.unige.ch
+dnl
+define(_AC_LATEX_CLASSES_INTERNE,[
+ ifelse($#,1,[],$#,2,[
+ AC_LATEX_CLASS($2,$1)
+ ],[
+ AC_LATEX_CLASS($2,$1)
+ if test "$$1" = "yes";
+ then
+ $1=$2 ; export $1 ;
+ else
+ _AC_LATEX_CLASSES_INTERNE($1,m4_shift(m4_shift($@)))
+ fi;
+ ])
+])
+
+AC_DEFUN([AC_LATEX_CLASSES],[
+ _AC_LATEX_CLASSES_INTERNE($2,$1)
+ AC_SUBST($2)
+])
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2004 Boretti Mathieu
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# AC_LATEX_DVIPS_O_STDOUT
+#
+# Test dvips with option -o- and set $dvips_o_stdout to the right value
+#
+#
+dnl @synopsis AC_LATEX_DVIPS_O_STDOUT
+dnl
+dnl test if dvips -o- works. If so, set $dvips_o_stdout to yes else to no
+dnl
+dnl @version 1.3
+dnl @author Mathieu Boretti boretti@eig.unige.ch
+dnl
+AC_DEFUN([AC_LATEX_DVIPS_O_STDOUT],[
+AC_REQUIRE([AC_LATEX_CLASS_BOOK])
+AC_CACHE_CHECK([for option -o- in dvips],ac_cv_dvips_o_stdout,[
+rm -rf .dvips
+mkdir .dvips
+cd .dvips
+cat > test.tex << EOF
+\documentclass{book}
+\begin{document}
+Test
+\end{document}
+EOF
+$latex test.tex 1>/dev/null 2>&1
+ac_cv_dvips_o_stdout="no"; export ac_cv_dvips_o_stdout;
+$dvips -o- test.dvi 1>/dev/null 2>&1 && ac_cv_dvips_o_stdout="yes"; export ac_cv_dvips_o_stdout
+cd ..
+rm -rf .dvips
+])
+DVIPS_O_STDOUT=$ac_cv_dvips_o_stdout; export DVIPS_O_STDOUT;
+if test $DVIPS_O_STDOUT = "no" ;
+then
+ AC_MSG_ERROR(Unable to find the option -o- in dvips)
+fi
+AC_SUBST(DVIPS_O_STDOUT)
+])
Oops, something went wrong. Retry.

0 comments on commit 8be9b51

Please sign in to comment.