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_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 Which version of GD are we using? dnl dnl If --with-gd not given, then check in system libs, and if not found dnl there then fall back on local copy of gd-1.2 dnl --------------------------------------------------------------------- dnl Clear some cache variables unset ac_cv_lib_gd_gdImageGif unset ac_cv_lib_gd_gdImageString16 unset ac_cv_lib_gd_gdImageJpeg unset ac_cv_lib_gd_gdImagePng AC_CHECKING(which version of GD to use...) AC_ARG_WITH(gd, [ --with-gd[=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_EXPAND_PATH($with_gd, 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" if test -n "$GD_INCLUDE" -a -n "$GD_LIBDIR" ; then GD_INC=-I$GD_INCLUDE GD_LIB="-L$GD_LIBDIR -lgd" AC_ADD_RUNPATH("$GD_LIBDIR") else AC_MSG_ERROR("Could not find gd.h or libgd.a in $GD_DIR. Make sure gd is compiled before calling configure.") fi AC_CHECK_LIB(gd, gdImageGif, GD_DEF=-DUSE_GD_1_2,, $GD_LIB) AC_CHECK_LIB(gd, gdImageString16, GD_DEF=-DUSE_GD_1_3,, $GD_LIB) AC_CHECK_LIB(gd, gdImagePng, GD_DEF=-DUSE_GD_1_6,, $GD_LIB -lpng -lz) AC_CHECK_LIB(gd, gdImageJpeg, GD_DEF=-DUSE_GD_1_8,, $GD_LIB -ljpeg -lpng -lz) AC_MSG_RESULT([ using GD ($GD_DEF) from $GD_DIR.]) else dnl dnl --width-gd was not given... look in system libs, and if not found dnl then use the local copy of gd 1.2 dnl AC_CHECK_LIB(gd, gdImageGif, GD_DEF=-DUSE_GD_1_2,,) AC_CHECK_LIB(gd, gdImageString16, GD_DEF=-DUSE_GD_1_3,,) AC_CHECK_LIB(gd, gdImagePng, GD_DEF=-DUSE_GD_1_6,, -lpng -lz) AC_CHECK_LIB(gd, gdImageJpeg, GD_DEF=-DUSE_GD_1_8,, -ljpeg -lpng -lz) if test -n "$GD_DEF" ; then GD_LIB="-lgd" AC_MSG_RESULT([ using GD ($GD_DEF) from system libs.]) else dnl GD not found on system... use local copy of gd 1.2 GD_DEF=-DUSE_GD_1_2 MAKE_GD=gd MAKE_GD_CLEAN=gd_clean AC_EXPAND_PATH(gd-1.2, GD_DIR) GD_INC=-I$GD_DIR GD_LIB="-L$GD_DIR -lgd" AC_ADD_RUNPATH("$GD_DIR") test -f $GD_DIR/Makefile.in && GD_MAKEFILE="$GD_DIR/Makefile" AC_MSG_RESULT([ using GD ($GD_DEF) from $GD_DIR.]) fi fi if test "$ac_cv_lib_gd_gdImagePng" = "yes"; then GD_LIB="$GD_LIB -lpng -lz" fi AC_SUBST(GD_DEF, $GD_DEF) AC_SUBST(GD_INC, $GD_INC) AC_SUBST(GD_LIB, $GD_LIB) 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" 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" if test -n "$TIFF_INCLUDE" -a -n "$TIFF_LIBDIR" ; then dnl dnl Found the header and lib file... try to establish if zlib required dnl TMP_LIB="-L$TIFF_LIBDIR -ltiff" AC_CHECK_LIB(tiff,TIFFOpen,TIFF_LIB=$TMP_LIB,,[$TMP_LIB]) if test -z "$TIFF_LIB" ; then AC_CHECKING(whether libtiff works with zlib (-lz)...) unset ac_cv_lib_tiff_TIFFOpen AC_CHECK_LIB(tiff,TIFFOpen,TIFF_LIB="$TMP_LIB -lz", ,[$TMP_LIB -lz]) fi if test -z "$TIFF_LIB" ; then AC_MSG_ERROR("Unable to link against libtiff using $TMP_LIB") fi TIFF_INC=-I$TIFF_INCLUDE AC_ADD_RUNPATH("$TIFF_LIBDIR") else AC_MSG_ERROR("Could not find tiffio.h or libtiff.a in $TIFF_DIR.") fi TIFF_ENABLED="-DUSE_TIFF" AC_MSG_RESULT([ using libtiff ($TIFF_LIB).]) else AC_CHECK_LIB(tiff,TIFFOpen,TIFF_LIB=-ltiff,,) if test -z "$TIFF_LIB" ; then AC_CHECKING(whether libtiff works with zlib (-lz)...) unset ac_cv_lib_tiff_TIFFOpen AC_CHECK_LIB(tiff,TIFFOpen,TIFF_LIB="-ltiff -lz", ,-lz) fi 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 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 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 "$with_jpeg" = "no" ; then AC_MSG_RESULT([ disabled by --without-jpeg]) elif 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" if test -n "$JPEG_INCLUDE" -a -n "$JPEG_LIBDIR" ; then JPEG_INC=-I$JPEG_INCLUDE JPEG_LIB="-L$JPEG_LIBDIR -ljpeg" AC_ADD_RUNPATH("$JPEG_LIBDIR") else AC_MSG_ERROR("Could not find jpeglib.h.h or libjpeg.a in $JPEG_DIR.") fi JPEG_ENABLED="-DUSE_JPEG" AC_MSG_RESULT([ using libjpeg from $JPEG_DIR.]) 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.]) 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 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 FreeType (included by default if found on system). dnl --------------------------------------------------------------------- unset ac_cv_lib_ttf_TT_Init_FreeType AC_CHECKING([whether we should include Freetype (TTF) support...]) AC_ARG_WITH(ttf, [ --without-ttf Disable Freetype (TTF) support. --with-ttf[=DIR] Include Freetype (TTF) support (DIR is Freetype's install dir).],,) if test "$with_ttf" = "no" ; then AC_MSG_RESULT([ disabled by --without-ttf]) elif test -n "$with_ttf" -a "$with_ttf" != "yes" ; then AC_EXPAND_PATH($with_ttf, TTF_DIR) test -f $TTF_DIR/include/freetype/freetype.h && TTF_INCLUDE="$TTF_DIR/include/freetype" test -f $TTF_DIR/include/freetype.h && TTF_INCLUDE="$TTF_DIR/include" test -f $TTF_DIR/lib/freetype.h && TTF_INCLUDE="$TTF_DIR/lib" test -f $TTF_DIR/freetype.h && TTF_INCLUDE="$TTF_DIR" test -f $TTF_DIR/lib/.libs/libttf.a && TTF_LIBDIR="$TTF_DIR/lib/.libs" test -f $TTF_DIR/lib/libttf.a && TTF_LIBDIR="$TTF_DIR/lib" test -f $TTF_DIR/libttf.a && TTF_LIBDIR="$TTF_DIR" test -f $TTF_DIR/lib/.libs/libttf.so && TTF_LIBDIR="$TTF_DIR/lib/.libs" test -f $TTF_DIR/lib/libttf.so && TTF_LIBDIR="$TTF_DIR/lib" test -f $TTF_DIR/libttf.so && TTF_LIBDIR="$TTF_DIR" if test -n "$TTF_INCLUDE" -a -n "$TTF_LIBDIR" ; then TTF_INC=-I$TTF_INCLUDE TTF_LIB="-L$TTF_LIBDIR -lttf" AC_ADD_RUNPATH("$TTF_LIBDIR") else AC_MSG_ERROR("Could not find freetype.h or libttf.so/libttf.a in $TTF_DIR.") fi TTF_ENABLED="-DUSE_TTF" AC_MSG_RESULT([ using ttf from $TTF_DIR.]) else AC_CHECK_LIB(ttf,TT_Init_FreeType, TTF_FOUND_LIB=yes,,,) AC_CHECK_HEADER(freetype.h, TTF_FOUND_HDR=yes,,,) AC_CHECK_LIB(ttf,TT_Init_FreeType, TTF_ENABLED=-DUSE_TTF,,,) if test -n "$TTF_FOUND_LIB" -a -z "$TTF_FOUND_HDR" ; then dnl Found lib, but header may be in a "freetype" sub-dir somewhere... dnl try to find it in some common system locations AC_MSG_CHECKING([for the location of freetype.h]) for dirname in /usr /usr/lib /usr/local /usr/local/lib \ /usr/pkg /pkg/lib do for subdirname in include include/freetype do if test -f "$dirname/$subdirname/freetype.h" ; then TTF_INC="-I$dirname/$subdirname" TTF_FOUND_HDR=yes AC_MSG_RESULT([$dirname/$subdirname/freetype.h]) fi done done if test -z "$TTF_FOUND_HDR" ; then AC_MSG_RESULT([not found]) AC_MSG_RESULT([ found libttf in system libs, but freetype.h was not found...]) fi fi if test -n "$TTF_FOUND_LIB" -a -n "$TTF_FOUND_HDR" ; then TTF_ENABLED=-DUSE_TTF TTF_LIB="-lttf" AC_MSG_RESULT([ using libttf from system libs.]) else AC_MSG_RESULT([ Freetype support not included.]) fi fi if test -n "$TTF_ENABLED" ; then dnl dnl We need to link with the GDFT directory as well dnl AC_EXPAND_PATH(gdft, GDFT_DIR) TTF_LIB="-L$GDFT_DIR -lgdft $TTF_LIB" AC_ADD_RUNPATH("$GDFT_DIR") TTF_INC="-I$GDFT_DIR $TTF_INC" MAKE_GDFT="gdft" MAKE_GDFT_CLEAN="gdft_clean" fi AC_SUBST(TTF_ENABLED, $TTF_ENABLED) AC_SUBST(TTF_INC, $TTF_INC) AC_SUBST(TTF_LIB, $TTF_LIB) AC_SUBST(MAKE_GDFT, $MAKE_GDFT) AC_SUBST(MAKE_GDFT_CLEAN,$MAKE_GDFT_CLEAN) ALL_ENABLED="$TTF_ENABLED $ALL_ENABLED" ALL_INC="$TTF_INC $ALL_INC" ALL_LIB="$TTF_LIB $ALL_LIB" dnl --------------------------------------------------------------------- dnl Find PROJ.4 ONLY IF REQUESTED. dnl --------------------------------------------------------------------- unset ac_cv_lib_proj_pj_init 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,,,) if test -n "$PROJ_ENABLED" ; 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" 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 in $PROJ_DIR.") fi PROJ_ENABLED=-DUSE_PROJ AC_MSG_RESULT([ using PROJ.4 from $PROJ_DIR.]) else AC_MSG_RESULT([ PROJ.4 support not requested.]) 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 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).],,) if test "$with_sde" = "yes" ; then AC_CHECK_LIB(sde80,SE_connection_create,SDE_ENABLED=-DUSE_SDE,,,) if test -n "$SDE_ENABLED" ; then SDE_LIB="-lsde80 -lpe -lsg -lpthread -lsocket" 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/libsde80.a && SDE_LIBDIR="$SDE_DIR/lib" test -f $SDE_DIR/libsde80.a && SDE_LIBDIR="$SDE_DIR" if test -n "$SDE_INCDIR" -a -n "$SDE_LIBDIR" ; then SDE_INC=-I$SDE_INCDIR SDE_LIB="-L$SDE_LIBDIR -lsde80 -lpe80 -lsg80 -lpthread -lsocket" AC_ADD_RUNPATH("$SDE_LIBDIR") else AC_MSG_ERROR("Could not find sdetype.h or libsde80.a 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 && MPATROL_LIBDIR="$MPATROL_DIR" test -f $MPATROL_DIR/lib/libmpatrol.so && 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 "$with_ogr" = "yes" ; then AC_CHECK_LIB(gdal.1.1, OGRRegisterAll, OGR_ENABLED=-DUSE_OGR,,,) if test -n "$OGR_ENABLED" ; then OGR_LIB="-lgdal.1.1 -ljpeg -lpng -ldl -logdi -lzlib" 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_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 one of ogr_feature.h, ogrsf_fmrts.h, cpl_conv.h, ogr.a, ogrsf_frmts.a, or cpl.a in $OGR_DIR.]) 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) ALL_ENABLED="$OGR_ENABLED $ALL_ENABLED" ALL_INC="$OGR_INC $ALL_INC" ALL_LIB="$OGR_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_ARG_ENABLE(debug, [ --enable-debug Include "-g" in CFLAGS for debugging. --disable-debug Do not include "-g" in CFLAGS (the default).],,) if test "$enable_debug" = "yes" ; then AC_COMPILER_WFLAGS_DEBUG else AC_COMPILER_WFLAGS fi dnl --------------------------------------------------------------------- dnl PHP3/MapScript module options dnl --------------------------------------------------------------------- AC_CHECKING(for PHP/MapScript module options...) AC_ARG_WITH(php, [ --with-php=DIR Specify directory where PHP3/PHP4 source tree is installed. Required in order to compile the PHP/MapScript module.],,) 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 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 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" 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-system-regex !!! !!! 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 dnl dnl Because of a conflict with gdttf.c/gdcache.c, we cannot have both dnl PHP and MapScript compiled with TTF support. dnl if test -n "$TTF_ENABLED" -a "$PHP_VERSION_FLAG" = "-DPHP4" ; then AC_MSG_CHECKING([whether PHP4 was compiled with TTF support]) if test -n "`grep 'define HAVE_LIBTTF 1' $PHP_CONFIG_H`" ; then AC_MSG_RESULT(yes) AC_MSG_ERROR([ !!! Cannot have both PHP4 and MapScript compiled with Freetype support. !!! !!! You have to configure either PHP or MapServer using the --without-ttf !!! !!! switch to avoid conflicts at runtime. !!!]) else AC_MSG_RESULT(no) fi 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] 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_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 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_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(RPATHS, [$RPATHS]) AC_OUTPUT(Makefile $GD_MAKEFILE gdft/Makefile $PHPMS_MAKEFILE)