home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 February / PCWorld_2002-02_cd.bin / Software / Vyzkuste / pdflib / pdflib-4.0.1.sit / pdflib-4.0.1 / configure.in next >
Encoding:
Text File  |  2001-07-04  |  28.4 KB  |  938 lines  |  [TEXT/LMAN]

  1. dnl -------------------------------------------------------------------------*
  2. dnl             PDFlib - A library for generating PDF on the fly             |
  3. dnl--------------------------------------------------------------------------+
  4. dnl Copyright (c) 1997-2001 PDFlib GmbH and Thomas Merz. All rights reserved.|
  5. dnl -------------------------------------------------------------------------+
  6. dnl   This software is NOT in the public domain.  It can be used under two   |
  7. dnl   substantially different licensing terms:                               |
  8. dnl                                                                          |
  9. dnl   The commercial license is available for a fee, and allows you to       |
  10. dnl   - ship a commercial product based on PDFlib                            |
  11. dnl   - implement commercial Web services with PDFlib                        |
  12. dnl   - distribute (free or commercial) software when the source code is     |
  13. dnl     not made available                                                   |
  14. dnl   Details can be found in the file PDFlib-license.pdf.                   |
  15. dnl                                                                          |
  16. dnl   The "Aladdin Free Public License" doesn't require any license fee,     |
  17. dnl   and allows you to                                                      |
  18. dnl   - develop and distribute PDFlib-based software for which the complete  |
  19. dnl     source code is made available                                        |
  20. dnl   - redistribute PDFlib non-commercially under certain conditions        |
  21. dnl   - redistribute PDFlib on digital media for a fee if the complete       |
  22. dnl     contents of the media are freely redistributable                     |
  23. dnl   Details can be found in the file aladdin-license.pdf.                  |
  24. dnl                                                                          |
  25. dnl   These conditions extend to ports to other programming languages.       |
  26. dnl   PDFlib is distributed with no warranty of any kind. Commercial users,  |
  27. dnl   however, will receive warranty and support statements in writing.      |
  28. dnl -------------------------------------------------------------------------.
  29.  
  30. dnl $Id: configure.in,v 1.52.2.4 2001/05/17 16:30:04 rjs Exp $
  31. dnl 
  32. dnl Process this file with autoconf to produce a configure script.
  33. dnl 
  34.  
  35. # --------------------------------------------------------------------
  36. #     PDFlib general setup
  37. # --------------------------------------------------------------------
  38.  
  39. dnl source directory sanity check using an arbitrary source file
  40. AC_INIT(pdflib/pdflib.h)
  41.  
  42. dnl do not change this (version.sh will do it for you :)
  43. VERSION="4.0.1"
  44. PDFLIB_MAJOR=4
  45. PDFLIB_MINOR=0
  46. PDFLIB_REVISION=1
  47.  
  48. AC_SUBST(PDFLIB_MAJOR)
  49. AC_SUBST(PDFLIB_MINOR)
  50. AC_SUBST(PDFLIB_REVISION)
  51.  
  52. dnl Important: Interface numbers are completely independent of release
  53. dnl or version numbers! See doc/readme_unix.txt for details.
  54.  
  55. PDFLIB_LTCURRENT=2
  56. PDFLIB_LTREVISION=1
  57. PDFLIB_LTAGE=1
  58.  
  59. LTVERSIONINFO="$PDFLIB_LTCURRENT:$PDFLIB_LTREVISION:$PDFLIB_LTAGE"
  60.  
  61. AC_SUBST(LTVERSIONINFO)
  62. AC_SUBST(PDFLIB_LTCURRENT)
  63. AC_SUBST(PDFLIB_LTREVISION)
  64. AC_SUBST(PDFLIB_LTAGE)
  65.  
  66. dnl The name of the library should only be changed in very rare cases,
  67. dnl such as Digital Unix where a (completely different) libpdf already
  68. dnl exists.
  69. dnl Note: do not include any file name suffix here.
  70.  
  71. PDFLIBNAME=pdf
  72. MATHLIB="-lm"
  73.  
  74. AC_ARG_WITH(pdflibname,[  --with-pdflibname=name  set file name of generated library [default=pdf]],[PDFLIBNAME="$withval"])
  75.  
  76. AC_ARG_WITH(libm,[  --with-libm=name        set math library option [default=-lm]],[MATHLIB="$withval"])
  77.  
  78. AC_SUBST(PDFLIBNAME)
  79.  
  80. dnl install-sh will be searched (and found) here
  81. AC_CONFIG_AUX_DIR(config)
  82.  
  83. builtin(include, config/aclocal.m4)
  84.  
  85. dnl Check the system name
  86. AC_CANONICAL_HOST
  87.  
  88. AC_MSG_CHECKING(MACHDEP)
  89. if test -z "$MACHDEP"
  90. then
  91.     if test -f /usr/lib/NextStep/software_version; then
  92.     set X `hostinfo | grep 'NeXT Mach.*:' | \
  93.         sed -e 's/://' -e 's/\./_/'` && \
  94.     ac_sys_system=next && ac_sys_release=$4
  95.     MACHDEP="$ac_sys_system$ac_sys_release$ac_sys_cpu"
  96.     else
  97.     ac_sys_system=`uname -s`
  98.     if test "$ac_sys_system" = "AIX" ; then
  99.         ac_sys_release=`uname -v`
  100.     else
  101.         ac_sys_release=`uname -r`
  102.     fi
  103.     ac_md_system=`echo $ac_sys_system |
  104.                tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
  105.     ac_md_release=`echo $ac_sys_release |
  106.                tr -d '[/ ]' | sed 's/\..*//'`
  107.     MACHDEP="$ac_md_system$ac_md_release"
  108.     fi
  109.     case MACHDEP in
  110.     '')    MACHDEP=unknown;;
  111.     esac
  112. fi
  113.  
  114. AC_MSG_RESULT($MACHDEP)
  115. PLATFORM="-DPDF_PLATFORM=\\\"\"$ac_sys_system $ac_sys_release\"\\\""
  116.  
  117. dnl choose compiler
  118. AC_PROG_CC
  119. AC_PROG_CPP
  120. AC_PROG_INSTALL
  121. dnl common stuff, unlikely to be changed
  122. SHELL="/bin/sh"
  123. RM="rm -rf"
  124.  
  125. dnl Default defines -- some systems may need special handling here
  126.  
  127. INCLUDES=
  128.  
  129. case $ac_sys_system in
  130.     dnl Our TIFF code currently requires special handling on AIX
  131.     aix*|AIX*)
  132.     DEFINES="$DEFINES -DAIX";;
  133.  
  134.     cyg*|CYG*) DEFINES="$DEFINES -U_WIN32 -UWIN32 -U__WIN32__ -U_Windows";;
  135.  
  136.     dnl HP needs option for ANSI mode if the HP compiler is used instead of gcc
  137.     hp*|HP*)
  138.     if test "$GCC" = ""; then 
  139.         DEFINES="$DEFINES -Aa"
  140.     fi;;
  141.  
  142.     dnl The OSF JNI requires libraries to be built thread-safe, which is true
  143.     dnl for PDFlib
  144.     osf1*|OSF1*) DEFINES="$DEFINES -pthread";;
  145.  
  146.     dnl MacOS X doesn't seem to like -lm, and doesn't actually need it;
  147.     dnl libtool only works if --with-gnu-ld=yes is supplied, so we try
  148.     dnl to set it here already.
  149.     rhapsody|Rhapsody*)
  150.     with_gnu_ld=yes
  151.     MATHLIB="";;
  152.  
  153.     darwin|Darwin*)
  154.     with_gnu_ld=yes
  155.     MATHLIB="";;
  156.  
  157.     dnl OS/390 specials
  158.     *OS/390*)
  159.     DEFINES="$DEFINES -DOS390"
  160.     CC=c89
  161.     LD=c89;;
  162.  
  163.     *)    ;;
  164. esac
  165.  
  166. GENERATED_FILES=""
  167.  
  168. dnl select debugging configuration
  169. WITH_DEBUG=no
  170.  
  171. dnl We hope to build shared libraries on this platform
  172. WITH_SHARED=yes
  173.  
  174. WITH_PROFILE=no
  175.  
  176. AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging],
  177. if test "$enableval" = "yes" ; then
  178.     WITH_DEBUG=yes
  179. fi)
  180.  
  181. AC_ARG_ENABLE(profile, [  --enable-profile        turn on profiling],
  182. if test "$enableval" = "yes" ; then
  183.     WITH_PROFILE=yes
  184. fi)
  185.  
  186. AC_EXEEXT
  187. AC_OBJEXT
  188.  
  189. dnl Prepare libtool
  190. dnl Required for dlopening our libraries, as done in the language interpreters.
  191.  
  192. AC_LIBTOOL_DLOPEN
  193. AC_LIBTOOL_WIN32_DLL
  194. AM_PROG_LIBTOOL
  195.  
  196. AC_SUBST(SHELL)
  197. AC_SUBST(EXEEXT)
  198. AC_SUBST(OBJEXT)
  199. AC_SUBST(VERSION)
  200. AC_SUBST(CC)
  201. AC_SUBST(RM)
  202.  
  203. # --------------------------------------------------------------------
  204. #     PDFlib Java binding (JNI)
  205. # --------------------------------------------------------------------
  206.  
  207. WITH_JAVA=yes
  208. JAVAINCLUDE=""
  209. JAVAPACKAGE=""
  210.  
  211. AC_ARG_WITH(java,[  --with-java=path        full path of Java Developers Kit, or no],[
  212. case $withval in
  213.     no) WITH_JAVA=no ;;
  214.     yes) WITH_JAVA=yes ;;
  215.     *) JAVAPACKAGE=$withval 
  216.     ;;
  217. esac
  218. ])
  219.  
  220. if test "$WITH_JAVA" != "no" ; then
  221.     WITH_JAVA=no
  222.     AC_MSG_CHECKING(for Java header files)
  223.  
  224.     # try without any precautions
  225.     AC_TRY_CPP([#include <jni.h>], WITH_JAVA=yes,
  226.     [ dirs="$prefix /usr/lib/java /usr/java /usr/java/jdk1.3 /usr/include/java /usr/local/java /usr/local/include/kaffe /usr/lib/jdk1.3 /opt/java1.3 /usr/lpp/java/J1.3 /usr/java/jdk1.2 /usr/lib/jdk1.2.2 /usr/lib/jdk1.2.1 /usr/jdk122 /usr/lib/jdk122 /usr/lib/jdk1.2.1 /opt/java1.2 /usr/lpp/java/J1.2 /usr/lib/jdk1.1.8 /usr/jdk118 /usr/lib/jdk118 /usr/lpp/java/J1.1 /opt/java1.1 /usr /opt/local /jdk1.3 /jdk1.2.3 /jdk1.2.2 /jdk1.2.1 /System/Library/Frameworks/JavaVM.framework/Headers /usr/jdk_base/include"
  227.  
  228.     if test "$JAVAPACKAGE" != ""; then
  229.         dirs="$JAVAPACKAGE $dirs"
  230.     fi
  231.  
  232.     # now try to find jni.h
  233.     for i in $dirs ; do
  234.         if test -r $i/jni.h; then
  235.         JAVAINCLUDE="$i"
  236.         break
  237.         elif test -r $i/include/jni.h; then
  238.         JAVAINCLUDE="$i/include"
  239.         break
  240.         fi
  241.     done
  242.     ])
  243.  
  244.     # now try with an include path
  245.     if test "$JAVAINCLUDE" != ""; then
  246.     OCPPFLAGS="$CPPFLAGS"
  247.     CPPFLAGS="-I$JAVAINCLUDE $OCPPFLAGS"
  248.     AC_TRY_CPP([#include <jni.h>], [
  249.         WITH_JAVA=yes
  250.         JAVAINCLUDE="-I$JAVAINCLUDE"
  251.     ],)
  252.     CPPFLAGS="$OCPPFLAGS"
  253.     fi
  254.  
  255.     # if the above didn't work probably jni_md.h is missing
  256.     if test "WITH_JAVA" != "yes" ; then
  257.     if test "$JAVAINCLUDE" != ""; then
  258.         subdirs="$JAVAINCLUDE $JAVAINCLUDE/$MACHDEP $JAVAINCLUDE/$ac_md_system $JAVAINCLUDE/solaris $JAVAINCLUDE/genunix $JAVAINCLUDE/alpha $JAVAINCLUDE/win32 $JAVAINCLUDE/mvs"
  259.         for i in $subdirs ; do
  260.         if test -r $i/jni_md.h; then
  261.             JAVAINCLUDE="-I$JAVAINCLUDE -I$i"
  262.             WITH_JAVA=yes
  263.             break
  264.         fi
  265.         done
  266.     fi
  267.     fi
  268.  
  269.     if test "$WITH_JAVA" = "no"; then
  270.     AC_MSG_RESULT(not found)
  271.     else
  272.     GENERATED_FILES="$GENERATED_FILES bind/java/Makefile"
  273.     AC_MSG_RESULT($JAVAINCLUDE)
  274.     AC_SUBST(JAVAINCLUDE)
  275.     fi
  276.  
  277. fi
  278.  
  279. # ----------------------------------------------------------------
  280. #  PDFlib Perl binding
  281. # ----------------------------------------------------------------
  282.  
  283. WITH_PERL=yes
  284. PERLBIN=nope
  285. PERLINCLUDE=nope
  286.  
  287. AC_ARG_WITH(perl,[  --with-perl=path        full path of Perl executable, or no],[PERLBIN="$withval"],[PERLBIN=nope])
  288.  
  289. if test "$PERLBIN" = "no" ; then
  290.     WITH_PERL=no
  291. fi
  292.  
  293. AC_ARG_WITH(perlincl,[  --with-perlincl=path    full path of Perl include directory],[PERLINCLUDE="$withval"],[PERLINCLUDE=nope])
  294.  
  295. if test "$WITH_PERL" = "yes" ; then
  296.  
  297.     WITH_PERL=no
  298.     dnl First figure out what the name of Perl is
  299.     if test "$PERLBIN" = "nope"; then
  300.     AC_CHECK_PROGS(PERL, perl perl5.7.0 perl5.6.0 perl5.005 perl5.004 perl5.003 perl5.002 perl5.001 perl5, nope)
  301.     else
  302.     PERL="$PERLBIN"
  303.     fi
  304.     AC_MSG_CHECKING(for Perl header file)
  305.     if test "$PERL" != "nope"; then
  306.     PERL5DIR=`($PERL -e 'use Config; print $Config{archlib};') 2>/dev/null`
  307.     if test "$PERL5DIR" != ""; then
  308.         if test "$PERLINCLUDE" = "nope"; then
  309.         if test -r "$PERL5DIR/perl.h"; then
  310.             AC_MSG_RESULT(PERL5DIR/perl.h)
  311.             WITH_PERL=yes
  312.             PERLINCLUDE="$PERL5DIR"
  313.         elif test -r "$PERL5DIR/CORE/perl.h"; then
  314.             AC_MSG_RESULT($PERL5DIR/CORE/perl.h)
  315.             WITH_PERL=yes
  316.             PERLINCLUDE="$PERL5DIR/CORE"
  317.         fi
  318.         else
  319.         WITH_PERL=yes
  320.         AC_MSG_RESULT($PERLINCLUDE)
  321.         fi
  322.         if test "$PERLINCLUDE" = "nope"; then
  323.         AC_MSG_RESULT(could not locate perl.h...)
  324.         WITH_PERL=no
  325.         fi    
  326.     else
  327.         AC_MSG_RESULT(unable to determine Perl configuration)
  328.         WITH_PERL=no
  329.     fi
  330.  
  331.     PERLLIBDIR=`($PERL -e 'use Config; print $Config{sitearchexp};') 2>/dev/null`
  332.     if test -z "$PERLLIBDIR" -o ! -d "$PERLLIBDIR"; then
  333.         AC_MSG_RESULT(         unable to determine perl shared library directory)
  334.     fi
  335.  
  336.     PERLMODDIR=`($PERL -e 'use Config; print $Config{sitelib};') 2>/dev/null`
  337.     if test -z "$PERLMODDIR" -o ! -d "$PERLMODDIR"; then
  338.         AC_MSG_RESULT(         unable to determine perl module directory)
  339.         PERLMODDIR="/usr/local/lib/perl5/site_perl/5.6.0"
  340.     fi
  341.     else
  342.     AC_MSG_RESULT(could not figure out how to run perl)
  343.     PERLINCLUDE="/usr/local/lib/perl5/5.6.0/archname/CORE"
  344.     fi
  345.  
  346.     dnl The Perl include files contain special handling for the bool type
  347.     dnl on NeXT (sigh). We'll run into trouble if we don't work around this.
  348.  
  349.     case $ac_sys_system in
  350.         NeXT|next) PERLBOOLDEF="";;
  351.         *)    PERLBOOLDEF="-Dbool=char -DHAS_BOOL";;
  352.     esac
  353.  
  354.     dnl Some platforms require linking the perl library directly.
  355.     dnl We use $PERLINCLUDE for this since it both contains the Perl library
  356.     dnl _and_ the include files. Other systems don't explicitly link the
  357.     dnl Perl library, so we put only $MATHLIB in PERLLINK.
  358.     dnl $MATHLIB is not required on all systems/perl builds, but those
  359.     dnl who need it choke fatally without it. HP-UX, on the other hand,
  360.     dnl chokes when we supply -lm.
  361.  
  362.     PERLLINK="$MATHLIB";
  363.  
  364.     case $ac_sys_system/$ac_sys_release in
  365.     hp*|HP*)     PERLLINK="";;
  366.     cyg*|CYG*)   PERLLINK="-L$PERLINCLUDE -lperl $PERLLINK";;
  367.     aix*|AIX*)   PERLLINK="-L$PERLINCLUDE -lperl $PERLLINK";;
  368.     osf1*|OSF1*) PERLLINK="-L$PERLINCLUDE -lperl $PERLLINK";;
  369.     *) ;;
  370.     esac
  371.  
  372.     if test "$WITH_PERL" = "yes" ; then
  373.     GENERATED_FILES="$GENERATED_FILES bind/perl/Makefile"
  374.     fi
  375.  
  376.     PERLINCLUDE="-I$PERLINCLUDE"
  377.     AC_SUBST(PERLINCLUDE)
  378.     AC_SUBST(PERLLIBDIR)
  379.     AC_SUBST(PERLMODDIR)
  380.     AC_SUBST(PERLBOOLDEF)
  381.     AC_SUBST(PERLLINK)
  382.     AC_SUBST(PERL)
  383. fi
  384.  
  385. # ----------------------------------------------------------------
  386. #  PDFlib Python binding
  387. # ----------------------------------------------------------------
  388.  
  389. WITH_PYTHON=yes
  390. PYINCLUDE=nope
  391. PYPACKAGE=nope
  392.  
  393. AC_ARG_WITH(py,[  --with-py=path          full path of Python root directory, or no],[PYPACKAGE="$withval"], [PYPACKAGE=nope])
  394.  
  395. if test "$PYPACKAGE" = "no" ; then
  396.     WITH_PYTHON=no
  397. fi
  398.  
  399. AC_ARG_WITH(pyincl,[  --with-pyincl=path      full path of Python include directory],[PYINCLUDE="$withval"], [PYINCLUDE=nope])
  400.  
  401. if test "$PYINCLUDE" = "nope" -a "$PYPACKAGE" != "no"; then
  402.     PYINCLUDE="$PYPACKAGE/include"
  403. fi
  404.  
  405. if test "$WITH_PYTHON" != "no" ; then
  406.     WITH_PYTHON=no
  407.     AC_MSG_CHECKING(for Python header files)
  408.  
  409.     dirs="$PYINCLUDE             \
  410.     $PYINCLUDE/python2.0         \
  411.     $prefix/include/python2.0         \
  412.     /usr/local/include/python2.0     \
  413.     /usr/include/python2.0         \
  414.     $prefix/include/python2.0        \
  415.     $PYINCLUDE/python1.6        \
  416.     $prefix/include/python1.6        \
  417.     /usr/local/include/python1.6    \
  418.     /usr/include/python1.6        \
  419.     $prefix/include/python1.6        \
  420.     $PYINCLUDE/python1.5        \
  421.     $prefix/include/python1.5        \
  422.     /usr/local/include/python1.5    \
  423.     /usr/include/python1.5        \
  424.     $prefix/include/python1.5        \
  425.     $PYINCLUDE/python1.4        \
  426.     $prefix/include/python1.4        \
  427.     /usr/local/include/python1.4    \
  428.     /usr/include/python1.4        \
  429.     $prefix/include/python1.4"
  430.     for i in $dirs ; do
  431.         if test -r $i/Python.h; then
  432.             AC_MSG_RESULT($i)
  433.             PYINCLUDE="-I$i"
  434.             WITH_PYTHON=yes
  435.             break
  436.         fi
  437.     done
  438.     if test "$PYINCLUDE" = "nope" -o "$PYINCLUDE" = "$PYPACKAGE/include"; then
  439.     AC_MSG_RESULT(not found)
  440.     WITH_PYTHON=no
  441.     fi
  442.  
  443.     AC_SUBST(PYINCLUDE)
  444.  
  445.     AC_CHECK_PROGS(PYTHONBIN, python, nope)
  446.  
  447.     if test "$PYTHONBIN" = "nope" ; then
  448.     WITH_PYTHON=no
  449.     fi
  450.  
  451.     if test "$WITH_PYTHON" = "yes" ; then
  452.     AC_MSG_CHECKING(for Python shared library path)
  453.  
  454.     if test "$PYTHONBIN" = "nope" ; then
  455.         WITH_PYTHON=no
  456.     else
  457.         PYTHONLIBDIR=`cat << EOF | python
  458. import sys
  459. import string
  460. print string.join(filter(lambda x: -1 != string.find(x, 'dynload'), sys.path))
  461. EOF
  462. `
  463.         if test "$PYTHONLIBDIR" = "" ; then
  464.         PYTHONLIBDIR=/usr/lib
  465.         fi
  466.         AC_SUBST(PYTHONLIBDIR)
  467.  
  468.     fi
  469.  
  470.     GENERATED_FILES="$GENERATED_FILES bind/python/Makefile"
  471.  
  472.     AC_MSG_RESULT($PYTHONLIBDIR)
  473.     fi
  474. fi
  475.  
  476. # --------------------------------------------------------------------
  477. #     PDFlib Tcl binding
  478. # --------------------------------------------------------------------
  479.  
  480. WITH_TCL=yes
  481. TCLINCLUDE=nope
  482. TCLPACKAGEDIR=nope
  483. TCLBIN=nope
  484.  
  485. AC_ARG_WITH(tcl,[  --with-tcl=path         full path of Tcl executable, or no],[TCLBIN="$withval"])
  486.  
  487. if test "$TCLBIN" = "no" ; then
  488.     WITH_TCL=no
  489. fi
  490.  
  491. AC_ARG_WITH(tclpkg,[  --with-tclpkg=path      full path of Tcl package install directory],[TCLPACKAGEDIR="$withval"],[TCLPACKAGEDIR=nope])
  492.  
  493. AC_ARG_WITH(tclincl,[  --with-tclincl=path     full path of Tcl include directory],[TCLINCLUDE="$withval"],[TCLINCLUDE=nope])
  494.  
  495. if test "$WITH_TCL" = "yes" ; then
  496.     WITH_TCL=no
  497.     AC_MSG_CHECKING(for Tcl header files)
  498.  
  499.     if test "$TCLINCLUDE" = "nope"; then
  500.     AC_TRY_CPP([#include <tcl.h>], , TCLINCLUDE="nope")
  501.     if test "$TCLINCLUDE" = "nope"; then
  502.         dirs="$prefix/include /usr/local/include /usr/include /opt/local/include /home/sci/local/include /usr/pkg/include /System/Library/Frameworks/Tcl.framework/Versions/8.3/Headers /System/Library/Frameworks/Tcl.framework/Versions/8.2/Headers"
  503.         for i in $dirs ; do
  504.         if test -r $i/tcl.h; then
  505.             AC_MSG_RESULT($i)
  506.             TCLINCLUDE="$i"
  507.             WITH_TCL=yes
  508.             break
  509.         fi
  510.         done
  511.     fi
  512.  
  513.     if test "$TCLINCLUDE" = "nope"; then
  514.         AC_MSG_RESULT(not found)
  515.         WITH_TCL=no
  516.     fi
  517.     else
  518.     AC_MSG_RESULT($TCLINCLUDE)
  519.     fi
  520.  
  521.     dnl We need at least Tcl 8.0 because of its support for binary strings
  522.     dnl and the object interface.
  523.  
  524.     if test "$TCLINCLUDE" != "nope" -a "$TCLBIN" = "nope"; then
  525.     AC_CHECK_PROGS(TCL, tclsh tclsh8.4 tclsh8.3 tclsh8.2 tclsh8.1 tclsh8.0, nope)
  526.     TCLBIN=$TCL
  527.     fi
  528.  
  529.     if test "$TCLINCLUDE" = "nope" -o "$TCLBIN" = "nope"; then
  530.     WITH_TCL=no
  531.     else
  532.     dnl Check the installed Tcl version -- must be 8.0 or higher
  533.     TCLVERSION=`echo "puts [[info tclversion]]" | $TCLBIN`
  534.     if test  "$TCLVERSION" = "7.6" -o "$TCLVERSION" = "7.5" -o  "$TCLVERSION" = "7.4" -o "$TCLVERSION" = "7.3" -o "$TCLVERSION" = "7.1" -o "$TCLVERSION" = "7.0"; then
  535.         AC_MSG_RESULT([         Tcl version 8.0 or newer is required for PDFlib.])
  536.         AC_MSG_RESULT([         PDFlib support for Tcl will not be built.])
  537.         WITH_TCL=no
  538.     else
  539.         if test  "$TCLVERSION" = "8.0" -o "$TCLVERSION" = "8.1"; then
  540.         AC_MSG_RESULT([         The PDFlib build process requires Tcl 8.2 or above. Please read])
  541.         AC_MSG_RESULT([         bind/tcl/readme.txt for instructions on manually building PDFlib])
  542.         AC_MSG_RESULT([         for Tcl 8.0 or 8.1.])
  543.         fi
  544.     
  545.         if test "$TCLPACKAGEDIR" = "nope"; then
  546.         dnl Let tcl decide where to install the package
  547.         TCLPACKAGEDIR=`(echo "puts \\$auto_path" | "$TCLBIN" | awk '{print $1}') 2>/dev/null`
  548.         fi
  549.  
  550.         if test "$TCLPACKAGEDIR" = "nope" -o -z "$TCLPACKAGEDIR" -o ! -d "$TCLPACKAGEDIR"; then
  551.         AC_MSG_RESULT(unable to determine Tcl package directory)
  552.         WITH_TCL=no
  553.  
  554.         else
  555.  
  556.         TCLPACKAGEDIR=$TCLPACKAGEDIR/pdflib
  557.         WITH_TCL=yes
  558.         fi
  559.     fi
  560.     fi
  561.  
  562.     if test "$WITH_TCL" = "yes" ; then
  563.     GENERATED_FILES="$GENERATED_FILES bind/tcl/Makefile"
  564.     fi
  565. fi
  566.  
  567. TCLINCLUDE="-I$TCLINCLUDE"
  568. AC_SUBST(TCLINCLUDE)
  569. AC_SUBST(TCLPACKAGEDIR)
  570. AC_SUBST(TCLBIN)
  571.  
  572. # ----------------------------------------------------------------
  573. #  PDFlib auxiliary library: TIFFlib
  574. #  We bring our own copy of tifflib but the client may choose to
  575. #  use an installed one instead. This is only support for C/C++ clients.
  576. # ----------------------------------------------------------------
  577.  
  578. # The list of Makefile targets for our internal libraries
  579. LIBTARGETS=""
  580. INTERNALLIBS=""
  581.  
  582. WITH_INTERNALTIFFLIB="yes"
  583. TIFFLIBINC=""
  584. EXTERNALLIBS="$MATHLIB"
  585.  
  586. AC_ARG_WITH(tifflib,
  587. [  --with-tifflib          use installed tifflib instead of internal (not rec.)],
  588. [
  589.     AC_CHECK_LIB(tiff, TIFFOpen, [EXTERNALLIBS="$EXTERNALLIBS -ltiff"],
  590.     AC_MSG_ERROR([No usable tifflib library found.]))
  591.  
  592.     AC_CHECK_HEADER(tiff.h, , 
  593.     AC_MSG_ERROR([No usable tifflib include file found.]))
  594.  
  595.     AC_MSG_RESULT([         Note: user-supplied tifflib - language bindings disabled])
  596.     WITH_INTERNALTIFFLIB="no"
  597. ],[
  598.     AC_C_BIGENDIAN()
  599.  
  600.     TIFFLIBINC="-I../tiff"
  601.     INTERNALLIBS="$INTERNALLIBS \$(top_builddir)/tiff/libtiff.la"
  602.     LIBTARGETS="$LIBTARGETS libtiff"
  603.     GENERATED_FILES="$GENERATED_FILES tiff/Makefile"
  604. ])
  605.  
  606. AC_SUBST(TIFFLIBINC)
  607.  
  608. # ----------------------------------------------------------------------
  609. #  PDFlib auxiliary library: Zlib
  610. #  We bring our own copy of zlib but the client may choose to
  611. #  use an installed one instead. This is only support for C/C++ clients.
  612. # ----------------------------------------------------------------------
  613.  
  614. ZLIBINC=""
  615. WITH_INTERNALZLIB="yes"
  616.  
  617. AC_ARG_WITH(zlib,
  618. [  --with-zlib             use installed zlib instead of internal (not rec.)],
  619. [
  620.     AC_CHECK_LIB(z, deflateEnd, [EXTERNALLIBS="$EXTERNALLIBS -lz"],
  621.     AC_MSG_ERROR([No usable zlib compression library found.]))
  622.  
  623.     AC_CHECK_HEADER(zlib.h, , 
  624.     AC_MSG_ERROR([No usable zlib include file found.]))
  625.  
  626.     AC_MSG_RESULT([         Note: user-supplied zlib - language bindings disabled])
  627.     WITH_INTERNALZLIB="no"
  628. ],[
  629.     ZLIBINC="-I../flate"
  630.     INTERNALLIBS="$INTERNALLIBS \$(top_builddir)/flate/libz.la"
  631.     LIBTARGETS="$LIBTARGETS libz"
  632.     GENERATED_FILES="$GENERATED_FILES flate/Makefile"
  633. ])
  634.  
  635. AC_SUBST(ZLIBINC)
  636.  
  637. # ---------------------------------------------------------------------
  638. #  PDFlib auxiliary library: libpng
  639. #  We bring our own copy of pnglib but the client may choose to
  640. #  use an installed one instead. This is only support for C/C++ clients.
  641. # ---------------------------------------------------------------------
  642.  
  643. PNGLIBINC=""
  644. WITH_INTERNALPNGLIB=$WITH_INTERNALZLIB
  645.  
  646. AC_ARG_WITH(pnglib,
  647. [  --with-pnglib           use installed pnglib instead of internal (not rec.)],
  648. [
  649.     if test "$WITH_INTERNALZLIB" = "yes"; then
  650.     AC_MSG_ERROR([--with-pnglib requires --with-zlib])
  651.     fi
  652.  
  653.     dnl Make sure libpng sits in front of libz
  654.     AC_CHECK_LIB(png, png_create_read_struct,
  655.     [EXTERNALLIBS="-lpng $EXTERNALLIBS"],
  656.     AC_MSG_ERROR([No usable pnglib library found.]))
  657.  
  658.     AC_CHECK_HEADER(png.h, , 
  659.     AC_MSG_ERROR([No usable pnglib include file found.]))
  660.  
  661.     AC_MSG_RESULT([         Note: user-supplied pnglib - language bindings disabled])
  662.     WITH_INTERNALPNGLIB="no"
  663. ],[
  664.     if test "$WITH_INTERNALZLIB" = "no"; then
  665.     AC_MSG_ERROR([--with-zlib requires --with-pnglib])
  666.     fi
  667.  
  668.     PNGLIBINC="-I../png"
  669.     dnl PNG must be in front because it needs zlib
  670.     INTERNALLIBS="\$(top_builddir)/png/libpng.la $INTERNALLIBS"
  671.     LIBTARGETS="$LIBTARGETS libpng"
  672.     GENERATED_FILES="$GENERATED_FILES png/Makefile"
  673. ])
  674.  
  675. AC_SUBST(PNGLIBINC)
  676.  
  677. # ----------------------------------------------------------------
  678. #  PDFlib auxiliary library: PDI (PDF import library)
  679. # ----------------------------------------------------------------
  680.  
  681. WITH_PDI=no
  682.  
  683. AC_MSG_CHECKING(for PDF import library PDI)
  684.  
  685. if test -f pdi/pdi.h ; then
  686.     dnl PDI must be in front because it needs zlib
  687.     INTERNALLIBS="\$(top_builddir)/pdi/libpdi.la $INTERNALLIBS"
  688.     DEFINES="$DEFINES -DHAVE_PDI"
  689.     WITH_PDI=yes
  690.     LIBTARGETS="$LIBTARGETS libpdi"
  691.     GENERATED_FILES="$GENERATED_FILES pdi/Makefile"
  692.     AC_MSG_RESULT(found)
  693. else
  694.     AC_MSG_RESULT(not found)
  695. fi
  696.  
  697. if test -f dist.mak.in ; then
  698.     GENERATED_FILES="$GENERATED_FILES dist.mak"
  699.     PDFPWD=`pwd`
  700.     AC_SUBST(PDFPWD)
  701. fi
  702.  
  703. # ----------------------------------------------------------------
  704. #  PDFlib PHP binding
  705. # ----------------------------------------------------------------
  706.  
  707. WITH_PHP=yes
  708.  
  709. AC_ARG_ENABLE(php,[  --enable-php            enable PHP language binding [default=yes]], WITH_PHP=$enableval)
  710.  
  711. if test "$WITH_PDI" = "yes" -a "$WITH_PHP" = "yes"; then
  712.     WITH_PHP=""
  713.     AC_CHECK_PROG(WITH_PHP, phpize, yes, no)
  714.     if test "$WITH_PHP" = ""; then
  715.     WITH_PHP="no"
  716.     fi
  717.     if test "$WITH_PHP" = "yes"; then
  718.     GENERATED_FILES="$GENERATED_FILES bind/php/Makefile.in"
  719.     fi
  720. else
  721.     if test "$WITH_PDI" = "no"; then
  722.     WITH_PHP=yes
  723.     else
  724.     WITH_PHP=no
  725.     fi
  726. fi
  727.  
  728. # If at least one library has been substituted we disable most
  729. # language bindings.
  730.  
  731. if test "$EXTERNALLIBS" != "$MATHLIB"; then
  732.     WITH_JAVA=no
  733.     WITH_PERL=no
  734.     WITH_PYTHON=no
  735.     WITH_TCL=no
  736.     WITH_PHP=no
  737. fi
  738.  
  739. # --------------------------------------------------------------------
  740. #     PDFlib C++ language binding
  741. # --------------------------------------------------------------------
  742.  
  743. dnl C++ mode is disabled by default since it seems impossible to come up
  744. dnl with a portable solution for linking the stdc++ library.
  745. dnl If we have PDI, we check C++ mode, too.
  746.  
  747. if test "$WITH_PDI" = "yes"; then
  748.     WITH_CXX=yes
  749. else
  750.     WITH_CXX=no
  751. fi
  752.  
  753. STDCPP=""
  754.  
  755. AC_ARG_ENABLE(cxx,[  --enable-cxx            enable C++ language binding [default=no]], WITH_CXX=$enableval)
  756.  
  757. if test "$WITH_CXX" = "yes"; then
  758.     AC_LANG_CPLUSPLUS
  759.     AC_PROG_CXX
  760.     AC_MSG_CHECKING(whether the previously found C++ compiler works)
  761.     AC_TRY_COMPILE(, [class a { int b; } ], WITH_CXX=yes, WITH_CXX=no)
  762.     AC_LANG_C
  763.  
  764.     case $ac_sys_system/$ac_sys_release in
  765.     osf1*|OSF1*) STDCPP="";;
  766.  
  767.     *)    dnl don't change $WITH_CXX
  768.         ;;
  769.     esac
  770.  
  771.     dnl If working with gcc add the name of the stdc++ library
  772.     if test "x$GCC" != "x"; then
  773.     STDCPP="-lstdc++"
  774.     fi
  775.  
  776.     if test "$WITH_CXX" = "yes"; then
  777.     AC_SUBST(STDCPP)
  778.     AC_SUBST(CXX)
  779.     AC_MSG_RESULT(yes)
  780.     GENERATED_FILES="$GENERATED_FILES bind/cpp/Makefile"
  781.     else
  782.     AC_MSG_RESULT(no)
  783.     fi
  784. fi
  785.  
  786. # ----------------------------------------------------------------
  787. #  PDFlib wrapup
  788. # ----------------------------------------------------------------
  789.  
  790. dnl The following variables are used to tell the Makefile what to
  791. dnl actually do, depending on the available language bindings.
  792. dnl PDFlib itself will be built and installed by default, regardless
  793. dnl of the settings below.
  794.  
  795. BINDINGS="c"
  796. BINDINGS_INSTALL=""
  797. BINDINGS_UNINSTALL=""
  798. BINDINGS_CLEAN="c_clean"
  799. BINDINGS_TEST="c_test"
  800.  
  801. if ${CONFIG_SHELL-/bin/sh} ./libtool --features | grep "disable shared" >/dev/null; then
  802.     WITH_SHARED=no
  803. fi
  804.  
  805. dnl Building the language wrappers based on a shared PDFlib is no longer supported!
  806. if test "$WITH_SHARED" = "no"; then
  807.     WITH_JAVA=no
  808.     WITH_PERL=no
  809.     WITH_PYTHON=no
  810.     WITH_TCL=no
  811.     WITH_PHP=no
  812. fi
  813.  
  814. if test "$WITH_CXX" = "yes" ; then
  815.     BINDINGS="$BINDINGS cpp"
  816.     BINDINGS_TEST="$BINDINGS_TEST cpp_test"
  817.     BINDINGS_CLEAN="$BINDINGS_CLEAN cpp_clean"
  818. fi
  819. if test "$WITH_JAVA" = "yes" ; then
  820.     BINDINGS="$BINDINGS java"
  821.     BINDINGS_INSTALL="$BINDINGS_INSTALL java_install"
  822.     BINDINGS_UNINSTALL="$BINDINGS_UNINSTALL java_uninstall"
  823.     BINDINGS_TEST="$BINDINGS_TEST java_test"
  824.     BINDINGS_CLEAN="$BINDINGS_CLEAN java_clean"
  825. fi
  826. if test "$WITH_PERL" = "yes" ; then
  827.     BINDINGS="$BINDINGS perl"
  828.     BINDINGS_INSTALL="$BINDINGS_INSTALL perl_install"
  829.     BINDINGS_UNINSTALL="$BINDINGS_UNINSTALL perl_uninstall"
  830.     BINDINGS_TEST="$BINDINGS_TEST perl_test"
  831.     BINDINGS_CLEAN="$BINDINGS_CLEAN perl_clean"
  832. fi
  833. if test "$WITH_PYTHON" = "yes" ; then
  834.     BINDINGS="$BINDINGS python"
  835.     BINDINGS_INSTALL="$BINDINGS_INSTALL python_install"
  836.     BINDINGS_UNINSTALL="$BINDINGS_UNINSTALL python_uninstall"
  837.     BINDINGS_TEST="$BINDINGS_TEST python_test"
  838.     BINDINGS_CLEAN="$BINDINGS_CLEAN python_clean"
  839. fi
  840. if test "$WITH_TCL" = "yes" ; then
  841.     BINDINGS="$BINDINGS tcl"
  842.     BINDINGS_INSTALL="$BINDINGS_INSTALL tcl_install"
  843.     BINDINGS_UNINSTALL="$BINDINGS_UNINSTALL tcl_uninstall"
  844.     BINDINGS_TEST="$BINDINGS_TEST tcl_test"
  845.     BINDINGS_CLEAN="$BINDINGS_CLEAN tcl_clean"
  846. fi
  847.  
  848. if test "$WITH_DEBUG" = "yes"; then
  849.     CFLAGS="$CFLAGS -g -DDEBUG"
  850. fi
  851.  
  852. if test "$WITH_PROFILE" = "yes"; then
  853.     CFLAGS="$CFLAGS -pg"
  854.     LDFLAGS="$LDFLAGS -pg"
  855. fi
  856.  
  857. DEFINES="$CFLAGS $DEFINES $INCLUDES $PLATFORM"
  858. EXTERNALLIBS="$LDFLAGS $EXTERNALLIBS"
  859.  
  860. AC_SUBST(BINDINGS)
  861. AC_SUBST(WITH_PDI)
  862. AC_SUBST(LDFLAGS)
  863. AC_SUBST(LIBTARGETS)
  864. AC_SUBST(BINDINGS_INSTALL)
  865. AC_SUBST(BINDINGS_UNINSTALL)
  866. AC_SUBST(BINDINGS_TEST)
  867. AC_SUBST(BINDINGS_CLEAN)
  868.  
  869. dnl PDFLIBCONVENIENT contains all convenient libs to build shared libs
  870. dnl             like PDFlib, and the wrapper libraries.
  871. dnl PDFLIBLINKSELF   contains the flags needed to link PDFlib itself
  872. dnl PDFLIBLINK       contains the files needed to link a program against PDFlib
  873.  
  874. if test "$WITH_SHARED" = "no"; then
  875.     dnl We can generate a static lib only, but not a shared
  876.     RPATH=""
  877. else
  878.     dnl we generate both static and shared libs
  879.     RPATH="-rpath \$(libdir) -version-info $LTVERSIONINFO"
  880.  
  881. fi
  882.  
  883. PDFLIBCONVENIENT="\$(top_builddir)/pdflib/libpdf_.la $INTERNALLIBS"
  884. PDFLIBLINKSELF="$RPATH $PDFLIBCONVENIENT"
  885. PDFLIBLINK="\$(top_builddir)/pdflib/libpdf.la $EXTERNALLIBS"
  886.  
  887. AC_SUBST(EXTERNALLIBS)
  888. AC_SUBST(PDFLIBCONVENIENT)
  889. AC_SUBST(PDFLIBLINKSELF)
  890. AC_SUBST(PDFLIBLINK)
  891. AC_SUBST(INTERNALLIBS)
  892. AC_SUBST(INCLUDES)
  893. AC_SUBST(DEFINES)
  894. AC_SUBST(DEFS)
  895. AC_SUBST(WITH_SHARED)
  896.  
  897. dnl ---------- Generate the Makefiles
  898.  
  899. GENERATED_FILES="$GENERATED_FILES Makefile pdflib-config pdflib/Makefile test/Makefile clients/Makefile util/Makefile bind/c/Makefile"
  900.  
  901. AC_OUTPUT([$GENERATED_FILES],[
  902.     chmod +x pdflib-config
  903. ])
  904.  
  905. if test "$WITH_SHARED" = "no" ; then
  906.     AC_MSG_WARN([Can't create shared PDFlib libraries on this platform.])
  907.     AC_MSG_WARN([PDFlib will work when linked to a C or C++ program,])
  908.     AC_MSG_WARN([but other language bindings will be unavailable.])
  909. fi
  910.  
  911. AC_MSG_RESULT([_____________________________________________________________])
  912. AC_MSG_RESULT([For your convenience, here's a summary of configure's results:])
  913. AC_MSG_RESULT([])
  914. AC_MSG_RESULT([Support for shared libraries:           $WITH_SHARED])
  915. AC_MSG_RESULT([C++ language binding for PDFlib:        $WITH_CXX])
  916. AC_MSG_RESULT([Java language binding for PDFlib:       $WITH_JAVA])
  917. AC_MSG_RESULT([Perl language binding for PDFlib:       $WITH_PERL])
  918. AC_MSG_RESULT([Python language binding for PDFlib:     $WITH_PYTHON])
  919. AC_MSG_RESULT([Tcl language binding for PDFlib:        $WITH_TCL])
  920.  
  921. if test "$WITH_PHP" = "yes" ; then
  922.     AC_MSG_RESULT([PHP language binding for PDFlib:        yes (you must rebuild PHP)])
  923. else
  924.     AC_MSG_RESULT([PHP language binding for PDFlib:        no])
  925. fi
  926.  
  927. AC_MSG_RESULT([PDF import library (PDI):               $WITH_PDI])
  928. if test "$WITH_PDI" = "no" ; then
  929.     AC_MSG_RESULT([     Note: if you purchase the additional PDF import library (PDI)])
  930.     AC_MSG_RESULT([     you can also manipulate existing PDF documents with PDFlib.])
  931.     AC_MSG_RESULT([     See http://www.pdflib.com for details.])
  932. fi
  933.  
  934. AC_MSG_RESULT([])
  935. AC_MSG_RESULT([Please observe the licensing terms for commercial PDFlib usage.])
  936. AC_MSG_RESULT([PDFlib license agreement and purchase order can be found in the doc directory.])
  937. AC_MSG_RESULT([])
  938.