~ubuntu-branches/ubuntu/trusty/mapnik/trusty-proposed

« back to all changes in this revision

Viewing changes to config/ax_lib_postgresql.m4

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2009-08-27 00:28:37 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090827002837-ztqzfg2rmclfh4i9
Tags: 0.6.1-0ubuntu1
* New upstream release.
* Change usr/lib to usr/lib* to enable build on 64 bits systems due to new
  configuration in SConstruct in :
  - debian/libmapnik-dev.install
  - debian/libmapnik0.6.install
  - debian/mapnik-plugin-base

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl @synopsis AX_LIB_POSTGRESQL([MINIMUM-VERSION])
2
 
dnl
3
 
dnl This macro provides tests of availability of PostgreSQL 'libpq'
4
 
dnl library of particular version or newer.
5
 
dnl
6
 
dnl AX_LIB_POSTGRESQL macro takes only one argument which is optional.
7
 
dnl If there is no required version passed, then macro does not run
8
 
dnl version test.
9
 
dnl
10
 
dnl The --with-postgresql option takes one of three possible values:
11
 
dnl
12
 
dnl no - do not check for PostgreSQL client library
13
 
dnl
14
 
dnl yes - do check for PostgreSQL library in standard locations
15
 
dnl (pg_config should be in the PATH)
16
 
dnl
17
 
dnl path - complete path to pg_config utility, use this option if
18
 
dnl pg_config can't be found in the PATH
19
 
dnl
20
 
dnl This macro calls:
21
 
dnl
22
 
dnl   AC_SUBST(POSTGRESQL_CFLAGS)
23
 
dnl   AC_SUBST(POSTGRESQL_LDFLAGS)
24
 
dnl   AC_SUBST(POSTGRESQL_VERSION)
25
 
dnl
26
 
dnl And sets:
27
 
dnl
28
 
dnl   HAVE_POSTGRESQL
29
 
dnl
30
 
dnl @category InstalledPackages
31
 
dnl @category Cxx
32
 
dnl @author Mateusz Loskot <mateusz@loskot.net>
33
 
dnl @version 2006-07-16
34
 
dnl @license AllPermissive
35
 
 
36
 
AC_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
 
])