root/trunk/config/ax_lib_postgresql.m4

Revision 524, 4.4 kB (checked in by andreas, 16 months ago)

+ added GNU autotools build environment
+ raster and gdal input isn't tested. Not working currently...
+ *-input.so plugins created. Change loader in source or link plugin to correct place
+ use pkg-config uninstalled feature

-> define project root to PKG_CONFIG_PATH to use mapnik without installation

+ added various library checks
+ don't install fonts
+ don't use included AGG

-> check for a installed libagg

+ Added Makefile for c++ demo
+ don't build any python wrapper stuff

-> this follows if all other building works

+ added Anjuta file

-> not needed to build anything, but helps much if you use Anjuta

Line 
1dnl @synopsis AX_LIB_POSTGRESQL([MINIMUM-VERSION])
2dnl
3dnl This macro provides tests of availability of PostgreSQL 'libpq'
4dnl library of particular version or newer.
5dnl
6dnl AX_LIB_POSTGRESQL macro takes only one argument which is optional.
7dnl If there is no required version passed, then macro does not run
8dnl version test.
9dnl
10dnl The --with-postgresql option takes one of three possible values:
11dnl
12dnl no - do not check for PostgreSQL client library
13dnl
14dnl yes - do check for PostgreSQL library in standard locations
15dnl (pg_config should be in the PATH)
16dnl
17dnl path - complete path to pg_config utility, use this option if
18dnl pg_config can't be found in the PATH
19dnl
20dnl This macro calls:
21dnl
22dnl   AC_SUBST(POSTGRESQL_CFLAGS)
23dnl   AC_SUBST(POSTGRESQL_LDFLAGS)
24dnl   AC_SUBST(POSTGRESQL_VERSION)
25dnl
26dnl And sets:
27dnl
28dnl   HAVE_POSTGRESQL
29dnl
30dnl @category InstalledPackages
31dnl @category Cxx
32dnl @author Mateusz Loskot <mateusz@loskot.net>
33dnl @version 2006-07-16
34dnl @license AllPermissive
35
36AC_DEFUN([AX_LIB_POSTGRESQL],
37[
38    AC_ARG_WITH([postgresql],
39        AC_HELP_STRING([--with-postgresql=@<:@ARG@:>@],
40            [use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config]
41        ),
42        [
43        if test "$withval" = "no"; then
44            want_postgresql="no"
45        elif test "$withval" = "yes"; then
46            want_postgresql="yes"
47        else
48            want_postgresql="yes"
49            PG_CONFIG="$withval"
50        fi
51        ],
52        [want_postgresql="yes"]
53    )
54
55    POSTGRESQL_CFLAGS=""
56    POSTGRESQL_LDFLAGS=""
57    POSTGRESQL_POSTGRESQL=""
58
59    dnl
60    dnl Check PostgreSQL libraries (libpq)
61    dnl
62
63    if test "$want_postgresql" = "yes"; then
64
65        if test -z "$PG_CONFIG" -o test; then
66            AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
67        fi
68
69        if test "$PG_CONFIG" != "no"; then
70            AC_MSG_CHECKING([for PostgreSQL libraries])
71
72            POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
73            POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
74
75            POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
76
77            AC_DEFINE([HAVE_POSTGRESQL], [1],
78                [Define to 1 if PostgreSQL libraries are available])
79
80            found_postgresql="yes"
81            AC_MSG_RESULT([yes])
82        else
83            found_postgresql="no"
84            AC_MSG_RESULT([no])
85        fi
86    fi
87
88    dnl
89    dnl Check if required version of PostgreSQL is available
90    dnl
91
92
93    postgresql_version_req=ifelse([$1], [], [], [$1])
94
95    if test "$found_postgresql" = "yes" -a -n "$postgresql_version_req"; then
96
97        AC_MSG_CHECKING([if PostgreSQL version is >= $postgresql_version_req])
98
99        dnl Decompose required version string of PostgreSQL
100        dnl and calculate its number representation
101        postgresql_version_req_major=`expr $postgresql_version_req : '\([[0-9]]*\)'`
102        postgresql_version_req_minor=`expr $postgresql_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
103        postgresql_version_req_micro=`expr $postgresql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
104        if test "x$postgresql_version_req_micro" = "x"; then
105            postgresql_version_req_micro="0"
106        fi
107
108        postgresql_version_req_number=`expr $postgresql_version_req_major \* 1000000 \
109                                   \+ $postgresql_version_req_minor \* 1000 \
110                                   \+ $postgresql_version_req_micro`
111
112        dnl Decompose version string of installed PostgreSQL
113        dnl and calculate its number representation
114        postgresql_version_major=`expr $POSTGRESQL_VERSION : '\([[0-9]]*\)'`
115        postgresql_version_minor=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
116        postgresql_version_micro=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
117        if test "x$postgresql_version_micro" = "x"; then
118            postgresql_version_micro="0"
119        fi
120
121        postgresql_version_number=`expr $postgresql_version_major \* 1000000 \
122                                   \+ $postgresql_version_minor \* 1000 \
123                                   \+ $postgresql_version_micro`
124
125        postgresql_version_check=`expr $postgresql_version_number \>\= $postgresql_version_req_number`
126        if test "$postgresql_version_check" = "1"; then
127            AC_MSG_RESULT([yes])
128        else
129            AC_MSG_RESULT([no])
130        fi
131    fi
132
133    AC_SUBST([POSTGRESQL_VERSION])
134    AC_SUBST([POSTGRESQL_CFLAGS])
135    AC_SUBST([POSTGRESQL_LDFLAGS])
136])
Note: See TracBrowser for help on using the browser.