1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.61)
5AC_INIT(libgaiagraphics, 0.5, a.furieri @ lqt.it)
6AC_LANG(C)
7AC_CONFIG_AUX_DIR([.])
8AC_CONFIG_MACRO_DIR([m4])
9
10AM_INIT_AUTOMAKE
11AM_MAINTAINER_MODE
12
13# Checks for header files.
14AC_CHECK_HEADERS(stdlib.h,, [AC_MSG_ERROR([cannot find stdlib.h, bailing out])])
15AC_CHECK_HEADERS(stdio.h,,[AC_MSG_ERROR([cannot find stdio.h, bailing out])])
16AC_CHECK_HEADERS(string.h,, [AC_MSG_ERROR([cannot find string.h, bailing out])])
17AC_CHECK_HEADERS(memory.h,, [AC_MSG_ERROR([cannot find memory.h, bailing out])])
18AC_CHECK_HEADERS(math.h,,[AC_MSG_ERROR([cannot find math.h, bailing out])])
19AC_CHECK_HEADERS(float.h,,[AC_MSG_ERROR([cannot find float.h, bailing out])])
20AC_CHECK_HEADERS(fcntl.h,,[AC_MSG_ERROR([cannot find fcntl.h, bailing out])])
21AC_CHECK_HEADERS(inttypes.h,, [AC_MSG_ERROR([cannot find inttypes.h, bailing out])])
22AC_CHECK_HEADERS(stddef.h,, [AC_MSG_ERROR([cannot find stddef.h, bailing out])])
23AC_CHECK_HEADERS(stdint.h,, [AC_MSG_ERROR([cannot find stdint.h, bailing out])])
24AC_CHECK_HEADERS(sys/time.h,, [AC_MSG_ERROR([cannot find sys/time.h, bailing out])])
25AC_CHECK_HEADERS(unistd.h,, [AC_MSG_ERROR([cannot find unistd.h, bailing out])])
26AC_CHECK_HEADERS(jpeglib.h,, [AC_MSG_ERROR([cannot find jpeglib.h, bailing out])])
27AC_CHECK_HEADERS(jerror.h,, [AC_MSG_ERROR([cannot find jerror.h, bailing out])])
28
29#
30# testing GeoTiff headers
31# on some systems they are located on -/include
32# on other systems they are on -/include/geotiff
33# or even on -/include/libgeotiff
34#
35# this patch was kindly contributed by Brad Hards
36# 2011-09-02
37#
38AC_CHECK_HEADERS(geotiff/geotiff.h)
39AC_CHECK_HEADERS(libgeotiff/geotiff.h)
40AC_CHECK_HEADERS(geotiff.h)
41if test x"$ac_cv_header_geotiff_geotiff_h" != x"yes" &&
42    test x"$ac_cv_header_libgeotiff_geotiff_h" != x"yes" &&
43    test x"$ac_cv_header_geotiff_h" != x"yes";
44then
45    AC_MSG_ERROR(['libgeotiff' is required but the header (geotiff.h) doesn't seem to be installed on this system])
46fi
47
48# Checks for programs.
49AC_PROG_CXX
50AC_PROG_CC
51AC_PROG_CPP
52AC_PROG_INSTALL
53AC_PROG_LN_S
54AC_PROG_MAKE_SET
55AC_LIBTOOL_WIN32_DLL
56AC_PROG_LIBTOOL
57
58# Checks for typedefs, structures, and compiler characteristics.
59AC_C_CONST
60AC_TYPE_OFF_T
61AC_TYPE_SIZE_T
62AC_HEADER_TIME
63AC_STRUCT_TM
64AC_C_VOLATILE
65
66# Checks for library functions.
67AC_FUNC_LSTAT
68AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
69AC_FUNC_MEMCMP
70AC_FUNC_STAT
71AC_FUNC_STRFTIME
72AC_CHECK_FUNCS([memset sqrt strcasecmp strerror strncasecmp strstr fdatasync ftruncate getcwd gettimeofday localtime_r memmove strerror])
73
74# Checks for installed libraries
75AC_CHECK_LIB(z,inflateInit_,,AC_MSG_ERROR(['libz' is required but it doesn't seems to be installed on this system.]),-lm)
76AC_CHECK_LIB(jpeg,jpeg_start_compress,,AC_MSG_ERROR(['libjpeg' is required but it doesn't seems to be installed on this system.]),-lm)
77AC_CHECK_LIB(tiff,TIFFClientOpen,,AC_MSG_ERROR(['libtiff' is required but it doesn't seems to be installed on this system.]),-lm)
78AC_CHECK_LIB(proj,pj_init_plus,,AC_MSG_ERROR(['libproj' is required but it doesn't seems to be installed on this system.]),-lm)
79AC_CHECK_LIB(geotiff,GTIFSetFromProj4,,AC_MSG_ERROR(['libgeotiff' [>= v.1.2.5] is required but it doesn't seems to be installed on this system.]),-lm)
80
81PKG_CHECK_MODULES([LIBPNG], [libpng], , AC_MSG_ERROR(['libpng' is required but it doesn't seems to be installed on this system.]))
82AC_SUBST(LIBPNG_CFLAGS)
83AC_SUBST(LIBPNG_LIBS)
84
85PKG_CHECK_MODULES([LIBCAIRO], [cairo], , AC_MSG_ERROR(['libcairo' is required but it doesn't seems to be installed on this system.]))
86AC_SUBST(LIBCAIRO_CFLAGS)
87AC_SUBST(LIBCAIRO_LIBS)
88
89PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], , AC_MSG_ERROR(['libxml2' is required but it doesn't seem to be installed on this system.]))
90  AC_SUBST(LIBXML2_CFLAGS)
91  AC_SUBST(LIBXML2_LIBS)
92
93AC_CONFIG_FILES([Makefile \
94		headers/Makefile \
95		src/Makefile \
96		gaiagraphics.pc])
97
98# Checking for MinGW
99AM_CONDITIONAL([MINGW], [test "$target_alias" = "mingw32"])
100
101AC_OUTPUT
102