dnl Process this file with autoconf to produce a configure script.
AC_INIT(geotiff.h)
AC_CONFIG_HEADER(geo_config.h)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
VERSION_MAJOR=1
VERSION_MINOR=2
VERSION_POINT=5
AC_SUBST(VERSION_MAJOR,$VERSION_MAJOR)
AC_SUBST(VERSION_MINOR,$VERSION_MINOR)
AC_SUBST(VERSION_POINT,$VERSION_POINT)
dnl Checks for programs.
AC_PROG_CC
AC_COMPILER_WFLAGS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AC_COMPILER_PIC
AC_LD_SHARED
#
# If we have shared library support define that we want to build
# the libgeotiff.so
GEOTIFF_SO=
GEOTIFF_DLL=
GEOTIFF_IMP=
EXEEXT=
if test "$LD_SHARED" != "/bin/true" ; then
case $host in
*-pc-cygwin*) EXEEXT=.exe
GEOTIFF_SO=cyggeotiff-1.dll
GEOTIFF_DLL=cyggeotiff-1.dll
GEOTIFF_IMP=libgeotiff.dll.a
LD_SHARED="gcc -shared -Wl,--export-all -Wl,--out-implib=\$(GEOTIFF_IMP)" ;;
*) GEOTIFF_SO=libgeotiff.${SO_EXT}.$VERSION_MAJOR.$VERSION_MINOR.$VERSION_POINT ;;
esac
fi
AC_SUBST(GEOTIFF_SO,$GEOTIFF_SO)
AC_SUBST(GEOTIFF_IMP,$GEOTIFF_IMP)
AC_SUBST(GEOTIFF_DLL,$GEOTIFF_DLL)
AC_SUBST(EXEEXT,$EXEEXT)
dnl Checks for libraries.
AC_CHECK_LIB(m,exp,,,)
dnl We want to honor the users wishes with regard to linking.
LIBS="$LDFLAGS $LIBS"
dnl We check for headers
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h strings.h stdlib.h)
dnl
dnl Add option to include libz in library list for use of libtiff.
dnl
AC_ARG_WITH(zip, [ --with-zip=dir Use ZIP library in directory dir],[ZIP=$withval],[ZIP=yes])
if test "$ZIP" = "yes" ; then
AC_CHECK_LIB(z,inflateInit_,,,-lm)
AC_CHECK_HEADERS(zlib.h,,)
AC_DEFINE(HAVE_ZIP)
else
if test "$ZIP" != "no" ; then
LIBS="${LIBS} -L${ZIP}/lib -lz"
ZIP_INC="-I${ZIP}/include"
AC_SUBST(ZIP_INC,$ZIP_INC)
AC_DEFINE(HAVE_ZIP)
echo "Using user supplied libzip directory: "$ZIP
fi
fi
dnl
dnl Add option to include libjpeg in library list for use of libtiff.
dnl
AC_ARG_WITH(jpeg, [ --with-jpeg=dir Use JPEG library in directory dir],[JPEG=$withval],[JPEG=yes])
if test "$JPEG" = "yes" ; then
AC_CHECK_LIB(jpeg,jinit_compress_master,,,-lm)
AC_DEFINE(HAVE_JPEG)
else
if test "$JPEG" != "no" ; then
LIBS="${LIBS} -L${JPEG} -ljpeg"
AC_DEFINE(HAVE_JPEG)
echo "Using user supplied libjpeg directory: "$JPEG
fi
fi
dnl
dnl Special logic to try and find a user specified libtiff tree. If not
dnl available check if the system directories have the library, _and_ the
dnl required private include files. Normally these private include files
dnl (tiffiop.h) are not installed with the public interface.
dnl
AC_ARG_WITH(libtiff, [ --with-libtiff=dir Use libtiff in directory dir],,)
if test "$with_libtiff" != "" ; then
if test -f $with_libtiff/include/tiffio.h -a -d $with_libtiff/lib ; then
LIBS="-L$with_libtiff/lib -ltiff $LIBS"
TIFF_INC=-I$with_libtiff/include
else
LIBS="-L$with_libtiff -ltiff $LIBS"
TIFF_INC=-I$with_libtiff
fi
LIBS_SAVED="$LIBS"
AC_CHECK_LIB(tiff,TIFFOpen,,
AC_MSG_ERROR([failed to link with -ltiff to find TIFFOpen]),-lm)
AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,,
AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
libgeotiff. Please upgrade or use an older version of libgeotiff.]),-lm)
LIBS="$LIBS_SAVED"
else
AC_CHECK_LIB(tiff,TIFFOpen,,
AC_MSG_ERROR([You will need to substantially rewrite libxtiff to
build libgeotiff without libtiff]),-lm)
LIBS_SAVED="$LIBS"
AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,,
AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
libgeotiff. Please upgrade libtiff or use an older version of libgeotiff.]),-lm)
LIBS="$LIBS_SAVED"
TIFF_INC=
fi
AC_SUBST(TIFF_INC,$TIFF_INC)
dnl
dnl Try and find libproj.a, and projects.h
dnl
AC_ARG_WITH(proj, [ --with-proj[=ARG] Use PROJ.4 library (ARG=no or path)],[PROJ_HOME=$withval],[PROJ_HOME=])
if test "$PROJ_HOME" != "" -a "$PROJ_HOME" != "no" ; then
if test -d "$PROJ_HOME/src/pj_init.c" ; then
PROJ_HOME=$PROJ_HOME/src
fi
dnl Old PROJ.4 build tree, without automake
if test -f "$PROJ_HOME/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
PROJ_LIB=$PROJ_HOME/libproj.a
PROJ_INC=$PROJ_HOME
dnl New PROJ.4 build tree, with automake
elif test -f "$PROJ_HOME/.libs/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
PROJ_LIB=$PROJ_HOME/.libs/libproj.a
PROJ_INC=$PROJ_HOME
dnl Installed tree in an odd place
elif test \( -f "$PROJ_HOME/lib/libproj.a" -o -f "$PROJ_HOME/lib/libproj.so" \) -a -f "$PROJ_HOME/include/proj_api.h"; then
PROJ_LIB="-L$PROJ_HOME/lib -lproj"
PROJ_INC=$PROJ_HOME/include
else
echo "PROJ_HOME=$PROJ_HOME, but either projects.h or libproj.a not found!"
fi
fi
if test "$PROJ_HOME" = "no" ; then
echo "PROJ.4 support disabled."
elif test "$PROJ_LIB" != "" -a "$PROJ_INC" != "" ; then
echo "Found $PROJ_LIB"
echo "Found $PROJ_INC/projects.h"
LIBS="$PROJ_LIB $LIBS"
PROJ_INC=-I$PROJ_INC
AC_SUBST(PROJ_INC,$PROJ_INC)
AC_DEFINE(HAVE_PROJECTS_H)
AC_DEFINE(HAVE_LIBPROJ)
else
AC_CHECK_LIB(proj,pj_init,,,-lm)
AC_CHECK_HEADERS(projects.h,,)
fi
dnl
dnl Has the user requested "incode" EPSG tables, overriding the
dnl default use of EPSG tables in csv files? Temporarily unvailable.
dnl
AC_ARG_ENABLE(incode-epsg, [ --enable-incode-epsg Use C code EPSG tables],, enable_incode_epsg=no)
if test "$enable_incode_epsg" != "yes" ; then
echo "EPSG tables will be read from .csv files."
CSV_SOURCE="\$(CSV_FILE_OBJS)"
else
echo "EPSG tables will be linked into library."
CSV_SOURCE="\$(CSV_INCODE_OBJS)"
fi
AC_SUBST(CSV_SOURCE,$CSV_SOURCE)
AC_OUTPUT(Makefile bin/Makefile)