File: pdns_with_postgresql.m4

package info (click to toggle)
pdns 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,824 kB
  • sloc: cpp: 101,240; sh: 5,616; makefile: 2,318; sql: 860; ansic: 675; python: 635; yacc: 245; perl: 161; lex: 131
file content (35 lines) | stat: -rw-r--r-- 1,177 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
dnl
dnl Attempt to detect the flags we need for the Postgresql client libraries
dnl First, use pkg-config
dnl If that yields no results, use (optionally find) pg_config and use it to
dnl determine the CFLAGS and LIBS
dnl
AC_DEFUN([PDNS_WITH_POSTGRESQL], [
  PG_CONFIG=""
  AC_ARG_WITH([pg-config],
    [AS_HELP_STRING([--with-pg-config=<path>], [path to pg_config])
  ], [
    PG_CONFIG="$withval"
    AS_IF([test "$PG_CONFIG" = "yes" -o ! -x "$PG_CONFIG"], [
      AC_MSG_ERROR([--with-pg-config must provide a valid path to the pg_config executable])
    ])
  ])

  AS_IF([test -z "$PG_CONFIG"], [
    PKG_CHECK_MODULES([PGSQL], [libpq], [ : ], [ : ])
  ])

  AS_IF([test -n "$PG_CONFIG" -o -z "$PGSQL_LIBS"], [
    dnl Either a path was provided, or pkg-config failed to produce a result
    AS_IF([test -z "$PG_CONFIG"], [
      AC_PATH_PROG([PG_CONFIG], [pg_config])
    ])
    AS_IF([test -z "$PG_CONFIG"], [
      AC_MSG_ERROR([Can not find pg_config, use --with-pg-config to specify the path to pg_config])
    ])
    PGSQL_LIBS="-L$($PG_CONFIG --libdir) -lpq"
    PGSQL_CFLAGS="-I$($PG_CONFIG --includedir)"
  ])
  AC_SUBST([PGSQL_LIBS])
  AC_SUBST([PGSQL_CFLAGS])
])