"Fossies" - the Fresh Open Source Software Archive

Member "sip-0.12.1/configure.ac" (26 Nov 2016, 21900 Bytes) of package /linux/privat/sip-0.12.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 0.5.6_vs_0.12.1.

    1 # Process this file with autoconf to produce a configure script.
    2 #
    3 # Copyright (C) 2003-2009 Ricardo Fabbri
    4 # Some inspiration came from ImageMagick's configure.ac (thx Bob F.)
    5 # and examples from the Autobook (http://sources.redhat.com/autobook),
    6 # and some changes were re-incorporated from SIVP.
    7 #
    8 # This program is free software; you can redistribute it and/or modify
    9 # it under the terms of the GNU General Public License as published by
   10 # the Free Software Foundation; either version 2, or (at your option)
   11 # any later version.
   12 #
   13 # This program is distributed in the hope that it will be useful,
   14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16 # GNU General Public License for more details.
   17 #
   18 # You should have received a copy of the GNU General Public License
   19 # along with this program; if not, write to the Free Software
   20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   21 
   22 AC_PREREQ(2.69)
   23 
   24 #AC_INIT([sip], [20040710-2], [ricardofabbri@users.sf.net],[sip-dev])
   25 AC_INIT([sip], [0.12.1], [ricardofabbri@users.sourceforge.net])
   26 echo "configuring SIP AC_PACKAGE_VERSION"
   27 AC_CONFIG_AUX_DIR([config])
   28 AC_CONFIG_SRCDIR([src/imread.c])
   29 AC_CONFIG_HEADER([src/config.h])
   30 AX_PREFIX_CONFIG_H([src/sip_config.h],[sip])
   31 AM_INIT_AUTOMAKE([no-define])
   32 
   33 # Checks for programs.
   34 AC_PROG_CC
   35 
   36 if test x"$ac_cv_prog_cc_stdc" = x'no'; then
   37    AC_MSG_WARN([[found the $CC compiler but it is not ANSI-C compliant.]])
   38 fi
   39 
   40 AC_LIBTOOL_WIN32_DLL
   41 AC_DISABLE_STATIC
   42 AC_PROG_LIBTOOL
   43 
   44 # Check to see if building shared libraries
   45 libtool_build_shared_libs='no'
   46 if ./libtool --config | grep 'build_libtool_libs=yes' > /dev/null
   47 then
   48   libtool_build_shared_libs='yes'
   49 fi
   50 
   51 
   52 #
   53 # Tests for windoze
   54 #
   55 native_win32_build='no'
   56 cygwin_build='no'
   57 case $host_os in
   58   cygwin*) 
   59       cygwin_build='yes'
   60       ;;
   61   mingw* )
   62       native_win32_build='yes' 
   63       ;;
   64 esac
   65 
   66 
   67 AC_CHECK_PROG([has_scilab],[scilab],[yes],[no], , )
   68 if test x$has_scilab = xno; then
   69     AC_MSG_ERROR([[Scilab was not found in your PATH], your PATH is $PATH])
   70 fi
   71 
   72 SCIEXE="scilab"
   73 # test if SCI is defined. If not, test if scilab is in path,
   74 # then get SCI from scilab -nw
   75 if test -z "$SCI"; then
   76       cmd='F=mopen("getpath.incl","w");
   77            mfprintf(F,SCI);
   78            mclose(F);exit;'
   79       echo "$cmd" > getpath.sci
   80       scilab -nwni -nb -nouserstartup -f getpath.sci # >/dev/null
   81       SCIDIR=`cat getpath.incl`
   82       rm -f getpath.sci getpath.incl 
   83 else
   84    SCIDIR="$SCI"
   85 fi
   86 
   87 #get scilab version
   88 cmd='F=mopen("version.incl","w");
   89      myver=getversion();
   90      myver=part(myver, 8);
   91      mfprintf(F,myver);
   92      mclose(F);exit;'
   93 echo "$cmd" > version.sci
   94 scilab -nwni -nb -nouserstartup -f version.sci # >/dev/null
   95 SCIVERSION=`cat version.incl`
   96 rm -f version.sci version.incl 
   97 
   98 # scilab-branch-xx (b as in branch)
   99 # TODO detect scilab yasp branch
  100 if test $SCIVERSION = b; then
  101   SCIVERSION=5
  102 fi
  103 echo "Scilab version is $SCIVERSION"
  104 
  105 
  106 HELPDIR=""
  107 if test $SCIVERSION -le 4; then
  108    # checks for xsltproc (to buld HTML help pages)
  109    AC_CHECK_PROG([has_xsltproc],[xsltproc],[yes],[no], , )
  110    if test x$has_xsltproc = xno; then
  111       # checks for sabcmd as an alternative
  112       AC_CHECK_PROG([has_sablotron],[sabcmd],[yes],[no], , )
  113       if test x$has_sablotron = xno; then
  114         AC_MSG_ERROR([[xsltproc or sabcmd programs were not found but \
  115                    at least one of them is required to build the SIP manual pages.
  116                    Download xslproc (from libxml) at:
  117                      http://www.xmlsoft.org 
  118                    or sabcmd (from sablotron) at:
  119                      http://www.gingerall.com/charlie/ga/xml/p_sab.xml]])
  120          fi
  121     fi
  122     HELPDIR="man"
  123 else
  124     HELPDIR="help"  
  125 fi
  126 
  127 
  128 
  129 # Determine the include path for the scilab headers.
  130 # 
  131 # The following tests were partly based off ilib_compile from scilab v. 5.1 in
  132 # modules/dynamic_link/macros
  133 
  134 # This works for the binary version: SCIDIR=/usr/local/scilab-5.1
  135 
  136 SCILIBDIR="";
  137 if test $SCIVERSION -le 4; then
  138   CPPFLAGS="$CPPFLAGS -I$SCIDIR/routines"
  139 else
  140   if test -d "$SCIDIR/../../include/scilab/core"; then
  141     # Binary version
  142     SCI_INCL="$SCIDIR/../../";
  143     CPPFLAGS="$CPPFLAGS  -I$SCI_INCL/include/scilab/routines/ -I$SCI_INCL/include/scilab/core/ -I$SCI_INCL/include/scilab/mexlib/"
  144     if test -d "$SCI_INCL/lib/scilab"; then
  145       SCILIBDIR="$SCI_INCL/lib/scilab";
  146     fi
  147   else 
  148     if test -d "$SCIDIR/modules/core/includes"; then
  149       # Source tree version
  150       SCI_INCL="$SCIDIR/modules";
  151       CPPFLAGS="$CPPFLAGS -I$SCI_INCL/routines/includes/ -I$SCI_INCL/core/includes/ -I$SCI_INCL/mexlib/includes/"
  152       if test -d "$SCI_INCL/core/lib"; then
  153         SCILIBDIR="$SCI_INCL/core/lib";
  154       fi
  155     else
  156       if test -d "/usr/include/scilab"; then
  157         # System version
  158         SCI_INCL="/usr/include/scilab"
  159         CPPFLAGS="$CPPFLAGS  -I$SCI_INCL/routines/ -I$SCI_INCL/core/ -I$SCI_INCL/mexlib/ -I$SCI_INCL/"
  160         if test -e "$SCI_INCL/sci_gateway.h" -o -e "$SCI_INCL/routines/sci_gateway.h" -o -e "$SCI_INCL/core/sci_gateway.h" -o -e "$SCI_INCL/mexlib/sci_gateway.h"; then
  161           AC_DEFINE([HAVE_SCI_GATEWAY_H],[],
  162                     [Defines if Scilab has a sci_gateway.h file separate from mex.h])
  163         fi
  164         if test -d "/usr/lib/scilab"; then
  165           SCILIBDIR="/usr/lib/scilab";
  166         fi
  167       else
  168         if test -d "$SCIDIR/../../include/scilab"; then
  169           # Scilab binary version around 5.2.2
  170           SCI_INCL="$SCIDIR/../../";
  171           CPPFLAGS="$CPPFLAGS  -I$SCI_INCL/include/scilab/";
  172           AC_DEFINE([HAVE_SCI_GATEWAY_H],[],
  173                     [Defines if Scilab has a sci_gateway.h file separate from mex.h])
  174           if test -d "$SCI_INCL/lib/scilab"; then
  175             SCILIBDIR="$SCI_INCL/lib/scilab";
  176           fi
  177         else
  178           AC_MSG_ERROR([[Cannot locate the include files from Scilab. Please report this.]])
  179         fi
  180       fi
  181     fi
  182   fi
  183 fi
  184 
  185 # determine location of libscilab for building test subdir
  186 if test -z $SCILIBDIR; then
  187   if test -d "/usr/lib/scilab"; then
  188     SCILIBDIR="/usr/lib/scilab"
  189   else 
  190     if test -d "/usr/local/lib/scilab"; then
  191       SCILIBDIR="/usr/local/lib/scilab"
  192     else
  193       AC_MSG_WARN([[Cannot find location of Scilab libraries needed for tests subdir]])
  194     fi
  195   fi
  196 fi
  197 
  198 if test "x$prefix"  = xNONE; then 
  199    prefix="${SCIDIR}/contrib/${PACKAGE_NAME}-${PACKAGE_VERSION}"
  200 else
  201    prefix="${prefix}/${PACKAGE_NAME}-${PACKAGE_VERSION}"
  202 fi
  203 
  204 TOOLBOXDIR=$prefix
  205 
  206 AC_PREFIX_DEFAULT([$TOOLBOXDIR])
  207 AC_SUBST(TOOLBOXDIR)
  208 AC_SUBST(SCIDIR)
  209 AC_SUBST(SCILIBDIR)
  210 AC_SUBST(SCIEXE)
  211 AC_SUBST(HELPDIR)
  212 
  213 #
  214 # Set defines required to build DLLs and modules using MinGW
  215 # thx to Bob F.
  216 #
  217 LIBRARY_EXTRA_CPPFLAGS=''
  218 LIBRARY_EXTRA_LIBS=''
  219 if test "${native_win32_build}" = 'yes'
  220 then
  221    if test "${libtool_build_shared_libs}" = 'yes'
  222    then
  223       SHARED_LIB_SUFFIX=dll
  224       CPPFLAGS="$CPPFLAGS -DFORDLL -D_DLL"
  225       AC_MSG_WARN([[Dont forget to rename SCI/bin/LibScilab* to lowercase]])
  226       LDFLAGS="$LDFLAGS -L${SCIDIR}/bin"
  227       LIBRARY_EXTRA_CPPFLAGS="-D_SIPLIB"
  228       LIBRARY_EXTRA_LIBS="-lscilab"
  229    else
  230       CPPFLAGS="$CPPFLAGS -D_LIB"
  231    fi
  232 else
  233   case "$host_os" in
  234        *Darwin* | *darwin*)
  235           SHARED_LIB_SUFFIX=dylib
  236        ;;
  237        *)
  238           SHARED_LIB_SUFFIX=so
  239        ;;
  240   esac
  241 fi
  242 AC_SUBST(SHARED_LIB_SUFFIX)
  243 AC_SUBST(LIBRARY_EXTRA_CPPFLAGS)
  244 AC_SUBST(LIBRARY_EXTRA_LIBS)
  245 
  246 
  247 #
  248 # Checks for libraries.
  249 #
  250 #AC_CHECK_PROG([has_pkgconfig],[pkg-config],[yes],[no], , )
  251 #if test x$has_pkgconfig = xyes; then
  252    # pkg-config method
  253 #   AC_PATH_LIB([animal],[0.3.0 -nocheck], [],[],[
  254 #      #if found:
  255 #      CFLAGS="$CFLAGS -W -Wall $ANIMAL_CFLAGS"
  256 #      LIBS="$LIBS `Magick-config --libs` $ANIMAL_LIBS"
  257 #   ], [AC_MSG_ERROR([[AnImaL version >= 0.3.0 was not found.]])])
  258 #else
  259 
  260 # animal-config method
  261 AC_PATH_LIB_LIBCONFIG
  262 AC_PATH_LIB([animal], [0.16.0 -nocheck], [animal-config], ,[
  263    # if found:
  264    if test "$GCC" = "yes";  then
  265       CFLAGS="$CFLAGS -W -Wall -Wno-implicit-int"
  266    fi
  267    CFLAGS="$CFLAGS $ANIMAL_CFLAGS"
  268    LIBS="$LIBS $ANIMAL_LIBS"
  269 ], [AC_MSG_ERROR([[Either AnImaL version >= 0.13.0 was not found or a compile test failed.]])],
  270 [--cppflags], [--ldflags --libs])
  271 
  272 
  273 
  274 ##################################
  275 #  I M A G E   M A G I C K
  276 ##################################
  277 
  278 if test "${native_win32_build}" = 'yes'
  279 then
  280    # under windows, set some stuff by hand
  281    AC_MSG_CHECKING([ImageMagick location])
  282    if test -z "$MAGICK_DIR"; then
  283       MAGICK_DIR="/c/imagemagick"
  284    fi
  285    AC_MSG_RESULT(["assuming $MAGICK_DIR"])
  286 
  287    IMAGEMAGICK_VERSION="6.0.3"
  288    LIBS="$LIBS -lCORE_RL_magick_"
  289    LDFLAGS="$LDFLAGS -L$MAGICK_DIR"
  290    CPPFLAGS="$CPPFLAGS -W -Wall -I$MAGICK_DIR/include"
  291    # CPPFLAGS="$CPPFLAGS -D_MAGICKLIB_"
  292    MAGICK_LIBNAME="CORE_RL_magick_"
  293 else
  294    MAGICK_LIBNAME="Magick"
  295    # TODO change this is not going to be true for newer versions of imagemagick,
  296    # so we must figure this out by testing if the version is greater than
  297    # 6.3.8-5. Right now, I repeat some tests for both Magick and MagickCore
  298 #
  299 # ImageMagick tests to assure compatibility across MANY ImageMagick
  300 # versions, from 5.4.x to 6.x.x
  301 #
  302 AC_PATH_LIB_LIBCONFIG
  303 
  304 
  305 AC_CHECK_PROG([has_magickwand_config],[MagickWand-config],[yes],[no], , )
  306 
  307 MAGICK_CONFIG="Magick-config"
  308 if test x$has_magickwand_config = xyes; then
  309   # This is necessary because MogrifyImage is in MagickWand
  310   # TODO: this can be reconciled with a test for version 6.3.8-5 (when unix
  311   # refactoring occurred)
  312   MAGICK_CONFIG="MagickWand-config"
  313 fi
  314 
  315 
  316 
  317 
  318 have_magick='no'
  319 AC_PATH_LIB([ImageMagick], [[5.4.2 -nocheck]], [$MAGICK_CONFIG], ,[
  320    # if found:
  321    if test x$IMAGEMAGICK_VERSION = "x5.5.5"; then
  322       AC_MSG_ERROR([[ImageMagick 5.5.5 has a bug which make it unusable with
  323 AnImaL. Please download and install any other version from www.imagemagick.org]])
  324    fi
  325    if test x$IMAGEMAGICK_VERSION = "x6.0.1" -o x$IMAGEMAGICK_VERSION = "x6.0.0" ; then
  326       AC_MSG_WARN([[
  327 ****************
  328 ImageMagick 6.0.0 and 6.0.1-3 have a bug which can \
  329 make some images not to be read. To have a fully-functional \
  330 system please download and install another version from \
  331 www.imagemagick.org
  332 ****************]])
  333    fi
  334 
  335    AC_SUBST(IMAGEMAGICK_LIBS)
  336    AC_SUBST(IMAGEMAGICK_LDFLAGS)
  337    AC_SUBST(IMAGEMAGICK_CPPFLAGS)
  338 
  339    LIBS="$IMAGEMAGICK_LIBS $LIBS"
  340    LDFLAGS="$IMAGEMAGICK_LDFLAGS $LDFLAGS"
  341    CPPFLAGS="$IMAGEMAGICK_CPPFLAGS $CPPFLAGS"
  342    have_magick=yes
  343 ], [
  344     AC_MSG_RESULT([[First try to configure ImageMagick version >= 5.4.2 could not be done by Magick-config, 
  345 trying pkg-config]])
  346     have_magick=no
  347 ],
  348 [--cppflags --cflags], [--ldflags --libs])
  349 fi
  350 
  351 if test "$have_magick" = 'no'; then
  352   # Try finding imagemagick by pkg-config
  353   PKG_CHECK_MODULES(MAGICK, 
  354       [MagickCore >= 5.4.2],
  355       [CFLAGS="$CFLAGS $MAGICK_CFLAGS"
  356        LDFLAGS="$LDFLAGS $MAGICK_LDFLAGS"
  357        CPPFLAGS="$CPPFLAGS $MAGICK_CPPFLAGS"
  358        LIBS="$LIBS $MAGICK_LIBS"],
  359       [AC_MSG_ERROR([[ ImageMagick core >= 5.4.2 not found ]])])
  360 
  361   PKG_CHECK_MODULES(MAGICKWAND, 
  362       [MagickWand >= 5.4.2],
  363       [CFLAGS="$CFLAGS $MAGICKWAND_CFLAGS"
  364        LDFLAGS="$LDFLAGS $MAGICKWAND_LDFLAGS"
  365        CPPFLAGS="$CPPFLAGS $MAGICKWAND_CPPFLAGS"
  366        LIBS="$LIBS $MAGICKWAND_LIBS"
  367        have_magick=yes
  368        # On older versions of pkg-config, the PKG_* macro will not call AC_SUBST on
  369        # these variables; modern versions (at least version 0.24) will take care
  370        # of that already. Running it twice, though, will not cause problems...
  371        MAGICK_LIBS="$MAGICK_LIBS $MAGICKWAND_LIBS"
  372        MAGICK_LDFLAGS="$MAGICK_LDFLAGS $MAGICKWAND_LDFLAGS"
  373        MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS $MAGICKWAND_CPPFLAGS"
  374        AC_SUBST([MAGICK_LIBS])
  375        AC_SUBST([MAGICK_LDFLAGS])
  376        AC_SUBST([MAGICK_CPPFLAGS])
  377        have_magick=yes
  378        AC_DEFINE(HAVE_MAGICK,[], [define HAVE_MAGICK if you have ImageMagick])],
  379       [AC_MSG_ERROR([[ ImageMagick >= 5.4.2 not found ]])])
  380 fi
  381 
  382 #   END of ImageMagick tests
  383 dnl ===========================================================================
  384 
  385 
  386 AC_MSG_CHECKING([if  ImageMagick links])
  387 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  388                                     #include <time.h>
  389                                     #include <sys/types.h>
  390                                     #include <magick/api.h>]],
  391                   [[if (1)]]),
  392 AC_MSG_RESULT([yes]),
  393 AC_MSG_RESULT([no])
  394 AC_MSG_ERROR([could not link to ImageMagick. Check the file 
  395    config.log and/or send it to the SIP developers.]))
  396 
  397 # ------------------------------------
  398 AC_MSG_CHECKING([for HWBColorspace in ImageMagick])
  399 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  400                                     #include <time.h>
  401                                     #include <sys/types.h>
  402                                     #include <magick/api.h>]],
  403                   [[if (HWBColorspace == GRAYColorspace);]]),
  404    AC_MSG_RESULT([yes])
  405    AC_DEFINE([HAVE_HWBCOLORSPACE],[],
  406              [Defines if ImageMagick has HWBColorspace]),
  407    AC_MSG_RESULT([no]))
  408 
  409 # ------------------------------------
  410 AC_MSG_CHECKING([for HSLColorspace in ImageMagick])
  411 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  412                                     #include <time.h>
  413                                     #include <sys/types.h>
  414                                     #include <magick/api.h>]],
  415                   [[if (HSLColorspace == GRAYColorspace);]]),
  416    AC_MSG_RESULT([yes])
  417    AC_DEFINE([HAVE_HSLCOLORSPACE],[],
  418              [Defines if ImageMagick has HSLColorspace]),
  419    AC_MSG_RESULT([no]))
  420 
  421 # ------------------------------------
  422 AC_MSG_CHECKING([for Virtual Pixel in ImageMagick])
  423 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  424                                     #include <time.h>
  425                                     #include <sys/types.h>
  426                                     #include <magick/api.h>]],
  427                   [[VirtualPixelMethod vpm;]]),
  428    AC_MSG_RESULT([yes])
  429    AC_DEFINE([HAVE_VIRTUAL_PIXEL],[],
  430              [Defines if ImageMagick has Virtual Pixel specifications]),
  431    AC_MSG_RESULT([no]))
  432 
  433 # ------------------------------------
  434 AC_MSG_CHECKING([whether QueryColorDatabase has 3rd parameter in IM])
  435 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  436                                     #include <time.h>
  437                                     #include <sys/types.h>
  438                                     #include <magick/api.h>]],
  439                   [[QueryColorDatabase("black",(PixelPacket *)NULL,\
  440                   (ExceptionInfo *)NULL);]]),
  441    AC_MSG_RESULT([yes])
  442    AC_DEFINE([HAVE_QueryColorDatabase_3args],[],
  443       [Defines if ImageMagick has QueryColorDatabase with a 3rd parameter]),
  444    AC_MSG_RESULT([no]))
  445 # ------------------------------------
  446 AC_MSG_CHECKING([whether MagickWand.h in IM])
  447 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  448                                     #include <time.h>
  449                                     #include <sys/types.h>
  450                                     #include <wand/MagickWand.h>]],
  451                   [[ ]]),
  452    AC_MSG_RESULT([yes])
  453    AC_DEFINE([HAVE_MagickWand],[],
  454       [Defines if ImageMagick has MagickWand API]),
  455    AC_MSG_RESULT([no]))
  456 # ------------------------------------
  457 AC_MSG_CHECKING([whether MogrifyImage has 5th parameter in IM])
  458 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  459                                     #include <time.h>
  460                                     #include <sys/types.h>
  461                                     #include <magick/api.h>]],
  462                   [[ ImageInfo *image_info; Image *image; char **argv;\
  463                   ExceptionInfo exception;
  464                   MogrifyImage(image_info, 1, argv, &image, &exception);]]),
  465    AC_MSG_RESULT([yes])
  466    AC_DEFINE([HAVE_MogrifyImage_5args],[],
  467       [Defines if ImageMagick has MogrifyImage with a 5th parameter]),
  468    AC_MSG_RESULT([no]))
  469 
  470 # ------------------------------------
  471 # TODO: set MAGICK_LIBNAME appropriately and change this test to use
  472 # MAGICK_LIBNAME. 
  473 AC_CHECK_LIB([Magick],[GetLocaleExceptionMessage],[
  474   # if found
  475   AC_DEFINE([HAVE_GetLocaleExceptionMessage],[], [Define if \
  476 ImageMagick has locale error messages.])
  477    ]
  478 , [
  479   # if not found, try MagickCore
  480   AC_CHECK_LIB([MagickCore],[GetLocaleExceptionMessage],[
  481     AC_DEFINE([HAVE_GetLocaleExceptionMessage],[], [Define if \
  482   ImageMagick has locale error messages.])] , [])
  483 ])
  484 
  485 # ------------------------------------
  486 # Some distros (Ubuntu 11.04) fail to have this symbol in the shared libs
  487 AC_CHECK_LIB([Magick],[StringToDouble],[
  488   # if found
  489   AC_DEFINE([HAVE_StringToDouble],[], [Define if \
  490 ImageMagick has StringToDouble.])
  491    ]
  492 , [
  493   # if not found, try MagickCore
  494   AC_CHECK_LIB([MagickCore],[StringToDouble],[
  495     AC_DEFINE([HAVE_StringToDouble],[], [Define if \
  496   ImageMagick has StringToDouble.])] , [
  497    AC_MSG_WARN([[sip mogrify -fuzz for segmentation will not work in this system.]])
  498     ])
  499 ])
  500 
  501 # ------------------------------------
  502 AC_MSG_CHECKING([name of the default compression quality in IM])
  503 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  504                                     #include <time.h>
  505                                     #include <sys/types.h>
  506                                     #include <magick/api.h>]],
  507                   [[unsigned a=UndefinedCompressionQuality;]]),
  508    AC_MSG_RESULT([UndefinedCompressionQuality])
  509    AC_DEFINE([MAGICK_DEFAULT_COMPRESSION_QUALITY],
  510              [UndefinedCompressionQuality],
  511              [The name of the default compression quality in this \
  512 particular ImageMagick setup]),
  513    #----- Not UndefinedCompression. Test for UndefinedCompressionQuality
  514     AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  515                                         #include <time.h>
  516                                         #include <sys/types.h>
  517                                         #include <magick/api.h>]],
  518                       [[unsigned a=UndefinedCompression;]]),
  519        AC_MSG_RESULT([UndefinedCompression])
  520        AC_DEFINE([MAGICK_DEFAULT_COMPRESSION_QUALITY],
  521                  [UndefinedCompression],
  522                  [The name of the default compression quality in this \
  523     particular ImageMagick setup]),
  524    #----- Not UndefinedCompression. Test for UndefinedCompressionQuality
  525         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <stdio.h>
  526                                             #include <time.h>
  527                                             #include <sys/types.h>
  528                                             #include <magick/api.h>]],
  529                           [[unsigned a=DefaultCompressionQuality;]]),
  530            AC_MSG_RESULT([DefaultCompressionQuality])
  531            AC_DEFINE([MAGICK_DEFAULT_COMPRESSION_QUALITY],
  532                      [DefaultCompressionQuality],
  533                      [The name of the default compression quality in this \
  534         particular ImageMagick setup]),
  535        AC_MSG_ERROR([No compression quality name detected. Please report your ImageMagick version in the bugtracker at http://siptoolbox.sf.net
  536          ])
  537           )
  538      )
  539    
  540    )
  541 
  542 
  543 # END OF IMAGEMAGICK TESTS
  544 dnl #############################################
  545 
  546 dnl ###############
  547     # OpenCV tests
  548 dnl ###############
  549 have_opencv=no
  550 
  551 AC_ARG_WITH([opencv], 
  552    [AS_HELP_STRING([--without-opencv], [disable the OpenCV API])],
  553    [],
  554    [with_opencv=yes])
  555 
  556 AS_IF([test "x$with_opencv" = "xyes"], [
  557 PKG_CHECK_MODULES(OPENCV, 
  558     [opencv >= 0.26],
  559     [CFLAGS="$CFLAGS $OPENCV_CFLAGS"
  560      LDFLAGS="$LDFLAGS $OPENCV_LIBS"
  561      have_opencv=yes
  562      AC_DEFINE(HAVE_OPENCV,[], [define HAVE_OPENCV if you have opencv])],
  563     [AC_MSG_WARN([[ OpenCV >= 0.26 not found ]])])
  564 ])
  565 
  566 # END of OpenCV tests
  567 dnl #############################################
  568 
  569 dnl #####################
  570 #  L E P T O N I C A
  571 dnl #####################
  572 
  573 have_lept=no
  574 
  575 AC_ARG_WITH([leptonica], 
  576    [AS_HELP_STRING([--without-leptonica], [disable the Leptonica API])],
  577    [],
  578    [with_leptonica=yes])
  579 
  580 AS_IF([test "x$with_leptonica" = "xyes"], [
  581 # Check location of leptonica/liblept headers.
  582 AC_MSG_CHECKING(for leptonica)
  583 AC_ARG_VAR(LIBLEPT_HEADERSDIR,[Leptonica headers directory])
  584 
  585 if test "$LIBLEPT_HEADERSDIR" = "" ; then
  586   LIBLEPT_HEADERSDIR="/usr/local/include /usr/include"
  587 fi
  588 for incd in $LIBLEPT_HEADERSDIR
  589 do
  590   for lept in . leptonica liblept
  591   do
  592     if test -r "$incd/$lept/allheaders.h" ; then
  593       CPPFLAGS="$CPPFLAGS -I$incd/$lept"
  594       have_lept=yes
  595     fi
  596   done
  597 done
  598 
  599 if test "$have_lept" = yes ; then
  600   AC_MSG_RESULT(yes)
  601   AC_CHECK_LIB(lept,pixCreate,[], AC_MSG_ERROR([leptonica library missing]))
  602 else
  603   AC_MSG_WARN([leptonica not found])
  604 fi
  605 ]) 
  606 dnl END AS_IF
  607 
  608 # End of Leptonica Tests
  609 ##############################################
  610 
  611 # Checks for header files.
  612 AC_HEADER_STDC
  613 if test x"$ac_cv_header_stdc" = x'no'; then
  614    AC_MSG_WARN([[this package uses ANSI-C headers but none were found.]])
  615 fi
  616 AC_CHECK_HEADERS([string.h])
  617 
  618 # Checks for typedefs, structures, and compiler characteristics.
  619 AC_C_CONST
  620 AC_C_INLINE
  621 AC_HEADER_STDBOOL
  622 
  623 
  624 # Checks for library functions.
  625 
  626 AC_CHECK_FUNC([strcasecmp],[],[AC_MSG_ERROR([[this package needs the strcasecmp function.]])])
  627 AC_CHECK_FUNCS([malloc])
  628 
  629 AC_CONFIG_FILES([Makefile 
  630   src/Makefile 
  631   macros/Makefile
  632   images/Makefile 
  633   images/photonics/Makefile
  634   man/Makefile 
  635   help/Makefile 
  636   config/loader.sce 
  637   config/sip_xmltohtml.sci
  638   config/loader_include.sce
  639   tests/Makefile])
  640 
  641 AC_OUTPUT
  642 
  643 AC_MSG_RESULT([
  644 =====================================================
  645 Configuration:
  646   CFLAGS         = $CFLAGS
  647 
  648   CPPFLAGS       = $CPPFLAGS
  649 
  650   LDFLAGS        = $LDFLAGS
  651 
  652   LIBS           = $LIBS
  653 
  654   OpenCV support = $have_opencv
  655   
  656   Leptonica support = $have_lept
  657 =====================================================
  658 This toolbox will be installed in $TOOLBOXDIR
  659 Please run 'make' and 'make install' to compile and install the toolbox. 
  660 ]) 
  661