dnl dnl MapServer configure.in dnl dnl Process this file with autoconf to produce a configure script. dnl dnl $Id$ dnl AC_INIT(Makefile.in) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_RANLIB AC_PROG_LEX AC_PROG_YACC AC_RUNPATH_SWITCH dnl --------------------------------------------------------------------- dnl Checks for libraries. dnl --------------------------------------------------------------------- AC_CHECK_LIB(m,exp, XTRALIBS="$XTRALIBS -lm",,) AC_CHECK_LIB(stdc++,exp, XTRALIBS="$XTRALIBS -lstdc++",,) AC_SUBST(XTRALIBS, $XTRALIBS) LIBS="$XTRALIBS $LIBS" dnl --------------------------------------------------------------------- dnl Checks for header files. dnl --------------------------------------------------------------------- AC_HEADER_STDC dnl --------------------------------------------------------------------- dnl Check for some string functions dnl --------------------------------------------------------------------- AC_CHECK_FUNC(strcasecmp, , STRINGS="-DNEED_STRCASECMP $STRINGS") AC_CHECK_FUNC(strncasecmp, , STRINGS="-DNEED_STRNCASECMP $STRINGS") AC_CHECK_FUNC(strdup, , STRINGS="-DNEED_STRDUP $STRINGS") AC_SUBST(STRINGS, $STRINGS) dnl --------------------------------------------------------------------- dnl libJPEG (included by default if found on system). dnl --------------------------------------------------------------------- unset ac_cv_lib_jpeg_jpeg_read_header AC_CHECKING(whether we should include JPEG support...) AC_ARG_WITH(jpeg, [ --without-jpeg Disable JPEG support. --with-jpeg[=DIR] Include JPEG support (DIR is LibJPEG's install dir).],,) if test -n "$with_jpeg" -a "$with_jpeg" != "yes" ; then AC_EXPAND_PATH($with_jpeg, JPEG_DIR) test -f $JPEG_DIR/include/jpeg/jpeglib.h && JPEG_INCLUDE="$JPEG_DIR/include/jpeg" test -f $JPEG_DIR/include/jpeglib.h && JPEG_INCLUDE="$JPEG_DIR/include" test -f $JPEG_DIR/lib/jpeglib.h && JPEG_INCLUDE="$JPEG_DIR/lib" test -f $JPEG_DIR/jpeglib.h && JPEG_INCLUDE="$JPEG_DIR" test -f $JPEG_DIR/lib/libjpeg.a && JPEG_LIBDIR="$JPEG_DIR/lib" test -f $JPEG_DIR/libjpeg.a && JPEG_LIBDIR="$JPEG_DIR" test -f $JPEG_DIR/lib/libjpeg.so -o -f $JPEG_DIR/lib/libjpeg.sl && JPEG_LIBDIR="$JPEG_DIR/lib" test -f $JPEG_DIR/libjpeg.so -o -f $JPEG_DIR/libjpeg.sl && JPEG_LIBDIR="$JPEG_DIR" if test -n "$JPEG_INCLUDE" -a -n "$JPEG_LIBDIR" ; then JPEG_ENABLED="-DUSE_JPEG" JPEG_INC=-I$JPEG_INCLUDE JPEG_LIB="-L$JPEG_LIBDIR -ljpeg" AC_ADD_RUNPATH("$JPEG_LIBDIR") else if test "$with_jpeg" != "no" ; then AC_MSG_RESULT("Could not find jpeglib.h or libjpeg.a/libjpeg.so in $JPEG_DIR.") fi fi dnl if --without-jpeg was requested, disable mapserver from using it, but dnl libjpeg may still be needed by GD if test "$with_jpeg" = "no" ; then AC_MSG_RESULT([ disabled by --without-jpeg]) else JPEG_ENABLED="-DUSE_JPEG" fi if test -z "$JPEG_LIB" ; then AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_LIB="-ljpeg",,,) if test -n "$JPEG_LIB" ; then JPEG_LIB="-ljpeg" AC_MSG_RESULT([ using libjpeg from system libs.]) else AC_MSG_RESULT([ libjpeg not found. JPEG support not included, possibly needed for GD.]) fi else AC_MSG_RESULT([ using libjpeg from system $JPEG_LIB]) fi else AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_ENABLED=-DUSE_JPEG,,,) if test -n "$JPEG_ENABLED" ; then JPEG_LIB="-ljpeg" AC_MSG_RESULT([ using libjpeg from system libs.]) else AC_MSG_RESULT([ libjpeg not found. JPEG support not included, possibly needed for GD.]) fi fi AC_SUBST(JPEG_ENABLED,$JPEG_ENABLED) AC_SUBST(JPEG_INC, $JPEG_INC) AC_SUBST(JPEG_LIB, $JPEG_LIB) ALL_ENABLED="$JPEG_ENABLED $ALL_ENABLED" ALL_INC="$JPEG_INC $ALL_INC" ALL_LIB="$JPEG_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl Find GD library dnl dnl If --with-gd not given, then check in system libs. dnl --------------------------------------------------------------------- dnl We don't want LIBS updated by all the GD stuff, so we save it and dnl restore later. ms_saved_LIBS="$LIBS" dnl Clear some cache variables unset ac_cv_lib_gd_gdImageCreate unset ac_cv_lib_gd_gdImageString16 unset ac_cv_lib_gd_gdImageGif unset ac_cv_lib_gd_gdImagePng unset ac_cv_lib_gd_gdImageJpeg unset ac_cv_lib_gd_gdImageWBMP unset ac_cv_lib_gd_gdImageStringTTF unset ac_cv_lib_gd_gdImageStringFT unset ac_cv_lib_gd_gdImageGifPtr unset ac_cv_lib_c_gdImageCreate unset ac_cv_lib_c_gdImageString16 unset ac_cv_lib_c_gdImageGif unset ac_cv_lib_c_gdImagePng unset ac_cv_lib_c_gdImageJpeg unset ac_cv_lib_c_gdImageWBMP unset ac_cv_lib_c_gdImageStringTTF unset ac_cv_lib_c_gdImageStringFT unset ac_cv_lib_c_gdImageGifPtr AC_CHECKING(which version of GD to use...) AC_ARG_WITH(gd, [ --with-gd[=[static,]DIR] Specify which version of GD to use (DIR is GD's install dir).],,) if test "$with_gd" = "no" ; then AC_MSG_ERROR(gd library cannot be disabled) elif test -n "$with_gd" -a "$with_gd" != "yes" ; then dnl dnl --with-gd was specified explicitly... try to establish which version dnl of GD this is dnl AC_PARSE_WITH_LIB_STATIC($with_gd, GD_DIR, GD_STATIC) AC_EXPAND_PATH($GD_DIR, GD_DIR) test -f $GD_DIR/include/gd.h && GD_INCLUDE="$GD_DIR/include" test -f $GD_DIR/include/gd/gd.h && GD_INCLUDE="$GD_DIR/include/gd" test -f $GD_DIR/gd.h && GD_INCLUDE="$GD_DIR" test -f $GD_DIR/lib/libgd.a && GD_LIBDIR="$GD_DIR/lib" test -f $GD_DIR/.libs/libgd.a && GD_LIBDIR="$GD_DIR/.libs" test -f $GD_DIR/_libs/libgd.a && GD_LIBDIR="$GD_DIR/_libs" test -f $GD_DIR/libgd.a && GD_LIBDIR="$GD_DIR" test -f $GD_DIR/lib/libgd.so -o -f $GD_DIR/lib/libgd.sl && GD_LIBDIR="$GD_DIR/lib" test -f $GD_DIR/.libs/libgd.so -o -f $GD_DIR/.libs/libgd.sl && GD_LIBDIR="$GD_DIR/.libs" test -f $GD_DIR/_libs/libgd.so -o -f $GD_DIR/_libs/libgd.sl && GD_LIBDIR="$GD_DIR/_libs" test -f $GD_DIR/libgd.so -o -f $GD_DIR/libgd.sl && GD_LIBDIR="$GD_DIR" if test -n "$GD_INCLUDE" -a -n "$GD_LIBDIR" ; then GD_INC=-I$GD_INCLUDE GD_LIB="-L$GD_LIBDIR -lgd" AC_MSG_RESULT([ using libgd from $GD_LIB]) AC_ADD_RUNPATH("$GD_LIBDIR") else AC_MSG_ERROR("Could not find gd.h or libgd.a/libgd.so in $GD_DIR. Make sure gd is compiled before calling configure.") fi else dnl --with-gd specified without a DIR, look for gd in system dirs dnl /usr or /usr/local for GD_DIR in /usr /usr/local do test -f $GD_DIR/include/gd.h && GD_INCLUDE="$GD_DIR/include" test -f $GD_DIR/lib/libgd.a && GD_LIBDIR="$GD_DIR/lib" test -f $GD_DIR/lib/libgd.so -o -f $GD_DIR/lib/libgd.sl && GD_LIBDIR="$GD_DIR/lib" if test -n "$GD_INCLUDE" -a -n "$GD_LIBDIR" ; then GD_INC=-I$GD_INCLUDE GD_LIB="-L$GD_LIBDIR -lgd" AC_MSG_RESULT([ using libgd from system libs.]) AC_ADD_RUNPATH("$GD_LIBDIR") break fi done fi dnl --------------------------------------------------------------------- dnl Several libraries might be needed for GD: png, zlib, freetype, dnl and jpeg (processed above). Use where GD was found as default. dnl --------------------------------------------------------------------- dnl --------------------------------------------------------------------- dnl Check where FreeType is installed dnl --------------------------------------------------------------------- unset ac_cv_lib_freetype_FT_Init_FreeType unset ac_cv_lib_ttf_TT_Init_FreeType AC_ARG_WITH(freetype, [ --with-freetype=DIR Specify where FreeType is installed (DIR is path to FreeType 2.x freetype-config program or FreeType 1.x/2.x install dir).], FT_DIR=$withval,FT_DIR='') AC_ARG_ENABLE(force-freetype1, [ --enable-force-freetype1 Use this to force detection of freetype1 over freetype2 on systems which have both versions installed in system libs such as RH7.1 (By default, freetype2 is detected first)],,) AC_EXPAND_PATH($FT_DIR, FT_DIR) AC_CHECKING(where FreeType is installed...) FT_LIB='' FT_BIN='' FT_TYPE='' test -x "$FT_DIR" -a "freetype-config" = "`basename $FT_DIR ''`" && FT_BIN="$FT_DIR" test -x "$FT_DIR/freetype-config" && FT_BIN="$FT_DIR/freetype-config" test -x "$FT_DIR/bin/freetype-config" && FT_BIN="$FT_DIR/bin/freetype-config" if test "$with_freetype" = "yes" ; then AC_PATH_PROG(FT_BIN, freetype-config, no) fi if test -n "$FT_BIN" ; then dnl we have freetype-config program, use its values FT_LIB=`$FT_BIN --libs` FT_LIBDIR="`$FT_BIN --exec-prefix`/lib" AC_MSG_RESULT([ using libfreetype from $FT_LIB]) AC_ADD_RUNPATH("$FT_LIBDIR") else dnl try freetype 2.x install lib name test -f $FT_DIR/lib/libfreetype.a -o -f $FT_DIR/lib/libfreetype.so -o -f $FT_DIR/lib/libfreetype.sl && FT_LIBDIR="$FT_DIR/lib" test -f $FT_DIR/libfreetype.a -o -f $FT_DIR/libfreetype.so -o -f $FT_DIR/libfreetype.sl && FT_LIBDIR="$FT_DIR" if test -n "$FT_LIBDIR" ; then FT_TYPE="-lfreetype" else dnl try freetype 1.x install lib name test -f $FT_DIR/lib/libttf.a -o -f $FT_DIR/lib/libttf.so -o -f $FT_DIR/lib/libttf.sl && FT_LIBDIR="$FT_DIR/lib" test -f $FT_DIR/libttf.a -o -f $FT_DIR/libttf.so -o -f $FT_DIR/libttf.sl && FT_LIBDIR="$FT_DIR" if test -n "$FT_LIBDIR" ; then FT_TYPE="-lttf" fi fi fi if test -n "$FT_LIBDIR" -a -z "$FT_BIN" ; then FT_LIB="-L$FT_LIBDIR $FT_TYPE" AC_MSG_RESULT([ using libfreetype from $FT_LIB]) AC_ADD_RUNPATH("$FT_LIBDIR") else dnl check for lib in system libs if test "$enable_force_freetype1" = "yes" ; then dnl check for freetype1 first AC_CHECK_LIB(ttf, TT_Init_FreeType, FT_LIB="-lttf", AC_CHECK_LIB(freetype, FT_Init_FreeType, FT_LIB="-lfreetype",,) ) else dnl check for freetype2 first AC_CHECK_LIB(freetype, FT_Init_FreeType, FT_LIB="-lfreetype", AC_CHECK_LIB(ttf, TT_Init_FreeType, FT_LIB="-lttf",,) ) fi if test -n "$FT_LIB" ; then AC_MSG_RESULT([ using libfreetype $FT_LIB from system libs.]) else AC_MSG_RESULT([ freetype-config or libfreetype cannot be found, possibly needed for GD]) fi fi dnl --------------------------------------------------------------------- dnl Check where zlib is installed dnl --------------------------------------------------------------------- unset ac_cv_lib_z_zlibVersion AC_ARG_WITH(zlib, [ --with-zlib=DIR Specify where zlib is installed (DIR is path to zlib install dir).], ZL_DIR=$withval,ZL_DIR='') AC_EXPAND_PATH($ZL_DIR, ZL_DIR) AC_CHECKING(where Zlib is installed...) ZL_LIB='' test -f $ZL_DIR/lib/libz.a -o -f $ZL_DIR/lib/libz.so -o -f $ZL_DIR/lib/libz.sl && ZL_LIBDIR="$ZL_DIR/lib" test -f $ZL_DIR/libz.a -o -f $ZL_DIR/libz.so -o -f $ZL_DIR/libz.sl && ZL_LIBDIR="$ZL_DIR" if test -n "$ZL_LIBDIR" ; then ZL_LIB="-L$ZL_LIBDIR -lz" AC_MSG_RESULT([ using libz from $ZL_LIB]) AC_ADD_RUNPATH("$ZL_DIR") else dnl check for lib in system libs AC_CHECK_LIB(z, zlibVersion, ZL_LIB="-lz",,) if test -n "$ZL_LIB" ; then AC_MSG_RESULT([ using libz from system libs.]) else AC_MSG_RESULT([ Zlib (libz) library cannot be found, possibly needed for GD]) fi fi dnl --------------------------------------------------------------------- dnl Check where PNG is installed dnl --------------------------------------------------------------------- unset ac_cv_lib_png_png_init_io AC_ARG_WITH(png, [ --with-png=DIR Specify where PNG is installed (DIR is path to PNG install dir).], PNG_DIR=$withval,PNG_DIR='') AC_EXPAND_PATH($PNG_DIR, PNG_DIR) AC_CHECKING(where PNG is installed...) PNG_LIB='' test -f $PNG_DIR/lib/libpng.a -o -f $PNG_DIR/lib/libpng.so -o -f $PNG_DIR/lib/libpng.sl && PNG_LIBDIR="$PNG_DIR/lib" test -f $PNG_DIR/libpng.a -o -f $PNG_DIR/libpng.so -o -f $PNG_DIR/libpng.sl && PNG_LIBDIR="$PNG_DIR" if test -n "$PNG_LIBDIR" ; then PNG_LIB="-L$PNG_LIBDIR -lpng" AC_MSG_RESULT([ using libpng from $PNG_LIB]) AC_ADD_RUNPATH("$PNG_LIBDIR") else dnl check for lib in system libs AC_CHECK_LIB(png, png_init_io, PNG_LIB="-lpng",, $ZL_LIB) if test -n "$PNG_LIB" ; then AC_MSG_RESULT([ using libpng from system libs.]) else AC_MSG_RESULT([ PNG (libpng) library cannot be found, possibly needed for GD]) fi fi GD_XTRA_LIBS="$JPEG_LIB $FT_LIB $PNG_LIB $ZL_LIB" dnl --------------------------------------------------------------------- dnl Continue with GD processing - determine GD formats dnl --------------------------------------------------------------------- if test -n "$with_gd" -a "$with_gd" != "yes" ; then dnl check gd lib that was found on --with-gd= if test "$GD_STATIC" = "yes" ; then dnl To test against static GD, do AC_CHECK_LIB calls against -lc and dnl include libgd.a in GD_LIB param GD_CHECKLIB=c GD_LIB="" GD_STATIC=$GD_LIBDIR/libgd.a AC_MSG_RESULT([static linkage of $GD_STATIC requested... testing supported formats...]) else GD_CHECKLIB=c # GD_LIB was already set above GD_STATIC="" fi AC_CHECK_LIB($GD_CHECKLIB, gdImageGif, GD_DEF="$GD_DEF -DUSE_GD_GIF",, $GD_STATIC $GD_LIB $GD_XTRA_LIBS) AC_CHECK_LIB($GD_CHECKLIB, gdImagePng, GD_DEF="$GD_DEF -DUSE_GD_PNG",, $GD_STATIC $GD_LIB $GD_XTRA_LIBS) AC_CHECK_LIB($GD_CHECKLIB, gdImageJpeg, GD_DEF="$GD_DEF -DUSE_GD_JPEG",, $GD_STATIC $GD_LIB $GD_XTRA_LIBS) AC_CHECK_LIB($GD_CHECKLIB, gdImageWBMP, GD_DEF="$GD_DEF -DUSE_GD_WBMP",, $GD_STATIC $GD_LIB $GD_XTRA_LIBS) dnl Check for Freetype 2 support GD_FT_FOUND=no AC_CHECK_LIB($GD_CHECKLIB, gdImageStringFT, GD_FT_FOUND="yes";GD_DEF="$GD_DEF -DUSE_GD_FT",, $GD_STATIC $GD_LIB $GD_XTRA_LIBS) dnl If we can't find Freetype 2 in GD then check for Freetype 1 if test "$GD_FT_FOUND" = "no" ; then AC_CHECK_LIB($GD_CHECKLIB, gdImageStringTTF, GD_DEF="$GD_DEF -DUSE_GD_TTF",, $GD_STATIC $GD_LIB $GD_XTRA_LIBS) fi dnl For GD 1.2, x/y in buffers are swapped. AC_CHECK_LIB($GD_CHECKLIB, gdImageString16, , GD_DEF="$GD_DEF -DUSE_GD_SWAP_XY" , $GD_STATIC $GD_LIB $GD_XTRA_LIBS) dnl gdImageGifPtr is there only in GIF-patched GD versions AC_CHECK_LIB($GD_CHECKLIB, gdImageGifPtr,GD_DEF="$GD_DEF -DGD_HAS_GDIMAGEGIFPTR",, $GD_STATIC $GD_LIB $GD_XTRA_LIBS) AC_MSG_RESULT([ using GD ($GD_DEF) from $GD_DIR.]) else dnl dnl --width-gd was not given... then look in system libs dnl dnl Make sure GD is at least there! AC_CHECK_LIB(gd, gdImageCreate, GD_FOUND=yes , ,$GD_XTRA_LIBS) if test -z "$GD_FOUND" ; then AC_MSG_ERROR([GD is required but was not found... use --with-gd=DIR to specify its location.]) fi dnl Check supported formats AC_CHECK_LIB(gd, gdImageGif, GD_DEF="$GD_DEF -DUSE_GD_GIF",, $GD_LIB $GD_XTRA_LIBS) AC_CHECK_LIB(gd, gdImagePng, GD_DEF="$GD_DEF -DUSE_GD_PNG",, $GD_LIB $GD_XTRA_LIBS) AC_CHECK_LIB(gd, gdImageJpeg, GD_DEF="$GD_DEF -DUSE_GD_JPEG",, $GD_LIB $GD_XTRA_LIBS) AC_CHECK_LIB(gd, gdImageWBMP, GD_DEF="$GD_DEF -DUSE_GD_WBMP",, $GD_LIB $GD_XTRA_LIBS) dnl Check for Freetype 2 support GD_FT_FOUND=no AC_CHECK_LIB(gd, gdImageStringFT, GD_FT_FOUND="yes";GD_DEF="$GD_DEF -DUSE_GD_FT",, $GD_LIB $GD_XTRA_LIBS) dnl If we can't find Freetype 2 in GD then check for Freetype 1 if test "$GD_FT_FOUND" = "no" ; then AC_CHECK_LIB(gd, gdImageStringTTF, GD_DEF="$GD_DEF -DUSE_GD_TTF",, $GD_LIB $GD_XTRA_LIBS) fi dnl For GD 1.2, x/y in buffers are swapped. AC_CHECK_LIB(gd, gdImageString16, , GD_DEF="$GD_DEF -DUSE_GD_SWAP_XY", $GD_LIB $GD_XTRA_LIBS) dnl gdImageGifPtr is there only in GIF-patched GD versions AC_CHECK_LIB(gd, gdImageGifPtr, GD_DEF="$GD_DEF -DGD_HAS_GDIMAGEGIFPTR",, $GD_LIB $GD_XTRA_LIBS) if test -n "$GD_DEF" ; then GD_LIB="-lgd $GD_LIB" AC_MSG_RESULT([ using GD ($GD_DEF) from system libs.]) fi fi GD_LIB="$GD_LIB $GD_XTRA_LIBS" AC_SUBST(GD_DEF, $GD_DEF) AC_SUBST(GD_INC, $GD_INC) AC_SUBST(GD_LIB, $GD_LIB) AC_SUBST(GD_STATIC, $GD_STATIC) AC_SUBST(MAKE_GD, $MAKE_GD) AC_SUBST(MAKE_GD_CLEAN, $MAKE_GD_CLEAN) ALL_ENABLED="$GD_DEF $ALL_ENABLED" ALL_INC="$GD_INC $ALL_INC" ALL_LIB="$GD_LIB $ALL_LIB" ALL_STATIC_LIB="$GD_STATIC $ALL_STATIC_LIB" dnl Restore LIBS environment to state at beginning of gd tests. LIBS="$ms_saved_LIBS" dnl --------------------------------------------------------------------- dnl Find PDFlib library dnl dnl If --with-pdflib not given, then check in system libs. dnl --------------------------------------------------------------------- dnl We don't want LIBS updated by all the PDF stuff, so we save it and dnl restore later. ms_saved_LIBS="$LIBS" dnl Clear some cache variables unset ac_cv_lib_pdf_PDF_setlinewidth unset ac_cv_lib_pdf_PDF_setrgbcolor unset ac_cv_lib_pdf_PDF_moveto unset ac_cv_lib_pdf_PDF_curveto AC_CHECKING(whether we should include PDF support...) AC_ARG_WITH(pdf, [ --without-pdf Disable PDF support. --with-pdf[=DIR] Include PDF support (DIR is PDFlib's install dir).],,) if test "$with_pdf" = "no" ; then AC_MSG_RESULT([ disabled by --without-pdf]) elif test -n "$with_pdf" -a "$with_pdf" != "yes" ; then AC_EXPAND_PATH($with_pdf, PDF_DIR) test -f $PDF_DIR/include/pdflib.h && PDF_INCLUDE="$PDF_DIR/include" test -f $PDF_DIR/libpdf/pdflib.h && PDF_INCLUDE="$PDF_DIR/libpdf" test -f $PDF_DIR/include/libpdf/pdflib.h && PDF_INCLUDE="$PDF_DIR/include/libpdf" test -f $PDF_DIR/pdflib.h && PDF_INCLUDE="$PDF_DIR" test -f $PDF_DIR/lib/libpdf.a && PDF_LIBDIR="$PDF_DIR/lib" test -f $PDF_DIR/libpdf/libpdf.a && PDF_LIBDIR="$PDF_DIR/libpdf" test -f $PDF_DIR/libpdf.a && PDF_LIBDIR="$PDF_DIR" test -f $PDF_DIR/lib/libpdf.so -o $PDF_DIR/lib/libpdf.sl && PDF_LIBDIR="$PDF_DIR/lib" test -f $PDF_DIR/libpdf/libpdf.so -o -f $PDF_DIR/libpdf/libpdf.sl && PDF_LIBDIR="$PDF_DIR/libpdf" test -f $PDF_DIR/libpdf.so -o -f $PDF_DIR/libpdf.sl && PDF_LIBDIR="$PDF_DIR" if test -n "$PDF_INCLUDE" -a -n "$PDF_LIBDIR" ; then PDF_LIB="-L$PDF_LIBDIR -lPDF" PDF_INC=-I$PDF_INCLUDE AC_ADD_RUNPATH("$PDF_LIBDIR") else AC_MSG_ERROR("Could not find pdflib.h or libpdf.a/libpdf.so in $PDF_DIR.") fi PDF_ENABLED="-DUSE_PDF" AC_MSG_RESULT([ using libpdf from $PDF_LIB.]) else AC_CHECK_LIB(pdf,PDF_setlinewidth,PDF_LIB="-lpdf",,) AC_CHECK_LIB(pdf,PDF_setrgbcolor,PDF_LIB="-lpdf",,) AC_CHECK_LIB(pdf,PDF_moveto,PDF_LIB="-lpdf",,) AC_CHECK_LIB(pdf,PDF_curveto,PDF_LIB="-lpdf",,) AC_CHECK_LIB(pdf,PDF_show_xy,PDF_LIB="-lpdf",,) if test -n "$PDF_LIB" ; then PDF_ENABLED=-DUSE_PDF PDF_OBJ="mappdf.o" AC_MSG_RESULT([ using libpdf from system libs.]) else AC_MSG_RESULT([ libpdf not found... PDF support not included.]) fi fi dnl dnl libpdf may need the same libs (libz, libjpeg) that are included with GD dnl PDF_LIB="$PDF_LIB" AC_SUBST(PDF_ENABLED,$PDF_ENABLED) AC_SUBST(PDF_INC, $PDF_INC) AC_SUBST(PDF_LIB, $PDF_LIB) AC_SUBST(PDF_OBJ, $PDF_OBJ) ALL_ENABLED="$PDF_ENABLED $ALL_ENABLED" ALL_INC="$PDF_INC $ALL_INC" ALL_LIB="$PDF_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl libTIFF (included by default if found on system). dnl --------------------------------------------------------------------- unset ac_cv_lib_tiff_TIFFOpen AC_CHECKING(whether we should include TIFF support...) AC_ARG_WITH(tiff, [ --without-tiff Disable TIFF support. --with-tiff[=DIR] Include TIFF support (DIR is LibTIFF's install dir).],,) if test "$with_tiff" = "no" ; then AC_MSG_RESULT([ disabled by --without-tiff]) elif test -n "$with_tiff" -a "$with_tiff" != "yes" ; then AC_EXPAND_PATH($with_tiff, TIFF_DIR) test -f $TIFF_DIR/include/tiffio.h && TIFF_INCLUDE="$TIFF_DIR/include" test -f $TIFF_DIR/libtiff/tiffio.h && TIFF_INCLUDE="$TIFF_DIR/libtiff" test -f $TIFF_DIR/include/libtiff/tiffio.h && TIFF_INCLUDE="$TIFF_DIR/include/libtiff" test -f $TIFF_DIR/tiffio.h && TIFF_INCLUDE="$TIFF_DIR" test -f $TIFF_DIR/lib/libtiff.a && TIFF_LIBDIR="$TIFF_DIR/lib" test -f $TIFF_DIR/libtiff/libtiff.a && TIFF_LIBDIR="$TIFF_DIR/libtiff" test -f $TIFF_DIR/libtiff.a && TIFF_LIBDIR="$TIFF_DIR" test -f $TIFF_DIR/lib/libtiff.so -o $TIFF_DIR/lib/libtiff.sl && TIFF_LIBDIR="$TIFF_DIR/lib" test -f $TIFF_DIR/libtiff/libtiff.so -o -f $TIFF_DIR/libtiff/libtiff.sl && TIFF_LIBDIR="$TIFF_DIR/libtiff" test -f $TIFF_DIR/libtiff.so -o -f $TIFF_DIR/libtiff.sl && TIFF_LIBDIR="$TIFF_DIR" if test -n "$TIFF_INCLUDE" -a -n "$TIFF_LIBDIR" ; then TIFF_LIB="-L$TIFF_LIBDIR -ltiff" TIFF_INC=-I$TIFF_INCLUDE AC_ADD_RUNPATH("$TIFF_LIBDIR") else AC_MSG_ERROR("Could not find tiffio.h or libtiff.a/libtiff.so in $TIFF_DIR.") fi TIFF_ENABLED="-DUSE_TIFF" AC_MSG_RESULT([ using libtiff from $TIFF_LIB.]) else AC_CHECK_LIB(tiff,TIFFOpen,TIFF_LIB="-ltiff",,$GD_XTRA_LIBS) if test -n "$TIFF_LIB" ; then TIFF_ENABLED=-DUSE_TIFF AC_MSG_RESULT([ using libtiff from system libs.]) else AC_MSG_RESULT([ libtiff not found... TIFF support not included.]) fi fi dnl dnl libtiff may need the same libs (libz, libjpeg) that are included with GD dnl TIFF_LIB="$TIFF_LIB $GD_XTRA_LIBS" AC_SUBST(TIFF_ENABLED,$TIFF_ENABLED) AC_SUBST(TIFF_INC, $TIFF_INC) AC_SUBST(TIFF_LIB, $TIFF_LIB) ALL_ENABLED="$TIFF_ENABLED $ALL_ENABLED" ALL_INC="$TIFF_INC $ALL_INC" ALL_LIB="$TIFF_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl EPPL7 support (included by default) dnl --------------------------------------------------------------------- AC_CHECKING(whether we should include EPPL7 support...) AC_ARG_WITH(eppl, [ --without-eppl Disable EPPL7 support. --with-eppl Include EPPL7 support.],,) if test "$with_eppl" = "no" ; then AC_MSG_RESULT([ disabled by --without-eppl]) else EPPL_OBJ="epplib.o" EPPL_ENABLED="-DUSE_EPPL" AC_MSG_RESULT([ including EPPL7 support.]) fi AC_SUBST(EPPL_ENABLED,$EPPL_ENABLED) AC_SUBST(EPPL_OBJ, $EPPL_OBJ) ALL_ENABLED="$EPPL_ENABLED $ALL_ENABLED" dnl --------------------------------------------------------------------- dnl Find PROJ.4 ONLY IF REQUESTED. dnl --------------------------------------------------------------------- unset ac_cv_lib_proj_pj_init unset ac_cv_lib_proj_pj_transform unset ac_cv_lib_proj_pj_latlong_from_proj AC_CHECKING(whether we should include PROJ.4 support...) AC_ARG_WITH(proj, [ --with-proj[=DIR] Include PROJ.4 support (DIR is PROJ.4's install dir).],,) if test "$with_proj" = "yes" ; then AC_CHECK_LIB(proj,pj_init,PROJ_ENABLED=-DUSE_PROJ,,,) AC_CHECK_LIB(proj,pj_transform,PJ_TRANSFORM=yes,PJ_TRANSFORM=no,,) AC_CHECK_LIB(proj,pj_latlong_from_proj,PROJ_API=yes,PROJ_API=no,,) if test -n "$PROJ_ENABLED" -a "$PJ_TRANSFORM" = "no"; then AC_MSG_ERROR([This version of PROJ is too old. PROJ4.4.2 or later is required.]) elif test -n "$PROJ_ENABLED" -a "$PJ_TRANSFORM" = "yes"; then PROJ_LIB="-lproj" AC_MSG_RESULT([ using PROJ.4 from system libs.]) else AC_MSG_WARN([ PROJ.4 not found in system libs... use --with-proj=DIR.]) fi elif test -n "$with_proj" -a "$with_proj" != "no" ; then AC_EXPAND_PATH($with_proj, PROJ_DIR) test -f $PROJ_DIR/include/projects.h && PROJ_INCLUDE="$PROJ_DIR/include" test -f $PROJ_DIR/include/proj/projects.h && PROJ_INCLUDE="$PROJ_DIR/include/proj" test -f $PROJ_DIR/src/projects.h && PROJ_INCLUDE="$PROJ_DIR/src" test -f $PROJ_DIR/projects.h && PROJ_INCLUDE="$PROJ_DIR" test -f $PROJ_DIR/src/.libs/libproj.a && PROJ_LIBDIR="$PROJ_DIR/src/.libs" test -f $PROJ_DIR/lib/libproj.a && PROJ_LIBDIR="$PROJ_DIR/lib" test -f $PROJ_DIR/libproj.a && PROJ_LIBDIR="$PROJ_DIR" test -f $PROJ_DIR/src/.libs/libproj.so -o -f $PROJ_DIR/src/.libs/libproj.sl && PROJ_LIBDIR="$PROJ_DIR/src/.libs" test -f $PROJ_DIR/lib/libproj.so -o -f $PROJ_DIR/lib/libproj.sl && PROJ_LIBDIR="$PROJ_DIR/lib" test -f $PROJ_DIR/libproj.so -o -f $PROJ_DIR/libproj.sl && PROJ_LIBDIR="$PROJ_DIR" if test -n "$PROJ_INCLUDE" -a -n "$PROJ_LIBDIR" ; then PROJ_INC=-I$PROJ_INCLUDE PROJ_LIB="-L$PROJ_LIBDIR -lproj" AC_ADD_RUNPATH("$PROJ_LIBDIR") else AC_MSG_ERROR("Could not find projects.h or libproj.a/libproj.so in $PROJ_DIR.") fi AC_CHECK_LIB(proj,pj_transform,PJ_TRANSFORM=yes,PJ_TRANSFORM=no,$PROJ_LIB) AC_CHECK_LIB(proj,pj_latlong_from_proj,PROJ_API=yes,PROJ_API=no,$PROJ_LIB) if test "$PJ_TRANSFORM" = "no"; then AC_MSG_ERROR([This version of PROJ is too old. PROJ4.4.2 or later is required.]) fi PROJ_ENABLED=-DUSE_PROJ AC_MSG_RESULT([ using PROJ.4 from $PROJ_DIR.]) else AC_MSG_RESULT([ PROJ.4 support not requested.]) fi if test "x$PROJ_API" = "xyes" ; then PROJ_ENABLED="$PROJ_ENABLED -DUSE_PROJ_API_H" fi AC_SUBST(PROJ_ENABLED,$PROJ_ENABLED) AC_SUBST(PROJ_INC, $PROJ_INC) AC_SUBST(PROJ_LIB, $PROJ_LIB) ALL_ENABLED="$PROJ_ENABLED $ALL_ENABLED" ALL_INC="$PROJ_INC $ALL_INC" ALL_LIB="$PROJ_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl ENABLE THREADS ONLY IF REQUESTED. dnl --------------------------------------------------------------------- THREAD_LIB="" THREAD_FLAG="" AC_CHECKING(whether we should include thread safe support...) AC_ARG_WITH(threads, [ --with-threads[=linkopt]Include thread safe support],,) if test "$with_threads" = "yes" ; then AC_CHECK_LIB(pthread,pthread_create,THREAD_FLAG=-DUSE_THREAD,,,) if test -n "$THREAD_FLAG" ; then THREAD_LIB="-lpthread" AC_MSG_RESULT([ using -lpthread from system libs.]) else AC_MSG_ERROR([ -lpthread not found, use --with-thread=]) fi elif test -n "$with_threads" -a "$with_threads" != "no" ; then THREAD_FLAG=-DUSE_THREAD THREAD_LIB="$with_threads" AC_MSG_RESULT([ using threads with link options "$THREAD_LIB".]) else AC_MSG_RESULT([ thread safe support disabled.]) fi AC_SUBST(THREAD_FLAG,$THREAD_FLAG) AC_SUBST(THREAD_LIB,$THREAD_LIB) ALL_ENABLED="$THREAD_FLAG $ALL_ENABLED" ALL_LIB="$THREAD_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl Find ESRI SDE ONLY IF REQUESTED. dnl --------------------------------------------------------------------- AC_CHECKING(whether we should include ESRI SDE support...) AC_ARG_WITH(sde, [ --with-sde[=DIR] Include ESRI SDE support (DIR is SDE's install dir).],,) AC_ARG_WITH(sde-version, [ --with-sde-version[=VERSION NUMBER] Set ESRI SDE verion number (Default is 80).],SDE_VERSION=$with_sde_version,SDE_VERSION=80) if test "$with_sde" = "yes" ; then AC_CHECK_LIB(sde$SDE_VERSION,SE_connection_create,SDE_ENABLED=-DUSE_SDE,,,) if test -n "$SDE_ENABLED" ; then SDE_LIB="-lsde$SDE_VERSION -lpe$SDE_VERSION -lsg$SDE_VERSION" AC_CHECK_LIB(pthread, main, SDE_LIB="$SDE_LIB -lpthread",,) AC_CHECK_LIB(socket, main, SDE_LIB="$SDE_LIB -lsocket",,) AC_CHECK_LIB(dl, main, SDE_LIB="$SDE_LIB -ldl",,) AC_MSG_RESULT([ using ESRI SDE from system libs.]) else AC_MSG_WARN([ ESRI SDE not found in system libs... use --with-sde=DIR.]) fi elif test -n "$with_sde" -a "$with_sde" != "no" ; then AC_EXPAND_PATH($with_sde, SDE_DIR) test -f $SDE_DIR/arcsde/coverages/include/sdetype.h && SDE_INCDIR="$SDE_DIR/arcsde/coverages/include" test -f $SDE_DIR/include/sdetype.h && SDE_INCDIR="$SDE_DIR/include" test -f $SDE_DIR/sdetype.h && SDE_INCDIR="$SDE_DIR" test -f $SDE_DIR/lib/libsde$SDE_VERSION.a && SDE_LIBDIR="$SDE_DIR/lib" test -f $SDE_DIR/libsde$SDE_VERSION.a && SDE_LIBDIR="$SDE_DIR" test -f $SDE_DIR/lib/libsde$SDE_VERSION.so -o -f $SDE_DIR/lib/libsde$SDE_VERSION.sl && SDE_LIBDIR="$SDE_DIR/lib" test -f $SDE_DIR/libsde$SDE_VERSION.so -o -f $SDE_DIR/libsde$SDE_VERSION.sl && SDE_LIBDIR="$SDE_DIR" if test -n "$SDE_INCDIR" -a -n "$SDE_LIBDIR" ; then SDE_INC=-I$SDE_INCDIR SDE_LIB="-L$SDE_LIBDIR -lsde$SDE_VERSION -lpe$SDE_VERSION -lsg$SDE_VERSION" AC_CHECK_LIB(pthread, main, SDE_LIB="$SDE_LIB -lpthread",,) AC_CHECK_LIB(socket, main, SDE_LIB="$SDE_LIB -lsocket",,) AC_CHECK_LIB(dl, main, SDE_LIB="$SDE_LIB -ldl",,) AC_ADD_RUNPATH("$SDE_LIBDIR") else AC_MSG_ERROR("Could not find sdetype.h or libsde$SDE_VERSION.a/libsde$SDE_VERSION.so in $SDE_DIR.") fi SDE_ENABLED=-DUSE_SDE AC_MSG_RESULT([ using ESRI SDE from $SDE_DIR.]) else AC_MSG_RESULT([ ESRI SDE support not requested.]) fi AC_SUBST(SDE_ENABLED,$SDE_ENABLED) AC_SUBST(SDE_INC, $SDE_INC) AC_SUBST(SDE_LIB, $SDE_LIB) ALL_ENABLED="$SDE_ENABLED $ALL_ENABLED" ALL_INC="$SDE_INC $ALL_INC" ALL_LIB="$SDE_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl Use MPATROL ONLY IF REQUESTED. dnl --------------------------------------------------------------------- AC_CHECKING(whether we should compile in MPATROL support...) AC_ARG_WITH(mpatrol,[ --with-mpatrol[=DIR] Include MPATROL support (DIR is MPATROL's install dir).],,) if test "$with_mpatrol" = "yes" ; then AC_CHECK_LIB(mpatrol,__mp_free,MPATROL_ENABLED=-DUSE_MPATROL,,,) if test -n "$MPATROL_ENABLED" ; then MPATROL_LIB="-lbfd -liberty -lmpatrol" AC_MSG_RESULT([ using MPATROL from system libs.]) else AC_MSG_WARN([ MPATROL not found in system libs... use --with-mpatrol=DIR.]) fi elif test -n "$with_mpatrol" -a "$with_patrol" != "no" ; then AC_EXPAND_PATH($with_mpatrol, MPATROL_DIR) test -f $MPATROL_DIR/mpatrol.h && MPATROL_INCDIR="$MPATROL_DIR" test -f $MPATROL_DIR/include/mpatrol.h && MPATROL_INCDIR="$MPATROL_DIR/include" test -f $MPATROL_DIR/libmpatrol.a && MPATROL_LIBDIR="$MPATROL_DIR" test -f $MPATROL_DIR/lib/libmpatrol.a && MPATROL_LIBDIR="$MPATROL_DIR/lib" test -f $MPATROL_DIR/libmpatrol.so -o -f $MPATROL_DIR/libmpatrol.sl && MPATROL_LIBDIR="$MPATROL_DIR" test -f $MPATROL_DIR/lib/libmpatrol.so -o -f $MPATROL_DIR/lib/libmpatrol.sl && MPATROL_LIBDIR="$MPATROL_DIR/lib" if test -n "$MPATROL_INCDIR" -a -n "$MPATROL_LIBDIR" ; then MPATROL_INC=-I$MPATROL_INCDIR MPATROL_LIB="-L$MPATROL_LIBDIR -lbfd -liberty -lmpatrol" AC_ADD_RUNPATH("$MPATROL_LIBDIR") else AC_MSG_ERROR("Could not find mpatrol.h or libmpatrol.a/libmpatrol.so in $MPATROL_DIR.") fi MPATROL_ENABLED=-DUSE_MPATROL AC_MSG_RESULT([ using MPATROL from $MPATROL_DIR.]) else AC_MSG_RESULT([ MPATROL support not requested.]) fi AC_SUBST(MPATROL_ENABLED,$MPATROL_ENABLED) AC_SUBST(MPATROL_INC, $MPATROL_INC) AC_SUBST(MPATROL_LIB, $MPATROL_LIB) ALL_ENABLED="$MPATROL_ENABLED $ALL_ENABLED" ALL_INC="$MPATROL_INC $ALL_INC" ALL_LIB="$MPATROL_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl Find OGR ONLY IF REQUESTED. dnl --------------------------------------------------------------------- AC_CHECKING(whether we should include OGR support...) AC_ARG_WITH(ogr, [ --with-ogr[=DIR] Include OGR support (DIR is OGR's install dir).],,) if test "`basename xx/$with_ogr`" = "gdal-config" ; then GDAL_CONFIG="$with_ogr" fi if test "$with_ogr" = "yes" ; then AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) if test "$GDAL_CONFIG" = "no" ; then AC_MSG_ERROR([couldn't find gdal-config]) fi fi if test -n "$GDAL_CONFIG" ; then saved_LIBS="$LIBS" LIBS="$LIBS `$GDAL_CONFIG --libs`" AC_CHECK_LIB(gdal.1.1, OGRRegisterAll, OGR_ENABLED=-DUSE_OGR,,,) LIBS="$saved_LIBS" HAVE_GDAL_LIB=yes if test -n "$OGR_ENABLED" ; then OGR_LIB="`$GDAL_CONFIG --libs`" OGR_INC="`$GDAL_CONFIG --cflags`" AC_MSG_RESULT([ using OGR from system libs.]) else AC_MSG_WARN([ OGR not found in system libs... use --with-ogr=DIR.]) fi elif test -n "$with_ogr" -a "$with_ogr" != "no" ; then AC_EXPAND_PATH($with_ogr, OGR_DIR) dnl check in case we were pointed to GDAL parent dir test -f $OGR_DIR/ogr/ogr_feature.h && OGR_DIR="$OGR_DIR/ogr" dnl check for headers test -f $OGR_DIR/ogr_feature.h && OGR_INCDIR="$OGR_DIR" test -f $OGR_DIR/ogrsf_frmts/ogrsf_frmts.h && OGR_FRMTSDIR="$OGR_DIR/ogrsf_frmts" test -f $OGR_DIR/../port/cpl_conv.h && OGR_CPLDIR="$OGR_DIR/../port" test -f $OGR_DIR/port/cpl_conv.h && OGR_CPLDIR="$OGR_DIR/port" dnl check for static OGR libs test -f $OGR_DIR/ogr.a && OGR_OGRLIB="$OGR_DIR/ogr.a" test -f $OGR_DIR/ogrsf_frmts/ogrsf_frmts.a && OGR_FRMTSLIB="$OGR_DIR/ogrsf_frmts/ogrsf_frmts.a" test -f $OGR_DIR/../port/cpl.a && OGR_CPLLIB="$OGR_DIR/../port/cpl.a" test -f $OGR_DIR/port/cpl.a && OGR_CPLLIB="$OGR_DIR/port/cpl.a" if test -n "$OGR_INCDIR" -a -n "$OGR_FRMTSDIR" -a -n "$OGR_CPLDIR" -a \ -n "$OGR_OGRLIB" -a -n "$OGR_FRMTSLIB" -a -n "$OGR_CPLLIB" ; then OGR_INC="-I$OGR_FRMTSDIR -I$OGR_INCDIR -I$OGR_CPLDIR" OGR_LIB="" OGR_STATIC="$OGR_FRMTSLIB $OGR_OGRLIB $OGR_CPLLIB" dnl check for OGDI if test -n "$TOPDIR" -a -n "$TARGET" ; then OGDI_LIBDIR="$TOPDIR/bin/$TARGET" OGR_LIB="$OGR_LIB -L$TOPDIR/bin/$TARGET -logdi -lzlib -ldl" AC_ADD_RUNPATH("$OGDI_LIBDIR") fi else AC_MSG_ERROR([ !!! Could not find ogr_feature.h, ogrsf_fmrts.h, cpl_conv.h, !!! !!! ogr.a, ogrsf_frmts.a, or cpl.a in $OGR_DIR . !!! Either this is not the location of a recent GDAL/OGR source tree, !!! !!! or OGR has not been compiled yet. Please make sure you compile !!! !!! OGR before calling configure. !!!]) fi OGR_ENABLED=-DUSE_OGR AC_MSG_RESULT([ using OGR from $OGR_DIR.]) else AC_MSG_RESULT([ OGR support not requested.]) fi AC_SUBST(OGR_ENABLED,$OGR_ENABLED) AC_SUBST(OGR_INC, $OGR_INC) AC_SUBST(OGR_LIB, $OGR_LIB) AC_SUBST(OGR_STATIC, $OGR_STATIC) ALL_ENABLED="$OGR_ENABLED $ALL_ENABLED" ALL_INC="$OGR_INC $ALL_INC" ALL_LIB="$OGR_LIB $ALL_LIB" ALL_STATIC_LIB="$OGR_STATIC $ALL_STATIC_LIB" dnl --------------------------------------------------------------------- dnl Find GDAL only if requested (and not supplied by OGR) dnl --------------------------------------------------------------------- AC_MSG_CHECKING(if GDAL support requested) AC_ARG_WITH(gdal, [ --with-gdal[=PATH] Include GDAL support (PATH is path to gdal-config],,) if test "$with_gdal" = "yes" ; then AC_MSG_RESULT([yes]) if test -z "$GDAL_CONFIG" ; then AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) fi if test "$GDAL_CONFIG" = "no" ; then AC_MSG_ERROR([couldn't find gdal-config]) fi elif test -n "$with_gdal" -a "$with_gdal" != "no" ; then GDAL_CONFIG=$with_gdal if test -f "$GDAL_CONFIG" -a -x "$GDAL_CONFIG" ; then AC_MSG_RESULT([yes, user supplied gdal-config ($GDAL_CONFIG)]) else AC_MSG_ERROR(['$GDAL_CONFIG' is not an executable. Make sure you use --with-gdal=/path/to/gdal-config]) fi else AC_MSG_RESULT([no]) fi if test -n "$GDAL_CONFIG" ; then if test "$HAVE_GDAL_LIB" != "yes" ; then GDAL_LIB=`$GDAL_CONFIG --libs` fi GDAL_INC=`$GDAL_CONFIG --cflags` GDAL_ENABLED=-DUSE_GDAL fi AC_SUBST(GDAL_ENABLED,$GDAL_ENABLED) AC_SUBST(GDAL_INC, $GDAL_INC) AC_SUBST(GDAL_LIB, $GDAL_LIB) ALL_ENABLED="$GDAL_ENABLED $ALL_ENABLED" ALL_INC="$GDAL_INC $ALL_INC" ALL_LIB="$GDAL_LIB $ALL_LIB" dnl --------------------------------------------------------------------------- dnl Try to find PostgreSQL if PostGIS support requested. dnl --------------------------------------------------------------------------- AC_MSG_CHECKING(if PostGIS support requested) AC_ARG_WITH(postgis,[ --with-postgis[=ARG] Include PostGIS Support (ARG=yes/path to pg_config)],,) if test "$with_postgis" = "no" -o "$with_postgis" = "" ; then AC_MSG_RESULT(no) PG_CONFIG="no" elif test "$with_postgis" = "yes" ; then AC_MSG_RESULT(yes) AC_PATH_PROG(PG_CONFIG, pg_config, no) else PG_CONFIG=$with_postgis fi if test "$PG_CONFIG" = "no" ; then POSTGIS_ENABLED= POSTGIS_INC= POSTGIS_LIB= else AC_MSG_RESULT([yes, user supplied pg_config]) POSTGIS_ENABLED=-DUSE_POSTGIS POSTGIS_LIB="-L`$PG_CONFIG --libdir` -lpq" POSTGIS_INC="-I`$PG_CONFIG --includedir`" fi AC_SUBST(POSTGIS_ENABLED,$POSTGIS_ENABLED) AC_SUBST(POSTGIS_INC,$POSTGIS_INC) AC_SUBST(POSTGIS_LIB,$POSTGIS_LIB) ALL_ENABLED="$POSTGIS_ENABLED $ALL_ENABLED" ALL_INC="$POSTGIS_INC $ALL_INC" ALL_LIB="$POSTGIS_LIB $ALL_LIB" dnl --------------------------------------------------------------------------- dnl Try to find out if OracleSpatial support requested. dnl --------------------------------------------------------------------------- AC_MSG_CHECKING(if OracleSpatial support requested) AC_ARG_WITH(oraclespatial, [ --with-oraclespatial[=ARG] Include OracleSpatial Support (ARG=yes/path to Oracle home)],,) if test "$with_oraclespatial" = "no" -o "$with_oraclespatial" = ""; then AC_MSG_RESULT([no]) ORA_HOME="no" elif test "$with_oraclespatial" = "yes"; then if test -d "$ORACLE_HOME"; then AC_MSG_RESULT([yes, set from ORACLE_HOME environment variable]) ORA_HOME="$ORACLE_HOME" else ORA_HOME="no" AC_MSG_ERROR([ORACLE_HOME variable is not properly set]) fi else AC_MSG_RESULT([yes, user supplied ORACLE_HOME]) ORA_HOME=$with_oraclespatial fi if test "$ORA_HOME" = "no" ; then ORACLESPATIAL_ENABLED= ORACLESPATIAL_INC= ORACLESPATIAL_LIB= else ORACLESPATIAL_ENABLED=-DUSE_ORACLESPATIAL ORACLESPATIAL_LIB="-L$ORA_HOME/lib -lclntsh" ORACLESPATIAL_INC="-I$ORA_HOME/rdbms/demo -I$ORA_HOME/rdbms/public" fi AC_SUBST(ORACLESPATIAL_ENABLED,$ORACLESPATIAL_ENABLED) AC_SUBST(ORACLESPATIAL_INC,$ORACLESPATIAL_INC) AC_SUBST(ORACLESPATIAL_LIB,$ORACLESPATIAL_LIB) dnl --------------------------------------------------------------------- dnl WMS Compatibility - Enabled by default if PROJ.4 is there. dnl Can be explicitly disabled using --without-wms dnl --------------------------------------------------------------------- AC_CHECKING(whether we should include WMS support...) AC_ARG_WITH(wms, [ --without-wms Disable OGC WMS Compatibility (enabled by default).],,) if test "$with_wms" = "no" ; then AC_MSG_RESULT([ OGC WMS Compatibility disabled by --without-wms.]) elif test -z "$PROJ_ENABLED" ; then AC_MSG_RESULT([ OGC WMS Compatibility not enabled (PROJ.4 is required for WMS).]) else WMS_ENABLED="-DUSE_WMS" AC_MSG_RESULT([ OGC WMS compatibility enabled ($WMS_ENABLED).]) fi AC_SUBST(WMS_ENABLED,$WMS_ENABLED) ALL_ENABLED="$WMS_ENABLED $ALL_ENABLED" dnl --------------------------------------------------------------------- dnl WMS Client support - Enabled by default if PROJ.4 and libwww are there. dnl Can be explicitly disabled using --without-wmsclient dnl --------------------------------------------------------------------- AC_CHECKING(whether we should include WMS Client Connections support...) AC_ARG_WITH(wms, [ --with-wmsclient Enable OGC WMS Client Connections (PROJ4 and libwww required).],,) if test "$with_wmsclient" = "no" ; then AC_MSG_RESULT([ OGC WMS Client Layers disabled by --without-wmsclient.]) elif test -z "$PROJ_ENABLED" ; then AC_MSG_RESULT([ OGC WMS Client Connections not enabled (PROJ.4 and libwww required).]) elif test "$with_wmsclient" = "yes" ; then AC_PATH_PROG(LIBWWW_CONFIG, libwww-config, no) if test "$LIBWWW_CONFIG" = "no" ; then AC_MSG_ERROR([couldn't find libwww-config]) fi WWW_VER=`$LIBWWW_CONFIG --version` AC_MSG_RESULT([ found libwww version $WWW_VER]) dnl Need libwww 5.3.2 or more because of an infinite loop in older versions dnl __TODO__ How can we do a '-lt' (lower than) test on strings??? if test -z "$WWW_VER" -o `expr "$WWW_VER" \< "5.3.2"` = 1; then AC_MSG_ERROR([libwww version 5.3.2 or more recent is required.]) fi WMS_LYR_ENABLED="-DUSE_WMS_LYR" WWW_INC=`$LIBWWW_CONFIG --cflags` WWW_LIB=`$LIBWWW_CONFIG --libs` AC_MSG_RESULT([ OGC WMS Client Connections enabled ($WMS_LYR_ENABLED).]) dnl dnl Check for possible conflict if libwww is used on a system with dnl rxposix installed. See MapServer bug#82 dnl AC_CHECKING(for potential conflict between system regex and rxposix...) AC_CHECK_LIB(rx, regexec, RXPOSIX=yes,,,) AC_ARG_ENABLE(rxposix-conflict-error, [ --disable-rxposix-conflict-error Do not produce any configure error about potential regex vs rxposix conflicts. See MapServer bug 82],,) if test "$RXPOSIX" = "yes" -a "$enable_rxposix_conflict_error" != "no" ; then AC_MSG_ERROR([ !!! Your system seems to have the 'rxposix' regex library installed !!! !!! which could cause conflicts with the system regex if it gets !!! !!! picked by libwww. !!! !!! See MapServer bug#82 for more details and possible solutions at !!! !!! http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=82 !!! !!! !!! !!! If you have dealt with this problem already then you may use !!! !!! --disable-rxposix-conflict-error to disable this error !!! |!! message and let configure complete without error. !!!]) fi fi AC_SUBST(WMS_LYR_ENABLED,$WMS_LYR_ENABLED) AC_SUBST(WWW_INC, $WWW_INC) AC_SUBST(WWW_LIB, $WWW_LIB) ALL_ENABLED="$WMS_LYR_ENABLED $ALL_ENABLED" ALL_INC="$WWW_INC $ALL_INC" ALL_LIB="$WWW_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl Define some vars for the mapserver library itself for modules that dnl link with it. dnl --------------------------------------------------------------------- MS_DIR="`pwd`" MS_INC="-I$MS_DIR" MS_LIB="-L$MS_DIR -lmap" AC_ADD_RUNPATH("$MS_DIR") AC_SUBST(MS_INC, $MS_INC) AC_SUBST(MS_LIB, $MS_LIB) dnl --------------------------------------------------------------------- dnl Check IGNORE_MISSING_DATA option (ON by default) dnl --------------------------------------------------------------------- AC_ARG_ENABLE(ignore-missing-data, [ --enable-ignore-missing-data Ignore missing data file errors at runtime (enabled by default). --disable-ignore-missing-data Report all missing data files.],,) if test "$enable_ignore_missing_data" != "no" ; then IGNORE_MISSING_DATA="-DIGNORE_MISSING_DATA" AC_MSG_RESULT([Compiling with -DIGNORE_MISSING_DATA.]) fi AC_SUBST(IGNORE_MISSING_DATA, $IGNORE_MISSING_DATA) dnl --------------------------------------------------------------------- dnl Check --enable-debug option for "-g" compile flag. (OFF by default) dnl --------------------------------------------------------------------- AC_CHECKING(whether we should enable debug features...) AC_ARG_ENABLE(debug, [ --enable-debug Include "-g" in CFLAGS for debugging and enable msDebug() output to stderr (i.e. server log file). --disable-debug Do not include "-g" in CFLAGS and disable msDebug() output (the default).],,) if test "$enable_debug" = "yes" ; then AC_COMPILER_WFLAGS_DEBUG dnl also enable output of msDebug() calls to stderr. DEBUG_FLAGS="-DENABLE_STDERR_DEBUG" AC_MSG_RESULT([ Enabling debug features: -g in CFLAGS and msDebug() to stderr.]) else AC_COMPILER_WFLAGS fi AC_SUBST(DEBUG_FLAGS, $DEBUG_FLAGS) ALL_ENABLED="$DEBUG_FLAGS $ALL_ENABLED" dnl --------------------------------------------------------------------- dnl PHP/MapScript module options dnl --------------------------------------------------------------------- AC_CHECKING(for PHP/MapScript module options...) AC_ARG_WITH(php, [ --with-php=DIR Specify directory where PHP4 source tree is installed. Required in order to compile the PHP/MapScript module.],,) AC_ARG_ENABLE(internal-ld-detect, [ --enable-internal-ld-detect (applies to --with-php only) Use internal configure macro to figure the command to use to link php_mapscript.so instead of using perl -V which is the default and may not work well on some systems such as FreeBSD.],,) if test -n "$with_php" -a -d "$with_php" ; then AC_EXPAND_PATH($with_php, PHP_SRC_DIR) dnl dnl Checks for shared library linking. dnl dnl Try to use the perl-based macro if perl is available... dnl Unless internal detection explicitly requested... dnl if test "$enable_internal_ld_detect" = "yes" ; then AC_MSG_RESULT(Using internal macro to figure ld command to link php_mapscript.so) AC_COMPILER_PIC AC_LD_SHARED PHP_CC="$CC $C_PIC" PHP_LD="$LD_SHARED" else dnl if test -n "`which perl`" ; then AC_MSG_CHECKING([whether 'perl -V' works]) if (perl -V > /dev/null 2>&1) ; then AC_MSG_RESULT(yes) AC_LD_SHARED_FROM_PERL PHP_CC="$PERL_CC" PHP_LD="$PERL_LD" else AC_MSG_RESULT(no) AC_COMPILER_PIC AC_LD_SHARED PHP_CC="$CC $C_PIC" PHP_LD="$LD_SHARED" fi fi dnl dnl Look for PHP3's config.h or PHP4's php_config.h. dnl We'll need the config file to find info about the PHP configuration dnl AC_MSG_CHECKING([for location of config.h or php_config.h]) dnl In PHP3, it was called config.h test -f "$PHP_SRC_DIR/config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/config.h" dnl In PHP 4.0.1 to 4.0.3, it was php-4.0.x/php_config.h test -f "$PHP_SRC_DIR/php_config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/php_config.h" dnl Starting with PHP 4.0.4, it's php-4.0.x/main/php_config.h test -f "$PHP_SRC_DIR/main/php_config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h" if test -n "$PHP_CONFIG_H" ; then AC_MSG_RESULT([$PHP_CONFIG_H]) else AC_MSG_ERROR([ !!! Could not find config.h or php_config.h in $PHP_SRC_DIR. !!! !!! Has PHP been configured yet? !!!]) fi dnl dnl Check which PHP version we're using. dnl Default is PHP3, and if ZEND_API is set then we assume that we have PHP4. dnl AC_MSG_CHECKING([whether we have PHP3 or PHP4]) if test -n "`grep 'ZEND_API' $PHP_CONFIG_H`" ; then PHP_VERSION_FLAG="-DPHP4" else PHP_VERSION_FLAG="-DPHP3" AC_MSG_ERROR([ !!! PHP MapScript now requires PHP 4.1.2 or more recent. !!! !!! Support for PHP3 has been dropped after MapServer version 3.5. !!!]) fi AC_MSG_RESULT([$PHP_VERSION_FLAG]) dnl dnl Check if PHP was compiled with the bundled regex, and if so then dnl use the same version to compile MapServer. dnl AC_MSG_CHECKING([whether we should use PHP's regex]) if test -n "`grep 'define REGEX 1' $PHP_CONFIG_H`" ; then AC_MSG_RESULT(yes) dnl __TODO__ dnl This is a temporary error messgae until we figure the problem with dnl PHP4's regex dnl if test "$PHP_VERSION_FLAG" = "-DPHP4" ; then AC_MSG_ERROR([ !!! The current version of PHP MapScript has some problems with !!! !!! PHP4's bundled regex. Until we figure the solution to the !!! !!! problem, the workaround is to compile PHP4 with the system regex !!! !!! Please re-configure and re-compile PHP4 with --with-regex=system !!! !!! and then re-configure and re-compile MapServer. !!!]) fi PHP_REGEX_DIR="$PHP_SRC_DIR/regex" PHP_REGEX_INC="-I$PHP_REGEX_DIR" PHP_REGEX_OBJ="$PHP_REGEX_DIR/regcomp.o $PHP_REGEX_DIR/regerror.o \ $PHP_REGEX_DIR/regexec.o $PHP_REGEX_DIR/regfree.o" ALL_INC="$PHP_REGEX_INC $ALL_INC" else AC_MSG_RESULT(no) fi PHPMS_MAKEFILE=mapscript/php3/Makefile MAKE_PHPMS=php3_mapscript MAKE_PHPMS_CLEAN=php3_mapscript_clean AC_SUBST(PHP_VERSION_FLAG, $PHP_VERSION_FLAG) AC_SUBST(PHP_SRC_DIR, $PHP_SRC_DIR) AC_SUBST(PHP_CC, $PHP_CC) AC_SUBST(PHP_LD, $PHP_LD) AC_SUBST(PHP_REGEX_INC, $PHP_REGEX_INC) AC_SUBST(PHP_REGEX_OBJ, $PHP_REGEX_OBJ) AC_MSG_RESULT([ PHP/MapScript module configured.]) elif test -n "$with_php" -a "$with_php" != "no" ; then AC_MSG_ERROR([Missing or invalid PHP source directory in --with-php=DIR.]) else AC_MSG_RESULT([ PHP/MapScript module not configured.]) fi AC_SUBST(MAKE_PHPMS, $MAKE_PHPMS) AC_SUBST(MAKE_PHPMS_CLEAN, $MAKE_PHPMS_CLEAN) dnl --------------------------------------------------------------------- dnl 'apxs' option for PHP built as an Apache module (libphp3.so) dnl --with-apxs[=FILE] should be the exact same value that was passed dnl to the PHP configure command. dnl dnl All we need is to add the Apache include files to the php module dnl include path. dnl dnl The APXS variable also affects the way AC_ADD_RUNPATH() works dnl --------------------------------------------------------------------- AC_ARG_WITH(apxs, [ --with-apxs[=FILE] (CURRENTLY DISABLED) Use this option only if building the PHP MapScript on a system where PHP was built as a shared Apache module. FILE is the optional pathname to the Apache apxs tool; defaults to apxs.],,) if test -n "$with_apxs" -a "$with_apxs" != "no" ; then AC_MSG_ERROR([ !!! The current version of PHP MapScript requires PHP4 configured as !!! !!! a CGI and cannot be used with PHP4 configured as an Apache module,!!! !!! so you cannot use the --with-apxs option. !!! !!! See: http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI !!!]) AC_MSG_CHECKING([for location of Apache headers using apxs]) if test -z "$MAKE_PHPMS" ; then AC_MSG_ERROR([--with-apxs applies only if --with-php is used.]) elif test "$with_apxs" = "yes" ; then APXS=apxs else APXS="$with_apxs" fi APACHE_INC=-I`$APXS -q INCLUDEDIR` AC_MSG_RESULT($APACHE_INC) dnl APACHE_INC substitution is done after --with-apache switch processing dnl below. fi dnl --------------------------------------------------------------------- dnl '--with-apache' option for PHP built as an Apache module and statically dnl linked into the httpd executable. This option is used to specify the dnl location of the apache include files. dnl --------------------------------------------------------------------- AC_ARG_WITH(apache, [ --with-apache=DIR (CURRENTLY DISABLED) Use this option only if building the PHP MapScript on a system where PHP was built as an Apache module statically linked into the httpd executable. DIR is the path to the apache include files.],,) if test -n "$with_apache" -a "$with_apache" != "no" ; then AC_MSG_ERROR([ !!! The current version of PHP MapScript requires PHP4 configured as !!! !!! a CGI and cannot be used with PHP4 configured as an Apache module,!!! !!! so you cannot use the --with-apache option. !!! !!! See: http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI !!!]) AC_MSG_CHECKING([for location of Apache headers]) if test -z "$MAKE_PHPMS" ; then AC_MSG_ERROR([--with-apache applies only if --with-php is used.]) fi AC_EXPAND_PATH($with_apache, APACHE_DIR) test -f $APACHE_DIR/httpd.h && APACHE_INC_DIR="$APACHE_DIR" test -f $APACHE_DIR/include/httpd.h && APACHE_INC_DIR="$APACHE_DIR/include" test -f $APACHE_DIR/src/include/httpd.h && APACHE_INC_DIR="$APACHE_DIR/src/include" if test -n "$APACHE_INC_DIR" ; then APACHE_INC="-I$APACHE_INC_DIR $APACHE_INC" AC_MSG_RESULT("-I$APACHE_INC_DIR") else AC_MSG_ERROR("Could not find httpd.h in $APACHE_DIR.") fi fi AC_SUBST(APACHE_INC, $APACHE_INC) dnl --------------------------------------------------------------------- dnl Check --enable-runpath to request including -Wl,-R for runtime dnl lib path in link command (disabled by default) dnl --------------------------------------------------------------------- AC_ARG_ENABLE(debug, [ --enable-runpath Include runtime library path flags (-Wl,-R) in link. Required on *BSD systems. --disable-runpath Do not link with runtime lib path (the default).],,) if test "$enable_runpath" != "yes" ; then RPATHS="" fi dnl --------------------------------------------------------------------- dnl Generate output files dnl --------------------------------------------------------------------- AC_SUBST(ALL_ENABLED, $ALL_ENABLED) AC_SUBST(ALL_INC, $ALL_INC) AC_SUBST(ALL_LIB, $ALL_LIB) AC_SUBST(ALL_STATIC_LIB, $ALL_STATIC_LIB) AC_SUBST(RPATHS, [$RPATHS]) AC_OUTPUT(Makefile $PHPMS_MAKEFILE)