1 Use pkg-config for libtiff detection
3 Using pkg-config allows proper behavior in static-only contexts: the
4 libtiff library might depend on libz and libjpeg.
6 This patch also fixes a few other issues in the configure.ac script
7 that prevents autoreconf to work, or proper detection of the proj
10 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13 ===================================================================
20 -AC_ARG_WITH(libtiff, [ --with-libtiff=dir Use libtiff in directory dir],,)
22 -if test "$with_libtiff" != "" ; then
23 - if test -f $with_libtiff/include/tiffio.h -a -d $with_libtiff/lib ; then
24 - LIBS="-L$with_libtiff/lib -ltiff $LIBS"
25 - TIFF_INC=-I$with_libtiff/include
27 - LIBS="-L$with_libtiff -ltiff $LIBS"
28 - TIFF_INC=-I$with_libtiff
31 - AC_CHECK_LIB(tiff,TIFFOpen,[TIFF_CONFIG=yes],
32 - AC_MSG_ERROR([failed to link with -ltiff to find TIFFOpen]),-lm)
33 - AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,[TIFF_CONFIG=yes],
34 - AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
35 -libgeotiff. Please upgrade or use an older version of libgeotiff.]),-lm)
38 - AC_CHECK_LIB(tiff,TIFFOpen,[TIFF_CONFIG=yes],
39 - AC_MSG_ERROR([You will need to substantially rewrite libxtiff to
40 -build libgeotiff without libtiff]),-lm)
42 - AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,[TIFF_CONFIG=yes],
43 - AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
44 -libgeotiff. Please upgrade libtiff or use an older version of libgeotiff.]),-lm)
50 +PKG_CHECK_MODULES(LIBTIFF, libtiff-4)
51 +TIFF_INC="$LIBTIFF_CFLAGS"
52 +LIBS="$LIBS $LIBTIFF_LIBS"
56 -AC_SUBST([TIFF_PREFIX])
57 AM_CONDITIONAL([TIFF_IS_CONFIG], [test ! x$TIFF_CONFIG = xno])
63 AC_SUBST(PROJ_INC,$PROJ_INC)
64 - AC_DEFINE(HAVE_PROJECTS_H)
65 + AC_DEFINE([HAVE_PROJECTS_H], [], [Whether proj library header is available])
66 AC_DEFINE(HAVE_LIBPROJ)
67 AC_SUBST([HAVE_LIBPROJ])
71 AC_CHECK_LIB(proj,pj_init,,,-lm)
72 AC_CHECK_HEADERS(proj_api.h,,)
74 + if "$ac_cv_lib_proj_pj_init" = "yes" -a "$ac_cv_header_proj_api_h" = "yes"; then
79 AM_CONDITIONAL([PROJ_IS_CONFIG], [test ! x$PROJ_CONFIG = xno])