a4b11f15236415706c22adb4af353a7edc9c0860
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / libgeotiff / 0001-use-pkg-config.patch
1 Use pkg-config for libtiff detection
2
3 Using pkg-config allows proper behavior in static-only contexts: the
4 libtiff library might depend on libz and libjpeg.
5
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
8 library.
9
10 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11
12 Index: b/configure.ac
13 ===================================================================
14 --- a/configure.ac
15 +++ b/configure.ac
16 @@ -196,39 +196,12 @@
17  
18  TIFF_CONFIG="no"
19  
20 -AC_ARG_WITH(libtiff, [  --with-libtiff=dir      Use libtiff in directory dir],,)
21 -
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
26 -  else
27 -    LIBS="-L$with_libtiff -ltiff $LIBS"
28 -    TIFF_INC=-I$with_libtiff
29 -  fi
30 -  LIBS_SAVED="$LIBS"
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)
36 -  LIBS="$LIBS_SAVED"
37 -else
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)
41 -  LIBS_SAVED="$LIBS"
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)
45 -  LIBS="$LIBS -ltiff"
46 -  TIFF_INC=
47 -  TIFF_CONFIG="yes"
48 -fi
49 -
50 +PKG_CHECK_MODULES(LIBTIFF, libtiff-4)
51 +TIFF_INC="$LIBTIFF_CFLAGS"
52 +LIBS="$LIBS $LIBTIFF_LIBS"
53 +TIFF_CONFIG="yes"
54  
55  AC_SUBST([TIFF_INC])
56 -AC_SUBST([TIFF_PREFIX])
57  AM_CONDITIONAL([TIFF_IS_CONFIG], [test ! x$TIFF_CONFIG = xno])
58  
59  dnl
60 @@ -280,15 +253,16 @@
61    PROJ_INC=-I$PROJ_INC
62  
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])
68    PROJ_CONFIG="yes"
69 -
70  else
71    AC_CHECK_LIB(proj,pj_init,,,-lm)
72    AC_CHECK_HEADERS(proj_api.h,,)
73 -  PROJ_CONFIG="yes"
74 +  if "$ac_cv_lib_proj_pj_init" = "yes" -a "$ac_cv_header_proj_api_h" = "yes"; then
75 +    PROJ_CONFIG="yes"
76 +  fi
77  fi
78  
79  AM_CONDITIONAL([PROJ_IS_CONFIG], [test ! x$PROJ_CONFIG = xno])