1dnl 2dnl Attempt to detect the flags we need for the Postgresql client libraries 3dnl First, use pkg-config 4dnl If that yields no results, use (optionally find) pg_config and use it to 5dnl determine the CFLAGS and LIBS 6dnl 7AC_DEFUN([PDNS_WITH_POSTGRESQL], [ 8 PG_CONFIG="" 9 AC_ARG_WITH([pg-config], 10 [AS_HELP_STRING([--with-pg-config=<path>], [path to pg_config]) 11 ], [ 12 PG_CONFIG="$withval" 13 AS_IF([test "x$PG_CONFIG" = "xyes" -o ! -x "$PG_CONFIG"], [ 14 AC_MSG_ERROR([--with-pg-config must provide a valid path to the pg_config executable]) 15 ]) 16 ]) 17 18 AS_IF([test "x$PG_CONFIG" = "x"], [ 19 PKG_CHECK_MODULES([PGSQL], [libpq], [ : ], [ : ]) 20 ]) 21 22 AS_IF([test "x$PG_CONFIG" != "x" -o "x$PGSQL_LIBS" = "x"], [ 23 dnl Either a path was provided, or pkg-config failed to produce a result 24 AS_IF([test "x$PG_CONFIG" == "x"], [ 25 AC_PATH_PROG([PG_CONFIG], [pg_config]) 26 ]) 27 AS_IF([test "x$PG_CONFIG" == "x"], [ 28 AC_MSG_ERROR([Can not find pg_config, use --with-pg-config to specify the path to pg_config]) 29 ]) 30 PGSQL_LIBS="-L$($PG_CONFIG --libdir) -lpq" 31 PGSQL_CFLAGS="-I$($PG_CONFIG --includedir)" 32 ]) 33 AC_SUBST([PGSQL_LIBS]) 34 AC_SUBST([PGSQL_CFLAGS]) 35]) 36